File tree Expand file tree Collapse file tree 3 files changed +15
-12
lines changed
src/processing/mode/java/preproc Expand file tree Collapse file tree 3 files changed +15
-12
lines changed Original file line number Diff line number Diff line change 4
4
* - changes main entry point to reflect sketch types 'static' | 'active'
5
5
* - adds support for type converter functions like "int()"
6
6
* - adds pseudo primitive type "color"
7
- * - adds HTML hex notation with hash symbol: #ff5522
7
+ * - adds HTML hex notation with hash symbol: #ff5522
8
+ * - allow color to appear as part of qualified names (like in imports)
8
9
*/
9
10
10
11
grammar Processing;
@@ -47,8 +48,8 @@ variableDeclaratorId
47
48
// https://github.com/processing/processing/issues/93
48
49
// prevent from types being used as variable names
49
50
warnTypeAsVariableName
50
- : primitiveType (' [' ' ]' )* {
51
- notifyErrorListeners(" Type names are not allowed as variable names: " +$primitiveType.text);
51
+ : primitiveType (' [' ' ]' )* {
52
+ notifyErrorListeners(" Type names are not allowed as variable names: " +$primitiveType.text);
52
53
}
53
54
;
54
55
@@ -89,6 +90,10 @@ colorPrimitiveType
89
90
: ' color'
90
91
;
91
92
93
+ qualifiedName
94
+ : (IDENTIFIER | colorPrimitiveType) (' .' (IDENTIFIER | colorPrimitiveType))*
95
+ ;
96
+
92
97
// added HexColorLiteral
93
98
literal
94
99
: integerLiteral
@@ -127,4 +132,3 @@ LINE_COMMENT
127
132
;
128
133
129
134
CHAR_LITERAL : ' \' ' (~[' \\\r\n ] | EscapeSequence)* ' \' ' ; // A bit nasty but let JDT tackle invalid chars
130
-
Original file line number Diff line number Diff line change @@ -3,6 +3,8 @@ import processing.data.*;
3
3
import processing.event.*;
4
4
import processing.opengl.*;
5
5
6
+ import test.color;
7
+
6
8
import java.util.HashMap;
7
9
import java.util.ArrayList;
8
10
import java.io.File;
@@ -12,19 +14,18 @@ import java.io.InputStream;
12
14
import java.io.OutputStream;
13
15
import java.io.IOException;
14
16
15
- import test.color;
16
-
17
17
public class colorimport extends PApplet {
18
18
19
19
public void setup() {
20
+
21
+
20
22
boolean test = true;
21
- int c1 = color(255, 255, 255);
22
- int c2 = test ? 0xFFA011CD : 0xC0C0C0C0;
23
- noLoop();
23
+
24
+ noLoop();
24
25
}
25
26
26
27
static public void main(String[] passedArgs) {
27
- String[] appletArgs = new String[] { "color " };
28
+ String[] appletArgs = new String[] { "colorimport " };
28
29
if (passedArgs != null) {
29
30
PApplet.main(concat(appletArgs, passedArgs));
30
31
} else {
Original file line number Diff line number Diff line change 1
1
import test.color ;
2
2
3
3
boolean test = true ;
4
- color c1 = color (255 , 255 , 255 );
5
- color c2 = test ? #A011CD : #C0C0C0C0 ;
You can’t perform that action at this time.
0 commit comments