Commit 85f2b2c5 by alokp@chromium.org

Added rules for ignoring comments.

git-svn-id: https://angleproject.googlecode.com/svn/trunk@1053 736b8ea6-26fd-11df-bfd4-992fa37f6226
parent ddb6e8e3
......@@ -45,8 +45,9 @@ typedef pp::Token::Location YYLTYPE;
%option reentrant bison-bridge bison-locations
%option prefix="pp"
%option extra-type="pp::Input*"
%x COMMENT
NEWLINE "\n"|"\r"|"\r\n"
NEWLINE \n|\r|\r\n
IDENTIFIER [_a-zA-Z][_a-zA-Z0-9]*
PUNCTUATOR [][<>(){}.+-/*%^|&~=!:;,?]
......@@ -60,6 +61,17 @@ FRACTIONAL_CONSTANT ({DIGIT}*"."{DIGIT}+)|({DIGIT}+".")
%%
/* Line comment */
"//"[^\r\n]*
/* Block comment */
"/*" { BEGIN(COMMENT); }
<COMMENT>[^*\r\n]*
<COMMENT>[^*\r\n]*{NEWLINE} { ++yylineno; return '\n'; }
<COMMENT>"*"+[^*/\r\n]*
<COMMENT>"*"+[^*/\r\n]*{NEWLINE} { ++yylineno; return '\n'; }
<COMMENT>"*"+"/" { BEGIN(INITIAL); return ' '; }
# { return yytext[0]; }
{IDENTIFIER} {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment