Skip to content

XPath parser fails to parse functions that have other functions as the second or higher argument #45

Description

@altin

Functions that have other functions as the second or higher argument cannot be parsed.

Example:

from eulxml import xpath
ast = xpath.parse('foo(a,b,c,d)') # ok
ast = xpath.parse('foo(current(),b,c,d)') # ok
ast = xpath.parse('foo(a,current(),c,d)') # error

Stack trace:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/eulxml/xpath/core.py", line 154, in parse
    return parser.parse(xpath, lexer=lexer)
  File "/eulxml/env/lib/python3.8/site-packages/ply/yacc.py", line 333, in parse
    return self.parseopt_notrack(input, lexer, debug, tracking, tokenfunc)
  File "/eulxml/env/lib/python3.8/site-packages/ply/yacc.py", line 1201, in parseopt_notrack
    tok = call_errorfunc(self.errorfunc, errtoken, self)
  File "/eulxml/env/lib/python3.8/site-packages/ply/yacc.py", line 192, in call_errorfunc
    r = errorfunc(token)
  File "/eulxml/eulxml/xpath/parserules.py", line 375, in p_error
    raise RuntimeError("Syntax error at '%s'" % repr(p))
RuntimeError: Syntax error at 'LexToken(OPEN_PAREN,'(',1,13)'

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions