Added String.fromCharCode, "a".code

Added a preprocessor
This commit is contained in:
NeeEoo
2024-04-25 17:23:35 +02:00
parent 6c77566fea
commit fb8f35e2a5
11 changed files with 277 additions and 111 deletions
+12
View File
@@ -163,6 +163,14 @@ class Parser {
opPriority.set(x, x == "++" || x == "--" ? -1 : -2);
}
public static inline function getBaseError( err ):Error {
#if hscriptPos
return new Error(err, 0, 0, "", 0);
#else
return err;
#end
}
public inline function error( err, pmin, pmax ) {
if( !resumeErrors )
#if hscriptPos
@@ -215,6 +223,7 @@ class Parser {
parseFullExpr(a);
}
var expr = if( a.length == 1 ) a[0] else mk(EBlock(a),0);
expr = Preprocessor.process(expr);
if(Parser.optimize) {
expr = Optimizer.optimize(expr);
var printer = new Printer();
@@ -1880,6 +1889,9 @@ class Parser {
interpString.push(arr);
interpolation = false;
if(arr.length == 2) // If its just ()
error(EPreset(EMPTY_INTERPOLATION), p1, p1);
if( StringTools.isEof(peekChar()) )
break;