Package org.fife.ui.rsyntaxtextarea
Class AbstractJFlexCTokenMaker
- java.lang.Object
-
- org.fife.ui.rsyntaxtextarea.TokenMakerBase
-
- org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker
-
- org.fife.ui.rsyntaxtextarea.AbstractJFlexCTokenMaker
-
- All Implemented Interfaces:
TokenMaker
- Direct Known Subclasses:
ActionScriptTokenMaker
,CPlusPlusTokenMaker
,CSharpTokenMaker
,CSSTokenMaker
,CTokenMaker
,DartTokenMaker
,DTokenMaker
,GroovyTokenMaker
,JavaScriptTokenMaker
,JavaTokenMaker
,NSISTokenMaker
,PerlTokenMaker
,ScalaTokenMaker
,TclTokenMaker
public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker
Base class for JFlex-based token makers using C-style syntax. This class knows how to:- Auto-indent after opening braces and parens
- Automatically close multi-line and documentation comments
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected class
AbstractJFlexCTokenMaker.CStyleInsertBreakAction
Action that knows how to special-case inserting a newline in a multi-line comment for languages like C and Java.
-
Field Summary
-
Fields inherited from class org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker
offsetShift, s, start
-
Fields inherited from class org.fife.ui.rsyntaxtextarea.TokenMakerBase
currentToken, firstToken, previousToken
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
AbstractJFlexCTokenMaker()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected Action
createInsertBreakAction()
Creates and returns the action to use when the user inserts a newline.boolean
getCurlyBracesDenoteCodeBlocks(int languageIndex)
Returnstrue
always as C-style languages use curly braces to denote code blocks.Action
getInsertBreakAction()
Returns an action to handle "insert break" key presses (i.e.boolean
getMarkOccurrencesOfTokenType(int type)
Returns whether tokens of the specified type should have "mark occurrences" enabled for the current programming language.boolean
getShouldIndentNextLineAfter(Token t)
The default implementation returnsfalse
always.-
Methods inherited from class org.fife.ui.rsyntaxtextarea.AbstractJFlexTokenMaker
yybegin, yybegin
-
Methods inherited from class org.fife.ui.rsyntaxtextarea.TokenMakerBase
addNullToken, addToken, addToken, addToken, createOccurrenceMarker, getClosestStandardTokenTypeForInternalType, getLanguageIndex, getLastTokenTypeOnLine, getLineCommentStartAndEnd, getOccurrenceMarker, isIdentifierChar, isMarkupLanguage, resetTokenList, setLanguageIndex
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface org.fife.ui.rsyntaxtextarea.TokenMaker
getTokenList
-
-
-
-
Method Detail
-
createInsertBreakAction
protected Action createInsertBreakAction()
Creates and returns the action to use when the user inserts a newline. The default implementation intelligently closes multi-line comments. Subclasses can override.- Returns:
- The action.
- See Also:
getInsertBreakAction()
-
getCurlyBracesDenoteCodeBlocks
public boolean getCurlyBracesDenoteCodeBlocks(int languageIndex)
Returnstrue
always as C-style languages use curly braces to denote code blocks.- Specified by:
getCurlyBracesDenoteCodeBlocks
in interfaceTokenMaker
- Overrides:
getCurlyBracesDenoteCodeBlocks
in classTokenMakerBase
- Parameters:
languageIndex
- The language index at the offset in question. Since someTokenMaker
s effectively have nested languages (such as JavaScript in HTML), this parameter tells theTokenMaker
what sub-language to look at.- Returns:
true
always.
-
getInsertBreakAction
public Action getInsertBreakAction()
Returns an action to handle "insert break" key presses (i.e. Enter). An action is returned that handles newlines differently in multi-line comments.- Specified by:
getInsertBreakAction
in interfaceTokenMaker
- Overrides:
getInsertBreakAction
in classTokenMakerBase
- Returns:
- The action.
-
getMarkOccurrencesOfTokenType
public boolean getMarkOccurrencesOfTokenType(int type)
Returns whether tokens of the specified type should have "mark occurrences" enabled for the current programming language. The default implementation returns true if type isTokenTypes.IDENTIFIER
. Subclasses can override this method to support other token types, such asTokenTypes.VARIABLE
.- Specified by:
getMarkOccurrencesOfTokenType
in interfaceTokenMaker
- Overrides:
getMarkOccurrencesOfTokenType
in classTokenMakerBase
- Parameters:
type
- The token type.- Returns:
- Whether tokens of this type should have "mark occurrences" enabled.
-
getShouldIndentNextLineAfter
public boolean getShouldIndentNextLineAfter(Token t)
The default implementation returnsfalse
always. Languages that wish to better support auto-indentation can override this method.- Specified by:
getShouldIndentNextLineAfter
in interfaceTokenMaker
- Overrides:
getShouldIndentNextLineAfter
in classTokenMakerBase
- Parameters:
t
- The token the previous line ends with.- Returns:
- Whether the next line should be indented.
-
-