Class JsonFoldParser

java.lang.Object
org.fife.ui.rsyntaxtextarea.folding.JsonFoldParser
All Implemented Interfaces:
FoldParser

public class JsonFoldParser extends Object implements FoldParser
The fold parser for JSON. Objects ("{ ... }") and arrays ("[ ... ]") that span multiple lines are considered fold regions.
Version:
1.0
  • Field Details

    • OBJECT_BLOCK

      private static final Object OBJECT_BLOCK
    • ARRAY_BLOCK

      private static final Object ARRAY_BLOCK
  • Constructor Details

    • JsonFoldParser

      public JsonFoldParser()
  • Method Details

    • getFolds

      public List<Fold> getFolds(RSyntaxTextArea textArea)
      Description copied from interface: FoldParser
      Returns a list of all folds in the text area.
      Specified by:
      getFolds in interface FoldParser
      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

      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:
    • popOffTop

      private static boolean popOffTop(Stack<Object> stack, Object value)
      If the specified value is on top of the stack, pop it off and return true. Otherwise, return false.
      Parameters:
      stack - The stack.
      value - The value to check for.
      Returns:
      Whether the value was found on top of the stack.