fixes for -D hscriptPos

This commit is contained in:
Nicolas Cannasse
2016-04-03 20:09:39 +02:00
parent d44ad07c2b
commit 98c08becd6
2 changed files with 12 additions and 0 deletions
+8
View File
@@ -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() );
+4
View File
@@ -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: