public override object VisitDataType([NotNull] MiniSQLParser.DataTypeContext context) { AttributeDeclaration attribute = new AttributeDeclaration(); string type = context.type.Text.ToLower(); switch (type) { case "int": attribute.Type = AttributeTypes.Int; break; case "float": attribute.Type = AttributeTypes.Float; break; case "char": attribute.Type = AttributeTypes.Char; if (context.fieldLength() != null) { attribute.CharLimit = (int)Visit(context.fieldLength()); } break; } return(attribute); }
/// <summary> /// Exit a parse tree produced by <see cref="MiniSQLParser.dataType"/>. /// <para>The default implementation does nothing.</para> /// </summary> /// <param name="context">The parse tree.</param> public virtual void ExitDataType([NotNull] MiniSQLParser.DataTypeContext context) { }
/// <summary> /// Visit a parse tree produced by <see cref="MiniSQLParser.dataType"/>. /// <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 VisitDataType([NotNull] MiniSQLParser.DataTypeContext context) { return(VisitChildren(context)); }