Re: [Flex-help] How to comment a line or multiple lines in the rule section of a .l file?
flex is a tool for generating scanners
Brought to you by:
wlestes
From: Marcel L. <ma...@la...> - 2009-12-30 04:17:43
|
I believe the section in the manual you are looking for is: 5.4 Comments in the Input The main gotcha is that comments may not be the first thing on a line, so just be sure to lead with a space. On Tue, 29 Dec 2009 21:33:31 -0600, Peng Yu <pen...@gm...> wrote: > For example, I want to comment out the line '\n { chars++; lines++; > }' in the following flex file. > > I see the following FAQ. But I don't find in the manual what syntax I > should to use to comment out a line in the rule section. Could > somebody let me know? > > http://flex.sourceforge.net/manual/Can-I-include-comments-in-the-_0022rules_0022-section-of-the-file_003f.html#Can-I-include-comments-in-the-_0022rules_0022-section-of-the-file_003f > > -----------------------the following is the flex file. > %{ > int chars = 0; > int words = 0; > int lines = 0; > %} > > %% > > [a-zA-Z]+ { words++; chars += strlen(yytext); } > \n { chars++; lines++; } > . { chars++; } > > %% > > main() > { > yylex(); > printf("%8d%8d%8d\n", lines, words, chars); > } > > ------------------------------------------------------------------------------ > This SF.Net email is sponsored by the Verizon Developer Community > Take advantage of Verizon's best-in-class app development support > A streamlined, 14 day to market process makes app distribution fast and > easy > Join now and get one step closer to millions of Verizon customers > http://p.sf.net/sfu/verizon-dev2dev > _______________________________________________ > Flex-help mailing list > Fle...@li... > https://lists.sourceforge.net/lists/listinfo/flex-help |