Lexer2
- Implemented ::isAllDigits to distinguish between integers and real numbers.
This commit is contained in:
@@ -965,3 +965,9 @@ std::string Lexer2::typeToString (Lexer2::Type type)
|
|||||||
}
|
}
|
||||||
|
|
||||||
////////////////////////////////////////////////////////////////////////////////
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
bool Lexer2::isAllDigits (const std::string& text)
|
||||||
|
{
|
||||||
|
return text.find_first_not_of ("0123456789") == std::string::npos;
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|||||||
@@ -58,6 +58,7 @@ public:
|
|||||||
static std::vector <std::pair <std::string, Lexer2::Type>> tokens (const std::string&);
|
static std::vector <std::pair <std::string, Lexer2::Type>> tokens (const std::string&);
|
||||||
static std::vector <std::string> split (const std::string&);
|
static std::vector <std::string> split (const std::string&);
|
||||||
static std::string typeToString (Lexer2::Type);
|
static std::string typeToString (Lexer2::Type);
|
||||||
|
static bool isAllDigits (const std::string&);
|
||||||
|
|
||||||
// Static helpers.
|
// Static helpers.
|
||||||
static const std::string typeName (const Lexer2::Type&);
|
static const std::string typeName (const Lexer2::Type&);
|
||||||
|
|||||||
Reference in New Issue
Block a user