tools/llvm: Do not build with symbols
[minix3.git] / external / bsd / flex / dist / examples / testxxLexer.l
blob7430df50e0b34c26f8fadef508c7cd7df7befadb
1 /*      $NetBSD: testxxLexer.l,v 1.1.1.1 2009/10/26 00:28:31 christos Exp $     */
3         // An example of using the flex C++ scanner class.
5 %option C++ noyywrap
7 %{
8 int mylineno = 0;
9 %}
11 string  \"[^\n"]+\"
13 ws      [ \t]+
15 alpha   [A-Za-z]
16 dig     [0-9]
17 name    ({alpha}|{dig}|\$)({alpha}|{dig}|\_|\.|\-|\/|\$)*
18 num1    [-+]?{dig}+\.?([eE][-+]?{dig}+)?
19 num2    [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
20 number  {num1}|{num2}
24 {ws}    /* skip blanks and tabs */
26 "/*"            {
27                 int c;
29                 while((c = yyinput()) != 0)
30                         {
31                         if(c == '\n')
32                                 ++mylineno;
34                         else if(c == '*')
35                                 {
36                                 if((c = yyinput()) == '/')
37                                         break;
38                                 else
39                                         unput(c);
40                                 }
41                         }
42                 }
44 {number}        FLEX_STD cout << "number " << YYText() << '\n';
46 \n              mylineno++;
48 {name}          FLEX_STD cout << "name " << YYText() << '\n';
50 {string}        FLEX_STD cout << "string " << YYText() << '\n';
54 int main( int /* argc */, char** /* argv */ )
55         {
56         FlexLexer* lexer = new yyFlexLexer;
57         while(lexer->yylex() != 0)
58                 ;
59         return 0;
60         }