Skip to content
Snippets Groups Projects
Commit c09b348a authored by Marijn Haverbeke's avatar Marijn Haverbeke
Browse files

Fix assumption that StringStream.peek returns a string

Closes #776
parent a8c7092d
No related branches found
No related tags found
No related merge requests found
......@@ -40,9 +40,9 @@ CodeMirror.defineMode("clojure", function (config, mode) {
var tests = {
digit: /\d/,
digit_or_colon: /[\d:]/,
hex: /[0-9a-fA-F]/,
hex: /[0-9a-f]/i,
sign: /[+-]/,
exponent: /[eE]/,
exponent: /e/i,
keyword_char: /[^\s\(\[\;\)\]]/,
basic: /[\w\$_\-]/,
lang_keyword: /[\w*+!\-_?:\/]/
......@@ -64,8 +64,7 @@ CodeMirror.defineMode("clojure", function (config, mode) {
function isNumber(ch, stream){
// hex
if ( ch === '0' && 'x' == stream.peek().toLowerCase() ) {
stream.eat('x');
if ( ch === '0' && stream.eat(/x/i) ) {
stream.eatWhile(tests.hex);
return true;
}
......@@ -85,8 +84,7 @@ CodeMirror.defineMode("clojure", function (config, mode) {
stream.eatWhile(tests.digit);
}
if ( 'e' == stream.peek().toLowerCase() ) {
stream.eat(tests.exponent);
if ( stream.eat(tests.exponent) ) {
stream.eat(tests.sign);
stream.eatWhile(tests.digit);
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment