Skip to content

Commit

Permalink
fixed suffixes for negative numeric literals
Browse files Browse the repository at this point in the history
  • Loading branch information
AlexHaxe committed Sep 14, 2022
1 parent a36d74c commit a1be77a
Show file tree
Hide file tree
Showing 5 changed files with 18 additions and 5 deletions.
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.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
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": "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": {}
}
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.2",
"version": "1.2.3",
"description": "TokenTree library used by haxe-checkstyle, haxe-formatter and haxe-languageserver",
"repository": {
"type": "git",
Expand Down
9 changes: 9 additions & 0 deletions src/tokentree/TokenStream.hx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down

0 comments on commit a1be77a

Please sign in to comment.