281282283284285286287288289290291
m = new JavaMethod(JavaMethod.PROTECTED, "enter" + name, type + " node", "void"); m.addComment(new JavaComment(ENTER_COMMENT)); m.addThrows("ParseException"); cls.addMethod(m); } /** * Adds an exit node method to this file.
299300301302303304305306307308309
m = new JavaMethod(JavaMethod.PROTECTED, "exit" + name, type + " node", "Node"); m.addComment(new JavaComment(EXIT_COMMENT)); m.addThrows("ParseException"); m.addCode("return node;"); cls.addMethod(m); } /**
317318319320321322323324325326327
m = new JavaMethod(JavaMethod.PROTECTED, "child" + name, "Production node, Node child", "void"); m.addComment(new JavaComment(CHILD_COMMENT)); m.addThrows("ParseException"); m.addCode("node.addChild(child);"); cls.addMethod(m); } /**
214215216217218219220221222223224
// Add tokenizer factory method method = new JavaMethod(JavaMethod.PROTECTED, "newTokenizer", "Reader in", "Tokenizer"); method.addThrows("ParserCreationException"); method.addComment(new JavaComment(FACTORY_COMMENT)); method.addCode("return new " + tokenizer.getClassName() + "(in);"); cls.addMethod(method); // Add init method