[Gambas-user] where does the TextEditor turn "?" to "Print" ?

Bruce Steers bsteers4 at gmail.com
Tue Mar 21 20:29:55 CET 2023


On Mon, 20 Mar 2023 at 21:06, Benoit Minisini <
benoit.minisini at gambas-basic.org> wrote:

> Le 20/03/2023 à 19:54, Bruce Steers a écrit :
> > Was going to see if i could get my gambas to replace "??" for "Debug"
> > like it replaces "?" for "Print"
> >
> > cant find where it does it, looked all round gb.form.editor and
> > gb.eval.highlight
> >
> > And clues anyone?
> >
> > Cheers
> > BruceS
> >
>
> The TextEditor does nothing.
>
> It's the 'gb.eval.highlight' component that has support for highlighting
> that both highlights and rewrites the highlighted text.
>
> The Gambas highlighting is done in the 'gb.eval' component.
>
> The transformation of "?" into "PRINT" is done in 'eval_read.c' at line
> 400 (in 'master').
>
> It's done after the parser has done its job, so it's just a matter of
> replacing the token for question mark by the token of PRINT, only if we
> want to rewrite the code ('EVAL->analyze' is 'TRUE' then).
>
> Regards,
>
> --
> Benoît Minisini.
>

aaah thank you Ben

So after some investigating i added this after the existing code to replace
? for Print in eval_read.c ...

if (EVAL->analyze && op == RS_AT)
op = RS_DEBUG;
Made sense to use AT @ as usually i want to use Debug not Print because i
want to know there the message is "at".
(plus I had no idea how to make it check for double Questionmarks ??)

works a treat converting @ to Debug :)

Thanks again :)
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230321/83d24b09/attachment.htm>


More information about the User mailing list