1- var DEBUG = false ; // `true` to print debugging info.
2- var TIMER = false ; // `true` to time calls to `parse()` and print the results.
3-
4- import dbg from "../debug.js" ;
1+ import dbg from "../../debug.js" ;
52let debug = dbg ( "parse" ) ;
63
74import { lex } from "../lexer/lexer.ts" ;
8- import { AST , Token } from "../types.ts" ;
5+ import { AST , Token } from "../../ types.ts" ;
96
107var _comments : boolean ; // Whether comments are allowed.
118var _depth : number ; // Current block nesting depth.
@@ -36,14 +33,14 @@ export function parse(css: string | any[], options: any): AST {
3633 var rules = [ ] ;
3734 var token ;
3835
39- TIMER && ( start = Date . now ( ) ) ;
36+ start = Date . now ( ) ;
4037
4138 while ( ( token = next ( ) ) ) {
4239 rule = parseToken ( token ) ;
4340 rule && rules . push ( rule ) ;
4441 }
4542
46- TIMER && debug ( "ran in" , ( Date . now ( ) - start ) + "ms" ) ;
43+ debug ( "ran in" , ( Date . now ( ) - start ) + "ms" ) ;
4744
4845 return {
4946 type : "stylesheet" ,
@@ -95,7 +92,7 @@ function astNode(token: Token, overrd?: any): Token {
9592 } ;
9693 }
9794
98- DEBUG && debug ( "astNode:" , JSON . stringify ( node , null , 2 ) ) ;
95+ debug ( "astNode:" , JSON . stringify ( node , null , 2 ) ) ;
9996
10097 return node ;
10198}
@@ -107,7 +104,7 @@ function astNode(token: Token, overrd?: any): Token {
107104 */
108105function next ( ) {
109106 var token = _tokens . shift ( ) ;
110- DEBUG && debug ( "next:" , JSON . stringify ( token , null , 2 ) ) ;
107+ debug ( "next:" , JSON . stringify ( token , null , 2 ) ) ;
111108 return token ;
112109}
113110
@@ -249,7 +246,7 @@ function parseToken(token: any): any {
249246 return parseAtGroup ( token ) ;
250247 }
251248
252- DEBUG && debug ( "parseToken: unexpected token:" , JSON . stringify ( token ) ) ;
249+ debug ( "parseToken: unexpected token:" , JSON . stringify ( token ) ) ;
253250}
254251
255252// -- Parse Helper Functions ---------------------------------------------------
0 commit comments