Provided by: manpages-ja_0.5.0.0.20110915-1_all bug

YACC

       flex  yacc  yacc  yylex() yylval flex yacc yacc -d yacc %tokens y.tab.h
       flex  "TOK_NUMBER" :

           %{
           #include "y.tab.h"
           %}

           %%

           [0-9]+        yylval = atoi( yytext ); return TOK_NUMBER;

       flex :

       -b      lex.backup (backing-up)  -Cf -CF ( -p ) ()

       -c     POSIX

       -d       yy_flex_debug ()

                  --accepting rule at line 53 ("the matched text")

               (flex)  (NUL; )

       -f      -Cfr  ()

       -h     flex  ""  -?  --help -h

       -i      flex yytext  ()

       -l     AT&T lex  -+, -f, -F, -Cf, -CF  "Lex  POSIX " YY_FLEX_LEX_COMPAT
              #define

       -n     POSIX

       -p      flex 2

              REJECT %option yylineno (/); yymore() ^ -I

       -s      (  )

       -t     lex.yy.c

       -v       flex flex flex ( -V )

       -w

       -B       ( -I )  flex -B   -Cf -CF () -B

       -F      () (-f)  ()  "keywords"  "identifier" :

                  "case"    return TOK_CASE;
                  "switch"  return TOK_SWITCH;
                  ...
                  "default" return TOK_DEFAULT;
                  [a-z]+    return TOK_ID;

                "identifier" -F

               -CFr  () -+

       -I     flex  ;

              flex  -Cf -CF () flex -I -Cf -CF  ;

              isatty() -I flex %option always-interactive ()

                -B ()

       -L     flex #line lex.yy.c  #line flex ( ) lex.yy.c ( flex  -- )

       -T     flex  /  flex

       -V       --version -V

       -7     7  7 -7 -8 ()  8

               -Cf -CF flex -Cf -CF,  8  8 (USA ) 7 flex  7  8 -v

              -Cfe -CFe () flex  8  8  7

       -8     8 flex  8 -Cf -CF  flex  8

              flex  7  8 -7

       -+     C++  C++

       -C[aefFmr]

              -Ca ("") RISC  2

              -Ce    () ( flex  "[0-9]"  '0', '1', ..., '9' ) / ( 1/2-1/5) ( 1
              1)

              -Cf (full)  - flex

              -CF ( -F ) -+

              -Cm flex  () (1-2  1 )

              -Cr ()  fread() getc() read() -Cf -CF -Cr yyin ()

              -Cr YY_INPUT () yyin

              -C

               -Cf -CF -Cm  -

               -Cem flex

                        -Cem
                        -Cm
                        -Ce
                        -C
                        -C{f,F}e
                        -C{f,F}
                        -C{f,F}a

               -Cfe

       -ooutput
              lex.yy.c output  flex -o -t  #line ( -L ) output

       -Pprefix
              flex yy prefix -Pfoo yytext footext lex.yy.c lex.foo.c :

                  yy_create_buffer
                  yy_delete_buffer
                  yy_flex_debug
                  yy_init_buffer
                  yy_flush_buffer
                  yy_load_buffer_state
                  yy_switch_to_buffer
                  yyin
                  yyleng
                  yylex
                  yylineno
                  yyout
                  yyrestart
                  yytext
                  yywrap

              (C++ yywrap yyFlexLexer ) ;

               flex yywrap() () %option noyywrap -ll

       -Sskeleton_file
              flex flex

       flex flex %option %option  flex

         "no" ()  flex

           7bit            -7
           8bit            -8
           align           -Ca
           backup          -b
           batch           -B
           c++             -+

           caseful
           case-sensitive  -i ()

           case-insensitive
           caseless        -i

           debug           -d
           default         -s
           ecs             -Ce
           fast            -F
           full            -f
           interactive     -I
           lex-compat      -l
           meta-ecs        -Cm
           perf-report     -p
           read            -Cr
           stdout          -t
           verbose         -v
           warn            -w
                           (-w  "%option nowarn" )

           array           "%array"
           pointer         "%pointer" ()

       %option :

       always-interactive
               ""  flex isatty()  1  1

       main    yylex() main() noyywrap ()

       never-interactive
               ""  flex ( isatty() ) always-interactive

       stack  ()

       stdinit
               ( %option stdinit) yyin yyout nil   lex ANSI C ANSI C

       yylineno
               yylineno flex %option lex-compat

       yywrap  ( %option noyywrap) yywrap() ( yyin yylex() )

       flex  REJECT  yymore()  reject  yymore  (  %option  reject)  (  %option
       noyymore)

       '=' :

           %option outfile="ABC"

        -oABC

           %option prefix="XYZ"

        -PXYZ

           %option yyclass="foo"

        C++ ( -+ ) flex foo yyFlexLexer flex yyFlexLexer::yylex() foo::yylex()
       ( yyFlexLexer::LexerError() ) yyFlexLexer::yylex()  C++

        lint ( %option nounput ):

           input, unput
           yy_push_state, yy_pop_state, yy_top_state
           yy_scan_buffer, yy_scan_bytes, yy_scan_string

       ( yy_push_state() %option stack )

       flex -C / :

           REJECT
           %option yylineno
           (trailing context)

           %array
           %option interactive
           %option always-interactive

           '^'
           yymore()

        3  2 unput() yyless() ; yyless()

        REJECT

        -b lex.backup

           %%
           foo        return TOK_KEYWORD;
           foobar     return TOK_KEYWORD;

       :

           State #6 is non-accepting -
            associated rule line numbers:
                  2       3
            out-transitions: [ o ]
            jam-transitions: EOF [ \001-n  p-\177 ]

           State #8 is non-accepting -
            associated rule line numbers:
                  3
            out-transitions: [ a ]
            jam-transitions: EOF [ \001-`  b-\177 ]

           State #9 is non-accepting -
            associated rule line numbers:
                  3
            out-transitions: [ r ]
            jam-transitions: EOF [ \001-q  s-\177 ]

           Compressed tables always back up.

        'o'  2, 3  'o'  "fo" 'o'  'f' () ()

        #8 "foob" 'a'  "foo"  #9 "fooba"  'r'

        -Cf -CF

        "" :

           %%
           foo         return TOK_KEYWORD;
           foobar      return TOK_KEYWORD;

           fooba       |
           foob        |
           fo          {
                       /* false alarm, not really a keyword */
                       return TOK_ID;
                       }

       "" :

           %%
           foo         return TOK_KEYWORD;
           foobar      return TOK_KEYWORD;

           [a-z]+      return TOK_ID;

        ( flex )

         () REJECT () :

           %%
           mouse|rat/(cat|dog)   run();

       :

           %%
           mouse/cat|dog         run();
           rat/cat|dog           run();

       :

           %%
           mouse|rat/cat         run();
           mouse|rat/dog         run();

        '|'  (/)

       () () ( yytext) C :

           %x comment
           %%
                   int line_num = 1;

           "/*"         BEGIN(comment);

           <comment>[^*\n]*
           <comment>"*"+[^*/\n]*
           <comment>\n             ++line_num;
           <comment>"*"+"/"        BEGIN(INITIAL);

       :

           %x comment
           %%
                   int line_num = 1;

           "/*"         BEGIN(comment);

           <comment>[^*\n]*
           <comment>[^*\n]*\n      ++line_num;
           <comment>"*"+[^*/\n]*
           <comment>"*"+[^*/\n]*\n ++line_num;
           <comment>"*"+"/"        BEGIN(INITIAL);

         ""  !   '*'  '|' ()

       : 1  1 :

           %%
           asm      |
           auto     |
           break    |
           ... etc ...
           volatile |
           while    /* it's a keyword */

           .|\n     /* it's not a keyword */

       :

           %%
           asm      |
           auto     |
           break    |
           ... etc ...
           volatile |
           while    /* it's a keyword */

           [a-z]+   |
           .|\n     /* it's not a keyword */

       1  1 :

           %%
           asm\n    |
           auto\n   |
           break\n  |
           ... etc ...
           volatile\n |
           while\n  /* it's a keyword */

           [a-z]+\n |
           .|\n     /* it's not a keyword */

         flex  "auto"  "auto"  "auto" "auto\n" :

           %%
           asm\n    |
           auto\n   |
           break\n  |
           ... etc ...
           volatile\n |
           while\n  /* it's a keyword */

           [a-z]+\n |
           [a-z]+   |
           .|\n     /* it's not a keyword */

       -Cf flex

       : flex  NUL  NUL  NUL

       : yytext ()  ""  ""  8K /

C++

       flex  2  C++ flex  C  C++ ()  C  C++ yyin yyout FILE * C++ streams

       flex  C++ -+ ( %option c++ ) flex  '+'  flex lex.yy.cc lex.yy.c 2   C++
       FlexLexer.h

        FlexLexer :

       const char* YYText()
               yytext

       int YYLeng()
               yyleng

       int lineno() const
              ( %option yylineno ) %option yylineno 1

       void set_debug( int flag )
               yy_flex_debug () %option debug

       int debug() const

          yy_switch_to_buffer(),   yy_create_buffer()   (  istream*  FILE*  ),
       yy_flush_buffer(), yy_delete_buffer(), yyrestart() ( istream* )

       2 FlexLexer.h yyFlexLexer FlexLexer :

       yyFlexLexer( istream* arg_yyin = 0, ostream* arg_yyout = 0 )
               yyFlexLexer cin cout

       virtual int yylex()
               yylex()  flex : yyFlexLexer S  yylex()  S  %option  yyclass="S"
              yyFlexLexer   flex   yyFlexLexer::yylex()   flex   S::yylex()  (
              yyFlexLexer::LexerError() yyFlexLexer::yylex() )

       virtual void switch_streams(istream* new_in = 0,
              ostream* new_out = 0) yyin new_in () yyout new_out () yyin

       int yylex( istream* new_in, ostream* new_out = 0 )
               switch_streams( new_in, new_out ) yylex()

        yyFlexLexer :

       virtual int LexerInput( char* buf, int max_size )
               max_size buf  0 "" ( -B -I ) YY_INTERACTIVE LexerInput() #ifdef

       virtual void LexerOutput( const char* buf, int size )
              size buf  NUL NUL  "" NUL

       virtual void LexerError( const char* msg )
               cerr

       yyFlexLexer  yyFlexLexer  C++ -P

        %array  C++ ; %pointer ()

        C++ :

               // An example of using the flex C++ scanner class.

           %{
           int mylineno = 0;
           %}

           string  \"[^\n"]+\"

           ws      [ \t]+

           alpha   [A-Za-z]
           dig     [0-9]
           name    ({alpha}|{dig}|\$)({alpha}|{dig}|[_.\-/$])*
           num1    [-+]?{dig}+\.?([eE][-+]?{dig}+)?
           num2    [-+]?{dig}*\.{dig}+([eE][-+]?{dig}+)?
           number  {num1}|{num2}

           %%

           {ws}    /* skip blanks and tabs */

           "/*"    {
                   int c;

                   while((c = yyinput()) != 0)
                       {
                       if(c == '\n')
                           ++mylineno;

                       else if(c == '*')
                           {
                           if((c = yyinput()) == '/')
                               break;
                           else
                               unput(c);
                           }
                       }
                   }

           {number}  cout << "number " << YYText() << '\n';

           \n        mylineno++;

           {name}    cout << "name " << YYText() << '\n';

           {string}  cout << "string " << YYText() << '\n';

           %%

           int main( int /* argc */, char** /* argv */ )
               {
               FlexLexer* lexer = new yyFlexLexer;
               while(lexer->yylex() != 0)
                   ;
               return 0;
               }
       () -P  ( prefix= ) yyFlexLexer xxFlexLexer <FlexLexer.h> yyFlexLexer :

           #undef yyFlexLexer
           #define yyFlexLexer xxFlexLexer
           #include <FlexLexer.h>

           #undef yyFlexLexer
           #define yyFlexLexer zzFlexLexer
           #include <FlexLexer.h>

        %option prefix="xx" %option prefix="zz"

       :

LEX POSIX

       flex  AT&T Unix lex (2 ) flex  POSIX lex  %pointer  ()  unput()  yytext
       POSIX

        flex  AT&T lex  POSIX

       flex -l  AT&T lex -l

       flex lex :

       -       lex yylineno -l %option yylineno

              yylineno ()

              yylineno  POSIX

       -      input() input() yywrap() ``'' EOF

               YY_INPUT

              input() flex yyin POSIX

       -      unput()  POSIX

       -      flex lex :

                  fatal flex scanner internal error--end of buffer missed

                  yyrestart( yyin );

              ;

              C++  C++ C++  "C++ "

       -      output() ECHO yyout (  )

              output()  POSIX

       -      lex  (%x)  POSIX

       -       flex lex :

                  NAME    [A-Z][A-Z0-9]*
                  %%
                  foo{NAME}?      printf( "Found it\n" );
                  %%

                "foo"   "foo[A-Z][A-Z0-9]*?"   `?'  "[A-Z0-9]*" flex  "foo([A-
              Z][A-Z0-9]*)?"   "foo"

              ^ $ <s>, /, <<EOF>> flex

              -l lex

              POSIX

       -      lex :

                  %%
                  foo|bar<space here>
                    { foobar_action(); }

              flex

       -      lex %r (Ratfor )  POSIX

       -       %array unput() yytext lex  POSIX -l

       -      {} () lex  "abc{1,3}"  "1  2  3  'abc' " flex  "'ab'   1   2   3
              'c' "  POSIX

       -      ^  lex   "^foo|bar"   "  'foo'   'bar'  " flex  " 'foo'  'bar' "
              POSIX

       -      lex %a flex ; flex

       -      flex     lex     FLEX_SCANNER     flex     YY_FLEX_MAJOR_VERSION
              YY_FLEX_MINOR_VERSION ( 2.5  2  5 )

        flex lex  POSIX :

           C++
           %option

           /
           yy_scan_string()
           yyterminate()
           yy_set_interactive()
           yy_set_bol()
           YY_AT_BOL()
           <<EOF>>
           <*>
           YY_DECL
           YY_START
           YY_USER_ACTION
           YY_USER_INIT
           #line
            %{}

        flex flex lex

           foo    handle_foo(); ++num_foos_seen;

        ()

           foo    handle_foo();

       flex

       warning, rule cannot be matched  "foo"  "" :

           [a-z]+    got_identifier();
           foo       got_foo();

        REJECT

       warning, -s option given but default rule can be matched ()  () -s

       reject_used_but_not_detected   undefined   yymore_used_but_not_detected
       undefined - REJECT yymore() flex flex  2 ( #include  )  %option  reject
       %option yymore flex

       flex scanner jammed - -s

       token  too  large,  exceeds  YYLMAX  - %array YYLMAX ( 8K ) flex YYLMAX
       #define

       scanner requires -8 flag to use the character 'x' -  8 'x' -Cf  -CF   7
       -8 -7

       flex scanner push-back overflow - unput() yytext

       input buffer overflow, can't enlarge buffer because scanner uses REJECT
       - REJECT

       fatal flex scanner internal error--end of buffer missed - () :

           yyrestart( yyin );

        C++

       too many start conditions in <> construct! -  <> ()

       -ll

       lex.yy.c
              ( lexyy.c )

       lex.yy.cc
              -+  C++

       <FlexLexer.h>
              C++ FlexLexer yyFlexLexer

       flex.skl
                flex flex

       lex.backup
              -b ( lex.bck )

 /
       (trailing context)  ("dangerous trailing context")  2   "zx*/xy*"  'x*'
       'x' (POSIX )

         '|'  {n} ( "foo{3}")

        '|'   :

           %%
           abc      |
           xyz/def

       %array -l unput()  yytext  yyleng

       NUL

        ()

        <stdio.h> getchar() flex input()

       -v REJECT  DFA  DFA

       REJECT -f -F

       flex

       lex(1), yacc(1), sed(1), awk(1)

       John  Levine,  Tony  Mason,  and  Doug  Brown, Lex & Yacc, O'Reilly and
       Associates.   2

       M. E. Lesk and E. Schmidt, LEX - Lexical Analyzer Generator

       Alfred Aho, Ravi  Sethi  and  Jeffrey  Ullman,  Compilers:  Principles,
       Techniques and Tools, Addison-Wesley (1986).  flex ()

       Vern Paxson Van Jacobson  Jef Poskanzer  Van Jacobson  Kevin Gong  Vern
       Paxson

        flex  Francois Pinard, Casey Leedom, Robert Abramovitz, Stan Adermann,
       Terry  Allen,  David  Barker-Plummer,  John Basrai, Neal Becker, Nelson
       H.F.  Beebe,  benson@odi.com,  Karl  Berry,  Peter  A.   Bigot,   Simon
       Blanchard,  Keith  Bostic, Frederic Brehm, Ian Brockbank, Kin Cho, Nick
       Christopher, Brian Clapper, J.T. Conklin,  Jason  Coughlin,  Bill  Cox,
       Nick  Cropper,  Dave  Curtis,  Scott David Daniels, Chris G. Demetriou,
       Theo Deraadt, Mike Donahue, Chuck Doucette,  Tom  Epperly,  Leo  Eskin,
       Chris  Faylor,  Chris Flatters, Jon Forrest, Jeffrey Friedl, Joe Gayda,
       Kaveh R. Ghazi, Wolfgang Glunz, Eric  Goldman,  Christopher  M.  Gould,
       Ulrich  Grepel,  Peer Griebel, Jan Hajic, Charles Hemphill, NORO Hideo,
       Jarkko Hietaniemi, Scott Hofmann, Jeff Honig, Dana Hudes, Eric  Hughes,
       John  Interrante,  Ceriel  Jacobs, Michal Jaegermann, Sakari Jalovaara,
       Jeffrey R. Jones, Henry Juengst,  Klaus  Kaempf,  Jonathan  I.  Kamens,
       Terrence  O  Kane,  Amir Katz, ken@ken.hilco.com, Kevin B. Kenny, Steve
       Kirsch, Winfried Koenig, Marq Kole, Ronald Lamprecht, Greg  Lee,  Rohan
       Lenard,  Craig  Leres,  John Levine, Steve Liddle, David Loffredo, Mike
       Long, Mohamed  el  Lozy,  Brian  Madsen,  Malte,  Joe  Marshall,  Bengt
       Martensson,  Chris  Metcalf,  Luke  Mewburn, Jim Meyering, R. Alexander
       Milowski, Erik Naggum, G.T. Nicol,  Landon  Noll,  James  Nordby,  Marc
       Nozell,  Richard  Ohnemus,  Karsten  Pahnke,  Sven Panne, Roland Pesch,
       Walter Pelissero, Gaumond  Pierre,  Esmond  Pitt,  Jef  Poskanzer,  Joe
       Rahmeh,  Jarmo  Raiha, Frederic Raimbault, Pat Rankin, Rick Richardson,
       Kevin Rodgers, Kai Uwe Rommel, Jim Roskind,  Alberto  Santini,  Andreas
       Scherer,  Darrell  Schiebel,  Raf  Schietekat,  Doug  Schmidt, Philippe
       Schnoebelen, Andreas Schwab, Larry  Schwimmer,  Alex  Siegel,  Eckehard
       Stolz,  Jan-Erik Strvmquist, Mike Stump, Paul Stuart, Dave Tallman, Ian
       Lance Taylor, Chris  Thewalt,  Richard  M.  Timoney,  Jodi  Tsai,  Paul
       Tuinenga, Gary Weik, Frank Whaley, Gerhard Wilhelms, Kent Williams, Ken
       Yap, Ron Zellar, Nathan Zelle, David Zuhn,

       Keith Bostic, Jon Forrest, Noah Friedman, John  Gilmore,  Craig  Leres,
       John  Levine,  Bob  Mulcahy,  G.T.   Nicol, Francois Pinard, Rich Salz,
       Richard Stallman

       Esmond Pitt  Earle Horton  8 ; Benson Margulies  Fred Burke  C++ ; Kent
       Williams  Tom Epperly  C++ ; Ove Ewerlid  NUL ; Eric Hughes

        CA Berkeley  Lawrence Berkeley Laboratory  Real Time Systems Group

        vern@ee.lbl.gov