Skip to content

Commit dda85bb

Browse files
Merge pull request #7 from KoloInDaCrib/using-my-mighty-powers
[FEATURE] The `using` keyword
2 parents d60bb29 + 861c821 commit dda85bb

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

hscript/Expr.hx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ enum Error {
122122
enum ModuleDecl {
123123
DPackage( path : Array<String> );
124124
DImport( path : Array<String>, ?everything : Bool, ?name : String );
125+
DUsing( path: Array<String> );
125126
DClass( c : ClassDecl );
126127
DTypedef( c : TypeDecl );
127128
DEnum( e : EnumDecl );

hscript/Parser.hx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1194,6 +1194,24 @@ class Parser {
11941194
}
11951195
ensure(TSemicolon);
11961196
return DImport(path, star, name);
1197+
case "using":
1198+
var path = [getIdent()];
1199+
while( true ) {
1200+
var t = token();
1201+
if( t != TDot ) {
1202+
push(t);
1203+
break;
1204+
}
1205+
t = token();
1206+
switch( t ) {
1207+
case TId(id):
1208+
path.push(id);
1209+
default:
1210+
unexpected(t);
1211+
}
1212+
}
1213+
ensure(TSemicolon);
1214+
return DUsing(path);
11971215
case "class":
11981216
var name = getIdent();
11991217
var params = parseParams();

0 commit comments

Comments
 (0)