c++.at (bison-3.8.1.tar.xz) | : | c++.at (bison-3.8.2.tar.xz) | ||
---|---|---|---|---|
skipping to change at line 962 | skipping to change at line 962 | |||
AT_BISON_OPTION_PUSHDEFS([$1 %debug]) | AT_BISON_OPTION_PUSHDEFS([$1 %debug]) | |||
AT_DATA_GRAMMAR([[input.yy]], | AT_DATA_GRAMMAR([[input.yy]], | |||
[[$1 | [[$1 | |||
%header | %header | |||
%code | %code | |||
{ | { | |||
#include <cstdlib> | #include <cstdlib> | |||
int yylex (yy::parser::semantic_type *); | int yylex (yy::parser::value_type *); | |||
} | } | |||
%define parse.error verbose | %define parse.error verbose | |||
%define parse.trace | %define parse.trace | |||
%% | %% | |||
start: with-recovery | '!' without-recovery; | start: with-recovery | '!' without-recovery; | |||
with-recovery: | with-recovery: | |||
%empty | %empty | |||
skipping to change at line 1006 | skipping to change at line 1006 | |||
]AT_MAIN_DEFINE[ | ]AT_MAIN_DEFINE[ | |||
]]) | ]]) | |||
# Another file to check syntax_error's linkage. | # Another file to check syntax_error's linkage. | |||
AT_DATA_SOURCE([scan.cc], | AT_DATA_SOURCE([scan.cc], | |||
[[#include <cstdio> // getchar | [[#include <cstdio> // getchar | |||
#include "input.hh" | #include "input.hh" | |||
// 'a': valid item, 's': syntax error, 'l': lexical error. | // 'a': valid item, 's': syntax error, 'l': lexical error. | |||
int | int | |||
yylex (yy::parser::semantic_type *lval) | yylex (yy::parser::value_type *lval) | |||
{ | { | |||
switch (int res = getchar ()) | switch (int res = getchar ()) | |||
{ | { | |||
// Don't choke on echo's \n. | // Don't choke on echo's \n. | |||
case '\n': | case '\n': | |||
return yylex (lval); | return yylex (lval); | |||
case 'l': | case 'l': | |||
throw yy::parser::syntax_error ("invalid character"); | throw yy::parser::syntax_error ("invalid character"); | |||
default: | default: | |||
return res; | return res; | |||
} | } | |||
} | } | |||
]]) | ]]) | |||
AT_BISON_CHECK([[-o input.cc input.yy]]) | AT_BISON_CHECK([[-o input.cc input.yy]]) | |||
AT_FOR_EACH_CXX([ | AT_FOR_EACH_CXX([ | |||
AT_GLR2_CC_IF([AT_REQUIRE_CXX_STD(11, [echo "$at_std not supported"; continue] )]) | ||||
AT_LANG_COMPILE([[input]], [[input.cc scan.cc]]) | AT_LANG_COMPILE([[input]], [[input.cc scan.cc]]) | |||
# Leave enough valid tokens to make sure we recovered from the | # Leave enough valid tokens to make sure we recovered from the | |||
# previous error, otherwise we might hide some error messages | # previous error, otherwise we might hide some error messages | |||
# (discarded during error recoevery). | # (discarded during error recoevery). | |||
echo "asaaalaa" >in | echo "asaaalaa" >in | |||
AT_PARSER_CHECK([[input < in]], [[0]], [[]], | AT_PARSER_CHECK([[input < in]], [[0]], [[]], | |||
[[error: invalid expression | [[error: invalid expression | |||
caught error | caught error | |||
error: invalid character | error: invalid character | |||
End of changes. 3 change blocks. | ||||
2 lines changed or deleted | 3 lines changed or added |