diff --git a/CHANGELOG.md b/CHANGELOG.md index 816c95f..f7d6077 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## dev branch / next version (1.x.x) +## version 1.2.3 (2022-09-14) + +- Fixed suffixes for negative numeric literals + ## version 1.2.2 (2022-09-14) - Updated haxeparser to support latest Haxe nightly syntax diff --git a/haxelib.json b/haxelib.json index afb7719..5898981 100644 --- a/haxelib.json +++ b/haxelib.json @@ -7,8 +7,8 @@ "contributors": [ "AlexHaxe" ], - "releasenote": "updated haxeparser to support latest Haxe nightly syntax - see CHANGELOG for details", - "version": "1.2.2", + "releasenote": "fixed suffixes for negative numeric literals - see CHANGELOG for details", + "version": "1.2.3", "url": "https://github.com/HaxeCheckstyle/tokentree", "dependencies": {} } \ No newline at end of file diff --git a/package-lock.json b/package-lock.json index 6924839..d37ba98 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "tokentree", - "version": "1.2.2", + "version": "1.2.3", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "tokentree", - "version": "1.2.2", + "version": "1.2.3", "license": "MIT", "devDependencies": { "lix": "^15.11.6" diff --git a/package.json b/package.json index 9cd6b79..0e28839 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "tokentree", - "version": "1.2.2", + "version": "1.2.3", "description": "TokenTree library used by haxe-checkstyle, haxe-formatter and haxe-languageserver", "repository": { "type": "git", diff --git a/src/tokentree/TokenStream.hx b/src/tokentree/TokenStream.hx index b56ecab..daea242 100644 --- a/src/tokentree/TokenStream.hx +++ b/src/tokentree/TokenStream.hx @@ -340,12 +340,21 @@ class TokenStream { return new TokenTree(tok.tok, tok.space, tok.pos, tok.index); } switch (token()) { + #if (haxe >= version("4.3.0-rc.1")) + case Const(CInt(v, s)): + var const:TokenTree = consumeConst(); + return new TokenTree(Const(CInt('-$v', s)), const.space, {file: tok.pos.file, min: tok.pos.min, max: const.pos.max}, tok.index); + case Const(CFloat(v, s)): + var const:TokenTree = consumeConst(); + return new TokenTree(Const(CFloat('-$v', s)), const.space, {file: tok.pos.file, min: tok.pos.min, max: const.pos.max}, tok.index); + #else case Const(CInt(n)): var const:TokenTree = consumeConst(); return new TokenTree(Const(CInt('-$n')), const.space, {file: tok.pos.file, min: tok.pos.min, max: const.pos.max}, tok.index); case Const(CFloat(n)): var const:TokenTree = consumeConst(); return new TokenTree(Const(CFloat('-$n')), const.space, {file: tok.pos.file, min: tok.pos.min, max: const.pos.max}, tok.index); + #end default: throw NO_MORE_TOKENS; }