Closed Jimw338 closed 5 years ago
Hi Jim,
The part of the grammar that defines this behavior is here:
fieldPart
: card field 'id' term
| background? field 'id' term
| card field term
| background? field term
| ordinal card field
| ordinal background? field
| fieldPart of cardPart
;
... specifically, the background? field term
rule. This causes the public Object visitBkgndFieldPart(HyperTalkParser.BkgndFieldPartContext ctx)
method in the HyperTalkTreeVisitor
class to fire, which, in turn, produces a PartNameExp
node in the abstract syntax tree (which specifies a background field, not a card field).
I believe this behavior is consistent with HyperCard. button 1
refers to card button 1, but field 1
refers to background field 1. Go figure.
Unfortunately, I have no recommendations for any Antlr books. What little I know about the tool I learned through experimentation and Googling. :)
I create a field, and then a button with the following mouseUp script:
on mouseDown ask "Enter a number" put it into field 1 --"output" end mouseDown
This complains that there is no background field. If I change it to card field, it works as I expect. Where in the code or grammar determines what the "default" specifier to use is?
What is recommended as a good "first ANTLR book"?