Skip whitespace by default in lexer
This commit is contained in:
parent
19804367b3
commit
49ad910474
4 changed files with 14 additions and 8 deletions
|
|
@ -25,21 +25,21 @@ describe("arithmetic", []() {
|
|||
});
|
||||
|
||||
it("parses products of variables", [&]() {
|
||||
TSDocumentSetText(document, "x+y");
|
||||
TSDocumentSetText(document, "x + y");
|
||||
AssertThat(string(TSDocumentToString(document)), Equals(
|
||||
"(expression (term (factor (variable))) (plus) (term (factor (variable))))"));
|
||||
|
||||
TSDocumentSetText(document, "x*y");
|
||||
TSDocumentSetText(document, "x * y");
|
||||
AssertThat(string(TSDocumentToString(document)), Equals(
|
||||
"(expression (term (factor (variable)) (times) (factor (variable))))"));
|
||||
});
|
||||
|
||||
it("parses complex trees", [&]() {
|
||||
TSDocumentSetText(document, "x*y+z*a");
|
||||
TSDocumentSetText(document, "x * y + z * a");
|
||||
AssertThat(string(TSDocumentToString(document)), Equals(
|
||||
"(expression (term (factor (variable)) (times) (factor (variable))) (plus) (term (factor (variable)) (times) (factor (variable))))"));
|
||||
|
||||
TSDocumentSetText(document, "x*(y+z)");
|
||||
TSDocumentSetText(document, "x * (y + z)");
|
||||
AssertThat(string(TSDocumentToString(document)), Equals(
|
||||
"(expression (term (factor (variable)) (times) (factor (expression (term (factor (variable))) (plus) (term (factor (variable)))))))"));
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue