Giter Site home page Giter Site logo

Better error messages about riml HOT 13 OPEN

dsawardekar avatar dsawardekar commented on July 20, 2024
Better error messages

from riml.

Comments (13)

luke-gru avatar luke-gru commented on July 20, 2024

I totally agree with you on every point 👍 I'll create a branch and start working on these issues.

from riml.

dsawardekar avatar dsawardekar commented on July 20, 2024

Hey @luke-gru, I've noticed some improved error reporting in 0.3.6. Can you clarify the format you are using to do this? I have done some initial work in riml.vim on a syntastic plugin, but it's very experimental at the moment. If your error formats are working I can fix up the plugin to better highlight syntax errors.

from riml.

luke-gru avatar luke-gru commented on July 20, 2024

Hey @dsawardekar, sorry for the long delay. Been super busy 😄

I've just pushed a new release, 0.3.8. Since 0.3.7, there has been a new format for error messages. The format is like this https://github.com/luke-gru/riml/blob/master/lib/riml/errors.rb#L11

Riml::ParserError
location: /full/path/to/file.riml:100
message: single or multi-line error message

If the location can't be deteremined, it outputs location: <unknown> on the second line. This should be rare, and I would consider it a bug if you encounter it.

There is a debug flag now for riml, it's --debug or -D. In this case, the full stacktrace is shown.

The error messages are still a work in progress, so I'll keep this ticket open for now.

Thanks again!

from riml.

dsawardekar avatar dsawardekar commented on July 20, 2024

@luke-gru Np, I've been a bit busy and haven't followed up with this. This error format looks good, I'll try to incorporate it into the syntastic plugin.

from riml.

dsawardekar avatar dsawardekar commented on July 20, 2024

Hey Luke,

Happy 2014! I'll be getting back to this in the next few days. Will report back if I find any pesky stacktraces. 😄

from riml.

luke-gru avatar luke-gru commented on July 20, 2024

Hey @dsawardekar, happy new year to you too!

Let me know if you need any help while you're working on this. Also, I just released a new version, 0.3.9 today. The main changes are that the compiles are faster and there's a new feature called 'splat arguments', that works like Ruby's splatting in a function call context, so for instance:

args = ['arg1', 'arg2']
some_func(*args)

is equivalent to:

some_func('arg1', 'arg2')

Thanks!

from riml.

dsawardekar avatar dsawardekar commented on July 20, 2024

@luke-gru I've upgraded most of my stuff to 0.3.9. Every thing looks ok. The syntastic plugin api appears to have changed, riml.vim's syntax checker is currently broken as a result. Need to rethink some of my assumptions.

The splats syntax look handy, but the generated code is a bit involved. Could it be moved to a call call invocation? Something like below,

function! Some_Func(...)
  echomsg string(a:000)
endfunction

let args = ['a', 'b']
call call('Some_Func', args)

from riml.

luke-gru avatar luke-gru commented on July 20, 2024

@dsawardekar I agree the generated code is not ideal, I was wondering what the best way to do it would be. That looks much easier! I'll make the change some time this week for sure.

Thanks!

from riml.

dsawardekar avatar dsawardekar commented on July 20, 2024

@luke-gru I took another look at the Syntax checker. Vim's errorformat needs to match a %f against a filename to work. Currently the compiler errors don't include the filename in the returned error. Can you add a file line to the output?

Riml::ParseError
file: lib/foo.riml
location: <String>:3
message: parse error on value "\n" (NEWLINE)

Currently for the following code,

class Foo
  defm foo(
  end
end

The error output is,

Riml::ParseError
location: <String>:3
message: parse error on value "\n" (NEWLINE)

from riml.

luke-gru avatar luke-gru commented on July 20, 2024

Hi @dsawardekar, sorry for the delay on this issue.

I'll have time from no on to dedicate more time to this project. Are you compiling this from the commandline, or are you using the Ruby API (Riml.compile)?

Thanks,

from riml.

dsawardekar avatar dsawardekar commented on July 20, 2024

Now worries @luke-gru. As much as I like Vim, it doesn't put food on the plate. 😄

I'm using the the command line in this case, so basically a riml -c. Not sure if it makes any difference but the riml executable is called by syntastic.

from riml.

luke-gru avatar luke-gru commented on July 20, 2024

Hey @dsawardekar, I can't reproduce the error for some reason.

I put the code (class Foo ...) in a file called test.riml and ran the command riml -c test.riml, and got this output:

Riml::ParseError
location: test.riml:3
message: parse error on value "\n" (NEWLINE)

I get this for versions 0.3.9 and the newly released 0.4.0 (:tada:). Can you try this again?

Also, in 0.4.0, your suggestion for using call('function_name', args_list) is in the release, so there's no more of that awkward code generation, and it makes the rewriter much easier to understand! 👍 Thanks!

from riml.

dsawardekar avatar dsawardekar commented on July 20, 2024

That's odd I can't reproduce this anymore, I'll investigate further. 0.4.0 looks really good, I have some upgrading to do! 😄

from riml.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.