{
    "mode": "info",
    "parameter": "flex",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/info/flex/json",
    "generated": "2026-07-30T08:41:52Z",
    "sections": {
        "File: flex.info,  Node: Top,  Next: Copyright,  Prev: (dir),  Up: (dir)": {
            "content": "",
            "subsections": []
        },
        "flex": {
            "content": "",
            "subsections": []
        },
        "This manual describes 'flex', a tool for generating programs that": {
            "content": "perform pattern-matching on text.  The manual includes both tutorial and\nreference sections.\n\nThis edition of 'The flex Manual' documents 'flex' version 2.6.4.  It\nwas last updated on 6 May 2017.\n\nThis manual was written by Vern Paxson, Will Estes and John Millaway.\n\n* Menu:\n\n* Copyright::\n* Reporting Bugs::\n* Introduction::\n* Simple Examples::\n* Format::\n* Patterns::\n* Matching::\n* Actions::\n* Generated Scanner::\n* Start Conditions::\n* Multiple Input Buffers::\n* EOF::\n* Misc Macros::\n* User Values::\n* Yacc::\n* Scanner Options::\n* Performance::\n* Cxx::\n* Reentrant::\n* Lex and Posix::\n* Memory Management::\n* Serialized Tables::\n* Diagnostics::\n* Limitations::\n* Bibliography::\n* FAQ::\n* Appendices::\n* Indices::\n\n-- The Detailed Node Listing --\n",
            "subsections": []
        },
        "Format of the Input File": {
            "content": "* Definitions Section::\n* Rules Section::\n* User Code Section::\n* Comments in the Input::\n",
            "subsections": []
        },
        "Scanner Options": {
            "content": "* Options for Specifying Filenames::\n* Options Affecting Scanner Behavior::\n* Code-Level And API Options::\n* Options for Scanner Speed and Size::\n* Debugging Options::\n* Miscellaneous Options::\n",
            "subsections": []
        },
        "Reentrant C Scanners": {
            "content": "* Reentrant Uses::\n* Reentrant Overview::\n* Reentrant Example::\n* Reentrant Detail::\n* Reentrant Functions::\n",
            "subsections": []
        },
        "The Reentrant API in Detail": {
            "content": "* Specify Reentrant::\n* Extra Reentrant Argument::\n* Global Replacement::\n* Init and Destroy Functions::\n* Accessor Methods::\n* Extra Data::\n* About yyscant::\n",
            "subsections": []
        },
        "Memory Management": {
            "content": "* The Default Memory Management::\n* Overriding The Default Memory Management::\n* A Note About yytext And Memory::\n",
            "subsections": []
        },
        "Serialized Tables": {
            "content": "* Creating Serialized Tables::\n* Loading and Unloading Serialized Tables::\n* Tables File Format::\n",
            "subsections": []
        },
        "FAQ": {
            "content": "From time to time, the 'flex' maintainer receives certain questions.",
            "subsections": []
        },
        "Appendices": {
            "content": "* Makefiles and Flex::\n* Bison Bridge::\n* M4 Dependency::\n* Common Patterns::\n",
            "subsections": []
        },
        "Indices": {
            "content": "* Menu:\n\n* Concept Index::\n* Index of Functions and Macros::\n* Index of Variables::\n* Index of Data Types::\n* Index of Hooks::\n* Index of Scanner Options::\n",
            "subsections": []
        },
        "File: flex.info,  Node: Copyright,  Next: Reporting Bugs,  Prev: Top,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "1 Copyright": {
            "content": "",
            "subsections": []
        },
        "The flex manual is placed under the same licensing conditions as the": {
            "content": "rest of flex:\n\nCopyright (C) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2012 The Flex\nProject.\n\nCopyright (C) 1990, 1997 The Regents of the University of California.\nAll rights reserved.\n\nThis code is derived from software contributed to Berkeley by Vern\nPaxson.\n\nThe United States Government has rights in this work pursuant to\ncontract no.  DE-AC03-76SF00098 between the United States Department of\nEnergy and the University of California.\n\nRedistribution and use in source and binary forms, with or without\nmodification, are permitted provided that the following conditions are\nmet:\n\n1. Redistributions of source code must retain the above copyright\nnotice, this list of conditions and the following disclaimer.\n\n2. Redistributions in binary form must reproduce the above copyright\nnotice, this list of conditions and the following disclaimer in the\ndocumentation and/or other materials provided with the\ndistribution.\n\nNeither the name of the University nor the names of its contributors\nmay be used to endorse or promote products derived from this software\nwithout specific prior written permission.\n\nTHIS SOFTWARE IS PROVIDED \"AS IS\" AND WITHOUT ANY EXPRESS OR IMPLIED\nWARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF\nMERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Reporting Bugs,  Next: Introduction,  Prev: Copyright,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "2 Reporting Bugs": {
            "content": "",
            "subsections": []
        },
        "If you find a bug in 'flex', please report it using GitHub's issue": {
            "content": "tracking facility at <https://github.com/westes/flex/issues/>\n",
            "subsections": []
        },
        "File: flex.info,  Node: Introduction,  Next: Simple Examples,  Prev: Reporting Bugs,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "3 Introduction": {
            "content": "'flex' is a tool for generating \"scanners\".  A scanner is a program\nwhich recognizes lexical patterns in text.  The 'flex' program reads the\ngiven input files, or its standard input if no file names are given, for\na description of a scanner to generate.  The description is in the form\nof pairs of regular expressions and C code, called \"rules\".  'flex'\ngenerates as output a C source file, 'lex.yy.c' by default, which\ndefines a routine 'yylex()'.  This file can be compiled and linked with\nthe flex runtime library to produce an executable.  When the executable\nis run, it analyzes its input for occurrences of the regular\nexpressions.  Whenever it finds one, it executes the corresponding C\ncode.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Simple Examples,  Next: Format,  Prev: Introduction,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "4 Some Simple Examples": {
            "content": "First some simple examples to get the flavor of how one uses 'flex'.\n\nThe following 'flex' input specifies a scanner which, when it\nencounters the string 'username' will replace it with the user's login\nname:\n\n%%\nusername    printf( \"%s\", getlogin() );\n\nBy default, any text not matched by a 'flex' scanner is copied to the\noutput, so the net effect of this scanner is to copy its input file to\nits output with each occurrence of 'username' expanded.  In this input,\nthere is just one rule.  'username' is the \"pattern\" and the 'printf' is\nthe \"action\".  The '%%' symbol marks the beginning of the rules.\n\nHere's another simple example:\n\nint numlines = 0, numchars = 0;\n\n%%\n\\n      ++numlines; ++numchars;\n.       ++numchars;\n\n%%\n\nint main()\n{\nyylex();\nprintf( \"# of lines = %d, # of chars = %d\\n\",\nnumlines, numchars );\n}\n\nThis scanner counts the number of characters and the number of lines\nin its input.  It produces no output other than the final report on the\ncharacter and line counts.  The first line declares two globals,\n'numlines' and 'numchars', which are accessible both inside 'yylex()'\nand in the 'main()' routine declared after the second '%%'.  There are\ntwo rules, one which matches a newline ('\\n') and increments both the\nline count and the character count, and one which matches any character\nother than a newline (indicated by the '.' regular expression).\n\nA somewhat more complicated example:\n\n/* scanner for a toy Pascal-like language */\n\n%{\n/* need this for the call to atof() below */\n#include <math.h>\n%}\n\nDIGIT    [0-9]\nID       [a-z][a-z0-9]*\n\n%%\n\n{DIGIT}+    {\nprintf( \"An integer: %s (%d)\\n\", yytext,\natoi( yytext ) );\n}\n\n{DIGIT}+\".\"{DIGIT}*        {\nprintf( \"A float: %s (%g)\\n\", yytext,\natof( yytext ) );\n}\n\nif|then|begin|end|procedure|function        {\nprintf( \"A keyword: %s\\n\", yytext );\n}\n\n{ID}        printf( \"An identifier: %s\\n\", yytext );\n\n\"+\"|\"-\"|\"*\"|\"/\"   printf( \"An operator: %s\\n\", yytext );\n\n\"{\"[^{}\\n]*\"}\"     /* eat up one-line comments */\n\n[ \\t\\n]+          /* eat up whitespace */\n\n.           printf( \"Unrecognized character: %s\\n\", yytext );\n\n%%\n\nint main( int argc, char argv )\n{\n++argv, --argc;  /* skip over program name */\nif ( argc > 0 )\nyyin = fopen( argv[0], \"r\" );\nelse\nyyin = stdin;\n\nyylex();\n}\n\nThis is the beginnings of a simple scanner for a language like\nPascal.  It identifies different types of \"tokens\" and reports on what\nit has seen.\n\nThe details of this example will be explained in the following\nsections.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Format,  Next: Patterns,  Prev: Simple Examples,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "5 Format of the Input File": {
            "content": "",
            "subsections": []
        },
        "The 'flex' input file consists of three sections, separated by a line": {
            "content": "containing only '%%'.\n\ndefinitions\n%%\nrules\n%%\nuser code\n\n* Menu:\n\n* Definitions Section::\n* Rules Section::\n* User Code Section::\n* Comments in the Input::\n",
            "subsections": []
        },
        "File: flex.info,  Node: Definitions Section,  Next: Rules Section,  Prev: Format,  Up: Format": {
            "content": "",
            "subsections": [
                {
                    "name": "5.1 Format of the Definitions Section",
                    "content": "The \"definitions section\" contains declarations of simple \"name\"\ndefinitions to simplify the scanner specification, and declarations of\n\"start conditions\", which are explained in a later section.\n\nName definitions have the form:\n\nname definition\n\nThe 'name' is a word beginning with a letter or an underscore ('')\nfollowed by zero or more letters, digits, '', or '-' (dash).  The\ndefinition is taken to begin at the first non-whitespace character\nfollowing the name and continuing to the end of the line.  The\ndefinition can subsequently be referred to using '{name}', which will\nexpand to '(definition)'.  For example,\n\nDIGIT    [0-9]\nID       [a-z][a-z0-9]*\n\nDefines 'DIGIT' to be a regular expression which matches a single\ndigit, and 'ID' to be a regular expression which matches a letter\nfollowed by zero-or-more letters-or-digits.  A subsequent reference to\n\n{DIGIT}+\".\"{DIGIT}*\n\nis identical to\n\n([0-9])+\".\"([0-9])*\n\nand matches one-or-more digits followed by a '.' followed by\nzero-or-more digits.\n\nAn unindented comment (i.e., a line beginning with '/*') is copied\nverbatim to the output up to the next '*/'.\n\nAny indented text or text enclosed in '%{' and '%}' is also copied\nverbatim to the output (with the %{ and %} symbols removed).  The %{ and\n%} symbols must appear unindented on lines by themselves.\n\nA '%top' block is similar to a '%{' ...  '%}' block, except that the\ncode in a '%top' block is relocated to the top of the generated file,\nbefore any flex definitions (1).  The '%top' block is useful when you\nwant certain preprocessor macros to be defined or certain files to be\nincluded before the generated code.  The single characters, '{' and '}'\nare used to delimit the '%top' block, as show in the example below:\n\n%top{\n/* This code goes at the \"top\" of the generated file. */\n#include <stdint.h>\n#include <inttypes.h>\n}\n\nMultiple '%top' blocks are allowed, and their order is preserved.\n\n---------- Footnotes ----------\n\n(1) Actually, 'yyINHEADER' is defined before the '%top' block.\n"
                }
            ]
        },
        "File: flex.info,  Node: Rules Section,  Next: User Code Section,  Prev: Definitions Section,  Up: Format": {
            "content": "",
            "subsections": [
                {
                    "name": "5.2 Format of the Rules Section",
                    "content": "The \"rules\" section of the 'flex' input contains a series of rules of\nthe form:\n\npattern   action\n\nwhere the pattern must be unindented and the action must begin on the\nsame line.  *Note Patterns::, for a further description of patterns and\nactions.\n\nIn the rules section, any indented or %{ %} enclosed text appearing\nbefore the first rule may be used to declare variables which are local\nto the scanning routine and (after the declarations) code which is to be\nexecuted whenever the scanning routine is entered.  Other indented or %{\n%} text in the rule section is still copied to the output, but its\nmeaning is not well-defined and it may well cause compile-time errors\n(this feature is present for POSIX compliance.  *Note Lex and Posix::,\nfor other such features).\n\nAny indented text or text enclosed in '%{' and '%}' is copied\nverbatim to the output (with the %{ and %} symbols removed).  The %{ and\n%} symbols must appear unindented on lines by themselves.\n"
                }
            ]
        },
        "File: flex.info,  Node: User Code Section,  Next: Comments in the Input,  Prev: Rules Section,  Up: Format": {
            "content": "",
            "subsections": [
                {
                    "name": "5.3 Format of the User Code Section",
                    "content": ""
                }
            ]
        },
        "The user code section is simply copied to 'lex.yy.c' verbatim.  It is": {
            "content": "used for companion routines which call or are called by the scanner.",
            "subsections": []
        },
        "The presence of this section is optional; if it is missing, the second": {
            "content": "'%%' in the input file may be skipped, too.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Comments in the Input,  Prev: User Code Section,  Up: Format": {
            "content": "",
            "subsections": [
                {
                    "name": "5.4 Comments in the Input",
                    "content": "Flex supports C-style comments, that is, anything between '/*' and '*/'\nis considered a comment.  Whenever flex encounters a comment, it copies\nthe entire comment verbatim to the generated source code.  Comments may\nappear just about anywhere, but with the following exceptions:\n\n* Comments may not appear in the Rules Section wherever flex is\nexpecting a regular expression.  This means comments may not appear\nat the beginning of a line, or immediately following a list of\nscanner states.\n* Comments may not appear on an '%option' line in the Definitions\nSection.\n\nIf you want to follow a simple rule, then always begin a comment on a\nnew line, with one or more whitespace characters before the initial\n'/*').  This rule will work anywhere in the input file.\n\nAll the comments in the following example are valid:\n\n%{\n/* code block */\n%}\n\n/* Definitions Section */\n%x STATEX\n\n%%\n/* Rules Section */\nruleA   /* after regex */ { /* code block */ } /* after code block */\n/* Rules Section (indented) */\n<STATEX>{\nruleC   ECHO;\nruleD   ECHO;\n%{\n/* code block */\n%}\n}\n%%\n/* User Code Section */\n\n"
                }
            ]
        },
        "File: flex.info,  Node: Patterns,  Next: Matching,  Prev: Format,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "6 Patterns": {
            "content": "The patterns in the input (see *note Rules Section::) are written using\nan extended set of regular expressions.  These are:\n\n'x'\nmatch the character 'x'\n\n'.'\nany character (byte) except newline\n\n'[xyz]'\na \"character class\"; in this case, the pattern matches either an\n'x', a 'y', or a 'z'\n\n'[abj-oZ]'\na \"character class\" with a range in it; matches an 'a', a 'b', any\nletter from 'j' through 'o', or a 'Z'\n\n'[^A-Z]'\na \"negated character class\", i.e., any character but those in the\nclass.  In this case, any character EXCEPT an uppercase letter.\n\n'[^A-Z\\n]'\nany character EXCEPT an uppercase letter or a newline\n\n'[a-z]{-}[aeiou]'\nthe lowercase consonants\n\n'r*'\nzero or more r's, where r is any regular expression\n\n'r+'\none or more r's\n\n'r?'\nzero or one r's (that is, \"an optional r\")\n\n'r{2,5}'\nanywhere from two to five r's\n\n'r{2,}'\ntwo or more r's\n\n'r{4}'\nexactly 4 r's\n\n'{name}'\nthe expansion of the 'name' definition (*note Format::).\n\n'\"[xyz]\\\"foo\"'\nthe literal string: '[xyz]\"foo'\n\n'\\X'\nif X is 'a', 'b', 'f', 'n', 'r', 't', or 'v', then the ANSI-C\ninterpretation of '\\x'.  Otherwise, a literal 'X' (used to escape\noperators such as '*')\n\n'\\0'\na NUL character (ASCII code 0)\n\n'\\123'\nthe character with octal value 123\n\n'\\x2a'\nthe character with hexadecimal value 2a\n\n'(r)'\nmatch an 'r'; parentheses are used to override precedence (see\nbelow)\n\n'(?r-s:pattern)'\napply option 'r' and omit option 's' while interpreting pattern.\nOptions may be zero or more of the characters 'i', 's', or 'x'.\n\n'i' means case-insensitive.  '-i' means case-sensitive.\n\n's' alters the meaning of the '.' syntax to match any single byte\nwhatsoever.  '-s' alters the meaning of '.' to match any byte\nexcept '\\n'.\n\n'x' ignores comments and whitespace in patterns.  Whitespace is\nignored unless it is backslash-escaped, contained within '\"\"'s, or\nappears inside a character class.\n\nThe following are all valid:\n\n(?:foo)         same as  (foo)\n(?i:ab7)        same as  ([aA][bB]7)\n(?-i:ab)        same as  (ab)\n(?s:.)          same as  [\\x00-\\xFF]\n(?-s:.)         same as  [^\\n]\n(?ix-s: a . b)  same as  ([Aa][^\\n][bB])\n(?x:a  b)       same as  (\"ab\")\n(?x:a\\ b)       same as  (\"a b\")\n(?x:a\" \"b)      same as  (\"a b\")\n(?x:a[ ]b)      same as  (\"a b\")\n(?x:a\n/* comment */\nb\nc)          same as  (abc)\n\n'(?# comment )'\nomit everything within '()'.  The first ')' character encountered\nends the pattern.  It is not possible to for the comment to contain\na ')' character.  The comment may span lines.\n\n'rs'\nthe regular expression 'r' followed by the regular expression 's';\ncalled \"concatenation\"\n\n'r|s'\neither an 'r' or an 's'\n\n'r/s'\nan 'r' but only if it is followed by an 's'.  The text matched by\n's' is included when determining whether this rule is the longest\nmatch, but is then returned to the input before the action is\nexecuted.  So the action only sees the text matched by 'r'.  This\ntype of pattern is called \"trailing context\".  (There are some\ncombinations of 'r/s' that flex cannot match correctly.  *Note\nLimitations::, regarding dangerous trailing context.)\n\n'^r'\nan 'r', but only at the beginning of a line (i.e., when just\nstarting to scan, or right after a newline has been scanned).\n\n'r$'\nan 'r', but only at the end of a line (i.e., just before a\nnewline).  Equivalent to 'r/\\n'.\n\nNote that 'flex''s notion of \"newline\" is exactly whatever the C\ncompiler used to compile 'flex' interprets '\\n' as; in particular,\non some DOS systems you must either filter out '\\r's in the input\nyourself, or explicitly use 'r/\\r\\n' for 'r$'.\n\n'<s>r'\nan 'r', but only in start condition 's' (see *note Start\nConditions:: for discussion of start conditions).\n\n'<s1,s2,s3>r'\nsame, but in any of start conditions 's1', 's2', or 's3'.\n\n'<*>r'\nan 'r' in any start condition, even an exclusive one.\n\n'<<EOF>>'\nan end-of-file.\n\n'<s1,s2><<EOF>>'\nan end-of-file when in start condition 's1' or 's2'\n\nNote that inside of a character class, all regular expression\noperators lose their special meaning except escape ('\\') and the\ncharacter class operators, '-', ']]', and, at the beginning of the\nclass, '^'.\n\nThe regular expressions listed above are grouped according to\nprecedence, from highest precedence at the top to lowest at the bottom.",
            "subsections": []
        },
        "Those grouped together have equal precedence (see special note on the": {
            "content": "precedence of the repeat operator, '{}', under the documentation for the\n'--posix' POSIX compliance option).  For example,\n\nfoo|bar*\n\nis the same as\n\n(foo)|(ba(r*))\n\nsince the '*' operator has higher precedence than concatenation, and\nconcatenation higher than alternation ('|').  This pattern therefore\nmatches either the string 'foo' or the string 'ba' followed by\nzero-or-more 'r''s.  To match 'foo' or zero-or-more repetitions of the\nstring 'bar', use:\n\nfoo|(bar)*\n\nAnd to match a sequence of zero or more repetitions of 'foo' and\n'bar':\n\n(foo|bar)*\n\nIn addition to characters and ranges of characters, character classes\ncan also contain \"character class expressions\".  These are expressions\nenclosed inside '[:' and ':]' delimiters (which themselves must appear\nbetween the '[' and ']' of the character class.  Other elements may\noccur inside the character class, too).  The valid expressions are:\n\n[:alnum:] [:alpha:] [:blank:]\n[:cntrl:] [:digit:] [:graph:]\n[:lower:] [:print:] [:punct:]\n[:space:] [:upper:] [:xdigit:]\n\nThese expressions all designate a set of characters equivalent to the\ncorresponding standard C 'isXXX' function.  For example, '[:alnum:]'\ndesignates those characters for which 'isalnum()' returns true - i.e.,\nany alphabetic or numeric character.  Some systems don't provide\n'isblank()', so flex defines '[:blank:]' as a blank or a tab.\n\nFor example, the following character classes are all equivalent:\n\n[[:alnum:]]\n[[:alpha:][:digit:]]\n[[:alpha:][0-9]]\n[a-zA-Z0-9]\n\nA word of caution.  Character classes are expanded immediately when\nseen in the 'flex' input.  This means the character classes are\nsensitive to the locale in which 'flex' is executed, and the resulting\nscanner will not be sensitive to the runtime locale.  This may or may\nnot be desirable.\n\n* If your scanner is case-insensitive (the '-i' flag), then\n'[:upper:]' and '[:lower:]' are equivalent to '[:alpha:]'.\n\n* Character classes with ranges, such as '[a-Z]', should be used with\ncaution in a case-insensitive scanner if the range spans upper or\nlowercase characters.  Flex does not know if you want to fold all\nupper and lowercase characters together, or if you want the literal\nnumeric range specified (with no case folding).  When in doubt,\nflex will assume that you meant the literal numeric range, and will\nissue a warning.  The exception to this rule is a character range\nsuch as '[a-z]' or '[S-W]' where it is obvious that you want\ncase-folding to occur.  Here are some examples with the '-i' flag\nenabled:\n\nRange        Result      Literal Range        Alternate Range\n'[a-t]'      ok          '[a-tA-T]'\n'[A-T]'      ok          '[a-tA-T]'\n'[A-t]'      ambiguous   '[A-Z\\[\\\\\\]`a-t]'   '[a-tA-T]'\n'[-{]'      ambiguous   '[`a-z{]'           '[`a-zA-Z{]'\n'[@-C]'      ambiguous   '[@ABC]'             '[@A-Z\\[\\\\\\]`abc]'\n\n* A negated character class such as the example '[^A-Z]' above will\nmatch a newline unless '\\n' (or an equivalent escape sequence) is\none of the characters explicitly present in the negated character\nclass (e.g., '[^A-Z\\n]').  This is unlike how many other regular\nexpression tools treat negated character classes, but unfortunately\nthe inconsistency is historically entrenched.  Matching newlines\nmeans that a pattern like '[^\"]*' can match the entire input unless\nthere's another quote in the input.\n\nFlex allows negation of character class expressions by prepending\n'^' to the POSIX character class name.\n\n[:^alnum:] [:^alpha:] [:^blank:]\n[:^cntrl:] [:^digit:] [:^graph:]\n[:^lower:] [:^print:] [:^punct:]\n[:^space:] [:^upper:] [:^xdigit:]\n\nFlex will issue a warning if the expressions '[:^upper:]' and\n'[:^lower:]' appear in a case-insensitive scanner, since their\nmeaning is unclear.  The current behavior is to skip them entirely,\nbut this may change without notice in future revisions of flex.\n\n*\nThe '{-}' operator computes the difference of two character\nclasses.  For example, '[a-c]{-}[b-z]' represents all the\ncharacters in the class '[a-c]' that are not in the class '[b-z]'\n(which in this case, is just the single character 'a').  The '{-}'\noperator is left associative, so '[abc]{-}[b]{-}[c]' is the same as\n'[a]'.  Be careful not to accidentally create an empty set, which\nwill never match.\n\n*\nThe '{+}' operator computes the union of two character classes.\nFor example, '[a-z]{+}[0-9]' is the same as '[a-z0-9]'.  This\noperator is useful when preceded by the result of a difference\noperation, as in, '[[:alpha:]]{-}[[:lower:]]{+}[q]', which is\nequivalent to '[A-Zq]' in the \"C\" locale.\n\n* A rule can have at most one instance of trailing context (the '/'\noperator or the '$' operator).  The start condition, '^', and\n'<<EOF>>' patterns can only occur at the beginning of a pattern,\nand, as well as with '/' and '$', cannot be grouped inside\nparentheses.  A '^' which does not occur at the beginning of a rule\nor a '$' which does not occur at the end of a rule loses its\nspecial properties and is treated as a normal character.\n\n* The following are invalid:\n\nfoo/bar$\n<sc1>foo<sc2>bar\n\nNote that the first of these can be written 'foo/bar\\n'.\n\n* The following will result in '$' or '^' being treated as a normal\ncharacter:\n\nfoo|(bar$)\nfoo|^bar\n\nIf the desired meaning is a 'foo' or a 'bar'-followed-by-a-newline,\nthe following could be used (the special '|' action is explained\nbelow, *note Actions::):\n\nfoo      |\nbar$     /* action goes here */\n\nA similar trick will work for matching a 'foo' or a\n'bar'-at-the-beginning-of-a-line.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Matching,  Next: Actions,  Prev: Patterns,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "7 How the Input Is Matched": {
            "content": "",
            "subsections": []
        },
        "When the generated scanner is run, it analyzes its input looking for": {
            "content": "strings which match any of its patterns.  If it finds more than one\nmatch, it takes the one matching the most text (for trailing context\nrules, this includes the length of the trailing part, even though it\nwill then be returned to the input).  If it finds two or more matches of\nthe same length, the rule listed first in the 'flex' input file is\nchosen.\n\nOnce the match is determined, the text corresponding to the match\n(called the \"token\") is made available in the global character pointer\n'yytext', and its length in the global integer 'yyleng'.  The \"action\"\ncorresponding to the matched pattern is then executed (*note Actions::),\nand then the remaining input is scanned for another match.\n\nIf no match is found, then the \"default rule\" is executed: the next\ncharacter in the input is considered matched and copied to the standard\noutput.  Thus, the simplest valid 'flex' input is:\n\n%%\n\nwhich generates a scanner that simply copies its input (one character\nat a time) to its output.\n\nNote that 'yytext' can be defined in two different ways: either as a\ncharacter pointer or as a character array.  You can control which\ndefinition 'flex' uses by including one of the special directives\n'%pointer' or '%array' in the first (definitions) section of your flex\ninput.  The default is '%pointer', unless you use the '-l' lex\ncompatibility option, in which case 'yytext' will be an array.  The\nadvantage of using '%pointer' is substantially faster scanning and no\nbuffer overflow when matching very large tokens (unless you run out of\ndynamic memory).  The disadvantage is that you are restricted in how\nyour actions can modify 'yytext' (*note Actions::), and calls to the\n'unput()' function destroys the present contents of 'yytext', which can\nbe a considerable porting headache when moving between different 'lex'\nversions.\n\nThe advantage of '%array' is that you can then modify 'yytext' to\nyour heart's content, and calls to 'unput()' do not destroy 'yytext'\n(*note Actions::).  Furthermore, existing 'lex' programs sometimes\naccess 'yytext' externally using declarations of the form:\n\nextern char yytext[];\n\nThis definition is erroneous when used with '%pointer', but correct\nfor '%array'.\n\nThe '%array' declaration defines 'yytext' to be an array of 'YYLMAX'\ncharacters, which defaults to a fairly large value.  You can change the\nsize by simply #define'ing 'YYLMAX' to a different value in the first\nsection of your 'flex' input.  As mentioned above, with '%pointer'\nyytext grows dynamically to accommodate large tokens.  While this means\nyour '%pointer' scanner can accommodate very large tokens (such as\nmatching entire blocks of comments), bear in mind that each time the\nscanner must resize 'yytext' it also must rescan the entire token from\nthe beginning, so matching such tokens can prove slow.  'yytext'\npresently does not dynamically grow if a call to 'unput()' results in\ntoo much text being pushed back; instead, a run-time error results.\n\nAlso note that you cannot use '%array' with C++ scanner classes\n(*note Cxx::).\n",
            "subsections": []
        },
        "File: flex.info,  Node: Actions,  Next: Generated Scanner,  Prev: Matching,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "8 Actions": {
            "content": "Each pattern in a rule has a corresponding \"action\", which can be any\narbitrary C statement.  The pattern ends at the first non-escaped\nwhitespace character; the remainder of the line is its action.  If the\naction is empty, then when the pattern is matched the input token is\nsimply discarded.  For example, here is the specification for a program\nwhich deletes all occurrences of 'zap me' from its input:\n\n%%\n\"zap me\"\n\nThis example will copy all other characters in the input to the\noutput since they will be matched by the default rule.\n\nHere is a program which compresses multiple blanks and tabs down to a\nsingle blank, and throws away whitespace found at the end of a line:\n\n%%\n[ \\t]+        putchar( ' ' );\n[ \\t]+$       /* ignore this token */\n\nIf the action contains a '{', then the action spans till the\nbalancing '}' is found, and the action may cross multiple lines.  'flex'\nknows about C strings and comments and won't be fooled by braces found\nwithin them, but also allows actions to begin with '%{' and will\nconsider the action to be all the text up to the next '%}' (regardless\nof ordinary braces inside the action).\n\nAn action consisting solely of a vertical bar ('|') means \"same as\nthe action for the next rule\".  See below for an illustration.\n\nActions can include arbitrary C code, including 'return' statements\nto return a value to whatever routine called 'yylex()'.  Each time\n'yylex()' is called it continues processing tokens from where it last\nleft off until it either reaches the end of the file or executes a\nreturn.\n\nActions are free to modify 'yytext' except for lengthening it (adding\ncharacters to its end-these will overwrite later characters in the input\nstream).  This however does not apply when using '%array' (*note\nMatching::).  In that case, 'yytext' may be freely modified in any way.\n\nActions are free to modify 'yyleng' except they should not do so if\nthe action also includes use of 'yymore()' (see below).\n\nThere are a number of special directives which can be included within\nan action:\n\n'ECHO'\ncopies yytext to the scanner's output.\n\n'BEGIN'\nfollowed by the name of a start condition places the scanner in the\ncorresponding start condition (see below).\n\n'REJECT'\ndirects the scanner to proceed on to the \"second best\" rule which\nmatched the input (or a prefix of the input).  The rule is chosen\nas described above in *note Matching::, and 'yytext' and 'yyleng'\nset up appropriately.  It may either be one which matched as much\ntext as the originally chosen rule but came later in the 'flex'\ninput file, or one which matched less text.  For example, the\nfollowing will both count the words in the input and call the\nroutine 'special()' whenever 'frob' is seen:\n\nint wordcount = 0;\n%%\n\nfrob        special(); REJECT;\n[^ \\t\\n]+   ++wordcount;\n\nWithout the 'REJECT', any occurrences of 'frob' in the input would\nnot be counted as words, since the scanner normally executes only\none action per token.  Multiple uses of 'REJECT' are allowed, each\none finding the next best choice to the currently active rule.  For\nexample, when the following scanner scans the token 'abcd', it will\nwrite 'abcdabcaba' to the output:\n\n%%\na        |\nab       |\nabc      |\nabcd     ECHO; REJECT;\n.|\\n     /* eat up any unmatched character */\n\nThe first three rules share the fourth's action since they use the\nspecial '|' action.\n\n'REJECT' is a particularly expensive feature in terms of scanner\nperformance; if it is used in any of the scanner's actions it\nwill slow down all of the scanner's matching.  Furthermore,\n'REJECT' cannot be used with the '-Cf' or '-CF' options (*note\nScanner Options::).\n\nNote also that unlike the other special actions, 'REJECT' is a\nbranch.  Code immediately following it in the action will not\nbe executed.\n\n'yymore()'\ntells the scanner that the next time it matches a rule, the\ncorresponding token should be appended onto the current value of\n'yytext' rather than replacing it.  For example, given the input\n'mega-kludge' the following will write 'mega-mega-kludge' to the\noutput:\n\n%%\nmega-    ECHO; yymore();\nkludge   ECHO;\n\nFirst 'mega-' is matched and echoed to the output.  Then 'kludge'\nis matched, but the previous 'mega-' is still hanging around at the\nbeginning of 'yytext' so the 'ECHO' for the 'kludge' rule will\nactually write 'mega-kludge'.\n\nTwo notes regarding use of 'yymore()'.  First, 'yymore()' depends on\nthe value of 'yyleng' correctly reflecting the size of the current\ntoken, so you must not modify 'yyleng' if you are using 'yymore()'.",
            "subsections": []
        },
        "Second, the presence of 'yymore()' in the scanner's action entails a": {
            "content": "minor performance penalty in the scanner's matching speed.\n\n'yyless(n)' returns all but the first 'n' characters of the current\ntoken back to the input stream, where they will be rescanned when the\nscanner looks for the next match.  'yytext' and 'yyleng' are adjusted\nappropriately (e.g., 'yyleng' will now be equal to 'n').  For example,\non the input 'foobar' the following will write out 'foobarbar':\n\n%%\nfoobar    ECHO; yyless(3);\n[a-z]+    ECHO;\n\nAn argument of 0 to 'yyless()' will cause the entire current input\nstring to be scanned again.  Unless you've changed how the scanner will\nsubsequently process its input (using 'BEGIN', for example), this will\nresult in an endless loop.\n\nNote that 'yyless()' is a macro and can only be used in the flex\ninput file, not from other source files.\n\n'unput(c)' puts the character 'c' back onto the input stream.  It\nwill be the next character scanned.  The following action will take the\ncurrent token and cause it to be rescanned enclosed in parentheses.\n\n{\nint i;\n/* Copy yytext because unput() trashes yytext */\nchar *yycopy = strdup( yytext );\nunput( ')' );\nfor ( i = yyleng - 1; i >= 0; --i )\nunput( yycopy[i] );\nunput( '(' );\nfree( yycopy );\n}\n\nNote that since each 'unput()' puts the given character back at the\nbeginning of the input stream, pushing back strings must be done\nback-to-front.\n\nAn important potential problem when using 'unput()' is that if you\nare using '%pointer' (the default), a call to 'unput()' destroys the\ncontents of 'yytext', starting with its rightmost character and\ndevouring one character to the left with each call.  If you need the\nvalue of 'yytext' preserved after a call to 'unput()' (as in the above\nexample), you must either first copy it elsewhere, or build your scanner\nusing '%array' instead (*note Matching::).\n\nFinally, note that you cannot put back 'EOF' to attempt to mark the\ninput stream with an end-of-file.\n\n'input()' reads the next character from the input stream.  For\nexample, the following is one way to eat up C comments:\n\n%%\n\"/*\"        {\nint c;\n\nfor ( ; ; )\n{\nwhile ( (c = input()) != '*' &&\nc != EOF )\n;    /* eat up text of comment */\n\nif ( c == '*' )\n{\nwhile ( (c = input()) == '*' )\n;\nif ( c == '/' )\nbreak;    /* found the end */\n}\n\nif ( c == EOF )\n{\nerror( \"EOF in comment\" );\nbreak;\n}\n}\n}\n\n(Note that if the scanner is compiled using 'C++', then 'input()' is\ninstead referred to as yyinput(), in order to avoid a name clash with\nthe 'C++' stream by the name of 'input'.)\n\n'YYFLUSHBUFFER;' flushes the scanner's internal buffer so that the\nnext time the scanner attempts to match a token, it will first refill\nthe buffer using 'YYINPUT()' (*note Generated Scanner::).  This action\nis a special case of the more general 'yyflushbuffer;' function,\ndescribed below (*note Multiple Input Buffers::)\n\n'yyterminate()' can be used in lieu of a return statement in an\naction.  It terminates the scanner and returns a 0 to the scanner's\ncaller, indicating \"all done\".  By default, 'yyterminate()' is also\ncalled when an end-of-file is encountered.  It is a macro and may be\nredefined.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Generated Scanner,  Next: Start Conditions,  Prev: Actions,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "9 The Generated Scanner": {
            "content": "",
            "subsections": []
        },
        "The output of 'flex' is the file 'lex.yy.c', which contains the scanning": {
            "content": "routine 'yylex()', a number of tables used by it for matching tokens,\nand a number of auxiliary routines and macros.  By default, 'yylex()' is\ndeclared as follows:\n\nint yylex()\n{\n... various definitions and the actions in here ...\n}\n\n(If your environment supports function prototypes, then it will be\n'int yylex( void )'.)  This definition may be changed by defining the\n'YYDECL' macro.  For example, you could use:\n\n#define YYDECL float lexscan( a, b ) float a, b;\n\nto give the scanning routine the name 'lexscan', returning a float,\nand taking two floats as arguments.  Note that if you give arguments to\nthe scanning routine using a K&R-style/non-prototyped function\ndeclaration, you must terminate the definition with a semi-colon (;).\n\n'flex' generates 'C99' function definitions by default.  Flex used to\nhave the ability to generate obsolete, er, 'traditional', function\ndefinitions.  This was to support bootstrapping gcc on old systems.",
            "subsections": []
        },
        "Unfortunately, traditional definitions prevent us from using any": {
            "content": "standard data types smaller than int (such as short, char, or bool) as\nfunction arguments.  Furthermore, traditional definitions support added\nextra complexity in the skeleton file.  For this reason, current\nversions of 'flex' generate standard C99 code only, leaving K&R-style\nfunctions to the historians.\n\nWhenever 'yylex()' is called, it scans tokens from the global input\nfile 'yyin' (which defaults to stdin).  It continues until it either\nreaches an end-of-file (at which point it returns the value 0) or one of\nits actions executes a 'return' statement.\n\nIf the scanner reaches an end-of-file, subsequent calls are undefined\nunless either 'yyin' is pointed at a new input file (in which case\nscanning continues from that file), or 'yyrestart()' is called.\n'yyrestart()' takes one argument, a 'FILE *' pointer (which can be NULL,\nif you've set up 'YYINPUT' to scan from a source other than 'yyin'),\nand initializes 'yyin' for scanning from that file.  Essentially there\nis no difference between just assigning 'yyin' to a new input file or\nusing 'yyrestart()' to do so; the latter is available for compatibility\nwith previous versions of 'flex', and because it can be used to switch\ninput files in the middle of scanning.  It can also be used to throw\naway the current input buffer, by calling it with an argument of 'yyin';\nbut it would be better to use 'YYFLUSHBUFFER' (*note Actions::).  Note\nthat 'yyrestart()' does not reset the start condition to 'INITIAL'\n(*note Start Conditions::).\n\nIf 'yylex()' stops scanning due to executing a 'return' statement in\none of the actions, the scanner may then be called again and it will\nresume scanning where it left off.\n\nBy default (and for purposes of efficiency), the scanner uses\nblock-reads rather than simple 'getc()' calls to read characters from\n'yyin'.  The nature of how it gets its input can be controlled by\ndefining the 'YYINPUT' macro.  The calling sequence for 'YYINPUT()' is\n'YYINPUT(buf,result,maxsize)'.  Its action is to place up to\n'maxsize' characters in the character array 'buf' and return in the\ninteger variable 'result' either the number of characters read or the\nconstant 'YYNULL' (0 on Unix systems) to indicate 'EOF'.  The default\n'YYINPUT' reads from the global file-pointer 'yyin'.\n\nHere is a sample definition of 'YYINPUT' (in the definitions section\nof the input file):\n\n%{\n#define YYINPUT(buf,result,maxsize) \\\n{ \\\nint c = getchar(); \\\nresult = (c == EOF) ? YYNULL : (buf[0] = c, 1); \\\n}\n%}\n\nThis definition will change the input processing to occur one\ncharacter at a time.\n\nWhen the scanner receives an end-of-file indication from YYINPUT, it\nthen checks the 'yywrap()' function.  If 'yywrap()' returns false\n(zero), then it is assumed that the function has gone ahead and set up\n'yyin' to point to another input file, and scanning continues.  If it\nreturns true (non-zero), then the scanner terminates, returning 0 to its\ncaller.  Note that in either case, the start condition remains\nunchanged; it does not revert to 'INITIAL'.\n\nIf you do not supply your own version of 'yywrap()', then you must\neither use '%option noyywrap' (in which case the scanner behaves as\nthough 'yywrap()' returned 1), or you must link with '-lfl' to obtain\nthe default version of the routine, which always returns 1.\n\nFor scanning from in-memory buffers (e.g., scanning strings), see\n*note Scanning Strings::.  *Note Multiple Input Buffers::.\n\nThe scanner writes its 'ECHO' output to the 'yyout' global (default,\n'stdout'), which may be redefined by the user simply by assigning it to\nsome other 'FILE' pointer.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Start Conditions,  Next: Multiple Input Buffers,  Prev: Generated Scanner,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "10 Start Conditions": {
            "content": "'flex' provides a mechanism for conditionally activating rules.  Any\nrule whose pattern is prefixed with '<sc>' will only be active when the\nscanner is in the \"start condition\" named 'sc'.  For example,\n\n<STRING>[^\"]*        { /* eat up the string body ... */\n...\n}\n\nwill be active only when the scanner is in the 'STRING' start\ncondition, and\n\n<INITIAL,STRING,QUOTE>\\.        { /* handle an escape ... */\n...\n}\n\nwill be active only when the current start condition is either\n'INITIAL', 'STRING', or 'QUOTE'.\n\nStart conditions are declared in the definitions (first) section of\nthe input using unindented lines beginning with either '%s' or '%x'\nfollowed by a list of names.  The former declares \"inclusive\" start\nconditions, the latter \"exclusive\" start conditions.  A start condition\nis activated using the 'BEGIN' action.  Until the next 'BEGIN' action is\nexecuted, rules with the given start condition will be active and rules\nwith other start conditions will be inactive.  If the start condition is\ninclusive, then rules with no start conditions at all will also be\nactive.  If it is exclusive, then only rules qualified with the start\ncondition will be active.  A set of rules contingent on the same\nexclusive start condition describe a scanner which is independent of any\nof the other rules in the 'flex' input.  Because of this, exclusive\nstart conditions make it easy to specify \"mini-scanners\" which scan\nportions of the input that are syntactically different from the rest\n(e.g., comments).\n\nIf the distinction between inclusive and exclusive start conditions\nis still a little vague, here's a simple example illustrating the\nconnection between the two.  The set of rules:\n\n%s example\n%%\n\n<example>foo   dosomething();\n\nbar            somethingelse();\n\nis equivalent to\n\n%x example\n%%\n\n<example>foo   dosomething();\n\n<INITIAL,example>bar    somethingelse();\n\nWithout the '<INITIAL,example>' qualifier, the 'bar' pattern in the\nsecond example wouldn't be active (i.e., couldn't match) when in start\ncondition 'example'.  If we just used '<example>' to qualify 'bar',\nthough, then it would only be active in 'example' and not in 'INITIAL',\nwhile in the first example it's active in both, because in the first\nexample the 'example' start condition is an inclusive '(%s)' start\ncondition.\n\nAlso note that the special start-condition specifier '<*>' matches\nevery start condition.  Thus, the above example could also have been\nwritten:\n\n%x example\n%%\n\n<example>foo   dosomething();\n\n<*>bar    somethingelse();\n\nThe default rule (to 'ECHO' any unmatched character) remains active\nin start conditions.  It is equivalent to:\n\n<*>.|\\n     ECHO;\n\n'BEGIN(0)' returns to the original state where only the rules with no\nstart conditions are active.  This state can also be referred to as the\nstart-condition 'INITIAL', so 'BEGIN(INITIAL)' is equivalent to\n'BEGIN(0)'.  (The parentheses around the start condition name are not\nrequired but are considered good style.)\n\n'BEGIN' actions can also be given as indented code at the beginning\nof the rules section.  For example, the following will cause the scanner\nto enter the 'SPECIAL' start condition whenever 'yylex()' is called and\nthe global variable 'enterspecial' is true:\n\nint enterspecial;\n\n%x SPECIAL\n%%\nif ( enterspecial )\nBEGIN(SPECIAL);\n\n<SPECIAL>blahblahblah\n...more rules follow...\n\nTo illustrate the uses of start conditions, here is a scanner which\nprovides two different interpretations of a string like '123.456'.  By\ndefault it will treat it as three tokens, the integer '123', a dot\n('.'), and the integer '456'.  But if the string is preceded earlier in\nthe line by the string 'expect-floats' it will treat it as a single\ntoken, the floating-point number '123.456':\n\n%{\n#include <math.h>\n%}\n%s expect\n\n%%\nexpect-floats        BEGIN(expect);\n\n<expect>[0-9]+.[0-9]+      {\nprintf( \"found a float, = %f\\n\",\natof( yytext ) );\n}\n<expect>\\n           {\n/* that's the end of the line, so\n* we need another \"expect-number\"\n* before we'll recognize any more\n* numbers\n*/\nBEGIN(INITIAL);\n}\n\n[0-9]+      {\nprintf( \"found an integer, = %d\\n\",\natoi( yytext ) );\n}\n\n\".\"         printf( \"found a dot\\n\" );\n\nHere is a scanner which recognizes (and discards) C comments while\nmaintaining a count of the current input line.\n\n%x comment\n%%\nint linenum = 1;\n\n\"/*\"         BEGIN(comment);\n\n<comment>[^*\\n]*        /* eat anything that's not a '*' */\n<comment>\"*\"+[^*/\\n]*   /* eat up '*'s not followed by '/'s */\n<comment>\\n             ++linenum;\n<comment>\"*\"+\"/\"        BEGIN(INITIAL);\n\nThis scanner goes to a bit of trouble to match as much text as\npossible with each rule.  In general, when attempting to write a\nhigh-speed scanner try to match as much possible in each rule, as it's a\nbig win.\n\nNote that start-conditions names are really integer values and can be\nstored as such.  Thus, the above could be extended in the following\nfashion:\n\n%x comment foo\n%%\nint linenum = 1;\nint commentcaller;\n\n\"/*\"         {\ncommentcaller = INITIAL;\nBEGIN(comment);\n}\n\n...\n\n<foo>\"/*\"    {\ncommentcaller = foo;\nBEGIN(comment);\n}\n\n<comment>[^*\\n]*        /* eat anything that's not a '*' */\n<comment>\"*\"+[^*/\\n]*   /* eat up '*'s not followed by '/'s */\n<comment>\\n             ++linenum;\n<comment>\"*\"+\"/\"        BEGIN(commentcaller);\n\nFurthermore, you can access the current start condition using the\ninteger-valued 'YYSTART' macro.  For example, the above assignments to\n'commentcaller' could instead be written\n\ncommentcaller = YYSTART;\n\nFlex provides 'YYSTATE' as an alias for 'YYSTART' (since that is\nwhat's used by AT&T 'lex').\n\nFor historical reasons, start conditions do not have their own\nname-space within the generated scanner.  The start condition names are\nunmodified in the generated scanner and generated header.  *Note\noption-header::.  *Note option-prefix::.\n\nFinally, here's an example of how to match C-style quoted strings\nusing exclusive start conditions, including expanded escape sequences\n(but not including checking for a string that's too long):\n\n%x str\n\n%%\nchar stringbuf[MAXSTRCONST];\nchar *stringbufptr;\n\n\n\\\"      stringbufptr = stringbuf; BEGIN(str);\n\n<str>\\\"        { /* saw closing quote - all done */\nBEGIN(INITIAL);\n*stringbufptr = '\\0';\n/* return string constant token type and\n* value to parser\n*/\n}\n\n<str>\\n        {\n/* error - unterminated string constant */\n/* generate error message */\n}\n\n<str>\\\\[0-7]{1,3} {\n/* octal escape sequence */\nint result;\n\n(void) sscanf( yytext + 1, \"%o\", &result );\n\nif ( result > 0xff )\n/* error, constant is out-of-bounds */\n\n*stringbufptr++ = result;\n}\n\n<str>\\\\[0-9]+ {\n/* generate error - bad escape sequence; something\n* like '\\48' or '\\0777777'\n*/\n}\n\n<str>\\\\n  *stringbufptr++ = '\\n';\n<str>\\\\t  *stringbufptr++ = '\\t';\n<str>\\\\r  *stringbufptr++ = '\\r';\n<str>\\\\b  *stringbufptr++ = '\\b';\n<str>\\\\f  *stringbufptr++ = '\\f';\n\n<str>\\\\(.|\\n)  *stringbufptr++ = yytext[1];\n\n<str>[^\\\\\\n\\\"]+        {\nchar *yptr = yytext;\n\nwhile ( *yptr )\n*stringbufptr++ = *yptr++;\n}\n\nOften, such as in some of the examples above, you wind up writing a\nwhole bunch of rules all preceded by the same start condition(s).  Flex\nmakes this a little easier and cleaner by introducing a notion of start\ncondition \"scope\".  A start condition scope is begun with:\n\n<SCs>{\n\nwhere '<SCs>' is a list of one or more start conditions.  Inside the\nstart condition scope, every rule automatically has the prefix '<SCs>'\napplied to it, until a '}' which matches the initial '{'.  So, for\nexample,\n\n<ESC>{\n\"\\\\n\"   return '\\n';\n\"\\\\r\"   return '\\r';\n\"\\\\f\"   return '\\f';\n\"\\\\0\"   return '\\0';\n}\n\nis equivalent to:\n\n<ESC>\"\\\\n\"  return '\\n';\n<ESC>\"\\\\r\"  return '\\r';\n<ESC>\"\\\\f\"  return '\\f';\n<ESC>\"\\\\0\"  return '\\0';\n\nStart condition scopes may be nested.\n\nThe following routines are available for manipulating stacks of start\nconditions:\n\n-- Function: void yypushstate ( int newstate )\npushes the current start condition onto the top of the start\ncondition stack and switches to 'newstate' as though you had used\n'BEGIN newstate' (recall that start condition names are also\nintegers).\n\n-- Function: void yypopstate ()\npops the top of the stack and switches to it via 'BEGIN'.\n\n-- Function: int yytopstate ()\nreturns the top of the stack without altering the stack's contents.\n\nThe start condition stack grows dynamically and so has no built-in\nsize limitation.  If memory is exhausted, program execution aborts.\n\nTo use start condition stacks, your scanner must include a '%option\nstack' directive (*note Scanner Options::).\n",
            "subsections": []
        },
        "File: flex.info,  Node: Multiple Input Buffers,  Next: EOF,  Prev: Start Conditions,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "11 Multiple Input Buffers": {
            "content": "Some scanners (such as those which support \"include\" files) require\nreading from several input streams.  As 'flex' scanners do a large\namount of buffering, one cannot control where the next input will be\nread from by simply writing a 'YYINPUT()' which is sensitive to the\nscanning context.  'YYINPUT()' is only called when the scanner reaches\nthe end of its buffer, which may be a long time after scanning a\nstatement such as an 'include' statement which requires switching the\ninput source.\n\nTo negotiate these sorts of problems, 'flex' provides a mechanism for\ncreating and switching between multiple input buffers.  An input buffer\nis created by using:\n\n-- Function: YYBUFFERSTATE yycreatebuffer ( FILE *file, int size )\n\nwhich takes a 'FILE' pointer and a size and creates a buffer\nassociated with the given file and large enough to hold 'size'\ncharacters (when in doubt, use 'YYBUFSIZE' for the size).  It returns\na 'YYBUFFERSTATE' handle, which may then be passed to other routines\n(see below).  The 'YYBUFFERSTATE' type is a pointer to an opaque\n'struct yybufferstate' structure, so you may safely initialize\n'YYBUFFERSTATE' variables to '((YYBUFFERSTATE) 0)' if you wish, and\nalso refer to the opaque structure in order to correctly declare input\nbuffers in source files other than that of your scanner.  Note that the\n'FILE' pointer in the call to 'yycreatebuffer' is only used as the\nvalue of 'yyin' seen by 'YYINPUT'.  If you redefine 'YYINPUT()' so it\nno longer uses 'yyin', then you can safely pass a NULL 'FILE' pointer to\n'yycreatebuffer'.  You select a particular buffer to scan from using:\n\n-- Function: void yyswitchtobuffer ( YYBUFFERSTATE newbuffer )\n\nThe above function switches the scanner's input buffer so subsequent\ntokens will come from 'newbuffer'.  Note that 'yyswitchtobuffer()'\nmay be used by 'yywrap()' to set things up for continued scanning,\ninstead of opening a new file and pointing 'yyin' at it.  If you are\nlooking for a stack of input buffers, then you want to use\n'yypushbufferstate()' instead of this function.  Note also that\nswitching input sources via either 'yyswitchtobuffer()' or 'yywrap()'\ndoes not change the start condition.\n\n-- Function: void yydeletebuffer ( YYBUFFERSTATE buffer )\n\nis used to reclaim the storage associated with a buffer.  ('buffer'\ncan be NULL, in which case the routine does nothing.)  You can also\nclear the current contents of a buffer using:\n\n-- Function: void yypushbufferstate ( YYBUFFERSTATE buffer )\n\nThis function pushes the new buffer state onto an internal stack.",
            "subsections": []
        },
        "The pushed state becomes the new current state.  The stack is maintained": {
            "content": "by flex and will grow as required.  This function is intended to be used\ninstead of 'yyswitchtobuffer', when you want to change states, but\npreserve the current state for later use.\n\n-- Function: void yypopbufferstate ( )\n\nThis function removes the current state from the top of the stack,\nand deletes it by calling 'yydeletebuffer'.  The next state on the\nstack, if any, becomes the new current state.\n\n-- Function: void yyflushbuffer ( YYBUFFERSTATE buffer )\n\nThis function discards the buffer's contents, so the next time the\nscanner attempts to match a token from the buffer, it will first fill\nthe buffer anew using 'YYINPUT()'.\n\n-- Function: YYBUFFERSTATE yynewbuffer ( FILE *file, int size )\n\nis an alias for 'yycreatebuffer()', provided for compatibility with\nthe C++ use of 'new' and 'delete' for creating and destroying dynamic\nobjects.\n\n'YYCURRENTBUFFER' macro returns a 'YYBUFFERSTATE' handle to the\ncurrent buffer.  It should not be used as an lvalue.\n\nHere are two examples of using these features for writing a scanner\nwhich expands include files (the '<<EOF>>' feature is discussed below).\n\nThis first example uses yypushbufferstate and yypopbufferstate.\nFlex maintains the stack internally.\n\n/* the \"incl\" state is used for picking up the name\n* of an include file\n*/\n%x incl\n%%\ninclude             BEGIN(incl);\n\n[a-z]+              ECHO;\n[^a-z\\n]*\\n?        ECHO;\n\n<incl>[ \\t]*      /* eat the whitespace */\n<incl>[^ \\t\\n]+   { /* got the include file name */\nyyin = fopen( yytext, \"r\" );\n\nif ( ! yyin )\nerror( ... );\n\nyypushbufferstate(yycreatebuffer( yyin, YYBUFSIZE ));\n\nBEGIN(INITIAL);\n}\n\n<<EOF>> {\nyypopbufferstate();\n\nif ( !YYCURRENTBUFFER )\n{\nyyterminate();\n}\n}\n\nThe second example, below, does the same thing as the previous\nexample did, but manages its own input buffer stack manually (instead of\nletting flex do it).\n\n/* the \"incl\" state is used for picking up the name\n* of an include file\n*/\n%x incl\n\n%{\n#define MAXINCLUDEDEPTH 10\nYYBUFFERSTATE includestack[MAXINCLUDEDEPTH];\nint includestackptr = 0;\n%}\n\n%%\ninclude             BEGIN(incl);\n\n[a-z]+              ECHO;\n[^a-z\\n]*\\n?        ECHO;\n\n<incl>[ \\t]*      /* eat the whitespace */\n<incl>[^ \\t\\n]+   { /* got the include file name */\nif ( includestackptr >= MAXINCLUDEDEPTH )\n{\nfprintf( stderr, \"Includes nested too deeply\" );\nexit( 1 );\n}\n\nincludestack[includestackptr++] =\nYYCURRENTBUFFER;\n\nyyin = fopen( yytext, \"r\" );\n\nif ( ! yyin )\nerror( ... );\n\nyyswitchtobuffer(\nyycreatebuffer( yyin, YYBUFSIZE ) );\n\nBEGIN(INITIAL);\n}\n\n<<EOF>> {\nif ( --includestackptr == 0 )\n{\nyyterminate();\n}\n\nelse\n{\nyydeletebuffer( YYCURRENTBUFFER );\nyyswitchtobuffer(\nincludestack[includestackptr] );\n}\n}\n\nThe following routines are available for setting up input buffers for\nscanning in-memory strings instead of files.  All of them create a new\ninput buffer for scanning the string, and return a corresponding\n'YYBUFFERSTATE' handle (which you should delete with\n'yydeletebuffer()' when done with it).  They also switch to the new\nbuffer using 'yyswitchtobuffer()', so the next call to 'yylex()' will\nstart scanning the string.\n\n-- Function: YYBUFFERSTATE yyscanstring ( const char *str )\nscans a NUL-terminated string.\n\n-- Function: YYBUFFERSTATE yyscanbytes ( const char *bytes, int len\n)\nscans 'len' bytes (including possibly 'NUL's) starting at location\n'bytes'.\n\nNote that both of these functions create and scan a copy of the\nstring or bytes.  (This may be desirable, since 'yylex()' modifies the\ncontents of the buffer it is scanning.)  You can avoid the copy by\nusing:\n\n-- Function: YYBUFFERSTATE yyscanbuffer (char *base, yysizet\nsize)\nwhich scans in place the buffer starting at 'base', consisting of\n'size' bytes, the last two bytes of which must be\n'YYENDOFBUFFERCHAR' (ASCII NUL). These last two bytes are not\nscanned; thus, scanning consists of 'base[0]' through\n'base[size-2]', inclusive.\n\nIf you fail to set up 'base' in this manner (i.e., forget the final\ntwo 'YYENDOFBUFFERCHAR' bytes), then 'yyscanbuffer()' returns a\nNULL pointer instead of creating a new input buffer.\n\n-- Data type: yysizet\nis an integral type to which you can cast an integer expression\nreflecting the size of the buffer.\n",
            "subsections": []
        },
        "File: flex.info,  Node: EOF,  Next: Misc Macros,  Prev: Multiple Input Buffers,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "12 End-of-File Rules": {
            "content": "The special rule '<<EOF>>' indicates actions which are to be taken when\nan end-of-file is encountered and 'yywrap()' returns non-zero (i.e.,\nindicates no further files to process).  The action must finish by doing\none of the following things:\n\n* assigning 'yyin' to a new input file (in previous versions of\n'flex', after doing the assignment you had to call the special\naction 'YYNEWFILE'.  This is no longer necessary.)\n\n* executing a 'return' statement;\n\n* executing the special 'yyterminate()' action.\n\n* or, switching to a new buffer using 'yyswitchtobuffer()' as\nshown in the example above.\n\n<<EOF>> rules may not be used with other patterns; they may only be\nqualified with a list of start conditions.  If an unqualified <<EOF>>\nrule is given, it applies to all start conditions which do not already\nhave <<EOF>> actions.  To specify an <<EOF>> rule for only the initial\nstart condition, use:\n\n<INITIAL><<EOF>>\n\nThese rules are useful for catching things like unclosed comments.\nAn example:\n\n%x quote\n%%\n\n...other rules for dealing with quotes...\n\n<quote><<EOF>>   {\nerror( \"unterminated quote\" );\nyyterminate();\n}\n<<EOF>>  {\nif ( *++filelist )\nyyin = fopen( *filelist, \"r\" );\nelse\nyyterminate();\n}\n",
            "subsections": []
        },
        "File: flex.info,  Node: Misc Macros,  Next: User Values,  Prev: EOF,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "13 Miscellaneous Macros": {
            "content": "",
            "subsections": []
        },
        "The macro 'YYUSERACTION' can be defined to provide an action which is": {
            "content": "always executed prior to the matched rule's action.  For example, it\ncould be #define'd to call a routine to convert yytext to lower-case.",
            "subsections": []
        },
        "When 'YYUSERACTION' is invoked, the variable 'yyact' gives the number": {
            "content": "of the matched rule (rules are numbered starting with 1).  Suppose you\nwant to profile how often each of your rules is matched.  The following\nwould do the trick:\n\n#define YYUSERACTION ++ctr[yyact]\n\nwhere 'ctr' is an array to hold the counts for the different rules.",
            "subsections": []
        },
        "Note that the macro 'YYNUMRULES' gives the total number of rules": {
            "content": "(including the default rule), even if you use '-s)', so a correct\ndeclaration for 'ctr' is:\n\nint ctr[YYNUMRULES];\n\nThe macro 'YYUSERINIT' may be defined to provide an action which is\nalways executed before the first scan (and before the scanner's internal\ninitializations are done).  For example, it could be used to call a\nroutine to read in a data table or open a logging file.\n\nThe macro 'yysetinteractive(isinteractive)' can be used to control\nwhether the current buffer is considered \"interactive\".  An interactive\nbuffer is processed more slowly, but must be used when the scanner's\ninput source is indeed interactive to avoid problems due to waiting to\nfill buffers (see the discussion of the '-I' flag in *note Scanner",
            "subsections": []
        },
        "Options::).  A non-zero value in the macro invocation marks the buffer": {
            "content": "as interactive, a zero value as non-interactive.  Note that use of this\nmacro overrides '%option always-interactive' or '%option\nnever-interactive' (*note Scanner Options::).  'yysetinteractive()'\nmust be invoked prior to beginning to scan the buffer that is (or is\nnot) to be considered interactive.\n\nThe macro 'yysetbol(atbol)' can be used to control whether the\ncurrent buffer's scanning context for the next token match is done as\nthough at the beginning of a line.  A non-zero macro argument makes\nrules anchored with '^' active, while a zero argument makes '^' rules\ninactive.\n\nThe macro 'YYATBOL()' returns true if the next token scanned from\nthe current buffer will have '^' rules active, false otherwise.\n\nIn the generated scanner, the actions are all gathered in one large\nswitch statement and separated using 'YYBREAK', which may be redefined.",
            "subsections": []
        },
        "By default, it is simply a 'break', to separate each rule's action from": {
            "content": "the following rule's.  Redefining 'YYBREAK' allows, for example, C++\nusers to #define YYBREAK to do nothing (while being very careful that\nevery rule ends with a 'break' or a 'return'!)  to avoid suffering from\nunreachable statement warnings where because a rule's action ends with\n'return', the 'YYBREAK' is inaccessible.\n",
            "subsections": []
        },
        "File: flex.info,  Node: User Values,  Next: Yacc,  Prev: Misc Macros,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "14 Values Available To the User": {
            "content": "",
            "subsections": []
        },
        "This chapter summarizes the various values available to the user in the": {
            "content": "rule actions.\n\n'char *yytext'\nholds the text of the current token.  It may be modified but not\nlengthened (you cannot append characters to the end).\n\nIf the special directive '%array' appears in the first section of\nthe scanner description, then 'yytext' is instead declared 'char\nyytext[YYLMAX]', where 'YYLMAX' is a macro definition that you can\nredefine in the first section if you don't like the default value\n(generally 8KB). Using '%array' results in somewhat slower\nscanners, but the value of 'yytext' becomes immune to calls to\n'unput()', which potentially destroy its value when 'yytext' is a\ncharacter pointer.  The opposite of '%array' is '%pointer', which\nis the default.\n\nYou cannot use '%array' when generating C++ scanner classes (the\n'-+' flag).\n\n'int yyleng'\nholds the length of the current token.\n\n'FILE *yyin'\nis the file which by default 'flex' reads from.  It may be\nredefined but doing so only makes sense before scanning begins or\nafter an EOF has been encountered.  Changing it in the midst of\nscanning will have unexpected results since 'flex' buffers its\ninput; use 'yyrestart()' instead.  Once scanning terminates because\nan end-of-file has been seen, you can assign 'yyin' at the new\ninput file and then call the scanner again to continue scanning.\n\n'void yyrestart( FILE *newfile )'\nmay be called to point 'yyin' at the new input file.  The\nswitch-over to the new file is immediate (any previously\nbuffered-up input is lost).  Note that calling 'yyrestart()' with\n'yyin' as an argument thus throws away the current input buffer and\ncontinues scanning the same input file.\n\n'FILE *yyout'\nis the file to which 'ECHO' actions are done.  It can be reassigned\nby the user.\n\n'YYCURRENTBUFFER'\nreturns a 'YYBUFFERSTATE' handle to the current buffer.\n\n'YYSTART'\nreturns an integer value corresponding to the current start\ncondition.  You can subsequently use this value with 'BEGIN' to\nreturn to that start condition.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Yacc,  Next: Scanner Options,  Prev: User Values,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "15 Interfacing with Yacc": {
            "content": "",
            "subsections": []
        },
        "One of the main uses of 'flex' is as a companion to the 'yacc'": {
            "content": "parser-generator.  'yacc' parsers expect to call a routine named\n'yylex()' to find the next input token.  The routine is supposed to\nreturn the type of the next token as well as putting any associated\nvalue in the global 'yylval'.  To use 'flex' with 'yacc', one specifies\nthe '-d' option to 'yacc' to instruct it to generate the file 'y.tab.h'\ncontaining definitions of all the '%tokens' appearing in the 'yacc'\ninput.  This file is then included in the 'flex' scanner.  For example,\nif one of the tokens is 'TOKNUMBER', part of the scanner might look\nlike:\n\n%{\n#include \"y.tab.h\"\n%}\n\n%%\n\n[0-9]+        yylval = atoi( yytext ); return TOKNUMBER;\n",
            "subsections": []
        },
        "File: flex.info,  Node: Scanner Options,  Next: Performance,  Prev: Yacc,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "16 Scanner Options": {
            "content": "",
            "subsections": []
        },
        "The various 'flex' options are categorized by function in the following": {
            "content": "menu.  If you want to lookup a particular option by name, *Note Index of\nScanner Options::.\n\n* Menu:\n\n* Options for Specifying Filenames::\n* Options Affecting Scanner Behavior::\n* Code-Level And API Options::\n* Options for Scanner Speed and Size::\n* Debugging Options::\n* Miscellaneous Options::\n\nEven though there are many scanner options, a typical scanner might\nonly specify the following options:\n\n%option   8bit reentrant bison-bridge\n%option   warn nodefault\n%option   yylineno\n%option   outfile=\"scanner.c\" header-file=\"scanner.h\"\n\nThe first line specifies the general type of scanner we want.  The\nsecond line specifies that we are being careful.  The third line asks\nflex to track line numbers.  The last line tells flex what to name the\nfiles.  (The options can be specified in any order.  We just divided\nthem.)\n\n'flex' also provides a mechanism for controlling options within the\nscanner specification itself, rather than from the flex command-line.\nThis is done by including '%option' directives in the first section of\nthe scanner specification.  You can specify multiple options with a\nsingle '%option' directive, and multiple directives in the first section\nof your flex input file.\n\nMost options are given simply as names, optionally preceded by the\nword 'no' (with no intervening whitespace) to negate their meaning.  The\nnames are the same as their long-option equivalents (but without the\nleading '--' ).\n\n'flex' scans your rule actions to determine whether you use the\n'REJECT' or 'yymore()' features.  The 'REJECT' and 'yymore' options are\navailable to override its decision as to whether you use the options,\neither by setting them (e.g., '%option reject)' to indicate the feature\nis indeed used, or unsetting them to indicate it actually is not used\n(e.g., '%option noyymore)'.\n\nA number of options are available for lint purists who want to\nsuppress the appearance of unneeded routines in the generated scanner.\nEach of the following, if unset (e.g., '%option nounput'), results in\nthe corresponding routine not appearing in the generated scanner:\n\ninput, unput\nyypushstate, yypopstate, yytopstate\nyyscanbuffer, yyscanbytes, yyscanstring\n\nyygetextra, yysetextra, yygetleng, yygettext,\nyygetlineno, yysetlineno, yygetin, yysetin,\nyygetout, yysetout, yygetlval, yysetlval,\nyygetlloc, yysetlloc, yygetdebug, yysetdebug\n\n(though 'yypushstate()' and friends won't appear anyway unless you\nuse '%option stack)'.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Options for Specifying Filenames,  Next: Options Affecting Scanner Behavior,  Prev: Scanner Options,  Up: Scanner Options": {
            "content": "",
            "subsections": [
                {
                    "name": "16.1 Options for Specifying Filenames",
                    "content": "'--header-file=FILE, '%option header-file=\"FILE\"''\ninstructs flex to write a C header to 'FILE'.  This file contains\nfunction prototypes, extern variables, and types used by the\nscanner.  Only the external API is exported by the header file.\nMany macros that are usable from within scanner actions are not\nexported to the header file.  This is due to namespace problems and\nthe goal of a clean external API.\n\nWhile in the header, the macro 'yyINHEADER' is defined, where 'yy'\nis substituted with the appropriate prefix.\n\nThe '--header-file' option is not compatible with the '--c++'\noption, since the C++ scanner provides its own header in\n'yyFlexLexer.h'.\n\n'-oFILE, --outfile=FILE, '%option outfile=\"FILE\"''\ndirects flex to write the scanner to the file 'FILE' instead of\n'lex.yy.c'.  If you combine '--outfile' with the '--stdout' option,\nthen the scanner is written to 'stdout' but its '#line' directives\n(see the '-l' option above) refer to the file 'FILE'.\n\n'-t, --stdout, '%option stdout''\ninstructs 'flex' to write the scanner it generates to standard\noutput instead of 'lex.yy.c'.\n\n'-SFILE, --skel=FILE'\noverrides the default skeleton file from which 'flex' constructs\nits scanners.  You'll never need this option unless you are doing\n'flex' maintenance or development.\n\n'--tables-file=FILE'\nWrite serialized scanner dfa tables to FILE. The generated scanner\nwill not contain the tables, and requires them to be loaded at\nruntime.  *Note serialization::.\n\n'--tables-verify'\nThis option is for flex development.  We document it here in case\nyou stumble upon it by accident or in case you suspect some\ninconsistency in the serialized tables.  Flex will serialize the\nscanner dfa tables but will also generate the in-code tables as it\nnormally does.  At runtime, the scanner will verify that the\nserialized tables match the in-code tables, instead of loading\nthem.\n"
                }
            ]
        },
        "File: flex.info,  Node: Options Affecting Scanner Behavior,  Next: Code-Level And API Options,  Prev: Options for Specifying Filenames,  Up: Scanner Options": {
            "content": "",
            "subsections": [
                {
                    "name": "16.2 Options Affecting Scanner Behavior",
                    "content": "'-i, --case-insensitive, '%option case-insensitive''\ninstructs 'flex' to generate a \"case-insensitive\" scanner.  The\ncase of letters given in the 'flex' input patterns will be ignored,\nand tokens in the input will be matched regardless of case.  The\nmatched text given in 'yytext' will have the preserved case (i.e.,\nit will not be folded).  For tricky behavior, see *note case and\ncharacter ranges::.\n\n'-l, --lex-compat, '%option lex-compat''\nturns on maximum compatibility with the original AT&T 'lex'\nimplementation.  Note that this does not mean full compatibility.\nUse of this option costs a considerable amount of performance, and\nit cannot be used with the '--c++', '--full', '--fast', '-Cf', or\n'-CF' options.  For details on the compatibilities it provides, see\n*note Lex and Posix::.  This option also results in the name\n'YYFLEXLEXCOMPAT' being '#define''d in the generated scanner.\n\n'-B, --batch, '%option batch''\ninstructs 'flex' to generate a \"batch\" scanner, the opposite of\ninteractive scanners generated by '--interactive' (see below).\nIn general, you use '-B' when you are certain that your scanner\nwill never be used interactively, and you want to squeeze a\nlittle more performance out of it.  If your goal is instead to\nsqueeze out a lot more performance, you should be using the '-Cf'\nor '-CF' options, which turn on '--batch' automatically anyway.\n\n'-I, --interactive, '%option interactive''\ninstructs 'flex' to generate an interactive scanner.  An\ninteractive scanner is one that only looks ahead to decide what\ntoken has been matched if it absolutely must.  It turns out that\nalways looking one extra character ahead, even if the scanner has\nalready seen enough text to disambiguate the current token, is a\nbit faster than only looking ahead when necessary.  But scanners\nthat always look ahead give dreadful interactive performance; for\nexample, when a user types a newline, it is not recognized as a\nnewline token until they enter another token, which often means\ntyping in another whole line.\n\n'flex' scanners default to 'interactive' unless you use the '-Cf'\nor '-CF' table-compression options (*note Performance::).  That's\nbecause if you're looking for high-performance you should be using\none of these options, so if you didn't, 'flex' assumes you'd rather\ntrade off a bit of run-time performance for intuitive interactive\nbehavior.  Note also that you cannot use '--interactive' in\nconjunction with '-Cf' or '-CF'.  Thus, this option is not really\nneeded; it is on by default for all those cases in which it is\nallowed.\n\nYou can force a scanner to not be interactive by using '--batch'\n\n'-7, --7bit, '%option 7bit''\ninstructs 'flex' to generate a 7-bit scanner, i.e., one which can\nonly recognize 7-bit characters in its input.  The advantage of\nusing '--7bit' is that the scanner's tables can be up to half the\nsize of those generated using the '--8bit'.  The disadvantage is\nthat such scanners often hang or crash if their input contains an\n8-bit character.\n\nNote, however, that unless you generate your scanner using the\n'-Cf' or '-CF' table compression options, use of '--7bit' will save\nonly a small amount of table space, and make your scanner\nconsiderably less portable.  'Flex''s default behavior is to\ngenerate an 8-bit scanner unless you use the '-Cf' or '-CF', in\nwhich case 'flex' defaults to generating 7-bit scanners unless your\nsite was always configured to generate 8-bit scanners (as will\noften be the case with non-USA sites).  You can tell whether flex\ngenerated a 7-bit or an 8-bit scanner by inspecting the flag\nsummary in the '--verbose' output as described above.\n\nNote that if you use '-Cfe' or '-CFe' 'flex' still defaults to\ngenerating an 8-bit scanner, since usually with these compression\noptions full 8-bit tables are not much more expensive than 7-bit\ntables.\n\n'-8, --8bit, '%option 8bit''\ninstructs 'flex' to generate an 8-bit scanner, i.e., one which can\nrecognize 8-bit characters.  This flag is only needed for scanners\ngenerated using '-Cf' or '-CF', as otherwise flex defaults to\ngenerating an 8-bit scanner anyway.\n\nSee the discussion of '--7bit' above for 'flex''s default behavior\nand the tradeoffs between 7-bit and 8-bit scanners.\n\n'--default, '%option default''\ngenerate the default rule.\n\n'--always-interactive, '%option always-interactive''\ninstructs flex to generate a scanner which always considers its\ninput interactive.  Normally, on each new input file the scanner\ncalls 'isatty()' in an attempt to determine whether the scanner's\ninput source is interactive and thus should be read a character at\na time.  When this option is used, however, then no such call is\nmade.\n\n'--never-interactive, '--never-interactive''\ninstructs flex to generate a scanner which never considers its\ninput interactive.  This is the opposite of 'always-interactive'.\n\n'-X, --posix, '%option posix''\nturns on maximum compatibility with the POSIX 1003.2-1992\ndefinition of 'lex'.  Since 'flex' was originally designed to\nimplement the POSIX definition of 'lex' this generally involves\nvery few changes in behavior.  At the current writing the known\ndifferences between 'flex' and the POSIX standard are:\n\n* In POSIX and AT&T 'lex', the repeat operator, '{}', has lower\nprecedence than concatenation (thus 'ab{3}' yields 'ababab').\nMost POSIX utilities use an Extended Regular Expression (ERE)\nprecedence that has the precedence of the repeat operator\nhigher than concatenation (which causes 'ab{3}' to yield\n'abbb').  By default, 'flex' places the precedence of the\nrepeat operator higher than concatenation which matches the\nERE processing of other POSIX utilities.  When either\n'--posix' or '-l' are specified, 'flex' will use the\ntraditional AT&T and POSIX-compliant precedence for the repeat\noperator where concatenation has higher precedence than the\nrepeat operator.\n\n'--stack, '%option stack''\nenables the use of start condition stacks (*note Start\nConditions::).\n\n'--stdinit, '%option stdinit''\nif set (i.e., %option stdinit) initializes 'yyin' and 'yyout' to\n'stdin' and 'stdout', instead of the default of 'NULL'.  Some\nexisting 'lex' programs depend on this behavior, even though it is\nnot compliant with ANSI C, which does not require 'stdin' and\n'stdout' to be compile-time constant.  In a reentrant scanner,\nhowever, this is not a problem since initialization is performed in\n'yylexinit' at runtime.\n\n'--yylineno, '%option yylineno''\ndirects 'flex' to generate a scanner that maintains the number of\nthe current line read from its input in the global variable\n'yylineno'.  This option is implied by '%option lex-compat'.  In a\nreentrant C scanner, the macro 'yylineno' is accessible regardless\nof the value of '%option yylineno', however, its value is not\nmodified by 'flex' unless '%option yylineno' is enabled.\n\n'--yywrap, '%option yywrap''\nif unset (i.e., '--noyywrap)', makes the scanner not call\n'yywrap()' upon an end-of-file, but simply assume that there are no\nmore files to scan (until the user points 'yyin' at a new file and\ncalls 'yylex()' again).\n"
                }
            ]
        },
        "File: flex.info,  Node: Code-Level And API Options,  Next: Options for Scanner Speed and Size,  Prev: Options Affecting Scanner Behavior,  Up: Scanner Options": {
            "content": "",
            "subsections": [
                {
                    "name": "16.3 Code-Level And API Options",
                    "content": "'--ansi-definitions, '%option ansi-definitions''\nDeprecated, ignored\n\n'--ansi-prototypes, '%option ansi-prototypes''\nDeprecated, ignored\n\n'--bison-bridge, '%option bison-bridge''\ninstructs flex to generate a C scanner that is meant to be called\nby a 'GNU bison' parser.  The scanner has minor API changes for\n'bison' compatibility.  In particular, the declaration of 'yylex'\nis modified to take an additional parameter, 'yylval'.  *Note Bison\nBridge::.\n\n'--bison-locations, '%option bison-locations''\ninstruct flex that 'GNU bison' '%locations' are being used.  This\nmeans 'yylex' will be passed an additional parameter, 'yylloc'.\nThis option implies '%option bison-bridge'.  *Note Bison Bridge::.\n\n'-L, --noline, '%option noline''\ninstructs 'flex' not to generate '#line' directives.  Without this\noption, 'flex' peppers the generated scanner with '#line'\ndirectives so error messages in the actions will be correctly\nlocated with respect to either the original 'flex' input file (if\nthe errors are due to code in the input file), or 'lex.yy.c' (if\nthe errors are 'flex''s fault - you should report these sorts of\nerrors to the email address given in *note Reporting Bugs::).\n\n'-R, --reentrant, '%option reentrant''\ninstructs flex to generate a reentrant C scanner.  The generated\nscanner may safely be used in a multi-threaded environment.  The\nAPI for a reentrant scanner is different than for a non-reentrant\nscanner *note Reentrant::).  Because of the API difference between\nreentrant and non-reentrant 'flex' scanners, non-reentrant flex\ncode must be modified before it is suitable for use with this\noption.  This option is not compatible with the '--c++' option.\n\nThe option '--reentrant' does not affect the performance of the\nscanner.\n\n'-+, --c++, '%option c++''\nspecifies that you want flex to generate a C++ scanner class.\n*Note Cxx::, for details.\n\n'--array, '%option array''\nspecifies that you want yytext to be an array instead of a char*\n\n'--pointer, '%option pointer''\nspecify that 'yytext' should be a 'char *', not an array.  This\ndefault is 'char *'.\n\n'-PPREFIX, --prefix=PREFIX, '%option prefix=\"PREFIX\"''\nchanges the default 'yy' prefix used by 'flex' for all\nglobally-visible variable and function names to instead be\n'PREFIX'.  For example, '--prefix=foo' changes the name of 'yytext'\nto 'footext'.  It also changes the name of the default output file\nfrom 'lex.yy.c' to 'lex.foo.c'.  Here is a partial list of the\nnames affected:\n\nyycreatebuffer\nyydeletebuffer\nyyflexdebug\nyyinitbuffer\nyyflushbuffer\nyyloadbufferstate\nyyswitchtobuffer\nyyin\nyyleng\nyylex\nyylineno\nyyout\nyyrestart\nyytext\nyywrap\nyyalloc\nyyrealloc\nyyfree\n\n(If you are using a C++ scanner, then only 'yywrap' and\n'yyFlexLexer' are affected.)  Within your scanner itself, you can\nstill refer to the global variables and functions using either\nversion of their name; but externally, they have the modified name.\n\nThis option lets you easily link together multiple 'flex' programs\ninto the same executable.  Note, though, that using this option\nalso renames 'yywrap()', so you now must either provide your own\n(appropriately-named) version of the routine for your scanner, or\nuse '%option noyywrap', as linking with '-lfl' no longer provides\none for you by default.\n\n'--main, '%option main''\ndirects flex to provide a default 'main()' program for the scanner,\nwhich simply calls 'yylex()'.  This option implies 'noyywrap' (see\nbelow).\n\n'--nounistd, '%option nounistd''\nsuppresses inclusion of the non-ANSI header file 'unistd.h'.  This\noption is meant to target environments in which 'unistd.h' does not\nexist.  Be aware that certain options may cause flex to generate\ncode that relies on functions normally found in 'unistd.h', (e.g.\n'isatty()', 'read()'.)  If you wish to use these functions, you\nwill have to inform your compiler where to find them.  *Note\noption-always-interactive::.  *Note option-read::.\n\n'--yyclass=NAME, '%option yyclass=\"NAME\"''\nonly applies when generating a C++ scanner (the '--c++' option).\nIt informs 'flex' that you have derived 'NAME' as a subclass of\n'yyFlexLexer', so 'flex' will place your actions in the member\nfunction 'foo::yylex()' instead of 'yyFlexLexer::yylex()'.  It also\ngenerates a 'yyFlexLexer::yylex()' member function that emits a\nrun-time error (by invoking 'yyFlexLexer::LexerError())' if called.\n*Note Cxx::.\n"
                }
            ]
        },
        "File: flex.info,  Node: Options for Scanner Speed and Size,  Next: Debugging Options,  Prev: Code-Level And API Options,  Up: Scanner Options": {
            "content": "",
            "subsections": [
                {
                    "name": "16.4 Options for Scanner Speed and Size",
                    "content": "'-C[aefFmr]'\ncontrols the degree of table compression and, more generally,\ntrade-offs between small scanners and fast scanners.\n\n'-C'\nA lone '-C' specifies that the scanner tables should be\ncompressed but neither equivalence classes nor\nmeta-equivalence classes should be used.\n\n'-Ca, --align, '%option align''\n(\"align\") instructs flex to trade off larger tables in the\ngenerated scanner for faster performance because the elements\nof the tables are better aligned for memory access and\ncomputation.  On some RISC architectures, fetching and\nmanipulating longwords is more efficient than with\nsmaller-sized units such as shortwords.  This option can\nquadruple the size of the tables used by your scanner.\n\n'-Ce, --ecs, '%option ecs''\ndirects 'flex' to construct \"equivalence classes\", i.e., sets\nof characters which have identical lexical properties (for\nexample, if the only appearance of digits in the 'flex' input\nis in the character class \"[0-9]\" then the digits '0', '1',\n..., '9' will all be put in the same equivalence class).\nEquivalence classes usually give dramatic reductions in the\nfinal table/object file sizes (typically a factor of 2-5) and\nare pretty cheap performance-wise (one array look-up per\ncharacter scanned).\n\n'-Cf'\nspecifies that the \"full\" scanner tables should be generated -\n'flex' should not compress the tables by taking advantages of\nsimilar transition functions for different states.\n\n'-CF'\nspecifies that the alternate fast scanner representation\n(described above under the '--fast' flag) should be used.\nThis option cannot be used with '--c++'.\n\n'-Cm, --meta-ecs, '%option meta-ecs''\ndirects 'flex' to construct \"meta-equivalence classes\", which\nare sets of equivalence classes (or characters, if equivalence\nclasses are not being used) that are commonly used together.\nMeta-equivalence classes are often a big win when using\ncompressed tables, but they have a moderate performance impact\n(one or two 'if' tests and one array look-up per character\nscanned).\n\n'-Cr, --read, '%option read''\ncauses the generated scanner to bypass use of the standard\nI/O library ('stdio') for input.  Instead of calling 'fread()'\nor 'getc()', the scanner will use the 'read()' system call,\nresulting in a performance gain which varies from system to\nsystem, but in general is probably negligible unless you are\nalso using '-Cf' or '-CF'.  Using '-Cr' can cause strange\nbehavior if, for example, you read from 'yyin' using 'stdio'\nprior to calling the scanner (because the scanner will miss\nwhatever text your previous reads left in the 'stdio' input\nbuffer).  '-Cr' has no effect if you define 'YYINPUT()'\n(*note Generated Scanner::).\n\nThe options '-Cf' or '-CF' and '-Cm' do not make sense together -\nthere is no opportunity for meta-equivalence classes if the table\nis not being compressed.  Otherwise the options may be freely\nmixed, and are cumulative.\n\nThe default setting is '-Cem', which specifies that 'flex' should\ngenerate equivalence classes and meta-equivalence classes.  This\nsetting provides the highest degree of table compression.  You can\ntrade off faster-executing scanners at the cost of larger tables\nwith the following generally being true:\n\nslowest & smallest\n-Cem\n-Cm\n-Ce\n-C\n-C{f,F}e\n-C{f,F}\n-C{f,F}a\nfastest & largest\n\nNote that scanners with the smallest tables are usually generated\nand compiled the quickest, so during development you will usually\nwant to use the default, maximal compression.\n\n'-Cfe' is often a good compromise between speed and size for\nproduction scanners.\n\n'-f, --full, '%option full''\nspecifies \"fast scanner\".  No table compression is done and 'stdio'\nis bypassed.  The result is large but fast.  This option is\nequivalent to '--Cfr'\n\n'-F, --fast, '%option fast''\nspecifies that the fast scanner table representation should be\nused (and 'stdio' bypassed).  This representation is about as fast\nas the full table representation '--full', and for some sets of\npatterns will be considerably smaller (and for others, larger).  In\ngeneral, if the pattern set contains both keywords and a\ncatch-all, identifier rule, such as in the set:\n\n\"case\"    return TOKCASE;\n\"switch\"  return TOKSWITCH;\n...\n\"default\" return TOKDEFAULT;\n[a-z]+    return TOKID;\n\nthen you're better off using the full table representation.  If\nonly the identifier rule is present and you then use a hash table\nor some such to detect the keywords, you're better off using\n'--fast'.\n\nThis option is equivalent to '-CFr'.  It cannot be used with\n'--c++'.\n"
                }
            ]
        },
        "File: flex.info,  Node: Debugging Options,  Next: Miscellaneous Options,  Prev: Options for Scanner Speed and Size,  Up: Scanner Options": {
            "content": "",
            "subsections": [
                {
                    "name": "16.5 Debugging Options",
                    "content": "'-b, --backup, '%option backup''\nGenerate backing-up information to 'lex.backup'.  This is a list of\nscanner states which require backing up and the input characters on\nwhich they do so.  By adding rules one can remove backing-up\nstates.  If all backing-up states are eliminated and '-Cf' or\n'-CF' is used, the generated scanner will run faster (see the\n'--perf-report' flag).  Only users who wish to squeeze every last\ncycle out of their scanners need worry about this option.  (*note\nPerformance::).\n\n'-d, --debug, '%option debug''\nmakes the generated scanner run in \"debug\" mode.  Whenever a\npattern is recognized and the global variable 'yyflexdebug' is\nnon-zero (which is the default), the scanner will write to 'stderr'\na line of the form:\n\n-accepting rule at line 53 (\"the matched text\")\n\nThe line number refers to the location of the rule in the file\ndefining the scanner (i.e., the file that was fed to flex).\nMessages are also generated when the scanner backs up, accepts the\ndefault rule, reaches the end of its input buffer (or encounters a\nNUL; at this point, the two look the same as far as the scanner's\nconcerned), or reaches an end-of-file.\n\n'-p, --perf-report, '%option perf-report''\ngenerates a performance report to 'stderr'.  The report consists of\ncomments regarding features of the 'flex' input file which will\ncause a serious loss of performance in the resulting scanner.  If\nyou give the flag twice, you will also get comments regarding\nfeatures that lead to minor performance losses.\n\nNote that the use of 'REJECT', and variable trailing context (*note\nLimitations::) entails a substantial performance penalty; use of\n'yymore()', the '^' operator, and the '--interactive' flag entail\nminor performance penalties.\n\n'-s, --nodefault, '%option nodefault''\ncauses the default rule (that unmatched scanner input is echoed\nto 'stdout)' to be suppressed.  If the scanner encounters input\nthat does not match any of its rules, it aborts with an error.\nThis option is useful for finding holes in a scanner's rule set.\n\n'-T, --trace, '%option trace''\nmakes 'flex' run in \"trace\" mode.  It will generate a lot of\nmessages to 'stderr' concerning the form of the input and the\nresultant non-deterministic and deterministic finite automata.\nThis option is mostly for use in maintaining 'flex'.\n\n'-w, --nowarn, '%option nowarn''\nsuppresses warning messages.\n\n'-v, --verbose, '%option verbose''\nspecifies that 'flex' should write to 'stderr' a summary of\nstatistics regarding the scanner it generates.  Most of the\nstatistics are meaningless to the casual 'flex' user, but the first\nline identifies the version of 'flex' (same as reported by\n'--version'), and the next line the flags used when generating the\nscanner, including those that are on by default.\n\n'--warn, '%option warn''\nwarn about certain things.  In particular, if the default rule can\nbe matched but no default rule has been given, the flex will warn\nyou.  We recommend using this option always.\n"
                }
            ]
        },
        "File: flex.info,  Node: Miscellaneous Options,  Prev: Debugging Options,  Up: Scanner Options": {
            "content": "",
            "subsections": [
                {
                    "name": "16.6 Miscellaneous Options",
                    "content": "'-c'\nA do-nothing option included for POSIX compliance.\n\n'-h, -?, --help'\ngenerates a \"help\" summary of 'flex''s options to 'stdout' and then\nexits.\n\n'-n'\nAnother do-nothing option included for POSIX compliance.\n\n'-V, --version'\nprints the version number to 'stdout' and exits.\n"
                }
            ]
        },
        "File: flex.info,  Node: Performance,  Next: Cxx,  Prev: Scanner Options,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "17 Performance Considerations": {
            "content": "",
            "subsections": []
        },
        "The main design goal of 'flex' is that it generate high-performance": {
            "content": "scanners.  It has been optimized for dealing well with large sets of\nrules.  Aside from the effects on scanner speed of the table compression\n'-C' options outlined above, there are a number of options/actions which\ndegrade performance.  These are, from most expensive to least:\n\nREJECT\narbitrary trailing context\n\npattern sets that require backing up\n%option yylineno\n%array\n\n%option interactive\n%option always-interactive\n\n^ beginning-of-line operator\nyymore()\n\nwith the first two all being quite expensive and the last two being\nquite cheap.  Note also that 'unput()' is implemented as a routine call\nthat potentially does quite a bit of work, while 'yyless()' is a\nquite-cheap macro.  So if you are just putting back some excess text you\nscanned, use 'yyless()'.\n\n'REJECT' should be avoided at all costs when performance is\nimportant.  It is a particularly expensive option.\n\nThere is one case when '%option yylineno' can be expensive.  That is\nwhen your patterns match long tokens that could possibly contain a\nnewline character.  There is no performance penalty for rules that can\nnot possibly match newlines, since flex does not need to check them for\nnewlines.  In general, you should avoid rules such as '[^f]+', which\nmatch very long tokens, including newlines, and may possibly match your\nentire file!  A better approach is to separate '[^f]+' into two rules:\n\n%option yylineno\n%%\n[^f\\n]+\n\\n+\n\nThe above scanner does not incur a performance penalty.\n\nGetting rid of backing up is messy and often may be an enormous\namount of work for a complicated scanner.  In principal, one begins by\nusing the '-b' flag to generate a 'lex.backup' file.  For example, on\nthe input:\n\n%%\nfoo        return TOKKEYWORD;\nfoobar     return TOKKEYWORD;\n\nthe file looks like:\n\nState #6 is non-accepting -\nassociated rule line numbers:\n2       3\nout-transitions: [ o ]\njam-transitions: EOF [ \\001-n  p-\\177 ]\n\nState #8 is non-accepting -\nassociated rule line numbers:\n3\nout-transitions: [ a ]\njam-transitions: EOF [ \\001-`  b-\\177 ]\n\nState #9 is non-accepting -\nassociated rule line numbers:\n3\nout-transitions: [ r ]\njam-transitions: EOF [ \\001-q  s-\\177 ]\n\nCompressed tables always back up.\n\nThe first few lines tell us that there's a scanner state in which it\ncan make a transition on an 'o' but not on any other character, and that\nin that state the currently scanned text does not match any rule.  The\nstate occurs when trying to match the rules found at lines 2 and 3 in\nthe input file.  If the scanner is in that state and then reads\nsomething other than an 'o', it will have to back up to find a rule\nwhich is matched.  With a bit of headscratching one can see that this\nmust be the state it's in when it has seen 'fo'.  When this has\nhappened, if anything other than another 'o' is seen, the scanner will\nhave to back up to simply match the 'f' (by the default rule).\n\nThe comment regarding State #8 indicates there's a problem when\n'foob' has been scanned.  Indeed, on any character other than an 'a',\nthe scanner will have to back up to accept \"foo\".  Similarly, the\ncomment for State #9 concerns when 'fooba' has been scanned and an 'r'\ndoes not follow.\n\nThe final comment reminds us that there's no point going to all the\ntrouble of removing backing up from the rules unless we're using '-Cf'\nor '-CF', since there's no performance gain doing so with compressed\nscanners.\n\nThe way to remove the backing up is to add \"error\" rules:\n\n%%\nfoo         return TOKKEYWORD;\nfoobar      return TOKKEYWORD;\n\nfooba       |\nfoob        |\nfo          {\n/* false alarm, not really a keyword */\nreturn TOKID;\n}\n\nEliminating backing up among a list of keywords can also be done\nusing a \"catch-all\" rule:\n\n%%\nfoo         return TOKKEYWORD;\nfoobar      return TOKKEYWORD;\n\n[a-z]+      return TOKID;\n\nThis is usually the best solution when appropriate.\n\nBacking up messages tend to cascade.  With a complicated set of rules\nit's not uncommon to get hundreds of messages.  If one can decipher\nthem, though, it often only takes a dozen or so rules to eliminate the\nbacking up (though it's easy to make a mistake and have an error rule\naccidentally match a valid token.  A possible future 'flex' feature will\nbe to automatically add rules to eliminate backing up).\n\nIt's important to keep in mind that you gain the benefits of\neliminating backing up only if you eliminate every instance of backing\nup.  Leaving just one means you gain nothing.\n\nVariable trailing context (where both the leading and trailing\nparts do not have a fixed length) entails almost the same performance\nloss as 'REJECT' (i.e., substantial).  So when possible a rule like:\n\n%%\nmouse|rat/(cat|dog)   run();\n\nis better written:\n\n%%\nmouse/cat|dog         run();\nrat/cat|dog           run();\n\nor as\n\n%%\nmouse|rat/cat         run();\nmouse|rat/dog         run();\n\nNote that here the special '|' action does not provide any savings,\nand can even make things worse (*note Limitations::).\n\nAnother area where the user can increase a scanner's performance (and\none that's easier to implement) arises from the fact that the longer the\ntokens matched, the faster the scanner will run.  This is because with\nlong tokens the processing of most input characters takes place in the\n(short) inner scanning loop, and does not often have to go through the\nadditional work of setting up the scanning environment (e.g., 'yytext')\nfor the action.  Recall the scanner for C comments:\n\n%x comment\n%%\nint linenum = 1;\n\n\"/*\"         BEGIN(comment);\n\n<comment>[^*\\n]*\n<comment>\"*\"+[^*/\\n]*\n<comment>\\n             ++linenum;\n<comment>\"*\"+\"/\"        BEGIN(INITIAL);\n\nThis could be sped up by writing it as:\n\n%x comment\n%%\nint linenum = 1;\n\n\"/*\"         BEGIN(comment);\n\n<comment>[^*\\n]*\n<comment>[^*\\n]*\\n      ++linenum;\n<comment>\"*\"+[^*/\\n]*\n<comment>\"*\"+[^*/\\n]*\\n ++linenum;\n<comment>\"*\"+\"/\"        BEGIN(INITIAL);\n\nNow instead of each newline requiring the processing of another\naction, recognizing the newlines is distributed over the other rules to\nkeep the matched text as long as possible.  Note that adding rules\ndoes not slow down the scanner!  The speed of the scanner is\nindependent of the number of rules or (modulo the considerations given\nat the beginning of this section) how complicated the rules are with\nregard to operators such as '*' and '|'.\n\nA final example in speeding up a scanner: suppose you want to scan\nthrough a file containing identifiers and keywords, one per line and\nwith no other extraneous characters, and recognize all the keywords.  A\nnatural first approach is:\n\n%%\nasm      |\nauto     |\nbreak    |\n... etc ...\nvolatile |\nwhile    /* it's a keyword */\n\n.|\\n     /* it's not a keyword */\n\nTo eliminate the back-tracking, introduce a catch-all rule:\n\n%%\nasm      |\nauto     |\nbreak    |\n... etc ...\nvolatile |\nwhile    /* it's a keyword */\n\n[a-z]+   |\n.|\\n     /* it's not a keyword */\n\nNow, if it's guaranteed that there's exactly one word per line, then\nwe can reduce the total number of matches by a half by merging in the\nrecognition of newlines with that of the other tokens:\n\n%%\nasm\\n    |\nauto\\n   |\nbreak\\n  |\n... etc ...\nvolatile\\n |\nwhile\\n  /* it's a keyword */\n\n[a-z]+\\n |\n.|\\n     /* it's not a keyword */\n\nOne has to be careful here, as we have now reintroduced backing up\ninto the scanner.  In particular, while we know that there will never\nbe any characters in the input stream other than letters or newlines,\n'flex' can't figure this out, and it will plan for possibly needing to\nback up when it has scanned a token like 'auto' and then the next\ncharacter is something other than a newline or a letter.  Previously it\nwould then just match the 'auto' rule and be done, but now it has no\n'auto' rule, only a 'auto\\n' rule.  To eliminate the possibility of\nbacking up, we could either duplicate all rules but without final\nnewlines, or, since we never expect to encounter such an input and\ntherefore don't how it's classified, we can introduce one more catch-all\nrule, this one which doesn't include a newline:\n\n%%\nasm\\n    |\nauto\\n   |\nbreak\\n  |\n... etc ...\nvolatile\\n |\nwhile\\n  /* it's a keyword */\n\n[a-z]+\\n |\n[a-z]+   |\n.|\\n     /* it's not a keyword */\n\nCompiled with '-Cf', this is about as fast as one can get a 'flex'\nscanner to go for this particular problem.\n\nA final note: 'flex' is slow when matching 'NUL's, particularly when\na token contains multiple 'NUL's.  It's best to write rules which match\nshort amounts of text if it's anticipated that the text will often\ninclude 'NUL's.\n\nAnother final note regarding performance: as mentioned in *note",
            "subsections": []
        },
        "Matching::, dynamically resizing 'yytext' to accommodate huge tokens is": {
            "content": "a slow process because it presently requires that the (huge) token be\nrescanned from the beginning.  Thus if performance is vital, you should\nattempt to match \"large\" quantities of text but not \"huge\" quantities,\nwhere the cutoff between the two is at about 8K characters per token.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Cxx,  Next: Reentrant,  Prev: Performance,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "18 Generating C++ Scanners": {
            "content": "*IMPORTANT*: the present form of the scanning class is experimental\nand may change considerably between major releases.\n\n'flex' provides two different ways to generate scanners for use with\nC++.  The first way is to simply compile a scanner generated by 'flex'\nusing a C++ compiler instead of a C compiler.  You should not encounter\nany compilation errors (*note Reporting Bugs::).  You can then use C++\ncode in your rule actions instead of C code.  Note that the default\ninput source for your scanner remains 'yyin', and default echoing is\nstill done to 'yyout'.  Both of these remain 'FILE *' variables and not\nC++ streams.\n\nYou can also use 'flex' to generate a C++ scanner class, using the\n'-+' option (or, equivalently, '%option c++)', which is automatically\nspecified if the name of the 'flex' executable ends in a '+', such as\n'flex++'.  When using this option, 'flex' defaults to generating the\nscanner to the file 'lex.yy.cc' instead of 'lex.yy.c'.  The generated\nscanner includes the header file 'FlexLexer.h', which defines the\ninterface to two C++ classes.\n\nThe first class in 'FlexLexer.h', 'FlexLexer', provides an abstract\nbase class defining the general scanner class interface.  It provides\nthe following member functions:\n\n'const char* YYText()'\nreturns the text of the most recently matched token, the equivalent\nof 'yytext'.\n\n'int YYLeng()'\nreturns the length of the most recently matched token, the\nequivalent of 'yyleng'.\n\n'int lineno() const'\nreturns the current input line number (see '%option yylineno)', or\n'1' if '%option yylineno' was not used.\n\n'void setdebug( int flag )'\nsets the debugging flag for the scanner, equivalent to assigning to\n'yyflexdebug' (*note Scanner Options::).  Note that you must\nbuild the scanner using '%option debug' to include debugging\ninformation in it.\n\n'int debug() const'\nreturns the current setting of the debugging flag.\n\nAlso provided are member functions equivalent to\n'yyswitchtobuffer()', 'yycreatebuffer()' (though the first argument\nis an 'istream&' object reference and not a 'FILE*)',\n'yyflushbuffer()', 'yydeletebuffer()', and 'yyrestart()' (again, the\nfirst argument is a 'istream&' object reference).\n\nThe second class defined in 'FlexLexer.h' is 'yyFlexLexer', which is\nderived from 'FlexLexer'.  It defines the following additional member\nfunctions:\n\n'yyFlexLexer( istream* argyyin = 0, ostream* argyyout = 0 )'\n'yyFlexLexer( istream& argyyin, ostream& argyyout )'\nconstructs a 'yyFlexLexer' object using the given streams for input\nand output.  If not specified, the streams default to 'cin' and\n'cout', respectively.  'yyFlexLexer' does not take ownership of its\nstream arguments.  It's up to the user to ensure the streams\npointed to remain alive at least as long as the 'yyFlexLexer'\ninstance.\n\n'virtual int yylex()'\nperforms the same role is 'yylex()' does for ordinary 'flex'\nscanners: it scans the input stream, consuming tokens, until a\nrule's action returns a value.  If you derive a subclass 'S' from\n'yyFlexLexer' and want to access the member functions and variables\nof 'S' inside 'yylex()', then you need to use '%option yyclass=\"S\"'\nto inform 'flex' that you will be using that subclass instead of\n'yyFlexLexer'.  In this case, rather than generating\n'yyFlexLexer::yylex()', 'flex' generates 'S::yylex()' (and also\ngenerates a dummy 'yyFlexLexer::yylex()' that calls\n'yyFlexLexer::LexerError()' if called).\n\n'virtual void switchstreams(istream* newin = 0, ostream* newout = 0)'\n'virtual void switchstreams(istream& newin, ostream& newout)'\nreassigns 'yyin' to 'newin' (if non-null) and 'yyout' to 'newout'\n(if non-null), deleting the previous input buffer if 'yyin' is\nreassigned.\n\n'int yylex( istream* newin, ostream* newout = 0 )'\n'int yylex( istream& newin, ostream& newout )'\nfirst switches the input streams via 'switchstreams( newin,\nnewout )' and then returns the value of 'yylex()'.\n\nIn addition, 'yyFlexLexer' defines the following protected virtual\nfunctions which you can redefine in derived classes to tailor the\nscanner:\n\n'virtual int LexerInput( char* buf, int maxsize )'\nreads up to 'maxsize' characters into 'buf' and returns the number\nof characters read.  To indicate end-of-input, return 0 characters.\nNote that 'interactive' scanners (see the '-B' and '-I' flags in\n*note Scanner Options::) define the macro 'YYINTERACTIVE'.  If you\nredefine 'LexerInput()' and need to take different actions\ndepending on whether or not the scanner might be scanning an\ninteractive input source, you can test for the presence of this\nname via '#ifdef' statements.\n\n'virtual void LexerOutput( const char* buf, int size )'\nwrites out 'size' characters from the buffer 'buf', which, while\n'NUL'-terminated, may also contain internal 'NUL's if the scanner's\nrules can match text with 'NUL's in them.\n\n'virtual void LexerError( const char* msg )'\nreports a fatal error message.  The default version of this\nfunction writes the message to the stream 'cerr' and exits.\n\nNote that a 'yyFlexLexer' object contains its entire scanning\nstate.  Thus you can use such objects to create reentrant scanners, but\nsee also *note Reentrant::.  You can instantiate multiple instances of\nthe same 'yyFlexLexer' class, and you can also combine multiple C++\nscanner classes together in the same program using the '-P' option\ndiscussed above.\n\nFinally, note that the '%array' feature is not available to C++\nscanner classes; you must use '%pointer' (the default).\n\nHere is an example of a simple C++ scanner:\n\n// An example of using the flex C++ scanner class.\n\n%{\n#include <iostream>\nusing namespace std;\nint mylineno = 0;\n%}\n\n%option noyywrap c++\n\nstring  \\\"[^\\n\"]+\\\"\n\nws      [ \\t]+\n\nalpha   [A-Za-z]\ndig     [0-9]\nname    ({alpha}|{dig}|\\$)({alpha}|{dig}|[.\\-/$])*\nnum1    [-+]?{dig}+\\.?([eE][-+]?{dig}+)?\nnum2    [-+]?{dig}*\\.{dig}+([eE][-+]?{dig}+)?\nnumber  {num1}|{num2}\n\n%%\n\n{ws}    /* skip blanks and tabs */\n\n\"/*\"    {\nint c;\n\nwhile((c = yyinput()) != 0)\n{\nif(c == '\\n')\n++mylineno;\n\nelse if(c == '*')\n{\nif((c = yyinput()) == '/')\nbreak;\nelse\nunput(c);\n}\n}\n}\n\n{number}  cout << \"number \" << YYText() << '\\n';\n\n\\n        mylineno++;\n\n{name}    cout << \"name \" << YYText() << '\\n';\n\n{string}  cout << \"string \" << YYText() << '\\n';\n\n%%\n\n// This include is required if main() is an another source file.\n//#include <FlexLexer.h>\n\nint main( int /* argc */, char /* argv */ )\n{\nFlexLexer* lexer = new yyFlexLexer;\nwhile(lexer->yylex() != 0)\n;\nreturn 0;\n}\n\nIf you want to create multiple (different) lexer classes, you use the\n'-P' flag (or the 'prefix=' option) to rename each 'yyFlexLexer' to some\nother 'xxFlexLexer'.  You then can include '<FlexLexer.h>' in your other\nsources once per lexer class, first renaming 'yyFlexLexer' as follows:\n\n#undef yyFlexLexer\n#define yyFlexLexer xxFlexLexer\n#include <FlexLexer.h>\n\n#undef yyFlexLexer\n#define yyFlexLexer zzFlexLexer\n#include <FlexLexer.h>\n\nif, for example, you used '%option prefix=\"xx\"' for one of your\nscanners and '%option prefix=\"zz\"' for the other.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Reentrant,  Next: Lex and Posix,  Prev: Cxx,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "19 Reentrant C Scanners": {
            "content": "'flex' has the ability to generate a reentrant C scanner.  This is\naccomplished by specifying '%option reentrant' ('-R') The generated\nscanner is both portable, and safe to use in one or more separate\nthreads of control.  The most common use for reentrant scanners is from\nwithin multi-threaded applications.  Any thread may create and execute a\nreentrant 'flex' scanner without the need for synchronization with other\nthreads.\n\n* Menu:\n\n* Reentrant Uses::\n* Reentrant Overview::\n* Reentrant Example::\n* Reentrant Detail::\n* Reentrant Functions::\n",
            "subsections": []
        },
        "File: flex.info,  Node: Reentrant Uses,  Next: Reentrant Overview,  Prev: Reentrant,  Up: Reentrant": {
            "content": "",
            "subsections": [
                {
                    "name": "19.1 Uses for Reentrant Scanners",
                    "content": ""
                }
            ]
        },
        "However, there are other uses for a reentrant scanner.  For example, you": {
            "content": "could scan two or more files simultaneously to implement a 'diff' at the\ntoken level (i.e., instead of at the character level):\n\n/* Example of maintaining more than one active scanner. */\n\ndo {\nint tok1, tok2;\n\ntok1 = yylex( scanner1 );\ntok2 = yylex( scanner2 );\n\nif( tok1 != tok2 )\nprintf(\"Files are different.\");\n\n} while ( tok1 && tok2 );\n\nAnother use for a reentrant scanner is recursion.  (Note that a\nrecursive scanner can also be created using a non-reentrant scanner and\nbuffer states.  *Note Multiple Input Buffers::.)\n\nThe following crude scanner supports the 'eval' command by invoking\nanother instance of itself.\n\n/* Example of recursive invocation. */\n\n%option reentrant\n\n%%\n\"eval(\".+\")\"  {\nyyscant scanner;\nYYBUFFERSTATE buf;\n\nyylexinit( &scanner );\nyytext[yyleng-1] = ' ';\n\nbuf = yyscanstring( yytext + 5, scanner );\nyylex( scanner );\n\nyydeletebuffer(buf,scanner);\nyylexdestroy( scanner );\n}\n...\n%%\n",
            "subsections": []
        },
        "File: flex.info,  Node: Reentrant Overview,  Next: Reentrant Example,  Prev: Reentrant Uses,  Up: Reentrant": {
            "content": "",
            "subsections": [
                {
                    "name": "19.2 An Overview of the Reentrant API",
                    "content": ""
                }
            ]
        },
        "The API for reentrant scanners is different than for non-reentrant": {
            "content": "scanners.  Here is a quick overview of the API:\n\n'%option reentrant' must be specified.\n\n* All functions take one additional argument: 'yyscanner'\n\n* All global variables are replaced by their macro equivalents.  (We\ntell you this because it may be important to you during debugging.)\n\n* 'yylexinit' and 'yylexdestroy' must be called before and after\n'yylex', respectively.\n\n* Accessor methods (get/set functions) provide access to common\n'flex' variables.\n\n* User-specific data can be stored in 'yyextra'.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Reentrant Example,  Next: Reentrant Detail,  Prev: Reentrant Overview,  Up: Reentrant": {
            "content": "",
            "subsections": [
                {
                    "name": "19.3 Reentrant Example",
                    "content": "First, an example of a reentrant scanner:\n/* This scanner prints \"//\" comments. */\n\n%option reentrant stack noyywrap\n%x COMMENT\n\n%%\n\n\"//\"                 yypushstate( COMMENT, yyscanner);\n.|\\n\n\n<COMMENT>\\n          yypopstate( yyscanner );\n<COMMENT>[^\\n]+      fprintf( yyout, \"%s\\n\", yytext);\n\n%%\n\nint main ( int argc, char * argv[] )\n{\nyyscant scanner;\n\nyylexinit ( &scanner );\nyylex ( scanner );\nyylexdestroy ( scanner );\nreturn 0;\n}\n"
                }
            ]
        },
        "File: flex.info,  Node: Reentrant Detail,  Next: Reentrant Functions,  Prev: Reentrant Example,  Up: Reentrant": {
            "content": "",
            "subsections": [
                {
                    "name": "19.4 The Reentrant API in Detail",
                    "content": ""
                }
            ]
        },
        "Here are the things you need to do or know to use the reentrant C API of": {
            "content": "'flex'.\n\n* Menu:\n\n* Specify Reentrant::\n* Extra Reentrant Argument::\n* Global Replacement::\n* Init and Destroy Functions::\n* Accessor Methods::\n* Extra Data::\n* About yyscant::\n",
            "subsections": []
        },
        "File: flex.info,  Node: Specify Reentrant,  Next: Extra Reentrant Argument,  Prev: Reentrant Detail,  Up: Reentrant Detail": {
            "content": "%option reentrant (-reentrant) must be specified.\n\nNotice that '%option reentrant' is specified in the above example\n(*note Reentrant Example::.  Had this option not been specified, 'flex'\nwould have happily generated a non-reentrant scanner without\ncomplaining.  You may explicitly specify '%option noreentrant', if you\ndo not want a reentrant scanner, although it is not necessary.  The\ndefault is to generate a non-reentrant scanner.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Extra Reentrant Argument,  Next: Global Replacement,  Prev: Specify Reentrant,  Up: Reentrant Detail": {
            "content": "All functions take one additional argument: 'yyscanner'.\n\nNotice that the calls to 'yypushstate' and 'yypopstate' both have\nan argument, 'yyscanner' , that is not present in a non-reentrant\nscanner.  Here are the declarations of 'yypushstate' and\n'yypopstate' in the reentrant scanner:\n\nstatic void yypushstate  ( int newstate , yyscant yyscanner ) ;\nstatic void yypopstate  ( yyscant yyscanner  ) ;\n\nNotice that the argument 'yyscanner' appears in the declaration of\nboth functions.  In fact, all 'flex' functions in a reentrant scanner\nhave this additional argument.  It is always the last argument in the\nargument list, it is always of type 'yyscant' (which is typedef'd to\n'void *') and it is always named 'yyscanner'.  As you may have guessed,\n'yyscanner' is a pointer to an opaque data structure encapsulating the\ncurrent state of the scanner.  For a list of function declarations, see\n*note Reentrant Functions::.  Note that preprocessor macros, such as\n'BEGIN', 'ECHO', and 'REJECT', do not take this additional argument.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Global Replacement,  Next: Init and Destroy Functions,  Prev: Extra Reentrant Argument,  Up: Reentrant Detail": {
            "content": "",
            "subsections": []
        },
        "All global variables in traditional flex have been replaced by macro": {
            "content": "equivalents.\n\nNote that in the above example, 'yyout' and 'yytext' are not plain\nvariables.  These are macros that will expand to their equivalent\nlvalue.  All of the familiar 'flex' globals have been replaced by their\nmacro equivalents.  In particular, 'yytext', 'yyleng', 'yylineno',\n'yyin', 'yyout', 'yyextra', 'yylval', and 'yylloc' are macros.  You may\nsafely use these macros in actions as if they were plain variables.  We\nonly tell you this so you don't expect to link to these variables\nexternally.  Currently, each macro expands to a member of an internal\nstruct, e.g.,\n\n#define yytext (((struct yygutst*)yyscanner)->yytextr)\n\nOne important thing to remember about 'yytext' and friends is that\n'yytext' is not a global variable in a reentrant scanner, you can not\naccess it directly from outside an action or from other functions.  You\nmust use an accessor method, e.g., 'yygettext', to accomplish this.\n(See below).\n",
            "subsections": []
        },
        "File: flex.info,  Node: Init and Destroy Functions,  Next: Accessor Methods,  Prev: Global Replacement,  Up: Reentrant Detail": {
            "content": "'yylexinit' and 'yylexdestroy' must be called before and after\n'yylex', respectively.\n\nint yylexinit ( yyscant * ptryyglobals ) ;\nint yylexinitextra ( YYEXTRATYPE userdefined, yyscant * ptryyglobals ) ;\nint yylex ( yyscant yyscanner ) ;\nint yylexdestroy ( yyscant yyscanner ) ;\n\nThe function 'yylexinit' must be called before calling any other\nfunction.  The argument to 'yylexinit' is the address of an\nuninitialized pointer to be filled in by 'yylexinit', overwriting any\nprevious contents.  The function 'yylexinitextra' may be used instead,\ntaking as its first argument a variable of type 'YYEXTRATYPE'.  See\nthe section on yyextra, below, for more details.\n\nThe value stored in 'ptryyglobals' should thereafter be passed to\n'yylex' and 'yylexdestroy'.  Flex does not save the argument passed to\n'yylexinit', so it is safe to pass the address of a local pointer to\n'yylexinit' so long as it remains in scope for the duration of all\ncalls to the scanner, up to and including the call to 'yylexdestroy'.\n\nThe function 'yylex' should be familiar to you by now.  The reentrant\nversion takes one argument, which is the value returned (via an\nargument) by 'yylexinit'.  Otherwise, it behaves the same as the\nnon-reentrant version of 'yylex'.\n\nBoth 'yylexinit' and 'yylexinitextra' returns 0 (zero) on success,\nor non-zero on failure, in which case errno is set to one of the\nfollowing values:\n\n* ENOMEM Memory allocation error.  *Note memory-management::.\n* EINVAL Invalid argument.\n\nThe function 'yylexdestroy' should be called to free resources used\nby the scanner.  After 'yylexdestroy' is called, the contents of\n'yyscanner' should not be used.  Of course, there is no need to destroy\na scanner if you plan to reuse it.  A 'flex' scanner (both reentrant and\nnon-reentrant) may be restarted by calling 'yyrestart'.\n\nBelow is an example of a program that creates a scanner, uses it,\nthen destroys it when done:\n\nint main ()\n{\nyyscant scanner;\nint tok;\n\nyylexinit(&scanner);\n\nwhile ((tok=yylex(scanner)) > 0)\nprintf(\"tok=%d  yytext=%s\\n\", tok, yygettext(scanner));\n\nyylexdestroy(scanner);\nreturn 0;\n}\n",
            "subsections": []
        },
        "File: flex.info,  Node: Accessor Methods,  Next: Extra Data,  Prev: Init and Destroy Functions,  Up: Reentrant Detail": {
            "content": "",
            "subsections": []
        },
        "Accessor methods (get/set functions) provide access to common 'flex'": {
            "content": "variables.\n\nMany scanners that you build will be part of a larger project.",
            "subsections": []
        },
        "Portions of your project will need access to 'flex' values, such as": {
            "content": "'yytext'.  In a non-reentrant scanner, these values are global, so there\nis no problem accessing them.  However, in a reentrant scanner, there\nare no global 'flex' values.  You can not access them directly.",
            "subsections": []
        },
        "Instead, you must access 'flex' values using accessor methods (get/set": {
            "content": "functions).  Each accessor method is named 'yygetNAME' or 'yysetNAME',\nwhere 'NAME' is the name of the 'flex' variable you want.  For example:\n\n/* Set the last character of yytext to NULL. */\nvoid chop ( yyscant scanner )\n{\nint len = yygetleng( scanner );\nyygettext( scanner )[len - 1] = '\\0';\n}\n\nThe above code may be called from within an action like this:\n\n%%\n.+\\n    { chop( yyscanner );}\n\nYou may find that '%option header-file' is particularly useful for\ngenerating prototypes of all the accessor functions.  *Note\noption-header::.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Extra Data,  Next: About yyscant,  Prev: Accessor Methods,  Up: Reentrant Detail": {
            "content": "User-specific data can be stored in 'yyextra'.\n\nIn a reentrant scanner, it is unwise to use global variables to\ncommunicate with or maintain state between different pieces of your\nprogram.  However, you may need access to external data or invoke\nexternal functions from within the scanner actions.  Likewise, you may\nneed to pass information to your scanner (e.g., open file descriptors,\nor database connections).  In a non-reentrant scanner, the only way to\ndo this would be through the use of global variables.  'Flex' allows you\nto store arbitrary, \"extra\" data in a scanner.  This data is accessible\nthrough the accessor methods 'yygetextra' and 'yysetextra' from\noutside the scanner, and through the shortcut macro 'yyextra' from\nwithin the scanner itself.  They are defined as follows:\n\n#define YYEXTRATYPE  void*\nYYEXTRATYPE  yygetextra ( yyscant scanner );\nvoid           yysetextra ( YYEXTRATYPE arbitrarydata , yyscant scanner);\n\nIn addition, an extra form of 'yylexinit' is provided,\n'yylexinitextra'.  This function is provided so that the yyextra value\ncan be accessed from within the very first yyalloc, used to allocate the\nscanner itself.\n\nBy default, 'YYEXTRATYPE' is defined as type 'void *'.  You may\nredefine this type using '%option extra-type=\"yourtype\"' in the\nscanner:\n\n/* An example of overriding YYEXTRATYPE. */\n%{\n#include <sys/stat.h>\n#include <unistd.h>\n%}\n%option reentrant\n%option extra-type=\"struct stat *\"\n%%\n\nfilesize     printf( \"%ld\", yyextra->stsize  );\nlastmod      printf( \"%ld\", yyextra->stmtime );\n%%\nvoid scanfile( char* filename )\n{\nyyscant scanner;\nstruct stat buf;\nFILE *in;\n\nin = fopen( filename, \"r\" );\nstat( filename, &buf );\n\nyylexinitextra( buf, &scanner );\nyysetin( in, scanner );\nyylex( scanner );\nyylexdestroy( scanner );\n\nfclose( in );\n}\n",
            "subsections": []
        },
        "File: flex.info,  Node: About yyscant,  Prev: Extra Data,  Up: Reentrant Detail": {
            "content": "'yyscant' is defined as:\n\ntypedef void* yyscant;\n\nIt is initialized by 'yylexinit()' to point to an internal\nstructure.  You should never access this value directly.  In particular,\nyou should never attempt to free it (use 'yylexdestroy()' instead.)\n",
            "subsections": []
        },
        "File: flex.info,  Node: Reentrant Functions,  Prev: Reentrant Detail,  Up: Reentrant": {
            "content": "",
            "subsections": [
                {
                    "name": "19.5 Functions and Macros Available in Reentrant C Scanners",
                    "content": "The following Functions are available in a reentrant scanner:\n\nchar *yygettext ( yyscant scanner );\nint yygetleng ( yyscant scanner );\nFILE *yygetin ( yyscant scanner );\nFILE *yygetout ( yyscant scanner );\nint yygetlineno ( yyscant scanner );\nYYEXTRATYPE yygetextra ( yyscant scanner );\nint  yygetdebug ( yyscant scanner );\n\nvoid yysetdebug ( int flag, yyscant scanner );\nvoid yysetin  ( FILE * instr , yyscant scanner );\nvoid yysetout  ( FILE * outstr , yyscant scanner );\nvoid yysetlineno ( int linenumber , yyscant scanner );\nvoid yysetextra ( YYEXTRATYPE userdefined , yyscant scanner );\n\nThere are no \"set\" functions for yytext and yyleng.  This is\nintentional.\n\nThe following Macro shortcuts are available in actions in a reentrant\nscanner:\n\nyytext\nyyleng\nyyin\nyyout\nyylineno\nyyextra\nyyflexdebug\n\nIn a reentrant C scanner, support for yylineno is always present\n(i.e., you may access yylineno), but the value is never modified by\n'flex' unless '%option yylineno' is enabled.  This is to allow the user\nto maintain the line count independently of 'flex'.\n\nThe following functions and macros are made available when '%option\nbison-bridge' ('--bison-bridge') is specified:\n\nYYSTYPE * yygetlval ( yyscant scanner );\nvoid yysetlval ( YYSTYPE * yylvalp , yyscant scanner );\nyylval\n\nThe following functions and macros are made available when '%option\nbison-locations' ('--bison-locations') is specified:\n\nYYLTYPE *yygetlloc ( yyscant scanner );\nvoid yysetlloc ( YYLTYPE * yyllocp , yyscant scanner );\nyylloc\n\nSupport for yylval assumes that 'YYSTYPE' is a valid type.  Support\nfor yylloc assumes that 'YYSLYPE' is a valid type.  Typically, these\ntypes are generated by 'bison', and are included in section 1 of the\n'flex' input.\n"
                }
            ]
        },
        "File: flex.info,  Node: Lex and Posix,  Next: Memory Management,  Prev: Reentrant,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "20 Incompatibilities with Lex and Posix": {
            "content": "'flex' is a rewrite of the AT&T Unix lex tool (the two implementations\ndo not share any code, though), with some extensions and\nincompatibilities, both of which are of concern to those who wish to\nwrite scanners acceptable to both implementations.  'flex' is fully\ncompliant with the POSIX 'lex' specification, except that when using\n'%pointer' (the default), a call to 'unput()' destroys the contents of\n'yytext', which is counter to the POSIX specification.  In this section\nwe discuss all of the known areas of incompatibility between 'flex',\nAT&T 'lex', and the POSIX specification.  'flex''s '-l' option turns on\nmaximum compatibility with the original AT&T 'lex' implementation, at\nthe cost of a major loss in the generated scanner's performance.  We\nnote below which incompatibilities can be overcome using the '-l'\noption.  'flex' is fully compatible with 'lex' with the following\nexceptions:\n\n* The undocumented 'lex' scanner internal variable 'yylineno' is not\nsupported unless '-l' or '%option yylineno' is used.\n\n* 'yylineno' should be maintained on a per-buffer basis, rather than\na per-scanner (single global variable) basis.\n\n* 'yylineno' is not part of the POSIX specification.\n\n* The 'input()' routine is not redefinable, though it may be called\nto read characters following whatever has been matched by a rule.\nIf 'input()' encounters an end-of-file the normal 'yywrap()'\nprocessing is done.  A \"real\" end-of-file is returned by 'input()'\nas 'EOF'.\n\n* Input is instead controlled by defining the 'YYINPUT()' macro.\n\n* The 'flex' restriction that 'input()' cannot be redefined is in\naccordance with the POSIX specification, which simply does not\nspecify any way of controlling the scanner's input other than by\nmaking an initial assignment to 'yyin'.\n\n* The 'unput()' routine is not redefinable.  This restriction is in\naccordance with POSIX.\n\n* 'flex' scanners are not as reentrant as 'lex' scanners.  In\nparticular, if you have an interactive scanner and an interrupt\nhandler which long-jumps out of the scanner, and the scanner is\nsubsequently called again, you may get the following message:\n\nfatal flex scanner internal error--end of buffer missed\n\nTo reenter the scanner, first use:\n\nyyrestart( yyin );\n\nNote that this call will throw away any buffered input; usually\nthis isn't a problem with an interactive scanner.  *Note\nReentrant::, for 'flex''s reentrant API.\n\n* Also note that 'flex' C++ scanner classes are reentrant, so if\nusing C++ is an option for you, you should use them instead.  *Note\nCxx::, and *note Reentrant:: for details.\n\n* 'output()' is not supported.  Output from the ECHO macro is done to\nthe file-pointer 'yyout' (default 'stdout)'.\n\n* 'output()' is not part of the POSIX specification.\n\n* 'lex' does not support exclusive start conditions (%x), though they\nare in the POSIX specification.\n\n* When definitions are expanded, 'flex' encloses them in parentheses.\nWith 'lex', the following:\n\nNAME    [A-Z][A-Z0-9]*\n%%\nfoo{NAME}?      printf( \"Found it\\n\" );\n%%\n\nwill not match the string 'foo' because when the macro is expanded\nthe rule is equivalent to 'foo[A-Z][A-Z0-9]*?' and the precedence\nis such that the '?' is associated with '[A-Z0-9]*'.  With 'flex',\nthe rule will be expanded to 'foo([A-Z][A-Z0-9]*)?' and so the\nstring 'foo' will match.\n\n* Note that if the definition begins with '^' or ends with '$' then\nit is not expanded with parentheses, to allow these operators to\nappear in definitions without losing their special meanings.  But\nthe '<s>', '/', and '<<EOF>>' operators cannot be used in a 'flex'\ndefinition.\n\n* Using '-l' results in the 'lex' behavior of no parentheses around\nthe definition.\n\n* The POSIX specification is that the definition be enclosed in\nparentheses.\n\n* Some implementations of 'lex' allow a rule's action to begin on a\nseparate line, if the rule's pattern has trailing whitespace:\n\n%%\nfoo|bar<space here>\n{ foobaraction();}\n\n'flex' does not support this feature.\n\n* The 'lex' '%r' (generate a Ratfor scanner) option is not supported.\nIt is not part of the POSIX specification.\n\n* After a call to 'unput()', yytext is undefined until the next\ntoken is matched, unless the scanner was built using '%array'.\nThis is not the case with 'lex' or the POSIX specification.  The\n'-l' option does away with this incompatibility.\n\n* The precedence of the '{,}' (numeric range) operator is different.\nThe AT&T and POSIX specifications of 'lex' interpret 'abc{1,3}' as\nmatch one, two, or three occurrences of 'abc'\", whereas 'flex'\ninterprets it as \"match 'ab' followed by one, two, or three\noccurrences of 'c'\".  The '-l' and '--posix' options do away with\nthis incompatibility.\n\n* The precedence of the '^' operator is different.  'lex' interprets\n'^foo|bar' as \"match either 'foo' at the beginning of a line, or\n'bar' anywhere\", whereas 'flex' interprets it as \"match either\n'foo' or 'bar' if they come at the beginning of a line\".  The\nlatter is in agreement with the POSIX specification.\n\n* The special table-size declarations such as '%a' supported by 'lex'\nare not required by 'flex' scanners..  'flex' ignores them.\n* The name 'FLEXSCANNER' is '#define''d so scanners may be written\nfor use with either 'flex' or 'lex'.  Scanners also include\n'YYFLEXMAJORVERSION', 'YYFLEXMINORVERSION' and\n'YYFLEXSUBMINORVERSION' indicating which version of 'flex'\ngenerated the scanner.  For example, for the 2.5.22 release, these\ndefines would be 2, 5 and 22 respectively.  If the version of\n'flex' being used is a beta version, then the symbol 'FLEXBETA' is\ndefined.\n\n* The symbols '[[' and ']]' in the code sections of the input may\nconflict with the m4 delimiters.  *Note M4 Dependency::.\n\nThe following 'flex' features are not included in 'lex' or the POSIX\nspecification:\n\n* C++ scanners\n* %option\n* start condition scopes\n* start condition stacks\n* interactive/non-interactive scanners\n* yyscanstring() and friends\n* yyterminate()\n* yysetinteractive()\n* yysetbol()\n* YYATBOL() <<EOF>>\n* <*>\n* YYDECL\n* YYSTART\n* YYUSERACTION\n* YYUSERINIT\n* #line directives\n* %{}'s around actions\n* reentrant C API\n* multiple actions on a line\n* almost all of the 'flex' command-line options\n\nThe feature \"multiple actions on a line\" refers to the fact that with\n'flex' you can put multiple actions on the same line, separated with\nsemi-colons, while with 'lex', the following:\n\nfoo    handlefoo(); ++numfoosseen;\n\nis (rather surprisingly) truncated to\n\nfoo    handlefoo();\n\n'flex' does not truncate the action.  Actions that are not enclosed\nin braces are simply terminated at the end of the line.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Memory Management,  Next: Serialized Tables,  Prev: Lex and Posix,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "21 Memory Management": {
            "content": "",
            "subsections": []
        },
        "This chapter describes how flex handles dynamic memory, and how you can": {
            "content": "override the default behavior.\n\n* Menu:\n\n* The Default Memory Management::\n* Overriding The Default Memory Management::\n* A Note About yytext And Memory::\n",
            "subsections": []
        },
        "File: flex.info,  Node: The Default Memory Management,  Next: Overriding The Default Memory Management,  Prev: Memory Management,  Up: Memory Management": {
            "content": "",
            "subsections": [
                {
                    "name": "21.1 The Default Memory Management",
                    "content": ""
                }
            ]
        },
        "Flex allocates dynamic memory during initialization, and once in a while": {
            "content": "from within a call to yylex().  Initialization takes place during the\nfirst call to yylex().  Thereafter, flex may reallocate more memory if\nit needs to enlarge a buffer.  As of version 2.5.9 Flex will clean up\nall memory when you call 'yylexdestroy' *Note faq-memory-leak::.\n\nFlex allocates dynamic memory for four purposes, listed below (1)\n\n16kB for the input buffer.\nFlex allocates memory for the character buffer used to perform\npattern matching.  Flex must read ahead from the input stream and\nstore it in a large character buffer.  This buffer is typically the\nlargest chunk of dynamic memory flex consumes.  This buffer will\ngrow if necessary, doubling the size each time.  Flex frees this\nmemory when you call yylexdestroy().  The default size of this\nbuffer (16384 bytes) is almost always too large.  The ideal size\nfor this buffer is the length of the longest token expected, in\nbytes, plus a little more.  Flex will allocate a few extra bytes\nfor housekeeping.  Currently, to override the size of the input\nbuffer you must '#define YYBUFSIZE' to whatever number of bytes\nyou want.  We don't plan to change this in the near future, but we\nreserve the right to do so if we ever add a more robust memory\nmanagement API.\n\n64kb for the REJECT state. This will only be allocated if you use REJECT.\nThe size is large enough to hold the same number of states as\ncharacters in the input buffer.  If you override the size of the\ninput buffer (via 'YYBUFSIZE'), then you automatically override\nthe size of this buffer as well.\n\n100 bytes for the start condition stack.\nFlex allocates memory for the start condition stack.  This is the\nstack used for pushing start states, i.e., with yypushstate().\nIt will grow if necessary.  Since the states are simply integers,\nthis stack doesn't consume much memory.  This stack is not present\nif '%option stack' is not specified.  You will rarely need to tune\nthis buffer.  The ideal size for this stack is the maximum depth\nexpected.  The memory for this stack is automatically destroyed\nwhen you call yylexdestroy().  *Note option-stack::.\n\n40 bytes for each YYBUFFERSTATE.\nFlex allocates memory for each YYBUFFERSTATE. The buffer state\nitself is about 40 bytes, plus an additional large character buffer\n(described above.)  The initial buffer state is created during\ninitialization, and with each call to yycreatebuffer().  You\ncan't tune the size of this, but you can tune the character buffer\nas described above.  Any buffer state that you explicitly create by\ncalling yycreatebuffer() is NOT destroyed automatically.  You\nmust call yydeletebuffer() to free the memory.  The exception to\nthis rule is that flex will delete the current buffer automatically\nwhen you call yylexdestroy().  If you delete the current buffer,\nbe sure to set it to NULL. That way, flex will not try to delete\nthe buffer a second time (possibly crashing your program!)  At the\ntime of this writing, flex does not provide a growable stack for\nthe buffer states.  You have to manage that yourself.  *Note\nMultiple Input Buffers::.\n\n84 bytes for the reentrant scanner guts\nFlex allocates about 84 bytes for the reentrant scanner structure\nwhen you call yylexinit().  It is destroyed when the user calls\nyylexdestroy().\n\n---------- Footnotes ----------\n\n(1) The quantities given here are approximate, and may vary due to\nhost architecture, compiler configuration, or due to future enhancements\nto flex.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Overriding The Default Memory Management,  Next: A Note About yytext And Memory,  Prev: The Default Memory Management,  Up: Memory Management": {
            "content": "",
            "subsections": [
                {
                    "name": "21.2 Overriding The Default Memory Management",
                    "content": ""
                }
            ]
        },
        "Flex calls the functions 'yyalloc', 'yyrealloc', and 'yyfree' when it": {
            "content": "needs to allocate or free memory.  By default, these functions are\nwrappers around the standard C functions, 'malloc', 'realloc', and\n'free', respectively.  You can override the default implementations by\ntelling flex that you will provide your own implementations.\n\nTo override the default implementations, you must do two things:\n\n1. Suppress the default implementations by specifying one or more of\nthe following options:\n\n* '%option noyyalloc'\n* '%option noyyrealloc'\n* '%option noyyfree'.\n\n2. Provide your own implementation of the following functions: (1)\n\n// For a non-reentrant scanner\nvoid * yyalloc (sizet bytes);\nvoid * yyrealloc (void * ptr, sizet bytes);\nvoid   yyfree (void * ptr);\n\n// For a reentrant scanner\nvoid * yyalloc (sizet bytes, void * yyscanner);\nvoid * yyrealloc (void * ptr, sizet bytes, void * yyscanner);\nvoid   yyfree (void * ptr, void * yyscanner);\n\nIn the following example, we will override all three memory routines.",
            "subsections": []
        },
        "We assume that there is a custom allocator with garbage collection.  In": {
            "content": "order to make this example interesting, we will use a reentrant scanner,\npassing a pointer to the custom allocator through 'yyextra'.\n\n%{\n#include \"someallocator.h\"\n%}\n\n/* Suppress the default implementations. */\n%option noyyalloc noyyrealloc noyyfree\n%option reentrant\n\n/* Initialize the allocator. */\n%{\n#define YYEXTRATYPE  struct allocator*\n#define YYUSERINIT  yyextra = allocatorcreate();\n%}\n\n%%\n.|\\n   ;\n%%\n\n/* Provide our own implementations. */\nvoid * yyalloc (sizet bytes, void* yyscanner) {\nreturn allocatoralloc (yyextra, bytes);\n}\n\nvoid * yyrealloc (void * ptr, sizet bytes, void* yyscanner) {\nreturn allocatorrealloc (yyextra, bytes);\n}\n\nvoid yyfree (void * ptr, void * yyscanner) {\n/* Do nothing -- we leave it to the garbage collector. */\n}\n\n\n---------- Footnotes ----------\n\n(1) It is not necessary to override all (or any) of the memory\nmanagement routines.  You may, for example, override 'yyrealloc', but\nnot 'yyfree' or 'yyalloc'.\n",
            "subsections": []
        },
        "File: flex.info,  Node: A Note About yytext And Memory,  Prev: Overriding The Default Memory Management,  Up: Memory Management": {
            "content": "",
            "subsections": [
                {
                    "name": "21.3 A Note About yytext And Memory",
                    "content": ""
                }
            ]
        },
        "When flex finds a match, 'yytext' points to the first character of the": {
            "content": "match in the input buffer.  The string itself is part of the input\nbuffer, and is NOT allocated separately.  The value of yytext will be\noverwritten the next time yylex() is called.  In short, the value of\nyytext is only valid from within the matched rule's action.\n\nOften, you want the value of yytext to persist for later processing,\ni.e., by a parser with non-zero lookahead.  In order to preserve yytext,\nyou will have to copy it with strdup() or a similar function.  But this\nintroduces some headache because your parser is now responsible for\nfreeing the copy of yytext.  If you use a yacc or bison parser,\n(commonly used with flex), you will discover that the error recovery\nmechanisms can cause memory to be leaked.\n\nTo prevent memory leaks from strdup'd yytext, you will have to track\nthe memory somehow.  Our experience has shown that a garbage collection\nmechanism or a pooled memory mechanism will save you a lot of grief when\nwriting parsers.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Serialized Tables,  Next: Diagnostics,  Prev: Memory Management,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "22 Serialized Tables": {
            "content": "A 'flex' scanner has the ability to save the DFA tables to a file, and\nload them at runtime when needed.  The motivation for this feature is to\nreduce the runtime memory footprint.  Traditionally, these tables have\nbeen compiled into the scanner as C arrays, and are sometimes quite\nlarge.  Since the tables are compiled into the scanner, the memory used\nby the tables can never be freed.  This is a waste of memory, especially\nif an application uses several scanners, but none of them at the same\ntime.\n\nThe serialization feature allows the tables to be loaded at runtime,\nbefore scanning begins.  The tables may be discarded when scanning is\nfinished.\n\n* Menu:\n\n* Creating Serialized Tables::\n* Loading and Unloading Serialized Tables::\n* Tables File Format::\n",
            "subsections": []
        },
        "File: flex.info,  Node: Creating Serialized Tables,  Next: Loading and Unloading Serialized Tables,  Prev: Serialized Tables,  Up: Serialized Tables": {
            "content": "",
            "subsections": [
                {
                    "name": "22.1 Creating Serialized Tables",
                    "content": "You may create a scanner with serialized tables by specifying:\n\n%option tables-file=FILE\nor\n--tables-file=FILE\n\nThese options instruct flex to save the DFA tables to the file FILE."
                }
            ]
        },
        "The tables will not be embedded in the generated scanner.  The scanner": {
            "content": "will not function on its own.  The scanner will be dependent upon the\nserialized tables.  You must load the tables from this file at runtime\nbefore you can scan anything.\n\nIf you do not specify a filename to '--tables-file', the tables will\nbe saved to 'lex.yy.tables', where 'yy' is the appropriate prefix.\n\nIf your project uses several different scanners, you can concatenate\nthe serialized tables into one file, and flex will find the correct set\nof tables, using the scanner prefix as part of the lookup key.  An\nexample follows:\n\n$ flex --tables-file --prefix=cpp cpp.l\n$ flex --tables-file --prefix=c   c.l\n$ cat lex.cpp.tables lex.c.tables  >  all.tables\n\nThe above example created two scanners, 'cpp', and 'c'.  Since we did\nnot specify a filename, the tables were serialized to 'lex.c.tables' and\n'lex.cpp.tables', respectively.  Then, we concatenated the two files\ntogether into 'all.tables', which we will distribute with our project.",
            "subsections": []
        },
        "At runtime, we will open the file and tell flex to load the tables from": {
            "content": "it.  Flex will find the correct tables automatically.  (See next\nsection).\n",
            "subsections": []
        },
        "File: flex.info,  Node: Loading and Unloading Serialized Tables,  Next: Tables File Format,  Prev: Creating Serialized Tables,  Up: Serialized Tables": {
            "content": "",
            "subsections": [
                {
                    "name": "22.2 Loading and Unloading Serialized Tables",
                    "content": "If you've built your scanner with '%option tables-file', then you must\nload the scanner tables at runtime.  This can be accomplished with the\nfollowing function:\n\n-- Function: int yytablesfload (FILE* FP [, yyscant SCANNER])\nLocates scanner tables in the stream pointed to by FP and loads\nthem.  Memory for the tables is allocated via 'yyalloc'.  You must\ncall this function before the first call to 'yylex'.  The argument\nSCANNER only appears in the reentrant scanner.  This function\nreturns '0' (zero) on success, or non-zero on error.\n\nThe loaded tables are *not* automatically destroyed (unloaded) when\nyou call 'yylexdestroy'.  The reason is that you may create several\nscanners of the same type (in a reentrant scanner), each of which needs\naccess to these tables.  To avoid a nasty memory leak, you must call the\nfollowing function:\n\n-- Function: int yytablesdestroy ([yyscant SCANNER])\nUnloads the scanner tables.  The tables must be loaded again before\nyou can scan any more data.  The argument SCANNER only appears in\nthe reentrant scanner.  This function returns '0' (zero) on\nsuccess, or non-zero on error.\n\n*The functions 'yytablesfload' and 'yytablesdestroy' are not\nthread-safe.*  You must ensure that these functions are called exactly\nonce (for each scanner type) in a threaded program, before any thread\ncalls 'yylex'.  After the tables are loaded, they are never written to,\nand no thread protection is required thereafter - until you destroy\nthem.\n"
                }
            ]
        },
        "File: flex.info,  Node: Tables File Format,  Prev: Loading and Unloading Serialized Tables,  Up: Serialized Tables": {
            "content": "",
            "subsections": [
                {
                    "name": "22.3 Tables File Format",
                    "content": "This section defines the file format of serialized 'flex' tables.\n\nThe tables format allows for one or more sets of tables to be\nspecified, where each set corresponds to a given scanner.  Scanners are\nindexed by name, as described below.  The file format is as follows:\n\nTABLE SET 1\n+-------------------------------+\nHeader  | uint32          thmagic;     |\n| uint32          thhsize;     |\n| uint32          thssize;     |\n| uint16          thflags;     |\n| char            thversion[]; |\n| char            thname[];    |\n| uint8           thpad64[];   |\n+-------------------------------+\nTable 1 | uint16          tdid;        |\n| uint16          tdflags;     |\n| uint32          tdhilen;     |\n| uint32          tdlolen;     |\n| void            tddata[];    |\n| uint8           tdpad64[];   |\n+-------------------------------+\nTable 2 |                               |\n.    .                               .\n.    .                               .\n.    .                               .\n.    .                               .\nTable n |                               |\n+-------------------------------+\nTABLE SET 2\n.\n.\n.\nTABLE SET N\n\nThe above diagram shows that a complete set of tables consists of a\nheader followed by multiple individual tables.  Furthermore, multiple\ncomplete sets may be present in the same file, each set with its own\nheader and tables.  The sets are contiguous in the file.  The only way\nto know if another set follows is to check the next four bytes for the\nmagic number (or check for EOF). The header and tables sections are\npadded to 64-bit boundaries.  Below we describe each field in detail."
                }
            ]
        },
        "This format does not specify how the scanner will expand the given data,": {
            "content": "i.e., data may be serialized as int8, but expanded to an int32 array at\nruntime.  This is to reduce the size of the serialized data where\npossible.  Remember, all integer values are in network byte order.\n\nFields of a table header:\n\n'thmagic'\nMagic number, always 0xF13C57B1.\n\n'thhsize'\nSize of this entire header, in bytes, including all fields plus any\npadding.\n\n'thssize'\nSize of this entire set, in bytes, including the header, all\ntables, plus any padding.\n\n'thflags'\nBit flags for this table set.  Currently unused.\n\n'thversion[]'\nFlex version in NULL-terminated string format.  e.g., '2.5.13a'.\nThis is the version of flex that was used to create the serialized\ntables.\n\n'thname[]'\nContains the name of this table set.  The default is 'yytables',\nand is prefixed accordingly, e.g., 'footables'.  Must be\nNULL-terminated.\n\n'thpad64[]'\nZero or more NULL bytes, padding the entire header to the next\n64-bit boundary as calculated from the beginning of the header.\n\nFields of a table:\n\n'tdid'\nSpecifies the table identifier.  Possible values are:\n'YYTDIDACCEPT (0x01)'\n'yyaccept'\n'YYTDIDBASE (0x02)'\n'yybase'\n'YYTDIDCHK (0x03)'\n'yychk'\n'YYTDIDDEF (0x04)'\n'yydef'\n'YYTDIDEC (0x05)'\n'yyec '\n'YYTDIDMETA (0x06)'\n'yymeta'\n'YYTDIDNULTRANS (0x07)'\n'yyNULtrans'\n'YYTDIDNXT (0x08)'\n'yynxt'.  This array may be two dimensional.  See the\n'tdhilen' field below.\n'YYTDIDRULECANMATCHEOL (0x09)'\n'yyrulecanmatcheol'\n'YYTDIDSTARTSTATELIST (0x0A)'\n'yystartstatelist'.  This array is handled specially\nbecause it is an array of pointers to structs.  See the\n'tdflags' field below.\n'YYTDIDTRANSITION (0x0B)'\n'yytransition'.  This array is handled specially because it\nis an array of structs.  See the 'tdlolen' field below.\n'YYTDIDACCLIST (0x0C)'\n'yyacclist'\n\n'tdflags'\nBit flags describing how to interpret the data in 'tddata'.  The\ndata arrays are one-dimensional by default, but may be two\ndimensional as specified in the 'tdhilen' field.\n\n'YYTDDATA8 (0x01)'\nThe data is serialized as an array of type int8.\n'YYTDDATA16 (0x02)'\nThe data is serialized as an array of type int16.\n'YYTDDATA32 (0x04)'\nThe data is serialized as an array of type int32.\n'YYTDPTRANS (0x08)'\nThe data is a list of indexes of entries in the expanded\n'yytransition' array.  Each index should be expanded to a\npointer to the corresponding entry in the 'yytransition'\narray.  We count on the fact that the 'yytransition' array\nhas already been seen.\n'YYTDSTRUCT (0x10)'\nThe data is a list of yytransinfo structs, each of which\nconsists of two integers.  There is no padding between struct\nelements or between structs.  The type of each member is\ndetermined by the 'YYTDDATA*' bits.\n\n'tdhilen'\nIf 'tdhilen' is non-zero, then the data is a two-dimensional\narray.  Otherwise, the data is a one-dimensional array.  'tdhilen'\ncontains the number of elements in the higher dimensional array,\nand 'tdlolen' contains the number of elements in the lowest\ndimension.\n\nConceptually, 'tddata' is either 'sometype tddata[tdlolen]', or\n'sometype tddata[tdhilen][tdlolen]', where 'sometype' is\nspecified by the 'tdflags' field.  It is possible for both\n'tdlolen' and 'tdhilen' to be zero, in which case 'tddata' is a\nzero length array, and no data is loaded, i.e., this table is\nsimply skipped.  Flex does not currently generate tables of zero\nlength.\n\n'tdlolen'\nSpecifies the number of elements in the lowest dimension array.  If\nthis is a one-dimensional array, then it is simply the number of\nelements in this array.  The element size is determined by the\n'tdflags' field.\n\n'tddata[]'\nThe table data.  This array may be a one- or two-dimensional array,\nof type 'int8', 'int16', 'int32', 'struct yytransinfo', or\n'struct yytransinfo*', depending upon the values in the\n'tdflags', 'tdhilen', and 'tdlolen' fields.\n\n'tdpad64[]'\nZero or more NULL bytes, padding the entire table to the next\n64-bit boundary as calculated from the beginning of this table.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Diagnostics,  Next: Limitations,  Prev: Serialized Tables,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "23 Diagnostics": {
            "content": "The following is a list of 'flex' diagnostic messages:\n\n* 'warning, rule cannot be matched' indicates that the given rule\ncannot be matched because it follows other rules that will always\nmatch the same text as it.  For example, in the following 'foo'\ncannot be matched because it comes after an identifier \"catch-all\"\nrule:\n\n[a-z]+    gotidentifier();\nfoo       gotfoo();\n\nUsing 'REJECT' in a scanner suppresses this warning.\n\n* 'warning, -s option given but default rule can be matched' means\nthat it is possible (perhaps only in a particular start condition)\nthat the default rule (match any single character) is the only one\nthat will match a particular input.  Since '-s' was given,\npresumably this is not intended.\n\n* 'rejectusedbutnotdetected undefined' or\n'yymoreusedbutnotdetected undefined'.  These errors can occur\nat compile time.  They indicate that the scanner uses 'REJECT' or\n'yymore()' but that 'flex' failed to notice the fact, meaning that\n'flex' scanned the first two sections looking for occurrences of\nthese actions and failed to find any, but somehow you snuck some in\n(via a #include file, for example).  Use '%option reject' or\n'%option yymore' to indicate to 'flex' that you really do use these\nfeatures.\n\n* 'flex scanner jammed'.  a scanner compiled with '-s' has\nencountered an input string which wasn't matched by any of its\nrules.  This error can also occur due to internal problems.\n\n* 'token too large, exceeds YYLMAX'.  your scanner uses '%array' and\none of its rules matched a string longer than the 'YYLMAX' constant\n(8K bytes by default).  You can increase the value by #define'ing\n'YYLMAX' in the definitions section of your 'flex' input.\n\n* 'scanner requires -8 flag to use the character 'x''.  Your scanner\nspecification includes recognizing the 8-bit character ''x'' and\nyou did not specify the -8 flag, and your scanner defaulted to\n7-bit because you used the '-Cf' or '-CF' table compression\noptions.  See the discussion of the '-7' flag, *note Scanner\nOptions::, for details.\n\n* 'flex scanner push-back overflow'.  you used 'unput()' to push back\nso much text that the scanner's buffer could not hold both the\npushed-back text and the current token in 'yytext'.  Ideally the\nscanner should dynamically resize the buffer in this case, but at\npresent it does not.\n\n* 'input buffer overflow, can't enlarge buffer because scanner uses\nREJECT'.  the scanner was working on matching an extremely large\ntoken and needed to expand the input buffer.  This doesn't work\nwith scanners that use 'REJECT'.\n\n* 'fatal flex scanner internal error--end of buffer missed'.  This\ncan occur in a scanner which is reentered after a long-jump has\njumped out (or over) the scanner's activation frame.  Before\nreentering the scanner, use:\nyyrestart( yyin );\nor, as noted above, switch to using the C++ scanner class.\n\n* 'too many start conditions in <> construct!' you listed more start\nconditions in a <> construct than exist (so you must have listed at\nleast one of them twice).\n",
            "subsections": []
        },
        "File: flex.info,  Node: Limitations,  Next: Bibliography,  Prev: Diagnostics,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "24 Limitations": {
            "content": "",
            "subsections": []
        },
        "Some trailing context patterns cannot be properly matched and generate": {
            "content": "warning messages ('dangerous trailing context').  These are patterns\nwhere the ending of the first part of the rule matches the beginning of\nthe second part, such as 'zx*/xy*', where the 'x*' matches the 'x' at\nthe beginning of the trailing context.  (Note that the POSIX draft\nstates that the text matched by such patterns is undefined.)  For some\ntrailing context rules, parts which are actually fixed-length are not\nrecognized as such, leading to the abovementioned performance loss.  In\nparticular, parts using '|' or '{n}' (such as 'foo{3}') are always\nconsidered variable-length.  Combining trailing context with the special\n'|' action can result in fixed trailing context being turned into the\nmore expensive variable trailing context.  For example, in the\nfollowing:\n\n%%\nabc      |\nxyz/def\n\nUse of 'unput()' invalidates yytext and yyleng, unless the '%array'\ndirective or the '-l' option has been used.  Pattern-matching of 'NUL's\nis substantially slower than matching other characters.  Dynamic\nresizing of the input buffer is slow, as it entails rescanning all the\ntext matched so far by the current (generally huge) token.  Due to both\nbuffering of input and read-ahead, you cannot intermix calls to\n'<stdio.h>' routines, such as, getchar(), with 'flex' rules and expect\nit to work.  Call 'input()' instead.  The total table entries listed by\nthe '-v' flag excludes the number of table entries needed to determine\nwhat rule has been matched.  The number of entries is equal to the\nnumber of DFA states if the scanner does not use 'REJECT', and somewhat\ngreater than the number of states if it does.  'REJECT' cannot be used\nwith the '-f' or '-F' options.\n\nThe 'flex' internal algorithms need documentation.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Bibliography,  Next: FAQ,  Prev: Limitations,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "25 Additional Reading": {
            "content": "You may wish to read more about the following programs:\n* lex\n* yacc\n* sed\n* awk\n\nThe following books may contain material of interest:\n\nJohn Levine, Tony Mason, and Doug Brown, Lex & Yacc, O'Reilly and\nAssociates.  Be sure to get the 2nd edition.\n\nM. E. Lesk and E. Schmidt, LEX - Lexical Analyzer Generator\n\nAlfred Aho, Ravi Sethi and Jeffrey Ullman, Compilers: Principles,",
            "subsections": []
        },
        "Techniques and Tools, Addison-Wesley (1986).  Describes the": {
            "content": "pattern-matching techniques used by 'flex' (deterministic finite\nautomata).\n",
            "subsections": []
        },
        "File: flex.info,  Node: FAQ,  Next: Appendices,  Prev: Bibliography,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "Rather than repeat answers to well-understood problems, we publish them": {
            "content": "here.\n\n* Menu:\n\n* When was flex born?::\n* How do I expand backslash-escape sequences in C-style quoted strings?::\n* Why do flex scanners call fileno if it is not ANSI compatible?::\n* Does flex support recursive pattern definitions?::\n* How do I skip huge chunks of input (tens of megabytes) while using flex?::\n* Flex is not matching my patterns in the same order that I defined them.::\n* My actions are executing out of order or sometimes not at all.::\n* How can I have multiple input sources feed into the same scanner at the same time?::\n* Can I build nested parsers that work with the same input file?::\n* How can I match text only at the end of a file?::\n* How can I make REJECT cascade across start condition boundaries?::\n* Why cant I use fast or full tables with interactive mode?::\n* How much faster is -F or -f than -C?::\n* If I have a simple grammar cant I just parse it with flex?::\n* Why doesn't yyrestart() set the start state back to INITIAL?::\n* How can I match C-style comments?::\n* The period isn't working the way I expected.::\n* Can I get the flex manual in another format?::\n* Does there exist a \"faster\" NDFA->DFA algorithm?::\n* How does flex compile the DFA so quickly?::\n* How can I use more than 8192 rules?::\n* How do I abandon a file in the middle of a scan and switch to a new file?::\n* How do I execute code only during initialization (only before the first scan)?::\n* How do I execute code at termination?::\n* Where else can I find help?::\n* Can I include comments in the \"rules\" section of the file?::\n* I get an error about undefined yywrap().::\n* How can I change the matching pattern at run time?::\n* How can I expand macros in the input?::\n* How can I build a two-pass scanner?::\n* How do I match any string not matched in the preceding rules?::\n* I am trying to port code from AT&T lex that uses yysptr and yysbuf.::\n* Is there a way to make flex treat NULL like a regular character?::\n* Whenever flex can not match the input it says \"flex scanner jammed\".::\n* Why doesn't flex have non-greedy operators like perl does?::\n* Memory leak - 16386 bytes allocated by malloc.::\n* How do I track the byte offset for lseek()?::\n* How do I use my own I/O classes in a C++ scanner?::\n* How do I skip as many chars as possible?::\n* deleteme00::\n* Are certain equivalent patterns faster than others?::\n* Is backing up a big deal?::\n* Can I fake multi-byte character support?::\n* deleteme01::\n* Can you discuss some flex internals?::\n* unput() messes up yyatbol::\n* The | operator is not doing what I want::\n* Why can't flex understand this variable trailing context pattern?::\n* The ^ operator isn't working::\n* Trailing context is getting confused with trailing optional patterns::\n* Is flex GNU or not?::\n* ERASEME53::\n* I need to scan if-then-else blocks and while loops::\n* ERASEME55::\n* ERASEME56::\n* ERASEME57::\n* Is there a repository for flex scanners?::\n* How can I conditionally compile or preprocess my flex input file?::\n* Where can I find grammars for lex and yacc?::\n* I get an end-of-buffer message for each character scanned.::\n* unnamed-faq-62::\n* unnamed-faq-63::\n* unnamed-faq-64::\n* unnamed-faq-65::\n* unnamed-faq-66::\n* unnamed-faq-67::\n* unnamed-faq-68::\n* unnamed-faq-69::\n* unnamed-faq-70::\n* unnamed-faq-71::\n* unnamed-faq-72::\n* unnamed-faq-73::\n* unnamed-faq-74::\n* unnamed-faq-75::\n* unnamed-faq-76::\n* unnamed-faq-77::\n* unnamed-faq-78::\n* unnamed-faq-79::\n* unnamed-faq-80::\n* unnamed-faq-81::\n* unnamed-faq-82::\n* unnamed-faq-83::\n* unnamed-faq-84::\n* unnamed-faq-85::\n* unnamed-faq-86::\n* unnamed-faq-87::\n* unnamed-faq-88::\n* unnamed-faq-90::\n* unnamed-faq-91::\n* unnamed-faq-92::\n* unnamed-faq-93::\n* unnamed-faq-94::\n* unnamed-faq-95::\n* unnamed-faq-96::\n* unnamed-faq-97::\n* unnamed-faq-98::\n* unnamed-faq-99::\n* unnamed-faq-100::\n* unnamed-faq-101::\n* What is the difference between YYLEXPARAM and YYDECL?::\n* Why do I get \"conflicting types for yylex\" error?::\n* How do I access the values set in a Flex action from within a Bison action?::\n\nFile: flex.info,  Node: When was flex born?,  Next: How do I expand backslash-escape sequences in C-style quoted strings?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "When was flex born?",
                    "content": ""
                }
            ]
        },
        "Vern Paxson took over the 'Software Tools' lex project from Jef": {
            "content": "",
            "subsections": []
        },
        "Poskanzer in 1982.  At that point it was written in Ratfor.  Around 1987": {
            "content": "or so, Paxson translated it into C, and a legend was born :-).\n\nFile: flex.info,  Node: How do I expand backslash-escape sequences in C-style quoted strings?,  Next: Why do flex scanners call fileno if it is not ANSI compatible?,  Prev: When was flex born?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How do I expand backslash-escape sequences in C-style quoted strings?",
                    "content": "A key point when scanning quoted strings is that you cannot (easily)\nwrite a single rule that will precisely match the string if you allow\nthings like embedded escape sequences and newlines.  If you try to match\nstrings with a single rule then you'll wind up having to rescan the\nstring anyway to find any escape sequences.\n\nInstead you can use exclusive start conditions and a set of rules,\none for matching non-escaped text, one for matching a single escape, one\nfor matching an embedded newline, and one for recognizing the end of the\nstring.  Each of these rules is then faced with the question of where to\nput its intermediary results.  The best solution is for the rules to\nappend their local value of 'yytext' to the end of a \"string literal\"\nbuffer.  A rule like the escape-matcher will append to the buffer the\nmeaning of the escape sequence rather than the literal text in 'yytext'.\nIn this way, 'yytext' does not need to be modified at all.\n\nFile: flex.info,  Node: Why do flex scanners call fileno if it is not ANSI compatible?,  Next: Does flex support recursive pattern definitions?,  Prev: How do I expand backslash-escape sequences in C-style quoted strings?,  Up: FAQ\n"
                },
                {
                    "name": "Why do flex scanners call fileno if it is not ANSI compatible?",
                    "content": ""
                }
            ]
        },
        "Flex scanners call 'fileno()' in order to get the file descriptor": {
            "content": "corresponding to 'yyin'.  The file descriptor may be passed to\n'isatty()' or 'read()', depending upon which '%options' you specified.",
            "subsections": []
        },
        "If your system does not have 'fileno()' support, to get rid of the": {
            "content": "'read()' call, do not specify '%option read'.  To get rid of the\n'isatty()' call, you must specify one of '%option always-interactive' or\n'%option never-interactive'.\n\nFile: flex.info,  Node: Does flex support recursive pattern definitions?,  Next: How do I skip huge chunks of input (tens of megabytes) while using flex?,  Prev: Why do flex scanners call fileno if it is not ANSI compatible?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "Does flex support recursive pattern definitions?",
                    "content": "e.g.,\n\n%%\nblock   \"{\"({block}|{statement})*\"}\"\n\nNo.  You cannot have recursive definitions.  The pattern-matching\npower of regular expressions in general (and therefore flex scanners,\ntoo) is limited.  In particular, regular expressions cannot \"balance\"\nparentheses to an arbitrary degree.  For example, it's impossible to\nwrite a regular expression that matches all strings containing the same\nnumber of '{'s as '}'s.  For more powerful pattern matching, you need a\nparser, such as 'GNU bison'.\n\nFile: flex.info,  Node: How do I skip huge chunks of input (tens of megabytes) while using flex?,  Next: Flex is not matching my patterns in the same order that I defined them.,  Prev: Does flex support recursive pattern definitions?,  Up: FAQ\n"
                },
                {
                    "name": "How do I skip huge chunks of input (tens of megabytes) while using flex?",
                    "content": "Use 'fseek()' (or 'lseek()') to position yyin, then call 'yyrestart()'.\n\nFile: flex.info,  Node: Flex is not matching my patterns in the same order that I defined them.,  Next: My actions are executing out of order or sometimes not at all.,  Prev: How do I skip huge chunks of input (tens of megabytes) while using flex?,  Up: FAQ\n"
                },
                {
                    "name": "Flex is not matching my patterns in the same order that I defined them.",
                    "content": "'flex' picks the rule that matches the most text (i.e., the longest\npossible input string).  This is because 'flex' uses an entirely\ndifferent matching technique (\"deterministic finite automata\") that\nactually does all of the matching simultaneously, in parallel.  (Seems\nimpossible, but it's actually a fairly simple technique once you\nunderstand the principles.)\n\nA side-effect of this parallel matching is that when the input\nmatches more than one rule, 'flex' scanners pick the rule that matched\nthe most text.  This is explained further in the manual, in the\nsection *Note Matching::.\n\nIf you want 'flex' to choose a shorter match, then you can work\naround this behavior by expanding your short rule to match more text,\nthen put back the extra:\n\ndata.*        yyless( 5 ); BEGIN BLOCKIDSTATE;\n\nAnother fix would be to make the second rule active only during the\n'<BLOCKIDSTATE>' start condition, and make that start condition\nexclusive by declaring it with '%x' instead of '%s'.\n\nA final fix is to change the input language so that the ambiguity for\n'data' is removed, by adding characters to it that don't match the\nidentifier rule, or by removing characters (such as '') from the\nidentifier rule so it no longer matches 'data'.  (Of course, you might\nalso not have the option of changing the input language.)\n\nFile: flex.info,  Node: My actions are executing out of order or sometimes not at all.,  Next: How can I have multiple input sources feed into the same scanner at the same time?,  Prev: Flex is not matching my patterns in the same order that I defined them.,  Up: FAQ\n"
                },
                {
                    "name": "My actions are executing out of order or sometimes not at all.",
                    "content": "Most likely, you have (in error) placed the opening '{' of the action\nblock on a different line than the rule, e.g.,\n\n^(foo|bar)\n{  <<<--- WRONG!\n\n}\n\n'flex' requires that the opening '{' of an action associated with a\nrule begin on the same line as does the rule.  You need instead to write\nyour rules as follows:\n\n^(foo|bar)   {  // CORRECT!\n\n}\n\nFile: flex.info,  Node: How can I have multiple input sources feed into the same scanner at the same time?,  Next: Can I build nested parsers that work with the same input file?,  Prev: My actions are executing out of order or sometimes not at all.,  Up: FAQ\n"
                },
                {
                    "name": "How can I have multiple input sources feed into the same scanner at the same time?",
                    "content": "If ...\n* your scanner is free of backtracking (verified using 'flex''s '-b'\nflag),\n* AND you run your scanner interactively ('-I' option; default unless\nusing special table compression options),\n* AND you feed it one character at a time by redefining 'YYINPUT' to\ndo so,\n\nthen every time it matches a token, it will have exhausted its input\nbuffer (because the scanner is free of backtracking).  This means you\ncan safely use 'select()' at the point and only call 'yylex()' for\nanother token if 'select()' indicates there's data available.\n\nThat is, move the 'select()' out from the input function to a point\nwhere it determines whether 'yylex()' gets called for the next token.\n\nWith this approach, you will still have problems if your input can\narrive piecemeal; 'select()' could inform you that the beginning of a\ntoken is available, you call 'yylex()' to get it, but it winds up\nblocking waiting for the later characters in the token.\n\nHere's another way: Move your input multiplexing inside of\n'YYINPUT'.  That is, whenever 'YYINPUT' is called, it 'select()''s to\nsee where input is available.  If input is available for the scanner, it\nreads and returns the next byte.  If input is available from another\nsource, it calls whatever function is responsible for reading from that\nsource.  (If no input is available, it blocks until some input is\navailable.)  I've used this technique in an interpreter I wrote that\nboth reads keyboard input using a 'flex' scanner and IPC traffic from\nsockets, and it works fine.\n\nFile: flex.info,  Node: Can I build nested parsers that work with the same input file?,  Next: How can I match text only at the end of a file?,  Prev: How can I have multiple input sources feed into the same scanner at the same time?,  Up: FAQ\n"
                },
                {
                    "name": "Can I build nested parsers that work with the same input file?",
                    "content": ""
                }
            ]
        },
        "This is not going to work without some additional effort.  The reason is": {
            "content": "that 'flex' block-buffers the input it reads from 'yyin'.  This means\nthat the \"outermost\" 'yylex()', when called, will automatically slurp up\nthe first 8K of input available on yyin, and subsequent calls to other\n'yylex()''s won't see that input.  You might be tempted to work around\nthis problem by redefining 'YYINPUT' to only return a small amount of\ntext, but it turns out that that approach is quite difficult.  Instead,\nthe best solution is to combine all of your scanners into one large\nscanner, using a different exclusive start condition for each.\n\nFile: flex.info,  Node: How can I match text only at the end of a file?,  Next: How can I make REJECT cascade across start condition boundaries?,  Prev: Can I build nested parsers that work with the same input file?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How can I match text only at the end of a file?",
                    "content": "There is no way to write a rule which is \"match this text, but only if\nit comes at the end of the file\".  You can fake it, though, if you\nhappen to have a character lying around that you don't allow in your\ninput.  Then you redefine 'YYINPUT' to call your own routine which, if\nit sees an 'EOF', returns the magic character first (and remembers to\nreturn a real 'EOF' next time it's called).  Then you could write:\n\n<COMMENT>(.|\\n)*{EOFCHAR}    /* saw comment at EOF */\n\nFile: flex.info,  Node: How can I make REJECT cascade across start condition boundaries?,  Next: Why cant I use fast or full tables with interactive mode?,  Prev: How can I match text only at the end of a file?,  Up: FAQ\n"
                },
                {
                    "name": "How can I make REJECT cascade across start condition boundaries?",
                    "content": ""
                }
            ]
        },
        "You can do this as follows.  Suppose you have a start condition 'A', and": {
            "content": "after exhausting all of the possible matches in '<A>', you want to try\nmatches in '<INITIAL>'.  Then you could use the following:\n\n%x A\n%%\n<A>rulethatislong    ...; REJECT;\n<A>rule                 ...; REJECT; /* shorter rule */\n<A>etc.\n...\n<A>.|\\n  {\n/* Shortest and last rule in <A>, so\n* cascaded REJECTs will eventually\n* wind up matching this rule.  We want\n* to now switch to the initial state\n* and try matching from there instead.\n*/\nyyless(0);    /* put back matched text */\nBEGIN(INITIAL);\n}\n\nFile: flex.info,  Node: Why cant I use fast or full tables with interactive mode?,  Next: How much faster is -F or -f than -C?,  Prev: How can I make REJECT cascade across start condition boundaries?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "Why can't I use fast or full tables with interactive mode?",
                    "content": ""
                }
            ]
        },
        "One of the assumptions flex makes is that interactive applications are": {
            "content": "inherently slow (they're waiting on a human after all).  It has to do\nwith how the scanner detects that it must be finished scanning a token.",
            "subsections": []
        },
        "For interactive scanners, after scanning each character the current": {
            "content": "state is looked up in a table (essentially) to see whether there's a\nchance of another input character possibly extending the length of the\nmatch.  If not, the scanner halts.  For non-interactive scanners, the\nend-of-token test is much simpler, basically a compare with 0, so no\nmemory bus cycles.  Since the test occurs in the innermost scanning\nloop, one would like to make it go as fast as possible.\n\nStill, it seems reasonable to allow the user to choose to trade off a\nbit of performance in this area to gain the corresponding flexibility.",
            "subsections": []
        },
        "There might be another reason, though, why fast scanners don't support": {
            "content": "the interactive option.\n\nFile: flex.info,  Node: How much faster is -F or -f than -C?,  Next: If I have a simple grammar cant I just parse it with flex?,  Prev: Why cant I use fast or full tables with interactive mode?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How much faster is -F or -f than -C?",
                    "content": "Much faster (factor of 2-3).\n\nFile: flex.info,  Node: If I have a simple grammar cant I just parse it with flex?,  Next: Why doesn't yyrestart() set the start state back to INITIAL?,  Prev: How much faster is -F or -f than -C?,  Up: FAQ\n"
                },
                {
                    "name": "If I have a simple grammar can't I just parse it with flex?",
                    "content": "Is your grammar recursive?  That's almost always a sign that you're\nbetter off using a parser/scanner rather than just trying to use a\nscanner alone.\n\nFile: flex.info,  Node: Why doesn't yyrestart() set the start state back to INITIAL?,  Next: How can I match C-style comments?,  Prev: If I have a simple grammar cant I just parse it with flex?,  Up: FAQ\n"
                },
                {
                    "name": "Why doesn't yyrestart() set the start state back to INITIAL?",
                    "content": ""
                }
            ]
        },
        "There are two reasons.  The first is that there might be programs that": {
            "content": "rely on the start state not changing across file changes.  The second is\nthat beginning with 'flex' version 2.4, use of 'yyrestart()' is no\nlonger required, so fixing the problem there doesn't solve the more\ngeneral problem.\n\nFile: flex.info,  Node: How can I match C-style comments?,  Next: The period isn't working the way I expected.,  Prev: Why doesn't yyrestart() set the start state back to INITIAL?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How can I match C-style comments?",
                    "content": "You might be tempted to try something like this:\n\n\"/*\".*\"*/\"       // WRONG!\n\nor, worse, this:\n\n\"/*\"(.|\\n)\"*/\"   // WRONG!\n\nThe above rules will eat too much input, and blow up on things like:\n\n/* a comment */ domything( \"oops */\" );\n\nHere is one way which allows you to track line information:\n\n<INITIAL>{\n\"/*\"              BEGIN(INCOMMENT);\n}\n<INCOMMENT>{\n\"*/\"      BEGIN(INITIAL);\n[^*\\n]+   // eat comment in chunks\n\"*\"       // eat the lone star\n\\n        yylineno++;\n}\n\nFile: flex.info,  Node: The period isn't working the way I expected.,  Next: Can I get the flex manual in another format?,  Prev: How can I match C-style comments?,  Up: FAQ\n"
                },
                {
                    "name": "The '.' isn't working the way I expected.",
                    "content": "Here are some tips for using '.':\n\n* A common mistake is to place the grouping parenthesis AFTER an\noperator, when you really meant to place the parenthesis BEFORE the\noperator, e.g., you probably want this '(foo|bar)+' and NOT this\n'(foo|bar+)'.\n\nThe first pattern matches the words 'foo' or 'bar' any number of\ntimes, e.g., it matches the text 'barfoofoobarfoo'.  The second\npattern matches a single instance of 'foo' or a single instance of\n'bar' followed by one or more 'r's, e.g., it matches the text\n'barrrr' .\n* A '.' inside '[]''s just means a literal'.' (period), and NOT \"any\ncharacter except newline\".\n* Remember that '.' matches any character EXCEPT '\\n' (and 'EOF').\nIf you really want to match ANY character, including newlines, then\nuse '(.|\\n)' Beware that the regex '(.|\\n)+' will match your entire\ninput!\n* Finally, if you want to match a literal '.' (a period), then use\n'[.]' or '\".\"'\n\nFile: flex.info,  Node: Can I get the flex manual in another format?,  Next: Does there exist a \"faster\" NDFA->DFA algorithm?,  Prev: The period isn't working the way I expected.,  Up: FAQ\n"
                },
                {
                    "name": "Can I get the flex manual in another format?",
                    "content": ""
                }
            ]
        },
        "The 'flex' source distribution includes a texinfo manual.  You are free": {
            "content": "to convert that texinfo into whatever format you desire.  The 'texinfo'\npackage includes tools for conversion to a number of formats.\n\nFile: flex.info,  Node: Does there exist a \"faster\" NDFA->DFA algorithm?,  Next: How does flex compile the DFA so quickly?,  Prev: Can I get the flex manual in another format?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "Does there exist a \"faster\" NDFA->DFA algorithm?",
                    "content": ""
                }
            ]
        },
        "There's no way around the potential exponential running time - it can": {
            "content": "take you exponential time just to enumerate all of the DFA states.  In\npractice, though, the running time is closer to linear, or sometimes\nquadratic.\n\nFile: flex.info,  Node: How does flex compile the DFA so quickly?,  Next: How can I use more than 8192 rules?,  Prev: Does there exist a \"faster\" NDFA->DFA algorithm?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How does flex compile the DFA so quickly?",
                    "content": "There are two big speed wins that 'flex' uses:\n\n1. It analyzes the input rules to construct equivalence classes for\nthose characters that always make the same transitions.  It then\nrewrites the NFA using equivalence classes for transitions instead\nof characters.  This cuts down the NFA->DFA computation time\ndramatically, to the point where, for uncompressed DFA tables, the\nDFA generation is often I/O bound in writing out the tables.\n2. It maintains hash values for previously computed DFA states, so\ntesting whether a newly constructed DFA state is equivalent to a\npreviously constructed state can be done very quickly, by first\ncomparing hash values.\n\nFile: flex.info,  Node: How can I use more than 8192 rules?,  Next: How do I abandon a file in the middle of a scan and switch to a new file?,  Prev: How does flex compile the DFA so quickly?,  Up: FAQ\n"
                },
                {
                    "name": "How can I use more than 8192 rules?",
                    "content": "'Flex' is compiled with an upper limit of 8192 rules per scanner.  If\nyou need more than 8192 rules in your scanner, you'll have to recompile\n'flex' with the following changes in 'flexdef.h':\n\n<    #define YYTRAILINGMASK 0x2000\n<    #define YYTRAILINGHEADMASK 0x4000\n--\n>    #define YYTRAILINGMASK 0x20000000\n>    #define YYTRAILINGHEADMASK 0x40000000\n\nThis should work okay as long as your C compiler uses 32 bit\nintegers.  But you might want to think about whether using such a huge\nnumber of rules is the best way to solve your problem.\n\nThe following may also be relevant:\n\nWith luck, you should be able to increase the definitions in\nflexdef.h for:\n\n#define JAMSTATE -32766 /* marks a reference to the state that always jams */\n#define MAXIMUMMNS 31999\n#define BADSUBSCRIPT -32767\n\nrecompile everything, and it'll all work.  Flex only has these\n16-bit-like values built into it because a long time ago it was\ndeveloped on a machine with 16-bit ints.  I've given this advice to\nothers in the past but haven't heard back from them whether it worked\nokay or not...\n\nFile: flex.info,  Node: How do I abandon a file in the middle of a scan and switch to a new file?,  Next: How do I execute code only during initialization (only before the first scan)?,  Prev: How can I use more than 8192 rules?,  Up: FAQ\n"
                },
                {
                    "name": "How do I abandon a file in the middle of a scan and switch to a new file?",
                    "content": ""
                }
            ]
        },
        "Just call 'yyrestart(newfile)'.  Be sure to reset the start state if you": {
            "content": "want a \"fresh start, since 'yyrestart' does NOT reset the start state\nback to 'INITIAL'.\n\nFile: flex.info,  Node: How do I execute code only during initialization (only before the first scan)?,  Next: How do I execute code at termination?,  Prev: How do I abandon a file in the middle of a scan and switch to a new file?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How do I execute code only during initialization (only before the first scan)?",
                    "content": ""
                }
            ]
        },
        "You can specify an initial action by defining the macro 'YYUSERINIT'": {
            "content": "(though note that 'yyout' may not be available at the time this macro is\nexecuted).  Or you can add to the beginning of your rules section:\n\n%%\n/* Must be indented! */\nstatic int didinit = 0;\n\nif ( ! didinit ){\ndomyinit();\ndidinit = 1;\n}\n\nFile: flex.info,  Node: How do I execute code at termination?,  Next: Where else can I find help?,  Prev: How do I execute code only during initialization (only before the first scan)?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How do I execute code at termination?",
                    "content": "You can specify an action for the '<<EOF>>' rule.\n\nFile: flex.info,  Node: Where else can I find help?,  Next: Can I include comments in the \"rules\" section of the file?,  Prev: How do I execute code at termination?,  Up: FAQ\n"
                },
                {
                    "name": "Where else can I find help?",
                    "content": ""
                }
            ]
        },
        "You can find the flex homepage on the web at": {
            "content": "<http://flex.sourceforge.net/>.  See that page for details about flex\nmailing lists as well.\n\nFile: flex.info,  Node: Can I include comments in the \"rules\" section of the file?,  Next: I get an error about undefined yywrap().,  Prev: Where else can I find help?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "Can I include comments in the \"rules\" section of the file?",
                    "content": ""
                }
            ]
        },
        "Yes, just about anywhere you want to.  See the manual for the specific": {
            "content": "syntax.\n\nFile: flex.info,  Node: I get an error about undefined yywrap().,  Next: How can I change the matching pattern at run time?,  Prev: Can I include comments in the \"rules\" section of the file?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "I get an error about undefined yywrap().",
                    "content": ""
                }
            ]
        },
        "You must supply a 'yywrap()' function of your own, or link to 'libfl.a'": {
            "content": "(which provides one), or use\n\n%option noyywrap\n\nin your source to say you don't want a 'yywrap()' function.\n\nFile: flex.info,  Node: How can I change the matching pattern at run time?,  Next: How can I expand macros in the input?,  Prev: I get an error about undefined yywrap().,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How can I change the matching pattern at run time?",
                    "content": ""
                }
            ]
        },
        "You can't, it's compiled into a static table when flex builds the": {
            "content": "scanner.\n\nFile: flex.info,  Node: How can I expand macros in the input?,  Next: How can I build a two-pass scanner?,  Prev: How can I change the matching pattern at run time?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How can I expand macros in the input?",
                    "content": ""
                }
            ]
        },
        "The best way to approach this problem is at a higher level, e.g., in the": {
            "content": "parser.\n\nHowever, you can do this using multiple input buffers.\n\n%%\nmacro/[a-z]+\t{\n/* Saw the macro \"macro\" followed by extra stuff. */\nmainbuffer = YYCURRENTBUFFER;\nexpansionbuffer = yyscanstring(expand(yytext));\nyyswitchtobuffer(expansionbuffer);\n}\n\n<<EOF>>\t{\nif ( expansionbuffer )\n{\n// We were doing an expansion, return to where\n// we were.\nyyswitchtobuffer(mainbuffer);\nyydeletebuffer(expansionbuffer);\nexpansionbuffer = 0;\n}\nelse\nyyterminate();\n}\n\nYou probably will want a stack of expansion buffers to allow nested\nmacros.  From the above though hopefully the idea is clear.\n\nFile: flex.info,  Node: How can I build a two-pass scanner?,  Next: How do I match any string not matched in the preceding rules?,  Prev: How can I expand macros in the input?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How can I build a two-pass scanner?",
                    "content": ""
                }
            ]
        },
        "One way to do it is to filter the first pass to a temporary file, then": {
            "content": "process the temporary file on the second pass.  You will probably see a\nperformance hit, due to all the disk I/O.\n\nWhen you need to look ahead far forward like this, it almost always\nmeans that the right solution is to build a parse tree of the entire\ninput, then walk it after the parse in order to generate the output.  In\na sense, this is a two-pass approach, once through the text and once\nthrough the parse tree, but the performance hit for the latter is\nusually an order of magnitude smaller, since everything is already\nclassified, in binary format, and residing in memory.\n\nFile: flex.info,  Node: How do I match any string not matched in the preceding rules?,  Next: I am trying to port code from AT&T lex that uses yysptr and yysbuf.,  Prev: How can I build a two-pass scanner?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How do I match any string not matched in the preceding rules?",
                    "content": "One way to assign precedence, is to place the more specific rules first."
                }
            ]
        },
        "If two rules would match the same input (same sequence of characters)": {
            "content": "then the first rule listed in the 'flex' input wins, e.g.,\n\n%%\nfoo[a-zA-Z]+    return FOOID;\nbar[a-zA-Z]+    return BARID;\n[a-zA-Z]+       return GENERICID;\n\nNote that the rule '[a-zA-Z]+' must come *after* the others.  It\nwill match the same amount of text as the more specific rules, and in\nthat case the 'flex' scanner will pick the first rule listed in your\nscanner as the one to match.\n\nFile: flex.info,  Node: I am trying to port code from AT&T lex that uses yysptr and yysbuf.,  Next: Is there a way to make flex treat NULL like a regular character?,  Prev: How do I match any string not matched in the preceding rules?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "I am trying to port code from AT&T lex that uses yysptr and yysbuf.",
                    "content": "Those are internal variables pointing into the AT&T scanner's input\nbuffer.  I imagine they're being manipulated in user versions of the\n'input()' and 'unput()' functions.  If so, what you need to do is\nanalyze those functions to figure out what they're doing, and then\nreplace 'input()' with an appropriate definition of 'YYINPUT'.  You\nshouldn't need to (and must not) replace 'flex''s 'unput()' function.\n\nFile: flex.info,  Node: Is there a way to make flex treat NULL like a regular character?,  Next: Whenever flex can not match the input it says \"flex scanner jammed\".,  Prev: I am trying to port code from AT&T lex that uses yysptr and yysbuf.,  Up: FAQ\n"
                },
                {
                    "name": "Is there a way to make flex treat NULL like a regular character?",
                    "content": "Yes, '\\0' and '\\x00' should both do the trick.  Perhaps you have an\nancient version of 'flex'.  The latest release is version 2.6.4.\n\nFile: flex.info,  Node: Whenever flex can not match the input it says \"flex scanner jammed\".,  Next: Why doesn't flex have non-greedy operators like perl does?,  Prev: Is there a way to make flex treat NULL like a regular character?,  Up: FAQ\n"
                },
                {
                    "name": "Whenever flex can not match the input it says \"flex scanner jammed\".",
                    "content": ""
                }
            ]
        },
        "You need to add a rule that matches the otherwise-unmatched text, e.g.,": {
            "content": "%option yylineno\n%%\n[[a bunch of rules here]]\n\n.\tprintf(\"bad input character '%s' at line %d\\n\", yytext, yylineno);\n\nSee '%option default' for more information.\n\nFile: flex.info,  Node: Why doesn't flex have non-greedy operators like perl does?,  Next: Memory leak - 16386 bytes allocated by malloc.,  Prev: Whenever flex can not match the input it says \"flex scanner jammed\".,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "Why doesn't flex have non-greedy operators like perl does?",
                    "content": "A DFA can do a non-greedy match by stopping the first time it enters an\naccepting state, instead of consuming input until it determines that no\nfurther matching is possible (a \"jam\" state).  This is actually easier\nto implement than longest leftmost match (which flex does).\n\nBut it's also much less useful than longest leftmost match.  In\ngeneral, when you find yourself wishing for non-greedy matching, that's\nusually a sign that you're trying to make the scanner do some parsing."
                }
            ]
        },
        "That's generally the wrong approach, since it lacks the power to do a": {
            "content": "decent job.  Better is to either introduce a separate parser, or to\nsplit the scanner into multiple scanners using (exclusive) start\nconditions.\n\nYou might have a separate start state once you've seen the 'BEGIN'.",
            "subsections": []
        },
        "In that state, you might then have a regex that will match 'END' (to": {
            "content": "kick you out of the state), and perhaps '(.|\\n)' to get a single\ncharacter within the chunk ...\n\nThis approach also has much better error-reporting properties.\n\nFile: flex.info,  Node: Memory leak - 16386 bytes allocated by malloc.,  Next: How do I track the byte offset for lseek()?,  Prev: Why doesn't flex have non-greedy operators like perl does?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "Memory leak - 16386 bytes allocated by malloc.",
                    "content": "UPDATED 2002-07-10: As of 'flex' version 2.5.9, this leak means that you\ndid not call 'yylexdestroy()'.  If you are using an earlier version of\n'flex', then read on.\n\nThe leak is about 16426 bytes.  That is, (8192 * 2 + 2) for the\nread-buffer, and about 40 for 'struct yybufferstate' (depending upon\nalignment).  The leak is in the non-reentrant C scanner only (NOT in the\nreentrant scanner, NOT in the C++ scanner).  Since 'flex' doesn't know\nwhen you are done, the buffer is never freed.\n\nHowever, the leak won't multiply since the buffer is reused no matter\nhow many times you call 'yylex()'.\n\nIf you want to reclaim the memory when you are completely done\nscanning, then you might try this:\n\n/* For non-reentrant C scanner only. */\nyydeletebuffer(YYCURRENTBUFFER);\nyyinit = 1;\n\nNote: 'yyinit' is an \"internal variable\", and hasn't been tested in\nthis situation.  It is possible that some other globals may need\nresetting as well.\n\nFile: flex.info,  Node: How do I track the byte offset for lseek()?,  Next: How do I use my own I/O classes in a C++ scanner?,  Prev: Memory leak - 16386 bytes allocated by malloc.,  Up: FAQ\n"
                },
                {
                    "name": "How do I track the byte offset for lseek()?",
                    "content": ">   We thought that it would be possible to have this number through the\n>   evaluation of the following expression:\n>\n>   seekposition = (nobuffers)*YYREADBUFSIZE + yycbufp - YYCURRENTBUFFER->yychbuf\n\nWhile this is the right idea, it has two problems.  The first is that\nit's possible that 'flex' will request less than 'YYREADBUFSIZE'\nduring an invocation of 'YYINPUT' (or that your input source will\nreturn less even though 'YYREADBUFSIZE' bytes were requested).  The\nsecond problem is that when refilling its internal buffer, 'flex' keeps\nsome characters from the previous buffer (because usually it's in the\nmiddle of a match, and needs those characters to construct 'yytext' for\nthe match once it's done).  Because of this, 'yycbufp -\nYYCURRENTBUFFER->yychbuf' won't be exactly the number of characters\nalready read from the current buffer.\n\nAn alternative solution is to count the number of characters you've\nmatched since starting to scan.  This can be done by using\n'YYUSERACTION'.  For example,\n\n#define YYUSERACTION numchars += yyleng;\n\n(You need to be careful to update your bookkeeping if you use\n'yymore('), 'yyless()', 'unput()', or 'input()'.)\n\nFile: flex.info,  Node: How do I use my own I/O classes in a C++ scanner?,  Next: How do I skip as many chars as possible?,  Prev: How do I track the byte offset for lseek()?,  Up: FAQ\n"
                },
                {
                    "name": "How do I use my own I/O classes in a C++ scanner?",
                    "content": "When the flex C++ scanning class rewrite finally happens, then this sort\nof thing should become much easier.\n\nYou can do this by passing the various functions (such as\n'LexerInput()' and 'LexerOutput()') NULL 'iostream*''s, and then dealing\nwith your own I/O classes surreptitiously (i.e., stashing them in\nspecial member variables).  This works because the only assumption about\nthe lexer regarding what's done with the iostream's is that they're\nultimately passed to 'LexerInput()' and 'LexerOutput', which then do\nwhatever is necessary with them.\n\nFile: flex.info,  Node: How do I skip as many chars as possible?,  Next: deleteme00,  Prev: How do I use my own I/O classes in a C++ scanner?,  Up: FAQ\n"
                },
                {
                    "name": "How do I skip as many chars as possible?",
                    "content": ""
                }
            ]
        },
        "How do I skip as many chars as possible - without interfering with the": {
            "content": "other patterns?\n\nIn the example below, we want to skip over characters until we see\nthe phrase \"endskip\".  The following will NOT work correctly (do you\nsee why not?)\n\n/* INCORRECT SCANNER */\n%x SKIP\n%%\n<INITIAL>startskip   BEGIN(SKIP);\n...\n<SKIP>\"endskip\"       BEGIN(INITIAL);\n<SKIP>.*             ;\n\nThe problem is that the pattern .* will eat up the word \"endskip.\"\nThe simplest (but slow) fix is:\n\n<SKIP>\"endskip\"      BEGIN(INITIAL);\n<SKIP>.              ;\n\nThe fix involves making the second rule match more, without making it\nmatch \"endskip\" plus something else.  So for example:\n\n<SKIP>\"endskip\"     BEGIN(INITIAL);\n<SKIP>[^e]+         ;\n<SKIP>.\t\t        ;/* so you eat up e's, too */\n\nFile: flex.info,  Node: deleteme00,  Next: Are certain equivalent patterns faster than others?,  Prev: How do I skip as many chars as possible?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "deleteme00",
                    "content": "QUESTION:\nWhen was flex born?\n\nVern Paxson took over\nthe Software Tools lex project from Jef Poskanzer in 1982.  At that point it\nwas written in Ratfor.  Around 1987 or so, Paxson translated it into C, and\na legend was born :-).\n\nFile: flex.info,  Node: Are certain equivalent patterns faster than others?,  Next: Is backing up a big deal?,  Prev: deleteme00,  Up: FAQ\n"
                },
                {
                    "name": "Are certain equivalent patterns faster than others?",
                    "content": "To: Adoram Rogel <adoram@orna.hybridge.com>\nSubject: Re: Flex 2.5.2 performance questions\nIn-reply-to: Your message of Wed, 18 Sep 96 11:12:17 EDT.\nDate: Wed, 18 Sep 96 10:51:02 PDT\nFrom: Vern Paxson <vern>\n\n[Note, the most recent flex release is 2.5.4, which you can get from\nftp.ee.lbl.gov.  It has bug fixes over 2.5.2 and 2.5.3.]\n\n> 1. Using the pattern\n>    ([Ff](oot)?)?[Nn](ote)?(\\.)?\n>    instead of\n>    (((F|f)oot(N|n)ote)|((N|n)ote)|((N|n)\\.)|((F|f)(N|n)(\\.)))\n>    (in a very complicated flex program) caused the program to slow from\n>    300K+/min to 100K/min (no other changes were done).\n\nThese two are not equivalent.  For example, the first can match \"footnote.\"\nbut the second can only match \"footnote\".  This is almost certainly the\ncause in the discrepancy - the slower scanner run is matching more tokens,\nand/or having to do more backing up.\n\n> 2. Which of these two are better: [Ff]oot or (F|f)oot ?\n\nFrom a performance point of view, they're equivalent (modulo presumably\nminor effects such as memory cache hit rates; and the presence of trailing\ncontext, see below).  From a space point of view, the first is slightly\npreferable.\n\n> 3. I have a pattern that look like this:\n>    pats {p1}|{p2}|{p3}|...|{p50}     (50 patterns ORd)\n>\n>    running yet another complicated program that includes the following rule:\n>    <snext>{and}/{no4}{bb}{pats}\n>\n>    gets me to \"too complicated - over 32,000 states\"...\n\nI can't tell from this example whether the trailing context is variable-length\nor fixed-length (it could be the latter if {and} is fixed-length).  If it's\nvariable length, which flex -p will tell you, then this reflects a basic\nperformance problem, and if you can eliminate it by restructuring your\nscanner, you will see significant improvement.\n\n>    so I divided {pats} to {pats1}, {pats2},..., {pats5} each consists of about\n>    10 patterns and changed the rule to be 5 rules.\n>    This did compile, but what is the rule of thumb here ?\n\nThe rule is to avoid trailing context other than fixed-length, in which for\na/b, either the 'a' pattern or the 'b' pattern have a fixed length.  Use\nof the '|' operator automatically makes the pattern variable length, so in\nthis case '[Ff]oot' is preferred to '(F|f)oot'.\n\n> 4. I changed a rule that looked like this:\n>    <snext8>{and}{bb}/{ROMAN}[^A-Za-z] { BEGIN...\n>\n>    to the next 2 rules:\n>    <snext8>{and}{bb}/{ROMAN}[A-Za-z] { ECHO;}\n>    <snext8>{and}{bb}/{ROMAN}         { BEGIN...\n>\n>    Again, I understand the using [^...] will cause a great performance loss\n\nActually, it doesn't cause any sort of performance loss.  It's a surprising\nfact about regular expressions that they always match in linear time\nregardless of how complex they are.\n\n>    but are there any specific rules about it ?\n\nSee the \"Performance Considerations\" section of the man page, and also\nthe example in MISC/fastwc/.\n\nVern\n\nFile: flex.info,  Node: Is backing up a big deal?,  Next: Can I fake multi-byte character support?,  Prev: Are certain equivalent patterns faster than others?,  Up: FAQ\n"
                },
                {
                    "name": "Is backing up a big deal?",
                    "content": "To: Adoram Rogel <adoram@hybridge.com>\nSubject: Re: Flex 2.5.2 performance questions\nIn-reply-to: Your message of Thu, 19 Sep 96 10:16:04 EDT.\nDate: Thu, 19 Sep 96 09:58:00 PDT\nFrom: Vern Paxson <vern>\n\n> a lot about the backing up problem.\n> I believe that there lies my biggest problem, and I'll try to improve\n> it.\n\nSince you have variable trailing context, this is a bigger performance\nproblem.  Fixing it is usually easier than fixing backing up, which in a\ncomplicated scanner (yours seems to fit the bill) can be extremely\ndifficult to do correctly.\n\nYou also don't mention what flags you are using for your scanner.\n-f makes a large speed difference, and -Cfe buys you nearly as much\nspeed but the resulting scanner is considerably smaller.\n\n> I have an | operator in {and} and in {pats} so both of them are variable\n> length.\n\n-p should have reported this.\n\n> Is changing one of them to fixed-length is enough ?\n\nYes.\n\n> Is it possible to change the 32,000 states limit ?\n\nYes.  I've appended instructions on how.  Before you make this change,\nthough, you should think about whether there are ways to fundamentally\nsimplify your scanner - those are certainly preferable!\n\nVern\n\nTo increase the 32K limit (on a machine with 32 bit integers), you increase\nthe magnitude of the following in flexdef.h:\n\n#define JAMSTATE -32766 /* marks a reference to the state that always jams */\n#define MAXIMUMMNS 31999\n#define BADSUBSCRIPT -32767\n#define MAXSHORT 32700\n\nAdding a 0 or two after each should do the trick.\n\nFile: flex.info,  Node: Can I fake multi-byte character support?,  Next: deleteme01,  Prev: Is backing up a big deal?,  Up: FAQ\n"
                },
                {
                    "name": "Can I fake multi-byte character support?",
                    "content": "To: HeemanLee@hp.com\nSubject: Re: flex - multi-byte support?\nIn-reply-to: Your message of Thu, 03 Oct 1996 17:24:04 PDT.\nDate: Fri, 04 Oct 1996 11:42:18 PDT\nFrom: Vern Paxson <vern>\n\n>      I assume as long as my *.l file defines the\n>      range of expected character code values (in octal format), flex will\n>      scan the file and read multi-byte characters correctly. But I have no\n>      confidence in this assumption.\n\nYour lack of confidence is justified - this won't work.\n\nFlex has in it a widespread assumption that the input is processed\none byte at a time.  Fixing this is on the to-do list, but is involved,\nso it won't happen any time soon.  In the interim, the best I can suggest\n(unless you want to try fixing it yourself) is to write your rules in\nterms of pairs of bytes, using definitions in the first section:\n\nX\t\\xfe\\xc2\n...\n%%\nfoo{X}bar\tfoundfoofec2bar();\n\netc.  Definitely a pain - sorry about that.\n\nBy the way, the email address you used for me is ancient, indicating you\nhave a very old version of flex.  You can get the most recent, 2.5.4, from\nftp.ee.lbl.gov.\n\nVern\n\nFile: flex.info,  Node: deleteme01,  Next: Can you discuss some flex internals?,  Prev: Can I fake multi-byte character support?,  Up: FAQ\n"
                },
                {
                    "name": "deleteme01",
                    "content": "To: moleary@primus.com\nSubject: Re: Flex / Unicode compatibility question\nIn-reply-to: Your message of Tue, 22 Oct 1996 10:15:42 PDT.\nDate: Tue, 22 Oct 1996 11:06:13 PDT\nFrom: Vern Paxson <vern>\n\nUnfortunately flex at the moment has a widespread assumption within it\nthat characters are processed 8 bits at a time.  I don't see any easy\nfix for this (other than writing your rules in terms of double characters -\na pain).  I also don't know of a wider lex, though you might try surfing\nthe Plan 9 stuff because I know it's a Unicode system, and also the PCCT\ntoolkit (try searching say Alta Vista for \"Purdue Compiler Construction\nToolkit\").\n\nFixing flex to handle wider characters is on the long-term to-do list.\nBut since flex is a strictly spare-time project these days, this probably\nwon't happen for quite a while, unless someone else does it first.\n\nVern\n\nFile: flex.info,  Node: Can you discuss some flex internals?,  Next: unput() messes up yyatbol,  Prev: deleteme01,  Up: FAQ\n"
                },
                {
                    "name": "Can you discuss some flex internals?",
                    "content": "To: Johan Linde <jl@theophys.kth.se>\nSubject: Re: translation of flex\nIn-reply-to: Your message of Sun, 10 Nov 1996 09:16:36 PST.\nDate: Mon, 11 Nov 1996 10:33:50 PST\nFrom: Vern Paxson <vern>\n\n> I'm working for the Swedish team translating GNU program, and I'm currently\n> working with flex. I have a few questions about some of the messages which\n> I hope you can answer.\n\nAll of the things you're wondering about, by the way, concerning flex\ninternals - probably the only person who understands what they mean in\nEnglish is me!  So I wouldn't worry too much about getting them right.\nThat said ...\n\n> #: main.c:545\n> msgid \"  %d protos created\\n\"\n>\n> Does proto mean prototype?\n\nYes - prototypes of state compression tables.\n\n> #: main.c:539\n> msgid \"  %d/%d (peak %d) template nxt-chk entries created\\n\"\n>\n> Here I'm mainly puzzled by 'nxt-chk'. I guess it means 'next-check'. (?)\n> However, 'template next-check entries' doesn't make much sense to me. To be\n> able to find a good translation I need to know a little bit more about it.\n\nThere is a scheme in the Aho/Sethi/Ullman compiler book for compressing\nscanner tables.  It involves creating two pairs of tables.  The first has\n\"base\" and \"default\" entries, the second has \"next\" and \"check\" entries.\nThe \"base\" entry is indexed by the current state and yields an index into\nthe next/check table.  The \"default\" entry gives what to do if the state\ntransition isn't found in next/check.  The \"next\" entry gives the next\nstate to enter, but only if the \"check\" entry verifies that this entry is\ncorrect for the current state.  Flex creates templates of series of\nnext/check entries and then encodes differences from these templates as a\nway to compress the tables.\n\n> #: main.c:533\n> msgid \"  %d/%d base-def entries created\\n\"\n>\n> The same problem here for 'base-def'.\n\nSee above.\n\nVern\n\nFile: flex.info,  Node: unput() messes up yyatbol,  Next: The | operator is not doing what I want,  Prev: Can you discuss some flex internals?,  Up: FAQ\n"
                },
                {
                    "name": "unput() messes up yyatbol",
                    "content": "To: Xinying Li <xli@npac.syr.edu>\nSubject: Re: FLEX ?\nIn-reply-to: Your message of Wed, 13 Nov 1996 17:28:38 PST.\nDate: Wed, 13 Nov 1996 19:51:54 PST\nFrom: Vern Paxson <vern>\n\n> \"unput()\" them to input flow, question occurs. If I do this after I scan\n> a carriage, the variable \"YYCURRENTBUFFER->yyatbol\" is changed. That\n> means the carriage flag has gone.\n\nYou can control this by calling yysetbol().  It's described in the manual.\n\n>      And if in pre-reading it goes to the end of file, is anything done\n> to control the end of curren buffer and end of file?\n\nNo, there's no way to put back an end-of-file.\n\n>      By the way I am using flex 2.5.2 and using the \"-l\".\n\nThe latest release is 2.5.4, by the way.  It fixes some bugs in 2.5.2 and\n2.5.3.  You can get it from ftp.ee.lbl.gov.\n\nVern\n\nFile: flex.info,  Node: The | operator is not doing what I want,  Next: Why can't flex understand this variable trailing context pattern?,  Prev: unput() messes up yyatbol,  Up: FAQ\n"
                },
                {
                    "name": "The | operator is not doing what I want",
                    "content": "To: Alain.ISSARD@st.com\nSubject: Re: Start condition with FLEX\nIn-reply-to: Your message of Mon, 18 Nov 1996 09:45:02 PST.\nDate: Mon, 18 Nov 1996 10:41:34 PST\nFrom: Vern Paxson <vern>\n\n> I am not able to use the start condition scope and to use the | (OR) with\n> rules having start conditions.\n\nThe problem is that if you use '|' as a regular expression operator, for\nexample \"a|b\" meaning \"match either 'a' or 'b'\", then it must *not* have\nany blanks around it.  If you instead want the special '|' *action* (which\nfrom your scanner appears to be the case), which is a way of giving two\ndifferent rules the same action:\n\nfoo\t|\nbar\tmatchedfooorbar();\n\nthen '|' *must* be separated from the first rule by whitespace and *must*\nbe followed by a new line.  You *cannot* write it as:\n\nfoo | bar\tmatchedfooorbar();\n\neven though you might think you could because yacc supports this syntax.\nThe reason for this unfortunately incompatibility is historical, but it's\nunlikely to be changed.\n\nYour problems with start condition scope are simply due to syntax errors\nfrom your use of '|' later confusing flex.\n\nLet me know if you still have problems.\n\nVern\n\nFile: flex.info,  Node: Why can't flex understand this variable trailing context pattern?,  Next: The ^ operator isn't working,  Prev: The | operator is not doing what I want,  Up: FAQ\n"
                },
                {
                    "name": "Why can't flex understand this variable trailing context pattern?",
                    "content": "To: Gregory Margo <gmargo@newton.vip.best.com>\nSubject: Re: flex-2.5.3 bug report\nIn-reply-to: Your message of Sat, 23 Nov 1996 16:50:09 PST.\nDate: Sat, 23 Nov 1996 17:07:32 PST\nFrom: Vern Paxson <vern>\n\n> Enclosed is a lex file that \"real\" lex will process, but I cannot get\n> flex to process it.  Could you try it and maybe point me in the right direction?\n\nYour problem is that some of the definitions in the scanner use the '/'\ntrailing context operator, and have it enclosed in ()'s.  Flex does not\nallow this operator to be enclosed in ()'s because doing so allows undefined\nregular expressions such as \"(a/b)+\".  So the solution is to remove the\nparentheses.  Note that you must also be building the scanner with the -l\noption for AT&T lex compatibility.  Without this option, flex automatically\nencloses the definitions in parentheses.\n\nVern\n\nFile: flex.info,  Node: The ^ operator isn't working,  Next: Trailing context is getting confused with trailing optional patterns,  Prev: Why can't flex understand this variable trailing context pattern?,  Up: FAQ\n"
                },
                {
                    "name": "The ^ operator isn't working",
                    "content": "To: Thomas Hadig <hadig@toots.physik.rwth-aachen.de>\nSubject: Re: Flex Bug ?\nIn-reply-to: Your message of Tue, 26 Nov 1996 14:35:01 PST.\nDate: Tue, 26 Nov 1996 11:15:05 PST\nFrom: Vern Paxson <vern>\n\n> In my lexer code, i have the line :\n> ^\\*.*          { }\n>\n> Thus all lines starting with an astrix (*) are comment lines.\n> This does not work !\n\nI can't get this problem to reproduce - it works fine for me.  Note\nthough that if what you have is slightly different:\n\nCOMMENT\t^\\*.*\n%%\n{COMMENT}\t{ }\n\nthen it won't work, because flex pushes back macro definitions enclosed\nin ()'s, so the rule becomes\n\n(^\\*.*)\t\t{ }\n\nand now that the '^' operator is not at the immediate beginning of the\nline, it's interpreted as just a regular character.  You can avoid this\nbehavior by using the \"-l\" lex-compatibility flag, or \"%option lex-compat\".\n\nVern\n\nFile: flex.info,  Node: Trailing context is getting confused with trailing optional patterns,  Next: Is flex GNU or not?,  Prev: The ^ operator isn't working,  Up: FAQ\n"
                },
                {
                    "name": "Trailing context is getting confused with trailing optional patterns",
                    "content": "To: Adoram Rogel <adoram@hybridge.com>\nSubject: Re: Flex 2.5.4 BOF ???\nIn-reply-to: Your message of Tue, 26 Nov 1996 16:10:41 PST.\nDate: Wed, 27 Nov 1996 10:56:25 PST\nFrom: Vern Paxson <vern>\n\n>     Organization(s)?/[a-z]\n>\n> This matched \"Organizations\" (looking in debug mode, the trailing s\n> was matched with trailing context instead of the optional (s) in the\n> end of the word.\n\nThat should only happen with lex.  Flex can properly match this pattern.\n(That might be what you're saying, I'm just not sure.)\n\n> Is there a way to avoid this dangerous trailing context problem ?\n\nUnfortunately, there's no easy way.  On the other hand, I don't see why\nit should be a problem.  Lex's matching is clearly wrong, and I'd hope\nthat usually the intent remains the same as expressed with the pattern,\nso flex's matching will be correct.\n\nVern\n\nFile: flex.info,  Node: Is flex GNU or not?,  Next: ERASEME53,  Prev: Trailing context is getting confused with trailing optional patterns,  Up: FAQ\n"
                },
                {
                    "name": "Is flex GNU or not?",
                    "content": "To: Cameron MacKinnon <mackin@interlog.com>\nSubject: Re: Flex documentation bug\nIn-reply-to: Your message of Mon, 02 Dec 1996 00:07:08 PST.\nDate: Sun, 01 Dec 1996 22:29:39 PST\nFrom: Vern Paxson <vern>\n\n> I'm not sure how or where to submit bug reports (documentation or\n> otherwise) for the GNU project stuff ...\n\nWell, strictly speaking flex isn't part of the GNU project.  They just\ndistribute it because no one's written a decent GPL'd lex replacement.\nSo you should send bugs directly to me.  Those sent to the GNU folks\nsometimes find there way to me, but some may drop between the cracks.\n\n> In GNU Info, under the section 'Start Conditions', and also in the man\n> page (mine's dated April '95) is a nice little snippet showing how to\n> parse C quoted strings into a buffer, defined to be MAXSTRCONST in\n> size. Unfortunately, no overflow checking is ever done ...\n\nThis is already mentioned in the manual:\n\nFinally, here's an example of how to  match  C-style  quoted\nstrings using exclusive start conditions, including expanded\nescape sequences (but not including checking  for  a  string\nthat's too long):\n\nThe reason for not doing the overflow checking is that it will needlessly\nclutter up an example whose main purpose is just to demonstrate how to\nuse flex.\n\nThe latest release is 2.5.4, by the way, available from ftp.ee.lbl.gov.\n\nVern\n\nFile: flex.info,  Node: ERASEME53,  Next: I need to scan if-then-else blocks and while loops,  Prev: Is flex GNU or not?,  Up: FAQ\n"
                },
                {
                    "name": "ERASEME53",
                    "content": "To: tsv@cs.UManitoba.CA\nSubject: Re: Flex (reg)..\nIn-reply-to: Your message of Thu, 06 Mar 1997 23:50:16 PST.\nDate: Thu, 06 Mar 1997 15:54:19 PST\nFrom: Vern Paxson <vern>\n\n> [:alpha:] ([:alnum:] | \\\\)*\n\nIf your rule really has embedded blanks as shown above, then it won't\nwork, as the first blank delimits the rule from the action.  (It wouldn't\neven compile ...)  You need instead:\n\n[:alpha:]([:alnum:]|\\\\)*\n\nand that should work fine - there's no restriction on what can go inside\nof ()'s except for the trailing context operator, '/'.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: I need to scan if-then-else blocks and while loops,  Next: ERASEME55,  Prev: ERASEME53,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "I need to scan if-then-else blocks and while loops",
                    "content": "To: \"Mike Stolnicki\" <mstolnic@ford.com>\nSubject: Re: FLEX help\nIn-reply-to: Your message of Fri, 30 May 1997 13:33:27 PDT.\nDate: Fri, 30 May 1997 10:46:35 PDT\nFrom: Vern Paxson <vern>\n\n> We'd like to add \"if-then-else\", \"while\", and \"for\" statements to our\n> language ...\n> We've investigated many possible solutions.  The one solution that seems\n> the most reasonable involves knowing the position of a TOKEN in yyin.\n\nI strongly advise you to instead build a parse tree (abstract syntax tree)\nand loop over that instead.  You'll find this has major benefits in keeping\nyour interpreter simple and extensible.\n\nThat said, the functionality you mention for getposition and setposition\nhave been on the to-do list for a while.  As flex is a purely spare-time\nproject for me, no guarantees when this will be added (in particular, it\nfor sure won't be for many months to come).\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: ERASEME55,  Next: ERASEME56,  Prev: I need to scan if-then-else blocks and while loops,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "ERASEME55",
                    "content": "To: Colin Paul Adams <colin@colina.demon.co.uk>\nSubject: Re: Flex C++ classes and Bison\nIn-reply-to: Your message of 09 Aug 1997 17:11:41 PDT.\nDate: Fri, 15 Aug 1997 10:48:19 PDT\nFrom: Vern Paxson <vern>\n\n> #define YYDECL   int yylex (YYSTYPE *lvalp, struct parsercontrol\n> *parm)\n>\n> I have been trying  to get this to work as a C++ scanner, but it does\n> not appear to be possible (warning that it matches no declarations in\n> yyFlexLexer, or something like that).\n>\n> Is this supposed to be possible, or is it being worked on (I DID\n> notice the comment that scanner classes are still experimental, so I'm\n> not too hopeful)?\n\nWhat you need to do is derive a subclass from yyFlexLexer that provides\nthe above yylex() method, squirrels away lvalp and parm into member\nvariables, and then invokes yyFlexLexer::yylex() to do the regular scanning.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: ERASEME56,  Next: ERASEME57,  Prev: ERASEME55,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "ERASEME56",
                    "content": "To: Mikael.Latvala@lmf.ericsson.se\nSubject: Re: Possible mistake in Flex v2.5 document\nIn-reply-to: Your message of Fri, 05 Sep 1997 16:07:24 PDT.\nDate: Fri, 05 Sep 1997 10:01:54 PDT\nFrom: Vern Paxson <vern>\n\n> In that example you show how to count comment lines when using\n> C style /* ... */ comments. My question is, shouldn't you take into\n> account a scenario where end of a comment marker occurs inside\n> character or string literals?\n\nThe scanner certainly needs to also scan character and string literals.\nHowever it does that (there's an example in the man page for strings), the\nlexer will recognize the beginning of the literal before it runs across the\nembedded \"/*\".  Consequently, it will finish scanning the literal before it\neven considers the possibility of matching \"/*\".\n\nExample:\n\n'([^']*|{ESCAPESEQUENCE})'\n\nwill match all the text between the ''s (inclusive).  So the lexer\nconsiders this as a token beginning at the first ', and doesn't even\nattempt to match other tokens inside it.\n\nI thinnk this subtlety is not worth putting in the manual, as I suspect\nit would confuse more people than it would enlighten.\n\nVern\n\nFile: flex.info,  Node: ERASEME57,  Next: Is there a repository for flex scanners?,  Prev: ERASEME56,  Up: FAQ\n"
                },
                {
                    "name": "ERASEME57",
                    "content": "To: \"Marty Leisner\" <leisner@sdsp.mc.xerox.com>\nSubject: Re: flex limitations\nIn-reply-to: Your message of Sat, 06 Sep 1997 11:27:21 PDT.\nDate: Mon, 08 Sep 1997 11:38:08 PDT\nFrom: Vern Paxson <vern>\n\n> %%\n> [a-zA-Z]+       /* skip a line */\n>                 {  printf(\"got %s\\n\", yytext); }\n> %%\n\nWhat version of flex are you using?  If I feed this to 2.5.4, it complains:\n\n\"bug.l\", line 5: EOF encountered inside an action\n\"bug.l\", line 5: unrecognized rule\n\"bug.l\", line 5: fatal parse error\n\nNot the world's greatest error message, but it manages to flag the problem.\n\n(With the introduction of start condition scopes, flex can't accommodate\nan action on a separate line, since it's ambiguous with an indented rule.)\n\nYou can get 2.5.4 from ftp.ee.lbl.gov.\n\nVern\n\nFile: flex.info,  Node: Is there a repository for flex scanners?,  Next: How can I conditionally compile or preprocess my flex input file?,  Prev: ERASEME57,  Up: FAQ\n"
                },
                {
                    "name": "Is there a repository for flex scanners?",
                    "content": "Not that we know of.  You might try asking on comp.compilers.\n\nFile: flex.info,  Node: How can I conditionally compile or preprocess my flex input file?,  Next: Where can I find grammars for lex and yacc?,  Prev: Is there a repository for flex scanners?,  Up: FAQ\n"
                },
                {
                    "name": "How can I conditionally compile or preprocess my flex input file?",
                    "content": ""
                }
            ]
        },
        "Flex doesn't have a preprocessor like C does.  You might try using m4,": {
            "content": "or the C preprocessor plus a sed script to clean up the result.\n\nFile: flex.info,  Node: Where can I find grammars for lex and yacc?,  Next: I get an end-of-buffer message for each character scanned.,  Prev: How can I conditionally compile or preprocess my flex input file?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "Where can I find grammars for lex and yacc?",
                    "content": "In the sources for flex and bison.\n\nFile: flex.info,  Node: I get an end-of-buffer message for each character scanned.,  Next: unnamed-faq-62,  Prev: Where can I find grammars for lex and yacc?,  Up: FAQ\n"
                },
                {
                    "name": "I get an end-of-buffer message for each character scanned.",
                    "content": ""
                }
            ]
        },
        "This will happen if your LexerInput() function returns only one": {
            "content": "character at a time, which can happen either if you're scanner is\n\"interactive\", or if the streams library on your platform always returns\n1 for yyin->gcount().\n\nSolution: override LexerInput() with a version that returns whole\nbuffers.\n",
            "subsections": []
        },
        "File: flex.info,  Node: unnamed-faq-62,  Next: unnamed-faq-63,  Prev: I get an end-of-buffer message for each character scanned.,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-62",
                    "content": "To: Georg.Rehm@CL-KI.Uni-Osnabrueck.DE\nSubject: Re: Flex maximums\nIn-reply-to: Your message of Mon, 17 Nov 1997 17:16:06 PST.\nDate: Mon, 17 Nov 1997 17:16:15 PST\nFrom: Vern Paxson <vern>\n\n> I took a quick look into the flex-sources and altered some #defines in\n> flexdefs.h:\n>\n> \t#define INITIALMNS 64000\n> \t#define MNSINCREMENT 1024000\n> \t#define MAXIMUMMNS 64000\n\nThe things to fix are to add a couple of zeroes to:\n\n#define JAMSTATE -32766 /* marks a reference to the state that always jams */\n#define MAXIMUMMNS 31999\n#define BADSUBSCRIPT -32767\n#define MAXSHORT 32700\n\nand, if you get complaints about too many rules, make the following change too:\n\n#define YYTRAILINGMASK 0x200000\n#define YYTRAILINGHEADMASK 0x400000\n\n- Vern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-63,  Next: unnamed-faq-64,  Prev: unnamed-faq-62,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-63",
                    "content": "To: jimmey@lexis-nexis.com (Jimmey Todd)\nSubject: Re: FLEX question regarding istream vs ifstream\nIn-reply-to: Your message of Mon, 08 Dec 1997 15:54:15 PST.\nDate: Mon, 15 Dec 1997 13:21:35 PST\nFrom: Vern Paxson <vern>\n\n>         stdinhandle = YYCURRENTBUFFER;\n>         ifstream fin( \"aFile\" );\n>         yyswitchtobuffer( yycreatebuffer( fin, YYBUFSIZE ) );\n>\n> What I'm wanting to do, is pass the contents of a file thru one set\n> of rules and then pass stdin thru another set... It works great if, I\n> don't use the C++ classes. But since everything else that I'm doing is\n> in C++, I thought I'd be consistent.\n>\n> The problem is that 'yycreatebuffer' is expecting an istream* as it's\n> first argument (as stated in the man page). However, fin is a ifstream\n> object. Any ideas on what I might be doing wrong? Any help would be\n> appreciated. Thanks!!\n\nYou need to pass &fin, to turn it into an ifstream* instead of an ifstream.\nThen its type will be compatible with the expected istream*, because ifstream\nis derived from istream.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-64,  Next: unnamed-faq-65,  Prev: unnamed-faq-63,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-64",
                    "content": "To: Enda Fadian <fadiane@piercom.ie>\nSubject: Re: Question related to Flex man page?\nIn-reply-to: Your message of Tue, 16 Dec 1997 15:17:34 PST.\nDate: Tue, 16 Dec 1997 14:17:09 PST\nFrom: Vern Paxson <vern>\n\n> Can you explain to me what is ment by a long-jump in relation to flex?\n\nUsing the longjmp() function while inside yylex() or a routine called by it.\n\n> what is the flex activation frame.\n\nJust yylex()'s stack frame.\n\n> As far as I can see yyrestart will bring me back to the sart of the input\n> file and using flex++ isnot really an option!\n\nNo, yyrestart() doesn't imply a rewind, even though its name might sound\nlike it does.  It tells the scanner to flush its internal buffers and\nstart reading from the given file at its present location.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-65,  Next: unnamed-faq-66,  Prev: unnamed-faq-64,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-65",
                    "content": "To: hassan@larc.info.uqam.ca (Hassan Alaoui)\nSubject: Re: Need urgent Help\nIn-reply-to: Your message of Sat, 20 Dec 1997 19:38:19 PST.\nDate: Sun, 21 Dec 1997 21:30:46 PST\nFrom: Vern Paxson <vern>\n\n> /usr/lib/yaccpar: In function `int yyparse()':\n> /usr/lib/yaccpar:184: warning: implicit declaration of function `int yylex(...)'\n>\n> ld: Undefined symbol\n>    yylex\n>    yyparse\n>    yyin\n\nThis is a known problem with Solaris C++ (and/or Solaris yacc).  I believe\nthe fix is to explicitly insert some 'extern \"C\"' statements for the\ncorresponding routines/symbols.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-66,  Next: unnamed-faq-67,  Prev: unnamed-faq-65,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-66",
                    "content": "To: mc0307@mclink.it\nCc: gnu@prep.ai.mit.edu\nSubject: Re: [mc0307@mclink.it: Help request]\nIn-reply-to: Your message of Fri, 12 Dec 1997 17:57:29 PST.\nDate: Sun, 21 Dec 1997 22:33:37 PST\nFrom: Vern Paxson <vern>\n\n> This is my definition for float and integer types:\n> . . .\n> NZD          [1-9]\n> ...\n> I've tested my program on other lex version (on UNIX Sun Solaris an HP\n> UNIX) and it work well, so I think that my definitions are correct.\n> There are any differences between Lex and Flex?\n\nThere are indeed differences, as discussed in the man page.  The one\nyou are probably running into is that when flex expands a name definition,\nit puts parentheses around the expansion, while lex does not.  There's\nan example in the man page of how this can lead to different matching.\nFlex's behavior complies with the POSIX standard (or at least with the\nlast POSIX draft I saw).\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-67,  Next: unnamed-faq-68,  Prev: unnamed-faq-66,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-67",
                    "content": "To: hassan@larc.info.uqam.ca (Hassan Alaoui)\nSubject: Re: Thanks\nIn-reply-to: Your message of Mon, 22 Dec 1997 16:06:35 PST.\nDate: Mon, 22 Dec 1997 14:35:05 PST\nFrom: Vern Paxson <vern>\n\n> Thank you very much for your help. I compile and link well with C++ while\n> declaring 'yylex ...' extern, But a little problem remains. I get a\n> segmentation default when executing ( I linked with lfl library) while it\n> works well when using LEX instead of flex. Do you have some ideas about the\n> reason for this ?\n\nThe one possible reason for this that comes to mind is if you've defined\nyytext as \"extern char yytext[]\" (which is what lex uses) instead of\n\"extern char *yytext\" (which is what flex uses).  If it's not that, then\nI'm afraid I don't know what the problem might be.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-68,  Next: unnamed-faq-69,  Prev: unnamed-faq-67,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-68",
                    "content": "To: \"Bart Niswonger\" <NISWONGR@almaden.ibm.com>\nSubject: Re: flex 2.5: c++ scanners & start conditions\nIn-reply-to: Your message of Tue, 06 Jan 1998 10:34:21 PST.\nDate: Tue, 06 Jan 1998 19:19:30 PST\nFrom: Vern Paxson <vern>\n\n> The problem is that when I do this (using %option c++) start\n> conditions seem to not apply.\n\nThe BEGIN macro modifies the yystart variable.  For C scanners, this\nis a static with scope visible through the whole file.  For C++ scanners,\nit's a member variable, so it only has visible scope within a member\nfunction.  Your lexbegin() routine is not a member function when you\nbuild a C++ scanner, so it's not modifying the correct yystart.  The\ndiagnostic that indicates this is that you found you needed to add\na declaration of yystart in order to get your scanner to compile when\nusing C++; instead, the correct fix is to make lexbegin() a member\nfunction (by deriving from yyFlexLexer).\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-69,  Next: unnamed-faq-70,  Prev: unnamed-faq-68,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-69",
                    "content": "To: \"Boris Zinin\" <boris@ippe.rssi.ru>\nSubject: Re: current position in flex buffer\nIn-reply-to: Your message of Mon, 12 Jan 1998 18:58:23 PST.\nDate: Mon, 12 Jan 1998 12:03:15 PST\nFrom: Vern Paxson <vern>\n\n> The problem is how to determine the current position in flex active\n> buffer when a rule is matched....\n\nYou will need to keep track of this explicitly, such as by redefining\nYYUSERACTION to count the number of characters matched.\n\nThe latest flex release, by the way, is 2.5.4, available from ftp.ee.lbl.gov.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-70,  Next: unnamed-faq-71,  Prev: unnamed-faq-69,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-70",
                    "content": "To: Bik.Dhaliwal@bis.org\nSubject: Re: Flex question\nIn-reply-to: Your message of Mon, 26 Jan 1998 13:05:35 PST.\nDate: Tue, 27 Jan 1998 22:41:52 PST\nFrom: Vern Paxson <vern>\n\n> That requirement involves knowing\n> the character position at which a particular token was matched\n> in the lexer.\n\nThe way you have to do this is by explicitly keeping track of where\nyou are in the file, by counting the number of characters scanned\nfor each token (available in yyleng).  It may prove convenient to\ndo this by redefining YYUSERACTION, as described in the manual.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-71,  Next: unnamed-faq-72,  Prev: unnamed-faq-70,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-71",
                    "content": "To: Vladimir Alexiev <vladimir@cs.ualberta.ca>\nSubject: Re: flex: how to control start condition from parser?\nIn-reply-to: Your message of Mon, 26 Jan 1998 05:50:16 PST.\nDate: Tue, 27 Jan 1998 22:45:37 PST\nFrom: Vern Paxson <vern>\n\n> It seems useful for the parser to be able to tell the lexer about such\n> context dependencies, because then they don't have to be limited to\n> local or sequential context.\n\nOne way to do this is to have the parser call a stub routine that's\nincluded in the scanner's .l file, and consequently that has access ot\nBEGIN.  The only ugliness is that the parser can't pass in the state\nit wants, because those aren't visible - but if you don't have many\nsuch states, then using a different set of names doesn't seem like\nto much of a burden.\n\nWhile generating a .h file like you suggests is certainly cleaner,\nflex development has come to a virtual stand-still :-(, so a workaround\nlike the above is much more pragmatic than waiting for a new feature.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-72,  Next: unnamed-faq-73,  Prev: unnamed-faq-71,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-72",
                    "content": "To: Barbara Denny <denny@3com.com>\nSubject: Re: freebsd flex bug?\nIn-reply-to: Your message of Fri, 30 Jan 1998 12:00:43 PST.\nDate: Fri, 30 Jan 1998 12:42:32 PST\nFrom: Vern Paxson <vern>\n\n> lex.yy.c:1996: parse error before `='\n\nThis is the key, identifying this error.  (It may help to pinpoint\nit by using flex -L, so it doesn't generate #line directives in its\noutput.)  I will bet you heavy money that you have a start condition\nname that is also a variable name, or something like that; flex spits\nout #define's for each start condition name, mapping them to a number,\nso you can wind up with:\n\n%x foo\n%%\n...\n%%\nvoid bar()\n{\nint foo = 3;\n}\n\nand the penultimate will turn into \"int 1 = 3\" after C preprocessing,\nsince flex will put \"#define foo 1\" in the generated scanner.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-73,  Next: unnamed-faq-74,  Prev: unnamed-faq-72,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-73",
                    "content": "To: Maurice Petrie <mpetrie@infoscigroup.com>\nSubject: Re: Lost flex .l file\nIn-reply-to: Your message of Mon, 02 Feb 1998 14:10:01 PST.\nDate: Mon, 02 Feb 1998 11:15:12 PST\nFrom: Vern Paxson <vern>\n\n> I am curious as to\n> whether there is a simple way to backtrack from the generated source to\n> reproduce the lost list of tokens we are searching on.\n\nIn theory, it's straight-forward to go from the DFA representation\nback to a regular-expression representation - the two are isomorphic.\nIn practice, a huge headache, because you have to unpack all the tables\nback into a single DFA representation, and then write a program to munch\non that and translate it into an RE.\n\nSorry for the less-than-happy news ...\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-74,  Next: unnamed-faq-75,  Prev: unnamed-faq-73,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-74",
                    "content": "To: jimmey@lexis-nexis.com (Jimmey Todd)\nSubject: Re: Flex performance question\nIn-reply-to: Your message of Thu, 19 Feb 1998 11:01:17 PST.\nDate: Thu, 19 Feb 1998 08:48:51 PST\nFrom: Vern Paxson <vern>\n\n> What I have found, is that the smaller the data chunk, the faster the\n> program executes. This is the opposite of what I expected. Should this be\n> happening this way?\n\nThis is exactly what will happen if your input file has embedded NULs.\nFrom the man page:\n\nA final note: flex is slow when matching NUL's, particularly\nwhen  a  token  contains multiple NUL's.  It's best to write\nrules which match short amounts of text if it's  anticipated\nthat the text will often include NUL's.\n\nSo that's the first thing to look for.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-75,  Next: unnamed-faq-76,  Prev: unnamed-faq-74,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-75",
                    "content": "To: jimmey@lexis-nexis.com (Jimmey Todd)\nSubject: Re: Flex performance question\nIn-reply-to: Your message of Thu, 19 Feb 1998 11:01:17 PST.\nDate: Thu, 19 Feb 1998 15:42:25 PST\nFrom: Vern Paxson <vern>\n\nSo there are several problems.\n\nFirst, to go fast, you want to match as much text as possible, which\nyour scanners don't in the case that what they're scanning is *not*\na <RN> tag.  So you want a rule like:\n\n[^<]+\n\nSecond, C++ scanners are particularly slow if they're interactive,\nwhich they are by default.  Using -B speeds it up by a factor of 3-4\non my workstation.\n\nThird, C++ scanners that use the istream interface are slow, because\nof how poorly implemented istream's are.  I built two versions of\nthe following scanner:\n\n%%\n.*\\n\n.*\n%%\n\nand the C version inhales a 2.5MB file on my workstation in 0.8 seconds.\nThe C++ istream version, using -B, takes 3.8 seconds.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-76,  Next: unnamed-faq-77,  Prev: unnamed-faq-75,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-76",
                    "content": "To: \"Frescatore, David (CRD, TAD)\" <frescatore@exc01crdge.crd.ge.com>\nSubject: Re: FLEX 2.5 & THE YEAR 2000\nIn-reply-to: Your message of Wed, 03 Jun 1998 11:26:22 PDT.\nDate: Wed, 03 Jun 1998 10:22:26 PDT\nFrom: Vern Paxson <vern>\n\n> I am researching the Y2K problem with General Electric R&D\n> and need to know if there are any known issues concerning\n> the above mentioned software and Y2K regardless of version.\n\nThere shouldn't be, all it ever does with the date is ask the system\nfor it and then print it out.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-77,  Next: unnamed-faq-78,  Prev: unnamed-faq-76,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-77",
                    "content": "To: \"Hans Dermot Doran\" <htd@ibhdoran.com>\nSubject: Re: flex problem\nIn-reply-to: Your message of Wed, 15 Jul 1998 21:30:13 PDT.\nDate: Tue, 21 Jul 1998 14:23:34 PDT\nFrom: Vern Paxson <vern>\n\n> To overcome this, I gets() the stdin into a string and lex the string. The\n> string is lexed OK except that the end of string isn't lexed properly\n> (yyscanstring()), that is the lexer dosn't recognise the end of string.\n\nFlex doesn't contain mechanisms for recognizing buffer endpoints.  But if\nyou use fgets instead (which you should anyway, to protect against buffer\noverflows), then the final \\n will be preserved in the string, and you can\nscan that in order to find the end of the string.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-78,  Next: unnamed-faq-79,  Prev: unnamed-faq-77,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-78",
                    "content": "To: soumen@almaden.ibm.com\nSubject: Re: Flex++ 2.5.3 instance member vs. static member\nIn-reply-to: Your message of Mon, 27 Jul 1998 02:10:04 PDT.\nDate: Tue, 28 Jul 1998 01:10:34 PDT\nFrom: Vern Paxson <vern>\n\n> %{\n> int mylineno = 0;\n> %}\n> ws      [ \\t]+\n> alpha   [A-Za-z]\n> dig     [0-9]\n> %%\n>\n> Now you'd expect mylineno to be a member of each instance of class\n> yyFlexLexer, but is this the case?  A look at the lex.yy.cc file seems to\n> indicate otherwise; unless I am missing something the declaration of\n> mylineno seems to be outside any class scope.\n>\n> How will this work if I want to run a multi-threaded application with each\n> thread creating a FlexLexer instance?\n\nDerive your own subclass and make mylineno a member variable of it.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-79,  Next: unnamed-faq-80,  Prev: unnamed-faq-78,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-79",
                    "content": "To: Adoram Rogel <adoram@hybridge.com>\nSubject: Re: More than 32K states change hangs\nIn-reply-to: Your message of Tue, 04 Aug 1998 16:55:39 PDT.\nDate: Tue, 04 Aug 1998 22:28:45 PDT\nFrom: Vern Paxson <vern>\n\n> Vern Paxson,\n>\n> I followed your advice, posted on Usenet bu you, and emailed to me\n> personally by you, on how to overcome the 32K states limit. I'm running\n> on Linux machines.\n> I took the full source of version 2.5.4 and did the following changes in\n> flexdef.h:\n> #define JAMSTATE -327660\n> #define MAXIMUMMNS 319990\n> #define BADSUBSCRIPT -327670\n> #define MAXSHORT 327000\n>\n> and compiled.\n> All looked fine, including check and bigcheck, so I installed.\n\nHmmm, you shouldn't increase MAXSHORT, though looking through my email\narchives I see that I did indeed recommend doing so.  Try setting it back\nto 32700; that should suffice that you no longer need -Ca.  If it still\nhangs, then the interesting question is - where?\n\n> Compiling the same hanged program with a out-of-the-box (RedHat 4.2\n> distribution of Linux)\n> flex 2.5.4 binary works.\n\nSince Linux comes with source code, you should diff it against what\nyou have to see what problems they missed.\n\n> Should I always compile with the -Ca option now ? even short and simple\n> filters ?\n\nNo, definitely not.  It's meant to be for those situations where you\nabsolutely must squeeze every last cycle out of your scanner.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-80,  Next: unnamed-faq-81,  Prev: unnamed-faq-79,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-80",
                    "content": "To: \"Schmackpfeffer, Craig\" <Craig.Schmackpfeffer@usa.xerox.com>\nSubject: Re: flex output for static code portion\nIn-reply-to: Your message of Tue, 11 Aug 1998 11:55:30 PDT.\nDate: Mon, 17 Aug 1998 23:57:42 PDT\nFrom: Vern Paxson <vern>\n\n> I would like to use flex under the hood to generate a binary file\n> containing the data structures that control the parse.\n\nThis has been on the wish-list for a long time.  In principle it's\nstraight-forward - you redirect mkdata() et al's I/O to another file,\nand modify the skeleton to have a start-up function that slurps these\ninto dynamic arrays.  The concerns are (1) the scanner generation code\nis hairy and full of corner cases, so it's easy to get surprised when\ngoing down this path :-( ; and (2) being careful about buffering so\nthat when the tables change you make sure the scanner starts in the\ncorrect state and reading at the right point in the input file.\n\n> I was wondering if you know of anyone who has used flex in this way.\n\nI don't - but it seems like a reasonable project to undertake (unlike\nnumerous other flex tweaks :-).\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-81,  Next: unnamed-faq-82,  Prev: unnamed-faq-80,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-81",
                    "content": "Received: from 131.173.17.11 (131.173.17.11 [131.173.17.11])\nby ee.lbl.gov (8.9.1/8.9.1) with ESMTP id AAA03838\nfor <vern@ee.lbl.gov>; Thu, 20 Aug 1998 00:47:57 -0700 (PDT)\nReceived: from hal.cl-ki.uni-osnabrueck.de (hal.cl-ki.Uni-Osnabrueck.DE [131.173.141.2])\nby deimos.rz.uni-osnabrueck.de (8.8.7/8.8.8) with ESMTP id JAA34694\nfor <vern@ee.lbl.gov>; Thu, 20 Aug 1998 09:47:55 +0200\nReceived: (from georg@localhost) by hal.cl-ki.uni-osnabrueck.de (8.6.12/8.6.12) id JAA34834 for vern@ee.lbl.gov; Thu, 20 Aug 1998 09:47:54 +0200\nFrom: Georg Rehm <georg@hal.cl-ki.uni-osnabrueck.de>\nMessage-Id: <199808200747.JAA34834@hal.cl-ki.uni-osnabrueck.de>\nSubject: \"flex scanner push-back overflow\"\nTo: vern@ee.lbl.gov\nDate: Thu, 20 Aug 1998 09:47:54 +0200 (MEST)\nReply-To: Georg.Rehm@CL-KI.Uni-Osnabrueck.DE\nX-NoJunk: Do NOT send commercial mail, spam or ads to this address!\nX-URL: http://www.cl-ki.uni-osnabrueck.de/~georg/\nX-Mailer: ELM [version 2.4ME+ PL28 (25)]\nMIME-Version: 1.0\nContent-Type: text/plain; charset=US-ASCII\nContent-Transfer-Encoding: 7bit\n\nHi Vern,\n\nYesterday, I encountered a strange problem: I use the macro processor m4\nto include some lengthy lists into a .l file. Following is a flex macro\ndefinition that causes some serious pain in my neck:\n\nAUTHOR           (\"A. Boucard / L. Boucard\"|\"A. Dastarac / M. Levent\"|\"A.Boucaud / L.Boucaud\"|\"Abderrahim Lamchichi\"|\"Achmat Dangor\"|\"Adeline Toullier\"|\"Adewale Maja-Pearce\"|\"Ahmed Ziri\"|\"Akram Ellyas\"|\"Alain Bihr\"|\"Alain Gresh\"|\"Alain Guillemoles\"|\"Alain Joxe\"|\"Alain Morice\"|\"Alain Renon\"|\"Alain Zecchini\"|\"Albert Memmi\"|\"Alberto Manguel\"|\"Alex De Waal\"|\"Alfonso Artico\"| [...])\n\nThe complete list contains about 10kB. When I try to \"flex\" this file\n(on a Solaris 2.6 machine, using a modified flex 2.5.4 (I only increased\nsome of the predefined values in flexdefs.h) I get the error:\n\nmyflex/flex -8  sentag.tmp.l\nflex scanner push-back overflow\n\nWhen I remove the slashes in the macro definition everything works fine.\nAs I understand it, the double quotes escape the slash-character so it\nreally means \"/\" and not \"trailing context\". Furthermore, I tried to\nescape the slashes with backslashes, but with no use, the same error message\nappeared when flexing the code.\n\nDo you have an idea what's going on here?\n\nGreetings from Germany,\nGeorg\n--\nGeorg Rehm                                     georg@cl-ki.uni-osnabrueck.de\nInstitute for Semantic Information Processing, University of Osnabrueck, FRG\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-82,  Next: unnamed-faq-83,  Prev: unnamed-faq-81,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-82",
                    "content": "To: Georg.Rehm@CL-KI.Uni-Osnabrueck.DE\nSubject: Re: \"flex scanner push-back overflow\"\nIn-reply-to: Your message of Thu, 20 Aug 1998 09:47:54 PDT.\nDate: Thu, 20 Aug 1998 07:05:35 PDT\nFrom: Vern Paxson <vern>\n\n> myflex/flex -8  sentag.tmp.l\n> flex scanner push-back overflow\n\nFlex itself uses a flex scanner.  That scanner is running out of buffer\nspace when it tries to unput() the humongous macro you've defined.  When\nyou remove the '/'s, you make it small enough so that it fits in the buffer;\nremoving spaces would do the same thing.\n\nThe fix is to either rethink how come you're using such a big macro and\nperhaps there's another/better way to do it; or to rebuild flex's own\nscan.c with a larger value for\n\n#define YYBUFSIZE 16384\n\n- Vern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-83,  Next: unnamed-faq-84,  Prev: unnamed-faq-82,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-83",
                    "content": "To: Jan Kort <jan@research.techforce.nl>\nSubject: Re: Flex\nIn-reply-to: Your message of Fri, 04 Sep 1998 12:18:43 +0200.\nDate: Sat, 05 Sep 1998 00:59:49 PDT\nFrom: Vern Paxson <vern>\n\n> %%\n>\n> \"TEST1\\n\"       { fprintf(stderr, \"TEST1\\n\"); yyless(5); }\n> ^\\n             { fprintf(stderr, \"empty line\\n\"); }\n> .               { }\n> \\n              { fprintf(stderr, \"new line\\n\"); }\n>\n> %%\n> -- input ---------------------------------------\n> TEST1\n> -- output --------------------------------------\n> TEST1\n> empty line\n> ------------------------------------------------\n\nIMHO, it's not clear whether or not this is in fact a bug.  It depends\non whether you view yyless() as backing up in the input stream, or as\npushing new characters onto the beginning of the input stream.  Flex\ninterprets it as the latter (for implementation convenience, I'll admit),\nand so considers the newline as in fact matching at the beginning of a\nline, as after all the last token scanned an entire line and so the\nscanner is now at the beginning of a new line.\n\nI agree that this is counter-intuitive for yyless(), given its\nfunctional description (it's less so for unput(), depending on whether\nyou're unput()'ing new text or scanned text).  But I don't plan to\nchange it any time soon, as it's a pain to do so.  Consequently,\nyou do indeed need to use yysetbol() and YYATBOL() to tweak\nyour scanner into the behavior you desire.\n\nSorry for the less-than-completely-satisfactory answer.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-84,  Next: unnamed-faq-85,  Prev: unnamed-faq-83,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-84",
                    "content": "To: Patrick Krusenotto <krusenot@mac-info-link.de>\nSubject: Re: Problems with restarting flex-2.5.2-generated scanner\nIn-reply-to: Your message of Thu, 24 Sep 1998 10:14:07 PDT.\nDate: Thu, 24 Sep 1998 23:28:43 PDT\nFrom: Vern Paxson <vern>\n\n> I am using flex-2.5.2 and bison 1.25 for Solaris and I am desperately\n> trying to make my scanner restart with a new file after my parser stops\n> with a parse error. When my compiler restarts, the parser always\n> receives the token after the token (in the old file!) that caused the\n> parser error.\n\nI suspect the problem is that your parser has read ahead in order\nto attempt to resolve an ambiguity, and when it's restarted it picks\nup with that token rather than reading a fresh one.  If you're using\nyacc, then the special \"error\" production can sometimes be used to\nconsume tokens in an attempt to get the parser into a consistent state.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-85,  Next: unnamed-faq-86,  Prev: unnamed-faq-84,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-85",
                    "content": "To: Henric Jungheim <junghelh@pe-nelson.com>\nSubject: Re: flex 2.5.4a\nIn-reply-to: Your message of Tue, 27 Oct 1998 16:41:42 PST.\nDate: Tue, 27 Oct 1998 16:50:14 PST\nFrom: Vern Paxson <vern>\n\n> This brings up a feature request:  How about a command line\n> option to specify the filename when reading from stdin?  That way one\n> doesn't need to create a temporary file in order to get the \"#line\"\n> directives to make sense.\n\nUse -o combined with -t (per the man page description of -o).\n\n> P.S., Is there any simple way to use non-blocking IO to parse multiple\n> streams?\n\nSimple, no.\n\nOne approach might be to return a magic character on EWOULDBLOCK and\nhave a rule\n\n.*<magic-character>\t// put back .*, eat magic character\n\nThis is off the top of my head, not sure it'll work.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-86,  Next: unnamed-faq-87,  Prev: unnamed-faq-85,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-86",
                    "content": "To: \"Repko, Billy D\" <billy.d.repko@intel.com>\nSubject: Re: Compiling scanners\nIn-reply-to: Your message of Wed, 13 Jan 1999 10:52:47 PST.\nDate: Thu, 14 Jan 1999 00:25:30 PST\nFrom: Vern Paxson <vern>\n\n> It appears that maybe it cannot find the lfl library.\n\nThe Makefile in the distribution builds it, so you should have it.\nIt's exceedingly trivial, just a main() that calls yylex() and\na yyrap() that always returns 1.\n\n> %%\n>       \\n      ++numlines; ++numchars;\n>       .       ++numchars;\n\nYou can't indent your rules like this - that's where the errors are coming\nfrom.  Flex copies indented text to the output file, it's how you do things\nlike\n\nint numlinesseen = 0;\n\nto declare local variables.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-87,  Next: unnamed-faq-88,  Prev: unnamed-faq-86,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-87",
                    "content": "To: Erick Branderhorst <Erick.Branderhorst@asml.nl>\nSubject: Re: flex input buffer\nIn-reply-to: Your message of Tue, 09 Feb 1999 13:53:46 PST.\nDate: Tue, 09 Feb 1999 21:03:37 PST\nFrom: Vern Paxson <vern>\n\n> In the flex.skl file the size of the default input buffers is set.  Can you\n> explain why this size is set and why it is such a high number.\n\nIt's large to optimize performance when scanning large files.  You can\nsafely make it a lot lower if needed.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-88,  Next: unnamed-faq-90,  Prev: unnamed-faq-87,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-88",
                    "content": "To: \"Guido Minnen\" <guidomi@cogs.susx.ac.uk>\nSubject: Re: Flex error message\nIn-reply-to: Your message of Wed, 24 Feb 1999 15:31:46 PST.\nDate: Thu, 25 Feb 1999 00:11:31 PST\nFrom: Vern Paxson <vern>\n\n> I'm extending a larger scanner written in Flex and I keep running into\n> problems. More specifically, I get the error message:\n> \"flex: input rules are too complicated (>= 32000 NFA states)\"\n\nIncrease the definitions in flexdef.h for:\n\n#define JAMSTATE -32766 /* marks a reference to the state that always j\nams */\n#define MAXIMUMMNS 31999\n#define BADSUBSCRIPT -32767\n\nrecompile everything, and it should all work.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-90,  Next: unnamed-faq-91,  Prev: unnamed-faq-88,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-90",
                    "content": "To: \"Dmitriy Goldobin\" <gold@ems.chel.su>\nSubject: Re: FLEX trouble\nIn-reply-to: Your message of Mon, 31 May 1999 18:44:49 PDT.\nDate: Tue, 01 Jun 1999 00:15:07 PDT\nFrom: Vern Paxson <vern>\n\n>   I have a trouble with FLEX. Why rule \"/*\".*\"*/\" work properly,=20\n> but rule \"/*\"(.|\\n)*\"*/\" don't work ?\n\nThe second of these will have to scan the entire input stream (because\n\"(.|\\n)*\" matches an arbitrary amount of any text) in order to see if\nit ends with \"*/\", terminating the comment.  That potentially will overflow\nthe input buffer.\n\n>   More complex rule \"/*\"([^*]|(\\*/[^/]))*\"*/ give an error\n> 'unrecognized rule'.\n\nYou can't use the '/' operator inside parentheses.  It's not clear\nwhat \"(a/b)*\" actually means.\n\n>   I now use workaround with state <comment>, but single-rule is\n> better, i think.\n\nSingle-rule is nice but will always have the problem of either setting\nrestrictions on comments (like not allowing multi-line comments) and/or\nrunning the risk of consuming the entire input stream, as noted above.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-91,  Next: unnamed-faq-92,  Prev: unnamed-faq-90,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-91",
                    "content": "Received: from mc-qout4.whowhere.com (mc-qout4.whowhere.com [209.185.123.18])\nby ee.lbl.gov (8.9.3/8.9.3) with SMTP id IAA05100\nfor <vern@ee.lbl.gov>; Tue, 15 Jun 1999 08:56:06 -0700 (PDT)\nReceived: from Unknown/Local ([?.?.?.?]) by my-deja.com; Tue Jun 15 08:55:43 1999\nTo: vern@ee.lbl.gov\nDate: Tue, 15 Jun 1999 08:55:43 -0700\nFrom: \"Aki Niimura\" <neko@my-deja.com>\nMessage-ID: <KNONDOHDOBGAEAAA@my-deja.com>\nMime-Version: 1.0\nCc:\nX-Sent-Mail: on\nReply-To:\nX-Mailer: MailCity Service\nSubject: A question on flex C++ scanner\nX-Sender-Ip: 12.72.207.61\nOrganization: My Deja Email  (http://www.my-deja.com:80)\nContent-Type: text/plain; charset=us-ascii\nContent-Transfer-Encoding: 7bit\n\nDear Dr. Paxon,\n\nI have been using flex for years.\nIt works very well on many projects.\nMost case, I used it to generate a scanner on C language.\nHowever, one project I needed to generate  a scanner\non C++ lanuage. Thanks to your enhancement, flex did\nthe job.\n\nCurrently, I'm working on enhancing my previous project.\nI need to deal with multiple input streams (recursive\ninclusion) in this scanner (C++).\nI did similar thing for another scanner (C) as you\nexplained in your documentation.\n\nThe generated scanner (C++) has necessary methods:\n- switchtobuffer(struct yybufferstate *b)\n- yycreatebuffer(istream *is, int sz)\n- yydeletebuffer(struct yybufferstate *b)\n\nHowever, I couldn't figure out how to access current\nbuffer (yycurrentbuffer).\n\nyycurrentbuffer is a protected member of yyFlexLexer.\nI can't access it directly.\nThen, I thought yycreatebuffer() with is = 0 might\nreturn current stream buffer. But it seems not as far\nas I checked the source. (flex 2.5.4)\n\nI went through the Web in addition to Flex documentation.\nHowever, it hasn't been successful, so far.\n\nIt is not my intention to bother you, but, can you\ncomment about how to obtain the current stream buffer?\n\nYour response would be highly appreciated.\n\nBest regards,\nAki Niimura\n\n--== Sent via Deja.com http://www.deja.com/ ==--\nShare what you know. Learn what you don't.\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-92,  Next: unnamed-faq-93,  Prev: unnamed-faq-91,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-92",
                    "content": "To: neko@my-deja.com\nSubject: Re: A question on flex C++ scanner\nIn-reply-to: Your message of Tue, 15 Jun 1999 08:55:43 PDT.\nDate: Tue, 15 Jun 1999 09:04:24 PDT\nFrom: Vern Paxson <vern>\n\n> However, I couldn't figure out how to access current\n> buffer (yycurrentbuffer).\n\nDerive your own subclass from yyFlexLexer.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-93,  Next: unnamed-faq-94,  Prev: unnamed-faq-92,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-93",
                    "content": "To: \"Stones, Darren\" <Darren.Stones@nectech.co.uk>\nSubject: Re: You're the man to see?\nIn-reply-to: Your message of Wed, 23 Jun 1999 11:10:29 PDT.\nDate: Wed, 23 Jun 1999 09:01:40 PDT\nFrom: Vern Paxson <vern>\n\n> I hope you can help me.  I am using Flex and Bison to produce an interpreted\n> language.  However all goes well until I try to implement an IF statement or\n> a WHILE.  I cannot get this to work as the parser parses all the conditions\n> eg. the TRUE and FALSE conditons to check for a rule match.  So I cannot\n> make a decision!!\n\nYou need to use the parser to build a parse tree (= abstract syntax trwee),\nand when that's all done you recursively evaluate the tree, binding variables\nto values at that time.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-94,  Next: unnamed-faq-95,  Prev: unnamed-faq-93,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-94",
                    "content": "To: Petr Danecek <petr@ics.cas.cz>\nSubject: Re: flex - question\nIn-reply-to: Your message of Mon, 28 Jun 1999 19:21:41 PDT.\nDate: Fri, 02 Jul 1999 16:52:13 PDT\nFrom: Vern Paxson <vern>\n\n> file, it takes an enormous amount of time. It is funny, because the\n> source code has only 12 rules!!! I think it looks like an exponencial\n> growth.\n\nRight, that's the problem - some patterns (those with a lot of\nambiguity, where yours has because at any given time the scanner can\nbe in the middle of all sorts of combinations of the different\nrules) blow up exponentially.\n\nFor your rules, there is an easy fix.  Change the \".*\" that comes fater\nthe directory name to \"[^ ]*\".  With that in place, the rules are no\nlonger nearly so ambiguous, because then once one of the directories\nhas been matched, no other can be matched (since they all require a\nleading blank).\n\nIf that's not an acceptable solution, then you can enter a start state\nto pick up the .*\\n after each directory is matched.\n\nAlso note that for speed, you'll want to add a \".*\" rule at the end,\notherwise rules that don't match any of the patterns will be matched\nvery slowly, a character at a time.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-95,  Next: unnamed-faq-96,  Prev: unnamed-faq-94,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-95",
                    "content": "To: Tielman Koekemoer <tielman@spi.co.za>\nSubject: Re: Please help.\nIn-reply-to: Your message of Thu, 08 Jul 1999 13:20:37 PDT.\nDate: Thu, 08 Jul 1999 08:20:39 PDT\nFrom: Vern Paxson <vern>\n\n> I was hoping you could help me with my problem.\n>\n> I tried compiling (gnu)flex on a Solaris 2.4 machine\n> but when I ran make (after configure) I got an error.\n>\n> --------------------------------------------------------------\n> gcc -c -I. -I. -g -O parse.c\n> ./flex -t -p  ./scan.l >scan.c\n> sh: ./flex: not found\n> * Error code 1\n> make: Fatal error: Command failed for target `scan.c'\n> -------------------------------------------------------------\n>\n> What's strange to me is that I'm only\n> trying to install flex now. I then edited the Makefile to\n> and changed where it says \"FLEX = flex\" to \"FLEX = lex\"\n> ( lex: the native Solaris one ) but then it complains about\n> the \"-p\" option. Is there any way I can compile flex without\n> using flex or lex?\n>\n> Thanks so much for your time.\n\nYou managed to step on the bootstrap sequence, which first copies\ninitscan.c to scan.c in order to build flex.  Try fetching a fresh\ndistribution from ftp.ee.lbl.gov.  (Or you can first try removing\n\".bootstrap\" and doing a make again.)\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-96,  Next: unnamed-faq-97,  Prev: unnamed-faq-95,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-96",
                    "content": "To: Tielman Koekemoer <tielman@spi.co.za>\nSubject: Re: Please help.\nIn-reply-to: Your message of Fri, 09 Jul 1999 09:16:14 PDT.\nDate: Fri, 09 Jul 1999 00:27:20 PDT\nFrom: Vern Paxson <vern>\n\n> First I removed .bootstrap (and ran make) - no luck. I downloaded the\n> software but I still have the same problem. Is there anything else I\n> could try.\n\nTry:\n\ncp initscan.c scan.c\ntouch scan.c\nmake scan.o\n\nIf this last tries to first build scan.c from scan.l using ./flex, then\nyour \"make\" is broken, in which case compile scan.c to scan.o by hand.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-97,  Next: unnamed-faq-98,  Prev: unnamed-faq-96,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-97",
                    "content": "To: Sumanth Kamenani <skamenan@crl.nmsu.edu>\nSubject: Re: Error\nIn-reply-to: Your message of Mon, 19 Jul 1999 23:08:41 PDT.\nDate: Tue, 20 Jul 1999 00:18:26 PDT\nFrom: Vern Paxson <vern>\n\n> I am getting a compilation error. The error is given as \"unknown symbol- yylex\".\n\nThe parser relies on calling yylex(), but you're instead using the C++ scanning\nclass, so you need to supply a yylex() \"glue\" function that calls an instance\nscanner of the scanner (e.g., \"scanner->yylex()\").\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-98,  Next: unnamed-faq-99,  Prev: unnamed-faq-97,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-98",
                    "content": "To: daniel@synchrods.synchrods.COM (Daniel Senderowicz)\nSubject: Re: lex\nIn-reply-to: Your message of Mon, 22 Nov 1999 11:19:04 PST.\nDate: Tue, 23 Nov 1999 15:54:30 PST\nFrom: Vern Paxson <vern>\n\nWell, your problem is the\n\nswitch (yybgin-yysvec-1) {      /* witchcraft */\n\nat the beginning of lex rules.  \"witchcraft\" == \"non-portable\".  It's\nassuming knowledge of the AT&T lex's internal variables.\n\nFor flex, you can probably do the equivalent using a switch on YYSTATE.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-99,  Next: unnamed-faq-100,  Prev: unnamed-faq-98,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-99",
                    "content": "To: archow@hss.hns.com\nSubject: Re: Regarding distribution of flex and yacc based grammars\nIn-reply-to: Your message of Sun, 19 Dec 1999 17:50:24 +0530.\nDate: Wed, 22 Dec 1999 01:56:24 PST\nFrom: Vern Paxson <vern>\n\n> When we provide the customer with an object code distribution, is it\n> necessary for us to provide source\n> for the generated C files from flex and bison since they are generated by\n> flex and bison ?\n\nFor flex, no.  I don't know what the current state of this is for bison.\n\n> Also, is there any requrirement for us to neccessarily  provide source for\n> the grammar files which are fed into flex and bison ?\n\nAgain, for flex, no.\n\nSee the file \"COPYING\" in the flex distribution for the legalese.\n\nVern\n"
                }
            ]
        },
        "File: flex.info,  Node: unnamed-faq-100,  Next: unnamed-faq-101,  Prev: unnamed-faq-99,  Up: FAQ": {
            "content": "",
            "subsections": [
                {
                    "name": "unnamed-faq-100",
                    "content": "To: Martin Gallwey <gallweym@hyperion.moe.ul.ie>\nSubject: Re: Flex, and self referencing rules\nIn-reply-to: Your message of Sun, 20 Feb 2000 01:01:21 PST.\nDate: Sat, 19 Feb 2000 18:33:16 PST\nFrom: Vern Paxson <vern>\n\n> However, I do not use unput anywhere. I do use self-referencing\n> rules like this:\n>\n> UnaryExpr               ({UnionExpr})|(\"-\"{UnaryExpr})\n\nYou can't do this - flex is *not* a parser like yacc (which does indeed\nallow recursion), it is a scanner that's confined to regular expressions.\n\nVern\n\nFile: flex.info,  Node: unnamed-faq-101,  Next: What is the difference between YYLEXPARAM and YYDECL?,  Prev: unnamed-faq-100,  Up: FAQ\n"
                },
                {
                    "name": "unnamed-faq-101",
                    "content": "To: slg3@lehigh.edu (SAMUEL L. GULDEN)\nSubject: Re: Flex problem\nIn-reply-to: Your message of Thu, 02 Mar 2000 12:29:04 PST.\nDate: Thu, 02 Mar 2000 23:00:46 PST\nFrom: Vern Paxson <vern>\n\nIf this is exactly your program:\n\n> digit [0-9]\n> digits {digit}+\n> whitespace [ \\t\\n]+\n>\n> %%\n> \"[\" { printf(\"openbrac\\n\");}\n> \"]\" { printf(\"closebrac\\n\");}\n> \"+\" { printf(\"addop\\n\");}\n> \"*\" { printf(\"multop\\n\");}\n> {digits} { printf(\"NUMBER = %s\\n\", yytext);}\n> whitespace ;\n\nthen the problem is that the last rule needs to be \"{whitespace}\" !\n\nVern\n\nFile: flex.info,  Node: What is the difference between YYLEXPARAM and YYDECL?,  Next: Why do I get \"conflicting types for yylex\" error?,  Prev: unnamed-faq-101,  Up: FAQ\n"
                },
                {
                    "name": "What is the difference between YYLEXPARAM and YYDECL?",
                    "content": "YYLEXPARAM is not a flex symbol.  It is for Bison.  It tells Bison to\npass extra params when it calls yylex() from the parser.\n\nYYDECL is the Flex declaration of yylex.  The default is similar to\nthis:\n\n#define int yylex ()\n\nFile: flex.info,  Node: Why do I get \"conflicting types for yylex\" error?,  Next: How do I access the values set in a Flex action from within a Bison action?,  Prev: What is the difference between YYLEXPARAM and YYDECL?,  Up: FAQ\n"
                },
                {
                    "name": "Why do I get \"conflicting types for yylex\" error?",
                    "content": ""
                }
            ]
        },
        "This is a compiler error regarding a generated Bison parser, not a Flex": {
            "content": "scanner.  It means you need a prototype of yylex() in the top of the\nBison file.  Be sure the prototype matches YYDECL.\n\nFile: flex.info,  Node: How do I access the values set in a Flex action from within a Bison action?,  Prev: Why do I get \"conflicting types for yylex\" error?,  Up: FAQ\n",
            "subsections": [
                {
                    "name": "How do I access the values set in a Flex action from within a Bison action?",
                    "content": "With $1, $2, $3, etc.  These are called \"Semantic Values\" in the Bison\nmanual.  See *note (bison)Top::.\n"
                }
            ]
        },
        "File: flex.info,  Node: Appendices,  Next: Indices,  Prev: FAQ,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "Appendix A Appendices": {
            "content": "* Menu:\n\n* Makefiles and Flex::\n* Bison Bridge::\n* M4 Dependency::\n* Common Patterns::\n",
            "subsections": []
        },
        "File: flex.info,  Node: Makefiles and Flex,  Next: Bison Bridge,  Prev: Appendices,  Up: Appendices": {
            "content": "",
            "subsections": [
                {
                    "name": "A.1 Makefiles and Flex",
                    "content": ""
                }
            ]
        },
        "In this appendix, we provide tips for writing Makefiles to build your": {
            "content": "scanners.\n\nIn a traditional build environment, we say that the '.c' files are\nthe sources, and the '.o' files are the intermediate files.  When using\n'flex', however, the '.l' files are the sources, and the generated '.c'\nfiles (along with the '.o' files) are the intermediate files.  This\nrequires you to carefully plan your Makefile.\n\nModern 'make' programs understand that 'foo.l' is intended to\ngenerate 'lex.yy.c' or 'foo.c', and will behave accordingly(1)(2).  The\nfollowing Makefile does not explicitly instruct 'make' how to build\n'foo.c' from 'foo.l'.  Instead, it relies on the implicit rules of the\n'make' program to build the intermediate file, 'scan.c':\n\n# Basic Makefile -- relies on implicit rules\n# Creates \"myprogram\" from \"scan.l\" and \"myprogram.c\"\n#\nLEX=flex\nmyprogram: scan.o myprogram.o\nscan.o: scan.l\n\n\nFor simple cases, the above may be sufficient.  For other cases, you\nmay have to explicitly instruct 'make' how to build your scanner.  The\nfollowing is an example of a Makefile containing explicit rules:\n\n# Basic Makefile -- provides explicit rules\n# Creates \"myprogram\" from \"scan.l\" and \"myprogram.c\"\n#\nLEX=flex\nmyprogram: scan.o myprogram.o\n$(CC) -o $@  $(LDFLAGS) $^\n\nmyprogram.o: myprogram.c\n$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $^\n\nscan.o: scan.c\n$(CC) $(CPPFLAGS) $(CFLAGS) -o $@ -c $^\n\nscan.c: scan.l\n$(LEX) $(LFLAGS) -o $@ $^\n\nclean:\n$(RM) *.o scan.c\n\n\nNotice in the above example that 'scan.c' is in the 'clean' target.",
            "subsections": []
        },
        "This is because we consider the file 'scan.c' to be an intermediate": {
            "content": "file.\n\nFinally, we provide a realistic example of a 'flex' scanner used with\na 'bison' parser(3).  There is a tricky problem we have to deal with.",
            "subsections": []
        },
        "Since a 'flex' scanner will typically include a header file (e.g.,": {
            "content": "'y.tab.h') generated by the parser, we need to be sure that the header\nfile is generated BEFORE the scanner is compiled.  We handle this case\nin the following example:\n\n# Makefile example -- scanner and parser.\n# Creates \"myprogram\" from \"scan.l\", \"parse.y\", and \"myprogram.c\"\n#\nLEX     = flex\nYACC    = bison -y\nYFLAGS  = -d\nobjects = scan.o parse.o myprogram.o\n\nmyprogram: $(objects)\nscan.o: scan.l parse.c\nparse.o: parse.y\nmyprogram.o: myprogram.c\n\n\nIn the above example, notice the line,\n\nscan.o: scan.l parse.c\n\n, which lists the file 'parse.c' (the generated parser) as a\ndependency of 'scan.o'.  We want to ensure that the parser is created\nbefore the scanner is compiled, and the above line seems to do the\ntrick.  Feel free to experiment with your specific implementation of\n'make'.\n\nFor more details on writing Makefiles, see *note (make)Top::.\n\n---------- Footnotes ----------\n\n(1) GNU 'make' and GNU 'automake' are two such programs that provide\nimplicit rules for flex-generated scanners.\n\n(2) GNU 'automake' may generate code to execute flex in\nlex-compatible mode, or to stdout.  If this is not what you want, then\nyou should provide an explicit rule in your Makefile.am\n\n(3) This example also applies to yacc parsers.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Bison Bridge,  Next: M4 Dependency,  Prev: Makefiles and Flex,  Up: Appendices": {
            "content": "",
            "subsections": [
                {
                    "name": "A.2 C Scanners with Bison Parsers",
                    "content": ""
                }
            ]
        },
        "This section describes the 'flex' features useful when integrating": {
            "content": "'flex' with 'GNU bison'(1).  Skip this section if you are not using\n'bison' with your scanner.  Here we discuss only the 'flex' half of the\n'flex' and 'bison' pair.  We do not discuss 'bison' in any detail.  For\nmore information about generating 'bison' parsers, see *note\n(bison)Top::.\n\nA compatible 'bison' scanner is generated by declaring '%option\nbison-bridge' or by supplying '--bison-bridge' when invoking 'flex' from\nthe command line.  This instructs 'flex' that the macro 'yylval' may be\nused.  The data type for 'yylval', 'YYSTYPE', is typically defined in a\nheader file, included in section 1 of the 'flex' input file.  For a list\nof functions and macros available, *Note bison-functions::.\n\nThe declaration of yylex becomes,\n\nint yylex ( YYSTYPE * lvalp, yyscant scanner );\n\nIf '%option bison-locations' is specified, then the declaration\nbecomes,\n\nint yylex ( YYSTYPE * lvalp, YYLTYPE * llocp, yyscant scanner );\n\nNote that the macros 'yylval' and 'yylloc' evaluate to pointers.",
            "subsections": []
        },
        "Support for 'yylloc' is optional in 'bison', so it is optional in 'flex'": {
            "content": "as well.  The following is an example of a 'flex' scanner that is\ncompatible with 'bison'.\n\n/* Scanner for \"C\" assignment statements... sort of. */\n%{\n#include \"y.tab.h\"  /* Generated by bison. */\n%}\n\n%option bison-bridge bison-locations\n%\n\n[[:digit:]]+  { yylval->num = atoi(yytext);   return NUMBER;}\n[[:alnum:]]+  { yylval->str = strdup(yytext); return STRING;}\n\"=\"|\";\"       { return yytext[0];}\n.  {}\n%\n\nAs you can see, there really is no magic here.  We just use 'yylval'\nas we would any other variable.  The data type of 'yylval' is generated\nby 'bison', and included in the file 'y.tab.h'.  Here is the\ncorresponding 'bison' parser:\n\n/* Parser to convert \"C\" assignments to lisp. */\n%{\n/* Pass the argument to yyparse through to yylex. */\n#define YYPARSEPARAM scanner\n#define YYLEXPARAM   scanner\n%}\n%locations\n%pureparser\n%union {\nint num;\nchar* str;\n}\n%token <str> STRING\n%token <num> NUMBER\n%%\nassignment:\nSTRING '=' NUMBER ';' {\nprintf( \"(setf %s %d)\", $1, $3 );\n}\n;\n\n---------- Footnotes ----------\n\n(1) The features described here are purely optional, and are by no\nmeans the only way to use flex with bison.  We merely provide some glue\nto ease development of your parser-scanner pair.\n",
            "subsections": []
        },
        "File: flex.info,  Node: M4 Dependency,  Next: Common Patterns,  Prev: Bison Bridge,  Up: Appendices": {
            "content": "",
            "subsections": [
                {
                    "name": "A.3 M4 Dependency",
                    "content": ""
                }
            ]
        },
        "The macro processor 'm4'(1) must be installed wherever flex is": {
            "content": "installed.  'flex' invokes 'm4', found by searching the directories in\nthe 'PATH' environment variable.  Any code you place in section 1 or in\nthe actions will be sent through m4.  Please follow these rules to\nprotect your code from unwanted 'm4' processing.\n\n* Do not use symbols that begin with, 'm4', such as, 'm4define', or\n'm4include', since those are reserved for 'm4' macro names.  If\nfor some reason you need m4 as a prefix, use a preprocessor\n#define to get your symbol past m4 unmangled.\n\n* Do not use the strings '[[' or ']]' anywhere in your code.  The\nformer is not valid in C, except within comments and strings, but\nthe latter is valid in code such as 'x[y[z]]'.  The solution is\nsimple.  To get the literal string '\"]]\"', use '\"]\"\"]\"'.  To get\nthe array notation 'x[y[z]]', use 'x[y[z] ]'.  Flex will attempt to\ndetect these sequences in user code, and escape them.  However,\nit's best to avoid this complexity where possible, by removing such\nsequences from your code.\n\n'm4' is only required at the time you run 'flex'.  The generated\nscanner is ordinary C or C++, and does not require 'm4'.\n\n---------- Footnotes ----------\n\n(1) The use of m4 is subject to change in future revisions of flex.\nIt is not part of the public API of flex.  Do not depend on it.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Common Patterns,  Prev: M4 Dependency,  Up: Appendices": {
            "content": "",
            "subsections": [
                {
                    "name": "A.4 Common Patterns",
                    "content": ""
                }
            ]
        },
        "This appendix provides examples of common regular expressions you might": {
            "content": "use in your scanner.\n\n* Menu:\n\n* Numbers::\n* Identifiers::\n* Quoted Constructs::\n* Addresses::\n",
            "subsections": []
        },
        "File: flex.info,  Node: Numbers,  Next: Identifiers,  Up: Common Patterns": {
            "content": "C99 decimal constant\n'([[:digit:]]{-}[0])[[:digit:]]*'\n\nC99 hexadecimal constant\n'0[xX][[:xdigit:]]+'\n\nC99 octal constant\n'0[01234567]*'\n\nC99 floating point constant\n{dseq}      ([[:digit:]]+)\n{dseqopt}  ([[:digit:]]*)\n{frac}      (({dseqopt}\".\"{dseq})|{dseq}\".\")\n{exp}       ([eE][+-]?{dseq})\n{expopt}   ({exp}?)\n{fsuff}     [flFL]\n{fsuffopt} ({fsuff}?)\n{hpref}     (0[xX])\n{hdseq}     ([[:xdigit:]]+)\n{hdseqopt} ([[:xdigit:]]*)\n{hfrac}     (({hdseqopt}\".\"{hdseq})|({hdseq}\".\"))\n{bexp}      ([pP][+-]?{dseq})\n{dfc}       (({frac}{expopt}{fsuffopt})|({dseq}{exp}{fsuffopt}))\n{hfc}       (({hpref}{hfrac}{bexp}{fsuffopt})|({hpref}{hdseq}{bexp}{fsuffopt}))\n\n{c99floatingpointconstant}  ({dfc}|{hfc})\n\nSee C99 section 6.4.4.2 for the gory details.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Identifiers,  Next: Quoted Constructs,  Prev: Numbers,  Up: Common Patterns": {
            "content": "C99 Identifier\nucn        ((\\\\u([[:xdigit:]]{4}))|(\\\\U([[:xdigit:]]{8})))\nnondigit    [[:alpha:]]\nc99id     ([[:alpha:]]|{ucn})([[:alnum:]]|{ucn})*\n\nTechnically, the above pattern does not encompass all possible C99\nidentifiers, since C99 allows for \"implementation-defined\"\ncharacters.  In practice, C compilers follow the above pattern,\nwith the addition of the '$' character.\n\nUTF-8 Encoded Unicode Code Point\n[\\x09\\x0A\\x0D\\x20-\\x7E]|[\\xC2-\\xDF][\\x80-\\xBF]|\\xE0[\\xA0-\\xBF][\\x80-\\xBF]|[\\xE1-\\xEC\\xEE\\xEF]([\\x80-\\xBF]{2})|\\xED[\\x80-\\x9F][\\x80-\\xBF]|\\xF0[\\x90-\\xBF]([\\x80-\\xBF]{2})|[\\xF1-\\xF3]([\\x80-\\xBF]{3})|\\xF4[\\x80-\\x8F]([\\x80-\\xBF]{2})\n",
            "subsections": []
        },
        "File: flex.info,  Node: Quoted Constructs,  Next: Addresses,  Prev: Identifiers,  Up: Common Patterns": {
            "content": "C99 String Literal\n'L?\\\"([^\\\"\\\\\\n]|(\\\\['\\\"?\\\\abfnrtv])|(\\\\([0123456]{1,3}))|(\\\\x[[:xdigit:]]+)|(\\\\u([[:xdigit:]]{4}))|(\\\\U([[:xdigit:]]{8})))*\\\"'\n\nC99 Comment\n'(\"/*\"([^*]|\"*\"[^/])*\"*/\")|(\"/\"(\\\\\\n)*\"/\"[^\\n]*)'\n\nNote that in C99, a '//'-style comment may be split across lines,\nand, contrary to popular belief, does not include the trailing '\\n'\ncharacter.\n\nA better way to scan '/* */' comments is by line, rather than\nmatching possibly huge comments all at once.  This will allow you\nto scan comments of unlimited length, as long as line breaks appear\nat sane intervals.  This is also more efficient when used with\nautomatic line number processing.  *Note option-yylineno::.\n\n<INITIAL>{\n\"/*\"      BEGIN(COMMENT);\n}\n<COMMENT>{\n\"*/\"      BEGIN(0);\n[^*\\n]+   ;\n\"*\"[^/]   ;\n\\n        ;\n}\n",
            "subsections": []
        },
        "File: flex.info,  Node: Addresses,  Prev: Quoted Constructs,  Up: Common Patterns": {
            "content": "IPv4 Address\ndec-octet     [0-9]|[1-9][0-9]|1[0-9][0-9]|2[0-4][0-9]|25[0-5]\nIPv4address   {dec-octet}\\.{dec-octet}\\.{dec-octet}\\.{dec-octet}\n\nIPv6 Address\nh16           [0-9A-Fa-f]{1,4}\nls32          {h16}:{h16}|{IPv4address}\nIPv6address   ({h16}:){6}{ls32}|\n::({h16}:){5}{ls32}|\n({h16})?::({h16}:){4}{ls32}|\n(({h16}:){0,1}{h16})?::({h16}:){3}{ls32}|\n(({h16}:){0,2}{h16})?::({h16}:){2}{ls32}|\n(({h16}:){0,3}{h16})?::{h16}:{ls32}|\n(({h16}:){0,4}{h16})?::{ls32}|\n(({h16}:){0,5}{h16})?::{h16}|\n(({h16}:){0,6}{h16})?::\n\nSee RFC 2373 (http://www.ietf.org/rfc/rfc2373.txt) for details.\nNote that you have to fold the definition of 'IPv6address' into one\nline and that it also matches the \"unspecified address\" \"::\".\n",
            "subsections": []
        },
        "URI": {
            "content": "'(([^:/?#]+):)?(\"//\"([^/?#]*))?([^?#]*)(\\?([^#]*))?(#(.*))?'\n\nThis pattern is nearly useless, since it allows just about any\ncharacter to appear in a URI, including spaces and control\ncharacters.  See RFC 2396 (http://www.ietf.org/rfc/rfc2396.txt) for\ndetails.\n",
            "subsections": []
        },
        "File: flex.info,  Node: Indices,  Prev: Appendices,  Up: Top": {
            "content": "",
            "subsections": []
        },
        "File: flex.info,  Node: Concept Index,  Next: Index of Functions and Macros,  Prev: Indices,  Up: Indices": {
            "content": "",
            "subsections": [
                {
                    "name": "Concept Index",
                    "content": "* Menu:\n\n* $ as normal character in patterns:     Patterns.            (line 275)\n* %array, advantages of:                 Matching.            (line  43)\n* %array, use of:                        Matching.            (line  29)\n* %array, with C++:                      Matching.            (line  65)\n* %option noyywrapp:                     Generated Scanner.   (line  93)\n* %pointer, and unput():                 Actions.             (line 162)\n* %pointer, use of:                      Matching.            (line  29)\n* %top:                                  Definitions Section. (line  44)\n* %{ and %}, in Definitions Section:     Definitions Section. (line  40)\n* %{ and %}, in Rules Section:           Actions.             (line  26)\n* <<EOF>>, use of:                       EOF.                 (line  33)\n* [] in patterns:                        Patterns.            (line  15)\n* ^ as non-special character in patterns: Patterns.           (line 275)\n* |, in actions:                         Actions.             (line  33)\n* |, use of:                             Actions.             (line  83)\n* accessor functions, use of:            Accessor Methods.    (line  18)\n* actions:                               Actions.             (line   6)\n* actions, embedded C strings:           Actions.             (line  26)\n* actions, redefining YYBREAK:          Misc Macros.         (line  49)\n* actions, use of { and }:               Actions.             (line  26)\n* aliases, how to define:                Definitions Section. (line  10)\n* arguments, command-line:               Scanner Options.     (line   6)\n* array, default size for yytext:        User Values.         (line  13)\n* backing up, eliminating:               Performance.         (line  54)\n* backing up, eliminating by adding error rules: Performance. (line 104)\n* backing up, eliminating with catch-all rule: Performance.   (line 118)\n* backing up, example of eliminating:    Performance.         (line  49)\n* BEGIN:                                 Actions.             (line  57)\n* BEGIN, explanation:                    Start Conditions.    (line  84)\n* beginning of line, in patterns:        Patterns.            (line 127)\n* bison, bridging with flex:             Bison Bridge.        (line   6)\n* bison, parser:                         Bison Bridge.        (line  53)\n* bison, scanner to be called from bison: Bison Bridge.       (line  34)\n* BOL, checking the BOL flag:            Misc Macros.         (line  46)\n* BOL, in patterns:                      Patterns.            (line 127)\n* BOL, setting it:                       Misc Macros.         (line  40)\n* braces in patterns:                    Patterns.            (line  42)\n* bugs, reporting:                       Reporting Bugs.      (line   6)\n* C code in flex input:                  Definitions Section. (line  40)\n* C++:                                   Cxx.                 (line   9)\n* C++ and %array:                        User Values.         (line  23)\n* C++ I/O, customizing:                  How do I use my own I/O classes in a C++ scanner?.\n(line   9)\n* C++ scanners, including multiple scanners: Cxx.             (line 197)\n* C++ scanners, use of:                  Cxx.                 (line 128)\n* c++, experimental form of scanner class: Cxx.               (line   6)\n* C++, multiple different scanners:      Cxx.                 (line 192)\n* C-strings, in actions:                 Actions.             (line  26)\n* case-insensitive, effect on character classes: Patterns.    (line 216)\n* character classes in patterns:         Patterns.            (line 186)\n* character classes in patterns, syntax of: Patterns.         (line  15)\n* character classes, equivalence of:     Patterns.            (line 205)\n* clearing an input buffer:              Multiple Input Buffers.\n(line  66)\n* command-line options:                  Scanner Options.     (line   6)\n* comments in flex input:                Definitions Section. (line  37)\n* comments in the input:                 Comments in the Input.\n(line  24)\n* comments, discarding:                  Actions.             (line 176)\n* comments, example of scanning C comments: Start Conditions. (line 140)\n* comments, in actions:                  Actions.             (line  26)\n* comments, in rules section:            Comments in the Input.\n(line  11)\n* comments, syntax of:                   Comments in the Input.\n(line   6)\n* comments, valid uses of:               Comments in the Input.\n(line  24)\n* compressing whitespace:                Actions.             (line  22)\n* concatenation, in patterns:            Patterns.            (line 111)\n* copyright of flex:                     Copyright.           (line   6)\n* counting characters and lines:         Simple Examples.     (line  23)\n* customizing I/O in C++ scanners:       How do I use my own I/O classes in a C++ scanner?.\n(line   9)\n* default rule:                          Simple Examples.     (line  15)\n* default rule <1>:                      Matching.            (line  20)\n* defining pattern aliases:              Definitions Section. (line  21)\n* Definitions, in flex input:            Definitions Section. (line   6)\n* deleting lines from input:             Actions.             (line  13)\n* discarding C comments:                 Actions.             (line 176)\n* distributing flex:                     Copyright.           (line   6)\n* ECHO:                                  Actions.             (line  54)\n* ECHO, and yyout:                       Generated Scanner.   (line 101)\n* embedding C code in flex input:        Definitions Section. (line  40)\n* end of file, in patterns:              Patterns.            (line 150)\n* end of line, in negated character classes: Patterns.        (line 237)\n* end of line, in patterns:              Patterns.            (line 131)\n* end-of-file, and yyrestart():          Generated Scanner.   (line  42)\n* EOF and yyrestart():                   Generated Scanner.   (line  42)\n* EOF in patterns, syntax of:            Patterns.            (line 150)\n* EOF, example using multiple input buffers: Multiple Input Buffers.\n(line  81)\n* EOF, explanation:                      EOF.                 (line   6)\n* EOF, pushing back:                     Actions.             (line 170)\n* EOL, in negated character classes:     Patterns.            (line 237)\n* EOL, in patterns:                      Patterns.            (line 131)\n* error messages, end of buffer missed:  Lex and Posix.       (line  50)\n* error reporting, diagnostic messages:  Diagnostics.         (line   6)\n* error reporting, in C++:               Cxx.                 (line 112)\n* error rules, to eliminate backing up:  Performance.         (line 102)\n* escape sequences in patterns, syntax of: Patterns.          (line  57)\n* exiting with yyterminate():            Actions.             (line 212)\n* experimental form of c++ scanner class: Cxx.                (line   6)\n* extended scope of start conditions:    Start Conditions.    (line 270)\n* file format:                           Format.              (line   6)\n* file format, serialized tables:        Tables File Format.  (line   6)\n* flushing an input buffer:              Multiple Input Buffers.\n(line  66)\n* flushing the internal buffer:          Actions.             (line 206)\n* format of flex input:                  Format.              (line   6)\n* format of input file:                  Format.              (line   9)\n* freeing tables:                        Loading and Unloading Serialized Tables.\n(line   6)\n* getting current start state with YYSTART: Start Conditions.\n(line 189)\n* halting with yyterminate():            Actions.             (line 212)\n* handling include files with multiple input buffers: Multiple Input Buffers.\n(line  87)\n* handling include files with multiple input buffers <1>: Multiple Input Buffers.\n(line 122)\n* header files, with C++:                Cxx.                 (line 197)\n* include files, with C++:               Cxx.                 (line 197)\n* input file, Definitions section:       Definitions Section. (line   6)\n* input file, Rules Section:             Rules Section.       (line   6)\n* input file, user code Section:         User Code Section.   (line   6)\n* input():                               Actions.             (line 173)\n* input(), and C++:                      Actions.             (line 202)\n* input, format of:                      Format.              (line   6)\n* input, matching:                       Matching.            (line   6)\n* keywords, for performance:             Performance.         (line 200)\n* lex (traditional) and POSIX:           Lex and Posix.       (line   6)\n* LexerInput, overriding:                How do I use my own I/O classes in a C++ scanner?.\n(line   9)\n* LexerOutput, overriding:               How do I use my own I/O classes in a C++ scanner?.\n(line   9)\n* limitations of flex:                   Limitations.         (line   6)\n* literal text in patterns, syntax of:   Patterns.            (line  54)\n* loading tables at runtime:             Loading and Unloading Serialized Tables.\n(line   6)\n* m4:                                    M4 Dependency.       (line   6)\n* Makefile, example of implicit rules:   Makefiles and Flex.  (line  21)\n* Makefile, explicit example:            Makefiles and Flex.  (line  33)\n* Makefile, syntax:                      Makefiles and Flex.  (line   6)\n* matching C-style double-quoted strings: Start Conditions.   (line 203)\n* matching, and trailing context:        Matching.            (line   6)\n* matching, length of:                   Matching.            (line   6)\n* matching, multiple matches:            Matching.            (line   6)\n* member functions, C++:                 Cxx.                 (line   9)\n* memory management:                     Memory Management.   (line   6)\n* memory, allocating input buffers:      Multiple Input Buffers.\n(line  19)\n* memory, considerations for reentrant scanners: Init and Destroy Functions.\n(line   6)\n* memory, deleting input buffers:        Multiple Input Buffers.\n(line  46)\n* memory, for start condition stacks:    Start Conditions.    (line 301)\n* memory, serialized tables:             Serialized Tables.   (line   6)\n* memory, serialized tables <1>:         Loading and Unloading Serialized Tables.\n(line   6)\n* methods, c++:                          Cxx.                 (line   9)\n* minimal scanner:                       Matching.            (line  24)\n* multiple input streams:                Multiple Input Buffers.\n(line   6)\n* name definitions, not POSIX:           Lex and Posix.       (line  75)\n* negating ranges in patterns:           Patterns.            (line  23)\n* newline, matching in patterns:         Patterns.            (line 135)\n* non-POSIX features of flex:            Lex and Posix.       (line 142)\n* noyywrap, %option:                     Generated Scanner.   (line  93)\n* NULL character in patterns, syntax of: Patterns.            (line  62)\n* octal characters in patterns:          Patterns.            (line  65)\n* options, command-line:                 Scanner Options.     (line   6)\n* overriding LexerInput:                 How do I use my own I/O classes in a C++ scanner?.\n(line   9)\n* overriding LexerOutput:                How do I use my own I/O classes in a C++ scanner?.\n(line   9)\n* overriding the memory routines:        Overriding The Default Memory Management.\n(line  38)\n* Pascal-like language:                  Simple Examples.     (line  49)\n* pattern aliases, defining:             Definitions Section. (line  21)\n* pattern aliases, expansion of:         Patterns.            (line  51)\n* pattern aliases, how to define:        Definitions Section. (line  10)\n* pattern aliases, use of:               Definitions Section. (line  28)\n* patterns and actions on different lines: Lex and Posix.     (line 101)\n* patterns, character class equivalence: Patterns.            (line 205)\n* patterns, common:                      Common Patterns.     (line   6)\n* patterns, end of line:                 Patterns.            (line 300)\n* patterns, grouping and precedence:     Patterns.            (line 167)\n* patterns, in rules section:            Patterns.            (line   6)\n* patterns, invalid trailing context:    Patterns.            (line 285)\n* patterns, matching:                    Matching.            (line   6)\n* patterns, precedence of operators:     Patterns.            (line 161)\n* patterns, repetitions with grouping:   Patterns.            (line 184)\n* patterns, special characters treated as non-special: Patterns.\n(line 293)\n* patterns, syntax:                      Patterns.            (line   9)\n* patterns, syntax <1>:                  Patterns.            (line   9)\n* patterns, tuning for performance:      Performance.         (line  49)\n* patterns, valid character classes:     Patterns.            (line 192)\n* performance optimization, matching longer tokens: Performance.\n(line 167)\n* performance optimization, recognizing keywords: Performance.\n(line 205)\n* performance, backing up:               Performance.         (line  49)\n* performance, considerations:           Performance.         (line   6)\n* performance, using keywords:           Performance.         (line 200)\n* popping an input buffer:               Multiple Input Buffers.\n(line  60)\n* POSIX and lex:                         Lex and Posix.       (line   6)\n* POSIX comp;compliance:                 Lex and Posix.       (line 142)\n* POSIX, character classes in patterns, syntax of: Patterns.  (line  15)\n* preprocessor macros, for use in actions: Actions.           (line  50)\n* pushing an input buffer:               Multiple Input Buffers.\n(line  52)\n* pushing back characters with unput:    Actions.             (line 143)\n* pushing back characters with unput():  Actions.             (line 147)\n* pushing back characters with yyless:   Actions.             (line 131)\n* pushing back EOF:                      Actions.             (line 170)\n* ranges in patterns:                    Patterns.            (line  19)\n* ranges in patterns, negating:          Patterns.            (line  23)\n* recognizing C comments:                Start Conditions.    (line 143)\n* reentrant scanners, multiple interleaved scanners: Reentrant Uses.\n(line  10)\n* reentrant scanners, recursive invocation: Reentrant Uses.   (line  30)\n* reentrant, accessing flex variables:   Global Replacement.  (line   6)\n* reentrant, accessor functions:         Accessor Methods.    (line   6)\n* reentrant, API explanation:            Reentrant Overview.  (line   6)\n* reentrant, calling functions:          Extra Reentrant Argument.\n(line   6)\n* reentrant, example of:                 Reentrant Example.   (line   6)\n* reentrant, explanation:                Reentrant.           (line   6)\n* reentrant, extra data:                 Extra Data.          (line   6)\n* reentrant, initialization:             Init and Destroy Functions.\n(line   6)\n* regular expressions, in patterns:      Patterns.            (line   6)\n* REJECT:                                Actions.             (line  61)\n* REJECT, calling multiple times:        Actions.             (line  83)\n* REJECT, performance costs:             Performance.         (line  12)\n* reporting bugs:                        Reporting Bugs.      (line   6)\n* restarting the scanner:                Lex and Posix.       (line  54)\n* RETURN, within actions:                Generated Scanner.   (line  57)\n* rules, default:                        Simple Examples.     (line  15)\n* rules, in flex input:                  Rules Section.       (line   6)\n* scanner, definition of:                Introduction.        (line   6)\n* sections of flex input:                Format.              (line   6)\n* serialization:                         Serialized Tables.   (line   6)\n* serialization of tables:               Creating Serialized Tables.\n(line   6)\n* serialized tables, multiple scanners:  Creating Serialized Tables.\n(line  26)\n* stack, input buffer pop:               Multiple Input Buffers.\n(line  60)\n* stack, input buffer push:              Multiple Input Buffers.\n(line  52)\n* stacks, routines for manipulating:     Start Conditions.    (line 286)\n* start condition, applying to multiple patterns: Start Conditions.\n(line 258)\n* start conditions:                      Start Conditions.    (line   6)\n* start conditions, behavior of default rule: Start Conditions.\n(line  82)\n* start conditions, exclusive:           Start Conditions.    (line  53)\n* start conditions, for different interpretations of same input: Start Conditions.\n(line 112)\n* start conditions, in patterns:         Patterns.            (line 140)\n* start conditions, inclusive:           Start Conditions.    (line  44)\n* start conditions, inclusive v.s. exclusive: Start Conditions.\n(line  24)\n* start conditions, integer values:      Start Conditions.    (line 163)\n* start conditions, multiple:            Start Conditions.    (line  17)\n* start conditions, special wildcard condition: Start Conditions.\n(line  68)\n* start conditions, use of a stack:      Start Conditions.    (line 286)\n* start conditions, use of wildcard condition (<*>): Start Conditions.\n(line  72)\n* start conditions, using BEGIN:         Start Conditions.    (line  95)\n* stdin, default for yyin:               Generated Scanner.   (line  37)\n* stdout, as default for yyout:          Generated Scanner.   (line 101)\n* strings, scanning strings instead of files: Multiple Input Buffers.\n(line 175)\n* tables, creating serialized:           Creating Serialized Tables.\n(line   6)\n* tables, file format:                   Tables File Format.  (line   6)\n* tables, freeing:                       Loading and Unloading Serialized Tables.\n(line   6)\n* tables, loading and unloading:         Loading and Unloading Serialized Tables.\n(line   6)\n* terminating with yyterminate():        Actions.             (line 212)\n* token:                                 Matching.            (line  14)\n* trailing context, in patterns:         Patterns.            (line 118)\n* trailing context, limits of:           Patterns.            (line 275)\n* trailing context, matching:            Matching.            (line   6)\n* trailing context, performance costs:   Performance.         (line  12)\n* trailing context, variable length:     Performance.         (line 141)\n* unput():                               Actions.             (line 143)\n* unput(), and %pointer:                 Actions.             (line 162)\n* unput(), pushing back characters:      Actions.             (line 147)\n* user code, in flex input:              User Code Section.   (line   6)\n* username expansion:                    Simple Examples.     (line   8)\n* using integer values of start condition names: Start Conditions.\n(line 163)\n* verbatim text in patterns, syntax of:  Patterns.            (line  54)\n* warning, dangerous trailing context:   Limitations.         (line  20)\n* warning, rule cannot be matched:       Diagnostics.         (line  14)\n* warnings, diagnostic messages:         Diagnostics.         (line   6)\n* whitespace, compressing:               Actions.             (line  22)\n* yacc interface:                        Yacc.                (line  17)\n* yacc, interface:                       Yacc.                (line   6)\n* yyalloc, overriding:                   Overriding The Default Memory Management.\n(line   6)\n* yyfree, overriding:                    Overriding The Default Memory Management.\n(line   6)\n* yyin:                                  Generated Scanner.   (line  37)\n* yyinput():                             Actions.             (line 202)\n* yyleng:                                Matching.            (line  14)\n* yyleng, modification of:               Actions.             (line  47)\n* yyless():                              Actions.             (line 125)\n* yyless(), pushing back characters:     Actions.             (line 131)\n* yylex(), in generated scanner:         Generated Scanner.   (line   6)\n* yylex(), overriding:                   Generated Scanner.   (line  16)\n* yylex, overriding the prototype of:    Generated Scanner.   (line  20)\n* yylineno, in a reentrant scanner:      Reentrant Functions. (line  36)\n* yylineno, performance costs:           Performance.         (line  12)\n* yymore():                              Actions.             (line 104)\n* yymore() to append token to previous token: Actions.        (line 110)\n* yymore(), mega-kludge:                 Actions.             (line 110)\n* yymore, and yyleng:                    Actions.             (line  47)\n* yymore, performance penalty of:        Actions.             (line 119)\n* yyout:                                 Generated Scanner.   (line 101)\n* yyrealloc, overriding:                 Overriding The Default Memory Management.\n(line   6)\n* yyrestart():                           Generated Scanner.   (line  42)\n* yyterminate():                         Actions.             (line 212)\n* yytext:                                Matching.            (line  14)\n* yytext, default array size:            User Values.         (line  13)\n* yytext, memory considerations:         A Note About yytext And Memory.\n(line   6)\n* yytext, modification of:               Actions.             (line  42)\n* yytext, two types of:                  Matching.            (line  29)\n* yywrap():                              Generated Scanner.   (line  85)\n* yywrap, default for:                   Generated Scanner.   (line  93)\n* YYCURRENTBUFFER, and multiple buffers Finally, the macro: Multiple Input Buffers.\n(line  78)\n* YYEXTRATYPE, defining your own type: Extra Data.          (line  33)\n* YYFLUSHBUFFER:                       Actions.             (line 206)\n* YYINPUT:                              Generated Scanner.   (line  61)\n* YYINPUT, overriding:                  Generated Scanner.   (line  71)\n* YYSTART, example:                     Start Conditions.    (line 185)\n* YYUSERACTION to track each time a rule is matched: Misc Macros.\n(line  14)\n"
                }
            ]
        },
        "File: flex.info,  Node: Index of Functions and Macros,  Next: Index of Variables,  Prev: Concept Index,  Up: Indices": {
            "content": "",
            "subsections": [
                {
                    "name": "Index of Functions and Macros",
                    "content": ""
                }
            ]
        },
        "This is an index of functions and preprocessor macros that look like": {
            "content": "functions.  For macros that expand to variables or constants, see *note\nIndex of Variables::.\n\n\n* Menu:\n\n* BEGIN:                                 Start Conditions.    (line  84)\n* debug (C++ only):                      Cxx.                 (line  48)\n* LexerError (C++ only):                 Cxx.                 (line 112)\n* LexerInput (C++ only):                 Cxx.                 (line  97)\n* LexerOutput (C++ only):                Cxx.                 (line 107)\n* lineno (C++ only):                     Cxx.                 (line  38)\n* setdebug (C++ only):                  Cxx.                 (line  42)\n* switchstreams (C++ only):             Cxx.                 (line  82)\n* yyFlexLexer constructor (C++ only):    Cxx.                 (line  61)\n* yygetdebug:                           Reentrant Functions. (line   8)\n* yygetextra:                           Extra Data.          (line  20)\n* yygetextra <1>:                       Reentrant Functions. (line   8)\n* yygetin:                              Reentrant Functions. (line   8)\n* yygetleng:                            Reentrant Functions. (line   8)\n* yygetlineno:                          Reentrant Functions. (line   8)\n* yygetout:                             Reentrant Functions. (line   8)\n* yygettext:                            Reentrant Functions. (line   8)\n* YYLeng (C++ only):                     Cxx.                 (line  34)\n* yylex (C++ version):                   Cxx.                 (line  70)\n* yylex (reentrant version):             Bison Bridge.        (line  22)\n* yylex (reentrant version) <1>:         Bison Bridge.        (line  27)\n* yylexdestroy:                         Init and Destroy Functions.\n(line   6)\n* yylexinit:                            Init and Destroy Functions.\n(line   6)\n* yypopbufferstate:                    Multiple Input Buffers.\n(line  60)\n* yypushbufferstate:                   Multiple Input Buffers.\n(line  52)\n* yyrestart:                             User Values.         (line  38)\n* yysetdebug:                           Reentrant Functions. (line   8)\n* yysetextra:                           Extra Data.          (line  20)\n* yysetextra <1>:                       Reentrant Functions. (line   8)\n* yysetin:                              Reentrant Functions. (line   8)\n* yysetlineno:                          Reentrant Functions. (line   8)\n* yysetout:                             Reentrant Functions. (line   8)\n* yytablesdestroy:                      Loading and Unloading Serialized Tables.\n(line  23)\n* yytablesfload:                        Loading and Unloading Serialized Tables.\n(line  10)\n* YYText (C++ only):                     Cxx.                 (line  30)\n* YYATBOL:                             Misc Macros.         (line  46)\n* yycreatebuffer:                      Multiple Input Buffers.\n(line  19)\n* yydeletebuffer:                      Multiple Input Buffers.\n(line  46)\n* yyflushbuffer:                       Multiple Input Buffers.\n(line  66)\n* yynewbuffer:                         Multiple Input Buffers.\n(line  72)\n* YYNEWFILE (now obsolete):            EOF.                 (line  11)\n* yypopstate:                          Start Conditions.    (line 295)\n* yypushstate:                         Start Conditions.    (line 289)\n* yyscanbuffer:                        Multiple Input Buffers.\n(line 196)\n* yyscanbytes:                         Multiple Input Buffers.\n(line 186)\n* yyscanstring:                        Multiple Input Buffers.\n(line 183)\n* yysetbol:                            Misc Macros.         (line  40)\n* yysetinteractive:                    Misc Macros.         (line  28)\n* yyswitchtobuffer:                   Multiple Input Buffers.\n(line  35)\n* yytopstate:                          Start Conditions.    (line 298)\n",
            "subsections": []
        },
        "File: flex.info,  Node: Index of Variables,  Next: Index of Data Types,  Prev: Index of Functions and Macros,  Up: Indices": {
            "content": "",
            "subsections": [
                {
                    "name": "Index of Variables",
                    "content": ""
                }
            ]
        },
        "This is an index of variables, constants, and preprocessor macros that": {
            "content": "expand to variables or constants.\n\n\n* Menu:\n\n* INITIAL:                               Start Conditions.    (line  84)\n* yyextra:                               Extra Data.          (line   6)\n* yyin:                                  User Values.         (line  29)\n* yyleng:                                User Values.         (line  26)\n* yylloc:                                Bison Bridge.        (line   6)\n* YYLMAX:                                User Values.         (line  13)\n* yylval:                                Bison Bridge.        (line   6)\n* yylval, with yacc:                     Yacc.                (line   6)\n* yyout:                                 User Values.         (line  45)\n* yyscanner (reentrant only):            Extra Reentrant Argument.\n(line   6)\n* yytext:                                Matching.            (line  29)\n* yytext <1>:                            User Values.         (line   9)\n* YYCURRENTBUFFER:                     User Values.         (line  49)\n* YYENDOFBUFFERCHAR:                 Multiple Input Buffers.\n(line 196)\n* YYNUMRULES:                          Misc Macros.         (line  16)\n* YYSTART:                              Start Conditions.    (line 191)\n* YYSTART <1>:                          User Values.         (line  52)\n",
            "subsections": []
        },
        "File: flex.info,  Node: Index of Data Types,  Next: Index of Hooks,  Prev: Index of Variables,  Up: Indices": {
            "content": "",
            "subsections": [
                {
                    "name": "Index of Data Types",
                    "content": "* Menu:\n\n* FlexLexer (C++ only):                  Cxx.                 (line  57)\n* yyFlexLexer (C++ only):                Cxx.                 (line  57)\n* YYLTYPE:                               Bison Bridge.        (line   6)\n* yyscant (reentrant only):             About yyscant.      (line   6)\n* YYSTYPE:                               Bison Bridge.        (line   6)\n* YYBUFFERSTATE:                       Multiple Input Buffers.\n(line  25)\n* YYEXTRATYPE (reentrant only):        Extra Data.          (line  20)\n* yysizet:                             Multiple Input Buffers.\n(line 208)\n"
                }
            ]
        },
        "File: flex.info,  Node: Index of Hooks,  Next: Index of Scanner Options,  Prev: Index of Data Types,  Up: Indices": {
            "content": "",
            "subsections": [
                {
                    "name": "Index of Hooks",
                    "content": "This is an index of \"hooks\" that the user may define.  These hooks\ntypically correspond to specific locations in the generated scanner, and\nmay be used to insert arbitrary code.\n\n\n* Menu:\n\n* YYBREAK:                              Misc Macros.          (line 49)\n* YYUSERACTION:                        Misc Macros.          (line  6)\n* YYUSERINIT:                          Misc Macros.          (line 23)\n"
                }
            ]
        },
        "File: flex.info,  Node: Index of Scanner Options,  Prev: Index of Hooks,  Up: Indices": {
            "content": "",
            "subsections": [
                {
                    "name": "Index of Scanner Options",
                    "content": "* Menu:\n\n* -+:                                    Code-Level And API Options.\n(line  45)\n* --7bit:                                Options Affecting Scanner Behavior.\n(line  56)\n* --8bit:                                Options Affecting Scanner Behavior.\n(line  80)\n* --align:                               Options for Scanner Speed and Size.\n(line  15)\n* --always-interactive:                  Options Affecting Scanner Behavior.\n(line  92)\n* --array:                               Code-Level And API Options.\n(line  49)\n* --backup:                              Debugging Options.   (line   6)\n* --batch:                               Options Affecting Scanner Behavior.\n(line  23)\n* --bison-bridge:                        Code-Level And API Options.\n(line  12)\n* --bison-locations:                     Code-Level And API Options.\n(line  19)\n* --c++:                                 Code-Level And API Options.\n(line  45)\n* --case-insensitive:                    Options Affecting Scanner Behavior.\n(line   6)\n* --debug:                               Debugging Options.   (line  16)\n* --default:                             Options Affecting Scanner Behavior.\n(line  89)\n* --ecs:                                 Options for Scanner Speed and Size.\n(line  24)\n* --fast:                                Options for Scanner Speed and Size.\n(line 100)\n* --full:                                Options for Scanner Speed and Size.\n(line  95)\n* --header-file:                         Options for Specifying Filenames.\n(line   6)\n* --help:                                Miscellaneous Options.\n(line   9)\n* --interactive:                         Options Affecting Scanner Behavior.\n(line  32)\n* --lex-compat:                          Options Affecting Scanner Behavior.\n(line  14)\n* --main:                                Code-Level And API Options.\n(line  95)\n* --meta-ecs:                            Options for Scanner Speed and Size.\n(line  45)\n* --never-interactive:                   Options Affecting Scanner Behavior.\n(line 100)\n* --nodefault:                           Debugging Options.   (line  43)\n* --noline:                              Code-Level And API Options.\n(line  24)\n* --nounistd:                            Code-Level And API Options.\n(line 100)\n* --nowarn:                              Debugging Options.   (line  55)\n* --option-ansi-definitions:             Code-Level And API Options.\n(line   6)\n* --option-ansi-prototypes:              Code-Level And API Options.\n(line   9)\n* --outfile:                             Options for Specifying Filenames.\n(line  21)\n* --perf-report:                         Debugging Options.   (line  31)\n* --pointer:                             Code-Level And API Options.\n(line  52)\n* --posix:                               Options Affecting Scanner Behavior.\n(line 104)\n* --prefix:                              Code-Level And API Options.\n(line  56)\n* --read:                                Options for Scanner Speed and Size.\n(line  54)\n* --reentrant:                           Code-Level And API Options.\n(line  33)\n* --skel:                                Options for Specifying Filenames.\n(line  31)\n* --stack:                               Options Affecting Scanner Behavior.\n(line 124)\n* --stdinit:                             Options Affecting Scanner Behavior.\n(line 128)\n* --stdout:                              Options for Specifying Filenames.\n(line  27)\n* --tables-file:                         Options for Specifying Filenames.\n(line  36)\n* --tables-verify:                       Options for Specifying Filenames.\n(line  41)\n* --trace:                               Debugging Options.   (line  49)\n* --verbose:                             Debugging Options.   (line  58)\n* --version:                             Miscellaneous Options.\n(line  16)\n* --warn:                                Debugging Options.   (line  66)\n* --yyclass:                             Code-Level And API Options.\n(line 109)\n* --yylineno:                            Options Affecting Scanner Behavior.\n(line 137)\n* --yywrap:                              Options Affecting Scanner Behavior.\n(line 145)\n* -7:                                    Options Affecting Scanner Behavior.\n(line  56)\n* -8:                                    Options Affecting Scanner Behavior.\n(line  80)\n* -B:                                    Options Affecting Scanner Behavior.\n(line  23)\n* -b:                                    Debugging Options.   (line   6)\n* -C:                                    Options for Scanner Speed and Size.\n(line  10)\n* -c:                                    Miscellaneous Options.\n(line   6)\n* -Ca:                                   Options for Scanner Speed and Size.\n(line  15)\n* -Ce:                                   Options for Scanner Speed and Size.\n(line  24)\n* -Cf:                                   Options for Scanner Speed and Size.\n(line  35)\n* -CF:                                   Options for Scanner Speed and Size.\n(line  40)\n* -Cm:                                   Options for Scanner Speed and Size.\n(line  45)\n* -Cr:                                   Options for Scanner Speed and Size.\n(line  54)\n* -d:                                    Debugging Options.   (line  16)\n* -f:                                    Options for Scanner Speed and Size.\n(line  95)\n* -F:                                    Options for Scanner Speed and Size.\n(line 100)\n* -h:                                    Miscellaneous Options.\n(line   9)\n* -i:                                    Options Affecting Scanner Behavior.\n(line   6)\n* -I:                                    Options Affecting Scanner Behavior.\n(line  32)\n* -l:                                    Options Affecting Scanner Behavior.\n(line  14)\n* -L:                                    Code-Level And API Options.\n(line  24)\n* -n:                                    Miscellaneous Options.\n(line  13)\n* -o:                                    Options for Specifying Filenames.\n(line  21)\n* -P:                                    Code-Level And API Options.\n(line  56)\n* -p:                                    Debugging Options.   (line  31)\n* -R:                                    Code-Level And API Options.\n(line  33)\n* -s:                                    Debugging Options.   (line  43)\n* -t:                                    Options for Specifying Filenames.\n(line  27)\n* -T:                                    Debugging Options.   (line  49)\n* -v:                                    Debugging Options.   (line  58)\n* -V:                                    Miscellaneous Options.\n(line  16)\n* -w:                                    Debugging Options.   (line  55)\n* -X:                                    Options Affecting Scanner Behavior.\n(line 104)\n* 7bit:                                  Options Affecting Scanner Behavior.\n(line  56)\n* 8bit:                                  Options Affecting Scanner Behavior.\n(line  80)\n* align:                                 Options for Scanner Speed and Size.\n(line  15)\n* always-interactive:                    Options Affecting Scanner Behavior.\n(line  92)\n* ansi-definitions:                      Code-Level And API Options.\n(line   6)\n* ansi-prototypes:                       Code-Level And API Options.\n(line   9)\n* array:                                 Code-Level And API Options.\n(line  49)\n* backup:                                Debugging Options.   (line   6)\n* batch:                                 Options Affecting Scanner Behavior.\n(line  23)\n* bison-bridge:                          Code-Level And API Options.\n(line  12)\n* bison-locations:                       Code-Level And API Options.\n(line  19)\n* c++:                                   Code-Level And API Options.\n(line  45)\n* case-insensitive:                      Options Affecting Scanner Behavior.\n(line   6)\n* debug:                                 Debugging Options.   (line  16)\n* default:                               Options Affecting Scanner Behavior.\n(line  89)\n* ecs:                                   Options for Scanner Speed and Size.\n(line  24)\n* fast:                                  Options for Scanner Speed and Size.\n(line 100)\n* full:                                  Options for Scanner Speed and Size.\n(line  95)\n* header-file:                           Options for Specifying Filenames.\n(line   6)\n* interactive:                           Options Affecting Scanner Behavior.\n(line  32)\n* lex-compat:                            Options Affecting Scanner Behavior.\n(line  14)\n* main:                                  Code-Level And API Options.\n(line  95)\n* meta-ecs:                              Options for Scanner Speed and Size.\n(line  45)\n* nodefault:                             Debugging Options.   (line  43)\n* noline:                                Code-Level And API Options.\n(line  24)\n* nounistd:                              Code-Level And API Options.\n(line 100)\n* nowarn:                                Debugging Options.   (line  55)\n* noyyalloc:                             Overriding The Default Memory Management.\n(line  17)\n* outfile:                               Options for Specifying Filenames.\n(line  21)\n* perf-report:                           Debugging Options.   (line  31)\n* pointer:                               Code-Level And API Options.\n(line  52)\n* posix:                                 Options Affecting Scanner Behavior.\n(line 104)\n* prefix:                                Code-Level And API Options.\n(line  56)\n* read:                                  Options for Scanner Speed and Size.\n(line  54)\n* reentrant:                             Code-Level And API Options.\n(line  33)\n* stack:                                 Options Affecting Scanner Behavior.\n(line 124)\n* stdinit:                               Options Affecting Scanner Behavior.\n(line 128)\n* stdout:                                Options for Specifying Filenames.\n(line  27)\n* tables-file:                           Options for Specifying Filenames.\n(line  36)\n* tables-verify:                         Options for Specifying Filenames.\n(line  41)\n* trace:                                 Debugging Options.   (line  49)\n* verbose:                               Debugging Options.   (line  58)\n* warn:                                  Debugging Options.   (line  66)\n* yyclass:                               Code-Level And API Options.\n(line 109)\n* yylineno:                              Options Affecting Scanner Behavior.\n(line 137)\n* yywrap:                                Options Affecting Scanner Behavior.\n(line 145)\n"
                }
            ]
        }
    },
    "flags": [],
    "examples": [],
    "see_also": []
}