(stream, state)
| 106 | } |
| 107 | |
| 108 | function tokenBaseInner(stream, state) { |
| 109 | if (stream.eatSpace()) return null; |
| 110 | |
| 111 | var ch = stream.peek(); |
| 112 | |
| 113 | // Handle Comments |
| 114 | if (ch == "#") { |
| 115 | stream.skipToEnd(); |
| 116 | return "comment"; |
| 117 | } |
| 118 | |
| 119 | // Handle Number Literals |
| 120 | if (stream.match(/^[0-9\.]/, false)) { |
| 121 | var floatLiteral = false; |
| 122 | // Floats |
| 123 | if (stream.match(/^\d*\.\d+(e[\+\-]?\d+)?/i)) { floatLiteral = true; } |
| 124 | if (stream.match(/^\d+\.\d*/)) { floatLiteral = true; } |
| 125 | if (stream.match(/^\.\d+/)) { floatLiteral = true; } |
| 126 | if (floatLiteral) { |
| 127 | // Float literals may be "imaginary" |
| 128 | stream.eat(/J/i); |
| 129 | return "number"; |
| 130 | } |
| 131 | // Integers |
| 132 | var intLiteral = false; |
| 133 | // Hex |
| 134 | if (stream.match(/^0x[0-9a-f]+/i)) intLiteral = true; |
| 135 | // Binary |
| 136 | if (stream.match(/^0b[01]+/i)) intLiteral = true; |
| 137 | // Octal |
| 138 | if (stream.match(/^0o[0-7]+/i)) intLiteral = true; |
| 139 | // Decimal |
| 140 | if (stream.match(/^[1-9]\d*(e[\+\-]?\d+)?/)) { |
| 141 | // Decimal literals may be "imaginary" |
| 142 | stream.eat(/J/i); |
| 143 | // TODO - Can you have imaginary longs? |
| 144 | intLiteral = true; |
| 145 | } |
| 146 | // Zero by itself with no other piece of number. |
| 147 | if (stream.match(/^0(?![\dx])/i)) intLiteral = true; |
| 148 | if (intLiteral) { |
| 149 | // Integer literals may be "long" |
| 150 | stream.eat(/L/i); |
| 151 | return "number"; |
| 152 | } |
| 153 | } |
| 154 | |
| 155 | // Handle Strings |
| 156 | if (stream.match(stringPrefixes)) { |
| 157 | state.tokenize = tokenStringFactory(stream.current()); |
| 158 | return state.tokenize(stream, state); |
| 159 | } |
| 160 | |
| 161 | // Handle operators and Delimiters |
| 162 | if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) |
| 163 | return null; |
| 164 | |
| 165 | if (stream.match(doubleOperators) |
no test coverage detected
searching dependent graphs…