public override object VisitScientific([NotNull] MiniSQLParser.ScientificContext context) { AtomValue value = new AtomValue(); if (context.INT_NUMBER() != null) { value.Type = AttributeTypes.Int; value.IntegerValue = int.Parse(context.INT_NUMBER().GetText()); } else if (context.DECIMAL_NUMBER() != null) { value.Type = AttributeTypes.Float; value.FloatValue = float.Parse(context.DECIMAL_NUMBER().GetText()); } else if (context.SINGLE_QUOTED_TEXT() != null) { value.Type = AttributeTypes.Char; string withQuotes = context.SINGLE_QUOTED_TEXT().GetText(); value.StringValue = withQuotes.Substring(1, withQuotes.Length - 2); value.CharLimit = Encoding.UTF8.GetByteCount(value.StringValue); } else if (context.DOUBLE_QUOTED_TEXT() != null) { value.Type = AttributeTypes.Char; string withQuotes = context.DOUBLE_QUOTED_TEXT().GetText(); value.StringValue = withQuotes.Substring(1, withQuotes.Length - 2); value.CharLimit = Encoding.UTF8.GetByteCount(value.StringValue); } else { throw new System.NotImplementedException(); } return(value); }
/// <summary> /// Exit a parse tree produced by <see cref="MiniSQLParser.scientific"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitScientific([NotNull] MiniSQLParser.ScientificContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="MiniSQLParser.scientific"/>. /// <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 VisitScientific([NotNull] MiniSQLParser.ScientificContext context) { return(VisitChildren(context)); }