public class BlockParentHandler extends ExpressionHandler
The "block" handler classes use a common superclass BlockParentHandler, employing the Template Method pattern.
Constructor and Description |
---|
BlockParentHandler(IndentationCheck indentCheck,
String name,
DetailAST ast,
ExpressionHandler parent)
Construct an instance of this handler with the given indentation check,
name, abstract syntax tree, and parent handler.
|
Modifier and Type | Method and Description |
---|---|
void |
checkIndentation()
Check the indentation of the expression we are handling.
|
protected void |
checkLCurly()
Check the indentation of the left curly brace.
|
protected void |
checkRCurly()
Check the indentation of the right curly brace.
|
protected void |
checkToplevelToken()
Check the indent of the top level token.
|
protected boolean |
childrenMayNest()
Determines if child elements within the expression may be nested.
|
protected IndentLevel |
curlyLevel()
Get the expected indentation level for the curly braces.
|
protected int[] |
getCheckedChildren()
Returns array of token types which should be checked among childrens.
|
protected IndentLevel |
getChildrenExpectedLevel() |
protected DetailAST |
getLCurly()
Get the left curly brace portion of the expression we are handling.
|
protected DetailAST |
getListChild()
Get the child element representing the list of statements.
|
protected DetailAST |
getLParen()
Get the left parenthesis portion of the expression we are handling.
|
protected DetailAST |
getNonlistChild()
Get the child element that is not a list of statements.
|
protected DetailAST |
getRCurly()
Get the right curly brace portion of the expression we are handling.
|
protected DetailAST |
getRParen()
Get the right parenthesis portion of the expression we are handling.
|
protected DetailAST |
getToplevelAST()
Get the top level expression being managed by this handler.
|
protected boolean |
hasCurlys()
Determines if this block expression has curly braces.
|
protected boolean |
hasLabelBefore()
Check if the top level token has label before.
|
protected boolean |
rcurlyMustStart()
Determines if the right curly brace must be at the start of the line.
|
IndentLevel |
suggestedChildLevel(ExpressionHandler child)
Indentation level suggested for a child element.
|
protected boolean |
toplevelMustStartLine()
Determines if the top level token must start the line.
|
checkChildren, checkExpressionSubtree, checkLinesIndent, checkLParen, checkModifiers, checkRParen, expandedTabsColumnNo, findSubtreeLines, getBasicOffset, getBraceAdjustement, getFirstLine, getIndentCheck, getLevel, getLevelImpl, getLineStart, getLineStart, getMainAst, getParent, logError, logError, shouldIncreaseIndent, startsLine
public BlockParentHandler(IndentationCheck indentCheck, String name, DetailAST ast, ExpressionHandler parent)
indentCheck
- the indentation checkname
- the name of the handlerast
- the abstract syntax treeparent
- the parent handlerprotected int[] getCheckedChildren()
protected DetailAST getToplevelAST()
protected void checkToplevelToken()
protected boolean hasLabelBefore()
protected boolean toplevelMustStartLine()
protected boolean hasCurlys()
protected DetailAST getLCurly()
protected DetailAST getRCurly()
protected void checkLCurly()
protected IndentLevel curlyLevel()
protected boolean rcurlyMustStart()
protected boolean childrenMayNest()
protected void checkRCurly()
protected DetailAST getNonlistChild()
protected DetailAST getListChild()
protected DetailAST getRParen()
protected DetailAST getLParen()
public void checkIndentation()
ExpressionHandler
checkIndentation
in class ExpressionHandler
protected IndentLevel getChildrenExpectedLevel()
public IndentLevel suggestedChildLevel(ExpressionHandler child)
ExpressionHandler
suggestedChildLevel
in class ExpressionHandler
child
- child AST (so suggestion level can differ based on child
type)Copyright © 2001–2015. All rights reserved.