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 { 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' ;
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" ;
763
864export enum CssTokenType {
965 EOF ,
@@ -38,37 +94,35 @@ export class LexedCssResult {
3894 constructor ( public error : CssScannerError , public token : CssToken ) { }
3995}
4096
41- export function generateErrorMessage (
42- input : string , message : string , errorValue : string , index : number , row : number ,
43- column : number ) : string {
97+ export function generateErrorMessage ( input : string , message : string , errorValue : string ,
98+ index : number , row : number , column : number ) : string {
4499 return `${ message } at column ${ row } :${ column } in expression [` +
45- findProblemCode ( input , errorValue , index , column ) + ']' ;
100+ findProblemCode ( input , errorValue , index , column ) + ']' ;
46101}
47102
48- export function findProblemCode (
49- input : string , errorValue : string , index : number , column : number ) : string {
103+ export function findProblemCode ( input : string , errorValue : string , index : number ,
104+ column : number ) : string {
50105 var endOfProblemLine = index ;
51106 var current = charCode ( input , index ) ;
52107 while ( current > 0 && ! isNewline ( current ) ) {
53108 current = charCode ( input , ++ endOfProblemLine ) ;
54109 }
55110 var choppedString = input . substring ( 0 , endOfProblemLine ) ;
56- var pointerPadding = '' ;
111+ var pointerPadding = "" ;
57112 for ( var i = 0 ; i < column ; i ++ ) {
58- pointerPadding += ' ' ;
113+ pointerPadding += " " ;
59114 }
60- var pointerString = '' ;
115+ var pointerString = "" ;
61116 for ( var i = 0 ; i < errorValue . length ; i ++ ) {
62- pointerString += '^' ;
117+ pointerString += "^" ;
63118 }
64- return choppedString + '\n' + pointerPadding + pointerString + '\n' ;
119+ return choppedString + "\n" + pointerPadding + pointerString + "\n" ;
65120}
66121
67122export class CssToken {
68123 numValue : number ;
69- constructor (
70- public index : number , public column : number , public line : number , public type : CssTokenType ,
71- public strValue : string ) {
124+ constructor ( public index : number , public column : number , public line : number ,
125+ public type : CssTokenType , public strValue : string ) {
72126 this . numValue = charCode ( strValue , 0 ) ;
73127 }
74128}
@@ -194,7 +248,7 @@ export class CssScanner {
194248
195249 var next = output . token ;
196250 if ( ! isPresent ( next ) ) {
197- next = new CssToken ( 0 , 0 , 0 , CssTokenType . EOF , ' end of file' ) ;
251+ next = new CssToken ( 0 , 0 , 0 , CssTokenType . EOF , " end of file" ) ;
198252 }
199253
200254 var isMatchingType ;
@@ -211,17 +265,16 @@ export class CssScanner {
211265
212266 var error = null ;
213267 if ( ! isMatchingType || ( isPresent ( value ) && value != next . strValue ) ) {
214- var errorMessage = resolveEnumToken ( CssTokenType , next . type ) + ' does not match expected ' +
215- resolveEnumToken ( CssTokenType , type ) + ' value' ;
268+ var errorMessage = resolveEnumToken ( CssTokenType , next . type ) + " does not match expected " +
269+ resolveEnumToken ( CssTokenType , type ) + " value" ;
216270
217271 if ( isPresent ( value ) ) {
218272 errorMessage += ' ("' + next . strValue + '" should match "' + value + '")' ;
219273 }
220274
221275 error = new CssScannerError (
222- next , generateErrorMessage (
223- this . input , errorMessage , next . strValue , previousIndex , previousLine ,
224- previousColumn ) ) ;
276+ next , generateErrorMessage ( this . input , errorMessage , next . strValue , previousIndex ,
277+ previousLine , previousColumn ) ) ;
225278 }
226279
227280 return new LexedCssResult ( error , next ) ;
@@ -301,8 +354,8 @@ export class CssScanner {
301354 }
302355
303356 scanComment ( ) : CssToken {
304- if ( this . assertCondition (
305- isCommentStart ( this . peek , this . peekPeek ) , ' Expected comment start value' ) ) {
357+ if ( this . assertCondition ( isCommentStart ( this . peek , this . peekPeek ) ,
358+ " Expected comment start value" ) ) {
306359 return null ;
307360 }
308361
@@ -339,8 +392,8 @@ export class CssScanner {
339392 }
340393
341394 scanString ( ) : CssToken {
342- if ( this . assertCondition (
343- isStringStart ( this . peek , this . peekPeek ) , ' Unexpected non-string starting value' ) ) {
395+ if ( this . assertCondition ( isStringStart ( this . peek , this . peekPeek ) ,
396+ " Unexpected non-string starting value" ) ) {
344397 return null ;
345398 }
346399
@@ -359,7 +412,7 @@ export class CssScanner {
359412 this . advance ( ) ;
360413 }
361414
362- if ( this . assertCondition ( this . peek == target , ' Unterminated quote' ) ) {
415+ if ( this . assertCondition ( this . peek == target , " Unterminated quote" ) ) {
363416 return null ;
364417 }
365418 this . advance ( ) ;
@@ -389,8 +442,8 @@ export class CssScanner {
389442 }
390443
391444 scanIdentifier ( ) : CssToken {
392- if ( this . assertCondition (
393- isIdentifierStart ( this . peek , this . peekPeek ) , 'Expected identifier starting value' ) ) {
445+ if ( this . assertCondition ( isIdentifierStart ( this . peek , this . peekPeek ) ,
446+ 'Expected identifier starting value' ) ) {
394447 return null ;
395448 }
396449
@@ -416,9 +469,8 @@ export class CssScanner {
416469 scanCharacter ( ) : CssToken {
417470 var start = this . index ;
418471 var startingColumn = this . column ;
419- if ( this . assertCondition (
420- isValidCssCharacter ( this . peek , this . _currentMode ) ,
421- charStr ( this . peek ) + ' is not a valid CSS character' ) ) {
472+ if ( this . assertCondition ( isValidCssCharacter ( this . peek , this . _currentMode ) ,
473+ charStr ( this . peek ) + ' is not a valid CSS character' ) ) {
422474 return null ;
423475 }
424476
@@ -505,12 +557,12 @@ function isIdentifierStart(code: number, next: number): boolean {
505557 }
506558
507559 return ( $a <= target && target <= $z ) || ( $A <= target && target <= $Z ) || target == $BACKSLASH ||
508- target == $MINUS || target == $_ ;
560+ target == $MINUS || target == $_ ;
509561}
510562
511563function isIdentifierPart ( target : number ) : boolean {
512564 return ( $a <= target && target <= $z ) || ( $A <= target && target <= $Z ) || target == $BACKSLASH ||
513- target == $MINUS || target == $_ || isDigit ( target ) ;
565+ target == $MINUS || target == $_ || isDigit ( target ) ;
514566}
515567
516568function isValidPseudoSelectorCharacter ( code : number ) : boolean {
0 commit comments