> I've converted LexAsm, LexBasic and LexD to lexer objects
> to prepare them for adding further folding features/properties.
LexBasic implements three different lexers, with differing keyword
lists but there is only a single OptionSetBasic class whose
constructor calls DefineWordListSets 3 times with each lexer's word
list names making a composite list of 12 items that does not match any
on the lexers.
In the D lexer, none of the options shared with the cpp lexer
should have descriptions.
> I haven't declared a PropSetSimple props object in the
> lexer object and also deleted the neccessary include file
> (#include "PropSetSimple.h"), because it isn't used.
> Are there plans, to use it for something?
This was used in an earlier version but no longer appears
necessary. The empty definition in Accessor.h is all that is needed by
most lexers now. Committed removal of #include from most lexers and
props in LexCPP.
Neil
> I wonder, coloring has worked, despite this bug - I think,
> I've done it better now.
Before lexer objects, client code had to look at compile time
information like SciLexer.h or run a script over the source code of
all the lexers to see which properties they are controlled by. With
lexer objects the client can call SCI_PROPERTYNAMES to find out the
properties or SCI_DESCRIBEKEYWORDSETS to find the keywords. ScITE
doesn't use these but other containers may want to provide a dialog
where you can see the names of the keyword sets and change the
keywords in each set.
>> In the D lexer, none of the options shared with the cpp lexer
>> should have descriptions.
>
> I've changed it and updated the zip-file:
> http://dlchnr.dl.funpic.de/in/abdLex.zip
OK.
> But there will come up contradictions when implementing
> explicit fold points in LexAsm and LexBasic - fold.comment
> can't enable folding //{ and //} in this case, it has to be
> ;;{ and ;;} (''{ and ''} for FreeBasic), what I've choosen or
> something like that. Should we give up the desciption
> in this case too? Or should I introduce fold.asm.comment
> and fold.basic.comment like suggested in comments?
Yes, these lexers never supported fold.comment so there is no
backward compatibility issue.
> Which timeframe has to be placed between the
> patches (patch1, which converts to lexer object
> and patch2, which add further folding features),
> before adding them to scitilla code base?
Depends on how long I take to review the code and whether changes
are needed. I'm still a little unhappy about foldAtElseInt having
three values.
There are some unused parameter warnings. To avoid these just don't
give a name to the parameter:
LexBasic.cxx
..\lexers\LexBasic.cxx(391) : warning C4100: 'initStyle' :
unreferenced formal parameter
LexAsm.cxx
..\lexers\LexAsm.cxx(281) : warning C4100: 'pAccess' : unreferenced
formal parameter
..\lexers\LexAsm.cxx(281) : warning C4100: 'initStyle' : unreferenced
formal parameter
..\lexers\LexAsm.cxx(281) : warning C4100: 'length' : unreferenced
formal parameter
..\lexers\LexAsm.cxx(281) : warning C4100: 'startPos' : unreferenced
formal parameter
Neil
> I have had no idea to avoid this and being completely
> compatible with current version - you?
> Should we have a small incompatibilty and simply
> evaluate lexer.d.fold.at.else?
Its difficult to work out what the best path is here. I'd like to
have a simple model for properties where they have primitive values
without using an out of range value to indicate they haven't been set.
A boolean property should be either true or false. On the other hand,
changing the names and meaning of properties will break client code.
Adding an extra boolean to every property value to mark them as set or
not set seems to me to be just making this more complex for the rest
of time.
Neil
> if (!strcmp(token, "proc") || // group 00
> !strcmp(token, ".if") || // group 01
> !strcmp(token, ".repeat") || // group 02
> !strcmp(token, "segment") || // group 03
> !strcmp(token, "union") || // group 03
> !strcmp(token, "struct") || // group 03/04
> !strcmp(token, "istruc") || // group 05
> !strcmp(token, "%macro") || // group 06
> !strcmp(token, "%imacro") || // group 06
> !strcmp(token, "macro") || // group 07
> !strcmp(token, "for") || // group 07
> !strcmp(token, "forc") || // group 07
> !strcmp(token, "irpc") || // group 07
> ...
That is inefficient. Make a std::set<std::string> or similar at
initialisation that contains all the magic words and then just check
if the word is in the set.
Neil
Neil
> I've updated http://dlchnr.dl.funpic.de/in/abdLexFF.zip
> including LexAsm.cxx and LexBasic.cxx supporting
> the additional folding features and properties.
The lists of folding start and end points is quite long with many
commented out indicating uncertainty. In this situation it would be
better to allow the user to control the set of start and end points by
adding two keyword lists. In most languages the set of keywords is
much more certain so it is OK to have these hard coded.
> I've considered your hints also in LexD.cxx,
> but the lexer.d.fold.at.else behavior is still open
> (as in LexD.cxx without the extensions).
Despite my misgivings, I can't see a good way around this so will
include the foldAtElseInt code.
StyleContext::Complete() calls styler.Flush() so there is no need
to include an extra call to styler.Flush in lexers that already call
StyleContext::Complete().
C++ requires two / characters to start a comment whereas Basic only
requires a single ' or ; so using the sequences ''{ or ;;{ does not
really appear to match normal Basic style.
Does the early return if foldSyntaxBased and foldCommentExplicit
are false lead to stale fold points if these are turned off during a
session?
Document consuming loops can be unsafe without checks for end of
file. For example, these in the assembler lexer look problematic
although I'm unsure whether they can loop past the end:
while (IsASpaceOrTab(sc.ch)) {
sc.ForwardSetState(SCE_ASM_DEFAULT);
}
while (!sc.atLineEnd) {
sc.Forward();
}
Neil
> but I still would prefer fold points provided by an
> experienced programmer, because a simple, accidental change
> (e.g. I've delete the % before macro, when I moved the keywords
> to the set) can result in a catastrophic misfolded document.
With the folding words configurable, eventually a MASM user will
turn up and fix the issue.
> That means, there's nothing to change for me in the both versions
> of LexD.cxx?
There is the early exit from folding issue.
> My first thought was that StyleContext::Complete() does, what in
> LexLisp.cxx is missed, but when I saw the sequence
> sc.Complete();
> styler.Flush();
> in LexCPP.cxx, I was convinced, the idea was wrong - I then simply
> copied from LexCPP.cxx. I will remove it from all files,
> where I've added it (of course not in LexLisp.cxx :-).
LexCPP.cxx had the Flush before it was included in StyleContext.
> two ideas
> - the shorter the sequence, the more likely the risk of producing
> the sequence accidentally
> - using two comment signs + { / } could be the Scintilla "Standard"
> for explicit fold points
>
> You want to see '{ and '} or ;{ and ;}?
Either find a Basic-specific IDE and copy its choice or just leave
out a default. If a user wants fold points then they have to define
fold.basic.explicit.start/end. Then if any consensus emerges it can be
added as the default.
> I must admit that I didn't expect, changes can occur interactively.
Part of the reason for lexer objects is to allow more interactive
changes to settings and for those changes to be visible in a
consistent way.
> I catch a meaning of the lexer, not of the whole Scintilla /
> SciTE project - would the following solve the problem?
> ...
> Otherwise I've to delete this optimisation!
This is looking like trouble so just drop the optimisation.
Just noticed that you check for c == '\n' for line end but line
ends may be just '\r' for old-style MacOS files.
Neil
This is creating a long list of language specific properties in the
SciTE documentation. I may move these out into a separate section as
they are not of interest to users of other languages.
Neil