use of priv.bajdcc.LL1.syntax.ISyntaxComponent in project jMiniLang by bajdcc.
the class FirstSetSolver method visitBegin.
@Override
public void visitBegin(SequenceExp node, VisitBag bag) {
bag.bVisitChildren = false;
bag.bVisitEnd = false;
boolean zero = false;
for (ISyntaxComponent exp : node.arrExpressions) {
exp.visit(this);
zero = bZero;
if (!zero) {
break;
}
}
bZero = zero;
}
use of priv.bajdcc.LL1.syntax.ISyntaxComponent in project jMiniLang by bajdcc.
the class Syntax method doTail.
/**
* 处理右端表达式
*
* @throws SyntaxException 词法错误
*/
private void doTail() throws SyntaxException {
/* 获得分析后的表达式根结点 */
ISyntaxComponent exp = doAnalysis(TokenType.EOF, null);
/* 将根结点添加进对应规则 */
RuleItem item = new RuleItem(exp, rule.rule);
onAddRuleItem(item);
rule.rule.arrRules.add(item);
}
use of priv.bajdcc.LL1.syntax.ISyntaxComponent in project jMiniLang by bajdcc.
the class Syntax method getSingleString.
/**
* 获得单一产生式描述
*
* @param name
* 非终结符名称
* @param exp
* 表达式树
* @return 原产生式描述
*/
public static String getSingleString(String name, ISyntaxComponent exp) {
StringBuilder sb = new StringBuilder();
sb.append(name);
sb.append(" -> ");
SyntaxToString alg = new SyntaxToString();
exp.visit(alg);
sb.append(alg.toString());
return sb.toString();
}
use of priv.bajdcc.LL1.syntax.ISyntaxComponent in project jMiniLang by bajdcc.
the class SequenceExp method visit.
@Override
public void visit(ISyntaxComponentVisitor visitor) {
VisitBag bag = new VisitBag();
visitor.visitBegin(this, bag);
if (bag.bVisitChildren) {
for (ISyntaxComponent exp : arrExpressions) {
exp.visit(visitor);
}
}
if (bag.bVisitEnd) {
visitor.visitEnd(this);
}
}
use of priv.bajdcc.LL1.syntax.ISyntaxComponent in project jMiniLang by bajdcc.
the class FirstsetSolver method visitBegin.
@Override
public void visitBegin(SequenceExp node, VisitBag bag) {
bag.bVisitChildren = false;
bag.bVisitEnd = false;
boolean zero = false;
for (ISyntaxComponent exp : node.arrExpressions) {
exp.visit(this);
zero = bZero;
if (!zero) {
break;
}
}
bZero = zero;
}
Aggregations