-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathProcessingLexer.g4
More file actions
41 lines (35 loc) · 944 Bytes
/
ProcessingLexer.g4
File metadata and controls
41 lines (35 loc) · 944 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
/*
Derived from Processing preprocessor code by Jakub Valtar and Florian Jenett.
Copyright (c) 2021 Gagik Amaryan
*/
lexer grammar ProcessingLexer;
import JavaLexer;
// // add color literal notations for
// // #ff5522
// HEX_COLOR_LITERAL
// : '#' HEX_COLOR_VALUE
// ;
HEX_COLOR_VALUE: HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT HEX_DIGIT;
HEX_START: '#';
CIRCLE: 'circle';
ELLIPSE: 'ellipse';
RECT: 'rect';
LINE: 'line';
// catch floating point numbers in a parser rule
DECIMAL_LITERAL: ('0' | [1-9] (Digits? | '_'+ Digits)) [lL]?;
SIZE: 'size';
ABS_FUNC: 'abs';
SUBTRACT: '-';
ADD: '+';
SIN: 'sin';
COS: 'cos';
// special variables
FRAMECOUNT: 'frameCount';
// color-related
COLOR: 'color';
FILL: 'fill';
BACKGROUND: 'background';
STROKE: 'stroke';
HEX_DIGIT: [0-9a-fA-F];
// copy from Java.g4 where is is just a fragment
HEX_FLOAT_LITERAL: '0' [xX] (HexDigits '.'? | HexDigits? '.' HexDigits) [pP] [+-]? Digits [fFdD]?;