File tree Expand file tree Collapse file tree 2 files changed +27
-0
lines changed
Expand file tree Collapse file tree 2 files changed +27
-0
lines changed Original file line number Diff line number Diff line change 402402 }
403403 return expression ( stream , state ) ;
404404
405+ case "import" :
406+ if ( stream . eat ( ";" ) ) {
407+ state . soyState . pop ( ) ;
408+ state . indent -= 2 * config . indentUnit ;
409+ return null ;
410+ }
411+ if ( stream . match ( / \w + (? = \s + a s ) / ) ) {
412+ return "variable" ;
413+ }
414+ if ( match = stream . match ( / \w + / ) ) {
415+ return / ( f r o m | a s ) / . test ( match [ 0 ] ) ? "keyword" : "def" ;
416+ }
417+ if ( match = stream . match ( / ^ [ " ' ] / ) ) {
418+ state . soyState . push ( "string" ) ;
419+ state . quoteKind = match [ 0 ] ;
420+ return "string" ;
421+ }
422+ stream . next ( ) ;
423+ return null ;
424+
405425 case "tag" :
406426 var endTag = state . tag [ 0 ] == "/" ;
407427 var tagName = endTag ? state . tag . substring ( 1 ) : state . tag ;
499519 state . indent += 2 * config . indentUnit ;
500520 state . soyState . push ( "tag" ) ;
501521 return "keyword" ;
522+ } else if ( ! state . context && stream . match ( / \b i m p o r t \b / ) ) {
523+ state . soyState . push ( "import" ) ;
524+ state . indent += 2 * config . indentUnit ;
525+ return "keyword" ;
502526 }
503527
504528 return tokenUntil ( stream , state , / \{ | \s + \/ \/ | \/ \* / ) ;
Original file line number Diff line number Diff line change 252252 '[keyword {let] [def $myList]: [[[[[string \'a\'] ] ] [keyword /}] ' +
253253 '[keyword {let] [def $test]: [[[variable $a] [operator +] [atom 1] [keyword for] ' +
254254 '[def $a] [keyword in] [variable-2 $myList] [keyword if] [variable-2 $a] [operator >=] [atom 3] ] [keyword /}]' ) ;
255+
256+ MT ( 'import' ,
257+ '[keyword import] {[def Name], [variable Person] [keyword as] [def P]} [keyword from] [string \'examples/proto/example.proto\'];' ) ;
255258} ) ( ) ;
You can’t perform that action at this time.
0 commit comments