Skip to content

Commit

Permalink
[pegjs mode] Quotes can appear in character classes
Browse files Browse the repository at this point in the history
when they do so, they don't indicate the start of a string.
  • Loading branch information
ForbesLindesay authored and marijnh committed Nov 23, 2013
1 parent 3e84b9e commit 28a638a
Showing 1 changed file with 5 additions and 9 deletions.
14 changes: 5 additions & 9 deletions mode/pegjs/pegjs.js
Expand Up @@ -54,15 +54,11 @@ CodeMirror.defineMode("pegjs", function (config) {
}
return "comment";
} else if (state.inChracterClass) {
if (stream.match(/^[^\]\\]+/)) {
return;
} else if (stream.match(/^\\./)) {
return;
} else {
stream.next();
state.inChracterClass = false;
return 'bracket';
}
while (state.inChracterClass && !stream.eol()) {
if (!(stream.match(/^[^\]\\]+/) || stream.match(/^\\./))) {
state.inChracterClass = false;
}
}
} else if (stream.peek() === '[') {
stream.next();
state.inChracterClass = true;
Expand Down

0 comments on commit 28a638a

Please sign in to comment.