public override object VisitPropInstr([NotNull] StdAssemblerParser.PropInstrContext context) { string etiqueta = string.Empty; StdToken token; if (context.NL().ToString().Contains("missing")) { throw new Exception("Error de sintáxis: Instrucción no válida"); } else { if (context.etiqueta() != null) { etiqueta = Visit(context.etiqueta()) as String; if (TabSim.FirstOrDefault(s => s.Key == etiqueta).Value == null) { TabSim.Add(etiqueta, count.ToString("X")); } } else if (context.children.Count > 2) { throw new Exception("Error de sintáxis: Instrucción no válida"); } token = Visit(context.instruccion()) as StdToken; token.Label = etiqueta; TokenList.Add(token); count += 3; return(token); } }
/// <summary> /// Exit a parse tree produced by the <c>PropInstr</c> /// labeled alternative in <see cref="StdAssemblerParser.proposicion"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitPropInstr([NotNull] StdAssemblerParser.PropInstrContext context) { }
/// <summary> /// Visit a parse tree produced by the <c>PropInstr</c> /// labeled alternative in <see cref="StdAssemblerParser.proposicion"/>. /// <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 VisitPropInstr([NotNull] StdAssemblerParser.PropInstrContext context) { return(VisitChildren(context)); }