Skip to content
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

BUG: pow operator without whitespace errors #25

Open
jonas-eschle opened this issue Jun 20, 2020 · 1 comment
Open

BUG: pow operator without whitespace errors #25

jonas-eschle opened this issue Jun 20, 2020 · 1 comment
Assignees
Labels
bug Something isn't working help wanted Extra attention is needed

Comments

@jonas-eschle
Copy link
Contributor

Hi all, thanks a lot for the great package!

There seems to be a bug with missing whitespaces and the power operator **. It can only be parsed if a whitespace is inserted before.

formulate.from_numexpr('a**2') raises an error
formulate.from_numexpr('a ** 2') works

Other operators work fine without whitespace.

This is the full error:

In [12]: formulate.from_numexpr('a**2')                                         
ERROR:formulate:TODO TRACEBACK: ('a**2', 1, 'Expected end of text')
ERROR:formulate:Error parsing: a**2
ERROR:formulate:                ▲
ERROR:formulate:                ┃
ERROR:formulate:                ┗━━━━━━ Error here or shortly after
---------------------------------------------------------------------------
ParseException                            Traceback (most recent call last)
~/anaconda3/envs/rkq37/lib/python3.7/site-packages/formulate/parser.py in to_expression(self, string)
    232         try:
--> 233             result = self._parser.parseString(string, parseAll=True)
    234             assert len(result) == 1, result

~/anaconda3/envs/rkq37/lib/python3.7/site-packages/pyparsing.py in parseString(self, instring, parseAll)
   1954                     exc.__traceback__ = self._trim_traceback(exc.__traceback__)
-> 1955                 raise exc
   1956         else:

~/anaconda3/envs/rkq37/lib/python3.7/site-packages/pyparsing.py in parseImpl(self, instring, loc, doActions)
   3813         if loc < len(instring):
-> 3814             raise ParseException(instring, loc, self.errmsg, self)
   3815         elif loc == len(instring):

ParseException: Expected end of text, found '*'  (at char 1), (line:1, col:2)

During handling of the above exception, another exception occurred:

ParsingException                          Traceback (most recent call last)
<ipython-input-12-c3a50f695328> in <module>
----> 1 formulate.from_numexpr('a**2')

~/anaconda3/envs/rkq37/lib/python3.7/site-packages/formulate/parser.py in to_expression(self, string)
    244             exception = ParsingException()
    245             exception.__context__ = None
--> 246             raise exception
    247         else:
    248             return result

ParsingException: 

Any ideas?

@eduardo-rodrigues eduardo-rodrigues added bug Something isn't working help wanted Extra attention is needed labels Jan 29, 2021
@eduardo-rodrigues
Copy link
Member

Allow me to ping @chrisburr as this bug is probably an easy fix for an expert.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

3 participants