public override void EnterSymbol([NotNull] W3CebnfParser.SymbolContext context) { var token_ref = context.SYMBOL(); if (token_ref != null) { for (var parent = context.Parent; parent != null; parent = parent.Parent) { if (parent is W3CebnfParser.LhsContext) { return; } } string id = token_ref.GetText(); List <ISymbol> list = _pd.RootScope.LookupType(id).ToList(); if (!list.Any()) { ISymbol sym = new NonterminalSymbol(id, new List <IToken>() { token_ref.Symbol }); _pd.RootScope.define(ref sym); list = _pd.RootScope.LookupType(id).ToList(); } List <CombinedScopeSymbol> new_attrs = new List <CombinedScopeSymbol>(); CombinedScopeSymbol s = new RefSymbol(new List <IToken>() { token_ref.Symbol }, list); new_attrs.Add(s); _pd.Attributes[context] = new_attrs; _pd.Attributes[token_ref] = new_attrs; } }
public override void EnterSymbol([NotNull] W3CebnfParser.SymbolContext context) { var token_ref = context.SYMBOL(); if (token_ref != null && context.Parent is W3CebnfParser.LhsContext) { string id = token_ref.GetText(); ISymbol sym = new NonterminalSymbol(id, new List <IToken>() { token_ref.Symbol }); _pd.RootScope.define(ref sym); CombinedScopeSymbol s = (CombinedScopeSymbol)sym; _pd.Attributes[context] = new List <CombinedScopeSymbol>() { s }; _pd.Attributes[token_ref] = new List <CombinedScopeSymbol>() { s }; } }