d: prefer delegation to duplication

* data/skeletons/lalr1.d: Delegate the construction of the scanner.
This commit is contained in:
Akim Demaille
2019-06-19 08:24:34 +02:00
parent 5b525e86a5
commit cde8c0a0e6

View File

@@ -260,17 +260,15 @@ b4_user_union_members
]b4_lexer_if([[ ]b4_lexer_if([[
/** /**
* Instantiates the Bison-generated parser. * Instantiate the Bison-generated parser.
*/ */
public this] (b4_parse_param_decl([b4_lex_param_decl])[) { public this] (b4_parse_param_decl([b4_lex_param_decl])[) {
this.yylexer = new YYLexer(]b4_lex_param_call[); this (new YYLexer(]b4_lex_param_call[));
this.yyDebugStream = stderr;
]b4_parse_param_cons[
} }
]])[ ]])[
/** /**
* Instantiates the Bison-generated parser. * Instantiate the Bison-generated parser.
* @@param yylexer The scanner that will supply tokens to the parser. * @@param yylexer The scanner that will supply tokens to the parser.
*/ */
]b4_lexer_if([[protected]], [[public]]) [this (]b4_parse_param_decl([[Lexer yylexer]])[) { ]b4_lexer_if([[protected]], [[public]]) [this (]b4_parse_param_decl([[Lexer yylexer]])[) {