From 0435566da6c077dbf93f705929ee4e5c6e1d92ca Mon Sep 17 00:00:00 2001 From: Kolo <67389779+JustKolosaki@users.noreply.github.com> Date: Sun, 16 Feb 2025 14:56:00 +0100 Subject: [PATCH] class renaming --- hscript/Expr.hx | 2 +- hscript/Parser.hx | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/hscript/Expr.hx b/hscript/Expr.hx index bc020421..9876f36e 100644 --- a/hscript/Expr.hx +++ b/hscript/Expr.hx @@ -122,7 +122,7 @@ enum Error { enum ModuleDecl { DPackage( path : Array ); - DImport( path : Array, ?everything : Bool ); + DImport( path : Array, ?everything : Bool, ?name : String ); DClass( c : ClassDecl ); DTypedef( c : TypeDecl ); } diff --git a/hscript/Parser.hx b/hscript/Parser.hx index 12c51e7a..2923949e 100644 --- a/hscript/Parser.hx +++ b/hscript/Parser.hx @@ -1149,8 +1149,18 @@ class Parser { unexpected(t); } } + var name = null; + if ( maybe(TId("as")) && !star) { + var t = token(); + switch( t ) { + case TId(id): + name = id; + default: + unexpected(t); + } + } ensure(TSemicolon); - return DImport(path, star); + return DImport(path, star, name); case "class": var name = getIdent(); var params = parseParams();