Skip to content

Commit

Permalink
fixed positions when using inserted tokens in relaxed mode (#145)
Browse files Browse the repository at this point in the history
* fixed positions when using inserted tokens in relaxed mode
* prepare version 1.0.17
  • Loading branch information
AlexHaxe authored Mar 6, 2019
1 parent 51a30d4 commit e1d4742
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 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.0.17 (2019-03-06)

- Fixed wrong position of elements preceeding inserted dummy tokens in relax mode [#145](https://github.com/HaxeCheckstyle/tokentree/issues/145)

## version 1.0.16 (2019-03-04)

- Added `TokenTreeCheckUtils.isMetadata` [#143](https://github.com/HaxeCheckstyle/tokentree/issues/143)
Expand Down
2 changes: 1 addition & 1 deletion haxelib.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"AlexHaxe"
],
"releasenote": "bugfixes - see CHANGELOG for details",
"version": "1.0.16",
"version": "1.0.17",
"url": "https://github.com/HaxeCheckstyle/tokentree",
"dependencies": {}
}
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.0.16",
"version": "1.0.17",
"description": "TokenTree library used by haxe-checkstyle, haxe-formatter and haxe-languageserver",
"repository": {
"type": "git",
Expand Down
18 changes: 13 additions & 5 deletions src/tokentree/TokenStream.hx
Original file line number Diff line number Diff line change
Expand Up @@ -329,14 +329,22 @@ class TokenStream {
}

function createDummyToken(tokDef:TokenDef):TokenTree {
var pos:Null<Position> = null;
var pos:Position;
if ((current < 0) || (current >= tokens.length)) {
pos = tokens[tokens.length - 1].pos;
pos.min = pos.max;
var prevPos:Position = tokens[tokens.length - 1].pos;
pos = {
min: prevPos.max,
max: prevPos.max,
file: prevPos.file
}
}
else {
pos = tokens[current].pos;
pos.max = pos.min;
var prevPos:Position = tokens[current].pos;
pos = {
min: prevPos.min,
max: prevPos.min,
file: prevPos.file
}
}
return new TokenTree(tokDef, "", pos, -1, true);
}
Expand Down

0 comments on commit e1d4742

Please sign in to comment.