]> ocean-lang.org Git - ocean/commitdiff
parsergen: update description of $<N
authorNeilBrown <neil@brown.name>
Sun, 11 Oct 2020 01:18:57 +0000 (12:18 +1100)
committerNeilBrown <neil@brown.name>
Sun, 11 Oct 2020 03:45:48 +0000 (14:45 +1100)
This applies to structures as well as pointers.

Signed-off-by: NeilBrown <neil@brown.name>
csrc/parsergen.mdc

index 66a41b5f5a297abd1a90510c23d1d40e5e89e676..52c0c637c3154ef085d4a948d5604da93827e6a9 100644 (file)
@@ -408,14 +408,14 @@ be in one `code_node` of the literate code.  The `}$` must be
 at the end of a line.
 
 Text in the code fragment will undergo substitutions where `$N` or
 at the end of a line.
 
 Text in the code fragment will undergo substitutions where `$N` or
-`$<N`,for some numeric `N`, will be replaced with a variable holding
-the parse information for the particular symbol in the production.
-`$0` is the head of the production, `$1` is the first symbol of the
-body, etc.  The type of `$N` for a terminal symbol is `struct token`.
-For a non-terminal, it is whatever has been declared for that symbol.
-The `<` may be included for symbols declared as storing a reference
-(not a structure) and means that the reference is being moved out, so
-it will not automatically be freed.
+`$<N`,for some numeric `N`, will be replaced with a variable holding the
+parse information for the particular symbol in the production.  `$0` is
+the head of the production, `$1` is the first symbol of the body, etc.
+The type of `$N` for a terminal symbol is `struct token`.  For a
+non-terminal, it is whatever has been declared for that symbol.  The `<`
+may be included and means that the value (usually a reference) is being
+moved out, so it will not automatically be freed.  The effect of using
+'<' is that the variable is cleareed to all-zeros.
 
 Symbols that are left-recursive are a little special.  These are symbols
 that both the head of a production and the first body symbol of the same
 
 Symbols that are left-recursive are a little special.  These are symbols
 that both the head of a production and the first body symbol of the same
@@ -2169,10 +2169,12 @@ structure returned by a previous reduction.  These pointers need to be cast
 to the appropriate type for each access.  All this is handled in
 `gen_code`.
 
 to the appropriate type for each access.  All this is handled in
 `gen_code`.
 
-`gen_code` also allows symbol references to contain a '`<`' as in '`$<2`'.
-This applied only to symbols with references (or pointers), not those with structures.
-The `<` implies that the reference it being moved out, so the object will not be
-automatically freed.  This is equivalent to assigning `NULL` to the pointer.
+`gen_code` also allows symbol references to contain a '`<`' as in
+'`$<2`'.  This is particularly useful for references (or pointers), but
+can be used with structures too.  The `<` implies that the value it
+being moved out, so the object will not be automatically freed.  It is
+equivalent to assigning `NULL` to the pointer or filling a structure
+with zeros.
 
 ###### functions
 
 
 ###### functions