Beispiel #1
0
        public override void EnterRuleref([NotNull] ANTLRv4Parser.RulerefContext context)
        {
            TerminalNodeImpl first = context.GetChild(0) as TerminalNodeImpl;
            string           id    = context.GetChild(0).GetText();
            IList <ISymbol>  list  = _pd.RootScope.LookupType(id);

            if (!list.Any())
            {
                ISymbol sym = new NonterminalSymbol(id, first.Symbol);
                _pd.RootScope.define(ref sym);
            }
            List <CombinedScopeSymbol> new_attrs = new List <CombinedScopeSymbol>();

            foreach (ISymbol sym in list)
            {
                CombinedScopeSymbol s = new RefSymbol(first.Symbol, sym);
                new_attrs.Add(s);
            }
            _pd.Attributes[context]             = new_attrs;
            _pd.Attributes[context.GetChild(0)] = new_attrs;
        }
 /// <summary>
 /// Visit a parse tree produced by <see cref="ANTLRv4Parser.ruleref"/>.
 /// <para>
 /// The default implementation returns the result of calling <see cref="AbstractParseTreeVisitor{Result}.VisitChildren(IRuleNode)"/>
 /// on <paramref name="context"/>.
 /// </para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 /// <return>The visitor result.</return>
 public virtual Result VisitRuleref([NotNull] ANTLRv4Parser.RulerefContext context)
 {
     return(VisitChildren(context));
 }
 /// <summary>
 /// Exit a parse tree produced by <see cref="ANTLRv4Parser.ruleref"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitRuleref([NotNull] ANTLRv4Parser.RulerefContext context)
 {
 }
Beispiel #4
0
 public override void EnterRuleref([NotNull] ANTLRv4Parser.RulerefContext context)
 {
     RHS[current_nonterminal].Add(context.GetChild(0) as ITerminalNode);
 }