Skip to content

Commit 68d004c

Browse files
artdentmarijnh
authored andcommitted
Various minor parser bugs noticed by the Closure compiler.
- Trailing commas in object literals are not allowed by the spec and are handled poorly in some browsers. - Added var to some variable declarations that were not meant to be globals.
1 parent 0bfac9a commit 68d004c

File tree

3 files changed

+6
-6
lines changed

3 files changed

+6
-6
lines changed

mode/haskell/haskell.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -114,7 +114,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
114114
return function(source, setState) {
115115
var currNest = nest;
116116
while (!source.eol()) {
117-
ch = source.next();
117+
var ch = source.next();
118118
if (ch == '{' && source.eat('-')) {
119119
++currNest;
120120
}

mode/rst/rst.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ CodeMirror.defineMode('rst', function(config, options) {
193193
ch: orig, // inline() has to know what to search for
194194
wide: wide, // are we looking for `ch` or `chch`
195195
prev: null, // terminator must not be preceeded with whitespace
196-
token: token, // I don't want to recompute this all the time
196+
token: token // I don't want to recompute this all the time
197197
});
198198

199199
return token;

mode/stex/stex.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
2424
}
2525

2626
function applyMostPowerful(state) {
27-
context = state.cmdState;
27+
var context = state.cmdState;
2828
for (var i = context.length - 1; i >= 0; i--) {
2929
var plug = context[i];
3030
if (plug.name=="DEFAULT")
@@ -83,7 +83,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
8383

8484
function normal(source, state) {
8585
if (source.match(/^\\[a-z]+/)) {
86-
cmdName = source.current();
86+
var cmdName = source.current();
8787
cmdName = cmdName.substr(1, cmdName.length-1);
8888
var plug = plugins[cmdName];
8989
if (typeof(plug) == 'undefined') {
@@ -133,8 +133,8 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
133133
function beginParams(source, state) {
134134
var ch = source.peek();
135135
if (ch == '{' || ch == '[') {
136-
lastPlug = peekCommand(state);
137-
style = lastPlug.openBracket(ch);
136+
var lastPlug = peekCommand(state);
137+
var style = lastPlug.openBracket(ch);
138138
source.eat(ch);
139139
setState(state, normal);
140140
return "stex-bracket";

0 commit comments

Comments
 (0)