Skip to content

lookahead (for function parsing) isn't looking far enough #13

@philshafer

Description

@philshafer

The XPath rules for functions require lookahead:

http://www.w3.org/TR/xpath/#exprlex

If the character following an NCName (possibly after intervening ExprWhitespace) is (, then the token must be recognized as a NodeType or a FunctionName.

libslax does not handle the case when the whitespace contains a newline:

Bock [slax/libslax]% build/slaxproc/slaxproc --format > /dev/null
version 1.1;
var $x = concat(a,b);
Bock [slax/libslax]% build/slaxproc/slaxproc --format > /dev/null
version 1.1;
var $x = concat
(a,b);
-:3: unexpected input: '('; expected semi-colon (';')
-: 1 error detected during parsing (0)
slaxproc: cannot parse file: '-'
Bock [slax/libslax]% build/slaxproc/slaxproc --format > /dev/null
version 1.1;
var $x = concat (a,b);
Bock [slax/libslax]%

The first and third case work correctly, but the second, where a newline is present, does not.

Thanks,
Phil

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions