Skip to content

Commit

Permalink
bugfix for #38
Browse files Browse the repository at this point in the history
  • Loading branch information
pieterderycke committed Jan 2, 2019
1 parent 25b8d70 commit e3d660d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
34 changes: 34 additions & 0 deletions Jace.Tests/TokenReaderTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -521,5 +521,39 @@ public void TestTokenReader23()
Assert.AreEqual(0, tokens[0].StartPosition);
Assert.AreEqual(6, tokens[0].Length);
}

[TestMethod]
public void TestTokenReader24()
{
TokenReader reader = new TokenReader(CultureInfo.InvariantCulture);
List<Token> tokens = reader.Read("1 * e");

Assert.AreEqual(3, tokens.Count);

Assert.AreEqual(1, tokens[0].Value);
Assert.AreEqual(0, tokens[0].StartPosition);
Assert.AreEqual(1, tokens[0].Length);

Assert.AreEqual('*', tokens[1].Value);
Assert.AreEqual(2, tokens[1].StartPosition);
Assert.AreEqual(1, tokens[1].Length);

Assert.AreEqual("e", tokens[2].Value);
Assert.AreEqual(4, tokens[2].StartPosition);
Assert.AreEqual(1, tokens[2].Length);
}

[TestMethod]
public void TestTokenReader25()
{
TokenReader reader = new TokenReader(CultureInfo.InvariantCulture);
List<Token> tokens = reader.Read("e");

Assert.AreEqual(1, tokens.Count);

Assert.AreEqual("e", tokens[0].Value);
Assert.AreEqual(0, tokens[0].StartPosition);
Assert.AreEqual(1, tokens[0].Length);
}
}
}
2 changes: 1 addition & 1 deletion Jace/Tokenizer/TokenReader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ public List<Token> Read(string formula)

private bool IsPartOfNumeric(char character, bool isFirstCharacter, bool isFormulaSubPart)
{
return character == decimalSeparator || (character >= '0' && character <= '9') || (isFormulaSubPart && isFirstCharacter && character == '-') || character == 'e' || character == 'E';
return character == decimalSeparator || (character >= '0' && character <= '9') || (isFormulaSubPart && isFirstCharacter && character == '-') || (!isFirstCharacter && character == 'e') || (!isFirstCharacter && character == 'E');
}

private bool IsPartOfVariable(char character, bool isFirstCharacter)
Expand Down
2 changes: 1 addition & 1 deletion buildNuGetPackage.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET jaceVersion="0.9.1"
SET jaceVersion="0.9.2"

SET msbuild="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"

Expand Down
2 changes: 1 addition & 1 deletion buildZipPackage.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET version=0.9.1
SET version=0.9.2

SET msbuild="C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\MSBuild\15.0\Bin\msbuild.exe"

Expand Down

0 comments on commit e3d660d

Please sign in to comment.