Skip to content

Commit

Permalink
#4900: Def blocks not always have whitespace between the block name a…
Browse files Browse the repository at this point in the history
…nd the opening brace, this has been causing parser failures
  • Loading branch information
codereader committed Jan 23, 2021
1 parent a5a9d39 commit b82e439
Showing 1 changed file with 20 additions and 17 deletions.
37 changes: 20 additions & 17 deletions libs/parser/DefBlockTokeniser.h
Original file line number Diff line number Diff line change
Expand Up @@ -143,27 +143,30 @@ class DefBlockTokeniserFunc
// Fall through

case TOKEN_STARTED:
// Here a delimiter indicates a successful token match
if (isDelim(ch)) {
if (isDelim(ch))
{
// A delimiter indicates the name is complete
_state = SEARCHING_BLOCK;
continue;
continue;
}

// The character is pointing at a non-delimiter. Switch on it.
switch (ch) {
else if (ch == _blockStartChar)
{
// Some defs don't have whitespaces between name and block
_state = SEARCHING_BLOCK;
continue;
}
else if (ch == '/')
{
// Found a slash, possibly start of comment
case '/':
_state = FORWARDSLASH;
++next;
continue; // skip slash, will need to add it back if this is not a comment

// General case. Token lasts until next delimiter.
default:
tok.name += ch;
++next;
continue;
_state = FORWARDSLASH;
++next;
continue; // skip slash, will need to add it back if this is not a comment
}
break;

// Token lasts until we find some of the above, append and continue
tok.name += ch;
++next;
continue;

case SEARCHING_BLOCK:
if (isDelim(ch)) {
Expand Down

0 comments on commit b82e439

Please sign in to comment.