[Gambas-user] Scripter new version Bug

Benoît Minisini g4mba5 at gmail.com
Sun Mar 7 20:02:46 CET 2021


Le 07/03/2021 à 18:01, Brian G a écrit :
> Scripter  option --convert-project creates an error right now as  it 
> uses the new #Script Startup=xx format.
> when you run the generated script it will cause a syntax error.
> 
> The latest version of scripter now fails because #Script has been turned 
> into a keyword PreProcess command after the initial commit of the 
> scripter causing scripter not to recognize the keyword, A patch that 
> fixes scripter to accommodate this has been submitted for merge.
> 
> In the mean time for simple scripts, deleting this line from the output 
> script should work a treat.
> Lines starting with #Script can be deleted for now.
> 
> "Failure is the key to success;
>   each mistake teaches us something"  .. Morihei Ueshiba
> Brian G
> 

Hi,

The merge request has been merged

A few remarks:

1) I now realize the misunderstanding about Highlight.Analyze() and 
Highlight.Types.

If an analyzed token is told to be 'Highlight.XXXX', it does not mean 
that the token is syntactically 'XXXX', but that it will be highlighted 
as 'XXXX'.

So if '#SCRIPT' has the type 'Highlight.Preprocessor', it does not 
-necessarily- mean that you are in a preprocessor line. Even if it is 
very likely. It just tells you that the Gambas reader detected a token 
named '#SCRIPT' that will be highlighted with 'Highlight.Preprocessor' 
style.

I don't know if I was clear...

Concretely, what tells you that you have a preprocessor line is the 
first non-space character of the line being "#".

2) There are possible optimizations in the TokenizeFile() function. For 
example:

- Storing Highlight.Symbols and Highlight.Types in local variables for 
faster access.

- Use `If <symbol> == "ABCD"` instead of `If UCase(<symbol>) = "ABCD"`.

- Check for '#' at the start of the line before doing its specific 
script commands checks. Or directly check that the first token starts 
with a '#'.

3) When you write a commit log, please follow exactly the requested 
format described in the 'README.commit' file:

<summary of changes>

[SCRIPTER]
* BUG: Fixed bug #1.
* NEW: Add feature #2.
* OPT: Scripter is now faster!

And be careful with English (even if I make a lot of mistakes myself!).

Otherwise the automatic log compilation cannot work, and I have to 
rewrite the log by hand for each commit. My time is better spent 
somewhere else.

It's not dramatic at the moment, as a lot of commit log will be removed 
from the ChangeLog, the ones who are internal changes and not new 
features or bug fixes of precedently implemented features.

4) By reading the code of TokenizeFile(), I see support for apparently 
embedding classes (ok), modules (why not), form (??) and connections 
(????). But nothing for the other Gambas source file types.

I didn't see anything about that in the list of changes you sent me. Did 
I miss it? Or is it an hidden feature? Something not yet implemented? 
Otherwise why did you implement that?

Anyway, thanks for your work!

Regards,

-- 
Benoît Minisini


More information about the User mailing list