X-Git-Url: https://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/c190a2ae41238682c1430b8482683b6a7c15c66b..refs/tags/v0.0.3:/src/lexer.l diff --git a/src/lexer.l b/src/lexer.l index 92454f2..5f9f742 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -20,9 +20,10 @@ */ %{ +#include "config.h" #include -#include "y.tab.h" +#include "parse.h" static int parenth_depth = 0; static int before_comment = INITIAL; @@ -30,6 +31,7 @@ static int class_after_c = FALSE; static int header_c = FALSE; static GString *cbuf = NULL; +int ccode_line = 1; int line_no = 1; @@ -75,6 +77,7 @@ add_to_cbuf(char *s) \/\* {BEGIN(COMMENT); before_comment = CLASS_CODE_I; } \*\/ {BEGIN(before_comment);} . { ; /* comment, ignore */ } +\n { ; /* comment, ignore */ } ^\%h\{ { BEGIN(C_CODE); @@ -82,6 +85,7 @@ add_to_cbuf(char *s) class_after_c = FALSE; header_c = TRUE; clear_cbuf(); + ccode_line = line_no; } ^\%\{ { BEGIN(C_CODE); @@ -89,6 +93,7 @@ add_to_cbuf(char *s) class_after_c = FALSE; header_c = FALSE; clear_cbuf(); + ccode_line = line_no; } ^\%\} { BEGIN(INITIAL); @@ -166,12 +171,7 @@ class { argument {yylval.line = line_no; return ARGUMENT;} virtual {yylval.line = line_no; return VIRTUAL;} signal {yylval.line = line_no; return SIGNAL;} -last {return LAST;} -first {return FIRST;} override {yylval.line = line_no; return OVERRIDE;} -check {return CHECK;} -null {return CNULL;} -type {return TYPE;} onerror {return ONERROR;} 0|[1-9][0-9]*|0x[0-9a-fA-F]+|0[0-7]+|[0-9]*\.[0-9]+|\.[0-9][0-9]* { yylval.id = g_strdup(yytext); @@ -194,6 +194,8 @@ class { BEGIN(C_CODE); parenth_depth=1; class_after_c = TRUE; + ccode_line = line_no; + yylval.line = line_no; return '{'; } \} {