/* Common stuff */ /*!re2c re2c:define:YYCTYPE = "unsigned char"; re2c:define:YYCURSOR = p; re2c:yyfill:enable = 0; // generated code doesn't ask for more input */ static inline void MatchOshToken(int lex_mode, const unsigned char* line, int line_len, int start_pos, int* id, int* end_pos) { assert(start_pos <= line_len); /* caller should have checked */ const unsigned char* p = line + start_pos; /* modified by re2c */ //printf("p: %p q: %p\n", p, q); const unsigned char* YYMARKER; /* why do we need this? */ switch (lex_mode) { case lex_mode__Comment: for (;;) { /*!re2c [^\n\x00]* { *id = id__Ignored_Comment; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__ShCommand: for (;;) { /*!re2c [a-zA-Z_][a-zA-Z0-9_]* "+" ? "=" { *id = id__Lit_VarLike; break; } [a-zA-Z_][a-zA-Z0-9_]* "[" { *id = id__Lit_ArrayLhsOpen; break; } "]" "+" ? "=" { *id = id__Lit_ArrayLhsClose; break; } "((" { *id = id__Op_DLeftParen; break; } "[" { *id = id__Lit_LBracket; break; } "]" { *id = id__Lit_RBracket; break; } "*" { *id = id__Lit_Star; break; } "?" { *id = id__Lit_QMark; break; } "###" { *id = id__Lit_TPound; break; } "..." { *id = id__Lit_TDot; break; } "{" { *id = id__Lit_LBrace; break; } "}" { *id = id__Lit_RBrace; break; } "," { *id = id__Lit_Comma; break; } "=" { *id = id__Lit_Equals; break; } "_" { *id = id__Lit_Underscore; break; } "@" { *id = id__Lit_At; break; } "@" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__Lit_Splice; break; } [0-9]? [0-9]? "<" { *id = id__Redir_Less; break; } [0-9]? [0-9]? ">" { *id = id__Redir_Great; break; } [0-9]? [0-9]? "<" "<" { *id = id__Redir_DLess; break; } [0-9]? [0-9]? "<" "<" "<" { *id = id__Redir_TLess; break; } [0-9]? [0-9]? ">" ">" { *id = id__Redir_DGreat; break; } [0-9]? [0-9]? "<" "<" "-" { *id = id__Redir_DLessDash; break; } [0-9]? [0-9]? ">" "&" { *id = id__Redir_GreatAnd; break; } [0-9]? [0-9]? "<" "&" { *id = id__Redir_LessAnd; break; } [0-9]? [0-9]? "<" ">" { *id = id__Redir_LessGreat; break; } [0-9]? [0-9]? ">" "|" { *id = id__Redir_Clobber; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" { *id = id__Redir_Less; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" ">" { *id = id__Redir_Great; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" "<" { *id = id__Redir_DLess; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" "<" "<" { *id = id__Redir_TLess; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" ">" ">" { *id = id__Redir_DGreat; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" "<" "-" { *id = id__Redir_DLessDash; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" ">" "&" { *id = id__Redir_GreatAnd; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" "&" { *id = id__Redir_LessAnd; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" "<" ">" { *id = id__Redir_LessGreat; break; } "{" [a-zA-Z_][a-zA-Z0-9_]* "}" ">" "|" { *id = id__Redir_Clobber; break; } "&>" { *id = id__Redir_AndGreat; break; } "&>>" { *id = id__Redir_AndDGreat; break; } "[[" { *id = id__KW_DLeftBracket; break; } "!" { *id = id__KW_Bang; break; } "for" { *id = id__KW_For; break; } "while" { *id = id__KW_While; break; } "until" { *id = id__KW_Until; break; } "do" { *id = id__KW_Do; break; } "done" { *id = id__KW_Done; break; } "in" { *id = id__KW_In; break; } "case" { *id = id__KW_Case; break; } "esac" { *id = id__KW_Esac; break; } "if" { *id = id__KW_If; break; } "fi" { *id = id__KW_Fi; break; } "then" { *id = id__KW_Then; break; } "else" { *id = id__KW_Else; break; } "elif" { *id = id__KW_Elif; break; } "function" { *id = id__KW_Function; break; } "time" { *id = id__KW_Time; break; } "const" { *id = id__KW_Const; break; } "var" { *id = id__KW_Var; break; } "setvar" { *id = id__KW_SetVar; break; } "setref" { *id = id__KW_SetRef; break; } "setglobal" { *id = id__KW_SetGlobal; break; } "proc" { *id = id__KW_Proc; break; } "func" { *id = id__KW_Func; break; } "data" { *id = id__KW_Data; break; } "enum" { *id = id__KW_Enum; break; } "class" { *id = id__KW_Class; break; } "import" { *id = id__KW_Import; break; } "break" { *id = id__ControlFlow_Break; break; } "continue" { *id = id__ControlFlow_Continue; break; } "return" { *id = id__ControlFlow_Return; break; } "exit" { *id = id__ControlFlow_Exit; break; } "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; } "\\\n" { *id = id__Ignored_LineCont; break; } "`" { *id = id__Left_Backtick; break; } "$(" { *id = id__Left_DollarParen; break; } "${" { *id = id__Left_DollarBrace; break; } "$((" { *id = id__Left_DollarDParen; break; } "$[" { *id = id__Left_DollarBracket; break; } "\"" { *id = id__Left_DoubleQuote; break; } "'" { *id = id__Left_SingleQuote; break; } "$\"" { *id = id__Left_DollarDoubleQuote; break; } "$'" { *id = id__Left_DollarSingleQuote; break; } "<(" { *id = id__Left_ProcSubIn; break; } ">(" { *id = id__Left_ProcSubOut; break; } "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; } "$" [0-9] { *id = id__VSub_Number; break; } "$!" { *id = id__VSub_Bang; break; } "$@" { *id = id__VSub_At; break; } "$#" { *id = id__VSub_Pound; break; } "$$" { *id = id__VSub_Dollar; break; } "$*" { *id = id__VSub_Star; break; } "$-" { *id = id__VSub_Hyphen; break; } "$?" { *id = id__VSub_QMark; break; } [\x80-\xffa-zA-Z0-9_/.\-]+ { *id = id__Lit_Chars; break; } "~" [a-zA-Z0-9_.\-]* { *id = id__Lit_TildeLike; break; } ":" { *id = id__Lit_Colon; break; } "$" { *id = id__Lit_Dollar; break; } "#" { *id = id__Lit_Pound; break; } [ \t\r]+ { *id = id__WS_Space; break; } "\n" { *id = id__Op_Newline; break; } "&" { *id = id__Op_Amp; break; } "|" { *id = id__Op_Pipe; break; } "|&" { *id = id__Op_PipeAmp; break; } "&&" { *id = id__Op_DAmp; break; } "||" { *id = id__Op_DPipe; break; } ";" { *id = id__Op_Semi; break; } ";;" { *id = id__Op_DSemi; break; } "(" { *id = id__Op_LParen; break; } ")" { *id = id__Op_RParen; break; } [^\x00] { *id = id__Lit_Other; break; } ",(" { *id = id__ExtGlob_Comma; break; } "@(" { *id = id__ExtGlob_At; break; } "*(" { *id = id__ExtGlob_Star; break; } "+(" { *id = id__ExtGlob_Plus; break; } "?(" { *id = id__ExtGlob_QMark; break; } "!(" { *id = id__ExtGlob_Bang; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__Backtick: for (;;) { /*!re2c "`" { *id = id__Backtick_Right; break; } "\\" [$`"\\] { *id = id__Backtick_Quoted; break; } [^`\\\x00]+ { *id = id__Backtick_Other; break; } [^\x00] { *id = id__Backtick_Other; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__DBracket: for (;;) { /*!re2c "]]" { *id = id__Lit_DRightBracket; break; } "!" { *id = id__KW_Bang; break; } "<" { *id = id__Op_Less; break; } ">" { *id = id__Op_Great; break; } "-z" { *id = id__BoolUnary_z; break; } "-n" { *id = id__BoolUnary_n; break; } "-o" { *id = id__BoolUnary_o; break; } "-t" { *id = id__BoolUnary_t; break; } "-v" { *id = id__BoolUnary_v; break; } "-R" { *id = id__BoolUnary_R; break; } "-a" { *id = id__BoolUnary_a; break; } "-b" { *id = id__BoolUnary_b; break; } "-c" { *id = id__BoolUnary_c; break; } "-d" { *id = id__BoolUnary_d; break; } "-e" { *id = id__BoolUnary_e; break; } "-f" { *id = id__BoolUnary_f; break; } "-g" { *id = id__BoolUnary_g; break; } "-h" { *id = id__BoolUnary_h; break; } "-k" { *id = id__BoolUnary_k; break; } "-L" { *id = id__BoolUnary_L; break; } "-p" { *id = id__BoolUnary_p; break; } "-r" { *id = id__BoolUnary_r; break; } "-s" { *id = id__BoolUnary_s; break; } "-S" { *id = id__BoolUnary_S; break; } "-u" { *id = id__BoolUnary_u; break; } "-w" { *id = id__BoolUnary_w; break; } "-x" { *id = id__BoolUnary_x; break; } "-O" { *id = id__BoolUnary_O; break; } "-G" { *id = id__BoolUnary_G; break; } "-N" { *id = id__BoolUnary_N; break; } "=" { *id = id__BoolBinary_GlobEqual; break; } "==" { *id = id__BoolBinary_GlobDEqual; break; } "!=" { *id = id__BoolBinary_GlobNEqual; break; } "=~" { *id = id__BoolBinary_EqualTilde; break; } "-ef" { *id = id__BoolBinary_ef; break; } "-nt" { *id = id__BoolBinary_nt; break; } "-ot" { *id = id__BoolBinary_ot; break; } "-eq" { *id = id__BoolBinary_eq; break; } "-ne" { *id = id__BoolBinary_ne; break; } "-gt" { *id = id__BoolBinary_gt; break; } "-ge" { *id = id__BoolBinary_ge; break; } "-lt" { *id = id__BoolBinary_lt; break; } "-le" { *id = id__BoolBinary_le; break; } "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; } "\\\n" { *id = id__Ignored_LineCont; break; } "`" { *id = id__Left_Backtick; break; } "$(" { *id = id__Left_DollarParen; break; } "${" { *id = id__Left_DollarBrace; break; } "$((" { *id = id__Left_DollarDParen; break; } "$[" { *id = id__Left_DollarBracket; break; } "\"" { *id = id__Left_DoubleQuote; break; } "'" { *id = id__Left_SingleQuote; break; } "$\"" { *id = id__Left_DollarDoubleQuote; break; } "$'" { *id = id__Left_DollarSingleQuote; break; } "<(" { *id = id__Left_ProcSubIn; break; } ">(" { *id = id__Left_ProcSubOut; break; } "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; } "$" [0-9] { *id = id__VSub_Number; break; } "$!" { *id = id__VSub_Bang; break; } "$@" { *id = id__VSub_At; break; } "$#" { *id = id__VSub_Pound; break; } "$$" { *id = id__VSub_Dollar; break; } "$*" { *id = id__VSub_Star; break; } "$-" { *id = id__VSub_Hyphen; break; } "$?" { *id = id__VSub_QMark; break; } [\x80-\xffa-zA-Z0-9_/.\-]+ { *id = id__Lit_Chars; break; } "~" [a-zA-Z0-9_.\-]* { *id = id__Lit_TildeLike; break; } ":" { *id = id__Lit_Colon; break; } "$" { *id = id__Lit_Dollar; break; } "#" { *id = id__Lit_Pound; break; } [ \t\r]+ { *id = id__WS_Space; break; } "\n" { *id = id__Op_Newline; break; } "&" { *id = id__Op_Amp; break; } "|" { *id = id__Op_Pipe; break; } "|&" { *id = id__Op_PipeAmp; break; } "&&" { *id = id__Op_DAmp; break; } "||" { *id = id__Op_DPipe; break; } ";" { *id = id__Op_Semi; break; } ";;" { *id = id__Op_DSemi; break; } "(" { *id = id__Op_LParen; break; } ")" { *id = id__Op_RParen; break; } [^\x00] { *id = id__Lit_Other; break; } ",(" { *id = id__ExtGlob_Comma; break; } "@(" { *id = id__ExtGlob_At; break; } "*(" { *id = id__ExtGlob_Star; break; } "+(" { *id = id__ExtGlob_Plus; break; } "?(" { *id = id__ExtGlob_QMark; break; } "!(" { *id = id__ExtGlob_Bang; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__SQ_Raw: for (;;) { /*!re2c [^'\x00]+ { *id = id__Lit_Chars; break; } "'" { *id = id__Right_SingleQuote; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__DQ: for (;;) { /*!re2c "\\" [$`"\\] { *id = id__Lit_EscapedChar; break; } "\\" { *id = id__Lit_BadBackslash; break; } "\\\n" { *id = id__Ignored_LineCont; break; } "`" { *id = id__Left_Backtick; break; } "$(" { *id = id__Left_DollarParen; break; } "${" { *id = id__Left_DollarBrace; break; } "$((" { *id = id__Left_DollarDParen; break; } "$[" { *id = id__Left_DollarBracket; break; } "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; } "$" [0-9] { *id = id__VSub_Number; break; } "$!" { *id = id__VSub_Bang; break; } "$@" { *id = id__VSub_At; break; } "$#" { *id = id__VSub_Pound; break; } "$$" { *id = id__VSub_Dollar; break; } "$*" { *id = id__VSub_Star; break; } "$-" { *id = id__VSub_Hyphen; break; } "$?" { *id = id__VSub_QMark; break; } [^$`"\x00\\]+ { *id = id__Lit_Chars; break; } "$" { *id = id__Lit_Dollar; break; } "\"" { *id = id__Right_DoubleQuote; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__SQ_C: for (;;) { /*!re2c "\\" "x" [0-9a-fA-F]{1,2} { *id = id__Char_Hex; break; } "\\" "u" [0-9a-fA-F]{1,4} { *id = id__Char_Unicode4; break; } "\\" "U" [0-9a-fA-F]{1,8} { *id = id__Char_Unicode8; break; } "\\" [uU]"{" [0-9a-fA-F]{1,6} "}" { *id = id__Char_UBraced; break; } "\\" [0abeEfrtnv\\] { *id = id__Char_OneChar; break; } "\\\n" { *id = id__Char_Literals; break; } "\\" { *id = id__Unknown_Backslash; break; } "\\" [0-7]{1,3} { *id = id__Char_Octal3; break; } "\\'" { *id = id__Char_OneChar; break; } "\\\"" { *id = id__Char_OneChar; break; } [^\\'\x00]+ { *id = id__Char_Literals; break; } "'" { *id = id__Right_SingleQuote; break; } "\\\x00" { *id = id__Unknown_Tok; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__Arith: for (;;) { /*!re2c "`" { *id = id__Left_Backtick; break; } "$(" { *id = id__Left_DollarParen; break; } "${" { *id = id__Left_DollarBrace; break; } "$((" { *id = id__Left_DollarDParen; break; } "$[" { *id = id__Left_DollarBracket; break; } "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; } "$" [0-9] { *id = id__VSub_Number; break; } "$!" { *id = id__VSub_Bang; break; } "$@" { *id = id__VSub_At; break; } "$#" { *id = id__VSub_Pound; break; } "$$" { *id = id__VSub_Dollar; break; } "$*" { *id = id__VSub_Star; break; } "$-" { *id = id__VSub_Hyphen; break; } "$?" { *id = id__VSub_QMark; break; } "\"" { *id = id__Left_DoubleQuote; break; } "'" { *id = id__Left_SingleQuote; break; } "$\"" { *id = id__Left_DollarDoubleQuote; break; } "$'" { *id = id__Left_DollarSingleQuote; break; } "<(" { *id = id__Left_ProcSubIn; break; } ">(" { *id = id__Left_ProcSubOut; break; } [ \t\r\n]+ { *id = id__Ignored_Space; break; } [a-zA-Z_][a-zA-Z0-9_]* { *id = id__Lit_ArithVarLike; break; } [0-9]+ { *id = id__Lit_Digits; break; } "@" { *id = id__Lit_At; break; } "#" { *id = id__Lit_Pound; break; } ";" { *id = id__Arith_Semi; break; } "," { *id = id__Arith_Comma; break; } "+" { *id = id__Arith_Plus; break; } "-" { *id = id__Arith_Minus; break; } "*" { *id = id__Arith_Star; break; } "/" { *id = id__Arith_Slash; break; } "%" { *id = id__Arith_Percent; break; } "++" { *id = id__Arith_DPlus; break; } "--" { *id = id__Arith_DMinus; break; } "**" { *id = id__Arith_DStar; break; } "(" { *id = id__Arith_LParen; break; } ")" { *id = id__Arith_RParen; break; } "[" { *id = id__Arith_LBracket; break; } "]" { *id = id__Arith_RBracket; break; } "}" { *id = id__Arith_RBrace; break; } "?" { *id = id__Arith_QMark; break; } ":" { *id = id__Arith_Colon; break; } "<=" { *id = id__Arith_LessEqual; break; } "<" { *id = id__Arith_Less; break; } ">=" { *id = id__Arith_GreatEqual; break; } ">" { *id = id__Arith_Great; break; } "==" { *id = id__Arith_DEqual; break; } "!=" { *id = id__Arith_NEqual; break; } "&&" { *id = id__Arith_DAmp; break; } "||" { *id = id__Arith_DPipe; break; } "!" { *id = id__Arith_Bang; break; } ">>" { *id = id__Arith_DGreat; break; } "<<" { *id = id__Arith_DLess; break; } "&" { *id = id__Arith_Amp; break; } "|" { *id = id__Arith_Pipe; break; } "^" { *id = id__Arith_Caret; break; } "~" { *id = id__Arith_Tilde; break; } "=" { *id = id__Arith_Equal; break; } "+=" { *id = id__Arith_PlusEqual; break; } "-=" { *id = id__Arith_MinusEqual; break; } "*=" { *id = id__Arith_StarEqual; break; } "/=" { *id = id__Arith_SlashEqual; break; } "%=" { *id = id__Arith_PercentEqual; break; } ">>=" { *id = id__Arith_DGreatEqual; break; } "<<=" { *id = id__Arith_DLessEqual; break; } "&=" { *id = id__Arith_AmpEqual; break; } "|=" { *id = id__Arith_PipeEqual; break; } "^=" { *id = id__Arith_CaretEqual; break; } "\\\n" { *id = id__Ignored_LineCont; break; } [^\x00] { *id = id__Unknown_Tok; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__ExtGlob: for (;;) { /*!re2c "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; } "\\\n" { *id = id__Ignored_LineCont; break; } "`" { *id = id__Left_Backtick; break; } "$(" { *id = id__Left_DollarParen; break; } "${" { *id = id__Left_DollarBrace; break; } "$((" { *id = id__Left_DollarDParen; break; } "$[" { *id = id__Left_DollarBracket; break; } "\"" { *id = id__Left_DoubleQuote; break; } "'" { *id = id__Left_SingleQuote; break; } "$\"" { *id = id__Left_DollarDoubleQuote; break; } "$'" { *id = id__Left_DollarSingleQuote; break; } "<(" { *id = id__Left_ProcSubIn; break; } ">(" { *id = id__Left_ProcSubOut; break; } "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; } "$" [0-9] { *id = id__VSub_Number; break; } "$!" { *id = id__VSub_Bang; break; } "$@" { *id = id__VSub_At; break; } "$#" { *id = id__VSub_Pound; break; } "$$" { *id = id__VSub_Dollar; break; } "$*" { *id = id__VSub_Star; break; } "$-" { *id = id__VSub_Hyphen; break; } "$?" { *id = id__VSub_QMark; break; } ",(" { *id = id__ExtGlob_Comma; break; } "@(" { *id = id__ExtGlob_At; break; } "*(" { *id = id__ExtGlob_Star; break; } "+(" { *id = id__ExtGlob_Plus; break; } "?(" { *id = id__ExtGlob_QMark; break; } "!(" { *id = id__ExtGlob_Bang; break; } [^\\$`"'|)@*+!?\x00]+ { *id = id__Lit_Chars; break; } "|" { *id = id__Op_Pipe; break; } ")" { *id = id__Op_RParen; break; } [^\x00] { *id = id__Lit_Other; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__VSub_1: for (;;) { /*!re2c [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_Name; break; } [0-9]+ { *id = id__VSub_Number; break; } "!" { *id = id__VSub_Bang; break; } "@" { *id = id__VSub_At; break; } "#" { *id = id__VSub_Pound; break; } "$" { *id = id__VSub_Dollar; break; } "*" { *id = id__VSub_Star; break; } "-" { *id = id__VSub_Hyphen; break; } "?" { *id = id__VSub_QMark; break; } "." { *id = id__VSub_Dot; break; } "}" { *id = id__Right_DollarBrace; break; } "\\\n" { *id = id__Ignored_LineCont; break; } "\n" { *id = id__Unknown_Tok; break; } [^\x00] { *id = id__Unknown_Tok; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__VSub_2: for (;;) { /*!re2c ":-" { *id = id__VTest_ColonHyphen; break; } "-" { *id = id__VTest_Hyphen; break; } ":=" { *id = id__VTest_ColonEquals; break; } "=" { *id = id__VTest_Equals; break; } ":?" { *id = id__VTest_ColonQMark; break; } "?" { *id = id__VTest_QMark; break; } ":+" { *id = id__VTest_ColonPlus; break; } "+" { *id = id__VTest_Plus; break; } "@Q" { *id = id__VOp0_Q; break; } "@E" { *id = id__VOp0_E; break; } "@P" { *id = id__VOp0_P; break; } "@A" { *id = id__VOp0_A; break; } "@a" { *id = id__VOp0_a; break; } "|" { *id = id__VOpOil_Pipe; break; } " " { *id = id__VOpOil_Space; break; } "%" { *id = id__VOp1_Percent; break; } "%%" { *id = id__VOp1_DPercent; break; } "#" { *id = id__VOp1_Pound; break; } "##" { *id = id__VOp1_DPound; break; } "^" { *id = id__VOp1_Caret; break; } "^^" { *id = id__VOp1_DCaret; break; } "," { *id = id__VOp1_Comma; break; } ",," { *id = id__VOp1_DComma; break; } "/" { *id = id__VOp2_Slash; break; } ":" { *id = id__VOp2_Colon; break; } "[" { *id = id__VOp2_LBracket; break; } "]" { *id = id__VOp2_RBracket; break; } "@" { *id = id__VOp3_At; break; } "*" { *id = id__VOp3_Star; break; } "}" { *id = id__Right_DollarBrace; break; } "\\\n" { *id = id__Ignored_LineCont; break; } "\n" { *id = id__Unknown_Tok; break; } [^\x00] { *id = id__Unknown_Tok; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__VSub_ArgUnquoted: for (;;) { /*!re2c "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; } "\\\n" { *id = id__Ignored_LineCont; break; } "/" { *id = id__Lit_Slash; break; } "#" { *id = id__Lit_Pound; break; } "%" { *id = id__Lit_Percent; break; } "}" { *id = id__Right_DollarBrace; break; } "$" { *id = id__Lit_Dollar; break; } "`" { *id = id__Left_Backtick; break; } "$(" { *id = id__Left_DollarParen; break; } "${" { *id = id__Left_DollarBrace; break; } "$((" { *id = id__Left_DollarDParen; break; } "$[" { *id = id__Left_DollarBracket; break; } "\"" { *id = id__Left_DoubleQuote; break; } "'" { *id = id__Left_SingleQuote; break; } "$\"" { *id = id__Left_DollarDoubleQuote; break; } "$'" { *id = id__Left_DollarSingleQuote; break; } "<(" { *id = id__Left_ProcSubIn; break; } ">(" { *id = id__Left_ProcSubOut; break; } "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; } "$" [0-9] { *id = id__VSub_Number; break; } "$!" { *id = id__VSub_Bang; break; } "$@" { *id = id__VSub_At; break; } "$#" { *id = id__VSub_Pound; break; } "$$" { *id = id__VSub_Dollar; break; } "$*" { *id = id__VSub_Star; break; } "$-" { *id = id__VSub_Hyphen; break; } "$?" { *id = id__VSub_QMark; break; } "~" [a-zA-Z0-9_.\-]* { *id = id__Lit_TildeLike; break; } [^$`/}"'\x00\\#%<>]+ { *id = id__Lit_Chars; break; } [^\x00] { *id = id__Lit_Other; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__VSub_ArgDQ: for (;;) { /*!re2c "\\" [$`"\\] { *id = id__Lit_EscapedChar; break; } "\\" { *id = id__Lit_BadBackslash; break; } "/" { *id = id__Lit_Slash; break; } "#" { *id = id__Lit_Pound; break; } "%" { *id = id__Lit_Percent; break; } "}" { *id = id__Right_DollarBrace; break; } "$" { *id = id__Lit_Dollar; break; } "`" { *id = id__Left_Backtick; break; } "$(" { *id = id__Left_DollarParen; break; } "${" { *id = id__Left_DollarBrace; break; } "$((" { *id = id__Left_DollarDParen; break; } "$[" { *id = id__Left_DollarBracket; break; } "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; } "$" [0-9] { *id = id__VSub_Number; break; } "$!" { *id = id__VSub_Bang; break; } "$@" { *id = id__VSub_At; break; } "$#" { *id = id__VSub_Pound; break; } "$$" { *id = id__VSub_Dollar; break; } "$*" { *id = id__VSub_Star; break; } "$-" { *id = id__VSub_Hyphen; break; } "$?" { *id = id__VSub_QMark; break; } "\\}" { *id = id__Lit_EscapedChar; break; } [^$`/}"\x00\\#%]+ { *id = id__Lit_Chars; break; } "\"" { *id = id__Left_DoubleQuote; break; } "$'" { *id = id__Left_DollarSingleQuote; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__BashRegex: for (;;) { /*!re2c "`" { *id = id__Left_Backtick; break; } "$(" { *id = id__Left_DollarParen; break; } "${" { *id = id__Left_DollarBrace; break; } "$((" { *id = id__Left_DollarDParen; break; } "$[" { *id = id__Left_DollarBracket; break; } "\"" { *id = id__Left_DoubleQuote; break; } "'" { *id = id__Left_SingleQuote; break; } "$\"" { *id = id__Left_DollarDoubleQuote; break; } "$'" { *id = id__Left_DollarSingleQuote; break; } "<(" { *id = id__Left_ProcSubIn; break; } ">(" { *id = id__Left_ProcSubOut; break; } "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; } "$" [0-9] { *id = id__VSub_Number; break; } "$!" { *id = id__VSub_Bang; break; } "$@" { *id = id__VSub_At; break; } "$#" { *id = id__VSub_Pound; break; } "$$" { *id = id__VSub_Dollar; break; } "$*" { *id = id__VSub_Star; break; } "$-" { *id = id__VSub_Hyphen; break; } "$?" { *id = id__VSub_QMark; break; } [a-zA-Z0-9_/\-]+ { *id = id__Lit_Chars; break; } "~" [a-zA-Z0-9_.\-]* { *id = id__Lit_TildeLike; break; } [ \t\r]+ { *id = id__WS_Space; break; } "\\" [*+?.^$[\]] { *id = id__Lit_RegexMeta; break; } [^\x00] { *id = id__Lit_Other; break; } "\\" [^\n\x00] { *id = id__Lit_EscapedChar; break; } "\\\n" { *id = id__Ignored_LineCont; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__PrintfOuter: for (;;) { /*!re2c "\\" "x" [0-9a-fA-F]{1,2} { *id = id__Char_Hex; break; } "\\" "u" [0-9a-fA-F]{1,4} { *id = id__Char_Unicode4; break; } "\\" "U" [0-9a-fA-F]{1,8} { *id = id__Char_Unicode8; break; } "\\" [uU]"{" [0-9a-fA-F]{1,6} "}" { *id = id__Char_UBraced; break; } "\\" [0abeEfrtnv\\] { *id = id__Char_OneChar; break; } "\\\n" { *id = id__Char_Literals; break; } "\\" { *id = id__Unknown_Backslash; break; } "\\" [0-7]{1,3} { *id = id__Char_Octal3; break; } [^%\\\x00]+ { *id = id__Char_Literals; break; } "%%" { *id = id__Format_EscapedPercent; break; } "%" { *id = id__Format_Percent; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__PrintfPercent: for (;;) { /*!re2c [\- +#] { *id = id__Format_Flag; break; } "0" { *id = id__Format_Zero; break; } [1-9][0-9]* { *id = id__Format_Num; break; } "*" { *id = id__Format_Star; break; } "." { *id = id__Format_Dot; break; } [disqbcouxXeEfFgG] { *id = id__Format_Type; break; } "(" [^()]* ")" "T" { *id = id__Format_Time; break; } [^\x00] { *id = id__Unknown_Tok; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__Expr: for (;;) { /*!re2c "$" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__VSub_DollarName; break; } "$" [0-9] { *id = id__VSub_Number; break; } "$!" { *id = id__VSub_Bang; break; } "$@" { *id = id__VSub_At; break; } "$#" { *id = id__VSub_Pound; break; } "$$" { *id = id__VSub_Dollar; break; } "$*" { *id = id__VSub_Star; break; } "$-" { *id = id__VSub_Hyphen; break; } "$?" { *id = id__VSub_QMark; break; } "$(" { *id = id__Left_DollarParen; break; } "${" { *id = id__Left_DollarBrace; break; } "$[" { *id = id__Left_DollarBracket; break; } "\"" { *id = id__Left_DoubleQuote; break; } "'" { *id = id__Left_SingleQuote; break; } "r'" { *id = id__Left_RSingleQuote; break; } "$'" { *id = id__Left_DollarSingleQuote; break; } "\"\"\"" { *id = id__Left_TDoubleQuote; break; } "'''" { *id = id__Left_TSingleQuote; break; } "r'''" { *id = id__Left_RTSingleQuote; break; } "$'''" { *id = id__Left_DollarTSingleQuote; break; } "@(" { *id = id__Left_AtParen; break; } "^(" { *id = id__Left_CaretParen; break; } "^[" { *id = id__Left_CaretBracket; break; } "^{" { *id = id__Left_CaretBrace; break; } "%(" { *id = id__Left_PercentParen; break; } "%[" { *id = id__Expr_Reserved; break; } "%{" { *id = id__Expr_Reserved; break; } "@{" { *id = id__Expr_Reserved; break; } "@[" { *id = id__Expr_Reserved; break; } ";" { *id = id__Op_Semi; break; } "(" { *id = id__Op_LParen; break; } ")" { *id = id__Op_RParen; break; } "[" { *id = id__Op_LBracket; break; } "]" { *id = id__Op_RBracket; break; } "{" { *id = id__Op_LBrace; break; } "}" { *id = id__Op_RBrace; break; } "null" { *id = id__Expr_Null; break; } "true" { *id = id__Expr_True; break; } "false" { *id = id__Expr_False; break; } "and" { *id = id__Expr_And; break; } "or" { *id = id__Expr_Or; break; } "not" { *id = id__Expr_Not; break; } "for" { *id = id__Expr_For; break; } "while" { *id = id__Expr_While; break; } "is" { *id = id__Expr_Is; break; } "in" { *id = id__Expr_In; break; } "if" { *id = id__Expr_If; break; } "else" { *id = id__Expr_Else; break; } "func" { *id = id__Expr_Func; break; } "virtual" { *id = id__Expr_Virtual; break; } "override" { *id = id__Expr_Override; break; } "abstract" { *id = id__Expr_Abstract; break; } "as" { *id = id__Expr_As; break; } "break" { *id = id__Expr_Break; break; } "continue" { *id = id__Expr_Continue; break; } "return" { *id = id__Expr_Return; break; } "\\" [0rtn\\"'] { *id = id__Char_OneChar; break; } "\\" "x" [0-9a-fA-F]{2,2} { *id = id__Char_Hex; break; } "#" "'" [^']"'" { *id = id__Char_Pound; break; } "\\" [uU]"{" [0-9a-fA-F]{1,6} "}" { *id = id__Char_UBraced; break; } "0" { *id = id__Expr_DecInt; break; } [1-9]("_" ? [0-9])* { *id = id__Expr_DecInt; break; } "0" [bB]("_" ? [01])+ { *id = id__Expr_BinInt; break; } "0" [oO]("_" ? [0-7])+ { *id = id__Expr_OctInt; break; } "0" [xX]("_" ? [0-9a-fA-F])+ { *id = id__Expr_HexInt; break; } [0-9]+ ("." [0-9]* )? ([eE][+\-]? [0-9]+ )? { *id = id__Expr_Float; break; } [a-zA-Z_][a-zA-Z0-9_]* { *id = id__Expr_Name; break; } "%" [a-zA-Z_][a-zA-Z0-9_]* { *id = id__Expr_Symbol; break; } "," { *id = id__Arith_Comma; break; } ":" { *id = id__Arith_Colon; break; } "?" { *id = id__Arith_QMark; break; } "+" { *id = id__Arith_Plus; break; } "-" { *id = id__Arith_Minus; break; } "*" { *id = id__Arith_Star; break; } "^" { *id = id__Arith_Caret; break; } "/" { *id = id__Arith_Slash; break; } "%" { *id = id__Arith_Percent; break; } "**" { *id = id__Arith_DStar; break; } "++" { *id = id__Arith_DPlus; break; } "<" { *id = id__Arith_Less; break; } ">" { *id = id__Arith_Great; break; } "<=" { *id = id__Arith_LessEqual; break; } ">=" { *id = id__Arith_GreatEqual; break; } "===" { *id = id__Expr_TEqual; break; } "!==" { *id = id__Expr_NotDEqual; break; } "&" { *id = id__Arith_Amp; break; } "|" { *id = id__Arith_Pipe; break; } ">>" { *id = id__Arith_DGreat; break; } "<<" { *id = id__Arith_DLess; break; } "~" { *id = id__Arith_Tilde; break; } "!~" { *id = id__Expr_NotTilde; break; } "~~" { *id = id__Expr_DTilde; break; } "!~~" { *id = id__Expr_NotDTilde; break; } "=" { *id = id__Arith_Equal; break; } "+=" { *id = id__Arith_PlusEqual; break; } "-=" { *id = id__Arith_MinusEqual; break; } "*=" { *id = id__Arith_StarEqual; break; } "/=" { *id = id__Arith_SlashEqual; break; } "%=" { *id = id__Arith_PercentEqual; break; } "&=" { *id = id__Arith_AmpEqual; break; } "|=" { *id = id__Arith_PipeEqual; break; } "^=" { *id = id__Arith_CaretEqual; break; } ">>=" { *id = id__Arith_DGreatEqual; break; } "<<=" { *id = id__Arith_DLessEqual; break; } "!" { *id = id__Expr_Bang; break; } "//" { *id = id__Expr_DSlash; break; } "~==" { *id = id__Expr_TildeDEqual; break; } "." { *id = id__Expr_Dot; break; } "::" { *id = id__Expr_DColon; break; } "->" { *id = id__Expr_RArrow; break; } "$" { *id = id__Expr_Dollar; break; } "<-" { *id = id__Expr_Reserved; break; } "=>" { *id = id__Expr_RDArrow; break; } "..." { *id = id__Expr_Ellipsis; break; } "///" { *id = id__Expr_Reserved; break; } "@" { *id = id__Expr_At; break; } "@@" { *id = id__Expr_DoubleAt; break; } "\n" { *id = id__Op_Newline; break; } "#" [^\n\x00]* { *id = id__Ignored_Comment; break; } [ \t\r]+ { *id = id__Ignored_Space; break; } "\\\n" { *id = id__Ignored_LineCont; break; } [^\x00] { *id = id__Unknown_Tok; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; case lex_mode__QSN: for (;;) { /*!re2c "\\" [nrt0'"\\] { *id = id__Char_OneChar; break; } "\\" "x" [0-9a-fA-F]{2,2} { *id = id__Char_Hex; break; } "\\" [uU]"{" [0-9a-fA-F]{1,6} "}" { *id = id__Char_UBraced; break; } [^\\'\x00\t\n]+ { *id = id__Char_Literals; break; } "'" { *id = id__Right_SingleQuote; break; } [^\x00] { *id = id__Unknown_Tok; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } break; default: assert(0); } *end_pos = p - line; /* relative */ } static inline void MatchEchoToken(const unsigned char* line, int line_len, int start_pos, int* id, int* end_pos) { assert(start_pos <= line_len); /* caller should have checked */ const unsigned char* p = line + start_pos; /* modified by re2c */ /* Echo and History lexer apparently need this, but others don't */ const unsigned char* YYMARKER; for (;;) { /*!re2c "\\" "x" [0-9a-fA-F]{1,2} { *id = id__Char_Hex; break; } "\\" "u" [0-9a-fA-F]{1,4} { *id = id__Char_Unicode4; break; } "\\" "U" [0-9a-fA-F]{1,8} { *id = id__Char_Unicode8; break; } "\\" [uU]"{" [0-9a-fA-F]{1,6} "}" { *id = id__Char_UBraced; break; } "\\" [0abeEfrtnv\\] { *id = id__Char_OneChar; break; } "\\\n" { *id = id__Char_Literals; break; } "\\" { *id = id__Unknown_Backslash; break; } "\\" "0" [0-7]{1,3} { *id = id__Char_Octal4; break; } "\\c" { *id = id__Char_Stop; break; } [^\\\x00]+ { *id = id__Char_Literals; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } *end_pos = p - line; /* relative */ } static inline void MatchGlobToken(const unsigned char* line, int line_len, int start_pos, int* id, int* end_pos) { assert(start_pos <= line_len); /* caller should have checked */ const unsigned char* p = line + start_pos; /* modified by re2c */ /* Echo and History lexer apparently need this, but others don't */ const unsigned char* YYMARKER; for (;;) { /*!re2c "*" { *id = id__Glob_Star; break; } "?" { *id = id__Glob_QMark; break; } "!" { *id = id__Glob_Bang; break; } "^" { *id = id__Glob_Caret; break; } "[" { *id = id__Glob_LBracket; break; } "]" { *id = id__Glob_RBracket; break; } "\\" [^\x00] { *id = id__Glob_EscapedChar; break; } "\\" { *id = id__Glob_BadBackslash; break; } [a-zA-Z0-9_]+ { *id = id__Glob_CleanLiterals; break; } [^\x00] { *id = id__Glob_OtherLiteral; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } *end_pos = p - line; /* relative */ } static inline void MatchPS1Token(const unsigned char* line, int line_len, int start_pos, int* id, int* end_pos) { assert(start_pos <= line_len); /* caller should have checked */ const unsigned char* p = line + start_pos; /* modified by re2c */ /* Echo and History lexer apparently need this, but others don't */ const unsigned char* YYMARKER; for (;;) { /*!re2c "\\" [0-7]{1,3} { *id = id__PS_Octal3; break; } "\\" [adehHjlnrstT@AuvVwW!#$\\] { *id = id__PS_Subst; break; } "\\[" { *id = id__PS_LBrace; break; } "\\]" { *id = id__PS_RBrace; break; } [^\\\x00]+ { *id = id__PS_Literals; break; } "\\" { *id = id__PS_BadBackslash; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } *end_pos = p - line; /* relative */ } static inline void MatchHistoryToken(const unsigned char* line, int line_len, int start_pos, int* id, int* end_pos) { assert(start_pos <= line_len); /* caller should have checked */ const unsigned char* p = line + start_pos; /* modified by re2c */ /* Echo and History lexer apparently need this, but others don't */ const unsigned char* YYMARKER; for (;;) { /*!re2c "!" [!*^$] { *id = id__History_Op; break; } "!" "-" ? [0-9]+ { *id = id__History_Num; break; } "!" "?" ? [a-zA-Z_/.][0-9a-zA-Z_/.]+ [ \t\r\n] { *id = id__History_Search; break; } "#" [^\x00]* { *id = id__History_Other; break; } "'" [^'\x00]* "'" ? { *id = id__History_Other; break; } [^!\\'#\x00]+ { *id = id__History_Other; break; } "\\" [^\x00] { *id = id__History_Other; break; } [^\x00] { *id = id__History_Other; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } *end_pos = p - line; /* relative */ } static inline void MatchBraceRangeToken(const unsigned char* line, int line_len, int start_pos, int* id, int* end_pos) { assert(start_pos <= line_len); /* caller should have checked */ const unsigned char* p = line + start_pos; /* modified by re2c */ /* Echo and History lexer apparently need this, but others don't */ const unsigned char* YYMARKER; for (;;) { /*!re2c "-" ? [0-9]+ { *id = id__Range_Int; break; } [a-zA-Z] { *id = id__Range_Char; break; } "." "." { *id = id__Range_Dots; break; } [^\x00] { *id = id__Range_Other; break; } "\x00" { *id = id__Eol_Tok; *end_pos = start_pos; return; } */ } *end_pos = p - line; /* relative */ } static inline void MatchOption(const unsigned char* s, int len, int* id) { const unsigned char* p = s; /* modified by re2c */ const unsigned char* end = s + len; const unsigned char* YYMARKER; //fprintf(stderr, "*** s = %s\n", s); for (;;) { /*!re2c "errexit" { *id = 1; break; } "nounset" { *id = 2; break; } "pipefail" { *id = 3; break; } "inherit_errexit" { *id = 4; break; } "nullglob" { *id = 5; break; } "noexec" { *id = 6; break; } "xtrace" { *id = 7; break; } "verbose" { *id = 8; break; } "noglob" { *id = 9; break; } "noclobber" { *id = 10; break; } "posix" { *id = 11; break; } "vi" { *id = 12; break; } "emacs" { *id = 13; break; } "interactive" { *id = 14; break; } "hashall" { *id = 15; break; } "failglob" { *id = 16; break; } "extglob" { *id = 17; break; } "eval_unsafe_arith" { *id = 18; break; } "parse_dynamic_arith" { *id = 19; break; } "compat_array" { *id = 20; break; } "verbose_errexit" { *id = 21; break; } "allow_command_sub" { *id = 22; break; } "dynamic_scope" { *id = 23; break; } "redefine_module" { *id = 24; break; } "_running_trap" { *id = 25; break; } "strict_argv" { *id = 26; break; } "strict_arith" { *id = 27; break; } "strict_array" { *id = 28; break; } "strict_control_flow" { *id = 29; break; } "strict_errexit" { *id = 30; break; } "strict_nameref" { *id = 31; break; } "strict_word_eval" { *id = 32; break; } "strict_tilde" { *id = 33; break; } "strict_glob" { *id = 34; break; } "parse_at" { *id = 35; break; } "parse_brace" { *id = 36; break; } "parse_paren" { *id = 37; break; } "parse_raw_string" { *id = 38; break; } "parse_triple_quote" { *id = 39; break; } "simple_word_eval" { *id = 40; break; } "dashglob" { *id = 41; break; } "expand_aliases" { *id = 42; break; } "command_sub_errexit" { *id = 43; break; } "process_sub_fail" { *id = 44; break; } "xtrace_rich" { *id = 45; break; } "xtrace_details" { *id = 46; break; } "sigpipe_status_ok" { *id = 47; break; } "redefine_proc" { *id = 48; break; } "parse_equals" { *id = 49; break; } "parse_at_all" { *id = 50; break; } "parse_backslash" { *id = 51; break; } "parse_backticks" { *id = 52; break; } "parse_dollar" { *id = 53; break; } "parse_ignored" { *id = 54; break; } "parse_amp" { *id = 55; break; } "simple_echo" { *id = 56; break; } "simple_eval_builtin" { *id = 57; break; } "simple_test_builtin" { *id = 58; break; } "parse_tea" { *id = 59; break; } "lastpipe" { *id = 60; break; } "progcomp" { *id = 61; break; } "histappend" { *id = 62; break; } "hostcomplete" { *id = 63; break; } "cmdhist" { *id = 64; break; } "assoc_expand_once" { *id = 65; break; } "autocd" { *id = 66; break; } "cdable_vars" { *id = 67; break; } "cdspell" { *id = 68; break; } "checkhash" { *id = 69; break; } "checkjobs" { *id = 70; break; } "checkwinsize" { *id = 71; break; } "complete_fullquote" { *id = 72; break; } "direxpand" { *id = 73; break; } "dirspell" { *id = 74; break; } "dotglob" { *id = 75; break; } "execfail" { *id = 76; break; } "extdebug" { *id = 77; break; } "extquote" { *id = 78; break; } "force_fignore" { *id = 79; break; } "globasciiranges" { *id = 80; break; } "globstar" { *id = 81; break; } "gnu_errfmt" { *id = 82; break; } "histreedit" { *id = 83; break; } "histverify" { *id = 84; break; } "huponexit" { *id = 85; break; } "interactive_comments" { *id = 86; break; } "lithist" { *id = 87; break; } "localvar_inherit" { *id = 88; break; } "localvar_unset" { *id = 89; break; } "login_shell" { *id = 90; break; } "mailwarn" { *id = 91; break; } "no_empty_cmd_completion" { *id = 92; break; } "nocaseglob" { *id = 93; break; } "nocasematch" { *id = 94; break; } "progcomp_alias" { *id = 95; break; } "promptvars" { *id = 96; break; } "restricted_shell" { *id = 97; break; } "shift_verbose" { *id = 98; break; } "sourcepath" { *id = 99; break; } "xpg_echo" { *id = 100; break; } * { *id = 0; return; } */ } if (p != end) { //fprintf(stderr, "EXTRA CHARS\n", s); *id = 0; // Not an exact match } } static inline int IsValidVarName(const unsigned char* s, int len) { const unsigned char* p = s; /* modified by re2c */ const unsigned char* end = s + len; /* MatchBraceRangeToken needs this, but others don't */ const unsigned char* YYMARKER; /*!re2c re2c:define:YYCTYPE = "unsigned char"; re2c:define:YYCURSOR = p; [a-zA-Z_][a-zA-Z0-9_]* { return p == end; } // Match must be anchored right, like $ * { return 0; } */ } static inline int ShouldHijack(const unsigned char* s, int len) { const unsigned char* p = s; /* modified by re2c */ const unsigned char* end = s + len; /* MatchBraceRangeToken needs this, but others don't */ const unsigned char* YYMARKER; /*!re2c re2c:define:YYCTYPE = "unsigned char"; re2c:define:YYCURSOR = p; "#" "!" .* "s" "h" [ \t\r\n][^\x00]* { return p == end; } // Match must be anchored right, like $ * { return 0; } */ } static inline int BracketUnary(const unsigned char* s, int len) { const unsigned char* p = s; /* modified by re2c */ const unsigned char* end = s + len; const unsigned char* YYMARKER; int id; for (;;) { /*!re2c "-G" { id = id__BoolUnary_G; break; } "-L" { id = id__BoolUnary_L; break; } "-N" { id = id__BoolUnary_N; break; } "-O" { id = id__BoolUnary_O; break; } "-R" { id = id__BoolUnary_R; break; } "-S" { id = id__BoolUnary_S; break; } "-a" { id = id__BoolUnary_a; break; } "-b" { id = id__BoolUnary_b; break; } "-c" { id = id__BoolUnary_c; break; } "-d" { id = id__BoolUnary_d; break; } "-e" { id = id__BoolUnary_e; break; } "-f" { id = id__BoolUnary_f; break; } "-g" { id = id__BoolUnary_g; break; } "-h" { id = id__BoolUnary_h; break; } "-k" { id = id__BoolUnary_k; break; } "-n" { id = id__BoolUnary_n; break; } "-o" { id = id__BoolUnary_o; break; } "-p" { id = id__BoolUnary_p; break; } "-r" { id = id__BoolUnary_r; break; } "-s" { id = id__BoolUnary_s; break; } "-t" { id = id__BoolUnary_t; break; } "-u" { id = id__BoolUnary_u; break; } "-v" { id = id__BoolUnary_v; break; } "-w" { id = id__BoolUnary_w; break; } "-x" { id = id__BoolUnary_x; break; } "-z" { id = id__BoolUnary_z; break; } * { return id__Undefined_Tok; } */ } // must be an exact match return (p == end) ? id : id__Undefined_Tok; } static inline int BracketBinary(const unsigned char* s, int len) { const unsigned char* p = s; /* modified by re2c */ const unsigned char* end = s + len; const unsigned char* YYMARKER; int id; for (;;) { /*!re2c "!=" { id = id__BoolBinary_NEqual; break; } "-ef" { id = id__BoolBinary_ef; break; } "-eq" { id = id__BoolBinary_eq; break; } "-ge" { id = id__BoolBinary_ge; break; } "-gt" { id = id__BoolBinary_gt; break; } "-le" { id = id__BoolBinary_le; break; } "-lt" { id = id__BoolBinary_lt; break; } "-ne" { id = id__BoolBinary_ne; break; } "-nt" { id = id__BoolBinary_nt; break; } "-ot" { id = id__BoolBinary_ot; break; } "<" { id = id__Op_Less; break; } "=" { id = id__BoolBinary_Equal; break; } "==" { id = id__BoolBinary_DEqual; break; } ">" { id = id__Op_Great; break; } * { return id__Undefined_Tok; } */ } // must be an exact match return (p == end) ? id : id__Undefined_Tok; } static inline int BracketOther(const unsigned char* s, int len) { const unsigned char* p = s; /* modified by re2c */ const unsigned char* end = s + len; const unsigned char* YYMARKER; int id; for (;;) { /*!re2c "!" { id = id__KW_Bang; break; } "(" { id = id__Op_LParen; break; } ")" { id = id__Op_RParen; break; } "]" { id = id__Arith_RBracket; break; } * { return id__Undefined_Tok; } */ } // must be an exact match return (p == end) ? id : id__Undefined_Tok; }