Skip to content

Commit

Permalink
fixed parsing single false, true or null
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed Jul 30, 2024
1 parent c69d45e commit 3738d89
Show file tree
Hide file tree
Showing 9 changed files with 24 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/tokentree.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
haxe-version: ['4.3.4', 'nightly']
haxe-version: ['4.3.5', 'nightly']
steps:
- uses: actions/checkout@v4
- name: Use Node.js 18
Expand Down
2 changes: 1 addition & 1 deletion .haxerc
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"version": "4.3.4",
"version": "4.3.5",
"resolveLibs": "scoped"
}
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## dev branch / next version (1.x.x)

## version 1.2.12 (2024-07-30)

- Fixed parsing a single `false`, `true` or `null`

## version 1.2.11 (2024-02-10)

- Added getBkOpenType utils function
Expand Down
4 changes: 2 additions & 2 deletions haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@
"contributors": [
"AlexHaxe"
],
"releasenote": "fixed empty switch cases with comments; added getBkOpenType utils function - see CHANGELOG for details",
"version": "1.2.11",
"releasenote": "fixed parsing a single false, true or null - see CHANGELOG for details",
"version": "1.2.12",
"url": "https://github.com/HaxeCheckstyle/tokentree",
"dependencies": {}
}
2 changes: 1 addition & 1 deletion makeReleaseZip.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

npm install
npx lix download
npx lix use haxe 4.3.3
npx lix use haxe 4.3.5

haxe test.hxml

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tokentree",
"version": "1.2.11",
"version": "1.2.12",
"description": "TokenTree library used by haxe-checkstyle, haxe-formatter and haxe-languageserver",
"repository": {
"type": "git",
Expand Down
3 changes: 3 additions & 0 deletions src/tokentree/walk/WalkStatement.hx
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,9 @@ class WalkStatement {
case Kwd(KwdNull), Kwd(KwdTrue), Kwd(KwdFalse):
var newChild:TokenTree = stream.consumeToken();
parent.addChild(newChild);
if (!stream.hasMore()) {
return false;
}
switch (stream.token()) {
case Binop(OpBoolAnd), Binop(OpBoolOr): walkOpBool(stream, newChild);
case Question: WalkQuestion.walkQuestion(stream, newChild);
Expand Down
9 changes: 9 additions & 0 deletions test/tokentree/TokenTreeBuilderParsingTest.hx
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,9 @@ class TokenTreeBuilderParsingTest implements ITest {
assertCodeParses(CALL_WITHOUT_SEMICOLON);
assertCodeParses(ARRAY_ACCESSS_WITHOUT_SEMICOLON);
assertCodeParses(UNICODE_REGEX);
assertCodeParses(TRUE);
assertCodeParses(FALSE);
assertCodeParses(NULL);
}

public function assertCodeParses(code:String, ?pos:PosInfos) {
Expand Down Expand Up @@ -1896,4 +1899,10 @@ import #if haxe4 js.lib.Promise #else js.Promise #end as JsPromise;
var UNICODE_REGEX = "
static final ctrlCharacters = ~/[\\u0000-\\u001F\\u007F-\\u009F\\u2000-\\u200D\\uFEFF]/g;
";

var TRUE = "true";

var FALSE = "false";

var NULL = "null";
}

0 comments on commit 3738d89

Please sign in to comment.