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

Bruce Steers bsteers4 at gmail.com
Tue Mar 21 22:00:08 CET 2023


>
> On Mon, 20 Mar 2023 at 21:06, Benoit Minisini <
> benoit.minisini at gambas-basic.org> wrote:
>
>>
>> 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 :)
>

Sorry i got a couple of questions.

is it safe using @ ?
I know various chars like # and & couldn't be used.
i have a funny feeling @ is used for something, iirc pointers so should not
be used this way.

what would be safe chars to use?

Tilde maybe?  but i could not find the RS_CODE for ~ tilde
Semicolon looks unused

Thanks in advance
BruceS
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20230321/cbeb0c67/attachment-0001.htm>


More information about the User mailing list