Hi Eric,
[...]
> Good idea. There certainly are other compatibility functions to add
> too, like `with-syntax-table' (in semantic-lex). XEmacs has an Emacs
> compatibility package which may grow conflicting definitions. It is
> that file which forced the semantic overlay compatibility functions w/
> the new names as they were not as compatible as they needed to be.
>
> As we identify various compatibility issues, we may need to prefix
> them appropriately.
For example, the semantic overlay functions that are not specific
could be moved in the cedet-compat library as cedet-overlay functions
to avoid conflicts with other compatibility libraries. IMO, specific
stuff must remain in packages that use it.
> Please check in your change. Thanks.
Done. I also committed these changes:
1. A minor change in semantic-grammar.el to generate the lisp code
when the grammar buffer is modified (useful when hacking a grammar).
2. Implementation of the new %default-prec feature, introduced in
latest version of Bison. Here is an excerpt of the Bison's manual:
"
exp: ...
| exp '-' exp
...
| '-' exp %prec UMINUS
If you forget to append `%prec UMINUS' to the rule for unary minus,
Bison silently assumes that minus has its usual precedence. This
kind of problem can be tricky to debug, since one typically
discovers the mistake only by testing the code.
The `%default-prec 0' declaration makes it easier to discover this
kind of problem systematically. It causes rules that lack a
`%prec' modifier to have no precedence, even if the last terminal
symbol mentioned in their components has a declared precedence.
If `%default-prec 0' is in effect, you must specify `%prec' for all
rules that participate in precedence conflict resolution. Then you
will see any shift/reduce conflict until you tell Bison how to
resolve it, either by changing your grammar or by adding an
explicit precedence. This will probably add declarations to the
grammar, but it helps to protect against incorrect rule
precedences.
The effect of `%default-prec 0' can be reversed by giving
`%default-prec 1', which is the default."
Probably it is worth adding the above excerpt to the Semantic
manual ;-)
Following is the change log.
David
2003-10-01 David Ponce <david@...>
* semantic/semantic-grammar-wy.el
Re-generate.
* semantic/semantic-grammar.el
(semantic-grammar-create-package): Generate Lisp code if the
grammar in the current buffer is modified.
* semantic/semantic-grammar.wy
Handle new %default-prec declaration introduced in Bison 1.875c,
to enable (the default) or disable default rule precedences.
(DEFAULT-PREC): New token.
(default_prec_decl): New rule.
(decl): Use it.
* semantic/wisent/wisent-comp.el
Handle new default-prec feature introduced in Bison 1.875c,
to enable (the default) or disable default rule precedences.
Add `default-prec' to compile-grammar context.
(wisent-parse-grammar): Handle `default-prec' in associativity
rules.
|