Skip to content

Commit

Permalink
Preprocessor: #define - Insert whitespace token when tokens are separ…
Browse files Browse the repository at this point in the history
…ated by one or more
  • Loading branch information
Nenkai committed Mar 31, 2023
1 parent 5621abc commit df6370a
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions GTAdhocToolchain.Preprocessor/AdhocScriptPreprocessor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,13 @@ private void DoDefine()
if (_lookahead.Location.Start.Line != startLine)
break;

// If the next token is separated by a whitespace, insert one as a token
if (define.Content.Count > 0)
{
if (define.Content[^1].Location.End != _lookahead.Location.Start)
define.Content.Add(new Token() { Value = " "});
}

define.Content.Add(_lookahead);
}

Expand Down

0 comments on commit df6370a

Please sign in to comment.