New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Multiline comments error #795

Closed
zerolx opened this Issue Feb 13, 2017 · 6 comments

Comments

Projects
None yet
2 participants
@zerolx

zerolx commented Feb 13, 2017

Hi, recently I wrote some multi line expression in a app that I create and use mathjs, the expressions is similar a this:
That sample here is wrong made, do not generate errors

# comment
# comment
# any expression
1 + 1

That is the right one: (line break detail)

# comment


Then when executed is given the error:

TypeError: Cannot read property 'compile' of undefined

if I put that expressions:

# comment
1 + 1

or that:
1 + 1
or that:
# comment
no error is given, but if i put this:

# comment
# anycomment

the same error appears again, it seems to be a bug in the code so I am reporting

I tested in latest version and happened the same

In console the error appoints to mathjs/lib/expressions/function/eval.js#L44
And is easy to reproduce

Best regards.

@josdejong

This comment has been minimized.

Owner

josdejong commented Feb 13, 2017

Thanks for reporting, how can I reproduce your issue exactly? I tried:

var text = '# comment\n# comment\n# any expression\n1 + 1';

math.eval(text) // works fine, returns a ResultSet [2]
@zerolx

This comment has been minimized.

zerolx commented Feb 14, 2017

I made a fiddle for this
https://jsfiddle.net/galba/x3b063wq/

And sorry, the first sample that I give (and you used) was wrong, that really do not generate error, but the other yes.
Try at the fiddle, I put samples there too

@josdejong

This comment has been minimized.

Owner

josdejong commented Feb 14, 2017

Thanks a lot, I see the problem now, it can be simpified to:

math.eval('\n')  // throws TypeError: Cannot read property 'compile' of undefined

@josdejong josdejong added the bug label Feb 14, 2017

@josdejong

This comment has been minimized.

Owner

josdejong commented Feb 15, 2017

This has been fixed now in the develop branch and will be solved in the first next release.

@zerolx

This comment has been minimized.

zerolx commented Feb 16, 2017

Thanks!

@josdejong josdejong closed this in bd52740 Feb 16, 2017

@josdejong

This comment has been minimized.

Owner

josdejong commented Feb 16, 2017

This has been fixed in v3.9.2

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