/** * This method is used to get the first non-tight HTML tag encountered while parsing javadoc. * This shall eventually be reflected by the {@link ParseStatus} object returned by * {@link #parseJavadocAsDetailNode(DetailAST)} method via the instance member * {@link ParseStatus#firstNonTightHtmlTag}, and checks not supposed to process non-tight HTML * or the ones which are supposed to log violation for non-tight javadocs can utilize that. * * @param javadocParser The ANTLR recognizer instance which has been used to parse the javadoc * @return First non-tight HTML tag if one exists; null otherwise */ private Token getFirstNonTightHtmlTag(JavadocParser javadocParser) { final CommonToken offendingToken; final ParserRuleContext nonTightTagStartContext = javadocParser.nonTightTagStartContext; if (nonTightTagStartContext == null) { offendingToken = null; } else { final Token token = ((TerminalNode) nonTightTagStartContext.getChild(1)) .getSymbol(); offendingToken = new CommonToken(token); offendingToken.setLine(offendingToken.getLine() + errorListener.offset); } return offendingToken; }
@Override public int getLine() { if(token.isEmpty()) { return eofToken.getLine(); } else { return token.get(0).getLine(); } }
public static void printOriginalFilePiece(InputDocument doc, CommonToken originalCurToken) { System.out.println(doc.getLine(originalCurToken.getLine()-1)); System.out.println(doc.getLine(originalCurToken.getLine())); System.out.print(Tool.spaces(originalCurToken.getCharPositionInLine())); System.out.println("^"); }
private void initMissing(Recognizer<?, ?> recognizer,CommonToken commonToken){ try{ this.startLine = 1; this.startCharPositionInLine = 0; this.stopLine = commonToken.getLine(); this.stopCharPositionInLine = commonToken.getCharPositionInLine(); String text = commonToken.getTokenSource().getInputStream().toString(); if (text != null) { reader = new InnerScriptReader(text); } }catch (Exception e) { throw new RuntimeException(e); } }
/** * This method is used to get the first non-tight HTML tag encountered while parsing javadoc. * This shall eventually be reflected by the {@link ParseStatus} object returned by * {@link #parseJavadocAsDetailNode(DetailAST)} method via the instance member * {@link ParseStatus#firstNonTightHtmlTag}, and checks not supposed to process non-tight HTML * or the ones which are supposed to log violation for non-tight javadocs can utilize that. * * @param javadocParser The ANTLR recognizer instance which has been used to parse the javadoc * @return First non-tight HTML tag if one exists; null otherwise */ private Token getFirstNonTightHtmlTag(JavadocParser javadocParser) { final CommonToken offendingToken; final ParserRuleContext nonTightTagStartContext = javadocParser.nonTightTagStartContext; if (nonTightTagStartContext == null) { offendingToken = null; } else { final Token token = ((TerminalNode) nonTightTagStartContext.getChild(1)) .getSymbol(); offendingToken = new CommonToken(token); offendingToken.setLine(offendingToken.getLine() + errorListener.offset); } return offendingToken; }