Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* 12/23/2012
*
* JsonFoldParser.java - Fold parser for JSON.
*
* This library is distributed under a modified BSD license. See the included
* RSyntaxTextArea.License.txt file for details.
*/
package org.fife.ui.rsyntaxtextarea.folding;
import java.util.ArrayList;
import java.util.List;
import java.util.Stack;
import javax.swing.text.BadLocationException;
import org.fife.ui.rsyntaxtextarea.RSyntaxTextArea;
import org.fife.ui.rsyntaxtextarea.Token;
import org.fife.ui.rsyntaxtextarea.TokenTypes;
/**
* The fold parser for JSON. Objects ("{ ... }") and arrays
* ("[ ... ]") that span multiple lines are considered fold
* regions.
*
* @author Robert Futrell
* @version 1.0
*/
public class JsonFoldParser implements FoldParser {
private static final Object OBJECT_BLOCK = new Object();
private static final Object ARRAY_BLOCK = new Object();
/**
* {@inheritDoc}
*/
public List getFolds(RSyntaxTextArea textArea) {
Stack. Otherwise, return false.
*
* @param stack The stack.
* @param value The value to check for.
* @return Whether the value was found on top of the stack.
*/
private static final boolean popOffTop(Stack stack, Object value) {
if (stack.size()>0 && stack.peek()==value) {
stack.pop();
return true;
}
return false;
}
}