Skip to content

Commit

Permalink
Handle :do in a method call properly
Browse files Browse the repository at this point in the history
Repro code:

after_transition :do => :update_chcecked_at
  • Loading branch information
Evan Phoenix committed May 10, 2010
1 parent 214e23b commit 5b99467
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 1 deletion.
2 changes: 1 addition & 1 deletion kernel/loader.rb
Expand Up @@ -151,7 +151,7 @@ def options(argv=ARGV)
end

options.on "-c", "FILE", "Check the syntax of FILE" do |file|
mel = Rubinius::Melbourne.new file, 0, []
mel = Rubinius::Melbourne.new file, 1, []
begin
mel.parse_file
rescue SyntaxError => e
Expand Down
3 changes: 3 additions & 0 deletions lib/ext/melbourne/grammar.cpp
Expand Up @@ -9908,6 +9908,9 @@ yylex(void *yylval_v, void *vstate)
parse_state->lex_state = kw->state;
if (state == EXPR_FNAME) {
pslval->id = rb_parser_sym(kw->name);
// Hack. Ignore the different variants of do
// if we're just trying to match a FNAME
if(kw->id[0] == kDO) return kDO;
}
if (kw->id[0] == kDO) {
if (COND_P()) return kDO_COND;
Expand Down
3 changes: 3 additions & 0 deletions lib/ext/melbourne/grammar.y
Expand Up @@ -4717,6 +4717,9 @@ yylex(void *yylval_v, void *vstate)
parse_state->lex_state = kw->state;
if (state == EXPR_FNAME) {
pslval->id = rb_parser_sym(kw->name);
// Hack. Ignore the different variants of do
// if we're just trying to match a FNAME
if(kw->id[0] == kDO) return kDO;
}
if (kw->id[0] == kDO) {
if (COND_P()) return kDO_COND;
Expand Down

0 comments on commit 5b99467

Please sign in to comment.