X-Git-Url: http://git.draconx.ca/gitweb/gob-dx.git/blobdiff_plain/1656cfade4879af0cb003e3847e58264caa5781f..8fcffcc668f4782447beb64a823cc15961cea9ab:/src/lexer.l diff --git a/src/lexer.l b/src/lexer.l index 68bafd0..f3a0f2e 100644 --- a/src/lexer.l +++ b/src/lexer.l @@ -24,6 +24,7 @@ #include #include +#include "treefuncs.h" #include "parse.h" #include "main.h" #include "util.h" @@ -50,9 +51,9 @@ static void clear_cbuf(void) { if(!cbuf) { - cbuf = g_string_new(""); + cbuf = g_string_new(NULL); } else { - cbuf = g_string_assign(cbuf,""); + cbuf = g_string_assign(cbuf, ""); } } @@ -92,11 +93,33 @@ add_gtk_doc_func(void) %x GTK_DOC %x GTK_DOC_LINE + + %% <*>\n { line_no++; REJECT; } -<*>MOTHERFUCKER { fprintf(stderr,"You are a bad bad person!\n"); REJECT; } +^(I(S.RI).E\(([1-9][0-9]+|[2-9]))/(\)) { +/* Thy evil easter egg */ +#define QQ(x) long x +#define KK(x) =atoi(__(&,,x,)) +#define MM(x,a) {QQ(i);for(i=2;i^#[ \t]*include[ \t][<"][^\n">]*[>"] { @@ -201,6 +224,23 @@ add_gtk_doc_func(void) if(before_comment == C_CODE) add_to_cbuf(yytext); } +^\%(a|all)\{ { + BEGIN(C_CODE); + parenth_depth = 1; + class_after_c = FALSE; + code_type = ACODE; + clear_cbuf(); + ccode_line = line_no; + } +^\%(at|alltop)\{ { + BEGIN(C_CODE); + parenth_depth = 1; + class_after_c = FALSE; + code_type = ATCODE; + clear_cbuf(); + ccode_line = line_no; + } + ^\%(ht|headertop)\{ { BEGIN(C_CODE); parenth_depth = 1; @@ -327,7 +367,7 @@ class { char *s; s = g_strdup_printf("'%s' keyword should not " "be used when generating " - "C++ code",yytext); + "C++ code", yytext); print_error(TRUE, s, line_no); g_free(s); } @@ -355,16 +395,22 @@ class { public {yylval.line = line_no; return PUBLIC;} private {yylval.line = line_no; return PRIVATE;} protected {yylval.line = line_no; return PROTECTED;} +classwide {yylval.line = line_no; return CLASSWIDE;} argument {yylval.line = line_no; return ARGUMENT;} virtual {yylval.line = line_no; return VIRTUAL;} signal {yylval.line = line_no; return SIGNAL;} override {yylval.line = line_no; return OVERRIDE;} -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); return NUMBER; } -:?[A-Za-z_][A-Za-z0-9_]*(:[A-Za-z0-9_]*)+ { +[A-Za-z_][A-Za-z0-9_]*(:[A-Za-z0-9_]*)+ { + /* this one is for a classname with a namespace */ + yylval.id = g_strdup(yytext); + return TYPETOKEN; + } +:[A-Za-z_][A-Za-z0-9_]*(:[A-Za-z0-9_]*)* { + /* this is for a classname with an empty namespace */ yylval.id = g_strdup(yytext); return TYPETOKEN; } @@ -373,7 +419,7 @@ class { return TOKEN; } -(\[[0-9]*\])+ { +(\[[0-9]*\]|\[[A-Za-z_][A-Za-z0-9_]*\])+ { yylval.id = g_strdup(yytext); return ARRAY_DIM; }