diff --git a/hscript/Bytes.hx b/hscript/Bytes.hx index 4118d6c..c28f12e 100644 --- a/hscript/Bytes.hx +++ b/hscript/Bytes.hx @@ -130,6 +130,9 @@ class Bytes { } function doEncode( e : Expr ) { + #if hscriptPos + var e = e.e; + #end bout.addByte(Type.enumIndex(e)); switch( e ) { case EConst(c): @@ -234,6 +237,11 @@ class Bytes { } function doDecode() : Expr { + #if hscriptPos + return { e : _doDecode(), pmin : 0, pmax : 0 }; + } + function _doDecode() : ExprDef { + #end return switch( bin.get(pin++) ) { case 0: EConst( doDecodeConst() ); diff --git a/hscript/Parser.hx b/hscript/Parser.hx index 3bc7831..33f0c7e 100644 --- a/hscript/Parser.hx +++ b/hscript/Parser.hx @@ -738,7 +738,11 @@ class Parser { case TOp(op): if( op == ">" ) break; if( op.charCodeAt(0) == ">".code ) { + #if hscriptPos + tokens.add({ t : TOp(op.substr(1)), min : tokenMax - op.length - 1, max : tokenMax }); + #else tokens.add(TOp(op.substr(1))); + #end break; } default: