summaryrefslogtreecommitdiff
path: root/test/ragel.d/cond6.rl
diff options
context:
space:
mode:
Diffstat (limited to 'test/ragel.d/cond6.rl')
-rw-r--r--test/ragel.d/cond6.rl60
1 files changed, 0 insertions, 60 deletions
diff --git a/test/ragel.d/cond6.rl b/test/ragel.d/cond6.rl
deleted file mode 100644
index 4d66956f..00000000
--- a/test/ragel.d/cond6.rl
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * @LANG: c++
- */
-
-/* Balanced parenthesis with conditions. */
-
-#include <iostream>
-#include <string.h>
-using std::cout;
-using std::endl;
-
-%%{
- machine cond;
- write data noerror;
-}%%
-
-void test( const char *str )
-{
- int cs = cond_start, n = 0;
- const char *p = str;
- const char *pe = str + strlen( str );
-
- %%{
- comment = '(' @{n=0;}
- ( '('@{n++;} | ')'@{n--;} | [^()] )*
- :> ')' when{!n};
-
- main := ' '* comment ' '* '\n' @{cout << "success";};
-
- write exec;
- }%%
- if ( cs < cond_first_final )
- cout << "failure";
- cout << endl;
-}
-
-int main()
-{
- test( "( ( )\n" );
- test( "()()\n" );
- test( "(((\n" );
- test( "((()\n" );
- test( "((())\n" );
- test( "()\n" );
- test( "((()))\n" );
- test( "(()())\n" );
- test( "((())()(((()))))\n" );
- return 0;
-}
-
-##### OUTPUT #####
-failure
-failure
-failure
-failure
-failure
-success
-success
-success
-success