1- import { NumberWrapper , StringWrapper , isPresent , resolveEnumToken } from " angular2/src/facade/lang" ;
1+ import { NumberWrapper , StringWrapper , isPresent , resolveEnumToken } from ' angular2/src/facade/lang' ;
22import { BaseException } from 'angular2/src/facade/exceptions' ;
33
4- import {
5- isWhitespace ,
6- $EOF ,
7- $HASH ,
8- $TILDA ,
9- $CARET ,
10- $PERCENT ,
11- $$ ,
12- $_ ,
13- $COLON ,
14- $SQ ,
15- $DQ ,
16- $EQ ,
17- $SLASH ,
18- $BACKSLASH ,
19- $PERIOD ,
20- $STAR ,
21- $PLUS ,
22- $LPAREN ,
23- $RPAREN ,
24- $LBRACE ,
25- $RBRACE ,
26- $LBRACKET ,
27- $RBRACKET ,
28- $PIPE ,
29- $COMMA ,
30- $SEMICOLON ,
31- $MINUS ,
32- $BANG ,
33- $QUESTION ,
34- $AT ,
35- $AMPERSAND ,
36- $GT ,
37- $a ,
38- $A ,
39- $z ,
40- $Z ,
41- $0 ,
42- $9 ,
43- $FF ,
44- $CR ,
45- $LF ,
46- $VTAB
47- } from "angular2/src/compiler/chars" ;
48-
49- export {
50- $EOF ,
51- $AT ,
52- $RBRACE ,
53- $LBRACE ,
54- $LBRACKET ,
55- $RBRACKET ,
56- $LPAREN ,
57- $RPAREN ,
58- $COMMA ,
59- $COLON ,
60- $SEMICOLON ,
61- isWhitespace
62- } from "angular2/src/compiler/chars" ;
4+ import { isWhitespace , $EOF , $HASH , $TILDA , $CARET , $PERCENT , $$ , $_ , $COLON , $SQ , $DQ , $EQ , $SLASH , $BACKSLASH , $PERIOD , $STAR , $PLUS , $LPAREN , $RPAREN , $LBRACE , $RBRACE , $LBRACKET , $RBRACKET , $PIPE , $COMMA , $SEMICOLON , $MINUS , $BANG , $QUESTION , $AT , $AMPERSAND , $GT , $a , $A , $z , $Z , $0 , $9 , $FF , $CR , $LF , $VTAB } from 'angular2/src/compiler/chars' ;
5+
6+ export { $EOF , $AT , $RBRACE , $LBRACE , $LBRACKET , $RBRACKET , $LPAREN , $RPAREN , $COMMA , $COLON , $SEMICOLON , isWhitespace } from 'angular2/src/compiler/chars' ;
637
648export enum CssTokenType {
659 EOF ,
@@ -94,35 +38,37 @@ export class LexedCssResult {
9438 constructor ( public error : CssScannerError , public token : CssToken ) { }
9539}
9640
97- export function generateErrorMessage ( input : string , message : string , errorValue : string ,
98- index : number , row : number , column : number ) : string {
41+ export function generateErrorMessage (
42+ input : string , message : string , errorValue : string , index : number , row : number ,
43+ column : number ) : string {
9944 return `${ message } at column ${ row } :${ column } in expression [` +
100- findProblemCode ( input , errorValue , index , column ) + ']' ;
45+ findProblemCode ( input , errorValue , index , column ) + ']' ;
10146}
10247
103- export function findProblemCode ( input : string , errorValue : string , index : number ,
104- column : number ) : string {
48+ export function findProblemCode (
49+ input : string , errorValue : string , index : number , column : number ) : string {
10550 var endOfProblemLine = index ;
10651 var current = charCode ( input , index ) ;
10752 while ( current > 0 && ! isNewline ( current ) ) {
10853 current = charCode ( input , ++ endOfProblemLine ) ;
10954 }
11055 var choppedString = input . substring ( 0 , endOfProblemLine ) ;
111- var pointerPadding = "" ;
56+ var pointerPadding = '' ;
11257 for ( var i = 0 ; i < column ; i ++ ) {
113- pointerPadding += " " ;
58+ pointerPadding += ' ' ;
11459 }
115- var pointerString = "" ;
60+ var pointerString = '' ;
11661 for ( var i = 0 ; i < errorValue . length ; i ++ ) {
117- pointerString += "^" ;
62+ pointerString += '^' ;
11863 }
119- return choppedString + "\n" + pointerPadding + pointerString + "\n" ;
64+ return choppedString + '\n' + pointerPadding + pointerString + '\n' ;
12065}
12166
12267export class CssToken {
12368 numValue : number ;
124- constructor ( public index : number , public column : number , public line : number ,
125- public type : CssTokenType , public strValue : string ) {
69+ constructor (
70+ public index : number , public column : number , public line : number , public type : CssTokenType ,
71+ public strValue : string ) {
12672 this . numValue = charCode ( strValue , 0 ) ;
12773 }
12874}
@@ -248,7 +194,7 @@ export class CssScanner {
248194
249195 var next = output . token ;
250196 if ( ! isPresent ( next ) ) {
251- next = new CssToken ( 0 , 0 , 0 , CssTokenType . EOF , " end of file" ) ;
197+ next = new CssToken ( 0 , 0 , 0 , CssTokenType . EOF , ' end of file' ) ;
252198 }
253199
254200 var isMatchingType ;
@@ -265,16 +211,17 @@ export class CssScanner {
265211
266212 var error = null ;
267213 if ( ! isMatchingType || ( isPresent ( value ) && value != next . strValue ) ) {
268- var errorMessage = resolveEnumToken ( CssTokenType , next . type ) + " does not match expected " +
269- resolveEnumToken ( CssTokenType , type ) + " value" ;
214+ var errorMessage = resolveEnumToken ( CssTokenType , next . type ) + ' does not match expected ' +
215+ resolveEnumToken ( CssTokenType , type ) + ' value' ;
270216
271217 if ( isPresent ( value ) ) {
272218 errorMessage += ' ("' + next . strValue + '" should match "' + value + '")' ;
273219 }
274220
275221 error = new CssScannerError (
276- next , generateErrorMessage ( this . input , errorMessage , next . strValue , previousIndex ,
277- previousLine , previousColumn ) ) ;
222+ next , generateErrorMessage (
223+ this . input , errorMessage , next . strValue , previousIndex , previousLine ,
224+ previousColumn ) ) ;
278225 }
279226
280227 return new LexedCssResult ( error , next ) ;
@@ -354,8 +301,8 @@ export class CssScanner {
354301 }
355302
356303 scanComment ( ) : CssToken {
357- if ( this . assertCondition ( isCommentStart ( this . peek , this . peekPeek ) ,
358- " Expected comment start value" ) ) {
304+ if ( this . assertCondition (
305+ isCommentStart ( this . peek , this . peekPeek ) , ' Expected comment start value' ) ) {
359306 return null ;
360307 }
361308
@@ -392,8 +339,8 @@ export class CssScanner {
392339 }
393340
394341 scanString ( ) : CssToken {
395- if ( this . assertCondition ( isStringStart ( this . peek , this . peekPeek ) ,
396- " Unexpected non-string starting value" ) ) {
342+ if ( this . assertCondition (
343+ isStringStart ( this . peek , this . peekPeek ) , ' Unexpected non-string starting value' ) ) {
397344 return null ;
398345 }
399346
@@ -412,7 +359,7 @@ export class CssScanner {
412359 this . advance ( ) ;
413360 }
414361
415- if ( this . assertCondition ( this . peek == target , " Unterminated quote" ) ) {
362+ if ( this . assertCondition ( this . peek == target , ' Unterminated quote' ) ) {
416363 return null ;
417364 }
418365 this . advance ( ) ;
@@ -442,8 +389,8 @@ export class CssScanner {
442389 }
443390
444391 scanIdentifier ( ) : CssToken {
445- if ( this . assertCondition ( isIdentifierStart ( this . peek , this . peekPeek ) ,
446- 'Expected identifier starting value' ) ) {
392+ if ( this . assertCondition (
393+ isIdentifierStart ( this . peek , this . peekPeek ) , 'Expected identifier starting value' ) ) {
447394 return null ;
448395 }
449396
@@ -469,8 +416,9 @@ export class CssScanner {
469416 scanCharacter ( ) : CssToken {
470417 var start = this . index ;
471418 var startingColumn = this . column ;
472- if ( this . assertCondition ( isValidCssCharacter ( this . peek , this . _currentMode ) ,
473- charStr ( this . peek ) + ' is not a valid CSS character' ) ) {
419+ if ( this . assertCondition (
420+ isValidCssCharacter ( this . peek , this . _currentMode ) ,
421+ charStr ( this . peek ) + ' is not a valid CSS character' ) ) {
474422 return null ;
475423 }
476424
@@ -557,12 +505,12 @@ function isIdentifierStart(code: number, next: number): boolean {
557505 }
558506
559507 return ( $a <= target && target <= $z ) || ( $A <= target && target <= $Z ) || target == $BACKSLASH ||
560- target == $MINUS || target == $_ ;
508+ target == $MINUS || target == $_ ;
561509}
562510
563511function isIdentifierPart ( target : number ) : boolean {
564512 return ( $a <= target && target <= $z ) || ( $A <= target && target <= $Z ) || target == $BACKSLASH ||
565- target == $MINUS || target == $_ || isDigit ( target ) ;
513+ target == $MINUS || target == $_ || isDigit ( target ) ;
566514}
567515
568516function isValidPseudoSelectorCharacter ( code : number ) : boolean {
0 commit comments