3186 |
locations are much more general than semantic values, there is room in |
locations are much more general than semantic values, there is room in |
3187 |
the output parser to redefine the default action to take for each |
the output parser to redefine the default action to take for each |
3188 |
rule. The @code{YYLLOC_DEFAULT} macro is invoked each time a rule is |
rule. The @code{YYLLOC_DEFAULT} macro is invoked each time a rule is |
3189 |
matched, before the associated action is run. |
matched, before the associated action is run. It is also invoked |
3190 |
|
while processing a syntax error, to compute the error's location. |
3191 |
|
|
3192 |
Most of the time, this macro is general enough to suppress location |
Most of the time, this macro is general enough to suppress location |
3193 |
dedicated code from semantic actions. |
dedicated code from semantic actions. |
3194 |
|
|
3195 |
The @code{YYLLOC_DEFAULT} macro takes three parameters. The first one is |
The @code{YYLLOC_DEFAULT} macro takes three parameters. The first one is |
3196 |
the location of the grouping (the result of the computation). The second one |
the location of the grouping (the result of the computation). When a |
3197 |
is an array holding locations of all right hand side elements of the rule |
rule is matched, the second parameter is an array holding locations of |
3198 |
being matched. The last one is the size of the right hand side rule. |
all right hand side elements of the rule being matched, and the third |
3199 |
|
parameter is the size of the rule's right hand side. When processing |
3200 |
|
a syntax error, the second parameter is an array holding locations of |
3201 |
|
the symbols that were discarded during error processing, and the third |
3202 |
|
parameter is the number of discarded symbols. |
3203 |
|
|
3204 |
By default, it is defined this way for simple @acronym{LALR}(1) parsers: |
By default, @code{YYLLOC_DEFAULT} is defined this way for simple |
3205 |
|
@acronym{LALR}(1) parsers: |
3206 |
|
|
3207 |
@example |
@example |
3208 |
@group |
@group |
3497 |
(@pxref{Parser Function, , The Parser Function @code{yyparse}}). |
(@pxref{Parser Function, , The Parser Function @code{yyparse}}). |
3498 |
|
|
3499 |
@strong{Warning:} as of Bison 1.875, this feature is still considered as |
@strong{Warning:} as of Bison 1.875, this feature is still considered as |
3500 |
experimental, as there was not enough users feedback. In particular, |
experimental, as there was not enough user feedback. In particular, |
3501 |
the syntax might still change. |
the syntax might still change. |
3502 |
@end deffn |
@end deffn |
3503 |
|
|