Skip to content

Commit 7cbfe23

Browse files
committed
refactored for tokentree API change
1 parent 5f6e2d0 commit 7cbfe23

File tree

62 files changed

+257
-261
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

62 files changed

+257
-261
lines changed

.haxerc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
{
2-
"version": "4.1.1",
2+
"version": "4.1.2",
33
"resolveLibs": "scoped"
44
}

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
- Added support for final in `MagicNumber`, fixes [#494](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/494) ([#495](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/495))
66
- Fixed handling `OBJECT_DECL` token in `RightCurly`, fixes [#496](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/496) ([#497](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/497))
77
- Reorganised build files ([#498](https://github.com/HaxeCheckstyle/haxe-checkstyle/issues/498))
8+
- Refactored for tokentree API change
89

910
## version 2.6.1 (2019-12-17)
1011

checkstyle.json

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -153,15 +153,6 @@
153153
},
154154
"type": "HiddenField"
155155
},
156-
{
157-
"type": "Indentation"
158-
},
159-
{
160-
"props": {
161-
"character": "tab"
162-
},
163-
"type": "IndentationCharacter"
164-
},
165156
{
166157
"type": "InnerAssignment"
167158
},

haxe3_libraries/tokentree.hxml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
# @install: lix --silent download "gh://github.com/HaxeCheckstyle/tokentree#119c4cefa927018472cd57f5de1063d43f00da95" into tokentree/1.0.24/github/119c4cefa927018472cd57f5de1063d43f00da95
2-
-cp ${HAXE_LIBCACHE}/tokentree/1.0.24/github/119c4cefa927018472cd57f5de1063d43f00da95/src
3-
-D tokentree=1.0.24
1+
# @install: lix --silent download "haxelib:/tokentree#1.0.28" into tokentree/1.0.28/haxelib
2+
# -cp ${HAXE_LIBCACHE}/tokentree/1.0.28/haxelib/src
3+
-D tokentree=1.0.28
4+
-cp /home/blum/Projekte/github/checkstyle/tokentree/src

haxe_libraries/haxeparser.hxml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
-D haxeparser=3.3.0
2-
# @install: lix --silent download "gh://github.com/Simn/haxeparser#e5746bfc55c09a3694db42738ff575b91441971a" into haxeparser/3.3.0/github/e5746bfc55c09a3694db42738ff575b91441971a
1+
# @install: lix --silent download "gh://github.com/simn/haxeparser#00b509e8690300ca6366aa8d0d4d97bd29fbcf2b" into haxeparser/3.3.0/github/00b509e8690300ca6366aa8d0d4d97bd29fbcf2b
32
-lib hxparse
4-
-cp ${HAXE_LIBCACHE}/haxeparser/3.3.0/github/e5746bfc55c09a3694db42738ff575b91441971a/src
3+
-cp ${HAXE_LIBCACHE}/haxeparser/3.3.0/github/00b509e8690300ca6366aa8d0d4d97bd29fbcf2b/src
4+
-D haxeparser=3.3.0

haxe_libraries/tokentree.hxml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
# @install: lix --silent download "gh://github.com/HaxeCheckstyle/tokentree#119c4cefa927018472cd57f5de1063d43f00da95" into tokentree/1.0.24/github/119c4cefa927018472cd57f5de1063d43f00da95
2-
-cp ${HAXE_LIBCACHE}/tokentree/1.0.24/github/119c4cefa927018472cd57f5de1063d43f00da95/src
3-
-D tokentree=1.0.24
1+
# @install: lix --silent download "haxelib:/tokentree#1.0.28" into tokentree/1.0.28/haxelib
2+
# -cp ${HAXE_LIBCACHE}/tokentree/1.0.28/haxelib/src
3+
-D tokentree=1.0.28
4+
-cp /home/blum/Projekte/github/checkstyle/tokentree/src

src/checkstyle/Checker.hx

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,8 @@ class Checker {
132132
t = lexer.token(haxeparser.HaxeLexer.tok);
133133
}
134134
}
135-
catch (e:Any) {
135+
catch (e:haxe.Exception) {
136+
trace(e.details());
136137
ErrorUtils.handleException(e, file, "makeTokens");
137138
}
138139
}
@@ -160,7 +161,8 @@ class Checker {
160161
try {
161162
return parser.parse();
162163
}
163-
catch (e:Any) {
164+
catch (e:haxe.Exception) {
165+
trace(e.details());
164166
if (!allowFailingAST) {
165167
ErrorUtils.handleException(e, file, "makeAST [" + defines.join(",") + "]");
166168
}
@@ -210,7 +212,8 @@ class Checker {
210212
getTokenTree();
211213
excludesRanges = ExcludeManager.INSTANCE.getPosExcludes(this);
212214
}
213-
catch (e:Any) {
215+
catch (e:haxe.Exception) {
216+
trace(e.details());
214217
ErrorUtils.handleException(e, file, "createContext");
215218
return false;
216219
}

src/checkstyle/checks/block/BlockBreakingConditionalCheck.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ class BlockBreakingConditionalCheck extends Check {
1212

1313
override function actualRun() {
1414
var root:TokenTree = checker.getTokenTree();
15-
var allBrs:Array<TokenTree> = root.filter([BrOpen, BrClose], ALL);
15+
var allBrs:Array<TokenTree> = root.filter([BrOpen, BrClose], All);
1616

1717
for (br in allBrs) {
1818
if (isPosSuppressed(br.pos)) continue;

src/checkstyle/checks/block/ConditionalCompilationCheck.hx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ class ConditionalCompilationCheck extends Check {
2929

3030
override function actualRun() {
3131
var root:TokenTree = checker.getTokenTree();
32-
checkSharpIf(root.filter([Sharp("if")], ALL));
32+
checkSharpIf(root.filter([Sharp("if")], All));
3333
}
3434

3535
function checkSharpIf(tokens:Array<TokenTree>) {

src/checkstyle/checks/block/EmptyBlockCheck.hx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ class EmptyBlockCheck extends Check {
5959

6060
override function actualRun() {
6161
var root:TokenTree = checker.getTokenTree();
62-
var allBrOpen:Array<TokenTree> = root.filter([BrOpen], ALL);
62+
var allBrOpen:Array<TokenTree> = root.filter([BrOpen], All);
6363

6464
for (brOpen in allBrOpen) {
6565
if (isPosSuppressed(brOpen.pos)) continue;
@@ -78,7 +78,7 @@ class EmptyBlockCheck extends Check {
7878
}
7979

8080
function filterParentToken(token:TokenTree):Bool {
81-
if ((token == null) || (token.tok == null)) return false;
81+
if ((token == null) || (token.tok == Root)) return false;
8282
switch (token.tok) {
8383
case Kwd(KwdClass):
8484
return !hasToken(CLASS_DEF);

0 commit comments

Comments
 (0)