mirror of
https://github.com/JFormDesigner/FlatLaf.git
synced 2025-12-07 14:30:56 +03:00
Theme Editor: fixed mark occurrences for property references (starting with '$') and property references in function parameters
This commit is contained in:
@@ -97,6 +97,7 @@ public class FlatThemeTokenMaker
|
|||||||
|
|
||||||
int currentTokenStart = start;
|
int currentTokenStart = start;
|
||||||
int currentTokenType = Token.NULL;
|
int currentTokenType = Token.NULL;
|
||||||
|
int parenthesisLevel = 0;
|
||||||
|
|
||||||
for( int i = start; i <= end; i++ ) {
|
for( int i = start; i <= end; i++ ) {
|
||||||
int newTokenType;
|
int newTokenType;
|
||||||
@@ -119,21 +120,36 @@ public class FlatThemeTokenMaker
|
|||||||
if( currentTokenType == Token.NULL )
|
if( currentTokenType == Token.NULL )
|
||||||
currentTokenType = newTokenType;
|
currentTokenType = newTokenType;
|
||||||
else if( newTokenType != currentTokenType ) {
|
else if( newTokenType != currentTokenType ) {
|
||||||
addTokenImpl( array, currentTokenStart, i - 1, currentTokenType, newStartOffset + currentTokenStart );
|
addTokenImpl( array, currentTokenStart, i - 1, currentTokenType, newStartOffset + currentTokenStart, parenthesisLevel );
|
||||||
currentTokenType = newTokenType;
|
currentTokenType = newTokenType;
|
||||||
currentTokenStart = i;
|
currentTokenStart = i;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if( ch == '(' )
|
||||||
|
parenthesisLevel++;
|
||||||
|
else if( ch == ')' )
|
||||||
|
parenthesisLevel--;
|
||||||
}
|
}
|
||||||
|
|
||||||
if( currentTokenType != Token.NULL )
|
if( currentTokenType != Token.NULL )
|
||||||
addTokenImpl( array, currentTokenStart, end, currentTokenType, newStartOffset + currentTokenStart );
|
addTokenImpl( array, currentTokenStart, end, currentTokenType, newStartOffset + currentTokenStart, parenthesisLevel );
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addTokenImpl( char[] array, int start, int end, int tokenType, int startOffset ) {
|
private void addTokenImpl( char[] array, int start, int end, int tokenType, int startOffset, int parenthesisLevel ) {
|
||||||
if( tokenType == TOKEN_STRING ) {
|
if( tokenType == TOKEN_PROPERTY && array[start] == '$' ) {
|
||||||
|
// separate '$' from property token for mark occurrences to work
|
||||||
|
super.addToken( array, start, start, TokenTypes.OPERATOR, startOffset, false );
|
||||||
|
start++;
|
||||||
|
startOffset++;
|
||||||
|
} else if( tokenType == TOKEN_STRING ) {
|
||||||
|
// check for reserved words, functions, etc
|
||||||
int type = tokenMap.get( array, start, end );
|
int type = tokenMap.get( array, start, end );
|
||||||
if( type != -1 )
|
if( type != -1 )
|
||||||
tokenType = type;
|
tokenType = type;
|
||||||
|
else if( parenthesisLevel > 0 ) {
|
||||||
|
// assume property reference if in function parameters
|
||||||
|
tokenType = TOKEN_PROPERTY;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// debugOutputToken( array, start, end, tokenType );
|
// debugOutputToken( array, start, end, tokenType );
|
||||||
|
|||||||
Reference in New Issue
Block a user