Python's BNF

MartinRinehart at gmail.com MartinRinehart at gmail.com
Sun Mar 2 10:30:35 EST 2008


Gabriel Genellina wrote:

> About the generated page: I think it would be more useful if each symbol
> links to its definition, instead of showing an alert(). This way it's
> easier to navigate the tree, specially with complex declarations.

That was my first shot. It didn't work. (Every line is its own table
because
you can't put named anchors inside a table, something I really
regret.)
If the production is already viewable, there's no jump when you click
the
link.. If the production is on the last page (many are)
you jump to the last page and then have to hunt down the production.
Remind me to figure out Ajax so you get what we really want: click on
it
and see its definition highlighted.

> You can place the current text into a "title" attribute and most browsers
> will show it as a tooltip.

Great! Consider it done. Konqueror, Firefox, Opera and even MSIE.

How would <dl>, <dt> and <dd> make our lives easier?

I also tried putting the definitions into the status bar. If you ever
feel
tempted to do something similar, let the urge pass. (This now works
in Firefox 2 if you use the correct settings to allow javascript to
write
to the status bar. It doesn't work in Konqueror or Opera and I can't
even find the settings for MSIE.) Trying to get this to work DID get me
to considerably improve the readability of the HTML, so it wasn't a
total waste.

The tooltips are a big step forward. Thanks again.

Improved version at
http://www.MartinRinehart.com/articles/python-parse-bnf.html



More information about the Python-list mailing list