Apply same parser & lexer fixes from before

This commit is contained in:
Stef Tervelde
2025-03-17 15:11:24 +01:00
parent 743ea14190
commit ad5c27ec42
6 changed files with 24 additions and 17 deletions

1
.gitignore vendored
View File

@@ -108,6 +108,7 @@ java/build/
/java/libraries/svg/bin
/java/preprocessor/build
/java/lsp/build
/java/gradle/build
/.kotlin/sessions
/core/examples/build

View File

@@ -134,6 +134,8 @@ CHAR_LITERAL: '\'' (~['\\\r\n] | EscapeSequence) '\'';
STRING_LITERAL: '"' (~["\\\r\n] | EscapeSequence)* '"';
MULTI_STRING_LIT: '"""' (~[\\] | EscapeSequence)*? '"""';
TEXT_BLOCK: '"""' [ \t]* [\r\n] (. | EscapeSequence)*? '"""';
NULL_LITERAL: 'null';

View File

@@ -314,11 +314,24 @@ qualifiedName
: identifier ('.' identifier)*
;
baseStringLiteral
: STRING_LITERAL
;
multilineStringLiteral
: MULTI_STRING_LIT
;
stringLiteral
: baseStringLiteral
| multilineStringLiteral
;
literal
: integerLiteral
| floatLiteral
| CHAR_LITERAL
| STRING_LITERAL
| stringLiteral
| BOOL_LITERAL
| NULL_LITERAL
| TEXT_BLOCK // Java17

View File

@@ -27,7 +27,7 @@ processingSketch
: staticProcessingSketch
| javaProcessingSketch
| activeProcessingSketch
| warnMixedModes
// | warnMixedModes
;
// java mode, is a compilation unit
@@ -111,7 +111,7 @@ literal
: integerLiteral
| floatLiteral
| CHAR_LITERAL
| STRING_LITERAL
| stringLiteral
| BOOL_LITERAL
| NULL_LITERAL
| hexColorLiteral
@@ -144,13 +144,4 @@ LINE_COMMENT
CHAR_LITERAL
: '\'' (~['\\\r\n] | EscapeSequence)* '\'' // A bit nasty but let JDT tackle invalid chars
;
// Parser Rules
multilineStringLiteral
: MULTILINE_STRING_START .*? MULTILINE_STRING_END
;
// Lexer Rules
MULTILINE_STRING_START: '"""' '\r'? '\n';
MULTILINE_STRING_END: '"""';
;

View File

@@ -58,7 +58,7 @@ public class Preferences {
}
}
static public boolean getBoolean(String attribute) {
String value = get(attribute); //, null);
String value = get(attribute);
return Boolean.parseBoolean(value);
}
static public int getInteger(String attribute /*, int defaultValue*/) {

View File

@@ -20,9 +20,9 @@ flatCube[][] grid;
void setup() {
try {
quicktime.QTSession.open();
}
catch (quicktime.QTException qte) {
// quicktime.QTSession.open();
}
catch (quicktime.QTException qte) {
qte.printStackTrace();
}