Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
[S05] Reintroduce the .ast method.
Every good language has a few synonyms anyway :) .
  • Loading branch information
ShimmerFairy committed Mar 12, 2014
1 parent 2be6bfa commit 3795799
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion S05-regex.pod
Expand Up @@ -2981,7 +2981,7 @@ you can override that by calling C<make> inside a regex:
]);

This puts the new abstract node into C<$/.made>. An AST node may be of any
type. Using the make/.made mechanism, it is convenient to build up an
type. Using the C<make>/C<.made> mechanism, it is convenient to build up an
abstract syntax tree of arbitrary node types.

However, the C<make> function is not limited to be used for storing AST
Expand All @@ -3006,6 +3006,10 @@ this, use one of these:

or use C<.made.item> or a C<$> variable on the receiving end.

The C<.ast> method is a synonym C<.made> with no differing behavior. It exists
both for historical reasons and as a way to indicate to those reading your code
a more AST-like use of the C<made>/C<.make> mechanism.

=item *

You may also capture a subset of the match using the C<< <(...)> >> construct:
Expand Down Expand Up @@ -3102,6 +3106,7 @@ The currently defined methods are
$/.orig # the original match string
$/.Str # substr($/.orig, $/.from, $/.chars)
$/.made # the abstract result associated with this node (from make)
$/.ast # same as $/.made
$/.caps # sequential captures
$/.chunks # sequential tokenization
$/.prematch # $/.orig.substr(0, $/.from)
Expand Down

0 comments on commit 3795799

Please sign in to comment.