Commit Graph

21 Commits

Author SHA1 Message Date
Akim Demaille
6d86d26b33 tests: factor iterating over skeletons
* tests/local.at (AT_FOR_EACH_SKEL): New.
Use where appropriate.
* data/skeletons/lalr1.d: Reject -d.
* tests/input.at, tests/scanner.at: Also check D.
2021-08-07 12:53:19 +02:00
Adela Vais
689b184983 d: tests: various style fixes
* tests/calc.at, tests/scanner.at: Here.
(yylex): Report values directly, without storing them to the union
first.
2021-01-30 08:49:22 +01:00
Paul Eggert
b4582f1918 Update URLs to prefer https: to http:
Also, fix a few http: URLs that were no longer working.
2021-01-29 13:48:43 -08:00
Akim Demaille
d7e8aaa271 package: bump copyrights to 2021
Run 'make update-copyright'.
2021-01-16 16:11:17 +01:00
Akim Demaille
94701b4e5e style: rename semanticVal as value
* data/skeletons/README-D.txt: Remove, now useless and obsolete.
* data/skeletons/glr2.cc, examples/d/calc/calc.y,
* tests/calc.at, tests/d.at, tests/scanner.at (semanticVal): Replace
with...
(value): this.
2020-12-26 14:26:23 +01:00
Adela Vais
32bb53870b d: remove unnecessary methods from the Lexer interface
The complete symbol approach in yylex removes the need for the methods
semanticVal, startPos and endPos, which were used when the values were
reported separately.

* data/skeletons/lalr1.d: Here.
* doc/bison.texi: Remove sections about the three methods.
* examples/d/calc/calc.y, examples/d/simple/calc.y: Remove the unused methods.
* tests/calc.at, tests/d.at, tests/scanner.at: Test it.
2020-12-21 15:53:32 +01:00
Adela Vais
b00fa62e95 d: create alias Value for YYSemanticType
* data/skeletons/d.m4: Here.
* data/skeletons/lalr1.d, examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust.
* tests/calc.at, tests/d.at, tests/scanner.at: Test it.
2020-12-21 07:13:48 +01:00
Adela Vais
13bb2b78b3 d: create alias Symbol for YYParse.Symbol
* data/skeletons/lalr1.d: Here.
* doc/bison.texi: Document it.
* examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust.
* tests/calc.at, tests/d.at, tests/scanner.at: Test it.
2020-12-21 06:47:57 +01:00
Adela Vais
10305f3e94 d: change the return value of yylex from TokenKind to YYParser.Symbol
The complete symbol approach was deemed to be the right approach for Dlang.
Now, the user can return from yylex() an instance of YYParser.Symbol structure,
which binds together the TokenKind, the semantic value and the location. Before,
the last two were reported separately to the parser.
Only the user API is changed, Bisons's internal structure is kept the same.

* data/skeletons/d.m4 (struct YYParser.Symbol): New.
* data/skeletons/lalr1.d: Change the return value.
* doc/bison.texi: Document it.
* examples/d/calc/calc.y, examples/d/simple/calc.y: Demonstrate it.
* tests/calc.at, tests/scanner.at: Test it.
2020-11-20 22:09:31 +01:00
Akim Demaille
7cc9107053 style: enforce java coding style
* tests/scanner.at: here.
2020-11-10 07:55:36 +01:00
Akim Demaille
f7a7310433 java: avoid Integer(String), use parseInt
examples/java/calc/Calc.java:1531: warning: [deprecation] Integer(String) in Integer has been deprecated
          yylval = new Integer(st.sval);
                   ^

* examples/java/calc/Calc.y, examples/java/simple/Calc.y,
* tests/calc.at, tests/scanner.at: Use Integer.parseInt.
2020-11-03 08:46:54 +01:00
Adela Vais
7cd195b30a d: change api.token.raw default value to true
Generate consecutive values for enum TokenKind, as D's yylex()
returns TokenKind and collisions can't happen.

* data/skeletons/d.m4: Change default value.
* tests/scanner.at, tests/d.at: Check it.
2020-10-03 17:17:32 +02:00
Adela Vais
f296669c0f d: change the return value of yylex from int to TokenKind
* data/skeletons/lalr1.d: Change the return value.
* examples/d/calc/calc.y, examples/d/simple/calc.y: Adjust.
* tests/scanner.at: Adjust.
* tests/calc.at (_AT_DATA_CALC_Y(d)): New, extracted from...
(_AT_DATA_CALC_Y(c)): here.
The two grammars have been sufficiently different to be separated.
Still trying to be them together results in a maintenance burden.  For
the same reason, instead of specifying the results for D and for the
rest, compute the expected results with D from the regular case.
2020-09-26 08:08:25 +02:00
Valentin Tolmer
ef09bf065a glr2.cc: fork glr.cc to a c++ version
This is a fork of glr.cc to be c++-first instead of a wrapper around
glr.c.

* data/skeletons/glr2.cc: New.
* data/skeletons/bison.m4, data/skeletons/c++.m4: Adjust.
* data/skeletons/c.m4 (b4_user_args_no_comma): New.
* src/reader.c (grammar_rule_check_and_complete): glr2.cc is C++.
* tests/actions.at, tests/c++.at, tests/calc.at, tests/conflicts.at,
* tests/input.at, tests/local.at, tests/regression.at, tests/scanner.at,
* tests/synclines.at, tests/types.at: Also check glr2.cc.
2020-08-30 10:45:21 +02:00
Akim Demaille
71e3f6d4da d: put YYEMPTY in the TokenKind
* data/skeletons/d.m4, data/skeletons/lalr1.d (b4_token_enums): Rename
YYTokenType as TokenKind.
Define YYEMPTY.
* examples/d/calc.y, tests/calc.at, tests/scanner.at: Adjust.
2020-04-13 16:49:54 +02:00
Akim Demaille
72f04ca80f java: check and fix support for api.token.raw
* tests/local.at (AT_LANG_MATCH, AT_YYERROR_DECLARE(java))
(AT_YYERROR_DECLARE_EXTERN(java), AT_PARSER_CLASS): New.
(AT_MAIN_DEFINE(java)): Use AT_PARSER_CLASS.
* tests/scanner.at: Add a test for Java.
* data/skeletons/lalr1.java (yytranslate_): Cast the result.
2020-04-04 10:34:53 +02:00
Akim Demaille
c67daa9a97 package: bump copyrights to 2020
Run 'make update-copyright'.
2020-01-10 19:16:23 +01:00
Akim Demaille
8976e0f567 api.token.raw: check it against api.token.constructor
* tests/scanner.at: here.
2019-12-07 08:57:14 +01:00
Paul Eggert
5c2c9fcb17 tests: port to Solaris 10 grep
* tests/scanner.at (Token numbers: $1): Use $EGREP, not grep -E.
2019-10-17 11:51:20 -07:00
Akim Demaille
1e5e274972 api.token.raw: apply to the other skeletons
* data/skeletons/c++.m4, data/skeletons/glr.c,
* data/skeletons/lalr1.c, data/skeletons/lalr1.java:
Add support for api.token.raw.

* tests/scanner.at: Check them.
2019-09-14 09:55:17 +02:00
Akim Demaille
b1679f8346 api.token.raw: check it
* tests/local.at (AT_TOKEN_RAW_IF): New.
* tests/local.mk: New.
Use it.
2019-09-14 09:55:17 +02:00