parse error on value "." (tDOT) #49

Closed
aguynamedryan opened this Issue Jul 16, 2012 · 9 comments

Projects

None yet

4 participants

@aguynamedryan

According to this article Ruby 1.9.1+ supports method invocation syntax formatted like jQuery when chaining method calls, e.g.

result = foo
          .bar(i)
          .baz

but I get this error when ruby_parser hits some of my code which is formatted in that style:

/Users/ryan/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/racc/parser.rb:351:in `on_error':  (Racc::ParseError)
parse error on value "." (tDOT)
    from (eval):3:in `_racc_do_parse_c'
    from (eval):3:in `do_parse'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/gems/ruby_parser-2.3.1/lib/ruby_parser_extras.rb:750:in `process'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/gems/umlify-1.2.6/lib/umlify/parser_sexp.rb:39:in `parse_file'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/gems/umlify-1.2.6/lib/umlify/parser_sexp.rb:28:in `block in parse_sources!'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/gems/umlify-1.2.6/lib/umlify/parser_sexp.rb:26:in `each'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/gems/umlify-1.2.6/lib/umlify/parser_sexp.rb:26:in `parse_sources!'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/gems/umlify-1.2.6/lib/umlify/runner.rb:30:in `run'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/gems/umlify-1.2.6/lib/umlify.rb:47:in `execute'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/gems/umlify-1.2.6/bin/umlify:5:in `<top (required)>'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/bin/umlify:19:in `load'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/bin/umlify:19:in `<main>'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `eval'
    from /Users/ryan/.rvm/gems/ruby-1.9.3-p194/bin/ruby_noexec_wrapper:14:in `<main>'
@zenspider
Member

UGH. Fuck I hate the 1.9 syntax changes. :((((

@zenspider zenspider was assigned Jul 17, 2012
@brynary
brynary commented Jul 29, 2012

Yeah, this one is a PITA. Ran into it on Code Climate. :-/

@zenspider
Member

Just FYI... this one is a really low priority for me. If you want to take a whack at it, great. Even just contributing a test would be a help... but I'm not really feeling like digging through pretty much everything to make this (shitty) edge case work.

@brynary
brynary commented Aug 16, 2012

I'll see about putting together a failing test. Unfortunately I'm learning that this is actually pretty common in the wild. :-/

@zenspider
Member

On Aug 16, 2012, at 1:53 PM, Bryan Helmkamp notifications@github.com wrote:

I'll see about putting together a failing test. Unfortunately I'm learning that this is actually pretty common in the wild. :-/

:(

fuck me... what's wrong with people?!?

@alexspeller

Rails 3 query syntax, for example:

Class Foobars < ActiveRecord.base

  scope :bars, ->(param) {
    select('bars.name, foo_id, sub_foo_id, title, author, identifier as link, date')
      .joins(:bazes)
      .where("foo_id = :id OR sub_foo_id = :id", id: param)
      .order("dc_date DESC, name ASC")
      .group('author')
  }
end

It's a really useful syntax when working with chainable apis, which seem to be all the rage these days

@brynary
brynary commented Oct 9, 2012

My experience is the same as @alexspeller -- Rails 3 ActiveRecord queries. But doing it like this doesn't work in IRB, and I discourage it. Works with the period on the previous lines. :)

@brynary
brynary commented Oct 18, 2012

Fixed in 758d298?

@zenspider
Member

Oops. Yes. forgot to close.

@zenspider zenspider closed this Oct 18, 2012
@anthonybatchelor-examtime anthonybatchelor-examtime referenced this issue in presidentbeef/brakeman Dec 13, 2012
Closed

parse error on value "." (tDOT) #208

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment