Skip to content

Commit

Permalink
Merge pull request #28 from AlexHaxe/master
Browse files Browse the repository at this point in the history
support for KwdExtern in package and import lines
Simn committed Dec 2, 2015
2 parents 317838b + 531d7a9 commit 83f39d0
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/haxeparser/HaxeParser.hx
Original file line number Diff line number Diff line change
@@ -448,6 +448,7 @@ class HaxeParser extends hxparse.Parser<HaxeTokenSource, Token> implements hxpar
return switch stream {
case [{tok:Const(CIdent(i))} && isLowerIdent(i)]: i;
case [{tok:Kwd(KwdMacro)}]: "macro";
case [{tok:Kwd(KwdExtern)}]: "extern";
}
}

@@ -598,6 +599,8 @@ class HaxeParser extends hxparse.Parser<HaxeTokenSource, Token> implements hxpar
acc.push({pack:k,pos:p});
case [{tok:Kwd(KwdMacro), pos:p}]:
acc.push({pack:"macro",pos:p});
case [{tok:Kwd(KwdExtern), pos:p}]:
acc.push({pack:"extern",pos:p});
case [{tok:Binop(OpMult)}, {tok:Semicolon, pos:p2}]:
return {
decl: EImport(acc, IAll),
4 changes: 3 additions & 1 deletion test/Test.hx
Original file line number Diff line number Diff line change
@@ -256,6 +256,8 @@ class Test extends haxe.unit.TestCase {
function testPackage() {
assertEquals(0, parseFile("package;").pack.length);
assertEquals(1, parseFile("package x;").pack.length);
assertEquals(2, parseFile("package haxe.macro;").pack.length);
assertEquals(2, parseFile("package haxe.extern;").pack.length);
assertEquals(1, parseFile(
"//test\n"
+ "package x;"
@@ -486,4 +488,4 @@ class Test extends haxe.unit.TestCase {
}
assertEquals(whitespaceEreg.replace(expectedCode, ""), whitespaceEreg.replace(inputParsed, ""), p);
}
}
}

0 comments on commit 83f39d0

Please sign in to comment.