Permalink
Browse files

[pegjs mode] Quotes can appear in character classes

when they do so, they don't indicate the start of a string.
  • Loading branch information...
ForbesLindesay authored and marijnh committed Nov 22, 2013
1 parent 3e84b9e commit 28a638a984c021696d3ae9bbedb4103e0f4db4b1
Showing with 5 additions and 9 deletions.
  1. +5 −9 mode/pegjs/pegjs.js
View
@@ -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;

0 comments on commit 28a638a

Please sign in to comment.