]> ocean-lang.org Git - ocean/commitdiff
parsergen: move the 'follow' declaration
authorNeilBrown <neil@brown.name>
Fri, 5 Mar 2021 09:18:14 +0000 (20:18 +1100)
committerNeilBrown <neil@brown.name>
Wed, 10 Mar 2021 01:00:31 +0000 (12:00 +1100)
The 'follow' field is currently used before declared, which is poor
form.  Move it.

Also remove a stray '## functions' section that is redundant.

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

index 36c7464d58703859c2b59ab881ab7d595d3a0242..9156c63041121d0ef1f0e34bc7b45932967128b8 100644 (file)
@@ -1072,6 +1072,9 @@ and we find the set of possible "first" symbols after there.  This is
 done using `add_first` above and only needs to be done once as the
 "first" sets are now stable and will not change.
 
 done using `add_first` above and only needs to be done once as the
 "first" sets are now stable and will not change.
 
+###### grammar fields
+       struct symset *follow;
+
 ###### follow code
 
        for (p = 0; p < g->production_count; p++) {
 ###### follow code
 
        for (p = 0; p < g->production_count; p++) {
@@ -1121,9 +1124,6 @@ combine these two functions into a single loop.
 We now just need to create and initialise the `follow` list to get a
 complete function.
 
 We now just need to create and initialise the `follow` list to get a
 complete function.
 
-###### grammar fields
-       struct symset *follow;
-
 ###### functions
        static void build_follow(struct grammar *g)
        {
 ###### functions
        static void build_follow(struct grammar *g)
        {
@@ -2073,8 +2073,6 @@ The go to table is stored in a simple array of `sym` and corresponding
                }
        }
 
                }
        }
 
-###### functions
-
        static void gen_states(FILE *f, struct grammar *g)
        {
                int i;
        static void gen_states(FILE *f, struct grammar *g)
        {
                int i;