Added other punctuation

This commit is contained in:
Scarlett
2025-02-11 15:32:31 -05:00
parent 9091b65a30
commit 9c67da0348
6 changed files with 17 additions and 27 deletions

View File

@ -10,8 +10,6 @@ DIGIT [0-9]
CHAR \\n|\\t|\\'|[^'\n\t\\]
SCHAR \\n|\\t|\\\"|[^\"\n\\]
COM ([^*]|\*+[^)*])*
/* INCOMPLETE */
ID [A-Za-z_][0-9A-Za-z_]*
%%
@ -34,7 +32,10 @@ ID [A-Za-z_][0-9A-Za-z_]*
"external" {printf("EXTERNAL %s, Token: %d\n", yytext, EXTERNAL);} // {return EXTERNAL}
"as" {printf("AS %s, Token: %d\n", yytext, AS);} // {return AS}
{ID} {printf("ID: %s, Token: %d\n", yytext, ID );} // INCOMPLETE
";" {printf("SEMI_COLON %s, Token: %d\n", yytext, SEMI_COLON);}
":" {printf("COLON %s, Token: %d\n", yytext, COLON);}
"," {printf("COMMA %s, Token: %d\n", yytext, COMMA);}
"->" {printf("ARROW %s, Token: %d\n", yytext, ARROW);}
{DIGIT}+ {printf("C_INTEGER: %s, Token: %d\n", yytext, atoi( yytext ) );}
"null" {printf("C_NULL: %s, Token: %d\n", yytext, atoi( yytext ) );}
@ -42,6 +43,9 @@ ID [A-Za-z_][0-9A-Za-z_]*
"true" {printf("C_TRUE: %s, Token: %d\n", yytext, atoi( yytext ) );}
"false" {printf("C_FALSE: %s, Token: %d\n", yytext, atoi( yytext ) );}
\"{SCHAR}*\" {printf("C_STRING: %s, Token: %d\n", yytext, atoi( yytext ) );}
{ID} {printf("ID: %s, Token: %d\n", yytext, ID);}
.|\n
%%