[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH 3/4] java: add support for lookahead correction
From: |
Akim Demaille |
Subject: |
Re: [PATCH 3/4] java: add support for lookahead correction |
Date: |
Mon, 2 Nov 2020 07:32:17 +0100 |
Hi Adrian,
Thanks for your answer!
> Le 2 nov. 2020 à 01:50, Adrian Vogelsgesang <avogelsgesang@tableau.com> a
> écrit :
>
> Hi Akim,
>
> nice to see that Java also gets LAC support :)
:)
> public
> ]b4_parser_class[(]b4_parse_param_decl([b4_lex_param_decl])[)]b4_maybe_throws([b4_init_throws])[
> {
> -]b4_percent_code_get([[init]])[
> - this.yylexer = new YYLexer (]b4_lex_param_call[);
> +]b4_percent_code_get([[init]])[]b4_lac_if([[
> + this.yylacStack = new Vector<Integer>();
> + this.yylacEstablished = false;]])[
> + this.yylexer = new YYLexer(]b4_lex_param_call[);
> ]b4_parse_param_cons[
>
>
>
> Why do we place the user-provided init-code first?
> Does that mean, the user must not call any methoes which might depend on
> `yylexer`?
> Not sure if this actually matters, but I would put the user-provided
> init-code last, so that the rest of the class is already initialized…
It makes sense, I'll change that. Thanks!
> + /// Logically, the yylacStack's lifetime is confined to the function
> + /// yylacCheck. We just store it as a member of this class to hold
> + /// on to the memory and to avoid frequent reallocations.
> + /// Since yylacCheck is const, this member must be mutable.
>
> The parts about “const” and “mutable” don’t really apply to Java…
Bummer, caught in flagrante copy-paste delicto...
Thanks, I'll this too :)
[PATCH 4/4] java: lac: check it, Akim Demaille, 2020/11/01