Lexer: Added ::decomposeSubstitution and more flexible ::dequote

- ::dequote can now be given a string of valid quote characters, which defaults
  to '".
- ::decomposeSubstitution properly parses the /from/to/g construct allowing for
  escaped characters (\/).
- The 'g' at the end of a substitution is now considered to be a string of flag
  characters, which may contain 'g'. No other flag values are currently
  supported.
This commit is contained in:
Paul Beckingham 2015-07-11 16:40:52 -04:00
parent 1c1422370a
commit 1bef45ff47
2 changed files with 41 additions and 6 deletions

View file

@ -74,11 +74,12 @@ public:
static bool isPunctuation (int);
static bool isAllDigits (const std::string&);
static bool isOneWord (const std::string&);
static void dequote (std::string&);
static void dequote (std::string&, const std::string& quotes = "'\"");
static bool wasQuoted (const std::string&);
static bool readWord (const std::string&, const std::string&, std::string::size_type&, std::string&);
static bool readWord (const std::string&, std::string::size_type&, std::string&);
static bool decomposePair (const std::string&, std::string&, std::string&, std::string&, std::string&);
static bool decomposeSubstitution (const std::string&, std::string&, std::string&, std::string&);
static int hexToInt (int);
static int hexToInt (int, int);
static int hexToInt (int, int, int, int);