@@ -34,12 +34,12 @@ class Parser {
34
34
private $ iLength ;
35
35
private $ blockRules ;
36
36
private $ aSizeUnits ;
37
- private $ iLineNum ;
37
+ private $ iLineNo ;
38
38
39
- public function __construct ($ sText , Settings $ oParserSettings = null , $ iLineNum = 0 ) {
39
+ public function __construct ($ sText , Settings $ oParserSettings = null , $ iLineNo = 0 ) {
40
40
$ this ->sText = $ sText ;
41
41
$ this ->iCurrentPosition = 0 ;
42
- $ this ->iLineNum = $ iLineNum ;
42
+ $ this ->iLineNo = $ iLineNo ;
43
43
if ($ oParserSettings === null ) {
44
44
$ oParserSettings = Settings::create ();
45
45
}
@@ -68,7 +68,7 @@ public function getCharset() {
68
68
69
69
public function parse () {
70
70
$ this ->setCharset ($ this ->oParserSettings ->sDefaultCharset );
71
- $ oResult = new Document ($ this ->iLineNum );
71
+ $ oResult = new Document ($ this ->iLineNo );
72
72
$ this ->parseDocument ($ oResult );
73
73
return $ oResult ;
74
74
}
@@ -109,10 +109,10 @@ private function parseListItem(CSSList $oList, $bIsRoot = false) {
109
109
$ oAtRule = $ this ->parseAtRule ();
110
110
if ($ oAtRule instanceof Charset) {
111
111
if (!$ bIsRoot ) {
112
- throw new UnexpectedTokenException ('@charset may only occur in root document ' , '' , 'custom ' , $ this ->iLineNum );
112
+ throw new UnexpectedTokenException ('@charset may only occur in root document ' , '' , 'custom ' , $ this ->iLineNo );
113
113
}
114
114
if (count ($ oList ->getContents ()) > 0 ) {
115
- throw new UnexpectedTokenException ('@charset must be the first parseable token in a document ' , '' , 'custom ' , $ this ->iLineNum );
115
+ throw new UnexpectedTokenException ('@charset must be the first parseable token in a document ' , '' , 'custom ' , $ this ->iLineNo );
116
116
}
117
117
$ this ->setCharset ($ oAtRule ->getCharset ()->getString ());
118
118
}
@@ -132,7 +132,7 @@ private function parseListItem(CSSList $oList, $bIsRoot = false) {
132
132
private function parseAtRule () {
133
133
$ this ->consume ('@ ' );
134
134
$ sIdentifier = $ this ->parseIdentifier ();
135
- $ iIdentifierLineNum = $ this ->iLineNum ;
135
+ $ iIdentifierLineNum = $ this ->iLineNo ;
136
136
$ this ->consumeWhiteSpace ();
137
137
if ($ sIdentifier === 'import ' ) {
138
138
$ oLocation = $ this ->parseURLValue ();
@@ -195,7 +195,7 @@ private function parseAtRule() {
195
195
private function parseIdentifier ($ bAllowFunctions = true , $ bIgnoreCase = true ) {
196
196
$ sResult = $ this ->parseCharacter (true );
197
197
if ($ sResult === null ) {
198
- throw new UnexpectedTokenException ($ sResult , $ this ->peek (5 ), 'identifier ' , $ this ->iLineNum );
198
+ throw new UnexpectedTokenException ($ sResult , $ this ->peek (5 ), 'identifier ' , $ this ->iLineNo );
199
199
}
200
200
$ sCharacter = null ;
201
201
while (($ sCharacter = $ this ->parseCharacter (true )) !== null ) {
@@ -207,7 +207,7 @@ private function parseIdentifier($bAllowFunctions = true, $bIgnoreCase = true) {
207
207
if ($ bAllowFunctions && $ this ->comes ('( ' )) {
208
208
$ this ->consume ('( ' );
209
209
$ aArguments = $ this ->parseValue (array ('= ' , ' ' , ', ' ));
210
- $ sResult = new CSSFunction ($ sResult , $ aArguments , ', ' , $ this ->iLineNum );
210
+ $ sResult = new CSSFunction ($ sResult , $ aArguments , ', ' , $ this ->iLineNo );
211
211
$ this ->consume (') ' );
212
212
}
213
213
return $ sResult ;
@@ -241,7 +241,7 @@ private function parseStringValue() {
241
241
}
242
242
$ this ->consume ($ sQuote );
243
243
}
244
- return new CSSString ($ sResult , $ this ->iLineNum );
244
+ return new CSSString ($ sResult , $ this ->iLineNo );
245
245
}
246
246
247
247
private function parseCharacter ($ bIsForIdentifier ) {
@@ -290,7 +290,7 @@ private function parseCharacter($bIsForIdentifier) {
290
290
}
291
291
292
292
private function parseSelector () {
293
- $ oResult = new DeclarationBlock ($ this ->iLineNum );
293
+ $ oResult = new DeclarationBlock ($ this ->iLineNo );
294
294
$ oResult ->setSelector ($ this ->consumeUntil ('{ ' , false , true ));
295
295
$ this ->consumeWhiteSpace ();
296
296
$ this ->parseRuleSet ($ oResult );
@@ -336,7 +336,7 @@ private function parseRuleSet($oRuleSet) {
336
336
}
337
337
338
338
private function parseRule () {
339
- $ oRule = new Rule ($ this ->parseIdentifier (), $ this ->iLineNum );
339
+ $ oRule = new Rule ($ this ->parseIdentifier (), $ this ->iLineNo );
340
340
$ this ->consumeWhiteSpace ();
341
341
$ this ->consume (': ' );
342
342
$ oValue = $ this ->parseValue (self ::listDelimiterForRule ($ oRule ->getRule ()));
@@ -390,7 +390,7 @@ private function parseValue($aListDelimiters) {
390
390
break ;
391
391
}
392
392
}
393
- $ oList = new RuleValueList ($ sDelimiter , $ this ->iLineNum );
393
+ $ oList = new RuleValueList ($ sDelimiter , $ this ->iLineNo );
394
394
for ($ i = $ iStartPosition - 1 ; $ i - $ iStartPosition + 1 < $ iLength * 2 ; $ i +=2 ) {
395
395
$ oList ->addListComponent ($ aStack [$ i ]);
396
396
}
@@ -448,7 +448,7 @@ private function parseNumericValue($bForColor = false) {
448
448
}
449
449
}
450
450
}
451
- return new Size (floatval ($ sSize ), $ sUnit , $ bForColor , $ this ->iLineNum );
451
+ return new Size (floatval ($ sSize ), $ sUnit , $ bForColor , $ this ->iLineNo );
452
452
}
453
453
454
454
private function parseColorValue () {
@@ -459,7 +459,7 @@ private function parseColorValue() {
459
459
if ($ this ->strlen ($ sValue ) === 3 ) {
460
460
$ sValue = $ sValue [0 ] . $ sValue [0 ] . $ sValue [1 ] . $ sValue [1 ] . $ sValue [2 ] . $ sValue [2 ];
461
461
}
462
- $ aColor = array ('r ' => new Size (intval ($ sValue [0 ] . $ sValue [1 ], 16 ), null , true , $ this ->iLineNum ), 'g ' => new Size (intval ($ sValue [2 ] . $ sValue [3 ], 16 ), null , true , $ this ->iLineNum ), 'b ' => new Size (intval ($ sValue [4 ] . $ sValue [5 ], 16 ), null , true , $ this ->iLineNum ));
462
+ $ aColor = array ('r ' => new Size (intval ($ sValue [0 ] . $ sValue [1 ], 16 ), null , true , $ this ->iLineNo ), 'g ' => new Size (intval ($ sValue [2 ] . $ sValue [3 ], 16 ), null , true , $ this ->iLineNo ), 'b ' => new Size (intval ($ sValue [4 ] . $ sValue [5 ], 16 ), null , true , $ this ->iLineNo ));
463
463
} else {
464
464
$ sColorMode = $ this ->parseIdentifier (false );
465
465
$ this ->consumeWhiteSpace ();
@@ -475,7 +475,7 @@ private function parseColorValue() {
475
475
}
476
476
$ this ->consume (') ' );
477
477
}
478
- return new Color ($ aColor , $ this ->iLineNum );
478
+ return new Color ($ aColor , $ this ->iLineNo );
479
479
}
480
480
481
481
private function parseURLValue () {
@@ -486,7 +486,7 @@ private function parseURLValue() {
486
486
$ this ->consume ('( ' );
487
487
}
488
488
$ this ->consumeWhiteSpace ();
489
- $ oResult = new URL ($ this ->parseStringValue (), $ this ->iLineNum );
489
+ $ oResult = new URL ($ this ->parseStringValue (), $ this ->iLineNo );
490
490
if ($ bUseUrl ) {
491
491
$ this ->consumeWhiteSpace ();
492
492
$ this ->consume (') ' );
@@ -522,18 +522,18 @@ private function consume($mValue = 1) {
522
522
$ iLineCount = substr_count ($ mValue , "\n" );
523
523
$ iLength = $ this ->strlen ($ mValue );
524
524
if (!$ this ->streql ($ this ->substr ($ this ->iCurrentPosition , $ iLength ), $ mValue )) {
525
- throw new UnexpectedTokenException ($ mValue , $ this ->peek (max ($ iLength , 5 )), $ this ->iLineNum );
525
+ throw new UnexpectedTokenException ($ mValue , $ this ->peek (max ($ iLength , 5 )), $ this ->iLineNo );
526
526
}
527
- $ this ->iLineNum += $ iLineCount ;
527
+ $ this ->iLineNo += $ iLineCount ;
528
528
$ this ->iCurrentPosition += $ this ->strlen ($ mValue );
529
529
return $ mValue ;
530
530
} else {
531
531
if ($ this ->iCurrentPosition + $ mValue > $ this ->iLength ) {
532
- throw new UnexpectedTokenException ($ mValue , $ this ->peek (5 ), 'count ' , $ this ->iLineNum );
532
+ throw new UnexpectedTokenException ($ mValue , $ this ->peek (5 ), 'count ' , $ this ->iLineNo );
533
533
}
534
534
$ sResult = $ this ->substr ($ this ->iCurrentPosition , $ mValue );
535
535
$ iLineCount = substr_count ($ sResult , "\n" );
536
- $ this ->iLineNum += $ iLineCount ;
536
+ $ this ->iLineNo += $ iLineCount ;
537
537
$ this ->iCurrentPosition += $ mValue ;
538
538
return $ sResult ;
539
539
}
@@ -544,7 +544,7 @@ private function consumeExpression($mExpression) {
544
544
if (preg_match ($ mExpression , $ this ->inputLeft (), $ aMatches , PREG_OFFSET_CAPTURE ) === 1 ) {
545
545
return $ this ->consume ($ aMatches [0 ][0 ]);
546
546
}
547
- throw new UnexpectedTokenException ($ mExpression , $ this ->peek (5 ), 'expression ' , $ this ->iLineNum );
547
+ throw new UnexpectedTokenException ($ mExpression , $ this ->peek (5 ), 'expression ' , $ this ->iLineNo );
548
548
}
549
549
550
550
private function consumeWhiteSpace () {
@@ -602,7 +602,7 @@ private function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false)
602
602
}
603
603
604
604
$ this ->iCurrentPosition = $ start ;
605
- throw new UnexpectedTokenException ('One of (" ' .implode ('"," ' , $ aEnd ).'") ' , $ this ->peek (5 ), 'search ' , $ this ->iLineNum );
605
+ throw new UnexpectedTokenException ('One of (" ' .implode ('"," ' , $ aEnd ).'") ' , $ this ->peek (5 ), 'search ' , $ this ->iLineNo );
606
606
}
607
607
608
608
private function inputLeft () {
0 commit comments