mirror of
https://git.huckle.dev/Huckles-Minecraft-Archive/jpexs-decompiler.git
synced 2026-09-26 22:20:46 +00:00
Fixed: #2476 Dark interface skins identifiers highlighter visibility
This commit is contained in:
@@ -18,6 +18,7 @@ import java.beans.PropertyChangeEvent;
|
||||
import java.beans.PropertyChangeListener;
|
||||
import jsyntaxpane.actions.*;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.CaretEvent;
|
||||
import javax.swing.event.CaretListener;
|
||||
import javax.swing.text.JTextComponent;
|
||||
@@ -67,6 +68,12 @@ public class PairsMarker implements CaretListener, SyntaxComponent, PropertyChan
|
||||
@Override
|
||||
public void config(Configuration config) {
|
||||
Color markerColor = config.getColor(PROPERTY_COLOR, new Color(0xeeee33));
|
||||
|
||||
Color editorBackground = UIManager.getColor("EditorPane.background");
|
||||
int light = (editorBackground.getRed() + editorBackground.getGreen() + editorBackground.getBlue()) / 3;
|
||||
if (light < 128) {
|
||||
markerColor = new Color(0x553322);
|
||||
}
|
||||
this.marker = new Markers.SimpleMarker(markerColor);
|
||||
}
|
||||
|
||||
|
||||
@@ -22,6 +22,7 @@ import java.util.Iterator;
|
||||
import java.util.Set;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.JEditorPane;
|
||||
import javax.swing.UIManager;
|
||||
import javax.swing.event.CaretEvent;
|
||||
import javax.swing.event.CaretListener;
|
||||
import jsyntaxpane.SyntaxDocument;
|
||||
@@ -101,6 +102,11 @@ public class TokenMarker implements SyntaxComponent, CaretListener, PropertyChan
|
||||
public void config(Configuration config) {
|
||||
Color markerColor = config.getColor(
|
||||
PROPERTY_COLOR, DEFAULT_COLOR);
|
||||
Color editorBackground = UIManager.getColor("EditorPane.background");
|
||||
int light = (editorBackground.getRed() + editorBackground.getGreen() + editorBackground.getBlue()) / 3;
|
||||
if (light < 128) {
|
||||
markerColor = new Color(0x553322);
|
||||
}
|
||||
this.marker = new Markers.SimpleMarker(markerColor);
|
||||
String types = config.getString(
|
||||
PROPERTY_TOKENTYPES, DEFAULT_TOKENTYPES);
|
||||
|
||||
+27
-1
@@ -18,6 +18,7 @@ import jsyntaxpane.*;
|
||||
import java.io.IOException;
|
||||
import java.io.Reader;
|
||||
import java.util.List;
|
||||
import java.util.Stack;
|
||||
import java.util.logging.Level;
|
||||
import java.util.logging.Logger;
|
||||
import javax.swing.text.Segment;
|
||||
@@ -33,6 +34,8 @@ public abstract class DefaultJFlexLexer implements Lexer {
|
||||
protected int tokenStart;
|
||||
protected int tokenLength;
|
||||
protected int offset;
|
||||
|
||||
protected Stack<Token> pushedBack = new Stack<>();
|
||||
|
||||
/**
|
||||
* Helper method to create and return a new Token from of TokenType
|
||||
@@ -100,7 +103,7 @@ public abstract class DefaultJFlexLexer implements Lexer {
|
||||
CharArrayReader reader = new CharArrayReader(segment.array, segment.offset, segment.count);
|
||||
yyreset(reader);
|
||||
this.offset = ofst;
|
||||
for (Token t = yylex(); t != null; t = yylex()) {
|
||||
for (Token t = lex(); t != null; t = lex()) {
|
||||
tokens.add(t);
|
||||
}
|
||||
} catch (IOException ex) {
|
||||
@@ -115,6 +118,29 @@ public abstract class DefaultJFlexLexer implements Lexer {
|
||||
*/
|
||||
public abstract void yyreset(Reader reader);
|
||||
|
||||
|
||||
/**
|
||||
* JPEXS:
|
||||
* Pushes back token.
|
||||
* @param token
|
||||
*/
|
||||
public void pushBack(Token token) {
|
||||
pushedBack.push(token);
|
||||
}
|
||||
|
||||
/**
|
||||
* JPEXS:
|
||||
* Calls yylex, allows pushback
|
||||
* @return
|
||||
* @throws java.io.IOException
|
||||
*/
|
||||
public Token lex() throws java.io.IOException {
|
||||
if (!pushedBack.isEmpty()) {
|
||||
return pushedBack.pop();
|
||||
}
|
||||
return yylex();
|
||||
}
|
||||
|
||||
/**
|
||||
* This is called to return the next Token from the Input Reader
|
||||
* @return next token, or null if no more tokens.
|
||||
|
||||
@@ -83,7 +83,7 @@ StringCharacter = [^\r\n\"\\]
|
||||
Register= register{NumberLiteral}
|
||||
Constant= constant{NumberLiteral}
|
||||
|
||||
%state STRING,PARAMETERS
|
||||
%state STRING,IDENT,PARAMETERS
|
||||
|
||||
%%
|
||||
|
||||
@@ -94,6 +94,7 @@ Constant= constant{NumberLiteral}
|
||||
{WhiteSpace} { }
|
||||
|
||||
{Label} {
|
||||
pushBack(token(TokenType.OPERATOR,yychar+yylength()-1,1));
|
||||
return token(TokenType.IDENTIFIER,yychar,yylength()-1);
|
||||
}
|
||||
|
||||
@@ -113,6 +114,9 @@ Constant= constant{NumberLiteral}
|
||||
tokenLength = 1;
|
||||
}
|
||||
|
||||
/* operator*/
|
||||
"," { return token(TokenType.OPERATOR);}
|
||||
|
||||
/* numeric literals */
|
||||
|
||||
{NumberLiteral} { return token(TokenType.NUMBER); }
|
||||
|
||||
@@ -103,7 +103,10 @@ ExceptionTarget = "exceptiontarget "{PositiveNumberLiteral}":"
|
||||
}
|
||||
|
||||
|
||||
{Label} {return token(TokenType.IDENTIFIER,yychar,yylength()-1); }
|
||||
{Label} {
|
||||
pushBack(token(TokenType.OPERATOR,yychar+yylength()-1,1));
|
||||
return token(TokenType.IDENTIFIER,yychar,yylength()-1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user