|
17 | 17 | "+" return 'ADD'; |
18 | 18 | "-" return 'SUB'; |
19 | 19 |
|
20 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)em\b return 'EMS'; |
21 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)ex\b return 'EXS'; |
22 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)ch\b return 'CHS'; |
23 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)rem\b return 'REMS'; |
24 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)vw\b return 'VWS'; |
25 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)vh\b return 'VHS'; |
26 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)vmin\b return 'VMINS'; |
27 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)vmax\b return 'VMAXS'; |
28 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)cm\b return 'LENGTH'; |
29 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)mm\b return 'LENGTH'; |
30 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)in\b return 'LENGTH'; |
31 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)pt\b return 'LENGTH'; |
32 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)pc\b return 'LENGTH'; |
33 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)px\b return 'LENGTH'; |
34 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)deg\b return 'ANGLE'; |
35 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)grad\b return 'ANGLE'; |
36 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)rad\b return 'ANGLE'; |
37 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)turn\b return 'ANGLE'; |
38 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)s\b return 'TIME'; |
39 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)ms\b return 'TIME'; |
40 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)Hz\b return 'FREQ'; |
41 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)kHz\b return 'FREQ'; |
42 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)dpi\b return 'RES'; |
43 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)dpcm\b return 'RES'; |
44 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)dppx\b return 'RES'; |
45 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)\% return 'PERCENTAGE'; |
46 | | -([0-9]+("."[0-9]+)?|"."[0-9]+)\b return 'NUMBER'; |
| 20 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)em\b return 'EMS'; |
| 21 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)ex\b return 'EXS'; |
| 22 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)ch\b return 'CHS'; |
| 23 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)rem\b return 'REMS'; |
| 24 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)vw\b return 'VWS'; |
| 25 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)vh\b return 'VHS'; |
| 26 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)vmin\b return 'VMINS'; |
| 27 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)vmax\b return 'VMAXS'; |
| 28 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)cm\b return 'LENGTH'; |
| 29 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)mm\b return 'LENGTH'; |
| 30 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)in\b return 'LENGTH'; |
| 31 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)pt\b return 'LENGTH'; |
| 32 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)pc\b return 'LENGTH'; |
| 33 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)px\b return 'LENGTH'; |
| 34 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)deg\b return 'ANGLE'; |
| 35 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)grad\b return 'ANGLE'; |
| 36 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)rad\b return 'ANGLE'; |
| 37 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)turn\b return 'ANGLE'; |
| 38 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)s\b return 'TIME'; |
| 39 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)ms\b return 'TIME'; |
| 40 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)Hz\b return 'FREQ'; |
| 41 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)kHz\b return 'FREQ'; |
| 42 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)dpi\b return 'RES'; |
| 43 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)dpcm\b return 'RES'; |
| 44 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)dppx\b return 'RES'; |
| 45 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)\% return 'PERCENTAGE'; |
| 46 | +(([0-9]+("."[0-9]+)?|"."[0-9]+)(e(\+|-)[0-9]+)?)\b return 'NUMBER'; |
47 | 47 |
|
48 | 48 | "(" return 'LPAREN'; |
49 | 49 | ")" return 'RPAREN'; |
@@ -82,11 +82,11 @@ expression |
82 | 82 | ; |
83 | 83 |
|
84 | 84 | css_value |
85 | | - : LENGTH { $$ = { type: 'LengthValue', value: parseFloat($1), unit: /[a-z]+/i.exec($1)[0] }; } |
86 | | - | ANGLE { $$ = { type: 'AngleValue', value: parseFloat($1), unit: /[a-z]+/i.exec($1)[0] }; } |
87 | | - | TIME { $$ = { type: 'TimeValue', value: parseFloat($1), unit: /[a-z]+/i.exec($1)[0] }; } |
88 | | - | FREQ { $$ = { type: 'FrequencyValue', value: parseFloat($1), unit: /[a-z]+/i.exec($1)[0] }; } |
89 | | - | RES { $$ = { type: 'ResolutionValue', value: parseFloat($1), unit: /[a-z]+/i.exec($1)[0] }; } |
| 85 | + : LENGTH { $$ = { type: 'LengthValue', value: parseFloat($1), unit: /[a-z]+$/i.exec($1)[0] }; } |
| 86 | + | ANGLE { $$ = { type: 'AngleValue', value: parseFloat($1), unit: /[a-z]+$/i.exec($1)[0] }; } |
| 87 | + | TIME { $$ = { type: 'TimeValue', value: parseFloat($1), unit: /[a-z]+$/i.exec($1)[0] }; } |
| 88 | + | FREQ { $$ = { type: 'FrequencyValue', value: parseFloat($1), unit: /[a-z]+$/i.exec($1)[0] }; } |
| 89 | + | RES { $$ = { type: 'ResolutionValue', value: parseFloat($1), unit: /[a-z]+$/i.exec($1)[0] }; } |
90 | 90 | | EMS { $$ = { type: 'EmValue', value: parseFloat($1), unit: 'em' }; } |
91 | 91 | | EXS { $$ = { type: 'ExValue', value: parseFloat($1), unit: 'ex' }; } |
92 | 92 | | CHS { $$ = { type: 'ChValue', value: parseFloat($1), unit: 'ch' }; } |
|
0 commit comments