Skip to content

Instantly share code, notes, and snippets.

@wycats
Created April 7, 2012 17:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wycats/2330820 to your computer and use it in GitHub Desktop.
Save wycats/2330820 to your computer and use it in GitHub Desktop.
states.commentEndDash = {
toString: function() { return "commentEndDash"; },
consume: function(lexer) {
lexer.consume(function(next, token, tokens) {
switch (next) {
case "-":
lexer.setState('commentEnd');
break;
case NULL:
lexer.errorState('comment');
token.addChars("-" + REPLACEMENT);
break;
case EOF:
lexer.errorState('data');
lexer.emitCurrentToken();
break;
default:
lexer.setState('comment');
token.addChars("-" + next);
}
});
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment