- Add a preliminary grammar and a test driver for it.

SVN r2233 (scripting)
This commit is contained in:
Randy Heit 2010-03-19 04:04:13 +00:00
commit 7aa402b2a5
11 changed files with 972 additions and 16 deletions

View file

@ -119,6 +119,7 @@ FScanner &FScanner::operator=(const FScanner &other)
LastGotLine = other.LastGotLine;
CMode = other.CMode;
Escape = other.Escape;
StateMode = other.StateMode;
// Copy public members
if (other.String == other.StringBuffer)
@ -262,6 +263,7 @@ void FScanner::PrepareScript ()
LastGotLine = 1;
CMode = false;
Escape = true;
StateMode = 0;
StringBuffer[0] = '\0';
BigStringBuffer = "";
}
@ -359,6 +361,34 @@ void FScanner::SetEscape (bool esc)
Escape = esc;
}
//==========================================================================
//
// FScanner :: SetStateMode
//
// Enters state mode. This mode is very permissive for identifiers, which
// it returns as TOK_NonWhitespace. The only character sequences that are
// not returned as such are these:
//
// * stop
// * wait
// * fail
// * loop
// * goto - Automatically exits state mode after it's seen.
// * :
// * ;
// * } - 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.
//
//==========================================================================
void FScanner::SetStateMode(bool stately)
{
StateMode = stately ? 2 : 0;
}
//==========================================================================
//
// FScanner::ScanString