Skip to content

Commit

Permalink
More GUI parser advancements.
Browse files Browse the repository at this point in the history
  • Loading branch information
codereader committed Nov 18, 2017
1 parent 0979232 commit aae9e9a
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 6 deletions.
5 changes: 0 additions & 5 deletions libs/parser/CodeTokeniser.h
Expand Up @@ -688,11 +688,6 @@ class CodeTokeniser :
_tokenBuffer.pop_front();
_tokenBuffer.insert(_tokenBuffer.begin(), expanded.begin(), expanded.end());
}
else
{
rWarning() << "Macro expansion yields empty token list: " << _tokenBuffer.front() <<
" in " << (*_curNode)->archive->getName() << std::endl;
}
}

return; // got a token
Expand Down
10 changes: 10 additions & 0 deletions plugins/dm.gui/gui/GuiExpression.cpp
Expand Up @@ -391,6 +391,11 @@ class GuiExpressionTokeniser :
// No items in the buffer, take a peek in the underlying stream
std::string rawToken = _tokeniser.peek();

if (rawToken.empty())
{
return rawToken; // don't tokenise empty strings, just return it as it is
}

// Split up the token by using a sub-tokeniser, keeping all delimiters
parser::BasicDefTokeniser<std::string> subtokeniser(rawToken, "", _delims);

Expand Down Expand Up @@ -605,6 +610,11 @@ class GuiExpressionParser
// Helper routines
BinaryExpressionPtr getOperator()
{
if (!_tokeniser.hasMoreTokens())
{
return BinaryExpressionPtr();
}

std::string token = _tokeniser.peek();

if (token == "+")
Expand Down
2 changes: 1 addition & 1 deletion plugins/dm.gui/gui/GuiWindowDef.cpp
Expand Up @@ -169,7 +169,7 @@ void GuiWindowDef::constructFromTokens(parser::DefTokeniser& tokeniser)
// The windowDef keyword has already been parsed, so expect a name plus an opening brace here
name = tokeniser.nextToken();

if (name == "MainMenuModeSelect")
if (name == "NewGameRefreshAction")
{
int i = 6;
}
Expand Down

0 comments on commit aae9e9a

Please sign in to comment.