File tree Expand file tree Collapse file tree 1 file changed +17
-3
lines changed
Expand file tree Collapse file tree 1 file changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -91,9 +91,14 @@ CodeMirror.defineMode("groovy", function(config) {
9191 if ( ! tripleQuoted ) { break ; }
9292 if ( stream . match ( quote + quote ) ) { end = true ; break ; }
9393 }
94- if ( quote == '"' && next == "$" && ! escaped && stream . eat ( "{" ) ) {
95- state . tokenize . push ( tokenBaseUntilBrace ( ) ) ;
96- return "string" ;
94+ if ( quote == '"' && next == "$" && ! escaped ) {
95+ if ( stream . eat ( "{" ) ) {
96+ state . tokenize . push ( tokenBaseUntilBrace ( ) ) ;
97+ return "string" ;
98+ } else if ( stream . match ( / ^ \w / , false ) ) {
99+ state . tokenize . push ( tokenVariableDeref ) ;
100+ return "string" ;
101+ }
97102 }
98103 escaped = ! escaped && next == "\\" ;
99104 }
@@ -122,6 +127,15 @@ CodeMirror.defineMode("groovy", function(config) {
122127 return t ;
123128 }
124129
130+ function tokenVariableDeref ( stream , state ) {
131+ var next = stream . match ( / ^ ( \. | [ \w \$ _ ] + ) / )
132+ if ( ! next ) {
133+ state . tokenize . pop ( )
134+ return state . tokenize [ state . tokenize . length - 1 ] ( stream , state )
135+ }
136+ return next [ 0 ] == "." ? null : "variable"
137+ }
138+
125139 function tokenComment ( stream , state ) {
126140 var maybeEnd = false , ch ;
127141 while ( ch = stream . next ( ) ) {
You can’t perform that action at this time.
0 commit comments