diff --git a/applications/test/dictionary/testDictEval2 b/applications/test/dictionary/testDictEval2
index d7a6ac6736..5f53157740 100644
--- a/applications/test/dictionary/testDictEval2
+++ b/applications/test/dictionary/testDictEval2
@@ -58,5 +58,7 @@ eval8a #eval " pi() * 2 * ${{ ${factor$index} + ${factor10} }}";
eval8b #eval " pi() * 2 * $factor * ${{ 100 }}";
+eval10a #eval "vector(1,2,3) * 5";
+
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
diff --git a/applications/test/string2/Test-string2.C b/applications/test/string2/Test-string2.C
index 7709b19bfe..1ef7109805 100644
--- a/applications/test/string2/Test-string2.C
+++ b/applications/test/string2/Test-string2.C
@@ -132,6 +132,9 @@ int main(int argc, char *argv[])
"sqrt(2) = (${{ sqrt(2) }/* Truncated */",
"sqrt(2) = (${{ sqrt(2) * foo() }})/* bad expr */",
"huge = (${{ sqrt(123E+5000) }})/* range error */",
+
+ "vector=${{ 5 * vector(1,2,3) }}=",
+ "empty=${{ }}=",
}
)
{
diff --git a/src/OpenFOAM/Make/files b/src/OpenFOAM/Make/files
index b687560db9..d437839eba 100644
--- a/src/OpenFOAM/Make/files
+++ b/src/OpenFOAM/Make/files
@@ -134,10 +134,8 @@ $(strings)/lists/hashedWordList.C
$(strings)/parsing/parsing.C
$(strings)/parsing/genericRagelLemonDriver.C
$(strings)/stringOps/stringOps.C
+$(strings)/stringOps/stringOpsEvaluate.C
$(strings)/stringOps/stringOpsSort.C
-$(strings)/stringOps/toScalar/evalStringToScalarDriver.C
-$(strings)/stringOps/toScalar/evalStringToScalarLemonParser.lyy-m4
-$(strings)/stringOps/toScalar/evalStringToScalarScanner.cc
expr = expressions
$(expr)/exprEntry/expressionEntry.C
diff --git a/src/OpenFOAM/db/dictionary/functionEntries/evalEntry/evalEntry.C b/src/OpenFOAM/db/dictionary/functionEntries/evalEntry/evalEntry.C
index 0c19433a59..410fe29fa2 100644
--- a/src/OpenFOAM/db/dictionary/functionEntries/evalEntry/evalEntry.C
+++ b/src/OpenFOAM/db/dictionary/functionEntries/evalEntry/evalEntry.C
@@ -25,24 +25,21 @@ License
#include "evalEntry.H"
#include "dictionary.H"
+#include "OTstream.H"
#include "stringOps.H"
+#include "fieldExprDriver.H"
#include "addToMemberFunctionSelectionTable.H"
+#undef DetailInfo
+#define DetailInfo if (::Foam::infoDetailLevel > 0) InfoErr
+
+
// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
namespace Foam
{
namespace functionEntries
{
- addNamedToMemberFunctionSelectionTable
- (
- functionEntry,
- evalEntry,
- execute,
- dictionaryIstream,
- eval
- );
-
addNamedToMemberFunctionSelectionTable
(
functionEntry,
@@ -58,7 +55,7 @@ namespace functionEntries
// * * * * * * * * * * * * * Private Member Functions * * * * * * * * * * * //
-Foam::scalar Foam::functionEntries::evalEntry::evaluate
+Foam::tokenList Foam::functionEntries::evalEntry::evaluate
(
const dictionary& parentDict,
Istream& is
@@ -80,7 +77,8 @@ Foam::scalar Foam::functionEntries::evalEntry::evaluate
FatalIOErrorInFunction(is)
<< "Bad token - could not get string to evaluate"
<< exit(FatalIOError);
- return 0;
+
+ return tokenList();
}
if (tok.isString())
@@ -111,7 +109,9 @@ Foam::scalar Foam::functionEntries::evalEntry::evaluate
stringOps::inplaceExpand(s, parentDict, true, true);
stringOps::inplaceTrim(s);
- // A common input error, so catch it now
+ // An extraneous trailing ';' is a common input error, catch it now.
+ // May need to relax in the future, trim or something else
+
if (std::string::npos != s.find(';'))
{
FatalIOErrorInFunction(is)
@@ -128,13 +128,35 @@ Foam::scalar Foam::functionEntries::evalEntry::evaluate
if (s.empty())
{
InfoErr
- << "Empty #eval (treat as 0) - line "
+ << "Empty #eval - line "
<< is.lineNumber() << " in file " << parentDict.name() << nl;
- return scalar(0);
+ return tokenList();
}
- return stringOps::toScalar(s);
+ expressions::exprResult result;
+ {
+ expressions::fieldExprDriver driver(1);
+ driver.parse(s);
+ result = std::move(driver.result());
+ }
+
+ if (!result.hasValue() || !result.size())
+ {
+ InfoErr
+ << "Failed #eval - line "
+ << is.lineNumber() << " in file " << parentDict.name() << nl;
+
+ return tokenList();
+ }
+
+ // Could average/reduce to a single value, but probably not needed
+ //// result.testIfSingleValue(false); // No parallel check
+
+ OTstream toks;
+ result.writeValue(toks);
+
+ return toks;
}
@@ -147,37 +169,9 @@ bool Foam::functionEntries::evalEntry::execute
Istream& is
)
{
- const scalar value = evaluate(parentDict, is);
+ tokenList toks(evaluate(parentDict, is));
- // The result as terminated token entry
- ITstream result
- (
- "eval",
- tokenList({token(value), token(token::END_STATEMENT)})
- );
-
- entry.read(parentDict, result);
-
- return true;
-}
-
-
-bool Foam::functionEntries::evalEntry::execute
-(
- dictionary& parentDict,
- Istream& is
-)
-{
- const scalar value = evaluate(parentDict, is);
-
- // The result as terminated token entry
- ITstream result
- (
- "eval",
- tokenList({token(value), token(token::END_STATEMENT)})
- );
-
- parentDict.read(result);
+ entry.append(std::move(toks), true); // Lazy resizing
return true;
}
diff --git a/src/OpenFOAM/db/dictionary/functionEntries/evalEntry/evalEntry.H b/src/OpenFOAM/db/dictionary/functionEntries/evalEntry/evalEntry.H
index 173c474f30..c400bda9a1 100644
--- a/src/OpenFOAM/db/dictionary/functionEntries/evalEntry/evalEntry.H
+++ b/src/OpenFOAM/db/dictionary/functionEntries/evalEntry/evalEntry.H
@@ -27,7 +27,8 @@ Class
Foam::functionEntries::evalEntry
Description
- Uses stringOps::toScalar to evaluate mathematical expressions.
+ Uses expressions::fieldExprDriver to evaluate mathematical expressions
+ with scalars, vectors etc.
The input can any form of string or, for convenience,
a '{}' delimited string literal. In all cases, C/C++ comment stripping
@@ -81,8 +82,8 @@ class evalEntry
public functionEntry
{
- //- Evaluate and return a scalar
- static scalar evaluate(const dictionary& parentDict, Istream& is);
+ //- Evaluate and return a token list
+ static tokenList evaluate(const dictionary& parentDict, Istream& is);
public:
@@ -94,9 +95,6 @@ public:
primitiveEntry& thisEntry,
Istream& is
);
-
- //- Execute in a sub-dict context
- static bool execute(dictionary& parentDict, Istream& is);
};
diff --git a/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.C b/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.C
index 4fbcb6078e..fb858e0bc5 100644
--- a/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.C
+++ b/src/OpenFOAM/primitives/strings/parsing/genericRagelLemonDriver.C
@@ -26,7 +26,7 @@ License
\*---------------------------------------------------------------------------*/
#include "genericRagelLemonDriver.H"
-#include "evalStringToScalarDriver.H"
+#include "string.H"
#include "error.H"
// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
diff --git a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C
index cb36385faa..08b762a575 100644
--- a/src/OpenFOAM/primitives/strings/stringOps/stringOps.C
+++ b/src/OpenFOAM/primitives/strings/stringOps/stringOps.C
@@ -570,9 +570,10 @@ static Foam::string recursiveExpand
///Info<< "eval <" << out << ">" << endl;
- // Even with allow empty, expressions need content
- const scalar sval = stringOps::toScalar(out);
- const word val(Foam::name(sval));
+ // Even with allow empty, expressions may need content
+
+ string val(stringOps::evaluate(out));
+ stringOps::inplaceTrim(val);
return val;
}
diff --git a/src/OpenFOAM/primitives/strings/stringOps/stringOps.H b/src/OpenFOAM/primitives/strings/stringOps/stringOps.H
index 11167b02f0..11b0e15da3 100644
--- a/src/OpenFOAM/primitives/strings/stringOps/stringOps.H
+++ b/src/OpenFOAM/primitives/strings/stringOps/stringOps.H
@@ -46,10 +46,9 @@ SourceFiles
#include "dictionary.H"
#include "HashTable.H"
#include "stringOpsSort.H"
+#include "stringOpsEvaluate.H"
#include "wordRes.H"
-#include "evalStringToScalar.H"
-
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
namespace Foam
@@ -137,7 +136,7 @@ namespace stringOps
// - \c ${VAR}
// - \c ${VAR:-defValue}
// - \c ${VAR:+altValue}
- // -# numeric (scalar) evaluation using stringOps::toScalar
+ // -# mathematical evaluation using stringOps::evaluate
// - \c ${{EXPR}}
// -# current directory
// - leading "./"
@@ -183,7 +182,7 @@ namespace stringOps
// \param sigil The leading sigil. Can be changed to avoid conflict
// with other string expansions. (default: '$')
//
- // \sa Foam::findEtcEntry(), Foam::findEtcEntries(), stringOps::toScalar()
+ // \sa Foam::findEtcEntry(), Foam::findEtcEntries(), stringOps::evaluate()
//
// \note this function has too many parameters and should generally
// be avoided in user coding.
diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.C b/src/OpenFOAM/primitives/strings/stringOps/stringOpsEvaluate.C
similarity index 54%
rename from src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.C
rename to src/OpenFOAM/primitives/strings/stringOps/stringOpsEvaluate.C
index 2e079a85bd..6eb7d30962 100644
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.C
+++ b/src/OpenFOAM/primitives/strings/stringOps/stringOpsEvaluate.C
@@ -25,73 +25,81 @@ License
\*---------------------------------------------------------------------------*/
-#include "evalStringToScalar.H"
-#include "evalStringToScalarDriver.H"
-#include "evalStringToScalarScanner.H"
+#include "stringOpsEvaluate.H"
+#include "stringOps.H"
+#include "StringStream.H"
+#include "fieldExprDriver.H"
#include "error.H"
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-namespace Foam
-{
-namespace parsing
-{
-
-int evalStringToScalar::debug
-(
- ::Foam::debug::debugSwitch("stringToScalar", 0)
-);
-registerDebugSwitchWithName
-(
- evalStringToScalar,
- evalStringToScalar,
- "stringToScalar"
-);
-
-} // End namespace parsing
-} // End namespace Foam
-
-
-// * * * * * * * * * * * * * * * * Constructors * * * * * * * * * * * * * * //
-
-Foam::parsing::evalStringToScalar::parseDriver::parseDriver()
-:
- genericRagelLemonDriver(),
- value_(0)
-{}
-
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-Foam::scalar Foam::parsing::evalStringToScalar::parseDriver::execute
-(
- const std::string& s,
- size_t pos,
- size_t len
-)
-{
- // scanner::debug = 1;
-
- scanner().process(s, pos, len, *this);
-
- return value_;
-}
-
-
// * * * * * * * * * * * * * * * Global Functions * * * * * * * * * * * * * //
-Foam::scalar Foam::stringOps::toScalar
+Foam::string Foam::stringOps::evaluate
(
- const std::string& s,
+ const std::string& str,
size_t pos,
size_t len
)
{
- parsing::evalStringToScalar::parseDriver driver;
+ /// InfoErr<< "Evaluate " << str.substr(pos, len) << nl;
- driver.execute(s, pos, len);
+ size_t end = str.length();
+ if (pos > end)
+ {
+ pos = end;
+ }
+ else if (len != std::string::npos)
+ {
+ len += pos;
- return driver.value();
+ if (len < end)
+ {
+ end = len;
+ }
+ }
+
+ // Adjust like inplaceTrim
+
+ // Right
+ while (pos < end && std::isspace(str[end-1]))
+ {
+ --end;
+ }
+
+ // Left
+ while (pos < end && std::isspace(str[pos]))
+ {
+ ++pos;
+ }
+
+ if ((pos >= end) || std::isspace(str[pos]))
+ {
+ return "";
+ }
+
+ len = (end - pos);
+
+ /// InfoErr<< "Evaluate " << str.substr(pos, len) << nl;
+
+ expressions::exprResult result;
+ {
+ expressions::fieldExprDriver driver(1);
+ driver.parse(str, pos, len);
+ result = std::move(driver.result());
+ }
+
+ if (!result.hasValue() || !result.size())
+ {
+ InfoErr
+ << "Failed evaluation: "
+ << str.substr(pos, len) << nl;
+
+ return "";
+ }
+
+ OStringStream os;
+ result.writeValue(os);
+
+ return os.str();
}
diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalar.H b/src/OpenFOAM/primitives/strings/stringOps/stringOpsEvaluate.H
similarity index 88%
rename from src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalar.H
rename to src/OpenFOAM/primitives/strings/stringOps/stringOpsEvaluate.H
index bd7fbc563d..90a8f497f2 100644
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalar.H
+++ b/src/OpenFOAM/primitives/strings/stringOps/stringOpsEvaluate.H
@@ -23,17 +23,17 @@ License
You should have received a copy of the GNU General Public License
along with OpenFOAM. If not, see .
-Namespace
- Foam::parsing::evalStringToScalar
+InNamespace
+ Foam::stringOps
Description
- Parsing encapsulation for stringOps::toScalar
+ String expression evaluation.
\*---------------------------------------------------------------------------*/
-#ifndef evalStringToScalar_H
-#define evalStringToScalar_H
-#include "scalar.H"
+#ifndef stringOpsEvaluate_H
+#define stringOpsEvaluate_H
+
#include "string.H"
// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
@@ -42,8 +42,7 @@ namespace Foam
{
namespace stringOps
{
-
- //- A simple string to scalar evaluation that handles various basic
+ //- A simple string evaluation that handles various basic
//- expressions. For trivial input, use readScalar instead (faster).
//
// The evaluation supports the following:
@@ -52,8 +51,10 @@ namespace stringOps
// - trigonometric: sin, cos, tan, asin, acos, atan, atan2, hypot
// - hyperbolic: sinh, cosh, tanh
// - conversions: degToRad, radToDeg
+ // - type conversion: bool, mag
// - constants: pi(), true, false
- // - misc: floor, ceil, round, rand, rand(seed), bool()
+ // - limits: neg, pos, neg0, pos0, sign, floor, ceil, round
+ // - other: rand, rand(seed)
// - logic: ! ? : == != <= => < >
//
// \note
@@ -63,7 +64,7 @@ namespace stringOps
// \note
// The rand() function returns a uniform scalar on [0-1] interval
// and uses a constant seed.
- scalar toScalar
+ string evaluate
(
const std::string& s,
size_t pos = 0,
diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/createCode b/src/OpenFOAM/primitives/strings/stringOps/toScalar/createCode
deleted file mode 100755
index 4c6bf1cb15..0000000000
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/createCode
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-cd "${0%/*}" || exit # Run from this directory
-
-# Manually create ragel scanner and lemon parser header
-prefix=evalStringToScalar
-
-"${WM_PROJECT_DIR:?}/wmake/scripts/makeParser" \
- -prefix="$prefix" \
- -scanner=Scanner.rl \
- -parser=LemonParser.lyy-m4 \
- "$@"
-
-#------------------------------------------------------------------------------
diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.H b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.H
deleted file mode 100644
index e9dfadfc55..0000000000
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarDriver.H
+++ /dev/null
@@ -1,122 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | www.openfoam.com
- \\/ M anipulation |
--------------------------------------------------------------------------------
- Copyright (C) 2019 OpenCFD Ltd.
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Class
- Foam::parsing::evalStringToScalar::parseDriver
-
-Description
- Driver for stringOps::toScalar parsing
-
-SourceFiles
- evalStringToScalarDriver.C
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef evalStringToScalarDriver_H
-#define evalStringToScalarDriver_H
-
-#include "scalar.H"
-#include "className.H"
-#include "genericRagelLemonDriver.H"
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-namespace Foam
-{
-namespace parsing
-{
-namespace evalStringToScalar
-{
-
-// * * * * * * * * * * * * * * Static Data Members * * * * * * * * * * * * * //
-
-//- The debug flag. 2 = debug parser, 4 = debug scanner
-extern int debug;
-
-
-/*---------------------------------------------------------------------------*\
- Class parseDriver Declaration
-\*---------------------------------------------------------------------------*/
-
-class parseDriver
-:
- public genericRagelLemonDriver
-{
- // Private Data
-
- //- The result
- scalar value_;
-
-public:
-
- ClassName("evalStringToScalar::driver");
-
- // Constructors
-
- //- Construct null
- parseDriver();
-
-
- //- Destructor
- virtual ~parseDriver() = default;
-
-
- // Member Functions
-
- //- Perform parsing on (sub) string
- // \return evaluated value
- scalar execute
- (
- const std::string& s,
- size_t strPos = 0,
- size_t strLen = std::string::npos
- );
-
- //- Get value
- scalar value() const
- {
- return value_;
- }
-
- //- Set value
- void setValue(scalar val)
- {
- value_ = val;
- }
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace evalStringToScalar
-} // End namespace parsing
-} // End namespace Foam
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.h b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.h
deleted file mode 100644
index 8b01964b14..0000000000
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.h
+++ /dev/null
@@ -1,53 +0,0 @@
-#define TOK_QUESTION 1
-#define TOK_COLON 2
-#define TOK_LOR 3
-#define TOK_LAND 4
-#define TOK_EQUAL 5
-#define TOK_NOT_EQUAL 6
-#define TOK_LESS_EQ 7
-#define TOK_GREATER_EQ 8
-#define TOK_LESS 9
-#define TOK_GREATER 10
-#define TOK_PLUS 11
-#define TOK_MINUS 12
-#define TOK_TIMES 13
-#define TOK_DIVIDE 14
-#define TOK_PERCENT 15
-#define TOK_NEGATE 16
-#define TOK_NOT 17
-#define TOK_NUMBER 18
-#define TOK_LPAREN 19
-#define TOK_RPAREN 20
-#define TOK_MAG 21
-#define TOK_PI 22
-#define TOK_DEG_TO_RAD 23
-#define TOK_RAD_TO_DEG 24
-#define TOK_EXP 25
-#define TOK_LOG 26
-#define TOK_LOG10 27
-#define TOK_SQR 28
-#define TOK_SQRT 29
-#define TOK_CBRT 30
-#define TOK_SIN 31
-#define TOK_COS 32
-#define TOK_TAN 33
-#define TOK_ASIN 34
-#define TOK_ACOS 35
-#define TOK_ATAN 36
-#define TOK_SINH 37
-#define TOK_COSH 38
-#define TOK_TANH 39
-#define TOK_MAGSQR 40
-#define TOK_FLOOR 41
-#define TOK_CEIL 42
-#define TOK_ROUND 43
-#define TOK_POW 44
-#define TOK_COMMA 45
-#define TOK_ATAN2 46
-#define TOK_HYPOT 47
-#define TOK_MIN 48
-#define TOK_MAX 49
-#define TOK_RAND 50
-#define TOK_BOOL_FALSE 51
-#define TOK_BOOL_TRUE 52
-#define TOK_BOOL 53
diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.lyy-m4 b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.lyy-m4
deleted file mode 100644
index 61dc201f57..0000000000
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarLemonParser.lyy-m4
+++ /dev/null
@@ -1,399 +0,0 @@
-%include
-{
-/*--------------------------------*- C++ -*----------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | www.openfoam.com
- \\/ M anipulation |
--------------------------------------------------------------------------------
- Copyright (C) 2019 OpenCFD Ltd.
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Description
- Lemon grammar of a simple string to scalar evaluation.
-
- The generated parser is localized in an anonymous namespace.
- Interface code wrapping is near the bottom of the file.
-
-\*---------------------------------------------------------------------------*/
-}
-
-/*---------------------------------------------------------------------------*\
-dnl Begin m4 definitions
-dnl
-undefine(`substr')dnl> Avoid collision with C++ string substr() method
-dnl
-dnl
-dnl ---------------------------------------------------------------------------
-dnl rule_binary_op(out, in1, in2, tok, op)
-dnl Production rule for binary field operations
-dnl
-dnl Example:
-dnl rule_binary_op(sfield, sfield, sfield, PLUS, +)
-dnl
-dnl sfield (lhs) ::= sfield (a) PLUS sfield (b) .
-dnl {
-dnl lhs = (a) + (b);
-dnl }
-dnl
-dnl ---------------------------------------------------------------------------
-define(`rule_binary_op',
-`$1 (lhs) ::= $2 (a) $4 $3 (b) .
-{
- lhs = (a) $5 (b);
-}'
-)dnl>
-dnl
-dnl ---------------------------------------------------------------------------
-dnl rule_binary_logical_op(type, valType, compare, tok, op)
-dnl Production rule for binary logical field operations
-dnl Operates on identical field types, producing an lfield.
-dnl
-dnl Example:
-dnl rule_binary_logical_op(vfield, Foam::vector, greaterOp, GREATER, >)
-dnl
-dnl lfield (lhs) ::= vfield (a) GREATER vfield (b) .
-dnl {
-dnl lhs = Foam::greaterOp()(a, b);
-dnl }
-dnl ---------------------------------------------------------------------------
-define(`rule_binary_logical_op',
-`lfield (lhs) ::= $1 (a) $4 $1 (b) .
-{
- lhs = Foam::$3<$2>()(a, b);
-}'
-)dnl>
-dnl
-dnl ---------------------------------------------------------------------------
-dnl rule_ternary_op(inOut)
-dnl Production rule for ternary field operations
-dnl
-dnl Example:
-dnl rule_ternary_op(sfield)
-dnl
-dnl sfield (lhs) ::= lfield(cond) QUESTION sfield (a) COLON sfield (b) .
-dnl {
-dnl lhs = (cond ? a : b);
-dnl }
-dnl
-define(`rule_ternary_op',
-`$1 (lhs) ::= lfield(cond) QUESTION $1 (a) COLON $1 (b) .
-{
- lhs = (cond ? a : b);
-}'
-)dnl>
-dnl
-dnl ---------------------------------------------------------------------------
-dnl rule_unary_func(out, in1, tok, func)
-dnl Production rule for unary functions:
-dnl
-dnl Example:
-dnl rule_unary_func(sfield, vfield, MAG, Foam::mag)
-dnl
-dnl sfield (lhs) ::= MAG LPAREN vfield (a) RPAREN .
-dnl {
-dnl lhs = Foam::mag(a);
-dnl }
-dnl
-define(`rule_unary_func',
-`$1 (lhs) ::= $3 LPAREN $2 (a) RPAREN .
-{
- lhs = $4 (a);
-}'
-)dnl>
-dnl
-dnl ---------------------------------------------------------------------------
-dnl rule_binary_func(out, in1, in2, tok, func)
-dnl Production rule for binary functions:
-dnl
-dnl Example:
-dnl rule_binary_func(sfield, sfield, sfield, POW, Foam::pow)
-dnl
-dnl sfield (lhs) ::= POW LPAREN sfield (a) COMMA sfield (b) RPAREN .
-dnl {
-dnl lhs = Foam::pow((a), (b));
-dnl }
-dnl
-define(`rule_binary_func',
-`$1 (lhs) ::= $4 LPAREN $2 (a) COMMA $3 (b) RPAREN .
-{
- lhs = $5((a), (b));
-}'
-)dnl>
-dnl
-dnl End m4 definitions
-\*---------------------------------------------------------------------------*/
-
-%include
-{
-#include "evalStringToScalarDriver.H"
-#include "evalStringToScalarParser.H"
-#include "unitConversion.H"
-#include "Random.H"
-#include "Switch.H"
-#include "error.H"
-
-#pragma GCC diagnostic ignored "-Wold-style-cast"
-#pragma GCC diagnostic ignored "-Wunused-function"
-#pragma GCC diagnostic ignored "-Wunused-variable"
-#pragma GCC diagnostic ignored "-Wsign-compare"
-
-// Enable ParseTrace
-#undef NDEBUG
-
-// Local Functions
-
-//- Test for value close to zero
-template
-bool equalZero(const T& val)
-{
- return (Foam::mag(val) < Foam::ROOTVSMALL);
-}
-
-
-} // %include
-
-// ------------------------------------------------------------------------- //
-
-%namespace {}
-
-// Use extra argument for the return value
-%extra_context { Foam::parsing::evalStringToScalar::parseDriver* driver }
-%parse_failure { driver->reportFatal("Parse failure, giving up..."); }
-%syntax_error { driver->reportFatal("Syntax error"); }
-
-%token_prefix TOK_
-
-// Terminals
-%token_type {Foam::scalar}
-// Non-terminals
-%type lfield {bool}
-%type sfield {Foam::scalar}
-
-
-// (https://en.cppreference.com/w/cpp/language/operator_precedence)
-
-%right QUESTION COLON . // 16: right-to-left
-%left LOR . // 15:
-%left LAND . // 14:
-// %left BIT_OR . // 13
-// %left BIT_XOR . // 12
-// %left BIT_AND . // 11
-%left EQUAL NOT_EQUAL . // 10
-%left LESS_EQ GREATER_EQ LESS GREATER . // 9
-%left PLUS MINUS . // 6
-%left TIMES DIVIDE PERCENT . // 5
-%right NEGATE NOT . // 3: right-to-left
-
-%start_symbol evaluate
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-/*---------------------------------------------------------------------------*\
- * Productions (Foam::scalar)
-\*---------------------------------------------------------------------------*/
-
-evaluate ::= sfield(a).
-{
- driver->setValue(a);
-}
-
-
-// Basics
-
-sfield(lhs) ::= NUMBER(a). { lhs = a; } // From scanToken
-sfield(lhs) ::= LPAREN sfield(a) RPAREN. { lhs = a; }
-sfield(lhs) ::= MINUS sfield(a). [NEGATE] { lhs = -a; }
-
-// Conversion (cast)
-sfield(lhs) ::= MAG LPAREN lfield(a) RPAREN . { lhs = Foam::scalar(a); }
-
-// Constants
-
-sfield(lhs) ::= PI LPAREN RPAREN. { lhs = Foam::constant::mathematical::pi; }
-sfield(lhs) ::= DEG_TO_RAD LPAREN RPAREN. { lhs = Foam::degToRad(); }
-sfield(lhs) ::= RAD_TO_DEG LPAREN RPAREN. { lhs = Foam::radToDeg(); }
-
-// Operations
-
-rule_ternary_op(sfield)
-
-rule_binary_op(sfield, sfield, sfield, PLUS, +)
-rule_binary_op(sfield, sfield, sfield, MINUS, -)
-rule_binary_op(sfield, sfield, sfield, TIMES, *)
-
-sfield(lhs) ::= sfield(a) DIVIDE sfield(b).
-{
- lhs = equalZero(b) ? Foam::scalar(0) : (a / b);
-}
-sfield(lhs) ::= sfield(a) PERCENT sfield(b).
-{
- lhs = equalZero(b) ? Foam::scalar(0) : std::fmod(a, b);
-}
-
-// Functions
-
-rule_unary_func(sfield, sfield, DEG_TO_RAD, Foam::degToRad)
-rule_unary_func(sfield, sfield, RAD_TO_DEG, Foam::radToDeg)
-
-rule_unary_func(sfield, sfield, EXP, Foam::exp)
-rule_unary_func(sfield, sfield, LOG, Foam::log)
-rule_unary_func(sfield, sfield, LOG10, Foam::log10)
-rule_unary_func(sfield, sfield, SQR, Foam::sqr)
-rule_unary_func(sfield, sfield, SQRT, Foam::sqrt)
-rule_unary_func(sfield, sfield, CBRT, Foam::cbrt)
-rule_unary_func(sfield, sfield, SIN, Foam::sin)
-rule_unary_func(sfield, sfield, COS, Foam::cos)
-rule_unary_func(sfield, sfield, TAN, Foam::tan)
-rule_unary_func(sfield, sfield, ASIN, Foam::asin)
-rule_unary_func(sfield, sfield, ACOS, Foam::acos)
-rule_unary_func(sfield, sfield, ATAN, Foam::atan)
-rule_unary_func(sfield, sfield, SINH, Foam::sinh)
-rule_unary_func(sfield, sfield, COSH, Foam::cosh)
-rule_unary_func(sfield, sfield, TANH, Foam::tanh)
-rule_unary_func(sfield, sfield, MAG, Foam::mag)
-rule_unary_func(sfield, sfield, MAGSQR, Foam::magSqr)
-rule_unary_func(sfield, sfield, FLOOR, std::floor)
-rule_unary_func(sfield, sfield, CEIL, std::ceil)
-rule_unary_func(sfield, sfield, ROUND, std::round)
-
-rule_binary_func(sfield, sfield, sfield, POW, Foam::pow)
-rule_binary_func(sfield, sfield, sfield, ATAN2, Foam::atan2)
-rule_binary_func(sfield, sfield, sfield, HYPOT, Foam::hypot)
-rule_binary_func(sfield, sfield, sfield, MIN, Foam::min)
-rule_binary_func(sfield, sfield, sfield, MAX, Foam::max)
-
-sfield(lhs) ::= RAND LPAREN RPAREN.
-{
- lhs = Foam::Random().sample01();
-}
-
-sfield(lhs) ::= RAND LPAREN sfield(seed) RPAREN.
-{
- lhs = Foam::Random(seed).sample01();
-}
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-// Productions for bool (logical) fields
-
-evaluate ::= lfield(a).
-{
- driver->setValue(Foam::scalar(a));
-}
-
-// Basics
-
-lfield(lhs) ::= BOOL_FALSE . { lhs = false; }
-lfield(lhs) ::= BOOL_TRUE . { lhs = true; }
-lfield(lhs) ::= LPAREN lfield(a) RPAREN . { lhs = a; }
-lfield(lhs) ::= NOT lfield(a). [NEGATE] { lhs = !a; }
-
-// Conversion (cast)
-lfield(lhs) ::= BOOL LPAREN lfield(a) RPAREN . { lhs = a; }
-lfield(lhs) ::= BOOL LPAREN sfield(a) RPAREN . { lhs = Foam::Switch(a); }
-
-// Operations
-
-rule_ternary_op(lfield)
-
-rule_binary_logical_op(lfield, bool, andOp, LAND, &&)
-rule_binary_logical_op(lfield, bool, orOp, LOR, ||)
-
-rule_binary_logical_op(sfield, Foam::scalar, equalOp, EQUAL, ==)
-rule_binary_logical_op(sfield, Foam::scalar, notEqualOp, NOT_EQUAL, !=)
-rule_binary_logical_op(sfield, Foam::scalar, lessOp, LESS, <)
-rule_binary_logical_op(sfield, Foam::scalar, lessEqOp, LESS_EQ, <=)
-rule_binary_logical_op(sfield, Foam::scalar, greaterOp, GREATER, >)
-rule_binary_logical_op(sfield, Foam::scalar, greaterEqOp, GREATER_EQ, >=)
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-%code
-{
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-void Foam::parsing::evalStringToScalar::parser::stop()
-{
- if (lemon_)
- {
- ParseFree(lemon_, ::operator delete);
- #ifndef NDEBUG
- ParseTrace(nullptr, nullptr);
- #endif
- lemon_ = nullptr;
- }
-}
-
-
-void Foam::parsing::evalStringToScalar::parser::start(parseDriver& driver)
-{
- this->stop();
- lemon_ = ParseAlloc(::operator new, &driver);
-
- if (debug & 2)
- {
- #ifndef NDEBUG
- ParseTrace(stderr, const_cast(prompt_));
- #endif
- }
-}
-
-
-void Foam::parsing::evalStringToScalar::parser::parse
-(
- int tokenId,
- Foam::scalar val /* The value for the token */
-)
-{
- Parse(lemon_, tokenId, val);
-}
-
-
-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
deleted file mode 100644
index 44f16c996b..0000000000
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarParser.H
+++ /dev/null
@@ -1,105 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | www.openfoam.com
- \\/ M anipulation |
--------------------------------------------------------------------------------
- Copyright (C) 2019 OpenCFD Ltd.
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Class
- Foam::parsing::evalStringToScalar::parser
-
-Description
- Interface to lemon parser to simple string to scalar evaluation, which
- is used by stringOps::toScalar
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef evalStringToScalarParser_H
-#define evalStringToScalarParser_H
-
-namespace Foam
-{
-namespace parsing
-{
-namespace evalStringToScalar
-{
-
-// Forward Declarations
-class parseDriver;
-
-
-/*---------------------------------------------------------------------------*\
- Class parser Declaration
-\*---------------------------------------------------------------------------*/
-
-class parser
-{
- // Private Data
-
- //- Prompt for parser tracing
- static constexpr const char* const prompt_ = "#eval:";
-
- //- The lemon parser (demand-driven)
- void* lemon_;
-
-
-public:
-
- // Constructors
-
- //- Construct null
- parser() : lemon_(nullptr) {}
-
-
- //- Destructor, delete lemon parser
- ~parser()
- {
- stop();
- }
-
-
- // Member Functions
-
- //- Start parsing, with given driver context
- void start(parseDriver& driver);
-
- //- Stop parsing, freeing the allocated parser
- void stop();
-
- //- Push token/value to parser
- void parse(int tokenId, Foam::scalar val);
-
- //- The text name corresponding to the tokenId
- word nameOfToken(int tokenId) const;
-};
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace evalStringToScalar
-} // End namespace parsing
-} // End namespace Foam
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.H b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.H
deleted file mode 100644
index aa2847a37d..0000000000
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.H
+++ /dev/null
@@ -1,118 +0,0 @@
-/*---------------------------------------------------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | www.openfoam.com
- \\/ M anipulation |
--------------------------------------------------------------------------------
- Copyright (C) 2019 OpenCFD Ltd.
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Class
- Foam::parsing::evalStringToScalar::scanner
-
-Description
- Ragel lexer interface for lemon grammar of a simple string to
- scalar evaluation, which is used by stringOps::toScalar
-
-Note
- Ragel code generated with the ./createCode script.
-
-\*---------------------------------------------------------------------------*/
-
-#ifndef evalStringToScalarScanner_H
-#define evalStringToScalarScanner_H
-
-#include
-
-namespace Foam
-{
-namespace parsing
-{
-namespace evalStringToScalar
-{
-
-// Forward Declarations
-class parser;
-class parseDriver;
-
-/*---------------------------------------------------------------------------*\
- Class scanner Declaration
-\*---------------------------------------------------------------------------*/
-
-class scanner
-{
- // Private Data
-
- //- Wrapped lemon parser
- parser* parser_;
-
- // Ragel code state, action
- int cs, act;
-
-public:
-
- // Constructors
-
- //- Construct null
- scanner() : parser_(nullptr) {}
-
-
- //- Destructor, deletes parser
- ~scanner();
-
-
- // Member Functions
-
- //- Evaluate sub-string
- bool process
- (
- const std::string& str, size_t pos, size_t len,
- parseDriver& driver
- );
-
- //- Evaluate sub-string
- bool process
- (
- const std::string& str, size_t pos,
- parseDriver& driver
- )
- {
- return process(str, pos, std::string::npos, driver);
- }
-
- //- Evaluate string
- bool process(const std::string& str, parseDriver& driver)
- {
- return process(str, 0, std::string::npos, driver);
- }
-};
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-} // End namespace evalStringToScalar
-} // End namespace parsing
-} // End namespace Foam
-
-
-// * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * //
-
-#endif
-
-// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.cc b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.cc
deleted file mode 100644
index aa7e16fa59..0000000000
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.cc
+++ /dev/null
@@ -1,2204 +0,0 @@
-
-#line 1 "evalStringToScalarScanner.rl"
-/*--------------------------------*- C++ -*----------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | www.openfoam.com
- \\/ M anipulation |
--------------------------------------------------------------------------------
- Copyright (C) 2019 OpenCFD Ltd.
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Description
- Ragel lexer interface for lemon grammar of a simple string to
- scalar evaluation
-
-\*---------------------------------------------------------------------------*/
-
-#include "evalStringToScalarScanner.H"
-#include "evalStringToScalarDriver.H"
-#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"
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-// Ragel lexer with lemon parser integration
-
-// Ragel machine definition
-// Ragel variables (p, pe, eof, cs, top, stack, ts, te, act) defined later...
-//
-// Can use 'variable p xxx;' etc to change these names
-
-
-#line 56 "evalStringToScalarScanner.cc"
-static const int evalScanner_start = 7;
-static const int evalScanner_first_final = 7;
-static const int evalScanner_error = 0;
-
-static const int evalScanner_en_main = 7;
-
-
-#line 55 "evalStringToScalarScanner.rl"
-
-
-
-#undef DebugScannerInfo
-#define DebugScannerInfo if (debug & 4) InfoErr
-
-
-#define TOKEN_OF(T) TOK_##T
-#define EMIT_TOKEN(T) \
- driver.parsePosition() = (ts-buf); \
- DebugScannerInfo << STRINGIFY(T) << ": "<< driver.parsePosition() << nl; \
- parser_->parse(TOKEN_OF(T), 0); \
- driver.parsePosition() = (p-buf);
-
-
-
-#line 181 "evalStringToScalarScanner.rl"
-
-
-
-// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-
-Foam::parsing::evalStringToScalar::scanner::~scanner()
-{
- if (parser_)
- {
- delete parser_;
- }
-}
-
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-bool Foam::parsing::evalStringToScalar::scanner::process
-(
- const std::string& str,
- size_t strBeg,
- size_t strLen,
- parseDriver& driver
-)
-{
- if (!parser_)
- {
- parser_ = new parser();
- }
-
- driver.content(str, strBeg, strLen);
-
- size_t strEnd = str.length();
-
- if (strBeg > str.length())
- {
- strBeg = str.length();
- }
- else if (strLen != std::string::npos)
- {
- strLen += strBeg;
-
- if (strLen < str.length())
- {
- strEnd = strLen;
- }
- }
-
-
- parser_->start(driver);
-
- // Ragel token start/end (required naming)
- const char* ts;
- const char* te;
-
- // Local buffer data.
- // - p, pe, eof are required Ragel naming
- // - buf is our own naming
-
- const char* buf = &(str[strBeg]);
- const char* eof = &(str[strEnd]);
- const char* p = buf;
- const char* pe = eof;
-
- // Initialize FSM variables
-
-#line 147 "evalStringToScalarScanner.cc"
- {
- cs = evalScanner_start;
- ts = 0;
- te = 0;
- act = 0;
- }
-
-#line 245 "evalStringToScalarScanner.rl"
- /* ^^^ FSM initialization here ^^^ */;
-
-
-#line 159 "evalStringToScalarScanner.cc"
- {
- if ( p == pe )
- goto _test_eof;
- switch ( cs )
- {
-tr0:
-#line 134 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(LAND); }}
- goto st7;
-tr3:
-#line 73 "evalStringToScalarScanner.rl"
- {{p = ((te))-1;}{
- driver.parsePosition() = (ts-buf);
-
- DebugScannerInfo
- << "Number:" << std::string(ts, te-ts).c_str()
- << " at " << driver.parsePosition() << nl;
-
- scalar val(0);
-
- if (readScalar(std::string(ts, te-ts), val))
- {
- // Emit number
- parser_->parse(TOKEN_OF(NUMBER), val);
- }
- else
- {
- // Range error
- driver.reportFatal("Error parsing number");
- }
-
- driver.parsePosition() = (p-buf);
- }}
- goto st7;
-tr6:
-#line 132 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(EQUAL); }}
- goto st7;
-tr7:
-#line 135 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(LOR); }}
- goto st7;
-tr10:
-#line 117 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(PERCENT); }}
- goto st7;
-tr12:
-#line 118 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(LPAREN); }}
- goto st7;
-tr13:
-#line 119 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(RPAREN); }}
- goto st7;
-tr14:
-#line 120 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(TIMES); }}
- goto st7;
-tr15:
-#line 121 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(PLUS); }}
- goto st7;
-tr16:
-#line 123 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(COMMA); }}
- goto st7;
-tr17:
-#line 122 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(MINUS); }}
- goto st7;
-tr19:
-#line 124 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(DIVIDE); }}
- goto st7;
-tr21:
-#line 127 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(COLON); }}
- goto st7;
-tr25:
-#line 126 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(QUESTION); }}
- goto st7;
-tr41:
-#line 111 "evalStringToScalarScanner.rl"
- {te = p;p--;}
- goto st7;
-tr42:
-#line 116 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(NOT); }}
- goto st7;
-tr43:
-#line 133 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(NOT_EQUAL); }}
- goto st7;
-tr44:
-#line 73 "evalStringToScalarScanner.rl"
- {te = p;p--;{
- driver.parsePosition() = (ts-buf);
-
- DebugScannerInfo
- << "Number:" << std::string(ts, te-ts).c_str()
- << " at " << driver.parsePosition() << nl;
-
- scalar val(0);
-
- if (readScalar(std::string(ts, te-ts), val))
- {
- // Emit number
- parser_->parse(TOKEN_OF(NUMBER), val);
- }
- else
- {
- // Range error
- driver.reportFatal("Error parsing number");
- }
-
- driver.parsePosition() = (p-buf);
- }}
- goto st7;
-tr46:
-#line 128 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(LESS); }}
- goto st7;
-tr47:
-#line 129 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(LESS_EQ); }}
- goto st7;
-tr48:
-#line 130 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(GREATER); }}
- goto st7;
-tr49:
-#line 131 "evalStringToScalarScanner.rl"
- {te = p+1;{ EMIT_TOKEN(GREATER_EQ); }}
- goto st7;
-tr50:
-#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 st7;
-tr52:
-#line 1 "NONE"
- { switch( act ) {
- case 23:
- {{p = ((te))-1;} EMIT_TOKEN(PI); }
- break;
- case 24:
- {{p = ((te))-1;} EMIT_TOKEN(DEG_TO_RAD); }
- break;
- case 25:
- {{p = ((te))-1;} EMIT_TOKEN(RAD_TO_DEG); }
- break;
- case 26:
- {{p = ((te))-1;} EMIT_TOKEN(EXP); }
- break;
- case 28:
- {{p = ((te))-1;} EMIT_TOKEN(LOG10); }
- break;
- case 29:
- {{p = ((te))-1;} EMIT_TOKEN(POW); }
- break;
- case 31:
- {{p = ((te))-1;} EMIT_TOKEN(SQRT); }
- break;
- case 32:
- {{p = ((te))-1;} EMIT_TOKEN(CBRT); }
- break;
- case 36:
- {{p = ((te))-1;} EMIT_TOKEN(ASIN); }
- break;
- case 37:
- {{p = ((te))-1;} EMIT_TOKEN(ACOS); }
- break;
- case 39:
- {{p = ((te))-1;} EMIT_TOKEN(ATAN2); }
- break;
- case 40:
- {{p = ((te))-1;} EMIT_TOKEN(HYPOT); }
- break;
- case 41:
- {{p = ((te))-1;} EMIT_TOKEN(SINH); }
- break;
- case 42:
- {{p = ((te))-1;} EMIT_TOKEN(COSH); }
- break;
- case 43:
- {{p = ((te))-1;} EMIT_TOKEN(TANH); }
- break;
- case 44:
- {{p = ((te))-1;} EMIT_TOKEN(MIN); }
- break;
- case 45:
- {{p = ((te))-1;} EMIT_TOKEN(MAX); }
- break;
- case 47:
- {{p = ((te))-1;} EMIT_TOKEN(MAGSQR); }
- break;
- case 48:
- {{p = ((te))-1;} EMIT_TOKEN(FLOOR); }
- break;
- case 49:
- {{p = ((te))-1;} EMIT_TOKEN(CEIL); }
- break;
- case 50:
- {{p = ((te))-1;} EMIT_TOKEN(ROUND); }
- break;
- case 51:
- {{p = ((te))-1;} EMIT_TOKEN(RAND); }
- break;
- case 52:
- {{p = ((te))-1;} EMIT_TOKEN(BOOL); }
- break;
- case 53:
- {{p = ((te))-1;} EMIT_TOKEN(BOOL_FALSE); }
- break;
- case 54:
- {{p = ((te))-1;} EMIT_TOKEN(BOOL_TRUE); }
- break;
- case 55:
- {{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 st7;
-tr62:
-#line 156 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(ATAN); }}
- goto st7;
-tr75:
-#line 152 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(COS); }}
- goto st7;
-tr100:
-#line 145 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(LOG); }}
- goto st7;
-tr107:
-#line 164 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(MAG); }}
- goto st7;
-tr131:
-#line 151 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(SIN); }}
- goto st7;
-tr134:
-#line 148 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(SQR); }}
- goto st7;
-tr139:
-#line 153 "evalStringToScalarScanner.rl"
- {te = p;p--;{ EMIT_TOKEN(TAN); }}
- goto st7;
-st7:
-#line 1 "NONE"
- {ts = 0;}
- if ( ++p == pe )
- goto _test_eof7;
-case 7:
-#line 1 "NONE"
- {ts = p;}
-#line 431 "evalStringToScalarScanner.cc"
- switch( (*p) ) {
- case 32: goto st8;
- case 33: goto st9;
- case 37: goto tr10;
- case 38: goto st1;
- case 40: goto tr12;
- case 41: goto tr13;
- case 42: goto tr14;
- case 43: goto tr15;
- case 44: goto tr16;
- case 45: goto tr17;
- case 46: goto st2;
- case 47: goto tr19;
- case 58: goto tr21;
- case 60: goto st13;
- case 61: goto st5;
- case 62: goto st14;
- case 63: goto tr25;
- case 95: goto st15;
- case 97: goto st17;
- case 98: goto st25;
- case 99: goto st28;
- case 100: goto st35;
- case 101: goto st42;
- case 102: goto st44;
- case 104: goto st51;
- case 108: goto st55;
- case 109: goto st59;
- case 112: goto st65;
- case 114: goto st67;
- case 115: goto st78;
- case 116: goto st83;
- case 124: goto st6;
- }
- if ( (*p) < 48 ) {
- if ( 9 <= (*p) && (*p) <= 13 )
- goto st8;
- } else if ( (*p) > 57 ) {
- if ( (*p) > 90 ) {
- if ( 103 <= (*p) && (*p) <= 122 )
- goto st15;
- } else if ( (*p) >= 65 )
- goto st15;
- } else
- goto tr20;
- goto st0;
-st0:
-cs = 0;
- goto _out;
-st8:
- if ( ++p == pe )
- goto _test_eof8;
-case 8:
- if ( (*p) == 32 )
- goto st8;
- if ( 9 <= (*p) && (*p) <= 13 )
- goto st8;
- goto tr41;
-st9:
- if ( ++p == pe )
- goto _test_eof9;
-case 9:
- if ( (*p) == 61 )
- goto tr43;
- goto tr42;
-st1:
- if ( ++p == pe )
- goto _test_eof1;
-case 1:
- if ( (*p) == 38 )
- goto tr0;
- goto st0;
-st2:
- if ( ++p == pe )
- goto _test_eof2;
-case 2:
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr2;
- goto st0;
-tr2:
-#line 1 "NONE"
- {te = p+1;}
- goto st10;
-st10:
- if ( ++p == pe )
- goto _test_eof10;
-case 10:
-#line 519 "evalStringToScalarScanner.cc"
- switch( (*p) ) {
- case 69: goto st3;
- case 101: goto st3;
- }
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr2;
- goto tr44;
-st3:
- if ( ++p == pe )
- goto _test_eof3;
-case 3:
- switch( (*p) ) {
- case 43: goto st4;
- case 45: goto st4;
- }
- if ( 48 <= (*p) && (*p) <= 57 )
- goto st11;
- goto tr3;
-st4:
- if ( ++p == pe )
- goto _test_eof4;
-case 4:
- if ( 48 <= (*p) && (*p) <= 57 )
- goto st11;
- goto tr3;
-st11:
- if ( ++p == pe )
- goto _test_eof11;
-case 11:
- if ( 48 <= (*p) && (*p) <= 57 )
- goto st11;
- goto tr44;
-tr20:
-#line 1 "NONE"
- {te = p+1;}
- goto st12;
-st12:
- if ( ++p == pe )
- goto _test_eof12;
-case 12:
-#line 560 "evalStringToScalarScanner.cc"
- switch( (*p) ) {
- case 46: goto tr2;
- case 69: goto st3;
- case 101: goto st3;
- }
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr20;
- goto tr44;
-st13:
- if ( ++p == pe )
- goto _test_eof13;
-case 13:
- if ( (*p) == 61 )
- goto tr47;
- goto tr46;
-st5:
- if ( ++p == pe )
- goto _test_eof5;
-case 5:
- if ( (*p) == 61 )
- goto tr6;
- goto st0;
-st14:
- if ( ++p == pe )
- goto _test_eof14;
-case 14:
- if ( (*p) == 61 )
- goto tr49;
- goto tr48;
-st15:
- if ( ++p == pe )
- goto _test_eof15;
-case 15:
- if ( (*p) == 95 )
- goto tr51;
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-tr51:
-#line 1 "NONE"
- {te = p+1;}
-#line 96 "evalStringToScalarScanner.rl"
- {act = 55;}
- goto st16;
-tr57:
-#line 1 "NONE"
- {te = p+1;}
-#line 155 "evalStringToScalarScanner.rl"
- {act = 37;}
- goto st16;
-tr59:
-#line 1 "NONE"
- {te = p+1;}
-#line 154 "evalStringToScalarScanner.rl"
- {act = 36;}
- goto st16;
-tr63:
-#line 1 "NONE"
- {te = p+1;}
-#line 157 "evalStringToScalarScanner.rl"
- {act = 39;}
- goto st16;
-tr66:
-#line 1 "NONE"
- {te = p+1;}
-#line 170 "evalStringToScalarScanner.rl"
- {act = 52;}
- goto st16;
-tr71:
-#line 1 "NONE"
- {te = p+1;}
-#line 150 "evalStringToScalarScanner.rl"
- {act = 32;}
- goto st16;
-tr73:
-#line 1 "NONE"
- {te = p+1;}
-#line 167 "evalStringToScalarScanner.rl"
- {act = 49;}
- goto st16;
-tr76:
-#line 1 "NONE"
- {te = p+1;}
-#line 160 "evalStringToScalarScanner.rl"
- {act = 42;}
- goto st16;
-tr83:
-#line 1 "NONE"
- {te = p+1;}
-#line 142 "evalStringToScalarScanner.rl"
- {act = 24;}
- goto st16;
-tr85:
-#line 1 "NONE"
- {te = p+1;}
-#line 144 "evalStringToScalarScanner.rl"
- {act = 26;}
- goto st16;
-tr90:
-#line 1 "NONE"
- {te = p+1;}
-#line 173 "evalStringToScalarScanner.rl"
- {act = 53;}
- goto st16;
-tr93:
-#line 1 "NONE"
- {te = p+1;}
-#line 166 "evalStringToScalarScanner.rl"
- {act = 48;}
- goto st16;
-tr97:
-#line 1 "NONE"
- {te = p+1;}
-#line 158 "evalStringToScalarScanner.rl"
- {act = 40;}
- goto st16;
-tr102:
-#line 1 "NONE"
- {te = p+1;}
-#line 146 "evalStringToScalarScanner.rl"
- {act = 28;}
- goto st16;
-tr106:
-#line 1 "NONE"
- {te = p+1;}
-#line 163 "evalStringToScalarScanner.rl"
- {act = 45;}
- goto st16;
-tr110:
-#line 1 "NONE"
- {te = p+1;}
-#line 165 "evalStringToScalarScanner.rl"
- {act = 47;}
- goto st16;
-tr111:
-#line 1 "NONE"
- {te = p+1;}
-#line 162 "evalStringToScalarScanner.rl"
- {act = 44;}
- goto st16;
-tr112:
-#line 1 "NONE"
- {te = p+1;}
-#line 141 "evalStringToScalarScanner.rl"
- {act = 23;}
- goto st16;
-tr114:
-#line 1 "NONE"
- {te = p+1;}
-#line 147 "evalStringToScalarScanner.rl"
- {act = 29;}
- goto st16;
-tr123:
-#line 1 "NONE"
- {te = p+1;}
-#line 143 "evalStringToScalarScanner.rl"
- {act = 25;}
- goto st16;
-tr124:
-#line 1 "NONE"
- {te = p+1;}
-#line 169 "evalStringToScalarScanner.rl"
- {act = 51;}
- goto st16;
-tr127:
-#line 1 "NONE"
- {te = p+1;}
-#line 168 "evalStringToScalarScanner.rl"
- {act = 50;}
- goto st16;
-tr132:
-#line 1 "NONE"
- {te = p+1;}
-#line 159 "evalStringToScalarScanner.rl"
- {act = 41;}
- goto st16;
-tr135:
-#line 1 "NONE"
- {te = p+1;}
-#line 149 "evalStringToScalarScanner.rl"
- {act = 31;}
- goto st16;
-tr140:
-#line 1 "NONE"
- {te = p+1;}
-#line 161 "evalStringToScalarScanner.rl"
- {act = 43;}
- goto st16;
-tr142:
-#line 1 "NONE"
- {te = p+1;}
-#line 174 "evalStringToScalarScanner.rl"
- {act = 54;}
- goto st16;
-st16:
- if ( ++p == pe )
- goto _test_eof16;
-case 16:
-#line 765 "evalStringToScalarScanner.cc"
- if ( (*p) == 95 )
- goto tr51;
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr52;
-st17:
- if ( ++p == pe )
- goto _test_eof17;
-case 17:
- switch( (*p) ) {
- case 95: goto tr51;
- case 99: goto st18;
- case 115: goto st20;
- case 116: goto st22;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st18:
- if ( ++p == pe )
- goto _test_eof18;
-case 18:
- switch( (*p) ) {
- case 95: goto tr51;
- case 111: goto st19;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st19:
- if ( ++p == pe )
- goto _test_eof19;
-case 19:
- switch( (*p) ) {
- case 95: goto tr51;
- case 115: goto tr57;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st20:
- if ( ++p == pe )
- goto _test_eof20;
-case 20:
- switch( (*p) ) {
- case 95: goto tr51;
- case 105: goto st21;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st21:
- if ( ++p == pe )
- goto _test_eof21;
-case 21:
- switch( (*p) ) {
- case 95: goto tr51;
- case 110: goto tr59;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st22:
- if ( ++p == pe )
- goto _test_eof22;
-case 22:
- switch( (*p) ) {
- case 95: goto tr51;
- case 97: goto st23;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 98 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st23:
- if ( ++p == pe )
- goto _test_eof23;
-case 23:
- switch( (*p) ) {
- case 95: goto tr51;
- case 110: goto st24;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st24:
- if ( ++p == pe )
- goto _test_eof24;
-case 24:
- switch( (*p) ) {
- case 50: goto tr63;
- case 95: goto tr51;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr62;
-st25:
- if ( ++p == pe )
- goto _test_eof25;
-case 25:
- switch( (*p) ) {
- case 95: goto tr51;
- case 111: goto st26;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st26:
- if ( ++p == pe )
- goto _test_eof26;
-case 26:
- switch( (*p) ) {
- case 95: goto tr51;
- case 111: goto st27;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st27:
- if ( ++p == pe )
- goto _test_eof27;
-case 27:
- switch( (*p) ) {
- case 95: goto tr51;
- case 108: goto tr66;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st28:
- if ( ++p == pe )
- goto _test_eof28;
-case 28:
- switch( (*p) ) {
- case 95: goto tr51;
- case 98: goto st29;
- case 101: goto st31;
- case 111: goto st33;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st29:
- if ( ++p == pe )
- goto _test_eof29;
-case 29:
- switch( (*p) ) {
- case 95: goto tr51;
- case 114: goto st30;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st30:
- if ( ++p == pe )
- goto _test_eof30;
-case 30:
- switch( (*p) ) {
- case 95: goto tr51;
- case 116: goto tr71;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st31:
- if ( ++p == pe )
- goto _test_eof31;
-case 31:
- switch( (*p) ) {
- case 95: goto tr51;
- case 105: goto st32;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st32:
- if ( ++p == pe )
- goto _test_eof32;
-case 32:
- switch( (*p) ) {
- case 95: goto tr51;
- case 108: goto tr73;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st33:
- if ( ++p == pe )
- goto _test_eof33;
-case 33:
- switch( (*p) ) {
- case 95: goto tr51;
- case 115: goto st34;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st34:
- if ( ++p == pe )
- goto _test_eof34;
-case 34:
- switch( (*p) ) {
- case 95: goto tr51;
- case 104: goto tr76;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr75;
-st35:
- if ( ++p == pe )
- goto _test_eof35;
-case 35:
- switch( (*p) ) {
- case 95: goto tr51;
- case 101: goto st36;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st36:
- if ( ++p == pe )
- goto _test_eof36;
-case 36:
- switch( (*p) ) {
- case 95: goto tr51;
- case 103: goto st37;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st37:
- if ( ++p == pe )
- goto _test_eof37;
-case 37:
- switch( (*p) ) {
- case 84: goto st38;
- case 95: goto tr51;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st38:
- if ( ++p == pe )
- goto _test_eof38;
-case 38:
- switch( (*p) ) {
- case 95: goto tr51;
- case 111: goto st39;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st39:
- if ( ++p == pe )
- goto _test_eof39;
-case 39:
- switch( (*p) ) {
- case 82: goto st40;
- case 95: goto tr51;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st40:
- if ( ++p == pe )
- goto _test_eof40;
-case 40:
- switch( (*p) ) {
- case 95: goto tr51;
- case 97: goto st41;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 98 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st41:
- if ( ++p == pe )
- goto _test_eof41;
-case 41:
- switch( (*p) ) {
- case 95: goto tr51;
- case 100: goto tr83;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st42:
- if ( ++p == pe )
- goto _test_eof42;
-case 42:
- switch( (*p) ) {
- case 95: goto tr51;
- case 120: goto st43;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st43:
- if ( ++p == pe )
- goto _test_eof43;
-case 43:
- switch( (*p) ) {
- case 95: goto tr51;
- case 112: goto tr85;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st44:
- if ( ++p == pe )
- goto _test_eof44;
-case 44:
- switch( (*p) ) {
- case 95: goto tr51;
- case 97: goto st45;
- case 108: goto st48;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 98 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st45:
- if ( ++p == pe )
- goto _test_eof45;
-case 45:
- switch( (*p) ) {
- case 95: goto tr51;
- case 108: goto st46;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st46:
- if ( ++p == pe )
- goto _test_eof46;
-case 46:
- switch( (*p) ) {
- case 95: goto tr51;
- case 115: goto st47;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st47:
- if ( ++p == pe )
- goto _test_eof47;
-case 47:
- switch( (*p) ) {
- case 95: goto tr51;
- case 101: goto tr90;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st48:
- if ( ++p == pe )
- goto _test_eof48;
-case 48:
- switch( (*p) ) {
- case 95: goto tr51;
- case 111: goto st49;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st49:
- if ( ++p == pe )
- goto _test_eof49;
-case 49:
- switch( (*p) ) {
- case 95: goto tr51;
- case 111: goto st50;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st50:
- if ( ++p == pe )
- goto _test_eof50;
-case 50:
- switch( (*p) ) {
- case 95: goto tr51;
- case 114: goto tr93;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st51:
- if ( ++p == pe )
- goto _test_eof51;
-case 51:
- switch( (*p) ) {
- case 95: goto tr51;
- case 121: goto st52;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st52:
- if ( ++p == pe )
- goto _test_eof52;
-case 52:
- switch( (*p) ) {
- case 95: goto tr51;
- case 112: goto st53;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st53:
- if ( ++p == pe )
- goto _test_eof53;
-case 53:
- switch( (*p) ) {
- case 95: goto tr51;
- case 111: goto st54;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st54:
- if ( ++p == pe )
- goto _test_eof54;
-case 54:
- switch( (*p) ) {
- case 95: goto tr51;
- case 116: goto tr97;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st55:
- if ( ++p == pe )
- goto _test_eof55;
-case 55:
- switch( (*p) ) {
- case 95: goto tr51;
- case 111: goto st56;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st56:
- if ( ++p == pe )
- goto _test_eof56;
-case 56:
- switch( (*p) ) {
- case 95: goto tr51;
- case 103: goto st57;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st57:
- if ( ++p == pe )
- goto _test_eof57;
-case 57:
- switch( (*p) ) {
- case 49: goto st58;
- case 95: goto tr51;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr100;
-st58:
- if ( ++p == pe )
- goto _test_eof58;
-case 58:
- switch( (*p) ) {
- case 48: goto tr102;
- case 95: goto tr51;
- }
- if ( (*p) < 65 ) {
- if ( 49 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st59:
- if ( ++p == pe )
- goto _test_eof59;
-case 59:
- switch( (*p) ) {
- case 95: goto tr51;
- case 97: goto st60;
- case 105: goto st64;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 98 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st60:
- if ( ++p == pe )
- goto _test_eof60;
-case 60:
- switch( (*p) ) {
- case 95: goto tr51;
- case 103: goto st61;
- case 120: goto tr106;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st61:
- if ( ++p == pe )
- goto _test_eof61;
-case 61:
- switch( (*p) ) {
- case 83: goto st62;
- case 95: goto tr51;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr107;
-st62:
- if ( ++p == pe )
- goto _test_eof62;
-case 62:
- switch( (*p) ) {
- case 95: goto tr51;
- case 113: goto st63;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st63:
- if ( ++p == pe )
- goto _test_eof63;
-case 63:
- switch( (*p) ) {
- case 95: goto tr51;
- case 114: goto tr110;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st64:
- if ( ++p == pe )
- goto _test_eof64;
-case 64:
- switch( (*p) ) {
- case 95: goto tr51;
- case 110: goto tr111;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st65:
- if ( ++p == pe )
- goto _test_eof65;
-case 65:
- switch( (*p) ) {
- case 95: goto tr51;
- case 105: goto tr112;
- case 111: goto st66;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st66:
- if ( ++p == pe )
- goto _test_eof66;
-case 66:
- switch( (*p) ) {
- case 95: goto tr51;
- case 119: goto tr114;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st67:
- if ( ++p == pe )
- goto _test_eof67;
-case 67:
- switch( (*p) ) {
- case 95: goto tr51;
- case 97: goto st68;
- case 111: goto st75;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 98 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st68:
- if ( ++p == pe )
- goto _test_eof68;
-case 68:
- switch( (*p) ) {
- case 95: goto tr51;
- case 100: goto st69;
- case 110: goto st74;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st69:
- if ( ++p == pe )
- goto _test_eof69;
-case 69:
- switch( (*p) ) {
- case 84: goto st70;
- case 95: goto tr51;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st70:
- if ( ++p == pe )
- goto _test_eof70;
-case 70:
- switch( (*p) ) {
- case 95: goto tr51;
- case 111: goto st71;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st71:
- if ( ++p == pe )
- goto _test_eof71;
-case 71:
- switch( (*p) ) {
- case 68: goto st72;
- case 95: goto tr51;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st72:
- if ( ++p == pe )
- goto _test_eof72;
-case 72:
- switch( (*p) ) {
- case 95: goto tr51;
- case 101: goto st73;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st73:
- if ( ++p == pe )
- goto _test_eof73;
-case 73:
- switch( (*p) ) {
- case 95: goto tr51;
- case 103: goto tr123;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st74:
- if ( ++p == pe )
- goto _test_eof74;
-case 74:
- switch( (*p) ) {
- case 95: goto tr51;
- case 100: goto tr124;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st75:
- if ( ++p == pe )
- goto _test_eof75;
-case 75:
- switch( (*p) ) {
- case 95: goto tr51;
- case 117: goto st76;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st76:
- if ( ++p == pe )
- goto _test_eof76;
-case 76:
- switch( (*p) ) {
- case 95: goto tr51;
- case 110: goto st77;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st77:
- if ( ++p == pe )
- goto _test_eof77;
-case 77:
- switch( (*p) ) {
- case 95: goto tr51;
- case 100: goto tr127;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st78:
- if ( ++p == pe )
- goto _test_eof78;
-case 78:
- switch( (*p) ) {
- case 95: goto tr51;
- case 105: goto st79;
- case 113: goto st81;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st79:
- if ( ++p == pe )
- goto _test_eof79;
-case 79:
- switch( (*p) ) {
- case 95: goto tr51;
- case 110: goto st80;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st80:
- if ( ++p == pe )
- goto _test_eof80;
-case 80:
- switch( (*p) ) {
- case 95: goto tr51;
- case 104: goto tr132;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr131;
-st81:
- if ( ++p == pe )
- goto _test_eof81;
-case 81:
- switch( (*p) ) {
- case 95: goto tr51;
- case 114: goto st82;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st82:
- if ( ++p == pe )
- goto _test_eof82;
-case 82:
- switch( (*p) ) {
- case 95: goto tr51;
- case 116: goto tr135;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr134;
-st83:
- if ( ++p == pe )
- goto _test_eof83;
-case 83:
- switch( (*p) ) {
- case 95: goto tr51;
- case 97: goto st84;
- case 114: goto st86;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 98 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st84:
- if ( ++p == pe )
- goto _test_eof84;
-case 84:
- switch( (*p) ) {
- case 95: goto tr51;
- case 110: goto st85;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st85:
- if ( ++p == pe )
- goto _test_eof85;
-case 85:
- switch( (*p) ) {
- case 95: goto tr51;
- case 104: goto tr140;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr139;
-st86:
- if ( ++p == pe )
- goto _test_eof86;
-case 86:
- switch( (*p) ) {
- case 95: goto tr51;
- case 117: goto st87;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st87:
- if ( ++p == pe )
- goto _test_eof87;
-case 87:
- switch( (*p) ) {
- case 95: goto tr51;
- case 101: goto tr142;
- }
- if ( (*p) < 65 ) {
- if ( 48 <= (*p) && (*p) <= 57 )
- goto tr51;
- } else if ( (*p) > 90 ) {
- if ( 97 <= (*p) && (*p) <= 122 )
- goto tr51;
- } else
- goto tr51;
- goto tr50;
-st6:
- if ( ++p == pe )
- goto _test_eof6;
-case 6:
- if ( (*p) == 124 )
- goto tr7;
- goto st0;
- }
- _test_eof7: cs = 7; goto _test_eof;
- _test_eof8: cs = 8; goto _test_eof;
- _test_eof9: cs = 9; goto _test_eof;
- _test_eof1: cs = 1; goto _test_eof;
- _test_eof2: cs = 2; goto _test_eof;
- _test_eof10: cs = 10; goto _test_eof;
- _test_eof3: cs = 3; goto _test_eof;
- _test_eof4: cs = 4; goto _test_eof;
- _test_eof11: cs = 11; goto _test_eof;
- _test_eof12: cs = 12; goto _test_eof;
- _test_eof13: cs = 13; goto _test_eof;
- _test_eof5: cs = 5; goto _test_eof;
- _test_eof14: cs = 14; goto _test_eof;
- _test_eof15: cs = 15; goto _test_eof;
- _test_eof16: cs = 16; goto _test_eof;
- _test_eof17: cs = 17; goto _test_eof;
- _test_eof18: cs = 18; goto _test_eof;
- _test_eof19: cs = 19; goto _test_eof;
- _test_eof20: cs = 20; goto _test_eof;
- _test_eof21: cs = 21; goto _test_eof;
- _test_eof22: cs = 22; goto _test_eof;
- _test_eof23: cs = 23; goto _test_eof;
- _test_eof24: cs = 24; goto _test_eof;
- _test_eof25: cs = 25; goto _test_eof;
- _test_eof26: cs = 26; goto _test_eof;
- _test_eof27: cs = 27; goto _test_eof;
- _test_eof28: cs = 28; goto _test_eof;
- _test_eof29: cs = 29; goto _test_eof;
- _test_eof30: cs = 30; goto _test_eof;
- _test_eof31: cs = 31; goto _test_eof;
- _test_eof32: cs = 32; goto _test_eof;
- _test_eof33: cs = 33; goto _test_eof;
- _test_eof34: cs = 34; goto _test_eof;
- _test_eof35: cs = 35; goto _test_eof;
- _test_eof36: cs = 36; goto _test_eof;
- _test_eof37: cs = 37; goto _test_eof;
- _test_eof38: cs = 38; goto _test_eof;
- _test_eof39: cs = 39; goto _test_eof;
- _test_eof40: cs = 40; goto _test_eof;
- _test_eof41: cs = 41; goto _test_eof;
- _test_eof42: cs = 42; goto _test_eof;
- _test_eof43: cs = 43; goto _test_eof;
- _test_eof44: cs = 44; goto _test_eof;
- _test_eof45: cs = 45; goto _test_eof;
- _test_eof46: cs = 46; goto _test_eof;
- _test_eof47: cs = 47; goto _test_eof;
- _test_eof48: cs = 48; goto _test_eof;
- _test_eof49: cs = 49; goto _test_eof;
- _test_eof50: cs = 50; goto _test_eof;
- _test_eof51: cs = 51; goto _test_eof;
- _test_eof52: cs = 52; goto _test_eof;
- _test_eof53: cs = 53; goto _test_eof;
- _test_eof54: cs = 54; goto _test_eof;
- _test_eof55: cs = 55; goto _test_eof;
- _test_eof56: cs = 56; goto _test_eof;
- _test_eof57: cs = 57; goto _test_eof;
- _test_eof58: cs = 58; goto _test_eof;
- _test_eof59: cs = 59; goto _test_eof;
- _test_eof60: cs = 60; goto _test_eof;
- _test_eof61: cs = 61; goto _test_eof;
- _test_eof62: cs = 62; goto _test_eof;
- _test_eof63: cs = 63; goto _test_eof;
- _test_eof64: cs = 64; goto _test_eof;
- _test_eof65: cs = 65; goto _test_eof;
- _test_eof66: cs = 66; goto _test_eof;
- _test_eof67: cs = 67; goto _test_eof;
- _test_eof68: cs = 68; goto _test_eof;
- _test_eof69: cs = 69; goto _test_eof;
- _test_eof70: cs = 70; goto _test_eof;
- _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_eof6: cs = 6; goto _test_eof;
-
- _test_eof: {}
- if ( p == eof )
- {
- switch ( cs ) {
- case 8: goto tr41;
- case 9: goto tr42;
- case 10: goto tr44;
- case 3: goto tr3;
- case 4: goto tr3;
- case 11: goto tr44;
- case 12: goto tr44;
- case 13: goto tr46;
- case 14: goto tr48;
- case 15: goto tr50;
- case 16: goto tr52;
- case 17: goto tr50;
- case 18: goto tr50;
- case 19: goto tr50;
- case 20: goto tr50;
- case 21: goto tr50;
- case 22: goto tr50;
- case 23: goto tr50;
- case 24: goto tr62;
- case 25: goto tr50;
- case 26: goto tr50;
- case 27: goto tr50;
- case 28: goto tr50;
- case 29: goto tr50;
- case 30: goto tr50;
- case 31: goto tr50;
- case 32: goto tr50;
- case 33: goto tr50;
- case 34: goto tr75;
- case 35: goto tr50;
- case 36: goto tr50;
- case 37: goto tr50;
- case 38: goto tr50;
- case 39: goto tr50;
- case 40: goto tr50;
- case 41: goto tr50;
- case 42: goto tr50;
- case 43: goto tr50;
- case 44: goto tr50;
- case 45: goto tr50;
- case 46: goto tr50;
- case 47: goto tr50;
- case 48: goto tr50;
- case 49: goto tr50;
- case 50: goto tr50;
- case 51: goto tr50;
- case 52: goto tr50;
- case 53: goto tr50;
- case 54: goto tr50;
- case 55: goto tr50;
- case 56: goto tr50;
- case 57: goto tr100;
- case 58: goto tr50;
- case 59: goto tr50;
- case 60: goto tr50;
- case 61: goto tr107;
- case 62: goto tr50;
- case 63: goto tr50;
- case 64: goto tr50;
- case 65: goto tr50;
- case 66: goto tr50;
- case 67: goto tr50;
- case 68: goto tr50;
- case 69: goto tr50;
- case 70: goto tr50;
- case 71: goto tr50;
- case 72: goto tr50;
- case 73: goto tr50;
- case 74: goto tr50;
- case 75: goto tr50;
- case 76: goto tr50;
- case 77: goto tr50;
- case 78: goto tr50;
- case 79: goto tr50;
- case 80: goto tr131;
- case 81: goto tr50;
- case 82: goto tr134;
- case 83: goto tr50;
- case 84: goto tr50;
- case 85: goto tr139;
- case 86: goto tr50;
- case 87: goto tr50;
- }
- }
-
- _out: {}
- }
-
-#line 247 "evalStringToScalarScanner.rl"
- /* ^^^ FSM execution here ^^^ */;
-
- if (0 == cs)
- {
- driver.reportFatal("Parse error while scanning", (p-buf));
- }
-
- if (p != eof)
- {
- driver.reportFatal("Parsing failed with remaining content", (p-buf));
- }
-
- // Terminate parser execution
- parser_->parse(0, 0);
- parser_->stop();
-
- return true;
-}
-
-
-// ************************************************************************* //
diff --git a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.rl b/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.rl
deleted file mode 100644
index d4c19c85ca..0000000000
--- a/src/OpenFOAM/primitives/strings/stringOps/toScalar/evalStringToScalarScanner.rl
+++ /dev/null
@@ -1,267 +0,0 @@
-/*--------------------------------*- C++ -*----------------------------------*\
- ========= |
- \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
- \\ / O peration |
- \\ / A nd | www.openfoam.com
- \\/ M anipulation |
--------------------------------------------------------------------------------
- Copyright (C) 2019 OpenCFD Ltd.
--------------------------------------------------------------------------------
-License
- This file is part of OpenFOAM.
-
- OpenFOAM is free software: you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by
- the Free Software Foundation, either version 3 of the License, or
- (at your option) any later version.
-
- OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
- ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
- FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
- for more details.
-
- You should have received a copy of the GNU General Public License
- along with OpenFOAM. If not, see .
-
-Description
- Ragel lexer interface for lemon grammar of a simple string to
- scalar evaluation
-
-\*---------------------------------------------------------------------------*/
-
-#include "evalStringToScalarScanner.H"
-#include "evalStringToScalarDriver.H"
-#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"
-
-
-/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
-
-// Ragel lexer with lemon parser integration
-
-// Ragel machine definition
-// Ragel variables (p, pe, eof, cs, top, stack, ts, te, act) defined later...
-//
-// Can use 'variable p xxx;' etc to change these names
-
-%%{
- machine evalScanner;
- write data;
-}%%
-
-
-#undef DebugScannerInfo
-#define DebugScannerInfo if (debug & 4) InfoErr
-
-
-#define TOKEN_OF(T) TOK_##T
-#define EMIT_TOKEN(T) \
- driver.parsePosition() = (ts-buf); \
- DebugScannerInfo << STRINGIFY(T) << ": "<< driver.parsePosition() << nl; \
- parser_->parse(TOKEN_OF(T), 0); \
- driver.parsePosition() = (p-buf);
-
-
-%%{
- machine evalScanner;
-
- action emit_number {
- driver.parsePosition() = (ts-buf);
-
- DebugScannerInfo
- << "Number:" << std::string(ts, te-ts).c_str()
- << " at " << driver.parsePosition() << nl;
-
- scalar val(0);
-
- if (readScalar(std::string(ts, te-ts), val))
- {
- // Emit number
- parser_->parse(TOKEN_OF(NUMBER), val);
- }
- else
- {
- // 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+)? ;
- ident = ((alpha|'_') . ((alnum|'_')**)) ;
-
-
- ## The scanner
- main := |*
- space*;
-
- number => emit_number;
-
- ## operators
- '!' => { EMIT_TOKEN(NOT); };
- '%' => { EMIT_TOKEN(PERCENT); };
- '(' => { EMIT_TOKEN(LPAREN); };
- ')' => { EMIT_TOKEN(RPAREN); };
- '*' => { EMIT_TOKEN(TIMES); };
- '+' => { EMIT_TOKEN(PLUS); };
- '-' => { EMIT_TOKEN(MINUS); };
- ',' => { EMIT_TOKEN(COMMA); };
- '/' => { EMIT_TOKEN(DIVIDE); };
- '!' => { EMIT_TOKEN(NOT); };
- '?' => { EMIT_TOKEN(QUESTION); };
- ':' => { EMIT_TOKEN(COLON); };
- '<' => { EMIT_TOKEN(LESS); };
- '<=' => { EMIT_TOKEN(LESS_EQ); };
- '>' => { EMIT_TOKEN(GREATER); };
- '>=' => { EMIT_TOKEN(GREATER_EQ); };
- '==' => { EMIT_TOKEN(EQUAL); };
- '!=' => { EMIT_TOKEN(NOT_EQUAL); };
- '&&' => { EMIT_TOKEN(LAND); };
- '||' => { EMIT_TOKEN(LOR); };
-## Not needed '&' => { EMIT_TOKEN(BIT_AND); };
-## Not needed '|' => { EMIT_TOKEN(BIT_OR); };
-## Not needed '^' => { EMIT_TOKEN(BIT_XOR); };
-
- ## 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' => { EMIT_TOKEN(RAND); };
- 'bool' => { EMIT_TOKEN(BOOL); };
-
- ## Constants
- 'false' =>{ EMIT_TOKEN(BOOL_FALSE); };
- 'true' =>{ EMIT_TOKEN(BOOL_TRUE); };
-
- ## Catch-all for identifiers/errors
- ident => emit_ident;
-
- space*;
- *|;
-}%%
-
-
-// * * * * * * * * * * * * * * * * Destructor * * * * * * * * * * * * * * * //
-
-Foam::parsing::evalStringToScalar::scanner::~scanner()
-{
- if (parser_)
- {
- delete parser_;
- }
-}
-
-
-// * * * * * * * * * * * * * * * Member Functions * * * * * * * * * * * * * //
-
-bool Foam::parsing::evalStringToScalar::scanner::process
-(
- const std::string& str,
- size_t strBeg,
- size_t strLen,
- parseDriver& driver
-)
-{
- if (!parser_)
- {
- parser_ = new parser();
- }
-
- driver.content(str, strBeg, strLen);
-
- size_t strEnd = str.length();
-
- if (strBeg > str.length())
- {
- strBeg = str.length();
- }
- else if (strLen != std::string::npos)
- {
- strLen += strBeg;
-
- if (strLen < str.length())
- {
- strEnd = strLen;
- }
- }
-
-
- parser_->start(driver);
-
- // Ragel token start/end (required naming)
- const char* ts;
- const char* te;
-
- // Local buffer data.
- // - p, pe, eof are required Ragel naming
- // - buf is our own naming
-
- const char* buf = &(str[strBeg]);
- const char* eof = &(str[strEnd]);
- const char* p = buf;
- const char* pe = eof;
-
- // Initialize FSM variables
- %%{write init;}%% /* ^^^ FSM initialization here ^^^ */;
-
- %%{write exec;}%% /* ^^^ FSM execution here ^^^ */;
-
- if (%%{write error;}%% == cs)
- {
- driver.reportFatal("Parse error while scanning", (p-buf));
- }
-
- if (p != eof)
- {
- driver.reportFatal("Parsing failed with remaining content", (p-buf));
- }
-
- // Terminate parser execution
- parser_->parse(0, 0);
- parser_->stop();
-
- return true;
-}
-
-
-// ************************************************************************* //
diff --git a/tutorials/IO/dictionary/good-if2.dict b/tutorials/IO/dictionary/good-if2.dict
index fe1390ea40..c620ff18ba 100644
--- a/tutorials/IO/dictionary/good-if2.dict
+++ b/tutorials/IO/dictionary/good-if2.dict
@@ -36,4 +36,13 @@ FoamFile
#endif
+// Silly example, but can also force cast from scalar to bool
+
+#if #eval "bool(2 * pi())"
+ condition true;
+#else
+ condition false;
+#endif
+
+
// ************************************************************************* //