public object VisitTypeAST([NotNull] TypeASTContext context) { IdentASTContext ident = (IdentASTContext)Visit(context.ident()); if (ident != null) { if (types.Contains(ident.GetText())) { if (context.SQUAREBL() != null) { if (types.Contains(ident.GetText() + "[]")) { return(ident.GetText() + "[]"); } InsertError(ident.IDENT().Symbol, "No se pueden declarar arreglos de tipo" + ident.IDENT().GetText() + " porque no es un tipo simple"); } else { return(ident.GetText()); } } else { InsertError(ident.IDENT().Symbol, "El tipo " + ident.IDENT().GetText() + " no existe"); } } return(null); }
public object VisitTypeAST([NotNull] TypeASTContext context) { string type = context.GetText(); if (type == "int" || type == "bool" || type == "float") { return("I"); } else { return("C"); } }