From 177f4b79fe3fad37c99b8ce89343193c53fa73a6 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Fri, 1 Nov 2019 19:13:50 +0100 Subject: [PATCH] ENH: use direct scanning mode when lexing #eval expressions --- applications/test/dictionary/testDictEval1 | 6 +- .../strings/parsing/genericRagelLemonDriver.C | 6 +- .../strings/parsing/genericRagelLemonDriver.H | 4 +- .../stringOps/toScalar/evalStringToScalar.H | 5 +- .../toScalar/evalStringToScalarDriver.C | 6 +- .../toScalar/evalStringToScalarDriver.H | 18 +- .../evalStringToScalarLemonParser.lyy | 84 +- .../toScalar/evalStringToScalarParser.H | 9 +- .../toScalar/evalStringToScalarScanner.H | 6 +- .../toScalar/evalStringToScalarScanner.cc | 2045 ++++++++++------- .../toScalar/evalStringToScalarScanner.rl | 111 +- 11 files changed, 1363 insertions(+), 937 deletions(-) diff --git a/applications/test/dictionary/testDictEval1 b/applications/test/dictionary/testDictEval1 index 290585dd1e..be30ca643e 100644 --- a/applications/test/dictionary/testDictEval1 +++ b/applications/test/dictionary/testDictEval1 @@ -2,7 +2,7 @@ | ========= | | | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox | | \\ / O peration | Version: Any | -| \\ / A nd | Web: www.OpenFOAM.com | +| \\ / A nd | Website: www.openfoam.com | | \\/ M anipulation | | \*---------------------------------------------------------------------------*/ FoamFile @@ -43,7 +43,9 @@ cosh(0.1) #eval{cosh(0.1)}; sqrt100 #eval{((sqrt(100)))}; -random #eval{ floor(1000*rand()) }; +float 12.345; +ceil #eval{ ceil($float) }; +floor #eval{ floor($float) }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.C b/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.C index db0bf56759..4fbcb6078e 100644 --- a/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.C +++ b/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.C @@ -1,9 +1,11 @@ -/*--------------------------------*- C++ -*----------------------------------*\ +/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.H b/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.H index e762a266d7..4bea329e1c 100644 --- a/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.H +++ b/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.H @@ -2,8 +2,10 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalar.H b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalar.H index e04d7d2cac..5d7873df0f 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalar.H +++ b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalar.H @@ -2,8 +2,10 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -54,6 +56,7 @@ namespace stringOps // - misc: floor, ceil, round, rand, rand(seed) // // \note The rand() function returns a uniform scalar on [0-1] interval + // and uses a constant seed scalar toScalar ( const std::string& s, diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.C b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.C index ac99cccd56..4fc7c14ed6 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.C +++ b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.C @@ -1,9 +1,11 @@ -/*--------------------------------*- C++ -*----------------------------------*\ +/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.H b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.H index fb7fddec7e..f8c6794d16 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.H +++ b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.H @@ -2,8 +2,10 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -56,23 +58,11 @@ class parseDriver : public genericRagelLemonDriver { -protected: - - // Protected Data + // Private Data //- The result scalar value_; - - // Protected Member Functions - - // No copy copy construct - parseDriver(const parseDriver&) = delete; - - // No copy assignment - void operator=(const parseDriver&) = delete; - - public: ClassName("evalStringToScalar::driver"); diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.lyy b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.lyy index ff3560881a..c5d05436a7 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.lyy +++ b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.lyy @@ -3,8 +3,10 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -51,72 +53,43 @@ Description %token_prefix TOK_ +// Terminals %token_type {Foam::scalar} +// Non-terminals %type exp {Foam::scalar} %left PLUS MINUS. %left TIMES DIVIDE. %left NEGATE. +%start_symbol evaluate evaluate ::= exp(a). { driver->setValue(a); } -exp(lhs) ::= NUMBER(a). -{ - lhs = a; -} +exp(lhs) ::= NUMBER(a). { lhs = a; } +exp(lhs) ::= MINUS exp(a). [NEGATE] { lhs = -a; } -exp(lhs) ::= MINUS exp(a). // Could add [NEGATE] precedence -{ - lhs = -a; -} +// Operations -exp(lhs) ::= exp(a) PLUS exp(b). -{ - lhs = a + b; -} +exp(lhs) ::= exp(a) PLUS exp(b). { lhs = a + b; } +exp(lhs) ::= exp(a) MINUS exp(b). { lhs = a - b; } +exp(lhs) ::= exp(a) TIMES exp(b). { lhs = a * b; } +exp(lhs) ::= exp(a) DIVIDE exp(b). { lhs = a / b; } +exp(lhs) ::= LPAREN exp(a) RPAREN. { lhs = a; } -exp(lhs) ::= exp(a) MINUS exp(b). -{ - lhs = a - b; -} -exp(lhs) ::= exp(a) TIMES exp(b). -{ - lhs = a * b; -} +// Constants -exp(lhs) ::= exp(a) DIVIDE exp(b). -{ - lhs = a / b; -} - -exp(lhs) ::= LPAREN exp(a) RPAREN. -{ - lhs = a; -} +exp(lhs) ::= PI LPAREN RPAREN. { lhs = Foam::constant::mathematical::pi; } +exp(lhs) ::= DEG_TO_RAD LPAREN RPAREN. { lhs = Foam::degToRad(); } +exp(lhs) ::= RAD_TO_DEG LPAREN RPAREN. { lhs = Foam::radToDeg(); } // Functions -exp(lhs) ::= PI LPAREN RPAREN. -{ - lhs = Foam::constant::mathematical::pi; -} - -exp(lhs) ::= DEG_TO_RAD LPAREN RPAREN. -{ - lhs = Foam::degToRad(); -} - -exp(lhs) ::= RAD_TO_DEG LPAREN RPAREN. -{ - lhs = Foam::radToDeg(); -} - exp(lhs) ::= DEG_TO_RAD LPAREN exp(a) RPAREN. { lhs = Foam::degToRad(a); @@ -297,6 +270,27 @@ void Foam::parsing::evalStringToScalar::parser::parse } +Foam::word Foam::parsing::evalStringToScalar::parser::nameOfToken +( + int tokenId +) const +{ + #ifndef NDEBUG + if + ( + tokenId > 0 + && unsigned(tokenId) < (sizeof(yyTokenName) / sizeof(char*)) + ) + { + return yyTokenName[tokenId]; + } + return ""; + #else + return word(); + #endif +} + + // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // } // End of %code diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarParser.H b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarParser.H index a82a8791f1..ebaad788e9 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarParser.H +++ b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarParser.H @@ -1,9 +1,11 @@ -/*--------------------------------*- C++ -*----------------------------------*\ +/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -80,6 +82,9 @@ public: //- Push token/value to parser void parse(int tokenId, Foam::scalar val); + + //- The text name corresponding to the tokenId + word nameOfToken(int tokenId) const; }; // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * // diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.H b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.H index 770a637019..36badad3ed 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.H +++ b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.H @@ -1,9 +1,11 @@ -/*--------------------------------*- C++ -*----------------------------------*\ +/*---------------------------------------------------------------------------*\ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.cc b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.cc index 473543ff77..333347f376 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.cc +++ b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.cc @@ -4,8 +4,10 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -34,13 +36,11 @@ Description #include "evalStringToScalarLemonParser.h" #include "evalStringToScalarParser.H" #include "error.H" +#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wold-style-cast" -#ifndef FULLDEBUG -#define NDEBUG -#endif // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -58,11 +58,11 @@ int Foam::parsing::evalStringToScalar::scanner::debug = 0; #line 61 "evalStringToScalarScanner.cc" -static const int evalScanner_start = 96; -static const int evalScanner_first_final = 96; +static const int evalScanner_start = 4; +static const int evalScanner_first_final = 4; static const int evalScanner_error = 0; -static const int evalScanner_en_main = 96; +static const int evalScanner_en_main = 4; #line 60 "evalStringToScalarScanner.rl" @@ -71,13 +71,13 @@ static const int evalScanner_en_main = 96; #define TOKEN_OF(T) TOK_##T #define EMIT_TOKEN(T) \ driver.parsePosition() = (ts-buf); \ - DebugInfo<< "TOKEN_" #T << " at " << driver.parsePosition() << nl; \ + DebugInfo<< STRINGIFY(T) << ": " << driver.parsePosition() << nl; \ parser_->parse(TOKEN_OF(T), 0); \ driver.parsePosition() = (p-buf); -#line 149 "evalStringToScalarScanner.rl" +#line 160 "evalStringToScalarScanner.rl" @@ -151,7 +151,7 @@ bool Foam::parsing::evalStringToScalar::scanner::process act = 0; } -#line 213 "evalStringToScalarScanner.rl" +#line 224 "evalStringToScalarScanner.rl" /* ^^^ FSM initialization here ^^^ */; @@ -179,234 +179,46 @@ tr2: } else { - // Catch range errors + // Range error driver.reportFatal("Error parsing number"); } driver.parsePosition() = (p-buf); }} - goto st96; -tr10: -#line 125 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(ACOS); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr13: -#line 124 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(ASIN); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr17: -#line 126 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(ATAN); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr19: -#line 127 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(ATAN2); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr25: -#line 120 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(CBRT); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr28: -#line 137 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(CEIL); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr31: -#line 122 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(COS); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr33: -#line 130 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(COSH); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr41: -#line 112 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(DEG_TO_RAD); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr44: -#line 114 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(EXP); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr49: -#line 136 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(FLOOR); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr54: -#line 128 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(HYPOT); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr58: -#line 115 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(LOG); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr61: + goto st4; +tr6: #line 116 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(LOG10); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr67: -#line 134 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(MAG); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr71: -#line 135 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(MAGSQR); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr72: -#line 133 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(MAX); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr74: -#line 132 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(MIN); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr77: -#line 111 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(PI); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr79: + {te = p+1;{ EMIT_TOKEN(LPAREN); }} + goto st4; +tr7: #line 117 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(POW); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr89: -#line 113 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(RAD_TO_DEG); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr91: -#line 139 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(RAND); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr95: -#line 138 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(ROUND); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr100: -#line 121 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(SIN); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr102: -#line 129 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(SINH); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr105: + {te = p+1;{ EMIT_TOKEN(RPAREN); }} + goto st4; +tr8: +#line 120 "evalStringToScalarScanner.rl" + {te = p+1;{ EMIT_TOKEN(TIMES); }} + goto st4; +tr9: #line 118 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(SQR); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr107: + {te = p+1;{ EMIT_TOKEN(PLUS); }} + goto st4; +tr10: +#line 122 "evalStringToScalarScanner.rl" + {te = p+1;{ EMIT_TOKEN(COMMA); }} + goto st4; +tr11: #line 119 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(SQRT); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr111: -#line 123 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(TAN); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr113: -#line 131 "evalStringToScalarScanner.rl" - { p--; EMIT_TOKEN(TANH); } -#line 146 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr115: -#line 101 "evalStringToScalarScanner.rl" - { EMIT_TOKEN(LPAREN); } -#line 145 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr116: -#line 102 "evalStringToScalarScanner.rl" - { EMIT_TOKEN(RPAREN); } -#line 145 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr117: -#line 105 "evalStringToScalarScanner.rl" - { EMIT_TOKEN(TIMES); } -#line 145 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr118: -#line 103 "evalStringToScalarScanner.rl" - { EMIT_TOKEN(PLUS); } -#line 145 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr119: -#line 107 "evalStringToScalarScanner.rl" - { EMIT_TOKEN(COMMA); } -#line 145 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr120: -#line 104 "evalStringToScalarScanner.rl" - { EMIT_TOKEN(MINUS); } -#line 145 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr122: -#line 106 "evalStringToScalarScanner.rl" - { EMIT_TOKEN(DIVIDE); } -#line 145 "evalStringToScalarScanner.rl" - {te = p+1;} - goto st96; -tr136: -#line 143 "evalStringToScalarScanner.rl" + {te = p+1;{ EMIT_TOKEN(MINUS); }} + goto st4; +tr13: +#line 121 "evalStringToScalarScanner.rl" + {te = p+1;{ EMIT_TOKEN(DIVIDE); }} + goto st4; +tr28: +#line 111 "evalStringToScalarScanner.rl" {te = p;p--;} - goto st96; -tr137: + goto st4; +tr29: #line 73 "evalStringToScalarScanner.rl" {te = p;p--;{ driver.parsePosition() = (ts-buf); @@ -424,63 +236,189 @@ tr137: } else { - // Catch range errors + // Range error driver.reportFatal("Error parsing number"); } driver.parsePosition() = (p-buf); }} - goto st96; -st96: + goto st4; +tr31: +#line 96 "evalStringToScalarScanner.rl" + {te = p;p--;{ + driver.parsePosition() = (ts-buf); + const word ident = word::validate(ts, te); + + driver.reportFatal("Unknown function/type: " + ident); + driver.parsePosition() = (p-buf); + }} + goto st4; +tr33: +#line 1 "NONE" + { switch( act ) { + case 10: + {{p = ((te))-1;} EMIT_TOKEN(PI); } + break; + case 11: + {{p = ((te))-1;} EMIT_TOKEN(DEG_TO_RAD); } + break; + case 12: + {{p = ((te))-1;} EMIT_TOKEN(RAD_TO_DEG); } + break; + case 13: + {{p = ((te))-1;} EMIT_TOKEN(EXP); } + break; + case 15: + {{p = ((te))-1;} EMIT_TOKEN(LOG10); } + break; + case 16: + {{p = ((te))-1;} EMIT_TOKEN(POW); } + break; + case 18: + {{p = ((te))-1;} EMIT_TOKEN(SQRT); } + break; + case 19: + {{p = ((te))-1;} EMIT_TOKEN(CBRT); } + break; + case 23: + {{p = ((te))-1;} EMIT_TOKEN(ASIN); } + break; + case 24: + {{p = ((te))-1;} EMIT_TOKEN(ACOS); } + break; + case 26: + {{p = ((te))-1;} EMIT_TOKEN(ATAN2); } + break; + case 27: + {{p = ((te))-1;} EMIT_TOKEN(HYPOT); } + break; + case 28: + {{p = ((te))-1;} EMIT_TOKEN(SINH); } + break; + case 29: + {{p = ((te))-1;} EMIT_TOKEN(COSH); } + break; + case 30: + {{p = ((te))-1;} EMIT_TOKEN(TANH); } + break; + case 31: + {{p = ((te))-1;} EMIT_TOKEN(MIN); } + break; + case 32: + {{p = ((te))-1;} EMIT_TOKEN(MAX); } + break; + case 34: + {{p = ((te))-1;} EMIT_TOKEN(MAGSQR); } + break; + case 35: + {{p = ((te))-1;} EMIT_TOKEN(FLOOR); } + break; + case 36: + {{p = ((te))-1;} EMIT_TOKEN(CEIL); } + break; + case 37: + {{p = ((te))-1;} EMIT_TOKEN(ROUND); } + break; + case 38: + {{p = ((te))-1;} p--; EMIT_TOKEN(RAND); } + break; + case 39: + {{p = ((te))-1;} + driver.parsePosition() = (ts-buf); + const word ident = word::validate(ts, te); + + driver.reportFatal("Unknown function/type: " + ident); + driver.parsePosition() = (p-buf); + } + break; + } + } + goto st4; +tr43: +#line 140 "evalStringToScalarScanner.rl" + {te = p;p--;{ EMIT_TOKEN(ATAN); }} + goto st4; +tr53: +#line 136 "evalStringToScalarScanner.rl" + {te = p;p--;{ EMIT_TOKEN(COS); }} + goto st4; +tr74: +#line 129 "evalStringToScalarScanner.rl" + {te = p;p--;{ EMIT_TOKEN(LOG); }} + goto st4; +tr81: +#line 148 "evalStringToScalarScanner.rl" + {te = p;p--;{ EMIT_TOKEN(MAG); }} + goto st4; +tr105: +#line 135 "evalStringToScalarScanner.rl" + {te = p;p--;{ EMIT_TOKEN(SIN); }} + goto st4; +tr108: +#line 132 "evalStringToScalarScanner.rl" + {te = p;p--;{ EMIT_TOKEN(SQR); }} + goto st4; +tr112: +#line 137 "evalStringToScalarScanner.rl" + {te = p;p--;{ EMIT_TOKEN(TAN); }} + goto st4; +st4: #line 1 "NONE" {ts = 0;} if ( ++p == pe ) - goto _test_eof96; -case 96: + goto _test_eof4; +case 4: #line 1 "NONE" {ts = p;} -#line 443 "evalStringToScalarScanner.cc" +#line 374 "evalStringToScalarScanner.cc" switch( (*p) ) { - case 32: goto st97; - case 40: goto tr115; - case 41: goto tr116; - case 42: goto tr117; - case 43: goto tr118; - case 44: goto tr119; - case 45: goto tr120; + case 32: goto st5; + case 40: goto tr6; + case 41: goto tr7; + case 42: goto tr8; + case 43: goto tr9; + case 44: goto tr10; + case 45: goto tr11; case 46: goto st1; - case 47: goto tr122; - case 97: goto st4; - case 99: goto st16; - case 100: goto st27; - case 101: goto st35; - case 102: goto st38; - case 104: goto st43; - case 108: goto st48; - case 109: goto st54; - case 112: goto st64; - case 114: goto st68; - case 115: goto st82; - case 116: goto st91; + case 47: goto tr13; + case 95: goto st9; + case 97: goto st11; + case 99: goto st19; + case 100: goto st26; + case 101: goto st33; + case 102: goto st35; + case 104: goto st39; + case 108: goto st43; + case 109: goto st47; + case 112: goto st53; + case 114: goto st55; + case 115: goto st66; + case 116: goto st71; } - if ( (*p) > 13 ) { - if ( 48 <= (*p) && (*p) <= 57 ) - goto tr123; - } else if ( (*p) >= 9 ) - goto st97; + if ( (*p) < 48 ) { + if ( 9 <= (*p) && (*p) <= 13 ) + goto st5; + } else if ( (*p) > 57 ) { + if ( (*p) > 90 ) { + if ( 98 <= (*p) && (*p) <= 122 ) + goto st9; + } else if ( (*p) >= 65 ) + goto st9; + } else + goto tr14; goto st0; st0: cs = 0; goto _out; -st97: +st5: if ( ++p == pe ) - goto _test_eof97; -case 97: + goto _test_eof5; +case 5: if ( (*p) == 32 ) - goto st97; + goto st5; if ( 9 <= (*p) && (*p) <= 13 ) - goto st97; - goto tr136; + goto st5; + goto tr28; st1: if ( ++p == pe ) goto _test_eof1; @@ -491,19 +429,19 @@ case 1: tr0: #line 1 "NONE" {te = p+1;} - goto st98; -st98: + goto st6; +st6: if ( ++p == pe ) - goto _test_eof98; -case 98: -#line 500 "evalStringToScalarScanner.cc" + goto _test_eof6; +case 6: +#line 438 "evalStringToScalarScanner.cc" switch( (*p) ) { case 69: goto st2; case 101: goto st2; } if ( 48 <= (*p) && (*p) <= 57 ) goto tr0; - goto tr137; + goto tr29; st2: if ( ++p == pe ) goto _test_eof2; @@ -513,864 +451,1296 @@ case 2: case 45: goto st3; } if ( 48 <= (*p) && (*p) <= 57 ) - goto st99; + goto st7; goto tr2; st3: if ( ++p == pe ) goto _test_eof3; case 3: if ( 48 <= (*p) && (*p) <= 57 ) - goto st99; + goto st7; goto tr2; -st99: +st7: if ( ++p == pe ) - goto _test_eof99; -case 99: + goto _test_eof7; +case 7: if ( 48 <= (*p) && (*p) <= 57 ) - goto st99; - goto tr137; -tr123: + goto st7; + goto tr29; +tr14: #line 1 "NONE" {te = p+1;} - goto st100; -st100: + goto st8; +st8: if ( ++p == pe ) - goto _test_eof100; -case 100: -#line 541 "evalStringToScalarScanner.cc" + goto _test_eof8; +case 8: +#line 479 "evalStringToScalarScanner.cc" switch( (*p) ) { case 46: goto tr0; case 69: goto st2; case 101: goto st2; } if ( 48 <= (*p) && (*p) <= 57 ) - goto tr123; - goto tr137; -st4: - if ( ++p == pe ) - goto _test_eof4; -case 4: - switch( (*p) ) { - case 99: goto st5; - case 115: goto st8; - case 116: goto st11; - } - goto st0; -st5: - if ( ++p == pe ) - goto _test_eof5; -case 5: - if ( (*p) == 111 ) - goto st6; - goto st0; -st6: - if ( ++p == pe ) - goto _test_eof6; -case 6: - if ( (*p) == 115 ) - goto st7; - goto st0; -st7: - if ( ++p == pe ) - goto _test_eof7; -case 7: - switch( (*p) ) { - case 32: goto st7; - case 40: goto tr10; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st7; - goto st0; -st8: - if ( ++p == pe ) - goto _test_eof8; -case 8: - if ( (*p) == 105 ) - goto st9; - goto st0; + goto tr14; + goto tr29; st9: if ( ++p == pe ) goto _test_eof9; case 9: - if ( (*p) == 110 ) - goto st10; - goto st0; + if ( (*p) == 95 ) + goto tr32; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; +tr32: +#line 1 "NONE" + {te = p+1;} +#line 96 "evalStringToScalarScanner.rl" + {act = 39;} + goto st10; +tr38: +#line 1 "NONE" + {te = p+1;} +#line 139 "evalStringToScalarScanner.rl" + {act = 24;} + goto st10; +tr40: +#line 1 "NONE" + {te = p+1;} +#line 138 "evalStringToScalarScanner.rl" + {act = 23;} + goto st10; +tr44: +#line 1 "NONE" + {te = p+1;} +#line 141 "evalStringToScalarScanner.rl" + {act = 26;} + goto st10; +tr49: +#line 1 "NONE" + {te = p+1;} +#line 134 "evalStringToScalarScanner.rl" + {act = 19;} + goto st10; +tr51: +#line 1 "NONE" + {te = p+1;} +#line 151 "evalStringToScalarScanner.rl" + {act = 36;} + goto st10; +tr54: +#line 1 "NONE" + {te = p+1;} +#line 144 "evalStringToScalarScanner.rl" + {act = 29;} + goto st10; +tr61: +#line 1 "NONE" + {te = p+1;} +#line 126 "evalStringToScalarScanner.rl" + {act = 11;} + goto st10; +tr63: +#line 1 "NONE" + {te = p+1;} +#line 128 "evalStringToScalarScanner.rl" + {act = 13;} + goto st10; +tr67: +#line 1 "NONE" + {te = p+1;} +#line 150 "evalStringToScalarScanner.rl" + {act = 35;} + goto st10; +tr71: +#line 1 "NONE" + {te = p+1;} +#line 142 "evalStringToScalarScanner.rl" + {act = 27;} + goto st10; +tr76: +#line 1 "NONE" + {te = p+1;} +#line 130 "evalStringToScalarScanner.rl" + {act = 15;} + goto st10; +tr80: +#line 1 "NONE" + {te = p+1;} +#line 147 "evalStringToScalarScanner.rl" + {act = 32;} + goto st10; +tr84: +#line 1 "NONE" + {te = p+1;} +#line 149 "evalStringToScalarScanner.rl" + {act = 34;} + goto st10; +tr85: +#line 1 "NONE" + {te = p+1;} +#line 146 "evalStringToScalarScanner.rl" + {act = 31;} + goto st10; +tr86: +#line 1 "NONE" + {te = p+1;} +#line 125 "evalStringToScalarScanner.rl" + {act = 10;} + goto st10; +tr88: +#line 1 "NONE" + {te = p+1;} +#line 131 "evalStringToScalarScanner.rl" + {act = 16;} + goto st10; +tr97: +#line 1 "NONE" + {te = p+1;} +#line 127 "evalStringToScalarScanner.rl" + {act = 12;} + goto st10; +tr98: +#line 1 "NONE" + {te = p+1;} +#line 153 "evalStringToScalarScanner.rl" + {act = 38;} + goto st10; +tr101: +#line 1 "NONE" + {te = p+1;} +#line 152 "evalStringToScalarScanner.rl" + {act = 37;} + goto st10; +tr106: +#line 1 "NONE" + {te = p+1;} +#line 143 "evalStringToScalarScanner.rl" + {act = 28;} + goto st10; +tr109: +#line 1 "NONE" + {te = p+1;} +#line 133 "evalStringToScalarScanner.rl" + {act = 18;} + goto st10; +tr113: +#line 1 "NONE" + {te = p+1;} +#line 145 "evalStringToScalarScanner.rl" + {act = 30;} + goto st10; st10: if ( ++p == pe ) goto _test_eof10; case 10: - switch( (*p) ) { - case 32: goto st10; - case 40: goto tr13; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st10; - goto st0; +#line 645 "evalStringToScalarScanner.cc" + if ( (*p) == 95 ) + goto tr32; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr33; st11: if ( ++p == pe ) goto _test_eof11; case 11: - if ( (*p) == 97 ) - goto st12; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 99: goto st12; + case 115: goto st14; + case 116: goto st16; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st12: if ( ++p == pe ) goto _test_eof12; case 12: - if ( (*p) == 110 ) - goto st13; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 111: goto st13; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st13: if ( ++p == pe ) goto _test_eof13; case 13: switch( (*p) ) { - case 32: goto st14; - case 40: goto tr17; - case 50: goto st15; + case 95: goto tr32; + case 115: goto tr38; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st14; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st14: if ( ++p == pe ) goto _test_eof14; case 14: switch( (*p) ) { - case 32: goto st14; - case 40: goto tr17; + case 95: goto tr32; + case 105: goto st15; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st14; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st15: if ( ++p == pe ) goto _test_eof15; case 15: switch( (*p) ) { - case 32: goto st15; - case 40: goto tr19; + case 95: goto tr32; + case 110: goto tr40; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st15; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st16: if ( ++p == pe ) goto _test_eof16; case 16: switch( (*p) ) { - case 98: goto st17; - case 101: goto st20; - case 111: goto st23; + case 95: goto tr32; + case 97: goto st17; } - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 98 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st17: if ( ++p == pe ) goto _test_eof17; case 17: - if ( (*p) == 114 ) - goto st18; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 110: goto st18; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st18: if ( ++p == pe ) goto _test_eof18; case 18: - if ( (*p) == 116 ) - goto st19; - goto st0; + switch( (*p) ) { + case 50: goto tr44; + case 95: goto tr32; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr43; st19: if ( ++p == pe ) goto _test_eof19; case 19: switch( (*p) ) { - case 32: goto st19; - case 40: goto tr25; + case 95: goto tr32; + case 98: goto st20; + case 101: goto st22; + case 111: goto st24; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st19; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st20: if ( ++p == pe ) goto _test_eof20; case 20: - if ( (*p) == 105 ) - goto st21; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 114: goto st21; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st21: if ( ++p == pe ) goto _test_eof21; case 21: - if ( (*p) == 108 ) - goto st22; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 116: goto tr49; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st22: if ( ++p == pe ) goto _test_eof22; case 22: switch( (*p) ) { - case 32: goto st22; - case 40: goto tr28; + case 95: goto tr32; + case 105: goto st23; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st22; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st23: if ( ++p == pe ) goto _test_eof23; case 23: - if ( (*p) == 115 ) - goto st24; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 108: goto tr51; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st24: if ( ++p == pe ) goto _test_eof24; case 24: switch( (*p) ) { - case 32: goto st25; - case 40: goto tr31; - case 104: goto st26; + case 95: goto tr32; + case 115: goto st25; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st25; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st25: if ( ++p == pe ) goto _test_eof25; case 25: switch( (*p) ) { - case 32: goto st25; - case 40: goto tr31; + case 95: goto tr32; + case 104: goto tr54; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st25; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr53; st26: if ( ++p == pe ) goto _test_eof26; case 26: switch( (*p) ) { - case 32: goto st26; - case 40: goto tr33; + case 95: goto tr32; + case 101: goto st27; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st26; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st27: if ( ++p == pe ) goto _test_eof27; case 27: - if ( (*p) == 101 ) - goto st28; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 103: goto st28; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st28: if ( ++p == pe ) goto _test_eof28; case 28: - if ( (*p) == 103 ) - goto st29; - goto st0; + switch( (*p) ) { + case 84: goto st29; + case 95: goto tr32; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st29: if ( ++p == pe ) goto _test_eof29; case 29: - if ( (*p) == 84 ) - goto st30; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 111: goto st30; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st30: if ( ++p == pe ) goto _test_eof30; case 30: - if ( (*p) == 111 ) - goto st31; - goto st0; + switch( (*p) ) { + case 82: goto st31; + case 95: goto tr32; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st31: if ( ++p == pe ) goto _test_eof31; case 31: - if ( (*p) == 82 ) - goto st32; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 97: goto st32; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 98 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st32: if ( ++p == pe ) goto _test_eof32; case 32: - if ( (*p) == 97 ) - goto st33; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 100: goto tr61; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st33: if ( ++p == pe ) goto _test_eof33; case 33: - if ( (*p) == 100 ) - goto st34; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 120: goto st34; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st34: if ( ++p == pe ) goto _test_eof34; case 34: switch( (*p) ) { - case 32: goto st34; - case 40: goto tr41; + case 95: goto tr32; + case 112: goto tr63; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st34; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st35: if ( ++p == pe ) goto _test_eof35; case 35: - if ( (*p) == 120 ) - goto st36; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 108: goto st36; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st36: if ( ++p == pe ) goto _test_eof36; case 36: - if ( (*p) == 112 ) - goto st37; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 111: goto st37; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st37: if ( ++p == pe ) goto _test_eof37; case 37: switch( (*p) ) { - case 32: goto st37; - case 40: goto tr44; + case 95: goto tr32; + case 111: goto st38; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st37; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st38: if ( ++p == pe ) goto _test_eof38; case 38: - if ( (*p) == 108 ) - goto st39; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 114: goto tr67; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st39: if ( ++p == pe ) goto _test_eof39; case 39: - if ( (*p) == 111 ) - goto st40; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 121: goto st40; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st40: if ( ++p == pe ) goto _test_eof40; case 40: - if ( (*p) == 111 ) - goto st41; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 112: goto st41; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st41: if ( ++p == pe ) goto _test_eof41; case 41: - if ( (*p) == 114 ) - goto st42; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 111: goto st42; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st42: if ( ++p == pe ) goto _test_eof42; case 42: switch( (*p) ) { - case 32: goto st42; - case 40: goto tr49; + case 95: goto tr32; + case 116: goto tr71; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st42; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st43: if ( ++p == pe ) goto _test_eof43; case 43: - if ( (*p) == 121 ) - goto st44; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 111: goto st44; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st44: if ( ++p == pe ) goto _test_eof44; case 44: - if ( (*p) == 112 ) - goto st45; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 103: goto st45; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st45: if ( ++p == pe ) goto _test_eof45; case 45: - if ( (*p) == 111 ) - goto st46; - goto st0; + switch( (*p) ) { + case 49: goto st46; + case 95: goto tr32; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr74; st46: if ( ++p == pe ) goto _test_eof46; case 46: - if ( (*p) == 116 ) - goto st47; - goto st0; + switch( (*p) ) { + case 48: goto tr76; + case 95: goto tr32; + } + if ( (*p) < 65 ) { + if ( 49 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st47: if ( ++p == pe ) goto _test_eof47; case 47: switch( (*p) ) { - case 32: goto st47; - case 40: goto tr54; + case 95: goto tr32; + case 97: goto st48; + case 105: goto st52; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st47; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 98 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st48: if ( ++p == pe ) goto _test_eof48; case 48: - if ( (*p) == 111 ) - goto st49; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 103: goto st49; + case 120: goto tr80; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st49: if ( ++p == pe ) goto _test_eof49; case 49: - if ( (*p) == 103 ) - goto st50; - goto st0; + switch( (*p) ) { + case 83: goto st50; + case 95: goto tr32; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr81; st50: if ( ++p == pe ) goto _test_eof50; case 50: switch( (*p) ) { - case 32: goto st51; - case 40: goto tr58; - case 49: goto st52; + case 95: goto tr32; + case 113: goto st51; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st51; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st51: if ( ++p == pe ) goto _test_eof51; case 51: switch( (*p) ) { - case 32: goto st51; - case 40: goto tr58; + case 95: goto tr32; + case 114: goto tr84; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st51; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st52: if ( ++p == pe ) goto _test_eof52; case 52: - if ( (*p) == 48 ) - goto st53; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 110: goto tr85; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st53: if ( ++p == pe ) goto _test_eof53; case 53: switch( (*p) ) { - case 32: goto st53; - case 40: goto tr61; + case 95: goto tr32; + case 105: goto tr86; + case 111: goto st54; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st53; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st54: if ( ++p == pe ) goto _test_eof54; case 54: switch( (*p) ) { - case 97: goto st55; - case 105: goto st62; + case 95: goto tr32; + case 119: goto tr88; } - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st55: if ( ++p == pe ) goto _test_eof55; case 55: switch( (*p) ) { - case 103: goto st56; - case 120: goto st61; + case 95: goto tr32; + case 97: goto st56; + case 111: goto st63; } - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 98 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st56: if ( ++p == pe ) goto _test_eof56; case 56: switch( (*p) ) { - case 32: goto st57; - case 40: goto tr67; - case 83: goto st58; + case 95: goto tr32; + case 100: goto st57; + case 110: goto st62; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st57; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st57: if ( ++p == pe ) goto _test_eof57; case 57: switch( (*p) ) { - case 32: goto st57; - case 40: goto tr67; + case 84: goto st58; + case 95: goto tr32; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st57; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st58: if ( ++p == pe ) goto _test_eof58; case 58: - if ( (*p) == 113 ) - goto st59; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 111: goto st59; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st59: if ( ++p == pe ) goto _test_eof59; case 59: - if ( (*p) == 114 ) - goto st60; - goto st0; + switch( (*p) ) { + case 68: goto st60; + case 95: goto tr32; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st60: if ( ++p == pe ) goto _test_eof60; case 60: switch( (*p) ) { - case 32: goto st60; - case 40: goto tr71; + case 95: goto tr32; + case 101: goto st61; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st60; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st61: if ( ++p == pe ) goto _test_eof61; case 61: switch( (*p) ) { - case 32: goto st61; - case 40: goto tr72; + case 95: goto tr32; + case 103: goto tr97; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st61; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st62: if ( ++p == pe ) goto _test_eof62; case 62: - if ( (*p) == 110 ) - goto st63; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 100: goto tr98; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st63: if ( ++p == pe ) goto _test_eof63; case 63: switch( (*p) ) { - case 32: goto st63; - case 40: goto tr74; + case 95: goto tr32; + case 117: goto st64; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st63; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st64: if ( ++p == pe ) goto _test_eof64; case 64: switch( (*p) ) { - case 105: goto st65; - case 111: goto st66; + case 95: goto tr32; + case 110: goto st65; } - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st65: if ( ++p == pe ) goto _test_eof65; case 65: switch( (*p) ) { - case 32: goto st65; - case 40: goto tr77; + case 95: goto tr32; + case 100: goto tr101; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st65; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st66: if ( ++p == pe ) goto _test_eof66; case 66: - if ( (*p) == 119 ) - goto st67; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 105: goto st67; + case 113: goto st69; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st67: if ( ++p == pe ) goto _test_eof67; case 67: switch( (*p) ) { - case 32: goto st67; - case 40: goto tr79; + case 95: goto tr32; + case 110: goto st68; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st67; - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st68: if ( ++p == pe ) goto _test_eof68; case 68: switch( (*p) ) { - case 97: goto st69; - case 111: goto st78; + case 95: goto tr32; + case 104: goto tr106; } - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr105; st69: if ( ++p == pe ) goto _test_eof69; case 69: switch( (*p) ) { - case 100: goto st70; - case 110: goto st76; + case 95: goto tr32; + case 114: goto st70; } - goto st0; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st70: if ( ++p == pe ) goto _test_eof70; case 70: - if ( (*p) == 84 ) - goto st71; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 116: goto tr109; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr108; st71: if ( ++p == pe ) goto _test_eof71; case 71: - if ( (*p) == 111 ) - goto st72; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 97: goto st72; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 98 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st72: if ( ++p == pe ) goto _test_eof72; case 72: - if ( (*p) == 68 ) - goto st73; - goto st0; + switch( (*p) ) { + case 95: goto tr32; + case 110: goto st73; + } + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr31; st73: if ( ++p == pe ) goto _test_eof73; case 73: - if ( (*p) == 101 ) - goto st74; - goto st0; -st74: - if ( ++p == pe ) - goto _test_eof74; -case 74: - if ( (*p) == 103 ) - goto st75; - goto st0; -st75: - if ( ++p == pe ) - goto _test_eof75; -case 75: switch( (*p) ) { - case 32: goto st75; - case 40: goto tr89; + case 95: goto tr32; + case 104: goto tr113; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st75; - goto st0; -st76: - if ( ++p == pe ) - goto _test_eof76; -case 76: - if ( (*p) == 100 ) - goto st77; - goto st0; -st77: - if ( ++p == pe ) - goto _test_eof77; -case 77: - switch( (*p) ) { - case 32: goto st77; - case 40: goto tr91; + if ( (*p) < 65 ) { + if ( 48 <= (*p) && (*p) <= 57 ) + goto tr32; + } else if ( (*p) > 90 ) { + if ( 97 <= (*p) && (*p) <= 122 ) + goto tr32; + } else + goto tr32; + goto tr112; } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st77; - goto st0; -st78: - if ( ++p == pe ) - goto _test_eof78; -case 78: - if ( (*p) == 117 ) - goto st79; - goto st0; -st79: - if ( ++p == pe ) - goto _test_eof79; -case 79: - if ( (*p) == 110 ) - goto st80; - goto st0; -st80: - if ( ++p == pe ) - goto _test_eof80; -case 80: - if ( (*p) == 100 ) - goto st81; - goto st0; -st81: - if ( ++p == pe ) - goto _test_eof81; -case 81: - switch( (*p) ) { - case 32: goto st81; - case 40: goto tr95; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st81; - goto st0; -st82: - if ( ++p == pe ) - goto _test_eof82; -case 82: - switch( (*p) ) { - case 105: goto st83; - case 113: goto st87; - } - goto st0; -st83: - if ( ++p == pe ) - goto _test_eof83; -case 83: - if ( (*p) == 110 ) - goto st84; - goto st0; -st84: - if ( ++p == pe ) - goto _test_eof84; -case 84: - switch( (*p) ) { - case 32: goto st85; - case 40: goto tr100; - case 104: goto st86; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st85; - goto st0; -st85: - if ( ++p == pe ) - goto _test_eof85; -case 85: - switch( (*p) ) { - case 32: goto st85; - case 40: goto tr100; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st85; - goto st0; -st86: - if ( ++p == pe ) - goto _test_eof86; -case 86: - switch( (*p) ) { - case 32: goto st86; - case 40: goto tr102; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st86; - goto st0; -st87: - if ( ++p == pe ) - goto _test_eof87; -case 87: - if ( (*p) == 114 ) - goto st88; - goto st0; -st88: - if ( ++p == pe ) - goto _test_eof88; -case 88: - switch( (*p) ) { - case 32: goto st89; - case 40: goto tr105; - case 116: goto st90; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st89; - goto st0; -st89: - if ( ++p == pe ) - goto _test_eof89; -case 89: - switch( (*p) ) { - case 32: goto st89; - case 40: goto tr105; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st89; - goto st0; -st90: - if ( ++p == pe ) - goto _test_eof90; -case 90: - switch( (*p) ) { - case 32: goto st90; - case 40: goto tr107; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st90; - goto st0; -st91: - if ( ++p == pe ) - goto _test_eof91; -case 91: - if ( (*p) == 97 ) - goto st92; - goto st0; -st92: - if ( ++p == pe ) - goto _test_eof92; -case 92: - if ( (*p) == 110 ) - goto st93; - goto st0; -st93: - if ( ++p == pe ) - goto _test_eof93; -case 93: - switch( (*p) ) { - case 32: goto st94; - case 40: goto tr111; - case 104: goto st95; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st94; - goto st0; -st94: - if ( ++p == pe ) - goto _test_eof94; -case 94: - switch( (*p) ) { - case 32: goto st94; - case 40: goto tr111; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st94; - goto st0; -st95: - if ( ++p == pe ) - goto _test_eof95; -case 95: - switch( (*p) ) { - case 32: goto st95; - case 40: goto tr113; - } - if ( 9 <= (*p) && (*p) <= 13 ) - goto st95; - goto st0; - } - _test_eof96: cs = 96; goto _test_eof; - _test_eof97: cs = 97; goto _test_eof; - _test_eof1: cs = 1; goto _test_eof; - _test_eof98: cs = 98; goto _test_eof; - _test_eof2: cs = 2; goto _test_eof; - _test_eof3: cs = 3; goto _test_eof; - _test_eof99: cs = 99; goto _test_eof; - _test_eof100: cs = 100; goto _test_eof; _test_eof4: cs = 4; goto _test_eof; _test_eof5: cs = 5; goto _test_eof; + _test_eof1: cs = 1; goto _test_eof; _test_eof6: cs = 6; goto _test_eof; + _test_eof2: cs = 2; goto _test_eof; + _test_eof3: cs = 3; goto _test_eof; _test_eof7: cs = 7; goto _test_eof; _test_eof8: cs = 8; goto _test_eof; _test_eof9: cs = 9; goto _test_eof; @@ -1438,46 +1808,89 @@ case 95: _test_eof71: cs = 71; goto _test_eof; _test_eof72: cs = 72; goto _test_eof; _test_eof73: cs = 73; goto _test_eof; - _test_eof74: cs = 74; goto _test_eof; - _test_eof75: cs = 75; goto _test_eof; - _test_eof76: cs = 76; goto _test_eof; - _test_eof77: cs = 77; goto _test_eof; - _test_eof78: cs = 78; goto _test_eof; - _test_eof79: cs = 79; goto _test_eof; - _test_eof80: cs = 80; goto _test_eof; - _test_eof81: cs = 81; goto _test_eof; - _test_eof82: cs = 82; goto _test_eof; - _test_eof83: cs = 83; goto _test_eof; - _test_eof84: cs = 84; goto _test_eof; - _test_eof85: cs = 85; goto _test_eof; - _test_eof86: cs = 86; goto _test_eof; - _test_eof87: cs = 87; goto _test_eof; - _test_eof88: cs = 88; goto _test_eof; - _test_eof89: cs = 89; goto _test_eof; - _test_eof90: cs = 90; goto _test_eof; - _test_eof91: cs = 91; goto _test_eof; - _test_eof92: cs = 92; goto _test_eof; - _test_eof93: cs = 93; goto _test_eof; - _test_eof94: cs = 94; goto _test_eof; - _test_eof95: cs = 95; goto _test_eof; _test_eof: {} if ( p == eof ) { switch ( cs ) { - case 97: goto tr136; - case 98: goto tr137; + case 5: goto tr28; + case 6: goto tr29; case 2: goto tr2; case 3: goto tr2; - case 99: goto tr137; - case 100: goto tr137; + case 7: goto tr29; + case 8: goto tr29; + case 9: goto tr31; + case 10: goto tr33; + case 11: goto tr31; + case 12: goto tr31; + case 13: goto tr31; + case 14: goto tr31; + case 15: goto tr31; + case 16: goto tr31; + case 17: goto tr31; + case 18: goto tr43; + case 19: goto tr31; + case 20: goto tr31; + case 21: goto tr31; + case 22: goto tr31; + case 23: goto tr31; + case 24: goto tr31; + case 25: goto tr53; + case 26: goto tr31; + case 27: goto tr31; + case 28: goto tr31; + case 29: goto tr31; + case 30: goto tr31; + case 31: goto tr31; + case 32: goto tr31; + case 33: goto tr31; + case 34: goto tr31; + case 35: goto tr31; + case 36: goto tr31; + case 37: goto tr31; + case 38: goto tr31; + case 39: goto tr31; + case 40: goto tr31; + case 41: goto tr31; + case 42: goto tr31; + case 43: goto tr31; + case 44: goto tr31; + case 45: goto tr74; + case 46: goto tr31; + case 47: goto tr31; + case 48: goto tr31; + case 49: goto tr81; + case 50: goto tr31; + case 51: goto tr31; + case 52: goto tr31; + case 53: goto tr31; + case 54: goto tr31; + case 55: goto tr31; + case 56: goto tr31; + case 57: goto tr31; + case 58: goto tr31; + case 59: goto tr31; + case 60: goto tr31; + case 61: goto tr31; + case 62: goto tr31; + case 63: goto tr31; + case 64: goto tr31; + case 65: goto tr31; + case 66: goto tr31; + case 67: goto tr31; + case 68: goto tr105; + case 69: goto tr31; + case 70: goto tr108; + case 71: goto tr31; + case 72: goto tr31; + case 73: goto tr112; } } _out: {} } -#line 215 "evalStringToScalarScanner.rl" +#line 226 "evalStringToScalarScanner.rl" /* ^^^ FSM execution here ^^^ */; if (0 == cs) diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.rl b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.rl index e9c2ea0663..ced51f2950 100644 --- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.rl +++ b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.rl @@ -2,8 +2,10 @@ ========= | \\ / F ield | OpenFOAM: The Open Source CFD Toolbox \\ / O peration | - \\ / A nd | Copyright (C) 2019 OpenCFD Ltd. + \\ / A nd | www.openfoam.com \\/ M anipulation | +------------------------------------------------------------------------------- + Copyright (C) 2019 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -32,13 +34,11 @@ Description #include "evalStringToScalarLemonParser.h" #include "evalStringToScalarParser.H" #include "error.H" +#include "macros.H" #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" #pragma GCC diagnostic ignored "-Wold-style-cast" -#ifndef FULLDEBUG -#define NDEBUG -#endif // * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * // @@ -62,7 +62,7 @@ int Foam::parsing::evalStringToScalar::scanner::debug = 0; #define TOKEN_OF(T) TOK_##T #define EMIT_TOKEN(T) \ driver.parsePosition() = (ts-buf); \ - DebugInfo<< "TOKEN_" #T << " at " << driver.parsePosition() << nl; \ + DebugInfo<< STRINGIFY(T) << ": " << driver.parsePosition() << nl; \ parser_->parse(TOKEN_OF(T), 0); \ driver.parsePosition() = (p-buf); @@ -86,64 +86,75 @@ int Foam::parsing::evalStringToScalar::scanner::debug = 0; } else { - // Catch range errors + // Range error driver.reportFatal("Error parsing number"); } driver.parsePosition() = (p-buf); } + action emit_ident { + driver.parsePosition() = (ts-buf); + const word ident = word::validate(ts, te); + + driver.reportFatal("Unknown function/type: " + ident); + driver.parsePosition() = (p-buf); + } + decimal = ((digit* '.' digit+) | (digit+ '.'?)) ; number = (digit+ | decimal) ([Ee][\-+]? digit+)? ; - lfunc = space* '('; # Require functions to have '(' + ident = ((alpha|'_') . ((alnum|'_')**)) ; - operators = ( - '(' @{ EMIT_TOKEN(LPAREN); } - | ')' @{ EMIT_TOKEN(RPAREN); } - | '+' @{ EMIT_TOKEN(PLUS); } - | '-' @{ EMIT_TOKEN(MINUS); } - | '*' @{ EMIT_TOKEN(TIMES); } - | '/' @{ EMIT_TOKEN(DIVIDE); } - | ',' @{ EMIT_TOKEN(COMMA); } - ); - - functions = ( - 'pi' lfunc @{ fhold; EMIT_TOKEN(PI); } - | 'degToRad' lfunc @{ fhold; EMIT_TOKEN(DEG_TO_RAD); } - | 'radToDeg' lfunc @{ fhold; EMIT_TOKEN(RAD_TO_DEG); } - | 'exp' lfunc @{ fhold; EMIT_TOKEN(EXP); } - | 'log' lfunc @{ fhold; EMIT_TOKEN(LOG); } - | 'log10' lfunc @{ fhold; EMIT_TOKEN(LOG10); } - | 'pow' lfunc @{ fhold; EMIT_TOKEN(POW); } - | 'sqr' lfunc @{ fhold; EMIT_TOKEN(SQR); } - | 'sqrt' lfunc @{ fhold; EMIT_TOKEN(SQRT); } - | 'cbrt' lfunc @{ fhold; EMIT_TOKEN(CBRT); } - | 'sin' lfunc @{ fhold; EMIT_TOKEN(SIN); } - | 'cos' lfunc @{ fhold; EMIT_TOKEN(COS); } - | 'tan' lfunc @{ fhold; EMIT_TOKEN(TAN); } - | 'asin' lfunc @{ fhold; EMIT_TOKEN(ASIN); } - | 'acos' lfunc @{ fhold; EMIT_TOKEN(ACOS); } - | 'atan' lfunc @{ fhold; EMIT_TOKEN(ATAN); } - | 'atan2' lfunc @{ fhold; EMIT_TOKEN(ATAN2); } - | 'hypot' lfunc @{ fhold; EMIT_TOKEN(HYPOT); } - | 'sinh' lfunc @{ fhold; EMIT_TOKEN(SINH); } - | 'cosh' lfunc @{ fhold; EMIT_TOKEN(COSH); } - | 'tanh' lfunc @{ fhold; EMIT_TOKEN(TANH); } - | 'min' lfunc @{ fhold; EMIT_TOKEN(MIN); } - | 'max' lfunc @{ fhold; EMIT_TOKEN(MAX); } - | 'mag' lfunc @{ fhold; EMIT_TOKEN(MAG); } - | 'magSqr' lfunc @{ fhold; EMIT_TOKEN(MAGSQR); } - | 'floor' lfunc @{ fhold; EMIT_TOKEN(FLOOR); } - | 'ceil' lfunc @{ fhold; EMIT_TOKEN(CEIL); } - | 'round' lfunc @{ fhold; EMIT_TOKEN(ROUND); } - | 'rand' lfunc @{ fhold; EMIT_TOKEN(RAND); } - ); + ## The scanner main := |* space*; + number => emit_number; - operators; - functions; + + ## operators + '(' => { EMIT_TOKEN(LPAREN); }; + ')' => { EMIT_TOKEN(RPAREN); }; + '+' => { EMIT_TOKEN(PLUS); }; + '-' => { EMIT_TOKEN(MINUS); }; + '*' => { EMIT_TOKEN(TIMES); }; + '/' => { EMIT_TOKEN(DIVIDE); }; + ',' => { EMIT_TOKEN(COMMA); }; + + ## Regular functions + 'pi' => { EMIT_TOKEN(PI); }; + 'degToRad' => { EMIT_TOKEN(DEG_TO_RAD); }; + 'radToDeg' => { EMIT_TOKEN(RAD_TO_DEG); }; + 'exp' => { EMIT_TOKEN(EXP); }; + 'log' => { EMIT_TOKEN(LOG); }; + 'log10' => { EMIT_TOKEN(LOG10); }; + 'pow' => { EMIT_TOKEN(POW); }; + 'sqr' => { EMIT_TOKEN(SQR); }; + 'sqrt' => { EMIT_TOKEN(SQRT); }; + 'cbrt' => { EMIT_TOKEN(CBRT); }; + 'sin' => { EMIT_TOKEN(SIN); }; + 'cos' => { EMIT_TOKEN(COS); }; + 'tan' => { EMIT_TOKEN(TAN); }; + 'asin' => { EMIT_TOKEN(ASIN); }; + 'acos' => { EMIT_TOKEN(ACOS); }; + 'atan' => { EMIT_TOKEN(ATAN); }; + 'atan2' => { EMIT_TOKEN(ATAN2); }; + 'hypot' => { EMIT_TOKEN(HYPOT); }; + 'sinh' => { EMIT_TOKEN(SINH); }; + 'cosh' => { EMIT_TOKEN(COSH); }; + 'tanh' => { EMIT_TOKEN(TANH); }; + 'min' => { EMIT_TOKEN(MIN); }; + 'max' => { EMIT_TOKEN(MAX); }; + 'mag' => { EMIT_TOKEN(MAG); }; + 'magSqr' => { EMIT_TOKEN(MAGSQR); }; + 'floor' => { EMIT_TOKEN(FLOOR); }; + 'ceil' => { EMIT_TOKEN(CEIL); }; + 'round' => { EMIT_TOKEN(ROUND); }; + 'rand' => { fhold; EMIT_TOKEN(RAND); }; + + ## Catch-all for identifiers/errors + ident => emit_ident; + space*; *|; }%%