public override Node VisitEnum(DeltinScriptParser.EnumContext context) { string[] split = context.GetText().Split('.'); string type = split[0]; string value = split[1]; return(new EnumNode(type, value, new Location(file, Range.GetRange(context)))); }
public override Node VisitEnum(DeltinScriptParser.EnumContext context) { string[] split = context.GetText().Split('.'); string type = split[0]; string value = split[1]; Node node = new EnumNode(type, value, Range.GetRange(context)); CheckRange(node); return(node); }
public override object VisitEnum(DeltinScriptParser.EnumContext context) { string type = context.PART(0).GetText(); string value = context.PART(1)?.GetText(); if (value == null) { _diagnostics.Error("Expected enum value.", new Location(_file, Range.GetRange(context))); } else if (EnumData.GetEnumValue(type, value) == null) { _diagnostics.Error(string.Format(SyntaxErrorException.invalidEnumValue, value, type), new Location(_file, Range.GetRange(context))); } return(base.VisitEnum(context)); }
public override object VisitEnum(DeltinScriptParser.EnumContext context) { string type = context.ENUM().GetText(); string value = context.PART()?.GetText(); if (value == null) { _diagnostics.Add(new Diagnostic("Expected enum value.", Range.GetRange(context)) { severity = Diagnostic.Error }); } else if (EnumData.GetEnumValue(type, value) == null) { _diagnostics.Add(new Diagnostic(string.Format(SyntaxErrorException.invalidEnumValue, value, type), Range.GetRange(context)) { severity = Diagnostic.Error }); } return(base.VisitEnum(context)); }