org.gjt.sp.jedit.syntax
Class SyntaxUtilities
- java.lang.Object
-
- org.gjt.sp.jedit.syntax.SyntaxUtilities
-
public class SyntaxUtilities extends java.lang.ObjectClass with several segment and bracket matching functions used by jEdit's syntax colorizing subsystem. It also provides a way to get the default color table.
-
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method and Description static java.awt.Color[]getDefaultSyntaxColors()Returns the default color table.static intlocateBracketBackward(javax.swing.text.Document doc, int dot, char openBracket, char closeBracket)Finds the previous instance of an opening bracket in the buffer.static intlocateBracketForward(javax.swing.text.Document doc, int dot, char openBracket, char closeBracket)Finds the next instance of a closing bracket in the buffer.static booleanregionMatches(boolean ignoreCase, javax.swing.text.Segment text, int offset, char[] match)Checks if a subregion of aSegmentis equal to a character array.static booleanregionMatches(boolean ignoreCase, javax.swing.text.Segment text, int offset, java.lang.String match)Checks if a subregion of aSegmentis equal to a string.
-
-
-
Method Detail
-
regionMatches
public static boolean regionMatches(boolean ignoreCase, javax.swing.text.Segment text, int offset, java.lang.String match)Checks if a subregion of aSegmentis equal to a string.- Parameters:
ignoreCase- True if case should be ignored, false otherwisetext- The segmentoffset- The offset into the segmentmatch- The string to match
-
regionMatches
public static boolean regionMatches(boolean ignoreCase, javax.swing.text.Segment text, int offset, char[] match)Checks if a subregion of aSegmentis equal to a character array.- Parameters:
ignoreCase- True if case should be ignored, false otherwisetext- The segmentoffset- The offset into the segmentmatch- The character array to match
-
locateBracketBackward
public static int locateBracketBackward(javax.swing.text.Document doc, int dot, char openBracket, char closeBracket) throws javax.swing.text.BadLocationExceptionFinds the previous instance of an opening bracket in the buffer. The closing bracket is needed as well to handle nested brackets properly.- Parameters:
doc- The document to search indot- The starting positionopenBracket- The opening bracketcloseBracket- The closing bracket- Throws:
javax.swing.text.BadLocationException- if `dot' is out of range
-
locateBracketForward
public static int locateBracketForward(javax.swing.text.Document doc, int dot, char openBracket, char closeBracket) throws javax.swing.text.BadLocationExceptionFinds the next instance of a closing bracket in the buffer. The opening bracket is needed as well to handle nested brackets properly.- Parameters:
doc- The document to search indot- The starting positionopenBracket- The opening bracketcloseBracket- The closing bracket- Throws:
javax.swing.text.BadLocationException- if `dot' is out of range
-
getDefaultSyntaxColors
public static java.awt.Color[] getDefaultSyntaxColors()
Returns the default color table. This can be passed to thesetColors()method ofSyntaxDocumentto use the default syntax colors.
-
-
DataMelt 3.0 © DataMelt by jWork.ORG