Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Remove some incorrect statements from the Grammars article
The dynamic variables section stated that grammars behave like classes,
but they don't; they have a completely different metamodel.
  • Loading branch information
Kaiepi committed Jul 1, 2019
1 parent 93dbf02 commit 8a3efde
Showing 1 changed file with 5 additions and 8 deletions.
13 changes: 5 additions & 8 deletions doc/Language/grammars.pod6
Expand Up @@ -382,14 +382,11 @@ say GrammarAdvice.subparse("use regexes for significant whitespace by default")
=head2 Attributes in grammars
Attributes may be defined in grammars. However, they can only be accessed by
methods; in effect, grammars are classes, so these attributes behave in much the
same way as object attributes. Attempting to use them from within a token will
throw an exception because tokens are methods of L<Match|/type/Match>, not of
the grammar itself; C<Match>es, in effect, behave as instances of the class that
is the grammar. Note that mutating an attribute from within a method called in a
token will I<only modify the attribute for that token's own match object>!
Grammar attributes can be accessed in the match returned after parsing if made
public:
methods. Attempting to use them from within a token will throw an exception
because tokens are methods of L<Match|/type/Match>, not of the grammar itself.
Note that mutating an attribute from within a method called in a token will
I<only modify the attribute for that token's own match object>! Grammar
attributes can be accessed in the match returned after parsing if made public:
=begin code
grammar HTTPRequest {
Expand Down

0 comments on commit 8a3efde

Please sign in to comment.