Skip to content

Commit

Permalink
Update WordParser.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
Hoeksema authored Feb 15, 2024
1 parent 5174fac commit 9c68fd3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions source/Handlebars/Compiler/Lexer/Parsers/WordParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,16 +44,7 @@ private static string AccumulateWord(ExtendedStringReader reader)

while (true)
{
if (isEscaped)
{
var c = (char) reader.Read();
if (c == ']') isEscaped = false;

buffer.Append(c);
continue;
}

if (!inString)
if (!inString && !isEscaped)
{
var peek = (char) reader.Peek();

Expand All @@ -70,6 +61,15 @@ private static string AccumulateWord(ExtendedStringReader reader)
throw new HandlebarsParserException("Reached end of template before the expression was closed.", reader.GetContext());
}

if (isEscaped)
{
var c = (char) node;
if (c == ']') isEscaped = false;

buffer.Append(c);
continue;
}

if (node == '[' && !inString)
{
isEscaped = true;
Expand Down

0 comments on commit 9c68fd3

Please sign in to comment.