summaryrefslogtreecommitdiff
path: root/test/ragel.d/recdescent5.rl
diff options
context:
space:
mode:
authorAdrian Thurston <thurston@colm.net>2020-03-08 23:29:57 +0200
committerAdrian Thurston <thurston@colm.net>2020-03-08 23:53:25 +0200
commit78e7949ca590b273c2c152a0abe0d51e590a52fd (patch)
treec253c852aec77af8a04c24d921d8657ff29c4101 /test/ragel.d/recdescent5.rl
parent5718c319424a21b64e1b50dbb6aae644715b9e85 (diff)
downloadcolm-78e7949ca590b273c2c152a0abe0d51e590a52fd.tar.gz
remove the ragel tests, export runtests for use by ragel
Diffstat (limited to 'test/ragel.d/recdescent5.rl')
-rw-r--r--test/ragel.d/recdescent5.rl116
1 files changed, 0 insertions, 116 deletions
diff --git a/test/ragel.d/recdescent5.rl b/test/ragel.d/recdescent5.rl
deleted file mode 100644
index c6daa86c..00000000
--- a/test/ragel.d/recdescent5.rl
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- * @LANG: java
- */
-
-class recdescent5
-{
- %%{
- machine recdescent;
-
- prepush {
- if ( top == stack_size ) {
- System.out.print( "growing stack\n" );
- stack_size = top * 2;
- // Don't actually bother to resize here, but we do print messages.
- //stack = (int*)realloc( stack, sizeof(int)*stack_size );
- }
- }
-
- postpop {
- if ( stack_size > (top * 4) ) {
- stack_size = top * 2;
- // Don't actually bother to resize here, but we do print messages.
- //stack = (int*)realloc( stack, sizeof(int)*stack_size );
- System.out.print( "shrinking stack\n" );
- }
- }
-
- action item_start { item = p; }
-
- action item_finish
- {
- String item_data = new String ( data, item, p-item );
- System.out.print( "item: " );
- System.out.print( item_data );
- System.out.print( "\n" );
- }
-
- action call_main
- {
- System.out.print( "calling main\n" );
- fncall main;
- }
-
- action return_main
- {
- if ( top == 0 ) {
- System.out.print( "STRAY CLOSE\n" );
- fnbreak;
- }
- else {
- System.out.print( "returning from main\n" );
- fhold;
- fnret;
- }
- }
-
- id = [a-zA-Z_]+;
- number = [0-9]+;
- ws = [ \t\n]+;
-
- main := (
- ws |
- ( number | id ) >item_start %item_finish |
-
- '{' @call_main '}' |
-
- '}' @return_main
- )**;
- }%%
-
- %% write data;
-
- static void test( char data[] )
- {
- int cs, p = 0, pe = data.length, eof = data.length, item = 0;
- int stack[] = new int[1024];
- int stack_size = 1;
- int top;
-
- %% write init;
- %% write exec;
-
- if ( cs == recdescent_error )
- System.out.println( "SCANNER ERROR" );
- }
-
- public static void main( String args[] )
- {
- test( "88 foo { 99 {{{{}}}}{ } }".toCharArray() );
- test( "76 } sadf".toCharArray() );
- }
-}
-
-##### OUTPUT #####
-item: 88
-item: foo
-calling main
-item: 99
-calling main
-growing stack
-calling main
-growing stack
-calling main
-calling main
-growing stack
-returning from main
-returning from main
-returning from main
-returning from main
-shrinking stack
-calling main
-returning from main
-returning from main
-shrinking stack
-item: 76
-STRAY CLOSE