Class JsonFoldParser
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.folding.JsonFoldParser
-
- All Implemented Interfaces:
FoldParser
public class JsonFoldParser extends java.lang.Object implements FoldParser
The fold parser for JSON. Objects ("{ ... }
") and arrays ("[ ... ]"
) that span multiple lines are considered fold regions.- Version:
- 1.0
-
-
Field Summary
Fields Modifier and Type Field Description private static java.lang.Object
ARRAY_BLOCK
private static java.lang.Object
OBJECT_BLOCK
-
Constructor Summary
Constructors Constructor Description JsonFoldParser()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description java.util.List<Fold>
getFolds(RSyntaxTextArea textArea)
Returns a list of all folds in the text area.private static boolean
isLeftBracket(Token t)
Returns whether a token is the left bracket token.private static boolean
isRightBracket(Token t)
Returns whether a token is the right bracket token.private static boolean
popOffTop(java.util.Stack<java.lang.Object> stack, java.lang.Object value)
If the specified value is on top of the stack, pop it off and returntrue
.
-
-
-
Method Detail
-
getFolds
public java.util.List<Fold> getFolds(RSyntaxTextArea textArea)
Description copied from interface:FoldParser
Returns a list of all folds in the text area.- Specified by:
getFolds
in interfaceFoldParser
- Parameters:
textArea
- The text area whose contents should be analyzed.- Returns:
- The list of folds. If this method returns
null
, it is treated as if no folds were found.
-
isLeftBracket
private static boolean isLeftBracket(Token t)
Returns whether a token is the left bracket token.- Parameters:
t
- The token.- Returns:
- Whether the token is the left bracket token.
- See Also:
isRightBracket(Token)
-
isRightBracket
private static boolean isRightBracket(Token t)
Returns whether a token is the right bracket token.- Parameters:
t
- The token.- Returns:
- Whether the token is the right bracket token.
- See Also:
isLeftBracket(Token)
-
popOffTop
private static boolean popOffTop(java.util.Stack<java.lang.Object> stack, java.lang.Object value)
If the specified value is on top of the stack, pop it off and returntrue
. Otherwise, returnfalse
.- Parameters:
stack
- The stack.value
- The value to check for.- Returns:
- Whether the value was found on top of the stack.
-
-