mirror of
https://github.com/plexusorg/Plex-FAWE.git
synced 2024-12-24 02:07:39 +00:00
Moved some code around
This commit is contained in:
parent
effbf9f79c
commit
e6e31d0b93
@ -101,7 +101,11 @@ public class Parser {
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case '{':
|
case '{':
|
||||||
statements.add(parseBlock());
|
consumeCharacter('{');
|
||||||
|
|
||||||
|
statements.add(parseStatements(false));
|
||||||
|
|
||||||
|
consumeCharacter('}');
|
||||||
|
|
||||||
if (singleStatement) {
|
if (singleStatement) {
|
||||||
break loop;
|
break loop;
|
||||||
@ -194,13 +198,17 @@ public class Parser {
|
|||||||
|
|
||||||
switch (statements.size()) {
|
switch (statements.size()) {
|
||||||
case 0:
|
case 0:
|
||||||
throw new ParserException(-1, "No statement found.");
|
if (singleStatement) {
|
||||||
|
throw new ParserException(peek().getPosition(), "Statement expected.");
|
||||||
|
} else {
|
||||||
|
return new Sequence(peek().getPosition());
|
||||||
|
}
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
return statements.get(0);
|
return statements.get(0);
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return new Sequence(position, statements.toArray(new RValue[statements.size()]));
|
return new Sequence(peek().getPosition(), statements.toArray(new RValue[statements.size()]));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -327,20 +335,6 @@ public class Parser {
|
|||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
private final RValue parseBlock() throws ParserException {
|
|
||||||
consumeCharacter('{');
|
|
||||||
|
|
||||||
if (peek().id() == '}') {
|
|
||||||
return new Sequence(peek().getPosition());
|
|
||||||
}
|
|
||||||
|
|
||||||
final RValue ret = parseStatements(false);
|
|
||||||
|
|
||||||
consumeCharacter('}');
|
|
||||||
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
|
|
||||||
private boolean hasKeyword(String keyword) {
|
private boolean hasKeyword(String keyword) {
|
||||||
final Token next = peek();
|
final Token next = peek();
|
||||||
if (!(next instanceof KeywordToken)) {
|
if (!(next instanceof KeywordToken)) {
|
||||||
|
Loading…
Reference in New Issue
Block a user