-
Notifications
You must be signed in to change notification settings - Fork 90
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
d: support api.parser.extends and api.parser.implements
The D skeleton was not properly supporting them. * data/skeletons/d.m4: Fix it. * tests/d.at: Check it. * tests/local.mk, tests/testsuite.at: Adjust.
- Loading branch information
Showing
4 changed files
with
107 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
# D features tests. -*- Autotest -*- | ||
|
||
# Copyright (C) 2020 Free Software Foundation, Inc. | ||
|
||
# This program is free software: you can redistribute it and/or modify | ||
# it under the terms of the GNU General Public License as published by | ||
# the Free Software Foundation, either version 3 of the License, or | ||
# (at your option) any later version. | ||
# | ||
# This program is distributed in the hope that it will be useful, | ||
# but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
# GNU General Public License for more details. | ||
# | ||
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
AT_BANNER([[D Features.]]) | ||
|
||
# AT_CHECK_D_MINIMAL([DIRECTIVES], [PARSER_ACTION], [POSITION_CLASS], [EXTRA_USER_CODE]) | ||
# ---------------------------------------------------------------------- | ||
# Check that a minimal parser with DIRECTIVES compiles in D. | ||
# Put the D code in YYParser.d. | ||
m4_define([AT_CHECK_D_MINIMAL], | ||
[ | ||
AT_DATA([[YYParser.y]], [ | ||
%language "D" | ||
%token END "end" | ||
[$1] | ||
%% | ||
start: END {$2}; | ||
%% | ||
[$4] | ||
void main() {} | ||
]) | ||
AT_BISON_CHECK([[-Wno-deprecated YYParser.y]]) | ||
AT_CHECK([[grep '[mb]4_' YYParser.y]], [1], [ignore]) | ||
AT_COMPILE_D([[YYParser]]) | ||
]) | ||
|
||
# AT_CHECK_D_GREP([LINE], [COUNT=1]) | ||
# ------------------------------------- | ||
# Check that YYParser.d contains exactly COUNT lines matching ^LINE$ | ||
# with grep. | ||
m4_define([AT_CHECK_D_GREP], | ||
[AT_CHECK([grep -c '^$1$' YYParser.d], [ignore], [m4_default([$2], [1]) | ||
])]) | ||
|
||
## -------------------------------------- ## | ||
## D parser class extends and implements. ## | ||
## -------------------------------------- ## | ||
|
||
AT_SETUP([D parser class extends and implements]) | ||
AT_KEYWORDS([d]) | ||
|
||
AT_CHECK_D_MINIMAL([]) | ||
AT_CHECK_D_GREP([[class YYParser]]) | ||
|
||
AT_CHECK_D_MINIMAL([%define api.parser.extends {BaseClass}], [], [], [class BaseClass {}]) | ||
AT_CHECK_D_GREP([[class YYParser : BaseClass]]) | ||
|
||
AT_CHECK_D_MINIMAL([%define api.parser.extends {Interface}], [], [], [interface Interface {}]) | ||
AT_CHECK_D_GREP([[class YYParser : Interface]]) | ||
|
||
AT_CHECK_D_MINIMAL( | ||
[%define api.parser.extends {BaseClass} | ||
%define api.parser.implements {Interface}], [], [], | ||
[class BaseClass {} | ||
interface Interface {} | ||
]) | ||
AT_CHECK_D_GREP([[class YYParser : BaseClass, Interface]]) | ||
|
||
AT_CHECK_D_MINIMAL( | ||
[%define api.parser.extends {BaseClass} | ||
%define api.parser.implements {Interface1, Interface2}], [], [], | ||
[class BaseClass {} | ||
interface Interface1 {} | ||
interface Interface2 {} | ||
]) | ||
AT_CHECK_D_GREP([[class YYParser : BaseClass, Interface1, Interface2]]) | ||
|
||
AT_CLEANUP |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters