Re: [Flex-help] Comments in the definition section
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Chris v. <che...@gm...> - 2013-10-29 19:09:56
|
I'm pretty sure comments in flex have to be the only thing on the line. It's not actually C, so you can't put comments after aliases. Any line that starts with whitespace is also implicitly considered a comment. The support for "/* .. */" block-commenting is just: 1. so you can have multiple lines of comments without having to start multiple lines with leading whitespace, and 2. to give a visual indication of a block of comments, and 3. to allow you to comment a bunch of stuff out at once. Or at least that's my recollection. List lurkers, feel free to jump in if I'm way off. -Chris On Tue, Oct 29, 2013 at 11:01 AM, Arthur Schwarz <asc...@at...>wrote: > Section 5.1 "An unindented comment (i.e., a line > beginning with ‘/*’) is copied verbatim to the output up > to the next ‘*/’." > > Section 5.4 "Flex supports C-style comments, that is, anything between > ‘/*’ and > ‘*/’ is > considered a comment." > > With the comment in place, the following diagnostic message is output. > :13: unrecognized rule > > With the comment removed, the scanner is generated and compiles and works > as expected. > > Is there anything wrong with the code? > > %option main > > %{ > #include <stdio.h> > %} > DECIMAL [1-9][[:digit:]]* /* 1234 */ > %% > int col = 1; > int lineno = 1; > > ([[:space:]]{-}[\n])+ { col += yyleng; } > \n { printf("%3d:%4d \\n\n", lineno, col); > lineno++; col=1; } > {DECIMAL} { printf("%3d:%4d DECIMAL %s\n", > lineno, col, yytext); col += yyleng; } > > > ------------------------------------------------------------------------------ > Android is increasing in popularity, but the open development platform that > developers love is also attractive to malware creators. Download this white > paper to learn more about secure code signing practices that can help keep > Android apps secure. > http://pubads.g.doubleclick.net/gampad/clk?id=65839951&iu=/4140/ostg.clktrk > _______________________________________________ > Flex-help mailing list > Fle...@li... > https://lists.sourceforge.net/lists/listinfo/flex-help > |