Skip to content

Commit

Permalink
Merge pull request #191 from element-capital/master
Browse files Browse the repository at this point in the history
Allow numbers that start with decimal point.
  • Loading branch information
WillemJann authored Dec 2, 2024
2 parents ea68c74 + 6532e54 commit 22e3140
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
8 changes: 7 additions & 1 deletion src/XLParser.Tests/ParserTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,13 @@ public void Bool()
Test("false");
}


[TestMethod]
public void Number()
{
Test("123");
Test("0.95");
Test(".95");
}

[TestMethod]
public void Range()
Expand Down
2 changes: 1 addition & 1 deletion src/XLParser/ExcelFormulaGrammar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public class ExcelFormulaGrammar : Grammar
Priority = TerminalPriority.Bool
};

public Terminal NumberToken { get; } = new NumberLiteral(GrammarNames.TokenNumber, NumberOptions.None)
public Terminal NumberToken { get; } = new NumberLiteral(GrammarNames.TokenNumber, NumberOptions.AllowStartEndDot)
{
DefaultIntTypes = new[] { TypeCode.Int32, TypeCode.Int64, NumberLiteral.TypeCodeBigInt }
};
Expand Down

0 comments on commit 22e3140

Please sign in to comment.