parser.c
changeset 9 bdf20e6eefd7
parent 2 8c88756f81b0
child 11 9aa5114326e8
equal deleted inserted replaced
8:8d0f25ef038e 9:bdf20e6eefd7
     1 
     1 
     2 /* #line 1 "parser.rl" */
     2 #line 1 "parser.rl"
     3 /* vim: set noet nosta sw=4 ts=4 ft=ragel : */
     3 /* vim: set noet nosta sw=4 ts=4 ft=ragel : */
     4 /*
     4 /*
     5 Copyright (c) 2011, Mahlon E. Smith <mahlon@martini.nu>
     5 Copyright (c) 2011, Mahlon E. Smith <mahlon@martini.nu>
     6 All rights reserved.
     6 All rights reserved.
     7 Redistribution and use in source and binary forms, with or without
     7 Redistribution and use in source and binary forms, with or without
    58 */
    58 */
    59 
    59 
    60 #include "volta.h"
    60 #include "volta.h"
    61 
    61 
    62 
    62 
    63 /* #line 80 "parser.rl" */
    63 #line 80 "parser.rl"
    64 
    64 
    65 
    65 
    66 /* #line 67 "parser.c" */
    66 #line 67 "parser.c"
    67 static const int redirector_start = 1;
    67 static const int redirector_start = 1;
    68 static const int redirector_first_final = 13;
    68 static const int redirector_first_final = 13;
    69 static const int redirector_error = 0;
    69 static const int redirector_error = 0;
    70 
    70 
    71 static const int redirector_en_main = 1;
    71 static const int redirector_en_main = 1;
    72 
    72 
    73 
    73 
    74 /* #line 82 "parser.rl" */
    74 #line 82 "parser.rl"
    75 
    75 
    76 /*
    76 /*
    77 %%{
    77 %%{
    78 	machine redirector;
    78 	machine redirector;
    79 
    79 
   131 	/* initalize state machine with current line */
   131 	/* initalize state machine with current line */
   132 	char *pe = p + strlen(p) + 1;
   132 	char *pe = p + strlen(p) + 1;
   133 
   133 
   134 	/* enter state machine */
   134 	/* enter state machine */
   135 	
   135 	
   136 /* #line 137 "parser.c" */
   136 #line 137 "parser.c"
   137 	{
   137 	{
   138 	cs = redirector_start;
   138 	cs = redirector_start;
   139 	}
   139 	}
   140 
   140 
   141 /* #line 143 "parser.rl" */
   141 #line 143 "parser.rl"
   142 	
   142 	
   143 /* #line 144 "parser.c" */
   143 #line 144 "parser.c"
   144 	{
   144 	{
   145 	if ( p == pe )
   145 	if ( p == pe )
   146 		goto _test_eof;
   146 		goto _test_eof;
   147 	switch ( cs )
   147 	switch ( cs )
   148 	{
   148 	{
   201 case 6:
   201 case 6:
   202 	if ( (*p) == 47 )
   202 	if ( (*p) == 47 )
   203 		goto tr7;
   203 		goto tr7;
   204 	goto st0;
   204 	goto st0;
   205 tr7:
   205 tr7:
   206 /* #line 68 "parser.rl" */
   206 #line 68 "parser.rl"
   207 	{
   207 	{
   208 		printf( "I saw: %s", p+1 );
   208 		printf( "I saw: %s", p+1 );
   209 	}
   209 	}
   210 	goto st7;
   210 	goto st7;
   211 st7:
   211 st7:
   212 	if ( ++p == pe )
   212 	if ( ++p == pe )
   213 		goto _test_eof7;
   213 		goto _test_eof7;
   214 case 7:
   214 case 7:
   215 /* #line 216 "parser.c" */
   215 #line 216 "parser.c"
   216 	switch( (*p) ) {
   216 	switch( (*p) ) {
   217 		case 10: goto st13;
   217 		case 10: goto st13;
   218 		case 43: goto st8;
   218 		case 43: goto st8;
   219 		case 95: goto st8;
   219 		case 95: goto st8;
   220 	}
   220 	}
   312 
   312 
   313 	_test_eof: {}
   313 	_test_eof: {}
   314 	_out: {}
   314 	_out: {}
   315 	}
   315 	}
   316 
   316 
   317 /* #line 144 "parser.rl" */
   317 #line 144 "parser.rl"
   318 
   318 
   319 	/* reset the request */
   319 	/* reset the request */
   320 	/* c_request = reset_request; */
   320 	/* c_request = reset_request; */
   321 	return( cp_request );
   321 	return( cp_request );
   322 }
   322 }