Add new state options to parser and actually enable them

- Added new state options that DECORATE got to the lemon parser.
- Enable token generation for state options. They were previously not
  generated, so the grammar treated them as function calls instead.
This commit is contained in:
Randy Heit 2016-03-03 15:34:42 -06:00
commit 964ff46063
8 changed files with 101 additions and 39 deletions

View file

@ -120,6 +120,7 @@ FScanner &FScanner::operator=(const FScanner &other)
CMode = other.CMode;
Escape = other.Escape;
StateMode = other.StateMode;
StateOptions = other.StateOptions;
// Copy public members
if (other.String == other.StringBuffer)
@ -277,6 +278,7 @@ void FScanner::PrepareScript ()
CMode = false;
Escape = true;
StateMode = 0;
StateOptions = false;
StringBuffer[0] = '\0';
BigStringBuffer = "";
}
@ -409,15 +411,19 @@ void FScanner::SetEscape (bool esc)
// * ;
// * } - Automatically exits state mode after it's seen.
//
// Quoted strings are returned as TOK_NonWhitespace, minus the quotes. In
// addition, any two consecutive sequences of TOK_NonWhitespace also exit
// state mode.
// Quoted strings are returned as TOK_NonWhitespace, minus the quotes. Once
// two consecutive sequences of TOK_NonWhitespace have been encountered
// (which would be the state's sprite and frame specifiers), nearly normal
// processing resumes, with the exception that various identifiers
// used for state options will be returned as tokens and not identifiers.
// This ends once a ';' or '{' character is encountered.
//
//==========================================================================
void FScanner::SetStateMode(bool stately)
{
StateMode = stately ? 2 : 0;
StateOptions = stately;
}
//==========================================================================