mirror of
https://github.com/SuspiciousActivity/ByteEdit.git
synced 2026-08-13 17:56:17 +00:00
Fixes and updates
This commit is contained in:
1 parent
d1710ea6a5
commit
fb4da77359
211 files changed
+45363
-45571
No files matched your search
@@ -30,18 +30,18 @@ import org.fife.ui.rtextarea.RTextArea;
|
||||
* @version 1.0
|
||||
*/
|
||||
public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
|
||||
|
||||
|
||||
private final Action INSERT_BREAK_ACTION;
|
||||
private static final Pattern MLC_PATTERN = Pattern.compile("([ \\t]*)(/?[\\*]+)([ \\t]*)");
|
||||
|
||||
|
||||
protected AbstractJFlexCTokenMaker() {
|
||||
INSERT_BREAK_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.
|
||||
* Creates and returns the action to use when the user inserts a newline. The
|
||||
* default implementation intelligently closes multi-line comments. Subclasses
|
||||
* can override.
|
||||
*
|
||||
* @return The action.
|
||||
* @see #getInsertBreakAction()
|
||||
@@ -49,10 +49,10 @@ public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
|
||||
protected Action createInsertBreakAction() {
|
||||
return new CStyleInsertBreakAction();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns <code>true</code> always as C-style languages use curly braces
|
||||
* to denote code blocks.
|
||||
* Returns <code>true</code> always as C-style languages use curly braces to
|
||||
* denote code blocks.
|
||||
*
|
||||
* @return <code>true</code> always.
|
||||
*/
|
||||
@@ -60,11 +60,10 @@ public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
|
||||
public boolean getCurlyBracesDenoteCodeBlocks(int languageIndex) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns an action to handle "insert break" key presses (i.e. Enter).
|
||||
* An action is returned that handles newlines differently in multi-line
|
||||
* comments.
|
||||
* Returns an action to handle "insert break" key presses (i.e. Enter). An
|
||||
* action is returned that handles newlines differently in multi-line comments.
|
||||
*
|
||||
* @return The action.
|
||||
*/
|
||||
@@ -72,7 +71,7 @@ public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
|
||||
public Action getInsertBreakAction() {
|
||||
return INSERT_BREAK_ACTION;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -80,7 +79,7 @@ public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
|
||||
public boolean getMarkOccurrencesOfTokenType(int type) {
|
||||
return type == Token.IDENTIFIER || type == Token.FUNCTION;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* {@inheritDoc}
|
||||
*/
|
||||
@@ -92,19 +91,17 @@ public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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
|
||||
* <code>TokenMaker</code>s that use them as nested languages (such as
|
||||
* HTML, JSP, etc.).
|
||||
* 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 <code>TokenMaker</code>s
|
||||
* that use them as nested languages (such as HTML, JSP, etc.).
|
||||
*
|
||||
* @param t
|
||||
* The token to check. This cannot be <code>null</code>.
|
||||
* @return Whether the token is an internal token representing the end of
|
||||
* a line for an MLC/doc comment continuing on to the next line.
|
||||
* @param t The token to check. This cannot be <code>null</code>.
|
||||
* @return Whether the token is an internal token representing the end of a line
|
||||
* for an MLC/doc comment continuing on to the next line.
|
||||
*/
|
||||
private boolean isInternalEolTokenForMLCs(Token t) {
|
||||
int type = t.getType();
|
||||
@@ -114,13 +111,13 @@ public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Action that knows how to special-case inserting a newline in a
|
||||
* multi-line comment for languages like C and Java.
|
||||
* Action that knows how to special-case inserting a newline in a multi-line
|
||||
* comment for languages like C and Java.
|
||||
*/
|
||||
protected class CStyleInsertBreakAction extends RSyntaxTextAreaEditorKit.InsertBreakAction {
|
||||
|
||||
|
||||
@Override
|
||||
public void actionPerformedImpl(ActionEvent e, RTextArea textArea) {
|
||||
if (!textArea.isEditable() || !textArea.isEnabled()) {
|
||||
@@ -141,13 +138,12 @@ public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
|
||||
handleInsertBreak(rsta, true);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Returns whether the MLC token containing <code>offs</code> appears
|
||||
* to have a "nested" comment (i.e., contains "<code>/*</code>"
|
||||
* somewhere inside of it). This implies that it is likely a "new" MLC
|
||||
* and needs to be closed. While not foolproof, this is usually good
|
||||
* enough of a sign.
|
||||
* Returns whether the MLC token containing <code>offs</code> appears to have a
|
||||
* "nested" comment (i.e., contains "<code>/*</code>" somewhere inside of it).
|
||||
* This implies that it is likely a "new" MLC and needs to be closed. While not
|
||||
* foolproof, this is usually good enough of a sign.
|
||||
*
|
||||
* @param textArea
|
||||
* @param line
|
||||
@@ -183,7 +179,7 @@ public abstract class AbstractJFlexCTokenMaker extends AbstractJFlexTokenMaker {
|
||||
}
|
||||
return true; // No match - MLC goes to the end of the file
|
||||
}
|
||||
|
||||
|
||||
private void insertBreakInMLC(ActionEvent e, RSyntaxTextArea textArea, int line) {
|
||||
Matcher m = null;
|
||||
int start = -1;
|
||||
|
||||
Reference in new issue
Block a user