public PatternUst VisitLiteral(DslParser.LiteralContext context) { PatternUst result; var textSpan = context.GetTextSpan(); if (context.Id() != null) { result = ProcessId(context.Id()); } else if (context.String() != null) { result = new PatternStringLiteral(RemoveQuotes(context.GetText()), textSpan); } else if (context.Oct() != null) { result = new PatternIntLiteral( System.Convert.ToInt64(context.Oct().GetText(), 8), textSpan); } else if (context.Int() != null) { string text = context.Int().GetText(); if (long.TryParse(text, out long longValue)) { result = new PatternIntLiteral(longValue, textSpan); } else { result = new PatternBigIntLiteral(longValue, textSpan); } } else if (context.Hex() != null) { result = new PatternIntLiteral( System.Convert.ToInt64(context.Hex().GetText(), 16), textSpan); } else if (context.Bool() != null) { result = new PatternBooleanLiteral(bool.Parse(context.Bool().GetText()), textSpan); } else if (context.Null() != null) { result = new PatternNullLiteral(textSpan); } else { throw new NotImplementedException(); } return(result); }
public virtual T Visit(PatternNullLiteral patternNullLiteral) { return(VisitChildren(patternNullLiteral)); }