cviebig / lib-sql-text

Parsing expression grammar for SQL based on Boost Spirit X3

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SQL syntax error in the Readme.md example?

eyalroz opened this issue · comments

In Readme.md, it says:

auto const identifier_def = (
     (lexeme[alpha >> *ialnum] - reserved_word) >> attr(ast::quot::NONE)
  |  lit("\"") >> lexeme[+ialnum] >> lit("\"")  >> attr(ast::quot::DOUBLE)
  /* ... */
);

but between double-quotes, you should be able to use non-alpha-numeric characters, I think. Also, even without double-quotes - I'm pretty sure the SQL standard allows for, say, underscores in identifiers, at least after the first character. Am I wrong?

PS - I've been wanting to write an SQL parser in Spirit X3 ever since I saw the talk about it by that Ciere fellow... this is awesome! If you're interested in expanding this together to support a wider fragment of SQL, write me...

Hey,

it could be indeed that this is more restrictive than actually necessary. I followed the SQLite grammar description but having a quick glance right now could not find their definition of identifiers such as table names or schema names. I'm glad you like it! Indeed I'm very happy to further expand it to improve it's completeness and performance though I cannot give any promises on the amount of contributions I can make.

How would you relax the definition of the identifiers? The German Wikipedia is referencing a draft revision of the standard from 2008 but I'm unable to check it out out right now.