gmantele / vollt

Java libraries implementing the IVOA protocol: ADQL, UWS and TAP
http://cdsportal.u-strasbg.fr/taptuto/
29 stars 28 forks source link

FunctionDef.parse rejects underscore in parameter names #141

Closed mbtaylor closed 1 year ago

mbtaylor commented 1 year ago

I think there is a bug in the pattern matching used by the adql.db.FunctionDef.parse method. The following invocation succeeds:

FunctionDef.parse("func(ab INTEGER) -> INTEGER");

but the following one fails:

FunctionDef.parse("func(a_b INTEGER) -> INTEGER");

with a ParserException having a message:

Wrong function definition syntax! Expected syntax: "(?) ?", where ="[a-zA-Z]+[a-zA-Z0-9_]", =" -> ", ="( (, ))", should be one of the types described in the UPLOAD section of the TAP documentation. Examples of good syntax: "foo()", "foo() -> VARCHAR", "foo(param INTEGER)"

Since a_b matches the <regular_identifier> regex, it ought to succeed. The behaviour is the same on branches master and adql2.1.

gmantele commented 1 year ago

Indeed, just looking at the message:

="[a-zA-Z]+[a-zA-Z0-9_]",

There is an error in the regular expression: the + is at the wrong place. It should be [a-zA-Z][a-zA-Z0-9_]+.

gmantele commented 1 year ago

This should now be fixed in branch adql2.1.

The problem did not come from what I said, but I fixed anyway this error message. The character _ was merely not accepted.

mbtaylor commented 1 year ago

Thank you, fix confirmed.