@@ -2146,10 +2146,7 @@ LexicalUnit hslColor(LexicalUnit prev) :
2146
2146
(op = unaryOperator() )?
2147
2147
(
2148
2148
next = number(next, op)
2149
- | t = <ANGLE_DEG> { next = LexicalUnitImpl.createDegree(next, doubleValue(op, t.image)); }
2150
- | t = <ANGLE_RAD> { next = LexicalUnitImpl.createRadian(next, doubleValue(op, t.image)); }
2151
- | t = <ANGLE_GRAD> { next = LexicalUnitImpl.createGradian(next, doubleValue(op, t.image)); }
2152
- | t = <ANGLE_TURN> { next = LexicalUnitImpl.createTurn(next, doubleValue(op, t.image)); }
2149
+ | next = angle(next, op)
2153
2150
2154
2151
| t = ident() { next = LexicalUnitImpl.createIdent(next, unescape(t.image, false)); }
2155
2152
| next = calc(next)
@@ -2215,10 +2212,7 @@ LexicalUnit hslColor(LexicalUnit prev) :
2215
2212
(
2216
2213
<NONE> { param = LexicalUnitImpl.createNone(null); }
2217
2214
| param = number(null, op)
2218
- | t = <ANGLE_DEG> { param = LexicalUnitImpl.createDegree(null, doubleValue(op, t.image)); }
2219
- | t = <ANGLE_RAD> { param = LexicalUnitImpl.createRadian(null, doubleValue(op, t.image)); }
2220
- | t = <ANGLE_GRAD> { param = LexicalUnitImpl.createGradian(null, doubleValue(op, t.image)); }
2221
- | t = <ANGLE_TURN> { param = LexicalUnitImpl.createTurn(null, doubleValue(op, t.image)); }
2215
+ | param = angle(null, op)
2222
2216
2223
2217
| param = calc(null)
2224
2218
| param = var(null)
@@ -2328,10 +2322,7 @@ LexicalUnit hwbColor(LexicalUnit prev) :
2328
2322
(op = unaryOperator() )?
2329
2323
(
2330
2324
next = number(next, op)
2331
- | t = <ANGLE_DEG> { next = LexicalUnitImpl.createDegree(next, doubleValue(op, t.image)); }
2332
- | t = <ANGLE_RAD> { next = LexicalUnitImpl.createRadian(next, doubleValue(op, t.image)); }
2333
- | t = <ANGLE_GRAD> { next = LexicalUnitImpl.createGradian(next, doubleValue(op, t.image)); }
2334
- | t = <ANGLE_TURN> { next = LexicalUnitImpl.createTurn(next, doubleValue(op, t.image)); }
2325
+ | next = angle(next, op)
2335
2326
2336
2327
| t = ident() { next = LexicalUnitImpl.createIdent(next, unescape(t.image, false)); }
2337
2328
| next = calc(next)
@@ -2396,10 +2387,7 @@ LexicalUnit hwbColor(LexicalUnit prev) :
2396
2387
(
2397
2388
<NONE> { param = LexicalUnitImpl.createNone(null); }
2398
2389
| param = number(null, op)
2399
- | t = <ANGLE_DEG> { param = LexicalUnitImpl.createDegree(null, doubleValue(op, t.image)); }
2400
- | t = <ANGLE_RAD> { param = LexicalUnitImpl.createRadian(null, doubleValue(op, t.image)); }
2401
- | t = <ANGLE_GRAD> { param = LexicalUnitImpl.createGradian(null, doubleValue(op, t.image)); }
2402
- | t = <ANGLE_TURN> { param = LexicalUnitImpl.createTurn(null, doubleValue(op, t.image)); }
2390
+ | param = angle(null, op)
2403
2391
2404
2392
| param = calc(null)
2405
2393
| param = var(null)
@@ -2698,10 +2686,7 @@ LexicalUnit lchColor(LexicalUnit prev) :
2698
2686
(
2699
2687
(op = unaryOperator() )?
2700
2688
(
2701
- t = <ANGLE_DEG> { next = LexicalUnitImpl.createDegree(next, doubleValue(op, t.image)); }
2702
- | t = <ANGLE_RAD> { next = LexicalUnitImpl.createRadian(next, doubleValue(op, t.image)); }
2703
- | t = <ANGLE_GRAD> { next = LexicalUnitImpl.createGradian(next, doubleValue(op, t.image)); }
2704
- | t = <ANGLE_TURN> { next = LexicalUnitImpl.createTurn(next, doubleValue(op, t.image)); }
2689
+ next = angle(next, op)
2705
2690
2706
2691
| t = ident() { next = LexicalUnitImpl.createIdent(next, unescape(t.image, false)); }
2707
2692
| next = calc(next)
@@ -2767,10 +2752,7 @@ LexicalUnit lchColor(LexicalUnit prev) :
2767
2752
(op = unaryOperator() )?
2768
2753
(
2769
2754
<NONE> { next = LexicalUnitImpl.createNone(next); }
2770
- | t = <ANGLE_DEG> { next = LexicalUnitImpl.createDegree(next, doubleValue(op, t.image)); }
2771
- | t = <ANGLE_RAD> { next = LexicalUnitImpl.createRadian(next, doubleValue(op, t.image)); }
2772
- | t = <ANGLE_GRAD> { next = LexicalUnitImpl.createGradian(next, doubleValue(op, t.image)); }
2773
- | t = <ANGLE_TURN> { next = LexicalUnitImpl.createTurn(next, doubleValue(op, t.image)); }
2755
+ | next = angle(next, op)
2774
2756
2775
2757
| next = calc(next)
2776
2758
| next = var(next)
@@ -2981,6 +2963,32 @@ LexicalUnit dimension(LexicalUnit prev, char op) :
2981
2963
}
2982
2964
}
2983
2965
2966
+
2967
+ //
2968
+ // angle()
2969
+ //
2970
+ LexicalUnit angle(LexicalUnit prev, char op) :
2971
+ {
2972
+ Token t;
2973
+ LexicalUnit value = null;
2974
+ }
2975
+ {
2976
+ (
2977
+ t = <ANGLE_DEG> { value = LexicalUnitImpl.createDegree(prev, doubleValue(op, t.image)); }
2978
+ | t = <ANGLE_RAD> { value = LexicalUnitImpl.createRadian(prev, doubleValue(op, t.image)); }
2979
+ | t = <ANGLE_GRAD> { value = LexicalUnitImpl.createGradian(prev, doubleValue(op, t.image)); }
2980
+ | t = <ANGLE_TURN> { value = LexicalUnitImpl.createTurn(prev, doubleValue(op, t.image)); }
2981
+ )
2982
+ {
2983
+ if (value != null)
2984
+ {
2985
+ value.setLocator(createLocator(token));
2986
+ }
2987
+ return value;
2988
+ }
2989
+ }
2990
+
2991
+
2984
2992
//
2985
2993
// unicodeRange
2986
2994
//
0 commit comments