]> git.draconx.ca Git - gob-dx.git/blobdiff - src/lexer.l
Release 0.90.3
[gob-dx.git] / src / lexer.l
index cabafca6a919875378b1baa4f7ffc76fabdf643d..0037b85181537998dce2b3ebe8401a4b7e0b3b95 100644 (file)
@@ -70,16 +70,29 @@ add_to_cbuf(char *s)
 <*>MOTHERFUCKER                { fprintf(stderr,"You are a bad bad person!\n"); REJECT; }
 
 \/\/.*$                        { ; /*comment, ignore*/ }
-<C_CODE>\/\/.*$                { ; /*comment, ignore*/ }
+<C_CODE>\/\/.*$                { add_to_cbuf(yytext); /*comment, ignore*/ }
 <CLASS_CODE>\/\/.*$    { ; /*comment, ignore*/ }
 <CLASS_CODE_I>\/\/.*$  { ; /*comment, ignore*/ }
 \/\*           {BEGIN(COMMENT); before_comment = INITIAL; }
-<C_CODE>\/\*   {BEGIN(COMMENT); before_comment = C_CODE; }
+<C_CODE>\/\*   {
+       add_to_cbuf(yytext);
+       BEGIN(COMMENT);
+       before_comment = C_CODE;
+}
 <CLASS_CODE>\/\*       {BEGIN(COMMENT); before_comment = CLASS_CODE; }
 <CLASS_CODE_I>\/\*     {BEGIN(COMMENT); before_comment = CLASS_CODE_I; }
-<COMMENT>\*\/  {BEGIN(before_comment);}
-<COMMENT>.     { ; /* comment, ignore */ }
-<COMMENT>\n    { ; /* comment, ignore */ }
+<COMMENT>\*\/  {
+       if(before_comment == C_CODE) add_to_cbuf(yytext);
+       BEGIN(before_comment);
+               }
+<COMMENT>.     {
+       /* comment, ignore */
+       if(before_comment == C_CODE) add_to_cbuf(yytext);
+               }
+<COMMENT>\n    {
+       /* comment, ignore */
+       if(before_comment == C_CODE) add_to_cbuf(yytext);
+               }
 
 ^\%h\{         {
                        BEGIN(C_CODE);
@@ -111,22 +124,21 @@ add_to_cbuf(char *s)
 <C_CODE>\'\\\{\'       { add_to_cbuf(yytext); }
 <C_CODE>\'\}\'         { add_to_cbuf(yytext); }
 <C_CODE>\'\\\}\'       { add_to_cbuf(yytext); }
+<C_CODE>\'\"\'         { add_to_cbuf(yytext); }
+<C_CODE>\'\\\"\'       { add_to_cbuf(yytext); }
        
 <C_CODE>\\.    { add_to_cbuf(yytext); }
 <C_CODE>\"     {
                        BEGIN(C_CODE_STRING);
                        add_to_cbuf(yytext);
                }
-<C_CODE_STRING>\\.     {
-                               add_to_cbuf(yytext);
-                       }
+<C_CODE_STRING>\\.     { add_to_cbuf(yytext); }
 <C_CODE_STRING>\"      {
                                BEGIN(C_CODE);
                                add_to_cbuf(yytext);
                        }
-<C_CODE_STRING>.       {
-                               add_to_cbuf(yytext);
-                       }
+<C_CODE_STRING>.       { add_to_cbuf(yytext); }
+<C_CODE_STRING>\n      { add_to_cbuf(yytext); }
 
 <C_CODE>\{     {
                        parenth_depth++;
@@ -208,9 +220,11 @@ class              {
                                return '}';
                        }
 
-<CLASS_CODE,CLASS_CODE_I,INITIAL>[\n\t ]       ;  /*ignore*/
+<CLASS_CODE,CLASS_CODE_I,INITIAL>[\t ] ;  /*ignore*/
 
 <*>.           {
                        yylval.line = line_no;
                        return yytext[0];
                }
+
+<*>[\n\r]      ;  /*ignore*/