From cc425a710d71eeb81854f816445a47c5c5654653 Mon Sep 17 00:00:00 2001 From: Kolo <67389779+JustKolosaki@users.noreply.github.com> Date: Sat, 22 Feb 2025 20:22:31 +0100 Subject: [PATCH] the keyword using --- hscript/Expr.hx | 1 + hscript/Parser.hx | 18 ++++++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/hscript/Expr.hx b/hscript/Expr.hx index 1571b613..1aa1b99a 100644 --- a/hscript/Expr.hx +++ b/hscript/Expr.hx @@ -120,6 +120,7 @@ enum Error { enum ModuleDecl { DPackage( path : Array ); DImport( path : Array, ?everything : Bool ); + DUsing( path: Array ); DClass( c : ClassDecl ); DTypedef( c : TypeDecl ); } diff --git a/hscript/Parser.hx b/hscript/Parser.hx index d3c85604..47193a9c 100644 --- a/hscript/Parser.hx +++ b/hscript/Parser.hx @@ -1142,6 +1142,24 @@ class Parser { } ensure(TSemicolon); return DImport(path, star); + case "using": + var path = [getIdent()]; + while( true ) { + var t = token(); + if( t != TDot ) { + push(t); + break; + } + t = token(); + switch( t ) { + case TId(id): + path.push(id); + default: + unexpected(t); + } + } + ensure(TSemicolon); + return DUsing(path); case "class": var name = getIdent(); var params = parseParams();