(stream, state)
| 59 | } |
| 60 | // tokenizers |
| 61 | function tokenBase(stream, state) { |
| 62 | if (stream.eatSpace()) { |
| 63 | return null; |
| 64 | } |
| 65 | |
| 66 | var ch = stream.peek(); |
| 67 | |
| 68 | // Handle Comments |
| 69 | if (ch === "'") { |
| 70 | stream.skipToEnd(); |
| 71 | return 'comment'; |
| 72 | } |
| 73 | |
| 74 | |
| 75 | // Handle Number Literals |
| 76 | if (stream.match(/^((&H)|(&O))?[0-9\.a-f]/i, false)) { |
| 77 | var floatLiteral = false; |
| 78 | // Floats |
| 79 | if (stream.match(/^\d*\.\d+F?/i)) { floatLiteral = true; } |
| 80 | else if (stream.match(/^\d+\.\d*F?/)) { floatLiteral = true; } |
| 81 | else if (stream.match(/^\.\d+F?/)) { floatLiteral = true; } |
| 82 | |
| 83 | if (floatLiteral) { |
| 84 | // Float literals may be "imaginary" |
| 85 | stream.eat(/J/i); |
| 86 | return 'number'; |
| 87 | } |
| 88 | // Integers |
| 89 | var intLiteral = false; |
| 90 | // Hex |
| 91 | if (stream.match(/^&H[0-9a-f]+/i)) { intLiteral = true; } |
| 92 | // Octal |
| 93 | else if (stream.match(/^&O[0-7]+/i)) { intLiteral = true; } |
| 94 | // Decimal |
| 95 | else if (stream.match(/^[1-9]\d*F?/)) { |
| 96 | // Decimal literals may be "imaginary" |
| 97 | stream.eat(/J/i); |
| 98 | // TODO - Can you have imaginary longs? |
| 99 | intLiteral = true; |
| 100 | } |
| 101 | // Zero by itself with no other piece of number. |
| 102 | else if (stream.match(/^0(?![\dx])/i)) { intLiteral = true; } |
| 103 | if (intLiteral) { |
| 104 | // Integer literals may be "long" |
| 105 | stream.eat(/L/i); |
| 106 | return 'number'; |
| 107 | } |
| 108 | } |
| 109 | |
| 110 | // Handle Strings |
| 111 | if (stream.match(stringPrefixes)) { |
| 112 | state.tokenize = tokenStringFactory(stream.current()); |
| 113 | return state.tokenize(stream, state); |
| 114 | } |
| 115 | |
| 116 | // Handle operators and Delimiters |
| 117 | if (stream.match(tripleDelimiters) || stream.match(doubleDelimiters)) { |
| 118 | return null; |
nothing calls this directly
no test coverage detected