Class AbstractJFlexCTokenMaker

    • Field Detail

      • INSERT_BREAK_ACTION

        private final javax.swing.Action INSERT_BREAK_ACTION
      • MLC_PATTERN

        private static final java.util.regex.Pattern MLC_PATTERN
    • Constructor Detail

      • AbstractJFlexCTokenMaker

        protected AbstractJFlexCTokenMaker()
    • Method Detail

      • createInsertBreakAction

        protected javax.swing.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)
        Returns true always as C-style languages use curly braces to denote code blocks.
        Specified by:
        getCurlyBracesDenoteCodeBlocks in interface TokenMaker
        Overrides:
        getCurlyBracesDenoteCodeBlocks in class TokenMakerBase
        Parameters:
        languageIndex - The language index at the offset in question. Since some TokenMakers effectively have nested languages (such as JavaScript in HTML), this parameter tells the TokenMaker what sub-language to look at.
        Returns:
        true always.
      • getInsertBreakAction

        public javax.swing.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 interface TokenMaker
        Overrides:
        getInsertBreakAction in class TokenMakerBase
        Returns:
        The action.
      • getShouldIndentNextLineAfter

        public boolean getShouldIndentNextLineAfter​(Token t)
        Description copied from class: TokenMakerBase
        The default implementation returns false always. Languages that wish to better support auto-indentation can override this method.
        Specified by:
        getShouldIndentNextLineAfter in interface TokenMaker
        Overrides:
        getShouldIndentNextLineAfter in class TokenMakerBase
        Parameters:
        t - The token the previous line ends with.
        Returns:
        Whether the next line should be indented.
      • isInternalEolTokenForMLCs

        private boolean isInternalEolTokenForMLCs​(Token t)
        Returns whether a given token is an internal token type that represents an MLC or documentation comment continuing on to the next line. This is done by languages such as JavaScript that are a little more verbose than necessary so that their code can be copy-and-pasted into other TokenMakers that use them as nested languages (such as HTML, JSP, etc.).
        Parameters:
        t - The token to check. This cannot be null.
        Returns:
        Whether the token is an internal token representing the end of a line for an MLC/doc comment continuing on to the next line.