diff --git a/src/lex/lexer.l b/src/lex/lexer.l index a932b11..359ac96 100644 --- a/src/lex/lexer.l +++ b/src/lex/lexer.l @@ -1,6 +1,7 @@ %option noyywrap %{ #include + #include int yyLineNumber = 1; int yylex(); @@ -16,69 +17,69 @@ %% "\n" yyLineNumber++; -":" return(':'); -"=" return('='); -"+" return('+'); -"-" return('-'); -"*" return('*'); -"/" return('/'); -"," return(','); -";" return(';'); -"." return('.'); -"#" return('#'); +":" {DEBUG("\"%s\" tokenized with \':\'", yytext); return(':');}; +"=" {DEBUG("\"%s\" tokenized with \'=\'", yytext); return('=');}; +"+" {DEBUG("\"%s\" tokenized with \'+\'", yytext); return('+');}; +"-" {DEBUG("\"%s\" tokenized with \'-\'", yytext); return('-');}; +"*" {DEBUG("\"%s\" tokenized with \'*\'", yytext); return('*');}; +"/" {DEBUG("\"%s\" tokenized with \'/\'", yytext); return('/');}; +"," {DEBUG("\"%s\" tokenized with \',\'", yytext); return(',');}; +";" {DEBUG("\"%s\" tokenized with \';\'", yytext); return(';');}; +"." {DEBUG("\"%s\" tokenized with \'.\'", yytext); return('.');}; +"#" {DEBUG("\"%s\" tokenized with \'#\'", yytext); return('#');}; -"(" return('('); -")" return(')'); -"[" return('['); -"]" return(']'); -"{" return('{'); -"}" return('}'); -">" return('>'); -"<" return('<'); +"(" {DEBUG("\"%s\" tokenized with \'(\'", yytext); return('(');}; +")" {DEBUG("\"%s\" tokenized with \')\'", yytext); return(')');}; +"[" {DEBUG("\"%s\" tokenized with \'[\'", yytext); return('[');}; +"]" {DEBUG("\"%s\" tokenized with \']\'", yytext); return(']');}; +"{" {DEBUG("\"%s\" tokenized with \'{\'", yytext); return('{');}; +"}" {DEBUG("\"%s\" tokenized with \'}\'", yytext); return('}');}; +">" {DEBUG("\"%s\" tokenized with \'>\'", yytext); return('>');}; +"<" {DEBUG("\"%s\" tokenized with \'<\'", yytext); return('<');}; -"int" return(KeyInt); -"float" return(KeyFloat); -"as" return (KeyAs); -"short" return(KeyShort); -"long" return(KeyLong); -"half" return(KeyHalf); -"double" return(KeyDouble); -"signed" return(KeySigned); -"unsigned" return(Keyunsigned); -"ref" return(KeyRef); -"type" return(KeyType); -"local" return(KeyLocal); -"global" return(KeyGlobal); -"static" return(KeyStatic); -"if" return(KeyIf); -"else" return(KeyElse); -"while" return(KeyWhile); -"in" return(KeyIn); -"out" return(KeyOut); -"fun" return(KeyFun); -"==" return(OpEquals); -"&&" return(OpAnd); -"||" return(OpOr); -"!!" return(OpNot); -"^^" return(OpXor); -"&" return(OpBitand); -"|" return(OpBitor); -"!" return(OpBitnot); -"^" return(OpBitxor); -"import" return(KeyImport); -"silent" return(KeySilent); -"box" return(KeyBox); -"typeof" return(FunTypeof); -"sizeof" return(FunSizeof); -"filename" return(FunFilename); -"funname" return(FunFunname); -"lineno" return(FunLineno); -"extsupport" return(FunExtsupport); +"int" {DEBUG("\"%s\" tokenized with \'