Home > Back-end >  What does @ symbol mean in a function in yacc
What does @ symbol mean in a function in yacc

Time:12-15

I'm reading the yacc file from postgres's github repo and find this line with a @2. I'm not sure how to understand what this symbol mean.

pl_block        : decl_sect K_BEGIN proc_sect exception_sect K_END opt_label
                    {
                        PLpgSQL_stmt_block *new;

                        new = palloc0(sizeof(PLpgSQL_stmt_block));

                        new->cmd_type   = PLPGSQL_STMT_BLOCK;
                        new->lineno     = plpgsql_location_to_lineno(@2);
                        new->stmtid     =   plpgsql_curr_compile->nstatements;
                        new->label      = $1.label;
                        new->n_initvars = $1.n_initvars;
                        new->initvarnos = $1.initvarnos;
                        new->body       = $3;
                        new->exceptions = $4;

                        check_labels($1.label, $6, @6);
                        plpgsql_ns_pop();

                        $$ = (PLpgSQL_stmt *) new;
                    }
                ;

CodePudding user response:

It's the location structure corresponding to the second symbol in the production (in this case, the K_BEGIN keyword).

  • Related