Skip to content

Commit

Permalink
Various minor parser bugs noticed by the Closure compiler.
Browse files Browse the repository at this point in the history
- 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.
  • Loading branch information
artdent authored and marijnh committed May 4, 2011
1 parent 0bfac9a commit 68d004c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion mode/haskell/haskell.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ CodeMirror.defineMode("haskell", function(cmCfg, modeCfg) {
return function(source, setState) {
var currNest = nest;
while (!source.eol()) {
ch = source.next();
var ch = source.next();
if (ch == '{' && source.eat('-')) {
++currNest;
}
Expand Down
2 changes: 1 addition & 1 deletion mode/rst/rst.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ CodeMirror.defineMode('rst', function(config, options) {
ch: orig, // inline() has to know what to search for
wide: wide, // are we looking for `ch` or `chch`
prev: null, // terminator must not be preceeded with whitespace
token: token, // I don't want to recompute this all the time
token: token // I don't want to recompute this all the time
});

return token;
Expand Down
8 changes: 4 additions & 4 deletions mode/stex/stex.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
}

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

function normal(source, state) {
if (source.match(/^\\[a-z]+/)) {
cmdName = source.current();
var cmdName = source.current();
cmdName = cmdName.substr(1, cmdName.length-1);
var plug = plugins[cmdName];
if (typeof(plug) == 'undefined') {
Expand Down Expand Up @@ -133,8 +133,8 @@ CodeMirror.defineMode("stex", function(cmCfg, modeCfg)
function beginParams(source, state) {
var ch = source.peek();
if (ch == '{' || ch == '[') {
lastPlug = peekCommand(state);
style = lastPlug.openBracket(ch);
var lastPlug = peekCommand(state);
var style = lastPlug.openBracket(ch);
source.eat(ch);
setState(state, normal);
return "stex-bracket";
Expand Down

0 comments on commit 68d004c

Please sign in to comment.