Search in sources :

Example 6 with TokenExp

use of priv.bajdcc.LALR1.syntax.exp.TokenExp in project jMiniLang by bajdcc.

the class Syntax method addTerminal.

/**
 * 添加终结符
 *
 * @param name
 *            终结符名称
 * @param type
 *            单词类型
 * @param obj
 *            单词信息
 * @throws SyntaxException 词法错误
 */
public void addTerminal(String name, priv.bajdcc.util.lexer.token.TokenType type, Object obj) throws SyntaxException {
    TokenExp exp = new TokenExp(arrTerminals.size(), name, type, obj);
    if (!mapTerminals.containsKey(name)) {
        mapTerminals.put(name, exp);
        arrTerminals.add(exp);
    } else {
        err(SyntaxError.REDECLARATION, name);
    }
}
Also used : TokenExp(priv.bajdcc.LALR1.syntax.exp.TokenExp)

Aggregations

TokenExp (priv.bajdcc.LL1.syntax.exp.TokenExp)4 TokenExp (priv.bajdcc.LALR1.syntax.exp.TokenExp)2 RuleExp (priv.bajdcc.LALR1.syntax.exp.RuleExp)1 RuleItem (priv.bajdcc.LALR1.syntax.rule.RuleItem)1 RuleExp (priv.bajdcc.LL1.syntax.exp.RuleExp)1 RuleItem (priv.bajdcc.LL1.syntax.rule.RuleItem)1