mirror of
https://github.com/octoleo/plantuml.git
synced 2024-10-31 19:22:31 +00:00
minor Ebbn fix
This commit is contained in:
parent
b8913c81c4
commit
cfe2b60db9
@ -63,8 +63,8 @@ public class ResultPoint {
|
||||
}
|
||||
|
||||
/**
|
||||
* <p>Orders an array of three ResultPoints in an order [A,B,C] such that AB < AC and
|
||||
* BC < AC and the angle between BC and BA is less than 180 degrees.
|
||||
* <p>Orders an array of three ResultPoints in an order [A,B,C] such that AB is less than AC
|
||||
* and BC is less than AC and the angle between BC and BA is less than 180 degrees.
|
||||
*/
|
||||
public static void orderBestPatterns(ResultPoint[] patterns) {
|
||||
|
||||
|
@ -59,6 +59,7 @@ public class EbnfSingleExpression {
|
||||
} else if (isLetterOrDigit(ch)) {
|
||||
final String litteral = readLitteral(it);
|
||||
tokens.add(new Token(Symbol.LITTERAL, litteral));
|
||||
continue;
|
||||
} else if (ch == ',') {
|
||||
tokens.add(new Token(Symbol.CONCATENATION, null));
|
||||
} else if (ch == '|') {
|
||||
@ -125,9 +126,9 @@ public class EbnfSingleExpression {
|
||||
engine.alternation();
|
||||
else if (element.getSymbol() == Symbol.CONCATENATION)
|
||||
engine.concatenation();
|
||||
else if (element.getSymbol() == Symbol.OPTIONAL_CLOSE)
|
||||
else if (element.getSymbol() == Symbol.OPTIONAL)
|
||||
engine.optional();
|
||||
else if (element.getSymbol() == Symbol.REPETITION_CLOSE)
|
||||
else if (element.getSymbol() == Symbol.REPETITION)
|
||||
engine.repetition();
|
||||
else
|
||||
throw new UnsupportedOperationException(element.toString());
|
||||
|
@ -65,21 +65,15 @@ public class ShuntingYard {
|
||||
if (operatorStack.peekFirst().getSymbol() == Symbol.GROUPING_OPEN)
|
||||
operatorStack.removeFirst();
|
||||
} else if (token.getSymbol() == Symbol.OPTIONAL_OPEN) {
|
||||
operatorStack.addFirst(token);
|
||||
operatorStack.addFirst(new Token(Symbol.OPTIONAL, null));
|
||||
} else if (token.getSymbol() == Symbol.OPTIONAL_CLOSE) {
|
||||
while (operatorStack.peekFirst().getSymbol() != Symbol.OPTIONAL_OPEN)
|
||||
ouputQueue.add(operatorStack.removeFirst());
|
||||
if (operatorStack.peekFirst().getSymbol() == Symbol.OPTIONAL_OPEN)
|
||||
operatorStack.removeFirst();
|
||||
operatorStack.addFirst(token);
|
||||
final Token first = operatorStack.removeFirst();
|
||||
ouputQueue.add(first);
|
||||
} else if (token.getSymbol() == Symbol.REPETITION_OPEN) {
|
||||
operatorStack.addFirst(token);
|
||||
operatorStack.addFirst(new Token(Symbol.REPETITION, null));
|
||||
} else if (token.getSymbol() == Symbol.REPETITION_CLOSE) {
|
||||
while (operatorStack.peekFirst().getSymbol() != Symbol.REPETITION_OPEN)
|
||||
ouputQueue.add(operatorStack.removeFirst());
|
||||
if (operatorStack.peekFirst().getSymbol() == Symbol.REPETITION_OPEN)
|
||||
operatorStack.removeFirst();
|
||||
operatorStack.addFirst(token);
|
||||
final Token first = operatorStack.removeFirst();
|
||||
ouputQueue.add(first);
|
||||
} else {
|
||||
throw new UnsupportedOperationException(token.toString());
|
||||
}
|
||||
|
@ -46,8 +46,10 @@ public enum Symbol {
|
||||
ALTERNATION, // |
|
||||
OPTIONAL_OPEN, // [
|
||||
OPTIONAL_CLOSE, // ]
|
||||
OPTIONAL,
|
||||
REPETITION_OPEN, // {
|
||||
REPETITION_CLOSE, // }
|
||||
REPETITION, //
|
||||
GROUPING_OPEN, // (
|
||||
GROUPING_CLOSE, // )
|
||||
TERMINAL_STRING1, // " "
|
||||
|
Loading…
Reference in New Issue
Block a user