(stream, state)
| 55 | |
| 56 | // tokenizers |
| 57 | function tokenBase(stream, state) { |
| 58 | // Handle scope changes |
| 59 | var leaving_expr = state.leaving_expr; |
| 60 | if(stream.sol()) { |
| 61 | leaving_expr = false; |
| 62 | } |
| 63 | state.leaving_expr = false; |
| 64 | if(leaving_expr) { |
| 65 | if(stream.match(/^'+/)) { |
| 66 | return 'operator'; |
| 67 | } |
| 68 | |
| 69 | } |
| 70 | |
| 71 | if(stream.match(/^\.{2,3}/)) { |
| 72 | return 'operator'; |
| 73 | } |
| 74 | |
| 75 | if (stream.eatSpace()) { |
| 76 | return null; |
| 77 | } |
| 78 | |
| 79 | var ch = stream.peek(); |
| 80 | // Handle Comments |
| 81 | if (ch === '#') { |
| 82 | stream.skipToEnd(); |
| 83 | return 'comment'; |
| 84 | } |
| 85 | if(ch==='[') { |
| 86 | state.scopes.push("["); |
| 87 | } |
| 88 | |
| 89 | if(ch==='{') { |
| 90 | state.scopes.push("{"); |
| 91 | } |
| 92 | |
| 93 | var scope=cur_scope(state); |
| 94 | |
| 95 | if(scope==='[' && ch===']') { |
| 96 | state.scopes.pop(); |
| 97 | state.leaving_expr=true; |
| 98 | } |
| 99 | |
| 100 | if(scope==='{' && ch==='}') { |
| 101 | state.scopes.pop(); |
| 102 | state.leaving_expr=true; |
| 103 | } |
| 104 | |
| 105 | if(ch===')') { |
| 106 | state.leaving_expr = true; |
| 107 | } |
| 108 | |
| 109 | var match; |
| 110 | if(!in_array(state) && (match=stream.match(openers, false))) { |
| 111 | state.scopes.push(match); |
| 112 | } |
| 113 | |
| 114 | if(!in_array(state) && stream.match(closers, false)) { |
nothing calls this directly
no test coverage detected