Escape quotes in double-quoted string literals
This commit is contained in:
parent
35f261e74f
commit
a53a02fe0b
@ -261,5 +261,16 @@ namespace Lexer.Tests
|
||||
Assert.Less(1, tokens.Count);
|
||||
}
|
||||
}
|
||||
|
||||
[TestCase(".42i")]
|
||||
[TestCase("42i")]
|
||||
[TestCase("42e-1i")]
|
||||
public void ParseComplexNumbers(string text)
|
||||
{
|
||||
var sut = CreateLexer(text);
|
||||
var tokens = sut.ParseAll();
|
||||
Assert.AreEqual(2, tokens.Count);
|
||||
Assert.AreEqual(TokenKind.NumberLiteral, tokens[0].Kind);
|
||||
}
|
||||
}
|
||||
}
|
@ -359,6 +359,10 @@ namespace Lexer
|
||||
|
||||
if (success)
|
||||
{
|
||||
if (Window.PeekChar(n) == 'i' || Window.PeekChar(n) == 'j')
|
||||
{
|
||||
n++;
|
||||
}
|
||||
var s = Window.GetAndConsumeChars(n);
|
||||
return PureTokenFactory.CreateNumberLiteral(s);
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user