File tree Expand file tree Collapse file tree 1 file changed +8
-7
lines changed
Expand file tree Collapse file tree 1 file changed +8
-7
lines changed Original file line number Diff line number Diff line change @@ -10,23 +10,24 @@ export const toml = {
1010 } ,
1111 token : function ( stream , state ) {
1212 //check for state changes
13- if ( ! state . inString && ( ( stream . peek ( ) == '"' ) || ( stream . peek ( ) == "'" ) ) ) {
14- state . stringType = stream . peek ( ) ;
15- stream . next ( ) ; // Skip quote
13+ let quote
14+ if ( ! state . inString && ( quote = stream . match ( / ^ ( ' ' ' | " " " | ' | " ) / ) ) ) {
15+ state . stringType = quote [ 0 ]
1616 state . inString = true ; // Update state
1717 }
18- if ( stream . sol ( ) && state . inArray === 0 ) {
18+ if ( stream . sol ( ) && ! state . inString && state . inArray === 0 ) {
1919 state . lhs = true ;
2020 }
2121 //return state
2222 if ( state . inString ) {
23- while ( state . inString && ! stream . eol ( ) ) {
24- if ( stream . peek ( ) === state . stringType ) {
25- stream . next ( ) ; // Skip quote
23+ while ( state . inString ) {
24+ if ( stream . match ( state . stringType ) ) {
2625 state . inString = false ; // Clear flag
2726 } else if ( stream . peek ( ) === '\\' ) {
2827 stream . next ( ) ;
2928 stream . next ( ) ;
29+ } else if ( stream . eol ( ) ) {
30+ break
3031 } else {
3132 stream . match ( / ^ .[ ^ \\ \" \' ] * / ) ;
3233 }
You can’t perform that action at this time.
0 commit comments