Discussion:
Dedicated lexer for Windows registration files
(too old to reply)
nkmathew
2014-08-06 15:45:27 UTC
Permalink
<Loading Image...>
LexOthers wasn't doing much to highlight registry files so I made this.
Do you think it's merge-worthy?
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-08-07 00:03:32 UTC
Permalink
Post by nkmathew
LexOthers wasn't doing much to highlight registry files so I made this.
Do you think it's merge-worthy?
The folding isn’t consistent. Try the attached file: folding is much better with LexOthers.

There are some warnings from compilers and checkers:

..\lexers\LexRegistry.cxx(193) : warning C4060: switch statement contains no 'case' or 'default' labels
..\lexers\LexRegistry.cxx(369) : warning C4100: 'initStyle' : unreferenced formal parameter

Summary: Technically the member function 'LexerRegistry::IsKeyPathState' can be static.
Summary: Technically the member function 'LexerRegistry::AtValueType' can be static.
Summary: Technically the member function 'LexerRegistry::IsNextNonWhitespace' can be static.
Summary: Technically the member function 'LexerRegistry::AtKeyPathEnd' can be static.
Summary: Technically the member function 'LexerRegistry::AtGUID' can be static.

Neil
nkmathew
2014-08-07 11:46:06 UTC
Permalink
The folding isn’t consistent. Try the attached file: folding is much
better with LexOthers.
Fixed. Outer variable `next' was being shadowed.
..\lexers\LexRegistry.cxx(193) : warning C4060: switch statement contains no
'case' or 'default' labels
..\lexers\LexRegistry.cxx(369) : warning C4100: 'initStyle' : unreferenced formal parameter
Summary: Technically the member function 'LexerRegistry::IsKeyPathState' can be static.
Summary: Technically the member function 'LexerRegistry::AtValueType' can be static.
Summary: Technically the member function
'LexerRegistry::IsNextNonWhitespace' can be static.
Summary: Technically the member function 'LexerRegistry::AtKeyPathEnd' can be static.
Summary: Technically the member function 'LexerRegistry::AtGUID' can be static.
Addressed. I didn't get these warnings with both gcc and cppcheck. I'm
guessing they're from VC++?
--
nkmathew
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-08-08 00:49:49 UTC
Permalink
Post by nkmathew
The folding isn't consistent. Try the attached file: folding is much
better with LexOthers.
Fixed. Outer variable `next' was being shadowed.
Its better. The initial fold level appears to be greater than default so for files exported from regedit which start with "Windows Reg..." there is a fold tail visible for fold.symbols=3
Post by nkmathew
Addressed. I didn't get these warnings with both gcc and cppcheck. I'm
guessing they're from VC++?
The static warnings are from cppcheck in 'Show inconclusive errors' mode which is on the Advanced page of Preferences. Inconclusive errors are issues that cppcheck is unsure about. They often require the whole library to be built so that cppcheck can see how the definitions are used. Methods must often be non-static because the class is fulfilling a specification and cppcheck can't detect this. For example it wants AddRef and Release on ScintillaWin to be static event though they can't be because COM requires them to be non-static.

The switch issue was reported by Visual C++. The change just moves the problem on with 'unreachable code' now reported. Just remove all the code from WordListSet and return -1.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
nkmathew
2014-08-08 22:57:14 UTC
Permalink
Post by Neil Hodgson
Its better. The initial fold level appears to be greater than default so
for files exported from regedit which start with "Windows Reg..." there is a
fold tail visible for fold.symbols=3
It's gone now. Rewrote the function to work almost exactly like
FoldPropsDoc(my implementation led to incosistent results)

Couple of questions:
1. Why do you have to call SetLevel twice, without which the last line
isn't folded?
2. How is the folding/lexing start position and end position determined?
--
nkmathew
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-08-08 23:49:23 UTC
Permalink
Post by nkmathew
1. Why do you have to call SetLevel twice, without which the last line
isn't folded?
I don't think you are calling SetLevel twice for any line since currLine is always incremented after each call in the loop. Folding works on the difference between lines so you want to set the next line to get the right behaviour for a line.
Post by nkmathew
2. How is the folding/lexing start position and end position determined?
Changing the document moves the starting position backwards to the start of the line of the change. The end position is whatever Scintilla or the application want to have styled, often the current line or to the end of the window.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Neil Hodgson
2014-08-09 05:34:47 UTC
Permalink
Registry lexer committed with minor fixes for unused parameters.

Neil
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
nkmathew
2014-08-07 19:47:33 UTC
Permalink
Disregard the previous file. It gets tripped by adjacent escaped
characters like this:


[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\eHome.iTvHost.1\CLSID]
"{599141B3-B243-11DB-8460-00123F76E1F7}\\"="sdfsdf"

[HKEY_LOCAL_MACHINE\SOFTWARE\Classes\AcroExch.acrobatsecuritysettings.1\shell\Print\command]
@="\"\"C:\\Program Files\\Adobe\\Reader 9.0\\Reader\\AcroRd32.exe\"\"
/p /h \"%1\" "

This one should fix that.
--
nkmathew
--
You received this message because you are subscribed to the Google Groups "scintilla-interest" group.
To unsubscribe from this group and stop receiving emails from it, send an email to scintilla-interest+***@googlegroups.com.
To post to this group, send email to scintilla-***@googlegroups.com.
Visit this group at http://groups.google.com/group/scintilla-interest.
For more options, visit https://groups.google.com/d/optout.
Loading...