aboutsummaryrefslogblamecommitdiffstats
path: root/libcmd/cmd_parse.c
blob: 9d831cfca5fc85fc028fb4bd980b2945115209e3 (plain) (tree)
1
2
3
4
5
6
7
8
9








                                                                                                                   

                                                                        
 



















                                                      
                      
                                    



                                 


                                        

                                    


                                       
                                        







                                          


                                           
                                
            


                                          

                                


                                          

                                    


                                     
                                





                                   


                                        

                                


                                          

                                    


                                             

                                


                                               

                                


                                      

                                    

  

                                     

                               
                                 

 
                          

 
                                                                


                                 
                                            
                                                  
                                                                   

                          


                                    
                                                       
 




                                       
                       






                       
                          
        
                       















                                                           
               


                 
                       
































































                                                                            
               


                   



                          
               

                          

               



                          
                          
                                                                       
              
               
                          
                                                                           
              
               
                          
                                                                         

               
                          

                                                                         
                

                               

                                                                           
              




                                                                           



              
                       











                                                         
                       


















                                                
                          


                              
                                                                                 









                         

#line 1 "cmd_parse.ragel"
#include "cmd_parse.h"

//#define CTS(X) {if (!dm_current_tok)token_s = p; printf("%s ",#X);if (!dm_current_tok) dm_current_tok = TOK_##X;}
//#define CTE() {token_e = p;}
#define TADD(T,S,E,SZ) {cmd_tok_t *t=cmd_tok_create(S,E,SZ,T);cmd_tok_add(tl,t);tl=tl->next;}
//#define TADD(T,S,E)

//#define PR_TK_DBG(S) printf(S);fwrite(ts,1,te-ts,stdout);printf("\n");
#define PR_TK_DBG(S) ;

char *new_string( const char *start, const char *end )
{
	int str_s = end-start+1;
	char *new_str=malloc( str_s+1 );
	memcpy( new_str, start, str_s );
	if ( new_str != NULL )
		new_str[str_s]=0x0;
	return new_str;
}

int print_token( char *s, char *e, int tok)
{
	char *p = new_string( s, e );
	printf("t=%d,p=%s\n",tok,p);
	free( p );
	return 0;
}



#line 34 "cmd_parse.c"
static const char _cmd_actions[] = {
	0, 1, 0, 1, 1, 1, 6, 1, 
	7, 1, 8, 1, 9, 1, 10, 2, 
	2, 3, 2, 2, 4, 2, 2, 5
	
};

static const char _cmd_key_offsets[] = {
	0, 0, 3, 6, 18, 21, 28, 38, 
	46, 53
};

static const char _cmd_trans_keys[] = {
	34, 39, 92, 32, 34, 92, 32, 34, 
	46, 48, 9, 10, 33, 47, 49, 57, 
	58, 126, 33, 35, 126, 33, 35, 47, 
	48, 57, 58, 126, 33, 46, 98, 120, 
	35, 47, 48, 57, 58, 126, 33, 46, 
	35, 47, 48, 57, 58, 126, 33, 35, 
	47, 48, 49, 50, 126, 33, <