[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Force bison syntax error on string constant
From: |
Martin Alexander Neumann |
Subject: |
Re: Force bison syntax error on string constant |
Date: |
Fri, 24 Oct 2014 15:16:01 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux i686; rv:31.0) Gecko/20100101 Thunderbird/31.2.0 |
Hi Bob,
use the macro YYERROR;
It's documented here:
https://www.gnu.org/software/bison/manual/html_node/GLR-Semantic-Actions.html#YYERROR
Yours,
Alex
On 10/24/2014 03:10 PM, Bob Rossi wrote:
> Hi,
>
> I have a rule like this,
>
> output: output_variant NEWLINE {
> *gdbmi_output = $1;
> };
>
> output: error NEWLINE {
> yyerrok;
> };
>
> output_variant: OPEN_PAREN variable CLOSED_PAREN {
> $$ = gdbmi_output_alloc();
> $$->kind = GDBMI_OUTPUT_PROMPT;
> free($2);
> }
>
> Where OPEN_PAREN is (, variable is [a-zA-Z]+ and CLOSED_PAREN is ).
> I want ONLY "gdb" to be allowed in this variable context.
>
> Is there a way to force the syntax error in the action in such a way
> that bison then bubbles up the error into the above 'output' error rule?
>
> Thanks,
> Bob Rossi
>
> _______________________________________________
> address@hidden https://lists.gnu.org/mailman/listinfo/help-bison
>