private boolean init(String source, int kind) { // this is convenient for debugging (see Token.toString()) // Token.source = source; this.sourceString = source; this.sourceArray = source.toCharArray(); this.tokens.clear(); this.tokenManager = new TokenManager(this.tokens, source, this.workingOptions); tokenizeSource(kind); return !this.tokens.isEmpty(); }
private boolean init(String source, int kind) { // this is convenient for debugging (see Token.toString()) // Token.source = source; this.sourceString = source; this.sourceArray = source.toCharArray(); this.tokens.clear(); this.tokenManager = new TokenManager(this.tokens, source, this.workingOptions); tokenizeSource(kind); return !this.tokens.isEmpty(); }
private boolean init(String source) { // this is convenient for debugging (see Token.toString()) // Token.source = source; this.sourceString = source; this.sourceArray = source.toCharArray(); this.tokens.clear(); this.tokenManager = new TokenManager(this.tokens, source, this.workingOptions); tokenizeSource(); return !this.tokens.isEmpty(); }
private void traverseInternalStructure(Token token, int index) { List<Token> structure = token.getInternalStructure(); this.tm = new TokenManager(structure, this.parent.tm); this.counter = token.originalStart; this.sourceLimit = token.originalEnd + 1; this.parentTokenIndex = index; traverse(structure, 0); }
private void traverseInternalStructure(Token token, int index) { List<Token> structure = token.getInternalStructure(); this.tm = new TokenManager(structure, this.parent.tm); this.counter = token.originalStart; this.sourceLimit = token.originalEnd + 1; this.parentTokenIndex = index; traverse(structure, 0); }
private void traverseInternalStructure(Token token, int index) { List<Token> structure = token.getInternalStructure(); this.tm = new TokenManager(structure, this.parent.tm); this.counter = token.originalStart; this.sourceLimit = token.originalEnd + 1; this.parentTokenIndex = index; traverse(structure, 0); }
public void handleBlockComment(int commentIndex) { Token commentToken = this.tm.get(commentIndex); boolean isFirstColumn = handleWhitespaceAround(commentIndex); if (handleFormatOnOffTags(commentToken)) return; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_block_comment && !isHeader) || (this.options.comment_format_header && isHeader); formattingEnabled = formattingEnabled && this.tm.charAt(commentToken.originalStart + 2) != '-'; if (formattingEnabled && tokenizeMultilineComment(commentToken)) { this.commentStructure = commentToken.getInternalStructure(); this.ctm = new TokenManager(this.commentStructure, this.tm); handleStringLiterals(this.tm.toString(commentToken), commentToken.originalStart); addSubstituteWraps(); } else { commentToken.setInternalStructure(commentToLines(commentToken, -1)); } if (this.options.never_indent_block_comments_on_first_column && isFirstColumn) { commentToken.setIndent(0); commentToken.setWrapPolicy(WrapPolicy.FORCE_FIRST_COLUMN); } }
public void handleBlockComment(int commentIndex) { Token commentToken = this.tm.get(commentIndex); boolean isFirstColumn = handleWhitespaceAround(commentIndex); if (handleFormatOnOffTags(commentToken)) return; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_block_comment && !isHeader) || (this.options.comment_format_header && isHeader); formattingEnabled = formattingEnabled && this.tm.charAt(commentToken.originalStart + 2) != '-'; if (formattingEnabled && tokenizeMultilineComment(commentToken)) { this.commentStructure = commentToken.getInternalStructure(); this.ctm = new TokenManager(this.commentStructure, this.tm); handleStringLiterals(this.tm.toString(commentToken), commentToken.originalStart); addSubstituteWraps(); } else { commentToken.setInternalStructure(commentToLines(commentToken, -1)); } if (this.options.never_indent_block_comments_on_first_column && isFirstColumn) { commentToken.setIndent(0); commentToken.setWrapPolicy(null); } }
public void handleBlockComment(int commentIndex) { Token commentToken = this.tm.get(commentIndex); boolean isFirstColumn = handleWhitespaceAround(commentIndex); if (handleFormatOnOffTags(commentToken)) return; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_block_comment && !isHeader) || (this.options.comment_format_header && isHeader); formattingEnabled = formattingEnabled && this.tm.charAt(commentToken.originalStart + 2) != '-'; if (formattingEnabled && tokenizeMultilineComment(commentToken)) { this.commentStructure = commentToken.getInternalStructure(); this.ctm = new TokenManager(this.commentStructure, this.tm); handleStringLiterals(this.tm.toString(commentToken), commentToken.originalStart); addSubstituteWraps(); } else { commentToken.setInternalStructure(commentToLines(commentToken, -1)); } if (this.options.never_indent_block_comments_on_first_column && isFirstColumn) { commentToken.setIndent(0); commentToken.setWrapPolicy(WrapPolicy.FORCE_FIRST_COLUMN); } }
@Override public boolean visit(Javadoc node) { this.noFormatTagOpenStart = -1; this.formatCodeTagOpenEnd = -1; this.lastFormatCodeClosingTagIndex = -1; this.firstTagToken = null; this.ctm = null; int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC); Token commentToken = this.tm.get(commentIndex); if (node.getParent() == null) { // not a proper javadoc, treat as block comment handleWhitespaceAround(commentIndex); } if (commentIndex < this.tm.size() - 1) commentToken.breakAfter(); if (handleFormatOnOffTags(commentToken)) return false; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader) || (this.options.comment_format_header && isHeader); if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) { commentToken.setInternalStructure(commentToLines(commentToken, -1)); return false; } this.commentStructure = commentToken.getInternalStructure(); this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true); this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm); return true; }
@Override public boolean visit(Javadoc node) { this.noFormatTagOpenStart = -1; this.formatCodeTagOpenEnd = -1; this.lastFormatCodeClosingTagIndex = -1; this.firstTagToken = null; this.ctm = null; int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC); Token commentToken = this.tm.get(commentIndex); if (node.getParent() == null) { // not a proper javadoc, treat as block comment handleWhitespaceAround(commentIndex); } if (commentIndex < this.tm.size() - 1) commentToken.breakAfter(); if (handleFormatOnOffTags(commentToken)) return false; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader) || (this.options.comment_format_header && isHeader); if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) { commentToken.setInternalStructure(commentToLines(commentToken, -1)); return false; } this.commentStructure = commentToken.getInternalStructure(); this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true); this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm); return true; }
@Override public boolean visit(Javadoc node) { this.noFormatTagOpenStart = -1; this.formatCodeTagOpenEnd = -1; this.lastFormatCodeClosingTagIndex = -1; this.firstTagToken = null; this.ctm = null; int commentIndex = this.tm.firstIndexIn(node, TokenNameCOMMENT_JAVADOC); Token commentToken = this.tm.get(commentIndex); if (node.getParent() == null) { // not a proper javadoc, treat as block comment handleWhitespaceAround(commentIndex); } if (commentIndex < this.tm.size() - 1) commentToken.breakAfter(); if (handleFormatOnOffTags(commentToken)) return false; boolean isHeader = this.tm.isInHeader(commentIndex); boolean formattingEnabled = (this.options.comment_format_javadoc_comment && !isHeader) || (this.options.comment_format_header && isHeader); if (!formattingEnabled || !tokenizeMultilineComment(commentToken)) { commentToken.setInternalStructure(commentToLines(commentToken, -1)); return false; } this.commentStructure = commentToken.getInternalStructure(); this.commentIndent = this.tm.toIndent(commentToken.getIndent(), true); this.ctm = new TokenManager(commentToken.getInternalStructure(), this.tm); handleJavadocTagAlignment(node); return true; }