Example #1
0
        public CommentToolCommand(CommandToolParser.CommentCommandContext context)
        {
            var type = ProcessId(context.LITERAL().GetText(), out var number, out var symbol);

            if (HasSemanticError)
            {
                return;
            }

            if (type)
            {
                Symbol = symbol;
            }
            else
            {
                Address = number;
            }
            if (HasSemanticError || context.ChildCount < 5)
            {
                return;
            }

            var sb = new StringBuilder();

            for (var i = 4; i < context.ChildCount; i++)
            {
                sb.Append(context.GetChild(i).GetText());
            }
            Text = sb.ToString();
        }
 /// <summary>
 /// Exit a parse tree produced by <see cref="CommandToolParser.commentCommand"/>.
 /// <para>The default implementation does nothing.</para>
 /// </summary>
 /// <param name="context">The parse tree.</param>
 public virtual void ExitCommentCommand([NotNull] CommandToolParser.CommentCommandContext context)
 {
 }
 /// <summary>
 /// Visit a parse tree produced by <see cref="CommandToolParser.commentCommand"/>.
 /// <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 VisitCommentCommand([NotNull] CommandToolParser.CommentCommandContext context)
 {
     return(VisitChildren(context));
 }