18 |
|
|
19 |
AT_BANNER([[C++ Type Syntax (GLR).]]) |
AT_BANNER([[C++ Type Syntax (GLR).]]) |
20 |
|
|
21 |
# _AT_TEST_GLR_CALC(DECL, RESOLVE1, RESOLVE2) |
# _AT_TEST_GLR_CXXTYPES(DECL, RESOLVE1, RESOLVE2) |
22 |
# ------------------------------------------- |
# ----------------------------------------------- |
23 |
# Store into types.y the calc program, with DECL inserted as a declaration, |
# Store into types.y the calc program, with DECL inserted as a declaration, |
24 |
# and with RESOLVE1 and RESOLVE2 as annotations on the conflicted rule for |
# and with RESOLVE1 and RESOLVE2 as annotations on the conflicted rule for |
25 |
# stmt. Then compile the result. |
# stmt. Then compile the result. |
26 |
m4_define([_AT_TEST_GLR_CALC], |
m4_define([_AT_TEST_GLR_CXXTYPES], |
27 |
[AT_DATA([types.y], |
[AT_DATA_GRAMMAR([types.y], |
28 |
[[/* Simplified C++ Type and Expression Grammar. */ |
[[/* Simplified C++ Type and Expression Grammar. */ |
29 |
|
|
30 |
$1 |
$1 |
253 |
## ---------------------------------------------------- ## |
## ---------------------------------------------------- ## |
254 |
|
|
255 |
AT_SETUP([GLR: Resolve ambiguity, impure, no locations]) |
AT_SETUP([GLR: Resolve ambiguity, impure, no locations]) |
256 |
_AT_TEST_GLR_CALC([],[%dprec 1],[%dprec 2]) |
_AT_TEST_GLR_CXXTYPES([], |
257 |
|
[%dprec 1], [%dprec 2]) |
258 |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
259 |
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) |
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) |
260 |
AT_CLEANUP |
AT_CLEANUP |
261 |
|
|
262 |
AT_SETUP([GLR: Resolve ambiguity, impure, locations]) |
AT_SETUP([GLR: Resolve ambiguity, impure, locations]) |
263 |
_AT_TEST_GLR_CALC([%locations],[%dprec 1],[%dprec 2]) |
_AT_TEST_GLR_CXXTYPES([%locations],[%dprec 1],[%dprec 2]) |
264 |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
265 |
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) |
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) |
266 |
AT_CLEANUP |
AT_CLEANUP |
267 |
|
|
268 |
AT_SETUP([GLR: Resolve ambiguity, pure, no locations]) |
AT_SETUP([GLR: Resolve ambiguity, pure, no locations]) |
269 |
_AT_TEST_GLR_CALC([%pure-parser],[%dprec 1],[%dprec 2]) |
_AT_TEST_GLR_CXXTYPES([%pure-parser], |
270 |
|
[%dprec 1], [%dprec 2]) |
271 |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
272 |
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) |
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) |
273 |
AT_CLEANUP |
AT_CLEANUP |
274 |
|
|
275 |
AT_SETUP([GLR: Resolve ambiguity, pure, locations]) |
AT_SETUP([GLR: Resolve ambiguity, pure, locations]) |
276 |
_AT_TEST_GLR_CALC([%pure-parser |
_AT_TEST_GLR_CXXTYPES([%pure-parser %locations], |
277 |
%locations],[%dprec 1],[%dprec 2]) |
[%dprec 1], [%dprec 2]) |
278 |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
279 |
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) |
_AT_RESOLVED_GLR_OUTPUT, _AT_GLR_STDERR) |
280 |
AT_CLEANUP |
AT_CLEANUP |
281 |
|
|
282 |
AT_SETUP([GLR: Merge conflicting parses, impure, no locations]) |
AT_SETUP([GLR: Merge conflicting parses, impure, no locations]) |
283 |
_AT_TEST_GLR_CALC([],[%merge <stmtMerge>],[%merge <stmtMerge>]) |
_AT_TEST_GLR_CXXTYPES([], |
284 |
|
[%merge <stmtMerge>], [%merge <stmtMerge>]) |
285 |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
286 |
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) |
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) |
287 |
AT_CLEANUP |
AT_CLEANUP |
288 |
|
|
289 |
AT_SETUP([GLR: Merge conflicting parses, impure, locations]) |
AT_SETUP([GLR: Merge conflicting parses, impure, locations]) |
290 |
_AT_TEST_GLR_CALC([%locations],[%merge <stmtMerge>],[%merge <stmtMerge>]) |
_AT_TEST_GLR_CXXTYPES([%locations], |
291 |
|
[%merge <stmtMerge>], [%merge <stmtMerge>]) |
292 |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
293 |
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) |
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) |
294 |
AT_CLEANUP |
AT_CLEANUP |
295 |
|
|
296 |
AT_SETUP([GLR: Merge conflicting parses, pure, no locations]) |
AT_SETUP([GLR: Merge conflicting parses, pure, no locations]) |
297 |
_AT_TEST_GLR_CALC([%pure-parser],[%merge <stmtMerge>],[%merge <stmtMerge>]) |
_AT_TEST_GLR_CXXTYPES([%pure-parser], |
298 |
|
[%merge <stmtMerge>], [%merge <stmtMerge>]) |
299 |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
300 |
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) |
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) |
301 |
AT_CLEANUP |
AT_CLEANUP |
302 |
AT_SETUP([GLR: Merge conflicting parses, pure, locations]) |
AT_SETUP([GLR: Merge conflicting parses, pure, locations]) |
303 |
_AT_TEST_GLR_CALC([%pure-parser |
_AT_TEST_GLR_CXXTYPES([%pure-parser %locations], |
304 |
%locations],[%merge <stmtMerge>],[%merge <stmtMerge>]) |
[%merge <stmtMerge>],[%merge <stmtMerge>]) |
305 |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
306 |
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) |
_AT_AMBIG_GLR_OUTPUT, _AT_GLR_STDERR) |
307 |
AT_CLEANUP |
AT_CLEANUP |
308 |
|
|
309 |
AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations]) |
AT_SETUP([GLR: Verbose messages, resolve ambiguity, impure, no locations]) |
310 |
_AT_TEST_GLR_CALC([%error-verbose], |
_AT_TEST_GLR_CXXTYPES([%error-verbose], |
311 |
[%merge <stmtMerge>],[%merge <stmtMerge>]) |
[%merge <stmtMerge>], [%merge <stmtMerge>]) |
312 |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
AT_PARSER_CHECK([[./types test-input | sed 's/ *$//']], 0, |
313 |
_AT_AMBIG_GLR_OUTPUT, _AT_VERBOSE_GLR_STDERR) |
_AT_AMBIG_GLR_OUTPUT, _AT_VERBOSE_GLR_STDERR) |
314 |
AT_CLEANUP |
AT_CLEANUP |