// transform a Type in a Structure public override void EnterTypeStmt(VBAParser.TypeStmtContext context) { var typeName = context.ambiguousIdentifier().GetText(); Types.Push(typeName); InitStructures.Add(typeName, new StructureInitializer(typeName)); Rewriter.Replace(context.TYPE().Symbol, "Structure"); Rewriter.Replace(context.END_TYPE().Symbol, "End Structure"); string visibility = context.visibility().GetText(); foreach (var st in context.typeStmt_Element()) { Rewriter.InsertBefore(st.Start, $"{visibility} "); } }
//transform a Type in a Structure // typeStmt rule (VBA.g4 Line 502) public override void EnterTypeStmt([NotNull] BosParser.TypeStmtContext context) { // Find the type name or in the grammar the identifier var typeName = context.ambiguousIdentifier().GetText(); TypesStack.Push(typeName); // Store it in the stack, helpful when recreating the type // Used to create the new type InitStructures.Add(typeName, new StructureInitializer(typeName)); StreamRewriter.Replace(context.TYPE().Symbol, "Structure"); StreamRewriter.Replace(context.END_TYPE().Symbol, "End Structure"); string visibility = context.visibility().GetText(); foreach (var st in context.typeStmt_Element()) { StreamRewriter.InsertBefore(st.Start, $"{visibility} "); } }