@@ -113,7 +113,7 @@ private function parseList(CSSList $oList, $bIsRoot = false) {
113
113
throw new SourceException ("Unexpected end of document " , $ this ->iLineNo );
114
114
}
115
115
}
116
-
116
+
117
117
private function parseListItem (CSSList $ oList , $ bIsRoot = false ) {
118
118
if ($ this ->comes ('@ ' )) {
119
119
$ oAtRule = $ this ->parseAtRule ();
@@ -286,12 +286,14 @@ private function parseCharacter($bIsForIdentifier) {
286
286
}
287
287
if ($ bIsForIdentifier ) {
288
288
$ peek = ord ($ this ->peek ());
289
- // Ranges: a-z A-Z 0-9 - _
290
- if (($ peek >= 97 && $ peek <= 122 ) ||
291
- ($ peek >= 65 && $ peek <= 90 ) ||
292
- ($ peek >= 48 && $ peek <= 57 ) ||
293
- ($ peek === 45 ) ||
294
- ($ peek === 95 ) ||
289
+ if (($ peek >= 97 && $ peek <= 122 ) || // a-z
290
+ ($ peek >= 65 && $ peek <= 90 ) || // A-Z
291
+ ($ peek >= 48 && $ peek <= 57 ) || // 0-9
292
+ ($ peek === 42 ) || // *
293
+ ($ peek === 43 ) || // +
294
+ ($ peek === 45 ) || // -
295
+ ($ peek === 47 ) || // /
296
+ ($ peek === 95 ) || // _
295
297
($ peek > 0xa1 )) {
296
298
return $ this ->consume (1 );
297
299
}
@@ -428,7 +430,7 @@ private static function listDelimiterForRule($sRule) {
428
430
private function parsePrimitiveValue () {
429
431
$ oValue = null ;
430
432
$ this ->consumeWhiteSpace ();
431
- if (is_numeric ($ this ->peek ()) || ($ this ->comes ('-. ' ) && is_numeric ($ this ->peek (1 , 2 ))) || (($ this ->comes ('- ' ) || $ this ->comes ('. ' )) && is_numeric ($ this ->peek (1 , 1 )))) {
433
+ if (is_numeric ($ this ->peek ()) || ($ this ->comes ('-. ' ) && is_numeric ($ this ->peek (1 , 2 ))) || (($ this ->comes ('- ' ) || $ this ->comes ('+ ' ) || $ this -> comes ( ' * ' ) || $ this -> comes ( ' / ' ) || $ this -> comes ( ' . ' )) && is_numeric ($ this ->peek (1 , 1 )))) {
432
434
$ oValue = $ this ->parseNumericValue ();
433
435
} else if ($ this ->comes ('# ' ) || $ this ->comes ('rgb ' , true ) || $ this ->comes ('hsl ' , true )) {
434
436
$ oValue = $ this ->parseColorValue ();
@@ -446,10 +448,14 @@ private function parsePrimitiveValue() {
446
448
}
447
449
448
450
private function parseNumericValue ($ bForColor = false ) {
451
+ $ sOperator = '' ;
449
452
$ sSize = '' ;
450
- if ($ this ->comes ('- ' )) {
451
- $ sSize .= $ this ->consume ('- ' );
452
- }
453
+ $ sOperatorPossibilities = ['+ ' , '- ' , '* ' , '/ ' ];
454
+ foreach ($ sOperatorPossibilities as $ sOperatorPossibility ) {
455
+ if ($ this ->comes ($ sOperatorPossibility )) {
456
+ $ sOperator = $ this ->consume ($ sOperatorPossibility );
457
+ }
458
+ }
453
459
while (is_numeric ($ this ->peek ()) || $ this ->comes ('. ' )) {
454
460
if ($ this ->comes ('. ' )) {
455
461
$ sSize .= $ this ->consume ('. ' );
@@ -468,7 +474,7 @@ private function parseNumericValue($bForColor = false) {
468
474
}
469
475
}
470
476
}
471
- return new Size (floatval ($ sSize ), $ sUnit , $ bForColor , $ this ->iLineNo );
477
+ return new Size ($ sOperator . floatval ($ sSize ), $ sUnit , $ bForColor , $ this ->iLineNo );
472
478
}
473
479
474
480
private function parseColorValue () {
0 commit comments