+ rfc: refactoring for splitting Lexilla from Scintilla

This commit is contained in:
Rainer Kottenhoff 2021-03-11 16:54:16 +01:00
parent 1060a5a7c4
commit edc7c2843c
202 changed files with 21555 additions and 10773 deletions

66
lexilla/.gitignore vendored Normal file
View File

@ -0,0 +1,66 @@
*.o
*.a
*.asm
*.lib
*.obj
*.iobj
__pycache__
*.pyc
*.dll
*.so
*.dylib
*.framework
*.pyd
*.exe
*.exp
*.lib
*.pdb
*.ipdb
*.res
*.bak
*.sbr
*.suo
*.aps
*.sln
*.vcxproj.*
*.idb
*.bsc
*.intermediate.manifest
*.lastbuildstate
*.cache
*.ilk
*.ncb
*.tlog
*.sdf
gtk/*.plist
win32/*.plist
*.opt
*.plg
*.pbxbtree
*.mode1v3
*.pbxuser
*.pbproj
*.log
*.xcbkptlist
*.xcuserstate
xcuserdata/
*.xcsettings
xcschememanagement.plist
.DS_Store
test/TestLexers
Debug
Release
x64
ARM64
cocoa/build
cocoa/ScintillaFramework/build
cocoa/ScintillaTest/build
macosx/SciTest/build
*.cppcheck
cov-int
.vs
meson-private
meson-logs
build.ninja
.ninja*
compile_commands.json

View File

@ -27,60 +27,90 @@
</ProjectConfiguration>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\lexers_x\CharSetX.h" />
<ClInclude Include="src\lexers_x\LexerUtils.h" />
<ClInclude Include="src\lexers_x\SciXLexer.h" />
<ClInclude Include="src\Lexilla.h" />
<ClInclude Include="include\Lexilla.h" />
<ClInclude Include="include\SciLexer.h" />
<ClInclude Include="lexers_x\CharSetX.h" />
<ClInclude Include="lexers_x\LexerUtils.h" />
<ClInclude Include="lexers_x\SciXLexer.h" />
<ClInclude Include="lexlib\Accessor.h" />
<ClInclude Include="lexlib\CatalogueModules.h" />
<ClInclude Include="lexlib\CharacterCategory.h" />
<ClInclude Include="lexlib\CharacterSet.h" />
<ClInclude Include="lexlib\DefaultLexer.h" />
<ClInclude Include="lexlib\LexAccessor.h" />
<ClInclude Include="lexlib\LexerBase.h" />
<ClInclude Include="lexlib\LexerModule.h" />
<ClInclude Include="lexlib\LexerNoExceptions.h" />
<ClInclude Include="lexlib\LexerSimple.h" />
<ClInclude Include="lexlib\OptionSet.h" />
<ClInclude Include="lexlib\PropSetSimple.h" />
<ClInclude Include="lexlib\SparseState.h" />
<ClInclude Include="lexlib\StringCopy.h" />
<ClInclude Include="lexlib\StyleContext.h" />
<ClInclude Include="lexlib\SubStyles.h" />
<ClInclude Include="lexlib\WordList.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\scintilla\lexers\LexAsm.cxx" />
<ClCompile Include="..\scintilla\lexers\LexAU3.cxx" />
<ClCompile Include="..\scintilla\lexers\LexAVS.cxx" />
<ClCompile Include="..\scintilla\lexers\LexBash.cxx" />
<ClCompile Include="..\scintilla\lexers\LexBatch.cxx" />
<ClCompile Include="..\scintilla\lexers\LexCmake.cxx" />
<ClCompile Include="..\scintilla\lexers\LexCoffeeScript.cxx" />
<ClCompile Include="..\scintilla\lexers\LexConf.cxx" />
<ClCompile Include="..\scintilla\lexers\LexCPP.cxx" />
<ClCompile Include="..\scintilla\lexers\LexCSS.cxx" />
<ClCompile Include="..\scintilla\lexers\LexD.cxx" />
<ClCompile Include="..\scintilla\lexers\LexDiff.cxx" />
<ClCompile Include="..\scintilla\lexers\LexHTML.cxx" />
<ClCompile Include="..\scintilla\lexers\LexInno.cxx" />
<ClCompile Include="..\scintilla\lexers\LexLaTeX.cxx" />
<ClCompile Include="..\scintilla\lexers\LexLua.cxx" />
<ClCompile Include="..\scintilla\lexers\LexMake.cxx" />
<ClCompile Include="..\scintilla\lexers\LexMarkdown.cxx" />
<ClCompile Include="..\scintilla\lexers\LexMatlab.cxx" />
<ClCompile Include="..\scintilla\lexers\LexNim.cxx" />
<ClCompile Include="..\scintilla\lexers\LexNsis.cxx" />
<ClCompile Include="..\scintilla\lexers\LexNull.cxx" />
<ClCompile Include="..\scintilla\lexers\LexPascal.cxx" />
<ClCompile Include="..\scintilla\lexers\LexPerl.cxx" />
<ClCompile Include="..\scintilla\lexers\LexPowerShell.cxx" />
<ClCompile Include="..\scintilla\lexers\LexProps.cxx" />
<ClCompile Include="..\scintilla\lexers\LexPython.cxx" />
<ClCompile Include="..\scintilla\lexers\LexR.cxx" />
<ClCompile Include="..\scintilla\lexers\LexRegistry.cxx" />
<ClCompile Include="..\scintilla\lexers\LexRuby.cxx" />
<ClCompile Include="..\scintilla\lexers\LexRust.cxx" />
<ClCompile Include="..\scintilla\lexers\LexSQL.cxx" />
<ClCompile Include="..\scintilla\lexers\LexTCL.cxx" />
<ClCompile Include="..\scintilla\lexers\LexVB.cxx" />
<ClCompile Include="..\scintilla\lexers\LexVHDL.cxx" />
<ClCompile Include="..\scintilla\lexers\LexYAML.cxx" />
<ClCompile Include="src\lexers_x\LexAHKL.cxx" />
<ClCompile Include="src\lexers_x\LexCSV.cxx" />
<ClCompile Include="src\lexers_x\LexDart.cxx" />
<ClCompile Include="src\lexers_x\LexJSON.cxx" />
<ClCompile Include="src\lexers_x\LexKotlin.cxx" />
<ClCompile Include="src\lexers_x\LexTOML.cxx" />
<ClCompile Include="lexers\LexAsm.cxx" />
<ClCompile Include="lexers\LexAU3.cxx" />
<ClCompile Include="lexers\LexAVS.cxx" />
<ClCompile Include="lexers\LexBash.cxx" />
<ClCompile Include="lexers\LexBatch.cxx" />
<ClCompile Include="lexers\LexCmake.cxx" />
<ClCompile Include="lexers\LexCoffeeScript.cxx" />
<ClCompile Include="lexers\LexConf.cxx" />
<ClCompile Include="lexers\LexCPP.cxx" />
<ClCompile Include="lexers\LexCSS.cxx" />
<ClCompile Include="lexers\LexD.cxx" />
<ClCompile Include="lexers\LexDiff.cxx" />
<ClCompile Include="lexers\LexHTML.cxx" />
<ClCompile Include="lexers\LexInno.cxx" />
<ClCompile Include="lexers\LexLaTeX.cxx" />
<ClCompile Include="lexers\LexLua.cxx" />
<ClCompile Include="lexers\LexMake.cxx" />
<ClCompile Include="lexers\LexMarkdown.cxx" />
<ClCompile Include="lexers\LexMatlab.cxx" />
<ClCompile Include="lexers\LexNim.cxx" />
<ClCompile Include="lexers\LexNsis.cxx" />
<ClCompile Include="lexers\LexNull.cxx" />
<ClCompile Include="lexers\LexPascal.cxx" />
<ClCompile Include="lexers\LexPerl.cxx" />
<ClCompile Include="lexers\LexPowerShell.cxx" />
<ClCompile Include="lexers\LexProps.cxx" />
<ClCompile Include="lexers\LexPython.cxx" />
<ClCompile Include="lexers\LexR.cxx" />
<ClCompile Include="lexers\LexRegistry.cxx" />
<ClCompile Include="lexers\LexRuby.cxx" />
<ClCompile Include="lexers\LexRust.cxx" />
<ClCompile Include="lexers\LexSQL.cxx" />
<ClCompile Include="lexers\LexTCL.cxx" />
<ClCompile Include="lexers\LexVB.cxx" />
<ClCompile Include="lexers\LexVHDL.cxx" />
<ClCompile Include="lexers\LexYAML.cxx" />
<ClCompile Include="lexers_x\LexAHKL.cxx" />
<ClCompile Include="lexers_x\LexCSV.cxx" />
<ClCompile Include="lexers_x\LexDart.cxx" />
<ClCompile Include="lexers_x\LexJSON.cxx" />
<ClCompile Include="lexers_x\LexKotlin.cxx" />
<ClCompile Include="lexers_x\LexTOML.cxx" />
<ClCompile Include="lexlib\Accessor.cxx" />
<ClCompile Include="lexlib\CharacterCategory.cxx" />
<ClCompile Include="lexlib\CharacterSet.cxx" />
<ClCompile Include="lexlib\DefaultLexer.cxx" />
<ClCompile Include="lexlib\LexerBase.cxx" />
<ClCompile Include="lexlib\LexerModule.cxx" />
<ClCompile Include="lexlib\LexerNoExceptions.cxx" />
<ClCompile Include="lexlib\LexerSimple.cxx" />
<ClCompile Include="lexlib\PropSetSimple.cxx" />
<ClCompile Include="lexlib\StyleContext.cxx" />
<ClCompile Include="lexlib\WordList.cxx" />
<ClCompile Include="src\Lexilla.cxx" />
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="src\LexillaVersion.rc" />
</ItemGroup>
<ItemGroup>
<None Include="include\LexicalStyles.iface" />
<None Include="src\lexers_x\SciX.iface" />
</ItemGroup>
<PropertyGroup Label="Globals">
@ -195,7 +225,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexlib;src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;lexlib;src;..\scintilla\include;</AdditionalIncludeDirectories>
<StringPooling>true</StringPooling>
<FloatingPointModel>Precise</FloatingPointModel>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -224,7 +254,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexlib;src;ser\lexer_x</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;lexlib;src;..\scintilla\include;ser\lexer_x</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<StringPooling>true</StringPooling>
@ -262,7 +292,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexlib;src;ser\lexer_x</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;lexlib;src;..\scintilla\include;ser\lexer_x</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<StringPooling>true</StringPooling>
@ -292,7 +322,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexlib;src</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;lexlib;src;..\scintilla\include;</AdditionalIncludeDirectories>
<StringPooling>true</StringPooling>
<FloatingPointModel>Precise</FloatingPointModel>
<RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
@ -320,7 +350,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexlib;src;ser\lexer_x</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;lexlib;src;..\scintilla\include;ser\lexer_x</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<StringPooling>true</StringPooling>
@ -357,7 +387,7 @@
<ConformanceMode>true</ConformanceMode>
<LanguageStandard>stdcpp17</LanguageStandard>
<MultiProcessorCompilation>true</MultiProcessorCompilation>
<AdditionalIncludeDirectories>..\scintilla\include;..\scintilla\lexlib;src;ser\lexer_x</AdditionalIncludeDirectories>
<AdditionalIncludeDirectories>include;lexlib;src;..\scintilla\include;ser\lexer_x</AdditionalIncludeDirectories>
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed>
<StringPooling>true</StringPooling>

View File

@ -22,151 +22,241 @@
<Filter Include="lexers_x">
<UniqueIdentifier>{0087651a-f9f8-4b96-a61b-9d58c9eedada}</UniqueIdentifier>
</Filter>
<Filter Include="lexlib">
<UniqueIdentifier>{3478064f-95da-45ac-92ef-6fa23a3a8a6f}</UniqueIdentifier>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="src\Lexilla.h">
<ClInclude Include="lexers_x\CharSetX.h">
<Filter>lexers_x</Filter>
</ClInclude>
<ClInclude Include="lexers_x\SciXLexer.h">
<Filter>lexers_x</Filter>
</ClInclude>
<ClInclude Include="lexers_x\LexerUtils.h">
<Filter>lexers_x</Filter>
</ClInclude>
<ClInclude Include="lexlib\Accessor.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\CatalogueModules.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\CharacterCategory.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\CharacterSet.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\DefaultLexer.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\LexAccessor.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\LexerBase.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\LexerModule.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\LexerNoExceptions.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\LexerSimple.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\OptionSet.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\PropSetSimple.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\SparseState.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\StringCopy.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\StyleContext.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\SubStyles.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="lexlib\WordList.h">
<Filter>lexlib</Filter>
</ClInclude>
<ClInclude Include="include\Lexilla.h">
<Filter>Header Files</Filter>
</ClInclude>
<ClInclude Include="src\lexers_x\CharSetX.h">
<Filter>lexers_x</Filter>
</ClInclude>
<ClInclude Include="src\lexers_x\SciXLexer.h">
<Filter>lexers_x</Filter>
</ClInclude>
<ClInclude Include="src\lexers_x\LexerUtils.h">
<Filter>lexers_x</Filter>
<ClInclude Include="include\SciLexer.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="src\Lexilla.cxx">
<Filter>Source Files</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexAsm.cxx">
<ClCompile Include="lexers\LexAsm.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexAU3.cxx">
<ClCompile Include="lexers\LexAU3.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexAVS.cxx">
<ClCompile Include="lexers\LexAVS.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexBash.cxx">
<ClCompile Include="lexers\LexBash.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexBatch.cxx">
<ClCompile Include="lexers\LexBatch.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexCmake.cxx">
<ClCompile Include="lexers\LexCmake.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexCoffeeScript.cxx">
<ClCompile Include="lexers\LexCoffeeScript.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexConf.cxx">
<ClCompile Include="lexers\LexConf.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexCPP.cxx">
<ClCompile Include="lexers\LexCPP.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexCSS.cxx">
<ClCompile Include="lexers\LexCSS.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexD.cxx">
<ClCompile Include="lexers\LexD.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexDiff.cxx">
<ClCompile Include="lexers\LexDiff.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexHTML.cxx">
<ClCompile Include="lexers\LexHTML.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexInno.cxx">
<ClCompile Include="lexers\LexInno.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexLaTeX.cxx">
<ClCompile Include="lexers\LexLaTeX.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexLua.cxx">
<ClCompile Include="lexers\LexLua.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexMake.cxx">
<ClCompile Include="lexers\LexMake.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexMarkdown.cxx">
<ClCompile Include="lexers\LexMarkdown.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexMatlab.cxx">
<ClCompile Include="lexers\LexMatlab.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexNim.cxx">
<ClCompile Include="lexers\LexNim.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexNsis.cxx">
<ClCompile Include="lexers\LexNsis.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexNull.cxx">
<ClCompile Include="lexers\LexNull.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexPascal.cxx">
<ClCompile Include="lexers\LexPascal.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexPerl.cxx">
<ClCompile Include="lexers\LexPerl.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexPowerShell.cxx">
<ClCompile Include="lexers\LexPowerShell.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexProps.cxx">
<ClCompile Include="lexers\LexProps.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexPython.cxx">
<ClCompile Include="lexers\LexPython.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexR.cxx">
<ClCompile Include="lexers\LexR.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexRegistry.cxx">
<ClCompile Include="lexers\LexRegistry.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexRuby.cxx">
<ClCompile Include="lexers\LexRuby.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexRust.cxx">
<ClCompile Include="lexers\LexRust.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexSQL.cxx">
<ClCompile Include="lexers\LexSQL.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexTCL.cxx">
<ClCompile Include="lexers\LexTCL.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexVB.cxx">
<ClCompile Include="lexers\LexVB.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexVHDL.cxx">
<ClCompile Include="lexers\LexVHDL.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="..\scintilla\lexers\LexYAML.cxx">
<ClCompile Include="lexers\LexYAML.cxx">
<Filter>lexers</Filter>
</ClCompile>
<ClCompile Include="src\lexers_x\LexAHKL.cxx">
<ClCompile Include="lexers_x\LexAHKL.cxx">
<Filter>lexers_x</Filter>
</ClCompile>
<ClCompile Include="src\lexers_x\LexCSV.cxx">
<ClCompile Include="lexers_x\LexCSV.cxx">
<Filter>lexers_x</Filter>
</ClCompile>
<ClCompile Include="src\lexers_x\LexTOML.cxx">
<ClCompile Include="lexers_x\LexTOML.cxx">
<Filter>lexers_x</Filter>
</ClCompile>
<ClCompile Include="src\lexers_x\LexDart.cxx">
<ClCompile Include="lexers_x\LexDart.cxx">
<Filter>lexers_x</Filter>
</ClCompile>
<ClCompile Include="src\lexers_x\LexKotlin.cxx">
<ClCompile Include="lexers_x\LexKotlin.cxx">
<Filter>lexers_x</Filter>
</ClCompile>
<ClCompile Include="src\lexers_x\LexJSON.cxx">
<ClCompile Include="lexers_x\LexJSON.cxx">
<Filter>lexers_x</Filter>
</ClCompile>
<ClCompile Include="lexlib\Accessor.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\CharacterCategory.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\CharacterSet.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\DefaultLexer.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\LexerBase.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\LexerModule.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\LexerNoExceptions.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\LexerSimple.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\PropSetSimple.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\StyleContext.cxx">
<Filter>lexlib</Filter>
</ClCompile>
<ClCompile Include="lexlib\WordList.cxx">
<Filter>lexlib</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile Include="src\LexillaVersion.rc">
@ -174,6 +264,9 @@
</ResourceCompile>
</ItemGroup>
<ItemGroup>
<None Include="include\LexicalStyles.iface">
<Filter>Header Files</Filter>
</None>
<None Include="src\lexers_x\SciX.iface">
<Filter>lexers_x</Filter>
</None>

View File

@ -0,0 +1,230 @@
// SciTE - Scintilla based Text Editor
/** @file LexillaAccess.cxx
** Interface to loadable lexers.
** Maintains a list of lexer library paths and CreateLexer functions.
** If list changes then load all the lexer libraries and find the functions.
** When asked to create a lexer, call each function until one succeeds.
**/
// Copyright 2019 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <cstring>
#include <string>
#include <string_view>
#include <vector>
#include <set>
#if !_WIN32
#include <dlfcn.h>
#else
#include <windows.h>
#endif
#include "ILexer.h"
#include "Lexilla.h"
#include "LexillaAccess.h"
namespace {
#if _WIN32
typedef FARPROC Function;
typedef HMODULE Module;
constexpr const char *pathSeparator = "\\";
#else
typedef void *Function;
typedef void *Module;
constexpr const char *pathSeparator = "/";
#endif
/// Generic function to convert from a Function(void* or FARPROC) to a function pointer.
/// This avoids undefined and conditionally defined behaviour.
template<typename T>
T FunctionPointer(Function function) noexcept {
static_assert(sizeof(T) == sizeof(function));
T fp {};
memcpy(&fp, &function, sizeof(T));
return fp;
}
#if _WIN32
std::wstring WideStringFromUTF8(std::string_view sv) {
const int sLength = static_cast<int>(sv.length());
const int cchWide = ::MultiByteToWideChar(CP_UTF8, 0, sv.data(), sLength, nullptr, 0);
std::wstring sWide(cchWide, 0);
::MultiByteToWideChar(CP_UTF8, 0, sv.data(), sLength, &sWide[0], cchWide);
return sWide;
}
#endif
std::string directoryLoadDefault;
std::string lastLoaded;
std::vector<Lexilla::CreateLexerFn> fnCLs;
std::vector<Lexilla::GetLibraryPropertyNamesFn> fnGLPNs;
std::vector<std::string> lexers;
std::vector<std::string> libraryProperties;
std::vector<Lexilla::SetLibraryPropertyFn> fnSLPs;
Function FindSymbol(Module m, const char *symbol) noexcept {
#if _WIN32
return ::GetProcAddress(m, symbol);
#else
return dlsym(m, symbol);
#endif
}
Lexilla::CreateLexerFn pCreateLexerDefault = nullptr;
bool NameContainsDot(std::string_view path) noexcept {
for (std::string_view::const_reverse_iterator it = path.crbegin();
it != path.crend(); ++it) {
if (*it == '.')
return true;
if (*it == '/' || *it == '\\')
return false;
}
return false;
}
}
void Lexilla::SetDefault(CreateLexerFn pCreate) noexcept {
pCreateLexerDefault = pCreate;
}
void Lexilla::SetDefaultDirectory(std::string_view directory) {
directoryLoadDefault = directory;
}
bool Lexilla::Load(std::string_view sharedLibraryPaths) {
if (sharedLibraryPaths == lastLoaded) {
return !fnCLs.empty();
}
std::string_view paths = sharedLibraryPaths;
lexers.clear();
fnCLs.clear();
fnGLPNs.clear();
fnSLPs.clear();
while (!paths.empty()) {
const size_t separator = paths.find_first_of(';');
std::string path(paths.substr(0, separator));
if (separator == std::string::npos) {
paths.remove_prefix(paths.size());
} else {
paths.remove_prefix(separator + 1);
}
if (path == ".") {
if (directoryLoadDefault.empty()) {
path = "";
} else {
path = directoryLoadDefault;
path += pathSeparator;
}
path += LEXILLA_LIB;
}
if (!NameContainsDot(path)) {
// No '.' in name so add extension
path.append(LEXILLA_EXTENSION);
}
#if _WIN32
// Convert from UTF-8 to wide characters
std::wstring wsPath = WideStringFromUTF8(path);
Module lexillaDL = ::LoadLibraryW(wsPath.c_str());
#else
Module lexillaDL = dlopen(path.c_str(), RTLD_LAZY);
#endif
if (lexillaDL) {
GetLexerCountFn fnLexerCount = FunctionPointer<GetLexerCountFn>(
FindSymbol(lexillaDL, LEXILLA_GETLEXERCOUNT));
GetLexerNameFn fnLexerName = FunctionPointer<GetLexerNameFn>(
FindSymbol(lexillaDL, LEXILLA_GETLEXERNAME));
if (fnLexerCount && fnLexerName) {
const int nLexers = fnLexerCount();
for (int i = 0; i < nLexers; i++) {
char name[100] = "";
fnLexerName(i, name, sizeof(name));
lexers.push_back(name);
}
}
CreateLexerFn fnCL = FunctionPointer<CreateLexerFn>(
FindSymbol(lexillaDL, LEXILLA_CREATELEXER));
if (fnCL) {
fnCLs.push_back(fnCL);
}
GetLibraryPropertyNamesFn fnGLPN = FunctionPointer<GetLibraryPropertyNamesFn>(
FindSymbol(lexillaDL, LEXILLA_GETLIBRARYPROPERTYNAMES));
if (fnGLPN) {
fnGLPNs.push_back(fnGLPN);
}
SetLibraryPropertyFn fnSLP = FunctionPointer<SetLibraryPropertyFn>(
FindSymbol(lexillaDL, LEXILLA_SETLIBRARYPROPERTY));
if (fnSLP) {
fnSLPs.push_back(fnSLP);
}
}
}
lastLoaded = sharedLibraryPaths;
std::set<std::string> nameSet;
for (GetLibraryPropertyNamesFn fnGLPN : fnGLPNs) {
const char *cpNames = fnGLPN();
if (cpNames) {
std::string_view names = cpNames;
while (!names.empty()) {
const size_t separator = names.find_first_of('\n');
std::string name(names.substr(0, separator));
nameSet.insert(name);
if (separator == std::string::npos) {
names.remove_prefix(names.size());
} else {
names.remove_prefix(separator + 1);
}
}
}
}
// Standard Lexilla does not have any properties so can't be added to set.
libraryProperties = std::vector<std::string>(nameSet.begin(), nameSet.end());
return !fnCLs.empty();
}
Scintilla::ILexer5 *Lexilla::MakeLexer(std::string_view languageName) {
std::string sLanguageName(languageName); // Ensure NUL-termination
for (CreateLexerFn fnCL : fnCLs) {
Scintilla::ILexer5 *pLexer = fnCL(sLanguageName.c_str());
if (pLexer) {
return pLexer;
}
}
if (pCreateLexerDefault) {
return pCreateLexerDefault(sLanguageName.c_str());
}
#ifdef LEXILLA_STATIC
Scintilla::ILexer5 *pLexer = CreateLexer(sLanguageName.c_str());
if (pLexer) {
return pLexer;
}
#endif
return nullptr;
}
std::vector<std::string> Lexilla::Lexers() {
return lexers;
}
std::vector<std::string> Lexilla::LibraryProperties() {
return libraryProperties;
}
void Lexilla::SetProperty(const char *key, const char *value) {
for (SetLibraryPropertyFn fnSLP : fnSLPs) {
fnSLP(key, value);
}
// Standard Lexilla does not have any properties so don't set.
}

View File

@ -0,0 +1,34 @@
// SciTE - Scintilla based Text Editor
/** @file LexillaAccess.h
** Interface to loadable lexers.
** This does not depend on SciTE code so can be copied out into other projects.
**/
// Copyright 2019 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef LEXILLACOLLECTION_H
#define LEXILLACOLLECTION_H
namespace Lexilla {
// Directory to load default Lexilla from, commonly the directory of the application.
void SetDefaultDirectory(std::string_view directory);
// Specify CreateLexer when statically linked so no hard dependency in LexillaAccess
// so it doesn't have to be built in two forms - static and dynamic.
void SetDefault(CreateLexerFn pCreate) noexcept;
// sharedLibraryPaths is a ';' separated list of shared libraries to load.
// On Win32 it is treated as UTF-8 and on Unix it is passed to dlopen directly.
// Return true if any shared libraries are loaded.
bool Load(std::string_view sharedLibraryPaths);
Scintilla::ILexer5 *MakeLexer(std::string_view languageName);
std::vector<std::string> Lexers();
std::vector<std::string> LibraryProperties();
void SetProperty(const char *key, const char *value);
}
#endif

9
lexilla/access/README Normal file
View File

@ -0,0 +1,9 @@
README for access directory.
LexillaAccess is a module that simplifies using multiple libraries that follow the Lexilla protocol.
It can be compiled into a Lexilla client application.
Applications with complex needs can copy the code and customise it to meet their requirements.
This module is not meant to be compiled into Lexilla.

148
lexilla/cppcheck.suppress Normal file
View File

@ -0,0 +1,148 @@
// File to suppress cppcheck warnings for files that will not be fixed.
// Does not suppress warnings where an additional occurrence of the warning may be of interest.
// Coding style is to use assignments in constructor when there are many
// members to initialize or the initialization is complex or has comments.
useInitializationList
// These may be interesting but its not clear without examining each instance closely
// Would have to ensure that any_of/all_of has same early/late exits as current code and
// produces same result on empty collections
useStlAlgorithm
// Some non-explicit constructors are used for conversions or are private to lexers
noExplicitConstructor
// The styler parameter is not const as LexAccessor::operator[] is not const
constParameter:lexilla/lexlib/StyleContext.cxx
// The performance cost of by-value passing is often small and using a reference decreases
// code legibility.
passedByValue
// Suppress most lexer warnings since the lexers are maintained by others
redundantCondition:lexilla/lexers/LexA68k.cxx
constParameter:lexilla/lexers/LexAbaqus.cxx
knownConditionTrueFalse:lexilla/lexers/LexAU3.cxx
shadowVariable:lexilla/lexers/LexAU3.cxx
constParameter:lexilla/lexers/LexBaan.cxx
unreadVariable:lexilla/lexers/LexBaan.cxx
constParameter:lexilla/lexers/LexBash.cxx
uninitMemberVar:lexilla/lexers/LexBash.cxx
variableScope:lexilla/lexers/LexBash.cxx
variableScope:lexilla/lexers/LexBatch.cxx
variableScope:lexilla/lexers/LexCmake.cxx
knownConditionTrueFalse:lexilla/lexers/LexCmake.cxx
constParameter:lexilla/lexers/LexCLW.cxx
constParameter:lexilla/lexers/LexCoffeeScript.cxx
constParameter:lexilla/lexers/LexCPP.cxx
variableScope:lexilla/lexers/LexCSS.cxx
variableScope:lexilla/lexers/LexDataflex.cxx
knownConditionTrueFalse:lexilla/lexers/LexECL.cxx
variableScope:lexilla/lexers/LexErlang.cxx
knownConditionTrueFalse:lexilla/lexers/LexEScript.cxx
constParameter:lexilla/lexers/LexFortran.cxx
constParameter:lexilla/lexers/LexFSharp.cxx
redundantCondition:lexilla/lexers/LexFSharp.cxx
knownConditionTrueFalse:lexilla/lexers/LexFSharp.cxx
variableScope:lexilla/lexers/LexGui4Cli.cxx
constParameter:lexilla/lexers/LexHaskell.cxx
constParameter:lexilla/lexers/LexHex.cxx
constParameter:lexilla/lexers/LexHTML.cxx
variableScope:lexilla/lexers/LexInno.cxx
variableScope:lexilla/lexers/LexLaTeX.cxx
constParameter:lexilla/lexers/LexLaTeX.cxx
constParameter:lexilla/lexers/LexLisp.cxx
constParameter:lexilla/lexers/LexMagik.cxx
constParameter:lexilla/lexers/LexMatlab.cxx
unreadVariable:lexilla/lexers/LexMatlab.cxx
variableScope:lexilla/lexers/LexMetapost.cxx
constParameter:lexilla/lexers/LexModula.cxx
variableScope:lexilla/lexers/LexModula.cxx
variableScope:lexilla/lexers/LexMSSQL.cxx
shadowArgument:lexilla/lexers/LexMySQL.cxx
constParameter:lexilla/lexers/LexNim.cxx
constParameter:lexilla/lexers/LexNimrod.cxx
variableScope:lexilla/lexers/LexNimrod.cxx
variableScope:lexilla/lexers/LexNsis.cxx
knownConditionTrueFalse:lexilla/lexers/LexNsis.cxx
variableScope:lexilla/lexers/LexOpal.cxx
knownConditionTrueFalse:lexilla/lexers/LexOpal.cxx
constParameter:lexilla/lexers/LexOScript.cxx
variableScope:lexilla/lexers/LexPB.cxx
constParameter:lexilla/lexers/LexPerl.cxx
constParameter:lexilla/lexers/LexPython.cxx
shadowVariable:lexilla/lexers/LexPowerPro.cxx
knownConditionTrueFalse:lexilla/lexers/LexPowerPro.cxx
variableScope:lexilla/lexers/LexProgress.cxx
constParameter:lexilla/lexers/LexRaku.cxx
variableScope:lexilla/lexers/LexRaku.cxx
redundantInitialization:lexilla/lexers/LexRegistry.cxx
constParameter:lexilla/lexers/LexRuby.cxx
variableScope:lexilla/lexers/LexRuby.cxx
uninitMemberVar:lexilla/lexers/LexRuby.cxx
constParameter:lexilla/lexers/LexRust.cxx
constParameter:lexilla/lexers/LexScriptol.cxx
variableScope:lexilla/lexers/LexSpecman.cxx
unreadVariable:lexilla/lexers/LexSpice.cxx
constParameter:lexilla/lexers/LexSTTXT.cxx
knownConditionTrueFalse:lexilla/lexers/LexTACL.cxx
clarifyCalculation:lexilla/lexers/LexTADS3.cxx
constParameter:lexilla/lexers/LexTADS3.cxx
invalidscanf:lexilla/lexers/LexTCMD.cxx
constParameter:lexilla/lexers/LexTeX.cxx
variableScope:lexilla/lexers/LexTeX.cxx
knownConditionTrueFalse:lexilla/lexers/LexTxt2tags.cxx
constParameter:lexilla/lexers/LexVerilog.cxx
knownConditionTrueFalse:lexilla/lexers/LexVerilog.cxx
constParameter:lexilla/lexers/LexVHDL.cxx
shadowVariable:lexilla/lexers/LexVHDL.cxx
unreadVariable:lexilla/lexers/LexVHDL.cxx
variableScope:lexilla/lexers/LexVHDL.cxx
unreadVariable:lexilla/lexers/LexVisualProlog.cxx
constParameter:lexilla/lexers/LexYAML.cxx
// These are due to Accessor::IndentAmount not declaring the callback as taking a const.
// Changing this could cause problems for downstream projects.
constParameterCallback:lexilla/lexers/LexAsn1.cxx
constParameterCallback:lexilla/lexers/LexEiffel.cxx
constParameterCallback:lexilla/lexers/LexPython.cxx
constParameterCallback:lexilla/lexers/LexScriptol.cxx
constParameterCallback:lexilla/lexers/LexVB.cxx
constVariable:lexilla/lexers/LexA68k.cxx
constVariable:lexilla/lexers/LexAsn1.cxx
constVariable:lexilla/lexers/LexCLW.cxx
constVariable:lexilla/lexers/LexCOBOL.cxx
constVariable:lexilla/lexers/LexCSS.cxx
constVariable:lexilla/lexers/LexCrontab.cxx
constVariable:lexilla/lexers/LexEScript.cxx
constVariable:lexilla/lexers/LexEiffel.cxx
constVariable:lexilla/lexers/LexForth.cxx
constVariable:lexilla/lexers/LexGui4Cli.cxx
constVariable:lexilla/lexers/LexKix.cxx
constVariable:lexilla/lexers/LexLout.cxx
constVariable:lexilla/lexers/LexMetapost.cxx
constVariable:lexilla/lexers/LexModula.cxx
constVariable:lexilla/lexers/LexOpal.cxx
constVariable:lexilla/lexers/LexPS.cxx
constVariable:lexilla/lexers/LexPascal.cxx
constVariable:lexilla/lexers/LexR.cxx
constVariable:lexilla/lexers/LexRebol.cxx
constVariable:lexilla/lexers/LexSorcus.cxx
constVariable:lexilla/lexers/LexStata.cxx
constVariable:lexilla/lexers/LexTACL.cxx
constVariable:lexilla/lexers/LexTADS3.cxx
constVariable:lexilla/lexers/LexTAL.cxx
// bp.itBracket not actually redundant as needed by return statements
redundantAssignment:lexilla/lexers/LexCPP.cxx
// Suppress everything in test example files
*:lexilla/test/examples/*
// Suppress everything in catch.hpp as won't be changing
*:lexilla/test/unit/catch.hpp
// For now, suppress all test source files as, since Catch 2, cppcheck shows many warnings showing
// it doesn't understand the REQUIRE macro
*:lexilla/test/unit/*.cxx

155
lexilla/doc/Lexilla.html Normal file
View File

@ -0,0 +1,155 @@
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20210305" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
background: url(https://www.scintilla.org/LexillaLogo.png) no-repeat;
background-image: image-set(
url(https://www.scintilla.org/LexillaLogo.png) 1x,
url(https://www.scintilla.org/LexillaLogo2x.png) 2x );
height:150px;
}
#versionlist {
margin: 0;
padding: .5em;
list-style-type: none;
color: #FFCC99;
background: #000000;
}
#versionlist li {
margin-bottom: .5em;
}
#menu {
margin: 0;
padding: .5em 0;
list-style-type: none;
font-size: larger;
background: #CCCCCC;
}
#menu li {
margin: 0;
padding: 0 .5em;
display: inline;
}
</style>
<script type="text/javascript">
function IsRemote() {
var loc = '' + window.location;
return (loc.indexOf('http:')) != -1 || (loc.indexOf('https:') != -1);
}
</script>
<title>
Lexilla
</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="256">
</td>
<td width="40%" align="left">
<font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3">Release version 5.0.0<br />
Site last modified March 5 2021</font>
</td>
<td width="20%">
&nbsp;
</td>
</tr>
</table>
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="100%" class="logo">
&nbsp;
</td>
</tr>
</table>
<ul id="versionlist">
<li>Version 5.0.0 is an unstable testing release.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
<li id="remote2"><a href="https://www.scintilla.org/LexillaDownload.html">Download</a></li>
<li><a href="https://www.scintilla.org/LexillaDoc.html">Documentation</a></li>
<li><a href="https://www.scintilla.org/ScintillaToDo.html">Bugs</a></li>
<li id="remote3"><a href="https://www.scintilla.org/SciTE.html">SciTE</a></li>
<li><a href="https://www.scintilla.org/ScintillaHistory.html">History</a></li>
<li><a href="https://www.scintilla.org/ScintillaRelated.html">Related</a></li>
<li id="remote4"><a href="https://www.scintilla.org/Privacy.html">Privacy</a></li>
</ul>
<script type="text/javascript" language="JavaScript"><!--
if (!IsRemote()) { //if NOT remote...
document.getElementById('remote1').style.display='none';
document.getElementById('remote2').style.display='none';
document.getElementById('remote3').style.display='none';
document.getElementById('remote4').style.display='none';
}
//--></script>
<p>
<a href="https://www.scintilla.org/LexillaDoc.html">Lexilla</a> is a free library of language
lexers that can be used with the <a href="https://www.scintilla.org/index.html">Scintilla</a>
editing component.
It comes with complete source code and a <a href="https://www.scintilla.org/License.txt">license</a> that
permits use in any free project or commercial product.
</p>
<p>
Originally, this functionality was incorporated inside Scintilla.
It has been extracted as a separate project to make it easier for contributors to work on
support for new languages and to fix bugs in existing lexers.
It also defines a protocol where projects can easily implement their own lexers and distribute
them as they wish.
</p>
<p>
Current development occurs on the default branch as 5.* which requires a recent
C++ compiler that supports C++17.
The testing framework uses some C++20 features but the basic library only uses C++17.
</p>
<p>
Lexilla is currently available for Intel Win32, OS X, and Linux compatible operating
systems. It has been run on Windows 10, OS X 10.13+, and on Ubuntu 20.04 but is likely
to run on earlier systems as it has no GUI functionality.
</p>
<p>
You can <a href="https://www.scintilla.org/LexillaDownload.html">download Lexilla.</a>
</p>
<p>
The source code can be downloaded via Git at GitHub
<a href="https://github.com/ScintillaOrg/lexilla">Lexilla project page</a>.<br />
git clone https://github.com/ScintillaOrg/lexilla
</p>
<p>
<a href="https://www.scintilla.org/ScintillaRelated.html">Related sites.</a>
</p>
<p>
<a href="https://www.scintilla.org/ScintillaToDo.html">Bugs and To Do list.</a>
</p>
<p>
<a href="https://www.scintilla.org/LexillaHistory.html">History and contribution credits.</a>
</p>
<p>
Questions and comments about Lexilla should be directed to the
<a href="https://groups.google.com/forum/#!forum/scintilla-interest">scintilla-interest</a>
mailing list,
which is for discussion of Scintilla and related projects, their bugs and future features.
This is a low traffic list, averaging less than 20 messages per week.
To avoid spam, only list members can write to the list.
New versions of Lexilla are announced on scintilla-interest.
Messages sent to my personal email address that could have been sent to the list
may receive no response.
<br />
</p>
</body>
</html>

238
lexilla/doc/LexillaDoc.html Normal file
View File

@ -0,0 +1,238 @@
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator"
content="HTML Tidy for Windows (vers 1st August 2002), see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Lexilla Documentation</title>
<style type="text/css">
<!--
/*<![CDATA[*/
CODE { font-weight: bold; font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A:visited { color: blue; }
A:hover { text-decoration: underline ! important; }
A.message { text-decoration: none; font-weight: bold; font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A.seealso { text-decoration: none; font-weight: bold; font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
A.toc { text-decoration: none; }
A.jump { text-decoration: none; }
LI.message { text-decoration: none; font-weight: bold; font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
H2 { background: #E0EAFF; }
table {
border: 0px;
border-collapse: collapse;
}
div.console {
font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;
color: #008000;
font-weight: bold;
background: #F7FCF7;
border: 1px solid #C0D7C0;
margin: 0.3em 3em;
padding: 0.3em 0.6em;
}
span.console {
font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace;
color: #008000;
font-weight: bold;
background: #F7FCF7;
border: 1px solid #C0D7C0;
margin: 0.1em 0em;
padding: 0.1em 0.3em;
}
.name {
color: #B08000;
}
/*]]>*/
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0"
summary="Banner">
<tr>
<td><img src="SciTEIco.png" border="3" height="64" width="64" alt="Lexilla icon" /></td>
<td><a href="index.html"
style="color:white;text-decoration:none;font-size:200%">Lexilla</a></td>
</tr>
</table>
<h1>Lexilla Documentation</h1>
<p>Last edited 5 March 2021 NH</p>
<h2>Introduction</h2>
<p>Lexilla is a library containing lexers for use with Scintilla. It can be either a static library
that is linked into an application or a shared library that is loaded at runtime.</p>
<p>Lexilla does not interact with the display so there is no need to compile it for a
particular GUI toolkit. Therefore there can be a common library shared by applications using
different GUI toolkits. In some circumstances there may need to be both 32-bit and 64-bit versions
on one system to match different applications.</p>
<p>Different extensions are commonly used for shared libraries: .so on Linux, .dylib on macOS, and .DLL on Windows.
</p>
<h2>The Lexilla protocol</h2>
<p>A set of functions is defined by Lexilla for use by applications. Libraries that provide these functions
can be used as a replacement for Lexilla or to add new lexers beyond those provided by Lexilla.</p>
<p>The Lexilla protocol is a superset of the external lexer protocol and defines these functions that may be exported from a shared library:<br />
<code>int <span class="name">GetLexerCount</span>()</code><br />
<code>void <span class="name">GetLexerName</span>(unsigned int index, char *name, int buflength)</code><br />
<code>LexerFactoryFunction <span class="name">GetLexerFactory</span>(unsigned int index)</code><br />
<code>ILexer5 *<span class="name">CreateLexer</span>(const char *name)</code><br />
<code>void <span class="name">SetLibraryProperty</span>(const char *key, const char *value)</code><br />
<code>const char *<span class="name">GetLibraryPropertyNames</span>()</code>
</p>
<p><span class="name">ILexer5</span> is defined by Scintilla in include/ILexer.h as the interface provided by lexers which is called by Scintilla.
Many clients do not actually need to call methods on <span class="name">ILexer5</span> - they just take the return from CreateLexer and plug it
straight into Scintilla so it can be treated as a machine pointer (void *).
</p>
<p><span class="name">LexerFactoryFunction</span> is defined as a function that takes no arguments and returns an <span class="name">ILexer5</span> *:
<code>ILexer5 *(*LexerFactoryFunction)()</code> but this can be ignored by most client code.
</p>
<p>The Lexilla protocol is a superset of the earlier external lexer protocol that defined the first 3 functions
(<span class="name">GetLexerCount</span>, <span class="name">GetLexerName</span>, <span class="name">GetLexerFactory</span>)
so Lexilla be loaded by applications that support that protocol.
<span class="name">GetLexerFactory</span> will rarely be used now as it is easier to call <span class="name">CreateLexer</span>.
</p>
<p><span class="name">CreateLexer</span> is the main call that will create a lexer for a particular language. The returned lexer can then be
set as the current lexer in Scintilla by calling
<a class="seealso" href="ScintillaDoc.html#SCI_SETILEXER">SCI_SETILEXER</a>.</p>
<p><span class="name">SetLibraryProperty</span> and <span class="name">GetLibraryPropertyNames</span>
are optional functions that can be
defined if a library requires initialisation before calling other methods.
For example, a lexer library that reads language definitions from XML files may require that the
directory containing these files be set before a call to CreateLexer.
<code>SetLibraryProperty("definitions.directory", "/usr/share/xeditor/language-definitions")</code>
If a library implements SetLibraryProperty then it may also provide a set of valid property names with
GetLibraryPropertyNames that can then be used by the application to define configuration file property
names or user interface elements for options dialogs.</p>
<h2>Building Lexilla</h2>
<p>Before using Lexilla it must be built or downloaded.</p>
<div>To build Lexilla, in the lexilla/src directory, run make (for gcc or clang)</div>
<div class="console">make</div>
<div>or nmake for MSVC</div>
<div class="console">nmake -f lexilla.mak</div>
<br />
<div>After building Lexilla, its test suite can be run with make/nmake in the lexilla/test directory. For gcc or clang</div>
<div class="console">make test</div>
or for MSVC<br />
<div class="console">nmake -f testlexers.mak test</div>
<div>Each test case should show "<code>Lexing ...</code>" and errors will display a diagnostic, commonly showing
a difference between the actual and expected result:<br>
<code>C:\u\hg\lexilla\test\examples\python\x.py:1: is different</code>
</div>
<p>There are also RunTest.sh / RunTest.bat scripts in the scripts directory to build Lexilla and then build and run the tests.
These both use gcc/clang, not MSVC.</p>
<p>There are Microsoft Visual C++ and Xcode projects that can be used to build Lexilla.
For Visual C++: src/Lexilla.vcxproj. For Xcode: src/Lexilla/Lexilla.xcodeproj.
There is also test/TestLexers.vcxproj to build the tests with Visual C++.</p>
<h2>Using Lexilla</h2>
<p>Definitions for using Lexilla from C and C++ are included in lexilla/include/Lexilla.h.
For C++, scintilla/include/ILexer.h should be included before Lexilla.h as the
<code>ILexer5</code> type is used.
For C, ILexer.h should not be included as C does not understand it and from C,
<code>void*</code> is used instead of <code>ILexer5*</code>.
</p>
<p>For many applications the main Lexilla operations are loading the Lexilla library, creating a
lexer and using that lexer in Scintilla.
Applications need to define the location (or locations) they expect
to find Lexilla or libraries that support the Lexilla protocol.
They also need to define how they request particular lexers, perhaps with a mapping from
file extensions to lexer names.</p>
<h3 id="CheckLexilla">From C - CheckLexilla</h3>
<p>An example C program for accessing Lexilla is provided in lexilla/examples/CheckLexilla.
Build with <span class="console">make</span> and run with <span class="console">make check</span>.
</p>
<h3>From C++ - LexillaAccess</h3>
<p>A C++ module, LexillaAccess.cxx / LexillaAccess.h is provided in lexilla/access.
This can either be compiled into the application when it is sufficient
or the source code can be copied into the application and customized when the application has additional requirements
(such as checking code signatures).
SciTE uses LexillaAccess.</p>
<p>LexillaAccess supports loading multiple shared libraries implementing the Lexilla protocol at one time.</p>
<h3>From Qt</h3>
<p>For Qt, use either LexillaAccess from above or Qt's QLibrary class. With 'Call' defined to call Scintilla APIs.<br />
<code>
#if _WIN32<br />
&nbsp;&nbsp;&nbsp;&nbsp;typedef void *(__stdcall *CreateLexerFn)(const char *name);<br />
#else<br />
&nbsp;&nbsp;&nbsp;&nbsp;typedef void *(*CreateLexerFn)(const char *name);<br />
#endif<br />
&nbsp;&nbsp;&nbsp;&nbsp;QFunctionPointer fn = QLibrary::resolve("lexilla", "CreateLexer");<br />
&nbsp;&nbsp;&nbsp;&nbsp;void *lexCpp = ((CreateLexerFn)fn)("cpp");<br />
&nbsp;&nbsp;&nbsp;&nbsp;Call(SCI_SETILEXER, 0, (sptr_t)(void *)lexCpp);<br />
</code></p>
<p>Applications may discover the set of lexers provided by a library by first calling
<span class="name">GetLexerCount</span> to find the number of lexers implemented in the library then looping over calling
<span class="name">GetLexerName</span> with integers 0 to <code>GetLexerCount()-1</code>.</p>
<p>Applications may set properties on a library by calling <span class="name">SetLibraryProperty</span> if provided.
This may be needed for initialisation so should before calling <span class="name">GetLexerCount</span> or <span class="name">CreateLexer</span>.
A set of property names may be available from <span class="name">GetLibraryPropertyNames</span> if provided.
It returns a string pointer where the string contains a list of property names separated by '\n'.
It is up to applications to define how properties are defined and persisted in its user interface
and configuration files.</p>
<h2>Modifying or adding lexers</h2>
<p>Lexilla can be modified or a new library created that can be used to replace or augment Lexilla.</p>
<p>Lexer libraries that provide the same functions as Lexilla may provide lexers for use by Scintilla,
augmenting or replacing those provided by Lexilla.
To allow initialisation of lexer libraries, a <code>SetLibraryProperty(const char *key, const char *value)</code>
may optionally be implemented. For example, a lexer library that uses XML based lexer definitions may
be provided with a directory to search for such definitions.
Lexer libraries should ignore any properties that they do not understand.
The set of properties supported by a lexer library is specified as a '\n' separated list of property names by
an optional <code>const char *GetLibraryPropertyNames()</code> function.
</p>
<p>Lexilla and its contained lexers can be tested with the TestLexers program in lexilla/test.
Read lexilla/test/README for information on building and using TestLexers.</p>
<p>An example of a simple lexer housed in a shared library that is compatible with the
Lexilla protocol can be found in lexilla/examples/SimpleLexer. It is implemented in C++.
Build with <span class="console">make</span> and check by running <a href="#CheckLexilla">CheckLexilla</a> against it with
<span class="console">make check</span>.
</p>
</body>
</html>

View File

@ -0,0 +1,71 @@
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Download Lexilla
</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<img src="SciTEIco.png" border="3" height="64" width="64" alt="Scintilla icon" />
</td>
<td>
<a href="index.html" style="color:white;text-decoration:none"><font size="5">Download
Lexilla</font></a>
</td>
</tr>
</table>
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="https://www.scintilla.org/lexilla500.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla500.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
</tr>
</table>
<h2>
Download.
</h2>
<p>
The <a href="License.txt">license</a> for using Lexilla is similar to that of Python
containing very few restrictions.
</p>
<h3>
Release 4.4.6
</h3>
<h4>
Source Code
</h4>
The source code package contains all of the source code for Lexilla but no binary
executable code and is available in
<ul>
<li><a href="https://www.scintilla.org/lexilla500.zip">zip format</a> (1.0M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla500.tgz">tgz format</a> (0.8M) commonly used on Linux and compatible operating systems</li>
</ul>
Instructions for building on both Windows and Linux are included in the readme file.
<h4>
Windows Executable Code
</h4>
There is no download available containing only the Lexilla DLL.
However, it is included in the <a href="SciTEDownload.html">SciTE
executable full download</a> as Lexilla.DLL.
<p>
<a href="SciTEDownload.html">SciTE</a> is a good demonstration of Lexilla.
</p>
<p>
Previous versions can be downloaded from the <a href="LexillaHistory.html">history
page</a>.
</p>
</body>
</html>

File diff suppressed because it is too large Load Diff

BIN
lexilla/doc/LexillaLogo.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 44 KiB

File diff suppressed because it is too large Load Diff

75
lexilla/include/Lexilla.h Normal file
View File

@ -0,0 +1,75 @@
// Lexilla lexer library
/** @file Lexilla.h
** Lexilla definitions for dynamic and static linking.
** For C++, more features and type safety are available with the LexillaAccess module.
**/
// Copyright 2020 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Define the default Lexilla shared library name for each platform
#if _WIN32
#define LEXILLA_LIB "lexilla"
#define LEXILLA_EXTENSION ".dll"
#else
#define LEXILLA_LIB "liblexilla"
#if defined(__APPLE__)
#define LEXILLA_EXTENSION ".dylib"
#else
#define LEXILLA_EXTENSION ".so"
#endif
#endif
// On Win32 use the stdcall calling convention otherwise use the standard calling convention
#if _WIN32
#define LEXILLA_CALL __stdcall
#else
#define LEXILLA_CALL
#endif
#ifdef __cplusplus
// Must have already included ILexer.h to have Scintilla::ILexer5 defined.
using Scintilla::ILexer5;
#else
typedef void ILexer5;
#endif
typedef ILexer5 *(*LexerFactoryFunction)();
#ifdef __cplusplus
namespace Lexilla {
#endif
typedef int (LEXILLA_CALL *GetLexerCountFn)();
typedef void (LEXILLA_CALL *GetLexerNameFn)(unsigned int Index, char *name, int buflength);
typedef LexerFactoryFunction(LEXILLA_CALL *GetLexerFactoryFn)(unsigned int Index);
typedef ILexer5*(LEXILLA_CALL *CreateLexerFn)(const char *name);
typedef const char *(LEXILLA_CALL *GetLibraryPropertyNamesFn)();
typedef void(LEXILLA_CALL *SetLibraryPropertyFn)(const char *key, const char *value);
#ifdef __cplusplus
}
#endif
#define LEXILLA_GETLEXERCOUNT "GetLexerCount"
#define LEXILLA_GETLEXERNAME "GetLexerName"
#define LEXILLA_GETLEXERFACTORY "GetLexerFactory"
#define LEXILLA_CREATELEXER "CreateLexer"
#define LEXILLA_GETLIBRARYPROPERTYNAMES "GetLibraryPropertyNames"
#define LEXILLA_SETLIBRARYPROPERTY "SetLibraryProperty"
// Static linking prototypes
#ifdef __cplusplus
extern "C" {
#endif
ILexer5 * LEXILLA_CALL CreateLexer(const char *name);
int LEXILLA_CALL GetLexerCount();
void LEXILLA_CALL GetLexerName(unsigned int index, char *name, int buflength);
LexerFactoryFunction LEXILLA_CALL GetLexerFactory(unsigned int index);
const char * LEXILLA_CALL GetLibraryPropertyNames();
void LEXILLA_CALL SetLibraryProperty(const char *key, const char *value);
#ifdef __cplusplus
}
#endif

View File

@ -144,6 +144,7 @@
#define SCLEX_DATAFLEX 129
#define SCLEX_HOLLYWOOD 130
#define SCLEX_RAKU 131
#define SCLEX_FSHARP 132
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@ -1959,6 +1960,26 @@
#define SCE_RAKU_CALLABLE 26
#define SCE_RAKU_GRAMMAR 27
#define SCE_RAKU_CLASS 28
#define SCE_FSHARP_DEFAULT 0
#define SCE_FSHARP_KEYWORD 1
#define SCE_FSHARP_KEYWORD2 2
#define SCE_FSHARP_KEYWORD3 3
#define SCE_FSHARP_KEYWORD4 4
#define SCE_FSHARP_KEYWORD5 5
#define SCE_FSHARP_IDENTIFIER 6
#define SCE_FSHARP_QUOT_IDENTIFIER 7
#define SCE_FSHARP_COMMENT 8
#define SCE_FSHARP_COMMENTLINE 9
#define SCE_FSHARP_PREPROCESSOR 10
#define SCE_FSHARP_LINENUM 11
#define SCE_FSHARP_OPERATOR 12
#define SCE_FSHARP_NUMBER 13
#define SCE_FSHARP_CHARACTER 14
#define SCE_FSHARP_STRING 15
#define SCE_FSHARP_VERBATIM 16
#define SCE_FSHARP_QUOTATION 17
#define SCE_FSHARP_ATTRIBUTE 18
#define SCE_FSHARP_FORMAT_SPEC 19
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif

View File

@ -0,0 +1,105 @@
// Define the standard order in which to include header files
// All platform headers should be included before Scintilla headers
// and each of these groups are then divided into directory groups.
// Base of the repository relative to this file
//base:..
// File patterns to check:
//source:include/*.h
//source:src/*.cxx
//source:lexlib/*.cxx
//source:lexers/*.cxx
//source:access/*.cxx
//source:test/*.cxx
//source:test/unit/*.cxx
// Exclude LexCaml.cxx as it tries to build both as a normal and external lexer
// uses Windows.h and a no-longer-present Scintilla header.
//exclude:LexCaml.cxx
// C standard library
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
// C++ wrappers of C standard library
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cctype>
#include <cstdio>
#include <cstdarg>
// C++ standard library
#include <utility>
#include <string>
#include <string_view>
#include <vector>
#include <map>
#include <set>
#include <algorithm>
#include <iterator>
#include <functional>
#include <memory>
#include <iostream>
#include <sstream>
#include <fstream>
#include <filesystem>
// POSIX
#include <dlfcn.h>
// Windows header needed for loading DLL
#include <windows.h>
// Scintilla/Lexilla headers
// Non-platform-specific headers
// Scintilla include
#include "Sci_Position.h"
#include "ILexer.h"
#include "Scintilla.h"
// Lexilla include
#include "SciLexer.h"
#include "Lexilla.h"
// access
#include "LexillaAccess.h"
// lexlib
#include "StringCopy.h"
#include "PropSetSimple.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "CharacterCategory.h"
#include "LexerModule.h"
#include "CatalogueModules.h"
#include "OptionSet.h"
#include "SparseState.h"
#include "SubStyles.h"
#include "DefaultLexer.h"
#include "LexerBase.h"
#include "LexerSimple.h"
#include "LexerNoExceptions.h"
// src
#include "TestDocument.h"
// Catch testing framework
#include "catch.hpp"

View File

@ -0,0 +1,30 @@
#!/usr/bin/env python3
# LexFacer.py - regenerate the SciLexer.h files from the Scintilla.iface interface
# definition file.
# Implemented 2000 by Neil Hodgson neilh@scintilla.org
# Requires Python 3.6 or later
import os, pathlib, sys
sys.path.append(os.path.join("..", "..", "scintilla", "scripts"))
import Face
from FileGenerator import UpdateFile, Generate, Regenerate, UpdateLineInFile, lineEnd
def printLexHFile(f):
out = []
for name in f.order:
v = f.features[name]
if v["FeatureType"] in ["val"]:
if "SCE_" in name or "SCLEX_" in name:
out.append("#define " + name + " " + v["Value"])
return out
def RegenerateAll(root, showMaxID):
f = Face.Face()
f.ReadFromFile(root / "include/LexicalStyles.iface")
Regenerate(root / "include/SciLexer.h", "/* ", printLexHFile(f))
if __name__ == "__main__":
RegenerateAll(pathlib.Path(__file__).resolve().parent.parent, True)

View File

@ -0,0 +1,272 @@
#!/usr/bin/env python3
# ScintillaData.py - implemented 2013 by Neil Hodgson neilh@scintilla.org
# Released to the public domain.
# Common code used by Scintilla and SciTE for source file regeneration.
# The ScintillaData object exposes information about Scintilla as properties:
# Version properties
# version
# versionDotted
# versionCommad
#
# Date last modified
# dateModified
# yearModified
# mdyModified
# dmyModified
# myModified
#
# Information about lexers and properties defined in lexers
# lexFiles
# sorted list of lexer files
# lexerModules
# sorted list of module names
# lexerProperties
# sorted list of lexer properties
# propertyDocuments
# dictionary of property documentation { name: document string }
# sclexFromName
# dictionary of SCLEX_* IDs { name: SCLEX_ID }
# fileFromSclex
# dictionary of file names { SCLEX_ID: file name }
# This file can be run to see the data it provides.
# Requires Python 3.6 or later
import datetime, pathlib, sys, textwrap
thisPath = pathlib.Path(__file__).resolve()
sys.path.append(str(thisPath.parent.parent.parent / "scintilla" / "scripts"))
import FileGenerator
def FindModules(lexFile):
modules = []
partLine = ""
with lexFile.open() as f:
for l in f.readlines():
l = l.rstrip()
if partLine or l.startswith("LexerModule"):
if ")" in l:
l = partLine + l
l = l.replace("(", " ")
l = l.replace(")", " ")
l = l.replace(",", " ")
parts = l.split()
modules.append([parts[1], parts[2], parts[4][1:-1]])
partLine = ""
else:
partLine = partLine + l
return modules
def FindLexersInXcode(xCodeProject):
lines = FileGenerator.ReadFileAsList(xCodeProject)
uidsOfBuild = {}
markersPBXBuildFile = ["Begin PBXBuildFile section", "", "End PBXBuildFile section"]
for buildLine in lines[FileGenerator.FindSectionInList(lines, markersPBXBuildFile)]:
# Occurs for each file in the build. Find the UIDs used for the file.
#\t\t[0-9A-F]+ /* [a-zA-Z]+.cxx in sources */ = {isa = PBXBuildFile; fileRef = [0-9A-F]+ /* [a-zA-Z]+ */; };
pieces = buildLine.split()
uid1 = pieces[0]
filename = pieces[2].split(".")[0]
uid2 = pieces[12]
uidsOfBuild[filename] = [uid1, uid2]
lexers = {}
markersLexers = ["/* Lexers */ =", "children", ");"]
for lexerLine in lines[FileGenerator.FindSectionInList(lines, markersLexers)]:
#\t\t\t\t[0-9A-F]+ /* [a-zA-Z]+.cxx */,
uid, _, rest = lexerLine.partition("/* ")
uid = uid.strip()
lexer, _, _ = rest.partition(".")
lexers[lexer] = uidsOfBuild[lexer]
return lexers
# Properties that start with lexer. or fold. are automatically found but there are some
# older properties that don't follow this pattern so must be explicitly listed.
knownIrregularProperties = [
"fold",
"styling.within.preprocessor",
"tab.timmy.whinge.level",
"asp.default.language",
"html.tags.case.sensitive",
"ps.level",
"ps.tokenize",
"sql.backslash.escapes",
"nsis.uservars",
"nsis.ignorecase"
]
def FindProperties(lexFile):
properties = {}
with open(lexFile) as f:
for l in f.readlines():
if ("GetProperty" in l or "DefineProperty" in l) and "\"" in l:
l = l.strip()
if not l.startswith("//"): # Drop comments
propertyName = l.split("\"")[1]
if propertyName.lower() == propertyName:
# Only allow lower case property names
if propertyName in knownIrregularProperties or \
propertyName.startswith("fold.") or \
propertyName.startswith("lexer."):
properties[propertyName] = 1
return properties
def FindPropertyDocumentation(lexFile):
documents = {}
with lexFile.open() as f:
name = ""
for l in f.readlines():
l = l.strip()
if "// property " in l:
propertyName = l.split()[2]
if propertyName.lower() == propertyName:
# Only allow lower case property names
name = propertyName
documents[name] = ""
elif "DefineProperty" in l and "\"" in l:
propertyName = l.split("\"")[1]
if propertyName.lower() == propertyName:
# Only allow lower case property names
name = propertyName
documents[name] = ""
elif name:
if l.startswith("//"):
if documents[name]:
documents[name] += " "
documents[name] += l[2:].strip()
elif l.startswith("\""):
l = l[1:].strip()
if l.endswith(";"):
l = l[:-1].strip()
if l.endswith(")"):
l = l[:-1].strip()
if l.endswith("\""):
l = l[:-1]
# Fix escaped double quotes
l = l.replace("\\\"", "\"")
documents[name] += l
else:
name = ""
for name in list(documents.keys()):
if documents[name] == "":
del documents[name]
return documents
def FindCredits(historyFile):
credits = []
stage = 0
with historyFile.open(encoding="utf-8") as f:
for l in f.readlines():
l = l.strip()
if stage == 0 and l == "<table>":
stage = 1
elif stage == 1 and l == "</table>":
stage = 2
if stage == 1 and l.startswith("<td>"):
credit = l[4:-5]
if "<a" in l:
title, a, rest = credit.partition("<a href=")
urlplus, bracket, end = rest.partition(">")
name = end.split("<")[0]
url = urlplus[1:-1]
credit = title.strip()
if credit:
credit += " "
credit += name + " " + url
credits.append(credit)
return credits
def ciKey(a):
return str(a).lower()
def SortListInsensitive(l):
l.sort(key=ciKey)
class LexillaData:
def __init__(self, scintillaRoot):
# Discover version information
self.version = (scintillaRoot / "version.txt").read_text().strip()
self.versionDotted = self.version[0] + '.' + self.version[1] + '.' + \
self.version[2]
self.versionCommad = self.versionDotted.replace(".", ", ") + ', 0'
with (scintillaRoot / "doc" / "Lexilla.html").open() as f:
self.dateModified = [l for l in f.readlines() if "Date.Modified" in l]\
[0].split('\"')[3]
# 20130602
# Lexilla.html
dtModified = datetime.datetime.strptime(self.dateModified, "%Y%m%d")
self.yearModified = self.dateModified[0:4]
monthModified = dtModified.strftime("%B")
dayModified = "%d" % dtModified.day
self.mdyModified = monthModified + " " + dayModified + " " + self.yearModified
# May 22 2013
# Lexilla.html, SciTE.html
self.dmyModified = dayModified + " " + monthModified + " " + self.yearModified
# 22 May 2013
# LexillaHistory.html -- only first should change
self.myModified = monthModified + " " + self.yearModified
# Find all the lexer source code files
lexFilePaths = list((scintillaRoot / "lexers").glob("Lex*.cxx"))
SortListInsensitive(lexFilePaths)
self.lexFiles = [f.stem for f in lexFilePaths]
self.lexerModules = []
lexerProperties = set()
self.propertyDocuments = {}
self.sclexFromName = {}
self.fileFromSclex = {}
for lexFile in lexFilePaths:
modules = FindModules(lexFile)
for module in modules:
self.sclexFromName[module[2]] = module[1]
self.fileFromSclex[module[1]] = lexFile
self.lexerModules.append(module[0])
for k in FindProperties(lexFile).keys():
lexerProperties.add(k)
documents = FindPropertyDocumentation(lexFile)
for k in documents.keys():
if k not in self.propertyDocuments:
self.propertyDocuments[k] = documents[k]
SortListInsensitive(self.lexerModules)
self.lexerProperties = list(lexerProperties)
SortListInsensitive(self.lexerProperties)
self.lexersXcode = FindLexersInXcode(scintillaRoot /
"src/Lexilla/Lexilla.xcodeproj/project.pbxproj")
self.credits = FindCredits(scintillaRoot / "doc" / "LexillaHistory.html")
def printWrapped(text):
print(textwrap.fill(text, subsequent_indent=" "))
if __name__=="__main__":
sci = LexillaData(pathlib.Path(__file__).resolve().parent.parent)
print("Version %s %s %s" % (sci.version, sci.versionDotted, sci.versionCommad))
print("Date last modified %s %s %s %s %s" % (
sci.dateModified, sci.yearModified, sci.mdyModified, sci.dmyModified, sci.myModified))
printWrapped(str(len(sci.lexFiles)) + " lexer files: " + ", ".join(sci.lexFiles))
printWrapped(str(len(sci.lexerModules)) + " lexer modules: " + ", ".join(sci.lexerModules))
#~ printWrapped(str(len(sci.lexersXcode)) + " Xcode lexer references: " + ", ".join(
#~ [lex+":"+uids[0]+","+uids[1] for lex, uids in sci.lexersXcode.items()]))
print("Lexer name to ID:")
lexNames = sorted(sci.sclexFromName.keys())
for lexName in lexNames:
sclex = sci.sclexFromName[lexName]
fileName = sci.fileFromSclex[sclex].name
print(" " + lexName + " -> " + sclex + " in " + fileName)
printWrapped("Lexer properties: " + ", ".join(sci.lexerProperties))
print("Lexer property documentation:")
documentProperties = list(sci.propertyDocuments.keys())
SortListInsensitive(documentProperties)
for k in documentProperties:
print(" " + k)
print(textwrap.fill(sci.propertyDocuments[k], initial_indent=" ",
subsequent_indent=" "))
print("Credits:")
for c in sci.credits:
sys.stdout.buffer.write(b" " + c.encode("utf-8") + b"\n")

View File

@ -12,12 +12,13 @@ import os, pathlib, sys, uuid
thisPath = pathlib.Path(__file__).resolve()
sys.path.append(str(thisPath.parent.parent.parent / "scripts"))
sys.path.append(str(thisPath.parent.parent.parent / "scintilla" / "scripts"))
from FileGenerator import Regenerate, UpdateLineInFile, \
ReplaceREInFile, UpdateLineInPlistFile, ReadFileAsList, UpdateFileFromLines, \
FindSectionInList
import ScintillaData
import LexillaData
import LexFacer
sys.path.append(str(thisPath.parent.parent / "src"))
import DepGen
@ -91,15 +92,16 @@ def RegenerateAll(rootDirectory):
root = pathlib.Path(rootDirectory)
scintillaBase = root.resolve()
lexillaBase = root.resolve()
sci = ScintillaData.ScintillaData(scintillaBase)
lex = LexillaData.LexillaData(lexillaBase)
lexillaDir = scintillaBase / "lexilla"
lexillaDir = lexillaBase
srcDir = lexillaDir / "src"
docDir = lexillaDir / "doc"
Regenerate(srcDir / "Lexilla.cxx", "//", sci.lexerModules)
Regenerate(srcDir / "lexilla.mak", "#", sci.lexFiles)
Regenerate(srcDir / "Lexilla.cxx", "//", lex.lexerModules)
Regenerate(srcDir / "lexilla.mak", "#", lex.lexFiles)
# Discover version information
version = (lexillaDir / "version.txt").read_text().strip()
@ -111,11 +113,26 @@ def RegenerateAll(rootDirectory):
"#define VERSION_LEXILLA \"" + versionDotted + "\"")
UpdateLineInFile(rcPath, "#define VERSION_WORDS",
"#define VERSION_WORDS " + versionCommad)
ReplaceREInFile(docDir / "LexillaDownload.html",
r"/www.scintilla.org/([a-zA-Z]+)\d\d\d",
r"/www.scintilla.org/\g<1>" + version)
pathMain = lexillaDir / "doc" / "Lexilla.html"
UpdateLineInFile(pathMain,
' <font color="#FFCC99" size="3"> Release version',
' <font color="#FFCC99" size="3"> Release version ' + \
versionDotted + '<br />')
UpdateLineInFile(pathMain,
' Site last modified',
' Site last modified ' + lex.mdyModified + '</font>')
UpdateLineInFile(pathMain,
' <meta name="Date.Modified"',
' <meta name="Date.Modified" content="' + lex.dateModified + '" />')
lexillaXcode = lexillaDir / "src" / "Lexilla"
lexillaXcodeProject = lexillaXcode / "Lexilla.xcodeproj" / "project.pbxproj"
lexerReferences = ScintillaData.FindLexersInXcode(lexillaXcodeProject)
lexerReferences = LexillaData.FindLexersInXcode(lexillaXcodeProject)
UpdateLineInPlistFile(lexillaXcode / "Info.plist",
"CFBundleShortVersionString", versionDotted)
@ -123,7 +140,9 @@ def RegenerateAll(rootDirectory):
ReplaceREInFile(lexillaXcodeProject, "CURRENT_PROJECT_VERSION = [0-9.]+;",
f'CURRENT_PROJECT_VERSION = {versionDotted};')
RegenerateXcodeProject(lexillaXcodeProject, sci.lexFiles, lexerReferences)
RegenerateXcodeProject(lexillaXcodeProject, lex.lexFiles, lexerReferences)
LexFacer.RegenerateAll(root, False)
currentDirectory = pathlib.Path.cwd()
os.chdir(srcDir)
@ -131,4 +150,4 @@ def RegenerateAll(rootDirectory):
os.chdir(currentDirectory)
if __name__=="__main__":
RegenerateAll(pathlib.Path(__file__).resolve().parent.parent.parent)
RegenerateAll(pathlib.Path(__file__).resolve().parent.parent)

Some files were not shown because too many files have changed in this diff Show More