mirror of
https://github.com/GTNewHorizons/CraftTweaker.git
synced 2026-11-12 00:07:52 +00:00
Revert "Several bug fixes and enhancements on ZenScripts"
This commit is contained in:
1 parent
ad9c98a838
commit
89f22013f1
8 files changed
+8
-24
No files matched your search
@@ -128,7 +128,7 @@ public class MTTweaker implements ITweaker {
|
||||
while (script.next()) {
|
||||
Reader reader = null;
|
||||
try {
|
||||
reader = new InputStreamReader(new BufferedInputStream(script.open()), "UTF-8");
|
||||
reader = new InputStreamReader(new BufferedInputStream(script.open()));
|
||||
|
||||
String filename = script.getName();
|
||||
String className = extractClassName(filename);
|
||||
|
||||
@@ -95,7 +95,7 @@ public class ZenTokener extends TokenStream {
|
||||
private static final String[] REGEXPS = {
|
||||
"#[^\n]*[\n\\e]",
|
||||
"//[^\n]*[\n\\e]",
|
||||
"/\\*[^\\*]*(\\*|\\*[^/\\*][^\\*]*)*\\*/",
|
||||
"/\\*[^\\*]*(\\*[^/]*)*\\*/",
|
||||
"[ \t\r\n]*",
|
||||
"[a-zA-Z_][a-zA-Z_0-9]*",
|
||||
"\\-?(0|[1-9][0-9]*)\\.[0-9]+([eE][\\+\\-]?[0-9]+)?",
|
||||
|
||||
@@ -90,7 +90,6 @@ public class ExpressionJavaLambda extends Expression {
|
||||
for (Statement statement : statements) {
|
||||
statement.compile(environmentMethod);
|
||||
}
|
||||
output.ret();
|
||||
output.end();
|
||||
|
||||
environment.putClass(clsName, cw.toByteArray());
|
||||
|
||||
@@ -21,10 +21,6 @@ public class NFA {
|
||||
public static final int NOFINAL = Integer.MIN_VALUE;
|
||||
public static final int EPSILON = Integer.MIN_VALUE + 1;
|
||||
|
||||
/* UNICODE_ESCAPE should be between 128 and 256, so unicode chars can be
|
||||
matched by regexp like '.' and '[^a]' and not by '[a-zA-Z]' */
|
||||
public static final int UNICODE_ESCAPE = 256;
|
||||
|
||||
private final NFAState initial;
|
||||
|
||||
private HashMap<NodeSet, DFA.DFAState> converted;
|
||||
@@ -322,8 +318,6 @@ public class NFA {
|
||||
/* Processes a single character */
|
||||
private int processChar(CharStream stream) {
|
||||
if (stream.optional('\\')) {
|
||||
if (stream.optional('u'))
|
||||
return UNICODE_ESCAPE;
|
||||
if (stream.optional('e'))
|
||||
return -1;
|
||||
if (stream.optional('r'))
|
||||
|
||||
@@ -212,17 +212,12 @@ public class TokenStream implements Iterator<Token> {
|
||||
StringBuilder value = new StringBuilder();
|
||||
int tLine = line;
|
||||
int tLineOffset = lineOffset;
|
||||
int _fakeNextChar = nextChar > 127 ? NFA.UNICODE_ESCAPE : nextChar;
|
||||
while (dfa.transitions[state].containsKey(_fakeNextChar)) {
|
||||
if (nextChar < 0)
|
||||
value.append((char) nextChar);
|
||||
else
|
||||
value.appendCodePoint(nextChar);
|
||||
state = dfa.transitions[state].get(_fakeNextChar);
|
||||
while (dfa.transitions[state].containsKey(nextChar)) {
|
||||
value.append((char) nextChar);
|
||||
state = dfa.transitions[state].get(nextChar);
|
||||
line = reader.line;
|
||||
lineOffset = reader.lineOffset;
|
||||
nextChar = reader.read();
|
||||
_fakeNextChar = nextChar > 127 ? NFA.UNICODE_ESCAPE : nextChar;
|
||||
}
|
||||
|
||||
if (line < 0)
|
||||
|
||||
@@ -26,10 +26,7 @@ public abstract class Statement {
|
||||
}
|
||||
case T_RETURN: {
|
||||
parser.next();
|
||||
ParsedExpression expression = null;
|
||||
if (parser.peek() != null && !parser.isNext(T_SEMICOLON)) {
|
||||
expression = ParsedExpression.read(parser, environment);
|
||||
}
|
||||
ParsedExpression expression = ParsedExpression.read(parser, environment);
|
||||
parser.required(T_SEMICOLON, "; expected");
|
||||
return new StatementReturn(next.getPosition(), returnType, expression);
|
||||
}
|
||||
|
||||
@@ -57,6 +57,5 @@ public class StatementForeach extends Statement {
|
||||
body.compile(local);
|
||||
iterator.compilePostIterate(localVariables, exit, repeat);
|
||||
methodOutput.label(exit);
|
||||
iterator.compileEnd();
|
||||
}
|
||||
}
|
||||
@@ -77,12 +77,12 @@ public class ZenExpandMember {
|
||||
|
||||
@Override
|
||||
public Expression eval(IEnvironmentGlobal environment) {
|
||||
return new ExpressionCallStatic(position, environment, getter, value.eval(environment));
|
||||
return new ExpressionCallVirtual(position, environment, getter, value.eval(environment));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Expression assign(ZenPosition position, IEnvironmentGlobal environment, Expression other) {
|
||||
return new ExpressionCallStatic(position, environment, setter, value.eval(environment), other);
|
||||
return new ExpressionCallVirtual(position, environment, setter, value.eval(environment), other);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in new issue
Block a user