File tree Expand file tree Collapse file tree 1 file changed +7
-4
lines changed
Expand file tree Collapse file tree 1 file changed +7
-4
lines changed Original file line number Diff line number Diff line change 7777
7878 function asToken ( val ) {
7979 if ( ! val ) return null ;
80+ if ( val . apply ) return val
8081 if ( typeof val == "string" ) return val . replace ( / \. / g, " " ) ;
8182 var result = [ ] ;
8283 for ( var i = 0 ; i < val . length ; i ++ )
133134 state . indent . push ( stream . indentation ( ) + config . indentUnit ) ;
134135 if ( rule . data . dedent )
135136 state . indent . pop ( ) ;
137+ var token = rule . token
138+ if ( token . apply ) token = token ( matches )
136139 if ( matches . length > 2 ) {
137140 state . pending = [ ] ;
138141 for ( var j = 2 ; j < matches . length ; j ++ )
139142 if ( matches [ j ] )
140143 state . pending . push ( { text : matches [ j ] , token : rule . token [ j - 1 ] } ) ;
141144 stream . backUp ( matches [ 0 ] . length - ( matches [ 1 ] ? matches [ 1 ] . length : 0 ) ) ;
142- return rule . token [ 0 ] ;
143- } else if ( rule . token && rule . token . join ) {
144- return rule . token [ 0 ] ;
145+ return token [ 0 ] ;
146+ } else if ( token && token . join ) {
147+ return token [ 0 ] ;
145148 } else {
146- return rule . token ;
149+ return token ;
147150 }
148151 }
149152 }
You can’t perform that action at this time.
0 commit comments