示例#1
0
        public override ISexpr VisitAtom(SexprParser.AtomContext context)
        {
            var text = context.GetText();

            if (context.SYMBOL() != null)
            {
                return(Sexpr.Symbol(text));
            }
            else if (context.STRING() != null)
            {
                return(Sexpr.String(text));
            }
            else if (context.NUMBER() != null)
            {
                return(Sexpr.Number(text));
            }
            else
            {
                throw new Exception();
            }
        }
示例#2
0
 public override ISexpr VisitQuote(SexprParser.QuoteContext context)
 {
     return(Sexpr.List(new[] { Sexpr.Symbol("quote"), VisitItem(context.item()) }));
 }