[Prev][Next][Index][Thread]

Re: Comments on parsing steps:




Thanks for your patience in examining this issue.

> Are you saying that '&bold' will always grab the *token* to the right,
> independent of what a parser might normally do?

This would be an easy thing to explain and to learn.

> People may or may not understand about prefix, infix, etc., operators,
> and they certainly won't look up relative precedences in a dictionary unless
> they are really desparate.  Embellishing operators are another detail
> that people probably don't want to know.

I disagree. For a limited set of embellishments, such as for altering
the presentation or adding an accent, it looks like a useful capability.

> If we have prefix embellishing operators such as &bold, I don't think
> people would understand why '&bold + 2' parses to (I claim) '&bold {+ 2}'.
> I'm interested to see your algorithm to make them behave in a more intuitive
> way, but am dubious that it can be done without great complication to the
> parser.

"bind to the next token" works well. {&bold +} acts like `+' so that
adjacent tokens bind as expected. This depends on &bold being restricted
to a single role as a prefix embellishment operator. This requires a
simple check on the patterns [Op1 Op2|T] and [L Op1 Op2|T]

If say it could also act as a normal prefix then the this role would
only apply when the next token to the right is not an operator.
This sounds like it is going to be a little too subtle for most people.

-- Dave Raggett <dsr@w3.org> tel: +1 (617) 258 5741 fax: +1 (617) 258 5999
   World Wide Web Consortium, 545 Technology Square, Cambridge, MA 02139
   url = http://www.w3.org/People/Raggett


References: