use of priv.bajdcc.util.lexer.token.MetaType in project jMiniLang by bajdcc.
the class OperatorTokenizer method getRegexString.
public static String getRegexString() {
String exp = "->|\\||(|)|[|]|{|}|<|>";
MetaType[] metaTypes = new MetaType[] { MetaType.LPARAN, MetaType.RPARAN, MetaType.STAR, MetaType.PLUS, MetaType.LSQUARE, MetaType.RSQUARE, MetaType.LBRACE, MetaType.RBRACE, MetaType.DOT };
for (MetaType meta : metaTypes) {
exp = exp.replace(meta.getChar() + "", "\\" + meta.getChar());
}
return exp;
}
use of priv.bajdcc.util.lexer.token.MetaType in project jMiniLang by bajdcc.
the class OperatorTokenizer method getRegexString.
public static String getRegexString() {
MetaType[] metaTypes = new MetaType[] { MetaType.LPARAN, MetaType.RPARAN, MetaType.STAR, MetaType.PLUS, MetaType.LSQUARE, MetaType.RSQUARE, MetaType.LBRACE, MetaType.RBRACE, MetaType.DOT, MetaType.BAR, MetaType.QUERY };
StringBuilder sb = new StringBuilder();
for (OperatorType type : OperatorType.values()) {
String op = type.getName();
for (MetaType meta : metaTypes) {
op = op.replace(meta.getChar() + "", "\\" + meta.getChar());
}
if (type == OperatorType.ESCAPE)
op += op;
sb.append(op).append("|");
}
if (sb.length() > 0) {
sb.deleteCharAt(sb.length() - 1);
}
return sb.toString();
}
Aggregations