[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Subject: Re: [relax-ng] Compact syntax proposal: allow redundant , and & and |
> I should like to propose that we allow redundant commas (or vertical bars > or ampersands) just before a right paren, square bracket, or curly brace. > This would allow: > > foo = ( > attribute foo1 {text}, > attribute foo2 {text}, > attribute foo3 {text), > ) > > bar = element bar { > element bar1 {text}, > element bar2 {text}, > element bar3 {text}, > } So you would make foo = (bar, baz,) legal, but foo = bar, baz, would remain illegal? That doesn't seem a good idea. If you are allowed a trailing comma or vertical bar in some places, then it should be allowed in all places where you can have patterns or name classes separated by comma or vertical bar. Otherwise, it's going to be hard to learn and explain, and the grammar will get very complicated. However, if you allow such trailing commas consistently, then you will need arbitrary lookahead. You don't know till you see the comma after baz whether baz should be parsed as a pattern or the name of a definition, and baz may be preceded by annotations of arbitrary length. Neither of the other possibilities seems desirable to me. Given that the benefits of allowing trailing commas are arguable -- the designers of C++ and Java, for example, chose not to allow them -- I would be inclined not to adopt this proposal. James
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [Elist Home]
Powered by eList eXpress LLC