> I tried the following:
> {CREATE|ALTER} USER username
> [ WITH ID/UID/<whatever> number ]
> [ WITH PASSWORD password ]
> [ etc. as usual ]
> which gives shift/reduce conflicts, even if I make PASSWORD and
> ID/whatever a pure keyword (WITH is already one). So that won't work.
Sure it will (well, probably ;)
It depends how you set up the syntax. If you just try to have
something like (pseudocode, I'm rushing to leave for the weekend)
createuser: CREATE USER ColId Qual {};
Qual: WITH ID number {} | WITH PASSWORD password {};
then the single-token lookahead of yacc will get in trouble. But if
you break it up some more then yacc can start maintaining multiple
token pointers to keep going, and the shift/reduce conflicts will go
away. Something like
cu: CREATE USER ColId QualClause {};
QualClause: QualClause WITH QualExpr {}; | QualClause {} | /*EMPTY*/ {};
might do the trick, though I might be omitting one level. Check gram.y
for similar syntax examples such as the column qualifiers for CREATE
TABLE (though those are a bit more involved than this probably needs).
Good luck, and I'll be happy to help in a few days if you want.
- Thomas
--
Thomas Lockhart lockhart@alumni.caltech.edu
South Pasadena, California