changed Keyword for unsigned
added debug message for lexer
This commit is contained in:
parent
d6eaf6debf
commit
853bf09c96
123
src/lex/lexer.l
123
src/lex/lexer.l
|
@ -1,6 +1,7 @@
|
||||||
%option noyywrap
|
%option noyywrap
|
||||||
%{
|
%{
|
||||||
#include <yacc/parser.tab.h>
|
#include <yacc/parser.tab.h>
|
||||||
|
#include <sys/log.h>
|
||||||
|
|
||||||
int yyLineNumber = 1;
|
int yyLineNumber = 1;
|
||||||
int yylex();
|
int yylex();
|
||||||
|
@ -16,69 +17,69 @@
|
||||||
%%
|
%%
|
||||||
"\n" yyLineNumber++;
|
"\n" yyLineNumber++;
|
||||||
|
|
||||||
":" return(':');
|
":" {DEBUG("\"%s\" tokenized with \':\'", yytext); return(':');};
|
||||||
"=" return('=');
|
"=" {DEBUG("\"%s\" tokenized with \'=\'", yytext); return('=');};
|
||||||
"+" return('+');
|
"+" {DEBUG("\"%s\" tokenized with \'+\'", yytext); return('+');};
|
||||||
"-" return('-');
|
"-" {DEBUG("\"%s\" tokenized with \'-\'", yytext); return('-');};
|
||||||
"*" return('*');
|
"*" {DEBUG("\"%s\" tokenized with \'*\'", yytext); return('*');};
|
||||||
"/" return('/');
|
"/" {DEBUG("\"%s\" tokenized with \'/\'", yytext); return('/');};
|
||||||
"," return(',');
|
"," {DEBUG("\"%s\" tokenized with \',\'", yytext); return(',');};
|
||||||
";" return(';');
|
";" {DEBUG("\"%s\" tokenized with \';\'", yytext); return(';');};
|
||||||
"." return('.');
|
"." {DEBUG("\"%s\" tokenized with \'.\'", yytext); return('.');};
|
||||||
"#" return('#');
|
"#" {DEBUG("\"%s\" tokenized with \'#\'", yytext); return('#');};
|
||||||
|
|
||||||
"(" return('(');
|
"(" {DEBUG("\"%s\" tokenized with \'(\'", yytext); return('(');};
|
||||||
")" return(')');
|
")" {DEBUG("\"%s\" tokenized with \')\'", yytext); return(')');};
|
||||||
"[" return('[');
|
"[" {DEBUG("\"%s\" tokenized with \'[\'", yytext); return('[');};
|
||||||
"]" return(']');
|
"]" {DEBUG("\"%s\" tokenized with \']\'", yytext); return(']');};
|
||||||
"{" return('{');
|
"{" {DEBUG("\"%s\" tokenized with \'{\'", yytext); return('{');};
|
||||||
"}" return('}');
|
"}" {DEBUG("\"%s\" tokenized with \'}\'", yytext); return('}');};
|
||||||
">" return('>');
|
">" {DEBUG("\"%s\" tokenized with \'>\'", yytext); return('>');};
|
||||||
"<" return('<');
|
"<" {DEBUG("\"%s\" tokenized with \'<\'", yytext); return('<');};
|
||||||
|
|
||||||
"int" return(KeyInt);
|
"int" {DEBUG("\"%s\" tokenized with \'<KeyInt'", yytext); return(KeyInt);};
|
||||||
"float" return(KeyFloat);
|
"float" {DEBUG("\"%s\" tokenized with \'KeyFloat\'", yytext); return(KeyFloat);};
|
||||||
"as" return (KeyAs);
|
"as" {DEBUG("\"%s\" tokenized with \'<KeyAs'", yytext); return (KeyAs);};
|
||||||
"short" return(KeyShort);
|
"short" {DEBUG("\"%s\" tokenized with \'KeyShort\'", yytext); return(KeyShort);};
|
||||||
"long" return(KeyLong);
|
"long" {DEBUG("\"%s\" tokenized with \'KeyLong\'", yytext); return(KeyLong);};
|
||||||
"half" return(KeyHalf);
|
"half" {DEBUG("\"%s\" tokenized with \'KeyHalf\'", yytext); return(KeyHalf);};
|
||||||
"double" return(KeyDouble);
|
"double" {DEBUG("\"%s\" tokenized with \'KeyDouble\'", yytext); return(KeyDouble);};
|
||||||
"signed" return(KeySigned);
|
"signed" {DEBUG("\"%s\" tokenized with \'KeySigned\'", yytext); return(KeySigned);};
|
||||||
"unsigned" return(Keyunsigned);
|
"unsigned" {DEBUG("\"%s\" tokenized with \'KeyUnsigned\'", yytext); return(KeyUnsigned);};
|
||||||
"ref" return(KeyRef);
|
"ref" {DEBUG("\"%s\" tokenized with \'KeyRef\'", yytext); return(KeyRef);};
|
||||||
"type" return(KeyType);
|
"type" {DEBUG("\"%s\" tokenized with \'KeyType\'", yytext); return(KeyType);};
|
||||||
"local" return(KeyLocal);
|
"local" {DEBUG("\"%s\" tokenized with \'KeyLocal\'", yytext); return(KeyLocal);};
|
||||||
"global" return(KeyGlobal);
|
"global" {DEBUG("\"%s\" tokenized with \'KeyGlobal\'", yytext); return(KeyGlobal);};
|
||||||
"static" return(KeyStatic);
|
"static" {DEBUG("\"%s\" tokenized with \'KeyStatic\'", yytext); return(KeyStatic);};
|
||||||
"if" return(KeyIf);
|
"if" {DEBUG("\"%s\" tokenized with \'KeyIf\'", yytext); return(KeyIf);};
|
||||||
"else" return(KeyElse);
|
"else" {DEBUG("\"%s\" tokenized with \'KeyElse\'", yytext); return(KeyElse);};
|
||||||
"while" return(KeyWhile);
|
"while" {DEBUG("\"%s\" tokenized with \'KeyWhile\'", yytext); return(KeyWhile);};
|
||||||
"in" return(KeyIn);
|
"in" {DEBUG("\"%s\" tokenized with \'KeyIn\'", yytext); return(KeyIn);};
|
||||||
"out" return(KeyOut);
|
"out" {DEBUG("\"%s\" tokenized with \'KeyOut\'", yytext); return(KeyOut);};
|
||||||
"fun" return(KeyFun);
|
"fun" {DEBUG("\"%s\" tokenized with \'KeyFun\'", yytext); return(KeyFun);};
|
||||||
"==" return(OpEquals);
|
"==" {DEBUG("\"%s\" tokenized with \'OpEquals\'", yytext); return(OpEquals);};
|
||||||
"&&" return(OpAnd);
|
"&&" {DEBUG("\"%s\" tokenized with \'OpAnd\'", yytext); return(OpAnd);};
|
||||||
"||" return(OpOr);
|
"||" {DEBUG("\"%s\" tokenized with \'OpOr\'", yytext); return(OpOr);};
|
||||||
"!!" return(OpNot);
|
"!!" {DEBUG("\"%s\" tokenized with \'OpNot\'", yytext); return(OpNot);};
|
||||||
"^^" return(OpXor);
|
"^^" {DEBUG("\"%s\" tokenized with \'OpXor\'", yytext); return(OpXor);};
|
||||||
"&" return(OpBitand);
|
"&" {DEBUG("\"%s\" tokenized with \'OpBitand\'", yytext); return(OpBitand);};
|
||||||
"|" return(OpBitor);
|
"|" {DEBUG("\"%s\" tokenized with \'OpBitor\'", yytext); return(OpBitor);};
|
||||||
"!" return(OpBitnot);
|
"!" {DEBUG("\"%s\" tokenized with \'OpBitnot\'", yytext); return(OpBitnot);};
|
||||||
"^" return(OpBitxor);
|
"^" {DEBUG("\"%s\" tokenized with \'OpBitxor\'", yytext); return(OpBitxor);};
|
||||||
"import" return(KeyImport);
|
"import" {DEBUG("\"%s\" tokenized with \'KeyImport\'", yytext); return(KeyImport);};
|
||||||
"silent" return(KeySilent);
|
"silent" {DEBUG("\"%s\" tokenized with \'KeySilent\'", yytext); return(KeySilent);};
|
||||||
"box" return(KeyBox);
|
"box" {DEBUG("\"%s\" tokenized with \'KeyBox\'", yytext); return(KeyBox);};
|
||||||
"typeof" return(FunTypeof);
|
"typeof" {DEBUG("\"%s\" tokenized with \'FunTypeof\'", yytext); return(FunTypeof);};
|
||||||
"sizeof" return(FunSizeof);
|
"sizeof" {DEBUG("\"%s\" tokenized with \'FunSizeof\'", yytext); return(FunSizeof);};
|
||||||
"filename" return(FunFilename);
|
"filename" {DEBUG("\"%s\" tokenized with \'FunFilename\'", yytext); return(FunFilename);};
|
||||||
"funname" return(FunFunname);
|
"funname" {DEBUG("\"%s\" tokenized with \'FunFunname\'", yytext); return(FunFunname);};
|
||||||
"lineno" return(FunLineno);
|
"lineno" {DEBUG("\"%s\" tokenized with \'FunLineno\'", yytext); return(FunLineno);};
|
||||||
"extsupport" return(FunExtsupport);
|
"extsupport" {DEBUG("\"%s\" tokenized with \'FunExtsupport\'", yytext); return(FunExtsupport);};
|
||||||
|
|
||||||
[a-zA-Z_]+ { yylval.string = strdup(yytext); return(Ident); };
|
[a-zA-Z_]+ {DEBUG("\"%s\" tokenized with \'Ident\'", yytext); yylval.string = strdup(yytext); return(Ident); };
|
||||||
[0-9]+ { yylval.string = strdup(yytext); return(ValInt); };
|
[0-9]+ {DEBUG("\"%s\" tokenized with \'ValInt\'", yytext); yylval.string = strdup(yytext); return(ValInt); };
|
||||||
\"([^\"\n])*\" {yylval.string = strdup(yytext); return(ValStr);};
|
\"([^\"\n])*\" {DEBUG("\"%s\" tokenized with \'ValStr\'", yytext); yylval.string = strdup(yytext); return(ValStr);};
|
||||||
\"\"\"([^\"\n]|\\\n)*\"\"\" {yylval.string = strdup(yytext); return(ValMultistr);};
|
\"\"\"([^\"\n]|\\\n)*\"\"\" {DEBUG("\"%s\" tokenized with \'ValMultistr\'", yytext); yylval.string = strdup(yytext); return(ValMultistr);};
|
||||||
[0-9]*\.[0-9]+ {yylval.string = strdup(yytext); return(ValFloat);};
|
[0-9]*\.[0-9]+ {DEBUG("\"%s\" tokenized with \'ValFloat\'", yytext); yylval.string = strdup(yytext); return(ValFloat);};
|
||||||
.;
|
.;
|
||||||
%%
|
%%
|
||||||
|
|
|
@ -24,7 +24,7 @@
|
||||||
%token KeyHalf
|
%token KeyHalf
|
||||||
%token KeyDouble
|
%token KeyDouble
|
||||||
%token KeySigned
|
%token KeySigned
|
||||||
%token Keyunsigned
|
%token KeyUnsigned
|
||||||
%token KeyRef
|
%token KeyRef
|
||||||
%token KeyType
|
%token KeyType
|
||||||
%token KeyLocal
|
%token KeyLocal
|
||||||
|
|
Loading…
Reference in New Issue