/[bison]/bison/tests/regression.at
ViewVC logotype

Diff of /bison/tests/regression.at

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1.1.2.23 by akim, Sat Dec 22 14:41:15 2001 UTC revision 1.1.2.24 by akim, Sat Dec 22 14:44:25 2001 UTC
# Line 614  AT_TEST_CPP_GUARD_H([9foo]) Line 614  AT_TEST_CPP_GUARD_H([9foo])
614    
615    
616    
617  ## ------- ##  ## -------------- ##
618  ## Web2c.  ##  ## Web2c Report.  ##
619  ## ------- ##  ## -------------- ##
620    
621  # The generation of the reduction was once wrong in Bison, and made it  # The generation of the reduction was once wrong in Bison, and made it
622  # miss some reductions.  In the following test case, the reduction on  # miss some reductions.  In the following test case, the reduction on
623  # `undef_id_tok' in state 1 was missing.  This is stripped down from  # `undef_id_tok' in state 1 was missing.  This is stripped down from
624  # the actual web2c.y.  # the actual web2c.y.
625    
626  AT_SETUP([Web2c])  AT_SETUP([Web2c Report])
627    
628  AT_DATA([input.y],  AT_DATA([input.y],
629  [[%token        undef_id_tok const_id_tok  [[%token        undef_id_tok const_id_tok
# Line 716  state 11 Line 716  state 11
716  ]])  ]])
717    
718  AT_CLEANUP  AT_CLEANUP
719    
720    
721    ## --------------- ##
722    ## Web2c Actions.  ##
723    ## --------------- ##
724    
725    # The generation of the mapping `state -> action' was once wrong in
726    # extremely specific situations.  web2c.y exhibits this situation.
727    # Below is a stripped version of the grammar.  It looks like one can
728    # simplify it further, but just don't: it is tuned to exhibit a bug,
729    # which disapears when applying sane grammar transformations.
730    #
731    # It used to be wrong on yydefact only:
732    #
733    # static const short yydefact[] =
734    #  {
735    # -       2,     0,     1,     0,     0,     2,     3,     2,     5,     4,
736    # +       2,     0,     1,     0,     0,     0,     3,     2,     5,     4,
737    #         0,     0
738    #  };
739    #
740    # but let's check all the tables.
741    
742    
743    AT_SETUP([Web2c Actions])
744    
745    AT_DATA([input.y],
746    [[%%
747    statement:  struct_stat;
748    struct_stat:  /* empty. */ | if else;
749    if: "if" "const" "then" statement;
750    else: "else" statement;
751    %%
752    ]])
753    
754    AT_CHECK([bison -v input.y -o input.c])
755    
756    # Check only the tables.  We don't use --no-parser, because it is
757    # still to be implemented in the experimental branch of Bison.
758    AT_CHECK([[sed -n 's/  *$//;/^static const.*\[\] =/,/^}/p' input.c]], 0,
759    [[static const char yytranslate[] =
760    {
761           0,     2,     2,     2,     2,     2,     2,     2,     2,     2,
762           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
763           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
764           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
765           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
766           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
767           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
768           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
769           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
770           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
771           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
772           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
773           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
774           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
775           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
776           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
777           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
778           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
779           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
780           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
781           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
782           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
783           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
784           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
785           2,     2,     2,     2,     2,     2,     2,     2,     2,     2,
786           2,     2,     2,     2,     2,     2,     1,     3,     4,     5,
787           6
788    };
789    static const short yyprhs[] =
790    {
791           0,     0,     2,     3,     6,    11
792    };
793    static const short yyrhs[] =
794    {
795           8,     0,     0,     9,    10,     0,     3,     4,     5,     7,
796           0,     6,     7,     0
797    };
798    static const short yyrline[] =
799    {
800           0,     2,     3,     3,     4,     5
801    };
802    static const char *const yytname[] =
803    {
804      "$", "error", "$undefined.", "\"if\"", "\"const\"", "\"then\"",
805      "\"else\"", "statement", "struct_stat", "if", "else", NULL
806    };
807    static const short yyr1[] =
808    {
809           0,     7,     8,     8,     9,    10
810    };
811    static const short yyr2[] =
812    {
813           0,     1,     0,     2,     4,     2
814    };
815    static const short yydefact[] =
816    {
817           2,     0,     1,     0,     0,     2,     3,     2,     5,     4,
818           0,     0,     0
819    };
820    static const short yydefgoto[] =
821    {
822           8,     2,     3,     6
823    };
824    static const short yypact[] =
825    {
826          -2,    -1,-32768,    -4,     1,    -2,-32768,    -2,-32768,-32768,
827           4,     5,-32768
828    };
829    static const short yypgoto[] =
830    {
831           0,-32768,-32768,-32768
832    };
833    static const short yytable[] =
834    {
835          10,     1,     5,     4,    11,    12,     7,     9
836    };
837    static const short yycheck[] =
838    {
839           0,     3,     6,     4,     0,     0,     5,     7
840    };
841    ]])
842    
843    AT_CLEANUP

Legend:
Removed from v.1.1.2.23  
changed lines
  Added in v.1.1.2.24

savannah-hackers-public@gnu.org
ViewVC Help
Powered by ViewVC 1.1.26