Skip to content

Commit

Permalink
Fixes issue #117 - long empty comments not lexed correctly.
Browse files Browse the repository at this point in the history
  • Loading branch information
xanathar committed Dec 7, 2015
1 parent fdbeb97 commit c193d3d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 8 additions & 0 deletions src/MoonSharp.Interpreter.Tests/EndToEnd/SimpleTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,14 @@ namespace MoonSharp.Interpreter.Tests
[TestFixture]
public class SimpleTests
{
[Test]
public void EmptyLongComment()
{
Script S = new Script(CoreModules.None);
DynValue res = S.DoString("--[[]]");
}


[Test]
public void EmptyChunk()
{
Expand Down
2 changes: 1 addition & 1 deletion src/MoonSharp.Interpreter/Tree/Lexer/Lexer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ private Token ReadComment(int fromLine, int fromCol)
if (c == '[' && !extraneousFound && text.Length > 0)
{
text.Append('[');
CursorCharNext();
//CursorCharNext();
string comment = ReadLongString(fromLine, fromCol, text.ToString(), "comment");
return CreateToken(TokenType.Comment, fromLine, fromCol, comment);
}
Expand Down

0 comments on commit c193d3d

Please sign in to comment.