Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
 /// <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)
 {
 }
Ejemplo n.º 3
0
 /// <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));
 }