@@ -34,12 +34,12 @@ class Parser {
3434 private $ iLength ;
3535 private $ blockRules ;
3636 private $ aSizeUnits ;
37- private $ iLineNum ;
37+ private $ iLineNo ;
3838
39- public function __construct ($ sText , Settings $ oParserSettings = null , $ iLineNum = 0 ) {
39+ public function __construct ($ sText , Settings $ oParserSettings = null , $ iLineNo = 0 ) {
4040 $ this ->sText = $ sText ;
4141 $ this ->iCurrentPosition = 0 ;
42- $ this ->iLineNum = $ iLineNum ;
42+ $ this ->iLineNo = $ iLineNo ;
4343 if ($ oParserSettings === null ) {
4444 $ oParserSettings = Settings::create ();
4545 }
@@ -68,7 +68,7 @@ public function getCharset() {
6868
6969 public function parse () {
7070 $ this ->setCharset ($ this ->oParserSettings ->sDefaultCharset );
71- $ oResult = new Document ($ this ->iLineNum );
71+ $ oResult = new Document ($ this ->iLineNo );
7272 $ this ->parseDocument ($ oResult );
7373 return $ oResult ;
7474 }
@@ -109,10 +109,10 @@ private function parseListItem(CSSList $oList, $bIsRoot = false) {
109109 $ oAtRule = $ this ->parseAtRule ();
110110 if ($ oAtRule instanceof Charset) {
111111 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 );
113113 }
114114 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 );
116116 }
117117 $ this ->setCharset ($ oAtRule ->getCharset ()->getString ());
118118 }
@@ -132,7 +132,7 @@ private function parseListItem(CSSList $oList, $bIsRoot = false) {
132132 private function parseAtRule () {
133133 $ this ->consume ('@ ' );
134134 $ sIdentifier = $ this ->parseIdentifier ();
135- $ iIdentifierLineNum = $ this ->iLineNum ;
135+ $ iIdentifierLineNum = $ this ->iLineNo ;
136136 $ this ->consumeWhiteSpace ();
137137 if ($ sIdentifier === 'import ' ) {
138138 $ oLocation = $ this ->parseURLValue ();
@@ -195,7 +195,7 @@ private function parseAtRule() {
195195 private function parseIdentifier ($ bAllowFunctions = true , $ bIgnoreCase = true ) {
196196 $ sResult = $ this ->parseCharacter (true );
197197 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 );
199199 }
200200 $ sCharacter = null ;
201201 while (($ sCharacter = $ this ->parseCharacter (true )) !== null ) {
@@ -207,7 +207,7 @@ private function parseIdentifier($bAllowFunctions = true, $bIgnoreCase = true) {
207207 if ($ bAllowFunctions && $ this ->comes ('( ' )) {
208208 $ this ->consume ('( ' );
209209 $ aArguments = $ this ->parseValue (array ('= ' , ' ' , ', ' ));
210- $ sResult = new CSSFunction ($ sResult , $ aArguments , ', ' , $ this ->iLineNum );
210+ $ sResult = new CSSFunction ($ sResult , $ aArguments , ', ' , $ this ->iLineNo );
211211 $ this ->consume (') ' );
212212 }
213213 return $ sResult ;
@@ -241,7 +241,7 @@ private function parseStringValue() {
241241 }
242242 $ this ->consume ($ sQuote );
243243 }
244- return new CSSString ($ sResult , $ this ->iLineNum );
244+ return new CSSString ($ sResult , $ this ->iLineNo );
245245 }
246246
247247 private function parseCharacter ($ bIsForIdentifier ) {
@@ -290,7 +290,7 @@ private function parseCharacter($bIsForIdentifier) {
290290 }
291291
292292 private function parseSelector () {
293- $ oResult = new DeclarationBlock ($ this ->iLineNum );
293+ $ oResult = new DeclarationBlock ($ this ->iLineNo );
294294 $ oResult ->setSelector ($ this ->consumeUntil ('{ ' , false , true ));
295295 $ this ->consumeWhiteSpace ();
296296 $ this ->parseRuleSet ($ oResult );
@@ -336,7 +336,7 @@ private function parseRuleSet($oRuleSet) {
336336 }
337337
338338 private function parseRule () {
339- $ oRule = new Rule ($ this ->parseIdentifier (), $ this ->iLineNum );
339+ $ oRule = new Rule ($ this ->parseIdentifier (), $ this ->iLineNo );
340340 $ this ->consumeWhiteSpace ();
341341 $ this ->consume (': ' );
342342 $ oValue = $ this ->parseValue (self ::listDelimiterForRule ($ oRule ->getRule ()));
@@ -390,7 +390,7 @@ private function parseValue($aListDelimiters) {
390390 break ;
391391 }
392392 }
393- $ oList = new RuleValueList ($ sDelimiter , $ this ->iLineNum );
393+ $ oList = new RuleValueList ($ sDelimiter , $ this ->iLineNo );
394394 for ($ i = $ iStartPosition - 1 ; $ i - $ iStartPosition + 1 < $ iLength * 2 ; $ i +=2 ) {
395395 $ oList ->addListComponent ($ aStack [$ i ]);
396396 }
@@ -448,7 +448,7 @@ private function parseNumericValue($bForColor = false) {
448448 }
449449 }
450450 }
451- return new Size (floatval ($ sSize ), $ sUnit , $ bForColor , $ this ->iLineNum );
451+ return new Size (floatval ($ sSize ), $ sUnit , $ bForColor , $ this ->iLineNo );
452452 }
453453
454454 private function parseColorValue () {
@@ -459,7 +459,7 @@ private function parseColorValue() {
459459 if ($ this ->strlen ($ sValue ) === 3 ) {
460460 $ sValue = $ sValue [0 ] . $ sValue [0 ] . $ sValue [1 ] . $ sValue [1 ] . $ sValue [2 ] . $ sValue [2 ];
461461 }
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 ));
463463 } else {
464464 $ sColorMode = $ this ->parseIdentifier (false );
465465 $ this ->consumeWhiteSpace ();
@@ -475,7 +475,7 @@ private function parseColorValue() {
475475 }
476476 $ this ->consume (') ' );
477477 }
478- return new Color ($ aColor , $ this ->iLineNum );
478+ return new Color ($ aColor , $ this ->iLineNo );
479479 }
480480
481481 private function parseURLValue () {
@@ -486,7 +486,7 @@ private function parseURLValue() {
486486 $ this ->consume ('( ' );
487487 }
488488 $ this ->consumeWhiteSpace ();
489- $ oResult = new URL ($ this ->parseStringValue (), $ this ->iLineNum );
489+ $ oResult = new URL ($ this ->parseStringValue (), $ this ->iLineNo );
490490 if ($ bUseUrl ) {
491491 $ this ->consumeWhiteSpace ();
492492 $ this ->consume (') ' );
@@ -522,18 +522,18 @@ private function consume($mValue = 1) {
522522 $ iLineCount = substr_count ($ mValue , "\n" );
523523 $ iLength = $ this ->strlen ($ mValue );
524524 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 );
526526 }
527- $ this ->iLineNum += $ iLineCount ;
527+ $ this ->iLineNo += $ iLineCount ;
528528 $ this ->iCurrentPosition += $ this ->strlen ($ mValue );
529529 return $ mValue ;
530530 } else {
531531 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 );
533533 }
534534 $ sResult = $ this ->substr ($ this ->iCurrentPosition , $ mValue );
535535 $ iLineCount = substr_count ($ sResult , "\n" );
536- $ this ->iLineNum += $ iLineCount ;
536+ $ this ->iLineNo += $ iLineCount ;
537537 $ this ->iCurrentPosition += $ mValue ;
538538 return $ sResult ;
539539 }
@@ -544,7 +544,7 @@ private function consumeExpression($mExpression) {
544544 if (preg_match ($ mExpression , $ this ->inputLeft (), $ aMatches , PREG_OFFSET_CAPTURE ) === 1 ) {
545545 return $ this ->consume ($ aMatches [0 ][0 ]);
546546 }
547- throw new UnexpectedTokenException ($ mExpression , $ this ->peek (5 ), 'expression ' , $ this ->iLineNum );
547+ throw new UnexpectedTokenException ($ mExpression , $ this ->peek (5 ), 'expression ' , $ this ->iLineNo );
548548 }
549549
550550 private function consumeWhiteSpace () {
@@ -602,7 +602,7 @@ private function consumeUntil($aEnd, $bIncludeEnd = false, $consumeEnd = false)
602602 }
603603
604604 $ 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 );
606606 }
607607
608608 private function inputLeft () {
0 commit comments