/** Adds a comment to the current module or definition list */ void comment(Token token) { String str = token.image; if (str.startsWith("//")) str = str.substring(2, str.length() - 1); // remove // and \n from beginning and end else str = str.substring(2, str.length() - 2); // remove /* and */ from beginning and end LiterateCommentType lcType = LiterateCommentType.COMMON; if (str.startsWith("@")) { lcType = LiterateCommentType.LATEX; str = str.substring(1); } else if (str.startsWith("!")) { lcType = LiterateCommentType.PREAMBLE; str = str.substring(1); } Location loc = new Location(token.beginLine, token.beginColumn, token.endLine, token.endColumn); if (module == null) { items.add(markLocExplicit(loc, new LiterateDefinitionComment(str, lcType))); } else { module.appendModuleItem(markLocExplicit(loc, new LiterateModuleComment(str, lcType))); } }
/** Parses an Import and adds it to module */ final public void Import(Module module) throws ParseException { Location loc = startLoc(); boolean isSyntax = false; switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IMPORTS: jj_consume_token(IMPORTS); break; case IMPORTS2: jj_consume_token(IMPORTS2); break; default: jj_la1[27] = jj_gen; jj_consume_token(-1); throw new ParseException(); } switch ((jj_ntk==-1)?jj_ntk():jj_ntk) { case IMPORTSSYNTAX: jj_consume_token(IMPORTSSYNTAX); isSyntax = true; break; default: jj_la1[28] = jj_gen; ; } jj_consume_token(MODNAME); module.appendModuleItem(markLoc(loc, new Import(image(), isSyntax))); }
module.appendModuleItem(markLoc(loc, ss)); break; case SYNTAX: module.appendModuleItem(markLoc(loc, syn)); break; case PRIORITY: pblocks.add(new PriorityBlockExtended(list)); module.appendModuleItem(markLoc(loc, new PriorityExtended(pblocks))); break; case NON_ASSOC: module.appendModuleItem(markLoc(loc, new PriorityExtendedAssoc(type, list))); break; default: