diff --git a/src/java/me/topchetoeu/jscript/compilation/AssignableStatement.java b/src/java/me/topchetoeu/jscript/compilation/AssignableStatement.java index be19a2b..a0e2175 100644 --- a/src/java/me/topchetoeu/jscript/compilation/AssignableStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/AssignableStatement.java @@ -1,14 +1,10 @@ package me.topchetoeu.jscript.compilation; import me.topchetoeu.jscript.common.Operation; -import me.topchetoeu.jscript.common.parsing.Location; -public abstract class AssignableStatement extends Statement { +public interface AssignableStatement { public abstract Statement toAssign(Statement val, Operation operation); - protected AssignableStatement(Location loc) { - super(loc); - } // private static final Map operations = Map.ofEntries( // Map.entry("*=", Operation.MULTIPLY), // Map.entry("/=", Operation.DIVIDE), diff --git a/src/java/me/topchetoeu/jscript/compilation/CompoundStatement.java b/src/java/me/topchetoeu/jscript/compilation/CompoundStatement.java index f2094c1..ca04696 100644 --- a/src/java/me/topchetoeu/jscript/compilation/CompoundStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/CompoundStatement.java @@ -75,7 +75,7 @@ public class CompoundStatement extends Statement { if (!src.is(i + n, ",")) return ParseRes.failed(); n++; - var res = ES5.parseExpression(src, i + n, 2); + var res = JavaScript.parseExpression(src, i + n, 2); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected a value after the comma"); n += res.n; @@ -102,7 +102,7 @@ public class CompoundStatement extends Statement { continue; } - var res = ES5.parseStatement(src, i + n); + var res = JavaScript.parseStatement(src, i + n); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected a statement"); n += res.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/ES5.java b/src/java/me/topchetoeu/jscript/compilation/JavaScript.java similarity index 96% rename from src/java/me/topchetoeu/jscript/compilation/ES5.java rename to src/java/me/topchetoeu/jscript/compilation/JavaScript.java index b68d46c..a07e92b 100644 --- a/src/java/me/topchetoeu/jscript/compilation/ES5.java +++ b/src/java/me/topchetoeu/jscript/compilation/JavaScript.java @@ -43,7 +43,7 @@ import me.topchetoeu.jscript.compilation.values.operations.TypeofStatement; import me.topchetoeu.jscript.compilation.values.operations.VariableIndexStatement; import me.topchetoeu.jscript.runtime.exceptions.SyntaxException; -public class ES5 { +public class JavaScript { static final Set reserved = Set.of( "true", "false", "void", "null", "this", "if", "else", "try", "catch", "finally", "for", "do", "while", "switch", "case", "default", "new", @@ -59,7 +59,7 @@ public class ES5 { if (!openParen.isSuccess()) return openParen.chainError(); n += openParen.n; - var res = ES5.parseExpression(src, i + n, 0); + var res = JavaScript.parseExpression(src, i + n, 0); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected an expression in parens"); n += res.n; @@ -74,7 +74,7 @@ public class ES5 { return ParseRes.first(src, i, (a, b) -> statement ? ParseRes.failed() : ObjectStatement.parse(a, b), (a, b) -> statement ? ParseRes.failed() : FunctionStatement.parseFunction(a, b, false), - ES5::parseLiteral, + JavaScript::parseLiteral, StringStatement::parse, RegexStatement::parse, NumberStatement::parse, @@ -82,7 +82,7 @@ public class ES5 { ChangeStatement::parsePrefixIncrease, OperationStatement::parsePrefix, ArrayStatement::parse, - ES5::parseParens, + JavaScript::parseParens, CallStatement::parseNew, TypeofStatement::parse, DiscardStatement::parse, @@ -162,7 +162,7 @@ public class ES5 { var res = parseExpression(src, i, 0, true); if (!res.isSuccess()) return res.chainError(); - var end = ES5.parseStatementEnd(src, i + res.n); + var end = JavaScript.parseStatementEnd(src, i + res.n); if (!end.isSuccess()) return ParseRes.error(src.loc(i + res.n), "Expected an end of statement"); return res.addN(end.n); @@ -191,7 +191,7 @@ public class ES5 { TryStatement::parse, CompoundStatement::parse, (s, j) -> FunctionStatement.parseFunction(s, j, true), - ES5::parseExpressionStatement + JavaScript::parseExpressionStatement ); return res.addN(n); } @@ -232,7 +232,7 @@ public class ES5 { } public static boolean checkVarName(String name) { - return !ES5.reserved.contains(name); + return !JavaScript.reserved.contains(name); } public static ParseRes> parseParamList(Source src, int i) { @@ -297,6 +297,6 @@ public class ES5 { } public static CompileResult compile(Filename filename, String raw) { - return ES5.compile(ES5.parse(filename, raw)); + return JavaScript.compile(JavaScript.parse(filename, raw)); } } diff --git a/src/java/me/topchetoeu/jscript/compilation/VariableDeclareStatement.java b/src/java/me/topchetoeu/jscript/compilation/VariableDeclareStatement.java index ef5b7aa..603a3c8 100644 --- a/src/java/me/topchetoeu/jscript/compilation/VariableDeclareStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/VariableDeclareStatement.java @@ -63,7 +63,7 @@ public class VariableDeclareStatement extends Statement { var res = new ArrayList(); - var end = ES5.parseStatementEnd(src, i + n); + var end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new VariableDeclareStatement(loc, res), n); @@ -75,7 +75,7 @@ public class VariableDeclareStatement extends Statement { if (!name.isSuccess()) return name.chainError(nameLoc, "Expected a variable name"); n += name.n; - if (!ES5.checkVarName(name.result)) { + if (!JavaScript.checkVarName(name.result)) { return ParseRes.error(src.loc(i + n), String.format("Unexpected identifier '%s'", name.result)); } @@ -85,7 +85,7 @@ public class VariableDeclareStatement extends Statement { if (src.is(i + n, "=")) { n++; - var valRes = ES5.parseExpression(src, i + n, 2); + var valRes = JavaScript.parseExpression(src, i + n, 2); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value after '='"); n += valRes.n; @@ -100,7 +100,7 @@ public class VariableDeclareStatement extends Statement { continue; } - end = ES5.parseStatementEnd(src, i + n); + end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/control/BreakStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/BreakStatement.java index 7cf3cad..d7d1758 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/BreakStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/BreakStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class BreakStatement extends Statement { @@ -29,7 +29,7 @@ public class BreakStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "break")) return ParseRes.failed(); n += 5; - var end = ES5.parseStatementEnd(src, i + n); + var end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new BreakStatement(loc, null), n); @@ -39,7 +39,7 @@ public class BreakStatement extends Statement { if (label.isFailed()) return ParseRes.error(src.loc(i + n), "Expected a label name or an end of statement"); n += label.n; - end = ES5.parseStatementEnd(src, i + n); + end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new BreakStatement(loc, label.result), n); diff --git a/src/java/me/topchetoeu/jscript/compilation/control/ContinueStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/ContinueStatement.java index 8403f33..88f1551 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/ContinueStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/ContinueStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class ContinueStatement extends Statement { @@ -29,7 +29,7 @@ public class ContinueStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "continue")) return ParseRes.failed(); n += 8; - var end = ES5.parseStatementEnd(src, i + n); + var end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new ContinueStatement(loc, null), n); @@ -39,7 +39,7 @@ public class ContinueStatement extends Statement { if (label.isFailed()) return ParseRes.error(src.loc(i + n), "Expected a label name or an end of statement"); n += label.n; - end = ES5.parseStatementEnd(src, i + n); + end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new ContinueStatement(loc, label.result), n); diff --git a/src/java/me/topchetoeu/jscript/compilation/control/DebugStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/DebugStatement.java index b2fb08e..58d9fa9 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/DebugStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/DebugStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class DebugStatement extends Statement { @@ -26,7 +26,7 @@ public class DebugStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "debugger")) return ParseRes.failed(); n += 8; - var end = ES5.parseStatementEnd(src, i + n); + var end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new DebugStatement(loc), n); diff --git a/src/java/me/topchetoeu/jscript/compilation/control/DeleteStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/DeleteStatement.java index cc09617..4731feb 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/DeleteStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/DeleteStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; import me.topchetoeu.jscript.compilation.values.VariableStatement; import me.topchetoeu.jscript.compilation.values.constants.BoolStatement; @@ -32,7 +32,7 @@ public class DeleteStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "delete")) return ParseRes.failed(); n += 6; - var valRes = ES5.parseExpression(src, i + n, 15); + var valRes = JavaScript.parseExpression(src, i + n, 15); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value after 'delete'"); n += valRes.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/control/DoWhileStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/DoWhileStatement.java index bb9a42c..94cc1c5 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/DoWhileStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/DoWhileStatement.java @@ -7,7 +7,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class DoWhileStatement extends Statement { @@ -48,7 +48,7 @@ public class DoWhileStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "do")) return ParseRes.failed(); n += 2; - var bodyRes = ES5.parseStatement(src, i + n); + var bodyRes = JavaScript.parseStatement(src, i + n); if (!bodyRes.isSuccess()) return bodyRes.chainError(src.loc(i + n), "Expected a do-while body."); n += bodyRes.n; @@ -59,7 +59,7 @@ public class DoWhileStatement extends Statement { if (!src.is(i + n, "(")) return ParseRes.error(src.loc(i + n), "Expected a open paren after 'while'."); n++; - var condRes = ES5.parseExpression(src, i + n, 0); + var condRes = JavaScript.parseExpression(src, i + n, 0); if (!condRes.isSuccess()) return condRes.chainError(src.loc(i + n), "Expected a do-while condition."); n += condRes.n; n += Parsing.skipEmpty(src, i + n); @@ -67,7 +67,7 @@ public class DoWhileStatement extends Statement { if (!src.is(i + n, ")")) return ParseRes.error(src.loc(i + n), "Expected a closing paren after do-while condition."); n++; - var end = ES5.parseStatementEnd(src, i + n); + var end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new DoWhileStatement(loc, labelRes.result, condRes.result, bodyRes.result), n); diff --git a/src/java/me/topchetoeu/jscript/compilation/control/ForInStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/ForInStatement.java index 8868a52..2cb0a5d 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/ForInStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/ForInStatement.java @@ -8,7 +8,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class ForInStatement extends Statement { @@ -91,7 +91,7 @@ public class ForInStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "in")) return ParseRes.error(src.loc(i + n), "Expected 'in' keyword after variable declaration"); n += 2; - var obj = ES5.parseExpression(src, i + n, 0); + var obj = JavaScript.parseExpression(src, i + n, 0); if (!obj.isSuccess()) return obj.chainError(src.loc(i + n), "Expected a value"); n += obj.n; n += Parsing.skipEmpty(src, i + n); @@ -99,7 +99,7 @@ public class ForInStatement extends Statement { if (!src.is(i + n, ")")) return ParseRes.error(src.loc(i + n), "Expected a closing paren"); n++; - var bodyRes = ES5.parseStatement(src, i + n); + var bodyRes = JavaScript.parseStatement(src, i + n); if (!bodyRes.isSuccess()) return bodyRes.chainError(src.loc(i + n), "Expected a for-in body"); n += bodyRes.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/control/ForOfStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/ForOfStatement.java index 3072384..fe64e92 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/ForOfStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/ForOfStatement.java @@ -7,7 +7,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class ForOfStatement extends Statement { @@ -103,7 +103,7 @@ public class ForOfStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "fo")) return ParseRes.error(src.loc(i + n), "Expected 'of' keyword after variable declaration"); n += 2; - var obj = ES5.parseExpression(src, i + n, 0); + var obj = JavaScript.parseExpression(src, i + n, 0); if (!obj.isSuccess()) return obj.chainError(src.loc(i + n), "Expected a value"); n += obj.n; n += Parsing.skipEmpty(src, i + n); @@ -111,7 +111,7 @@ public class ForOfStatement extends Statement { if (!src.is(i + n, ")")) return ParseRes.error(src.loc(i + n), "Expected a closing paren"); n++; - var bodyRes = ES5.parseStatement(src, i + n); + var bodyRes = JavaScript.parseStatement(src, i + n); if (!bodyRes.isSuccess()) return bodyRes.chainError(src.loc(i + n), "Expected a for-of body"); n += bodyRes.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/control/ForStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/ForStatement.java index 2ab96b0..d9135ba 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/ForStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/ForStatement.java @@ -7,7 +7,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; import me.topchetoeu.jscript.compilation.VariableDeclareStatement; import me.topchetoeu.jscript.compilation.values.operations.DiscardStatement; @@ -58,7 +58,7 @@ public class ForStatement extends Statement { private static ParseRes parseCondition(Source src, int i) { var n = Parsing.skipEmpty(src, i); - var res = ES5.parseExpression(src, i + n, 0); + var res = JavaScript.parseExpression(src, i + n, 0); if (!res.isSuccess()) return res.chainError(); n += res.n; n += Parsing.skipEmpty(src, i + n); @@ -67,7 +67,7 @@ public class ForStatement extends Statement { else return ParseRes.res(res.result, n + 1); } private static ParseRes parseUpdater(Source src, int i) { - return ES5.parseExpression(src, i, 0); + return JavaScript.parseExpression(src, i, 0); } public static ParseRes parse(Source src, int i) { @@ -108,7 +108,7 @@ public class ForStatement extends Statement { if (!src.is(i + n, ")")) return ParseRes.error(src.loc(i + n), "Expected a close paren after for updater"); n++; - var body = ES5.parseStatement(src, i + n); + var body = JavaScript.parseStatement(src, i + n); if (!body.isSuccess()) return body.chainError(src.loc(i + n), "Expected a for body."); n += body.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/control/IfStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/IfStatement.java index a751ddd..992b89c 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/IfStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/IfStatement.java @@ -7,7 +7,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class IfStatement extends Statement { @@ -59,7 +59,7 @@ public class IfStatement extends Statement { var loc = src.loc(i + n); n++; - var a = ES5.parseExpression(src, i + n, 2); + var a = JavaScript.parseExpression(src, i + n, 2); if (!a.isSuccess()) return a.chainError(src.loc(i + n), "Expected a value after the ternary operator."); n += a.n; n += Parsing.skipEmpty(src, i); @@ -67,7 +67,7 @@ public class IfStatement extends Statement { if (!src.is(i + n, ":")) return ParseRes.failed(); n++; - var b = ES5.parseExpression(src, i + n, 2); + var b = JavaScript.parseExpression(src, i + n, 2); if (!b.isSuccess()) return b.chainError(src.loc(i + n), "Expected a second value after the ternary operator."); n += b.n; @@ -84,7 +84,7 @@ public class IfStatement extends Statement { if (!src.is(i + n, "(")) return ParseRes.error(src.loc(i + n), "Expected a open paren after 'if'."); n++; - var condRes = ES5.parseExpression(src, i + n, 0); + var condRes = JavaScript.parseExpression(src, i + n, 0); if (!condRes.isSuccess()) return condRes.chainError(src.loc(i + n), "Expected an if condition."); n += condRes.n; n += Parsing.skipEmpty(src, i + n); @@ -92,7 +92,7 @@ public class IfStatement extends Statement { if (!src.is(i + n, ")")) return ParseRes.error(src.loc(i + n), "Expected a closing paren after if condition."); n++; - var res = ES5.parseStatement(src, i + n); + var res = JavaScript.parseStatement(src, i + n); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected an if body."); n += res.n; @@ -100,7 +100,7 @@ public class IfStatement extends Statement { if (!elseKw.isSuccess()) return ParseRes.res(new IfStatement(loc, condRes.result, res.result, null), n); n += elseKw.n; - var elseRes = ES5.parseStatement(src, i + n); + var elseRes = JavaScript.parseStatement(src, i + n); if (!elseRes.isSuccess()) return elseRes.chainError(src.loc(i + n), "Expected an else body."); n += elseRes.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/control/ReturnStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/ReturnStatement.java index d5201d1..2769d0a 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/ReturnStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/ReturnStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class ReturnStatement extends Statement { @@ -31,17 +31,17 @@ public class ReturnStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "return")) return ParseRes.failed(); n += 6; - var end = ES5.parseStatementEnd(src, i + n); + var end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new ReturnStatement(loc, null), n); } - var val = ES5.parseExpression(src, i + n, 0); + var val = JavaScript.parseExpression(src, i + n, 0); if (val.isError()) return val.chainError(); n += val.n; - end = ES5.parseStatementEnd(src, i + n); + end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new ReturnStatement(loc, val.result), n); diff --git a/src/java/me/topchetoeu/jscript/compilation/control/SwitchStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/SwitchStatement.java index 2e738ce..bc11ca1 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/SwitchStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/SwitchStatement.java @@ -12,7 +12,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class SwitchStatement extends Statement { @@ -90,7 +90,7 @@ public class SwitchStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "case")) return ParseRes.failed(); n += 4; - var valRes = ES5.parseExpression(src, i + n, 0); + var valRes = JavaScript.parseExpression(src, i + n, 0); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value after 'case'"); n += valRes.n; @@ -122,7 +122,7 @@ public class SwitchStatement extends Statement { if (!src.is(i + n, "(")) return ParseRes.error(src.loc(i + n), "Expected a open paren after 'switch'"); n++; - var valRes = ES5.parseExpression(src, i + n, 0); + var valRes = JavaScript.parseExpression(src, i + n, 0); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a switch value"); n += valRes.n; n += Parsing.skipEmpty(src, i + n); @@ -167,7 +167,7 @@ public class SwitchStatement extends Statement { } if (caseRes.isError()) return caseRes.chainError(); - var stm = ES5.parseStatement(src, i + n); + var stm = JavaScript.parseStatement(src, i + n); if (stm.isSuccess()) { n += stm.n; statements.add(stm.result); diff --git a/src/java/me/topchetoeu/jscript/compilation/control/ThrowStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/ThrowStatement.java index ddfce87..a122473 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/ThrowStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/ThrowStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class ThrowStatement extends Statement { @@ -30,17 +30,17 @@ public class ThrowStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "throw")) return ParseRes.failed(); n += 5; - var end = ES5.parseStatementEnd(src, i + n); + var end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new ThrowStatement(loc, null), n); } - var val = ES5.parseExpression(src, i + n, 0); + var val = JavaScript.parseExpression(src, i + n, 0); if (val.isFailed()) return ParseRes.error(src.loc(i + n), "Expected a value"); n += val.n; - end = ES5.parseStatementEnd(src, i + n); + end = JavaScript.parseStatementEnd(src, i + n); if (end.isSuccess()) { n += end.n; return ParseRes.res(new ThrowStatement(loc, val.result), n); diff --git a/src/java/me/topchetoeu/jscript/compilation/control/WhileStatement.java b/src/java/me/topchetoeu/jscript/compilation/control/WhileStatement.java index a636b92..1393f6f 100644 --- a/src/java/me/topchetoeu/jscript/compilation/control/WhileStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/control/WhileStatement.java @@ -8,7 +8,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class WhileStatement extends Statement { @@ -83,7 +83,7 @@ public class WhileStatement extends Statement { if (!src.is(i + n, "(")) return ParseRes.error(src.loc(i + n), "Expected a open paren after 'while'."); n++; - var condRes = ES5.parseExpression(src, i + n, 0); + var condRes = JavaScript.parseExpression(src, i + n, 0); if (!condRes.isSuccess()) return condRes.chainError(src.loc(i + n), "Expected a while condition."); n += condRes.n; n += Parsing.skipEmpty(src, i + n); @@ -91,7 +91,7 @@ public class WhileStatement extends Statement { if (!src.is(i + n, ")")) return ParseRes.error(src.loc(i + n), "Expected a closing paren after while condition."); n++; - var res = ES5.parseStatement(src, i + n); + var res = JavaScript.parseStatement(src, i + n); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected a while body."); n += res.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/values/ArrayStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/ArrayStatement.java index b4ef1e6..015311c 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/ArrayStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/ArrayStatement.java @@ -8,7 +8,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class ArrayStatement extends Statement { @@ -70,7 +70,7 @@ public class ArrayStatement extends Statement { } } - var res = ES5.parseExpression(src, i + n, 2); + var res = JavaScript.parseExpression(src, i + n, 2); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected an array element."); n += res.n; n += Parsing.skipEmpty(src, i + n); diff --git a/src/java/me/topchetoeu/jscript/compilation/values/FunctionStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/FunctionStatement.java index 00fe37f..2dbdd7f 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/FunctionStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/FunctionStatement.java @@ -9,7 +9,7 @@ import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.jscript.compilation.CompoundStatement; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; import me.topchetoeu.jscript.runtime.exceptions.SyntaxException; @@ -133,7 +133,7 @@ public class FunctionStatement extends Statement { n += nameRes.n; n += Parsing.skipEmpty(src, i + n); - var args = ES5.parseParamList(src, i + n); + var args = JavaScript.parseParamList(src, i + n); if (!args.isSuccess()) return args.chainError(src.loc(i + n), "Expected a parameter list"); n += args.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/values/ObjectStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/ObjectStatement.java index aeefb24..e9d954d 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/ObjectStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/ObjectStatement.java @@ -11,7 +11,7 @@ import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; import me.topchetoeu.jscript.compilation.CompoundStatement; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class ObjectStatement extends Statement { @@ -103,7 +103,7 @@ public class ObjectStatement extends Statement { if (!name.isSuccess()) return name.chainError(src.loc(i + n), "Expected a property name after '" + access + "'"); n += name.n; - var params = ES5.parseParamList(src, i + n); + var params = JavaScript.parseParamList(src, i + n); if (!params.isSuccess()) return params.chainError(src.loc(i + n), "Expected an argument list"); n += params.n; @@ -154,7 +154,7 @@ public class ObjectStatement extends Statement { if (!src.is(i + n, ":")) return ParseRes.error(src.loc(i + n), "Expected a colon"); n++; - var valRes = ES5.parseExpression(src, i + n, 2); + var valRes = JavaScript.parseExpression(src, i + n, 2); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value in array list"); n += valRes.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/values/VariableStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/VariableStatement.java index 0f2f7ba..177394e 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/VariableStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/VariableStatement.java @@ -8,11 +8,11 @@ import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.AssignableStatement; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; import me.topchetoeu.jscript.compilation.values.operations.VariableAssignStatement; -public class VariableStatement extends AssignableStatement { +public class VariableStatement extends Statement implements AssignableStatement { public final String name; @Override public boolean pure() { return false; } @@ -42,7 +42,7 @@ public class VariableStatement extends AssignableStatement { if (!literal.isSuccess()) return literal.chainError(); n += literal.n; - if (!ES5.checkVarName(literal.result)) { + if (!JavaScript.checkVarName(literal.result)) { if (literal.result.equals("await")) return ParseRes.error(src.loc(i + n), "'await' expressions are not supported."); if (literal.result.equals("const")) return ParseRes.error(src.loc(i + n), "'const' declarations are not supported."); if (literal.result.equals("let")) return ParseRes.error(src.loc(i + n), "'let' declarations are not supported."); diff --git a/src/java/me/topchetoeu/jscript/compilation/values/operations/CallStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/operations/CallStatement.java index e9a08b3..ad022e1 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/operations/CallStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/operations/CallStatement.java @@ -11,7 +11,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; import me.topchetoeu.jscript.compilation.values.ArrayStatement; import me.topchetoeu.jscript.compilation.values.ObjectStatement; @@ -136,7 +136,7 @@ public class CallStatement extends Statement { boolean prevArg = false; while (true) { - var argRes = ES5.parseExpression(src, i + n, 2); + var argRes = JavaScript.parseExpression(src, i + n, 2); n += argRes.n; n += Parsing.skipEmpty(src, i + n); @@ -166,7 +166,7 @@ public class CallStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "new")) return ParseRes.failed(); n += 3; - var valRes = ES5.parseExpression(src, i + n, 18); + var valRes = JavaScript.parseExpression(src, i + n, 18); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value after 'new' keyword."); n += valRes.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/values/operations/ChangeStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/operations/ChangeStatement.java index 66a3eca..33f1033 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/operations/ChangeStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/operations/ChangeStatement.java @@ -8,7 +8,7 @@ import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.AssignableStatement; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; import me.topchetoeu.jscript.compilation.values.constants.NumberStatement; @@ -40,7 +40,7 @@ public class ChangeStatement extends Statement { if (!src.is(i + n, "++")) return ParseRes.failed(); n += 2; - var res = ES5.parseExpression(src, i + n, 15); + var res = JavaScript.parseExpression(src, i + n, 15); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected assignable value after prefix operator."); else if (!(res.result instanceof AssignableStatement)) return ParseRes.error(src.loc(i + n), "Expected assignable value after prefix operator."); @@ -53,7 +53,7 @@ public class ChangeStatement extends Statement { if (!src.is(i + n, "--")) return ParseRes.failed(); n += 2; - var res = ES5.parseExpression(src, i + n, 15); + var res = JavaScript.parseExpression(src, i + n, 15); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected assignable value after prefix operator."); else if (!(res.result instanceof AssignableStatement)) return ParseRes.error(src.loc(i + n), "Expected assignable value after prefix operator."); diff --git a/src/java/me/topchetoeu/jscript/compilation/values/operations/DiscardStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/operations/DiscardStatement.java index ddcccda..513c29c 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/operations/DiscardStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/operations/DiscardStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class DiscardStatement extends Statement { @@ -31,7 +31,7 @@ public class DiscardStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "void")) return ParseRes.failed(); n += 4; - var valRes = ES5.parseExpression(src, i + n, 14); + var valRes = JavaScript.parseExpression(src, i + n, 14); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value after 'void' keyword."); n += valRes.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/values/operations/IndexStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/operations/IndexStatement.java index a0f8598..aae2d10 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/operations/IndexStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/operations/IndexStatement.java @@ -9,11 +9,11 @@ import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.AssignableStatement; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; import me.topchetoeu.jscript.compilation.values.constants.StringStatement; -public class IndexStatement extends AssignableStatement { +public class IndexStatement extends Statement implements AssignableStatement { public final Statement object; public final Statement index; @@ -49,7 +49,7 @@ public class IndexStatement extends AssignableStatement { if (!src.is(i + n, "[")) return ParseRes.failed(); n++; - var valRes = ES5.parseExpression(src, i + n, 0); + var valRes = JavaScript.parseExpression(src, i + n, 0); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value in index expression"); n += valRes.n; n += Parsing.skipEmpty(src, i + n); diff --git a/src/java/me/topchetoeu/jscript/compilation/values/operations/LazyAndStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/operations/LazyAndStatement.java index 8dabe29..3da73bd 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/operations/LazyAndStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/operations/LazyAndStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class LazyAndStatement extends Statement { @@ -39,7 +39,7 @@ public class LazyAndStatement extends Statement { var loc = src.loc(i + n); n += 2; - var res = ES5.parseExpression(src, i + n, 4); + var res = JavaScript.parseExpression(src, i + n, 4); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected a value after the '&&' operator."); n += res.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/values/operations/LazyOrStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/operations/LazyOrStatement.java index aff7f6f..0ce04b5 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/operations/LazyOrStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/operations/LazyOrStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class LazyOrStatement extends Statement { @@ -39,7 +39,7 @@ public class LazyOrStatement extends Statement { var loc = src.loc(i + n); n += 2; - var res = ES5.parseExpression(src, i + n, 4); + var res = JavaScript.parseExpression(src, i + n, 4); if (!res.isSuccess()) return res.chainError(src.loc(i + n), "Expected a value after the '||' operator."); n += res.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/values/operations/OperationStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/operations/OperationStatement.java index 55b4e6a..a45afa5 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/operations/OperationStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/operations/OperationStatement.java @@ -13,7 +13,7 @@ import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.AssignableStatement; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; public class OperationStatement extends Statement { @@ -33,7 +33,7 @@ public class OperationStatement extends Statement { @Override public ParseRes construct(Source src, int i, Statement prev) { var loc = src.loc(i); - var other = ES5.parseExpression(src, i, precedence + 1); + var other = JavaScript.parseExpression(src, i, precedence + 1); if (!other.isSuccess()) return other.chainError(src.loc(i + other.n), String.format("Expected a value after '%s'", token)); return ParseRes.res(new OperationStatement(loc, operation, prev, (Statement)other.result), other.n); } @@ -56,7 +56,7 @@ public class OperationStatement extends Statement { if (!(prev instanceof AssignableStatement)) return ParseRes.error(loc, String.format("Expected an assignable expression before '%s'", token)); - var other = ES5.parseExpression(src, i, precedence); + var other = JavaScript.parseExpression(src, i, precedence); if (!other.isSuccess()) return other.chainError(src.loc(i + other.n), String.format("Expected a value after '%s'", token)); return ParseRes.res(((AssignableStatement)prev).toAssign(other.result, operation), other.n); } @@ -73,7 +73,7 @@ public class OperationStatement extends Statement { @Override public ParseRes construct(Source src, int i, Statement prev) { var loc = src.loc(i); - var other = ES5.parseExpression(src, i, 5); + var other = JavaScript.parseExpression(src, i, 5); if (!other.isSuccess()) return other.chainError(src.loc(i + other.n), "Expected a value after '&&'"); return ParseRes.res(new LazyAndStatement(loc, prev, (Statement)other.result), other.n); } @@ -84,7 +84,7 @@ public class OperationStatement extends Statement { @Override public ParseRes construct(Source src, int i, Statement prev) { var loc = src.loc(i); - var other = ES5.parseExpression(src, i, 6); + var other = JavaScript.parseExpression(src, i, 6); if (!other.isSuccess()) return other.chainError(src.loc(i + other.n), "Expected a value after '||'"); return ParseRes.res(new LazyOrStatement(loc, prev, (Statement)other.result), other.n); } @@ -171,7 +171,7 @@ public class OperationStatement extends Statement { n++; - var res = ES5.parseExpression(src, i + n, 14); + var res = JavaScript.parseExpression(src, i + n, 14); if (res.isSuccess()) return ParseRes.res(new OperationStatement(loc, operation, res.result), n + res.n); else return res.chainError(src.loc(i + n), String.format("Expected a value after the unary operator '%s'.", op)); @@ -186,7 +186,7 @@ public class OperationStatement extends Statement { if (!kw.isSuccess()) return kw.chainError(); n += kw.n; - var valRes = ES5.parseExpression(src, i + n, 10); + var valRes = JavaScript.parseExpression(src, i + n, 10); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value after 'instanceof'."); n += valRes.n; @@ -202,7 +202,7 @@ public class OperationStatement extends Statement { if (!kw.isSuccess()) return kw.chainError(); n += kw.n; - var valRes = ES5.parseExpression(src, i + n, 10); + var valRes = JavaScript.parseExpression(src, i + n, 10); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value after 'in'."); n += valRes.n; diff --git a/src/java/me/topchetoeu/jscript/compilation/values/operations/TypeofStatement.java b/src/java/me/topchetoeu/jscript/compilation/values/operations/TypeofStatement.java index 8aaa578..c073b57 100644 --- a/src/java/me/topchetoeu/jscript/compilation/values/operations/TypeofStatement.java +++ b/src/java/me/topchetoeu/jscript/compilation/values/operations/TypeofStatement.java @@ -6,7 +6,7 @@ import me.topchetoeu.jscript.common.parsing.ParseRes; import me.topchetoeu.jscript.common.parsing.Parsing; import me.topchetoeu.jscript.common.parsing.Source; import me.topchetoeu.jscript.compilation.CompileResult; -import me.topchetoeu.jscript.compilation.ES5; +import me.topchetoeu.jscript.compilation.JavaScript; import me.topchetoeu.jscript.compilation.Statement; import me.topchetoeu.jscript.compilation.values.VariableStatement; @@ -42,7 +42,7 @@ public class TypeofStatement extends Statement { if (!Parsing.isIdentifier(src, i + n, "typeof")) return ParseRes.failed(); n += 6; - var valRes = ES5.parseExpression(src, i + n, 15); + var valRes = JavaScript.parseExpression(src, i + n, 15); if (!valRes.isSuccess()) return valRes.chainError(src.loc(i + n), "Expected a value after 'typeof' keyword."); n += valRes.n;