Repository: ruben2020/codequery Branch: master Commit: 3f5fa3156507 Files: 1148 Total size: 12.1 MB Directory structure: gitextract_stnjarzb/ ├── .github/ │ └── workflows/ │ └── cmake.yml ├── .gitignore ├── CMakeLists.txt ├── LICENSE.md ├── NEWS.md ├── README.md ├── THIRDPARTY.md ├── cli/ │ ├── CMakeLists.txt │ ├── README.md │ └── main_cli.cpp ├── cmakefind/ │ └── FindSqlite.cmake ├── doc/ │ ├── HOWTO-LINUX.md │ ├── INSTALL-LINUX.md │ └── workflow.dia ├── gui/ │ ├── CMakeLists.txt │ ├── aboutdialog.cpp │ ├── aboutdialog.h │ ├── cqimages.qrc │ ├── cqtrans.qrc.template │ ├── cqwin32.rc │ ├── cqwin64.rc │ ├── fileviewer.cpp │ ├── fileviewer.h │ ├── fileviewsettingsdialog.cpp │ ├── fileviewsettingsdialog.h │ ├── graphdialog.cpp │ ├── graphdialog.h │ ├── images/ │ │ └── axialisReadMe.txt │ ├── langtable.cpp │ ├── langtable.h │ ├── listhandler.cpp │ ├── listhandler.h │ ├── main_gui.cpp │ ├── mainwindow.cpp │ ├── mainwindow.h │ ├── searchhandler.cpp │ ├── searchhandler.h │ ├── themes/ │ │ ├── Bespin.xml │ │ ├── Black_board.xml │ │ ├── Choco.xml │ │ ├── Deep_Black.xml │ │ ├── Eclipse_Default.xml │ │ ├── Hello_Kitty.xml │ │ ├── HotFudgeSundae.xml │ │ ├── Mono_Industrial.xml │ │ ├── Monokai.xml │ │ ├── MossyLawn.xml │ │ ├── Navajo.xml │ │ ├── NotepadPlusPlus.xml │ │ ├── Obsidian.xml │ │ ├── Plastic_Code_Wrap.xml │ │ ├── Ruby_Blue.xml │ │ ├── Solarized.xml │ │ ├── Solarized_light.xml │ │ ├── Twilight.xml │ │ ├── Vibrant_Ink.xml │ │ ├── Zenburn.xml │ │ ├── khaki.xml │ │ ├── parse_themes.pl │ │ └── vim_Dark_Blue.xml │ ├── themes.cpp │ ├── themes.h │ ├── themes_gen.cpp │ ├── translations/ │ │ ├── codequery_de.ts │ │ ├── codequery_en.ts │ │ ├── codequery_es.ts │ │ ├── codequery_fr.ts │ │ ├── codequery_id.ts │ │ ├── codequery_it.ts │ │ ├── codequery_ja.ts │ │ ├── codequery_ko.ts │ │ ├── codequery_zh-CHS.ts │ │ ├── codequery_zh-CHT.ts │ │ ├── dolupdate.pl │ │ ├── dowebtranslate.pl │ │ └── tslist.txt │ ├── ui/ │ │ ├── aboutDialog.ui │ │ ├── fileViewSettingsDialog.ui │ │ ├── graphDialog.ui │ │ └── mainWindow.ui │ └── winmain.cpp ├── lexilla/ │ ├── .gitattributes │ ├── .github/ │ │ └── workflows/ │ │ ├── build-check-macos.yml │ │ ├── build-check-win32.yml │ │ └── build-check.yml │ ├── .gitignore │ ├── .travis.yml │ ├── CMakeLists.txt │ ├── CONTRIBUTING │ ├── License.txt │ ├── README │ ├── access/ │ │ ├── LexillaAccess.cxx │ │ ├── LexillaAccess.h │ │ └── README │ ├── cppcheck.suppress │ ├── delbin.bat │ ├── doc/ │ │ ├── Lexilla.html │ │ ├── LexillaDoc.html │ │ ├── LexillaDownload.html │ │ └── LexillaHistory.html │ ├── examples/ │ │ ├── CheckLexilla/ │ │ │ ├── CheckLexilla.c │ │ │ └── makefile │ │ └── SimpleLexer/ │ │ ├── SimpleLexer.cxx │ │ └── makefile │ ├── include/ │ │ ├── LexicalStyles.iface │ │ ├── Lexilla.h │ │ └── SciLexer.h │ ├── lexers/ │ │ ├── LexA68k.cxx │ │ ├── LexAPDL.cxx │ │ ├── LexASY.cxx │ │ ├── LexAU3.cxx │ │ ├── LexAVE.cxx │ │ ├── LexAVS.cxx │ │ ├── LexAbaqus.cxx │ │ ├── LexAda.cxx │ │ ├── LexAsciidoc.cxx │ │ ├── LexAsm.cxx │ │ ├── LexAsn1.cxx │ │ ├── LexBaan.cxx │ │ ├── LexBash.cxx │ │ ├── LexBasic.cxx │ │ ├── LexBatch.cxx │ │ ├── LexBibTeX.cxx │ │ ├── LexBullant.cxx │ │ ├── LexCIL.cxx │ │ ├── LexCLW.cxx │ │ ├── LexCOBOL.cxx │ │ ├── LexCPP.cxx │ │ ├── LexCSS.cxx │ │ ├── LexCaml.cxx │ │ ├── LexCmake.cxx │ │ ├── LexCoffeeScript.cxx │ │ ├── LexConf.cxx │ │ ├── LexCrontab.cxx │ │ ├── LexCsound.cxx │ │ ├── LexD.cxx │ │ ├── LexDMAP.cxx │ │ ├── LexDMIS.cxx │ │ ├── LexDataflex.cxx │ │ ├── LexDiff.cxx │ │ ├── LexECL.cxx │ │ ├── LexEDIFACT.cxx │ │ ├── LexEScript.cxx │ │ ├── LexEiffel.cxx │ │ ├── LexErlang.cxx │ │ ├── LexErrorList.cxx │ │ ├── LexFSharp.cxx │ │ ├── LexFlagship.cxx │ │ ├── LexForth.cxx │ │ ├── LexFortran.cxx │ │ ├── LexGAP.cxx │ │ ├── LexGDScript.cxx │ │ ├── LexGui4Cli.cxx │ │ ├── LexHTML.cxx │ │ ├── LexHaskell.cxx │ │ ├── LexHex.cxx │ │ ├── LexHollywood.cxx │ │ ├── LexIndent.cxx │ │ ├── LexInno.cxx │ │ ├── LexJSON.cxx │ │ ├── LexJulia.cxx │ │ ├── LexKVIrc.cxx │ │ ├── LexKix.cxx │ │ ├── LexLaTeX.cxx │ │ ├── LexLisp.cxx │ │ ├── LexLout.cxx │ │ ├── LexLua.cxx │ │ ├── LexMMIXAL.cxx │ │ ├── LexMPT.cxx │ │ ├── LexMSSQL.cxx │ │ ├── LexMagik.cxx │ │ ├── LexMake.cxx │ │ ├── LexMarkdown.cxx │ │ ├── LexMatlab.cxx │ │ ├── LexMaxima.cxx │ │ ├── LexMetapost.cxx │ │ ├── LexModula.cxx │ │ ├── LexMySQL.cxx │ │ ├── LexNim.cxx │ │ ├── LexNimrod.cxx │ │ ├── LexNsis.cxx │ │ ├── LexNull.cxx │ │ ├── LexOScript.cxx │ │ ├── LexOpal.cxx │ │ ├── LexPB.cxx │ │ ├── LexPLM.cxx │ │ ├── LexPO.cxx │ │ ├── LexPOV.cxx │ │ ├── LexPS.cxx │ │ ├── LexPascal.cxx │ │ ├── LexPerl.cxx │ │ ├── LexPowerPro.cxx │ │ ├── LexPowerShell.cxx │ │ ├── LexProgress.cxx │ │ ├── LexProps.cxx │ │ ├── LexPython.cxx │ │ ├── LexR.cxx │ │ ├── LexRaku.cxx │ │ ├── LexRebol.cxx │ │ ├── LexRegistry.cxx │ │ ├── LexRuby.cxx │ │ ├── LexRust.cxx │ │ ├── LexSAS.cxx │ │ ├── LexSML.cxx │ │ ├── LexSQL.cxx │ │ ├── LexSTTXT.cxx │ │ ├── LexScriptol.cxx │ │ ├── LexSmalltalk.cxx │ │ ├── LexSorcus.cxx │ │ ├── LexSpecman.cxx │ │ ├── LexSpice.cxx │ │ ├── LexStata.cxx │ │ ├── LexTACL.cxx │ │ ├── LexTADS3.cxx │ │ ├── LexTAL.cxx │ │ ├── LexTCL.cxx │ │ ├── LexTCMD.cxx │ │ ├── LexTeX.cxx │ │ ├── LexTxt2tags.cxx │ │ ├── LexVB.cxx │ │ ├── LexVHDL.cxx │ │ ├── LexVerilog.cxx │ │ ├── LexVisualProlog.cxx │ │ ├── LexX12.cxx │ │ └── LexYAML.cxx │ ├── lexlib/ │ │ ├── Accessor.cxx │ │ ├── Accessor.h │ │ ├── CatalogueModules.h │ │ ├── CharacterCategory.cxx │ │ ├── CharacterCategory.h │ │ ├── CharacterSet.cxx │ │ ├── CharacterSet.h │ │ ├── DefaultLexer.cxx │ │ ├── DefaultLexer.h │ │ ├── InList.cxx │ │ ├── InList.h │ │ ├── LexAccessor.cxx │ │ ├── LexAccessor.h │ │ ├── LexerBase.cxx │ │ ├── LexerBase.h │ │ ├── LexerModule.cxx │ │ ├── LexerModule.h │ │ ├── LexerNoExceptions.cxx │ │ ├── LexerNoExceptions.h │ │ ├── LexerSimple.cxx │ │ ├── LexerSimple.h │ │ ├── OptionSet.h │ │ ├── PropSetSimple.cxx │ │ ├── PropSetSimple.h │ │ ├── SparseState.h │ │ ├── StringCopy.h │ │ ├── StyleContext.cxx │ │ ├── StyleContext.h │ │ ├── SubStyles.h │ │ ├── WordList.cxx │ │ └── WordList.h │ ├── scripts/ │ │ ├── HeaderOrder.txt │ │ ├── LexFacer.py │ │ ├── LexillaData.py │ │ ├── LexillaGen.py │ │ ├── LexillaLogo.py │ │ ├── PromoteNew.bat │ │ ├── RunTest.bat │ │ └── RunTest.sh │ ├── src/ │ │ ├── DepGen.py │ │ ├── Lexilla/ │ │ │ ├── Info.plist │ │ │ └── Lexilla.xcodeproj/ │ │ │ ├── project.pbxproj │ │ │ └── project.xcworkspace/ │ │ │ └── contents.xcworkspacedata │ │ ├── Lexilla.cxx │ │ ├── Lexilla.def │ │ ├── Lexilla.pro │ │ ├── Lexilla.ruleset │ │ ├── Lexilla.vcxproj │ │ ├── LexillaVersion.rc │ │ ├── deps.mak │ │ ├── lexilla.mak │ │ ├── makefile │ │ └── nmdeps.mak │ ├── test/ │ │ ├── README │ │ ├── TestDocument.cxx │ │ ├── TestDocument.h │ │ ├── TestLexers.cxx │ │ ├── TestLexers.vcxproj │ │ ├── examples/ │ │ │ ├── asciidoc/ │ │ │ │ ├── AllStyles.adoc │ │ │ │ ├── AllStyles.adoc.folded │ │ │ │ ├── AllStyles.adoc.styled │ │ │ │ └── SciTE.properties │ │ │ ├── asm/ │ │ │ │ ├── AllStyles.asm │ │ │ │ ├── AllStyles.asm.folded │ │ │ │ ├── AllStyles.asm.styled │ │ │ │ └── SciTE.properties │ │ │ ├── bash/ │ │ │ │ ├── 197ArithmeticOperator.bsh │ │ │ │ ├── 197ArithmeticOperator.bsh.folded │ │ │ │ ├── 197ArithmeticOperator.bsh.styled │ │ │ │ ├── 199Numbers.bsh │ │ │ │ ├── 199Numbers.bsh.folded │ │ │ │ ├── 199Numbers.bsh.styled │ │ │ │ ├── 202LineStartOption.bsh │ │ │ │ ├── 202LineStartOption.bsh.folded │ │ │ │ ├── 202LineStartOption.bsh.styled │ │ │ │ ├── 203TestOption.bsh │ │ │ │ ├── 203TestOption.bsh.folded │ │ │ │ ├── 203TestOption.bsh.styled │ │ │ │ ├── AllStyles.bsh │ │ │ │ ├── AllStyles.bsh.folded │ │ │ │ ├── AllStyles.bsh.styled │ │ │ │ ├── Issue180.bsh │ │ │ │ ├── Issue180.bsh.folded │ │ │ │ ├── Issue180.bsh.styled │ │ │ │ ├── Issue182.bsh │ │ │ │ ├── Issue182.bsh.folded │ │ │ │ ├── Issue182.bsh.styled │ │ │ │ ├── Issue184.bsh │ │ │ │ ├── Issue184.bsh.folded │ │ │ │ ├── Issue184.bsh.styled │ │ │ │ ├── Issue184Copy.bsh │ │ │ │ ├── Issue184Copy.bsh.folded │ │ │ │ ├── Issue184Copy.bsh.styled │ │ │ │ ├── Nested.bsh │ │ │ │ ├── Nested.bsh.folded │ │ │ │ ├── Nested.bsh.styled │ │ │ │ ├── NestedRich.bsh │ │ │ │ ├── NestedRich.bsh.folded │ │ │ │ ├── NestedRich.bsh.styled │ │ │ │ ├── NestedStyledInside.bsh │ │ │ │ ├── NestedStyledInside.bsh.folded │ │ │ │ ├── NestedStyledInside.bsh.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── continuation.bsh │ │ │ │ ├── continuation.bsh.folded │ │ │ │ ├── continuation.bsh.styled │ │ │ │ ├── hash.zsh │ │ │ │ ├── hash.zsh.folded │ │ │ │ ├── hash.zsh.styled │ │ │ │ ├── x.bsh │ │ │ │ ├── x.bsh.folded │ │ │ │ └── x.bsh.styled │ │ │ ├── batch/ │ │ │ │ ├── Issue115.bat │ │ │ │ ├── Issue115.bat.folded │ │ │ │ ├── Issue115.bat.styled │ │ │ │ ├── Issue222.bat │ │ │ │ ├── Issue222.bat.folded │ │ │ │ ├── Issue222.bat.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.bat │ │ │ │ ├── x.bat.folded │ │ │ │ └── x.bat.styled │ │ │ ├── caml/ │ │ │ │ ├── AllStyles.ml │ │ │ │ ├── AllStyles.ml.folded │ │ │ │ ├── AllStyles.ml.styled │ │ │ │ └── SciTE.properties │ │ │ ├── cmake/ │ │ │ │ ├── Bug77_0.cmake │ │ │ │ ├── Bug77_0.cmake.folded │ │ │ │ ├── Bug77_0.cmake.styled │ │ │ │ ├── Bug77_1.cmake │ │ │ │ ├── Bug77_1.cmake.folded │ │ │ │ ├── Bug77_1.cmake.styled │ │ │ │ └── SciTE.properties │ │ │ ├── cobol/ │ │ │ │ ├── 229.cob │ │ │ │ ├── 229.cob.folded │ │ │ │ ├── 229.cob.styled │ │ │ │ ├── 230.cob │ │ │ │ ├── 230.cob.folded │ │ │ │ ├── 230.cob.styled │ │ │ │ ├── 231.cob │ │ │ │ ├── 231.cob.folded │ │ │ │ ├── 231.cob.styled │ │ │ │ ├── AllStyles.cob │ │ │ │ ├── AllStyles.cob.folded │ │ │ │ ├── AllStyles.cob.styled │ │ │ │ └── SciTE.properties │ │ │ ├── cpp/ │ │ │ │ ├── 130NonAsciiKeyword.cxx │ │ │ │ ├── 130NonAsciiKeyword.cxx.folded │ │ │ │ ├── 130NonAsciiKeyword.cxx.styled │ │ │ │ ├── 149KeywordCase.cxx │ │ │ │ ├── 149KeywordCase.cxx.folded │ │ │ │ ├── 149KeywordCase.cxx.styled │ │ │ │ ├── 94Template.cxx │ │ │ │ ├── 94Template.cxx.folded │ │ │ │ ├── 94Template.cxx.styled │ │ │ │ ├── AllStyles.cxx │ │ │ │ ├── AllStyles.cxx.folded │ │ │ │ ├── AllStyles.cxx.styled │ │ │ │ ├── Bug2245.cxx │ │ │ │ ├── Bug2245.cxx.folded │ │ │ │ ├── Bug2245.cxx.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.cxx │ │ │ │ ├── x.cxx.folded │ │ │ │ └── x.cxx.styled │ │ │ ├── css/ │ │ │ │ ├── AllStyles.css │ │ │ │ ├── AllStyles.css.folded │ │ │ │ ├── AllStyles.css.styled │ │ │ │ └── SciTE.properties │ │ │ ├── d/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.d │ │ │ │ ├── x.d.folded │ │ │ │ └── x.d.styled │ │ │ ├── diff/ │ │ │ │ ├── AllStyles.diff │ │ │ │ ├── AllStyles.diff.folded │ │ │ │ ├── AllStyles.diff.styled │ │ │ │ ├── LongLine.diff │ │ │ │ ├── LongLine.diff.folded │ │ │ │ ├── LongLine.diff.styled │ │ │ │ └── SciTE.properties │ │ │ ├── erlang/ │ │ │ │ ├── AllStyles.erl │ │ │ │ ├── AllStyles.erl.folded │ │ │ │ ├── AllStyles.erl.styled │ │ │ │ └── SciTE.properties │ │ │ ├── errorlist/ │ │ │ │ ├── AllStyles.err │ │ │ │ ├── AllStyles.err.folded │ │ │ │ ├── AllStyles.err.styled │ │ │ │ └── SciTE.properties │ │ │ ├── fortran/ │ │ │ │ ├── AllStyles.f │ │ │ │ ├── AllStyles.f.folded │ │ │ │ ├── AllStyles.f.styled │ │ │ │ └── SciTE.properties │ │ │ ├── fsharp/ │ │ │ │ ├── FmtSpecs.fs │ │ │ │ ├── FmtSpecs.fs.folded │ │ │ │ ├── FmtSpecs.fs.styled │ │ │ │ ├── Issue56.fs │ │ │ │ ├── Issue56.fs.folded │ │ │ │ ├── Issue56.fs.styled │ │ │ │ ├── Issue93.fs │ │ │ │ ├── Issue93.fs.folded │ │ │ │ ├── Issue93.fs.styled │ │ │ │ ├── Literals.fs │ │ │ │ ├── Literals.fs.folded │ │ │ │ ├── Literals.fs.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.fs │ │ │ │ ├── x.fs.folded │ │ │ │ └── x.fs.styled │ │ │ ├── gdscript/ │ │ │ │ ├── AllStyles.gd │ │ │ │ ├── AllStyles.gd.folded │ │ │ │ ├── AllStyles.gd.styled │ │ │ │ ├── NodePath.gd │ │ │ │ ├── NodePath.gd.folded │ │ │ │ ├── NodePath.gd.styled │ │ │ │ └── SciTE.properties │ │ │ ├── gui4cli/ │ │ │ │ ├── AllStyles.gui │ │ │ │ ├── AllStyles.gui.folded │ │ │ │ ├── AllStyles.gui.styled │ │ │ │ └── SciTE.properties │ │ │ ├── hypertext/ │ │ │ │ ├── Bug2207.html │ │ │ │ ├── Bug2207.html.folded │ │ │ │ ├── Bug2207.html.styled │ │ │ │ ├── Bug2219.html │ │ │ │ ├── Bug2219.html.folded │ │ │ │ ├── Bug2219.html.styled │ │ │ │ ├── Issue19.php │ │ │ │ ├── Issue19.php.folded │ │ │ │ ├── Issue19.php.styled │ │ │ │ ├── Issue192.html │ │ │ │ ├── Issue192.html.folded │ │ │ │ ├── Issue192.html.styled │ │ │ │ ├── Issue20Numbers.php │ │ │ │ ├── Issue20Numbers.php.folded │ │ │ │ ├── Issue20Numbers.php.styled │ │ │ │ ├── Issue47.html │ │ │ │ ├── Issue47.html.folded │ │ │ │ ├── Issue47.html.styled │ │ │ │ ├── Issue53.html │ │ │ │ ├── Issue53.html.folded │ │ │ │ ├── Issue53.html.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── ServerBasic.aspx │ │ │ │ ├── ServerBasic.aspx.folded │ │ │ │ ├── ServerBasic.aspx.styled │ │ │ │ ├── ServerJavaScript.aspx │ │ │ │ ├── ServerJavaScript.aspx.folded │ │ │ │ ├── ServerJavaScript.aspx.styled │ │ │ │ ├── apostophe.php │ │ │ │ ├── apostophe.php.folded │ │ │ │ ├── apostophe.php.styled │ │ │ │ ├── comment.html │ │ │ │ ├── comment.html.folded │ │ │ │ ├── comment.html.styled │ │ │ │ ├── mako.html │ │ │ │ ├── mako.html.folded │ │ │ │ ├── mako.html.styled │ │ │ │ ├── x.asp │ │ │ │ ├── x.asp.folded │ │ │ │ ├── x.asp.styled │ │ │ │ ├── x.html │ │ │ │ ├── x.html.folded │ │ │ │ ├── x.html.styled │ │ │ │ ├── x.php │ │ │ │ ├── x.php.folded │ │ │ │ └── x.php.styled │ │ │ ├── inno/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.iss │ │ │ │ ├── x.iss.folded │ │ │ │ └── x.iss.styled │ │ │ ├── json/ │ │ │ │ ├── AllStyles.json │ │ │ │ ├── AllStyles.json.folded │ │ │ │ ├── AllStyles.json.styled │ │ │ │ └── SciTE.properties │ │ │ ├── julia/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.jl │ │ │ │ ├── x.jl.folded │ │ │ │ └── x.jl.styled │ │ │ ├── latex/ │ │ │ │ ├── AllStyles.tex │ │ │ │ ├── AllStyles.tex.folded │ │ │ │ ├── AllStyles.tex.styled │ │ │ │ ├── Feature1358.tex │ │ │ │ ├── Feature1358.tex.folded │ │ │ │ ├── Feature1358.tex.styled │ │ │ │ └── SciTE.properties │ │ │ ├── lua/ │ │ │ │ ├── AllStyles.lua │ │ │ │ ├── AllStyles.lua.folded │ │ │ │ ├── AllStyles.lua.styled │ │ │ │ ├── Bug2205.lua │ │ │ │ ├── Bug2205.lua.folded │ │ │ │ ├── Bug2205.lua.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── folding.lua │ │ │ │ ├── folding.lua.folded │ │ │ │ ├── folding.lua.styled │ │ │ │ ├── x.lua │ │ │ │ ├── x.lua.folded │ │ │ │ └── x.lua.styled │ │ │ ├── makefile/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── longline.mak │ │ │ │ ├── longline.mak.folded │ │ │ │ ├── longline.mak.styled │ │ │ │ ├── x.mak │ │ │ │ ├── x.mak.folded │ │ │ │ └── x.mak.styled │ │ │ ├── markdown/ │ │ │ │ ├── AllStyles.md │ │ │ │ ├── AllStyles.md.folded │ │ │ │ ├── AllStyles.md.styled │ │ │ │ ├── Bug1216.md │ │ │ │ ├── Bug1216.md.folded │ │ │ │ ├── Bug1216.md.styled │ │ │ │ ├── Bug2235.md │ │ │ │ ├── Bug2235.md.folded │ │ │ │ ├── Bug2235.md.styled │ │ │ │ ├── Bug2247.md │ │ │ │ ├── Bug2247.md.folded │ │ │ │ ├── Bug2247.md.styled │ │ │ │ ├── HeaderEOLFill_0.md │ │ │ │ ├── HeaderEOLFill_0.md.folded │ │ │ │ ├── HeaderEOLFill_0.md.styled │ │ │ │ ├── HeaderEOLFill_1.md │ │ │ │ ├── HeaderEOLFill_1.md.folded │ │ │ │ ├── HeaderEOLFill_1.md.styled │ │ │ │ ├── Issue117.md │ │ │ │ ├── Issue117.md.folded │ │ │ │ ├── Issue117.md.styled │ │ │ │ └── SciTE.properties │ │ │ ├── matlab/ │ │ │ │ ├── AllStyles.m.matlab │ │ │ │ ├── AllStyles.m.matlab.folded │ │ │ │ ├── AllStyles.m.matlab.styled │ │ │ │ ├── AllStyles.m.octave │ │ │ │ ├── AllStyles.m.octave.folded │ │ │ │ ├── AllStyles.m.octave.styled │ │ │ │ ├── ArgumentsBlock.m.matlab │ │ │ │ ├── ArgumentsBlock.m.matlab.folded │ │ │ │ ├── ArgumentsBlock.m.matlab.styled │ │ │ │ ├── ClassDefinition.m.matlab │ │ │ │ ├── ClassDefinition.m.matlab.folded │ │ │ │ ├── ClassDefinition.m.matlab.styled │ │ │ │ ├── FoldPoints.m.matlab │ │ │ │ ├── FoldPoints.m.matlab.folded │ │ │ │ ├── FoldPoints.m.matlab.styled │ │ │ │ ├── Issue18_EscapeSequence.m.matlab │ │ │ │ ├── Issue18_EscapeSequence.m.matlab.folded │ │ │ │ ├── Issue18_EscapeSequence.m.matlab.styled │ │ │ │ ├── Issue18_EscapeSequence.m.octave │ │ │ │ ├── Issue18_EscapeSequence.m.octave.folded │ │ │ │ ├── Issue18_EscapeSequence.m.octave.styled │ │ │ │ ├── NumericLiterals.m.matlab │ │ │ │ ├── NumericLiterals.m.matlab.folded │ │ │ │ ├── NumericLiterals.m.matlab.styled │ │ │ │ └── SciTE.properties │ │ │ ├── mmixal/ │ │ │ │ ├── AllStyles.mms │ │ │ │ ├── AllStyles.mms.folded │ │ │ │ ├── AllStyles.mms.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── references.mms │ │ │ │ ├── references.mms.folded │ │ │ │ ├── references.mms.styled │ │ │ │ ├── x.mms │ │ │ │ ├── x.mms.folded │ │ │ │ └── x.mms.styled │ │ │ ├── modula/ │ │ │ │ ├── 128Endless.m3 │ │ │ │ ├── 128Endless.m3.folded │ │ │ │ ├── 128Endless.m3.styled │ │ │ │ ├── Issue129.m3 │ │ │ │ ├── Issue129.m3.folded │ │ │ │ ├── Issue129.m3.styled │ │ │ │ └── SciTE.properties │ │ │ ├── mssql/ │ │ │ │ ├── AllStyles.tsql │ │ │ │ ├── AllStyles.tsql.folded │ │ │ │ ├── AllStyles.tsql.styled │ │ │ │ ├── Issue87.tsql │ │ │ │ ├── Issue87.tsql.folded │ │ │ │ ├── Issue87.tsql.styled │ │ │ │ ├── Issue90.tsql │ │ │ │ ├── Issue90.tsql.folded │ │ │ │ ├── Issue90.tsql.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── Various.tsql │ │ │ │ ├── Various.tsql.folded │ │ │ │ └── Various.tsql.styled │ │ │ ├── mysql/ │ │ │ │ ├── AllStyles.sql │ │ │ │ ├── AllStyles.sql.folded │ │ │ │ ├── AllStyles.sql.styled │ │ │ │ └── SciTE.properties │ │ │ ├── nim/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.nim │ │ │ │ ├── x.nim.folded │ │ │ │ └── x.nim.styled │ │ │ ├── perl/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── perl-test-5220delta.pl │ │ │ │ ├── perl-test-5220delta.pl.folded │ │ │ │ ├── perl-test-5220delta.pl.styled │ │ │ │ ├── perl-test-sub-prototypes.pl │ │ │ │ ├── perl-test-sub-prototypes.pl.folded │ │ │ │ ├── perl-test-sub-prototypes.pl.styled │ │ │ │ ├── x.pl │ │ │ │ ├── x.pl.folded │ │ │ │ └── x.pl.styled │ │ │ ├── powershell/ │ │ │ │ ├── AllStyles.ps1 │ │ │ │ ├── AllStyles.ps1.folded │ │ │ │ ├── AllStyles.ps1.styled │ │ │ │ ├── CharacterTruncation.ps1 │ │ │ │ ├── CharacterTruncation.ps1.folded │ │ │ │ ├── CharacterTruncation.ps1.styled │ │ │ │ ├── NumericLiterals.ps1 │ │ │ │ ├── NumericLiterals.ps1.folded │ │ │ │ ├── NumericLiterals.ps1.styled │ │ │ │ ├── Pull92.ps1 │ │ │ │ ├── Pull92.ps1.folded │ │ │ │ ├── Pull92.ps1.styled │ │ │ │ ├── Pull99Comment.ps1 │ │ │ │ ├── Pull99Comment.ps1.folded │ │ │ │ ├── Pull99Comment.ps1.styled │ │ │ │ └── SciTE.properties │ │ │ ├── props/ │ │ │ │ ├── Issue96Folding.props │ │ │ │ ├── Issue96Folding.props.folded │ │ │ │ ├── Issue96Folding.props.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── example.session │ │ │ │ ├── example.session.folded │ │ │ │ └── example.session.styled │ │ │ ├── python/ │ │ │ │ ├── AllStyles.py │ │ │ │ ├── AllStyles.py.folded │ │ │ │ ├── AllStyles.py.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── attributes/ │ │ │ │ │ ├── SciTE.properties │ │ │ │ │ ├── attributes.py │ │ │ │ │ ├── attributes.py.folded │ │ │ │ │ └── attributes.py.styled │ │ │ │ ├── f-strings.py │ │ │ │ ├── f-strings.py.folded │ │ │ │ ├── f-strings.py.styled │ │ │ │ ├── matchcase.py │ │ │ │ ├── matchcase.py.folded │ │ │ │ ├── matchcase.py.styled │ │ │ │ ├── strings.py │ │ │ │ ├── strings.py.folded │ │ │ │ ├── strings.py.styled │ │ │ │ ├── x.py │ │ │ │ ├── x.py.folded │ │ │ │ └── x.py.styled │ │ │ ├── r/ │ │ │ │ ├── 102Backticks.r │ │ │ │ ├── 102Backticks.r.folded │ │ │ │ ├── 102Backticks.r.styled │ │ │ │ ├── AllStyles.r │ │ │ │ ├── AllStyles.r.folded │ │ │ │ ├── AllStyles.r.styled │ │ │ │ └── SciTE.properties │ │ │ ├── raku/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.p6 │ │ │ │ ├── x.p6.folded │ │ │ │ └── x.p6.styled │ │ │ ├── ruby/ │ │ │ │ ├── 225NumberDotMethod.rb │ │ │ │ ├── 225NumberDotMethod.rb.folded │ │ │ │ ├── 225NumberDotMethod.rb.styled │ │ │ │ ├── 234HereDoc.rb │ │ │ │ ├── 234HereDoc.rb.folded │ │ │ │ ├── 234HereDoc.rb.styled │ │ │ │ ├── AllStyles.rb │ │ │ │ ├── AllStyles.rb.folded │ │ │ │ ├── AllStyles.rb.styled │ │ │ │ ├── Issue132.rb │ │ │ │ ├── Issue132.rb.folded │ │ │ │ ├── Issue132.rb.styled │ │ │ │ ├── Issue135.rb │ │ │ │ ├── Issue135.rb.folded │ │ │ │ ├── Issue135.rb.styled │ │ │ │ ├── Issue136.rb │ │ │ │ ├── Issue136.rb.folded │ │ │ │ ├── Issue136.rb.styled │ │ │ │ ├── Issue140.rb │ │ │ │ ├── Issue140.rb.folded │ │ │ │ ├── Issue140.rb.styled │ │ │ │ ├── Issue65.rb │ │ │ │ ├── Issue65.rb.folded │ │ │ │ ├── Issue65.rb.styled │ │ │ │ ├── Issue66.rb │ │ │ │ ├── Issue66.rb.folded │ │ │ │ ├── Issue66.rb.styled │ │ │ │ ├── Issue67.rb │ │ │ │ ├── Issue67.rb.folded │ │ │ │ ├── Issue67.rb.styled │ │ │ │ ├── Issue69.rb │ │ │ │ ├── Issue69.rb.folded │ │ │ │ ├── Issue69.rb.styled │ │ │ │ ├── PercentEquals124.rb │ │ │ │ ├── PercentEquals124.rb.folded │ │ │ │ ├── PercentEquals124.rb.styled │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.rb │ │ │ │ ├── x.rb.folded │ │ │ │ └── x.rb.styled │ │ │ ├── rust/ │ │ │ │ ├── Issue239.rs │ │ │ │ ├── Issue239.rs.folded │ │ │ │ ├── Issue239.rs.styled │ │ │ │ ├── Issue33.rs │ │ │ │ ├── Issue33.rs.folded │ │ │ │ ├── Issue33.rs.styled │ │ │ │ ├── Issue34.rs │ │ │ │ ├── Issue34.rs.folded │ │ │ │ ├── Issue34.rs.styled │ │ │ │ ├── Issue35.rs │ │ │ │ ├── Issue35.rs.folded │ │ │ │ ├── Issue35.rs.styled │ │ │ │ └── SciTE.properties │ │ │ ├── sql/ │ │ │ │ ├── AllStyles.sql │ │ │ │ ├── AllStyles.sql.folded │ │ │ │ ├── AllStyles.sql.styled │ │ │ │ └── SciTE.properties │ │ │ ├── tcl/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.tcl │ │ │ │ ├── x.tcl.folded │ │ │ │ └── x.tcl.styled │ │ │ ├── vb/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.vb │ │ │ │ ├── x.vb.folded │ │ │ │ └── x.vb.styled │ │ │ ├── verilog/ │ │ │ │ ├── AllStyles.vh │ │ │ │ ├── AllStyles.vh.folded │ │ │ │ ├── AllStyles.vh.styled │ │ │ │ └── SciTE.properties │ │ │ ├── vhdl/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── x.vhd │ │ │ │ ├── x.vhd.folded │ │ │ │ └── x.vhd.styled │ │ │ ├── visualprolog/ │ │ │ │ ├── AllStyles.pl │ │ │ │ ├── AllStyles.pl.folded │ │ │ │ ├── AllStyles.pl.styled │ │ │ │ ├── AllStyles.pro │ │ │ │ ├── AllStyles.pro.folded │ │ │ │ ├── AllStyles.pro.styled │ │ │ │ └── SciTE.properties │ │ │ ├── x12/ │ │ │ │ ├── SciTE.properties │ │ │ │ ├── empty.x12 │ │ │ │ ├── empty.x12.folded │ │ │ │ ├── empty.x12.styled │ │ │ │ ├── x.x12 │ │ │ │ ├── x.x12.folded │ │ │ │ └── x.x12.styled │ │ │ └── yaml/ │ │ │ ├── SciTE.properties │ │ │ ├── longline.yaml │ │ │ ├── longline.yaml.folded │ │ │ ├── longline.yaml.styled │ │ │ ├── x.yaml │ │ │ ├── x.yaml.folded │ │ │ └── x.yaml.styled │ │ ├── makefile │ │ ├── testlexers.mak │ │ └── unit/ │ │ ├── LICENSE_1_0.txt │ │ ├── README │ │ ├── Sci.natvis │ │ ├── SciTE.properties │ │ ├── UnitTester.cxx │ │ ├── UnitTester.vcxproj │ │ ├── catch.hpp │ │ ├── makefile │ │ ├── test.mak │ │ ├── testCharacterSet.cxx │ │ ├── testInList.cxx │ │ ├── testLexerSimple.cxx │ │ ├── testOptionSet.cxx │ │ ├── testPropSetSimple.cxx │ │ ├── testSparseState.cxx │ │ ├── testWordList.cxx │ │ └── unitTest.cxx │ ├── tgzsrc │ ├── version.txt │ └── zipsrc.bat ├── makedb/ │ ├── CMakeLists.txt │ ├── cs2sq.cpp │ ├── cs2sq.h │ ├── cscommon.h │ ├── csdbheader.cpp │ ├── csdbheader.h │ ├── csdbparser.cpp │ ├── csdbparser.h │ ├── ctagread.cpp │ ├── ctagread.h │ ├── main.cpp │ ├── sqlbase.cpp │ ├── sqlbase.h │ └── swver.h ├── querylib/ │ ├── CMakeLists.txt │ ├── README.txt │ ├── getopt2.cpp │ ├── getopt2.h │ ├── small_lib.cpp │ ├── small_lib.h │ ├── sqlquery.cpp │ └── sqlquery.h ├── release.json ├── scintilla/ │ ├── .editorconfig │ ├── .hg_archival.txt │ ├── .hgeol │ ├── .hgignore │ ├── .hgtags │ ├── CONTRIBUTING │ ├── License.txt │ ├── README │ ├── call/ │ │ └── ScintillaCall.cxx │ ├── cocoa/ │ │ ├── InfoBar.h │ │ ├── InfoBar.mm │ │ ├── InfoBarCommunicator.h │ │ ├── PlatCocoa.h │ │ ├── PlatCocoa.mm │ │ ├── QuartzTextLayout.h │ │ ├── QuartzTextStyle.h │ │ ├── QuartzTextStyleAttribute.h │ │ ├── Scintilla/ │ │ │ ├── Info.plist │ │ │ ├── Scintilla.xcodeproj/ │ │ │ │ ├── project.pbxproj │ │ │ │ └── project.xcworkspace/ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata/ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ └── module.modulemap │ │ ├── ScintillaCocoa.h │ │ ├── ScintillaCocoa.mm │ │ ├── ScintillaTest/ │ │ │ ├── AppController.h │ │ │ ├── AppController.mm │ │ │ ├── Info.plist │ │ │ ├── Scintilla-Info.plist │ │ │ ├── ScintillaTest.xcodeproj/ │ │ │ │ ├── project.pbxproj │ │ │ │ └── project.xcworkspace/ │ │ │ │ ├── contents.xcworkspacedata │ │ │ │ └── xcshareddata/ │ │ │ │ └── IDEWorkspaceChecks.plist │ │ │ ├── ScintillaTest_Prefix.pch │ │ │ ├── TestData.sql │ │ │ ├── en.lproj/ │ │ │ │ ├── InfoPlist.strings │ │ │ │ └── MainMenu.xib │ │ │ └── main.m │ │ ├── ScintillaView.h │ │ ├── ScintillaView.mm │ │ └── checkbuildosx.sh │ ├── cppcheck.suppress │ ├── delbin.bat │ ├── doc/ │ │ ├── AddSource.txt │ │ ├── Design.html │ │ ├── Icons.html │ │ ├── Lexer.txt │ │ ├── Privacy.html │ │ ├── SciCoding.html │ │ ├── Scintilla5Migration.html │ │ ├── ScintillaDoc.html │ │ ├── ScintillaDownload.html │ │ ├── ScintillaHistory.html │ │ ├── ScintillaRelated.html │ │ ├── ScintillaToDo.html │ │ ├── ScintillaUsage.html │ │ ├── Steps.html │ │ ├── StyleMetadata.html │ │ └── index.html │ ├── gtk/ │ │ ├── Converter.h │ │ ├── DepGen.py │ │ ├── PlatGTK.cxx │ │ ├── ScintillaGTK.cxx │ │ ├── ScintillaGTK.h │ │ ├── ScintillaGTKAccessible.cxx │ │ ├── ScintillaGTKAccessible.h │ │ ├── Wrappers.h │ │ ├── deps.mak │ │ ├── makefile │ │ ├── scintilla-marshal.c │ │ ├── scintilla-marshal.h │ │ └── scintilla-marshal.list │ ├── include/ │ │ ├── ILexer.h │ │ ├── ILoader.h │ │ ├── Sci_Position.h │ │ ├── Scintilla.h │ │ ├── Scintilla.iface │ │ ├── ScintillaCall.h │ │ ├── ScintillaMessages.h │ │ ├── ScintillaStructures.h │ │ ├── ScintillaTypes.h │ │ └── ScintillaWidget.h │ ├── qt/ │ │ ├── README │ │ ├── ScintillaEdit/ │ │ │ ├── CMakeLists.txt │ │ │ ├── ScintillaDocument.cpp │ │ │ ├── ScintillaDocument.h │ │ │ ├── ScintillaEdit.cpp │ │ │ ├── ScintillaEdit.cpp.template │ │ │ ├── ScintillaEdit.h │ │ │ ├── ScintillaEdit.h.template │ │ │ ├── ScintillaEdit.pro │ │ │ └── WidgetGen.py │ │ └── ScintillaEditBase/ │ │ ├── Notes.txt │ │ ├── PlatQt.cpp │ │ ├── PlatQt.h │ │ ├── ScintillaEditBase.cpp │ │ ├── ScintillaEditBase.h │ │ ├── ScintillaEditBase.pro │ │ ├── ScintillaQt.cpp │ │ └── ScintillaQt.h │ ├── scripts/ │ │ ├── CheckMentioned.py │ │ ├── Dependencies.py │ │ ├── Face.py │ │ ├── FileGenerator.py │ │ ├── GenerateCaseConvert.py │ │ ├── GenerateCharacterCategory.py │ │ ├── HFacer.py │ │ ├── HeaderCheck.py │ │ ├── HeaderOrder.txt │ │ ├── LexGen.py │ │ ├── ScintillaAPIFacer.py │ │ ├── ScintillaData.py │ │ ├── __init__.py │ │ └── archive.sh │ ├── src/ │ │ ├── AutoComplete.cxx │ │ ├── AutoComplete.h │ │ ├── CallTip.cxx │ │ ├── CallTip.h │ │ ├── CaseConvert.cxx │ │ ├── CaseConvert.h │ │ ├── CaseFolder.cxx │ │ ├── CaseFolder.h │ │ ├── CellBuffer.cxx │ │ ├── CellBuffer.h │ │ ├── ChangeHistory.cxx │ │ ├── ChangeHistory.h │ │ ├── CharClassify.cxx │ │ ├── CharClassify.h │ │ ├── CharacterCategoryMap.cxx │ │ ├── CharacterCategoryMap.h │ │ ├── CharacterType.cxx │ │ ├── CharacterType.h │ │ ├── ContractionState.cxx │ │ ├── ContractionState.h │ │ ├── DBCS.cxx │ │ ├── DBCS.h │ │ ├── Debugging.h │ │ ├── Decoration.cxx │ │ ├── Decoration.h │ │ ├── Document.cxx │ │ ├── Document.h │ │ ├── EditModel.cxx │ │ ├── EditModel.h │ │ ├── EditView.cxx │ │ ├── EditView.h │ │ ├── Editor.cxx │ │ ├── Editor.h │ │ ├── ElapsedPeriod.h │ │ ├── Geometry.cxx │ │ ├── Geometry.h │ │ ├── Indicator.cxx │ │ ├── Indicator.h │ │ ├── KeyMap.cxx │ │ ├── KeyMap.h │ │ ├── LineMarker.cxx │ │ ├── LineMarker.h │ │ ├── MarginView.cxx │ │ ├── MarginView.h │ │ ├── Partitioning.h │ │ ├── PerLine.cxx │ │ ├── PerLine.h │ │ ├── Platform.h │ │ ├── Position.h │ │ ├── PositionCache.cxx │ │ ├── PositionCache.h │ │ ├── RESearch.cxx │ │ ├── RESearch.h │ │ ├── RunStyles.cxx │ │ ├── RunStyles.h │ │ ├── SciTE.properties │ │ ├── ScintillaBase.cxx │ │ ├── ScintillaBase.h │ │ ├── Selection.cxx │ │ ├── Selection.h │ │ ├── SparseVector.h │ │ ├── SplitVector.h │ │ ├── Style.cxx │ │ ├── Style.h │ │ ├── UndoHistory.cxx │ │ ├── UndoHistory.h │ │ ├── UniConversion.cxx │ │ ├── UniConversion.h │ │ ├── UniqueString.cxx │ │ ├── UniqueString.h │ │ ├── ViewStyle.cxx │ │ ├── ViewStyle.h │ │ ├── XPM.cxx │ │ └── XPM.h │ ├── test/ │ │ ├── MessageNumbers.py │ │ ├── README │ │ ├── ScintillaCallable.py │ │ ├── XiteMenu.py │ │ ├── XiteWin.py │ │ ├── gi/ │ │ │ ├── Scintilla-0.1.gir.good │ │ │ ├── filter-scintilla-h.py │ │ │ ├── gi-test.py │ │ │ └── makefile │ │ ├── performanceTests.py │ │ ├── simpleTests.py │ │ ├── unit/ │ │ │ ├── LICENSE_1_0.txt │ │ │ ├── README │ │ │ ├── Sci.natvis │ │ │ ├── SciTE.properties │ │ │ ├── UnitTester.cxx │ │ │ ├── UnitTester.vcxproj │ │ │ ├── catch.hpp │ │ │ ├── makefile │ │ │ ├── test.mak │ │ │ ├── testCellBuffer.cxx │ │ │ ├── testCharClassify.cxx │ │ │ ├── testCharacterCategoryMap.cxx │ │ │ ├── testContractionState.cxx │ │ │ ├── testDecoration.cxx │ │ │ ├── testDocument.cxx │ │ │ ├── testGeometry.cxx │ │ │ ├── testPartitioning.cxx │ │ │ ├── testPerLine.cxx │ │ │ ├── testRESearch.cxx │ │ │ ├── testRunStyles.cxx │ │ │ ├── testSparseVector.cxx │ │ │ ├── testSplitVector.cxx │ │ │ ├── testUniConversion.cxx │ │ │ └── unitTest.cxx │ │ ├── win32Tests.py │ │ └── xite.py │ ├── tgzsrc │ ├── version.txt │ ├── win32/ │ │ ├── DepGen.py │ │ ├── HanjaDic.cxx │ │ ├── HanjaDic.h │ │ ├── PlatWin.cxx │ │ ├── PlatWin.h │ │ ├── SciTE.properties │ │ ├── ScintRes.rc │ │ ├── Scintilla.def │ │ ├── Scintilla.vcxproj │ │ ├── ScintillaDLL.cxx │ │ ├── ScintillaWin.cxx │ │ ├── ScintillaWin.h │ │ ├── WinTypes.h │ │ ├── deps.mak │ │ ├── makefile │ │ ├── nmdeps.mak │ │ └── scintilla.mak │ └── zipsrc.bat ├── showgraph/ │ ├── CMakeLists.txt │ ├── Graph/ │ │ ├── README.txt │ │ ├── agraph.h │ │ ├── edge.cpp │ │ ├── edge.h │ │ ├── edge_inline.h │ │ ├── graph.cpp │ │ ├── graph.h │ │ ├── graph_iface.h │ │ ├── graph_inline.h │ │ ├── marker.h │ │ ├── node.cpp │ │ ├── node.h │ │ ├── node_inline.h │ │ ├── node_iter.h │ │ ├── num.h │ │ └── predecls.h │ ├── GraphView/ │ │ ├── edge_helper.cpp │ │ ├── edge_helper.h │ │ ├── edge_item.cpp │ │ ├── edge_item.h │ │ ├── graph_view.cpp │ │ ├── graph_view.h │ │ ├── gstyle.h │ │ ├── gview_iface.h │ │ ├── gview_impl.h │ │ ├── navigation.cpp │ │ ├── navigation.h │ │ ├── node_item.cpp │ │ ├── node_item.h │ │ ├── style_edit.cpp │ │ ├── style_edit.h │ │ ├── visible_edge.cpp │ │ └── visible_edge.h │ ├── LICENSE.txt │ ├── Layout/ │ │ ├── aux_edge.h │ │ ├── aux_graph.cpp │ │ ├── aux_graph.h │ │ ├── aux_node.h │ │ ├── layout.cpp │ │ ├── layout_iface.h │ │ ├── node_group.cpp │ │ └── node_group.h │ ├── README.txt │ ├── Utils/ │ │ ├── asrt.h │ │ ├── conf.cpp │ │ ├── conf.h │ │ ├── conf_utest.cpp │ │ ├── list.h │ │ ├── list_utest.cpp │ │ ├── mem.h │ │ ├── mem_chunk.h │ │ ├── mem_entry.h │ │ ├── mem_fixed_pool.h │ │ ├── mem_mgr.cpp │ │ ├── mem_mgr.h │ │ ├── mem_obj.h │ │ ├── mem_pool.cpp │ │ ├── mem_pool.h │ │ ├── mem_ref.h │ │ ├── mem_utest.cpp │ │ ├── misc.h │ │ ├── print.h │ │ ├── singleton.h │ │ ├── ulist.h │ │ ├── utils.cpp │ │ ├── utils_iface.h │ │ └── utils_utest.cpp │ ├── core_iface.h │ ├── showgraph.cpp │ └── showgraph.h └── windows-install/ ├── qt5/ │ ├── buildqt5.bat │ ├── buildqt5_github.bat │ ├── codequeryqt5.wxs │ ├── packqt5_github.bat │ └── testqt5_github.bat ├── qt6/ │ ├── buildqt6.bat │ ├── buildqt6_github.bat │ ├── codequeryqt661.wxs │ ├── codequeryqt671.wxs │ ├── codequeryqt690.wxs │ ├── packqt6_github.bat │ └── testqt6_github.bat └── wincommon/ ├── HOWTO-WINDOWS.txt ├── LICENSE.rtf ├── LICENSE.txt ├── README.txt └── uninstall.bat ================================================ FILE CONTENTS ================================================ ================================================ FILE: .github/workflows/cmake.yml ================================================ # Heavily inspired (i.e. copy/paste) from https://gist.github.com/NickNaso/0d478f1481686d5bcc868cac06620a60 name: CMake Build Matrix # Controls when the action will run. Triggers the workflow on push on: push: pull_request: release: # tags: # - 'v*' # Push events to matching v*, i.e. v1.0, v20.15.10 # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" build: # The type of runner that the job will run on name: ${{ matrix.config.name }} runs-on: ${{ matrix.config.os }} strategy: fail-fast: false matrix: config: - { name: "Ubuntu-latest GCC NoGui", os: ubuntu-latest, build_type: "Debug", cc: "gcc", cxx: "g++" } - { name: "Ubuntu-latest GCC Qt6", os: ubuntu-latest, build_type: "Debug", cc: "gcc", cxx: "g++", } - { name: "Ubuntu-latest GCC Qt5", os: ubuntu-latest, build_type: "Debug", cc: "gcc", cxx: "g++", } - { name: "Ubuntu 22.04 GCC Qt5", os: ubuntu-22.04, build_type: "Debug", cc: "gcc", cxx: "g++" } - { name: "macOS Clang Qt6", os: macos-latest, build_type: "Debug", cc: "clang", cxx: "clang++" } - { name: "macOS Clang Qt5", os: macos-latest, build_type: "Debug", cc: "clang", cxx: "clang++" } - { name: "Windows MinGW Qt6", os: windows-latest, build_type: "Debug", cc: "gcc", cxx: "g++" } - { name: "Windows MinGW Qt5", os: windows-latest, build_type: "Debug", cc: "gcc", cxx: "g++" } steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - uses: actions/checkout@v4 - name: Print env run: | echo github.event.action: ${{ github.event.action }} echo github.event_name: ${{ github.event_name }} - name: Install common dependencies on all Ubuntu if: "startsWith(matrix.config.name, 'Ubuntu')" run: | sudo apt-get update sudo apt-get install build-essential g++ git cmake ninja-build sqlite3 libsqlite3-dev cscope exuberant-ctags uname -a lsb_release -a gcc -v && g++ -v && cmake --version && ninja --version - name: Install dependencies on Ubuntu-latest GCC Qt6 if: "startsWith(matrix.config.name, 'Ubuntu-latest GCC Qt6')" run: | sudo apt-get install libglx-dev libgl1-mesa-dev libvulkan-dev libxkbcommon-dev sudo apt-get install qt6-base-dev qt6-base-dev-tools qt6-tools-dev qt6-tools-dev-tools sudo apt-get install libqt6core5compat6-dev qt6-l10n-tools qt6-wayland - name: Install dependencies on Ubuntu-latest GCC Qt5 if: "startsWith(matrix.config.name, 'Ubuntu-latest GCC Qt5')" run: | sudo apt-get install qtcreator qtbase5-dev qt5-qmake qttools5-dev-tools qttools5-dev - name: Install dependencies on Ubuntu 22.04 GCC Qt5 if: "startsWith(matrix.config.name, 'Ubuntu 22.04 GCC Qt5')" run: | sudo apt-get install qtcreator qtbase5-dev qt5-qmake qttools5-dev-tools qttools5-dev - name: Install dependencies on macOS Clang Qt6 if: startsWith(matrix.config.name, 'macOS Clang Qt6') run: | brew install cmake ninja qt@6 sqlite cscope ctags vulkan-headers clang -v cmake --version ninja --version brew info qt@6 - name: Install dependencies on macOS Clang Qt5 if: startsWith(matrix.config.name, 'macOS Clang Qt5') run: | brew install cmake ninja qt@5 sqlite cscope ctags clang -v cmake --version ninja --version brew info qt@5 - name: Install Qt6 on Windows if: startsWith(matrix.config.name, 'Windows MinGW Qt6') uses: jurplel/install-qt-action@v4 with: version: '6.9.*' host: 'windows' target: 'desktop' arch: 'win64_mingw' modules: 'qt5compat' cache: 'false' - name: Install Qt5 on Windows if: startsWith(matrix.config.name, 'Windows MinGW Qt5') uses: jurplel/install-qt-action@v4 with: version: '5.15.2' host: 'windows' target: 'desktop' arch: 'win64_mingw81' cache: 'false' - name: Install sqlite3 on Windows shell: cmd if: startsWith(matrix.config.name, 'Windows MinGW') run: vcpkg install sqlite3:x64-windows - name: Install ninja on Windows if: startsWith(matrix.config.name, 'Windows MinGW') uses: seanmiddleditch/gha-setup-ninja@master - name: Configure CMake and Build on Ubuntu GCC Qt6 shell: bash if: "contains(matrix.config.name, 'Ubuntu-latest GCC Qt6')" run: | export CC=gcc export CXX=g++ cmake -G Ninja -S . -B build cmake --build build sudo cmake --install build - name: Configure CMake and Build on Ubuntu GCC Qt5 shell: bash if: "contains(matrix.config.name, 'Ubuntu-latest GCC Qt5') || contains(matrix.config.name, 'Ubuntu 22.04 GCC Qt5')" run: | export CC=gcc export CXX=g++ cmake -G Ninja -DBUILD_QT5=ON -S . -B build cmake --build build sudo cmake --install build - name: Configure CMake and Build on Ubuntu-latest GCC NoGui shell: bash if: contains(matrix.config.name, 'Ubuntu-latest GCC NoGui') run: | export CC=gcc export CXX=g++ cmake -G Ninja -DNO_GUI=ON -S . -B build cmake --build build sudo cmake --install build - name: Configure CMake and Build on macOS Clang Qt6 shell: bash if: contains(matrix.config.name, 'macOS Clang Qt6') run: | export CC=clang export CXX=clang++ cmake -G Ninja -DCMAKE_PREFIX_PATH=/usr/local/opt/qt@6/lib/cmake -S . -B build cmake --build build sudo cmake --install build - name: Configure CMake and Build on macOS Clang Qt5 shell: bash if: contains(matrix.config.name, 'macOS Clang Qt5') run: | export CC=clang export CXX=clang++ cmake -G Ninja -DBUILD_QT5=ON -DCMAKE_PREFIX_PATH=/opt/homebrew/opt/qt@5/lib/cmake -S . -B build cmake --build build sudo cmake --install build - name: Configure CMake and Build on Windows MinGW Qt6 shell: cmd if: contains(matrix.config.name, 'Windows MinGW Qt6') run: call "windows-install/qt6/buildqt6_github.bat" - name: Configure CMake and Build on Windows MinGW Qt5 shell: cmd if: contains(matrix.config.name, 'Windows MinGW Qt5') run: call "windows-install/qt5/buildqt5_github.bat" - name: Test on Linux, MacOS shell: bash if: ${{ !contains(matrix.config.name, 'Windows MinGW') }} run: | find . -name "*.h" > cscope.files find . -name "*.c" >> cscope.files find . -name "*.cpp" >> cscope.files find . -name "*.cxx" >> cscope.files cqmakedb -v cscope -cb ctags --fields=+i -n -L cscope.files cqmakedb -s cq.db -c cscope.out -t tags -p -d cqsearch -s cq.db -p 1 -t CODEQUERY_SW_VERSION -u cscope -b -f cscope1.out cqmakedb -s cq1.db -c cscope1.out -t tags -p -d cqsearch -s cq1.db -p 1 -t CODEQUERY_SW_VERSION -u - name: Test on Windows Qt6 shell: cmd if: contains(matrix.config.name, 'Windows MinGW Qt6') run: call "windows-install/qt6/testqt6_github.bat" - name: Test on Windows Qt5 shell: cmd if: contains(matrix.config.name, 'Windows MinGW Qt5') run: call "windows-install/qt5/testqt5_github.bat" - name: Pack on Windows Qt6 shell: cmd if: contains(matrix.config.name, 'Windows MinGW Qt6') run: call "windows-install/qt6/packqt6_github.bat" - name: Pack on Windows Qt5 shell: cmd if: contains(matrix.config.name, 'Windows MinGW Qt5') run: call "windows-install/qt5/packqt5_github.bat" ================================================ FILE: .gitignore ================================================ # Compiled Object files *.slo *.lo *.o # Compiled Dynamic libraries *.so *.dylib # Compiled Static libraries *.lai *.la *.a # Ignore backups *~ *.bak # Ignore the following directories build/ buildnogui/ buildqt4/ buildqt5/ buildqt6/ output/ Output/ bin/ html/ .vscode/ # Ignore cscope and ctags files, and our db files cscope*.files cscope*.out tags *.db ================================================ FILE: CMakeLists.txt ================================================ # # CodeQuery # Copyright (C) 2013-2018 ruben2020 https://github.com/ruben2020/ # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # cmake_minimum_required(VERSION 3.16.0) project(CodeQuery) option(BUILD_QT6 "Qt6 option" ON) option(BUILD_QT5 "Qt5 option" OFF) option(NO_GUI "No GUI option" OFF) option(GHAWIN "GitHub Actions on Windows" OFF) if (NO_GUI) MESSAGE("-- NO_GUI = " ${NO_GUI}) else (NO_GUI) if (BUILD_QT5) message("-- BUILD_QT5 = " ${BUILD_QT5}) else (BUILD_QT5) message("-- BUILD_QT6 = " ${BUILD_QT6}) endif(BUILD_QT5) endif(NO_GUI) if (GHAWIN) MESSAGE("-- GHAWIN = " ${GHAWIN}) else (GHAWIN) endif(GHAWIN) set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} "${CMAKE_SOURCE_DIR}/cmakefind/") # C++17 now always required SET( CMAKE_CXX_STANDARD 17 ) SET( CMAKE_CXX_STANDARD_REQUIRED ON ) #set(CMAKE_BUILD_TYPE Debug) #SET(CMAKE_C_FLAGS_DEBUG "-g -ggdb -O0 -Wno-unused-result -Wno-return-type") #SET(CMAKE_CXX_FLAGS_DEBUG "-g -ggdb -O0 -Wno-unused-result -Wno-return-type") IF(MSVC) ADD_DEFINITIONS(/D _CRT_SECURE_NO_WARNINGS) ELSE(MSVC) SET( CMAKE_CXX_FLAGS "-O2 -Wno-unused-result -Wno-return-type ${CMAKE_CXX_FLAGS}") SET( CMAKE_CXX_FLAGS_DEBUG "-g -ggdb -O0 -Wno-unused-result -Wno-return-type ${CMAKE_CXX_FLAGS_DEBUG}" ) SET( CMAKE_CXX_FLAGS_RELEASE "-O2 -Wno-unused-result -Wno-return-type ${CMAKE_CXX_FLAGS_RELEASE}" ) ENDIF(MSVC) set( EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR} ) add_subdirectory( "querylib" ) add_subdirectory( "makedb" ) add_subdirectory( "cli" ) if (NO_GUI) else (NO_GUI) add_subdirectory( "lexilla" ) add_subdirectory( "scintilla/qt/ScintillaEdit" ) add_subdirectory( "showgraph" ) add_subdirectory( "gui" ) endif (NO_GUI) ================================================ FILE: LICENSE.md ================================================ Mozilla Public License Version 2.0 ================================== ### 1. Definitions **1.1. “Contributor”** means each individual or legal entity that creates, contributes to the creation of, or owns Covered Software. **1.2. “Contributor Version”** means the combination of the Contributions of others (if any) used by a Contributor and that particular Contributor's Contribution. **1.3. “Contribution”** means Covered Software of a particular Contributor. **1.4. “Covered Software”** means Source Code Form to which the initial Contributor has attached the notice in Exhibit A, the Executable Form of such Source Code Form, and Modifications of such Source Code Form, in each case including portions thereof. **1.5. “Incompatible With Secondary Licenses”** means * **(a)** that the initial Contributor has attached the notice described in Exhibit B to the Covered Software; or * **(b)** that the Covered Software was made available under the terms of version 1.1 or earlier of the License, but not also under the terms of a Secondary License. **1.6. “Executable Form”** means any form of the work other than Source Code Form. **1.7. “Larger Work”** means a work that combines Covered Software with other material, in a separate file or files, that is not Covered Software. **1.8. “License”** means this document. **1.9. “Licensable”** means having the right to grant, to the maximum extent possible, whether at the time of the initial grant or subsequently, any and all of the rights conveyed by this License. **1.10. “Modifications”** means any of the following: * **(a)** any file in Source Code Form that results from an addition to, deletion from, or modification of the contents of Covered Software; or * **(b)** any new file in Source Code Form that contains any Covered Software. **1.11. “Patent Claims” of a Contributor** means any patent claim(s), including without limitation, method, process, and apparatus claims, in any patent Licensable by such Contributor that would be infringed, but for the grant of the License, by the making, using, selling, offering for sale, having made, import, or transfer of either its Contributions or its Contributor Version. **1.12. “Secondary License”** means either the GNU General Public License, Version 2.0, the GNU Lesser General Public License, Version 2.1, the GNU Affero General Public License, Version 3.0, or any later versions of those licenses. **1.13. “Source Code Form”** means the form of the work preferred for making modifications. **1.14. “You” (or “Your”)** means an individual or a legal entity exercising rights under this License. For legal entities, “You” includes any entity that controls, is controlled by, or is under common control with You. For purposes of this definition, “control” means **(a)** the power, direct or indirect, to cause the direction or management of such entity, whether by contract or otherwise, or **(b)** ownership of more than fifty percent (50%) of the outstanding shares or beneficial ownership of such entity. ### 2. License Grants and Conditions #### 2.1. Grants Each Contributor hereby grants You a world-wide, royalty-free, non-exclusive license: * **(a)** under intellectual property rights (other than patent or trademark) Licensable by such Contributor to use, reproduce, make available, modify, display, perform, distribute, and otherwise exploit its Contributions, either on an unmodified basis, with Modifications, or as part of a Larger Work; and * **(b)** under Patent Claims of such Contributor to make, use, sell, offer for sale, have made, import, and otherwise transfer either its Contributions or its Contributor Version. #### 2.2. Effective Date The licenses granted in Section 2.1 with respect to any Contribution become effective for each Contribution on the date the Contributor first distributes such Contribution. #### 2.3. Limitations on Grant Scope The licenses granted in this Section 2 are the only rights granted under this License. No additional rights or licenses will be implied from the distribution or licensing of Covered Software under this License. Notwithstanding Section 2.1(b) above, no patent license is granted by a Contributor: * **(a)** for any code that a Contributor has removed from Covered Software; or * **(b)** for infringements caused by: **(i)** Your and any other third party's modifications of Covered Software, or **(ii)** the combination of its Contributions with other software (except as part of its Contributor Version); or * **(c)** under Patent Claims infringed by Covered Software in the absence of its Contributions. This License does not grant any rights in the trademarks, service marks, or logos of any Contributor (except as may be necessary to comply with the notice requirements in Section 3.4). #### 2.4. Subsequent Licenses No Contributor makes additional grants as a result of Your choice to distribute the Covered Software under a subsequent version of this License (see Section 10.2) or under the terms of a Secondary License (if permitted under the terms of Section 3.3). #### 2.5. Representation Each Contributor represents that the Contributor believes its Contributions are its original creation(s) or it has sufficient rights to grant the rights to its Contributions conveyed by this License. #### 2.6. Fair Use This License is not intended to limit any rights You have under applicable copyright doctrines of fair use, fair dealing, or other equivalents. #### 2.7. Conditions Sections 3.1, 3.2, 3.3, and 3.4 are conditions of the licenses granted in Section 2.1. ### 3. Responsibilities #### 3.1. Distribution of Source Form All distribution of Covered Software in Source Code Form, including any Modifications that You create or to which You contribute, must be under the terms of this License. You must inform recipients that the Source Code Form of the Covered Software is governed by the terms of this License, and how they can obtain a copy of this License. You may not attempt to alter or restrict the recipients' rights in the Source Code Form. #### 3.2. Distribution of Executable Form If You distribute Covered Software in Executable Form then: * **(a)** such Covered Software must also be made available in Source Code Form, as described in Section 3.1, and You must inform recipients of the Executable Form how they can obtain a copy of such Source Code Form by reasonable means in a timely manner, at a charge no more than the cost of distribution to the recipient; and * **(b)** You may distribute such Executable Form under the terms of this License, or sublicense it under different terms, provided that the license for the Executable Form does not attempt to limit or alter the recipients' rights in the Source Code Form under this License. #### 3.3. Distribution of a Larger Work You may create and distribute a Larger Work under terms of Your choice, provided that You also comply with the requirements of this License for the Covered Software. If the Larger Work is a combination of Covered Software with a work governed by one or more Secondary Licenses, and the Covered Software is not Incompatible With Secondary Licenses, this License permits You to additionally distribute such Covered Software under the terms of such Secondary License(s), so that the recipient of the Larger Work may, at their option, further distribute the Covered Software under the terms of either this License or such Secondary License(s). #### 3.4. Notices You may not remove or alter the substance of any license notices (including copyright notices, patent notices, disclaimers of warranty, or limitations of liability) contained within the Source Code Form of the Covered Software, except that You may alter any license notices to the extent required to remedy known factual inaccuracies. #### 3.5. Application of Additional Terms You may choose to offer, and to charge a fee for, warranty, support, indemnity or liability obligations to one or more recipients of Covered Software. However, You may do so only on Your own behalf, and not on behalf of any Contributor. You must make it absolutely clear that any such warranty, support, indemnity, or liability obligation is offered by You alone, and You hereby agree to indemnify every Contributor for any liability incurred by such Contributor as a result of warranty, support, indemnity or liability terms You offer. You may include additional disclaimers of warranty and limitations of liability specific to any jurisdiction. ### 4. Inability to Comply Due to Statute or Regulation If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Covered Software due to statute, judicial order, or regulation then You must: **(a)** comply with the terms of this License to the maximum extent possible; and **(b)** describe the limitations and the code they affect. Such description must be placed in a text file included with all distributions of the Covered Software under this License. Except to the extent prohibited by statute or regulation, such description must be sufficiently detailed for a recipient of ordinary skill to be able to understand it. ### 5. Termination **5.1.** The rights granted under this License will terminate automatically if You fail to comply with any of its terms. However, if You become compliant, then the rights granted under this License from a particular Contributor are reinstated **(a)** provisionally, unless and until such Contributor explicitly and finally terminates Your grants, and **(b)** on an ongoing basis, if such Contributor fails to notify You of the non-compliance by some reasonable means prior to 60 days after You have come back into compliance. Moreover, Your grants from a particular Contributor are reinstated on an ongoing basis if such Contributor notifies You of the non-compliance by some reasonable means, this is the first time You have received notice of non-compliance with this License from such Contributor, and You become compliant prior to 30 days after Your receipt of the notice. **5.2.** If You initiate litigation against any entity by asserting a patent infringement claim (excluding declaratory judgment actions, counter-claims, and cross-claims) alleging that a Contributor Version directly or indirectly infringes any patent, then the rights granted to You by any and all Contributors for the Covered Software under Section 2.1 of this License shall terminate. **5.3.** In the event of termination under Sections 5.1 or 5.2 above, all end user license agreements (excluding distributors and resellers) which have been validly granted by You or Your distributors under this License prior to termination shall survive termination. ### 6. Disclaimer of Warranty > Covered Software is provided under this License on an “as is” > basis, without warranty of any kind, either expressed, implied, or > statutory, including, without limitation, warranties that the > Covered Software is free of defects, merchantable, fit for a > particular purpose or non-infringing. The entire risk as to the > quality and performance of the Covered Software is with You. > Should any Covered Software prove defective in any respect, You > (not any Contributor) assume the cost of any necessary servicing, > repair, or correction. This disclaimer of warranty constitutes an > essential part of this License. No use of any Covered Software is > authorized under this License except under this disclaimer. ### 7. Limitation of Liability > Under no circumstances and under no legal theory, whether tort > (including negligence), contract, or otherwise, shall any > Contributor, or anyone who distributes Covered Software as > permitted above, be liable to You for any direct, indirect, > special, incidental, or consequential damages of any character > including, without limitation, damages for lost profits, loss of > goodwill, work stoppage, computer failure or malfunction, or any > and all other commercial damages or losses, even if such party > shall have been informed of the possibility of such damages. This > limitation of liability shall not apply to liability for death or > personal injury resulting from such party's negligence to the > extent applicable law prohibits such limitation. Some > jurisdictions do not allow the exclusion or limitation of > incidental or consequential damages, so this exclusion and > limitation may not apply to You. ### 8. Litigation Any litigation relating to this License may be brought only in the courts of a jurisdiction where the defendant maintains its principal place of business and such litigation shall be governed by laws of that jurisdiction, without reference to its conflict-of-law provisions. Nothing in this Section shall prevent a party's ability to bring cross-claims or counter-claims. ### 9. Miscellaneous This License represents the complete agreement concerning the subject matter hereof. If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable. Any law or regulation which provides that the language of a contract shall be construed against the drafter shall not be used to construe this License against a Contributor. ### 10. Versions of the License #### 10.1. New Versions Mozilla Foundation is the license steward. Except as provided in Section 10.3, no one other than the license steward has the right to modify or publish new versions of this License. Each version will be given a distinguishing version number. #### 10.2. Effect of New Versions You may distribute the Covered Software under the terms of the version of the License under which You originally received the Covered Software, or under the terms of any subsequent version published by the license steward. #### 10.3. Modified Versions If you create software not governed by this License, and you want to create a new license for such software, you may create and use a modified version of this License if you rename the license and remove any references to the name of the license steward (except to note that such modified license differs from this License). #### 10.4. Distributing Source Code Form that is Incompatible With Secondary Licenses If You choose to distribute Source Code Form that is Incompatible With Secondary Licenses under the terms of this version of the License, the notice described in Exhibit B of this License must be attached. ## Exhibit A - Source Code Form License Notice This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/. If it is not possible or desirable to put the notice in a particular file, then You may include the notice in a location (such as a LICENSE file in a relevant directory) where a recipient would be likely to look for such a notice. You may add additional accurate notices of copyright ownership. ## Exhibit B - “Incompatible With Secondary Licenses” Notice This Source Code Form is "Incompatible With Secondary Licenses", as defined by the Mozilla Public License, v. 2.0. ================================================ FILE: NEWS.md ================================================ Changelog ========= Version 1.0.1 - July 14, 2025 ----------------------------- Minor code changes to avoid compilation errors with certain versions of the dependent libraries Added THIRDPARTY.md file to provide info on third party dependencies Version 1.0.0 - May 24, 2024 ----------------------------- Enhancement: Migrated to Qt6, which is now the default build option Enhancement: Updated Scintilla to 5.5.0 Qt5 and NO_GUI remain additional build options Qt4 and 32-bit Windows support removed Version 0.27.0 - Jan 25, 2024 ----------------------------- Enhancement: Compressed cscope.out (built without -c) supported experimentally Enhancement: CodeQuery database file can be opened by CodeQuery GUI through command line argument Version 0.26.0 - Dec 19, 2022 ----------------------------- Bugfix: File path label with too large contents extending window beyond viewport GUI bug fixed Enhancement: Default external editor configuration for MacOS added Version 0.25.0 - Apr 17, 2022 ----------------------------- Enhancement: Workaround for pycscope trailer start offset bug running on Python 3.8 Enhancement: Updated Scintilla to 3.21.1 Enhancement: Removed warnings for Qt 5.15 Enhancement: Windows installer now includes Qt 5.15.2 and sqlite 3.38.2 binaries Enhancement: Moved from Travis CI to Github Actions (for Linux, MacOS and Windows builds) Version 0.24.0 - Jan 17, 2021 ----------------------------- Enhancement: Improved German translation for CodeQuery GUI, contributed by stweise Version 0.23.0 - Apr 15, 2020 ----------------------------- The CMake build directory is now moveable and renameable, which is useful for Debian source package creation Version 0.22.0 - Apr 12, 2020 ----------------------------- Enhancement: Added build option for no GUI Enhancement: Updated Scintilla to 3.11.2 Enhancement: Performance improvement by using QString instead of STL String for search through GUI Enhancement: Added ability to general call function and class inheritance graph through cqsearch CLI Enhancement: Added ability to filter by path added to cqsearch CLI Enhancement: Changing query type on the GUI dropbox will start a search immediately Enhancement: Clicking on a line in the GUI file viewer, will now highlight the appropriate function in the function list Enhancement: Now Qt5 becomes the default build option in CMakeLists.txt Enhancement: Windows installer changed from InnoSetup to Wix Toolset, to generate MSI installer Enhancement: Now Windows installer will be in two versions: Qt5, 64-bit or Qt4, 32-bit Bugfix: Default font selection for GUI file viewer, instead of becoming empty Bugfix: Improved annotation accuracy in GUI Bugfix: Improved brace highlighting in GUI Bugfix: Fixed the bug where function list next to GUI file viewer doesn't work properly for grep Version 0.21.1 - Sept 16, 2018 ------------------------------ Fixed a build error due to new version of Qt5 (5.11) Version 0.21.0 - Apr 30, 2017 ----------------------------- Fixes in the ctags file parser "List of files" button added to the GUI Improved "full path for file" results list in GUI Version 0.20.0 - Apr 9, 2017 ---------------------------- Major bug fix for a performance issue in the GUI, wrt clearing of the search results list Other minor bug fixes Version 0.19.0 - Apr 2, 2017 ---------------------------- Migrated from GPLv2 to MPLv2 because of incompatibility with Qt5's license Now officially supporting Qt5 for Linux and Mac, but Qt4 for Windows Replaced QScintilla (by Riverbank Computing) with Scintilla (by Neil Hodgson), to avoid GPLv3 Unicode UTF-8 files now viewable on CodeQuery GUI Source code preview text line length now unlimited in database CodeQuery CLI now has feature to change the source code preview text line truncation length Golang syntax highlighting added Travis script now also builds with clang and Qt5 for Mac build testing Fixed a build bug in CMake scripts for Arch Linux Debian and tarball packages would now be separated into Qt5 and Qt4 Version 0.18.0 - Oct 9, 2016 ---------------------------- Migrated from GPLv3 to GPLv2 because some companies ban GPLv3 software List of functions in the file viewer area is a major new feature Now the selection of one or two levels has been added for function call graphs Replaced Dipperstein's optlist with Sittler's getopt replacement (MIT licensed), to avoid LGPLv3 Updated showgraph (now BSD licensed), with rebase from the git repo Various bug fixes for the file viewer Version 0.17.0 - Sept 25, 2016 ------------------------------ Now Javascript is officially supported through starscope The full file path option is added to the command-line version of the tool for vim support HOWTO documentation updated for compatibility with Mac OS CodeQuery now officially built using Qt5 for Mac OS, but still in Qt4 for Windows and Linux Travis script updated to include Coverity scanning Version 0.16.0 - May 2, 2015 ---------------------------- Brace matching on the file viewer Better handling for current line highlight Annotation in file viewer to quickly and easily identify the selected item Changed version to the semantic versioning scheme MAJOR.MINOR.PATCH Qt4 (default) and Qt5 now supported by CMake build option Version 0.15 - Aug 12, 2014 --------------------------- Added support for Mac OS Allowed -q in cscope.out header Added info to HOWTOs on how to exclude standard include paths Version 0.14 - Mar 9, 2014 -------------------------- Fixed Java and Ruby syntax highlight bug Fixed bug where database file combobox becomes too large due to very long filename Version 0.13 - Mar 1, 2014 -------------------------- Grep feature added Last search history stored persistently Version 0.12 - Feb 23, 2014 --------------------------- QScintilla used for code editing widget Imported a number of syntax highlight themes from Notepad++ Ruby and Go now officially supported through starscope RPM packages will now be generated also Version 0.11 - Dec 31, 2013 --------------------------- File path filter New query type: Calls of this function Search results traversing within same file Improvements on graph's initial size and zoom Bug fix on external editor settings text Version 0.10 - Aug 10, 2013 --------------------------- ctags file processing optimization New GUI features: Header files only, Functions inside this file, new About box New GUI features: Ability to change file viewer font and tab space width Autocomplete made asynchronous and optimized Version 0.09 - Apr 20, 2013 --------------------------- Fixed some cscope.out parser and SQL handling bugs Added font resize buttons for file viewer Version 0.08 - Apr 14, 2013 --------------------------- Fixed Windows app icon and taskbar bugs Version 0.07 - Apr 13, 2013 --------------------------- Added ability to parse cscope.out generated by pycscope (for Python support) Added syntax highlighting for Python and Java File path can now be selected and copied in the GUI tool Version 0.06 - Feb 27, 2013 --------------------------- Fixed syntax highlight bug, added user warning if CQ database is older than viewed source file, removed the extra console window appearing alongside the GUI app in Windows Version 0.05 - Feb 25, 2013 --------------------------- Fixed file path bug in Windows and initial version of cqsearch CLI tool Version 0.04 - Feb 24, 2013 --------------------------- Initial version of visualization for function call graph and class inheritance is now working. Version 0.03 - Feb 22, 2013 --------------------------- Added wildcard search * and ?. Added previous and next history browsing for search. Version 0.02 - Feb 19, 2013 --------------------------- Fixed external editor file path recognition bug for Windows (could not recognize spaces e.g. C:\Program Files). Version 0.01 - Feb 18, 2013 --------------------------- Initial release ================================================ FILE: README.md ================================================ ![CodeQuery](doc/logotitle.png) =============================== This is a tool to index, then query or search C, C++, Java, Python, Ruby, Go and Javascript source code. It builds upon the databases of [cscope](http://cscope.sourceforge.net/) and [Exuberant ctags](http://ctags.sourceforge.net/). It can also work with [Universal ctags](https://github.com/universal-ctags/ctags/), which is a drop-in replacement for Exuberant ctags. The databases of *cscope* and *ctags* would be processed by the *cqmakedb* tool to generate the CodeQuery database file. The CodeQuery database file can be viewed and queried using the *codequery* GUI tool. [![Build Status](https://github.com/ruben2020/codequery/actions/workflows/cmake.yml/badge.svg?branch=master)](https://github.com/ruben2020/codequery/actions) [![Coverity Status](https://scan.coverity.com/projects/10066/badge.svg)](https://scan.coverity.com/projects/ruben2020-codequery) ## Latest version = 1.0.1 Windows binaries available here for download: [CodeQuery@sourceforge downloads](https://sourceforge.net/projects/codequery/files/) On Debian and Ubuntu Linux, the software can be installed using `apt-get install codequery`. To build on Linux, please read the [INSTALL-LINUX](doc/INSTALL-LINUX.md) file. On Mac, the software can be installed through [Brew](http://brew.sh/) using `brew install codequery`. Please read [NEWS](NEWS.md) to find out more. ## How is it different from cscope and ctags? What are the advantages? Both cscope and ctags can do symbol lookup and identify functions, macros, classes and structs. cscope is very C-centric, but is fuzzy enough to cover C++ and Java, but not very well for e.g. it doesn't understand destructors and class member instantiations. It can't provide relationships of class inheritance and membership. cscope can do "functions that call this function" and "functions called by this function". This is a very powerful feature that makes cscope stand out among comparable tools. ctags does many languages well and understands destructors, member instantiations, and the relationships of class membership and inheritance. From ctags, we can find out "members and methods of this class", "class which owns this member or method", "parent of this class", "child of this class" etc. However, it doesn't do "functions that call this function" or "functions called by this function". So both these tools have their pros and cons, but complement each other. CodeQuery is a project that attempts to combine the features available from both cscope and ctags, provide faster database access compared to cscope (because it uses sqlite) and provides a nice GUI tool as well. Due to this faster database access, fast auto-completion of search terms and multiple complex queries to perform visualization is possible. In addition, [pycscope](https://github.com/portante/pycscope) is used to add support for Python, in place of cscope. In addition, [starscope](https://github.com/eapache/starscope) is used to add support for Ruby, Go and Javascript, in place of cscope. ## What features does CodeQuery have? * Combines the best of both cscope and ctags * Faster due to the use of sqlite for the CodeQuery database * Cross-platform GUI tool * Fast auto-completion of search term * Case-insensitive, partial keyword search - wildcard search supported * and ? * Exact match search * Filter search results by file path * File viewer with syntax highlighting, for UTF-8 encoded source files * Ability to open viewed file in an external editor or IDE * Visualization of function call graph and class inheritance based on search term * Visualization graphs can be saved to PNG or Graphviz DOT files ## What types of query can I make? * Symbol * Function or macro definition * Class or struct * Functions calling this function * Functions called by this function * Calls of this function or macro * Class which owns this member or method * Members and methods of this class * Parent of this class (inheritance) * Children of this class (inheritance) * Files including this file * Full path for file * Functions and macros inside this file * Grep ## What does it look like? ![CodeQuery screenshot](doc/screenshot.png) ## How does the visualization look like? Here's a function call graph based on the search term of "updateFilePathLabel". A -> B means A calls B: ![Visualization screenshot](doc/screenshot2.png) ## Are other editors like vim or emacs or Visual Studio Code supported? Yes! There is a vim plugin for CodeQuery called [vim-codequery](https://github.com/devjoe/vim-codequery) by [devjoe](https://github.com/devjoe). There is a Visual Studio Code extension for CodeQuery called [codequery4vscode](https://github.com/ruben2020/codequery4vscode) by [ruben2020](https://github.com/ruben2020). The Visual Studio Code Extension Marketplace page for this extension is [ruben2020.codequery4vscode](https://marketplace.visualstudio.com/items?itemName=ruben2020.codequery4vscode). We welcome contributors to develop plugins for other editors too. ## What does it cost? How is it licensed? It's freeware and free open source software. This software is licensed under the [Mozilla Public License, version 2.0 (MPL-2.0)](https://www.mozilla.org/en-US/MPL/2.0/). See [LICENSE.md](LICENSE.md) or [LICENSE.txt](windows-install/wincommon/LICENSE.txt). This applies to both the distributed Source Code Form and the distributed Executable Form of the software. To understand the MPL-2.0 license, please read the [MPL-2.0 FAQ by mozilla.org](https://www.mozilla.org/en-US/MPL/2.0/FAQ/). Files under the `querylib` directory are licensed under the [MIT license](http://opensource.org/licenses/MIT). See [QueryLib README](querylib/README.txt). This is a library to query CodeQuery database files. This library is MIT-licensed, so that it may be used to create plugins for editors, IDEs and other software without restrictions. It's only dependency is on sqlite3. Third party software attribution can be found in [THIRDPARTY.md](THIRDPARTY.md). ## Can I use it in a commercial environment without purchasing, for an unlimited time? Yes. However, donations are welcomed. ## Which platforms are supported? It has been tested on Windows 10 64-bit, Mac OS X, Ubuntu and Arch Linux 64-bit. Contributions are welcomed to attempt ports to other operating systems. ## Is the software available in other languages? Yes. This applies only to the GUI tool. Contributions are welcomed to update or provide new translations. ## How to install it? On Windows, EXE setup packages will be provided here: [CodeQuery@sourceforge downloads](https://sourceforge.net/projects/codequery/files/). The EXE setup package shall also contain cscope.exe, ctags.exe and the required DLLs. So, everything you need is in one package. However, [pycscope](https://github.com/portante/pycscope) (optional - only for Python) and [starscope](https://github.com/eapache/starscope) (optional - only for Ruby, Go and Javascript) are not bundled together with this setup package and need to be installed separately. On Debian and Ubuntu Linux, the software can be installed using `apt-get install codequery`. On Mac, the software can be installed through [Brew](http://brew.sh/) using `brew install codequery`. To build on Linux and Mac, please read the [INSTALL-LINUX](doc/INSTALL-LINUX.md) file. Version 15.8a of [cscope](http://cscope.sourceforge.net/) or higher, works best with CodeQuery. ## How do I use it? On Windows: [HOWTO-WINDOWS](windows-install/wincommon/HOWTO-WINDOWS.txt). This file is included in the EXE setup package. On Linux and Mac: [HOWTO-LINUX](doc/HOWTO-LINUX.md) Please read the HOWTO file provided for each platform. The workflow looks like this: ![CodeQuery workflow](doc/workflow.png) ## How do I generate whole-program call graphs or UML class diagrams? CodeQuery cannot do this at the moment. To generate whole-program call graphs, please use [GNU cflow](https://www.gnu.org/software/cflow/) or [CodeViz](https://github.com/petersenna/codeviz) for C and C++. For Java, there is [Javashot](http://code.google.com/p/javashot/). To generate whole-program UML class diagrams for various object-oriented languages, please use [tags2uml](https://github.com/ruben2020/tags2uml). ## Are there any known limitations? For C and C++, [inline assembly code](http://en.wikipedia.org/wiki/Inline_assembler) is not supported by all the tools. This mainly affects embedded software, OS and driver code. Please exclude files with inline assembly code from the list of files (cscope.files) to be scanned. ## How do I contact the authors for support, issues, bug reports, fix patches, feature requests etc.? Please see the email address below, and also the Issues tab in GitHub. Email address: ![Contact address](doc/emailaddr.png) Website: [CodeQuery website](https://github.com/ruben2020/codequery) ## How can I contribute? * Report bugs * Provide feedback, new ideas, suggestions etc. What would you like to see? * Tell your friends, recommend it on StackOverflow or social media * Fix bugs (see Issues tab) * Update translations (Deutsch, Francais, Japanese etc.) * Port to other platforms * Write plugins for emacs, eclipse, Notepad++, NetBeans, Jenkins etc. * Add support for other languages e.g. Objective-C, Swift ## List of Contributors [ruben2020](https://github.com/ruben2020) [naseer](https://github.com/naseer) [bruno-](https://github.com/bruno-) [devjoe](https://github.com/devjoe) [jonashaag](https://github.com/jonashaag) [ilovezfs](https://github.com/ilovezfs) [JCount](https://github.com/JCount) [brianonn](https://github.com/brianonn) [teungri](https://github.com/teungri) [stweise](https://github.com/stweise) (More welcomed) ## Credits We thank the people behind the following projects: [cscope](http://cscope.sourceforge.net/) - our database is derived from this [Exuberant ctags](http://ctags.sourceforge.net/)- our database is derived from this [Universal ctags](https://github.com/universal-ctags/ctags/) - drop-in replacement for Exuberant ctags [pycscope](https://github.com/portante/pycscope) - our database (for Python) is derived from this [starscope](https://github.com/eapache/starscope) - our database (for Ruby, Go and Javascript) is derived from this [sqlite3](http://www.sqlite.org/) - our database is using this format [CMake](http://www.cmake.org/) - cross-platform build toolchain for CodeQuery [Qt open source](http://qt-project.org/) - GUI toolkit used to build CodeQuery [showgraph](http://code.google.com/p/showgraph/) - visualization done using this library [scintilla](http://www.scintilla.org/) - our code editing widget [vim-codequery](https://github.com/devjoe/vim-codequery) - vim plugin for CodeQuery [Axialis](http://www.axialis.com/iconworkshop) - free images for CodeQuery and this website [brew](http://brew.sh/) - binaries for Mac here ================================================ FILE: THIRDPARTY.md ================================================ Third Party Software ==================== Both the source and binary distributions of this software are linked to some third party software. All the third party software included or linked is redistributed under the terms and conditions of their original licenses. These licenses are compatible with the license of this software, for the purposes they are being used. The following list provides attribution for these third party software in accordance with the conditions of their licenses. Qt6 open source --------------- Title: Qt 6.x Author: The Qt Company Ltd. and other contributors. Source: https://www.qt.io/download-open-source License: LGPL-3.0-only License file: https://doc.qt.io/qt-6/lgpl.html Linking method: Dynamic linking Distribution method: Distributed together with CodeQuery for Windows Scintilla --------- Title: Scintilla 5.5.x Author: Neil Hodgson Source: https://www.scintilla.org/ License: ISC-like license License file: [scintilla/License.txt](scintilla/License.txt) Linking method: Static linking Distribution method: Included in CodeQuery binaries Lexilla ------- Title: Lexilla 5.3.x Author: Neil Hodgson Source: https://www.scintilla.org/ License: ISC-like license License file: [lexilla/License.txt](lexilla/License.txt) Linking method: Static linking Distribution method: Included in CodeQuery binaries SQLite ------- Title: SQLite 3.x Author: D. Richard Hipp, Dan Kennedy, Joe Mistachkin Source: https://www.sqlite.org/ License: Public domain License file: https://www.sqlite.org/copyright.html Linking method: Dynamic linking Distribution method: Distributed together with CodeQuery for Windows getopt2 ------- Title: getopt2 Author: Russ Allbery, Benjamin Sittler Source: (unknown) License: MIT License file: [querylib/getopt2.h](querylib/getopt2.h) Linking method: Static linking Distribution method: Included in CodeQuery binaries winmain.cpp from gosu project ----------------------------- Title: WinMain.cpp (gosu) Author: Julian Raschke, Jan Lücker, cyberarm, and all Source: https://github.com/gosu/gosu/blob/master/src/WinMain.cpp License: MIT License file: [gui/winmain.cpp](gui/winmain.cpp) Linking method: Static linking Distribution method: Included in CodeQuery binaries for Windows showgraph --------- Title: showgraph Author: Boris Shurygin Source: https://github.com/boris-shurygin/showgraph License: BSD-3-Clause License file: [showgraph/LICENSE.txt](showgraph/LICENSE.txt) Linking method: Static linking Distribution method: Included in CodeQuery binaries Axialis ------- Title: Axialis Free Icons Author: Axialis Software SA Source: https://www.axialis.com/free/icons/ License: CC BY-ND 4.0 License file: https://www.axialis.com/icons/license.html#free Distribution method: Icon images used in the GUI app cscope ------ Title: cscope 15.8a Author: Santa Cruz Operation Inc. Source: https://cscope.sourceforge.net/ License: BSD-3-Clause License file: https://cscope.sourceforge.net/license.html Distribution method: Distributed together with CodeQuery for Windows ctags ----- Title: ctags 5.8 Author: Darren Hiebert Source: https://ctags.sourceforge.net/ License: GPL-2.0-only License file: https://sourceforge.net/projects/ctags/ Distribution method: Distributed together with CodeQuery for Windows Wix Toolset ----------- Title: Wix Toolset Author: .NET Foundation and contributors Source: https://github.com/wixtoolset/web License: MS-RL License file: https://github.com/wixtoolset/web/blob/master/LICENSE.TXT Distribution method: Used to create the Windows installer for CodeQuery ================================================ FILE: cli/CMakeLists.txt ================================================ # # CodeQuery # Copyright (C) 2013-2018 ruben2020 https://github.com/ruben2020/ # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # cmake_minimum_required(VERSION 3.16.0) project(CodeQueryCLI) #add_definitions( -Wall ) find_package(Sqlite REQUIRED) include_directories( "." ) include_directories( "../makedb" ) include_directories( "../querylib" ) include_directories( "${SQLITE_INCLUDE_DIR}" ) set( CQSEARCH_SRCS main_cli.cpp ) add_executable( cqsearch ${CQSEARCH_SRCS} ) target_link_libraries( cqsearch ${SQLITE_LIBRARIES} small_lib sqlquery_lib ) install(TARGETS cqsearch RUNTIME DESTINATION bin) ================================================ FILE: cli/README.md ================================================ CodeQuery command line interface ================================ This provides the command line interface (CLI) for CodeQuery's query interface. Type the following to get help: ```bash cqsearch -h ``` ================================================ FILE: cli/main_cli.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #include #include #include #include "small_lib.h" #include "getopt2.h" #include "sqlquery.h" #include "swver.h" void printhelp(const char* str) { printf("Usage:\n"); printf("%s [-s [-p ] [-g] [-t ] [-l ] -[e|f] [-u] [-b ]] [-d] [-v] [-h]\n\n", str); printf("options:\n"); printf(" -s : CodeQuery sqlite3 db file path\n"); printf(" -p : parameter is a number denoted by n\n"); printf(" default n = 1 (Symbol)\n"); printf(" -g : Create GraphViz DOT output instead of search results\n"); printf(" Applicable only for function or macro def(n=2) and\n"); printf(" class or struct (n=3)\n"); printf(" -t : search term without spaces\n"); printf(" if Exact Match is switched off, wild card\n"); printf(" searches are possible. Use * and ?\n"); printf(" -l : limited line length for truncated source code preview text\n"); printf(" Accepted range: 0 - 800 (use 0 for limitless)\n"); printf(" By default it is 80\n"); printf(" -e : Exact Match switched ON \n"); printf(" Case-sensitive\n"); printf(" -f : Exact Match switched OFF (fuzzy search)\n"); printf(" Case-insensitive with wild card search (default)\n"); printf(" -u : show full file path instead of file name\n"); printf(" -b : filters the results by source file path term\n"); printf(" For example, if the path term is \"test\" (without quotes),\n"); printf(" then the results will be filtered by source files whose\n"); printf(" path includes the term \"test\"\n"); printf(" -d : debug\n"); printf(" -v : version\n"); printf(" -h : help\n\n"); printf("The combinations possible are -s -t -e, -s -t -f -u\n"); printf("The additional optional arguments are -d\n\n"); printf("The possible values for n are:\n"); printf(" 1: Symbol (default)\n"); printf(" 2: Function or macro definition\n"); printf(" 3: Class or struct\n"); printf(" 4: Files including this file\n"); printf(" 5: Full file path\n"); printf(" 6: Functions calling this function\n"); printf(" 7: Functions called by this function\n"); printf(" 8: Calls of this function or macro\n"); printf(" 9: Members and methods of this class\n"); printf(" 10: Class which owns this member or method\n"); printf(" 11: Children of this class (inheritance)\n"); printf(" 12: Parent of this class (inheritance)\n"); printf(" 13: Functions or macros inside this file\n\n"); printf("Example:\n%s -s myproject.db -p 6 -t read*file -f\n\n", str); printf("Example of using -g with GraphViz:\n"); printf("%s -s myproject.db -p 2 -g -t read*file > functioncallgraph.dot\n", str); printf("dot -Tpng -ofunctioncallgraph.png functioncallgraph.dot\n\n"); } void printlicense(void) { printf(CODEQUERY_SW_VERSION); printf("\n"); printf(CODEQUERY_SW_LICENSE); } bool fileexists(const char* fn) { bool retval; FILE *fp; fp = fopen(fn, "r"); retval = (fp != NULL); if (retval) fclose(fp); return retval; } void process_argwithopt(char* thisOpt, int option, bool& err, tStr& fnstr, bool filemustexist) { if (thisOpt != NULL) { fnstr = thisOpt; if (filemustexist && (fileexists(fnstr.c_str()) == false)) { printf("Error: File %s doesn't exist.\n", fnstr.c_str()); err = true; } } else { printf("Error: -%c used without file option.\n", option); err = true; } } tStr limitcstr(int limitlen, tStr str) { if (limitlen <= 0) return str; else return str.substr(0,limitlen); } int process_query(tStr sqfn, tStr term, tStr param, bool exact, bool full, bool debug, int limitlen, bool graph, tStr fpath) { if ((sqfn.empty())||(term.empty())||(param.empty())) return 1; int retVal = 0; sqlquery sq; tStr lstr; sqlquery::en_filereadstatus filestatus = sq.open_dbfile(sqfn); tVecStr grpxml, grpdot; bool res = false; tStr errstr; switch (filestatus) { case sqlquery::sqlfileOK: break; case sqlquery::sqlfileOPENERROR: printf("Error: File %s open error!\n", sqfn.c_str()); return 1; case sqlquery::sqlfileNOTCORRECTDB: printf("Error: File %s does not have correct database format!\n", sqfn.c_str()); return 1; case sqlquery::sqlfileINCORRECTVER: printf("Error: File %s has an unsupported database version number!\n", sqfn.c_str()); return 1; case sqlquery::sqlfileUNKNOWNERROR: printf("Error: Unknown Error!\n"); return 1; } int intParam = atoi(param.c_str()) - 1; if ((intParam < 0) || (intParam >= sqlquery::sqlresultAUTOCOMPLETE)) { printf("Error: Parameter is out of range!\n"); return 1; } sqlqueryresultlist resultlst; if (graph) { if (intParam == sqlquery::sqlresultFUNC_MACRO) { res = sq.search_funcgraph(term, exact, grpxml, grpdot, 1, &errstr); } else if (intParam == sqlquery::sqlresultCLASS_STRUCT) { res = sq.search_classinheritgraph(term, exact, grpxml, grpdot, &errstr); } else { printf("Error: -g only works with function or macro def(n=2) and\n"); printf(" class or struct (n=3)\n"); return 1; } if (res == false) { printf("Error: SQL Error! %s!\n", errstr.c_str()); return 1; } else { for (auto it = grpdot.begin(); it != grpdot.end(); it++) printf("%s\n", it->c_str()); return 0; } } resultlst = sq.search(term, (sqlquery::en_queryType) intParam, exact, fpath); if (resultlst.result_type == sqlqueryresultlist::sqlresultERROR) { printf("Error: SQL Error! %s!\n", resultlst.sqlerrmsg.c_str()); return 1; } for(std::vector::iterator it = resultlst.resultlist.begin(); it != resultlst.resultlist.end(); it++) { lstr = limitcstr(limitlen, it->linetext); switch(resultlst.result_type) { case sqlqueryresultlist::sqlresultFULL: printf("%s\t%s:%s\t%s\n", it->symname.c_str(), (full ? it->filepath.c_str() : it->filename.c_str()), it->linenum.c_str(), lstr.c_str()); break; case sqlqueryresultlist::sqlresultFILE_LINE: printf("%s:%s\t%s\n", (full ? it->filepath.c_str() : it->filename.c_str()), it->linenum.c_str(), lstr.c_str()); break; case sqlqueryresultlist::sqlresultFILE_ONLY: printf("%s\n", it->filepath.c_str()); break; default: break; } } return retVal; } int main(int argc, char *argv[]) { int c; bool bSqlite, bParam, bGraph, bTerm, bExact, bFull; bool bDebug, bVersion, bHelp, bError; int countExact = 0; int limitlen = 80; bSqlite = false; bParam = false; bGraph = false; bTerm = false; bExact = false; bFull = false; bDebug = false; bVersion = false; bHelp = (argc <= 1); bError = false; tStr sqfn, param = "1", term, fpath = ""; while ((c = getopt2(argc, argv, "s:p:gt:l:efub:dvh")) != -1) { switch(c) { case 'v': bVersion = true; break; case 'h': bHelp = true; break; case 'e': bExact = true; countExact++; bError = bError || (countExact > 1); if (countExact > 1) printf("Error: either -e or -f but not both!\n"); break; case 'f': bExact = false; countExact++; bError = bError || (countExact > 1); if (countExact > 1) printf("Error: either -e or -f but not both!\n"); break; case 's': bSqlite = true; process_argwithopt(optarg, c, bError, sqfn, true); break; case 'p': bParam = true; param = optarg; break; case 'b': fpath = optarg; break; case 'g': bGraph = true; break; case 't': bTerm = true; term = optarg; break; case 'l': limitlen = atoi(optarg); break; case 'u': bFull = true; break; case 'd': bDebug = true; break; case '?': bError = true; break; default: break; } } if (bVersion) { printlicense(); return 0; } if (bHelp || bError) { printhelp(extract_filename(argv[0])); return (bError ? 1 : 0); } if (!bSqlite) { printf("Error: -s is required.\n"); bError = true; } if (!bTerm) { printf("Error: -t is required.\n"); bError = true; } if (bError) { printhelp(extract_filename(argv[0])); return 1; } if (bSqlite && bTerm) { bError = process_query(sqfn, term, param, bExact, bFull, bDebug, limitlen, bGraph, fpath) > 0; } if (bError) { printhelp(extract_filename(argv[0])); } return bError; } ================================================ FILE: cmakefind/FindSqlite.cmake ================================================ # # The following license applies only to this file: # # - find Sqlite 3 # SQLITE_INCLUDE_DIR - Where to find Sqlite 3 header files (directory) # SQLITE_LIBRARIES - Sqlite 3 libraries # SQLITE_LIBRARY_RELEASE - Where the release library is # SQLITE_LIBRARY_DEBUG - Where the debug library is # SQLITE_FOUND - Set to TRUE if we found everything (library, includes and executable) # Copyright (c) 2010 Pau Garcia i Quiles, # # Redistribution and use is allowed according to the terms of the BSD license. # For details see the accompanying COPYING-CMAKE-SCRIPTS file. # # Generated by CModuler, a CMake Module Generator - http://gitorious.org/cmoduler IF( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARY_RELEASE ) SET(SQLITE_FIND_QUIETLY TRUE) ENDIF( SQLITE_INCLUDE_DIR AND SQLITE_LIBRARY_RELEASE ) IF ( UNIX ) FIND_PATH( SQLITE_INCLUDE_DIR sqlite3.h ) FIND_LIBRARY(SQLITE_LIBRARY_RELEASE NAMES sqlite3 ) ELSE ( UNIX ) FIND_PATH( SQLITE_INCLUDE_DIR sqlite3.h "/sqlite3/include") FIND_LIBRARY( SQLITE_LIBRARY_RELEASE NAMES sqlite3 ) ENDIF ( UNIX ) IF( SQLITE_LIBRARY_RELEASE AND SQLITE_INCLUDE_DIR ) SET( SQLITE_FOUND TRUE ) ENDIF( SQLITE_LIBRARY_RELEASE AND SQLITE_INCLUDE_DIR ) IF( SQLITE_LIBRARY_RELEASE ) SET( SQLITE_LIBRARIES ${SQLITE_LIBRARY_RELEASE} ) ENDIF( SQLITE_LIBRARY_RELEASE ) IF( SQLITE_FOUND ) IF( NOT SQLITE_FIND_QUIETLY ) MESSAGE( STATUS "Found Sqlite3 header file in ${SQLITE_INCLUDE_DIR}") MESSAGE( STATUS "Found Sqlite3 libraries: ${SQLITE_LIBRARIES}") ENDIF( NOT SQLITE_FIND_QUIETLY ) ELSE(SQLITE_FOUND) IF( SQLITE_FIND_REQUIRED) MESSAGE( FATAL_ERROR "Could not find Sqlite3" ) ELSE( SQLITE_FIND_REQUIRED) MESSAGE( STATUS "Optional package Sqlite3 was not found" ) ENDIF( SQLITE_FIND_REQUIRED) ENDIF(SQLITE_FOUND) ================================================ FILE: doc/HOWTO-LINUX.md ================================================ HOWTO GUIDE =========== This HOWTO guide applies to Linux only ## HOW TO USE CODEQUERY WITH C/C++ CODE? 1. Change directory to the base folder of your source code like this: ```bash cd ~/projects/myproject/src ``` 2. Create a cscope.files file with all the C/C++ source files listed in it. Files with [inline assembly code](http://en.wikipedia.org/wiki/Inline_assembler) should be excluded from this list. ```bash find . -iname "*.c" > ./cscope.files find . -iname "*.cpp" >> ./cscope.files find . -iname "*.cxx" >> ./cscope.files find . -iname "*.cc " >> ./cscope.files find . -iname "*.h" >> ./cscope.files find . -iname "*.hpp" >> ./cscope.files find . -iname "*.hxx" >> ./cscope.files find . -iname "*.hh " >> ./cscope.files ``` 3. Create a cscope database like this (add `k`, if you don't want standard include paths like for stdio.h): ```bash cscope -cb ``` Omission of `c` (to use compressed cscope database) is now supported experimentally. 4. Create a ctags database like this. ```bash ctags --fields=+i -n -L ./cscope.files ``` 5. Run cqmakedb to create a CodeQuery database out of the cscope and ctags databases, like this: ```bash cqmakedb -s ./myproject.db -c ./cscope.out -t ./tags -p ``` 6. Open myproject.db using the CodeQuery GUI tool by running the following. Wild card search (* and ?) supported if Exact Match is switched off. Or use cqsearch, the CLI-version of CodeQuery (type `cqsearch -h` for more info). ```bash codequery ``` Use `cqmakedb -h` to get help on cqmakedb command line arguments. Use `codequery -h` to get help on codequery command line arguments. ## HOW TO USE CODEQUERY WITH JAVA CODE? 1. Change directory to the base folder of your source code like this: ```bash cd ~/projects/myproject/src ``` 2. Create a cscope.files file with all the Java source files listed in it. ```bash find . -iname "*.java" > ./cscope.files ``` 3. Create a cscope database like this: ```bash cscope -cb ``` Omission of `c` (to use compressed cscope database) is now supported experimentally. 4. Create a ctags database like this: ```bash ctags --fields=+i -n -L ./cscope.files ``` 5. Run cqmakedb to create a CodeQuery database out of the cscope and ctags databases, like this: ```bash cqmakedb -s ./myproject.db -c ./cscope.out -t ./tags -p ``` 6. Open myproject.db using the CodeQuery GUI tool by running the following. Wild card search (* and ?) supported if Exact Match is switched off. Or use cqsearch, the CLI-version of CodeQuery (type `cqsearch -h` for more info). ```bash codequery ``` Use `cqmakedb -h` to get help on cqmakedb command line arguments. Use `codequery -h` to get help on codequery command line arguments. ## HOW TO USE CODEQUERY WITH PYTHON CODE? If you want to browse Python code, don't forget to install [pycscope](https://github.com/portante/pycscope). Information on how to install this tool is available on its github page. 1. Change directory to the base folder of your source code like this: ```bash cd ~/projects/myproject/src ``` 2. Create a cscope.files file with all the Python source files listed in it. ```bash find . -iname "*.py" > ./cscope.files ``` 3. Create a cscope database like this: ```bash pycscope -i ./cscope.files ``` 4. Create a ctags database like this. ```bash ctags --fields=+i -n -L ./cscope.files ``` 5. Run cqmakedb to create a CodeQuery database out of the cscope and ctags databases, like this: ```bash cqmakedb -s ./myproject.db -c ./cscope.out -t ./tags -p ``` 6. Open myproject.db using the CodeQuery GUI tool by running the following. Wild card search (* and ?) supported if Exact Match is switched off. Or use cqsearch, the CLI-version of CodeQuery (type `cqsearch -h` for more info). ```bash codequery ``` Use `cqmakedb -h` to get help on cqmakedb command line arguments. Use `codequery -h` to get help on codequery command line arguments. ## HOW TO USE CODEQUERY WITH RUBY, GO AND JAVASCRIPT CODE? If you want to browse Ruby, Go or Javascript code, don't forget to install [starscope](https://github.com/eapache/starscope). Information on how to install this tool is available on its github page. 1. Change directory to the base folder of your source code like this: ```bash cd ~/projects/myproject/src ``` 2. Create a cscope.files file with all the Ruby, Go or Javascript source files listed in it. ```bash find . -iname "*.rb" > ./cscope.files find . -iname "*.go" >> ./cscope.files find . -iname "*.js" >> ./cscope.files ``` 3. Create a cscope database like this: ```bash starscope -e cscope ``` 4. Create a ctags database like this. ```bash ctags --fields=+i -n -L ./cscope.files ``` 5. Run cqmakedb to create a CodeQuery database out of the cscope and ctags databases, like this: ```bash cqmakedb -s ./myproject.db -c ./cscope.out -t ./tags -p ``` 6. Open myproject.db using the CodeQuery GUI tool by running the following. Wild card search (* and ?) supported if Exact Match is switched off. Or use cqsearch, the CLI-version of CodeQuery (type `cqsearch -h` for more info). ```bash codequery ``` Use `cqmakedb -h` to get help on cqmakedb command line arguments. Use `codequery -h` to get help on codequery command line arguments. ================================================ FILE: doc/INSTALL-LINUX.md ================================================ HOW TO INSTALL CODEQUERY IN LINUX ================================= This INSTALL guide applies to Linux and Mac only (For Windows, a SETUP EXE package will be provided) ## HOW TO INSTALL IN LINUX? Step 1: Install CMake (>=3.16), sqlite3, Qt5 (>=5.12) or Qt6 (>=6.4) for Qt5 or Qt6, cscope (15.8a or higher), ctags. If you have Ubuntu, Linux Mint, Debian or Fedora installed, most of these should be obtainable through the package managers. Note that the cscope version on the Ubuntu repositories may not be the latest one. It's better to have the latest version of cscope installed. [CMake](http://www.cmake.org/) [sqlite3](http://www.sqlite.org/) [Qt5 or Qt6](http://qt-project.org/) [cscope](http://cscope.sourceforge.net/) for C/C++/Java [Exuberant ctags](http://ctags.sourceforge.net/) [Universal ctags](https://github.com/universal-ctags/ctags/) [pycscope](https://github.com/portante/pycscope) for Python [starscope](https://github.com/eapache/starscope) for Ruby, Go and Javascript In Ubuntu or Linux Mint or Debian, do the following first: ```bash sudo apt-get update sudo apt-get install build-essential g++ git cmake ninja-build sqlite3 libsqlite3-dev cscope exuberant-ctags ``` In Ubuntu or Linux Mint or Debian, do the following next for Qt5: ```bash sudo apt-get install qtcreator qtbase5-dev qt5-qmake qttools5-dev-tools qttools5-dev ``` In Ubuntu or Linux Mint or Debian, do the following next for Qt6: ```bash sudo apt-get install libglx-dev libgl1-mesa-dev libvulkan-dev libxkbcommon-dev sudo apt-get install qt6-base-dev qt6-base-dev-tools qt6-tools-dev qt6-tools-dev-tools sudo apt-get install libqt6core5compat6-dev qt6-l10n-tools qt6-wayland ``` If you want to browse Python code, don't forget to install [pycscope](https://github.com/portante/pycscope) at this point. Information on how to install this tool is available on its github page. If you want to browse Ruby, Go or Javascript code, don't forget to install [starscope](https://github.com/eapache/starscope) at this point. Information on how to install this tool is available on its github page. Step 2: Download the repository as a ZIP file from github or clone git repository: [codequery@github](https://github.com/ruben2020/codequery) ```bash cd ~/myrepos git clone https://github.com/ruben2020/codequery.git ``` Step 3: Unzip to a directory and change to that directory. ```bash cd ~/myrepos/codequery ``` Step 4: Run cmake (first line for Qt6 OR second line for Qt5 OR third line for no GUI). ```bash cmake -G Ninja -S . -B build cmake -G Ninja -DBUILD_QT5=ON -S . -B build cmake -G Ninja -DNO_GUI=ON -S . -B build ``` Step 5: Build and install. ```bash cmake --build build sudo cmake --install build ``` If you want to install to an alternative directory instead of the default one, use the following: ```bash cmake -DCMAKE_INSTALL_PREFIX="/home/johndoe/tools/" -G Ninja -S . -B build cmake --build build sudo cmake --install build ``` Step 6: Please read [HOWTO-LINUX](HOWTO-LINUX.md) to learn how to use this software. If the theming of the codequery GUI app looks strange in environments other than KDE Plasma, please refer to [this page](https://wiki.archlinux.org/title/Qt#Configuration_of_Qt_5/6_applications_under_environments_other_than_KDE_Plasma) for hints. ================================================ FILE: gui/CMakeLists.txt ================================================ # # CodeQuery # Copyright (C) 2013-2018 ruben2020 https://github.com/ruben2020/ # # This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. # cmake_minimum_required(VERSION 3.16.0) project(CodeQueryGUI) #ADD_DEFINITIONS( -Wall ) if(${CMAKE_VERSION} VERSION_GREATER_EQUAL "3.10.0") foreach(p CMP0071 # 3.10: Let AUTOMOC and AUTOUIC process GENERATED files ) if(POLICY ${p}) cmake_policy(SET ${p} NEW) endif() endforeach() endif() # with SET() command you can change variables or define new ones # here we define CODEQUERY_SRCS variable that contains a list of all .cpp files # note that we don't need \ at the end of line SET( CODEQUERY_SRCS ../querylib/small_lib.cpp ../querylib/sqlquery.cpp langtable.cpp fileviewer.cpp listhandler.cpp searchhandler.cpp mainwindow.cpp graphdialog.cpp aboutdialog.cpp fileviewsettingsdialog.cpp themes.cpp main_gui.cpp winmain.cpp ) # another list, this time it includes all header files that should be treated with moc SET( CODEQUERY_MOC_HDRS fileviewer.h listhandler.h searchhandler.h mainwindow.h graphdialog.h aboutdialog.h fileviewsettingsdialog.h ) # some .ui files SET( CODEQUERY_UIS ui/mainWindow.ui ui/graphDialog.ui ui/aboutDialog.ui ui/fileViewSettingsDialog.ui ) # and finally an resource file #SET( CODEQUERY_RCS # codequery.qrc #) # translation files SET( CODEQUERY_TRANS translations/codequery_de.ts translations/codequery_en.ts translations/codequery_es.ts translations/codequery_fr.ts translations/codequery_id.ts translations/codequery_it.ts translations/codequery_ja.ts translations/codequery_ko.ts translations/codequery_zh-CHS.ts translations/codequery_zh-CHT.ts ) SET( CQIMAGES_RC_QRC "${CMAKE_CURRENT_SOURCE_DIR}/cqimages.qrc") SET( CQIMAGES_RC_SRCS "${CMAKE_CURRENT_BINARY_DIR}/qrc_cqimages.cxx") SET( CQTRANS_RC_QRCT "${CMAKE_CURRENT_SOURCE_DIR}/cqtrans.qrc.template") SET( CQTRANS_RC_QRC "${CMAKE_CURRENT_BINARY_DIR}/cqtrans.qrc") SET( CQTRANS_RC_SRCS "${CMAKE_CURRENT_BINARY_DIR}/qrc_cqtrans.cxx") if (WIN32) SET( COPY_COMMAND "copy") string(REPLACE "/" "\\" CQTRANS_RC_QRCT_CP "${CQTRANS_RC_QRCT}") string(REPLACE "/" "\\" CQTRANS_RC_QRC_CP "${CQTRANS_RC_QRC}") else (WIN32) SET( COPY_COMMAND "cp") SET( CQTRANS_RC_QRCT_CP "${CQTRANS_RC_QRCT}") SET( CQTRANS_RC_QRC_CP "${CQTRANS_RC_QRC}") endif (WIN32) add_definitions( -DNO_QDESIGNER_WIDGET_EXPORT ) INCLUDE_DIRECTORIES( "${CMAKE_CURRENT_BINARY_DIR}" ) INCLUDE_DIRECTORIES( "." ) INCLUDE_DIRECTORIES( "./translations" ) INCLUDE_DIRECTORIES( "../querylib" ) INCLUDE_DIRECTORIES( "../makedb" ) INCLUDE_DIRECTORIES( "../showgraph" ) INCLUDE_DIRECTORIES( "/usr/local/include" ) INCLUDE_DIRECTORIES( "../lexilla/include" ) INCLUDE_DIRECTORIES( "../scintilla/qt/ScintillaEdit" ) INCLUDE_DIRECTORIES( "../scintilla/qt/ScintillaEditBase" ) INCLUDE_DIRECTORIES( "../scintilla/include" ) INCLUDE_DIRECTORIES( "../scintilla/src" ) INCLUDE_DIRECTORIES( "../scintilla/lexlib" ) if(GHAWIN) find_package(unofficial-sqlite3 CONFIG REQUIRED) set( SQLITE_LIBRARIES "unofficial::sqlite3::sqlite3" ) else(GHAWIN) find_package(Sqlite REQUIRED) include_directories( "${SQLITE_INCLUDE_DIR}" ) endif(GHAWIN) if (BUILD_QT5) # this command finds Qt4 libraries and sets all required variables # note that it's Qt4, not QT4 or qt4 FIND_PACKAGE( Qt5Widgets REQUIRED ) FIND_PACKAGE( Qt5Core REQUIRED ) FIND_PACKAGE( Qt5Concurrent REQUIRED ) FIND_PACKAGE( Qt5Xml REQUIRED ) FIND_PACKAGE( Qt5LinguistTools REQUIRED ) add_definitions( -DUSE_QT5 ) #add_compile_definitions(QT_DISABLE_DEPRECATED_UP_TO=0x050F00) set_target_properties(Qt5::Core PROPERTIES MAP_IMPORTED_CONFIG_COVERAGE "RELEASE") SET(CMAKE_AUTOMOC ON) SET(CMAKE_INCLUDE_CURRENT_DIR ON) get_target_property(QT_RCC_EXECUTABLE Qt5::rcc LOCATION) QT5_ADD_TRANSLATION( QM ${CODEQUERY_TRANS} ) # this command will generate rules that will run rcc on all files from CODEQUERY_RCS # in result CQIMAGES_RC_SRCS variable will contain paths to files produced by rcc # QT4_ADD_RESOURCES( CQIMAGES_RC_SRCS ${CODEQUERY_RCS} ) # Run the resource compiler (rcc_options should already be set). ADD_CUSTOM_COMMAND( OUTPUT ${CQIMAGES_RC_SRCS} COMMAND ${QT_RCC_EXECUTABLE} ARGS ${rcc_options} -name cqimages -o ${CQIMAGES_RC_SRCS} ${CQIMAGES_RC_QRC} ) ADD_CUSTOM_COMMAND( OUTPUT ${CQTRANS_RC_SRCS} COMMAND ${QT_RCC_EXECUTABLE} ARGS ${rcc_options} -name cqtrans -o ${CQTRANS_RC_SRCS} ${CQTRANS_RC_QRC} DEPENDS ${QM} ${CQTRANS_RC_QRC} ) ADD_CUSTOM_COMMAND( OUTPUT ${CQTRANS_RC_QRC} COMMAND ${COPY_COMMAND} ARGS ${CQTRANS_RC_QRCT_CP} ${CQTRANS_RC_QRC_CP} ) # this will run uic on .ui files: QT5_WRAP_UI( CODEQUERY_UI_HDRS ${CODEQUERY_UIS} ) # we need this to be able to include headers produced by uic in our code # (CMAKE_BINARY_DIR holds a path to the build directory, while INCLUDE_DIRECTORIES() works just like INCLUDEPATH from qmake) INCLUDE_DIRECTORIES( "${Qt5Widgets_INCLUDE_DIRS}" ) if(WIN32) SET(CQ_WIN_RCS cqwin64.rc) add_executable( codequery WIN32 ${CODEQUERY_SRCS} ${CODEQUERY_MOC_SRCS} ${CQIMAGES_RC_SRCS} ${CQTRANS_RC_SRCS} ${CODEQUERY_UI_HDRS} ${QM} ${CQ_WIN_RCS} ) target_link_libraries( codequery Qt5::Widgets Qt5::Concurrent Qt5::WinMain ${SQLITE_LIBRARIES} cqshowgraph-qt5 scintillaedit lexilla) else() add_executable( codequery ${CODEQUERY_SRCS} ${CODEQUERY_MOC_SRCS} ${CQIMAGES_RC_SRCS} ${CQTRANS_RC_SRCS} ${CODEQUERY_UI_HDRS} ${QM} ) target_link_libraries( codequery Qt5::Widgets Qt5::Concurrent ${SQLITE_LIBRARIES} cqshowgraph-qt5 scintillaedit lexilla) endif() install(TARGETS codequery RUNTIME DESTINATION bin) else (BUILD_QT5) find_package(Qt6 REQUIRED COMPONENTS Core Widgets Concurrent Xml LinguistTools ) set(CMAKE_AUTOMOC ON) set(CMAKE_AUTORCC OFF) set(CMAKE_AUTOUIC OFF) add_definitions( -DUSE_QT6 ) add_compile_definitions(QT_DISABLE_DEPRECATED_UP_TO=0x050F00) set_target_properties(Qt6::Core PROPERTIES MAP_IMPORTED_CONFIG_COVERAGE "RELEASE") get_target_property(QT_RCC_EXECUTABLE Qt6::rcc LOCATION) qt6_add_translation( QM ${CODEQUERY_TRANS} ) ADD_CUSTOM_COMMAND( OUTPUT ${CQIMAGES_RC_SRCS} COMMAND ${QT_RCC_EXECUTABLE} ARGS ${rcc_options} -name cqimages -o ${CQIMAGES_RC_SRCS} ${CQIMAGES_RC_QRC} ) ADD_CUSTOM_COMMAND( OUTPUT ${CQTRANS_RC_SRCS} COMMAND ${QT_RCC_EXECUTABLE} ARGS ${rcc_options} -name cqtrans -o ${CQTRANS_RC_SRCS} ${CQTRANS_RC_QRC} DEPENDS ${QM} ${CQTRANS_RC_QRC} ) ADD_CUSTOM_COMMAND( OUTPUT ${CQTRANS_RC_QRC} COMMAND ${COPY_COMMAND} ARGS ${CQTRANS_RC_QRCT_CP} ${CQTRANS_RC_QRC_CP} ) qt6_wrap_ui( CODEQUERY_UI_HDRS ${CODEQUERY_UIS} ) if(WIN32) SET(CQ_WIN_RCS cqwin64.rc) add_executable( codequery WIN32 ${CODEQUERY_SRCS} ${CODEQUERY_MOC_SRCS} ${CQIMAGES_RC_SRCS} ${CQTRANS_RC_SRCS} ${CODEQUERY_UI_HDRS} ${QM} ${CQ_WIN_RCS} ) target_link_libraries( codequery PRIVATE Qt6::Widgets Qt6::Concurrent ${SQLITE_LIBRARIES} cqshowgraph-qt6 scintillaedit lexilla ) else() add_executable( codequery ${CODEQUERY_SRCS} ${CODEQUERY_MOC_SRCS} ${CQIMAGES_RC_SRCS} ${CQTRANS_RC_SRCS} ${CODEQUERY_UI_HDRS} ${QM} ) target_link_libraries( codequery PRIVATE Qt6::Widgets Qt6::Concurrent ${SQLITE_LIBRARIES} cqshowgraph-qt6 scintillaedit lexilla ) endif() install(TARGETS codequery RUNTIME DESTINATION bin) endif (BUILD_QT5) ================================================ FILE: gui/aboutdialog.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #include "ui_aboutDialog.h" #include "aboutdialog.h" #include "swver.h" cqDialogAbout::cqDialogAbout(QWidget *parent) :QDialog(parent) ,dialog_ui(new Ui::aboutDialog) { dialog_ui->setupUi(this); dialog_ui->labelTitle->setText(CODEQUERY_SW_VERSION_WEBSITE); dialog_ui->labelLicense->setText(CODEQUERY_SW_LICENSE_PARA_LINK); connect(dialog_ui->pushButtonCloseAbout, SIGNAL(clicked()), this, SLOT(accept())); resize(sizeHint()); layout()->setSizeConstraint(QLayout::SetFixedSize) ; setSizeGripEnabled(false) ; } cqDialogAbout::~cqDialogAbout() { disconnect(); delete dialog_ui; } ================================================ FILE: gui/aboutdialog.h ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifndef ABOUTDIALOG_H_CQ #define ABOUTDIALOG_H_CQ #include #include namespace Ui { class aboutDialog; } class cqDialogAbout : public QDialog { Q_OBJECT public: Ui::aboutDialog *dialog_ui; cqDialogAbout(QWidget *parent); virtual ~cqDialogAbout(); }; #endif //ABOUTDIALOG_H_CQ ================================================ FILE: gui/cqimages.qrc ================================================ images/Folder2.png images/Search.png images/Arrow2_Left.png images/Arrow2_Right.png images/Arrow2_Up.png images/Arrow2_Down.png images/Clipboard_Copy.png images/Clipboard_Paste.png images/Database.png images/Document2.png images/Flag.png images/Graph.png images/Zoom_Out.png images/Zoom_In.png images/Text_Minus.png images/Text_Plus.png images/logo.png ================================================ FILE: gui/cqtrans.qrc.template ================================================ codequery_de.qm codequery_en.qm codequery_es.qm codequery_fr.qm codequery_id.qm codequery_it.qm codequery_ja.qm codequery_ko.qm codequery_zh-CHS.qm codequery_zh-CHT.qm ================================================ FILE: gui/cqwin32.rc ================================================ IDI_ICON1 ICON DISCARDABLE "images/logo6464.ico" IDI_ICON2 ICON DISCARDABLE "images/logo4848.ico" IDI_ICON3 ICON DISCARDABLE "images/logo3232.ico" IDI_ICON4 ICON DISCARDABLE "images/logo1616.ico" ================================================ FILE: gui/cqwin64.rc ================================================ IDI_ICON1 ICON DISCARDABLE "images/logo128128.ico" IDI_ICON2 ICON DISCARDABLE "images/logo6464.ico" IDI_ICON3 ICON DISCARDABLE "images/logo4848.ico" IDI_ICON4 ICON DISCARDABLE "images/logo3232.ico" IDI_ICON5 ICON DISCARDABLE "images/logo1616.ico" ================================================ FILE: gui/fileviewer.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #include #include #include #include #include #include #include "ILexer.h" #include "Lexilla.h" #include "ScintillaEdit.h" #include "SciLexer.h" #include "fileviewer.h" #include "mainwindow.h" #include "fileviewsettingsdialog.h" #include "themes.h" #if defined(_WIN32) #define EXT_EDITOR_DEFAULT_PATH "notepad %f" #elif defined(__APPLE__) #define EXT_EDITOR_DEFAULT_PATH "open -t %f" #else #define EXT_EDITOR_DEFAULT_PATH "gedit %f +%n" #endif filedata::filedata() { linenum = "1"; fileid = -99; } filedata::filedata(const QString& fn, const QString& ln, const int& fi) { linenum = ln; filename = fn; fileid = fi; } bool filedata::compare(const filedata& fd) { bool cmp; if ((fileid < 0)||(fd.fileid < 0)) { cmp = ((linenum.compare(fd.linenum) == 0)&& (filename.compare(fd.filename) == 0)); } else { cmp = ((linenum.compare(fd.linenum) == 0)&& (fileid == fd.fileid)); } return cmp; } bool filedata::compareFilePathOnly(const filedata& fd) { bool cmp; if ((fileid < 0)||(fd.fileid < 0)) { cmp = (filename.compare(fd.filename) == 0); } else { cmp = (fileid == fd.fileid); } return cmp; } bool filedata::compareFileNameOnly(const filedata& fd) { bool cmp; if ((fileid < 0)||(fd.fileid < 0)) { cmp =(strcmp( extract_filename(filename.C_STR()), extract_filename(fd.filename.C_STR())) == 0); } else { cmp = (fileid == fd.fileid); } return cmp; } filedata::filedata(const filedata& fd) { linenum = fd.linenum; filename = fd.filename; fileid = fd.fileid; } filedata& filedata::operator=(const filedata& fd) { if (&fd != this) { linenum = fd.linenum; filename = fd.filename; fileid = fd.fileid; } return *this; } fileviewer::fileviewer(mainwindow* pmw) :mw(pmw) ,m_pushButtonPrev(NULL) ,m_pushButtonNext(NULL) ,m_pushButtonOpenInEditor(NULL) ,m_pushButtonPaste(NULL) ,m_pushButtonGoToLine(NULL) ,m_labelFilePath(NULL) ,m_textEditSource(NULL) ,m_textEditSourceFont("Courier New", 12) ,m_externalEditorPath(EXT_EDITOR_DEFAULT_PATH) ,m_timestampMismatchWarned(false) ,m_lexer(NULL) ,m_fontsize(0) ,m_currentlang(enHighlightCPP) ,m_currentline(1) ,m_annotline(1) ,m_pushButtonTextShrink(NULL) ,m_pushButtonTextEnlarge(NULL) ,m_checkBoxSymbolOnly(NULL) ,m_listWidgetFunc(NULL) ,m_comboBoxFuncListSort(NULL) ,m_fontwidthtemp(1) ,m_markerhandle(1) ,m_markerhandle2(2) { m_iter = m_fileDataList.begin(); m_textEditSourceFont.setStyleHint(QFont::TypeWriter); } fileviewer::~fileviewer() { disconnect(); } void fileviewer::createFontList(void) { QFontDatabase fontdb; QStringList fontlst = fontdb.families(QFontDatabase::Latin); QStringList fixedpitch; QStringList::iterator it; for(it = fontlst.begin(); it != fontlst.end(); it++) { if (fontdb.isFixedPitch(*it)) { fixedpitch << (*it); } } fixedpitch.sort(); m_fontlist = fixedpitch; } QString fileviewer::checkFontFamily(QString fontname) { QString newfont; #ifdef _WIN32 QString tryfont1 = "Consolas"; QString tryfont2 = "Courier New"; #else QString tryfont1 = "Monospace"; QString tryfont2 = "Ubuntu Mono"; #endif if (m_fontlist.isEmpty()) createFontList(); if (m_fontlist.contains(fontname)) { newfont = fontname; } else { newfont = QFontDatabase::systemFont(QFontDatabase::FixedFont).family(); } return newfont; } void fileviewer::init(void) { m_pushButtonPaste->setEnabled(false); m_pushButtonPrev->setEnabled(false); m_pushButtonNext->setEnabled(false); m_pushButtonTextShrink->setEnabled(false); m_pushButtonTextEnlarge->setEnabled(false); m_pushButtonGoToLine->setEnabled(false); m_pushButtonOpenInEditor->setEnabled(false); m_labelFilePath->clear(); m_textEditSource->setWrapMode(SC_WRAP_NONE); m_textEditSource->setReadOnly(true); m_markerhandle = 0; m_markerhandle2 = 1; m_textEditSource->markerDefine(m_markerhandle, SC_MARK_BACKGROUND); m_textEditSource->markerDefine(m_markerhandle2, SC_MARK_ARROW); m_textEditSource->setMarginTypeN(0, SC_MARGIN_NUMBER); m_textEditSource->setMarginTypeN(1, SC_MARGIN_SYMBOL); m_textEditSource->annotationSetVisible(ANNOTATION_BOXED); m_textEditSource->setCodePage(SC_CP_UTF8); m_textEditSource->setCaretPeriod(0); createFontList(); ScintillaEditBase *textEditSourceBase = m_textEditSource; connect(textEditSourceBase, SIGNAL(selectionChanged(bool)), this, SLOT(AbleToCopy(bool))); connect(m_pushButtonGoToLine, SIGNAL(clicked(bool)), this, SLOT(GoToLine_ButtonClick(bool))); connect(m_pushButtonPaste, SIGNAL(clicked(bool)), this, SLOT(Paste_ButtonClick(bool))); connect(m_pushButtonPrev, SIGNAL(clicked(bool)), this, SLOT(Prev_ButtonClick(bool))); connect(m_pushButtonNext, SIGNAL(clicked(bool)), this, SLOT(Next_ButtonClick(bool))); connect(m_pushButtonOpenInEditor, SIGNAL(clicked(bool)), this, SLOT(OpenInEditor_ButtonClick(bool))); connect(m_pushButtonTextShrink, SIGNAL(clicked(bool)), this, SLOT(TextShrink_ButtonClick(bool))); connect(m_pushButtonTextEnlarge, SIGNAL(clicked(bool)), this, SLOT(TextEnlarge_ButtonClick(bool))); connect(m_listWidgetFunc, SIGNAL(itemPressed(QListWidgetItem *)), this, SLOT(funcItemSelected(QListWidgetItem *))); connect(m_comboBoxFuncListSort, SIGNAL(currentIndexChanged(int)), this, SLOT(FuncListSort_indexChanged(int))); m_fileDataList.clear(); clearTextEdit(); setLexer(); } void fileviewer::clearList() { //printf("Fileview clearlist\n"); m_pushButtonPaste->setEnabled(false); m_pushButtonPrev->setEnabled(false); m_pushButtonNext->setEnabled(false); m_pushButtonTextShrink->setEnabled(false); m_pushButtonTextEnlarge->setEnabled(false); m_pushButtonGoToLine->setEnabled(false); m_pushButtonOpenInEditor->setEnabled(false); m_labelFilePath->clear(); clearTextEdit(); m_fileDataList.clear(); m_iter = m_fileDataList.begin(); m_timestampMismatchWarned = false; m_listWidgetFunc->clear(); } void fileviewer::recvDBtimestamp(QDateTime dt) { m_DBtimestamp = dt; } void fileviewer::fileToBeOpened(QString filename, QString linenum, int fileid) { filename.replace(QString("$HOME"), QDir::homePath()); #ifdef _WIN32 filename.replace("/", "\\"); #endif if (!(QFile::exists(filename))) { setFilePathLabelText(tr("File not found")); handleFileCannotBeOpenedCase(); return; } QFile file(filename); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { setFilePathLabelText(tr("File could not be opened")); handleFileCannotBeOpenedCase(); return; } file.close(); QFileInfo fi(filename); if ((m_DBtimestamp < fi.lastModified())&&(m_timestampMismatchWarned == false)) { m_timestampMismatchWarned = true; QMessageBox msgBox((QWidget*)mw); msgBox.setIcon(QMessageBox::Warning); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setText(tr("The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file.")); msgBox.exec(); } filedata fd(filename, linenum, fileid); if (m_fileDataList.isEmpty()) { //printf("Fileviewer: empty list\n"); m_fileDataList.push_back(fd); m_iter = m_fileDataList.end() - 1; m_pushButtonPrev->setEnabled(false); m_pushButtonNext->setEnabled(false); updateTextEdit(); return; } else if (m_iter == m_fileDataList.end()) { // previous file not found //printf("Fileviewer: previous file not found %d, %d\n", m_fileDataList.end(), m_fileDataList.end() - 1); m_fileDataList.push_back(fd); m_iter = m_fileDataList.end() - 1; m_pushButtonPrev->setEnabled(m_iter != m_fileDataList.begin()); m_pushButtonNext->setEnabled(false); updateTextEdit(); } else if (m_iter->compare(fd)) { // the same filename and line number //printf("Fileviewer: same filename and line number\n"); updateFilePathLabel(); return; } else if (m_iter->compareFilePathOnly(fd)) { // same file, different line number //printf("Fileviewer: same file, different line number\n"); m_fileDataList.push_back(fd); m_iter = m_fileDataList.end() - 1; m_pushButtonPrev->setEnabled(true); m_pushButtonNext->setEnabled(false); highlightLine(fd.linenum.toInt()); updateFilePathLabel(); } else { // different file //printf("Fileviewer: different file\n"); m_fileDataList.push_back(fd); m_iter = m_fileDataList.end() - 1; m_pushButtonPrev->setEnabled(true); m_pushButtonNext->setEnabled(false); updateTextEdit(); } if ((m_fileDataList.isEmpty())||(m_iter == m_fileDataList.end())) return; QVector::iterator it = m_fileDataList.begin(); while ((it != m_fileDataList.end() - 1)&&(it != m_fileDataList.end())) { if (it->compare(fd)) it = m_fileDataList.erase(it); else it++; } if (m_fileDataList.size() > 20) m_fileDataList.erase(m_fileDataList.begin()); m_iter = m_fileDataList.end() - 1; } void fileviewer::clearTextEdit(void) { m_textEditSource->setReadOnly(false); m_textEditSource->clearAll(); m_textEditSource->setReadOnly(true); } void fileviewer::updateTextEdit(void) { if (m_iter == m_fileDataList.end()) return; QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); clearTextEdit(); QFile file(m_iter->filename); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { QApplication::restoreOverrideCursor(); return; } QTextStream in(&file); int lang = enHighlightCPP; // default QRegularExpression rx1("\\.py$", QRegularExpression::CaseInsensitiveOption); auto pos = rx1.match(m_iter->filename); if (pos.hasMatch()) lang = enHighlightPython; QRegularExpression rx2("\\.java$", QRegularExpression::CaseInsensitiveOption); pos = rx2.match(m_iter->filename); if (pos.hasMatch()) lang = enHighlightJava; QRegularExpression rx3("\\.rb$", QRegularExpression::CaseInsensitiveOption); pos = rx3.match(m_iter->filename); if (pos.hasMatch()) lang = enHighlightRuby; QRegularExpression rx4("\\.js$", QRegularExpression::CaseInsensitiveOption); pos = rx4.match(m_iter->filename); if (pos.hasMatch()) lang = enHighlightJavascript; QRegularExpression rx5("\\.go$", QRegularExpression::CaseInsensitiveOption); pos = rx5.match(m_iter->filename); if (pos.hasMatch()) lang = enHighlightGo; m_currentlang = lang; QString alltext; while (!in.atEnd()) { alltext = in.readAll(); } m_textEditSource->setReadOnly(false); m_textEditSource->setText(alltext.toUtf8().data()); m_textEditSource->setReadOnly(true); m_textEditSource->setMarginWidthN(0, m_textEditSource->textWidth(STYLE_LINENUMBER, QString::number(m_textEditSource->lineCount() * 10).C_STR())); highlightLine(m_iter->linenum.toInt()); updateFilePathLabel(); m_pushButtonGoToLine->setEnabled(true); m_pushButtonOpenInEditor->setEnabled(true); m_pushButtonTextShrink->setEnabled(true); m_pushButtonTextEnlarge->setEnabled(true); m_listWidgetFunc->clear(); if (m_iter->fileid < 0) {emit requestFuncList_filename(m_iter->filename);} else {emit requestFuncList_fileid(m_iter->fileid);} setLexer(lang); QApplication::restoreOverrideCursor(); } void fileviewer::updateFilePathLabel(void) { QString labeltext = m_iter->filename; labeltext += ":"; labeltext += m_iter->linenum; setFilePathLabelText(labeltext); m_pushButtonGoToLine->setEnabled(true); } void fileviewer::setFilePathLabelText(QString text) { m_filepathlabeltextfull = text.simplified(); filePathLabelTextResized(); repaintWidget(); } void fileviewer::filePathLabelTextResized() { QFontMetrics metrics(m_labelFilePath->font()); QString elidedText = metrics.elidedText(m_filepathlabeltextfull, Qt::ElideLeft, m_labelFilePath->width()); m_labelFilePath->setText(elidedText); } void fileviewer::repaintWidget() { QPalette palette = m_labelFilePath->palette(); palette.setColor(QPalette::Base, palette.color(QPalette::Window)); m_labelFilePath->setPalette(palette); } void fileviewer::braceMatchCheck(void) { long cpos, matchpos; cpos = m_textEditSource->currentPos(); matchpos = m_textEditSource->braceMatch(cpos, 0); if (matchpos == -1) { cpos--; matchpos = m_textEditSource->braceMatch(cpos, 0); } if (matchpos != -1) m_textEditSource->braceHighlight(cpos, matchpos); else m_textEditSource->braceHighlight(-1, -1); } void fileviewer::updateFuncList(void) { if (m_funclist.resultlist.empty()) return; long line = m_textEditSource->lineFromPosition(m_textEditSource->currentPos()) + 1; tStr selectedfunc = ""; unsigned int selectedline, line1; auto previt = m_funclist.resultlist.begin(); for (auto it = m_funclist.resultlist.begin(); it != m_funclist.resultlist.end(); it++) { if ( (line < it->intLinenum) && (line >= previt->intLinenum) ) { selectedfunc = previt->symname; selectedline = previt->intLinenum; break; } previt = it; } if (selectedfunc.isEmpty() == false) { auto itemlist = m_listWidgetFunc->findItems(selectedfunc, Qt::MatchExactly); for (auto it = itemlist.begin(); it != itemlist.end(); it++) { line1 = (*it)->data(Qt::UserRole).toUInt(); if (selectedline == line1) { m_listWidgetFunc->setCurrentItem(*it); break; } } } } void fileviewer::AbleToCopy(bool copy) { m_pushButtonPaste->setEnabled(copy); m_textEditSource->annotationClearAll(); braceMatchCheck(); updateFuncList(); if (copy) { m_textEditSource->copy(); m_annotline = m_textEditSource->lineFromPosition(m_textEditSource->selectionEnd()); QString str = (QApplication::clipboard())->text(); if (str.length() > 0) { emit requestAnnotation(str); } } } void fileviewer::GoToLine_ButtonClick(bool checked) { if (!checked) highlightLine(m_iter->linenum.toInt()); } void fileviewer::Prev_ButtonClick(bool checked) { if (m_fileDataList.isEmpty()) { m_pushButtonPrev->setEnabled(false); m_pushButtonNext->setEnabled(false); return; } if(m_iter == m_fileDataList.begin()) { m_pushButtonPrev->setEnabled(false); return; } if (!checked) { QVector::iterator it = m_iter; m_iter--; if ((it != m_fileDataList.end())&&(m_iter->compareFilePathOnly(*it))) { highlightLine(m_iter->linenum.toInt()); updateFilePathLabel(); } else { updateTextEdit(); } m_pushButtonPrev->setEnabled(m_iter != m_fileDataList.begin()); m_pushButtonNext->setEnabled(m_iter != m_fileDataList.end() - 1); } } void fileviewer::Next_ButtonClick(bool checked) { if (m_fileDataList.isEmpty()) { m_pushButtonPrev->setEnabled(false); m_pushButtonNext->setEnabled(false); return; } if((m_iter == m_fileDataList.end() - 1)|| (m_iter == m_fileDataList.end())) { m_pushButtonNext->setEnabled(false); return; } if (!checked) { QVector::iterator it = m_iter; m_iter++; if (m_iter->compareFilePathOnly(*it)) { highlightLine(m_iter->linenum.toInt()); updateFilePathLabel(); } else { updateTextEdit(); } m_pushButtonPrev->setEnabled(m_iter != m_fileDataList.begin()); m_pushButtonNext->setEnabled(m_iter != m_fileDataList.end() - 1); } } void fileviewer::handleFileCannotBeOpenedCase(void) { //printf("handleFileCannotBeOpenedCase\n"); clearTextEdit(); m_pushButtonTextShrink->setEnabled(false); m_pushButtonTextEnlarge->setEnabled(false); m_pushButtonGoToLine->setEnabled(false); m_pushButtonNext->setEnabled(false); m_pushButtonPrev->setEnabled(m_fileDataList.isEmpty() == false); m_iter = m_fileDataList.end(); } void fileviewer::Paste_ButtonClick(bool checked) { if (!checked) { m_textEditSource->copy(); if (m_checkBoxSymbolOnly->isChecked()) emit searchCopiedTextSymbolOnly(); else emit searchCopiedText(); } } void fileviewer::fileViewSettings_Triggered(bool checked) { cqDialogFileViewSettings cqdg((QWidget*)mw, this, m_fontlist, themes::getThemesList()); m_fonttemp = m_textEditSourceFont.family(); m_fontwidthtemp = (m_textEditSource->tabWidth()); m_themetemp = m_theme; cqdg.setCurrentFontType(m_fonttemp); cqdg.setTabWidth(m_fontwidthtemp); cqdg.setCurrentTheme(m_themetemp); cqdg.setModal(true); cqdg.exec(); if (cqdg.result() == QDialog::Accepted) { m_textEditSourceFont.setFamily(m_fonttemp); m_textEditSource->setTabWidth(m_fontwidthtemp); m_textEditSource->setZoom(m_fontsize); m_theme = m_themetemp; m_themelast = "1234"; setLexer(); } } void fileviewer::OptionsExtEditor_Triggered(bool checked) { bool ok; QString inptext; QInputDialog qinp(mw); qinp.setCancelButtonText(tr("Cancel")); qinp.setOkButtonText(tr("OK")); qinp.setInputMode(QInputDialog::TextInput); qinp.setWindowTitle(tr("External Editor Configuration")); QString exted = tr("Please enter the path and arguments for the external editor. Replace as follows:"); exted += "\n%f - "; exted += tr("for file path"); exted += "\n%n - "; exted += tr("for line number"); exted += "\n"; exted += tr("For example:"); #ifdef _WIN32 exted += "\n\"C:\\Program Files\\Notepad++\\notepad++.exe\" -n%n %f"; #else exted += "\ngedit %f +%n"; #endif qinp.setLabelText(exted); qinp.setTextEchoMode(QLineEdit::Normal); qinp.setTextValue(m_externalEditorPath); qinp.exec(); ok = (qinp.result() == QDialog::Accepted); inptext = qinp.textValue(); if (ok && (inptext.isEmpty() == false)) m_externalEditorPath = inptext.trimmed(); } void fileviewer::OpenInEditor_ButtonClick(bool checked) { QMessageBox msgBox(mw); msgBox.setIcon(QMessageBox::Warning); msgBox.setStandardButtons(QMessageBox::Ok); if (!checked) { QFile file(m_iter->filename); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { msgBox.setText(tr("File could not be opened!")); msgBox.exec(); return; } file.close(); QStringList arguments; QString program; QRegularExpression rx("^\"([^\"]+)\" (.*)"); auto pos = rx.match(m_externalEditorPath); if (pos.hasMatch()) { program = pos.captured(1); arguments = (pos.captured(2)).split(QRegularExpression("[ ]+")); } else { arguments = m_externalEditorPath.split(QRegularExpression("[ ]+")); program = arguments.takeFirst(); } arguments.replaceInStrings(QRegularExpression("%f"), m_iter->filename); arguments.replaceInStrings(QRegularExpression("%n"), m_iter->linenum); if (QProcess::startDetached(program, arguments) == false) { msgBox.setText(tr("External editor could not be started. Please check Options!")); msgBox.exec(); return; } } } void fileviewer::TextShrink_ButtonClick(bool checked) { if (!checked) { textSizeChange(0-1); //m_textEditSource->zoomOut(); } } void fileviewer::TextEnlarge_ButtonClick(bool checked) { if (!checked) { textSizeChange(1); //m_textEditSource->zoomIn(); } } void fileviewer::textSizeChange(int n) { //m_fontwidthtemp = (m_textEditSource->tabWidth()); m_fontsize += n; m_textEditSource->setZoom(m_fontsize); m_textEditSource->setMarginWidthN(0, m_textEditSource->textWidth(STYLE_LINENUMBER, QString::number(m_textEditSource->lineCount() * 10).C_STR())); //m_textEditSource->setTabWidth(m_fontwidthtemp); } void fileviewer::fontSelectionTemporary(const QString &fonttxt) { m_fonttemp = fonttxt; } void fileviewer::themeSelectionTemporary(const QString &themetxt) { m_themetemp = themetxt; } void fileviewer::tabWidthSelectionTemporary(const QString &width) { m_fontwidthtemp = width.toInt(); } void fileviewer::highlightLine(unsigned int num) { m_textEditSource->markerDeleteAll(-1); if (num <= 0) { num = 1; } else { num = num - 1; // not sure why it's one off m_textEditSource->markerAdd(num, m_markerhandle); m_textEditSource->markerAdd(num, m_markerhandle2); } m_textEditSource->setFirstVisibleLine(num); m_currentline = num; } void fileviewer::setLexer(int lang) { if (lang == -1) lang = m_currentlang; switch(lang) { case enHighlightCPP: replaceLexer(SCLEX_CPP, lang); break; case enHighlightPython: replaceLexer(SCLEX_PYTHON, lang); break; case enHighlightJava: replaceLexer(SCLEX_CPP, lang); break; case enHighlightRuby: replaceLexer(SCLEX_RUBY, lang); break; case enHighlightJavascript: replaceLexer(SCLEX_CPP, lang); break; default: replaceLexer(SCLEX_CPP, lang); break; } } void fileviewer::replaceLexer(int sclang, int lang) { QColor markerlinebgcolor; QColor linenumfgcolor; switch (lang) { case enHighlightCPP: m_lexer = CreateLexer("cpp"); break; case enHighlightPython: m_lexer = CreateLexer("python"); break; case enHighlightJava: m_lexer = CreateLexer("cpp"); break; case enHighlightRuby: m_lexer = CreateLexer("ruby"); break; case enHighlightJavascript: m_lexer = CreateLexer("cpp"); break; default: m_lexer = CreateLexer("cpp"); break; } m_textEditSource->setILexer((sptr_t)m_lexer); m_textEditSource->clearDocumentStyle(); m_textEditSource->setZoom(m_fontsize); m_themelast = "1234"; m_themelast = m_theme; themes::setTheme(m_theme, lang, m_textEditSource, m_textEditSourceFont, markerlinebgcolor, linenumfgcolor); m_textEditSource->markerSetBack(m_markerhandle, themes::QC2SC(markerlinebgcolor)); m_textEditSource->markerSetBack(m_markerhandle2, themes::QC2SC(linenumfgcolor)); m_textEditSource->markerSetAlpha(m_markerhandle, SC_ALPHA_NOALPHA); m_textEditSource->markerSetAlpha(m_markerhandle2, SC_ALPHA_NOALPHA); m_textEditSource->styleSetFont(STYLE_LINENUMBER, m_textEditSourceFont.family().C_STR()); m_textEditSource->setZoom(m_fontsize); m_textEditSource->setMarginWidthN(0, m_textEditSource->textWidth(STYLE_LINENUMBER, QString::number(m_textEditSource->lineCount() * 10).C_STR())); themes::setKeywords(lang, m_textEditSource); m_textEditSource->colourise(0, -1); } void fileviewer::annotate(QStringList annotstrLst) { m_textEditSource->copy(); QString str = (QApplication::clipboard())->text(); m_annotline = m_textEditSource->lineFromPosition(m_textEditSource->selectionEnd()); if ((annotstrLst.length() >= 2)&&(annotstrLst[0] == str)) { m_textEditSource->annotationClearAll(); m_textEditSource->annotationSetText(m_annotline, annotstrLst[1].toUtf8().data()); m_textEditSource->annotationSetStyle(m_annotline, 29); } else if (str.length() > 0) { emit requestAnnotation(str); } } void fileviewer::recvFuncList(sqlqueryresultlist* reslist) { m_listWidgetFunc->clear(); if ((m_fileDataList.isEmpty())||(m_iter == m_fileDataList.end())) return; m_funclist = *reslist; m_funclist.sort_by_linenum(); for (auto it = m_funclist.resultlist.begin(); it != m_funclist.resultlist.end(); it++) { it->intLinenum = atoi(it->linenum.C_STR()); } filedata fd(m_funclist.resultlist[0].filename, "1", -99); if (m_iter->compareFileNameOnly(fd) == false) { if (m_iter->fileid < 0) {emit requestFuncList_filename(m_iter->filename);} else {emit requestFuncList_fileid(m_iter->fileid);} return; } sqlqueryresultlist templist = m_funclist; if (m_comboBoxFuncListSort->currentIndex() != 0) templist.sort_by_name(); QListWidgetItem* item; for (auto it = templist.resultlist.begin(); it != templist.resultlist.end(); it++) { item = new QListWidgetItem(it->symname); item->setData(Qt::UserRole, QVariant(it->intLinenum)); m_listWidgetFunc->addItem(item); } } void fileviewer::funcItemSelected(QListWidgetItem * curitem) { if (curitem == nullptr) return; unsigned int num = curitem->data(Qt::UserRole).toUInt(); m_textEditSource->setFirstVisibleLine(num - 1); } void fileviewer::FuncListSort_indexChanged(const int& idx) { recvFuncList(&m_funclist); } ================================================ FILE: gui/fileviewer.h ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifndef FILEVIEWER_H_CQ #define FILEVIEWER_H_CQ #include #include #include "sqlquery.h" Q_DECLARE_METATYPE(sqlqueryresultlist*) class mainwindow; class ScintillaEdit; class filedata { public: QString filename; QString linenum; int fileid; filedata(); filedata(const QString& fn, const QString& ln, const int& fi); filedata(const filedata& fd); bool compare(const filedata& fd); bool compareFilePathOnly(const filedata& fd); bool compareFileNameOnly(const filedata& fd); filedata& operator=(const filedata& fd); }; enum langtypes { enHighlightNone = 0, enHighlightCPP, enHighlightPython, enHighlightJava, enHighlightRuby, enHighlightGo, enHighlightJavascript }; class fileviewer : public QObject { Q_OBJECT public: QPushButton *m_pushButtonPrev; QPushButton *m_pushButtonNext; QPushButton *m_pushButtonOpenInEditor; QPushButton *m_pushButtonPaste; QPushButton *m_pushButtonGoToLine; QPushButton *m_pushButtonTextShrink; QPushButton *m_pushButtonTextEnlarge; QCheckBox *m_checkBoxSymbolOnly; QLineEdit *m_labelFilePath; ScintillaEdit *m_textEditSource; QListWidget *m_listWidgetFunc; QComboBox *m_comboBoxFuncListSort; QString m_externalEditorPath; QFont m_textEditSourceFont; void *m_lexer; int m_fontsize; QString m_theme; fileviewer(mainwindow* pmw); ~fileviewer(); void init(void); void updateTextEdit(void); void updateFilePathLabel(void); void handleFileCannotBeOpenedCase(void); QString checkFontFamily(QString fontname); public slots: void fileToBeOpened(QString filename, QString linenum, int fileid); void AbleToCopy(bool copy); void GoToLine_ButtonClick(bool checked); void Paste_ButtonClick(bool checked); void Prev_ButtonClick(bool checked); void Next_ButtonClick(bool checked); void OpenInEditor_ButtonClick(bool checked); void TextShrink_ButtonClick(bool checked); void TextEnlarge_ButtonClick(bool checked); void OptionsExtEditor_Triggered(bool checked); void fileViewSettings_Triggered(bool checked); void clearList(); void recvDBtimestamp(QDateTime dt); void fontSelectionTemporary(const QString &fonttxt); void themeSelectionTemporary(const QString &themetxt); void tabWidthSelectionTemporary(const QString &width); void annotate(QStringList annotstrLst); void recvFuncList(sqlqueryresultlist* reslist); void funcItemSelected(QListWidgetItem * curitem); void FuncListSort_indexChanged(const int& idx); void filePathLabelTextResized(); void repaintWidget(); signals: void searchCopiedText(); void searchCopiedTextSymbolOnly(); void requestAnnotation(QString searchstr); void requestFuncList_filename(QString filename); void requestFuncList_fileid(int fileid); private: mainwindow *mw; QVector m_fileDataList; QVector::iterator m_iter; QDateTime m_DBtimestamp; bool m_timestampMismatchWarned; QStringList m_fontlist; QString m_fonttemp; QString m_themetemp; QString m_themelast; QString m_filepathlabeltextfull; int m_currentlang; int m_fontwidthtemp; int m_markerhandle; int m_markerhandle2; long m_currentline; long m_annotline; sqlqueryresultlist m_funclist; void createFontList(void); void textSizeChange(int n); void highlightLine(unsigned int num = 0); void setLexer(int lang = -1); void replaceLexer(int sclang, int lang); void clearTextEdit(void); void braceMatchCheck(void); void updateFuncList(void); void setFilePathLabelText(QString text); }; #endif ================================================ FILE: gui/fileviewsettingsdialog.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #include "ui_fileViewSettingsDialog.h" #include "fileviewsettingsdialog.h" #include "fileviewer.h" #include cqDialogFileViewSettings::cqDialogFileViewSettings(QWidget *parent, fileviewer* fv, const QStringList& fontlst, const QStringList& themeslst) :QDialog(parent) ,m_fv(fv) ,dialog_ui(new Ui::fileViewSettingsDialog) ,m_tabwidthvalidator(1,64) { dialog_ui->setupUi(this); dialog_ui->lineEditTabWidth->setValidator(&m_tabwidthvalidator); dialog_ui->comboBoxFont->addItems(fontlst); dialog_ui->comboBoxTheme->addItems(themeslst); connect(dialog_ui->pushButtonOK, SIGNAL(clicked()), this, SLOT(accept())); connect(dialog_ui->pushButtonCancel, SIGNAL(clicked()), this, SLOT(reject())); connect(dialog_ui->comboBoxFont, SIGNAL(currentIndexChanged(int)), this, SLOT(fontSelectionTemporary(int))); connect(dialog_ui->comboBoxTheme, SIGNAL(currentIndexChanged(int)), this, SLOT(themeSelectionTemporary(int))); connect(dialog_ui->lineEditTabWidth, SIGNAL(textEdited(const QString &)), fv, SLOT(tabWidthSelectionTemporary(const QString &))); connect(this, SIGNAL(fontSelectionChanged(const QString &)), fv, SLOT(fontSelectionTemporary(const QString &))); connect(this, SIGNAL(themeSelectionChanged(const QString &)), fv, SLOT(themeSelectionTemporary(const QString &))); resize(sizeHint()); layout()->setSizeConstraint(QLayout::SetFixedSize) ; setSizeGripEnabled(false) ; } cqDialogFileViewSettings::~cqDialogFileViewSettings() { disconnect(); delete dialog_ui; } void cqDialogFileViewSettings::setCurrentFontType(const QString& fonttype) { int idx = dialog_ui->comboBoxFont->findText(fonttype, Qt::MatchContains); dialog_ui->comboBoxFont->setCurrentIndex(idx); } void cqDialogFileViewSettings::setCurrentTheme(const QString& theme) { int idx = dialog_ui->comboBoxTheme->findText(theme, Qt::MatchContains); dialog_ui->comboBoxTheme->setCurrentIndex(idx); } void cqDialogFileViewSettings::setTabWidth(const int& width) { dialog_ui->lineEditTabWidth->setText(QString::number(width)); } void cqDialogFileViewSettings::fontSelectionTemporary(int index) { emit fontSelectionChanged(dialog_ui->comboBoxFont->itemText(index)); } void cqDialogFileViewSettings::themeSelectionTemporary(int index) { emit themeSelectionChanged(dialog_ui->comboBoxTheme->itemText(index)); } ================================================ FILE: gui/fileviewsettingsdialog.h ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifndef FILEVIEWSETTINGSDIALOG_H_CQ #define FILEVIEWSETTINGSDIALOG_H_CQ #include #include namespace Ui { class fileViewSettingsDialog; } class fileviewer; class cqDialogFileViewSettings : public QDialog { Q_OBJECT public: Ui::fileViewSettingsDialog *dialog_ui; cqDialogFileViewSettings(QWidget *parent, fileviewer* fv, const QStringList& fontlst, const QStringList& themeslst); virtual ~cqDialogFileViewSettings(); void setCurrentFontType(const QString& fonttype); void setCurrentTheme(const QString& theme); void setTabWidth(const int& width); public slots: void fontSelectionTemporary(int index); void themeSelectionTemporary(int index); signals: void fontSelectionChanged(const QString& str); void themeSelectionChanged(const QString& str); private: QIntValidator m_tabwidthvalidator; fileviewer* m_fv; }; #endif //FILEVIEWSETTINGSDIALOG_H_CQ ================================================ FILE: gui/graphdialog.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #include "ui_graphDialog.h" #include "graphdialog.h" #include "showgraph.h" cqDialogGraph::cqDialogGraph(QWidget *parent) :QDialog(parent) ,dialog_ui(new Ui::DialogGraph) ,m_scaleFactor(5.0) { dialog_ui->setupUi(this); connect(dialog_ui->pushButtonClose, SIGNAL(clicked()), this, SLOT(accept())); connect(dialog_ui->pushButtonZoomOut, SIGNAL(clicked()), this, SLOT(zoomout())); connect(dialog_ui->pushButtonZoomIn, SIGNAL(clicked()), this, SLOT(zoomin())); connect(dialog_ui->pushButtonSave, SIGNAL(clicked()), this, SLOT(savetoimagefile())); connect(dialog_ui->pushButtonSaveDot, SIGNAL(clicked()), this, SLOT(savetodotfile())); connect(dialog_ui->comboBoxNbrOfLevels, SIGNAL(currentIndexChanged(int)), this, SLOT(numberOfLevelsChanged(int))); } cqDialogGraph::~cqDialogGraph() { disconnect(); delete dialog_ui; } void cqDialogGraph::setupGraphFromXML(QStringList& grpxml, QStringList& grpdot, QString& desc) { m_grpxml = grpxml; m_grpdot = grpdot; m_img = showgraph::convertToImage(grpxml[0]); dialog_ui->labelGraph->setPixmap(QPixmap::fromImage(m_img)); #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) dialog_ui->labelGraph->setMask(dialog_ui->labelGraph->pixmap(Qt::ReturnByValue).mask()); #else dialog_ui->labelGraph->setMask(dialog_ui->labelGraph->pixmap()->mask()); #endif if (desc.length() > 0) dialog_ui->labelDesc->setText(desc); for (unsigned int i=0; i < grpxml.size(); i++) dialog_ui->comboBoxNbrOfLevels->addItem(QString::number(i+1)); dialog_ui->comboBoxNbrOfLevels->setCurrentIndex(0); show(); adjustScrollBar(dialog_ui->scrollArea->horizontalScrollBar(), m_scaleFactor/5); adjustScrollBar(dialog_ui->scrollArea->verticalScrollBar(), m_scaleFactor/5); } void cqDialogGraph::numberOfLevelsChanged(int num) { m_img = showgraph::convertToImage(m_grpxml[dialog_ui->comboBoxNbrOfLevels->currentIndex()]); dialog_ui->labelGraph->setPixmap(QPixmap::fromImage(m_img)); #if (QT_VERSION >= QT_VERSION_CHECK(5, 15, 0)) dialog_ui->labelGraph->setMask(dialog_ui->labelGraph->pixmap(Qt::ReturnByValue).mask()); #else dialog_ui->labelGraph->setMask(dialog_ui->labelGraph->pixmap()->mask()); #endif adjustScrollBar(dialog_ui->scrollArea->horizontalScrollBar(), m_scaleFactor/5); adjustScrollBar(dialog_ui->scrollArea->verticalScrollBar(), m_scaleFactor/5); } void cqDialogGraph::zoomout() { scaleImage(-1); } void cqDialogGraph::zoomin() { scaleImage(1); } void cqDialogGraph::savetoimagefile() { QString filetype = tr("Images"); filetype += " (*.png *.jpg *.bmp *.tiff)"; QString fileName = QFileDialog::getSaveFileName( this, tr("Export Image"), QDir::currentPath(), filetype); if (fileName.isEmpty()) return; QMessageBox msgBox(this); msgBox.setIcon(QMessageBox::Warning); msgBox.setStandardButtons(QMessageBox::Ok); QImageWriter writer( fileName); if ((writer.canWrite() && writer.write(m_img)) == false) { msgBox.setText(tr("File could not be saved!")); msgBox.exec(); } } void cqDialogGraph::savetodotfile() { QString fileName = QFileDialog::getSaveFileName( this, tr("Export DOT file"), QDir::currentPath(), "Graphviz DOT (*.dot)"); if (fileName.isEmpty()) return; QFile outfile(fileName); QMessageBox msgBox(this); msgBox.setIcon(QMessageBox::Warning); msgBox.setStandardButtons(QMessageBox::Ok); if (outfile.open(QIODevice::WriteOnly | QIODevice::Text) == false) { msgBox.setText(tr("File could not be saved!")); msgBox.exec(); return; } QTextStream out(&outfile); out << m_grpdot[dialog_ui->comboBoxNbrOfLevels->currentIndex()]; outfile.close(); } void cqDialogGraph::scaleImage(double factor) { QPixmap p = QPixmap::fromImage(m_img); m_scaleFactor += factor; m_scaleFactor = (m_scaleFactor < 1.0) ? 1.0 : m_scaleFactor; dialog_ui->labelGraph->setPixmap(p.scaled((m_scaleFactor/5) * p.size(), Qt::KeepAspectRatio)); adjustScrollBar(dialog_ui->scrollArea->horizontalScrollBar(), m_scaleFactor/5); adjustScrollBar(dialog_ui->scrollArea->verticalScrollBar(), m_scaleFactor/5); } void cqDialogGraph::adjustScrollBar(QScrollBar *scrollBar, double factor) { int minim = scrollBar->minimum(); scrollBar->setValue((scrollBar->maximum() - minim)/2 + minim); } ================================================ FILE: gui/graphdialog.h ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifndef GRAPHDIALOG_H_CQ #define GRAPHDIALOG_H_CQ #include #include namespace Ui { class DialogGraph; } class cqDialogGraph : public QDialog { Q_OBJECT public: Ui::DialogGraph *dialog_ui; cqDialogGraph(QWidget *parent); virtual ~cqDialogGraph(); void setupGraphFromXML(QStringList& grpxml, QStringList& grpdot, QString& desc); void scaleImage(double factor); void adjustScrollBar(QScrollBar *scrollBar, double factor); public slots: void zoomout(); void zoomin(); void savetoimagefile(); void savetodotfile(); void numberOfLevelsChanged(int num); private: double m_scaleFactor; QImage m_img; QString m_dot; QStringList m_grpxml; QStringList m_grpdot; }; #endif //GRAPHDIALOG_H_CQ ================================================ FILE: gui/images/axialisReadMe.txt ================================================ Free Icons by Axialis Software http://www.axialis.com Here is a library of icons that you can freely use in your projects. All the icons are licensed under the Creative Commons Attribution License (http://creativecommons.org/licenses/by/2.5/). It means that you can use them in any project or website, commercially or not. The icons have been created by Axialis IconWorkshop, the professional icon authoring tool for Windows. For more info visit this page: http://www.axialis.com/iconworkshop TERMS OF USE The only restrictions are: (a) you must keep the credits of the authors: "Axialis Team", even if you modify them; (b) link to us if you use them on your website (see below). LINK TO US If you use the icons in your website, you must add the following link on EACH PAGE containing the icons (at the bottom of the page for example). The HTML code for this link is: Icons by Axialis Team ================================================ FILE: gui/langtable.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #include #include #include "small_lib.h" #include "langtable.h" #define BASE_LANG_PATH ":/trans/" typedef struct { const char* langName; const char* langFile; }langTableType; static const langTableType langTable[]= { #include "tslist.txt" }; QStringList langtable::getLangNameList(void) { QStringList lst; for(int i=0; iclear(); m_sqlist.resultlist.clear(); } void listhandler::init(void) { connect(m_treeWidgetSearchResults, SIGNAL(currentItemChanged(QTreeWidgetItem *, QTreeWidgetItem *)), this, SLOT(listItemClicked(QTreeWidgetItem *, QTreeWidgetItem *))); connect(m_pushButtonUp, SIGNAL(clicked(bool)), this, SLOT(Up_ButtonClick(bool))); connect(m_pushButtonDown, SIGNAL(clicked(bool)), this, SLOT(Down_ButtonClick(bool))); m_pushButtonUp->setEnabled(false); m_pushButtonDown->setEnabled(false); m_treeWidgetSearchResults->setSelectionMode(QAbstractItemView::SingleSelection); m_sqlist.resultlist.clear(); m_sqlist.result_type = sqlqueryresultlist::sqlresultFULL; m_noclick = true; updateListHeaders(); m_noclick = false; m_sqlist.result_type = sqlqueryresultlist::sqlresultERROR; } void listhandler::populateList(sqlqueryresultlist resultlist, int selectitem) { bool headersChanged = (m_sqlist.result_type != resultlist.result_type); m_sqlist = resultlist; m_noclick = true; QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); clearList(); if (headersChanged) updateListHeaders(); updateList(); resizeColumns(); QApplication::restoreOverrideCursor(); m_noclick = false; m_treeWidgetSearchResults->setCurrentItem(m_treeWidgetSearchResults->topLevelItem(selectitem)); emit listRowNumUpdated(selectitem); } void listhandler::listItemClicked(QTreeWidgetItem * current, QTreeWidgetItem * previous) { if (current == NULL) return; if (m_noclick) return; checkUpDown(); emit listRowNumUpdated(m_treeWidgetSearchResults->indexOfTopLevelItem(current)); emit openFile(m_sqlist.resultlist[current->data(0,Qt::UserRole).toLongLong()].filepath, m_sqlist.resultlist[current->data(0,Qt::UserRole).toLongLong()].linenum, m_sqlist.resultlist[current->data(0,Qt::UserRole).toLongLong()].fileid); } void listhandler::requestToProvideResultCurrentListItemSymbolName() { QString symName(""); if (m_treeWidgetSearchResults->topLevelItemCount() > 0) { QTreeWidgetItem* current = m_treeWidgetSearchResults->currentItem(); symName = m_sqlist.resultlist[current->data(0,Qt::UserRole).toLongLong()].symname; } emit sendResultCurrentListItemSymbolName(symName); } void listhandler::updateList(void) { if (m_sqlist.resultlist.empty()) return; qlonglong i = 0; int col; QList treeitemlist; treeitemlist.reserve(m_sqlist.resultlist.size()); for(std::vector::iterator it = m_sqlist.resultlist.begin(); it != m_sqlist.resultlist.end(); it++) { col = 0; treeitemlist += new QTreeWidgetItem(m_treeWidgetSearchResults); if (m_sqlist.result_type == sqlqueryresultlist::sqlresultFULL) treeitemlist.last()->setText(col++, it->symname); treeitemlist.last()->setText(col++, it->filename); if ((m_sqlist.result_type == sqlqueryresultlist::sqlresultFULL)|| (m_sqlist.result_type == sqlqueryresultlist::sqlresultFILE_LINE)) { treeitemlist.last()->setText(col++, it->linenum); treeitemlist.last()->setText(col++, it->linetext); } treeitemlist.last()->setData(0, Qt::UserRole, QVariant(i++)); } m_treeWidgetSearchResults->addTopLevelItems(treeitemlist); } void listhandler::updateListHeaders(void) { QStringList headers; if (m_sqlist.result_type == sqlqueryresultlist::sqlresultFULL) headers += tr("Symbol"); headers += tr("File"); if ((m_sqlist.result_type == sqlqueryresultlist::sqlresultFULL)|| (m_sqlist.result_type == sqlqueryresultlist::sqlresultFILE_LINE)) headers << tr("Line") << tr("Preview"); m_treeWidgetSearchResults->setHeaderLabels(headers); if (m_sqlist.result_type == sqlqueryresultlist::sqlresultFULL) { m_treeWidgetSearchResults->setColumnCount(4); } else if (m_sqlist.result_type == sqlqueryresultlist::sqlresultFILE_LINE) { m_treeWidgetSearchResults->setColumnCount(3); } else if (m_sqlist.result_type == sqlqueryresultlist::sqlresultFILE_ONLY) { m_treeWidgetSearchResults->setColumnCount(1); } } void listhandler::resizeColumns(void) { int n = m_treeWidgetSearchResults->columnCount(); if (n > 1) n--; for(int i=0; i < n; i++) {m_treeWidgetSearchResults->resizeColumnToContents(i);} } void listhandler::clearList() { bool noclick = m_noclick; m_pushButtonUp->setEnabled(false); m_pushButtonDown->setEnabled(false); m_noclick = true; m_treeWidgetSearchResults->clear(); m_noclick = noclick; } void listhandler::retranslateUi(void) { m_noclick = true; if (m_treeWidgetSearchResults->topLevelItemCount() <= 0) { m_sqlist.result_type = sqlqueryresultlist::sqlresultFULL; updateListHeaders(); m_noclick = false; } else { int curItemIdx = m_treeWidgetSearchResults->indexOfTopLevelItem(m_treeWidgetSearchResults->currentItem()); clearList(); updateListHeaders(); updateList(); resizeColumns(); m_treeWidgetSearchResults->setCurrentItem(m_treeWidgetSearchResults->topLevelItem(curItemIdx)); m_noclick = false; listItemClicked(m_treeWidgetSearchResults->topLevelItem(curItemIdx), NULL); } } void listhandler::Up_ButtonClick(bool checked) { QTreeWidgetItem *item = NULL; tStr curFilepath; tStr itemFilepath; if ((!checked)&&(m_treeWidgetSearchResults->topLevelItemCount() > 0)) { item = m_treeWidgetSearchResults->currentItem(); if (item != NULL) curFilepath = m_sqlist.resultlist[item->data(0,Qt::UserRole).toLongLong()].filepath; while (item != NULL) { item = m_treeWidgetSearchResults->itemAbove(item); if (item == NULL) break; itemFilepath = m_sqlist.resultlist[item->data(0,Qt::UserRole).toLongLong()].filepath; if (strrevcmp(curFilepath, itemFilepath)) { m_treeWidgetSearchResults->setCurrentItem(item); break; } } } } void listhandler::Down_ButtonClick(bool checked) { QTreeWidgetItem *item = NULL; tStr curFilepath; tStr itemFilepath; if ((!checked)&&(m_treeWidgetSearchResults->topLevelItemCount() > 0)) { item = m_treeWidgetSearchResults->currentItem(); if (item != NULL) curFilepath = m_sqlist.resultlist[item->data(0,Qt::UserRole).toLongLong()].filepath; while (item != NULL) { item = m_treeWidgetSearchResults->itemBelow(item); if (item == NULL) break; itemFilepath = m_sqlist.resultlist[item->data(0,Qt::UserRole).toLongLong()].filepath; if (strrevcmp(curFilepath, itemFilepath)) { m_treeWidgetSearchResults->setCurrentItem(item); break; } } } } void listhandler::checkUpDown(void) { QTreeWidgetItem *item = NULL; QTreeWidgetItem *curItem = NULL; tStr curFilepath, itemFilepath; bool upArrow=false, downArrow=false; if (m_treeWidgetSearchResults->topLevelItemCount() <= 0) return; item = m_treeWidgetSearchResults->currentItem(); curItem = item; if (item != NULL) curFilepath = m_sqlist.resultlist[item->data(0,Qt::UserRole).toLongLong()].filepath; while (item != NULL) { item = m_treeWidgetSearchResults->itemAbove(item); if (item == NULL) break; itemFilepath = m_sqlist.resultlist[item->data(0,Qt::UserRole).toLongLong()].filepath; if (strrevcmp(curFilepath, itemFilepath)) { upArrow = true; break; } // for now, assume items with same file path are grouped together // This is to speed up the search else break; } item = curItem; while (item != NULL) { item = m_treeWidgetSearchResults->itemBelow(item); if (item == NULL) break; itemFilepath = m_sqlist.resultlist[item->data(0,Qt::UserRole).toLongLong()].filepath; if (strrevcmp(curFilepath, itemFilepath)) { downArrow = true; break; } // for now, assume items with same file path are grouped together // This is to speed up the search else break; } m_pushButtonUp->setEnabled(upArrow); m_pushButtonDown->setEnabled(downArrow); } ================================================ FILE: gui/listhandler.h ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifndef LISTHANDLER_H_CQ #define LISTHANDLER_H_CQ #include #include #include "sqlquery.h" class mainwindow; class listhandler : public QObject { Q_OBJECT public: QTreeWidget *m_treeWidgetSearchResults; QPushButton *m_pushButtonUp; QPushButton *m_pushButtonDown; listhandler(mainwindow* pmw); ~listhandler(); void init(void); void updateList(void); void prepareToExit(void); void updateListHeaders(void); void resizeColumns(void); void retranslateUi(void); void checkUpDown(void); public slots: void populateList(sqlqueryresultlist resultlist, int selectitem); void listItemClicked(QTreeWidgetItem * current, QTreeWidgetItem * previous); void clearList(); void requestToProvideResultCurrentListItemSymbolName(); void Up_ButtonClick(bool checked); void Down_ButtonClick(bool checked); signals: void openFile(QString file, QString linenum, int fileid); void listRowNumUpdated(int row); void sendResultCurrentListItemSymbolName(const QString symName); private: mainwindow *mw; sqlqueryresultlist m_sqlist; bool m_noclick; }; #endif ================================================ FILE: gui/main_gui.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifdef _WIN32 #include #endif #include "mainwindow.h" int main(int argc, char *argv[]) { QApplication app(argc, argv); QMainWindow *wndw = new QMainWindow; /* #if QT_VERSION >= QT_VERSION_CHECK(6, 0, 0) #if defined(__unix__) || defined(__linux__) app.setAttribute(Qt::AA_DontUseNativeDialogs, true); #endif #endif */ mainwindow mw(wndw, &app); mw.show(); #ifdef _WIN32 ShowWindow( (HWND) mw.winId(), SW_HIDE); SetWindowLongPtr( (HWND) mw.winId(), GWL_EXSTYLE, GetWindowLongPtr( (HWND) mw.winId(), GWL_EXSTYLE) | WS_EX_APPWINDOW); ShowWindow( (HWND) mw.winId(), SW_SHOW); #endif return app.exec(); } ================================================ FILE: gui/mainwindow.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #include "mainwindow.h" #include "ui_mainWindow.h" #include "fileviewer.h" #include "listhandler.h" #include "searchhandler.h" #include "langtable.h" #include "aboutdialog.h" #include "swver.h" #include #include mainwindow::mainwindow(QMainWindow *parent, QApplication *app) :QMainWindow(parent) ,m_app(app) ,ui(new Ui::MainWindow) ,m_translator(this) ,m_fileviewer(NULL) ,m_listhandler(NULL) ,m_searchhandler(NULL) ,m_currentLanguage("English") { ui->setupUi(this); init(); } mainwindow::~mainwindow() { disconnect(); delete m_fileviewer; delete m_listhandler; delete m_searchhandler; delete ui; } void mainwindow::init(void) { m_fileviewer = new fileviewer(this); m_listhandler = new listhandler(this); m_searchhandler = new searchhandler(this); setup_fileviewer(); setup_listhandler(); setup_searchhandler(); connect(m_searchhandler, SIGNAL(searchresults(sqlqueryresultlist, int)), m_listhandler, SLOT(populateList(sqlqueryresultlist, int))); connect(m_searchhandler, SIGNAL(DBreset()), m_fileviewer, SLOT(clearList())); connect(m_searchhandler, SIGNAL(sendDBtimestamp(QDateTime)), m_fileviewer, SLOT(recvDBtimestamp(QDateTime))); connect(m_searchhandler, SIGNAL(DBreset()), m_listhandler, SLOT(clearList())); connect(m_listhandler, SIGNAL(openFile(QString, QString, int)), m_fileviewer, SLOT(fileToBeOpened(QString, QString, int))); connect(m_listhandler, SIGNAL(listRowNumUpdated(int)), m_searchhandler, SLOT(updateListItemRowNum(int))); connect(m_fileviewer, SIGNAL(searchCopiedText()), m_searchhandler, SLOT(newSearchText())); connect(m_fileviewer, SIGNAL(searchCopiedTextSymbolOnly()), m_searchhandler, SLOT(newSearchTextSymbolOnly())); connect(m_searchhandler, SIGNAL(updateStatus(const QString&, int)), ui->statusbar, SLOT(showMessage(const QString&, int))); connect(m_searchhandler, SIGNAL(getResultCurrentListItemSymbolName()), m_listhandler, SLOT(requestToProvideResultCurrentListItemSymbolName())); connect(m_listhandler, SIGNAL(sendResultCurrentListItemSymbolName(QString)), m_searchhandler, SLOT(resultCurrentListItemSymbolName(QString))); connect(m_searchhandler, SIGNAL(searchDeclarationResultsReady(QStringList)), m_fileviewer, SLOT(annotate(QStringList))); connect(m_fileviewer, SIGNAL(requestAnnotation(QString)), m_searchhandler, SLOT(searchDeclaration(QString))); connect(m_searchhandler, SIGNAL(searchListFuncResultsReady(sqlqueryresultlist*)), m_fileviewer, SLOT(recvFuncList(sqlqueryresultlist*))); connect(m_fileviewer, SIGNAL(requestFuncList_filename(QString)), m_searchhandler, SLOT(searchFuncList_filename(QString))); connect(m_fileviewer, SIGNAL(requestFuncList_fileid(int)), m_searchhandler, SLOT(searchFuncList_fileid(int))); connect(this, SIGNAL(windowResized()), m_fileviewer, SLOT(filePathLabelTextResized())); connect(this, SIGNAL(windowRepainted()), m_fileviewer, SLOT(repaintWidget())); connect(ui->actionExit, SIGNAL(triggered(bool)), this, SLOT(ExitTriggered(bool))); connect(ui->actionAbout, SIGNAL(triggered(bool)), this, SLOT(AboutTriggered(bool))); connect(ui->actionAbout_Qt, SIGNAL(triggered(bool)), this, SLOT(AboutQtTriggered(bool))); connect(ui->actionLanguage, SIGNAL(triggered(bool)), this, SLOT(LanguageTriggered(bool))); connect(ui->actionOpenDB, SIGNAL(triggered(bool)), m_searchhandler, SLOT(OpenDB_ButtonClick(bool))); connect(ui->actionOptionsExtEditor, SIGNAL(triggered(bool)), m_fileviewer, SLOT(OptionsExtEditor_Triggered(bool))); connect(ui->actionFileViewSettings, SIGNAL(triggered(bool)), m_fileviewer, SLOT(fileViewSettings_Triggered(bool))); m_app->setQuitOnLastWindowClosed(false); // connect(m_app, SIGNAL(lastWindowClosed()), // this, SLOT(prepareToExit())); readSettings(); } void mainwindow::setup_fileviewer(void) { m_fileviewer->m_pushButtonPrev = ui->pushButtonPrev; m_fileviewer->m_pushButtonNext = ui->pushButtonNext; m_fileviewer->m_pushButtonTextShrink = ui->pushButtonTextShrink; m_fileviewer->m_pushButtonTextEnlarge = ui->pushButtonTextEnlarge; m_fileviewer->m_pushButtonOpenInEditor = ui->pushButtonOpenInEditor; m_fileviewer->m_pushButtonPaste = ui->pushButtonPaste; m_fileviewer->m_pushButtonGoToLine = ui->pushButtonGoToLine; m_fileviewer->m_labelFilePath = ui->labelFilePath; m_fileviewer->m_textEditSource = ui->textEditSource; m_fileviewer->m_listWidgetFunc = ui->listWidgetFunc; m_fileviewer->m_comboBoxFuncListSort = ui->comboBoxFuncListSort; m_fileviewer->m_checkBoxSymbolOnly = ui->checkBoxSymbolOnly; m_fileviewer->init(); } void mainwindow::setup_listhandler(void) { m_listhandler->m_treeWidgetSearchResults = ui->treeWidgetSearchResults; m_listhandler->m_pushButtonUp = ui->pushButtonUp; m_listhandler->m_pushButtonDown = ui->pushButtonDown; m_listhandler->init(); } void mainwindow::setup_searchhandler(void) { m_searchhandler->m_pushButtonOpenDB = ui->pushButtonOpenDB; m_searchhandler->m_comboBoxDB = ui->comboBoxDB; m_searchhandler->m_checkBoxAutoComplete = ui->checkBoxAutoComplete; m_searchhandler->m_checkBoxExactMatch = ui->checkBoxExactMatch; m_searchhandler->m_pushButtonSearch = ui->pushButtonSearch; m_searchhandler->m_pushButtonClipSearch = ui->pushButtonClipSearch; m_searchhandler->m_comboBoxSearch = ui->comboBoxSearch; m_searchhandler->m_comboBoxQueryType = ui->comboBoxQueryType; m_searchhandler->m_pushButtonSearchPrev = ui->pushButtonSearchPrev; m_searchhandler->m_pushButtonSearchNext = ui->pushButtonSearchNext; m_searchhandler->m_pushButtonGraph = ui->pushButtonGraph; m_searchhandler->m_pushButtonFilesList = ui->pushButtonFilesList; m_searchhandler->m_checkBoxFilter = ui->checkBoxFilter; m_searchhandler->m_comboBoxFilter = ui->comboBoxFilter; m_searchhandler->init(); } void mainwindow::LanguageTriggered(bool checked) { QStringList items(langtable::getLangNameList()); bool ok; int curLangIdx = items.indexOf(m_currentLanguage); curLangIdx = curLangIdx != -1 ? curLangIdx : 0; QInputDialog qinp(this); qinp.setCancelButtonText(tr("Cancel")); qinp.setOkButtonText(tr("OK")); qinp.setInputMode(QInputDialog::TextInput); qinp.setWindowTitle(tr("Language")); qinp.setLabelText(tr("Select language:")); qinp.setComboBoxEditable(false); qinp.setComboBoxItems(items); qinp.setTextValue(m_currentLanguage); qinp.exec(); ok = (qinp.result() == QDialog::Accepted); QString item = qinp.textValue(); if (ok && (item.isEmpty() == false)) { m_currentLanguage = item; retranslateUi(); } } void mainwindow::retranslateUi(void) { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); m_translator.load(langtable::getLangFilePath(m_currentLanguage)); m_app->installTranslator(&m_translator); ui->retranslateUi(this); QString langtxt = ui->actionLanguage->text(); if (m_currentLanguage.compare("English") != 0) langtxt += " (Language)"; ui->actionLanguage->setText(langtxt); m_searchhandler->retranslateUi(); m_listhandler->retranslateUi(); QApplication::restoreOverrideCursor(); } void mainwindow::ExitTriggered(bool checked) { close(); } void mainwindow::AboutQtTriggered(bool checked) { QMessageBox::aboutQt(this); } void mainwindow::AboutTriggered(bool checked) { cqDialogAbout cqdg(this); cqdg.setModal(true); cqdg.exec(); } void mainwindow::prepareToExit() { writeSettings(); m_listhandler->prepareToExit(); m_app->quit(); } void mainwindow::writeSettings() { QSettings settings("ruben2020_foss", "CodeQuery"); settings.beginGroup("MainWindow"); settings.setValue("Size", size()); settings.setValue("Pos", pos()); settings.setValue("Maximized", isMaximized()); settings.setValue("AutoComplete", ui->checkBoxAutoComplete->isChecked()); settings.setValue("ExactMatch", ui->checkBoxExactMatch->isChecked()); settings.setValue("SymbolOnly", ui->checkBoxSymbolOnly->isChecked()); settings.setValue("FilterCheckBox", ui->checkBoxFilter->isChecked()); settings.setValue("QueryType", ui->comboBoxQueryType->currentIndex()); settings.setValue("LastOpenDB", ui->comboBoxDB->currentIndex()); settings.setValue("Language", m_currentLanguage); settings.setValue("ExtEditorPath", m_fileviewer->m_externalEditorPath); //settings.setValue("FileViewerFontSize", m_fileviewer->m_textEditSourceFont.pixelSize()); settings.setValue("FileViewerFontSize", m_fileviewer->m_fontsize); settings.setValue("FileViewerFontType", m_fileviewer->m_textEditSourceFont.family()); settings.setValue("FileViewerTabWidth", (int) m_fileviewer->m_textEditSource->tabWidth()); settings.setValue("FileViewerTheme", m_fileviewer->m_theme); settings.setValue("FuncListSortType", ui->comboBoxFuncListSort->currentIndex()); settings.endGroup(); settings.beginWriteArray("SearchHistory"); for (int i=0; i < ui->comboBoxSearch->count(); i++) { settings.setArrayIndex(i); settings.setValue("hist", ui->comboBoxSearch->itemText(i)); } settings.endArray(); settings.beginWriteArray("OpenDBHistory"); for (int i=0; i < ui->comboBoxDB->count(); i++) { settings.setArrayIndex(i); settings.setValue("db", ui->comboBoxDB->itemText(i)); } settings.endArray(); settings.beginWriteArray("FilterHistory"); for (int i=0; i < ui->comboBoxFilter->count(); i++) { settings.setArrayIndex(i); settings.setValue("filter", ui->comboBoxFilter->itemText(i)); } settings.endArray(); } void mainwindow::readSettings() { QSettings settings("ruben2020_foss", "CodeQuery"); int sizee = settings.beginReadArray("OpenDBHistory"); QStringList dbhist; QString ftoopen = checkForFileToOpen(); if (ftoopen.isEmpty() == false) dbhist << ftoopen; for (int i=0; i < sizee; i++) { settings.setArrayIndex(i); dbhist << settings.value("db").toString(); } settings.endArray(); dbhist.removeDuplicates(); if (dbhist.count() > 7) dbhist.removeLast(); if (dbhist.isEmpty() == false) ui->comboBoxDB->addItems(dbhist); int sizef = settings.beginReadArray("FilterHistory"); QStringList filterhist; for (int i=0; i < sizef; i++) { settings.setArrayIndex(i); filterhist << settings.value("filter").toString(); } settings.endArray(); if (filterhist.isEmpty()) filterhist << "*.h" << "*.c" << "src"; ui->comboBoxFilter->addItems(filterhist); ui->comboBoxFilter->setCurrentIndex(0); settings.beginGroup("MainWindow"); resize(settings.value("Size", size()).toSize()); move(settings.value("Pos", pos()).toPoint()); if (settings.value("Maximized", false).toBool()) showMaximized(); else showNormal(); ui->checkBoxAutoComplete->setChecked(settings.value("AutoComplete", true).toBool()); ui->checkBoxExactMatch->setChecked(settings.value("ExactMatch", false).toBool()); ui->checkBoxSymbolOnly->setChecked(settings.value("SymbolOnly", false).toBool()); ui->checkBoxFilter->setChecked(settings.value("FilterCheckBox", false).toBool()); ui->comboBoxQueryType->setCurrentIndex(settings.value("QueryType", 0).toInt()); if (ftoopen.isEmpty() == false) ui->comboBoxDB->setCurrentIndex(0); else ui->comboBoxDB->setCurrentIndex(settings.value("LastOpenDB", ui->comboBoxDB->currentIndex()).toInt()); m_currentLanguage = settings.value("Language", QString("English")).toString(); retranslateUi(); m_fileviewer->m_externalEditorPath = settings.value("ExtEditorPath", m_fileviewer->m_externalEditorPath).toString(); //m_fileviewer->m_textEditSourceFont.setPixelSize(settings.value("FileViewerFontSize", 12).toInt()); m_fileviewer->m_fontsize = settings.value("FileViewerFontSize", 0).toInt(); m_fileviewer->m_textEditSource->setZoom(m_fileviewer->m_fontsize); m_fileviewer->m_textEditSourceFont.setFamily(m_fileviewer->checkFontFamily( settings.value("FileViewerFontType", QFontDatabase::systemFont(QFontDatabase::FixedFont).family()).toString())); m_fileviewer->m_textEditSource->setFont(m_fileviewer->m_textEditSourceFont); m_fileviewer->m_textEditSource->setTabWidth(settings.value("FileViewerTabWidth", 4).toInt()); m_fileviewer->m_theme = (settings.value("FileViewerTheme", "Eclipse Default").toString()); ui->comboBoxFuncListSort->setCurrentIndex(settings.value("FuncListSortType", ui->comboBoxFuncListSort->currentIndex()).toInt()); settings.endGroup(); int sizeh = settings.beginReadArray("SearchHistory"); QStringList searchhist; for (int i=0; i < sizeh; i++) { settings.setArrayIndex(i); searchhist << settings.value("hist").toString(); } settings.endArray(); if (searchhist.isEmpty() == false) { ui->comboBoxSearch->addItems(searchhist); ui->comboBoxSearch->setCurrentIndex(-1); } } QString mainwindow::checkForFileToOpen(void) { QStringList arg = m_app->arguments(); QString fn; if (arg.size() <= 1) return fn; if (arg.size() >= 3) { printHelpAndExit("ERROR: More than 1 argument is not recognized."); return fn; } if ((arg[1] == "--help")|| (arg[1] == "-h")|| (arg[1] == "-?")|| (arg[1] == "/?")) { printHelpAndExit(""); return fn; } QFileInfo qfi(arg[1]); if ((qfi.exists() == false) || (qfi.isFile() == false)) { tempbuf buf(3000); sprintf(buf.get(), "ERROR: File \"%s\" does not exist!", arg[1].toStdString().c_str()); printHelpAndExit(buf.get()); return fn; } fn = qfi.canonicalFilePath(); return fn; } void mainwindow::printHelpAndExit(QString str) { printf("codequery [path_to_codequery_database_file_to_open]\n"); printf("The argument is optional.\n"); if (str.isEmpty() == false) printf("%s\n", str.toStdString().c_str()); printf("\n"); m_listhandler->prepareToExit(); m_app->quit(); exit(str.isEmpty() ? 0 : 1); } void mainwindow::resizeEvent(QResizeEvent* event) { QMainWindow::resizeEvent(event); emit windowResized(); } void mainwindow::paintEvent(QPaintEvent* event) { QMainWindow::paintEvent(event); emit windowRepainted(); } void mainwindow::closeEvent(QCloseEvent* event) { prepareToExit(); } ================================================ FILE: gui/mainwindow.h ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifndef MAINWINDOW_H_CQ #define MAINWINDOW_H_CQ #include #include namespace Ui { class MainWindow; } class fileviewer; class listhandler; class searchhandler; class mainwindow : public QMainWindow { Q_OBJECT public: Ui::MainWindow *ui; mainwindow(QMainWindow *parent = NULL, QApplication *app = NULL); virtual ~mainwindow(); void setup_fileviewer(void); void setup_listhandler(void); void setup_searchhandler(void); void retranslateUi(void); void writeSettings(); void readSettings(); public slots: void AboutQtTriggered(bool checked); void AboutTriggered(bool checked); void ExitTriggered(bool checked); void LanguageTriggered(bool checked); void prepareToExit(); signals: void windowResized(); void windowRepainted(); private: QApplication *m_app; fileviewer* m_fileviewer; listhandler* m_listhandler; searchhandler* m_searchhandler; QString m_currentLanguage; QTranslator m_translator; void init(void); QString checkForFileToOpen(void); void printHelpAndExit(QString str); protected: virtual void resizeEvent(QResizeEvent* event); virtual void paintEvent(QPaintEvent* event); virtual void closeEvent(QCloseEvent* event); }; #endif ================================================ FILE: gui/searchhandler.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #include #include #include "graphdialog.h" #include "searchhandler.h" #include sqlquery* searchhandler::sq = NULL; bool searchhandler::m_grepExactMatch = false; QRegularExpression* searchhandler::m_grepRegExp = NULL; searchitem::searchitem() :exactmatch(false) ,qtype(sqlquery::sqlquerySYMBOL) ,rownum(1) { } searchitem::searchitem(const searchitem& otheritem) { searchterm = otheritem.searchterm; filterterm = otheritem.filterterm; exactmatch = otheritem.exactmatch; qtype = otheritem.qtype; rownum = otheritem.rownum; } searchitem& searchitem::operator=(const searchitem& otheritem) { if (&otheritem != this) { searchterm = otheritem.searchterm; filterterm = otheritem.filterterm; exactmatch = otheritem.exactmatch; qtype = otheritem.qtype; rownum = otheritem.rownum; } return *this; } // return value: 0=same, 1=completely different, 2=only linenum changed int searchitem::compare(const searchitem& otheritem) { if ((searchterm.compare(otheritem.searchterm, Qt::CaseSensitive) != 0) || (exactmatch != otheritem.exactmatch) || (qtype != otheritem.qtype) || (filterterm.compare(otheritem.filterterm, Qt::CaseSensitive) != 0)) return 1; if (rownum != otheritem.rownum) return 2; return 0; } searchhandler::searchhandler(mainwindow* pmw) :mw(pmw) ,m_pushButtonOpenDB(NULL) ,m_comboBoxDB(NULL) ,m_checkBoxAutoComplete(NULL) ,m_checkBoxExactMatch(NULL) ,m_pushButtonSearch(NULL) ,m_comboBoxSearch(NULL) ,m_comboBoxQueryType(NULL) ,m_checkBoxFilter(NULL) ,m_comboBoxFilter(NULL) ,m_srchStrLstModel(QStringList()) ,m_typeOfGraph(1) ,m_autocompBusy(false) ,m_declarBusy(false) ,m_funcListBusy(false) ,m_pushButtonClipSearch(NULL) ,m_pushButtonSearchPrev(NULL) ,m_pushButtonSearchNext(NULL) ,m_pushButtonGraph(NULL) ,m_pushButtonFilesList(NULL) { sq = new sqlquery; m_completer = new QCompleter(&m_srchStrLstModel, (QWidget*)mw); m_grepRegExp = new QRegularExpression(); m_iter = m_searchMemoryList.begin(); } searchhandler::~searchhandler() { disconnect(); delete sq; delete m_completer; delete m_grepRegExp; } void searchhandler::OpenDB_ButtonClick(bool checked) { if (!checked) perform_open_db(); } void searchhandler::Search_ButtonClick(bool checked) { if (!checked) perform_search(m_comboBoxSearch->lineEdit()->text().trimmed().C_STR(), m_checkBoxExactMatch->isChecked()); } void searchhandler::ClipSearch_ButtonClick(bool checked) { if (!checked) newSearchText(); } void searchhandler::Graph_ButtonClick(bool checked) { if (!checked) { emit getResultCurrentListItemSymbolName(); } } void searchhandler::FilesList_ButtonClick(bool checked) { if (!checked) { perform_search("*", false, sqlquery::sqlresultFILESLIST, "*", 0, false); } } void searchhandler::PrevSearch_ButtonClick(bool checked) { if (!checked) goBackInSearchMemory(); } void searchhandler::NextSearch_ButtonClick(bool checked) { if (!checked) goForwardInSearchMemory(); } void searchhandler::Search_EnterKeyPressed() { perform_search(m_comboBoxSearch->lineEdit()->text().trimmed().C_STR(), m_checkBoxExactMatch->isChecked()); } void searchhandler::searchTextEdited(const QString& searchtxt) { if (m_checkBoxAutoComplete->isChecked()) { if ((m_autocompBusy)||(m_declarBusy)||(m_funcListBusy)) { m_autocompSrchTerm = searchtxt; } else { m_autocompBusy = true; m_autocompSrchTerm.clear(); m_autocompFutureWatcher.setFuture( QtConcurrent::run(search_autocomplete_qt, searchtxt)); } } m_autocompBusy = (!m_autocompFutureWatcher.isFinished()); } void searchhandler::autoCompleteFinished() { if (!m_autocompBusy) return; m_srchStrLstModel.setStringList(m_autocompFutureWatcher.result()); if (m_autocompSrchTerm.isEmpty()) { m_autocompBusy = false; } else { m_autocompBusy = true; m_autocompFutureWatcher.setFuture( QtConcurrent::run(search_autocomplete_qt, m_autocompSrchTerm)); m_autocompSrchTerm.clear(); } } void searchhandler::declarSearchFinished() { QStringList strLst = m_declarFutureWatcher.result(); m_declarBusy = false; if (strLst.length() > 0) emit searchDeclarationResultsReady(strLst); } void searchhandler::searchDeclaration(QString searchstr) { if ((!m_declarBusy)&&(!m_autocompBusy)&&(!m_funcListBusy)) { m_declarBusy = true; m_declarFutureWatcher.setFuture( QtConcurrent::run(search_declaration_qt, searchstr)); } } void searchhandler::funcListSearchFinished() { sqlqueryresultlist res = m_listFuncFutureWatcher.result(); if ((res.result_type == sqlqueryresultlist::sqlresultFUNC_IN_ONE_FILE) && (res.resultlist.empty() == false)) { emit searchListFuncResultsReady(&res); } m_funcListBusy = false; } void searchhandler::searchFuncList_filename(QString filename) { if ((filename.isEmpty() == false)&&(!m_declarBusy)&&(!m_autocompBusy)&&(!m_funcListBusy)) { m_funcListBusy = true; m_listFuncFutureWatcher.setFuture( QtConcurrent::run(search_funclist_qt_filename, filename)); } } void searchhandler::searchFuncList_fileid(int fileid) { if ((fileid >= 0)&&(!m_declarBusy)&&(!m_autocompBusy)&&(!m_funcListBusy)) { m_funcListBusy = true; m_listFuncFutureWatcher.setFuture( QtConcurrent::run(search_funclist_qt_fileid, fileid)); } } sqlqueryresultlist searchhandler::search_funclist_qt_filename(QString filename) { return sq->search_funclist_filename(extract_filename(filename.C_STR())); } sqlqueryresultlist searchhandler::search_funclist_qt_fileid(int fileid) { return sq->search_funclist_fileid(fileid); } QStringList searchhandler::search_declaration_qt(QString searchtxt) { QStringList strLst; QString str; sqlqueryresultlist reslst = sq->search_declaration(searchtxt.C_STR()); if (reslst.resultlist.size() > 0) { str.append(reslst.resultlist[0].filename.C_STR()) .append(":") .append(reslst.resultlist[0].linenum.C_STR()) .append(" ==> ") .append(reslst.resultlist[0].linetext.C_STR()); strLst << searchtxt; strLst << str; } return strLst; } QStringList searchhandler::search_autocomplete_qt(QString searchtxt) { return sq->search_autocomplete(searchtxt.C_STR()); } void searchhandler::autoCompleteStateChanged(int state) { if (state == Qt::Checked) { m_srchStrLstModel.setStringList(QStringList(m_comboBoxSearch->lineEdit()->text().trimmed())); } else if (state == Qt::Unchecked) { m_srchStrLstModel.setStringList(QStringList()); } } void searchhandler::newSearchText() { QString txt = (QApplication::clipboard())->text(); //m_comboBoxSearch->lineEdit()->setText(txt); perform_search(txt,m_checkBoxExactMatch->isChecked()); } void searchhandler::newSearchTextSymbolOnly() { QString txt = (QApplication::clipboard())->text(); //m_comboBoxSearch->lineEdit()->setText(txt); perform_search(txt, m_checkBoxExactMatch->isChecked(), sqlquery::sqlquerySYMBOL); } void searchhandler::init(void) { m_completer->setModelSorting(QCompleter::CaseSensitivelySortedModel); m_completer->setCaseSensitivity(Qt::CaseInsensitive); m_comboBoxSearch->lineEdit()->setCompleter(m_completer); m_comboBoxSearch->setInsertPolicy(QComboBox::NoInsert); retranslateUi(); m_pushButtonSearchPrev->setEnabled(false); m_pushButtonSearchNext->setEnabled(false); connect(m_pushButtonOpenDB, SIGNAL(clicked(bool)), this, SLOT(OpenDB_ButtonClick(bool))); connect(m_pushButtonSearch, SIGNAL(clicked(bool)), this, SLOT(Search_ButtonClick(bool))); connect(m_pushButtonClipSearch, SIGNAL(clicked(bool)), this, SLOT(ClipSearch_ButtonClick(bool))); connect(m_pushButtonGraph, SIGNAL(clicked(bool)), this, SLOT(Graph_ButtonClick(bool))); connect(m_pushButtonFilesList, SIGNAL(clicked(bool)), this, SLOT(FilesList_ButtonClick(bool))); connect(m_comboBoxSearch->lineEdit(), SIGNAL(returnPressed()), this, SLOT(Search_EnterKeyPressed())); connect(m_comboBoxSearch->lineEdit(), SIGNAL(textEdited(QString)), this, SLOT(searchTextEdited(QString))); connect(m_comboBoxDB, SIGNAL(currentIndexChanged(int)), this, SLOT(OpenDB_indexChanged(int))); connect(m_comboBoxQueryType, SIGNAL(currentIndexChanged(int)), this, SLOT(QueryType_indexChanged(int))); connect(m_checkBoxAutoComplete, SIGNAL(stateChanged(int)), this, SLOT(autoCompleteStateChanged(int))); connect(m_pushButtonSearchPrev, SIGNAL(clicked(bool)), this, SLOT(PrevSearch_ButtonClick(bool))); connect(m_pushButtonSearchNext, SIGNAL(clicked(bool)), this, SLOT(NextSearch_ButtonClick(bool))); connect(&m_autocompFutureWatcher, SIGNAL(finished()), this, SLOT(autoCompleteFinished())); connect(&m_declarFutureWatcher, SIGNAL(finished()), this, SLOT(declarSearchFinished())); connect(&m_listFuncFutureWatcher, SIGNAL(finished()), this, SLOT(funcListSearchFinished())); } void searchhandler::retranslateUi(void) { int curidx = 0; if (m_comboBoxQueryType->count() > 0) curidx = m_comboBoxQueryType->currentIndex(); m_comboBoxQueryType->clear(); m_comboBoxQueryType->addItem(QIcon(), tr("Symbol"), QVariant(sqlquery::sqlquerySYMBOL)); m_comboBoxQueryType->addItem(QIcon(), tr("Function or macro definition (Graph available)"), QVariant(sqlquery::sqlresultFUNC_MACRO)); m_comboBoxQueryType->addItem(QIcon(), tr("Calls of this function or macro"), QVariant(sqlquery::sqlresultCALLSOFFUNC)); m_comboBoxQueryType->addItem(QIcon(), tr("Functions calling this function"), QVariant(sqlquery::sqlresultCALLINGFUNC)); m_comboBoxQueryType->addItem(QIcon(), tr("Functions called by this function"), QVariant(sqlquery::sqlresultCALLEDFUNC)); m_comboBoxQueryType->addItem(QIcon(), tr("Class or struct (Graph available)"), QVariant(sqlquery::sqlresultCLASS_STRUCT)); m_comboBoxQueryType->addItem(QIcon(), tr("Class which owns this member or method"), QVariant(sqlquery::sqlresultOWNERCLASS)); m_comboBoxQueryType->addItem(QIcon(), tr("Members or methods of this class"), QVariant(sqlquery::sqlresultMEMBERS)); m_comboBoxQueryType->addItem(QIcon(), tr("Parent of this class"), QVariant(sqlquery::sqlresultPARENTCLASS)); m_comboBoxQueryType->addItem(QIcon(), tr("Children of this class"), QVariant(sqlquery::sqlresultCHILDCLASS)); m_comboBoxQueryType->addItem(QIcon(), tr("Files including this file"), QVariant(sqlquery::sqlresultINCLUDE)); m_comboBoxQueryType->addItem(QIcon(), tr("Full path for file"), QVariant(sqlquery::sqlresultFILESLIST)); m_comboBoxQueryType->addItem(QIcon(), tr("Functions or macros inside this file"), QVariant(sqlquery::sqlresultFUNCSINFILE)); m_comboBoxQueryType->addItem(QIcon(), "Grep", QVariant(sqlquery::sqlresultGREP)); m_comboBoxQueryType->setCurrentIndex(curidx); } void searchhandler::perform_open_db(void) { QString fileext = tr("CodeQuery DB Files"); fileext += " (*.db)"; QString fileName = QFileDialog::getOpenFileName( (QWidget*)mw, tr("Open CQ database file"), "", fileext); if (fileName.isEmpty() == false) { m_comboBoxDB->insertItem(0, fileName); m_comboBoxDB->setCurrentIndex(0); for (int i=1; i < (m_comboBoxDB->count()); i++) { if (fileName.compare(m_comboBoxDB->itemText(i), Qt::CaseSensitive) == 0) { m_comboBoxDB->removeItem(i); break; } } if (m_comboBoxDB->count() > 7) m_comboBoxDB->removeItem(m_comboBoxDB->count() - 1); } } void searchhandler::OpenDB_indexChanged(const int& idx) { if (idx < 0) return; sqlquery::en_filereadstatus sqstatus; if (m_autocompBusy) { m_autocompBusy = false; m_autocompFutureWatcher.waitForFinished(); } if (m_declarBusy) { m_declarBusy = false; m_declarFutureWatcher.waitForFinished(); } if (m_funcListBusy) { m_funcListBusy = false; m_listFuncFutureWatcher.waitForFinished(); } sq->close_dbfile(); QFileInfo dbfile(m_comboBoxDB->itemText(idx)); sqstatus = sq->open_dbfile(m_comboBoxDB->itemText(idx)); if (sqstatus != sqlquery::sqlfileOK) { QMessageBox msgBox((QWidget*)mw); msgBox.setText(sqlerrormsg(sqstatus)); msgBox.exec(); m_comboBoxDB->removeItem(idx); } else { QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); m_comboBoxSearch->clear(); m_comboBoxSearch->lineEdit()->clear(); m_searchMemoryList.clear(); m_iter = m_searchMemoryList.begin(); m_pushButtonSearchPrev->setEnabled(false); m_pushButtonSearchNext->setEnabled(false); emit sendDBtimestamp(dbfile.lastModified()); emit DBreset(); QApplication::restoreOverrideCursor(); } } void searchhandler::QueryType_indexChanged(const int& idx) { int qrytype; m_pushButtonGraph->setEnabled(false); qrytype = m_comboBoxQueryType->itemData(idx).toInt(); switch(qrytype) { case sqlquery::sqlresultFUNC_MACRO: // function or macro m_graphdesc = tr("Function Call Graph"); m_typeOfGraph = 1; break; case sqlquery::sqlresultCLASS_STRUCT: // class or struct m_graphdesc = tr("Class Inheritance Graph"); m_typeOfGraph = 2; break; } if (qrytype == sqlquery::sqlresultGREP) { #ifndef QT_NO_TOOLTIP m_comboBoxSearch->setToolTip("Grep: QRegularExpression regular expressions"); #endif // QT_NO_TOOLTIP #ifndef QT_NO_STATUSTIP m_comboBoxSearch->setStatusTip("Grep: QRegularExpression regular expressions"); #endif // QT_NO_STATUSTIP } else { #ifndef QT_NO_TOOLTIP m_comboBoxSearch->setToolTip(tr("If Exact Match is switched off, wildcard searches (* and ?) are supported")); #endif // QT_NO_TOOLTIP #ifndef QT_NO_STATUSTIP m_comboBoxSearch->setStatusTip(tr("If Exact Match is switched off, wildcard searches (* and ?) are supported")); #endif // QT_NO_STATUSTIP } Search_EnterKeyPressed(); } void searchhandler::perform_search(QString searchtxt, bool exactmatch, sqlquery::en_queryType qrytyp, QString filtertxt, int selectitem, bool updSearchMemory) { if (sq->isDBOpen() == false) return; if (searchtxt.isEmpty()) return; sqlqueryresultlist sqlresultlist; QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); if (m_autocompBusy) { m_autocompBusy = false; m_autocompFutureWatcher.waitForFinished(); } if (m_declarBusy) { m_declarBusy = false; m_declarFutureWatcher.waitForFinished(); } if (m_funcListBusy) { m_funcListBusy = false; m_listFuncFutureWatcher.waitForFinished(); } sqlquery::en_queryType querytype = qrytyp; if (querytype == sqlquery::sqlresultDEFAULT) querytype = (sqlquery::en_queryType)m_comboBoxQueryType->itemData(m_comboBoxQueryType->currentIndex()).toInt(); if ((filtertxt.isEmpty()) && (m_checkBoxFilter->isChecked())) { filtertxt = m_comboBoxFilter->lineEdit()->text().trimmed(); if (updSearchMemory) updateFilterHistory(filtertxt); } if (querytype == sqlquery::sqlresultGREP) { if (filtertxt.isEmpty()) filtertxt = "*"; sqlresultlist = sq->search(filtertxt.C_STR(), sqlquery::sqlresultFILEPATH, false); } else { sqlresultlist = sq->search(searchtxt.C_STR(), querytype, exactmatch, filtertxt.C_STR()); } QApplication::restoreOverrideCursor(); if (sqlresultlist.result_type == sqlqueryresultlist::sqlresultERROR) { QMessageBox msgBox((QWidget*)mw); msgBox.setText(sqlresultlist.sqlerrmsg); msgBox.exec(); } else { m_pushButtonGraph->setEnabled((querytype == sqlquery::sqlresultFUNC_MACRO)|| (querytype == sqlquery::sqlresultCLASS_STRUCT)); updateSearchHistory(searchtxt); if (updSearchMemory) addToSearchMemory(searchtxt, filtertxt); if (querytype == sqlquery::sqlresultGREP) { sqlresultlist = perform_grep(searchtxt, sqlresultlist, exactmatch); } emit searchresults(sqlresultlist, selectitem); QString str; str = QString("%1").arg(sqlresultlist.resultlist.size()); str += " "; str += tr("results found"); emit updateStatus(str, 5000); } } sqlqueryresultlist searchhandler::perform_grep(QString searchtxt, sqlqueryresultlist searchlist, bool exactmatch) { QVector> strvec; sqlqueryresultlist resultlist; QFutureWatcher futureWatcher; QProgressDialog dialog; long n = searchlist.resultlist.size(); if (n == 0) return resultlist; strvec.resize(n); for (long i=0; i < n; i++) { strvec.replace(i, qMakePair(searchlist.resultlist[i].filepath, searchlist.resultlist[i].fileid)); } dialog.setAutoReset(false); dialog.setLabelText(QString("Grep ").append(QString(tr("in progress"))).append(QString(" ..."))); dialog.setCancelButtonText(tr("Cancel")); QObject::connect(&futureWatcher, SIGNAL(finished()), &dialog, SLOT(reset())); QObject::connect(&dialog, SIGNAL(canceled()), &futureWatcher, SLOT(cancel())); QObject::connect(&futureWatcher, SIGNAL(progressRangeChanged(int,int)), &dialog, SLOT(setRange(int,int))); QObject::connect(&futureWatcher, SIGNAL(progressValueChanged(int)), &dialog, SLOT(setValue(int))); m_grepExactMatch = exactmatch; (*m_grepRegExp) = QRegularExpression(searchtxt.C_STR(), QRegularExpression::CaseInsensitiveOption); futureWatcher.setFuture(QtConcurrent::mappedReduced(strvec, doGrep, collateGrep, QtConcurrent::SequentialReduce)); dialog.exec(); futureWatcher.waitForFinished(); if (futureWatcher.isCanceled() == false) resultlist = futureWatcher.result(); return resultlist; } sqlqueryresultlist searchhandler::doGrep(const QPair &fp) { sqlqueryresultlist reslist; sqlqueryresult res; tStr str, fp2, fn; QRegularExpressionMatch pos; long linenumber=0; char numtext[30]; QRegularExpression rx1(*m_grepRegExp); reslist.result_type = sqlqueryresultlist::sqlresultFILE_LINE; fp2 = fp.first; // path of file to be searched fp2.replace(QString("$HOME"), QDir::homePath()); #ifdef _WIN32 fp2.replace("/", "\\"); #endif fn = extract_filename(fp2.C_STR()); QFile file(fp2); QTextStream in(&file); if (!file.open(QIODevice::ReadOnly | QIODevice::Text)) { return reslist; } while (!in.atEnd()) { linenumber++; str = in.readLine(); pos = rx1.match(str); if (pos.hasMatch()) { res.filepath = fp2; res.filename = fn; res.fileid = fp.second; sprintf(numtext, "%ld", linenumber); res.linenum = numtext; res.linetext = str.trimmed().left(800); reslist.resultlist.push_back(res); } } return reslist; } void searchhandler::collateGrep(sqlqueryresultlist &result, const sqlqueryresultlist &intermediate) { long i, n; n = intermediate.resultlist.size(); result.result_type = sqlqueryresultlist::sqlresultFILE_LINE; result.resultlist.reserve(n); for(i=0; iinsertItem(0, filtertxt); m_comboBoxFilter->setCurrentIndex(0); for(int i=1; i < m_comboBoxFilter->count(); i++) { if (m_comboBoxFilter->itemText(i).compare(filtertxt) == 0) { m_comboBoxFilter->removeItem(i); break; } } if (m_comboBoxFilter->count() > 7) // limit to 7 { m_comboBoxFilter->removeItem(m_comboBoxFilter->count() - 1); } } void searchhandler::resultCurrentListItemSymbolName(const QString symName) { if (symName.isEmpty()) { QMessageBox msgBox((QWidget*)mw); msgBox.setIcon(QMessageBox::Information); msgBox.setStandardButtons(QMessageBox::Ok); msgBox.setText(tr("You have to first select an item from the list before pushing the Graph button.")); msgBox.exec(); return; } QStringList grpxml, grpdot; bool res; QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); if (m_autocompBusy) { m_autocompBusy = false; m_autocompFutureWatcher.waitForFinished(); } if (m_declarBusy) { m_declarBusy = false; m_declarFutureWatcher.waitForFinished(); } if (m_funcListBusy) { m_funcListBusy = false; m_listFuncFutureWatcher.waitForFinished(); } if (m_typeOfGraph == 1) { res = sq->search_funcgraph(symName, true, grpxml, grpdot); res = sq->search_funcgraph(symName, true, grpxml, grpdot, 2); } else if (m_typeOfGraph == 2) { res = sq->search_classinheritgraph(symName, true, grpxml, grpdot); } else {QApplication::restoreOverrideCursor(); return;} QApplication::restoreOverrideCursor(); QMessageBox msgBox((QWidget*)mw); msgBox.setIcon(QMessageBox::Warning); msgBox.setStandardButtons(QMessageBox::Ok); if (!res) { msgBox.setText("SQL Query error"); msgBox.exec(); return; } QApplication::setOverrideCursor(QCursor(Qt::WaitCursor)); cqDialogGraph cqdg((QWidget*)mw); cqdg.setModal(true); cqdg.setupGraphFromXML(grpxml, grpdot, m_graphdesc); QApplication::restoreOverrideCursor(); cqdg.exec(); } void searchhandler::addToSearchMemory(const QString& searchtxt, const QString& filtertxt) { searchitem item; item.searchterm = searchtxt; item.filterterm = filtertxt; item.exactmatch = m_checkBoxExactMatch->isChecked(); item.qtype = (sqlquery::en_queryType) m_comboBoxQueryType->itemData(m_comboBoxQueryType->currentIndex()).toInt(); m_searchMemoryList.push_back(item); if (m_searchMemoryList.size() > 20) m_searchMemoryList.erase(m_searchMemoryList.begin()); m_iter = m_searchMemoryList.end() - 1; m_pushButtonSearchPrev->setEnabled(m_searchMemoryList.isEmpty() == false); m_pushButtonSearchNext->setEnabled(false); } void searchhandler::goForwardInSearchMemory(void) { if (m_searchMemoryList.size() <= 1) return; if (m_iter == m_searchMemoryList.end() - 1) return; m_iter++; m_pushButtonSearchPrev->setEnabled(m_searchMemoryList.isEmpty() == false); m_pushButtonSearchNext->setEnabled(m_iter != m_searchMemoryList.end() - 1); restoreSearchMemoryItem(); } void searchhandler::goBackInSearchMemory(void) { if (m_searchMemoryList.size() <= 1) return; if (m_iter == m_searchMemoryList.begin()) return; m_iter--; m_pushButtonSearchPrev->setEnabled(m_iter != m_searchMemoryList.begin()); m_pushButtonSearchNext->setEnabled(m_searchMemoryList.isEmpty() == false); restoreSearchMemoryItem(); } void searchhandler::restoreSearchMemoryItem(void) { perform_search(m_iter->searchterm, m_iter->exactmatch, m_iter->qtype, m_iter->filterterm, m_iter->rownum, false); } void searchhandler::updateListItemRowNum(const int& row) { if (m_searchMemoryList.isEmpty() == false) m_iter->rownum = row; } void searchhandler::updateSearchHistory(const QString& searchtxt) { m_comboBoxSearch->insertItem(0, searchtxt); // insert to top int n = (m_comboBoxSearch->count()); for(int i=1; i < n; i++) { if (m_comboBoxSearch->itemText(i).compare(searchtxt, Qt::CaseSensitive) == 0) { m_comboBoxSearch->removeItem(i); // remove duplicates break; } } // limit to 15 only if (m_comboBoxSearch->count() > 15) m_comboBoxSearch->removeItem(m_comboBoxSearch->count() - 1); m_comboBoxSearch->setCurrentIndex(0); } QString searchhandler::sqlerrormsg(sqlquery::en_filereadstatus status) { QString str; switch(status) { case sqlquery::sqlfileOPENERROR: str = tr("File open error"); break; case sqlquery::sqlfileNOTCORRECTDB: str = tr("Wrong file format"); break; case sqlquery::sqlfileINCORRECTVER: str = tr("Incorrect CQ database version"); break; case sqlquery::sqlfileOK: str = tr("OK"); break; case sqlquery::sqlfileUNKNOWNERROR: default: str = tr("Unknown Error"); break; } return str; } ================================================ FILE: gui/searchhandler.h ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifndef SEARCHHANDLER_H_CQ #define SEARCHHANDLER_H_CQ #include #include #include "sqlquery.h" class mainwindow; class searchitem { public: searchitem(); ~searchitem(){} searchitem(const searchitem& otheritem); searchitem& operator=(const searchitem& otheritem); // return value: 0=same, 1=completely different, 2=only linenum changed int compare(const searchitem& otheritem); QString searchterm; QString filterterm; bool exactmatch; sqlquery::en_queryType qtype; int rownum; }; class searchhandler : public QObject { Q_OBJECT public: QPushButton *m_pushButtonOpenDB; QComboBox *m_comboBoxDB; QCheckBox *m_checkBoxAutoComplete; QCheckBox *m_checkBoxExactMatch; QPushButton *m_pushButtonSearch; QPushButton *m_pushButtonClipSearch; QPushButton *m_pushButtonSearchPrev; QPushButton *m_pushButtonSearchNext; QComboBox *m_comboBoxSearch; QComboBox *m_comboBoxQueryType; QPushButton *m_pushButtonGraph; QPushButton *m_pushButtonFilesList; QCheckBox *m_checkBoxFilter; QComboBox *m_comboBoxFilter; QCompleter *m_completer; QFutureWatcher m_autocompFutureWatcher; QFutureWatcher m_declarFutureWatcher; QFutureWatcher m_listFuncFutureWatcher; static bool m_grepExactMatch; static QRegularExpression* m_grepRegExp; searchhandler(mainwindow* pmw); ~searchhandler(); void init(void); void perform_open_db(void); void perform_search(QString searchtxt, bool exactmatch, sqlquery::en_queryType qrytyp = sqlquery::sqlresultDEFAULT, QString filtertxt = "", int selectitem = 0, bool updSearchMemory = true); void updateSearchHistory(const QString& searchtxt); void addToSearchMemory(const QString& searchtxt, const QString& filtertxt); void goForwardInSearchMemory(void); void goBackInSearchMemory(void); void restoreSearchMemoryItem(void); void retranslateUi(void); static QStringList search_autocomplete_qt(QString searchtxt); static QStringList search_declaration_qt(QString searchtxt); static sqlqueryresultlist search_funclist_qt_filename(QString filename); static sqlqueryresultlist search_funclist_qt_fileid(int fileid); static sqlqueryresultlist doGrep(const QPair &fp); static void collateGrep(sqlqueryresultlist &result, const sqlqueryresultlist &intermediate); public slots: void OpenDB_ButtonClick(bool checked); void Search_ButtonClick(bool checked); void PrevSearch_ButtonClick(bool checked); void NextSearch_ButtonClick(bool checked); void ClipSearch_ButtonClick(bool checked); void Graph_ButtonClick(bool checked); void FilesList_ButtonClick(bool checked); void Search_EnterKeyPressed(); void searchTextEdited(const QString& searchtxt); void newSearchText(); void newSearchTextSymbolOnly(); void autoCompleteStateChanged(int state); void OpenDB_indexChanged(const int& idx); void QueryType_indexChanged(const int& idx); void updateListItemRowNum(const int& row); void resultCurrentListItemSymbolName(const QString symName); void searchDeclaration(QString searchstr); void searchFuncList_filename(QString filename); void searchFuncList_fileid(int fileid); void autoCompleteFinished(); void declarSearchFinished(); void funcListSearchFinished(); signals: void searchresults(sqlqueryresultlist resultlist, int selectitem); void updateStatus(const QString & message, int timeout = 0); void DBreset(); void sendDBtimestamp(QDateTime dt); void getResultCurrentListItemSymbolName(); void searchDeclarationResultsReady(QStringList resdeclar); void searchListFuncResultsReady(sqlqueryresultlist* res); private: mainwindow *mw; static sqlquery* sq; QString m_graphdesc; int m_typeOfGraph; // 1 = Function Call, 2 = Class Inheritance QStringListModel m_srchStrLstModel; QString sqlerrormsg(sqlquery::en_filereadstatus status); QVector m_searchMemoryList; QVector::iterator m_iter; bool m_autocompBusy; bool m_declarBusy; bool m_funcListBusy; QString m_autocompSrchTerm; void updateFilterHistory(QString filtertxt); sqlqueryresultlist perform_grep(QString searchtxt, sqlqueryresultlist searchlist, bool exactmatch); }; #endif ================================================ FILE: gui/themes/Bespin.xml ================================================ the_ID the_post have_posts wp_link_pages the_content $_POST $_GET $_SESSION alert appendChild arguments array blur checked childNodes className confirm dialogArguments event focus getElementById getElementsByTagName innerHTML keyCode length location null number parentNode push RegExp replace selectNodes selectSingleNode setAttribute split src srcElement test undefined value window XmlUtil loadXmlString TopologyXmlTree NotificationArea loadXmlFile debug param @projectDescription projectDescription @param import import endfunction endif ContentScroller onMotionChanged onMotionFinished Tween ImagesStrip ContentScroller mx transitions easing Sprite Point MouseEvent Event BitmapData Timer TimerEvent addEventListener event x y height width True False if else for while bool long int char if else for while bool long int char ================================================ FILE: gui/themes/Black_board.xml ================================================ endfunction endif True False if else for while bool long int char ================================================ FILE: gui/themes/Choco.xml ================================================ ooooo endfunction endif True False if else for while bool long int char if else for while bool long int char ================================================ FILE: gui/themes/Deep_Black.xml ================================================ endfunction endif True False if else for while bool long int char if else for while bool long int char if else for while bool long int char ================================================ FILE: gui/themes/Eclipse_Default.xml ================================================ if else for while bool long int char ================================================ FILE: gui/themes/Hello_Kitty.xml ================================================ endfunction endif True False if else for while bool long int char if else for while bool long int char ================================================ FILE: gui/themes/HotFudgeSundae.xml ================================================ param @projectDescription projectDescription @param ================================================ FILE: gui/themes/Mono_Industrial.xml ================================================ if else for while bool long int char ================================================ FILE: gui/themes/Monokai.xml ================================================ if else for while bool long int char ================================================ FILE: gui/themes/MossyLawn.xml ================================================ param @projectDescription projectDescription @param ================================================ FILE: gui/themes/Navajo.xml ================================================ param @projectDescription projectDescription @param ================================================ FILE: gui/themes/NotepadPlusPlus.xml ================================================ ================================================ FILE: gui/themes/Obsidian.xml ================================================ endfunction endif True False if else for while bool long int char if else for while bool long int char if else for while bool long int char if else for while bool long int char ================================================ FILE: gui/themes/Plastic_Code_Wrap.xml ================================================ if else for while bool long int char ================================================ FILE: gui/themes/Ruby_Blue.xml ================================================ if else for while bool long int char ================================================ FILE: gui/themes/Solarized.xml ================================================ param @projectDescription projectDescription @param ================================================ FILE: gui/themes/Solarized_light.xml ================================================ param @projectDescription projectDescription @param ================================================ FILE: gui/themes/Twilight.xml ================================================ raise if else for while bool long int char ================================================ FILE: gui/themes/Vibrant_Ink.xml ================================================ if else for while bool long int char ================================================ FILE: gui/themes/Zenburn.xml ================================================ ================================================ FILE: gui/themes/khaki.xml ================================================ param @projectDescription projectDescription @param ================================================ FILE: gui/themes/parse_themes.pl ================================================ #!/usr/bin/perl # Process theme XML files, to generate C++ code # # This license applies only to this file: # # Copyright (c) 2014 ruben2020 # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # use strict; use XML::LibXML; my $debug = 0; my $themelist; my $numOfThemes = 0; my $lexstyle; my $cppstyle; my $javastyle; my $pythonstyle; my $rubystyle; my $javascriptstyle; my $langname; my $langdesc; my $themename; my $themename2; my @themes; my $defaultbgcolor; my $defaultfgcolor; my $defaultfontstyle; my $currentlinebgcolor; my $linenumfgcolor; my $stylename; my $styleid; my $fgcolor; my $bgcolor; my $fontstyle; my %acceptedlang = ( 'C++' => 'cpp', 'Java' => 'java', 'Python' => 'python', 'Ruby' => 'ruby', 'Javascript' => 'javascript' ); my $filename; my $parser; my $xmldoc; $themelist .= "static const char* themelist[] = {\n"; $cppstyle .= "static const langstyle cppstyle[] = {\n"; $javastyle .= "static const langstyle javastyle[] = {\n"; $pythonstyle .= "static const langstyle pythonstyle[] = {\n"; $rubystyle .= "static const langstyle rubystyle[] = {\n"; $javascriptstyle .= "static const langstyle javascriptstyle[] = {\n"; opendir(DIR1, '.'); while($filename = readdir(DIR1)) { $themename = ''; if ((-f $filename )&&($filename =~ /\.xml$/i)) { $themename = $filename; $themename =~ s/\.xml$//i; $themename2 = $themename; $themename2 =~ s/_/ /g; print "\n ==> $themename\n" if ($debug); push @themes, $themename2; processfile(); $numOfThemes++; } } close(DIR1); @themes = sort {lc $a cmp lc $b} @themes; foreach my $them(@themes) { $themelist .= "\t\"$them\",\n"; } $themelist .= "};\n\n"; $cppstyle .= "\t{ NULL, NULL, NULL, 0 }\n};\n\n"; $javastyle .= "\t{ NULL, NULL, NULL, 0 }\n};\n\n"; $pythonstyle .= "\t{ NULL, NULL, NULL, 0 }\n};\n\n"; $rubystyle .= "\t{ NULL, NULL, NULL, 0 }\n};\n\n"; $javascriptstyle .= "\t{ NULL, NULL, NULL, 0 }\n};\n\n"; open(FILO,">themes_gen.cpp"); print FILO "\n /* THIS FILE WAS AUTO_GENERATED USING parse_themes.pl */"; print FILO "\n /* DO NOT CHANGE BY HAND */\n\n"; print FILO "#define NUM_OF_THEMES $numOfThemes\n\n"; print FILO $themelist; print FILO $lexstyle."\n"; print FILO $cppstyle; print FILO $javastyle; print FILO $pythonstyle; print FILO $rubystyle; print FILO $javascriptstyle; close(FILO); ################################################ sub processfile { $parser = XML::LibXML->new(); $xmldoc = $parser->parse_file($filename); my $lstyle; my $numofstyles=0; my $numofglobalstyles=0; $currentlinebgcolor = ''; $linenumfgcolor = ''; foreach my $sample ( $xmldoc->findnodes('/NotepadPlus/GlobalStyles') ) { $lexstyle .= "\nstatic const lexstyle global_".$themename."[] = {\n"; $defaultbgcolor = ''; $defaultfgcolor = ''; $defaultfontstyle = ''; $numofglobalstyles = 0; foreach my $child ( $sample->getChildnodes ) { if (( $child->nodeType() == XML_ELEMENT_NODE )&&($child->nodeName() eq 'WidgetStyle')) { $stylename = ''; $styleid = ''; $fgcolor = ''; $bgcolor = ''; $fontstyle = ''; $stylename = $child->getAttribute('name') if ($child->hasAttribute('name')); $styleid = $child->getAttribute('styleID') if ($child->hasAttribute('styleID')); $fgcolor = $child->getAttribute('fgColor') if ($child->hasAttribute('fgColor')); $bgcolor = $child->getAttribute('bgColor') if ($child->hasAttribute('bgColor')); $fontstyle = $child->getAttribute('fontStyle') if ($child->hasAttribute('fontStyle')); if ($stylename eq 'Current line background colour') {$currentlinebgcolor = $bgcolor;} if ($styleid eq '33') {$linenumfgcolor = $fgcolor;} if ($styleid eq '0') {next;} $defaultbgcolor = $bgcolor if ($stylename eq 'Default Style'); $defaultfgcolor = $fgcolor if ($stylename eq 'Default Style'); $defaultfontstyle = $fontstyle if ($stylename eq 'Default Style'); $defaultfontstyle = "0" if (length($defaultfontstyle) == 0); $bgcolor = $defaultbgcolor if (length($bgcolor) == 0); $fgcolor = $defaultfgcolor if (length($fgcolor) == 0); $fontstyle = $defaultfontstyle if (length($fontstyle) == 0); print "$stylename, $styleid, $fgcolor, $bgcolor, $fontstyle\n" if ($debug); $lexstyle .= "\t{ $styleid, \"$fgcolor\", \"$bgcolor\", $fontstyle }, // $stylename\n"; $numofglobalstyles++; } } $lexstyle .= "};\n\n"; } foreach my $sample ( $xmldoc->findnodes('/NotepadPlus/LexerStyles/LexerType') ) { $langname = ''; $langdesc = ''; $langname = $sample->getAttribute('name') if ($sample->hasAttribute('name')); $langdesc = $sample->getAttribute('desc') if ($sample->hasAttribute('desc')); next if (!(defined($acceptedlang{$langdesc}))); print "\n$langname, $langdesc\n" if ($debug); $lexstyle .= "\nstatic const lexstyle ".$langname."_".$themename."[] = {\n"; $numofstyles = 0; foreach my $child ( $sample->getChildnodes ) { if (( $child->nodeType() == XML_ELEMENT_NODE )&&($child->nodeName() eq 'WordsStyle')) { $stylename = ''; $styleid = ''; $fgcolor = ''; $bgcolor = ''; $fontstyle = ''; $stylename = $child->getAttribute('name') if ($child->hasAttribute('name')); $styleid = $child->getAttribute('styleID') if ($child->hasAttribute('styleID')); $fgcolor = $child->getAttribute('fgColor') if ($child->hasAttribute('fgColor')); $bgcolor = $child->getAttribute('bgColor') if ($child->hasAttribute('bgColor')); $fontstyle = $child->getAttribute('fontStyle') if ($child->hasAttribute('fontStyle')); $defaultbgcolor = $bgcolor if ($stylename eq 'DEFAULT'); $defaultfgcolor = $fgcolor if ($stylename eq 'DEFAULT'); $defaultfontstyle = $fontstyle if ($stylename eq 'DEFAULT'); $defaultfontstyle = "0" if (length($defaultfontstyle) == 0); $bgcolor = $defaultbgcolor if (length($bgcolor) == 0); $fgcolor = $defaultfgcolor if (length($fgcolor) == 0); $fontstyle = $defaultfontstyle if (length($fontstyle) == 0); print "$stylename, $styleid, $fgcolor, $bgcolor, $fontstyle\n" if ($debug); $lexstyle .= "\t{ $styleid, \"$fgcolor\", \"$bgcolor\", $fontstyle }, // $stylename\n"; $numofstyles++; } } $lexstyle .= "};\n"; $lstyle = " { \"$themename2\", \"$defaultfgcolor\", \"$defaultbgcolor\", \"$currentlinebgcolor\", \"$linenumfgcolor\", ".$langname."_".$themename.", global_".$themename.", $numofstyles, $numofglobalstyles },\n"; $cppstyle .= $lstyle if ($langdesc eq 'C++'); $javastyle .= $lstyle if ($langdesc eq 'Java'); $pythonstyle .= $lstyle if ($langdesc eq 'Python'); $rubystyle .= $lstyle if ($langdesc eq 'Ruby'); $javascriptstyle .= $lstyle if ($langdesc eq 'Javascript'); } } ================================================ FILE: gui/themes/vim_Dark_Blue.xml ================================================ endfunction endif True False if else for while bool long int char ================================================ FILE: gui/themes.cpp ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #include #include #include "ScintillaEdit.h" #include "small_lib.h" #include "fileviewer.h" #include "themes.h" typedef struct { const char *themename; const char *defaultfgcolor; const char *defaultbgcolor; const char *currentlinebgcolor; const char *linenumfgcolor; const lexstyle *lexstyletable; const lexstyle *globallexstyletable; int lexstylesize; int globallexstylesize; }langstyle; #include "themes_gen.cpp" // Keywords lists below taken from langs.model.xml of Notepad++ const char* python_keywords = "and as assert break class continue def " "del elif else except exec False finally " "for from global if import in is lambda " "None not or pass print raise return " "True try while with yield async await"; const char* ruby_keywords = "ARGF ARGV BEGIN END ENV FALSE DATA NIL " "RUBY_PATCHLEVEL RUBY_PLATFORM RUBY_RELEASE_DATE " "RUBY_VERSION PLATFORM RELEASE_DATE STDERR STDIN " "STDOUT TOPLEVEL_BINDING TRUE __ENCODING__ " "__END__ __FILE__ __LINE__ alias and begin break " "case class def defined? do else elsif end ensure " "false for if in module next nil not or redo rescue " "retry return self super then true undef " "unless until when while yield"; const char* js_keywords = "abstract async await boolean break byte case catch " "char class const continue debugger default delete do " "double else enum export extends final finally float " "for from function goto if implements import in instanceof " "int interface let long native new null of package private " "protected public return short static super switch synchronized " "this throw throws transient try typeof var void " "volatile while with true false prototype yield"; const char* js_types = "Array Date eval hasOwnProperty Infinity isFinite isNaN " "isPrototypeOf Math NaN Number Object prototype " "String toString undefined valueOf"; const char* java_keywords = "instanceof assert if else switch case default break goto " "return for while do continue new throw throws try catch " "finally this super extends implements import true false null"; const char* java_types = "package transient strictfp void char short int long double " "float const static volatile byte boolean class interface " "native private protected public final abstract synchronized enum"; const char* cpp_keywords = "alignof and and_eq bitand bitor break case catch compl const_cast " "continue default delete do dynamic_cast else false for goto if " "namespace new not not_eq nullptr operator or or_eq reinterpret_cast " "return sizeof static_assert static_cast switch this " "throw true try typedef typeid using while xor xor_eq NULL"; const char* cpp_types = "alignas asm auto bool char char16_t char32_t class clock_t " "const constexpr decltype double enum explicit export extern " "final float friend inline int int8_t int16_t int32_t int64_t " "int_fast8_t int_fast16_t int_fast32_t int_fast64_t intmax_t " "intptr_t long mutable noexcept override private protected " "ptrdiff_t public register short signed size_t ssize_t static " "struct template thread_local time_t typename uint8_t uint16_t " "uint32_t uint64_t uint_fast8_t uint_fast16_t uint_fast32_t " "uint_fast64_t uintmax_t uintptr_t union " "unsigned virtual void volatile wchar_t"; const char* cpp_docwords = "a addindex addtogroup anchor arg attention author authors b brief " "bug c callergraph callgraph category cite class code cond " "copybrief copydetails copydoc copyright date def defgroup deprecated " "details diafile dir docbookonly dontinclude dot dotfile e else elseif " "em endcode endcond enddocbookonly enddot endhtmlonly endif endinternal " "endlatexonly endlink endmanonly endmsc endparblock endrtfonly " "endsecreflist enduml endverbatim endxmlonly enum example exception " "extends f$ f[ f] file fn f{ f} headerfile hidecallergraph hidecallgraph " "hideinitializer htmlinclude htmlonly idlexcept if ifnot image " "implements include includelineno ingroup interface internal invariant " "latexinclude latexonly li line link mainpage manonly memberof msc mscfile " "n name namespace nosubgrouping note overload p package page par paragraph " "param parblock post pre private privatesection property protected " "protectedsection protocol public publicsection pure ref refitem related " "relatedalso relates relatesalso remark remarks result return returns " "retval rtfonly sa secreflist section see short showinitializer since " "skip skipline snippet startuml struct subpage subsection subsubsection " "tableofcontents test throw throws todo tparam typedef union until var " "verbatim verbinclude version vhdlflow warning weakgroup xmlonly xrefitem"; const char* go_keywords = "break default func interface select " "case defer go map struct chan else goto package switch " "const fallthrough if range type continue for import return var " "append cap close complex copy delete imag len " "make new panic print println real recover"; const char* go_types = "true false iota nil " "bool byte complex64 complex128 error float32 float64 " "int int8 int16 int32 int64 rune string " "uint uint8 uint16 uint32 uint64 uintptr"; QStringList themes::getThemesList(void) { QStringList lst; for(int i=0; isetKeyWords(i, " "); switch(lang) { case enHighlightPython: lexer->setKeyWords(0, python_keywords); break; case enHighlightJava: lexer->setKeyWords(0, java_keywords); lexer->setKeyWords(1, java_types); break; case enHighlightRuby: lexer->setKeyWords(0, ruby_keywords); break; case enHighlightJavascript: lexer->setKeyWords(0, js_keywords); lexer->setKeyWords(1, js_types); break; case enHighlightGo: lexer->setKeyWords(0, go_keywords); lexer->setKeyWords(1, go_types); break; case enHighlightCPP: // fall through default: lexer->setKeyWords(0, cpp_keywords); lexer->setKeyWords(1, cpp_types); lexer->setKeyWords(2, cpp_docwords); break; } } long themes::QC2SC(QColor colour) { long retval; retval = (long) colour.red(); retval |= ((long) colour.green()) << 8; retval |= ((long) colour.blue()) << 16; return retval; } void themes::setTheme(const QString& theme, int lang, ScintillaEdit* lexer, const QFont& fontt, QColor& curlinebgcolor, QColor& linenumbgcolor) { langstyle *lngstyle = NULL; lexstyle *lxstyle = NULL; lexstyle *globallxstyle = NULL; int i=0; int lxstylesize=0; int globallxstylesize=0; long defbgcolor; long deffgcolor; QFont font1 = fontt; //font1.setFixedPitch(true); font1.setBold(false); font1.setItalic(false); for (i=0; i < 4; i++) lexer->setKeyWords(i, ""); switch(lang) { case enHighlightCPP: lngstyle = (langstyle *) cppstyle; break; case enHighlightPython: lngstyle = (langstyle *) pythonstyle; break; case enHighlightJava: lngstyle = (langstyle *) javastyle; break; case enHighlightRuby: lngstyle = (langstyle *) rubystyle; break; case enHighlightJavascript: lngstyle = (langstyle *) cppstyle; //lngstyle = (langstyle *) javascriptstyle; break; default: lngstyle = (langstyle *) cppstyle; break; } i = 0; while (lngstyle[i].lexstylesize > 0) { if (theme.compare(QString(lngstyle[i].themename)) == 0) { lxstyle = (lexstyle *) lngstyle[i].lexstyletable; globallxstyle = (lexstyle *) lngstyle[i].globallexstyletable; lxstylesize = lngstyle[i].lexstylesize; globallxstylesize = lngstyle[i].globallexstylesize; defbgcolor = QC2SC(QColor(QString("#").append(QString(lngstyle[i].defaultbgcolor)))); deffgcolor = QC2SC(QColor(QString("#").append(QString(lngstyle[i].defaultfgcolor)))); lexer->styleSetBack( STYLE_DEFAULT, defbgcolor); lexer->styleSetFore( STYLE_DEFAULT, deffgcolor); lexer->styleSetFont( STYLE_DEFAULT, font1.family().toLatin1().data()); lexer->styleSetBold( STYLE_DEFAULT, false); lexer->styleSetItalic(STYLE_DEFAULT, false); lexer->styleClearAll(); lexer->setCaretFore(deffgcolor); break; } i++; } setThemeStyle(lexer, globallxstyle, globallxstylesize, font1); setThemeStyle(lexer, lxstyle , lxstylesize , font1); curlinebgcolor = QColor(QString("#").append(QString(lngstyle[i].currentlinebgcolor))); linenumbgcolor = QColor(QString("#").append(QString(lngstyle[i].linenumfgcolor))); } void themes::setThemeStyle(ScintillaEdit* lexer, lexstyle *lxstyle, int lxstylesize, QFont& font1) { int i; if (lxstyle != NULL) for(i=0; istyleSetBack(lxstyle[i].styleid, QC2SC(QColor(QString("#").append(QString(lxstyle[i].bgcolor))))); lexer->styleSetFore(lxstyle[i].styleid, QC2SC(QColor(QString("#").append(QString(lxstyle[i].fgcolor))))); lexer->styleSetFont(lxstyle[i].styleid, font1.family().toLatin1().data()); switch(lxstyle[i].fontstyle) { case 1: lexer->styleSetBold(lxstyle[i].styleid, true); lexer->styleSetItalic(lxstyle[i].styleid, false); break; case 2: lexer->styleSetBold(lxstyle[i].styleid, false); lexer->styleSetItalic(lxstyle[i].styleid, true); break; case 3: lexer->styleSetBold(lxstyle[i].styleid, true); lexer->styleSetItalic(lxstyle[i].styleid, true); break; default: lexer->styleSetBold(lxstyle[i].styleid, false); lexer->styleSetItalic(lxstyle[i].styleid, false); break; } } } ================================================ FILE: gui/themes.h ================================================ /* * CodeQuery * Copyright (C) 2013-2017 ruben2020 https://github.com/ruben2020/ * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. * */ #ifndef THEMES_H_CQ #define THEMES_H_CQ #include #include class ScintillaEdit; typedef struct { int styleid; const char *fgcolor; const char *bgcolor; int fontstyle; }lexstyle; class themes { public: static QStringList getThemesList(void); static void setTheme(const QString& theme, int lang, ScintillaEdit* lexer, const QFont& fontt, QColor& curlinebgcolor, QColor& linenumbgcolor); static void setKeywords(int lang, ScintillaEdit* lexer); static long QC2SC(QColor colour); private: static void setThemeStyle(ScintillaEdit* lexer, lexstyle *lxstyle, int lxstylesize, QFont& font1); }; #endif // THEMES_H_CQ ================================================ FILE: gui/themes_gen.cpp ================================================ /* THIS FILE WAS AUTO_GENERATED USING parse_themes.pl */ /* DO NOT CHANGE BY HAND */ #define NUM_OF_THEMES 22 static const char* themelist[] = { "Bespin", "Black board", "Choco", "Deep Black", "Eclipse Default", "Hello Kitty", "HotFudgeSundae", "khaki", "Mono Industrial", "Monokai", "MossyLawn", "Navajo", "NotepadPlusPlus", "Obsidian", "Plastic Code Wrap", "Ruby Blue", "Solarized", "Solarized light", "Twilight", "Vibrant Ink", "vim Dark Blue", "Zenburn", }; static const lexstyle global_Monokai[] = { { 32, "F8F8F2", "272822", 0 }, // Default Style { 37, "888A85", "272822", 0 }, // Indent guideline style { 34, "FCE94F", "272822", 1 }, // Brace highlight style { 35, "EF2929", "272822", 0 }, // Bad brace colour { 2069, "F8F8F0", "272822", 0 }, // Caret colour { 31, "CC0000", "EDD400", 0 }, // Find Mark Style { 33, "EEEEEC", "2E3436", 0 }, // Line number margin { 29, "555753", "00FF00", 0 }, // Smart HighLighting { 31, "FCAF3E", "FF0000", 0 }, // Find Mark Style { 25, "F8F8F2", "00FFFF", 0 }, // Mark Style 1 { 24, "F8F8F2", "FF8000", 0 }, // Mark Style 2 { 23, "F8F8F2", "FFFF00", 0 }, // Mark Style 3 { 22, "F8F8F2", "8000FF", 0 }, // Mark Style 4 { 21, "F8F8F2", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "8000FF", 0 }, // Tags match highlighting { 26, "8080C0", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_Monokai[] = { { 9, "F92672", "272822", 0 }, // PREPROCESSOR { 11, "F8F8F2", "272822", 0 }, // DEFAULT { 5, "66D9EF", "272822", 0 }, // INSTRUCTION WORD { 16, "F92672", "272822", 0 }, // TYPE WORD { 4, "AE81FF", "272822", 0 }, // NUMBER { 6, "E6DB74", "272822", 0 }, // STRING { 7, "E6DB74", "272822", 0 }, // CHARACTER { 10, "F92672", "272822", 0 }, // OPERATOR { 13, "AE81FF", "272822", 0 }, // VERBATIM { 14, "E6DB74", "272822", 0 }, // REGEX { 1, "75715E", "272822", 0 }, // COMMENT { 2, "75715E", "272822", 0 }, // COMMENT LINE { 3, "75715E", "272822", 0 }, // COMMENT DOC { 15, "75715E", "272822", 0 }, // COMMENT LINE DOC { 17, "75715E", "272822", 0 }, // COMMENT DOC KEYWORD { 18, "75715E", "272822", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Monokai[] = { { 9, "F92672", "272822", 0 }, // PREPROCESSOR { 11, "F8F8F2", "272822", 0 }, // DEFAULT { 5, "66D9EF", "272822", 0 }, // INSTRUCTION WORD { 16, "F92672", "272822", 0 }, // TYPE WORD { 4, "AE81FF", "272822", 0 }, // NUMBER { 6, "E6DB74", "272822", 0 }, // STRING { 7, "E6DB74", "272822", 0 }, // CHARACTER { 10, "F92672", "272822", 0 }, // OPERATOR { 13, "AE81FF", "272822", 0 }, // VERBATIM { 14, "E6DB74", "272822", 0 }, // REGEX { 1, "75715E", "272822", 0 }, // COMMENT { 2, "75715E", "272822", 0 }, // COMMENT LINE { 3, "75715E", "272822", 0 }, // COMMENT DOC { 15, "75715E", "272822", 0 }, // COMMENT LINE DOC { 17, "75715E", "272822", 0 }, // COMMENT DOC KEYWORD { 18, "75715E", "272822", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Monokai[] = { { 41, "F8F8F2", "272822", 0 }, // DEFAULT { 45, "AE81FF", "272822", 0 }, // NUMBER { 46, "F8F8F2", "272822", 0 }, // WORD { 47, "F92672", "272822", 0 }, // KEYWORD { 48, "E6DB74", "272822", 0 }, // DOUBLESTRING { 49, "E6DB74", "272822", 0 }, // SINGLESTRING { 50, "F8F8F2", "272822", 0 }, // SYMBOLS { 51, "E6DB74", "272822", 0 }, // STRINGEOL { 52, "E6DB74", "272822", 0 }, // REGEX { 42, "75715E", "272822", 0 }, // COMMENT { 43, "75715E", "272822", 0 }, // COMMENTLINE { 44, "75715E", "272822", 0 }, // COMMENTDOC }; static const lexstyle python_Monokai[] = { { 0, "F8F8F2", "272822", 0 }, // DEFAULT { 1, "75715E", "272822", 0 }, // COMMENTLINE { 2, "AE81FF", "272822", 0 }, // NUMBER { 3, "E6DB74", "272822", 0 }, // STRING { 4, "E6DB74", "272822", 0 }, // CHARACTER { 5, "F92672", "272822", 0 }, // KEYWORDS { 6, "F8F8F2", "272822", 0 }, // TRIPLE { 7, "F8F8F2", "272822", 0 }, // TRIPLEDOUBLE { 8, "F8F8F2", "272822", 0 }, // CLASSNAME { 9, "F8F8F2", "272822", 0 }, // DEFNAME { 10, "F92672", "272822", 0 }, // OPERATOR { 11, "66D9EF", "272822", 0 }, // IDENTIFIER { 12, "75715E", "272822", 0 }, // COMMENTBLOCK { 12, "E6DB74", "272822", 0 }, // STRINGEOL }; static const lexstyle ruby_Monokai[] = { { 0, "F8F8F2", "272822", 0 }, // DEFAULT { 1, "F8F8F2", "272822", 0 }, // ERROR { 2, "75715E", "272822", 0 }, // COMMENTLINE { 3, "F8F8F2", "272822", 0 }, // POD { 4, "AE81FF", "272822", 0 }, // NUMBER { 5, "F92672", "272822", 0 }, // INSTRUCTION { 6, "E6DB74", "272822", 0 }, // STRING { 7, "E6DB74", "272822", 0 }, // CHARACTER { 8, "F8F8F2", "272822", 0 }, // CLASS NAME { 9, "A6E22E", "272822", 0 }, // DEF NAME { 10, "F92672", "272822", 0 }, // OPERATOR { 11, "66D9EF", "272822", 0 }, // IDENTIFIER { 12, "E6DB74", "272822", 0 }, // REGEX { 13, "F8F8F2", "272822", 0 }, // GLOBAL { 14, "F8F8F2", "272822", 0 }, // SYMBOL { 15, "F8F8F2", "272822", 0 }, // MODULE NAME { 16, "F8F8F2", "272822", 0 }, // INSTANCE VAR { 17, "F8F8F2", "272822", 0 }, // CLASS VAR { 18, "F8F8F2", "272822", 0 }, // BACKTICKS { 19, "F8F8F2", "272822", 0 }, // DATA SECTION { 24, "E6DB74", "272822", 0 }, // STRING Q }; static const lexstyle global_Vibrant_Ink[] = { { 32, "FFFFFF", "000000", 0 }, // Default Style { 37, "C0C0C0", "000000", 0 }, // Indent guideline style { 34, "99CC99", "000000", 1 }, // Brace highlight style { 35, "CCFF33", "000000", 0 }, // Bad brace colour { 2069, "FFFFFF", "112435", 0 }, // Caret colour { 31, "FFFF00", "FF0000", 1 }, // Find Mark Style { 33, "E4E4E4", "333333", 0 }, // Line number margin { 29, "555753", "00FF00", 0 }, // Smart HighLighting { 31, "FCAF3E", "FF0000", 0 }, // Find Mark Style { 25, "FFFFFF", "00FFFF", 0 }, // Mark Style 1 { 24, "FFFFFF", "FF8000", 0 }, // Mark Style 2 { 23, "FFFFFF", "FFFF00", 0 }, // Mark Style 3 { 22, "FFFFFF", "8000FF", 0 }, // Mark Style 4 { 21, "FFFFFF", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "8000FF", 0 }, // Tags match highlighting { 26, "8080C0", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_Vibrant_Ink[] = { { 9, "EDF8F9", "000000", 0 }, // PREPROCESSOR { 11, "FFFFFF", "000000", 0 }, // DEFAULT { 5, "FF6600", "000000", 1 }, // INSTRUCTION WORD { 16, "66FF00", "000000", 0 }, // TYPE WORD { 4, "FF8000", "000000", 0 }, // NUMBER { 6, "66FF00", "000000", 0 }, // STRING { 7, "66FF00", "000000", 0 }, // CHARACTER { 10, "FFCC00", "000000", 1 }, // OPERATOR { 13, "FFFFFF", "000000", 0 }, // VERBATIM { 14, "FFFFFF", "000000", 1 }, // REGEX { 1, "9933CC", "000000", 0 }, // COMMENT { 2, "9933CC", "000000", 0 }, // COMMENT LINE { 3, "9933CC", "000000", 0 }, // COMMENT DOC { 15, "9933CC", "000000", 0 }, // COMMENT LINE DOC { 17, "9933CC", "000000", 1 }, // COMMENT DOC KEYWORD { 18, "9933CC", "000000", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Vibrant_Ink[] = { { 9, "EDF8F9", "000000", 0 }, // PREPROCESSOR { 11, "FFFFFF", "000000", 0 }, // DEFAULT { 5, "FF6600", "000000", 1 }, // INSTRUCTION WORD { 16, "66FF00", "000000", 0 }, // TYPE WORD { 4, "FF8000", "000000", 0 }, // NUMBER { 6, "66FF00", "000000", 0 }, // STRING { 7, "66FF00", "000000", 0 }, // CHARACTER { 10, "FFCC00", "000000", 1 }, // OPERATOR { 13, "FFFFFF", "000000", 0 }, // VERBATIM { 14, "FFFFFF", "000000", 1 }, // REGEX { 1, "9933CC", "000000", 0 }, // COMMENT { 2, "9933CC", "000000", 0 }, // COMMENT LINE { 3, "9933CC", "000000", 0 }, // COMMENT DOC { 15, "9933CC", "000000", 0 }, // COMMENT LINE DOC { 17, "9933CC", "000000", 1 }, // COMMENT DOC KEYWORD { 18, "9933CC", "000000", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Vibrant_Ink[] = { { 41, "FFFFFF", "000000", 0 }, // DEFAULT { 45, "99CC99", "000000", 0 }, // NUMBER { 46, "FF6600", "000000", 0 }, // WORD { 47, "FFCC00", "000000", 3 }, // KEYWORD { 48, "FFFF00", "000000", 0 }, // DOUBLESTRING { 49, "FFFF00", "000000", 0 }, // SINGLESTRING { 50, "999966", "000000", 1 }, // SYMBOLS { 51, "CCCCCC", "000000", 1 }, // STRINGEOL { 52, "339999", "000000", 0 }, // REGEX { 42, "9933CC", "000000", 0 }, // COMMENT { 43, "9933CC", "000000", 0 }, // COMMENTLINE { 44, "772CB7", "070707", 0 }, // COMMENTDOC }; static const lexstyle python_Vibrant_Ink[] = { { 0, "FFFFFF", "000000", 0 }, // DEFAULT { 1, "9933CC", "000000", 0 }, // COMMENTLINE { 2, "99CC99", "000000", 0 }, // NUMBER { 3, "66FF00", "000000", 0 }, // STRING { 4, "66FF00", "000000", 0 }, // CHARACTER { 5, "FF6600", "000000", 1 }, // KEYWORDS { 6, "FF8000", "000000", 0 }, // TRIPLE { 7, "FFFFFF", "000000", 0 }, // TRIPLEDOUBLE { 8, "FFFFFF", "000000", 1 }, // CLASSNAME { 9, "FF00FF", "000000", 0 }, // DEFNAME { 10, "FFCC00", "000000", 1 }, // OPERATOR { 11, "FFFFFF", "000000", 0 }, // IDENTIFIER { 12, "9933CC", "000000", 0 }, // COMMENTBLOCK { 12, "FFFF00", "000000", 0 }, // STRINGEOL }; static const lexstyle ruby_Vibrant_Ink[] = { { 0, "FFFFFF", "000000", 0 }, // DEFAULT { 1, "FFFFFF", "000000", 0 }, // ERROR { 2, "9933CC", "000000", 0 }, // COMMENTLINE { 3, "004000", "C0FFC0", 0 }, // POD { 4, "FF8000", "000000", 0 }, // NUMBER { 5, "FF6600", "000000", 1 }, // INSTRUCTION { 6, "66FF00", "000000", 0 }, // STRING { 7, "808000", "000000", 0 }, // CHARACTER { 8, "0080C0", "000000", 1 }, // CLASS NAME { 9, "8080FF", "FFFFCC", 1 }, // DEF NAME { 10, "FFCC00", "000000", 1 }, // OPERATOR { 11, "FFFFFF", "000000", 0 }, // IDENTIFIER { 12, "339999", "000000", 0 }, // REGEX { 13, "FFCC00", "000000", 1 }, // GLOBAL { 14, "FFFFFF", "000000", 0 }, // SYMBOL { 15, "EDF8F9", "000000", 1 }, // MODULE NAME { 16, "FFFFFF", "000000", 0 }, // INSTANCE VAR { 17, "FFFFFF", "000000", 0 }, // CLASS VAR { 18, "FFFF00", "A08080", 0 }, // BACKTICKS { 19, "600000", "FFF0D8", 0 }, // DATA SECTION { 24, "66FF00", "000000", 0 }, // STRING Q }; static const lexstyle global_Solarized_light[] = { { 32, "657B83", "FDF6E3", 0 }, // Default Style { 37, "93A1A1", "FDF6E3", 0 }, // Indent guideline style { 34, "DC322F", "859900", 1 }, // Brace highlight style { 35, "D33682", "FDF6E3", 0 }, // Bad brace colour { 2069, "073642", "FDF6E3", 0 }, // Caret colour { 33, "93A1A1", "EEE8D5", 0 }, // Line number margin { 29, "657B83", "002B36", 0 }, // Smart HighLighting { 31, "657B83", "6C71C4", 0 }, // Find Mark Style { 25, "657B83", "DC322F", 0 }, // Mark Style 1 { 24, "657B83", "268BD2", 0 }, // Mark Style 2 { 23, "657B83", "2AA198", 0 }, // Mark Style 3 { 22, "657B83", "859900", 0 }, // Mark Style 4 { 21, "657B83", "B58900", 0 }, // Mark Style 5 { 28, "657B83", "FDF6E3", 0 }, // Incremental highlight all { 27, "657B83", "CB4B16", 0 }, // Tags match highlighting { 26, "657B83", "CB4B16", 0 }, // Tags attribute }; static const lexstyle cpp_Solarized_light[] = { { 9, "DC322F", "FDF6E3", 0 }, // PREPROCESSOR { 11, "657B83", "FDF6E3", 0 }, // DEFAULT { 5, "859900", "FDF6E3", 0 }, // INSTRUCTION WORD { 16, "B58900", "FDF6E3", 0 }, // TYPE WORD { 4, "2AA198", "FDF6E3", 0 }, // NUMBER { 6, "2AA198", "FDF6E3", 0 }, // STRING { 7, "2AA198", "FDF6E3", 0 }, // CHARACTER { 10, "586E75", "FDF6E3", 0 }, // OPERATOR { 13, "2AA198", "FDF6E3", 0 }, // VERBATIM { 14, "268BD2", "FDF6E3", 0 }, // REGEX { 1, "93A1A1", "FDF6E3", 2 }, // COMMENT { 2, "93A1A1", "FDF6E3", 2 }, // COMMENT LINE { 3, "93A1A1", "FDF6E3", 2 }, // COMMENT DOC { 15, "93A1A1", "FDF6E3", 2 }, // COMMENT LINE DOC { 17, "93A1A1", "FDF6E3", 3 }, // COMMENT DOC KEYWORD { 18, "D33682", "FDF6E3", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Solarized_light[] = { { 9, "DC322F", "FDF6E3", 0 }, // PREPROCESSOR { 11, "657B83", "FDF6E3", 0 }, // DEFAULT { 5, "859900", "FDF6E3", 0 }, // INSTRUCTION WORD { 16, "B58900", "FDF6E3", 0 }, // TYPE WORD { 4, "2AA198", "FDF6E3", 0 }, // NUMBER { 6, "2AA198", "FDF6E3", 0 }, // STRING { 7, "2AA198", "FDF6E3", 0 }, // CHARACTER { 10, "586E75", "FDF6E3", 0 }, // OPERATOR { 13, "2AA198", "FDF6E3", 0 }, // VERBATIM { 14, "268BD2", "FDF6E3", 0 }, // REGEX { 1, "93A1A1", "FDF6E3", 2 }, // COMMENT { 2, "93A1A1", "FDF6E3", 2 }, // COMMENT LINE { 3, "93A1A1", "FDF6E3", 2 }, // COMMENT DOC { 15, "93A1A1", "FDF6E3", 2 }, // COMMENT LINE DOC { 17, "268BD2", "FDF6E3", 3 }, // COMMENT DOC KEYWORD { 18, "D33682", "FDF6E3", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Solarized_light[] = { { 41, "657B83", "FDF6E3", 0 }, // DEFAULT { 45, "2AA198", "FDF6E3", 0 }, // NUMBER { 46, "B58900", "FDF6E3", 0 }, // WORD { 47, "859900", "FDF6E3", 0 }, // KEYWORD { 48, "2AA198", "FDF6E3", 0 }, // DOUBLESTRING { 49, "2AA198", "FDF6E3", 0 }, // SINGLESTRING { 50, "657B83", "FDF6E3", 0 }, // SYMBOLS { 51, "DC322F", "FDF6E3", 0 }, // STRINGEOL { 52, "268BD2", "FDF6E3", 0 }, // REGEX { 42, "93A1A1", "FDF6E3", 2 }, // COMMENT { 43, "93A1A1", "FDF6E3", 2 }, // COMMENTLINE { 44, "93A1A1", "FDF6E3", 2 }, // COMMENTDOC { 17, "268BD2", "FDF6E3", 3 }, // COMMENT DOC KEYWORD { 18, "D33682", "FDF6E3", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle python_Solarized_light[] = { { 0, "657B83", "FDF6E3", 0 }, // DEFAULT { 1, "93A1A1", "FDF6E3", 2 }, // COMMENTLINE { 2, "2AA198", "FDF6E3", 0 }, // NUMBER { 3, "2AA198", "FDF6E3", 0 }, // STRING { 4, "2AA198", "FDF6E3", 0 }, // CHARACTER { 5, "859900", "FDF6E3", 0 }, // KEYWORDS { 6, "2AA198", "FDF6E3", 0 }, // TRIPLE { 7, "2AA198", "FDF6E3", 0 }, // TRIPLEDOUBLE { 8, "CB4B16", "FDF6E3", 0 }, // CLASSNAME { 9, "CB4B16", "FDF6E3", 0 }, // DEFNAME { 10, "586E75", "FDF6E3", 0 }, // OPERATOR { 11, "B58900", "FDF6E3", 0 }, // IDENTIFIER { 12, "93A1A1", "FDF6E3", 2 }, // COMMENTBLOCK { 12, "93A1A1", "FDF6E3", 0 }, // STRINGEOL }; static const lexstyle ruby_Solarized_light[] = { { 0, "657B83", "FDF6E3", 0 }, // DEFAULT { 1, "DC322F", "FDF6E3", 0 }, // ERROR { 2, "93A1A1", "FDF6E3", 2 }, // COMMENTLINE { 3, "657B83", "FDF6E3", 2 }, // POD { 4, "2AA198", "FDF6E3", 0 }, // NUMBER { 5, "859900", "FDF6E3", 0 }, // INSTRUCTION { 6, "2AA198", "FDF6E3", 0 }, // STRING { 7, "2AA198", "FDF6E3", 0 }, // CHARACTER { 8, "B58900", "FDF6E3", 0 }, // CLASS NAME { 9, "268BD2", "FDF6E3", 0 }, // DEF NAME { 10, "586E75", "FDF6E3", 0 }, // OPERATOR { 11, "B58900", "FDF6E3", 0 }, // IDENTIFIER { 12, "268BD2", "FDF6E3", 0 }, // REGEX { 13, "B58900", "FDF6E3", 0 }, // GLOBAL { 14, "657B83", "FDF6E3", 0 }, // SYMBOL { 15, "CB4B16", "FDF6E3", 0 }, // MODULE NAME { 16, "B58900", "FDF6E3", 0 }, // INSTANCE VAR { 17, "657B83", "FDF6E3", 0 }, // CLASS VAR { 18, "073642", "6C71C4", 0 }, // BACKTICKS { 19, "2AA198", "FDF6E3", 0 }, // DATA SECTION { 24, "2AA198", "FDF6E3", 0 }, // STRING Q { 25, "268BD2", "FDF6E3", 0 }, // BOOLEAN }; static const lexstyle global_Twilight[] = { { 32, "F8F8F8", "141414", 0 }, // Default Style { 37, "888A85", "141414", 0 }, // Indent guideline style { 34, "FCE94F", "141414", 1 }, // Brace highlight style { 35, "EF2929", "141414", 0 }, // Bad brace colour { 2069, "A7A7A7", "141414", 0 }, // Caret colour { 31, "CC0000", "EDD400", 0 }, // Find Mark Style { 33, "EEEEEC", "2E3436", 0 }, // Line number margin { 29, "555753", "00FF00", 0 }, // Smart HighLighting { 31, "FCAF3E", "FF0000", 0 }, // Find Mark Style { 25, "F8F8F8", "00FFFF", 0 }, // Mark Style 1 { 24, "F8F8F8", "FF8000", 0 }, // Mark Style 2 { 23, "F8F8F8", "FFFF00", 0 }, // Mark Style 3 { 22, "F8F8F8", "8000FF", 0 }, // Mark Style 4 { 21, "F8F8F8", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "8000FF", 0 }, // Tags match highlighting { 26, "8080C0", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_Twilight[] = { { 9, "8996A8", "141414", 0 }, // PREPROCESSOR { 11, "F8F8F8", "141414", 0 }, // DEFAULT { 5, "F9EE98", "141414", 0 }, // INSTRUCTION WORD { 16, "CDA869", "141414", 0 }, // TYPE WORD { 4, "CF6A4C", "141414", 0 }, // NUMBER { 6, "8F9D6A", "141414", 0 }, // STRING { 7, "8F9D6A", "141414", 0 }, // CHARACTER { 10, "CDA869", "141414", 0 }, // OPERATOR { 13, "CF6A4C", "141414", 0 }, // VERBATIM { 14, "E9C062", "141414", 0 }, // REGEX { 1, "5F5A60", "141414", 0 }, // COMMENT { 2, "5F5A60", "141414", 0 }, // COMMENT LINE { 3, "5F5A60", "141414", 0 }, // COMMENT DOC { 15, "5F5A60", "141414", 0 }, // COMMENT LINE DOC { 17, "5F5A60", "141414", 0 }, // COMMENT DOC KEYWORD { 18, "5F5A60", "141414", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Twilight[] = { { 9, "8996A8", "141414", 0 }, // PREPROCESSOR { 11, "F8F8F8", "141414", 0 }, // DEFAULT { 5, "F9EE98", "141414", 0 }, // INSTRUCTION WORD { 16, "CDA869", "141414", 0 }, // TYPE WORD { 4, "CF6A4C", "141414", 0 }, // NUMBER { 6, "8F9D6A", "141414", 0 }, // STRING { 7, "8F9D6A", "141414", 0 }, // CHARACTER { 10, "CDA869", "141414", 0 }, // OPERATOR { 13, "CF6A4C", "141414", 0 }, // VERBATIM { 14, "E9C062", "141414", 0 }, // REGEX { 1, "5F5A60", "141414", 0 }, // COMMENT { 2, "5F5A60", "141414", 0 }, // COMMENT LINE { 3, "5F5A60", "141414", 0 }, // COMMENT DOC { 15, "5F5A60", "141414", 0 }, // COMMENT LINE DOC { 17, "5F5A60", "141414", 0 }, // COMMENT DOC KEYWORD { 18, "5F5A60", "141414", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Twilight[] = { { 41, "F8F8F8", "141414", 0 }, // DEFAULT { 45, "CF6A4C", "141414", 0 }, // NUMBER { 46, "F8F8F8", "141414", 0 }, // WORD { 47, "CDA869", "141414", 0 }, // KEYWORD { 48, "8F9D6A", "141414", 0 }, // DOUBLESTRING { 49, "8F9D6A", "141414", 0 }, // SINGLESTRING { 50, "F8F8F8", "141414", 0 }, // SYMBOLS { 51, "8F9D6A", "141414", 0 }, // STRINGEOL { 52, "E9C062", "141414", 0 }, // REGEX { 42, "5F5A60", "141414", 0 }, // COMMENT { 43, "5F5A60", "141414", 0 }, // COMMENTLINE { 44, "5F5A60", "141414", 0 }, // COMMENTDOC }; static const lexstyle python_Twilight[] = { { 0, "F8F8F8", "141414", 0 }, // DEFAULT { 1, "5F5A60", "141414", 0 }, // COMMENTLINE { 2, "CF6A4C", "141414", 0 }, // NUMBER { 3, "8F9D6A", "141414", 0 }, // STRING { 4, "8F9D6A", "141414", 0 }, // CHARACTER { 5, "CDA869", "141414", 0 }, // KEYWORDS { 6, "8F9D6A", "141414", 0 }, // TRIPLE { 7, "8F9D6A", "141414", 0 }, // TRIPLEDOUBLE { 8, "F8F8F8", "141414", 0 }, // CLASSNAME { 9, "F8F8F8", "141414", 0 }, // DEFNAME { 10, "CDA869", "141414", 0 }, // OPERATOR { 11, "CF6A4C", "141414", 0 }, // IDENTIFIER { 12, "5F5A60", "141414", 0 }, // COMMENTBLOCK { 12, "8F9D6A", "141414", 0 }, // STRINGEOL }; static const lexstyle ruby_Twilight[] = { { 0, "F8F8F8", "141414", 0 }, // DEFAULT { 1, "000000", "141414", 0 }, // ERROR { 2, "5F5A60", "141414", 0 }, // COMMENTLINE { 3, "000000", "141414", 0 }, // POD { 4, "CF6A4C", "141414", 0 }, // NUMBER { 5, "CDA869", "141414", 0 }, // INSTRUCTION { 6, "8F9D6A", "141414", 0 }, // STRING { 7, "8F9D6A", "141414", 0 }, // CHARACTER { 8, "9B703F", "141414", 0 }, // CLASS NAME { 9, "9B703F", "141414", 0 }, // DEF NAME { 10, "CDA869", "141414", 0 }, // OPERATOR { 11, "CF6A4C", "141414", 0 }, // IDENTIFIER { 12, "E9C062", "141414", 0 }, // REGEX { 13, "7587A6", "141414", 0 }, // GLOBAL { 14, "F8F8F8", "141414", 0 }, // SYMBOL { 15, "9B703F", "141414", 0 }, // MODULE NAME { 16, "7587A6", "141414", 0 }, // INSTANCE VAR { 17, "000000", "141414", 0 }, // CLASS VAR { 18, "000000", "141414", 0 }, // BACKTICKS { 19, "000000", "141414", 0 }, // DATA SECTION { 24, "8F9D6A", "141414", 0 }, // STRING Q }; static const lexstyle global_vim_Dark_Blue[] = { { 32, "FFFFBF", "000040", 0 }, // Default Style { 37, "808080", "000040", 0 }, // Indent guideline style { 34, "80FF80", "000040", 1 }, // Brace highlight style { 35, "FF8000", "000040", 0 }, // Bad brace colour { 2069, "FFFF00", "000040", 0 }, // Caret colour { 31, "FFFF00", "000040", 1 }, // Find Mark Style { 33, "FFFFFF", "000040", 0 }, // Line number margin { 29, "FFFFBF", "2050D0", 0 }, // Smart HighLighting { 28, "FFFFBF", "008000", 0 }, // Incremental highlight all { 27, "FFFFBF", "000040", 0 }, // Tags match highlighting { 26, "FFFFBF", "000040", 0 }, // Tags attribute }; static const lexstyle cpp_vim_Dark_Blue[] = { { 9, "FFFFFF", "000040", 0 }, // PREPROCESSOR { 11, "FFFFFF", "000040", 0 }, // DEFAULT { 5, "FFFF00", "000040", 1 }, // INSTRUCTION WORD { 16, "00FF00", "000040", 0 }, // TYPE WORD { 4, "FFFFFF", "000040", 0 }, // NUMBER { 6, "FFA0A0", "000040", 0 }, // STRING { 7, "FFA0A0", "000040", 0 }, // CHARACTER { 10, "FFFFFF", "000040", 1 }, // OPERATOR { 13, "00FFFF", "000040", 0 }, // VERBATIM { 14, "80FFFF", "000040", 1 }, // REGEX { 1, "80A0FF", "000040", 0 }, // COMMENT { 2, "80A0FF", "000040", 0 }, // COMMENT LINE { 3, "80A0FF", "000040", 0 }, // COMMENT DOC { 15, "80A0FF", "000040", 0 }, // COMMENT LINE DOC { 17, "80A0FF", "000040", 1 }, // COMMENT DOC KEYWORD { 18, "80A0FF", "000040", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_vim_Dark_Blue[] = { { 9, "804000", "000040", 0 }, // PREPROCESSOR { 11, "FFFFFF", "000040", 0 }, // DEFAULT { 5, "0000FF", "000040", 1 }, // INSTRUCTION WORD { 16, "8000FF", "000040", 0 }, // TYPE WORD { 4, "FFFFFF", "000040", 0 }, // NUMBER { 6, "FFA0A0", "000040", 0 }, // STRING { 7, "FFA0A0", "000040", 0 }, // CHARACTER { 10, "FFFFFF", "000040", 1 }, // OPERATOR { 13, "FFFFFF", "000040", 0 }, // VERBATIM { 14, "FFFFFF", "000040", 1 }, // REGEX { 1, "80A0FF", "000040", 0 }, // COMMENT { 2, "80A0FF", "000040", 0 }, // COMMENT LINE { 3, "80A0FF", "000040", 0 }, // COMMENT DOC { 15, "80A0FF", "000040", 0 }, // COMMENT LINE DOC { 17, "80A0FF", "000040", 1 }, // COMMENT DOC KEYWORD { 18, "80A0FF", "000040", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_vim_Dark_Blue[] = { { 41, "FFFFFF", "000040", 0 }, // DEFAULT { 45, "FFFFFF", "000040", 0 }, // NUMBER { 46, "FFFFFF", "000040", 0 }, // WORD { 47, "000080", "000040", 3 }, // KEYWORD { 48, "FFA0A0", "000040", 0 }, // DOUBLESTRING { 49, "FFA0A0", "000040", 0 }, // SINGLESTRING { 50, "FFFFFF", "000040", 1 }, // SYMBOLS { 51, "FFA0A0", "000040", 1 }, // STRINGEOL { 52, "8000FF", "000040", 0 }, // REGEX { 42, "80A0FF", "000040", 0 }, // COMMENT { 43, "80A0FF", "000040", 0 }, // COMMENTLINE { 44, "80A0FF", "000040", 0 }, // COMMENTDOC }; static const lexstyle python_vim_Dark_Blue[] = { { 0, "FFFFFF", "000040", 0 }, // DEFAULT { 1, "80A0FF", "000040", 0 }, // COMMENTLINE { 2, "FFFFFF", "000040", 0 }, // NUMBER { 3, "FFA0A0", "000040", 0 }, // STRING { 4, "FFA0A0", "000040", 0 }, // CHARACTER { 5, "FFFF00", "000040", 0 }, // KEYWORDS { 6, "FF8000", "000040", 0 }, // TRIPLE { 7, "FFA0A0", "000040", 0 }, // TRIPLEDOUBLE { 8, "40FFFF", "000040", 0 }, // CLASSNAME { 9, "40FFFF", "000040", 0 }, // DEFNAME { 10, "FFFFFF", "000040", 0 }, // OPERATOR { 11, "C0C0C0", "000040", 0 }, // IDENTIFIER { 12, "80A0FF", "000040", 0 }, // COMMENTBLOCK { 12, "008080", "000040", 0 }, // STRINGEOL }; static const lexstyle ruby_vim_Dark_Blue[] = { { 0, "FFFFFF", "000040", 0 }, // DEFAULT { 1, "FFFFFF", "000040", 0 }, // ERROR { 2, "80A0FF", "000040", 0 }, // COMMENTLINE { 3, "004000", "000040", 0 }, // POD { 4, "FFFFFF", "000040", 0 }, // NUMBER { 5, "0000FF", "000040", 1 }, // INSTRUCTION { 6, "FFA0A0", "000040", 0 }, // STRING { 7, "FFA0A0", "000040", 0 }, // CHARACTER { 8, "0080C0", "000040", 1 }, // CLASS NAME { 9, "8080FF", "000040", 1 }, // DEF NAME { 10, "FFFFFF", "000040", 1 }, // OPERATOR { 11, "C0C0C0", "000040", 0 }, // IDENTIFIER { 12, "0080FF", "000040", 0 }, // REGEX { 13, "FFFFFF", "000040", 1 }, // GLOBAL { 14, "FFFFFF", "000040", 0 }, // SYMBOL { 15, "804000", "000040", 1 }, // MODULE NAME { 16, "FFFFFF", "000040", 0 }, // INSTANCE VAR { 17, "FFFFFF", "000040", 0 }, // CLASS VAR { 18, "FFFF00", "000040", 0 }, // BACKTICKS { 19, "600000", "000040", 0 }, // DATA SECTION { 24, "808080", "000040", 0 }, // STRING Q }; static const lexstyle global_Deep_Black[] = { { 32, "FFFFFF", "000000", 0 }, // Default Style { 37, "C0C0C0", "000000", 0 }, // Indent guideline style { 34, "00FF00", "000000", 1 }, // Brace highlight style { 35, "FF0000", "000000", 1 }, // Bad brace colour { 2069, "FFFFFF", "253B76", 0 }, // Caret colour { 33, "C0C0C0", "333333", 0 }, // Line number margin { 29, "555753", "80FF00", 0 }, // Smart HighLighting { 31, "FFFF00", "FF0000", 1 }, // Find Mark Style { 28, "555753", "FF8000", 0 }, // Incremental highlight all { 27, "FCAF3E", "0080FF", 0 }, // Tags match highlighting { 26, "FFFFFF", "808080", 0 }, // Tags attribute }; static const lexstyle cpp_Deep_Black[] = { { 9, "C0C0C0", "000000", 0 }, // PREPROCESSOR { 11, "FFFFFF", "000000", 0 }, // DEFAULT { 5, "FF6600", "000000", 1 }, // INSTRUCTION WORD { 16, "00FFFF", "000000", 1 }, // TYPE WORD { 4, "FF8000", "000000", 0 }, // NUMBER { 6, "FFFF00", "000000", 0 }, // STRING { 7, "FF8080", "000000", 0 }, // CHARACTER { 10, "FFCC00", "000000", 0 }, // OPERATOR { 13, "FFFFFF", "000000", 0 }, // VERBATIM { 14, "FFFFFF", "000000", 1 }, // REGEX { 1, "00FF00", "000000", 2 }, // COMMENT { 2, "00FF00", "000000", 2 }, // COMMENT LINE { 3, "00FF00", "000000", 2 }, // COMMENT DOC { 15, "00FF00", "000000", 2 }, // COMMENT LINE DOC { 17, "00FF00", "000000", 2 }, // COMMENT DOC KEYWORD { 18, "00FF00", "000000", 2 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Deep_Black[] = { { 9, "EDF8F9", "000000", 0 }, // PREPROCESSOR { 11, "FFFFFF", "000000", 0 }, // DEFAULT { 5, "FF6600", "000000", 1 }, // INSTRUCTION WORD { 16, "66FF00", "000000", 0 }, // TYPE WORD { 4, "FF8000", "000000", 0 }, // NUMBER { 6, "66FF00", "000000", 0 }, // STRING { 7, "66FF00", "000000", 0 }, // CHARACTER { 10, "FFCC00", "000000", 1 }, // OPERATOR { 13, "FFFFFF", "000000", 0 }, // VERBATIM { 14, "FFFFFF", "000000", 1 }, // REGEX { 1, "00FF00", "000000", 2 }, // COMMENT { 2, "00FF00", "000000", 2 }, // COMMENT LINE { 3, "00FF00", "000000", 2 }, // COMMENT DOC { 15, "00FF00", "000000", 2 }, // COMMENT LINE DOC { 17, "00FF00", "000000", 2 }, // COMMENT DOC KEYWORD { 18, "00FF00", "000000", 2 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Deep_Black[] = { { 41, "FFFFFF", "000000", 0 }, // DEFAULT { 45, "99CC99", "000000", 0 }, // NUMBER { 46, "FF6600", "000000", 0 }, // WORD { 47, "FFCC00", "000000", 3 }, // KEYWORD { 48, "FFFF00", "000000", 0 }, // DOUBLESTRING { 49, "FFFF00", "000000", 0 }, // SINGLESTRING { 50, "999966", "000000", 1 }, // SYMBOLS { 51, "CCCCCC", "000000", 1 }, // STRINGEOL { 52, "339999", "000000", 0 }, // REGEX { 42, "00FF00", "000000", 2 }, // COMMENT { 43, "00FF00", "000000", 2 }, // COMMENTLINE { 44, "772CB7", "070707", 0 }, // COMMENTDOC }; static const lexstyle python_Deep_Black[] = { { 0, "FFFFFF", "000000", 0 }, // DEFAULT { 1, "00FF00", "000000", 2 }, // COMMENTLINE { 2, "99CC99", "000000", 0 }, // NUMBER { 3, "66FF00", "000000", 0 }, // STRING { 4, "66FF00", "000000", 0 }, // CHARACTER { 5, "FF6600", "000000", 1 }, // KEYWORDS { 6, "FF8000", "000000", 0 }, // TRIPLE { 7, "FFFFFF", "000000", 0 }, // TRIPLEDOUBLE { 8, "FFFFFF", "000000", 1 }, // CLASSNAME { 9, "FF00FF", "000000", 0 }, // DEFNAME { 10, "FFCC00", "000000", 1 }, // OPERATOR { 11, "FFFFFF", "000000", 0 }, // IDENTIFIER { 12, "00FF00", "000000", 2 }, // COMMENTBLOCK { 12, "FFFF00", "000000", 0 }, // STRINGEOL }; static const lexstyle ruby_Deep_Black[] = { { 0, "FFFFFF", "000000", 0 }, // DEFAULT { 1, "FFFFFF", "000000", 0 }, // ERROR { 2, "00FF00", "000000", 2 }, // COMMENTLINE { 3, "004000", "C0FFC0", 0 }, // POD { 4, "FF8000", "000000", 0 }, // NUMBER { 5, "FF6600", "000000", 1 }, // INSTRUCTION { 6, "66FF00", "000000", 0 }, // STRING { 7, "808000", "000000", 0 }, // CHARACTER { 8, "0080C0", "000000", 1 }, // CLASS NAME { 9, "8080FF", "FFFFCC", 1 }, // DEF NAME { 10, "FFCC00", "000000", 1 }, // OPERATOR { 11, "FFFFFF", "000000", 0 }, // IDENTIFIER { 12, "339999", "000000", 0 }, // REGEX { 13, "FFCC00", "000000", 1 }, // GLOBAL { 14, "FFFFFF", "000000", 0 }, // SYMBOL { 15, "EDF8F9", "000000", 1 }, // MODULE NAME { 16, "FFFFFF", "000000", 0 }, // INSTANCE VAR { 17, "FFFFFF", "000000", 0 }, // CLASS VAR { 18, "FFFF00", "A08080", 0 }, // BACKTICKS { 19, "600000", "FFF0D8", 0 }, // DATA SECTION { 24, "66FF00", "000000", 0 }, // STRING Q }; static const lexstyle global_Mono_Industrial[] = { { 32, "FFFFFF", "222C28", 0 }, // Default Style { 37, "888A85", "222C28", 0 }, // Indent guideline style { 34, "FCE94F", "222C28", 1 }, // Brace highlight style { 35, "EF2929", "222C28", 0 }, // Bad brace colour { 2069, "FFFFFF", "222C28", 0 }, // Caret colour { 31, "CC0000", "EDD400", 0 }, // Find Mark Style { 33, "EEEEEC", "2E3436", 0 }, // Line number margin { 29, "555753", "00FF00", 0 }, // Smart HighLighting { 31, "FCAF3E", "FF0000", 0 }, // Find Mark Style { 25, "FFFFFF", "00FFFF", 0 }, // Mark Style 1 { 24, "FFFFFF", "FF8000", 0 }, // Mark Style 2 { 23, "FFFFFF", "FFFF00", 0 }, // Mark Style 3 { 22, "FFFFFF", "8000FF", 0 }, // Mark Style 4 { 21, "FFFFFF", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "8000FF", 0 }, // Tags match highlighting { 26, "8080C0", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_Mono_Industrial[] = { { 9, "A39E64", "222C28", 0 }, // PREPROCESSOR { 11, "FFFFFF", "222C28", 0 }, // DEFAULT { 5, "C23B00", "222C28", 0 }, // INSTRUCTION WORD { 16, "A39E64", "222C28", 0 }, // TYPE WORD { 4, "E98800", "222C28", 0 }, // NUMBER { 6, "FFFFFF", "222C28", 0 }, // STRING { 7, "FFFFFF", "222C28", 0 }, // CHARACTER { 10, "A8B3AB", "222C28", 0 }, // OPERATOR { 13, "E98800", "222C28", 0 }, // VERBATIM { 14, "FFFFFF", "222C28", 0 }, // REGEX { 1, "666C68", "222C28", 0 }, // COMMENT { 2, "666C68", "222C28", 0 }, // COMMENT LINE { 3, "666C68", "222C28", 0 }, // COMMENT DOC { 15, "666C68", "222C28", 0 }, // COMMENT LINE DOC { 17, "666C68", "222C28", 0 }, // COMMENT DOC KEYWORD { 18, "666C68", "222C28", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Mono_Industrial[] = { { 9, "A39E64", "222C28", 0 }, // PREPROCESSOR { 11, "FFFFFF", "222C28", 0 }, // DEFAULT { 5, "C23B00", "222C28", 0 }, // INSTRUCTION WORD { 16, "A39E64", "222C28", 0 }, // TYPE WORD { 4, "E98800", "222C28", 0 }, // NUMBER { 6, "FFFFFF", "222C28", 0 }, // STRING { 7, "FFFFFF", "222C28", 0 }, // CHARACTER { 10, "A8B3AB", "222C28", 0 }, // OPERATOR { 13, "E98800", "222C28", 0 }, // VERBATIM { 14, "FFFFFF", "222C28", 0 }, // REGEX { 1, "666C68", "222C28", 0 }, // COMMENT { 2, "666C68", "222C28", 0 }, // COMMENT LINE { 3, "666C68", "222C28", 0 }, // COMMENT DOC { 15, "666C68", "222C28", 0 }, // COMMENT LINE DOC { 17, "666C68", "222C28", 0 }, // COMMENT DOC KEYWORD { 18, "666C68", "222C28", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Mono_Industrial[] = { { 41, "FFFFFF", "222C28", 0 }, // DEFAULT { 45, "E98800", "222C28", 0 }, // NUMBER { 46, "FFFFFF", "222C28", 0 }, // WORD { 47, "A8B3AB", "222C28", 0 }, // KEYWORD { 48, "FFFFFF", "222C28", 0 }, // DOUBLESTRING { 49, "FFFFFF", "222C28", 0 }, // SINGLESTRING { 50, "FFFFFF", "222C28", 0 }, // SYMBOLS { 51, "FFFFFF", "222C28", 0 }, // STRINGEOL { 52, "FFFFFF", "222C28", 0 }, // REGEX { 42, "666C68", "222C28", 0 }, // COMMENT { 43, "666C68", "222C28", 0 }, // COMMENTLINE { 44, "666C68", "222C28", 0 }, // COMMENTDOC }; static const lexstyle python_Mono_Industrial[] = { { 0, "FFFFFF", "222C28", 0 }, // DEFAULT { 1, "666C68", "222C28", 0 }, // COMMENTLINE { 2, "E98800", "222C28", 0 }, // NUMBER { 3, "FFFFFF", "222C28", 0 }, // STRING { 4, "FFFFFF", "222C28", 0 }, // CHARACTER { 5, "A8B3AB", "222C28", 0 }, // KEYWORDS { 6, "000000", "222C28", 0 }, // TRIPLE { 7, "000000", "222C28", 0 }, // TRIPLEDOUBLE { 8, "000000", "222C28", 0 }, // CLASSNAME { 9, "000000", "222C28", 0 }, // DEFNAME { 10, "A8B3AB", "222C28", 0 }, // OPERATOR { 11, "C87500", "222C28", 0 }, // IDENTIFIER { 12, "666C68", "222C28", 0 }, // COMMENTBLOCK { 12, "FFFFFF", "222C28", 0 }, // STRINGEOL }; static const lexstyle ruby_Mono_Industrial[] = { { 0, "FFFFFF", "222C28", 0 }, // DEFAULT { 1, "000000", "222C28", 0 }, // ERROR { 2, "666C68", "222C28", 0 }, // COMMENTLINE { 3, "000000", "222C28", 0 }, // POD { 4, "E98800", "222C28", 0 }, // NUMBER { 5, "A39E64", "222C28", 0 }, // INSTRUCTION { 6, "FFFFFF", "222C28", 0 }, // STRING { 7, "FFFFFF", "222C28", 0 }, // CHARACTER { 8, "FFFFFF", "222C28", 0 }, // CLASS NAME { 9, "A8B3AB", "222C28", 0 }, // DEF NAME { 10, "A8B3AB", "222C28", 0 }, // OPERATOR { 11, "C87500", "222C28", 0 }, // IDENTIFIER { 12, "FFFFFF", "222C28", 0 }, // REGEX { 13, "648BD2", "222C28", 0 }, // GLOBAL { 14, "FFFFFF", "222C28", 0 }, // SYMBOL { 15, "000000", "222C28", 0 }, // MODULE NAME { 16, "648BD2", "222C28", 0 }, // INSTANCE VAR { 17, "000000", "222C28", 0 }, // CLASS VAR { 18, "000000", "222C28", 0 }, // BACKTICKS { 19, "000000", "222C28", 0 }, // DATA SECTION { 24, "FFFFFF", "222C28", 0 }, // STRING Q }; static const lexstyle global_Ruby_Blue[] = { { 32, "FFFFFF", "112435", 0 }, // Default Style { 37, "0080FF", "112435", 1 }, // Indent guideline style { 34, "FFFFFF", "112435", 0 }, // Brace highlight style { 35, "FFFFFF", "112435", 0 }, // Bad brace colour { 2069, "FFFFFF", "6699CC", 0 }, // Caret colour { 31, "FFFFFF", "112435", 0 }, // Find Mark Style { 33, "FFFFFF", "1F4661", 0 }, // Line number margin { 29, "555753", "00FF00", 0 }, // Smart HighLighting { 31, "FCAF3E", "FF0000", 0 }, // Find Mark Style { 25, "FFFFFF", "00FFFF", 0 }, // Mark Style 1 { 24, "FFFFFF", "FF8000", 0 }, // Mark Style 2 { 23, "FFFFFF", "FFFF00", 0 }, // Mark Style 3 { 22, "FFFFFF", "8000FF", 0 }, // Mark Style 4 { 21, "FFFFFF", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "8000FF", 0 }, // Tags match highlighting { 26, "8080C0", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_Ruby_Blue[] = { { 9, "FFFFFF", "112435", 0 }, // PREPROCESSOR { 11, "FFFFFF", "112435", 0 }, // DEFAULT { 5, "FFFFFF", "112435", 0 }, // INSTRUCTION WORD { 16, "FFFFFF", "112435", 0 }, // TYPE WORD { 4, "FFFFFF", "112435", 0 }, // NUMBER { 6, "FFFFFF", "112435", 0 }, // STRING { 7, "FFFFFF", "112435", 0 }, // CHARACTER { 10, "FFFFFF", "112435", 0 }, // OPERATOR { 13, "FFFFFF", "112435", 0 }, // VERBATIM { 14, "FFFFFF", "112435", 0 }, // REGEX { 1, "FFFFFF", "112435", 0 }, // COMMENT { 2, "FFFFFF", "112435", 0 }, // COMMENT LINE { 3, "FFFFFF", "112435", 0 }, // COMMENT DOC { 15, "FFFFFF", "112435", 0 }, // COMMENT LINE DOC { 17, "FFFFFF", "112435", 0 }, // COMMENT DOC KEYWORD { 18, "FFFFFF", "112435", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Ruby_Blue[] = { { 9, "FFFFFF", "112435", 0 }, // PREPROCESSOR { 11, "FFFFFF", "112435", 0 }, // DEFAULT { 5, "FFFFFF", "112435", 0 }, // INSTRUCTION WORD { 16, "FFFFFF", "112435", 0 }, // TYPE WORD { 4, "FFFFFF", "112435", 0 }, // NUMBER { 6, "FFFFFF", "112435", 0 }, // STRING { 7, "FFFFFF", "112435", 0 }, // CHARACTER { 10, "FFFFFF", "112435", 0 }, // OPERATOR { 13, "FFFFFF", "112435", 0 }, // VERBATIM { 14, "FFFFFF", "112435", 0 }, // REGEX { 1, "FFFFFF", "112435", 0 }, // COMMENT { 2, "FFFFFF", "112435", 0 }, // COMMENT LINE { 3, "FFFFFF", "112435", 0 }, // COMMENT DOC { 15, "FFFFFF", "112435", 0 }, // COMMENT LINE DOC { 17, "FFFFFF", "112435", 0 }, // COMMENT DOC KEYWORD { 18, "FFFFFF", "112435", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Ruby_Blue[] = { { 41, "FFFFFF", "112435", 0 }, // DEFAULT { 45, "FF00FF", "112435", 0 }, // NUMBER { 46, "8DB0D3", "112435", 0 }, // WORD { 47, "FFFF80", "112435", 0 }, // KEYWORD { 48, "F08047", "112435", 0 }, // DOUBLESTRING { 49, "F08047", "112435", 0 }, // SINGLESTRING { 50, "7BD827", "112435", 0 }, // SYMBOLS { 51, "730080", "112435", 0 }, // STRINGEOL { 52, "FF00FF", "112435", 0 }, // REGEX { 42, "3A8BDA", "112435", 0 }, // COMMENT { 43, "3A8BDA", "112435", 0 }, // COMMENTLINE { 44, "3A8BDA", "112435", 0 }, // COMMENTDOC }; static const lexstyle python_Ruby_Blue[] = { { 0, "FFFFFF", "112435", 0 }, // DEFAULT { 1, "FFFFFF", "112435", 0 }, // COMMENTLINE { 2, "FFFFFF", "112435", 0 }, // NUMBER { 3, "FFFFFF", "112435", 0 }, // STRING { 4, "FFFFFF", "112435", 0 }, // CHARACTER { 5, "FFFFFF", "112435", 0 }, // KEYWORDS { 6, "FFFFFF", "112435", 0 }, // TRIPLE { 7, "FFFFFF", "112435", 0 }, // TRIPLEDOUBLE { 8, "FFFFFF", "112435", 0 }, // CLASSNAME { 9, "FFFFFF", "112435", 0 }, // DEFNAME { 10, "FFFFFF", "112435", 0 }, // OPERATOR { 11, "FFFFFF", "112435", 0 }, // IDENTIFIER { 12, "FFFFFF", "112435", 0 }, // COMMENTBLOCK { 12, "FFFFFF", "112435", 0 }, // STRINGEOL }; static const lexstyle ruby_Ruby_Blue[] = { { 0, "FFFFFF", "112435", 0 }, // DEFAULT { 1, "FFFFFF", "112435", 0 }, // ERROR { 2, "FFFFFF", "112435", 0 }, // COMMENTLINE { 3, "FFFFFF", "112435", 0 }, // POD { 4, "FFFFFF", "112435", 0 }, // NUMBER { 5, "FFFFFF", "112435", 0 }, // INSTRUCTION { 6, "FFFFFF", "112435", 0 }, // STRING { 7, "FFFFFF", "112435", 0 }, // CHARACTER { 8, "FFFFFF", "112435", 0 }, // CLASS NAME { 9, "FFFFFF", "112435", 0 }, // DEF NAME { 10, "FFFFFF", "112435", 0 }, // OPERATOR { 11, "FFFFFF", "112435", 0 }, // IDENTIFIER { 12, "FFFFFF", "112435", 0 }, // REGEX { 13, "FFFFFF", "112435", 0 }, // GLOBAL { 14, "FFFFFF", "112435", 0 }, // SYMBOL { 15, "FFFFFF", "112435", 0 }, // MODULE NAME { 16, "FFFFFF", "112435", 0 }, // INSTANCE VAR { 17, "FFFFFF", "112435", 0 }, // CLASS VAR { 18, "FFFFFF", "112435", 0 }, // BACKTICKS { 19, "FFFFFF", "112435", 0 }, // DATA SECTION { 24, "FFFFFF", "112435", 0 }, // STRING Q }; static const lexstyle global_Choco[] = { { 32, "C3BE98", "1A0F0B", 0 }, // Default Style { 37, "888A85", "1A0F0B", 0 }, // Indent guideline style { 34, "FCE94F", "1A0F0B", 1 }, // Brace highlight style { 35, "EF2929", "1A0F0B", 0 }, // Bad brace colour { 2069, "A7A7A7", "112435", 0 }, // Caret colour { 31, "CC0000", "EDD400", 0 }, // Find Mark Style { 33, "EEEEEC", "2E3436", 0 }, // Line number margin { 29, "555753", "00FF00", 0 }, // Smart HighLighting { 31, "CC0000", "EDD400", 0 }, // Find Mark Style { 25, "80D4B2", "00FFFF", 0 }, // Mark Style 1 { 24, "3FBA89", "FF8000", 0 }, // Mark Style 2 { 23, "101010", "FFFF00", 0 }, // Mark Style 3 { 22, "808080", "8000FF", 0 }, // Mark Style 4 { 21, "FAAA3C", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "972FFF", 0 }, // Tags match highlighting { 26, "8080C0", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_Choco[] = { { 9, "8996A8", "1A0F0B", 0 }, // PREPROCESSOR { 11, "C3BE98", "1A0F0B", 0 }, // DEFAULT { 5, "F1E694", "1A0F0B", 0 }, // INSTRUCTION WORD { 16, "B3935C", "1A0F0B", 0 }, // TYPE WORD { 4, "DA5659", "1A0F0B", 0 }, // NUMBER { 6, "7CA563", "1A0F0B", 0 }, // STRING { 7, "7CA563", "1A0F0B", 0 }, // CHARACTER { 10, "B3935C", "1A0F0B", 0 }, // OPERATOR { 13, "DA5659", "1A0F0B", 0 }, // VERBATIM { 14, "E9C062", "1A0F0B", 0 }, // REGEX { 1, "679D47", "1A0F0B", 0 }, // COMMENT { 2, "679D47", "1A0F0B", 0 }, // COMMENT LINE { 3, "679D47", "1A0F0B", 0 }, // COMMENT DOC { 15, "679D47", "1A0F0B", 0 }, // COMMENT LINE DOC { 17, "679D47", "1A0F0B", 0 }, // COMMENT DOC KEYWORD { 18, "679D47", "1A0F0B", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Choco[] = { { 9, "8996A8", "1A0F0B", 0 }, // PREPROCESSOR { 11, "C3BE98", "1A0F0B", 0 }, // DEFAULT { 5, "F1E694", "1A0F0B", 0 }, // INSTRUCTION WORD { 16, "B3935C", "1A0F0B", 0 }, // TYPE WORD { 4, "DA5659", "1A0F0B", 0 }, // NUMBER { 6, "7CA563", "1A0F0B", 0 }, // STRING { 7, "7CA563", "1A0F0B", 0 }, // CHARACTER { 10, "B3935C", "1A0F0B", 0 }, // OPERATOR { 13, "DA5659", "1A0F0B", 0 }, // VERBATIM { 14, "E9C062", "1A0F0B", 0 }, // REGEX { 1, "679D47", "1A0F0B", 0 }, // COMMENT { 2, "679D47", "1A0F0B", 0 }, // COMMENT LINE { 3, "679D47", "1A0F0B", 0 }, // COMMENT DOC { 15, "679D47", "1A0F0B", 0 }, // COMMENT LINE DOC { 17, "679D47", "1A0F0B", 0 }, // COMMENT DOC KEYWORD { 18, "679D47", "1A0F0B", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Choco[] = { { 41, "C3BE98", "1A0F0B", 0 }, // DEFAULT { 45, "DA5659", "1A0F0B", 0 }, // NUMBER { 46, "C3BE98", "1A0F0B", 0 }, // WORD { 47, "B3935C", "1A0F0B", 0 }, // KEYWORD { 48, "7CA563", "1A0F0B", 0 }, // DOUBLESTRING { 49, "7CA563", "1A0F0B", 0 }, // SINGLESTRING { 50, "C3BE98", "1A0F0B", 0 }, // SYMBOLS { 51, "7CA563", "1A0F0B", 0 }, // STRINGEOL { 52, "E9C062", "1A0F0B", 0 }, // REGEX { 42, "679D47", "1A0F0B", 0 }, // COMMENT { 43, "679D47", "1A0F0B", 0 }, // COMMENTLINE { 44, "679D47", "1A0F0B", 0 }, // COMMENTDOC }; static const lexstyle python_Choco[] = { { 0, "C3BE98", "1A0F0B", 0 }, // DEFAULT { 1, "679D47", "1A0F0B", 0 }, // COMMENTLINE { 2, "DA5659", "1A0F0B", 0 }, // NUMBER { 3, "7CA563", "1A0F0B", 0 }, // STRING { 4, "7CA563", "1A0F0B", 0 }, // CHARACTER { 5, "B3935C", "1A0F0B", 0 }, // KEYWORDS { 6, "000000", "1A0F0B", 0 }, // TRIPLE { 7, "000000", "1A0F0B", 0 }, // TRIPLEDOUBLE { 8, "000000", "1A0F0B", 0 }, // CLASSNAME { 9, "000000", "1A0F0B", 0 }, // DEFNAME { 10, "B3935C", "1A0F0B", 0 }, // OPERATOR { 11, "D77261", "1A0F0B", 0 }, // IDENTIFIER { 12, "679D47", "1A0F0B", 0 }, // COMMENTBLOCK { 12, "7CA563", "1A0F0B", 0 }, // STRINGEOL }; static const lexstyle ruby_Choco[] = { { 0, "C3BE98", "1A0F0B", 0 }, // DEFAULT { 1, "000000", "1A0F0B", 0 }, // ERROR { 2, "679D47", "1A0F0B", 0 }, // COMMENTLINE { 3, "000000", "1A0F0B", 0 }, // POD { 4, "DA5659", "1A0F0B", 0 }, // NUMBER { 5, "B3935C", "1A0F0B", 0 }, // INSTRUCTION { 6, "7CA563", "1A0F0B", 0 }, // STRING { 7, "7CA563", "1A0F0B", 0 }, // CHARACTER { 8, "6D4C2F", "1A0F0B", 0 }, // CLASS NAME { 9, "6D4C2F", "1A0F0B", 0 }, // DEF NAME { 10, "B3935C", "1A0F0B", 0 }, // OPERATOR { 11, "D77261", "1A0F0B", 0 }, // IDENTIFIER { 12, "E9C062", "1A0F0B", 0 }, // REGEX { 13, "7989A6", "1A0F0B", 0 }, // GLOBAL { 14, "C3BE98", "1A0F0B", 0 }, // SYMBOL { 15, "000000", "1A0F0B", 0 }, // MODULE NAME { 16, "7989A6", "1A0F0B", 0 }, // INSTANCE VAR { 17, "000000", "1A0F0B", 0 }, // CLASS VAR { 18, "000000", "1A0F0B", 0 }, // BACKTICKS { 19, "000000", "1A0F0B", 0 }, // DATA SECTION { 24, "7CA563", "1A0F0B", 0 }, // STRING Q }; static const lexstyle global_khaki[] = { { 32, "5f5f00", "d7d7af", 0 }, // Default Style { 37, "afaf87", "d7d7af", 0 }, // Indent guideline style { 34, "d7d7af", "005f00", 1 }, // Brace highlight style { 35, "ff005f", "d7d7af", 0 }, // Bad brace colour { 2069, "5f5f00", "d7d7af", 0 }, // Caret colour { 33, "5f5f00", "afaf87", 0 }, // Line number margin { 29, "5f5f00", "d7ff87", 0 }, // Smart HighLighting { 31, "5f5f00", "d7ff87", 0 }, // Find Mark Style { 25, "5f5f00", "af5f00", 0 }, // Mark Style 1 { 24, "5f5f00", "005f5f", 0 }, // Mark Style 2 { 23, "5f5f00", "afaf87", 0 }, // Mark Style 3 { 22, "5f5f00", "87005f", 0 }, // Mark Style 4 { 21, "5f5f00", "d7ff87", 0 }, // Mark Style 5 { 28, "5f5f00", "d7ff87", 0 }, // Incremental highlight all { 27, "5f5f00", "afff87", 0 }, // Tags match highlighting { 26, "5f5f00", "5faf5f", 0 }, // Tags attribute }; static const lexstyle cpp_khaki[] = { { 9, "5f0000", "d7d7af", 0 }, // PREPROCESSOR { 11, "5f5f00", "d7d7af", 0 }, // DEFAULT { 5, "87005f", "d7d7af", 0 }, // INSTRUCTION WORD { 16, "5f005f", "d7d7af", 0 }, // TYPE WORD { 4, "005f00", "d7d7af", 0 }, // NUMBER { 6, "005f5f", "d7d7af", 0 }, // STRING { 7, "005f5f", "d7d7af", 0 }, // CHARACTER { 10, "00005f", "d7d7af", 0 }, // OPERATOR { 13, "005f5f", "d7d7af", 0 }, // VERBATIM { 14, "0087af", "d7d7af", 0 }, // REGEX { 1, "87875f", "d7d7af", 2 }, // COMMENT { 2, "87875f", "d7d7af", 2 }, // COMMENT LINE { 3, "87875f", "d7d7af", 2 }, // COMMENT DOC { 15, "87875f", "d7d7af", 2 }, // COMMENT LINE DOC { 17, "87875f", "d7d7af", 3 }, // COMMENT DOC KEYWORD { 18, "d700d7", "d7d7af", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_khaki[] = { { 9, "5f0000", "d7d7af", 0 }, // PREPROCESSOR { 11, "5f5f00", "d7d7af", 0 }, // DEFAULT { 5, "87005f", "d7d7af", 0 }, // INSTRUCTION WORD { 16, "5f005f", "d7d7af", 0 }, // TYPE WORD { 4, "005f00", "d7d7af", 0 }, // NUMBER { 6, "005f5f", "d7d7af", 0 }, // STRING { 7, "005f5f", "d7d7af", 0 }, // CHARACTER { 10, "00005f", "d7d7af", 0 }, // OPERATOR { 13, "005f5f", "d7d7af", 0 }, // VERBATIM { 14, "0087af", "d7d7af", 0 }, // REGEX { 1, "87875f", "d7d7af", 2 }, // COMMENT { 2, "87875f", "d7d7af", 2 }, // COMMENT LINE { 3, "87875f", "d7d7af", 2 }, // COMMENT DOC { 15, "87875f", "d7d7af", 2 }, // COMMENT LINE DOC { 17, "005f5f", "d7d7af", 3 }, // COMMENT DOC KEYWORD { 18, "d700d7", "d7d7af", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_khaki[] = { { 41, "5f5f00", "d7d7af", 0 }, // DEFAULT { 45, "005f00", "d7d7af", 0 }, // NUMBER { 46, "000087", "d7d7af", 0 }, // WORD { 47, "87005f", "d7d7af", 0 }, // KEYWORD { 48, "005f5f", "d7d7af", 0 }, // DOUBLESTRING { 49, "005f5f", "d7d7af", 0 }, // SINGLESTRING { 50, "5f5f00", "d7d7af", 0 }, // SYMBOLS { 51, "af5f00", "d7d7af", 0 }, // STRINGEOL { 52, "0087af", "d7d7af", 0 }, // REGEX { 42, "87875f", "d7d7af", 2 }, // COMMENT { 43, "87875f", "d7d7af", 2 }, // COMMENTLINE { 44, "87875f", "d7d7af", 2 }, // COMMENTDOC { 17, "005f5f", "d7d7af", 3 }, // COMMENT DOC KEYWORD { 18, "d700d7", "d7d7af", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle python_khaki[] = { { 0, "5f5f00", "d7d7af", 0 }, // DEFAULT { 1, "87875f", "d7d7af", 2 }, // COMMENTLINE { 2, "005f00", "d7d7af", 0 }, // NUMBER { 3, "005f5f", "d7d7af", 0 }, // STRING { 4, "005f5f", "d7d7af", 0 }, // CHARACTER { 5, "87005f", "d7d7af", 0 }, // KEYWORDS { 6, "005f5f", "d7d7af", 0 }, // TRIPLE { 7, "005f5f", "d7d7af", 0 }, // TRIPLEDOUBLE { 8, "5f0000", "d7d7af", 0 }, // CLASSNAME { 9, "af0000", "d7d7af", 0 }, // DEFNAME { 10, "00005f", "d7d7af", 0 }, // OPERATOR { 11, "000087", "d7d7af", 0 }, // IDENTIFIER { 12, "87875f", "d7d7af", 2 }, // COMMENTBLOCK { 12, "87875f", "d7d7af", 0 }, // STRINGEOL }; static const lexstyle ruby_khaki[] = { { 0, "5f5f00", "d7d7af", 0 }, // DEFAULT { 1, "af5f00", "d7d7af", 0 }, // ERROR { 2, "87875f", "d7d7af", 2 }, // COMMENTLINE { 3, "5f5f00", "d7d7af", 2 }, // POD { 4, "005f00", "d7d7af", 0 }, // NUMBER { 5, "87005f", "d7d7af", 0 }, // INSTRUCTION { 6, "005f5f", "d7d7af", 0 }, // STRING { 7, "005f5f", "d7d7af", 0 }, // CHARACTER { 8, "5f0000", "d7d7af", 0 }, // CLASS NAME { 9, "005f5f", "d7d7af", 0 }, // DEF NAME { 10, "00005f", "d7d7af", 0 }, // OPERATOR { 11, "000087", "d7d7af", 0 }, // IDENTIFIER { 12, "0087af", "d7d7af", 0 }, // REGEX { 13, "000087", "d7d7af", 0 }, // GLOBAL { 14, "5f5f00", "d7d7af", 0 }, // SYMBOL { 15, "af0000", "d7d7af", 0 }, // MODULE NAME { 16, "000087", "d7d7af", 0 }, // INSTANCE VAR { 17, "000087", "d7d7af", 0 }, // CLASS VAR { 18, "af0000", "d7d7af", 0 }, // BACKTICKS { 19, "005f5f", "d7d7af", 0 }, // DATA SECTION { 24, "005f5f", "d7d7af", 0 }, // STRING Q { 25, "005f5f", "d7d7af", 0 }, // BOOLEAN }; static const lexstyle global_Bespin[] = { { 32, "BDAE9D", "2A211C", 0 }, // Default Style { 37, "888A85", "2A211C", 0 }, // Indent guideline style { 34, "E5C138", "2A211C", 1 }, // Brace highlight style { 35, "EF2929", "2A211C", 0 }, // Bad brace colour { 2069, "37A8ED", "80FF00", 0 }, // Caret colour { 31, "CC0000", "EDD400", 0 }, // Find Mark Style { 33, "E5C138", "4C4A41", 0 }, // Line number margin { 29, "555753", "FF0080", 0 }, // Smart HighLighting { 31, "CC0000", "EDD400", 0 }, // Find Mark Style { 25, "BDAE9D", "00FFFF", 0 }, // Mark Style 1 { 24, "FAAA3C", "FF8000", 0 }, // Mark Style 2 { 23, "FFFF80", "FFFF00", 0 }, // Mark Style 3 { 22, "000000", "8000FF", 0 }, // Mark Style 4 { 21, "808080", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "808000", 0 }, // Tags match highlighting { 26, "8080C0", "808080", 0 }, // Tags attribute }; static const lexstyle cpp_Bespin[] = { { 9, "FFAA00", "2A211C", 0 }, // PREPROCESSOR { 11, "F8F8F8", "2A211C", 0 }, // DEFAULT { 5, "F6F080", "2A211C", 0 }, // INSTRUCTION WORD { 16, "FFAA00", "2A211C", 0 }, // TYPE WORD { 4, "FF3A83", "2A211C", 0 }, // NUMBER { 6, "55E439", "2A211C", 0 }, // STRING { 7, "55E439", "2A211C", 0 }, // CHARACTER { 10, "FFAA00", "2A211C", 0 }, // OPERATOR { 13, "FF3A83", "2A211C", 0 }, // VERBATIM { 14, "FFB454", "2A211C", 0 }, // REGEX { 1, "1E9AE0", "2A211C", 0 }, // COMMENT { 2, "1E9AE0", "2A211C", 0 }, // COMMENT LINE { 3, "1E9AE0", "2A211C", 0 }, // COMMENT DOC { 15, "1E9AE0", "2A211C", 0 }, // COMMENT LINE DOC { 17, "1E9AE0", "2A211C", 0 }, // COMMENT DOC KEYWORD { 18, "1E9AE0", "2A211C", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Bespin[] = { { 9, "FFAA00", "2A211C", 0 }, // PREPROCESSOR { 11, "F8F8F8", "2A211C", 0 }, // DEFAULT { 5, "F6F080", "2A211C", 0 }, // INSTRUCTION WORD { 16, "FFAA00", "2A211C", 0 }, // TYPE WORD { 4, "FF3A83", "2A211C", 0 }, // NUMBER { 6, "55E439", "2A211C", 0 }, // STRING { 7, "55E439", "2A211C", 0 }, // CHARACTER { 10, "FFAA00", "2A211C", 0 }, // OPERATOR { 13, "FF3A83", "2A211C", 0 }, // VERBATIM { 14, "FFB454", "2A211C", 0 }, // REGEX { 1, "1E9AE0", "2A211C", 0 }, // COMMENT { 2, "1E9AE0", "2A211C", 0 }, // COMMENT LINE { 3, "1E9AE0", "2A211C", 0 }, // COMMENT DOC { 15, "1E9AE0", "2A211C", 0 }, // COMMENT LINE DOC { 17, "1E9AE0", "2A211C", 0 }, // COMMENT DOC KEYWORD { 18, "1E9AE0", "2A211C", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Bespin[] = { { 41, "BDAF9D", "2A211C", 0 }, // DEFAULT { 45, "FF3A83", "2A211C", 0 }, // NUMBER { 46, "BDAE9D", "2A211C", 0 }, // WORD { 47, "37A3ED", "2A211C", 0 }, // KEYWORD { 16, "FF5555", "2A211C", 0 }, // USER-DEFINED { 48, "00FF40", "2A211C", 0 }, // DOUBLESTRING { 49, "80FF00", "2A211C", 0 }, // SINGLESTRING { 50, "E5C138", "2A211C", 0 }, // SYMBOLS { 51, "55E439", "2A211C", 0 }, // STRINGEOL { 52, "FFB454", "2A211C", 0 }, // REGEX { 42, "666666", "2A211C", 0 }, // COMMENT { 43, "666666", "2A211C", 0 }, // COMMENTLINE { 44, "FFFF80", "2A211C", 0 }, // COMMENTDOC { 17, "FF0080", "2A211C", 0 }, // COMMENT DOC KEYWORD { 18, "FF0080", "2A211C", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle python_Bespin[] = { { 0, "F8F8F8", "2A211C", 0 }, // DEFAULT { 1, "1E9AE0", "2A211C", 0 }, // COMMENTLINE { 2, "FF3A83", "2A211C", 0 }, // NUMBER { 3, "55E439", "2A211C", 0 }, // STRING { 4, "55E439", "2A211C", 0 }, // CHARACTER { 5, "FFAA00", "2A211C", 0 }, // KEYWORDS { 6, "000000", "2A211C", 0 }, // TRIPLE { 7, "000000", "2A211C", 0 }, // TRIPLEDOUBLE { 8, "000000", "2A211C", 0 }, // CLASSNAME { 9, "000000", "2A211C", 0 }, // DEFNAME { 10, "FFAA00", "2A211C", 0 }, // OPERATOR { 11, "EB939A", "2A211C", 0 }, // IDENTIFIER { 12, "1E9AE0", "2A211C", 0 }, // COMMENTBLOCK { 12, "55E439", "2A211C", 0 }, // STRINGEOL }; static const lexstyle ruby_Bespin[] = { { 0, "F8F8F8", "2A211C", 0 }, // DEFAULT { 1, "000000", "2A211C", 0 }, // ERROR { 2, "1E9AE0", "2A211C", 0 }, // COMMENTLINE { 3, "000000", "2A211C", 0 }, // POD { 4, "FF3A83", "2A211C", 0 }, // NUMBER { 5, "FFAA00", "2A211C", 0 }, // INSTRUCTION { 6, "55E439", "2A211C", 0 }, // STRING { 7, "55E439", "2A211C", 0 }, // CHARACTER { 8, "EFE900", "2A211C", 0 }, // CLASS NAME { 9, "EFE900", "2A211C", 0 }, // DEF NAME { 10, "FFAA00", "2A211C", 0 }, // OPERATOR { 11, "EB939A", "2A211C", 0 }, // IDENTIFIER { 12, "FFB454", "2A211C", 0 }, // REGEX { 13, "FB9A4B", "2A211C", 0 }, // GLOBAL { 14, "F8F8F8", "2A211C", 0 }, // SYMBOL { 15, "000000", "2A211C", 0 }, // MODULE NAME { 16, "FB9A4B", "2A211C", 0 }, // INSTANCE VAR { 17, "000000", "2A211C", 0 }, // CLASS VAR { 18, "000000", "2A211C", 0 }, // BACKTICKS { 19, "000000", "2A211C", 0 }, // DATA SECTION { 24, "55E439", "2A211C", 0 }, // STRING Q }; static const lexstyle global_Zenburn[] = { { 32, "DCDCCC", "3F3F3F", 0 }, // Default Style { 37, "4F5F5F", "3F3F3F", 0 }, // Indent guideline style { 34, "F0F9F9", "3F3F3F", 1 }, // Brace highlight style { 35, "F09F9F", "3F3F3F", 0 }, // Bad brace colour { 2069, "8FAF9F", "3F3F3F", 0 }, // Caret colour { 33, "8A8A8A", "0C0C0C", 0 }, // Line number margin { 29, "DCDCCC", "358A35", 0 }, // Smart HighLighting { 31, "DCDCCC", "FF0000", 0 }, // Find Mark Style { 25, "DCDCCC", "88B090", 0 }, // Mark Style 1 { 24, "DCDCCC", "F8F893", 0 }, // Mark Style 2 { 23, "DCDCCC", "F18C96", 0 }, // Mark Style 3 { 22, "DCDCCC", "408040", 0 }, // Mark Style 4 { 21, "DCDCCC", "968CF1", 0 }, // Mark Style 5 { 28, "DCDCCC", "C3BF9F", 0 }, // Incremental highlight all { 27, "DCDCCC", "C6C600", 0 }, // Tags match highlighting { 26, "DCDCCC", "78926F", 0 }, // Tags attribute }; static const lexstyle cpp_Zenburn[] = { { 9, "FFCFAF", "3F3F3F", 0 }, // PREPROCESSOR { 11, "DCDCCC", "3F3F3F", 0 }, // DEFAULT { 5, "DFC47D", "3F3F3F", 1 }, // INSTRUCTION WORD { 16, "CEDF99", "3F3F3F", 1 }, // TYPE WORD { 4, "8CD0D3", "3F3F3F", 0 }, // NUMBER { 6, "CC9393", "3F3F3F", 0 }, // STRING { 7, "DCA3A3", "3F3F3F", 0 }, // CHARACTER { 10, "9F9D6D", "3F3F3F", 1 }, // OPERATOR { 13, "CC9393", "3F3F3F", 0 }, // VERBATIM { 14, "C89191", "3F3F3F", 1 }, // REGEX { 1, "7F9F7F", "3F3F3F", 3 }, // COMMENT { 2, "7F9F7F", "3F3F3F", 3 }, // COMMENT LINE { 3, "7F9F7F", "3F3F3F", 2 }, // COMMENT DOC { 15, "7F9F7F", "3F3F3F", 2 }, // COMMENT LINE DOC { 17, "7F9F7F", "3F3F3F", 3 }, // COMMENT DOC KEYWORD { 18, "7F9F7F", "3F3F3F", 2 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Zenburn[] = { { 9, "FFCFAF", "3F3F3F", 0 }, // PREPROCESSOR { 11, "DCDCCC", "3F3F3F", 0 }, // DEFAULT { 5, "DFC47D", "3F3F3F", 1 }, // INSTRUCTION WORD { 16, "CEDF99", "3F3F3F", 1 }, // TYPE WORD { 4, "8CD0D3", "3F3F3F", 0 }, // NUMBER { 6, "CC9393", "3F3F3F", 0 }, // STRING { 7, "DCA3A3", "3F3F3F", 0 }, // CHARACTER { 10, "9F9D6D", "3F3F3F", 1 }, // OPERATOR { 13, "CC9393", "3F3F3F", 0 }, // VERBATIM { 14, "C89191", "3F3F3F", 1 }, // REGEX { 1, "7F9F7F", "3F3F3F", 3 }, // COMMENT { 2, "7F9F7F", "3F3F3F", 3 }, // COMMENT LINE { 3, "7F9F7F", "3F3F3F", 3 }, // COMMENT DOC { 15, "7F9F7F", "3F3F3F", 2 }, // COMMENT LINE DOC { 17, "7F9F7F", "3F3F3F", 2 }, // COMMENT DOC KEYWORD { 18, "7F9F7F", "3F3F3F", 2 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Zenburn[] = { { 41, "DCDCCC", "3F3F3F", 0 }, // DEFAULT { 45, "8CD0D3", "3F3F3F", 0 }, // NUMBER { 46, "DCDCCC", "3F3F3F", 0 }, // WORD { 47, "CEDF99", "3F3F3F", 3 }, // KEYWORD { 48, "CC9393", "3F3F3F", 0 }, // DOUBLESTRING { 49, "CC9393", "3F3F3F", 0 }, // SINGLESTRING { 50, "DFC47D", "3F3F3F", 1 }, // SYMBOLS { 52, "CC9393", "3F3F3F", 1 }, // REGEX { 42, "7F9F7F", "3F3F3F", 3 }, // COMMENT { 43, "7F9F7F", "3F3F3F", 3 }, // COMMENTLINE { 44, "7F9F7F", "3F3F3F", 2 }, // COMMENTDOC }; static const lexstyle python_Zenburn[] = { { 0, "DCDCCC", "3F3F3F", 0 }, // DEFAULT { 1, "7F9F7F", "3F3F3F", 3 }, // COMMENTLINE { 2, "8CD0D3", "3F3F3F", 0 }, // NUMBER { 3, "CC9393", "3F3F3F", 0 }, // STRING { 4, "DCA3A3", "3F3F3F", 0 }, // CHARACTER { 5, "DFC47D", "3F3F3F", 1 }, // KEYWORDS { 6, "7F9F7F", "3F3F3F", 0 }, // TRIPLE { 7, "7F9F7F", "3F3F3F", 0 }, // TRIPLEDOUBLE { 8, "DCDCCC", "3F3F3F", 0 }, // CLASSNAME { 9, "CEDF99", "3F3F3F", 0 }, // DEFNAME { 10, "9F9D6D", "3F3F3F", 1 }, // OPERATOR { 11, "DCDCCC", "3F3F3F", 0 }, // IDENTIFIER { 12, "7F9F7F", "3F3F3F", 0 }, // COMMENTBLOCK }; static const lexstyle ruby_Zenburn[] = { { 0, "DCDCCC", "3F3F3F", 0 }, // DEFAULT { 1, "EBD6EB", "3F3F3F", 0 }, // ERROR { 2, "7F9F7F", "3F3F3F", 3 }, // COMMENTLINE { 3, "DCDCCC", "3F3F3F", 0 }, // POD { 4, "8CD0D3", "3F3F3F", 0 }, // NUMBER { 5, "E3CEAB", "3F3F3F", 1 }, // INSTRUCTION { 6, "CC9393", "3F3F3F", 0 }, // STRING { 7, "DCA3A3", "3F3F3F", 0 }, // CHARACTER { 8, "DFE4CF", "3F3F3F", 1 }, // CLASS NAME { 9, "EFEF8F", "3F3F3F", 0 }, // DEF NAME { 10, "9F9D6D", "3F3F3F", 1 }, // OPERATOR { 11, "FFEBDD", "3F3F3F", 0 }, // IDENTIFIER { 12, "CC9393", "3F3F3F", 1 }, // REGEX { 13, "FFEBDD", "3F3F3F", 3 }, // GLOBAL { 14, "E3CEAB", "3F3F3F", 0 }, // SYMBOL { 15, "DCDCCC", "3F3F3F", 1 }, // MODULE NAME { 16, "FFCFAF", "3F3F3F", 0 }, // INSTANCE VAR { 17, "FFCFAF", "3F3F3F", 1 }, // CLASS VAR { 18, "DCDCCC", "3F3F3F", 0 }, // BACKTICKS { 19, "DCDCCC", "3F3F3F", 0 }, // DATA SECTION { 24, "C89191", "3F3F3F", 0 }, // STRING Q }; static const lexstyle global_Plastic_Code_Wrap[] = { { 32, "F8F8F8", "0B161D", 0 }, // Default Style { 37, "888A85", "0B161D", 0 }, // Indent guideline style { 34, "FCE94F", "0B161D", 1 }, // Brace highlight style { 35, "EF2929", "0B161D", 0 }, // Bad brace colour { 2069, "8BA7A7", "0B161D", 0 }, // Caret colour { 31, "CC0000", "EDD400", 0 }, // Find Mark Style { 33, "EEEEEC", "2E3436", 0 }, // Line number margin { 29, "555753", "00FF00", 0 }, // Smart HighLighting { 31, "FCAF3E", "FF0000", 0 }, // Find Mark Style { 25, "F8F8F8", "00FFFF", 0 }, // Mark Style 1 { 24, "F8F8F8", "FF8000", 0 }, // Mark Style 2 { 23, "F8F8F8", "FFFF00", 0 }, // Mark Style 3 { 22, "F8F8F8", "8000FF", 0 }, // Mark Style 4 { 21, "F8F8F8", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "8000FF", 0 }, // Tags match highlighting { 26, "8080C0", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_Plastic_Code_Wrap[] = { { 9, "FFAA00", "0B161D", 0 }, // PREPROCESSOR { 11, "F8F8F8", "0B161D", 0 }, // DEFAULT { 5, "F6F080", "0B161D", 0 }, // INSTRUCTION WORD { 16, "FFAA00", "0B161D", 0 }, // TYPE WORD { 4, "FF3A83", "0B161D", 0 }, // NUMBER { 6, "55E439", "0B161D", 0 }, // STRING { 7, "55E439", "0B161D", 0 }, // CHARACTER { 10, "FFAA00", "0B161D", 0 }, // OPERATOR { 13, "FF3A83", "0B161D", 0 }, // VERBATIM { 14, "FFB454", "0B161D", 0 }, // REGEX { 1, "1E9AE0", "0B161D", 0 }, // COMMENT { 2, "1E9AE0", "0B161D", 0 }, // COMMENT LINE { 3, "1E9AE0", "0B161D", 0 }, // COMMENT DOC { 15, "1E9AE0", "0B161D", 0 }, // COMMENT LINE DOC { 17, "1E9AE0", "0B161D", 0 }, // COMMENT DOC KEYWORD { 18, "1E9AE0", "0B161D", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Plastic_Code_Wrap[] = { { 9, "FFAA00", "0B161D", 0 }, // PREPROCESSOR { 11, "F8F8F8", "0B161D", 0 }, // DEFAULT { 5, "F6F080", "0B161D", 0 }, // INSTRUCTION WORD { 16, "FFAA00", "0B161D", 0 }, // TYPE WORD { 4, "FF3A83", "0B161D", 0 }, // NUMBER { 6, "55E439", "0B161D", 0 }, // STRING { 7, "55E439", "0B161D", 0 }, // CHARACTER { 10, "FFAA00", "0B161D", 0 }, // OPERATOR { 13, "FF3A83", "0B161D", 0 }, // VERBATIM { 14, "FFB454", "0B161D", 0 }, // REGEX { 1, "1E9AE0", "0B161D", 0 }, // COMMENT { 2, "1E9AE0", "0B161D", 0 }, // COMMENT LINE { 3, "1E9AE0", "0B161D", 0 }, // COMMENT DOC { 15, "1E9AE0", "0B161D", 0 }, // COMMENT LINE DOC { 17, "1E9AE0", "0B161D", 0 }, // COMMENT DOC KEYWORD { 18, "1E9AE0", "0B161D", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Plastic_Code_Wrap[] = { { 41, "F8F8F8", "0B161D", 0 }, // DEFAULT { 45, "FF3A83", "0B161D", 0 }, // NUMBER { 46, "F8F8F8", "0B161D", 0 }, // WORD { 47, "FFAA00", "0B161D", 0 }, // KEYWORD { 48, "55E439", "0B161D", 0 }, // DOUBLESTRING { 49, "55E439", "0B161D", 0 }, // SINGLESTRING { 50, "F8F8F8", "0B161D", 0 }, // SYMBOLS { 51, "55E439", "0B161D", 0 }, // STRINGEOL { 52, "FFB454", "0B161D", 0 }, // REGEX { 42, "1E9AE0", "0B161D", 0 }, // COMMENT { 43, "1E9AE0", "0B161D", 0 }, // COMMENTLINE { 44, "1E9AE0", "0B161D", 0 }, // COMMENTDOC }; static const lexstyle python_Plastic_Code_Wrap[] = { { 0, "F8F8F8", "0B161D", 0 }, // DEFAULT { 1, "1E9AE0", "0B161D", 0 }, // COMMENTLINE { 2, "FF3A83", "0B161D", 0 }, // NUMBER { 3, "55E439", "0B161D", 0 }, // STRING { 4, "55E439", "0B161D", 0 }, // CHARACTER { 5, "FFAA00", "0B161D", 0 }, // KEYWORDS { 6, "000000", "0B161D", 0 }, // TRIPLE { 7, "000000", "0B161D", 0 }, // TRIPLEDOUBLE { 8, "000000", "0B161D", 0 }, // CLASSNAME { 9, "000000", "0B161D", 0 }, // DEFNAME { 10, "FFAA00", "0B161D", 0 }, // OPERATOR { 11, "EB939A", "0B161D", 0 }, // IDENTIFIER { 12, "1E9AE0", "0B161D", 0 }, // COMMENTBLOCK { 12, "55E439", "0B161D", 0 }, // STRINGEOL }; static const lexstyle ruby_Plastic_Code_Wrap[] = { { 0, "F8F8F8", "0B161D", 0 }, // DEFAULT { 1, "000000", "0B161D", 0 }, // ERROR { 2, "1E9AE0", "0B161D", 0 }, // COMMENTLINE { 3, "000000", "0B161D", 0 }, // POD { 4, "FF3A83", "0B161D", 0 }, // NUMBER { 5, "FFAA00", "0B161D", 0 }, // INSTRUCTION { 6, "55E439", "0B161D", 0 }, // STRING { 7, "55E439", "0B161D", 0 }, // CHARACTER { 8, "EFE900", "0B161D", 0 }, // CLASS NAME { 9, "EFE900", "0B161D", 0 }, // DEF NAME { 10, "FFAA00", "0B161D", 0 }, // OPERATOR { 11, "EB939A", "0B161D", 0 }, // IDENTIFIER { 12, "FFB454", "0B161D", 0 }, // REGEX { 13, "FB9A4B", "0B161D", 0 }, // GLOBAL { 14, "F8F8F8", "0B161D", 0 }, // SYMBOL { 15, "000000", "0B161D", 0 }, // MODULE NAME { 16, "FB9A4B", "0B161D", 0 }, // INSTANCE VAR { 17, "000000", "0B161D", 0 }, // CLASS VAR { 18, "000000", "0B161D", 0 }, // BACKTICKS { 19, "000000", "0B161D", 0 }, // DATA SECTION { 24, "55E439", "0B161D", 0 }, // STRING Q }; static const lexstyle global_Solarized[] = { { 32, "839496", "002B36", 0 }, // Default Style { 37, "586E75", "002B36", 0 }, // Indent guideline style { 34, "DC322F", "859900", 1 }, // Brace highlight style { 35, "D33682", "002B36", 0 }, // Bad brace colour { 2069, "EEE8D5", "002B36", 0 }, // Caret colour { 33, "586E75", "073642", 0 }, // Line number margin { 29, "839496", "FDF6E3", 0 }, // Smart HighLighting { 31, "839496", "6C71C4", 0 }, // Find Mark Style { 25, "839496", "DC322F", 0 }, // Mark Style 1 { 24, "839496", "268BD2", 0 }, // Mark Style 2 { 23, "839496", "2AA198", 0 }, // Mark Style 3 { 22, "839496", "859900", 0 }, // Mark Style 4 { 21, "839496", "B58900", 0 }, // Mark Style 5 { 28, "839496", "002B36", 0 }, // Incremental highlight all { 27, "839496", "CB4B16", 0 }, // Tags match highlighting { 26, "839496", "CB4B16", 0 }, // Tags attribute }; static const lexstyle cpp_Solarized[] = { { 9, "DC322F", "002B36", 0 }, // PREPROCESSOR { 11, "839496", "002B36", 0 }, // DEFAULT { 5, "859900", "002B36", 0 }, // INSTRUCTION WORD { 16, "B58900", "002B36", 0 }, // TYPE WORD { 4, "2AA198", "002B36", 0 }, // NUMBER { 6, "2AA198", "002B36", 0 }, // STRING { 7, "2AA198", "002B36", 0 }, // CHARACTER { 10, "93A1A1", "002B36", 0 }, // OPERATOR { 13, "2AA198", "002B36", 0 }, // VERBATIM { 14, "268BD2", "002B36", 0 }, // REGEX { 1, "586E75", "002B36", 2 }, // COMMENT { 2, "586E75", "002B36", 2 }, // COMMENT LINE { 3, "586E75", "002B36", 2 }, // COMMENT DOC { 15, "586E75", "002B36", 2 }, // COMMENT LINE DOC { 17, "586E75", "002B36", 3 }, // COMMENT DOC KEYWORD { 18, "D33682", "002B36", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Solarized[] = { { 9, "DC322F", "002B36", 0 }, // PREPROCESSOR { 11, "839496", "002B36", 0 }, // DEFAULT { 5, "859900", "002B36", 0 }, // INSTRUCTION WORD { 16, "B58900", "002B36", 0 }, // TYPE WORD { 4, "2AA198", "002B36", 0 }, // NUMBER { 6, "2AA198", "002B36", 0 }, // STRING { 7, "2AA198", "002B36", 0 }, // CHARACTER { 10, "93A1A1", "002B36", 0 }, // OPERATOR { 13, "2AA198", "002B36", 0 }, // VERBATIM { 14, "268BD2", "002B36", 0 }, // REGEX { 1, "586E75", "002B36", 2 }, // COMMENT { 2, "586E75", "002B36", 2 }, // COMMENT LINE { 3, "586E75", "002B36", 2 }, // COMMENT DOC { 15, "586E75", "002B36", 2 }, // COMMENT LINE DOC { 17, "268BD2", "002B36", 3 }, // COMMENT DOC KEYWORD { 18, "D33682", "002B36", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Solarized[] = { { 41, "839496", "002B36", 0 }, // DEFAULT { 45, "2AA198", "002B36", 0 }, // NUMBER { 46, "B58900", "002B36", 0 }, // WORD { 47, "859900", "002B36", 0 }, // KEYWORD { 48, "2AA198", "002B36", 0 }, // DOUBLESTRING { 49, "2AA198", "002B36", 0 }, // SINGLESTRING { 50, "839496", "002B36", 0 }, // SYMBOLS { 51, "DC322F", "002B36", 0 }, // STRINGEOL { 52, "268BD2", "002B36", 0 }, // REGEX { 42, "586E75", "002B36", 2 }, // COMMENT { 43, "586E75", "002B36", 2 }, // COMMENTLINE { 44, "586E75", "002B36", 2 }, // COMMENTDOC { 17, "268BD2", "002B36", 3 }, // COMMENT DOC KEYWORD { 18, "D33682", "002B36", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle python_Solarized[] = { { 0, "839496", "002B36", 0 }, // DEFAULT { 1, "586E75", "002B36", 2 }, // COMMENTLINE { 2, "2AA198", "002B36", 0 }, // NUMBER { 3, "2AA198", "002B36", 0 }, // STRING { 4, "2AA198", "002B36", 0 }, // CHARACTER { 5, "859900", "002B36", 0 }, // KEYWORDS { 6, "2AA198", "002B36", 0 }, // TRIPLE { 7, "2AA198", "002B36", 0 }, // TRIPLEDOUBLE { 8, "CB4B16", "002B36", 0 }, // CLASSNAME { 9, "CB4B16", "002B36", 0 }, // DEFNAME { 10, "93A1A1", "002B36", 0 }, // OPERATOR { 11, "B58900", "002B36", 0 }, // IDENTIFIER { 12, "586E75", "002B36", 2 }, // COMMENTBLOCK { 12, "586E75", "002B36", 0 }, // STRINGEOL }; static const lexstyle ruby_Solarized[] = { { 0, "839496", "002B36", 0 }, // DEFAULT { 1, "DC322F", "002B36", 0 }, // ERROR { 2, "586E75", "002B36", 2 }, // COMMENTLINE { 3, "839496", "002B36", 2 }, // POD { 4, "2AA198", "002B36", 0 }, // NUMBER { 5, "859900", "002B36", 0 }, // INSTRUCTION { 6, "2AA198", "002B36", 0 }, // STRING { 7, "2AA198", "002B36", 0 }, // CHARACTER { 8, "B58900", "002B36", 0 }, // CLASS NAME { 9, "268BD2", "002B36", 0 }, // DEF NAME { 10, "93A1A1", "002B36", 0 }, // OPERATOR { 11, "B58900", "002B36", 0 }, // IDENTIFIER { 12, "268BD2", "002B36", 0 }, // REGEX { 13, "B58900", "002B36", 0 }, // GLOBAL { 14, "839496", "002B36", 0 }, // SYMBOL { 15, "CB4B16", "002B36", 0 }, // MODULE NAME { 16, "B58900", "002B36", 0 }, // INSTANCE VAR { 17, "839496", "002B36", 0 }, // CLASS VAR { 18, "EEE8D5", "6C71C4", 0 }, // BACKTICKS { 19, "2AA198", "002B36", 0 }, // DATA SECTION { 24, "2AA198", "002B36", 0 }, // STRING Q { 25, "268BD2", "002B36", 0 }, // BOOLEAN }; static const lexstyle global_Hello_Kitty[] = { { 32, "000000", "FFB0FF", 0 }, // Default Style { 37, "C0C0C0", "FFB0FF", 0 }, // Indent guideline style { 34, "FF0000", "FFB0FF", 1 }, // Brace highlight style { 35, "800000", "FFB0FF", 0 }, // Bad brace colour { 2069, "FFFFFF", "372017", 0 }, // Caret colour { 33, "FFFFFF", "FF80FF", 0 }, // Line number margin { 29, "555753", "00FF00", 0 }, // Smart HighLighting { 31, "FCAF3E", "FF0000", 0 }, // Find Mark Style { 25, "000000", "00FFFF", 0 }, // Mark Style 1 { 24, "000000", "FF8000", 0 }, // Mark Style 2 { 23, "000000", "FFFF00", 0 }, // Mark Style 3 { 22, "000000", "8000FF", 0 }, // Mark Style 4 { 21, "FAAA3C", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "8000FF", 0 }, // Tags match highlighting { 26, "8080C0", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_Hello_Kitty[] = { { 9, "804000", "FFB0FF", 0 }, // PREPROCESSOR { 11, "000000", "FFB0FF", 0 }, // DEFAULT { 5, "0000FF", "FFB0FF", 1 }, // INSTRUCTION WORD { 16, "8000FF", "FFB0FF", 0 }, // TYPE WORD { 4, "FF8000", "FFB0FF", 0 }, // NUMBER { 6, "808080", "FFB0FF", 0 }, // STRING { 7, "808080", "FFB0FF", 0 }, // CHARACTER { 10, "000080", "FFB0FF", 1 }, // OPERATOR { 13, "000000", "FFB0FF", 0 }, // VERBATIM { 14, "000000", "FFB0FF", 1 }, // REGEX { 1, "008000", "FFB0FF", 0 }, // COMMENT { 2, "008000", "FFB0FF", 0 }, // COMMENT LINE { 3, "008080", "FFB0FF", 0 }, // COMMENT DOC { 15, "008080", "FFB0FF", 0 }, // COMMENT LINE DOC { 17, "008080", "FFB0FF", 1 }, // COMMENT DOC KEYWORD { 18, "008080", "FFB0FF", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Hello_Kitty[] = { { 9, "804000", "FFB0FF", 0 }, // PREPROCESSOR { 11, "000000", "FFB0FF", 0 }, // DEFAULT { 5, "0000FF", "FFB0FF", 1 }, // INSTRUCTION WORD { 16, "8000FF", "FFB0FF", 0 }, // TYPE WORD { 4, "FF8000", "FFB0FF", 0 }, // NUMBER { 6, "808080", "FFB0FF", 0 }, // STRING { 7, "808080", "FFB0FF", 0 }, // CHARACTER { 10, "000080", "FFB0FF", 1 }, // OPERATOR { 13, "000000", "FFB0FF", 0 }, // VERBATIM { 14, "000000", "FFB0FF", 1 }, // REGEX { 1, "008000", "FFB0FF", 0 }, // COMMENT { 2, "008000", "FFB0FF", 0 }, // COMMENT LINE { 3, "008080", "FFB0FF", 0 }, // COMMENT DOC { 15, "008080", "FFB0FF", 0 }, // COMMENT LINE DOC { 17, "008080", "FFB0FF", 1 }, // COMMENT DOC KEYWORD { 18, "008080", "FFB0FF", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Hello_Kitty[] = { { 41, "000000", "F2F4FF", 0 }, // DEFAULT { 45, "FF0000", "F2F4FF", 0 }, // NUMBER { 46, "000000", "F2F4FF", 0 }, // WORD { 47, "000080", "F2F4FF", 3 }, // KEYWORD { 48, "808080", "F2F4FF", 0 }, // DOUBLESTRING { 49, "808080", "F2F4FF", 0 }, // SINGLESTRING { 50, "000000", "F2F4FF", 1 }, // SYMBOLS { 51, "808080", "F2F4FF", 1 }, // STRINGEOL { 52, "8000FF", "F2F4FF", 0 }, // REGEX { 42, "008000", "F2F4FF", 0 }, // COMMENT { 43, "008000", "F2F4FF", 0 }, // COMMENTLINE { 44, "008080", "F2F4FF", 0 }, // COMMENTDOC }; static const lexstyle python_Hello_Kitty[] = { { 0, "000000", "FFB0FF", 0 }, // DEFAULT { 1, "008000", "FFB0FF", 0 }, // COMMENTLINE { 2, "FF0000", "FFB0FF", 0 }, // NUMBER { 3, "808080", "FFB0FF", 0 }, // STRING { 4, "808080", "FFB0FF", 0 }, // CHARACTER { 5, "0000FF", "FFB0FF", 1 }, // KEYWORDS { 6, "FF8000", "FFB0FF", 0 }, // TRIPLE { 7, "000000", "FFB0FF", 0 }, // TRIPLEDOUBLE { 8, "000000", "FFB0FF", 1 }, // CLASSNAME { 9, "FF00FF", "FFB0FF", 0 }, // DEFNAME { 10, "000080", "FFB0FF", 1 }, // OPERATOR { 11, "000000", "FFB0FF", 0 }, // IDENTIFIER { 12, "008000", "FFB0FF", 0 }, // COMMENTBLOCK { 12, "FFFF00", "FFB0FF", 0 }, // STRINGEOL }; static const lexstyle ruby_Hello_Kitty[] = { { 0, "000000", "FFB0FF", 0 }, // DEFAULT { 1, "000000", "FFB0FF", 0 }, // ERROR { 2, "008000", "FFB0FF", 0 }, // COMMENTLINE { 3, "004000", "C0FFC0", 0 }, // POD { 4, "FF8000", "FFB0FF", 0 }, // NUMBER { 5, "0000FF", "FFB0FF", 1 }, // INSTRUCTION { 6, "808080", "FFB0FF", 0 }, // STRING { 7, "808000", "FFB0FF", 0 }, // CHARACTER { 8, "0080C0", "FFB0FF", 1 }, // CLASS NAME { 9, "8080FF", "FFFFCC", 1 }, // DEF NAME { 10, "000080", "FFB0FF", 1 }, // OPERATOR { 11, "000000", "FFB0FF", 0 }, // IDENTIFIER { 12, "0080FF", "FFB0FF", 0 }, // REGEX { 13, "000080", "FFB0FF", 1 }, // GLOBAL { 14, "000000", "FFB0FF", 0 }, // SYMBOL { 15, "804000", "FFB0FF", 1 }, // MODULE NAME { 16, "000000", "FFB0FF", 0 }, // INSTANCE VAR { 17, "000000", "FFB0FF", 0 }, // CLASS VAR { 18, "FFFF00", "A08080", 0 }, // BACKTICKS { 19, "600000", "FFF0D8", 0 }, // DATA SECTION { 24, "808080", "FFB0FF", 0 }, // STRING Q }; static const lexstyle global_HotFudgeSundae[] = { { 32, "B7975D", "2b0f01", 0 }, // Default Style { 37, "8B642B", "2b0f01", 0 }, // Indent guideline style { 34, "2b0f01", "EC6221", 1 }, // Brace highlight style { 35, "ff00ff", "2b0f01", 0 }, // Bad brace colour { 2069, "faf1c6", "2b0f01", 0 }, // Caret colour { 33, "8B642B", "43250b", 0 }, // Line number margin { 29, "B7975D", "008947", 0 }, // Smart HighLighting { 31, "B7975D", "7578DB", 0 }, // Find Mark Style { 25, "B7975D", "C11418", 0 }, // Mark Style 1 { 24, "B7975D", "0088CE", 0 }, // Mark Style 2 { 23, "B7975D", "BCBB80", 0 }, // Mark Style 3 { 22, "B7975D", "42A658", 0 }, // Mark Style 4 { 21, "B7975D", "cfba28", 0 }, // Mark Style 5 { 28, "B7975D", "2b0f01", 0 }, // Incremental highlight all { 27, "B7975D", "990000", 0 }, // Tags match highlighting { 26, "B7975D", "3D0B0C", 0 }, // Tags attribute }; static const lexstyle cpp_HotFudgeSundae[] = { { 9, "C11418", "2b0f01", 0 }, // PREPROCESSOR { 11, "B7975D", "2b0f01", 0 }, // DEFAULT { 5, "42A658", "2b0f01", 0 }, // INSTRUCTION WORD { 16, "cfba28", "2b0f01", 0 }, // TYPE WORD { 4, "AFA7D6", "2b0f01", 0 }, // NUMBER { 6, "BCBB80", "2b0f01", 0 }, // STRING { 7, "BCBB80", "2b0f01", 0 }, // CHARACTER { 10, "D6C479", "2b0f01", 0 }, // OPERATOR { 13, "BCBB80", "2b0f01", 0 }, // VERBATIM { 14, "0088CE", "2b0f01", 0 }, // REGEX { 1, "255C08", "2b0f01", 2 }, // COMMENT { 2, "255C08", "2b0f01", 2 }, // COMMENT LINE { 3, "255C08", "2b0f01", 2 }, // COMMENT DOC { 15, "255C08", "2b0f01", 2 }, // COMMENT LINE DOC { 17, "255C08", "2b0f01", 3 }, // COMMENT DOC KEYWORD { 18, "ff00ff", "2b0f01", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_HotFudgeSundae[] = { { 9, "C11418", "2b0f01", 0 }, // PREPROCESSOR { 11, "B7975D", "2b0f01", 0 }, // DEFAULT { 5, "42A658", "2b0f01", 0 }, // INSTRUCTION WORD { 16, "cfba28", "2b0f01", 0 }, // TYPE WORD { 4, "AFA7D6", "2b0f01", 0 }, // NUMBER { 6, "BCBB80", "2b0f01", 0 }, // STRING { 7, "BCBB80", "2b0f01", 0 }, // CHARACTER { 10, "D6C479", "2b0f01", 0 }, // OPERATOR { 13, "BCBB80", "2b0f01", 0 }, // VERBATIM { 14, "0088CE", "2b0f01", 0 }, // REGEX { 1, "255C08", "2b0f01", 2 }, // COMMENT { 2, "255C08", "2b0f01", 2 }, // COMMENT LINE { 3, "255C08", "2b0f01", 2 }, // COMMENT DOC { 15, "255C08", "2b0f01", 2 }, // COMMENT LINE DOC { 17, "0088CE", "2b0f01", 3 }, // COMMENT DOC KEYWORD { 18, "ff00ff", "2b0f01", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_HotFudgeSundae[] = { { 41, "B7975D", "2b0f01", 0 }, // DEFAULT { 45, "AFA7D6", "2b0f01", 0 }, // NUMBER { 46, "cfba28", "2b0f01", 0 }, // WORD { 47, "42A658", "2b0f01", 0 }, // KEYWORD { 48, "BCBB80", "2b0f01", 0 }, // DOUBLESTRING { 49, "BCBB80", "2b0f01", 0 }, // SINGLESTRING { 50, "B7975D", "2b0f01", 0 }, // SYMBOLS { 51, "C11418", "2b0f01", 0 }, // STRINGEOL { 52, "0088CE", "2b0f01", 0 }, // REGEX { 42, "255C08", "2b0f01", 2 }, // COMMENT { 43, "255C08", "2b0f01", 2 }, // COMMENTLINE { 44, "255C08", "2b0f01", 2 }, // COMMENTDOC { 17, "0088CE", "2b0f01", 3 }, // COMMENT DOC KEYWORD { 18, "ff00ff", "2b0f01", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle python_HotFudgeSundae[] = { { 0, "B7975D", "2b0f01", 0 }, // DEFAULT { 1, "255C08", "2b0f01", 2 }, // COMMENTLINE { 2, "AFA7D6", "2b0f01", 0 }, // NUMBER { 3, "BCBB80", "2b0f01", 0 }, // STRING { 4, "BCBB80", "2b0f01", 0 }, // CHARACTER { 5, "42A658", "2b0f01", 0 }, // KEYWORDS { 6, "BCBB80", "2b0f01", 0 }, // TRIPLE { 7, "BCBB80", "2b0f01", 0 }, // TRIPLEDOUBLE { 8, "d92b10", "2b0f01", 0 }, // CLASSNAME { 9, "d92b10", "2b0f01", 0 }, // DEFNAME { 10, "D6C479", "2b0f01", 0 }, // OPERATOR { 11, "cfba28", "2b0f01", 0 }, // IDENTIFIER { 12, "255C08", "2b0f01", 2 }, // COMMENTBLOCK { 12, "255C08", "2b0f01", 0 }, // STRINGEOL }; static const lexstyle ruby_HotFudgeSundae[] = { { 0, "B7975D", "2b0f01", 0 }, // DEFAULT { 1, "C11418", "2b0f01", 0 }, // ERROR { 2, "255C08", "2b0f01", 2 }, // COMMENTLINE { 3, "B7975D", "2b0f01", 2 }, // POD { 4, "AFA7D6", "2b0f01", 0 }, // NUMBER { 5, "42A658", "2b0f01", 0 }, // INSTRUCTION { 6, "BCBB80", "2b0f01", 0 }, // STRING { 7, "BCBB80", "2b0f01", 0 }, // CHARACTER { 8, "cfba28", "2b0f01", 0 }, // CLASS NAME { 9, "0088CE", "2b0f01", 0 }, // DEF NAME { 10, "D6C479", "2b0f01", 0 }, // OPERATOR { 11, "cfba28", "2b0f01", 0 }, // IDENTIFIER { 12, "0088CE", "2b0f01", 0 }, // REGEX { 13, "cfba28", "2b0f01", 0 }, // GLOBAL { 14, "B7975D", "2b0f01", 0 }, // SYMBOL { 15, "d92b10", "2b0f01", 0 }, // MODULE NAME { 16, "cfba28", "2b0f01", 0 }, // INSTANCE VAR { 17, "B7975D", "2b0f01", 0 }, // CLASS VAR { 18, "98AE66", "602F1A", 0 }, // BACKTICKS { 19, "BCBB80", "2b0f01", 0 }, // DATA SECTION { 24, "BCBB80", "2b0f01", 0 }, // STRING Q { 25, "0088CE", "2b0f01", 0 }, // BOOLEAN }; static const lexstyle global_Black_board[] = { { 32, "F8F8F8", "0C1021", 0 }, // Default Style { 37, "888A85", "0C1021", 0 }, // Indent guideline style { 34, "FCE94F", "0C1021", 1 }, // Brace highlight style { 35, "EF2929", "0C1021", 0 }, // Bad brace colour { 2069, "FFFFFF", "112435", 0 }, // Caret colour { 31, "CC0000", "EDD400", 0 }, // Find Mark Style { 33, "EEEEEC", "2E3436", 0 }, // Line number margin { 29, "555753", "00FF00", 0 }, // Smart HighLighting { 31, "FCAF3E", "FF0000", 0 }, // Find Mark Style { 25, "F8F8F8", "00FFFF", 0 }, // Mark Style 1 { 24, "F8F8F8", "FF8000", 0 }, // Mark Style 2 { 23, "F8F8F8", "FFFF00", 0 }, // Mark Style 3 { 22, "F8F8F8", "8000FF", 0 }, // Mark Style 4 { 21, "F8F8F8", "008000", 0 }, // Mark Style 5 { 28, "FFCAB0", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "8000FF", 0 }, // Tags match highlighting { 26, "8080C0", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_Black_board[] = { { 9, "FBDE2D", "0C1021", 0 }, // PREPROCESSOR { 11, "F8F8F8", "0C1021", 0 }, // DEFAULT { 5, "FBDE2D", "0C1021", 0 }, // INSTRUCTION WORD { 16, "FBDE2D", "0C1021", 0 }, // TYPE WORD { 4, "D8FA3C", "0C1021", 0 }, // NUMBER { 6, "61CE3C", "0C1021", 0 }, // STRING { 7, "61CE3C", "0C1021", 0 }, // CHARACTER { 10, "FBDE2D", "0C1021", 0 }, // OPERATOR { 13, "D8FA3C", "0C1021", 0 }, // VERBATIM { 14, "61CE3C", "0C1021", 0 }, // REGEX { 1, "AEAEAE", "0C1021", 0 }, // COMMENT { 2, "AEAEAE", "0C1021", 0 }, // COMMENT LINE { 3, "AEAEAE", "0C1021", 0 }, // COMMENT DOC { 15, "AEAEAE", "0C1021", 0 }, // COMMENT LINE DOC { 17, "AEAEAE", "0C1021", 0 }, // COMMENT DOC KEYWORD { 18, "AEAEAE", "0C1021", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Black_board[] = { { 9, "FBDE2D", "0C1021", 0 }, // PREPROCESSOR { 11, "F8F8F8", "0C1021", 0 }, // DEFAULT { 5, "FBDE2D", "0C1021", 0 }, // INSTRUCTION WORD { 16, "FBDE2D", "0C1021", 0 }, // TYPE WORD { 4, "D8FA3C", "0C1021", 0 }, // NUMBER { 6, "61CE3C", "0C1021", 0 }, // STRING { 7, "61CE3C", "0C1021", 0 }, // CHARACTER { 10, "FBDE2D", "0C1021", 0 }, // OPERATOR { 13, "D8FA3C", "0C1021", 0 }, // VERBATIM { 14, "61CE3C", "0C1021", 0 }, // REGEX { 1, "AEAEAE", "0C1021", 0 }, // COMMENT { 2, "AEAEAE", "0C1021", 0 }, // COMMENT LINE { 3, "AEAEAE", "0C1021", 0 }, // COMMENT DOC { 15, "AEAEAE", "0C1021", 0 }, // COMMENT LINE DOC { 17, "AEAEAE", "0C1021", 0 }, // COMMENT DOC KEYWORD { 18, "AEAEAE", "0C1021", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Black_board[] = { { 41, "F8F8F8", "0C1021", 0 }, // DEFAULT { 45, "D8FA3C", "0C1021", 0 }, // NUMBER { 46, "F8F8F8", "0C1021", 0 }, // WORD { 47, "FBDE2D", "0C1021", 0 }, // KEYWORD { 48, "61CE3C", "0C1021", 0 }, // DOUBLESTRING { 49, "61CE3C", "0C1021", 0 }, // SINGLESTRING { 50, "F8F8F8", "0C1021", 0 }, // SYMBOLS { 51, "61CE3C", "0C1021", 0 }, // STRINGEOL { 52, "61CE3C", "0C1021", 0 }, // REGEX { 42, "AEAEAE", "0C1021", 0 }, // COMMENT { 43, "AEAEAE", "0C1021", 0 }, // COMMENTLINE { 44, "AEAEAE", "0C1021", 0 }, // COMMENTDOC }; static const lexstyle python_Black_board[] = { { 0, "F8F8F8", "0C1021", 0 }, // DEFAULT { 1, "AEAEAE", "0C1021", 0 }, // COMMENTLINE { 2, "D8FA3C", "0C1021", 0 }, // NUMBER { 3, "61CE3C", "0C1021", 0 }, // STRING { 4, "61CE3C", "0C1021", 0 }, // CHARACTER { 5, "FBDE2D", "0C1021", 0 }, // KEYWORDS { 6, "000000", "0C1021", 0 }, // TRIPLE { 7, "000000", "0C1021", 0 }, // TRIPLEDOUBLE { 8, "000000", "0C1021", 0 }, // CLASSNAME { 9, "000000", "0C1021", 0 }, // DEFNAME { 10, "FBDE2D", "0C1021", 0 }, // OPERATOR { 11, "8DA6CE", "0C1021", 0 }, // IDENTIFIER { 12, "AEAEAE", "0C1021", 0 }, // COMMENTBLOCK { 12, "61CE3C", "0C1021", 0 }, // STRINGEOL }; static const lexstyle ruby_Black_board[] = { { 0, "F8F8F8", "0C1021", 0 }, // DEFAULT { 1, "000000", "0C1021", 0 }, // ERROR { 2, "AEAEAE", "0C1021", 0 }, // COMMENTLINE { 3, "000000", "0C1021", 0 }, // POD { 4, "D8FA3C", "0C1021", 0 }, // NUMBER { 5, "FBDE2D", "0C1021", 0 }, // INSTRUCTION { 6, "61CE3C", "0C1021", 0 }, // STRING { 7, "61CE3C", "0C1021", 0 }, // CHARACTER { 8, "FF6400", "0C1021", 0 }, // CLASS NAME { 9, "FF6400", "0C1021", 0 }, // DEF NAME { 10, "FBDE2D", "0C1021", 0 }, // OPERATOR { 11, "8DA6CE", "0C1021", 0 }, // IDENTIFIER { 12, "61CE3C", "0C1021", 0 }, // REGEX { 13, "F8F8F8", "0C1021", 0 }, // GLOBAL { 14, "F8F8F8", "0C1021", 0 }, // SYMBOL { 15, "000000", "0C1021", 0 }, // MODULE NAME { 16, "F8F8F8", "0C1021", 0 }, // INSTANCE VAR { 17, "000000", "0C1021", 0 }, // CLASS VAR { 18, "000000", "0C1021", 0 }, // BACKTICKS { 19, "000000", "0C1021", 0 }, // DATA SECTION { 24, "61CE3C", "0C1021", 0 }, // STRING Q }; static const lexstyle global_MossyLawn[] = { { 32, "f2c476", "6c7d51", 0 }, // Default Style { 37, "003709", "6c7d51", 0 }, // Indent guideline style { 34, "561e0f", "9ece3c", 1 }, // Brace highlight style { 35, "981f0e", "6c7d51", 0 }, // Bad brace colour { 2069, "ffc973", "6c7d51", 0 }, // Caret colour { 33, "603d13", "7e8a28", 0 }, // Line number margin { 29, "f2c476", "bf8830", 0 }, // Smart HighLighting { 31, "f2c476", "6a1a01", 0 }, // Find Mark Style { 25, "f2c476", "fdd64a", 0 }, // Mark Style 1 { 24, "f2c476", "afcf90", 0 }, // Mark Style 2 { 23, "f2c476", "ffdc87", 0 }, // Mark Style 3 { 22, "f2c476", "cbe248", 0 }, // Mark Style 4 { 21, "f2c476", "8abbe4", 0 }, // Mark Style 5 { 28, "f2c476", "6a1a01", 0 }, // Incremental highlight all { 27, "f2c476", "92983e", 0 }, // Tags match highlighting { 26, "f2c476", "dab57e", 0 }, // Tags attribute }; static const lexstyle cpp_MossyLawn[] = { { 9, "a32129", "6c7d51", 0 }, // PREPROCESSOR { 11, "f2c476", "6c7d51", 0 }, // DEFAULT { 5, "cbe248", "6c7d51", 0 }, // INSTRUCTION WORD { 16, "efc53d", "6c7d51", 0 }, // TYPE WORD { 4, "ffdc87", "6c7d51", 0 }, // NUMBER { 6, "ffdc87", "6c7d51", 0 }, // STRING { 7, "ffdc87", "6c7d51", 0 }, // CHARACTER { 10, "ffee88", "6c7d51", 1 }, // OPERATOR { 13, "ffdc87", "6c7d51", 0 }, // VERBATIM { 14, "afcf90", "6c7d51", 0 }, // REGEX { 1, "2a390e", "6c7d51", 2 }, // COMMENT { 2, "2a390e", "6c7d51", 2 }, // COMMENT LINE { 3, "2a390e", "6c7d51", 2 }, // COMMENT DOC { 15, "2a390e", "6c7d51", 2 }, // COMMENT LINE DOC { 17, "2a390e", "6c7d51", 3 }, // COMMENT DOC KEYWORD { 18, "981f0e", "fdd64a", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_MossyLawn[] = { { 9, "a32129", "6c7d51", 0 }, // PREPROCESSOR { 11, "f2c476", "6c7d51", 0 }, // DEFAULT { 5, "cbe248", "6c7d51", 0 }, // INSTRUCTION WORD { 16, "efc53d", "6c7d51", 0 }, // TYPE WORD { 4, "ffdc87", "6c7d51", 0 }, // NUMBER { 6, "ffdc87", "6c7d51", 0 }, // STRING { 7, "ffdc87", "6c7d51", 0 }, // CHARACTER { 10, "ffee88", "6c7d51", 1 }, // OPERATOR { 13, "ffdc87", "6c7d51", 0 }, // VERBATIM { 14, "afcf90", "6c7d51", 0 }, // REGEX { 1, "2a390e", "6c7d51", 2 }, // COMMENT { 2, "2a390e", "6c7d51", 2 }, // COMMENT LINE { 3, "2a390e", "6c7d51", 2 }, // COMMENT DOC { 15, "2a390e", "6c7d51", 2 }, // COMMENT LINE DOC { 17, "afcf90", "6c7d51", 3 }, // COMMENT DOC KEYWORD { 18, "981f0e", "fdd64a", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_MossyLawn[] = { { 41, "f2c476", "6c7d51", 0 }, // DEFAULT { 45, "ffdc87", "6c7d51", 0 }, // NUMBER { 46, "efc53d", "6c7d51", 0 }, // WORD { 47, "cbe248", "6c7d51", 0 }, // KEYWORD { 48, "ffdc87", "6c7d51", 0 }, // DOUBLESTRING { 49, "ffdc87", "6c7d51", 0 }, // SINGLESTRING { 50, "f2c476", "6c7d51", 0 }, // SYMBOLS { 51, "a32129", "6c7d51", 0 }, // STRINGEOL { 52, "afcf90", "6c7d51", 0 }, // REGEX { 42, "2a390e", "6c7d51", 2 }, // COMMENT { 43, "2a390e", "6c7d51", 2 }, // COMMENTLINE { 44, "2a390e", "6c7d51", 2 }, // COMMENTDOC { 17, "afcf90", "6c7d51", 3 }, // COMMENT DOC KEYWORD { 18, "981f0e", "fdd64a", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle python_MossyLawn[] = { { 0, "f2c476", "6c7d51", 0 }, // DEFAULT { 1, "2a390e", "6c7d51", 2 }, // COMMENTLINE { 2, "ffdc87", "6c7d51", 0 }, // NUMBER { 3, "ffdc87", "6c7d51", 0 }, // STRING { 4, "ffdc87", "6c7d51", 0 }, // CHARACTER { 5, "cbe248", "6c7d51", 0 }, // KEYWORDS { 6, "ffdc87", "6c7d51", 0 }, // TRIPLE { 7, "ffdc87", "6c7d51", 0 }, // TRIPLEDOUBLE { 8, "a32129", "6c7d51", 0 }, // CLASSNAME { 9, "a32129", "6c7d51", 0 }, // DEFNAME { 10, "ffee88", "6c7d51", 1 }, // OPERATOR { 11, "efc53d", "6c7d51", 0 }, // IDENTIFIER { 12, "2a390e", "6c7d51", 2 }, // COMMENTBLOCK { 12, "2a390e", "6c7d51", 0 }, // STRINGEOL }; static const lexstyle ruby_MossyLawn[] = { { 0, "f2c476", "6c7d51", 0 }, // DEFAULT { 1, "a32129", "6c7d51", 0 }, // ERROR { 2, "2a390e", "6c7d51", 2 }, // COMMENTLINE { 3, "f2c476", "6c7d51", 2 }, // POD { 4, "ffdc87", "6c7d51", 0 }, // NUMBER { 5, "cbe248", "6c7d51", 0 }, // INSTRUCTION { 6, "ffdc87", "6c7d51", 0 }, // STRING { 7, "ffdc87", "6c7d51", 0 }, // CHARACTER { 8, "efc53d", "6c7d51", 0 }, // CLASS NAME { 9, "afcf90", "6c7d51", 0 }, // DEF NAME { 10, "ffee88", "6c7d51", 1 }, // OPERATOR { 11, "efc53d", "6c7d51", 0 }, // IDENTIFIER { 12, "afcf90", "6c7d51", 0 }, // REGEX { 13, "efc53d", "6c7d51", 0 }, // GLOBAL { 14, "f2c476", "6c7d51", 0 }, // SYMBOL { 15, "a32129", "6c7d51", 0 }, // MODULE NAME { 16, "efc53d", "6c7d51", 0 }, // INSTANCE VAR { 17, "f2c476", "6c7d51", 0 }, // CLASS VAR { 18, "bfb8c4", "7e8a28", 0 }, // BACKTICKS { 19, "ffdc87", "6c7d51", 0 }, // DATA SECTION { 24, "ffdc87", "6c7d51", 0 }, // STRING Q { 25, "afcf90", "6c7d51", 0 }, // BOOLEAN }; static const lexstyle global_Obsidian[] = { { 32, "E0E2E4", "293134", 0 }, // Default Style { 37, "394448", "293134", 0 }, // Indent guideline style { 34, "F3DB2E", "293134", 1 }, // Brace highlight style { 35, "FB0000", "293134", 0 }, // Bad brace colour { 2069, "C1CBD2", "6699CC", 0 }, // Caret colour { 33, "81969A", "3F4B4E", 0 }, // Line number margin { 29, "222222", "56676D", 0 }, // Smart HighLighting { 31, "E0E2E4", "6B8189", 1 }, // Find Mark Style { 25, "E0E2E4", "00659B", 0 }, // Mark Style 1 { 24, "E0E2E4", "00880B", 0 }, // Mark Style 2 { 23, "E0E2E4", "A6AA00", 0 }, // Mark Style 3 { 22, "E0E2E4", "8A0B0B", 0 }, // Mark Style 4 { 21, "E0E2E4", "44116F", 0 }, // Mark Style 5 { 28, "FFFF80", "0080FF", 0 }, // Incremental highlight all { 27, "E0E2E4", "4D5C62", 0 }, // Tags match highlighting { 26, "FFCAB0", "93975E", 0 }, // Tags attribute }; static const lexstyle cpp_Obsidian[] = { { 9, "A082BD", "293134", 0 }, // PREPROCESSOR { 11, "E0E2E4", "293134", 0 }, // DEFAULT { 5, "93C763", "293134", 1 }, // INSTRUCTION WORD { 16, "678CB1", "293134", 0 }, // TYPE WORD { 4, "FFCD22", "293134", 0 }, // NUMBER { 6, "EC7600", "293134", 0 }, // STRING { 7, "FF8409", "293134", 0 }, // CHARACTER { 10, "E8E2B7", "293134", 0 }, // OPERATOR { 13, "E0E2E4", "293134", 0 }, // VERBATIM { 14, "D39745", "293134", 0 }, // REGEX { 1, "66747B", "293134", 0 }, // COMMENT { 2, "66747B", "293134", 0 }, // COMMENT LINE { 3, "6C788C", "293134", 0 }, // COMMENT DOC { 15, "6C788C", "293134", 0 }, // COMMENT LINE DOC { 17, "6C788C", "293134", 1 }, // COMMENT DOC KEYWORD { 18, "6C788C", "293134", 1 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Obsidian[] = { { 9, "A082BD", "293134", 0 }, // PREPROCESSOR { 11, "E0E2E4", "293134", 0 }, // DEFAULT { 5, "93C763", "293134", 1 }, // INSTRUCTION WORD { 16, "678CB1", "293134", 0 }, // TYPE WORD { 4, "FFCD22", "293134", 0 }, // NUMBER { 6, "EC7600", "293134", 0 }, // STRING { 7, "FF8409", "293134", 0 }, // CHARACTER { 10, "E8E2B7", "293134", 0 }, // OPERATOR { 13, "E0E2E4", "293134", 0 }, // VERBATIM { 14, "D39745", "293134", 0 }, // REGEX { 1, "66747B", "293134", 0 }, // COMMENT { 2, "66747B", "293134", 0 }, // COMMENT LINE { 3, "6C788C", "293134", 0 }, // COMMENT DOC { 15, "6C788C", "293134", 0 }, // COMMENT LINE DOC { 17, "6C788C", "293134", 1 }, // COMMENT DOC KEYWORD { 18, "6C788C", "293134", 1 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Obsidian[] = { { 41, "E0E2E4", "293134", 0 }, // DEFAULT { 45, "FFCD22", "293134", 0 }, // NUMBER { 46, "E0E2E4", "293134", 0 }, // WORD { 47, "93C763", "293134", 1 }, // KEYWORD { 48, "EC7600", "293134", 0 }, // DOUBLESTRING { 49, "EC7600", "293134", 0 }, // SINGLESTRING { 50, "E8E2B7", "293134", 0 }, // SYMBOLS { 51, "E0E2E4", "293134", 0 }, // STRINGEOL { 52, "D39745", "293134", 0 }, // REGEX { 42, "818E96", "293134", 0 }, // COMMENT { 43, "818E96", "293134", 0 }, // COMMENTLINE { 44, "6C788C", "293134", 0 }, // COMMENTDOC }; static const lexstyle python_Obsidian[] = { { 0, "E0E2E4", "293134", 0 }, // DEFAULT { 1, "66747B", "293134", 0 }, // COMMENTLINE { 2, "FFCD22", "293134", 0 }, // NUMBER { 3, "EC7600", "293134", 0 }, // STRING { 4, "FF8409", "293134", 0 }, // CHARACTER { 5, "93C763", "293134", 1 }, // KEYWORDS { 6, "66747B", "293134", 0 }, // TRIPLE { 7, "66747B", "293134", 0 }, // TRIPLEDOUBLE { 8, "A082BD", "293134", 1 }, // CLASSNAME { 9, "678CB1", "293134", 1 }, // DEFNAME { 10, "E8E2B7", "293134", 0 }, // OPERATOR { 11, "E0E2E4", "293134", 0 }, // IDENTIFIER { 12, "66747B", "293134", 0 }, // COMMENTBLOCK { 12, "E0E2E4", "293134", 0 }, // STRINGEOL }; static const lexstyle ruby_Obsidian[] = { { 0, "E0E2E4", "293134", 0 }, // DEFAULT { 1, "E0E2E4", "293134", 0 }, // ERROR { 2, "66747B", "293134", 0 }, // COMMENTLINE { 3, "E0E2E4", "293134", 0 }, // POD { 4, "FFCD22", "293134", 0 }, // NUMBER { 5, "93C763", "293134", 1 }, // INSTRUCTION { 6, "EC7600", "293134", 0 }, // STRING { 7, "FF8409", "293134", 0 }, // CHARACTER { 8, "A082BD", "293134", 1 }, // CLASS NAME { 9, "678CB1", "293134", 1 }, // DEF NAME { 10, "E8E2B7", "293134", 0 }, // OPERATOR { 11, "E0E2E4", "293134", 0 }, // IDENTIFIER { 12, "D39745", "293134", 0 }, // REGEX { 13, "E0E2E4", "293134", 0 }, // GLOBAL { 14, "E0E2E4", "293134", 0 }, // SYMBOL { 15, "E0E2E4", "293134", 0 }, // MODULE NAME { 16, "B6C8DA", "293134", 0 }, // INSTANCE VAR { 17, "E0E2E4", "293134", 0 }, // CLASS VAR { 18, "E0E2E4", "293134", 0 }, // BACKTICKS { 19, "E0E2E4", "293134", 0 }, // DATA SECTION { 24, "E0E2E4", "293134", 0 }, // STRING Q }; static const lexstyle global_Eclipse_Default[] = { { 32, "000000", "FFFFFF", 0 }, // Default Style { 37, "C0C0C0", "FFFFFF", 0 }, // Indent guideline style { 34, "FF0000", "FFFFFF", 1 }, // Brace highlight style { 35, "800000", "FFFFFF", 1 }, // Bad brace colour { 2069, "000000", "FFFFFF", 0 }, // Caret colour { 33, "808080", "E4E4E4", 0 }, // Line number margin { 29, "000000", "A3A3A3", 0 }, // Smart HighLighting { 31, "000000", "FF0000", 0 }, // Find Mark Style { 28, "000000", "FFFF00", 0 }, // Incremental highlight all { 27, "000000", "FFFF00", 0 }, // Tags match highlighting { 26, "000000", "FFFFFF", 0 }, // Tags attribute }; static const lexstyle cpp_Eclipse_Default[] = { { 9, "7F7F9F", "FFFFFF", 1 }, // PREPROCESSOR { 11, "000000", "FFFFFF", 0 }, // DEFAULT { 5, "7F0055", "FFFFFF", 1 }, // INSTRUCTION WORD { 16, "7F0055", "FFFFFF", 1 }, // TYPE WORD { 4, "000000", "FFFFFF", 0 }, // NUMBER { 6, "2A00FF", "FFFFFF", 0 }, // STRING { 7, "2A00FF", "FFFFFF", 0 }, // CHARACTER { 10, "000000", "FFFFFF", 0 }, // OPERATOR { 13, "646464", "FFFFFF", 0 }, // VERBATIM { 14, "646464", "FFFFFF", 0 }, // REGEX { 1, "3F7F5F", "FFFFFF", 0 }, // COMMENT { 2, "3F7F5F", "FFFFFF", 0 }, // COMMENT LINE { 3, "3F5FBF", "FFFFFF", 0 }, // COMMENT DOC { 15, "3F5FBF", "FFFFFF", 0 }, // COMMENT LINE DOC { 17, "7F9FBF", "FFFFFF", 1 }, // COMMENT DOC KEYWORD { 18, "7F9FBF", "FFFFFF", 1 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Eclipse_Default[] = { { 9, "7F7F9F", "FFFFFF", 1 }, // PREPROCESSOR { 11, "000000", "FFFFFF", 0 }, // DEFAULT { 5, "7F0055", "FFFFFF", 1 }, // INSTRUCTION WORD { 16, "7F0055", "FFFFFF", 1 }, // TYPE WORD { 4, "000000", "FFFFFF", 0 }, // NUMBER { 6, "2A00FF", "FFFFFF", 0 }, // STRING { 7, "2A00FF", "FFFFFF", 0 }, // CHARACTER { 10, "000000", "FFFFFF", 0 }, // OPERATOR { 13, "646464", "FFFFFF", 0 }, // VERBATIM { 14, "646464", "FFFFFF", 0 }, // REGEX { 1, "3F7F5F", "FFFFFF", 0 }, // COMMENT { 2, "3F7F5F", "FFFFFF", 0 }, // COMMENT LINE { 3, "3F5FBF", "FFFFFF", 0 }, // COMMENT DOC { 15, "3F5FBF", "FFFFFF", 0 }, // COMMENT LINE DOC { 17, "7F9FBF", "FFFFFF", 1 }, // COMMENT DOC KEYWORD { 18, "7F9FBF", "FFFFFF", 1 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Eclipse_Default[] = { { 41, "000000", "FFFFFF", 0 }, // DEFAULT { 45, "000000", "FFFFFF", 0 }, // NUMBER { 46, "000000", "FFFFFF", 0 }, // WORD { 47, "7F0055", "FFFFFF", 1 }, // KEYWORD { 48, "2A00FF", "FFFFFF", 0 }, // DOUBLESTRING { 49, "2A00FF", "FFFFFF", 0 }, // SINGLESTRING { 50, "000000", "FFFFFF", 0 }, // SYMBOLS { 51, "2A00FF", "FFFFFF", 0 }, // STRINGEOL { 52, "646464", "FFFFFF", 0 }, // REGEX { 42, "3F7F5F", "FFFFFF", 0 }, // COMMENT { 43, "3F7F5F", "FFFFFF", 0 }, // COMMENTLINE { 44, "3F5FBF", "FFFFFF", 0 }, // COMMENTDOC }; static const lexstyle python_Eclipse_Default[] = { { 0, "000000", "FFFFFF", 0 }, // DEFAULT { 1, "3F7F5F", "FFFFFF", 0 }, // COMMENTLINE { 2, "000000", "FFFFFF", 0 }, // NUMBER { 3, "2A00FF", "FFFFFF", 0 }, // STRING { 4, "2A00FF", "FFFFFF", 0 }, // CHARACTER { 5, "7F0055", "FFFFFF", 1 }, // KEYWORDS { 6, "646464", "FFFFFF", 0 }, // TRIPLE { 7, "000000", "FFFFFF", 0 }, // TRIPLEDOUBLE { 8, "000000", "FFFFFF", 0 }, // CLASSNAME { 9, "3F5FBF", "FFFFFF", 1 }, // DEFNAME { 10, "000000", "FFFFFF", 0 }, // OPERATOR { 11, "000000", "FFFFFF", 0 }, // IDENTIFIER { 12, "3F7F5F", "FFFFFF", 0 }, // COMMENTBLOCK { 12, "2A00FF", "FFFFFF", 0 }, // STRINGEOL }; static const lexstyle ruby_Eclipse_Default[] = { { 0, "000000", "FFFFFF", 0 }, // DEFAULT { 1, "FF0000", "FFFFFF", 0 }, // ERROR { 2, "3F7F5F", "FFFFFF", 0 }, // COMMENTLINE { 3, "000000", "FFFFFF", 0 }, // POD { 4, "000000", "FFFFFF", 0 }, // NUMBER { 5, "7F0055", "FFFFFF", 1 }, // INSTRUCTION { 6, "2A00FF", "FFFFFF", 0 }, // STRING { 7, "2A00FF", "FFFFFF", 0 }, // CHARACTER { 8, "000000", "FFFFFF", 0 }, // CLASS NAME { 9, "3F5FBF", "FFFFFF", 1 }, // DEF NAME { 10, "000000", "FFFFFF", 0 }, // OPERATOR { 11, "000000", "FFFFFF", 0 }, // IDENTIFIER { 12, "646464", "FFFFFF", 0 }, // REGEX { 13, "0000C0", "FFFFFF", 0 }, // GLOBAL { 14, "000000", "FFFFFF", 0 }, // SYMBOL { 15, "7F7F9F", "FFFFFF", 1 }, // MODULE NAME { 16, "000000", "FFFFFF", 0 }, // INSTANCE VAR { 17, "000000", "FFFFFF", 0 }, // CLASS VAR { 18, "000000", "FFFFFF", 0 }, // BACKTICKS { 19, "646464", "FFFFFF", 0 }, // DATA SECTION { 24, "2A00FF", "FFFFFF", 0 }, // STRING Q }; static const lexstyle global_Navajo[] = { { 32, "000000", "BA9C80", 0 }, // Default Style { 37, "181880", "BA9C80", 0 }, // Indent guideline style { 34, "000000", "00FFFF", 1 }, // Brace highlight style { 35, "BCBCBC", "5F0000", 0 }, // Bad brace colour { 2069, "FFFFFF", "BA9C80", 0 }, // Caret colour { 33, "000000", "808080", 0 }, // Line number margin { 29, "000000", "BCBCBC", 0 }, // Smart HighLighting { 31, "000000", "3b4092", 0 }, // Find Mark Style { 25, "000000", "870087", 0 }, // Mark Style 1 { 24, "000000", "C00058", 0 }, // Mark Style 2 { 23, "000000", "181880", 0 }, // Mark Style 3 { 22, "000000", "804040", 0 }, // Mark Style 4 { 21, "000000", "106060", 0 }, // Mark Style 5 { 28, "000000", "BA9C80", 0 }, // Incremental highlight all { 27, "000000", "D92B10", 0 }, // Tags match highlighting { 26, "000000", "D92B10", 0 }, // Tags attribute }; static const lexstyle cpp_Navajo[] = { { 9, "870087", "BA9C80", 0 }, // PREPROCESSOR { 11, "000000", "BA9C80", 0 }, // DEFAULT { 5, "804040", "BA9C80", 0 }, // INSTRUCTION WORD { 16, "1E8B47", "BA9C80", 0 }, // TYPE WORD { 4, "C00058", "BA9C80", 0 }, // NUMBER { 6, "C00058", "BA9C80", 0 }, // STRING { 7, "C00058", "BA9C80", 0 }, // CHARACTER { 10, "010101", "BA9C80", 1 }, // OPERATOR { 13, "C00058", "BA9C80", 0 }, // VERBATIM { 14, "C00058", "BA9C80", 0 }, // REGEX { 1, "181880", "BA9C80", 2 }, // COMMENT { 2, "181880", "BA9C80", 2 }, // COMMENT LINE { 3, "181880", "BA9C80", 2 }, // COMMENT DOC { 15, "181880", "BA9C80", 2 }, // COMMENT LINE DOC { 17, "181880", "BA9C80", 3 }, // COMMENT DOC KEYWORD { 18, "BCBCBC", "5F0000", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_Navajo[] = { { 9, "870087", "BA9C80", 0 }, // PREPROCESSOR { 11, "000000", "BA9C80", 0 }, // DEFAULT { 5, "804040", "BA9C80", 0 }, // INSTRUCTION WORD { 16, "1E8B47", "BA9C80", 0 }, // TYPE WORD { 4, "C00058", "BA9C80", 0 }, // NUMBER { 6, "C00058", "BA9C80", 0 }, // STRING { 7, "C00058", "BA9C80", 0 }, // CHARACTER { 10, "010101", "BA9C80", 1 }, // OPERATOR { 13, "C00058", "BA9C80", 0 }, // VERBATIM { 14, "C00058", "BA9C80", 0 }, // REGEX { 1, "181880", "BA9C80", 2 }, // COMMENT { 2, "181880", "BA9C80", 2 }, // COMMENT LINE { 3, "181880", "BA9C80", 2 }, // COMMENT DOC { 15, "181880", "BA9C80", 2 }, // COMMENT LINE DOC { 17, "C00058", "BA9C80", 3 }, // COMMENT DOC KEYWORD { 18, "BCBCBC", "5F0000", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_Navajo[] = { { 41, "000000", "BA9C80", 0 }, // DEFAULT { 45, "C00058", "BA9C80", 0 }, // NUMBER { 46, "106060", "BA9C80", 0 }, // WORD { 47, "804040", "BA9C80", 0 }, // KEYWORD { 48, "C00058", "BA9C80", 0 }, // DOUBLESTRING { 49, "C00058", "BA9C80", 0 }, // SINGLESTRING { 50, "000000", "BA9C80", 0 }, // SYMBOLS { 51, "870087", "BA9C80", 0 }, // STRINGEOL { 52, "C00058", "BA9C80", 0 }, // REGEX { 42, "181880", "BA9C80", 2 }, // COMMENT { 43, "181880", "BA9C80", 2 }, // COMMENTLINE { 44, "181880", "BA9C80", 2 }, // COMMENTDOC { 17, "C00058", "BA9C80", 3 }, // COMMENT DOC KEYWORD { 18, "BCBCBC", "5F0000", 3 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle python_Navajo[] = { { 0, "000000", "BA9C80", 0 }, // DEFAULT { 1, "181880", "BA9C80", 2 }, // COMMENTLINE { 2, "C00058", "BA9C80", 0 }, // NUMBER { 3, "C00058", "BA9C80", 0 }, // STRING { 4, "C00058", "BA9C80", 0 }, // CHARACTER { 5, "804040", "BA9C80", 0 }, // KEYWORDS { 6, "C00058", "BA9C80", 0 }, // TRIPLE { 7, "C00058", "BA9C80", 0 }, // TRIPLEDOUBLE { 8, "D92B10", "BA9C80", 0 }, // CLASSNAME { 9, "D92B10", "BA9C80", 0 }, // DEFNAME { 10, "010101", "BA9C80", 1 }, // OPERATOR { 11, "106060", "BA9C80", 0 }, // IDENTIFIER { 12, "181880", "BA9C80", 2 }, // COMMENTBLOCK { 12, "181880", "BA9C80", 0 }, // STRINGEOL }; static const lexstyle ruby_Navajo[] = { { 0, "000000", "BA9C80", 0 }, // DEFAULT { 1, "870087", "BA9C80", 0 }, // ERROR { 2, "181880", "BA9C80", 2 }, // COMMENTLINE { 3, "000000", "BA9C80", 2 }, // POD { 4, "C00058", "BA9C80", 0 }, // NUMBER { 5, "804040", "BA9C80", 0 }, // INSTRUCTION { 6, "C00058", "BA9C80", 0 }, // STRING { 7, "C00058", "BA9C80", 0 }, // CHARACTER { 8, "106060", "BA9C80", 0 }, // CLASS NAME { 9, "C00058", "BA9C80", 0 }, // DEF NAME { 10, "010101", "BA9C80", 1 }, // OPERATOR { 11, "106060", "BA9C80", 0 }, // IDENTIFIER { 12, "C00058", "BA9C80", 0 }, // REGEX { 13, "106060", "BA9C80", 0 }, // GLOBAL { 14, "000000", "BA9C80", 0 }, // SYMBOL { 15, "D92B10", "BA9C80", 0 }, // MODULE NAME { 16, "106060", "BA9C80", 0 }, // INSTANCE VAR { 17, "000000", "BA9C80", 0 }, // CLASS VAR { 18, "C00058", "CDB38B", 0 }, // BACKTICKS { 19, "C00058", "BA9C80", 0 }, // DATA SECTION { 24, "C00058", "BA9C80", 0 }, // STRING Q { 25, "C00058", "BA9C80", 0 }, // BOOLEAN }; static const lexstyle global_NotepadPlusPlus[] = { { 32, "000000", "FFFFFF", 0 }, // Default Style { 37, "C0C0C0", "FFFFFF", 0 }, // Indent guideline style { 34, "FF0000", "FFFFFF", 1 }, // Brace highlight style { 35, "800000", "FFFFFF", 0 }, // Bad brace colour { 2069, "8000FF", "FFFFFF", 0 }, // Caret colour { 33, "808080", "E4E4E4", 0 }, // Line number margin { 29, "000000", "00FF00", 0 }, // Smart HighLighting { 31, "000000", "FF0000", 0 }, // Find Mark Style { 25, "000000", "00FFFF", 0 }, // Mark Style 1 { 24, "000000", "FF8000", 0 }, // Mark Style 2 { 23, "000000", "FFFF00", 0 }, // Mark Style 3 { 22, "000000", "8000FF", 0 }, // Mark Style 4 { 21, "000000", "008000", 0 }, // Mark Style 5 { 28, "000000", "0080FF", 0 }, // Incremental highlight all { 27, "000000", "8000FF", 0 }, // Tags match highlighting { 26, "000000", "FFFF00", 0 }, // Tags attribute }; static const lexstyle cpp_NotepadPlusPlus[] = { { 9, "804000", "FFFFFF", 0 }, // PREPROCESSOR { 11, "000000", "FFFFFF", 0 }, // DEFAULT { 5, "0000FF", "FFFFFF", 1 }, // INSTRUCTION WORD { 16, "8000FF", "FFFFFF", 0 }, // TYPE WORD { 4, "FF8000", "FFFFFF", 0 }, // NUMBER { 6, "808080", "FFFFFF", 0 }, // STRING { 7, "808080", "FFFFFF", 0 }, // CHARACTER { 10, "000080", "FFFFFF", 1 }, // OPERATOR { 13, "000000", "FFFFFF", 0 }, // VERBATIM { 14, "000000", "FFFFFF", 1 }, // REGEX { 1, "008000", "FFFFFF", 0 }, // COMMENT { 2, "008000", "FFFFFF", 0 }, // COMMENT LINE { 3, "008080", "FFFFFF", 0 }, // COMMENT DOC { 15, "008080", "FFFFFF", 0 }, // COMMENT LINE DOC { 17, "008080", "FFFFFF", 1 }, // COMMENT DOC KEYWORD { 18, "008080", "FFFFFF", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle java_NotepadPlusPlus[] = { { 9, "804000", "FFFFFF", 0 }, // PREPROCESSOR { 11, "000000", "FFFFFF", 0 }, // DEFAULT { 5, "0000FF", "FFFFFF", 1 }, // INSTRUCTION WORD { 16, "8000FF", "FFFFFF", 0 }, // TYPE WORD { 4, "FF8000", "FFFFFF", 0 }, // NUMBER { 6, "808080", "FFFFFF", 0 }, // STRING { 7, "808080", "FFFFFF", 0 }, // CHARACTER { 10, "000080", "FFFFFF", 1 }, // OPERATOR { 13, "000000", "FFFFFF", 0 }, // VERBATIM { 14, "000000", "FFFFFF", 1 }, // REGEX { 1, "008000", "FFFFFF", 0 }, // COMMENT { 2, "008000", "FFFFFF", 0 }, // COMMENT LINE { 3, "008080", "FFFFFF", 0 }, // COMMENT DOC { 15, "008080", "FFFFFF", 0 }, // COMMENT LINE DOC { 17, "008080", "FFFFFF", 1 }, // COMMENT DOC KEYWORD { 18, "008080", "FFFFFF", 0 }, // COMMENT DOC KEYWORD ERROR }; static const lexstyle javascript_NotepadPlusPlus[] = { { 41, "000000", "F2F4FF", 0 }, // DEFAULT { 45, "FF0000", "F2F4FF", 0 }, // NUMBER { 46, "000000", "F2F4FF", 0 }, // WORD { 47, "000080", "F2F4FF", 3 }, // KEYWORD { 48, "808080", "F2F4FF", 0 }, // DOUBLESTRING { 49, "808080", "F2F4FF", 0 }, // SINGLESTRING { 50, "000000", "F2F4FF", 1 }, // SYMBOLS { 52, "8000FF", "F2F4FF", 0 }, // REGEX { 42, "008000", "F2F4FF", 0 }, // COMMENT { 43, "008000", "F2F4FF", 0 }, // COMMENTLINE { 44, "008080", "F2F4FF", 0 }, // COMMENTDOC }; static const lexstyle python_NotepadPlusPlus[] = { { 0, "000000", "FFFFFF", 0 }, // DEFAULT { 1, "008000", "FFFFFF", 0 }, // COMMENTLINE { 2, "FF0000", "FFFFFF", 0 }, // NUMBER { 3, "808080", "FFFFFF", 0 }, // STRING { 4, "808080", "FFFFFF", 0 }, // CHARACTER { 5, "0000FF", "FFFFFF", 1 }, // KEYWORDS { 6, "FF8000", "FFFFFF", 0 }, // TRIPLE { 7, "FF8000", "FFFFFF", 0 }, // TRIPLEDOUBLE { 8, "000000", "FFFFFF", 1 }, // CLASSNAME { 9, "FF00FF", "FFFFFF", 0 }, // DEFNAME { 10, "000080", "FFFFFF", 1 }, // OPERATOR { 11, "000000", "FFFFFF", 0 }, // IDENTIFIER { 12, "008000", "FFFFFF", 0 }, // COMMENTBLOCK }; static const lexstyle ruby_NotepadPlusPlus[] = { { 0, "000000", "FFFFFF", 0 }, // DEFAULT { 1, "000000", "FFFFFF", 0 }, // ERROR { 2, "008000", "FFFFFF", 0 }, // COMMENTLINE { 3, "004000", "C0FFC0", 0 }, // POD { 4, "FF8000", "FFFFFF", 0 }, // NUMBER { 5, "0000FF", "FFFFFF", 1 }, // INSTRUCTION { 6, "808080", "FFFFFF", 0 }, // STRING { 7, "808000", "FFFFFF", 0 }, // CHARACTER { 8, "0080C0", "FFFFFF", 1 }, // CLASS NAME { 9, "8080FF", "FFFFCC", 1 }, // DEF NAME { 10, "000080", "FFFFFF", 1 }, // OPERATOR { 11, "000000", "FFFFFF", 0 }, // IDENTIFIER { 12, "0080FF", "FFFFFF", 0 }, // REGEX { 13, "000080", "FFFFFF", 1 }, // GLOBAL { 14, "000000", "FFFFFF", 0 }, // SYMBOL { 15, "804000", "FFFFFF", 1 }, // MODULE NAME { 16, "000000", "FFFFFF", 0 }, // INSTANCE VAR { 17, "000000", "FFFFFF", 0 }, // CLASS VAR { 18, "FFFF00", "A08080", 0 }, // BACKTICKS { 19, "600000", "FFF0D8", 0 }, // DATA SECTION { 24, "808080", "FFFFFF", 0 }, // STRING Q }; static const langstyle cppstyle[] = { { "Monokai", "F8F8F2", "272822", "3E3D32", "EEEEEC", cpp_Monokai, global_Monokai, 16, 17 }, { "Vibrant Ink", "FFFFFF", "000000", "333333", "E4E4E4", cpp_Vibrant_Ink, global_Vibrant_Ink, 16, 17 }, { "Solarized light", "657B83", "FDF6E3", "EEE8D5", "93A1A1", cpp_Solarized_light, global_Solarized_light, 16, 16 }, { "Twilight", "F8F8F8", "141414", "292929", "EEEEEC", cpp_Twilight, global_Twilight, 16, 17 }, { "vim Dark Blue", "FFFFFF", "000040", "000040", "FFFFFF", cpp_vim_Dark_Blue, global_vim_Dark_Blue, 16, 11 }, { "Deep Black", "FFFFFF", "000000", "333333", "C0C0C0", cpp_Deep_Black, global_Deep_Black, 16, 11 }, { "Mono Industrial", "FFFFFF", "222C28", "2C3833", "EEEEEC", cpp_Mono_Industrial, global_Mono_Industrial, 16, 17 }, { "Ruby Blue", "FFFFFF", "112435", "273A4B", "FFFFFF", cpp_Ruby_Blue, global_Ruby_Blue, 16, 17 }, { "Choco", "C3BE98", "1A0F0B", "281711", "EEEEEC", cpp_Choco, global_Choco, 16, 17 }, { "khaki", "5f5f00", "d7d7af", "afaf87", "5f5f00", cpp_khaki, global_khaki, 16, 16 }, { "Bespin", "F8F8F8", "2A211C", "4B3C34", "E5C138", cpp_Bespin, global_Bespin, 16, 17 }, { "Zenburn", "DCDCCC", "3F3F3F", "101010", "8A8A8A", cpp_Zenburn, global_Zenburn, 16, 16 }, { "Plastic Code Wrap", "F8F8F8", "0B161D", "11222D", "EEEEEC", cpp_Plastic_Code_Wrap, global_Plastic_Code_Wrap, 16, 17 }, { "Solarized", "839496", "002B36", "073642", "586E75", cpp_Solarized, global_Solarized, 16, 16 }, { "Hello Kitty", "000000", "FFB0FF", "FF80C0", "FFFFFF", cpp_Hello_Kitty, global_Hello_Kitty, 16, 16 }, { "HotFudgeSundae", "B7975D", "2b0f01", "432c13", "8B642B", cpp_HotFudgeSundae, global_HotFudgeSundae, 16, 16 }, { "Black board", "F8F8F8", "0C1021", "121830", "EEEEEC", cpp_Black_board, global_Black_board, 16, 17 }, { "MossyLawn", "f2c476", "6c7d51", "858e4d", "603d13", cpp_MossyLawn, global_MossyLawn, 16, 16 }, { "Obsidian", "E0E2E4", "293134", "2F393C", "81969A", cpp_Obsidian, global_Obsidian, 16, 16 }, { "Eclipse Default", "000000", "FFFFFF", "E8F2FE", "808080", cpp_Eclipse_Default, global_Eclipse_Default, 16, 11 }, { "Navajo", "000000", "BA9C80", "B39674", "000000", cpp_Navajo, global_Navajo, 16, 16 }, { "NotepadPlusPlus", "000000", "FFFFFF", "E8E8FF", "808080", cpp_NotepadPlusPlus, global_NotepadPlusPlus, 16, 16 }, { NULL, NULL, NULL, 0 } }; static const langstyle javastyle[] = { { "Monokai", "F8F8F2", "272822", "3E3D32", "EEEEEC", java_Monokai, global_Monokai, 16, 17 }, { "Vibrant Ink", "FFFFFF", "000000", "333333", "E4E4E4", java_Vibrant_Ink, global_Vibrant_Ink, 16, 17 }, { "Solarized light", "657B83", "FDF6E3", "EEE8D5", "93A1A1", java_Solarized_light, global_Solarized_light, 16, 16 }, { "Twilight", "F8F8F8", "141414", "292929", "EEEEEC", java_Twilight, global_Twilight, 16, 17 }, { "vim Dark Blue", "FFFFFF", "000040", "000040", "FFFFFF", java_vim_Dark_Blue, global_vim_Dark_Blue, 16, 11 }, { "Deep Black", "FFFFFF", "000000", "333333", "C0C0C0", java_Deep_Black, global_Deep_Black, 16, 11 }, { "Mono Industrial", "FFFFFF", "222C28", "2C3833", "EEEEEC", java_Mono_Industrial, global_Mono_Industrial, 16, 17 }, { "Ruby Blue", "FFFFFF", "112435", "273A4B", "FFFFFF", java_Ruby_Blue, global_Ruby_Blue, 16, 17 }, { "Choco", "C3BE98", "1A0F0B", "281711", "EEEEEC", java_Choco, global_Choco, 16, 17 }, { "khaki", "5f5f00", "d7d7af", "afaf87", "5f5f00", java_khaki, global_khaki, 16, 16 }, { "Bespin", "F8F8F8", "2A211C", "4B3C34", "E5C138", java_Bespin, global_Bespin, 16, 17 }, { "Zenburn", "DCDCCC", "3F3F3F", "101010", "8A8A8A", java_Zenburn, global_Zenburn, 16, 16 }, { "Plastic Code Wrap", "F8F8F8", "0B161D", "11222D", "EEEEEC", java_Plastic_Code_Wrap, global_Plastic_Code_Wrap, 16, 17 }, { "Solarized", "839496", "002B36", "073642", "586E75", java_Solarized, global_Solarized, 16, 16 }, { "Hello Kitty", "000000", "FFB0FF", "FF80C0", "FFFFFF", java_Hello_Kitty, global_Hello_Kitty, 16, 16 }, { "HotFudgeSundae", "B7975D", "2b0f01", "432c13", "8B642B", java_HotFudgeSundae, global_HotFudgeSundae, 16, 16 }, { "Black board", "F8F8F8", "0C1021", "121830", "EEEEEC", java_Black_board, global_Black_board, 16, 17 }, { "MossyLawn", "f2c476", "6c7d51", "858e4d", "603d13", java_MossyLawn, global_MossyLawn, 16, 16 }, { "Obsidian", "E0E2E4", "293134", "2F393C", "81969A", java_Obsidian, global_Obsidian, 16, 16 }, { "Eclipse Default", "000000", "FFFFFF", "E8F2FE", "808080", java_Eclipse_Default, global_Eclipse_Default, 16, 11 }, { "Navajo", "000000", "BA9C80", "B39674", "000000", java_Navajo, global_Navajo, 16, 16 }, { "NotepadPlusPlus", "000000", "FFFFFF", "E8E8FF", "808080", java_NotepadPlusPlus, global_NotepadPlusPlus, 16, 16 }, { NULL, NULL, NULL, 0 } }; static const langstyle pythonstyle[] = { { "Monokai", "F8F8F2", "272822", "3E3D32", "EEEEEC", python_Monokai, global_Monokai, 14, 17 }, { "Vibrant Ink", "FFFFFF", "000000", "333333", "E4E4E4", python_Vibrant_Ink, global_Vibrant_Ink, 14, 17 }, { "Solarized light", "657B83", "FDF6E3", "EEE8D5", "93A1A1", python_Solarized_light, global_Solarized_light, 14, 16 }, { "Twilight", "F8F8F8", "141414", "292929", "EEEEEC", python_Twilight, global_Twilight, 14, 17 }, { "vim Dark Blue", "FFFFFF", "000040", "000040", "FFFFFF", python_vim_Dark_Blue, global_vim_Dark_Blue, 14, 11 }, { "Deep Black", "FFFFFF", "000000", "333333", "C0C0C0", python_Deep_Black, global_Deep_Black, 14, 11 }, { "Mono Industrial", "FFFFFF", "222C28", "2C3833", "EEEEEC", python_Mono_Industrial, global_Mono_Industrial, 14, 17 }, { "Ruby Blue", "FFFFFF", "112435", "273A4B", "FFFFFF", python_Ruby_Blue, global_Ruby_Blue, 14, 17 }, { "Choco", "C3BE98", "1A0F0B", "281711", "EEEEEC", python_Choco, global_Choco, 14, 17 }, { "khaki", "5f5f00", "d7d7af", "afaf87", "5f5f00", python_khaki, global_khaki, 14, 16 }, { "Bespin", "F8F8F8", "2A211C", "4B3C34", "E5C138", python_Bespin, global_Bespin, 14, 17 }, { "Zenburn", "DCDCCC", "3F3F3F", "101010", "8A8A8A", python_Zenburn, global_Zenburn, 13, 16 }, { "Plastic Code Wrap", "F8F8F8", "0B161D", "11222D", "EEEEEC", python_Plastic_Code_Wrap, global_Plastic_Code_Wrap, 14, 17 }, { "Solarized", "839496", "002B36", "073642", "586E75", python_Solarized, global_Solarized, 14, 16 }, { "Hello Kitty", "000000", "FFB0FF", "FF80C0", "FFFFFF", python_Hello_Kitty, global_Hello_Kitty, 14, 16 }, { "HotFudgeSundae", "B7975D", "2b0f01", "432c13", "8B642B", python_HotFudgeSundae, global_HotFudgeSundae, 14, 16 }, { "Black board", "F8F8F8", "0C1021", "121830", "EEEEEC", python_Black_board, global_Black_board, 14, 17 }, { "MossyLawn", "f2c476", "6c7d51", "858e4d", "603d13", python_MossyLawn, global_MossyLawn, 14, 16 }, { "Obsidian", "E0E2E4", "293134", "2F393C", "81969A", python_Obsidian, global_Obsidian, 14, 16 }, { "Eclipse Default", "000000", "FFFFFF", "E8F2FE", "808080", python_Eclipse_Default, global_Eclipse_Default, 14, 11 }, { "Navajo", "000000", "BA9C80", "B39674", "000000", python_Navajo, global_Navajo, 14, 16 }, { "NotepadPlusPlus", "000000", "FFFFFF", "E8E8FF", "808080", python_NotepadPlusPlus, global_NotepadPlusPlus, 13, 16 }, { NULL, NULL, NULL, 0 } }; static const langstyle rubystyle[] = { { "Monokai", "F8F8F2", "272822", "3E3D32", "EEEEEC", ruby_Monokai, global_Monokai, 21, 17 }, { "Vibrant Ink", "FFFFFF", "000000", "333333", "E4E4E4", ruby_Vibrant_Ink, global_Vibrant_Ink, 21, 17 }, { "Solarized light", "657B83", "FDF6E3", "EEE8D5", "93A1A1", ruby_Solarized_light, global_Solarized_light, 22, 16 }, { "Twilight", "F8F8F8", "141414", "292929", "EEEEEC", ruby_Twilight, global_Twilight, 21, 17 }, { "vim Dark Blue", "FFFFFF", "000040", "000040", "FFFFFF", ruby_vim_Dark_Blue, global_vim_Dark_Blue, 21, 11 }, { "Deep Black", "FFFFFF", "000000", "333333", "C0C0C0", ruby_Deep_Black, global_Deep_Black, 21, 11 }, { "Mono Industrial", "FFFFFF", "222C28", "2C3833", "EEEEEC", ruby_Mono_Industrial, global_Mono_Industrial, 21, 17 }, { "Ruby Blue", "FFFFFF", "112435", "273A4B", "FFFFFF", ruby_Ruby_Blue, global_Ruby_Blue, 21, 17 }, { "Choco", "C3BE98", "1A0F0B", "281711", "EEEEEC", ruby_Choco, global_Choco, 21, 17 }, { "khaki", "5f5f00", "d7d7af", "afaf87", "5f5f00", ruby_khaki, global_khaki, 22, 16 }, { "Bespin", "F8F8F8", "2A211C", "4B3C34", "E5C138", ruby_Bespin, global_Bespin, 21, 17 }, { "Zenburn", "DCDCCC", "3F3F3F", "101010", "8A8A8A", ruby_Zenburn, global_Zenburn, 21, 16 }, { "Plastic Code Wrap", "F8F8F8", "0B161D", "11222D", "EEEEEC", ruby_Plastic_Code_Wrap, global_Plastic_Code_Wrap, 21, 17 }, { "Solarized", "839496", "002B36", "073642", "586E75", ruby_Solarized, global_Solarized, 22, 16 }, { "Hello Kitty", "000000", "FFB0FF", "FF80C0", "FFFFFF", ruby_Hello_Kitty, global_Hello_Kitty, 21, 16 }, { "HotFudgeSundae", "B7975D", "2b0f01", "432c13", "8B642B", ruby_HotFudgeSundae, global_HotFudgeSundae, 22, 16 }, { "Black board", "F8F8F8", "0C1021", "121830", "EEEEEC", ruby_Black_board, global_Black_board, 21, 17 }, { "MossyLawn", "f2c476", "6c7d51", "858e4d", "603d13", ruby_MossyLawn, global_MossyLawn, 22, 16 }, { "Obsidian", "E0E2E4", "293134", "2F393C", "81969A", ruby_Obsidian, global_Obsidian, 21, 16 }, { "Eclipse Default", "000000", "FFFFFF", "E8F2FE", "808080", ruby_Eclipse_Default, global_Eclipse_Default, 21, 11 }, { "Navajo", "000000", "BA9C80", "B39674", "000000", ruby_Navajo, global_Navajo, 22, 16 }, { "NotepadPlusPlus", "000000", "FFFFFF", "E8E8FF", "808080", ruby_NotepadPlusPlus, global_NotepadPlusPlus, 21, 16 }, { NULL, NULL, NULL, 0 } }; static const langstyle javascriptstyle[] = { { "Monokai", "F8F8F2", "272822", "3E3D32", "EEEEEC", javascript_Monokai, global_Monokai, 12, 17 }, { "Vibrant Ink", "FFFFFF", "000000", "333333", "E4E4E4", javascript_Vibrant_Ink, global_Vibrant_Ink, 12, 17 }, { "Solarized light", "657B83", "FDF6E3", "EEE8D5", "93A1A1", javascript_Solarized_light, global_Solarized_light, 14, 16 }, { "Twilight", "F8F8F8", "141414", "292929", "EEEEEC", javascript_Twilight, global_Twilight, 12, 17 }, { "vim Dark Blue", "FFFFFF", "000040", "000040", "FFFFFF", javascript_vim_Dark_Blue, global_vim_Dark_Blue, 12, 11 }, { "Deep Black", "FFFFFF", "000000", "333333", "C0C0C0", javascript_Deep_Black, global_Deep_Black, 12, 11 }, { "Mono Industrial", "FFFFFF", "222C28", "2C3833", "EEEEEC", javascript_Mono_Industrial, global_Mono_Industrial, 12, 17 }, { "Ruby Blue", "FFFFFF", "112435", "273A4B", "FFFFFF", javascript_Ruby_Blue, global_Ruby_Blue, 12, 17 }, { "Choco", "C3BE98", "1A0F0B", "281711", "EEEEEC", javascript_Choco, global_Choco, 12, 17 }, { "khaki", "5f5f00", "d7d7af", "afaf87", "5f5f00", javascript_khaki, global_khaki, 14, 16 }, { "Bespin", "BDAF9D", "2A211C", "4B3C34", "E5C138", javascript_Bespin, global_Bespin, 15, 17 }, { "Zenburn", "DCDCCC", "3F3F3F", "101010", "8A8A8A", javascript_Zenburn, global_Zenburn, 11, 16 }, { "Plastic Code Wrap", "F8F8F8", "0B161D", "11222D", "EEEEEC", javascript_Plastic_Code_Wrap, global_Plastic_Code_Wrap, 12, 17 }, { "Solarized", "839496", "002B36", "073642", "586E75", javascript_Solarized, global_Solarized, 14, 16 }, { "Hello Kitty", "000000", "F2F4FF", "FF80C0", "FFFFFF", javascript_Hello_Kitty, global_Hello_Kitty, 12, 16 }, { "HotFudgeSundae", "B7975D", "2b0f01", "432c13", "8B642B", javascript_HotFudgeSundae, global_HotFudgeSundae, 14, 16 }, { "Black board", "F8F8F8", "0C1021", "121830", "EEEEEC", javascript_Black_board, global_Black_board, 12, 17 }, { "MossyLawn", "f2c476", "6c7d51", "858e4d", "603d13", javascript_MossyLawn, global_MossyLawn, 14, 16 }, { "Obsidian", "E0E2E4", "293134", "2F393C", "81969A", javascript_Obsidian, global_Obsidian, 12, 16 }, { "Eclipse Default", "000000", "FFFFFF", "E8F2FE", "808080", javascript_Eclipse_Default, global_Eclipse_Default, 12, 11 }, { "Navajo", "000000", "BA9C80", "B39674", "000000", javascript_Navajo, global_Navajo, 14, 16 }, { "NotepadPlusPlus", "000000", "F2F4FF", "E8E8FF", "808080", javascript_NotepadPlusPlus, global_NotepadPlusPlus, 11, 16 }, { NULL, NULL, NULL, 0 } }; ================================================ FILE: gui/translations/codequery_de.ts ================================================ DialogGraph Graph Diagramm Please wait ... Bitte warten... Zoom Out Verkleinern Zoom In Vergrößern Number of levels: Anzahl der Ebenen: Save to DOT file Als DOT-Datei speichern Save Image Bild speichern Close Schließen MainWindow CodeQuery CodeQuery Open Database Datenbank öffnen Auto-complete Automatische Vervollständigung Exact match Genaue Übereinstimmung File path filter Dateipfadfilter Filter Filter File path filter, wildcard searches (* and ?) are supported Dateipfadfilter, Platzhaltersuchen (* und ?) werden unterstützt Previous search term Vorheriger Suchbegriff Next search term Nächster Suchbegriff If Exact Match is switched off, wildcard searches (* and ?) are supported Wenn "Genaue Übereinstimmung" ausgeschaltet ist, werden Platzhaltersuchen (* und ?) unterstützt Search Suche Paste and Search Einfügen und suchen List of all files Liste aller Dateien Draw graph Diagramm zeichnen Previous File Vorherige Datei Next File Nächste Datei Open in Editor In Editor öffnen Go to selected line Zur ausgewählten Zeile gehen Reduce font size Schriftgrad verkleinern Increase font size Schriftgrad erhöhen Copy, paste and search Kopieren, einfügen und suchen Symbol search only for paste and search Einfügen und Suchen auf Symbolsuche einschränken Symbol only Nur Symbol Previous search result in this file Vorheriges Suchergebnis in dieser Datei Next search result in this file Nächstes Suchergebnis in dieser Datei FilePath:0 Dateipfad:0 Sort by line number Nach Zeilennummer sortieren Sort by name Nach Namen sortieren File Datei Options Optionen Help Hilfe Exit Beenden Open Offene About Über External Editor Externer Editor Open CQ Database CQ-Datenbank öffnen Language Sprache About Qt Über Qt File Viewer Settings Dateibetrachter Einstellungen aboutDialog About CodeQuery Über CodeQuery OK Okay cqDialogGraph Images Bilder Export Image Bild exportieren File could not be saved! Datei konnte nicht gespeichert werden! Export DOT file DOT-Datei exportieren fileViewSettingsDialog File Viewer Settings Dateibetrachter Einstellungen Font Schriftart Syntax highlight theme Syntaxhervorhebung Farbthema Tab Width (number of spaces) Tabstoppweite (Anzahl der Leerzeichen) Cancel Abbrechen OK Okay fileviewer File not found Datei nicht gefunden File could not be opened Datei konnte nicht geöffnet werden The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. Die Quelldatei, die angezeigt werden soll, ist neuer als die CodeQuery-Datenbankdatei. Wir empfehlen, die CodeQuery-Datenbankdatei manuell zu regenerieren. Cancel Abbrechen OK Okay External Editor Configuration Konfiguration externer Editor Please enter the path and arguments for the external editor. Replace as follows: Bitte geben Sie den Pfad und die Argumente für den externen Editor ein. Wie folgt ersetzen: for file path für Dateipfad for line number für Zeilennummer For example: Zum Beispiel: File could not be opened! Datei konnte nicht geöffnet werden! External editor could not be started. Please check Options! Externer Editor konnte nicht gestartet werden. Bitte überprüfen Sie die Optionen! listhandler Symbol Symbol File Datei Line Linie Preview Vorschau mainwindow Cancel Abbrechen OK Okay Language Sprache Select language: Sprache auswählen: searchhandler Symbol Symbol Function or macro definition (Graph available) Funktion oder ein Makro-Definition (Diagramm verfügbar) Class or struct (Graph available) Klasse oder Struktur (Diagramm verfügbar) Functions calling this function Funktionen, die diese Funktion aufrufen Functions called by this function Von dieser Funktion aufgerufene Funktionen Calls of this function or macro Aufrufe dieser Funktion oder dieses Makros Class which owns this member or method Klasse, die dieses Klassenmitglied oder die Methode besitzt Members or methods of this class Klassenmitglieder oder Methoden dieser Klasse Parent of this class Basisklasse dieser Klasse Children of this class Abgeleitete Klassen dieser Klasse Files including this file Dateien, die diese Datei einbinden Full path for file Vollständiger Pfad für Datei Functions or macros inside this file Funktionen oder Makros in dieser Datei CodeQuery DB Files CodeQuery DB Dateien Open CQ database file CQ-Datenbankdatei öffnen Function Call Graph Funktionsaufruf-Diagramm Class Inheritance Graph Klassen-Vererbungs-Diagramm If Exact Match is switched off, wildcard searches (* and ?) are supported Wenn "Genaue Übereinstimmung" ausgeschaltet ist, werden Platzhaltersuchen (* und ?) unterstützt results found Treffer gefunden in progress in Bearbeitung Cancel Abbrechen You have to first select an item from the list before pushing the Graph button. Du musst zuerst ein Element aus der Liste auswählen, bevor die Schaltfläche "Diagramm zeichnen" verwendet werden kann. File open error Fehler beim Öffnen der Datei Wrong file format Falsches Dateiformat Incorrect CQ database version Falsche CQ-Datenbankversion OK Okay Unknown Error Unbekannter Fehler ================================================ FILE: gui/translations/codequery_en.ts ================================================ DialogGraph Graph Please wait ... Zoom Out Zoom In Number of levels: Save to DOT file Save Image Close MainWindow CodeQuery Open Database Auto-complete Exact match File path filter Filter File path filter, wildcard searches (* and ?) are supported Previous search term Next search term If Exact Match is switched off, wildcard searches (* and ?) are supported Search Paste and Search List of all files Draw graph Previous File Next File Open in Editor Go to selected line Reduce font size Increase font size Copy, paste and search Symbol search only for paste and search Symbol only Previous search result in this file Next search result in this file FilePath:0 Sort by line number Sort by name File Options Help Exit Open About External Editor Open CQ Database Language About Qt File Viewer Settings aboutDialog About CodeQuery OK cqDialogGraph Images Export Image File could not be saved! Export DOT file fileViewSettingsDialog File Viewer Settings Font Syntax highlight theme Tab Width (number of spaces) Cancel OK fileviewer File not found File could not be opened The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. Cancel OK External Editor Configuration Please enter the path and arguments for the external editor. Replace as follows: for file path for line number For example: File could not be opened! External editor could not be started. Please check Options! listhandler Symbol File Line Preview mainwindow Cancel OK Language Select language: searchhandler Symbol Function or macro definition (Graph available) Class or struct (Graph available) Functions calling this function Functions called by this function Calls of this function or macro Class which owns this member or method Members or methods of this class Parent of this class Children of this class Files including this file Full path for file Functions or macros inside this file CodeQuery DB Files Open CQ database file Function Call Graph Class Inheritance Graph If Exact Match is switched off, wildcard searches (* and ?) are supported results found in progress Cancel You have to first select an item from the list before pushing the Graph button. File open error Wrong file format Incorrect CQ database version OK Unknown Error ================================================ FILE: gui/translations/codequery_es.ts ================================================ DialogGraph Graph Gráfico Please wait ... Espera... Zoom Out Alejar Zoom In Zoom Number of levels: Número de niveles: Save to DOT file Guardar en un archivo de punto Save Image Guardar imagen Close Cerrar MainWindow CodeQuery CodeQuery Open Database Base de datos abierta Auto-complete Completar automáticamente Exact match Coincidencia exacta File path filter Filtro de ruta de archivo Filter Filtro File path filter, wildcard searches (* and ?) are supported Filtro de ruta de acceso de archivo, búsquedas de comodín (* y?) son compatibles Previous search term Término de búsqueda anterior Next search term Al término de la búsqueda If Exact Match is switched off, wildcard searches (* and ?) are supported Si está apagado coincidencia exacta, búsquedas de comodín (* y?) son compatibles Search Búsqueda Paste and Search Pasta y búsqueda List of all files lista de todos los archivos Draw graph Gráfica Previous File Archivo anterior Next File Siguiente archivo Open in Editor Abierto en el Editor Go to selected line Ir a la línea seleccionada Reduce font size Reducir el tamaño de la fuente Increase font size Aumentar tamaño de fuente Copy, paste and search Copiar, pegar y buscar Symbol search only for paste and search Búsqueda de símbolo sólo para pasta y búsqueda Symbol only Símbolo sólo Previous search result in this file Resultado de la búsqueda anterior en este archivo Next search result in this file A continuación resultados de la búsqueda en este archivo FilePath:0 FilePath:0 Sort by line number Ordenar por número de línea Sort by name Ordenar por nombre File Archivo Options Opciones Help Ayuda Exit Salida Open Abierto About Acerca de External Editor Editor externo Open CQ Database Base de datos abierta CQ Language Idioma About Qt Acerca de Qt File Viewer Settings Configuraciones de visor de archivos aboutDialog About CodeQuery Acerca de CodeQuery OK Vale cqDialogGraph Images Imágenes Export Image Exportar imagen File could not be saved! No se han podido guardar archivo! Export DOT file Archivo de punto de exportación fileViewSettingsDialog File Viewer Settings Configuraciones de visor de archivos Font Fuente Syntax highlight theme Tema de resaltado de sintaxis Tab Width (number of spaces) Ficha anchura (número de espacios) Cancel Cancelar OK Vale fileviewer File not found Archivo no encontrado File could not be opened No se pudo abrir el archivo The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. El archivo de origen para ser visto es más reciente que el archivo de base de datos de CodeQuery. Se recomienda para regenerar manualmente el archivo de base de datos de CodeQuery. Cancel Cancelar OK Vale External Editor Configuration Configuración del Editor externo Please enter the path and arguments for the external editor. Replace as follows: Por favor ingrese la ruta y argumentos para el editor externo. Reemplace como sigue: for file path para la ruta del archivo for line number para el número de línea For example: Por ejemplo: File could not be opened! No se pudo abrir el archivo! External editor could not be started. Please check Options! No se pudo iniciar el editor externo. Consulte Opciones! listhandler Symbol Símbolo File Archivo Line Línea Preview Vista previa mainwindow Cancel Cancelar OK Vale Language Idioma Select language: Seleccionar idioma: searchhandler Symbol Símbolo Function or macro definition (Graph available) Definición de función o macro (gráfico disponible) Class or struct (Graph available) Clase o estructura (gráfico disponible) Functions calling this function Funciones llamar a esta función Functions called by this function Funciones de llamada por esta función Calls of this function or macro Llamadas de esta función o macro Class which owns this member or method Clase que posee este miembro o método Members or methods of this class Miembros o métodos de esta clase Parent of this class Padres de esta clase Children of this class Niños de esta clase Files including this file Archivos incluyendo este archivo Full path for file Ruta de acceso completa de archivo Functions or macros inside this file Funciones o macros dentro de este archivo CodeQuery DB Files CodeQuery DB archivos Open CQ database file Abrir archivo de base de datos de CQ Function Call Graph Gráfico de la llamada de función Class Inheritance Graph Gráfico de la herencia de clase If Exact Match is switched off, wildcard searches (* and ?) are supported Si está apagado coincidencia exacta, búsquedas de comodín (* y?) son compatibles results found se han encontrado resultados in progress en progreso Cancel Cancelar You have to first select an item from the list before pushing the Graph button. Tienes que seleccionar primero un elemento de la lista antes de presionar el botón gráfico. File open error Error de archivo abierto Wrong file format Formato de archivo incorrecto Incorrect CQ database version Versión incorrecta de la base de datos de CQ OK Vale Unknown Error Error desconocido ================================================ FILE: gui/translations/codequery_fr.ts ================================================ DialogGraph Graph Graphique Please wait ... Veuillez patienter... Zoom Out Effectuer un zoom arrière Zoom In Effectuez un zoom avant Number of levels: Nombre de niveaux: Save to DOT file Enregistrer dans fichier DOT Save Image Enregistrer l'Image Close Fermer MainWindow CodeQuery CodeQuery Open Database Base de données ouverte Auto-complete Semi-automatique Exact match Correspondance exacte File path filter Filtre de chemin de fichier Filter Filtre File path filter, wildcard searches (* and ?) are supported Filtre de chemin d'accès de fichier, les recherches génériques (* et?) sont pris en charge Previous search term Terme de la recherche précédente Next search term Prochain mandat de recherche If Exact Match is switched off, wildcard searches (* and ?) are supported Si une correspondance exacte déconnexion, recherches génériques (* et?) sont pris en charge Search Rechercher Paste and Search Pâte et recherche List of all files liste de tous les fichiers Draw graph Tracer graphique Previous File Fichier précédent Next File Fichier suivant Open in Editor Ouvert dans l'éditeur Go to selected line Aller à la ligne sélectionnée Reduce font size Réduire la taille de police Increase font size Augmenter la taille de police Copy, paste and search Copier, coller et Rechercher Symbol search only for paste and search Recherche de symbole que pour la pâte et de la recherche Symbol only Symbole seulement Previous search result in this file Résultat de la recherche précédente dans ce fichier Next search result in this file Résultat de la recherche suivante dans ce fichier FilePath:0 FilePath:0 Sort by line number Trier par numéro de ligne Sort by name Trier par nom File Fichier Options Options Help Aide Exit Sortie Open Ouvert About Sur External Editor External Editor Open CQ Database Base de données ouverte CQ Language Langue About Qt Sur Qt File Viewer Settings Paramètres de visionneuse de fichiers aboutDialog About CodeQuery Sur CodeQuery OK Bien cqDialogGraph Images Images Export Image Exporter Image File could not be saved! Fichier n'a pas pu être sauvé ! Export DOT file Exporter fichier DOT fileViewSettingsDialog File Viewer Settings Paramètres de visionneuse de fichiers Font Polices Syntax highlight theme Thème de point culminant de syntaxe Tab Width (number of spaces) Onglet largeur (nombre de places) Cancel Annuler OK Bien fileviewer File not found Fichier non trouvé File could not be opened Fichier n'a pas pu être ouvert The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. Le fichier source à afficher est plus récent que le fichier de base de données CodeQuery. Il est conseillé de régénérer manuellement le fichier de base de données CodeQuery. Cancel Annuler OK Bien External Editor Configuration Configuration de l'éditeur externe Please enter the path and arguments for the external editor. Replace as follows: Veuillez entrer le chemin d'accès et les arguments de l'éditeur externe. Remplacer comme suit : for file path pour le chemin du fichier for line number pour le numéro de ligne For example: Par exemple : File could not be opened! Fichier n'a pas pu être ouvert ! External editor could not be started. Please check Options! Éditeur externe n'a pas pu être démarré. Vérifiez les Options ! listhandler Symbol Symbole File Fichier Line Ligne Preview Aperçu mainwindow Cancel Annuler OK Bien Language Langue Select language: Sélectionner une langue: searchhandler Symbol Symbole Function or macro definition (Graph available) Définition de fonction ou de la macro (graphique disponible) Class or struct (Graph available) Classe ou struct (graphique disponible) Functions calling this function Fonctions d'appel de cette fonction Functions called by this function Fonctions appelées par cette fonction Calls of this function or macro Appels de la fonction ou la macro Class which owns this member or method Classe qui possède ce membre ou la méthode Members or methods of this class Membres ou méthodes de cette classe Parent of this class Parent de cette classe Children of this class Enfants de cette classe Files including this file Fichiers à inclure ce fichier Full path for file Chemin d'accès complet pour le fichier Functions or macros inside this file Fonctions ou des macros à l'intérieur de ce fichier CodeQuery DB Files CodeQuery DB fichiers Open CQ database file Ouvrir le fichier de base de données CQ Function Call Graph Fonction Call Graph Class Inheritance Graph Classe héritage graphique If Exact Match is switched off, wildcard searches (* and ?) are supported Si une correspondance exacte déconnexion, recherches génériques (* et?) sont pris en charge results found résultats trouvés in progress en cours Cancel Annuler You have to first select an item from the list before pushing the Graph button. Vous devez d'abord sélectionner un élément dans la liste avant de pousser le bouton graphique. File open error Erreur de fichier ouvert Wrong file format Format de fichier incorrect Incorrect CQ database version Version de base de données incorrecte CQ OK Bien Unknown Error Erreur inconnue ================================================ FILE: gui/translations/codequery_id.ts ================================================ DialogGraph Graph Grafik Please wait ... Harap tunggu... Zoom Out Zoom Out Zoom In Memperbesar Number of levels: Jumlah tingkat: Save to DOT file Menyimpan DOT file Save Image Simpan gambar Close Dekat MainWindow CodeQuery CodeQuery Open Database Buka Database Auto-complete Auto-lengkap Exact match Pencocokan sama persis File path filter File path filter Filter Filter File path filter, wildcard searches (* and ?) are supported File path filter, pencarian wildcard (* dan?) yang didukung Previous search term Istilah penelusuran sebelumnya Next search term Istilah pencarian berikutnya If Exact Match is switched off, wildcard searches (* and ?) are supported Jika pencocokan sama persis dimatikan, pencarian wildcard (* dan?) yang didukung Search Cari Paste and Search Tempel dan telusuri List of all files Daftar semua file Draw graph Menggambar grafik Previous File File sebelumnya Next File Sebelumnya/berikutnya Open in Editor Terbuka di Editor Go to selected line Pergi ke saluran yang dipilih Reduce font size Mengurangi ukuran font Increase font size Meningkatkan ukuran font Copy, paste and search Salin, Tempel dan telusuri Symbol search only for paste and search Simbol pencarian hanya untuk Tempel dan telusuri Symbol only Simbol hanya Previous search result in this file Hasil penelusuran sebelumnya dalam file ini Next search result in this file Hasil pencarian berikutnya dalam file ini FilePath:0 FilePath:0 Sort by line number Urut berdasarkan nomor baris Sort by name Urut berdasarkan nama File File Options Pilihan Help Tolong Exit Keluar Open Buka About Tentang External Editor Editor eksternal Open CQ Database CQ buka Database Language Bahasa About Qt Tentang Qt File Viewer Settings Pengaturan file Viewer aboutDialog About CodeQuery Tentang CodeQuery OK Oke cqDialogGraph Images Gambar Export Image Ekspor gambar File could not be saved! File tidak bisa diselamatkan! Export DOT file Mengekspor DOT file fileViewSettingsDialog File Viewer Settings Pengaturan file Viewer Font Font Syntax highlight theme Sintaks sorot tema Tab Width (number of spaces) Tab lebar (jumlah ruang) Cancel Batal OK Oke fileviewer File not found File tidak ditemukan File could not be opened File tidak bisa dibuka The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. File sumber untuk dilihat lebih baru daripada CodeQuery database file. Anda disarankan untuk secara manual regenerasi CodeQuery database file. Cancel Batal OK Oke External Editor Configuration Konfigurasi eksternal Editor Please enter the path and arguments for the external editor. Replace as follows: Harap masukkan path dan argumen untuk editor eksternal. Ganti sebagai berikut: for file path untuk file path for line number untuk nomor baris For example: Sebagai contoh: File could not be opened! File tidak bisa dibuka! External editor could not be started. Please check Options! Editor eksternal tidak dapat dimulai. Silakan periksa pilihan! listhandler Symbol Simbol File File Line Baris Preview Tinjauan mainwindow Cancel Batal OK Oke Language Bahasa Select language: Pilih bahasa: searchhandler Symbol Simbol Function or macro definition (Graph available) Definisi fungsi atau makro (grafik tersedia) Class or struct (Graph available) Kelas atau struct (grafik tersedia) Functions calling this function Fungsi-fungsi yang memanggil fungsi ini Functions called by this function Fungsi-fungsi yang disebut oleh fungsi ini Calls of this function or macro Panggilan ini fungsi atau makro Class which owns this member or method Kelas yang memiliki anggota atau metode ini Members or methods of this class Anggota atau metode kelas ini Parent of this class Orang tua dari kelas ini Children of this class Anak-anak kelas ini Files including this file File termasuk file ini Full path for file Path lengkap untuk file Functions or macros inside this file Fungsi atau Macro di dalam file ini CodeQuery DB Files CodeQuery DB file Open CQ database file Buka file database CQ Function Call Graph Grafik fungsi panggilan Class Inheritance Graph Kelas warisan grafik If Exact Match is switched off, wildcard searches (* and ?) are supported Jika pencocokan sama persis dimatikan, pencarian wildcard (* dan?) yang didukung results found hasil ditemukan in progress sedang berlangsung Cancel Batal You have to first select an item from the list before pushing the Graph button. Anda harus memilih dulu item dari daftar sebelum menekan tombol grafik. File open error Buka file kesalahan Wrong file format Format file salah Incorrect CQ database version Salah CQ database versi OK Oke Unknown Error Error tidak diketahui ================================================ FILE: gui/translations/codequery_it.ts ================================================ DialogGraph Graph Grafico Please wait ... Attendere prego... Zoom Out Zoom indietro Zoom In Zoom In Number of levels: Numero di livelli: Save to DOT file Salvare file DOT Save Image Salva immagine Close Chiudere MainWindow CodeQuery CodeQuery Open Database Database aperto Auto-complete Completamento automatico Exact match Corrispondenza esatta File path filter Filtro percorso file Filter Filtro File path filter, wildcard searches (* and ?) are supported Filtro percorso file, ricerche con caratteri jolly (* e?) sono supportati Previous search term Termine di ricerca precedente Next search term Successivo al termine di ricerca If Exact Match is switched off, wildcard searches (* and ?) are supported Se la corrispondenza esatta è spento, ricerche con caratteri jolly (* e?) sono supportati Search Ricerca Paste and Search Incolla e ricerca List of all files elenco di tutti i file Draw graph Disegnare il grafico Previous File Precedente File Next File File successivo Open in Editor Aperto nell'Editor Go to selected line Vai alla riga selezionata. Reduce font size Ridurre la dimensione del carattere Increase font size Aumentare la dimensione del carattere Copy, paste and search Copia, incolla e ricerca Symbol search only for paste and search Simbolo cerca solo pasta e ricerca Symbol only Unico simbolo Previous search result in this file Risultato della ricerca precedente in questo file Next search result in this file Risultati di ricerca successivo in questo file FilePath:0 FilePath:0 Sort by line number Ordina per numero di riga Sort by name Ordina per nome File File Options Opzioni Help Guida Exit Uscita Open Open About Info su External Editor Editor esterno Open CQ Database CQ Open Database Language Lingua About Qt Info su Qt File Viewer Settings Impostazioni del file Viewer aboutDialog About CodeQuery Info su CodeQuery OK Ok cqDialogGraph Images Immagini Export Image Esportazione immagine File could not be saved! File non poteva essere salvato! Export DOT file Esportare file DOT fileViewSettingsDialog File Viewer Settings Impostazioni del file Viewer Font Tipo di carattere Syntax highlight theme Tema di evidenziazione sintassi Tab Width (number of spaces) Larghezza scheda (numero di spazi) Cancel Annulla OK Ok fileviewer File not found File non trovato File could not be opened File non può essere aperto The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. Il file di origine per essere visualizzati è più recente rispetto al file di database CodeQuery. Si raccomanda di rigenerare manualmente il file di database CodeQuery. Cancel Annulla OK Ok External Editor Configuration Configurazione Editor esterno Please enter the path and arguments for the external editor. Replace as follows: Inserisci il percorso e gli argomenti per l'editor esterno. Sostituire come segue: for file path per il percorso del file for line number per numero di riga For example: Ad esempio: File could not be opened! File non può essere aperto! External editor could not be started. Please check Options! Editor esterno potrebbe non essere avviato. Si prega di controllare le opzioni! listhandler Symbol Simbolo File File Line Linea Preview Anteprima mainwindow Cancel Annulla OK Ok Language Lingua Select language: Seleziona lingua: searchhandler Symbol Simbolo Function or macro definition (Graph available) Definizione di funzione o macro (grafico disponibile) Class or struct (Graph available) Classe o struttura (grafico disponibile) Functions calling this function Funzioni di chiamata a questa funzione Functions called by this function Funzioni chiamate da questa funzione Calls of this function or macro Chiamate di questa funzione o macro Class which owns this member or method Classe che possiede questo membro o metodo. Members or methods of this class Membri o i metodi di questa classe Parent of this class Padre di questa classe Children of this class Bambini di questa classe Files including this file File incluso questo file Full path for file Percorso completo per il file Functions or macros inside this file Macro o funzioni all'interno di questo file. CodeQuery DB Files CodeQuery DB file Open CQ database file Aprire il file database CQ Function Call Graph Funzione Call Graph Class Inheritance Graph Grafico di ereditarietà di classe If Exact Match is switched off, wildcard searches (* and ?) are supported Se la corrispondenza esatta è spento, ricerche con caratteri jolly (* e?) sono supportati results found risultati trovati in progress in corso Cancel Annulla You have to first select an item from the list before pushing the Graph button. È necessario innanzitutto selezionare un elemento dall'elenco prima di spingere il pulsante grafico. File open error Errore di file aperti Wrong file format Formato di file sbagliato Incorrect CQ database version Versione del database corretto CQ OK Ok Unknown Error Errore sconosciuto ================================================ FILE: gui/translations/codequery_ja.ts ================================================ DialogGraph Graph グラフ Please wait ... お待ちください。。。 Zoom Out ズーム アウト Zoom In ズームインします。 Number of levels: レベル数: Save to DOT file ドット ファイルに保存します。 Save Image 画像を保存します。 Close 閉じる MainWindow CodeQuery CodeQuery Open Database データベースを開く Auto-complete 自動車-完全な Exact match 完全に一致します。 File path filter ファイル パス フィルター Filter フィルター File path filter, wildcard searches (* and ?) are supported ファイル パス フィルター、ワイルドカード検索 (* と?) がサポートされています Previous search term 前の検索クエリ Next search term 次の検索用語 If Exact Match is switched off, wildcard searches (* and ?) are supported 完全に一致するワイルドカード検索を切り替えた場合 (* と?) サポートされています。 Search 検索 Paste and Search 貼り付け、検索 List of all files すべてのファイルの一覧 Draw graph グラフを描く Previous File 以前のファイル Next File 次のファイル Open in Editor エディターで開く Go to selected line 選択した行に移動します。 Reduce font size フォント サイズを小さく Increase font size フォント サイズを大きく Copy, paste and search コピー、貼り付け、検索 Symbol search only for paste and search シンボル検索は、貼り付け、検索のみ Symbol only シンボルのみ Previous search result in this file このファイルの前の検索結果 Next search result in this file このファイルの次の検索結果 FilePath:0 FilePath:0 Sort by line number 行番号順に並べ替えます Sort by name 名前順に並べ替えます File ファイル Options オプション Help ヘルプ Exit 終了 Open オープン About について External Editor 外部エディター Open CQ Database オープン cq, データベース Language 言語 About Qt Qt について File Viewer Settings ファイル ビューアーの設定 aboutDialog About CodeQuery CodeQuery について OK わかりました cqDialogGraph Images 画像 Export Image イメージをエクスポートします。 File could not be saved! ファイルを保存できませんでした ! Export DOT file ドット ファイルをエクスポートします。 fileViewSettingsDialog File Viewer Settings ファイル ビューアーの設定 Font フォント Syntax highlight theme 構文強調表示テーマ Tab Width (number of spaces) タブ幅 (スペース数) Cancel キャンセル OK わかりました fileviewer File not found ファイルが見つかりません File could not be opened ファイルを開くことができません。 The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. ソース ファイルを表示するのには、CodeQuery データベース ファイルよりも新しいです。CodeQuery データベース ファイルを手動で再生成に推奨されます。 Cancel キャンセル OK わかりました External Editor Configuration 外部エディターの構成 Please enter the path and arguments for the external editor. Replace as follows: 外部エディターの引数とパスを入力してください。次のように置き換えます。 for file path ファイルのパス for line number 行番号について For example: たとえば。 File could not be opened! ファイルを開くことができません ! External editor could not be started. Please check Options! 外部エディターを開始できませんでした。オプションを確認してください ! listhandler Symbol シンボル File ファイル Line ライン Preview プレビュー mainwindow Cancel キャンセル OK わかりました Language 言語 Select language: 言語の選択: searchhandler Symbol シンボル Function or macro definition (Graph available) 関数またはマクロの定義 (グラフ) Class or struct (Graph available) クラスまたは構造体 (利用可能なグラフ) Functions calling this function この関数を呼び出す関数 Functions called by this function この関数によって呼び出された関数 Calls of this function or macro この関数やマクロの呼び出し Class which owns this member or method このメンバーまたはメソッドを所有しているクラス Members or methods of this class このクラスのメンバーやメソッド Parent of this class このクラスの親 Children of this class このクラスの子供たち Files including this file このファイルを含むファイル Full path for file ファイルの完全なパス Functions or macros inside this file 関数またはこのファイル内のマクロ CodeQuery DB Files CodeQuery DB ファイル Open CQ database file Cq, データベース ファイルを開く Function Call Graph 関数コール グラフ Class Inheritance Graph クラス継承グラフ If Exact Match is switched off, wildcard searches (* and ?) are supported 完全に一致するワイルドカード検索を切り替えた場合 (* と?) サポートされています。 results found 検索結果 in progress 進行中 Cancel キャンセル You have to first select an item from the list before pushing the Graph button. [グラフ] ボタンを押す前にまず一覧から項目を選択する必要があります。 File open error ファイルを開くエラー Wrong file format ファイル フォーマット Incorrect CQ database version Cq, データベース バージョンが正しくないです。 OK わかりました Unknown Error 不明なエラー ================================================ FILE: gui/translations/codequery_ko.ts ================================================ DialogGraph Graph 그래프 Please wait ... 잠시만 기다려 주십시오... Zoom Out 축소 Zoom In 확대 Number of levels: 수준의 수: Save to DOT file 점 파일에 저장 Save Image 이미지 저장 Close 닫기 MainWindow CodeQuery CodeQuery Open Database 데이터베이스 열기 Auto-complete 자동 완성 Exact match 정확 하 게 일치 File path filter 파일 경로 필터 Filter 필터 File path filter, wildcard searches (* and ?) are supported 파일 경로 필터, 와일드 카드 검색 (* 및?) 지원 Previous search term 이전 검색어 Next search term 다음 검색어 If Exact Match is switched off, wildcard searches (* and ?) are supported 정확히 일치 하는 와일드 카드 검색을 전환 하는 경우 (* 및?) 지원 Search 검색 Paste and Search 붙여넣기 및 검색 List of all files 모든 파일의 목록 Draw graph 그래프 그리기 Previous File 이전 파일 Next File 다음 파일 Open in Editor 편집기에서 열려 Go to selected line 선택 된 줄으로 이동 Reduce font size 글꼴 크기 줄이기 Increase font size 글꼴 크기 증가 Copy, paste and search 복사, 붙여넣기 및 검색 Symbol search only for paste and search 붙여넣기 및 검색에 대해서만 기호 검색 Symbol only 상징만 Previous search result in this file 이 파일에서 이전 검색 결과 Next search result in this file 이 파일에서 다음 검색 결과 FilePath:0 FilePath:0 Sort by line number 줄 번호로 정렬 합니다 Sort by name 이름으로 정렬 합니다 File 파일 Options 옵션 Help 도움말 Exit 출구 Open 오픈 About 에 대 한 External Editor 외부 편집기 Open CQ Database 오픈 CQ 데이터베이스 Language 언어 About Qt Qt에 대 한 File Viewer Settings 파일 뷰어 설정 aboutDialog About CodeQuery CodeQuery에 대 한 OK 괜찮았던 것 cqDialogGraph Images 이미지 Export Image 이미지 내보내기 File could not be saved! 파일을 저장할 수 없습니다! Export DOT file 도트 파일 내보내기 fileViewSettingsDialog File Viewer Settings 파일 뷰어 설정 Font 글꼴 Syntax highlight theme 구문 하이라이트 테마 Tab Width (number of spaces) 탭 너비 (공백 수) Cancel 취소 OK 괜찮았던 것 fileviewer File not found 파일을 찾을 수 없습니다 File could not be opened 파일을 열 수 없습니다. The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. 소스 파일을 볼 수 CodeQuery 데이터베이스 파일 보다 최신입니다. CodeQuery 데이터베이스 파일을 수동으로 다시 생성 하는 것이 좋습니다. Cancel 취소 OK 괜찮았던 것 External Editor Configuration 외부 편집기 구성 Please enter the path and arguments for the external editor. Replace as follows: 경로 및 외부 편집기에 대 한 인수를 입력 해 주시기 바랍니다. 다음과 같이 바꿉니다. for file path 파일 경로 대 한 for line number 줄 번호에 대 한 For example: 예를 들어: File could not be opened! 파일을 열 수 없습니다! External editor could not be started. Please check Options! 외부 편집기를 시작할 수 없습니다. 옵션을 확인 하십시오! listhandler Symbol 기호 File 파일 Line Preview 미리 보기 mainwindow Cancel 취소 OK 괜찮았던 것 Language 언어 Select language: 언어 선택: searchhandler Symbol 기호 Function or macro definition (Graph available) 함수 또는 매크로 정의 (그래프 제공) Class or struct (Graph available) 클래스 또는 구조체 (그래프 제공) Functions calling this function 이 함수를 호출 하는 함수 Functions called by this function 이 함수에 의해 호출 된 함수 Calls of this function or macro 이 함수 또는 매크로의 호출 Class which owns this member or method 클래스 멤버 또는 메서드가 소유 하 고 있는 Members or methods of this class 회원 또는이 클래스의 메서드 Parent of this class 이 클래스의 부모 Children of this class 이 클래스의 자식 Files including this file 이 파일을 포함 한 파일 Full path for file 파일의 전체 경로 Functions or macros inside this file 이 파일 안에 매크로 또는 함수 CodeQuery DB Files CodeQuery DB 파일 Open CQ database file CQ 데이터베이스 파일 열기 Function Call Graph 함수 호출 그래프 Class Inheritance Graph 클래스 상속 그래프 If Exact Match is switched off, wildcard searches (* and ?) are supported 정확히 일치 하는 와일드 카드 검색을 전환 하는 경우 (* 및?) 지원 results found 찾은 결과 in progress 진행 중 Cancel 취소 You have to first select an item from the list before pushing the Graph button. 먼저 그래프 버튼을 추진 하기 전에 목록에서 항목을 선택 해야 합니다. File open error 파일 열기 오류 Wrong file format 잘못 된 파일 형식 Incorrect CQ database version 잘못 된 CQ 데이터베이스 버전 OK 괜찮았던 것 Unknown Error 알 수 없는 오류 ================================================ FILE: gui/translations/codequery_zh-CHS.ts ================================================ DialogGraph Graph Please wait ... 请稍候。。。 Zoom Out 缩小 Zoom In 放大 Number of levels: 级别数: Save to DOT file 将保存到点文件 Save Image 保存图像 Close 关闭 MainWindow CodeQuery CodeQuery Open Database 打开的数据库 Auto-complete 自动完成 Exact match 精确匹配 File path filter 文件路径筛选器 Filter 筛选器 File path filter, wildcard searches (* and ?) are supported 文件路径筛选器、 通配符搜索 (* 和?) 支持 Previous search term 以前的搜索词 Next search term 下一个搜索词 If Exact Match is switched off, wildcard searches (* and ?) are supported 如果精确匹配关掉,通配符搜索 (* 和?) 支持 Search 搜索 Paste and Search 粘贴并搜索 List of all files 所有文件列表 Draw graph 绘制关系图 Previous File 以前的文件 Next File 下一个文件 Open in Editor 在编辑器中打开 Go to selected line 转到所选行 Reduce font size 减小字体大小 Increase font size 增加字体大小 Copy, paste and search 复制、 粘贴和搜索 Symbol search only for paste and search 仅用于粘贴和搜索符号搜索 Symbol only 只有符号 Previous search result in this file 此文件中的上一个搜索结果 Next search result in this file 在此文件中的下一个搜索结果 FilePath:0 FilePath:0 Sort by line number 按行号排序 Sort by name 按名称排序 File 文件 Options 选项 Help 帮助 Exit 退出 Open 开放 About 关于 External Editor 外部编辑器 Open CQ Database 打开 CQ 数据库 Language 语言 About Qt 关于 Qt File Viewer Settings 文件查看器设置 aboutDialog About CodeQuery 关于 CodeQuery OK 还行 cqDialogGraph Images 图像 Export Image 导出图像 File could not be saved! 无法保存文件 ! Export DOT file 出口点文件 fileViewSettingsDialog File Viewer Settings 文件查看器设置 Font 字体 Syntax highlight theme 语法突出显示主题 Tab Width (number of spaces) 标签宽度 (空格的数量) Cancel 取消 OK 还行 fileviewer File not found 找不到文件 File could not be opened 不能打开文件 The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. 要查看源文件是比 CodeQuery 数据库文件更新。建议您手动重新生成的 CodeQuery 数据库文件。 Cancel 取消 OK 还行 External Editor Configuration 外部编辑器配置 Please enter the path and arguments for the external editor. Replace as follows: 请输入路径和参数的外部编辑器。替换,如下所示: for file path 文件路径 for line number 为行号 For example: 例如: File could not be opened! 不能打开文件 ! External editor could not be started. Please check Options! 无法启动外部编辑器。请检查选项 ! listhandler Symbol 符号 File 文件 Line Preview 预览 mainwindow Cancel 取消 OK 还行 Language 语言 Select language: 选择语言: searchhandler Symbol 符号 Function or macro definition (Graph available) 函数或宏的定义 (Graph 中可用) Class or struct (Graph available) 类或结构 (Graph 中可用) Functions calling this function 调用此函数的函数 Functions called by this function 此函数调用的函数 Calls of this function or macro 此函数或宏的调用 Class which owns this member or method 拥有此成员或方法的类 Members or methods of this class 此类方法或成员 Parent of this class 此类的父 Children of this class 儿童的此类 Files including this file 此文件包括文件 Full path for file 文件的完整路径 Functions or macros inside this file 函数或此文件中的宏 CodeQuery DB Files CodeQuery DB 文件 Open CQ database file 打开 CQ 数据库文件 Function Call Graph 函数的调用关系图 Class Inheritance Graph 类继承关系图 If Exact Match is switched off, wildcard searches (* and ?) are supported 如果精确匹配关掉,通配符搜索 (* 和?) 支持 results found 找到的结果 in progress 在进行中 Cancel 取消 You have to first select an item from the list before pushing the Graph button. 您必须先推图形按钮之前从列表中选择一个项。 File open error 文件打开错误 Wrong file format 错误的文件格式 Incorrect CQ database version CQ 数据库版本不正确 OK 还行 Unknown Error 未知的错误 ================================================ FILE: gui/translations/codequery_zh-CHT.ts ================================================ DialogGraph Graph Please wait ... 請稍候。。。 Zoom Out 縮小 Zoom In 放大 Number of levels: 級別數: Save to DOT file 將保存到點檔 Save Image 保存圖像 Close 關閉 MainWindow CodeQuery CodeQuery Open Database 打開的資料庫 Auto-complete 自動完成 Exact match 精確匹配 File path filter 檔路徑篩選器 Filter 篩選器 File path filter, wildcard searches (* and ?) are supported 檔路徑篩選器、 萬用字元搜尋 (* 和?) 支援 Previous search term 以前的搜索詞 Next search term 下一個搜索詞 If Exact Match is switched off, wildcard searches (* and ?) are supported 如果精確匹配關掉,萬用字元搜尋 (* 和?) 支援 Search 搜索 Paste and Search 粘貼並搜索 List of all files 所有檔案清單 Draw graph 繪製關係圖 Previous File 以前的檔 Next File 下一個檔 Open in Editor 在編輯器中打開 Go to selected line 轉到所選行 Reduce font size 減小字體大小 Increase font size 增加字體大小 Copy, paste and search 複製、 粘貼和搜索 Symbol search only for paste and search 僅用於粘貼和搜索符號搜索 Symbol only 只有符號 Previous search result in this file 此檔中的上一個搜尋結果 Next search result in this file 在此檔中的下一個搜尋結果 FilePath:0 FilePath:0 Sort by line number 按行號排序 Sort by name 按名稱排序 File Options 選項 Help 説明 Exit 退出 Open 開放 About 關於 External Editor 外部編輯器 Open CQ Database 打開 CQ 資料庫 Language 語言 About Qt 關於 Qt File Viewer Settings 檔檢視器設置 aboutDialog About CodeQuery 關於 CodeQuery OK 還行 cqDialogGraph Images 圖像 Export Image 匯出圖像 File could not be saved! 無法保存檔 ! Export DOT file 出口點檔 fileViewSettingsDialog File Viewer Settings 檔檢視器設置 Font 字體 Syntax highlight theme 語法突出顯示主題 Tab Width (number of spaces) 標籤寬度 (空格的數量) Cancel 取消 OK 還行 fileviewer File not found 找不到檔 File could not be opened 不能打開檔 The source file to be viewed is newer than the CodeQuery database file. You are recommended to manually regenerate the CodeQuery database file. 要查看原始檔案是比 CodeQuery 資料庫檔案更新。建議您手動重新生成的 CodeQuery 資料庫檔案。 Cancel 取消 OK 還行 External Editor Configuration 外部編輯器配置 Please enter the path and arguments for the external editor. Replace as follows: 請輸入路徑和參數的外部編輯器。替換,如下所示: for file path 檔路徑 for line number 為行號 For example: 例如: File could not be opened! 不能打開檔 ! External editor could not be started. Please check Options! 無法啟動外部編輯器。請檢查選項 ! listhandler Symbol 符號 File Line Preview 預覽 mainwindow Cancel 取消 OK 還行 Language 語言 Select language: 選擇語言: searchhandler Symbol 符號 Function or macro definition (Graph available) 函數或宏的定義 (Graph 中可用) Class or struct (Graph available) 類或結構 (Graph 中可用) Functions calling this function 調用此函數的函數 Functions called by this function 此函式呼叫的函數 Calls of this function or macro 此函數或宏的調用 Class which owns this member or method 擁有此成員或方法的類 Members or methods of this class 此類方法或成員 Parent of this class 此類的父 Children of this class 兒童的此類 Files including this file 此檔包括檔 Full path for file 檔的完整路徑 Functions or macros inside this file 函數或此檔中的宏 CodeQuery DB Files CodeQuery DB 檔 Open CQ database file 打開 CQ 資料庫檔案 Function Call Graph 函數的調用關係圖 Class Inheritance Graph 類繼承關係圖 If Exact Match is switched off, wildcard searches (* and ?) are supported 如果精確匹配關掉,萬用字元搜尋 (* 和?) 支援 results found 找到的結果 in progress 在進行中 Cancel 取消 You have to first select an item from the list before pushing the Graph button. 您必須先推圖形按鈕之前從清單中選擇一個項。 File open error 檔打開錯誤 Wrong file format 錯誤的檔案格式 Incorrect CQ database version CQ 資料庫版本不正確 OK 還行 Unknown Error 未知的錯誤 ================================================ FILE: gui/translations/dolupdate.pl ================================================ # lupdate # # This license applies only to this file: # # Copyright (c) 2013 ruben2020 # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # use strict; my @langfiles; open(FIL, "./tslist.txt"); while() { chomp; if (/\{[ \t]*\"(.+)\"[ \t]*,[ \t]*\"(.+)\"[ \t]*\}/) { push @langfiles, $2; } } close(FIL); foreach(@langfiles) { system("lupdate-qt4 -no-obsolete ../*.cpp ../ui/*.ui -ts ./$_.ts"); } ================================================ FILE: gui/translations/dowebtranslate.pl ================================================ # Automatically web-translate ts files. # # This license applies only to this file: # # Copyright (c) 2013 ruben2020 # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to # deal in the Software without restriction, including without limitation the # rights to use, copy, modify, merge, publish, distribute, sublicense, and/or # sell copies of the Software, and to permit persons to whom the Software is # furnished to do so, subject to the following conditions: # # The above copyright notice and this permission notice shall be included in # all copies or substantial portions of the Software. # # THE SOTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR # IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, # FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE # AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER # LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING # FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS # IN THE SOFTWARE. # use strict; use HTTP::Request::Common qw(POST); use LWP::UserAgent; my @langfiles; open(FIL, "./tslist.txt"); while() { chomp; if (/\{[ \t]*\"(.+)\"[ \t]*,[ \t]*\"(.+)\"[ \t]*\}/) { push @langfiles, $2; } } close(FIL); foreach(@langfiles) { system("lupdate-qt4 -no-obsolete ../*.cpp ../ui/*.ui -ts ./$_.ts"); } my $langout; my $langfil; foreach(@langfiles) { $langfil = "./$_.ts"; if ($_ =~ /codequery\_([A-Za-z0-9-]+)/) {$langout = $1;} if ($langout eq 'en') {next;} print "Web translating $langfil $langout ...\n"; &translatedoc($langfil, $langout); } ############################################# sub translatedoc { my ($fn, $lang) = @_; my $ua = LWP::UserAgent->new(); my $req = POST 'http://maille.tk/translate/index-curl.php', Content_Type => 'multipart/form-data', Content => [ "bingkey" => "689AC7C9ABE8CF4C53B930FE1A0019F73C0C8AB5", "languagein" => "en", "languageout" => $lang, "output" => "pofile", "pofile" => [$fn] ]; my $resp = $ua->request($req); my @respxml; if ($resp->is_success) { open(FILO, ">$fn"); @respxml = split /\n/, $resp->content; $respxml[0] =~ s/^[ \t]*<\?xml/as_string;} } ================================================ FILE: gui/translations/tslist.txt ================================================ {"English", "codequery_en" }, {"Deutsch", "codequery_de" }, {"Fran\347ais", "codequery_fr" }, {"Espa\361ol", "codequery_es" }, {"Italiano", "codequery_it" }, {"Bahasa Indonesia", "codequery_id" }, {"Chinese Simplified", "codequery_zh-CHS" }, {"Chinese Traditional", "codequery_zh-CHT" }, {"Japanese", "codequery_ja" }, {"Korean", "codequery_ko" }, ================================================ FILE: gui/ui/aboutDialog.ui ================================================ aboutDialog 0 0 400 300 0 0 About CodeQuery true 0 0 :/mainwindow/images/logo.png false 0 0 Qt::AlignCenter true true 0 0 true true Qt::Horizontal 40 20 0 0 OK ================================================ FILE: gui/ui/fileViewSettingsDialog.ui ================================================ fileViewSettingsDialog 0 0 423 162 File Viewer Settings true 0 0 Font 0 0 Syntax highlight theme 0 0 Tab Width (number of spaces) 0 0 0 0 0 0 Qt::Horizontal 40 20 0 0 Cancel 0 0 OK comboBoxFont lineEditTabWidth comboBoxTheme ================================================ FILE: gui/ui/graphDialog.ui ================================================ DialogGraph 0 0 999 713 Graph true Please wait ... Qt::AlignCenter true 0 0 979 591 Qt::LeftToRight 1 0 Zoom Out Zoom Out :/mainwindow/images/Zoom_Out.png:/mainwindow/images/Zoom_Out.png 1 0 Zoom In Zoom In :/mainwindow/images/Zoom_In.png:/mainwindow/images/Zoom_In.png Qt::Vertical 5 0 Number of levels: Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter 1 0 0 0 Save to DOT file Save to DOT file Save to DOT file 0 0 Save Image Save Image Save Image 0 0 Close Close Close pushButtonZoomOut pushButtonZoomIn pushButtonSaveDot pushButtonSave pushButtonClose ================================================ FILE: gui/ui/mainWindow.ui ================================================ MainWindow 0 0 967 813 CodeQuery :/mainwindow/images/logo.png:/mainwindow/images/logo.png Open Database Open Database :/mainwindow/images/Database.png:/mainwindow/images/Database.png 24 24 0 0 Qt::RightToLeft QComboBox::AdjustToContents Qt::Vertical Qt::LeftToRight Auto-complete Qt::Vertical Exact match Qt::Vertical File path filter File path filter Filter true 0 0 File path filter, wildcard searches (* and ?) are supported File path filter, wildcard searches (* and ?) are supported Qt::RightToLeft true QComboBox::NoInsert QComboBox::AdjustToContents Previous search term Previous search term :/mainwindow/images/Arrow2_Left.png:/mainwindow/images/Arrow2_Left.png 24 24 Next search term Next search term :/mainwindow/images/Arrow2_Right.png:/mainwindow/images/Arrow2_Right.png 24 24 0 0 If Exact Match is switched off, wildcard searches (* and ?) are supported If Exact Match is switched off, wildcard searches (* and ?) are supported true QComboBox::NoInsert QComboBox::AdjustToContents true Search Search :/mainwindow/images/Search.png:/mainwindow/images/Search.png 24 24 Paste and Search Paste and Search :/mainwindow/images/Clipboard_Paste.png:/mainwindow/images/Clipboard_Paste.png 24 24 List of all files List of all files :/mainwindow/images/Folder2.png:/mainwindow/images/Folder2.png 24 24 false Draw graph Draw graph :/mainwindow/images/Graph.png:/mainwindow/images/Graph.png 24 24 0 0 15 QComboBox::NoInsert QComboBox::AdjustToContents Qt::Vertical 1 Previous File Previous File :/mainwindow/images/Arrow2_Left.png:/mainwindow/images/Arrow2_Left.png 24 24 Next File Next File :/mainwindow/images/Arrow2_Right.png:/mainwindow/images/Arrow2_Right.png 24 24 Open in Editor Open in Editor :/mainwindow/images/Document2.png:/mainwindow/images/Document2.png 24 24 Go to selected line Go to selected line :/mainwindow/images/Flag.png:/mainwindow/images/Flag.png 24 24 Reduce font size Reduce font size :/mainwindow/images/Text_Minus.png:/mainwindow/images/Text_Minus.png 24 24 Increase font size Increase font size :/mainwindow/images/Text_Plus.png:/mainwindow/images/Text_Plus.png 24 24 Qt::Vertical Copy, paste and search Copy, paste and search :/mainwindow/images/Clipboard_Paste.png:/mainwindow/images/Clipboard_Paste.png 24 24 Symbol search only for paste and search Symbol search only for paste and search Symbol only Qt::Vertical Previous search result in this file Previous search result in this file :/mainwindow/images/Arrow2_Up.png:/mainwindow/images/Arrow2_Up.png 24 24 Next search result in this file Next search result in this file :/mainwindow/images/Arrow2_Down.png:/mainwindow/images/Arrow2_Down.png 24 24 ArrowCursor false true FilePath:0 Qt::AlignRight|Qt::AlignTrailing|Qt::AlignVCenter true Qt::Horizontal 100 QComboBox::NoInsert Sort by line number Sort by name 1 0 4 0 0 0 967 29 File Options Help Exit QAction::QuitRole Open About External Editor Open CQ Database Language About Qt QAction::AboutQtRole File Viewer Settings ScintillaEdit QFrame
ScintillaEdit.h
1
pushButtonOpenDB comboBoxDB checkBoxAutoComplete checkBoxExactMatch checkBoxFilter comboBoxFilter pushButtonSearchPrev pushButtonSearchNext comboBoxSearch pushButtonSearch pushButtonClipSearch pushButtonFilesList pushButtonGraph comboBoxQueryType treeWidgetSearchResults pushButtonPrev pushButtonNext pushButtonOpenInEditor pushButtonGoToLine pushButtonTextShrink pushButtonTextEnlarge pushButtonPaste checkBoxSymbolOnly pushButtonUp pushButtonDown comboBoxFuncListSort listWidgetFunc checkBoxFilter toggled(bool) comboBoxFilter setEnabled(bool) 675 65 956 68
================================================ FILE: gui/winmain.cpp ================================================ /* Taken from: https://github.com/gosu/gosu/blob/master/src/WinMain.cpp This license applies only to this file: Copyright (C) 2001-2023 Julian Raschke, Jan Lücker, cyberarm, and all other contributors: https://github.com/gosu/gosu/graphs/contributors Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. Julian Raschke & contributors https://www.libgosu.org/ */ //#ifdef _MSC_VER #ifdef _WIN32 #include #include #include #include using namespace std; vector split_cmd_line() { vector result; const char* cmd_line = ::GetCommandLineA(); const char* arg_begin = nullptr; bool is_quoted_arg = false; while (*cmd_line) { if (*cmd_line == '"') { if (arg_begin == nullptr) { arg_begin = cmd_line + 1; is_quoted_arg = true; } else if (is_quoted_arg) { result.push_back(string(arg_begin, cmd_line)); arg_begin = nullptr; } } else if (!isspace((unsigned char)*cmd_line) && arg_begin == nullptr) { arg_begin = cmd_line; is_quoted_arg = false; } else if (isspace((unsigned char)*cmd_line) && arg_begin != nullptr && !is_quoted_arg) { result.push_back(string(arg_begin, cmd_line + 1)); arg_begin = nullptr; } ++cmd_line; } if (arg_begin != 0) result.push_back(arg_begin); return result; } int main(int argc, char* argv[]); int WINAPI WinMain(HINSTANCE, HINSTANCE, LPSTR, int) { try { vector arguments = split_cmd_line(); vector argv(arguments.size()); for (unsigned i = 0; i < argv.size(); ++i) { argv[i] = const_cast(arguments[i].c_str()); } return main(argv.size(), &argv[0]); } catch (const exception& e) { ::MessageBoxA(0, e.what(), "Uncaught Exception", MB_OK | MB_ICONERROR); return EXIT_FAILURE; } } #endif ================================================ FILE: lexilla/.gitattributes ================================================ * -text **.cxx text **.cpp text **.c text **.h text **.hpp text **.m text **.mm text **.iface text **.template text **.mk text **.py text **.rc text **.css text **.html text **.bat text **.bsh text **.zsh text **.mak text **.def text **.manifest text **.properties text **.props text **.session text **.styled text **.folded text **.adoc text **.asp text **.aspx text **.php text **.vb text **.asm text **.cob text **.cmake text **.d text **.diff text **.erl text **.f text **.gd text **.gui text **.iss text **.jl text **.json text **.lua text **.m3 text **.matlab text **.ml text **.nim text **.octave text **.pl text **.p6 text **.ps1 text **.r text **.rb text **.rs text **.sql text **.tcl text **.tsql text **.err text **.mms text **.tex text **.fs text **.vh text **.vhd text **.x12 text **.yaml text **.md text **.txt text **.pch text **.hg* text **.dsp text **.pbxproj text **.plist text **.xcworkspacedata text **.pro text **.gen text **makefile text **.bmp binary **.cur binary **.ico binary **.jpg binary **.png binary **.sh text eol=lf tgzsrc text eol=lf ================================================ FILE: lexilla/.github/workflows/build-check-macos.yml ================================================ name: "Build and check Lexilla on macOS" on: [push] jobs: build: runs-on: macos-11 strategy: matrix: cpp_compiler: [clang++] steps: - uses: actions/checkout@v4 - name: Install Scintilla source run: | (cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip) (cd .. && unzip scintilla500.zip) - name: Unit Test run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test) - name: Build Lexilla run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}}) - uses: actions/upload-artifact@v4 with: name: liblexilla.dylib path: bin/liblexilla.dylib - name: Test lexing and folding run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test) - name: CheckLexilla C Example run: (cd examples/CheckLexilla && make DEBUG=1 check) - name: SimpleLexer Example run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} check) ================================================ FILE: lexilla/.github/workflows/build-check-win32.yml ================================================ name: "Build and check Lexilla on Win32 with Visual C++" on: [push] jobs: build: runs-on: windows-latest steps: - uses: actions/checkout@v4 - name: Preparing nmake uses: ilammy/msvc-dev-cmd@v1 with: arch: x64 - name: Install Scintilla source run: | pwd cd .. curl -O https://www.scintilla.org/scintilla500.zip ls 7z x scintilla500.zip cd lexilla - name: Unit Test run: | cd test/unit nmake -f test.mak DEBUG=1 test cd ../.. - name: Build Lexilla run: | cd src nmake -f lexilla.mak DEBUG=1 cd .. - uses: actions/upload-artifact@v4 with: name: lexilla.dll path: bin/lexilla.dll - name: Test lexing and folding run: | cd test nmake -f testlexers.mak DEBUG=1 test cd .. - name: CheckLexilla C Example run: | cd examples/CheckLexilla cl CheckLexilla.c -I ../../include -Fe: CheckLexilla .\CheckLexilla.exe cd ../.. - name: SimpleLexer Example run: | cd examples/SimpleLexer cl -std:c++17 -EHsc -LD -I ../../../scintilla/include -I ../../include -I ../../lexlib SimpleLexer.cxx ../../lexlib/*.cxx cd ../.. ================================================ FILE: lexilla/.github/workflows/build-check.yml ================================================ name: "Build and check Lexilla on Linux" on: [push] jobs: build: runs-on: ubuntu-latest strategy: matrix: cpp_compiler: [g++, clang++] steps: - uses: actions/checkout@v4 - name: Install Scintilla source run: | (cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip) (cd .. && unzip scintilla500.zip) - name: Unit Test run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test) - name: Build Lexilla run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}}) - uses: actions/upload-artifact@v4 with: name: liblexilla-${{matrix.cpp_compiler}}.so path: bin/liblexilla.so overwrite: true - name: Test lexing and folding run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test) - name: CheckLexilla C Example run: (cd examples/CheckLexilla && make DEBUG=1 check) - name: SimpleLexer Example run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} check) ================================================ FILE: lexilla/.gitignore ================================================ *.o *.a *.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 *.nativecodeanalysis.xml *.cache *.ilk *.ncb *.tlog *.sdf gtk/*.plist win32/*.plist *.opt *.plg *.pbxbtree *.mode1v3 *.pbxuser *.pbproj *.tgz *.log *.xcbkptlist *.xcuserstate xcuserdata/ *.xcsettings xcschememanagement.plist .DS_Store test/TestLexers Release Debug x64 ARM64 cocoa/build cocoa/ScintillaFramework/build cocoa/ScintillaTest/build macosx/SciTest/build *.cppcheck *.pro.user .qmake.stash cov-int .vs meson-private meson-logs build.ninja .ninja* compile_commands.json .vscode/ VTune Profiler Results/ ================================================ FILE: lexilla/.travis.yml ================================================ # Build Lexilla with gcc and clang on Linux, macOS, and Windows # Test Lexilla with gcc and clang on Linux and macOS # Windows has older versions of libraries so can't compile std::filesystem # with gcc or std::string::starts_with with clang. # On macOS, gcc is a synonym for clang so exclude gcc. os: - linux - osx - windows dist: focal osx_image: xcode12.3 language: cpp jobs: exclude: - os: osx compiler: gcc install: - cd .. - wget --no-verbose https://www.scintilla.org/scintilla500.zip - if [ "$TRAVIS_OS_NAME" = "windows" ]; then 7z x scintilla500.zip ; else unzip scintilla500.zip ; fi - cd lexilla compiler: - gcc - clang script: - if [ "$TRAVIS_OS_NAME" = "windows" ]; then MAKER="mingw32-make windir=1" ; else MAKER="make" ; fi - (cd src && $MAKER DEBUG=1) - cd test - if [ "$TRAVIS_OS_NAME" != "windows" ]; then make DEBUG=1 test ; fi - (cd unit && $MAKER DEBUG=1 test) - cd .. - cd examples - (cd CheckLexilla && $MAKER DEBUG=1 check) - (cd SimpleLexer && $MAKER DEBUG=1 check) - cd .. ================================================ FILE: lexilla/CMakeLists.txt ================================================ cmake_minimum_required(VERSION 3.16.0) project(Lexilla) #FILE(GLOB LEXER_SRCS "./lexers/*.cxx") FILE(GLOB LEXLIB_SRCS "./lexlib/*.cxx") FILE(GLOB LEXINT_SRCS "./src/*.cxx") SET( LEXER_SRCS ./lexers/LexCPP.cxx ./lexers/LexRuby.cxx ./lexers/LexPython.cxx ) INCLUDE_DIRECTORIES( "./include" ) INCLUDE_DIRECTORIES( "./src" ) INCLUDE_DIRECTORIES( "./lexlib" ) INCLUDE_DIRECTORIES( "../scintilla/include" ) add_definitions( -DSCINTILLA_QT=1 -DSCI_LEXER=1 -D_CRT_SECURE_NO_DEPRECATE=1 -DSTATIC_BUILD=1 ) add_library( lexilla STATIC ${LEXER_SRCS} ${LEXLIB_SRCS} ${LEXINT_SRCS} ) target_link_libraries( lexilla ) ================================================ FILE: lexilla/CONTRIBUTING ================================================ Lexilla is on GitHub at https://github.com/ScintillaOrg/lexilla Bugs, fixes and features should be posted to the Issue Tracker https://github.com/ScintillaOrg/lexilla/issues Patches should include test cases. Add a test case file in lexilla/test/examples/ and run the test program in lexilla/test. The result will be new files with ".styled.new" and ".folded.new" appended containing lexing or folding results. For lexing, there are brace surrounded style numbers for each style start as markup: {5}import{0} {11}contextlib{0} For folding, there are 4 columns of folding results preceding the example text: 2 400 0 + --[[ coding:UTF-8 0 402 0 | comment ]] See the test/README file for more explanation of the folding results. To build lexilla and the tests with gcc there are Windows batch and Unix shell files scripts/RunTest.bat scripts/RunTest.sh. Check the result of the .new files and, if correct, rename replacing ".styled.new" with ".styled" and ".folded.new" with ".folded". Run the tests again and success should be reported. Include the .styled and .folded files in the patch. Including test cases ensures that the change won't be undone by other changes in the future and clarifies the intentions of the author. Either send unified diffs (or patch files) or zip archives with whole files. Mercurial/Git patch files are best as they include author information and commit messages. Questions should go to the scintilla-interest mailing list https://groups.google.com/forum/#!forum/scintilla-interest Code should follow the guidelines at https://www.scintilla.org/SciCoding.html Lexilla is on GitHub so use its facilities rather than SourceForge which is the home of Scintilla. The neilh @ scintilla.org account receives much spam and is only checked occasionally. Almost all Scintilla mail should go to the mailing list. ================================================ FILE: lexilla/License.txt ================================================ License for Lexilla, Scintilla, and SciTE Copyright 1998-2021 by Neil Hodgson All Rights Reserved Permission to use, copy, modify, and distribute this software and its documentation for any purpose and without fee is hereby granted, provided that the above copyright notice appear in all copies and that both that copyright notice and this permission notice appear in supporting documentation. NEIL HODGSON DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL NEIL HODGSON BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ================================================ FILE: lexilla/README ================================================ README for Lexilla library. The Lexilla library contains a set of lexers and folders that provides support for programming, mark-up, and data languages for the Scintilla source code editing component. Lexilla is made available as both a shared library and static library. The shared library is called liblexilla.so / liblexilla.dylib / lexilla.dll on Linux / macOS / Windows. The static library is called liblexilla.a when built with GCC or Clang and liblexilla.lib when built with MSVC. Lexilla is developed on Windows, Linux, and macOS and requires a C++17 compiler. It may work on other Unix platforms like BSD but that is not a development focus. MSVC 2019.4, GCC 9.0, Clang 9.0, and Apple Clang 11.0 are known to work. MSVC is only available on Windows. GCC and Clang work on Windows and Linux. On macOS, only Apple Clang is available. Lexilla requires some headers from Scintilla to build and expects a directory named "scintilla" containing a copy of Scintilla 5+ to be a peer of the Lexilla top level directory conventionally called "lexilla". To use GCC, run lexilla/src/makefile: make To use Clang, run lexilla/test/makefile: make CLANG=1 On macOS, CLANG is set automatically so this can just be make To use MSVC, run lexilla/test/lexilla.mak: nmake -f lexilla.mak To build a debugging version of the library, add DEBUG=1 to the command: make DEBUG=1 The built libraries are copied into lexilla/bin. Lexilla relies on a list of lexers from the lexilla/lexers directory. If any changes are made to the set of lexers then source and build files can be regenerated with the lexilla/scripts/LexillaGen.py script which requires Python 3 and is tested with 3.7+. Unix: python3 LexillaGen.py Windows: pyw LexillaGen.py ================================================ FILE: lexilla/access/LexillaAccess.cxx ================================================ // 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 // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #if !defined(_WIN32) #include #else #include #endif #include "ILexer.h" #include "Lexilla.h" #include "LexillaAccess.h" namespace { #if defined(_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 T FunctionPointer(Function function) noexcept { static_assert(sizeof(T) == sizeof(function)); T fp {}; memcpy(&fp, &function, sizeof(T)); return fp; } #if defined(_WIN32) std::wstring WideStringFromUTF8(std::string_view sv) { const int sLength = static_cast(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.data(), cchWide); return sWide; } #endif // Turn off deprecation checks as LexillaAccess deprecates its wrapper over // the deprecated LexerNameFromID. Thus use within LexillaAccess is intentional. #if defined(__GNUC__) || defined(__clang__) #pragma GCC diagnostic ignored "-Wdeprecated-declarations" #else #pragma warning(disable: 4996) #endif std::string directoryLoadDefault; std::string lastLoaded; struct LexLibrary { Lexilla::CreateLexerFn fnCL; Lexilla::LexerNameFromIDFn fnLNFI; Lexilla::GetLibraryPropertyNamesFn fnGLPN; Lexilla::SetLibraryPropertyFn fnSLP; std::string nameSpace; }; std::vector libraries; std::vector lexers; std::vector libraryProperties; Function FindSymbol(Module m, const char *symbol) noexcept { #if defined(_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; } constexpr bool HasPrefix(std::string_view s, std::string_view prefix) noexcept { return (s.size() >= prefix.size()) && (prefix == s.substr(0, prefix.size())); } } 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 !libraries.empty(); } std::string_view paths = sharedLibraryPaths; lexers.clear(); libraries.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 defined(_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( FindSymbol(lexillaDL, LEXILLA_GETLEXERCOUNT)); GetLexerNameFn fnLexerName = FunctionPointer( 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( FindSymbol(lexillaDL, LEXILLA_CREATELEXER)); LexerNameFromIDFn fnLNFI = FunctionPointer( FindSymbol(lexillaDL, LEXILLA_LEXERNAMEFROMID)); GetLibraryPropertyNamesFn fnGLPN = FunctionPointer( FindSymbol(lexillaDL, LEXILLA_GETLIBRARYPROPERTYNAMES)); SetLibraryPropertyFn fnSLP = FunctionPointer( FindSymbol(lexillaDL, LEXILLA_SETLIBRARYPROPERTY)); GetNameSpaceFn fnGNS = FunctionPointer( FindSymbol(lexillaDL, LEXILLA_GETNAMESPACE)); std::string nameSpace; if (fnGNS) { nameSpace = fnGNS(); nameSpace += LEXILLA_NAMESPACE_SEPARATOR; } LexLibrary lexLib { fnCL, fnLNFI, fnGLPN, fnSLP, nameSpace }; libraries.push_back(lexLib); } } lastLoaded = sharedLibraryPaths; std::set nameSet; for (const LexLibrary &lexLib : libraries) { if (lexLib.fnGLPN) { const char *cpNames = lexLib.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(nameSet.begin(), nameSet.end()); return !libraries.empty(); } Scintilla::ILexer5 *Lexilla::MakeLexer(std::string_view languageName) { std::string sLanguageName(languageName); // Ensure NUL-termination // First, try to match namespace then name suffix for (const LexLibrary &lexLib : libraries) { if (lexLib.fnCL && !lexLib.nameSpace.empty()) { if (HasPrefix(languageName, lexLib.nameSpace)) { Scintilla::ILexer5 *pLexer = lexLib.fnCL(sLanguageName.substr(lexLib.nameSpace.size()).c_str()); if (pLexer) { return pLexer; } } } } // If no match with namespace, try to just match name for (const LexLibrary &lexLib : libraries) { if (lexLib.fnCL) { Scintilla::ILexer5 *pLexer = lexLib.fnCL(sLanguageName.c_str()); if (pLexer) { return pLexer; } } } if (pCreateLexerDefault) { return pCreateLexerDefault(sLanguageName.c_str()); } #if defined(LEXILLA_STATIC) Scintilla::ILexer5 *pLexer = CreateLexer(sLanguageName.c_str()); if (pLexer) { return pLexer; } #endif return nullptr; } std::vector Lexilla::Lexers() { return lexers; } std::string Lexilla::NameFromID(int identifier) { for (const LexLibrary &lexLib : libraries) { if (lexLib.fnLNFI) { const char *name = lexLib.fnLNFI(identifier); if (name) { return name; } } } return std::string(); } std::vector Lexilla::LibraryProperties() { return libraryProperties; } void Lexilla::SetProperty(const char *key, const char *value) { for (const LexLibrary &lexLib : libraries) { if (lexLib.fnSLP) { lexLib.fnSLP(key, value); } } // Standard Lexilla does not have any properties so don't set. } ================================================ FILE: lexilla/access/LexillaAccess.h ================================================ // 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 // The License.txt file describes the conditions under which this software may be distributed. #ifndef LEXILLAACCESS_H #define LEXILLAACCESS_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 Lexers(); [[deprecated]] std::string NameFromID(int identifier); std::vector LibraryProperties(); void SetProperty(const char *key, const char *value); } #endif ================================================ FILE: lexilla/access/README ================================================ 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. ================================================ FILE: lexilla/cppcheck.suppress ================================================ // 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. // Configured for cppcheck 2.12 // 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 performance cost of by-value passing is often small and using a reference decreases // code legibility. passedByValue // cppcheck 2.11 can't find system headers on Win32. missingIncludeSystem // Passing temporary string into hidden object creator functions: they do not hold the argument danglingTemporaryLifetime:lexilla/access/LexillaAccess.cxx returnDanglingLifetime:lexilla/access/LexillaAccess.cxx // cppcheck seems to believe that unique_ptr::get returns void* instead of char** arithOperationsOnVoidPointer:lexilla/lexlib/WordList.cxx // cppcheck 2.11 limits checking of complex functions unless --check-level=exhaustive but that // only finds one false issue in LexRuby checkLevelNormal:lexilla/lexers/LexBash.cxx checkLevelNormal:lexilla/lexers/LexCPP.cxx checkLevelNormal:lexilla/lexers/LexHTML.cxx checkLevelNormal:lexilla/lexers/LexPerl.cxx checkLevelNormal:lexilla/lexers/LexRuby.cxx // Physically but not logically const. constVariablePointer:lexilla/examples/CheckLexilla/CheckLexilla.c // Suppress most lexer warnings since the lexers are maintained by others redundantCondition:lexilla/lexers/LexA68k.cxx constParameterReference:lexilla/lexers/LexAbaqus.cxx constParameterReference:lexilla/lexers/LexAda.cxx constParameterReference:lexilla/lexers/LexAsciidoc.cxx constParameterCallback:lexilla/lexers/LexAsn1.cxx knownConditionTrueFalse:lexilla/lexers/LexAU3.cxx shadowVariable:lexilla/lexers/LexAU3.cxx constParameterReference:lexilla/lexers/LexBaan.cxx unreadVariable:lexilla/lexers/LexBaan.cxx variableScope:lexilla/lexers/LexBaan.cxx constParameterPointer:lexilla/lexers/LexBaan.cxx constParameterReference:lexilla/lexers/LexBash.cxx knownConditionTrueFalse:lexilla/lexers/LexBash.cxx variableScope:lexilla/lexers/LexBash.cxx constVariable:lexilla/lexers/LexBasic.cxx constParameterReference:lexilla/lexers/LexCLW.cxx knownConditionTrueFalse:lexilla/lexers/LexCLW.cxx variableScope:lexilla/lexers/LexCmake.cxx knownConditionTrueFalse:lexilla/lexers/LexCmake.cxx constParameterReference:lexilla/lexers/LexCmake.cxx constParameterReference:lexilla/lexers/LexCOBOL.cxx constParameterReference:lexilla/lexers/LexCoffeeScript.cxx constParameterPointer:lexilla/lexers/LexCoffeeScript.cxx knownConditionTrueFalse:lexilla/lexers/LexCoffeeScript.cxx constVariableReference:lexilla/lexers/LexConf.cxx constParameterReference:lexilla/lexers/LexCPP.cxx variableScope:lexilla/lexers/LexCSS.cxx knownConditionTrueFalse:lexilla/lexers/LexDataflex.cxx constParameterReference:lexilla/lexers/LexDataflex.cxx variableScope:lexilla/lexers/LexDataflex.cxx knownConditionTrueFalse:lexilla/lexers/LexECL.cxx variableScope:lexilla/lexers/LexECL.cxx constParameter:lexilla/lexers/LexEDIFACT.cxx constParameterPointer:lexilla/lexers/LexEDIFACT.cxx knownConditionTrueFalse:lexilla/lexers/LexEiffel.cxx variableScope:lexilla/lexers/LexErlang.cxx knownConditionTrueFalse:lexilla/lexers/LexEScript.cxx constParameter:lexilla/lexers/LexFortran.cxx constParameterReference:lexilla/lexers/LexFortran.cxx redundantContinue:lexilla/lexers/LexFortran.cxx knownConditionTrueFalse:lexilla/lexers/LexFSharp.cxx constParameterReference:lexilla/lexers/LexGAP.cxx constParameterReference:lexilla/lexers/LexGDScript.cxx variableScope:lexilla/lexers/LexGui4Cli.cxx constParameterReference:lexilla/lexers/LexHaskell.cxx constParameterReference:lexilla/lexers/LexHex.cxx knownConditionTrueFalse:lexilla/lexers/LexHex.cxx constVariable:lexilla/lexers/LexHollywood.cxx variableScope:lexilla/lexers/LexInno.cxx constVariableReference:lexilla/lexers/LexInno.cxx constParameterReference:lexilla/lexers/LexJSON.cxx constParameterPointer:lexilla/lexers/LexJulia.cxx constParameterReference:lexilla/lexers/LexJulia.cxx knownConditionTrueFalse:lexilla/lexers/LexJulia.cxx unreadVariable:lexilla/lexers/LexJulia.cxx variableScope:lexilla/lexers/LexJulia.cxx variableScope:lexilla/lexers/LexLaTeX.cxx constParameterReference:lexilla/lexers/LexLaTeX.cxx constParameterPointer:lexilla/lexers/LexMagik.cxx constParameterReference:lexilla/lexers/LexMagik.cxx constParameterReference:lexilla/lexers/LexMarkdown.cxx constParameterPointer:lexilla/lexers/LexMatlab.cxx constParameterReference:lexilla/lexers/LexMatlab.cxx unreadVariable:lexilla/lexers/LexMatlab.cxx variableScope:lexilla/lexers/LexMatlab.cxx variableScope:lexilla/lexers/LexMetapost.cxx constParameterReference:lexilla/lexers/LexModula.cxx variableScope:lexilla/lexers/LexModula.cxx constParameterReference:lexilla/lexers/LexMPT.cxx variableScope:lexilla/lexers/LexMSSQL.cxx shadowArgument:lexilla/lexers/LexMySQL.cxx constParameterReference:lexilla/lexers/LexNim.cxx constParameterReference:lexilla/lexers/LexNimrod.cxx knownConditionTrueFalse:lexilla/lexers/LexNimrod.cxx variableScope:lexilla/lexers/LexNimrod.cxx variableScope:lexilla/lexers/LexNsis.cxx constParameterReference:lexilla/lexers/LexNsis.cxx knownConditionTrueFalse:lexilla/lexers/LexNsis.cxx variableScope:lexilla/lexers/LexOpal.cxx constParameterReference:lexilla/lexers/LexOpal.cxx knownConditionTrueFalse:lexilla/lexers/LexOpal.cxx constParameterReference:lexilla/lexers/LexOScript.cxx constParameterReference:lexilla/lexers/LexPascal.cxx variableScope:lexilla/lexers/LexPB.cxx constParameterReference:lexilla/lexers/LexPerl.cxx constVariableReference:lexilla/lexers/LexPerl.cxx knownConditionTrueFalse:lexilla/lexers/LexPerl.cxx constParameterReference:lexilla/lexers/LexPLM.cxx constParameterReference:lexilla/lexers/LexPO.cxx constParameterReference:lexilla/lexers/LexPython.cxx shadowVariable:lexilla/lexers/LexPowerPro.cxx knownConditionTrueFalse:lexilla/lexers/LexPowerPro.cxx variableScope:lexilla/lexers/LexProgress.cxx constParameterReference:lexilla/lexers/LexProgress.cxx constParameterReference:lexilla/lexers/LexRaku.cxx variableScope:lexilla/lexers/LexRaku.cxx redundantInitialization:lexilla/lexers/LexRegistry.cxx constParameterReference:lexilla/lexers/LexRuby.cxx constParameterReference:lexilla/lexers/LexRust.cxx knownConditionTrueFalse:lexilla/lexers/LexScriptol.cxx variableScope:lexilla/lexers/LexSpecman.cxx unreadVariable:lexilla/lexers/LexSpice.cxx constParameterReference:lexilla/lexers/LexSpice.cxx constParameterReference:lexilla/lexers/LexSTTXT.cxx constParameterReference:lexilla/lexers/LexTACL.cxx knownConditionTrueFalse:lexilla/lexers/LexTACL.cxx clarifyCalculation:lexilla/lexers/LexTADS3.cxx constParameterReference:lexilla/lexers/LexTADS3.cxx constParameterReference:lexilla/lexers/LexTAL.cxx constVariableReference:lexilla/lexers/LexTCL.cxx invalidscanf:lexilla/lexers/LexTCMD.cxx constParameterReference:lexilla/lexers/LexTeX.cxx variableScope:lexilla/lexers/LexTeX.cxx knownConditionTrueFalse:lexilla/lexers/LexTxt2tags.cxx knownConditionTrueFalse:lexilla/lexers/LexVB.cxx constParameterReference:lexilla/lexers/LexVerilog.cxx variableScope:lexilla/lexers/LexVerilog.cxx badBitmaskCheck:lexilla/lexers/LexVerilog.cxx uselessCallsSubstr:lexilla/lexers/LexVerilog.cxx constParameterReference:lexilla/lexers/LexVHDL.cxx constVariable:lexilla/lexers/LexVHDL.cxx shadowVariable:lexilla/lexers/LexVHDL.cxx unreadVariable:lexilla/lexers/LexVHDL.cxx variableScope:lexilla/lexers/LexVHDL.cxx unreadVariable:lexilla/lexers/LexVisualProlog.cxx variableScope:lexilla/lexers/LexVisualProlog.cxx shiftTooManyBitsSigned:lexilla/lexers/LexVisualProlog.cxx iterateByValue:lexilla/lexers/LexVisualProlog.cxx unreadVariable:lexilla/lexers/LexX12.cxx constVariableReference:lexilla/lexers/LexX12.cxx constParameterPointer:lexilla/lexers/LexX12.cxx uselessCallsSubstr:lexilla/lexers/LexX12.cxx constParameterReference:lexilla/lexers/LexYAML.cxx constParameterPointer:lexilla/lexers/LexYAML.cxx knownConditionTrueFalse: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/LexEiffel.cxx constParameterCallback:lexilla/lexers/LexGDScript.cxx constParameterCallback:lexilla/lexers/LexPython.cxx constParameterCallback:lexilla/lexers/LexScriptol.cxx constParameterCallback:lexilla/lexers/LexVB.cxx constVariableReference:lexilla/lexers/LexBibTeX.cxx constVariableReference:lexilla/lexers/LexCSS.cxx constVariableReference:lexilla/lexers/LexCrontab.cxx constVariableReference:lexilla/lexers/LexGui4Cli.cxx constVariableReference:lexilla/lexers/LexMetapost.cxx constVariableReference:lexilla/lexers/LexOpal.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 // cppcheck gives up inside catch.hpp *:lexilla/test/unit/UnitTester.cxx *:lexilla/test/unit/unitTest.cxx // Tests often test things that are always true knownConditionTrueFalse:lexilla/test/unit/testCharacterSet.cxx // cppcheck fails REQUIRE from Catch comparisonOfFuncReturningBoolError:lexilla/test/unit/*.cxx ================================================ FILE: lexilla/delbin.bat ================================================ @del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.ipdb *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog *.lastbuildstate >NUL: ================================================ FILE: lexilla/doc/Lexilla.html ================================================ Lexilla
A library of language lexers for use with Scintilla Release version 5.3.2
Site last modified April 23 2024
 
  • Version 5.3.2 improves COBOL, HTML, Lua, Ruby, and Rust.
  • Version 5.3.1 improves Assembler, Bash, Batch, JavaScript, Python, and Ruby.
  • Version 5.3.0 improves Bash, HTML, and Lua.
  • Version 5.2.9 fixes potential problems on macOS 12 and older when built with Xcode 15.0.
  • Version 5.2.8 improves Python and R.

Lexilla is a free library of language lexers that can be used with the Scintilla editing component. It comes with complete source code and a license that permits use in any free project or commercial product.

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 implement their own lexers and distribute them as they wish.

Current development 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.

Lexilla is currently available for Intel Win32, macOS, and Linux compatible operating systems. It has been run on Windows 10, macOS 10.13+, and on Ubuntu 20.04 but is likely to run on earlier systems as it has no GUI functionality.

You can download Lexilla.

The source code can be downloaded via Git at GitHub Lexilla project page.
git clone https://github.com/ScintillaOrg/lexilla

Current repository status:


Related sites.

Bugs and other issues.

History and contribution credits.

Questions and comments about Lexilla should be directed to the scintilla-interest 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.

================================================ FILE: lexilla/doc/LexillaDoc.html ================================================ Lexilla Documentation
Lexilla icon Lexilla

Lexilla Documentation

Last edited 21 April 2021 NH

Introduction

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.

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.

Different extensions are commonly used for shared libraries: .so on Linux, .dylib on macOS, and .DLL on Windows.

The Lexilla protocol

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.

The Lexilla protocol is a superset of the external lexer protocol and defines these functions that may be exported from a shared library:
int GetLexerCount()
void GetLexerName(unsigned int index, char *name, int buflength)
LexerFactoryFunction GetLexerFactory(unsigned int index)
ILexer5 *CreateLexer(const char *name)
const char *LexerNameFromID(int identifier)
const char *GetLibraryPropertyNames()
void SetLibraryProperty(const char *key, const char *value)
const char *GetNameSpace()

ILexer5 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 ILexer5 - they just take the return from CreateLexer and plug it straight into Scintilla so it can be treated as a machine pointer (void *).

LexerFactoryFunction is defined as a function that takes no arguments and returns an ILexer5 *: ILexer5 *(*LexerFactoryFunction)() but this can be ignored by most client code.

The Lexilla protocol is a superset of the earlier external lexer protocol that defined the first 3 functions (GetLexerCount, GetLexerName, GetLexerFactory) so Lexilla can be loaded by applications that support that protocol. GetLexerFactory will rarely be used now as it is easier to call CreateLexer.

CreateLexer 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 SCI_SETILEXER.

LexerNameFromID is an optional function that returns the name for a lexer identifier. LexerNameFromID(SCLEX_CPP) → "cpp". This is a temporary affordance to make it easier to convert applications to using Lexilla. Applications should move to using lexer names instead of IDs. This function is deprecated, showing warnings with some compilers, and will be removed in a future version of Lexilla.

SetLibraryProperty and GetLibraryPropertyNames 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. SetLibraryProperty("definitions.directory", "/usr/share/xeditor/language-definitions") 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.

GetNameSpace is an optional function that returns a namespace string that can be used to disambiguate lexers with the same name from different providers. If Lexilla and XMLLexers both provide a "cpp" lexer than a request for "cpp" may be satisfied by either but "xmllexers.cpp" unambiguously refers to the "cpp" lexer from XMLLexers.

Building Lexilla

Before using Lexilla it must be built or downloaded.

Lexilla requires some headers from Scintilla to build and expects a directory named "scintilla" containing a copy of Scintilla 5+ to be a peer of the Lexilla top level directory conventionally called "lexilla".

To build Lexilla, in the lexilla/src directory, run make (for gcc or clang)
make
or nmake for MSVC
nmake -f lexilla.mak

After building Lexilla, its test suite can be run with make/nmake in the lexilla/test directory. For gcc or clang
make test
or for MSVC
nmake -f testlexers.mak test
Each test case should show "Lexing ..." and errors will display a diagnostic, commonly showing a difference between the actual and expected result:
C:\u\hg\lexilla\test\examples\python\x.py:1: is different

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.

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++.

Using Lexilla

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 ILexer5 type is used. For C, ILexer.h should not be included as C does not understand it and from C, void* is used instead of ILexer5*.

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.

From C - CheckLexilla

An example C program for accessing Lexilla is provided in lexilla/examples/CheckLexilla. Build with make and run with make check.

From C++ - LexillaAccess

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.

LexillaAccess supports loading multiple shared libraries implementing the Lexilla protocol at one time.

From Qt

For Qt, use either LexillaAccess from above or Qt's QLibrary class. With 'Call' defined to call Scintilla APIs.
#if _WIN32
    typedef void *(__stdcall *CreateLexerFn)(const char *name);
#else
    typedef void *(*CreateLexerFn)(const char *name);
#endif
    QFunctionPointer fn = QLibrary::resolve("lexilla", "CreateLexer");
    void *lexCpp = ((CreateLexerFn)fn)("cpp");
    Call(SCI_SETILEXER, 0, (sptr_t)(void *)lexCpp);

Applications may discover the set of lexers provided by a library by first calling GetLexerCount to find the number of lexers implemented in the library then looping over calling GetLexerName with integers 0 to GetLexerCount()-1.

Applications may set properties on a library by calling SetLibraryProperty if provided. This may be needed for initialisation so should before calling GetLexerCount or CreateLexer. A set of property names may be available from GetLibraryPropertyNames 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.

Modifying or adding lexers

Lexilla can be modified or a new library created that can be used to replace or augment Lexilla.

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 SetLibraryProperty(const char *key, const char *value) 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 const char *GetLibraryPropertyNames() function.

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.

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 make and check by running CheckLexilla against it with make check.

================================================ FILE: lexilla/doc/LexillaDownload.html ================================================ Download Lexilla
Scintilla icon Download Lexilla
Windows   GTK/Linux  

Download.

The license for using Lexilla is similar to that of Python containing very few restrictions.

Release 5.3.2

Source Code

The source code package contains all of the source code for Lexilla but no binary executable code and is available in
  • zip format (1.3M) commonly used on Windows
  • tgz format (0.9M) commonly used on Linux and compatible operating systems
Instructions for building on both Windows and Linux are included in the readme file.

Windows Executable Code

There is no download available containing only the Lexilla DLL. However, it is included in the SciTE executable full download as Lexilla.DLL.

SciTE is a good demonstration of Lexilla.

Previous versions can be downloaded from the history page.

================================================ FILE: lexilla/doc/LexillaHistory.html ================================================ Lexilla
Scintilla icon Lexilla

History of Lexilla

Lexilla was originally code that was part of the Scintilla project. Thus it shares much of the history and contributors of Scintilla before it was extracted as its own project.

Contributors

Thanks to all the people that have contributed patches, bug reports and suggestions.

Source code and documentation have been contributed by

Atsuo Ishimoto Mark Hammond Francois Le Coguiec Dale Nagata
Ralf Reinhardt Philippe Lhoste Andrew McKinlay Stephan R. A. Deibel
Hans Eckardt Vassili Bourdo Maksim Lin Robin Dunn
John Ehresman Steffen Goeldner Deepak S. DevelopMentor
Yann Gaillard Aubin Paul Jason Diamond Ahmad Baitalmal
Paul Winwood Maxim Baranov Ragnar Højland Christian Obrecht
Andreas Neukoetter Adam Gates Steve Lhomme Ferdinand Prantl
Jan Dries Markus Gritsch Tahir Karaca Ahmad Zawawi
Laurent le Tynevez Walter Braeu Ashley Cambrell Garrett Serack
Holger Schmidt ActiveState James Larcombe Alexey Yutkin
Jan Hercek Richard Pecl Edward K. Ream Valery Kondakoff
Smári McCarthy Clemens Wyss Simon Steele Serge A. Baranov
Xavier Nodet Willy Devaux David Clain Brendon Yenson
Vamsi Potluru Praveen Ambekar Alan Knowles Kengo Jinno
Valentin Valchev Marcos E. Wurzius Martin Alderson Robert Gustavsson
José Fonseca Holger Kiemes Francis Irving Scott Kirkwood
Brian Quinlan Ubi Michael R. Duerig Deepak T
Don Paul Beletsky Gerhard Kalab Olivier Dagenais Josh Wingstrom
Bruce Dodson Sergey Koshcheyev Chuan-jian Shen Shane Caraveo
Alexander Scripnik Ryan Christianson Martin Steffensen Jakub Vrána
The Black Horus Bernd Kreuss Thomas Lauer Mike Lansdaal
Yukihiro Nakai Jochen Tucht Greg Smith Steve Schoettler
Mauritius Thinnes Darren Schroeder Pedro Guerreiro Steven te Brinke
Dan Petitt Biswapesh Chattopadhyay Kein-Hong Man Patrizio Bekerle
Nigel Hathaway Hrishikesh Desai Sergey Puljajev Mathias Rauen
Angelo Mandato Denis Sureau Kaspar Schiess Christoph Hösler
João Paulo F Farias Ron Schofield Stefan Wosnik Marius Gheorghe
Naba Kumar Sean O'Dell Stefanos Togoulidis Hans Hagen
Jim Cape Roland Walter Brian Mosher Nicholas Nemtsev
Roy Wood Peter-Henry Mander Robert Boucher Christoph Dalitz
April White S. Umar Trent Mick Filip Yaghob
Avi Yegudin Vivi Orunitia Manfred Becker Dimitris Keletsekis
Yuiga Davide Scola Jason Boggs Reinhold Niesner
Jos van der Zande Pescuma Pavol Bosik Johannes Schmid
Blair McGlashan Mikael Hultgren Florian Balmer Hadar Raz
Herr Pfarrer Ben Key Gene Barry Niki Spahiev
Carsten Sperber Phil Reid Iago Rubio Régis Vaquette
Massimo Corà Elias Pschernig Chris Jones Josiah Reynolds
Robert Roessler rftp.com Steve Donovan Jan Martin Pettersen Sergey Philippov
Borujoa Michael Owens Franck Marcia Massimo Maria Ghisalberti
Frank Wunderlich Josepmaria Roca Tobias Engvall Suzumizaki Kimitaka
Michael Cartmell Pascal Hurni Andre Randy Butler
Georg Ritter Michael Goffioul Ben Harper Adam Strzelecki
Kamen Stanev Steve Menard Oliver Yeoh Eric Promislow
Joseph Galbraith Jeffrey Ren Armel Asselin Jim Pattee
Friedrich Vedder Sebastian Pipping Andre Arpin Stanislav Maslovski
Martin Stone Fabien Proriol mimir Nicola Civran
Snow Mitchell Foral Pieter Holtzhausen Waldemar Augustyn
Jason Haslam Sebastian Steinlechner Chris Rickard Rob McMullen
Stefan Schwendeler Cristian Adam Nicolas Chachereau Istvan Szollosi
Xie Renhui Enrico Tröger Todd Whiteman Yuval Papish
instanton Sergio Lucato VladVRO Dmitry Maslov
chupakabra Juan Carlos Arevalo Baeza Nick Treleaven Stephen Stagg
Jean-Paul Iribarren Tim Gerundt Sam Harwell Boris
Jason Oster Gertjan Kloosterman alexbodn Sergiu Dotenco
Anders Karlsson ozlooper Marko Njezic Eugen Bitter
Christoph Baumann Christopher Bean Sergey Kishchenko Kai Liu
Andreas Rumpf James Moffatt Yuzhou Xin Nic Jansma
Evan Jones Mike Lischke Eric Kidd maXmo
David Severwright Jon Strait Oliver Kiddle Etienne Girondel
Haimag Ren Andrey Moskalyov Xavi Toby Inkster
Eric Forgeot Colomban Wendling Neo Jordan Russell
Farshid Lashkari Sam Rawlins Michael Mullin Carlos SS
vim Martial Demolins Tino Weinkauf Jérôme Laforge
Udo Lechner Marco Falda Dariusz Knociński Ben Fisher
Don Gobin John Yeung Adobe Elizabeth A. Irizarry
Mike Schroeder Morten MacFly Jaime Gimeno Thomas Linder Puls
Artyom Zuikov Gerrit Occam's Razor Ben Bluemel
David Wolfendale Chris Angelico Marat Dukhan Stefan Weil
Rex Conn Ross McKay Bruno Barbieri Gordon Smith
dimitar Sébastien Granjoux zeniko James Ribe
Markus Nißl Martin Panter Mark Yen Philippe Elsass
Dimitar Zhekov Fan Yang Denis Shelomovskij darmar
John Vella Chinh Nguyen Sakshi Verma Joel B. Mohler
Isiledhel Vidya Wasi G. Hu Byron Hawkins
Alpha John Donoghue kudah Igor Shaula
Pavel Bulochkin Yosef Or Boczko Brian Griffin Özgür Emir
Neomi OmegaPhil SiegeLord Erik
TJF Mark Robinson Thomas Martitz felix
Christian Walther Ebben Robert Gieseke Mike M
nkmathew Andreas Tscharner Lee Wilmott johnsonj
Vicente Nick Gravgaard Ian Goldby Holger Stenger
danselmi Mat Berchtold Michael Staszewski Baurzhan Muftakhidinov
Erik Angelin Yusuf Ramazan Karagöz Markus Heidelberg Joe Mueller
Mika Attila JoMazM Markus Moser Stefan Küng
Jiří Techet Jonathan Hunt Serg Stetsuk Jordan Jueckstock
Yury Dubinsky Sam Hocevar Luyomi Matt Gilarde
Mark C Johannes Sasongko fstirlitz Robin Haberkorn
Pavel Sountsov Dirk Lorenzen Kasper B. Graversen Chris Mayo
Van de Bugger Tse Kit Yam SmartShare Systems Morten Brørup
Alexey Denisov Justin Dailey oirfeodent A-R-C-A
Roberto Rossi Kenny Liu Iain Clarke desto
John Flatness Thorsten Kani Bernhard M. Wiedemann Baldur Karlsson
Martin Kleusberg Jannick Zufu Liu Simon Sobisch
Georger Araújo Tobias Kühne Dimitar Radev Liang Bai
Gunter Königsmann Nicholai Benalal Uniface Raghda Morsy
Giuseppe Corbelli Andreas Rönnquist Henrik Hank Luke Rasmussen
Philipp maboroshin Gokul Krishnan John Horigan
jj5 Jad Altahan Andrea Ricchi Juarez Rudsatz
Wil van Antwerpen Hodong Kim Michael Conrad Dejan Budimir
Andreas Falkenhahn Mark Reay David Shuman McLoo
Shmuel Zeigerman Chris Graham Hugues Larrive Prakash Sahni
Michel Sauvard uhf7 gnombat Derek Brown
Robert Di Pardo riQQ YX Hao Bertrand Lacoste
Ivan Ustûžanin Rainer Kottenhoff feitoi vsl7
Michael Heath Antonio Cebrián David Yu Yang Arkadiusz Michalski
Red_M cdbdev Andrey Smolyakov Knut Leimbert
German Aizek Tsuyoshi Miyake Martin Schäfer RainRat

Releases

Release 5.3.2

  • Released 23 April 2024.
  • COBOL: Stop string literal continuing over line end. Issue #229.
  • COBOL: Stop doc comment assigning different styles to \r and \n at line end. Issue #229.
  • COBOL: Recognize keywords that start with 'V'. Issue #230.
  • COBOL: Recognize comments after tag or that start with '/'. Issue #231.
  • HTML: Implement substyles for tags, attributes, and identifiers SCE_H_TAG, SCE_H_ATTRIBUTE, SCE_HJ_WORD, SCE_HJA_WORD, SCE_HB_WORD, SCE_HP_WORD, SCE_HPHP_WORD.
  • HTML: Implement context-sensitive attributes. "tag.attribute" matches "attribute" only inside "tag".
  • HTML: Match standard handling of comments. Issue #232.
  • Lua: Implement substyles for identifiers SCE_LUA_IDENTIFIER.
  • Ruby: Allow non-ASCII here-doc delimiters. Issue #234.
  • Ruby: Allow modifier if, unless, while and until after heredoc delimiter. Issue #236.
  • Rust: Recognize raw identifiers. Issue #239, Pull request #240.

Release 5.3.1

  • Released 5 March 2024.
  • Assembler: After comments, treat \r\n line ends the same as \n. This makes testing easier.
  • Bash: Fix folding when line changed to/from comment and previous line is comment. Issue #224.
  • Batch: Fix handling ':' next to keywords. Issue #222.
  • JavaScript: in cpp lexer, add lexer.cpp.backquoted.strings=2 mode to treat ` back-quoted strings as template literals which allow embedded ${expressions}. Issue #94.
  • Python: fix lexing of rb'' and rf'' strings. Issue #223, Pull request #227.
  • Ruby: fix lexing of methods on numeric literals like '3.times' so the '.' and method name do not appear in numeric style. Issue #225.

Release 5.3.0

  • Released 27 December 2023.
  • Fix calling AddStaticLexerModule by defining as C++ instead of C which matches header. Bug #2421.
  • Bash: Fix shift operator << incorrectly recognized as here-doc. Issue #215.
  • Bash: Fix termination of '${' with first unquoted '}' instead of nesting. Issue #216.
  • HTML: JavaScript double-quoted strings may escape line end with '\'. Issue #214.
  • Lua: recognize --- doc comments. Defined by LDoc. Does not recognize --[[-- doc comments which seem less common.

Release 5.2.9

  • Released 18 November 2023.
  • Xcode build settings changed to avoid problems with Xcode 15.0.

Release 5.2.8

  • Released 5 November 2023.
  • Python: Update f-string handling to match PEP 701 and Python 3.12. Controlled with property lexer.python.strings.f.pep.701. Issue #150, Pull request #209.
  • R: Fix escape sequence highlighting with change of for loop to while loop. Issue #206, Pull request #207.
  • Minimum supported macOS release increased to 10.13.

Release 5.2.7

  • Released 22 September 2023.
  • Fix building on Windows with non-English environment. Pull request #200.
  • Bash: fix line continuation for comments and when multiple backslashes at line end. Issue #195.
  • Bash: treat += as operator and, inside arithmetic expressions, treat ++ and -- as operators. Issue #197.
  • Bash: improve backslash handling inside backquoted command substitution and fix $ at end of backtick expression. Issue #194.
  • Bash: treat words that are similar to numbers but invalid wholly as identifiers. Issue #199.
  • Bash: consistently handle '-' options at line start and after '|' as identifiers. Issue #202.
  • Bash: handle '-' options differently in [ single ] and [[ double ]] bracket constructs. Issue #203.
  • F#: improve speed of folding long lines. Issue #198.
  • HTML: fix invalid entity at line end and terminate invalid entity before invalid character. Issue #192.

Release 5.2.6

  • Released 26 July 2023.
  • Include empty word list names in value returned by DescribeWordListSets and SCI_DESCRIBEKEYWORDSETS. Issue #175, Pull request #176.
  • Bash: style here-doc end delimiters as SCE_SH_HERE_DELIM instead of SCE_SH_HERE_Q. Issue #177.
  • Bash: allow '$' as last character in string. Issue #180, Pull request #181.
  • Bash: fix state after expansion. Highlight all numeric and file test operators. Don't highlight dash in long option as operator. Issue #182, Pull request #183.
  • Bash: strict checking of special parameters ($*, $@, $$, ...) with property lexer.bash.special.parameter to specify valid parameters. Issue #184, Pull request #186.
  • Bash: recognize keyword before redirection operators (< and >). Issue #188, Pull request #189.
  • Errorlist: recognize Bash diagnostic messages.
  • HTML: allow ASP block to terminate inside line comment. Issue #185.
  • HTML: fix folding with JSP/ASP.NET <%-- comment. Issue #191.
  • HTML: fix incremental styling of multi-line ASP.NET directive. Issue #191.
  • Matlab: improve arguments blocks. Add support for multiple arguments blocks. Prevent "arguments" from being keyword in function declaration line. Fix semicolon handling. Pull request #179.
  • Visual Prolog: add support for embedded syntax with SCE_VISUALPROLOG_EMBEDDED and SCE_VISUALPROLOG_PLACEHOLDER.
    Styling of string literals changed with no differentiation between literals with quotes and those that are prefixed with "@". Quote characters are in a separate style (SCE_VISUALPROLOG_STRING_QUOTE) to contents (SCE_VISUALPROLOG_STRING).
    SCE_VISUALPROLOG_CHARACTER, SCE_VISUALPROLOG_CHARACTER_TOO_MANY, SCE_VISUALPROLOG_CHARACTER_ESCAPE_ERROR, SCE_VISUALPROLOG_STRING_EOL_OPEN, and SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL were removed (replaced with SCE_VISUALPROLOG_UNUSED[1-5]). Pull request #178.

Release 5.2.5

  • Released 31 May 2023.
  • Add CharacterSetArray constructor without setBase initial argument for common case where this is setNone and the initialSet argument completely defines the characters. This shortens and clarifies use of CharacterSetArray.
  • Bash: implement highlighting inside quoted elements and here-docs. Controlled with properties lexer.bash.styling.inside.string, lexer.bash.styling.inside.backticks, lexer.bash.styling.inside.parameter, and lexer.bash.styling.inside.heredoc. Issue #154, Issue #153, Feature #1033.
  • Bash: add property lexer.bash.command.substitution to choose how to style command substitutions. 0 → SCE_SH_BACKTICKS; 1 → surrounding "$(" and ")" as operators and contents styled as bash code; 2 → use distinct styles (base style + 64) for contents. Choice (2) is a provisional feature and details may change before it is finalized. Issue #153.
  • Bash: fix nesting of parameters (SCE_SH_PARAM) like ${var/$sub/"${rep}}"}. Issue #154.
  • Bash: fix single character special parameters like $? by limiting style. Issue #154.
  • Bash: treat "$$" as special parameter and end scalars before "$". Issue #154.
  • Bash: treat "<<" in arithmetic contexts as left bitwise shift operator instead of here-doc. Issue #137.
  • Batch: style SCE_BAT_AFTER_LABEL used for rest of line after label which is not executed. Issue #148.
  • F#: Lex interpolated verbatim strings as verbatim. Issue #156.
  • VB: allow multiline strings when lexer.vb.strings.multiline set. Issue #151.

Release 5.2.4

Release 5.2.3

  • Released 8 March 2023.
  • Add scripts/PromoteNew.bat script to promote .new files after checking.
  • Makefile: Remove 1024-byte line length limit..
  • Ruby: Add new lexical classes for % literals SCE_RB_STRING_W (%w non-interpolable string array), SCE_RB_STRING_I (%i non-interpolable symbol array), SCE_RB_STRING_QI (%I interpolable symbol array), and SCE_RB_STRING_QS (%s symbol). Issue #124.
  • Ruby: Disambiguate %= which may be a quote or modulo assignment. Issue #124, Bug #1255, Bug #2182.
  • Ruby: Fix additional fold level for single character in SCE_RB_STRING_QW. Issue #132.
  • Ruby: Set SCE_RB_HERE_QQ for unquoted and double-quoted heredocs and SCE_RB_HERE_QX for backticks-quoted heredocs. Issue #134.
  • Ruby: Recognise #{} inside SCE_RB_HERE_QQ and SCE_RB_HERE_QX. Issue #134.
  • Ruby: Improve regex and heredoc recognition. Issue #136.
  • Ruby: Highlight #@, #@@ and #$ style interpolation. Issue #140.
  • Ruby: Fix folding for multiple heredocs started on one line. Fix folding when there is a space after heredoc opening delimiter. Issue #135.
  • YAML: Remove 1024-byte line length limit.

Release 5.2.2

  • Released 8 February 2023.
  • C++: Fix keywords that start with non-ASCII. Also affects other lexers. Issue #130.
  • Matlab: Include more prefix and suffix characters in numeric literals. Issue #120.
  • Matlab: More accurate treatment of line ends inside strings. Matlab and Octave are different here. Issue #18.
  • Modula-3: Don't treat identifier suffix that matches keyword as keyword. Issue #129.
  • Modula-3: Fix endless loop in folder. Issue #128.
  • Modula-3: Fix access to lines beyond document end in folder. Issue #131.
  • Python: Don't highlight match and case as keywords in contexts where they probably aren't used as keywords. Pull request #122.
  • X12: Support empty envelopes. Bug #2369.

Release 5.2.1

  • Released 6 December 2022.
  • Update to Unicode 14. Feature #1461.
  • Change default compilation optimization option to favour speed over space. -O2 for MSVC and -O3 for gcc and clang.
  • Batch: Fix comments starting inside strings. Issue #115.
  • F#: Lex signed numeric literals more accurately. Issue #110, Issue #111.
  • F#: Add specifiers for 64-bit integer and floating point literals. Issue #112.
  • Markdown: Stop styling numbers at line start in PRECHAR style. Issue #117.
  • PowerShell: Recognise numeric literals more accurately. Issue #118.

Release 5.2.0

  • Released 12 October 2022.
  • PowerShell: End comment before \r carriage return so \r and \n in same SCE_POWERSHELL_DEFAULT style. Pull request #99.
  • PowerShell: Fix character truncation bug that lead to 'ġ' styled as an operator since its low 8 bits are equal to '!'.
  • R: Support hexadecimal, float exponent and number suffix. Issue #101.
  • R: Highlight backticks. Pull request #102.
  • R: Highlight raw strings. Issue #100.
  • R: Optionally highlight escape sequences in strings. Issue #100.
  • Fix early truncation from LexAccessor::GetRange and LexAccessor::GetRangeLowered. Issue #17.

Release 5.1.9

  • Released 27 August 2022.
  • Julia: Parse unicode forall and exists as identifiers #42314. Pull request #98.
  • Julia: Parse apostrophe as char and not adjoint after exclamation. Issue #97, Pull request #98.
  • Properties: Don't set header flag for empty section. Issue #96.

Release 5.1.8

  • Released 10 July 2022.
  • F#: Recognize nested comments in F#. Issue #93.
  • MS SQL: Recognize nested comments in Transact-SQL. Issue #87.
  • MS SQL: Preference data types more consistently to not depend on how lexing is broken up into segments. This is needed because there are keywords that are both data type names and function names such as 'CHAR'. Issue #90.
  • PowerShell: Fix single quoted strings to not treat backtick as escape. Pull request #92.
  • Visual Prolog: Treat \r\n line ends the same as \n. This makes testing easier. Add test case. Issue #83.
  • Visual Prolog: Allow disabling verbatim strings. Pull request #89.
  • Visual Prolog: Support backquoted strings. Pull request #89.

Release 5.1.7

  • Released 22 May 2022.
  • Add LexAccessor::StyleIndexAt to retrieve style values as unsigned to handle styles > 127 better. Issue #61.
  • Associate more than one file extension with a setting for testing. Issue #81.
  • CMake: Fix folding of "ElseIf". Issue #77, Pull request #78, Bug #2213.
  • HTML: Fix folding of JavaScript doc comments. Bug #2219.
  • Matlab: add "classdef" and "spmd" to folding keywords. Pull request #70.
  • Matlab: handle "arguments" contextual keyword. Pull request #70.
  • Matlab: improve support of class definition syntax. Pull request #75.
  • Raku: fix escape detection. Pull request #76.
  • Ruby: fix character sequence "?\\#" to not include '#' in SCE_RB_NUMBER as only second '\' is quoted. Issue #69.
  • Ruby: improve styling of ternary expressions as commonly used. Issue #69.
  • VHDL: support folding for VHDL 08 else-generate and case-generate. Pull request #80.

Release 5.1.6

  • Released 31 March 2022.
  • Implement conditional statements "if" and "match", comparison function "$(=", and "FileNameExt" property in TestLexers to allow varying lexer properties over different files. Issue #62.
  • Add LexAccessor::BufferStyleAt to retrieve style values to simplify logic and improve performance. Issue #54.
  • Markdown: Optionally style all of Markdown header lines. Enabled with lexer.markdown.header.eolfill=1. Issue #60.
  • Ruby: Fix operator method styling so next word not treated as method name. Issue #65.
  • Ruby: Fix folding for Ruby 3 endless method definition. Issue #65.
  • Ruby: Fold string array SCE_RB_STRING_QW. Issue #65.
  • Ruby: Fix final \n in indented heredoc to be SCE_RB_HERE_Q. Issue #66.
  • Ruby: Fix heredoc recognition when '.' and ',' used in method calls and after SCE_RB_GLOBAL. Classify word after heredoc delimiter instead of styling as keyword. Issue #67.
  • Ruby: Improve method highlighting so method name is styled as SCE_RB_DEFNAME and class/object is styled appropriately. Issue #68.

Release 5.1.5

  • Released 9 February 2022.
  • Bash: Treat \r\n line ends the same as \n. This makes testing easier. Issue #57.
  • Batch: Recognise "::" comments when second command on line. Bug #2304.
  • F#: Recognise format specifiers in interpolated strings and %B for binary. Issue #46.
  • F#: More accurate line-based folding. Issue #56.
  • HTML: Fix folding inside script blocks. Issue #47, Issue #53.
  • Inno Setup: Fix multiline comments in code. Issue #44.
  • Python: Add attribute style with properties lexer.python.identifier.attributes and lexer.python.decorator.attributes. Pull request #49.
  • Allow choice of object file directory with makefile by setting DIR_O. Issue #50.

Release 5.1.4

  • Released 7 December 2021.
  • Add AsciiDoc lexer. Pull request #39.
  • Add GDScript lexer. Some behaviour and lexical states may change before this lexer is stable. Pull request #41.
  • Fix strings ending in escaped '\' in F#. Issue #38.
  • Better handling of bad terminators and folding for X12. Feature #1420.

Release 5.1.3

  • Released 8 November 2021.
  • Fix parsing of 128-bit integer literals in Rust. Issue #33.
  • Fix different styles between \r and \n at end of line comments for Rust. Issue #34.
  • For Rust, don't go past end when file ends with unterminated block comment. Issue #35.

Release 5.1.2

  • Released 23 September 2021.
  • Implement conditional group rules in CSS. Issue #25, Pull request #28.
  • Allow F# triple-quoted strings to interpolate string literals. Issue #21.
  • Highlight F# printf specifiers in type-checked interpolated strings. Issue #24.
  • Fix styling for Inno Setup scripts handling unterminated strings, message sections, and avoid terminating comments between CR and LF. Pull request #29. Feature #1415.
  • Fix Markdown hang when document ends with "`", "*", "_", or similar. Issue #23.
  • Treat '.' as an operator instead of part of a word for PHP. Issue #22. Bug #2225.
  • Check PHP numeric literals, showing invalid values with default style instead of numeric. Issue #20.
  • For PHP, recognize start of comment after numeric literal. Issue #20. Bug #2143.
  • For PHP, recognize PHP code within JavaScript strings. Pull request #27.

Release 5.1.1

  • Released 26 July 2021.
  • On 32-bit Win32 using Visual C++ projects, stop exported functions ending with @n causing failures with GetProcAddress.
  • Fixed crash when calling TagsOfStyle on C++ lexer after allocating substyles.
  • Fixed folding for Julia which could be inconsistent depending on range folded. Added SCE_JULIA_KEYWORD4 and SCE_JULIA_TYPEOPERATOR lexical styles and changed keyword set 4 from "Raw string literals" to "Built in functions". Property lexer.julia.string.interpolation removed. Updated set of characters for identifiers. Pull request #13.
  • Fixed Markdown emphasis spans to only be recognized when closed in same paragraph. Bug #1216.
  • Fixed Markdown code block to terminate when end marker is indented. Display all of end marker in code block style. Only recognize inline code when closed in same paragraph. Bug #2247.
  • Fixed Matlab to not allow escape sequences in double-quoted strings. Issue #18.
  • Support flexible heredoc and nowdoc syntax for PHP. Issue #19.
  • Enabled '_' digit separator in numbers for PHP. Issue #19.
  • Stop styling attributes as comments for PHP. Issue #19.

Release 5.1.0

  • Released 23 June 2021.
  • This is a stable release. The Lexilla protocol should remain compatible through 5.x releases.
  • Fixed bugs with styling Erlang by handling \n and \r\n line endings consistently.
  • Fixed folding for F# open statements and for strings that contain comment prefixes.
  • Format specifiers lexed in F# strings.
  • Fixed folding for ASP files where scripts were treated inconsistently when '<%' was included or not included in range examined.
  • Fixed folding of Raku heredocs that start with "q:to" or "qq:to".
  • Fixed folding at end of Ruby files where these is no final new line.
  • Made folding of Tcl files more consistent by always treating completely empty lines as whitespace.
  • Fixed styling of "a:b" with no spaces in YAML as a single piece of text instead of a key-value pair. Pull request #15.

Release 5.0.3

  • Released 2 June 2021.
  • Add namespace feature with GetNameSpace function.
  • Add Julia lexer. Feature #1380.
  • Fix transition to comment for --> inside JavaScript string. Bug #2207.
  • Fix variable expansion in Batch. Issue #4.
  • Fix empty link titles in Markdown. Bug #2235. Also fix detection of whether the previous line had content which treated '\n' and '\r\n' line endings differently.
  • Remove nested comment and long string support as these were removed from Lua. Bug #2205.
  • Update to Unicode 13. Feature #1379.
  • AddStaticLexerModule function adds a static lexer to Lexilla's list.
  • On Win32 enable hardware-enforced stack protection. Feature #1405.
  • On 32-bit Win32 using g++, stop exported functions ending with @n causing failures with GetProcAddress. Issue #10.

Release 5.0.2

  • Released 23 April 2021.
  • Fix assertion in cpp lexer handling of preprocessor. Empty preprocessor statement '#' caused preprocessor history to be stored on incorrect line number. Dangling #else or #elif without corresponding #if led to inconsistent state. Change treatment of empty preprocessor statement to set subsequent line end characters in preprocessor style as this is more consistent with other preprocessor directives and avoids differences between \n and \r\n line ends. Bug #2245.

Release 5.0.1

  • Released 9 April 2021.
  • Add LexerNameFromID function to Lexilla protocol as optional and temporary to help applications migrate to Lexilla. It is marked deprecated and will be removed in a future release.
  • The cpp lexer supports XML styled comment doc keywords. Pull request #2.
  • The errorlist lexer detects NMAKE fatal errors and Microsoft linker errors as SCE_ERR_MS.

Release 5.0.0

  • Released 5 March 2021.
  • First version that separates Lexilla from Scintilla. Each of the 3 projects now has a separate history page but history before 5.0.0 remains combined.
  • Lexer added for F#.

Lexilla became a separate project at this point.

Release 4.4.6

  • Released 1 December 2020.
  • Fix building with Xcode 12. Bug #2187.

Release 4.4.5

  • Released 11 September 2020.
  • Lexilla interface supports setting initialisation properties on lexer libraries with SetLibraryProperty and GetLibraryPropertyNames functions. These are called by SciTE which will forward properties to lexer libraries that are prefixed with "lexilla.context.".
  • Allow cross-building for GTK by choosing pkg-config. Bug #2189.
  • On GTK, allow setting CPPFLAGS (and LDFLAGS for SciTE) to support hardening. Bug #2191.
  • Changed SciTE's indent.auto mode to set tab size to indent size when file uses tabs for indentation. Bug #2198.
  • Fix position of marker symbols for SC_MARGIN_RTEXT which were being moved based on width of text.
  • Fixed bug on Win32 where cursor was flickering between hand and text over an indicator with hover style. Bug #2170.
  • Fixed bug where hovered indicator was not returning to non-hover appearance when mouse moved out of window or into margin. Bug #2193.
  • Fixed bug where a hovered INDIC_TEXTFORE indicator was not applying the hover colour to the whole range. Bug #2199.
  • Fixed bug where gradient indicators were not showing hovered appearance.
  • Fixed bug where layout caching was ineffective. Bug #2197.
  • For SciTE, don't show the output pane for quiet jobs. Feature #1365.
  • Support command.quiet for SciTE on GTK. Feature #1365.
  • Fixed a bug in SciTE with stack balance when a syntax error in the Lua startup script caused continuing failures to find functions after the syntax error was corrected. Bug #2176.
  • Added method for iterating through multiple vertical edges: SCI_GETMULTIEDGECOLUMN. Feature #1350.

Release 4.4.4

  • Released 21 July 2020.
  • End of line annotations implemented. Bug #2141.
  • Add SCI_BRACEMATCHNEXT API. Feature #1368.
  • The latex lexer supports lstlisting environment that is similar to verbatim. Feature #1358.
  • For SciTE on Linux, place liblexilla.so and libscintilla.so in /usr/lib/scite. Bug #2184.
  • Round SCI_TEXTWIDTH instead of truncating as this may be more accurate when sizing application elements to match text. Feature #1355.
  • Display DEL control character as visible "DEL" block like other control characters. Feature #1369.
  • Allow caret width to be up to 20 pixels. Feature #1361.
  • SciTE on Windows adds create.hidden.console option to stop console window flashing when Lua script calls os.execute or io.popen.
  • Fix translucent rectangle drawing on Qt. When drawing a translucent selection, there were edge artifacts as the calls used were drawing outlines over fill areas. Make bottom and right borders on INDIC_ROUNDBOX be same intensity as top and left. Replaced some deprecated Qt calls with currently supported calls.
  • Fix printing on Windows to use correct text size. Bug #2185.
  • Fix bug on Win32 where calling WM_GETTEXT for more text than in document could return less text than in document.
  • Fixed a bug in SciTE with Lua stack balance causing failure to find functions after reloading script. Bug #2176.

Release 4.4.3

  • Released 3 June 2020.
  • Fix syntax highlighting for SciTE on Windows by setting executable directory for loading Lexilla. Bug #2181.

Release 4.4.2

  • Released 2 June 2020.
  • On Cocoa using Xcode changed Lexilla.dylib install path to @rpath as would otherwise try /usr/lib which won't work for sandboxed applications.
  • On Cocoa using Xcode made work on old versions of macOS by specifying deployment target as 10.8 instead of 10.15.
  • On Win32 fix static linking of Lexilla by specifying calling convention in Lexilla.h.
  • SciTE now uses default shared library extension even when directory contains '.'.

Release 4.4.0

  • Released 1 June 2020.
  • Added Xcode project files for Lexilla and Scintilla with no lexers (cocoa/Scintilla).
  • For GTK, build a shared library with no lexers libscintilla.so or libscintilla.dll.
  • Lexilla used as a shared library for most builds of SciTE except for the single file executable on Win32. On GTK, Scintilla shared library used. LexillaLibrary code can be copied out of SciTE for other applications that want to interface to Lexilla.
  • Constants in Scintilla.h can be disabled with SCI_DISABLE_AUTOGENERATED.
  • Implement per-monitor DPI Awareness on Win32 so both Scintilla and SciTE will adapt to the display scale when moved between monitors. Applications should forward WM_DPICHANGED to Scintilla. Bug #2171, Bug #2063.
  • Optimized performance when opening huge files. Feature #1347.
  • Add Appearance and Contrast properties to SciTE that allow customising visuals for dark mode and high contrast modes.
  • Fixed bug in Batch lexer where a single character line with a single character line end continued state onto the next line.
  • Added SCE_ERR_GCC_EXCERPT style for GCC 9 diagnostics in errorlist lexer.
  • Fixed buffer over-read bug with absolute references in MMIXAL lexer. Bug #2019.
  • Fixed bug with GTK on recent Linux distributions where underscores were invisible. Bug #2173.
  • Fixed GTK on Linux bug when pasting from closed application. Bug #2175.
  • Fixed bug in SciTE with Lua stack balance. Bug #2176.
  • For macOS, SciTE reverts to running python (2) due to python3 not being available in the sandbox.

Release 4.3.3

  • Released 27 April 2020.
  • Added Visual Studio project files for Lexilla and Scintilla with no lexers.
  • Add methods for iterating through the marker handles and marker numbers on a line: SCI_MARKERHANDLEFROMLINE and SCI_MARKERNUMBERFROMLINE. Feature #1344.
  • Assembler lexers asm and as can change comment character with lexer.as.comment.character property. Feature #1314.
  • Fix brace styling in Batch lexer so that brace matching works. Bug #1624, Bug #1906, Bug #1997, Bug #2065.
  • Change Perl lexer to style all line ends of comment lines in comment line style. Previously, the last character was in default style which made the characters in \r\n line ends have mismatching styles. Bug #2164.
  • When a lexer has been set with SCI_SETILEXER, fix SCI_GETLEXER and avoid sending SCN_STYLENEEDED notifications.
  • On Win32 fix handling Japanese IME input when both GCS_COMPSTR and GCS_RESULTSTR set.
  • With Qt on Win32 add support for line copy format on clipboard, compatible with Visual Studio. Bug #2167.
  • On Qt with default encoding (ISO 8859-1) fix bug where 'µ' (Micro Sign) case-insensitively matches '?' Bug #2168.
  • On GTK with Wayland fix display of windowed IME. Bug #2149.
  • For Python programs, SciTE defaults to running python3 on Unix and pyw on Windows which will run the most recently installed Python in many cases. Set the "python.command" property to override this. Scripts distributed with Scintilla and SciTE are checked with Python 3 and may not work with Python 2.

Release 4.3.2

  • Released 6 March 2020.
  • On Win32 fix new bug that treated all dropped text as rectangular.

Release 4.3.1

  • Released 4 March 2020.
  • Add default argument for StyleContext::GetRelative. Feature #1336.
  • Fix drag and drop between different encodings on Win32 by always providing CF_UNICODETEXT only. Bug #2151.
  • Automatically scroll while dragging text. Feature #497.
  • On Win32, the numeric keypad with Alt pressed can be used to enter characters by number. This can produce unexpected results in non-numlock mode when function keys are assigned. Potentially problematic keys like Alt+KeypadUp are now ignored. Bug #2152.
  • Crash fixed with Direct2D on Win32 when updating driver. Bug #2138.
  • For SciTE on Win32, fix crashes when Lua script closes application. Bug #2155.

Release 4.3.0

  • Released 16 January 2020.
  • Lexers made available as Lexilla library. TestLexers program with tests for Lexilla and lexers added in lexilla/test.
  • SCI_SETILEXER implemented to use lexers from Lexilla or other sources.
  • ILexer5 interface defined provisionally to support use of Lexilla. The details of this interface may change before being stabilised in Scintilla 5.0.
  • SCI_LOADLEXERLIBRARY implemented on Cocoa.
  • Build Scintilla with SCI_EMPTYCATALOGUE to avoid making lexers available.
  • Lexer and folder added for Raku language. Feature #1328.
  • Don't clear clipboard before copying text with Qt. Bug #2147.
  • On Win32, remove support for CF_TEXT clipboard format as Windows will convert to CF_UNICODETEXT.
  • Improve IME behaviour on GTK. Set candidate position for windowed IME. Improve location of candidate window. Prevent movement of candidate window while typing. Bug #2135.

Release 4.2.3

  • Released 11 December 2019.
  • Fix failure in SciTE's Complete Symbol command.

Release 4.2.2

  • Released 7 December 2019.
  • Move rather than grow selection when insertion at start. Bug #2140.
  • Allow target to have virtual space. Add methods for finding the virtual space at start and end of multiple selections. Feature #1316.
  • SciTE on Win32 adds mouse button "Forward" and "Backward" key definitions for use in properties like user.shortcuts. Feature #1317.
  • Lexer and folder added for Hollywood language. Feature #1324.
  • HTML lexer treats custom tags from HTML5 as known tags. These contain "-" like "custom-tag". Feature #1299.
  • HTML lexer fixes bug with some non-alphabetic characters in unknown tags. Feature #1320.
  • Fix bug in properties file lexer where long lines were only styled for the first 1024 characters. Bug #1933.
  • Ruby lexer recognizes squiggly heredocs. Feature #1326.
  • Avoid unnecessary IME caret movement on Win32. Feature #1304.
  • Clear IME state when switching language on Win32. Bug #2137.
  • Fixed drawing of translucent rounded rectangles on Win32 with Direct2D. Bug #2144.
  • Setting rectangular selection made faster. Bug #2130.
  • SciTE reassigns *.s extension to the GNU Assembler language from the S+ statistical language.

Release 4.2.1

  • Released 24 October 2019.
  • Add SCI_SETTABMINIMUMWIDTH to set the minimum width of tabs. This allows minimaps or overviews to be laid out to match the full size editing view. Bug #2118.
  • SciTE enables use of SCI_ commands in user.context.menu.
  • XML folder adds fold.xml.at.tag.open option to fold tags at the start of the tag "<" instead of the end ">". Bug #2128.
  • Metapost lexer fixes crash with 'interface=none' comment. Bug #2129.
  • Perl lexer supports indented here-docs. Bug #2121.
  • Perl folder folds qw arrays. Feature #1306.
  • TCL folder can turn off whitespace flag by setting fold.compact property to 0. Bug #2131.
  • Optimize setting up keyword lists in lexers. Feature #1305.
  • Updated case conversion and character categories to Unicode 12.1. Feature #1315.
  • On Win32, stop the IME candidate window moving unnecessarily and position it better.
    Stop candidate window overlapping composition text and taskbar.
    Position candidate window closer to composition text.
    Stop candidate window moving while typing.
    Align candidate window to target part of composition text.
    Stop Google IME on Windows 7 moving while typing.
    Bug #2120. Feature #1300.

Release 4.2.0

  • Released 5 July 2019.
  • Scintilla.iface adds line and pointer types, increases use of the position type, uses enumeration types in methods and properties, and adds enumeration aliases to produce better CamelCase identifiers. Feature #1297.
  • Source of input (direct / IME composition / IME result) reported in SCN_CHARADDED so applications can treat temporary IME composition input differently. Bug #2038.
  • Lexer added for DataFlex. Feature #1295.
  • Matlab lexer now treats keywords as case-sensitive. Bug #2112.
  • SQL lexer fixes single quoted strings where '" (quote, double quote) was seen as continuing the string. Bug #2098.
  • Platform layers should use InsertCharacter method to perform keyboard and IME input, replacing AddCharUTF method. Feature #1293.
  • Add CARETSTYLE_BLOCK_AFTER option to always display block caret after selection. Bug #1924.
  • On Win32, limit text returned from WM_GETTEXT to the length specified in wParam. This could cause failures when using assistive technologies like NVDA. Bug #2110, Bug #2114.
  • Fix deletion of isolated invalid bytes. Bug #2116.
  • Fix position of line caret when overstrike caret set to block. Bug #2106.

Release 4.1.7

  • Released 13 June 2019.
  • Fixes an incorrect default setting in SciTE which caused multiple visual features to fail to display.

Release 4.1.6

  • Released 10 June 2019.
  • For Visual C++ 2019, /std:c++latest now includes some C++20 features so switch to /std:c++17.
  • SciTE supports editing files larger than 2 gigabytes when built as a 64-bit application.
  • Lexer added for X12. Feature #1280.
  • CMake folder folds function - endfunction. Feature #1289.
  • VB lexer adds support for VB2017 binary literal &B and digit separators 123_456. Feature #1288.
  • Improved performance of line folding code on large files when no folds are contracted. This improves the time taken to open or close large files.
  • Fix bug where changing identifier sets in lexers preserved previous identifiers.
  • Fixed bug where changing to Unicode would rediscover line end positions even if still sticking to ASCII (not Unicode NEL, LS, PS) line ends. Only noticeable on huge files with over 100,000 lines.
  • Changed behaviour of SCI_STYLESETCASE(*,SC_CASE_CAMEL) so that it only treats 'a-zA-Z' as word characters because this covers the feature's intended use (viewing case-insensitive ASCII-only keywords in a specified casing style) and simplifies the behaviour and code. Feature #1238.
  • In SciTE added Camel case option "case:c" for styles to show keywords with initial capital.

Release 4.1.5

  • Released 17 April 2019.
  • On Win32, removed special handling of non-0 wParam to WM_PAINT.
  • Implement high-priority idle on Win32 to make redraw smoother and more efficient.
  • Add vertical bookmark symbol SC_MARK_VERTICALBOOKMARK. Feature #1276.
  • Set default fold display text SCI_SETDEFAULTFOLDDISPLAYTEXT(text). Feature #1272.
  • Add SCI_SETCHARACTERCATEGORYOPTIMIZATION API to optimize speed of character category features like determining whether a character is a space or number at the expense of memory. Feature #1259.
  • Improve the styling of numbers in Nim. Feature #1268.
  • Fix exception when inserting DBCS text. Bug #2093.
  • Improve performance of accessibility on GTK. Bug #2094.
  • Fix text reported for deletion with accessibility on GTK. Bug #2095.
  • Fix flicker when inserting primary selection on GTK. Bug #2087.
  • Support coloured text in Windows 8.1+. Feature #1277.
  • Avoid potential long hangs with idle styling for huge documents on Cocoa and GTK.

Release 4.1.4

  • Released 7 March 2019.
  • Calltips implemented on Qt. Bug #1548.
  • Block caret in overtype mode SCI_SETCARETSTYLE(caretStyle | CARETSTYLE_OVERSTRIKE_BLOCK). Feature #1217.
  • SciTE supports changing caret style via caret.style property. Feature #1264.
  • Lexer added for .NET's Common Intermediate Language CIL. Feature #1265.
  • The C++ lexer, with styling.within.preprocessor on, now interprets "(" in preprocessor "#if(" as an operator instead of part of the directive. This improves folding as well which could become unbalanced.
  • Fix raw strings in Nim. Feature #1253.
  • Fix inconsistency with dot styling in Nim. Feature #1260.
  • Enhance the styling of backticks in Nim. Feature #1261.
  • Enhance raw string identifier styling in Nim. Feature #1262.
  • Fix fold behaviour with comments in Nim. Feature #1254.
  • Fix TCL lexer recognizing '"' after "," inside a bracketed substitution. Bug #1947.
  • Fix garbage text from SCI_MOVESELECTEDLINESUP and SCI_MOVESELECTEDLINESDOWN for rectangular or thin selection by performing no action. Bug #2078.
  • Ensure container notified if Insert pressed when caret off-screen. Bug #2083.
  • Fix memory leak when checking running instance on GTK. Feature #1267.
  • Platform layer font cache removed on Win32 as there is a platform-independent cache.
  • SciTE for GTK easier to build on macOS. Bug #2084.

Release 4.1.3

  • Released 10 January 2019.
  • Add SCI_SETCOMMANDEVENTS API to allow turning off command events as they can be a significant performance cost.
  • Improve efficiency of idle wrapping by wrapping in blocks as large as possible while still remaining responsive.
  • Updated case conversion and character categories to Unicode 11.
  • Errorlist lexer recognizes negative line numbers as some programs show whole-file errors occurring on line -1. SciTE's parsing of diagnostics also updated to handle this case.
  • Added "nim" lexer (SCLEX_NIM) for the Nim language which was previously called Nimrod. For compatibility, the old "nimrod" lexer is still present but is deprecated and will be removed at the next major version. Feature #1242.
  • The Bash lexer implements substyles for multiple sets of keywords and supports SCI_PROPERTYNAMES. Bug #2054.
  • The C++ lexer interprets continued preprocessor lines correctly by reading all of the logical line. Bug #2062.
  • The C++ lexer interprets preprocessor arithmetic expressions containing multiplicative and additive operators correctly by following operator precedence rules. Bug #2069.
  • The EDIFACT lexer handles message groups as well as messages. Feature #1247.
  • For SciTE's Find in Files, allow case-sensitivity and whole-word options when running a user defined command. Bug #2053.
  • Notify with SC_UPDATE_SELECTION when user performs a multiple selection add.
  • On macOS 10.14 Cocoa, fix incorrect horizontal offset. Bug #2022.
  • On Cocoa, fix a crash that occurred when entering a dead key diacritic then a character that can not take that diacritic, such as option+e (acute accent) followed by g. Bug #2061.
  • On Cocoa, use dark info bar background when system is set to Dark Appearance. Bug #2055.
  • Fixed a crash on Cocoa in bidirectional mode where some patterns of invalid UTF-8 caused failures to create Unicode strings.
  • SCI_MARKERADD returns -1 for invalid lines as documented instead of 0. Bug #2051.
  • Improve performance of text insertion when Unicode line indexing off.
  • For Qt on Windows, stop specifying -std:c++latest as that is no longer needed to enable C++17 with MSVC 2017 and Qt 5.12 and it caused duplicate flag warnings.
  • On Linux, enable Lua to access dynamic libraries. Bug #2058.

Release 4.1.2

  • Released 2 October 2018.
  • C++ lexer fixes evaluation of "#elif". Bug #2045.
  • Markdown lexer fixes highlighting of non-ASCII characters in links.
  • SciTE on Win32 drops menukey feature, makes Del key work again in find and replace strips and disables F5 while command running. Bug #2044.

Release 4.1.1

  • Released 9 September 2018.
  • Optional indexing of line starts in UTF-8 documents by UTF-32 code points and UTF-16 code units added. This can improve performance for clients that provide UTF-32 or UTF-16 interfaces or that need to interoperate with UTF-32 or UTF-16 components.
  • Lexers added for SAS and Stata. Feature #1185.
  • Shell folder folds "if", "do", and "case". Feature #1144.
  • SciTE's menukey feature implemented on Windows.
  • For SciTE on Windows, user defined strip lists are now scrollable. Cursor no longer flickers in edit and combo boxes. Focus in and out events occur for combo boxes.
  • Fix a leak in the bidirectional code on Win32.
  • Fix crash on Win32 when switching technology to default after setting bidirectional mode.
  • Fix margin cursor on Cocoa to point more accurately.
  • Fix SciTE crash on GTK+ when using director interface.

Release 4.1.0

  • Released 19 June 2018.
  • Experimental and incomplete support added for bidirectional text on Windows using DirectWrite and Cocoa for UTF-8 documents by calling SCI_SETBIDIRECTIONAL(SC_BIDIRECTIONAL_L2R). This allows documents that contain Arabic or Hebrew to be edited more easily in a way that is similar to other editors.
  • INDIC_GRADIENT and INDIC_GRADIENTCENTRE indicator types added. INDIC_GRADIENT starts with a specified colour and alpha at top of line and fades to fully transparent at bottom. INDIC_GRADIENTCENTRE starts with a specified colour and alpha at centre of line and fades to fully transparent at top and bottom.
  • Wrap indent mode SC_WRAPINDENT_DEEPINDENT added which indents two tabs from previous line.
  • Indicators are drawn for line end characters when displayed.
  • Most invalid bytes in DBCS encodings are displayed as blobs to make problems clear and ensure something is shown.
  • On Cocoa, invalid text in DBCS encodings will be interpreted through the single-byte MacRoman encoding as that will accept any byte.
  • Diff lexer adds styles for diffs containing patches.
  • Crashes fixed on macOS for invalid DBCS characters when dragging text, changing case of text, case-insensitive searching, and retrieving text as UTF-8.
  • Regular expression crash fixed on macOS when linking to libstdc++.
  • SciTE on GTK+, when running in single-instance mode, now forwards all command line arguments to the already running instance. This allows "SciTE filename -goto:line" to work.

Release 4.0.5

  • Released 10 May 2018.
  • Add experimental SC_DOCUMENTOPTION_TEXT_LARGE option to accommodate documents larger than 2 GigaBytes.
  • Additional print option SC_PRINT_SCREENCOLOURS prints with the same colours used on screen including line numbers.
  • SciTE can read settings in EditorConfig format when enabled with editor.config.enable property.
  • EDIFACT lexer adds property lexer.edifact.highlight.un.all to highlight all UN* segments. Feature #1166.
  • Fortran folder understands "change team" and "endteam". Feature #1216.
  • Set the last X chosen when SCI_REPLACESEL called to ensure macros work when text insertion followed by caret up or down.
  • Bugs fixed in regular expression searches in Scintilla where some matches did not occur in an effort to avoid infinite loops when replacing on empty matches like "^" and "$". Applications should always handle empty matches in a way that avoids infinite loops, commonly by incrementing the search position after replacing an empty match. SciTE fixes a bug where replacing "^" always matched on the first line even when it was an "in selection" replace and the selection started after the line start.
  • Bug fixed in SciTE where invalid numeric properties could crash.
  • Runtime warnings fixed with SciTE on GTK after using Find in Files.
  • SciTE on Windows find and replace strips place caret at end of text after search.
  • Bug fixed with SciTE on macOS where corner debris appeared in the margin when scrolling. Fixed by not completely hiding the status bar so the curved corner is no longer part of the scrolling region. By default, 4 pixels of the status bar remain visible and this can be changed with the statusbar.minimum.height property or turned off if the debris are not a problem by setting the property to 0.

Release 4.0.4

  • Released 10 April 2018.
  • On Win32, the standard makefiles build a libscintilla static library as well as the existing dynamic libraries. The statically linked version of SciTE, Sc1, links to this static library. A new file, ScintillaDLL.cxx, provides the DllMain function required for a stand-alone Scintilla DLL. Build and project files should include this file when producing a DLL and omit it when producing a static library or linking Scintilla statically. The STATIC_BUILD preprocessor symbol is no longer used.
  • On Win32, Direct2D support is no longer automatically detected during build. DISABLE_D2D may still be defined to remove Direct2D features.
  • In some cases, invalid UTF-8 is handled in a way that is a little friendlier. For example, when copying to the clipboard on Windows, an invalid lead byte will be copied as the equivalent ISO 8859-1 character and will not hide the following byte. Feature #1211.
  • Lexer added for the Maxima computer algebra language. Feature #1210.
  • Fix hang in Lua lexer when lexing a label up to the terminating "::". Bug #1999.
  • Lua lexer matches identifier chains with dots and colons. Bug #1952.
  • For rectangular selections, pressing Home or End now moves the caret to the Home or End position instead of the limit of the rectangular selection.
  • Fix move-extends-selection mode for rectangular and line selections.
  • On GTK+, change lifetime of selection widget to avoid runtime warnings.
  • Fix building on Mingw/MSYS to perform file copies and deletions. Bug #1993.
  • SciTE can match a wider variety of file patterns where '*' is in the middle of the pattern and where there are multiple '*'. A '?' matches any single character.
  • SciTE on Windows can execute Python scripts directly by name when on path. Feature #1209.
  • SciTE on Windows Find in Files checks for cancel after every 10,000 lines read so can be stopped on huge files.
  • SciTE remembers entered values in lists in more cases for find, replace and find in files. Bug #1715.

Release 4.0.3

  • Released 12 February 2018.
  • Features from C++14 and C++17 are used more often, with build files now specifying c++17, gnu++17, c++1z, or std:c++latest (MSVC). Requires Microsoft Visual C++ 2017.5, GCC 7, Xcode 9.2 or Clang 4.0 or newer.
  • SCI_CREATEDOCUMENT adds a bytes argument to allocate memory for an initial size. SCI_CREATELOADER and SCI_CREATEDOCUMENT add a documentOption argument to allow choosing different document capabilities.
  • Add SC_DOCUMENTOPTION_STYLES_NONE option to stop allocating memory for styles.
  • Add SCI_GETMOVEEXTENDSSELECTION to allow applications to add more complex selection commands.
  • SciTE property bookmark.symbol allows choosing symbol used for bookmarks. Feature #1208.
  • Improve VHDL lexer's handling of character literals and escape characters in strings.
  • Fix double tap word selection on Windows 10 1709 Fall Creators Update. Bug #1983.
  • Fix closing autocompletion lists on Cocoa for macOS 10.13 where the window was emptying but staying visible. Bug #1981.
  • Fix drawing failure on Cocoa with animated find indicator in large files with macOS 10.12 by disabling animation.
  • SciTE on GTK+ installs its desktop file as non-executable and supports the common LDLIBS make variable. Bug #1989, Bug #1990.
  • SciTE shows correct column number when caret in virtual space. Bug #1991.
  • SciTE preserves selection positions when saving with strip.trailing.spaces and virtual space turned on. Bug #1992.

Release 4.0.2

  • Released 26 October 2017.
  • Fix HTML lexer handling of Django so that nesting a {{ }} or {% %} Django tag inside of a {# #} Django comment does not break highlighting of rest of file
  • The Matlab folder now treats "while" as a fold start. Bug #1985.
  • Fix failure on Cocoa with animated find indicator in large files with macOS 10.13 by disabling animation on 10.13.
  • Fix Cocoa hang when Scintilla loaded from SMB share on macOS 10.13. Bug #1979.

Release 4.0.1

  • Released 23 October 2017.
  • The ILoader interface is defined in its own header ILoader.h as it is not related to lexing so doesn't belong in ILexer.h.
  • The Scintilla namespace is always active for internal symbols and for the lexer interfaces ILexer4 and IDocument.
  • The Baan lexer checks that matches to 3rd set of keywords are function calls and leaves as identifiers if not. Baan lexer and folder support #context_on / #context_off preprocessor feature.
  • The C++ lexer improved preprocessor conformance.
    Default value of 0 for undefined preprocessor symbols.
    #define A is treated as #define A 1.
    "defined A" removes "A" before replacing "defined" with value. Bug #1966.
  • The Python folder treats triple-quoted f-strings like triple-quoted strings. Bug #1977.
  • The SQL lexer uses sql.backslash.escapes for double quoted strings. Bug #1968.
  • Minor undefined behaviour fixed. Bug #1978.
  • On Cocoa, improve scrolling on macOS 10.12. Bug #1885.
  • On Cocoa, fix line selection by clicking in the margin when scrolled. Bug #1971.

Release 4.0.0

  • Released 16 August 2017.
  • This is an unstable release with changes to interfaces used for lexers and platform access. Some more changes may occur to internal and external interfaces before stability is regained with 4.1.0.
  • Uses C++14 features. Requires Microsoft Visual C++ 2017, GCC 7, and Clang 4.0 or newer.
  • Support dropped for GTK+ versions before 2.24.
  • The lexer interfaces ILexer and ILexerWithSubStyles, along with additional style metadata methods, were merged into ILexer4. Most lexers will need to be updated to match the new interfaces.
  • The IDocumentWithLineEnd interface was merged into IDocument.
  • The platform layer interface has changed with unused methods removed, a new mechanism for reporting events, removal of methods that take individual keyboard modifiers, and removal of old timer methods.
  • Style metadata may be retrieved from lexers that support this through the SCI_GETNAMEDSTYLES, SCI_NAMEOFSTYLE, SCI_TAGSOFSTYLE, and SCI_DESCRIPTIONOFSTYLE APIs.
  • The Cocoa platform layer uses Automatic Reference Counting (ARC).
  • The default encoding in Scintilla is UTF-8.
  • An SCN_AUTOCSELECTIONCHANGE notification is sent when items are highlighted in an autocompletion or user list.
  • The data parameter to ILoader::AddData made const. Bug #1955.
  • SciTE's embedded Lua interpreter updated to Lua 5.3.
  • SciTE allows event handlers to be arbitrary callables, not just functions. Feature #1190.
  • SciTE allows user.shortcuts to be defined with symbolic Scintilla messages like 'Ctrl+L|SCI_LINEDELETE|'.
  • The Matlab lexer treats 'end' as a number rather than a keyword when used as an index. This also stops incorrect folding. Bug #1951.
  • The Matlab folder implements "fold", "fold.comment", and "fold.compact" properties. Bug #1965.
  • The Rust lexer recognizes 'usize' numeric literal suffixes. Bug #1919.
  • Ensure redraw when application changes overtype mode so caret change visible even when not blinking. Notify application with SC_UPDATE_SELECTION when overtype changed - previously sent SC_UPDATE_CONTENT.
  • Fix drawing failure when in wrap mode for delete to start/end of line which affects later lines but did not redraw them. Also fixed drawing for wrap mode on GTK+ 2.x. Bug #1949.
  • On GTK+ fix drawing problems including incorrect scrollbar redrawing and flickering of text. Bug #1876.
  • On Linux, both for GTK+ and Qt, the default modifier key for rectangular selection is now Alt. This is the same as Windows and macOS. This was changed from Ctrl as window managers are less likely to intercept Alt+Drag for moving windows than in the past.
  • On Cocoa, fix doCommandBySelector but avoid double effect of 'delete' key. Bug #1958.
  • On Qt, the updateUi signal includes the 'updated' flags. No updateUi signal is sent for focus in events. These changes make Qt behave more like the other platforms.
  • On Qt, dropping files on Scintilla now fires the SCN_URIDROPPED notification instead of inserting text.
  • On Qt, focus changes send the focusChanged signal. Bug #1957.
  • On Qt, mouse tracking is reenabled when the window is reshown. Bug #1948.
  • On Windows, the DirectWrite modes SC_TECHNOLOGY_DIRECTWRITEDC and SC_TECHNOLOGY_DIRECTWRITERETAIN are no longer provisional.
  • SciTE on macOS fixes a crash when platform-specific and platform-independent session restoration clashed. Bug #1960.
  • SciTE on GTK+ implements find.close.on.find. Bug #1152, Bug #1254, Bug #1762, Feature #849.

Release 3.7.6

  • Released 8 August 2017.
  • This is the first release of the long term branch which avoids using features from C++14 or later in order to support older systems.
  • The Baan lexer correctly highlights numbers when followed by an operator.
  • On Cocoa, fix a bug with retrieving encoded bytes.

Release 3.7.5

  • Released 26 May 2017.
  • This is the final release of SciTE 3.x.
  • Support dropped for Microsoft Visual C++ 2013 due to increased use of C++11 features.
  • Added a caret line frame as an alternative visual for highlighting the caret line.
  • Added "Reverse Selected Lines" feature.
  • SciTE adds "Select All Bookmarks" command.
  • SciTE adds a save.path.suggestion setting to suggest a file name when saving an unnamed buffer.
  • Updated case conversion and character categories to Unicode 9.
  • The Baan lexer recognizes numeric literals in a more compliant manner including hexadecimal numbers and exponentials.
  • The Bash lexer recognizes strings in lists in more cases. Bug #1944.
  • The Fortran lexer recognizes a preprocessor line after a line continuation &. Bug #1935.
  • The Fortran folder can fold comments. Bug #1936.
  • The PowerShell lexer recognizes escaped quotes in strings. Bug #1929.
  • The Python lexer recognizes identifiers more accurately when they include non-ASCII characters.
  • The Python folder treats comments at the end of the file as separate from the preceding structure.
  • The YAML lexer recognizes comments in more situations and styles a "..." line like a "---" line. Bug #1931.
  • Update scroll bar when annotations added, removed, or visibility changed. Feature #1187.
  • Canceling modes with the Esc key preserves a rectangular selection. Bug #1940.
  • Builds are made with a sorted list of lexers to be more reproducible. Bug #1946.
  • On Cocoa, a leak of mouse tracking areas was fixed.
  • On Cocoa, the autocompletion is 4 pixels wider to avoid text truncation.
  • On Windows, stop drawing a focus rectangle on the autocompletion list and raise the default list length to 9 items.
  • SciTE examines at most 1 MB of a file to automatically determine indentation for indent.auto to avoid a lengthy pause when loading very large files.
  • SciTE user interface uses lighter colours and fewer 3D elements to match current desktop environments.
  • SciTE sets buffer dirty and shows message when file deleted if load.on.activate on.
  • SciTE on Windows Find strip Find button works in incremental no-close mode. Bug #1926.

Release 3.7.4

  • Released 21 March 2017.
  • Requires a C++11 compiler. GCC 4.8 and MSVC 2015 are supported.
  • Support dropped for Windows NT 4.
  • Accessibility support may be queried with SCI_GETACCESSIBILITY. On GTK+, accessibility may be disabled by calling SCI_SETACCESSIBILITY.
  • Lexer added for "indent" language which is styled as plain text but folded by indentation level.
  • The Progress ABL lexer handles nested comments where comment starts or ends are adjacent like "/*/*" or "*/*/".
  • In the Python lexer, improve f-string support. Add support for multiline expressions in triple quoted f-strings. Handle nested "()", "[]", and "{}" in f-string expressions and terminate expression colouring at ":" or "!". End f-string if ending quote is seen in a "{}" expression. Fix terminating single quoted f-string at EOL. Bug #1918.
  • The VHDL folder folds an "entity" on the first line of the file.
  • For IMEs, do not clear selected text when there is no composition text to show.
  • Fix to crash with fold tags where line inserted at start.
  • Fix to stream selection mode when moving caret up or down. Bug #1905.
  • Drawing fixes for fold tags include fully drawing lines and not overlapping some drawing and ensuring edges and mark underlines are visible.
  • Fix Cocoa failure to display accented character chooser for European languages by partially reverting a change made to prevent a crash with Chinese input by special-casing the Cangjie input source. Bug #1881.
  • Fix potential problems with IME on Cocoa when document contains invalid UTF-8.
  • Fix crash on Cocoa with OS X 10.9 due to accessibility API not available. Bug #1915.
  • Improved speed of accessibility code on GTK+ by using additional memory as a cache. Bug #1910.
  • Fix crash in accessibility code on GTK+ < 3.3.6 caused by previous bug fix. Bug #1907.
  • Fix to prevent double scrolling on GTK+ with X11. Bug #1901.
  • SciTE on GTK+ adds an "accessibility" property to allow disabling accessibility on GTK+ as an optimization.
  • SciTE on GTK+ has changed file chooser behaviour for some actions: overwriting an existing file shows a warning; the default session file name "SciTE.session" is shown and a "*.session" filter is applied; appropriate filters are applied when exporting; the current file name is displayed in "Save As" even when that file no longer exists.
  • SciTE fixed a bug where, on GTK+, when the output pane had focus, menu commands performed by mouse were sent instead to the edit pane.
  • SciTE on Windows 8+ further restricts the paths searched for DLLs to the application and system directories which may prevent some binary planting attacks.
  • Fix failure to load Direct2D on Windows when used on old versions of Windows. Bug #1653.

Release 3.7.3

  • Released 19 February 2017.
  • Display block caret over the character at the end of a selection to be similar to other editors.
  • In SciTE can choose colours for fold markers. Feature #1172.
  • In SciTE can hide buffer numbers in tabs. Feature #1173.
  • The Diff lexer recognizes deleted lines that start with "--- ".
  • The Lua lexer requires the first line to start with "#!" to be treated as a shebang comment, not just "#". Bug #1900.
  • The Matlab lexer requires block comment start and end to be alone on a line. Bug #1902.
  • The Python lexer supports f-strings with new styles, allows Unicode identifiers, and no longer allows @1 to be a decorator. Bug #1848.
  • Fix folding inconsistency when fold header added above a folded part. Avoid unnecessary unfolding when a deletion does not include a line end. Bug #1896.
  • Fix finalization crash on Cocoa. Bug #1909.
  • SciTE on GTK+ can have a wide divider between the panes with the split.wide property.
  • Fix display of autocompletion lists and calltips on GTK+ 3.22 on Wayland. Newer APIs used on GTK+ 3.22 as older APIs were deprecated.
  • Fix crash in accessibility code on GTK+ due to signal receipt after destruction. Bug #1907.
  • Make trackpad scrolling work on Wayland. Bug #1901.

Release 3.7.2

  • Released 30 December 2016.
  • Minimize redrawing for SCI_SETSELECTIONN* APIs. Bug #1888.
  • Use more precision to allow selecting individual lines in files with more than 16.7 million lines.
  • For Qt 5, define QT_WS_MAC or QT_WS_X11 on those platforms. Bug #1887.
  • For Cocoa, fix crash on view destruction with macOS 10.12.2. Bug #1891.
  • Fix crash on GTK+ <3.8 due to incorrect lifetime of accessibility object. More accurate reporting of attribute ranges and deletion lengths for accessibility.
  • In SciTE, if a Lua script causes a Scintilla failure exception, display error message in output pane instead of exiting. Bug #1773.

Release 3.7.1

  • Released 4 December 2016.
  • The Scintilla namespace is no longer applied to struct definitions in Scintilla.h even when SCI_NAMESPACE defined. Client code should not define SCI_NAMESPACE.
  • Structure names in Scintilla.h without prefixes are deprecated and will now only be usable with INCLUDE_DEPRECATED_FEATURES defined.
    Use the newer names with the "Sci_" prefix:
    CharacterRange → Sci_CharacterRange
    TextRange → Sci_TextRange
    TextToFind → Sci_TextToFind
    RangeToFormat → Sci_RangeToFormat
    NotifyHeader → Sci_NotifyHeader
  • Previously deprecated features SC_CP_DBCS, SCI_SETUSEPALETTE. and SCI_GETUSEPALETTE have been removed and can no longer be used in client code.
  • Single phase drawing SC_PHASES_ONE is deprecated along with the SCI_SETTWOPHASEDRAW and SCI_GETTWOPHASEDRAW messages.
  • Accessibility support allowing screen readers to work added on GTK+ and Cocoa.
  • Textual tags may be displayed to the right on folded lines with SCI_TOGGLEFOLDSHOWTEXT. This is commonly something like "{ ... }" or "<tr>...</tr>". It is displayed with the STYLE_FOLDDISPLAYTEXT style and may have a box drawn around it with SCI_FOLDDISPLAYTEXTSETSTYLE.
  • A mouse right-click over the margin may send an SCN_MARGINRIGHTCLICK event. This only occurs when popup menus are turned off. SCI_USEPOPUP now has three states: SC_POPUP_NEVER, SC_POPUP_ALL, or SC_POPUP_TEXT.
  • INDIC_POINT and INDIC_POINTCHARACTER indicators added to display small arrows underneath positions or characters.
  • Added alternate appearance for visible tabs which looks like a horizontal line. Controlled with SCI_SETTABDRAWMODE. Feature #1165.
  • On Cocoa, a modulemap file is included to allow Scintilla to be treated as a module. This makes it easier to use Scintilla from the Swift language.
  • Baan folder accommodates sections and lexer fixes definition of SCE_BAAN_FUNCDEF.
  • EDIFACT lexer and folder added. Feature #1166.
  • JSON folder fixed where it didn't resume folding with the correct fold level.
  • Matlab folder based on syntax instead of indentation so more accurate. Bug #1692.
  • YAML lexer fixed style of references and keywords when followed by a comment. Bug #1872.
  • Margin click to select line now clears rectangular and additional selections.
  • Fixed a NULL access bug on GTK+ where the scrollbars could be used during destruction. Bug #1873.
  • A potential bug on GTK+ fixed where asynchronous clipboard could be delivered after its target Scintilla instance was destroyed.
  • Cocoa IME made more compliant with documented behaviour to avoid bugs that caused huge allocations. Bug #1881.
  • On Win32 fix EM_SETSEL to match Microsoft documentation.. Bug #1886.
  • SciTE on GTK+ allows localizing tool bar tool tips. Feature #1167.
  • SciTE on Windows restores focus to edit pane after closing user strip.
  • SciTE measures files larger that 2 GB which allows it to refuse to open huge files more consistently and to show better warning messages.

Release 3.7.0

  • Released 16 October 2016.
  • Word selection, navigation, and manipulation is now performed on characters instead of bytes leading to more natural behaviour for multi-byte encodings like UTF-8. For UTF-8 characters 0x80 and above, classification into word; punctuation; space; or line-end is based on the Unicode general category of the character and is not customizable. Bug #1832.
  • Two enums changed in Scintilla.iface which may lead to changed bindings. There were 2 FontQuality enums and the first is now PhasesDraw. The prefix for FoldAction was SC_FOLDACTION and is now SC_FOLDACTION_ which is similar to other enums. These changes do not affect the standard C/C++ binding.
  • EDGE_MULTILINE and SCI_MULTIEDGEADDLINE added to allow displaying multiple vertical edges simultaneously.
  • The number of margins can be changed with SCI_SETMARGINS.
  • Margin type SC_MARGIN_COLOUR added so that the application may choose any colour for a margin with SCI_SETMARGINBACKN.
  • On Win32, mouse wheel scrolling can be restricted to only occur when the mouse is within the window.
  • The WordList class in lexlib used by lexers adds an InListAbridged method for matching keywords that have particular prefixes and/or suffixes.
  • The Baan lexer was changed significantly with more lexical states, keyword sets, and support for abridged keywords.
  • The CoffeeScript lexer styles interpolated code in strings. Bug #1865.
  • The Progress lexer "progress" has been replaced with a new lexer "abl" (Advanced Business Language) with a different set of lexical states and more functionality. The lexical state prefix has changed from SCE_4GL_ to SCE_ABL_. Feature #1143.
  • The PowerShell lexer understands the grave accent escape character. Bug #1868.
  • The YAML lexer recognizes inline comments. Bug #1660.
  • SciTE on Windows can retain coloured selection when inactive with selection.always.visible property.
  • SciTE on Windows adds a state to close.on.find to close the find strip when a match is found.
  • Fix caret position after left or right movement with rectangular selection. Bug #1861.
  • In SciTE, optional prefix argument added to scite.ConstantName method. Bug #1860.
  • On Cocoa, include ILexer.h in the public headers of the framework. Bug #1855.
  • On Cocoa, allow subclass of SCIContentView to set cursor. Bug #1863.
  • On Cocoa, recognize the numeric keypad '+', '-', and '/' keys as SCK_ADD, SCK_SUBTRACT, and SCK_DIVIDE. Bug #1867.
  • On GTK+ 3.21+ fix incorrect font size in auto-completion list. Bug #1859.
  • Fix SciTE crash when command.mode ends with comma. Bug #1857.
  • SciTE on Windows has a full size toolbar icon for "Close".

Release 3.6.7

  • Released 4 September 2016.
  • C++11 range-based for loops used in SciTE so GCC 4.6 is now the minimum supported version.
  • SC_CHARSET_DEFAULT now means code page 1252 on Windows unless a code page is set. This prevents unexpected behaviour and crashes on East Asian systems where default locales are commonly DBCS. Projects which want to default to DBCS code pages in East Asian locales should set the code page and character set explicitly.
  • SCVS_NOWRAPLINESTART option stops left arrow from wrapping to the previous line. Most commonly wanted when virtual space is used. Bug #1648.
  • The C++ lexer can fold on #else and #elif with the fold.cpp.preprocessor.at.else property. Bug #210.
  • The errorlist lexer detects warnings from Visual C++ which do not contain line numbers.
  • The HTML lexer no longer treats "<?" inside a string in a script as potentially starting an XML document. Bug #767.
  • The HTML lexer fixes a problem resuming at a script start where the starting state continued past where it should. Bug #1849.
  • When inserting spaces for virtual space and the position is in indentation and tabs are enabled for indentation then use tabs. Bug #1850.
  • Fix fold expand when some child text not styled. Caused by fixes for Bug #1799. Bug #1842.
  • Fix key binding bug on Cocoa for control+. Bug #1854.
  • Fix scroll bar size warnings on GTK+ caused by #1831. Bug #1851.
  • Small fixes for GTK+ makefile. Bug #1844. Bug #1845. Bug #1846.
  • Fix SciTE indentation after code like "void function () {}".
  • Fix SciTE global regex replace of "^" with something which missed the line after empty lines with LF line ends. Bug #1839.
  • Fix SciTE on GTK+ 3.20 bug where toggle buttons on find and replace strips did not show active state. Bug #1853.

Release 3.6.6

  • Released 24 May 2016.
  • C++ 11 <regex> support built by default. Can be disabled by defining NO_CXX11_REGEX.
  • SciTE_USERHOME environment variable allows separate location for writeable properties files. Feature #965.
  • GObject introspection supports notify and command events.
  • The Progress lexer now allows comments preceded by a tab.
  • Scripts reading Scintilla.iface file include comments for enu and lex definitions. Bug #1829.
  • Fix crashes on GTK+ if idle work active when destroyed. Bug #1827.
  • Fixed bugs when used on GTK+ 3.20. Bug #1825. Bug #1831.
  • Fix SciTE search field background with dark theme on GTK+ 2.x. Bug #1826.
  • Fixed bug on Win32 that allowed resizing autocompletion from bottom when it was located above the caret.
  • On Win32, when using a screen reader and selecting text using Shift+Arrow, fix bug when scrolling made the caret stay at the same screen location so the screen reader did not speak the added or removed selection.

Release 3.6.5

  • Released 26 April 2016.
  • JSON lexer added. Feature #1140.
  • The C++ lexer fixes a bug with multi-line strings with line continuation where the string style overflowed after an edit. Bug #1824.
  • The Python lexer treats '@' as an operator except when it is the first visible character on a line. This is for Python 3.5.
  • The Rust lexer allows '?' as an operator. Feature #1146.
  • Doubled size of compiled regex buffer. Bug #1822.
  • For GTK+, the Super modifier key can be used in key bindings. Feature #1142.
  • For GTK+, fix some crashes when using multiple threads.
  • Platform layer font cache removed on GTK+ as platform-independent caches are used. This avoids the use of thread locking and initialization of threads so any GTK+ applications that rely on Scintilla initializing threads will have to do that themselves.
  • SciTE bug fixed with exported HTML where extra line shown. Bug #1816.
  • SciTE on Windows fixes bugs with pop-up menus in the find and replace strips. For the replace strip, menu choices change the state. For the find strip, menu choices are reflected in the appearance of their corresponding buttons.
  • SciTE on Windows on high DPI displays fixes the height of edit boxes in user strips.

Release 3.6.4

  • Released 13 March 2016.
  • SciTE allows setting the autocompletion type separator character.
  • The C++ folder folds code on '(' and ')' to allow multi-line calls to be folded. Feature #1138.
  • For the HTML lexer, limit the extent of Mako line comments to finish before the line end characters.
  • Folds unfolded when two fold regions are merged by either deleting an intervening line or changing its fold level by adding characters. This was fixed both in Scintilla and in SciTE's equivalent code. Bug #1799.
  • The Progress lexer supports hexadecimal numeric literals, single-line comments, abbreviated keywords and extends nested comments to unlimited levels.
  • Ruby lexer treats alternate hash key syntax "key:" as a symbol. Bug #1810.
  • Rust lexer handles bracketed Unicode string escapes like "\u{123abc}". Bug #1809.
  • For GTK+ on Windows fix 64-bit build which was broken in 3.6.3.
  • For Qt, release builds have assertions turned off.
  • For Qt on Windows, fix compilation failure for Qt 4.x.
  • IME target range displayed on Qt for OS X.
  • On Windows, make clipboard operations more robust by retrying OpenClipboard if it fails as this may occur when another application has opened the clipboard.
  • On Windows back out change that removed use of def file to ensure Scintilla_DirectFunction exported without name mangling. Bug #1813.
  • On GTK+ and Qt over Win32 in Korean fix bug caused by last release's word input change.
  • For SciTE, more descriptive error messages are displayed when there are problems loading the Lua startup script. Feature #1139.

Release 3.6.3

  • Released 18 January 2016.
  • Allow painting without first styling all visible text then styling in the background using idle-time. This helps performance when scrolling down in very large documents. Can also incrementally style after the visible area to the end of the document so that the document is already styled when the user scrolls to it.
  • Support GObject introspection on GTK+.
  • SciTE supports pasting to each selection with the selection.multipaste setting. Feature #1123.
  • SciTE can optionally display a read-only indicator on tabs and in the Buffers menu.
  • Bash lexer flags incomplete here doc delimiters as syntax errors. Bug #1789.
    Support added for using '#' in non-comment ways as is possible with zsh. Bug #1794.
    Recognize more characters as here-doc delimiters. Bug #1778.
  • Errorlist lexer highlights warning messages from the Microsoft linker.
  • Errorlist lexer fixes bug with final line in escape sequence recognition mode.
  • Lua lexer includes '&' and '|' bitwise operators for Lua 5.3. Bug #1790.
  • Perl lexer updated for Perl 5.20 and 5.22.
    Allow '_' for subroutine prototypes. Bug #1791.
    Double-diamond operator <<>>.
    Hexadecimal floating point literals.
    Repetition in list assignment. Bug #1793.
    Highlight changed subroutine prototype syntax for Perl 5.20. Bug #1797.
    Fix module ::-syntax when special characters such as 'x' are used.
    Added ' and " detection as prefix chars for x repetition operator. Bug #1800.
  • Visual Prolog lexer recognizes numbers more accurately and allows non-ASCII verbatim quoting characters. Feature #1130.
  • Send SCN_UPDATEUI with SC_UPDATE_SELECTION when the application changes multiple selection.
  • Expand folded areas before deleting fold header line. Bug #1796.
  • Treat Unicode line ends like common line ends when maintaining fold state.
  • Highlight whole run for hover indicator when wrapped. Bug #1784.
  • On Cocoa, fix crash when autocompletion list closed during scroll bounce-back. Bug #1788.
  • On Windows, fix non-BMP input through WM_CHAR and allow WM_UNICHAR to work with non-BMP characters and on non-Unicode documents. Bug #1779.
  • On Windows using DirectWrite, for ligatures and other character clusters, display caret and selections part-way through clusters so that the caret doesn't stick to the end of the cluster making it easier to understand editing actions.
  • On Windows, Scintilla no longer uses a .DEF file during linking as it duplicates source code directives.
  • On GTK+ and Qt, Korean input by word fixed.
  • On GTK+, Qt, and Win32 block IME input when document is read-only or any selected text is protected.
  • On GTK+ on OS X, fix warning during destruction. Bug #1777.
  • Fix SciTE crashes when using LPEG lexers.

Release 3.6.2

  • Released 6 November 2015.
  • Whitespace may be made visible just in indentation.
  • Whitespace dots are centred when larger than 1 pixel.
  • The Scintilla framework on Cocoa now contains version numbers.
  • SciTE's standard properties collect values from all active .properties file to produce the Language menu and the file types pull-down in the File open dialog.
  • The single executable version of SciTE, Sc1, uses 'module' statements within its embedded properties. This makes it act more like the full distribution allowing languages to be turned on and off by setting imports.include and imports.exclude. The default imports.exclude property adds eiffel, erlang, ps, and pov so these languages are turned off by default.
  • SciTE adds an output.blank.margin.left property to allow setting the output pane margin to a different width than the edit pane.
  • CoffeeScript lexer highlights ranges correctly. Bug #1765.
  • Markdown lexer treats line starts consistently to always highlight *foo* or similar at line start. Bug #1766.
  • Optimize marker redrawing by only drawing affected lines when markers shown in the text.
  • On Cocoa, timers and idling now work in modal dialogs. This also stops some crashes.
  • On Cocoa, fix crashes when deleting a ScintillaView. These crashes could occur when scrolling at the time the ScintillaView was deleted although there may have been other cases.
  • On GTK+ 2.x, fix height of lines in autocompletion lists. Bug #1774.
  • Fix bug with SCI_LINEENDDISPLAY where the caret moved to the next document line instead of the end of the display line. Bug #1772.
  • Report error (SC_STATUS_FAILURE) when negative length passed to SCI_SETSTYLING. Bug #1768.
  • When SC_MARK_UNDERLINE is not assigned to a margin, stop drawing the whole line.
  • When reverting an untitled document in SciTE, just clear it with no message about a file. Bug #1764.
  • SciTE on GTK+ allows use of Ctrl+A (Select All) inside find and replace strips. Bug #1769.

Release 3.6.1

  • Released 15 September 2015.
  • The oldest version of GTK+ supported now is 2.18 and for glib it is 2.22.
  • On GTK+, SC_CHARSET_OEM866 added to allow editing Russian files encoded in code page 866. Feature #1019.
  • On Windows, reconversion is performed when requested by the IME.
  • CoffeeScript lexer adds lexical class for instance properties and fixes some cases of regex highlighting. Bug #1749.
  • The errorlist lexer understands some ANSI escape sequences to change foreground colour and intensity. This is sufficient to colour diagnostic output from gcc and clang when -fdiagnostics-color set.
  • The errorlist lexer allows the line number to be 0 in GCC errors as some tools report whole file errors as line 0.
  • MySql lexer fixes empty comments /**/ so the comment state does not continue.
  • VHDL folder supports "protected" keyword.
  • Treat CRLF line end as two characters in SCI_COUNTCHARACTERS. Bug #1757.
  • On GTK+ 3.x, fix height of lines in autocompletion lists to match the font. Switch from deprecated style calls to CSS styling. Removed setting list colours on GTK+ 3.16+ as no longer appears needed.
  • On GTK+, avoid "Invalid rectangle passed" warning messages by never reporting the client rectangle with a negative width or height. Bug #1743.
  • On Cocoa, copy Sci_Position.h into the framework so clients can build.
  • On Cocoa fix bug with drag and drop that could lead to crashes. Bug #1751.
  • Fix SciTE disk exhaustion bug by reporting failures when writing files. Bug #1760.
  • Fix find strip in SciTE on Windows XP to be visible.
  • SciTE on Windows changes the way it detects that a tool has finished executing to ensure all output data from the process is read.
  • SciTE on Windows improves the time taken to read output from tools that produce a large amount of output by a factor of around 10.
  • On GTK+ the keyboard command for View | End of Line was changed to Ctrl+Shift+N to avoid clash with Search | Selection Add Next. Bug #1750.

Release 3.6.0

  • Released 3 August 2015.
  • External interfaces use the Sci_Position and Sci_PositionU typedefs instead of int and unsigned int to allow for changes to a 64-bit interface on 64-bit platforms in the future. Applications and external lexers should start using the new type names so that they will be compatible when the 64-bit change occurs. There is also Sci_PositionCR (long) for use in the Sci_CharacterRange struct which will also eventually become 64-bit.
  • Multiple selection now works over more key commands. The new multiple-selection handling commands include horizontal movement and selection commands, line up and down movement and selection commands, word and line deletion commands, and line end insertion. This change in behaviours is conditional on setting the SCI_SETADDITIONALSELECTIONTYPING property.
  • Autocompletion lists send an SCN_AUTOCCOMPLETED notification after the text has been inserted. Feature #1109.
  • The case mode style attribute can now be SC_CASE_CAMEL.
  • The Python lexer supports substyles for identifiers.
  • SciTE adds support for substyles.
  • SciTE's Export as RTF and Copy as RTF commands support UTF-8.
  • SciTE can display autocompletion on all IME input with ime.autocomplete property.
  • SciTE properties files now discard trailing white space on variable names.
  • Calling SCI_SETIDENTIFIERS resets styling to ensure any added identifier are highlighted.
  • Avoid candidate box randomly popping up away from edit pane with (especially Japanese) IME input.
  • On Cocoa fix problems with positioning of autocompletion lists near screen edge or under dock. Cancel autocompletion when window moved. Bug #1740.
  • Fix drawing problem when control characters are in a hidden style as they then have a zero width rectangle to draw but modify that rectangle in a way that clears some pixels.
  • Report error when attempt to resize buffer to more than 2GB with SC_STATUS_FAILURE.
  • Fix bug on GTK+ with scroll bars leaking. Bug #1742.
  • LexOthers.cxx file split into one file per lexer: LexBatch, LexDiff, LexErrorList, LexMake, LexNull, and LexProps.
  • SciTE exporters handle styles > 127 correctly now.
  • SciTE on Windows can scale window element sizes based on the system DPI setting.
  • SciTE implements find.in.files.close.on.find on all platforms, not just Windows.

Release 3.5.7

  • Released 20 June 2015.
  • Added SCI_MULTIPLESELECTADDNEXT to add the next occurrence of the main selection within the target to the set of selections as main. If the current selection is empty then select word around caret. SCI_MULTIPLESELECTADDEACH adds each occurrence of the main selection within the target to the set of selections.
  • SciTE adds "Selection Add Next" and "Selection Add Each" commands to the Search menu.
  • Added SCI_ISRANGEWORD to determine if the parameters are at the start and end of a word.
  • Added SCI_TARGETWHOLEDOCUMENT to set the target to the whole document.
  • Verilog lexer recognizes protected regions and the folder folds protected regions.
  • A performance problem with markers when deleting many lines was fixed. Bug #1733.
  • On Cocoa fix crash when ScintillaView destroyed if no autocompletion ever displayed. Bug #1728.
  • On Cocoa fix crash in drag and drop.
  • On GTK+ 3.4+, when there are both horizontal and vertical scrollbars, draw the lower-right corner so that it does not appear black when text selected. Bug #1611.
  • Fixed most calls deprecated in GTK+ 3.16. Does not fix style override calls as they are more complex.
  • SciTE on GTK+ 3.x uses a different technique for highlighting the search strip when there is no match which is more compatible with future and past versions and different themes.

Release 3.5.6

  • Released 26 May 2015.
  • On Qt, use fractional positioning calls and avoid rounding to ensure consistency.
  • SCI_TARGETASUTF8 and SCI_ENCODEDFROMUTF8 implemented on Win32 as well as GTK+ and Cocoa.
  • C++ lexer fixes empty backquoted string. Bug #1711.
  • C++ lexer fixes #undef directive. Bug #1719.
  • Fortran folder fixes handling of "selecttype" and "selectcase". Bug #1724.
  • Verilog folder folds interface definitions.
  • VHDL folder folds units declarations and fixes a case insensitivity bug with not treating "IS" the same as "is".
  • Fix bug when drawing text margins in buffered mode which would use default encoding instead of chosen encoding. Bug #1703.
  • Fix bug with Korean Hanja conversions in DBCS encoding on Windows.
  • Fix for reading a UTF-16 file in SciTE where a non-BMP character is split over a read buffer boundary. Bug #1710.
  • Fix bug on GTK+ 2.x for Windows where there was an ABI difference between compiler version. Bug #1726.
  • Fix undo bug on Cocoa that could lose data..
  • Fix link error on Windows when SCI_NAMESPACE used.
  • Fix exporting from SciTE when using Scintillua for lexing.
  • SciTE does not report twice that a search string can not be found when "Replace" pressed. Bug #1716.
  • SciTE on GTK+ 3.x disables arrow in search combo when no entries. Bug #1717.

Release 3.5.5

  • Released 17 April 2015.
  • Scintilla on Windows is now always a wide character window so SCI_SETKEYSUNICODE has no effect and SCI_GETKEYSUNICODE always returns true. These APIs are deprecated and should not be called.
  • The wxWidgets-specific ascent member of Font has been removed which breaks compatibility with current wxStyledTextCtrl. Bug #1682.
  • IME on Qt supports multiple carets and behaves more like other platforms.
  • Always use inline IME on GTK+ for Korean.
  • SQL lexer fixes handling of '+' and '-' in numbers so the '-' in '1-1' is seen as an operator and for '1--comment' the comment is recognized.
  • TCL lexer reverts change to string handling. Bug #1642.
  • Verilog lexer fixes bugs with macro styling. Verilog folder fixes bugs with `end completing an `if* instead of `endif and fold.at.else, and implements folding at preprocessor `else.
  • VHDL lexer supports extended identifiers.
  • Fix bug on Cocoa where the calltip would display incorrectly when switching calltips and the new calltip required a taller window.
  • Fix leak on Cocoa with autocompletion lists. Bug #1706.
  • Fix potential crash on Cocoa with drag and drop. Bug #1709.
  • Fix bug on Windows when compiling with MinGW-w64 which caused text to not be drawn when in wrap mode. Bug #1705.
  • Fix SciTE bug with missing file open filters and add hex to excluded set of properties files so that its settings don't appear. Bug #1707.
  • Fix SciTE bug where files without extensions like "makefile" were not highlighted correctly.

Release 3.5.4

  • Released 8 March 2015.
  • Indicators may have a different colour and style when the mouse is over them or the caret is moved into them.
  • An indicator may display in a large variety of colours with the SC_INDICFLAG_VALUEFORE flag taking the colour from the indicator's value, which may differ for every character, instead of its foreground colour attribute.
  • On Cocoa, additional IME methods implemented so that more commands are enabled. For Japanese: Reverse Conversion, Convert to Related Character, and Search Similar Kanji can now be performed. The global definition hotkey Command+Control+D and the equivalent three finger tap gesture can be used.
  • Minimum version of Qt supported is now 4.8 due to the use of QElapsedTimer::nsecsElapsed.
  • On Windows, for Korean, the VK_HANJA key is implemented to choose Hanja for Hangul and to convert from Hanja to Hangul.
  • C++ lexer adds lexer.cpp.verbatim.strings.allow.escapes option that allows verbatim (@") strings to contain escape sequences. This should remain off (0) for C# and be turned on (1) for Objective C.
  • Rust lexer accepts new 'is'/'us' integer suffixes instead of 'i'/'u'. Bug #1098.
  • Ruby folder can fold multiline comments. Bug #1697.
  • SQL lexer fixes a bug with the q-quote operator.
  • TCL lexer fixes a bug with some strings. Bug #1642.
  • Verilog lexer handles escaped identifiers that begin with \ and end with space like \reset* . Verilog folder fixes one bug with inconsistent folding when fold.comment is on and another with typedef class statements creating a fold point, expecting an endclass statement.
  • VHDL folder fixes hang in folding when document starts with "entity".
  • Add new indicators INDIC_COMPOSITIONTHIN, INDIC_FULLBOX, and INDIC_TEXTFORE. INDIC_COMPOSITIONTHIN is a thin underline that mimics the appearance of non-target segments in OS X IME. INDIC_FULLBOX is similar to INDIC_STRAIGHTBOX but covers the entire character area which means that indicators with this style on contiguous lines may touch. INDIC_TEXTFORE changes the text foreground colour.
  • Fix adaptive scrolling speed for GTK+ on OS X with GTK Quartz backend (as opposed to X11 backend). Bug #1696.
  • Fix position of autocompletion and calltips on Cocoa when there were two screens stacked vertically.
  • Fix crash in SciTE when saving large files in background when closing application. Bug #1691.
  • Fix decoding of MSVC warnings in SciTE so that files in the C:\Program Files (x86)\ directory can be opened. This is a common location of system include files.
  • Fix compilation failure of C++11 <regex> on Windows using gcc.

Release 3.5.3

  • Released 20 January 2015.
  • Support removed for Windows 95, 98, and ME.
  • Lexers added for Motorola S-Record files, Intel hex files, and Tektronix extended hex files with folding for Intel hex files. Feature #1091. Feature #1093. Feature #1095. Feature #1096.
  • C++ folder allows folding on square brackets '['. Feature #1087.
  • Shell lexer fixes three issues with here-documents. Bug #1672.
  • Verilog lexer highlights doc comment keywords; has separate styles for input, output, and inout ports (lexer.verilog.portstyling); fixes a bug in highlighting numbers; can treat upper-case identifiers as keywords (lexer.verilog.allupperkeywords); and can use different styles for code that is inactive due to preprocessor commands (lexer.verilog.track.preprocessor, lexer.verilog.update.preprocessor).
  • When the calltip window is taller than the Scintilla window, leave it in a position that avoids overlapping the Scintilla text.
  • When a text margin is displayed, for annotation lines, use the background colour of the base line.
  • On Windows GDI, assume font names are encoded in UTF-8. This matches the Direct2D code path.
  • Fix paste for GTK+ on OS X. Bug #1677.
  • Reverted a fix on Qt where Qt 5.3 has returned to the behaviour of 4.x. Bug #1575.
  • When the mouse is on the line between margin and text changed to treat as within text. This makes the PLAT_CURSES character cell platform work better.
  • Fix a crash in SciTE when the command line is just "-close:". Bug #1675.
  • Fix unexpected dialog in SciTE on Windows when the command line has a quoted filename then ends with a space. Bug #1673.
  • On Windows and GTK+, use indicators for inline IME.
  • SciTE shuts down quicker when there is no user-written OnClose function and no directors are attached.

Release 3.5.2

  • Released 2 December 2014.
  • For OS X Cocoa switch C++ runtime to libc++ to enable use of features that will never be added to libstdc++ including those part of C++11. Scintilla will now run only on OS X 10.7 or later and only in 64-bit mode.
  • Include support for using C++11 <regex> for regular expression searches. Enabling this requires rebuilding Scintilla with a non-default option. This is a provisional feature and may change API before being made permanent.
  • Allocate indicators used for Input Method Editors after 31 which was the previous limit of indicators to ensure no clash between the use of indicators for IME and for the application.
  • ANNOTATION_INDENTED added which is similar to ANNOTATION_BOXED in terms of positioning but does not show a border. Feature #1086.
  • Allow platform overrides for drawing tab arrows, wrap markers, and line markers. Size of double click detection area is a variable. These enable better visuals and behaviour for PLAT_CURSES as it is character cell based.
  • CoffeeScript lexer fixes "/*" to not be a comment. Bug #1420.
  • VHDL folder fixes "block" keyword. Bug #1664.
  • Prevent caret blinking when holding down Delete key. Bug #1657.
  • On Windows, allow right click selection in popup menu. Feature #1080.
  • On Windows, only call ShowCaret in GDI mode as it interferes with caret drawing when using Direct2D. Bug #1643.
  • On Windows, another DirectWrite mode SC_TECHNOLOGY_DIRECTWRITEDC added which may avoid drawing failures in some circumstances by drawing into a GDI DC. This feature is provisional and may be changed or removed if a better solution is found.
  • On Windows, avoid processing mouse move events where the mouse has not moved as these can cause unexpected dwell start notifications. Bug #1670.
  • For GTK+ on Windows, avoid extra space when pasting from external application.
  • On GTK+ 2.x allow Scintilla to be used inside tool tips by changing when preedit window created. Bug #1662.
  • Support MinGW compilation under Linux. Feature #1077.

Release 3.5.1

  • Released 30 September 2014.
  • BibTeX lexer added. Feature #1071.
  • SQL lexer supports the q-quote operator as SCE_SQL_QOPERATOR(24).
  • VHDL lexer supports block comments. Bug #1527.
  • VHDL folder fixes case where "component" used before name. Bug #613.
  • Restore fractional pixel tab positioning which was truncated to whole pixels in 3.5.0. Bug #1652.
  • Allow choice between windowed and inline IME on some platforms.
  • On GTK+ cache autocomplete window to avoid platform bug where windows were sometimes lost. Bug #1649.
  • On GTK+ size autocomplete window more accurately.
  • On Windows only unregister windows classes registered. Bug #1639.
  • On Windows another DirectWrite mode SC_TECHNOLOGY_DIRECTWRITERETAIN added which may avoid drawing failures on some cards and drivers. This feature is provisional and may be changed or removed if a better solution is found.
  • On Windows support the Visual Studio 2010+ clipboard format that indicates a line copy. Bug #1636.
  • SciTE session files remember the scroll position.

Release 3.5.0

  • Released 13 August 2014.
  • Text may share space vertically so that extreme ascenders and descenders are not cut off by calling SCI_SETPHASESDRAW(SC_PHASES_MULTIPLE).
  • Separate timers are used for each type of periodic activity and they are turned on and off as required. This saves power as there are fewer wake ups. On recent releases of OS X Cocoa and Windows, coalescing timers are used to further save power. Bug #1086. Bug #1532.
  • Explicit tab stops may be set for each line.
  • On Windows and GTK+, when using Korean input methods, IME composition is moved from a separate window into the Scintilla window.
  • SciTE adds a "Clean" command to the "Tools" menu which is meant to be bound to a command like "make clean".
  • Lexer added for Windows registry files.
  • HTML lexer fixes a crash with SGML after a Mako comment. Bug #1622.
  • KiXtart lexer adds a block comment state. Feature #1053.
  • Matlab lexer fixes transpose operations like "X{1}'". Bug #1629.
  • Ruby lexer fixes bugs with the syntax of symbols including allowing a symbol to end with '?'. Bug #1627.
  • Rust lexer supports byte string literals, naked CR can be escaped in strings, and files starting with "#![" are not treated as starting with a hashbang comment. Feature #1063.
  • Bug fixed where style data was stale when deleting a rectangular selection.
  • Bug fixed where annotations disappeared when SCI_CLEARDOCUMENTSTYLE called.
  • Bug fixed where selection not redrawn after SCI_DELWORDRIGHT. Bug #1633.
  • Change the function prototypes to be complete for functions exported as "C". Bug #1618.
  • Fix a memory leak on GTK+ with autocompletion lists. Bug #1638.
  • On GTK+, use the full character width for the overstrike caret for multibyte characters.
  • On Qt, set list icon size to largest icon. Add padding on OS X. Bug #1634.
  • On Qt, fix building on FreeBSD 9.2. Bug #1635.
  • On Qt, add a get_character method on the document. Feature #1064.
  • On Qt, add SCI_* for methods to ScintillaConstants.py. Feature #1065.
  • SciTE on GTK+ crash fixed with Insert Abbreviation command.
  • For SciTE with read-only files and are.you.sure=0 reenable choice to save to another location when using Save or Close commands.
  • Fix SciTE bug where toggle bookmark did not work after multiple lines with bookmarks merged. Bug #1617.

Release 3.4.4

  • Released 3 July 2014.
  • Style byte indicators removed. They were deprecated in 2007. Standard indicators should be used instead. Some elements used by lexers no longer take number of bits or mask arguments so lexers may need to be updated for LexAccessor::StartAt, LexAccessor::SetFlags (removed), LexerModule::LexerModule.
  • When multiple selections are active, autocompletion text may be inserted at each selection with new SCI_AUTOCSETMULTI method.
  • C++ lexer fixes crash for "#define x(". Bug #1614.
  • C++ lexer fixes raw string recognition so that R"xxx(blah)xxx" is styled as SCE_C_STRINGRAW.
  • The Postscript lexer no longer marks token edges with indicators as this used style byte indicators.
  • The Scriptol lexer no longer displays indicators for poor indentation as this used style byte indicators.
  • TCL lexer fixes names of keyword sets. Bug #1615.
  • Shell lexer fixes fold matching problem caused by "<<<". Bug #1605.
  • Fix bug where indicators were not removed when fold highlighting on. Bug #1604.
  • Fix bug on Cocoa where emoji were treated as being zero width.
  • Fix crash on GTK+ with Ubuntu 12.04 and overlay scroll bars.
  • Avoid creating a Cairo context when measuring text on GTK+ as future versions of GTK+ may prohibit calling gdk_cairo_create except inside drawing handlers. This prohibition may be required on Wayland.
  • On Cocoa, the registerNotifyCallback method is now marked as deprecated so client code that uses it will display an error message. Client code should use the delegate mechanism or subclassing instead. The method will be removed in the next version.
  • On Cocoa, package Scintilla more in compliance with platform conventions. Only publish public headers in the framework headers directory. Only define the Scintilla namespace in Scintilla.h when compiling as C++. Use the Cocoa NS_ENUM and NS_OPTIONS macros for exposed enumerations. Hide internal methods from public headers. These changes are aimed towards publishing Scintilla as a module which will allow it to be used from the Swift programming language, although more changes will be needed here.
  • Fix crash in SciTE when stream comment performed at line end. Bug #1610.
  • For SciTE on Windows, display error message when common dialogs fail. Bug #156.
  • For SciTE on GTK+ fix bug with initialization of toggle buttons in find and replace strips. Bug #1612.

Release 3.4.3

  • Released 27 May 2014.
  • Fix hangs and crashes in DLL at shutdown on Windows when using Direct2D.

Release 3.4.2

  • Released 22 May 2014.
  • Insertions can be filtered or modified by calling SCI_CHANGEINSERTION inside a handler for SC_MOD_INSERTCHECK.
  • DMIS lexer added. DMIS is a language for coordinate measuring machines. Feature #1049.
  • Line state may be displayed in the line number margin to aid in debugging lexing and folding with SC_FOLDFLAG_LINESTATE (128).
  • C++ lexer understands more preprocessor statements. #if defined SYMBOL is understood. Some macros with arguments can be understood and these may be predefined in keyword set 4 (keywords5 for SciTE) with syntax similar to CHECKVERSION(x)=(x<3). Feature #1051.
  • C++ lexer can highlight task marker keywords in comments as SCE_C_TASKMARKER.
  • C++ lexer can optionally highlight escape sequences in strings as SCE_C_ESCAPESEQUENCE.
  • C++ lexer supports Go back quoted raw string literals with lexer.cpp.backquoted.strings option. Feature #1047.
  • SciTE performs word and search match highlighting as an idle task to improve interactivity and allow use of these features on large files.
  • Bug fixed on Cocoa where previous caret lines were visible. Bug #1593.
  • Bug fixed where caret remained invisible when period set to 0. Bug #1592.
  • Fixed display flashing when scrolling with GTK+ 3.10. Bug #1567.
  • Fixed calls and constants deprecated in GTK+ 3.10.
  • Fixed bug on Windows where WM_GETTEXT did not provide data in UTF-16 for Unicode window. Bug #685.
  • For SciTE, protect access to variables used by threads with a mutex to prevent data races.
  • For SciTE on GTK+ fix thread object leaks. Display the version of GTK+ compiled against in the about box.
  • For SciTE on GTK+ 3.10, fix the size of the tab bar's content and use freedesktop.org standard icon names where possible.
  • For SciTE on Windows, fix bug where invoking help resubmitted the running program. Bug #272.
  • SciTE's highlight current word feature no longer matches the selection when it contains space.
  • For building SciTE in Visual C++, the win\SciTE.vcxproj project file should be used. The boundscheck directory and its project and solution files have been removed.

Release 3.4.1

  • Released 1 April 2014.
  • Display Unicode line ends as [LS], [PS], and [NEL] blobs.
  • Bug fixed where cursor down failed on wrapped lines. Bug #1585.
  • Caret positioning changed a little to appear inside characters less often by rounding the caret position to the pixel grid instead of truncating. Bug #1588.
  • Bug fixed where automatic indentation wrong when caret in virtual space. Bug #1586.
  • Bug fixed on Windows where WM_LBUTTONDBLCLK was no longer sent to window. Bug #1587.
  • Bug fixed with SciTE on Windows XP where black stripes appeared inside the find and replace strips.
  • Crash fixed in SciTE with recursive properties files. Bug #1507.
  • Bug fixed with SciTE where Ctrl+E before an unmatched end brace jumps to file start. Bug #315.
  • Fixed scrolling on Cocoa to avoid display glitches and be smoother.
  • Fixed crash on Cocoa when character composition used when autocompletion list active.

Release 3.4.0

  • Released 22 March 2014.
  • The Unicode line ends and substyles features added as provisional in 3.2.5 are now finalized. There are now no provisional features.
  • Added wrap mode SC_WRAP_WHITESPACE which only wraps on whitespace, not on style changes.
  • SciTE find and replace strips can perform incremental searching and temporary highlighting of all matches with the find.strip.incremental, replace.strip.incremental, and find.indicator.incremental settings.
  • SciTE default settings changed to use strips for find and replace and to draw with Direct2D and DirectWrite on Windows.
  • SciTE on Windows scales image buttons on the find and replace strips to match the current system scale factor.
  • Additional assembler lexer variant As(SCLEX_AS) for Unix assembly code which uses '#' for comments and ';' to separate statements.
  • Fix Coffeescript lexer for keyword style extending past end of word. Also fixes styling 0...myArray.length all as a number. Bug #1583.
  • Fix crashes and other bugs in Fortran folder by removing folding of do-label constructs.
  • Deleting a whole line deletes the annotations on that line instead of the annotations on the next line. Bug #1577.
  • Changed position of tall calltips to prefer lower half of screen to cut off end instead of start.
  • Fix Qt bug where double click treated as triple click. Bug #1575.
  • On Qt, selecting an item in an autocompletion list that is not currently visible positions it at the top.
  • Fix bug on Windows when resizing autocompletion list with only short strings caused the list to move.
  • On Cocoa reduce scrollable height by one line to fix bugs with moving caret up or down.
  • On Cocoa fix calltips which did not appear when they were created in an off-screen position.

Release 3.3.9

  • Released 31 January 2014.
  • Fix 3.3.8 bug where external lexers became inaccessible. Bug #1574.

Release 3.3.8

  • Released 28 January 2014.
  • DropSelectionN API added to drop a selection from a multiple selection.
  • CallTipSetPosStart API added to change the position at which backspacing removes the calltip.
  • SC_MARK_BOOKMARK marker symbol added which looks like bookmark ribbons used in book reading applications.
  • Basic lexer highlights hex, octal, and binary numbers in FreeBASIC which use the prefixes &h, &o and &b respectively. Feature #1041.
  • C++ lexer fixes bug where keyword followed immediately by quoted string continued keyword style. Bug #1564.
  • Matlab lexer treats '!' differently for Matlab and Octave languages. Bug #1571.
  • Rust lexer improved with nested comments, more compliant doc-comment detection, octal literals, NUL characters treated as valid, and highlighting of raw string literals and float literals fixed. Feature #1038. Bug #1570.
  • On Qt expose the EOLMode on the document object.
  • Fix hotspot clicking where area was off by half a character width. Bug #1562.
  • Tweaked scroll positioning by either 2 pixels or 1 pixel when caret is at left or right of view to ensure caret is inside visible area.
  • Send SCN_UPDATEUI with SC_UPDATE_SELECTION for Shift+Tab inside text.
  • On Windows update the system caret position when scrolling to help screen readers see the scroll quickly.
  • On Cocoa, GTK+, and Windows/Direct2D draw circles more accurately so that circular folding margin markers appear circular, of consistent size, and centred. Make SC_MARK_ARROWS drawing more even. Fix corners of SC_MARK_ROUNDRECT with Direct2D to be similar to other platforms.
  • SciTE uses a bookmark ribbon symbol for bookmarks as it scales better to higher resolutions than the previous blue gem bitmap.
  • SciTE will change the width of margins while running when the margin.width and fold.margin.width properties are changed.
  • SciTE on Windows can display a larger tool bar with the toolbar.large property.
  • SciTE displays a warning message when asked to open a directory. Bug #1568.

Release 3.3.7

  • Released 12 December 2013.
  • Lexer added for DMAP language. Feature #1026.
  • Basic lexer supports multiline comments in FreeBASIC. Feature #1023.
  • Bash lexer allows '#' inside words.. Bug #1553.
  • C++ lexer recognizes C++11 user-defined literals and applies lexical class SCE_C_USERLITERAL.
  • C++ lexer allows single quote characters as digit separators in numeric literals like 123'456 as this is included in C++14.
  • C++ lexer fixes bug with #include statements without " or > terminating filename. Bug #1538.
  • C++ lexer fixes split of Doxygen keywords @code{.fileExtension} and @param[in,out]. Bug #1551.
  • C++ lexer styles Doxygen keywords at end of document.
  • Cmake lexer fixes bug with empty comments. Bug #1550.
  • Fortran folder improved. Treats "else" as fold header. Feature #962.
  • Fix bug with adjacent instances of the same indicator with different values where only the first was drawn. Bug #1560.
  • For DirectWrite, use the GDI ClearType gamma value for SC_EFF_QUALITY_LCD_OPTIMIZED as this results in text that is similar in colour intensity to GDI. For the duller default DirectWrite ClearType text appearance, use SC_EFF_QUALITY_DEFAULT. Feature #887.
  • Fix another problem with drawing on Windows with Direct2D when returning from lock screen. The whole window is redrawn as just redrawing the initially required area left other areas black.
  • When scroll width is tracked, take width of annotation lines into account.
  • For Cocoa on OS X 10.9, responsive scrolling is supported.
  • On Cocoa, apply font quality setting to line numbers. Bug #1544.
  • On Cocoa, clicking in margin now sets focus. Bug #1542.
  • On Cocoa, correct cursor displayed in margin after showing dialog.
  • On Cocoa, multipaste mode now works. Bug #1541.
  • On GTK+, chain up to superclass finalize so that all finalization is performed. Bug #1549.
  • On GTK+, fix horizontal scroll bar range to not be double the needed width. Bug #1546.
  • On OS X GTK+, report control key as SCI_META for mouse down events.
  • On Qt, bug fixed with drawing of scrollbars, where previous contents were not drawn over with some themes.
  • On Qt, bug fixed with finding monitor rectangle which could lead to autocomplete showing at wrong location.
  • SciTE fix for multiple message boxes when failing to save a file with save.on.deactivate. Bug #1540.
  • SciTE on GTK+ fixes SIGCHLD handling so that Lua scripts can determine the exit status of processes they start. Bug #1557.
  • SciTE on Windows XP fixes bad display of find and replace values when using strips.

Release 3.3.6

  • Released 15 October 2013.
  • Added functions to help convert between substyles and base styles and between secondary and primary styles. SCI_GETSTYLEFROMSUBSTYLE finds the base style of substyles. Can be used to treat all substyles of a style equivalent to that style. SCI_GETPRIMARYSTYLEFROMSTYLE finds the primary style of secondary styles. StyleFromSubStyle and PrimaryStyleFromStyle methods were added to ILexerWithSubStyles so each lexer can implement these.
  • Lexer added for Rust language. Feature #1024.
  • Avoid false matches in errorlist lexer which is used for the SciTE output pane by stricter checking of ctags lines.
  • Perl lexer fixes bugs with multi-byte characters, including in HEREDOCs and PODs. Bug #1528.
  • SQL folder folds 'create view' statements. Feature #1020.
  • Visual Prolog lexer updated with better support for string literals and Unicode. Feature #1025.
  • For SCI_SETIDENTIFIERS, \t, \r, and \n are allowed as well as space between identifiers. Bug #1521.
  • Gaining and losing focus is now reported as a notification with the code set to SCN_FOCUSIN or SCN_FOCUSOUT. This allows clients to uniformly use notifications instead of commands. Since there is no longer a need for commands they will be deprecated in a future version. Clients should switch any code that currently uses SCEN_SETFOCUS or SCEN_KILLFOCUS.
  • On Cocoa, clients should use the delegate mechanism or subclass ScintillaView in preference to registerNotifyCallback: which will be deprecated in the future.
  • On Cocoa, the ScintillaView.h header hides internal implementation details from Platform.h and ScintillaCocoa.h. InnerView was renamed to SCIContentView and MarginView was renamed to SCIMarginView. dealloc removed from @interface.
  • On Cocoa, clients may customize SCIContentView by subclassing both SCIContentView and ScintillaView and implementing the contentViewClass class method on the ScintillaView subclass to return the class of the SCIContentView subclass.
  • On Cocoa, fixed appearance of alpha rectangles to use specified alpha and colour for outline as well as corner size. This makes INDIC_STRAIGHTBOX and INDIC_ROUNDBOX look correct.
  • On Cocoa, memory leak fixed for MarginView.
  • On Cocoa, make drag and drop work when destination view is empty. Bug #1534.
  • On Cocoa, drag image fixed when view scrolled.
  • On Cocoa, SCI_POSITIONFROMPOINTCLOSE fixed when view scrolled. Feature #1021.
  • On Cocoa, don't send selection change notification when scrolling. Bug #1522.
  • On Qt, turn off idle events on destruction to prevent repeatedly calling idle.
  • Qt bindings in ScintillaEdit changed to use signed first parameter.
  • Compilation errors fixed on Windows and GTK+ with SCI_NAMESPACE.
  • On Windows, building with gcc will check if Direct2D headers are available and enable Direct2D if they are.
  • Avoid attempts to redraw empty areas when lexing beyond the currently visible lines.
  • Control more attributes of indicators in SciTE with find.mark.indicator and highlight.current.word.indicator properties.
  • Fix SciTE bug with buffers becoming read-only. Bug #1525.
  • Fix linking SciTE on non-Linux Unix systems with GNU toolchain by linking to libdl. Bug #1523.
  • On Windows, SciTE's Incremental Search displays match failures by changing the background colour instead of not adding the character that caused failure.
  • Fix SciTE on GTK+ 3.x incremental search to change foreground colour when no match as changing background colour is difficult.

Release 3.3.5

  • Released 31 August 2013.
  • Characters may be represented by strings. In Unicode mode C1 control characters are represented by their mnemonics.
  • Added SCI_POSITIONRELATIVE to optimize navigation by character.
  • Option to allow mouse selection to switch to rectangular by pressing Alt after start of gesture. Feature #1007.
  • Lexer added for KVIrc script. Feature #1008.
  • Bash lexer fixed quoted HereDoc delimiters. Bug #1500.
  • MS SQL lexer fixed ';' to appear as an operator. Bug #1509.
  • Structured Text lexer fixed styling of enumeration members. Bug #1508.
  • Fixed bug with horizontal caret position when margin changed. Bug #1512.
  • Fixed bug on Cocoa where coordinates were relative to text subview instead of whole view.
  • Ensure selection redrawn correctly in two cases. When switching from stream to rectangular selection with Alt+Shift+Up. When reducing the range of an additional selection by moving mouse up. Feature #1007.
  • Copy and paste of rectangular selections compatible with Borland Delphi IDE on Windows. Feature #1002. Bug #1513.
  • Initialize extended styles to the default style.
  • On Windows, fix painting on an explicit HDC when first paint attempt abandoned.
  • Qt bindings in ScintillaEdit made to work on 64-bit Unix systems.
  • Easier access to printing on Qt with formatRange method.
  • Fixed SciTE failure to save initial buffer in single buffer mode. Bug #1339.
  • Fixed compilation problem with Visual C++ in non-English locales. Bug #1506.
  • Disable Direct2D when compiling with MinGW gcc on Windows because of changes in the recent MinGW release.
  • SciTE crash fixed for negative line.margin.width. Bug #1504.
  • SciTE fix for infinite dialog boxes when failing to automatically save a file. Bug #1503.
  • SciTE settings buffered.draw, two.phase.draw, and technology are applied to the output pane as well as the edit pane.

Release 3.3.4

  • Released 19 July 2013.
  • Handling of UTF-8 and DBCS text in lexers improved with methods ForwardBytes and GetRelativeCharacter added to StyleContext. Bug #1483.
  • For Unicode text, case-insensitive searching and making text upper or lower case is now compliant with Unicode standards on all platforms and is much faster for non-ASCII characters.
  • A CategoriseCharacter function was added to return the Unicode general category of a character which can be useful in lexers.
  • On Cocoa, the LCD Optimized font quality level turns font smoothing on.
  • SciTE 'immediate' subsystem added to allow scripts that work while tools are executed.
  • Font quality exposed in SciTE as font.quality setting.
  • On Cocoa, message:... methods simplify direct access to Scintilla and avoid call layers..
  • A68K lexer updated.
  • CoffeeScript lexer fixes a bug with comment blocks. Bug #1495
  • ECL lexer regular expression code fixed. Bug #1491.
  • errorlist lexer only recognizes Perl diagnostics when there is a filename between "at" and "line". Had been triggering for MSVC errors containing "at line".
  • Haskell lexer fixed to avoid unnecessary full redraws. Don't highlight CPP inside comments when styling.within.preprocessor is on. Bug #1459.
  • Lua lexer fixes bug in labels with UTF-8 text. Bug #1483.
  • Perl lexer fixes bug in string interpolation with UTF-8 text. Bug #1483.
  • Fixed bugs with case conversion when the result was longer or shorter than the original text. Could access past end of string potentially crashing. Selection now updated to result length.
  • Fixed bug where data being inserted and removed was not being reported in notification messages. Bug was introduced in 3.3.2.
  • Word wrap bug fixed where the last line could be shown twice.
  • Word wrap bug fixed for lines wrapping too short on Windows and GTK+.
  • Word wrap performance improved.
  • Minor memory leak fixed. Bug #1487.
  • On Cocoa, fixed insertText: method which was broken when implementing a newer protocol.
  • On Cocoa, fixed a crash when performing string folding for bytes that do not represent a character in the current encoding.
  • On Qt, fixed layout problem when QApplication construction delayed.
  • On Qt, find_text reports failure with -1 as first element of return value.
  • Fixed SciTE on GTK+ bug where a tool command could be performed using the keyboard while one was already running leading to confusion and crashes. Bug #1486.
  • Fixed SciTE bug in Copy as RTF which was limited to first 32 styles. Bug #1011.
  • Fixed SciTE on Windows user strip height when the system text scaling factor is 125% or 150%.
  • Compile time checks for Digital Mars C++ removed.
  • Visual C++ 2013 supported. Bug #1492.
  • Python scripts used for building and maintenance improved and moved into scripts directory.
  • Testing scripts now work on Linux using Qt and PySide.
  • Tk platform defined. Implementation for Tk will be available separately from main Scintilla distribution.

Release 3.3.3

  • Released 2 June 2013.
  • Lexer and folder added for Structured Text language. Feature #959.
  • Out of bounds access fixed for GTK+. Bug #1480.
  • Crash fixed for GTK+ on Windows paste.
  • Bug fixed with incorrect event copying on GTK+ 3.x. Bug #1481.
  • Bug fixed with right to left locales, like Hebrew, on GTK+. Bug #1477.
  • Bug fixed with undo grouping of tab and backtab commands. Bug #1478.

Release 3.3.2

  • Released 22 May 2013.
  • Basic implementations of common folding methods added to Scintilla to make it easier for containers to implement folding.
  • Add indicator INDIC_COMPOSITIONTHICK, a thick low underline, to mimic an appearance used for Asian language input composition.
  • On Cocoa, implement font quality setting. Feature #988.
  • On Cocoa, implement automatic enabling of commands and added clear command. Feature #987.
  • C++ lexer adds style for preprocessor doc comment. Feature #990.
  • Haskell lexer and folder improved. Separate mode for literate Haskell "literatehaskell" SCLEX_LITERATEHASKELL. Bug #1459 .
  • LaTeX lexer bug fixed for Unicode character following '\'. Bug #1468 .
  • PowerShell lexer recognizes here strings and doccomment keywords. #region folding added. Feature #985.
  • Fix multi-typing when two carets are located in virtual space on one line so that spaces are preserved.
  • Fixes to input composition on Cocoa and implementation of accented character input through press and hold. Set selection correctly so that changes to pieces of composition text are easier to perform. Restore undo collection after a sequence of composition actions. Composition popups appear near input.
  • Fix lexer problem where no line end was seen at end of document.
  • Fix crash on Cocoa when view deallocated. Bug #1466.
  • Fix Qt window positioning to not assume the top right of a monitor is at 0, 0.
  • Fix Qt to not track mouse when widget is hidden.
  • Qt now supports Qt 5.0. Bug #1448.
  • Fix drawing on Windows with Direct2D when returning from lock screen. The render target had to be recreated and an area would be black since the drawing was not retried.
  • Fix display of DBCS documents on Windows Direct2D/DirectWrite with default character set.
  • For SciTE on Windows, fixed most-recently-used menu when files opened through check.if.already.opened.
  • In SciTE, do not call OnSave twice when files saved asynchronously.
  • Scintilla no longer builds with Visual C++ 6.0.

Release 3.3.1

  • Released 11 April 2013.
  • Autocompletion lists can now appear in priority order or be sorted by Scintilla. Feature #981.
  • Most lexers now lex an extra NUL byte at the end of the document which makes it more likely they will classify keywords at document end correctly. Bug #574, Bug #588.
  • Haskell lexer improved in several ways. Bug #1459.
  • Matlab/Octave lexer recognizes block comments and ... comments. Bug #1414.
  • Ruby lexer crash fixed with keyword at start of document.
  • The PLAT_NCURSES platform now called PLAT_CURSES as may work on other implementations.
  • Bug on Cocoa fixed where input composition with multiple selection or virtual space selection could make undo stop working.
  • Direct2D/DirectWrite mode on Windows now displays documents in non-Latin1 8-bit encodings correctly.
  • Character positioning corrected in Direct2D/DirectWrite mode on Windows to avoid text moving and cutting off lower parts of characters.
  • Position of calltip and autocompletion lists fixed on Cocoa.
  • While regular expression search in DBCS text is still not working, matching partial characters is now avoided by moving end of match to end of character.

Release 3.3.0

  • Released 30 March 2013.
  • Overlay scrollers and kinetic scrolling implemented on Cocoa.
  • To improve display smoothness, styling and UI Update notifications will, when possible, be performed in a high-priority idle task on Cocoa instead of during painting. Performing these jobs inside painting can cause paints to be abandoned and a new paint scheduled. On GTK+, the high-priority idle task is used in more cases.
  • SCI_SCROLLRANGE added to scroll the view to display a range of text. If the whole range can not be displayed, priority is given to one end.
  • C++ lexer no longer recognizes raw (R"") strings when the first character after " is invalid. Bug #1454.
  • HTML lexer recognizes JavaScript RegEx literals in more contexts. Bug #1412.
  • Fixed automatic display of folded text when return pressed at end of fold header and first folded line was blank. Bug #1455.
  • SCI_VISIBLEFROMDOCLINE fixed to never return a line beyond the document end.
  • SCI_LINESCROLL fixed for a negative column offset. Bug #1450.
  • On GTK+, fix tab markers so visible if indent markers are visible. Bug #1453.

Release 3.2.5

  • Released 26 February 2013.
  • To allow cooperation between different uses of extended (beyond 255) styles they should be allocated using SCI_ALLOCATEEXTENDEDSTYLES.
  • For Unicode documents, lexers that use StyleContext will retrieve whole characters instead of bytes. LexAccessor provides a LineEnd method which can be a more efficient way to handle line ends and can enable Unicode line ends.
  • The C++ lexer understands the #undef directive when determining preprocessor definitions. Feature #978.
  • The errorlist lexer recognizes gcc include path diagnostics that appear before an error.
  • Folding implemented for GetText (PO) translation language. Bug #1437.
  • HTML lexer does not interrupt comment style for processing instructions. Bug #1447.
  • Fix SciTE forgetting caret x-position when switching documents. Bug #1442.
  • Fixed bug where vertical scrollbar thumb appeared at beginning of document when scrollbar shown. Bug #1446.
  • Fixed brace-highlighting bug on OS X 10.8 where matching brace is on a different line.
  • Provisional features are new features that may change or be removed if they cause problems but should become permanent if they work well. For this release Unicode line ends and substyles are provisional features.

Release 3.2.4

  • Released 17 January 2013.
  • Caret line highlight can optionally remain visible when window does not have focus. Feature #964.
  • Delegate mechanism for notifications added on Cocoa.
  • NUL characters in selection are copied to clipboard as spaces to avoid truncating at the NUL. Bug #1289.
  • C++ lexer fixes problem with showing inactive sections when preprocessor lines contain trailing comment. Bug #1413.
  • C++ lexer fixes problem with JavaScript regular expressions with '/' in character ranges. Bug #1415.
  • LaTeX folder added. Feature #970.
  • LaTeX lexer improves styling of math environments. Feature #970.
  • MySQL lexer implements hidden commands.
  • Only produce a single undo step when autocompleting a single word. Bug #1421.
  • Fixed crash when printing lines longer than 8000 characters. Bug #1430.
  • Fixed problem in character movement extends selection mode where reversing direction collapsed the selection.
  • Memory issues fixed on Cocoa, involving object ownership, lifetime of timers, and images held by the info bar. Bug #1436.
  • Cocoa key binding for Alt+Delete changed to delete previous word to be more compatible with platform standards.
  • Fixed crash on Cocoa with scrollbar when there is no scrolling possible. Bug #1416.
  • On Cocoa with retina display fixed positioning of autocompletion lists.
  • Fixed SciTE on Windows failure to run a batch file with a name containing a space by quoting the path in the properties file. Bug #1423.
  • Fixed scaling bug when printing on GTK+. Bug #1427.
  • SciTE on GTK toolbar.detachable feature removed.
  • Fixed some background saving bugs in SciTE. Bug #1366. Bug #1339.

Release 3.2.3

  • Released 21 October 2012.
  • Improve speed when performing multiple searches.
  • SciTE adds definition of PLAT_UNIX for both PLAT_GTK and PLAT_MAC to allow consolidation of settings valid on all Unix variants.
  • Signal autoCompleteCancelled added on Qt.
  • Bash lexer supports nested delimiter pairs. Feature #3569352. Bug #1515556. Bug #3008483. Bug #3512208. Bug #3515392.
  • For C/C++, recognize exponent in floating point hexadecimal literals. Bug #3576454.
  • For C #include statements, do not treat // in the path as a comment. Bug #3519260.
  • Lexer for GetText translations (PO) improved with additional styles and single instance limitation fixed.
  • Ruby for loop folding fixed. Bug #3240902. Bug #3567391.
  • Ruby recognition of here-doc after class or instance variable fixed. Bug #3567809.
  • SQL folding of loop and case fixed. Bug #3567905.
  • SQL folding of case with assignment fixed. Bug #3571820.
  • Fix hang when removing all characters from indicator at end of document.
  • Fix failure of \xhh in regular expression search for values greater than 0x79.
  • On Cocoa on OS X 10.8, fix inverted drawing of find indicator.
  • On Cocoa, fix double drawing when horizontal scroll range small and user swipes horizontally.
  • On Cocoa, remove incorrect setting of save point when reading information through 'string' and 'selectedString'.
  • On Cocoa, fix incorrect memory management of infoBar.
  • On GTK+ 3 Ubuntu, fix crash when drawing margin.
  • On ncurses, fix excessive spacing with italics line end.
  • On Windows, search for D2D1.DLL and DWRITE.DLL in system directory to avoid loading from earlier in path where could be planted by malware.

Release 3.2.2

  • Released 31 August 2012.
  • Retina display support for Cocoa. Text size fixed. Scale factor for images implemented so they can be displayed in high definition.
  • Implement INDIC_SQUIGGLEPIXMAP as a faster version of INDIC_SQUIGGLE. Avoid poor drawing at right of INDIC_SQUIGGLE. Align INDIC_DOTBOX to pixel grid for full intensity.
  • Implement SCI_GETSELECTIONEMPTY API. Bug #3543121.
  • Added SCI_VCHOMEDISPLAY and SCI_VCHOMEDISPLAYEXTEND key commands. Feature #3561433.
  • Allow specifying SciTE Find in Files directory with find.in.directory property. Feature #3558594.
  • Override SciTE global strip.trailing.spaces with strip.trailing.spaces by pattern files. Feature #3556320.
  • Fix long XML script tag handling in XML lexer. Bug #3534190.
  • Fix rectangular selection range after backspace. Bug #3543097.
  • Send SCN_UPDATEUI with SC_UPDATE_SELECTION for backspace in virtual space. Bug #3543121.
  • Avoid problems when calltip highlight range is negative. Bug #3545938.
  • On Cocoa, fix image drawing code so that image is not accessed after being freed and is drawn in the correct location.
  • On Cocoa, limit horizontal touch scrolling to existing established width.
  • On Cocoa, decrease sensitivity of pinch-zoom.
  • Fix Cocoa drawing where style changes were not immediately visible.
  • Fix Cocoa memory leak due to reference cycle.
  • Fix Cocoa bug where notifications were sent after Scintilla was freed.
  • SciTE on OS X user shortcuts treats "Ctrl+D" as equivalent to "Ctrl+d".
  • On Windows, saving SciTE's Lua startup script causes it to run.
  • Limit time allowed to highlight current word in SciTE to 0.25 seconds to remain responsive.
  • Fixed SciTE read-only mode to stick with buffer.
  • For SciTE on Windows, enable Ctrl+Z, Ctrl+X, and Ctrl+C (Undo, Cut, and Copy) in the editable fields of find and replace strips
  • Remove limit on logical line length in SciTE .properties files. Bug #3544312.
  • Improve performance of SciTE Save As command.
  • Fix SciTE crash with empty .properties files. Bug #3545938. Bug #3555308.
  • Fix repeated letter in SciTE calltips. Bug #3545938.
  • Refine build time checking for Direct2D and DirectWrite.
  • Avoid potential build problems on Windows with MultiMon.h by explicitly checking for multi-monitor APIs.
  • Automatically disable themed drawing in SciTE when building on Windows 2000. Reenable building for Windows NT 4 on NT 4 .
  • Added ncurses platform definitions. Implementation is maintained separately as Scinterm.

Release 3.2.1

  • Released 14 July 2012.
  • In Scintilla.iface, specify features as properties instead of functions where possible and fix some enumerations.
  • In SciTE Lua scripts, string properties in Scintilla API can be retrieved as well as set using property notation.
  • Added character class APIs: SCI_SETPUNCTUATIONCHARS, SCI_GETWORDCHARS, SCI_GETWHITESPACECHARS, and SCI_GETPUNCTUATIONCHARS. Feature #3529805.
  • Less/Hss support added to CSS lexer. Feature #3532413.
  • C++ lexer style SCE_C_PREPROCESSORCOMMENT added for stream comments in preprocessor. Bug #3487406.
  • Fix incorrect styling of inactive code in C++ lexer. Bug #3533036.
  • Fix incorrect styling by C++ lexer after empty lines in preprocessor style.
  • C++ lexer option "lexer.cpp.allow.dollars" fixed so can be turned off after being on. Bug #3541461.
  • Fortran fixed format lexer fixed to style comments from column 73. Bug #3540486.
  • Fortran folder folds CRITICAL .. END CRITICAL. Bug #3540486.
  • Fortran lexer fixes styling after comment line ending with '&'. Bug #3087226.
  • Fortran lexer styles preprocessor lines so they do not trigger incorrect folding. Bug #2906275.
  • Fortran folder fixes folding of nested ifs. Bug #2809176.
  • HTML folder fixes folding of CDATA when fold.html.preprocessor=0. Bug #3540491.
  • On Cocoa, fix autocompletion font lifetime issue and row height computation.
  • In 'choose single' mode, autocompletion will close an existing list if asked to display a single entry list.
  • Fixed SCI_MARKERDELETE to only delete one marker per call. Bug #3535806.
  • Properly position caret after undoing coalesced delete operations. Bug #3523326.
  • Ensure margin is redrawn when SCI_MARGINSETSTYLE called.
  • Fix clicks in first pixel of margins to send SCN_MARGINCLICK.
  • Fix infinite loop when drawing block caret for a zero width space character at document start.
  • Crash fixed for deleting negative range.
  • For characters that overlap the beginning of their space such as italics descenders and bold serifs, allow start of text to draw 1 pixel into margin. Bug #699587. Bug #3537799.
  • Fixed problems compiling Scintilla for Qt with GCC 4.7.1 x64.
  • Fixed problem with determining GTK+ sub-platform caused when adding Qt support in 3.2.0.
  • Fix incorrect measurement of untitled file in SciTE on Linux leading to message "File ...' is 2147483647 bytes long". Bug #3537764.
  • In SciTE, fix open of selected filename with line number to go to that line.
  • Fix problem with last visible buffer closing in SciTE causing invisible buffers to be active.
  • Avoid blinking of SciTE's current word highlight when output pane changes.
  • SciTE properties files can be longer than 60K.

Release 3.2.0

  • Released 1 June 2012.
  • Platform layer added for the Qt open-source cross-platform application and user interface framework for development in C++ or in Python with the PySide bindings for Qt.
  • Direct access provided to the document bytes for ranges within Scintilla. This is similar to the existing SCI_GETCHARACTERPOINTER API but allows for better performance.
  • Ctrl+Double Click and Ctrl+Triple Click add the word or line to the set of selections. Feature #3520037.
  • A SCI_DELETERANGE API was added for deleting a range of text.
  • Line wrap markers may now be drawn in the line number margin. Feature #3518198.
  • SciTE on OS X adds option to hide hidden files in the open dialog box.
  • Lexer added for OScript language. Feature #3523197.
  • Lexer added for Visual Prolog language. Feature #3523018.
  • UTF-8 validity is checked more stringently and consistently. All 66 non-characters are now treated as invalid.
  • HTML lexer bug fixed with inconsistent highlighting for PHP when attribute on separate line from tag. Bug #3520027.
  • HTML lexer bug fixed for JavaScript block comments. Bug #3520032.
  • Annotation drawing bug fixed when box displayed with different colours on different lines. Bug #3519872.
  • On Windows with Direct2D, fix drawing with 125% and 150% DPI system settings.
  • Virtual space selection bug fixed for rectangular selections. Bug #3519246.
  • Replacing multiple selection with newline changed to only affect main selection. Bug #3522251.
  • Replacing selection with newline changed to group deletion and insertion as a single undo action. Bug #3522250.
  • Auto-completion lists on GTK+ 3 set height correctly instead of showing too few lines.
  • Mouse wheel scrolling changed to avoid GTK+ bug in recent distributions.
  • IME bug on Windows fixed for horizontal jump. Bug #3529728.
  • SciTE case-insensitive autocompletion filters equal identifiers better. Calltip arrows work with bare word identifiers. Bug #3517810.
  • SciTE bug fixed where shbang lines not setting file type when switching to file loaded in background.
  • SciTE on GTK+ shows open and save dialogs with the directory of the current file displayed.

Release 3.1.0

  • Released 20 April 2012.
  • Animated find indicator added on Cocoa.
  • Buttons can be made default in SciTE user strips.
  • SciTE allows find and replace histories to be saved in session.
  • Option added to allow case-insensitive selection in auto-completion lists. Bug #3516538.
  • Replace \0 by complete found text in regular expressions. Feature #3510979.
  • Fixed single quoted strings in bash lexer. Bug #3512208.
  • Incorrect highlighting fixed in C++ lexer for continued lines. Bug #3509317.
  • Hang fixed in diff lexer. Bug #3508602.
  • Folding improved for SQL CASE/MERGE statement. Bug #3503277.
  • Fix extra drawing of selection inside word wrap indentation. Bug #3515555.
  • Fix problem with determining the last line that needs styling when drawing. Bug #3514882.
  • Fix problems with drawing in margins. Bug #3514882.
  • Fix printing crash when using Direct2D to display on-screen. Bug #3513946.
  • Fix SciTE bug where background.*.size disabled restoration of bookmarks and positions from session. Bug #3514885.
  • Fixed the Move Selected Lines command when last line does not end with a line end character. Bug #3511023.
  • Fix word wrap indentation printing to use printer settings instead of screen settings. Bug #3512961.
  • Fix SciTE bug where executing an empty command prevented executing further commands Bug #3512976.
  • Fix SciTE bugs with focus in user strips and made strips more robust with invalid definitions.
  • Suppress SciTE regular expression option when searching with find next selection. Bug #3510985.
  • SciTE Find in Files command matches empty pattern to all files. Feature #3495918.
  • Fix scroll with mouse wheel on GTK+. Bug #3501321.
  • Fix column finding method so that tab is counted correctly. Bug #3483713.

Release 3.0.4

  • Released 8 March 2012.
  • SciTE scripts can create user interfaces as strips.
  • SciTE can save files automatically in the background.
  • Pinch zoom implemented on Cocoa.
  • ECL lexer added. Feature #3488209.
  • CPP lexer fixes styling after document comment keywords. Bug #3495445.
  • Pascal folder improves handling of some constructs. Feature #3486385.
  • XML lexer avoids entering a bad mode due to complex preprocessor instructions. Bug #3488060.
  • Duplicate command is always remembered as a distinct command for undo. Bug #3495836.
  • SciTE xml.auto.close.tags no longer closes with PHP code similar to <a $this-> Bug #3488067.
  • Fix bug where setting an indicator for the whole document would fail. Bug #3487440.
  • Crash fixed for SCI_MOVESELECTEDLINESDOWN with empty vertical selection. Bug #3496403.
  • Differences between buffered and unbuffered mode on Direct2D eliminated. Bug #3495791.
  • Font leading implemented for Direct2D to improve display of character blobs. Bug #3494744.
  • Fractional widths used for line numbers, character markers and other situations. Bug #3494492.
  • Translucent rectangles drawn using Direct2D with sharper corners. Bug #3494492.
  • RGBA markers drawn sharper when centred using Direct2D. Bug #3494202.
  • RGBA markers are drawn centred when taller than line. Bug #3494184.
  • Image marker drawing problem fixed for markers taller than line. Bug #3493503.
  • Markers are drawn horizontally off-centre based on margin type instead of dimensions. Bug #3488696.
  • Fold tail markers drawn vertically centred. Feature #3488289.
  • On Windows, Scintilla is more responsive in wrap mode. Bug #3487397.
  • Unimportant "Gdk-CRITICAL" messages are no longer displayed. Bug #3488481.
  • SciTE on Windows Find in Files sets focus to dialog when already created; allows opening dialog when a job is running. Bug #3480635. Bug #3486657.
  • Fixed problems with multiple clicks in margin and with mouse actions combined with virtual space. Bug #3484370.
  • Fixed bug with using page up and down and not returning to original line. Bug #3485669.
  • Down arrow with wrapped text no longer skips lines. Bug #1776560.
  • Fix problem with dwell ending immediately due to word wrap. Bug #3484416.
  • Wrapped lines are rewrapped more consistently while resizing window. Bug #3484179.
  • Selected line ends are highlighted more consistently. Bug #3484330.
  • Fix grey background on files that use shbang to choose language. Bug #3482777.
  • Fix failure messages from empty commands in SciTE. Bug #3480645.
  • Redrawing reduced for some marker calls. Feature #3493530.
  • Match brace and select brace commands work in SciTE output pane. Feature #3486598.
  • Performing SciTE "Show Calltip" command when a calltip is already visible shows the next calltip. Feature #3487017.
  • SciTE allows saving file even when file unchanged. Feature #3486654.
  • SciTE allows optional use of character escapes in calltips. Feature #3495239.
  • SciTE can open file:// URLs with Ctrl+Shift+O. Feature #3495389.
  • Key modifiers updated for GTK+ on OS X to match upstream changes.
  • SciTE hang when marking all occurrences of regular expressions fixed.

Release 3.0.3

  • Released 28 January 2012.
  • Printing works on GTK+ version 2.x as well as 3.x.
  • Lexer added for the AviSynth language. Feature #3475611.
  • Lexer added for the Take Command / TCC scripting language. Feature #3462462.
  • CSS lexer gains support for SCSS. Feature #3268017.
  • CPP lexer fixes problems in the preprocessor structure caused by continuation lines. Bug #3458508.
  • Errorlist lexer handles column numbers for GCC format diagnostics. In SciTE, Next Message goes to column where this can be decoded from GCC format diagnostics. Feature #3453075.
  • HTML folder fixes spurious folds on some tags. Bug #3459262.
  • Ruby lexer fixes bug where '=' at start of file caused whole file to appear as a comment. Bug #3452488.
  • SQL folder folds blocks of single line comments. Feature #3467425.
  • On Windows using Direct2D, defer invalidation of render target until completion of painting to avoid failures.
  • Further support of fractional positioning. Spaces, tabs, and single character tokens can take fractional space and wrapped lines are positioned taking fractional positions into account. Bug #3471998.
  • On Windows using Direct2D, fix extra carets appearing. Bug #3471998.
  • For autocompletion lists Page Up and Down move by the list height instead of by 5 lines. Bug #3455493.
  • For SCI_LINESCROLLDOWN/UP don't select into virtual space. Bug #3451681.
  • Fix fold highlight not being fully drawn. Bug #3469936.
  • Fix selection margin appearing black when starting in wrap mode.
  • Fix crash when changing end of document after adding an annotation. Bug #3476637.
  • Fix problems with building to make RPMs. Bug #3476149.
  • Fix problem with building on GTK+ where recent distributions could not find gmodule. Bug #3469056.
  • Fix problem with installing SciTE on GTK+ due to icon definition in .desktop file including an extension. Bug #3476117.
  • Fix SciTE bug where new buffers inherited some properties from previously opened file. Bug #3457060.
  • Fix focus when closing tab in SciTE with middle click. Focus moves to edit pane instead of staying on tab bar. Bug #3440142.
  • For SciTE on Windows fix bug where Open Selected Filename for URL would append a file extension. Feature #3459185.
  • For SciTE on Windows fix key handling of control characters in Parameters dialog so normal editing (Ctrl+C, ...) works. Bug #3459345.
  • Fix SciTE bug where files became read-only after saving. Drop the "*" dirty marker after save completes. Bug #3467432.
  • For SciTE handling of diffs with "+++" and "---" lines, also handle case where not followed by tab. Go to correct line for diff "+++" message. Bug #3467143. Bug #3467178.
  • SciTE on GTK+ now performs threaded actions even on GTK+ versions before 2.12.

Release 3.0.2

  • Released 9 December 2011.
  • SciTE saves files in the background without blocking the user interface.
  • Printing implemented in SciTE on GTK+ 3.x.
  • ILoader interface for background loading finalized and documented.
  • CoffeeScript lexer added.
  • C++ lexer fixes crash with "#if defined( XXX 1".
  • Crash with Direct2D on Windows fixed.
  • Backspace removing protected range fixed. Bug #3445911.
  • Cursor setting failure on Windows when screen saver on fixed. Bug #3438780.
  • SciTE on GTK+ hang fixed with -open:file option. Bug #3441980.
  • Failure to evaluate shbang fixed in SciTE. Bug #3441801.
  • SciTE failure to treat files starting with "<?xml" as XML fixed. Bug #3440718.
  • Made untitled tab saveable when created by closing all files. Bug #3440244.
  • SciTE crash fixed when using Scintillua.
  • SciTE revert command fixed so that undo works on individual actions instead of undoing to revert point.
  • Focus loss in SciTE when opening a recent file fixed. Bug #3440142.
  • Fixed SciTE SelLength property to measure characters instead of bytes. Bug #3283519.

Release 3.0.1

  • Released 15 November 2011.
  • SciTE on Windows now runs Lua scripts directly on the main thread instead of starting them on a secondary thread and then moving back to the main thread.
  • Highlight "else" as a keyword for TCL in the same way as other languages. Bug #1836954.
  • Fix problems with setting fonts for autocompletion lists on Windows where font handles were copied and later deleted causing a system default font to be used.
  • Fix font size used on Windows for Asian language input methods which sometimes led to IME not being visible. Bug #3436753.
  • Fixed polygon drawing on Windows so fold symbols are visible again. Bug #3433558.
  • Changed background drawing on GTK+ to allow for fractional character positioning as occurs on OS X as this avoids faint lines at lexeme boundaries.
  • Ensure pixmaps allocated before painting as there was a crash when Scintilla drew without common initialization calls. Bug #3432354.
  • Fixed SciTE on Windows bug causing wrong caret position after indenting a selection. Bug #3433433.
  • Fixed SciTE session saving to store buffer position matching buffer. Bug #3434372.
  • Fixed leak of document objects in SciTE.
  • Recognize URL characters '?' and '%' for Open Selected command in SciTE. Bug #3429409.

Release 3.0.0

  • Released 1 November 2011.
  • Carbon platform support removed. OS X applications should switch to Cocoa.
  • On Windows Vista or newer, drawing may be performed with Direct2D and DirectWrite instead of GDI.
  • Cairo is now used for all drawing on GTK+. GDK drawing was removed.
  • Paletted display support removed.
  • Fractional font sizes can be specified.
  • Different weights of text supported on some platforms instead of just normal and bold.
  • Sub-pixel character positioning supported.
  • SciTE loads files in the background without blocking the user interface.
  • SciTE can display diagnostic messages interleaved with the text of files immediately after the line referred to by the diagnostic.
  • New API to see if all lines are visible which can be used to optimize processing fold structure notifications.
  • Scrolling optimized by avoiding invalidation of fold margin when redrawing whole window.
  • Optimized SCI_MARKERNEXT.
  • C++ lexer supports Pike hash quoted strings when turned on with lexer.cpp.hashquoted.strings.
  • Fixed incorrect line height with annotations in wrapped mode when there are multiple views. Bug #3388159.
  • Calltips may be displayed above the text as well as below. Bug #3410830.
  • For huge files SciTE only examines the first megabyte for newline discovery.
  • SciTE on GTK+ removes the fileselector.show.hidden property and check box as this was buggy and GTK+ now supports an equivalent feature. Bug #3413630.
  • SciTE on GTK+ supports mnemonics in dynamic menus.
  • SciTE on GTK+ displays the user's home directory as '~' in menus to make them shorter.

Release 2.29

  • Released 16 September 2011.
  • To automatically discover the encoding of a file when opening it, SciTE can run a program set with command.discover.properties. Feature #3324341.
  • Cairo always used for drawing on GTK+.
  • The set of properties files imported by SciTE can be controlled with the properties imports.include and imports.exclude. The import statement has been extended to allow "import *". The properties files for some languages are no longer automatically loaded by default. The properties files affected are avenue, baan, escript, lot, metapost, and mmixal.
  • C++ lexer fixed a bug with raw strings being recognized too easily. Bug #3388122.
  • LaTeX lexer improved with more states and fixes to most outstanding bugs. Bug #1493111. Bug #1856356. Bug #3081692.
  • Lua lexer updates for Lua 5.2 beta with goto labels and "\z" string escape. Feature #3386330.
  • Perl string styling highlights interpolated variables. Feature #3394258. Bug #3076629.
  • Perl lexer updated for Perl 5.14.0 with 0X and 0B numeric literal prefixes, break keyword and "+" supported in subroutine prototypes. Feature #3388802.
  • Perl bug fixed with CRLF line endings.
  • Markdown lexer fixed to not change state with "_" in middle of word. Bug #3398184.
  • Cocoa restores compatibility with OS X 10.5.
  • Mouse pointer changes over selection to an arrow near start when scrolled horizontally. Bug #3389055.
  • Indicators that finish at the end of the document no longer expand when text is appended. Bug #3378718.
  • SparseState merge fixed to check if other range is empty. Bug #3387053.
  • On Windows, autocompletion lists will scroll instead of document when mouse wheel spun. Feature #3403600.
  • SciTE performs more rapid polling for command completion so will return faster and report more accurate times.
  • SciTE resizes panes proportionally when switched between horizontal and vertical layout. Feature #3376784.
  • SciTE on GTK+ opens multiple files into a single instance more reliably. Bug #3363754.

Release 2.28

  • Released 1 August 2011.
  • GTK+ Cairo support works back to GTK+ version 2.8. Requires changing Scintilla source code to enable before GTK+ 2.22. Bug #3322351.
  • Translucent images in RGBA format can be used for margin markers and in autocompletion lists.
  • INDIC_DOTBOX added as a translucent dotted rectangular indicator.
  • Asian text input using IME works for GTK+ 3.x and GTK+ 2.x with Cairo.
  • On GTK+, IME works for Ctrl+Shift+U Unicode input in Scintilla. For SciTE, Ctrl+Shift+U is still Make Selection Uppercase.
  • Key bindings for GTK+ on OS X made compatible with Cocoa port and platform conventions.
  • Cocoa port supports different character encodings, improves scrolling performance and drag image appearance. The control ID is included in WM_COMMAND notifications. Text may be deleted by dragging to the trash. ScrollToStart and ScrollToEnd key commands added to simplify implementation of standard OS X Home and End behaviour.
  • SciTE on GTK+ uses a paned widget to contain the edit and output panes instead of custom code. This allows the divider to be moved easily on GTK+ 3 and its appearance follows GTK+ conventions more closely.
  • SciTE builds and installs on BSD. Bug #3324644.
  • Cobol supports fixed format comments. Bug #3014850.
  • Mako template language block syntax extended and ## comments recognized. Feature #3325178. Bug #3318818.
  • Folding of Mako template language within HTML fixed. Bug #3324563.
  • Python lexer has lexer.python.keywords2.no.sub.identifiers option to avoid highlighting second set of keywords following '.'. Bug #3325333.
  • Python folder fixes bug where fold would not extend to final line. Bug #3349157.
  • SciTE treats LPEG lexers the same as script lexers by setting all 8 style bits.
  • For Cocoa, crashes with unsupported font variants and memory leaks for colour objects fixed.
  • Shift-JIS lead byte ranges modified to match Windows.
  • Mouse pointer changes over selection to an arrow more consistently. Bug #3315756.
  • Bug fixed with annotations beyond end of document. Bug #3347268.
  • Incorrect drawing fixed for combination of background colour change and translucent selection. Bug #3377116.
  • Lexers initialized correctly when started at position other than start of line. Bug #3377148.
  • Fold highlight drawing fixed for some situations. Bug #3323015. Bug #3323805.
  • Case insensitive search fixed for cases where folded character uses fewer bytes than base character. Bug #3362038.
  • SciTE bookmark.alpha setting fixed. Bug #3373907.

Release 2.27

  • Released 20 June 2011.
  • On recent GTK+ 2.x versions when using Cairo, bug fixed where wrong colours were drawn.
  • SciTE on GTK+ slow performance in menu maintenance fixed. Bug #3315233.
  • Cocoa platform supports 64-bit builds and uses only non-deprecated APIs. Asian Input Method Editors are supported. Autocompletion lists and calltips implemented. Control identifier used in notifications.
  • On Cocoa, rectangular selection now uses Option/Alt key to be compatible with Apple Human Interface Guidelines and other applications. The Control key is reported with an SCMOD_META modifier bit.
  • API added for setting and retrieving the identifier number used in notifications.
  • SCI_SETEMPTYSELECTION added to set selection without scrolling or redrawing more than needed. Feature #3314877.
  • Added new indicators. INDIC_DASH and INDIC_DOTS are variants of underlines. INDIC_SQUIGGLELOW indicator added as shorter alternative to INDIC_SQUIGGLE for small fonts. Bug #3314591
  • Margin line selection can be changed to select display lines instead of document lines. Bug #3312763.
  • On Windows, SciTE can perform reverse searches by pressing Shift+Enter in the Find or Replace strips or dialogs.
  • Matlab lexer does not special case '\' in single quoted strings. Bug #948757 Bug #1755950 Bug #1888738 Bug #3316852.
  • Verilog lexer supports SystemVerilog folding and keywords.
  • Font leak fixed. Bug #3306156.
  • Automatic scrolling works for long wrapped lines. Bug #3312763.
  • Multiple typing works for cases where selections collapse together. Bug #3309906.
  • Fold expanded when needed in word wrap mode. Bug #3291579.
  • Bug fixed with edge drawn in wrong place on wrapped lines. Bug #3314807.
  • Bug fixed with unnecessary scrolling for SCI_GOTOLINE. Bug #3303406.
  • Bug fixed where extra step needed to undo SCI_CLEAR in virtual space. Bug #3159691.
  • Regular expression search fixed for \$ on last line of search range. Bug #3313746.
  • SciTE performance improved when switching to a tab with a very large file. Bug #3311421.
  • On Windows, SciTE advanced search remembers the "Search only in this style" setting. Bug #3313344.
  • On GTK+, SciTE opens help using "xdg-open" instead of "netscape" as "netscape" no longer commonly installed. Bug #3314377.
  • SciTE script lexers can use 256 styles.
  • SciTE word highlight works for words containing DBCS characters. Bug #3315173.
  • Compilation fixed for wxWidgets. Bug #3306156.

Release 2.26

  • Released 25 May 2011.
  • Folding margin symbols can be highlighted for the current folding block. Feature #3147069.
  • Selected lines can be moved up or down together. Feature #3304850.
  • SciTE can highlight all occurrences of the current word or selected text. Feature #3291636.
  • Experimental GTK+ 3.0 support: build with "make GTK3=1".
  • INDIC_STRAIGHTBOX added. Is similar to INDIC_ROUNDBOX but without rounded corners. Bug #3290435.
  • Can show brace matching and mismatching with indicators instead of text style. Translucency of outline can be altered for INDIC_ROUNDBOX and INDIC_STRAIGHTBOX. Feature #3290434.
  • SciTE can automatically indent python by examining previous line for scope-starting ':' with indent.python.colon.
  • Batch file lexer allows braces '(' or ')' inside variable names.
  • The cpp lexer only recognizes Vala triple quoted strings when lexer.cpp.triplequoted.strings property is set. Bug #3239234.
  • Make file lexer treats a variable with a nested variable like $(f$(qx)b) as one variable. Bug #3298223.
  • Folding bug fixed for JavaScript with nested PHP. Bug #3193530.
  • HTML lexer styles Django's {# #} comments. Bug #3013798.
  • HTML lexer styles JavaScript regular expression correctly for /abc/i.test('abc');. Bug #3209108.
  • Inno Setup Script lexer now works properly when it restarts from middle of [CODE] section. Bug #3283880. Bug #3129044.
  • Lua lexer updated for Lua 5.2 with hexadecimal floating-point numbers and '\*' whitespace escaping in strings. Feature #3243811.
  • Perl folding folds "here doc"s and adds options fold.perl.at.else and fold.perl.comment.explicit. Fold structure for Perl fixed. Feature #3112671. Bug #3265401.
  • Python lexer supports cpdef keyword for Cython. Bug #3279728.
  • SQL folding option lexer.sql.fold.at.else renamed to fold.sql.at.else. Bug #3271474.
  • SQL lexer no longer treats ';' as terminating a comment. Bug #3196071.
  • Text drawing and measurement segmented into smaller runs to avoid platform bugs. Bug #3277449. Bug #3165743.
  • SciTE on Windows adds temp.files.sync.load property to open dropped temporary files synchronously as they may be removed before they can be opened asynchronously. Bug #3072009.
  • Bug fixed with indentation guides ignoring first line in SC_IV_LOOKBOTH mode. Bug #3291317.
  • Bugs fixed in backward regex search. Bug #3292659.
  • Bugs with display of folding structure fixed for wrapped lines and where there is a fold header but no body. Bug #3291579. Bug #3265401.
  • SciTE on Windows cursor changes to an arrow now when over horizontal splitter near top of window. Bug #3286620.
  • Fixed default widget size problem on GTK+. Bug #3267892.
  • Fixed font size when using Cairo on GTK+. Bug #3272662.
  • Fixed primary selection and cursor issues on GTK+ when unrealized then realized. Bug #3256153.
  • Right click now cancels selection on GTK+ like on Windows. Bug #3235190.
  • SciTE on GTK+ implements z-order buffer switching like on Windows. Bug #3228384.
  • Improve selection position after SciTE Insert Abbreviation command when abbreviation expansion includes '|'.

Release 2.25

  • Released 21 March 2011.
  • SparseState class makes it easier to write lexers which have to remember complex state between lines.
  • Visual Studio project (.dsp) files removed. The make files should be used instead as described in the README.
  • Modula 3 lexer added along with SciTE support. Feature #3173374.
  • Asm, Basic, and D lexers add extra folding properties.
  • Raw string literals for C++0x supported in C++ lexer.
  • Triple-quoted strings used in Vala language supported in C++ lexer. Feature #3177601.
  • The errorlist lexer used in SciTE's output pane colours lines that start with '<' as diff deletions. Feature #3172878.
  • The Fortran lexer correctly folds type-bound procedures from Fortran 2003.
  • LPeg lexer support‎ improved in SciTE.
  • SciTE on Windows-64 fixes for menu localization and Lua scripts. Bug #3204502.
  • SciTE on Windows avoids locking folders when using the open or save dialogs. Bug #1795484.
  • Diff lexer fixes problem where diffs of diffs producing lines that start with "----". Bug #3197952.
  • Bug fixed when searching upwards in Chinese code page 936. Bug #3176271.
  • On Cocoa, translucent drawing performed as on other platforms instead of 2.5 times less translucent.
  • Performance issue and potential bug fixed on GTK+ with caret line for long lines.

Release 2.24

  • Released 3 February 2011.
  • Fixed memory leak in GTK+ Cairo code. Feature #3157655.
  • Insert Abbreviation dialog added to SciTE on GTK+.
  • SCN_UPDATEUI notifications received when window scrolled. An 'updated' bit mask indicates which types of update have occurred from SC_UPDATE_SELECTION, SC_UPDATE_CONTENT, SC_UPDATE_H_SCROLL or SC_UPDATE_V_SCROLL. Feature #3125977.
  • On Windows, to ensure reverse arrow cursor matches platform default, it is now generated by reflecting the platform arrow cursor. Feature #3143968.
  • Can choose mouse cursor used in margins. Feature #3161326.
  • On GTK+, SciTE sets a mime type of text/plain in its .desktop file so that it will appear in the shell context menu. Feature #3137126.
  • Bash folder handles here docs. Feature #3118223.
  • C++ folder adds fold.cpp.syntax.based, fold.cpp.comment.multiline, fold.cpp.explicit.start, fold.cpp.explicit.end, and fold.cpp.explicit.anywhere properties to allow more control over folding and choice of explicit fold markers.
  • C++ lexer fixed to always handle single quote strings continued past a line end. Bug #3150522.
  • Ruby folder handles here docs. Feature #3118224.
  • SQL lexer allows '.' to be part of words. Feature #3103129.
  • SQL folder handles case statements in more situations. Feature #3135027.
  • SQL folder adds fold points inside expressions based on bracket structure. Feature #3165488.
  • SQL folder drops fold.sql.exists property as 'exists' is handled automatically. Bug #3164194.
  • SciTE only forwards properties to lexers when they have been explicitly set so the defaults set by lexers are used rather than 0.
  • Mouse double click word selection chooses the word around the character under the mouse rather than the inter-character position under the mouse. This makes double clicking select what the user is pointing at and avoids selecting adjacent non-word characters. Bug #3111174.
  • Fixed mouse double click to always perform word select, not line select. Bug #3143635.
  • Right click cancels autocompletion. Bug #3144531.
  • Fixed multiPaste to work when additionalSelectionTyping off. Bug #3126221.
  • Fixed virtual space problems when text modified at caret. Bug #3154986.
  • Fixed memory leak in lexer object code. Bug #3133672.
  • Fixed SciTE on GTK+ search failure when using regular expression. Bug #3156217.
  • Avoid unnecessary full window redraw for SCI_GOTOPOS. Feature #3146650.
  • Avoid unnecessary redraw when indicator fill range makes no real change.

Release 2.23

  • Released 7 December 2010.
  • On GTK+ version 2.22 and later, drawing is performed with Cairo rather than GDK. This is in preparation for GTK+ 3.0 which will no longer support GDK drawing. The appearance of some elements will be different with Cairo as it is anti-aliased and uses sub-pixel positioning. Cairo may be turned on for GTK+ versions before 2.22 by defining USE_CAIRO although this has not been extensively tested.
  • New lexer a68k for Motorola 68000 assembler. Feature #3101598.
  • Borland C++ is no longer supported for building Scintilla or SciTE on Windows.
  • Performance improved when creating large rectangular selections.
  • PHP folder recognizes #region and #endregion comments. Feature #3101624.
  • SQL lexer has a lexer.sql.numbersign.comment option to turn off use of '#' comments as these are a non-standard feature only available in some implementations. Feature #3098071.
  • SQL folder recognizes case statements and understands the fold.at.else property. Bug #3104091. Bug #3107362.
  • SQL folder fixes bugs with end statements when fold.sql.only.begin=1. Bug #3104091.
  • SciTE on Windows bug fixed with multi-line tab bar not adjusting correctly when maximizing and demaximizing. Bug #3097517.
  • Crash fixed on GTK+ when Scintilla widget destroyed while it still has an outstanding style idle pending.
  • Bug fixed where searching backwards in DBCS text (code page 936 or similar) failed to find occurrences at the start of the line. Bug #3103936.
  • SciTE on Windows supports Unicode file names when executing help applications with winhelp and htmlhelp subsystems.

Release 2.22

  • Released 27 October 2010.
  • SciTE includes support for integrating with Scintillua which allows lexers to be implemented in Lua as a Parsing Expression Grammar (PEG).
  • Regular expressions allow use of '?' for non-greedy matches or to match 0 or 1 instances of an item.
  • SCI_CONTRACTEDFOLDNEXT added to allow rapid retrieval of folding state.
  • SCN_HOTSPOTRELEASECLICK notification added which is similar to SCN_HOTSPOTCLICK but occurs when the mouse is released. Feature #3082409.
  • Command added for centring current line in window. Feature #3064696.
  • SciTE performance improved by not examining document for line ends when switching buffers and not storing folds when folding turned off.
  • Bug fixed where scrolling to ensure the caret is visible did not take into account all pixels of the line. Bug #3081721.
  • Bug fixed for autocompletion list overlapping text when WS_EX_CLIENTEDGE used. Bug #3079778.
  • After autocompletion, the caret's X is updated. Bug #3079114.
  • On Windows, default to the system caret blink time. Feature #3079784.
  • PgUp/PgDn fixed to allow virtual space. Bug #3077452.
  • Crash fixed when AddMark and AddMarkSet called with negative argument. Bug #3075074.
  • Dwell notifications fixed so that they do not occur when the mouse is outside Scintilla. Bug #3073481.
  • Bash lexer bug fixed for here docs starting with <<-. Bug #3063822.
  • C++ lexer bug fixed for // comments that are continued onto a second line by a \. Bug #3066031.
  • C++ lexer fixes wrong highlighting for float literals containing +/-. Bug #3058924.
  • JavaScript lexer recognize regexes following return keyword.‎ Bug #3062287.
  • Ruby lexer handles % quoting better and treats range dots as operators in 1..2 and 1...2. Ruby folder handles "if" keyword used as a modifier even when it is separated from the modified statement by an escaped new line. Bug #2093767. Bug #3058496.
  • Bug fixed where upwards search failed with DBCS code pages. Bug #3065912.
  • SciTE has a default Lua startup script name distributed in SciTEGlobal.properties. No error message is displayed if this file does not exist.
  • SciTE on Windows tab control height is calculated better. Bug #2635702.
  • SciTE on Windows uses better themed check buttons in find and replace strips.
  • SciTE on Windows fixes bug with Find strip appearing along with Incremental Find strip.
  • SciTE setting find.close.on.find added to allow preventing the Find dialog from closing.
  • SciTE on Windows attempts to rerun commands that fail by prepending them with "cmd.exe /c". This allows commands built in to the command processor like "dir" to run.

Release 2.21

  • Released 1 September 2010.
  • Asian Double Byte Character Set (DBCS) support improved. Case insensitive search works and other operations are much faster. Bug #2999125, Bug #2774616, Bug #2991942, Bug #3005688.
  • Scintilla on GTK+ uses only non-deprecated APIs (for GTK+ 2.20) except for GdkFont and GdkFont use can be disabled with the preprocessor symbol DISABLE_GDK_FONT.
  • IDocument interface used by lexers adds BufferPointer and GetLineIndentation methods.
  • On Windows, clicking sets focus before processing the click or sending notifications.
  • Bug on OS X (macosx platform) fixed where drag/drop overwrote clipboard. Bug #3039732.
  • GTK+ drawing bug when the view was horizontally scrolled more than 32000 pixels fixed.
  • SciTE bug fixed with invoking Complete Symbol from output pane. Bug #3050957.
  • Bug fixed where it was not possible to disable folding. Bug #3040649.
  • Bug fixed with pressing Enter on a folded fold header line not opening the fold. Bug #3043419.
  • SciTE 'Match case' option in find and replace user interfaces changed to 'Case sensitive' to allow use of 'v' rather than 'c' as the mnemonic.
  • SciTE displays stack trace for Lua when error occurs.. Bug #3051397.
  • SciTE on Windows fixes bug where double clicking on error message left focus in output pane. Bug #1264835.
  • SciTE on Windows uses SetDllDirectory to avoid a security problem.
  • C++ lexer crash fixed with preprocessor expression that looked like division by 0. Bug #3056825.
  • Haskell lexer improved. Feature #3039490.
  • HTML lexing fixed around Django {% %} tags. Bug #3034853.
  • HTML JavaScript lexing fixed when line end escaped. Bug #3038381.
  • HTML lexer stores line state produced by a line on that line rather than on the next line.
  • Markdown lexer fixes infinite loop. Bug #3045386.
  • MySQL folding bugs with END statements fixed. Bug #3031742.
  • PowerShell lexer allows '_' as a word character. Feature #3042228.
  • SciTE on GTK+ abandons processing of subsequent commands if a command.go.needs command fails.
  • When SciTE is closed, all buffers now receive an OnClose call. Bug #3033857.

Release 2.20

  • Released 30 July 2010.
  • Lexers are implemented as objects so that they may retain extra state. The interfaces defined for this are tentative and may change before the next release. Compatibility classes allow current lexers compiled into Scintilla to run with few changes. The interface to external lexers has changed and existing external lexers will need to have changes made and be recompiled. A single lexer object is attached to a document whereas previously lexers were attached to views which could lead to different lexers being used for split views with confusing results.
  • C++ lexer understands the preprocessor enough to grey-out inactive code due to conditional compilation.
  • SciTE can use strips within the main window for find and replace rather than dialogs. On Windows SciTE always uses a strip for incremental search.
  • Lexer added for Txt2Tags language. Feature #3018736.
  • Sticky caret feature enhanced with additional SC_CARETSTICKY_WHITESPACE mode . Feature #3027559.
  • Bash lexer implements basic parsing of compound commands and constructs. Feature #3033135.
  • C++ folder allows disabling explicit fold comments.
  • Perl folder works for array blocks, adjacent package statements, nested PODs, and terminates package folding at __DATA__, ^D and ^Z. Feature #3030887.
  • PowerShell lexer supports multiline <# .. #> comments and adds 2 keyword classes. Feature #3015176.
  • Lexing performed incrementally when needed by wrapping to make user interface more responsive.
  • SciTE setting replaceselection:yes works on GTK+.
  • SciTE Lua scripts calling io.open or io.popen on Windows have arguments treated as UTF-8 and converted to Unicode so that non-ASCII file paths will work. Lua files with non-ASCII paths run. Bug #3016951.
  • Crash fixed when searching for empty string. Bug #3017572.
  • Bugs fixed with folding and lexing when Enter pressed at start of line. Bug #3032652.
  • Bug fixed with line selection mode not affecting selection range. Bug #3021480.
  • Bug fixed where indicator alpha was limited to 100 rather than 255. Bug #3021473.
  • Bug fixed where changing annotation did not cause automatic redraw.
  • Regular expression bug fixed when a character range included non-ASCII characters.
  • Compilation failure with recent compilers fixed on GTK+. Bug #3022027.
  • Bug fixed on Windows with multiple monitors where autocomplete pop up would appear off-screen or straddling monitors. Bug #3017512.
  • SciTE on Windows bug fixed where changing directory to a Unicode path failed. Bug #3011987.
  • SciTE on Windows bug fixed where combo boxes were not allowing Unicode characters. Bug #3012986.
  • SciTE on GTK+ bug fixed when dragging files into SciTE on KDE. Bug #3026555.
  • SciTE bug fixed where closing untitled file could lose data if attempt to name file same as another buffer. Bug #3011680.
  • COBOL number masks now correctly highlighted. Bug #3012164.
  • PHP comments can include <?PHP without triggering state change. Bug #2854183.
  • VHDL lexer styles unclosed string correctly. Bug #3029627.
  • Memory leak fixed in list boxes on GTK+. Bug #3007669.

Release 2.12

  • Released 1 June 2010.
  • Drawing optimizations improve speed and fix some visible flashing when scrolling.
  • Copy Path command added to File menu in SciTE. Feature #2986745.
  • Optional warning displayed by SciTE when saving a file which has been modified by another process. Feature #2975041.
  • Flagship lexer for xBase languages updated to follow the language much more closely. Feature #2992689.
  • HTML lexer highlights Django templates in more regions. Feature #3002874.
  • Dropping files on SciTE on Windows, releases the drag object earlier and opens the files asynchronously, leading to smoother user experience. Feature #2986724.
  • SciTE HTML exports take the Use Monospaced Font setting into account.
  • SciTE window title "[n of m]" localized.
  • When new line inserted at start of line, markers are moved down. Bug #2986727.
  • On Windows, dropped text has its line ends converted, similar to pasting. Bug #3005328.
  • Fixed bug with middle-click paste in block select mode where text was pasted next to selection rather than at cursor. Bug #2984460.
  • Fixed SciTE crash where a style had a size parameter without a value. Bug #3003834.
  • Debug assertions in multiple lexers fixed. Bug #3000566.
  • CSS lexer fixed bug where @font-face displayed incorrectly Bug #2994224.
  • CSS lexer fixed bug where open comment caused highlighting error. Bug #1683672.
  • Shell file lexer fixed highlight glitch with here docs where the first line is a comment. Bug #2830239.
  • Bug fixed in SciTE openpath property that caused Open Selected File to fail to open the selected file.
  • Bug fixed in SciTE FileExt property when file name with no extension evaluated to whole path.
  • Fixed SciTE on Windows printing bug where the $(CurrentTime), $(CurrentPage) variables were not expanded. Bug #2994612.
  • SciTE compiles for 64-bit Windows and runs without crashing. Bug #2986312.
  • Full Screen mode in Windows Vista/7 improved to hide Start button and size borders a little better. Bug #3002813.

Release 2.11

  • Released 9 April 2010.
  • Fixes compatibility of Scintilla.h with the C language.
  • With a rectangular selection SCI_GETSELECTIONSTART and SCI_GETSELECTIONEND return limits of the rectangular selection rather than the limits of the main selection.
  • When SciTE on Windows is minimized to tray, only takes a single click to restore rather than a double click. Feature #981917.

Release 2.10

  • Released 4 April 2010.
  • Version 1.x of GTK+ is no longer supported.
  • SciTE is no longer supported on Windows 95, 98 or ME.
  • Case-insensitive search works for non-ASCII characters in UTF-8 and 8-bit encodings. Non-regex search in DBCS encodings is always case-sensitive.
  • Non-ASCII characters may be changed to upper and lower case.
  • SciTE on Windows can access all files including those with names outside the user's preferred character encoding.
  • SciTE may be extended with lexers written in Lua.
  • When there are multiple selections, the paste command can go either to the main selection or to each selection. This is controlled with SCI_SETMULTIPASTE.
  • More forms of bad UTF-8 are detected including overlong sequences, surrogates, and characters outside the valid range. Bad UTF-8 bytes are now displayed as 2 hex digits preceded by 'x'.
  • SCI_GETTAG retrieves the value of captured expressions within regular expression searches.
  • Django template highlighting added to the HTML lexer. Feature #2974889.
  • Verilog line comments can be folded.
  • SciTE on Windows allows specifying a filter for the Save As dialog. Feature #2943445.
  • Bug fixed when multiple selection disabled where rectangular selections could be expanded into multiple selections. Bug #2948260.
  • Bug fixed when document horizontally scrolled and up/down-arrow did not return to the same column after horizontal scroll occurred. Bug #2950799.
  • Bug fixed to remove hotspot highlight when mouse is moved out of the document. Windows only fix. Bug #2951353.
  • R lexer now performs case-sensitive check for keywords. Bug #2956543.
  • Bug fixed on GTK+ where text disappeared when a wrap occurred. Bug #2958043.
  • Bug fixed where regular expression replace cannot escape the '\' character by using '\\'. Bug #2959876.
  • Bug fixed on GTK+ when virtual space disabled, middle-click could still paste text beyond end of line. Bug #2971618.
  • SciTE crash fixed when double clicking on a malformed error message in the output pane. Bug #2976551.
  • Improved performance on GTK+ when changing parameters associated with scroll bars to the same value. Bug #2964357.
  • Fixed bug with pressing Shift+Tab with a rectangular selection so that it performs an un-indent similar to how Tab performs an indent.

Release 2.03

  • Released 14 February 2010.
  • Added SCI_SETFIRSTVISIBLELINE to match SCI_GETFIRSTVISIBLELINE.
  • Erlang lexer extended set of numeric bases recognized; separate style for module:function_name; detects built-in functions, known module attributes, and known preprocessor instructions; recognizes EDoc and EDoc macros; separates types of comments. Bug #2942448.
  • Python lexer extended with lexer.python.strings.over.newline option that allows non-triple-quoted strings to extend past line ends. This allows use of the Ren'Py language. Feature #2945550.
  • Fixed bugs with cursor movement after deleting a rectangular selection. Bug #2942131.
  • Fixed bug where calling SCI_SETSEL when there is a rectangular selection left the additional selections selected. Bug #2947064.
  • Fixed macro recording bug where not all bytes in multi-byte character insertions were reported through SCI_REPLACESEL.
  • Fixed SciTE bug where using Ctrl+Enter followed by Ctrl+Space produced an autocompletion list with only a single line containing all the identifiers.
  • Fixed SciTE on GTK+ bug where running a tool made the user interface completely unresponsive.
  • Fixed SciTE on Windows Copy to RTF bug. Bug #2108574.

Release 2.02

  • Released on 25 January 2010.
  • Markdown lexer added. Feature #2844081.
  • On GTK+, include code that understands the ranges of lead bytes for code pages 932, 936, and 950 so that most Chinese and Japanese text can be used on systems that are not set to the corresponding locale.
  • Allow changing the size of dots in visible whitespace using SCI_SETWHITESPACESIZE. Feature #2839427.
  • Additional carets can be hidden with SCI_SETADDITIONALCARETSVISIBLE.
  • Can choose anti-aliased, non-anti-aliased or lcd-optimized text using SCI_SETFONTQUALITY.
  • Retrieve the current selected text in the autocompletion list with SCI_AUTOCGETCURRENTTEXT.
  • Retrieve the name of the current lexer with SCI_GETLEXERLANGUAGE.
  • Progress 4GL lexer improves handling of comments in preprocessor declaration. Feature #2902206.
  • HTML lexer extended to handle Mako template language.
  • SQL folder extended for SQL Anywhere "EXISTS" and "ENDIF" keywords. Feature #2887524.
  • SciTE adds APIPath and AbbrevPath variables.
  • SciTE on GTK+ uses pipes instead of temporary files for running tools. This should be more secure.
  • Fixed crash when calling SCI_STYLEGETFONT for a style which does not have a font set. Bug #2857425.
  • Fixed crash caused by not having sufficient styles allocated after choosing a lexer. Bug #2881279.
  • Fixed crash in SciTE using autocomplete word when word characters includes space. Bug #2840141.
  • Fixed bug with handling upper-case file extensions SciTE on GTK+.
  • Fixed SciTE loading files from sessions with folded folds where it would not be scrolled to the correct location. Bug #2882775.
  • Fixed SciTE loading files from sessions when file no longer exists. Bug #2883437.
  • Fixed SciTE export to HTML using the wrong background colour.
  • Fixed crash when adding an annotation and then adding a new line after the annotation. Bug #2929708.
  • Fixed crash in SciTE setting a property to nil from Lua.
  • SCI_GETSELTEXT fixed to return correct length. Bug #2929441.
  • Fixed text positioning problems with selection in some circumstances.
  • Fixed text positioning problems with ligatures on GTK+.
  • Fixed problem pasting into rectangular selection with caret at bottom caused text to go from the caret down rather than replacing the selection.
  • Fixed problem replacing in a rectangular selection where only the final line was changed.
  • Fixed inability to select a rectangular area using Alt+Shift+Click at both corners. Bug #2899746.
  • Fixed problem moving to start/end of a rectangular selection with left/right key. Bug #2871358.
  • Fixed problem with Select All when there's a rectangular selection. Bug #2930488.
  • Fixed SCI_LINEDUPLICATE on a rectangular selection to not produce multiple discontinuous selections.
  • Virtual space removed when performing delete word left or delete line left. Virtual space converted to real space for delete word right. Preserve virtual space when pressing Delete key. Bug #2882566.
  • Fixed problem where Shift+Alt+Down did not move through wrapped lines. Bug #2871749.
  • Fixed incorrect background colour when using coloured lines with virtual space. Bug #2914691.
  • Fixed failure to display wrap symbol for SC_WRAPVISUALFLAGLOC_END_BY_TEXT. Bug #2936108.
  • Fixed blank background colour with EOLFilled style on last line. Bug #2890105.
  • Fixed problem in VB lexer with keyword at end of file. Bug #2901239.
  • Fixed SciTE bug where double clicking on a tab closed the file.
  • Fixed SciTE brace matching commands to only work when the caret is next to the brace, not when it is in virtual space. Bug #2885560.
  • Fixed SciTE on Windows Vista to access files in the Program Files directory rather than allow Windows to virtualize access. Bug #2916685.
  • Fixed NSIS folder to handle keywords that start with '!'. Bug #2872157.
  • Changed linkage of Scintilla_LinkLexers to "C" so that it can be used by clients written in C. Bug #2844718.

Release 2.01

  • Released on 19 August 2009.
  • Fix to positioning rectangular paste when viewing line ends.
  • Don't insert new lines and indentation for line ends at end of rectangular paste.
  • When not in additional selection typing mode, cutting a rectangular selection removes all of the selected text.
  • Rectangular selections are copied to the clipboard in document order, not in the order of selection.
  • SCI_SETCURRENTPOS and SCI_SETANCHOR work in rectangular mode.
  • On GTK+, drag and drop to a later position in the document now drops at the position.
  • Fix bug where missing property did not use default value.

Release 2.0

  • Released on 11 August 2009.
  • Multiple pieces of text can be selected simultaneously by holding control while dragging the mouse. Typing, backspace and delete may affect all selections together.
  • Virtual space allows selecting beyond the last character on a line.
  • SciTE on GTK+ path bar is now optional and defaults to off.
  • MagikSF lexer recognizes numbers correctly.
  • Folding of Python comments and blank lines improved. Bug #210240.
  • Bug fixed where background colour of last character in document leaked past that character.
  • Crash fixed when adding marker beyond last line in document. Bug #2830307.
  • Resource leak fixed in SciTE for Windows when printing fails. Bug #2816524.
  • Bug fixed on Windows where the system caret was destroyed during destruction when another window was using the system caret. Bug #2830223.
  • Bug fixed where indentation guides were drawn over text when the indentation used a style with a different space width to the default style.
  • SciTE bug fixed where box comment added a bare line feed rather than the chosen line end. Bug #2818104.
  • Reverted fix that led to wrapping whole document when displaying the first line of the document.
  • Export to LaTeX in SciTE fixed to work in more cases and not use as much space. Bug #1286548.
  • Bug fixed where EN_CHANGE notification was sent when performing a paste operation in a read-only document. Bug #2825485.
  • Refactored code so that Scintilla exposes less of its internal implementation and uses the C++ standard library for some basic collections. Projects that linked to Scintilla's SString or PropSet classes should copy this code from a previous version of Scintilla or from SciTE.

Release 1.79

  • Released on 1 July 2009.
  • Memory exhaustion and other exceptions handled by placing an error value into the status property rather than crashing. Scintilla now builds with exception handling enabled and requires exception handling to be enabled.
    This is a major change and application developers should consider how they will deal with Scintilla exhausting memory since Scintilla may not be in a stable state.
  • Deprecated APIs removed. The symbols removed are:
    • SCI_SETCARETPOLICY
    • CARET_CENTER
    • CARET_XEVEN
    • CARET_XJUMPS
    • SC_FOLDFLAG_BOX
    • SC_FOLDLEVELBOXHEADERFLAG
    • SC_FOLDLEVELBOXFOOTERFLAG
    • SC_FOLDLEVELCONTRACTED
    • SC_FOLDLEVELUNINDENT
    • SCN_POSCHANGED
    • SCN_CHECKBRACE
    • SCLEX_ASP
    • SCLEX_PHP
  • Cocoa platform added.
  • Names of struct types in Scintilla.h now start with "Sci_" to avoid possible clashes with platform definitions. Currently, the old names still work but these will be phased out.
  • When lines are wrapped, subsequent lines may be indented to match the indent of the initial line, or one more indentation level. Feature #2796119.
  • APIs added for finding the character at a point rather than an inter-character position. Feature #2646738.
  • A new marker SC_MARK_BACKGROUND_UNDERLINE is drawn in the text area as an underline the full width of the window.
  • Batch file lexer understands variables surrounded by '!'.
  • CAML lexer also supports SML.
  • D lexer handles string and numeric literals more accurately. Feature #2793782.
  • Forth lexer is now case-insensitive and better supports numbers like $hex and %binary. Feature #2804894.
  • Lisp lexer treats '[', ']', '{', and '}' as balanced delimiters which is common usage. Feature #2794989.
    It treats keyword argument names as being equivalent to symbols. Feature #2794901.
  • Pascal lexer bug fixed to prevent hang when 'interface' near beginning of file. Bug #2802863.
  • Perl lexer bug fixed where previous lexical states persisted causing "/" special case styling and subroutine prototype styling to not be correct. Bug #2809168.
  • XML lexer fixes bug where Unicode entities like '&—' were broken into fragments. Bug #2804760.
  • SciTE on GTK+ enables scrolling the tab bar on recent versions of GTK+. Feature #2061821.
  • SciTE on Windows allows tab bar tabs to be reordered by drag and drop.
  • Unit test script for Scintilla on Windows included with source code.
  • User defined menu items are now localized when there is a matching translation.
  • Width of icon column of autocompletion lists on GTK+ made more consistent.
  • Bug with slicing UTF-8 text into character fragments when there is a sequence of 100 or more 3 byte characters. Bug #2780566.
  • Folding bugs introduced in 1.78 fixed. Some of the fix was generic and there was also a specific fix for C++.
  • Bug fixed where a rectangular paste was not padding the line with sufficient spaces to align the pasted text.
  • Bug fixed with showing all text on each line of multi-line annotations when styling the whole annotation using SCI_ANNOTATIONSETSTYLE. Bug #2789430.

Release 1.78

  • Released on 28 April 2009.
  • Annotation lines may be added to each line.
  • A text margin may be defined with different text on each line.
  • Application actions may be added to the undo history.
  • Can query the symbol defined for a marker. An available symbol added for applications to indicate that plugins may allocate a marker.
  • Can increase the amount of font ascent and descent.
  • COBOL lexer added. Feature #2127406.
  • Nimrod lexer added. Feature #2642620.
  • PowerPro lexer added. Feature #2195308.
  • SML lexer added. Feature #2710950.
  • SORCUS Installation file lexer added. Feature #2343375.
  • TACL lexer added. Feature #2127406.
  • TAL lexer added. Feature #2127406.
  • Rewritten Pascal lexer with improved folding and other fixes. Feature #2190650.
  • INDIC_ROUNDBOX translucency level can be modified. Feature #2586290.
  • C++ lexer treats angle brackets in #include directives as quotes when styling.within.preprocessor. Bug #2551033.
  • Inno Setup lexer is sensitive to whether within the [Code] section and handles comments better. Bug #2552973.
  • HTML lexer does not go into script mode when script tag is self-closing.
  • HTML folder fixed where confused by comments when fold.html.preprocessor off. Bug #2532774.
  • Perl lexer fixes problem with string matching caused by line endings. Bug #2648342.
  • Progress lexer fixes problem with "last-event:function" phrase. Bug #2483619.
  • Properties file lexer extended to handle RFC2822 text when lexer.props.allow.initial.spaces on.
  • Python lexer adds options for Python 3 and Cython.
  • Shell lexer fixes heredoc problem caused by line endings. Bug #2635257.
  • TeX lexer handles comment at end of line correctly. Bug #2698766.
  • SciTE retains selection range when performing a replace selection command. Feature #2339160.
  • SciTE definition of word characters fixed to match documentation. Bug #2464531.
  • SciTE on GTK+ performing Search or Replace when dialog already shown now brings dialog to foreground. Bug #2634224.
  • Fixed encoding bug with calltips on GTK+.
  • Block caret drawn in correct place on wrapped lines. Bug #2126144.
  • Compilation for 64 bit Windows works using MinGW. Bug #2515578.
  • Incorrect memory freeing fixed on OS X. Bug #2354098, Bug #2671749.
  • SciTE on GTK+ crash fixed on startup when child process exits before initialization complete. Bug #2716987.
  • Crash fixed when AutoCompleteGetCurrent called with no active autocompletion.
  • Flickering diminished when pressing Tab. Bug #2723006.
  • Namespace compilation issues with GTK+ on OS X fixed.
  • Increased maximum length of SciTE's Language menu on GTK+ to 100 items. Bug #2528241.
  • Fixed incorrect Python lexing for multi-line continued strings. Bug #2450963.

Release 1.77

  • Released on 18 October 2008.
  • Direct temporary access to Scintilla's text buffer to allow simple efficient interfacing to libraries like regular expression libraries.
  • Scintilla on Windows can interpret keys as Unicode even when a narrow character window with SCI_SETKEYSUNICODE.
  • Notification sent when autocompletion cancelled.
  • MySQL lexer added.
  • Lexer for gettext .po files added.
  • Abaqus lexer handles program structure more correctly.
  • Assembler lexer works with non-ASCII text.
  • C++ lexer allows mixed case doc comment tags.
  • CSS lexer updated and works with non-ASCII.
  • Diff lexer adds style for changed lines, handles subversion diffs better and fixes styling and folding for lines containing chunk dividers ("---").
  • FORTRAN lexer accepts more styles of compiler directive.
  • Haskell lexer allows hexadecimal literals.
  • HTML lexer improves PHP and JavaScript folding. PHP heredocs, nowdocs, strings and comments processed more accurately. Internet Explorer's non-standard >comment< tag supported. Script recognition in XML can be controlled with lexer.xml.allow.scripts property.
  • Lua lexer styles last character correctly.
  • Perl lexer update.
  • Comment folding implemented for Ruby.
  • Better TeX folding.
  • Verilog lexer updated.
  • Windows Batch file lexer handles %~ and %*.
  • YAML lexer allows non-ASCII text.
  • SciTE on GTK+ implements "Replace in Buffers" in advanced mode.
  • The extender OnBeforeSave method can override the default file saving behaviour by retuning true.
  • Window position and recent files list may be saved into the session file.
  • Right button press outside the selection moves the caret.
  • SciTE load.on.activate works when closing a document reveals a changed document.
  • SciTE bug fixed where eol.mode not used for initial buffer.
  • SciTE bug fixed where a file could be saved as the same name as another buffer leading to confusing behaviour.
  • Fixed display bug for long lines in same style on Windows.
  • Fixed SciTE crash when finding matching preprocessor command used on some files.
  • Drawing performance improved for files with many blank lines.
  • Folding bugs fixed where changing program text produced a decrease in fold level on a fold header line.
  • Clearing document style now clears all indicators.
  • SciTE's embedded Lua updated to 5.1.4.
  • SciTE will compile with versions of GTK+ before 2.8 again.
  • SciTE on GTK+ bug fixed where multiple files not opened.
  • Bug fixed with SCI_VCHOMEWRAP and SCI_VCHOMEWRAPEXTEND on white last line.
  • Regular expression bug fixed where "^[^(]+$" matched empty lines.

Release 1.76

  • Released on 16 March 2008.
  • Support for PowerShell.
  • Lexer added for Magik.
  • Director extension working on GTK+.
  • Director extension may set focus to SciTE through "focus:" message on GTK+.
  • C++ folder handles final line better in some cases.
  • SCI_COPYALLOWLINE added which is similar to SCI_COPY except that if the selection is empty then the line holding the caret is copied. On Windows an extra clipboard format allows pasting this as a whole line before the current selection. This behaviour is compatible with Visual Studio.
  • On Windows, the horizontal scroll bar can handle wider files.
  • On Windows, a system palette leak was fixed. Should not affect many as palette mode is rarely used.
  • Install command on GTK+ no longer tries to set explicit owner.
  • Perl lexer handles defined-or operator "//".
  • Octave lexer fixes "!=" operator.
  • Optimized selection change drawing to not redraw as much when not needed.
  • SciTE on GTK+ no longer echoes Lua commands so is same as on Windows.
  • Automatic vertical scrolling limited to one line at a time so is not too fast.
  • Crash fixed when line states set beyond end of line states. This occurred when lexers did not set a line state for each line.
  • Crash in SciTE on Windows fixed when search for 513 character string fails.
  • SciTE disables translucent features on Windows 9x due to crashes reported when using translucency.
  • Bug fixed where whitespace background was not seen on wrapped lines.

Release 1.75

  • Released on 22 November 2007.
  • Some WordList and PropSet functionality moved from Scintilla to SciTE. Projects that link to Scintilla's code for these classes may need to copy code from SciTE.
  • Borland C++ can no longer build Scintilla.
  • Invalid bytes in UTF-8 mode are displayed as hex blobs. This also prevents crashes due to passing invalid UTF-8 to platform calls.
  • Indentation guides enhanced to be visible on completely empty lines when possible.
  • The horizontal scroll bar may grow to match the widest line displayed.
  • Allow autocomplete pop ups to appear outside client rectangle in some cases.
  • When line state changed, SC_MOD_CHANGELINESTATE modification notification sent and margin redrawn.
  • SciTE scripts can access the menu command values IDM_*.
  • SciTE's statement.end property has been implemented again.
  • SciTE shows paths and matches in different styles for Find In Files.
  • Incremental search in SciTE for Windows is modeless to make it easier to exit.
  • Folding performance improved.
  • SciTE for GTK+ now includes a Browse button in the Find In Files dialog.
  • On Windows versions that support Unicode well, Scintilla is a wide character window which allows input for some less common languages like Armenian, Devanagari, Tamil, and Georgian. To fully benefit, applications should use wide character calls.
  • Lua function names are exported from SciTE to allow some extension libraries to work.
  • Lexers added for Abaqus, Ansys APDL, Asymptote, and R.
  • SCI_DELWORDRIGHTEND added for closer compatibility with GTK+ entry widget.
  • The styling buffer may now use all 8 bits in each byte for lexical states with 0 bits for indicators.
  • Multiple characters may be set for SciTE's calltip.<lexer>.parameters.start property.
  • Bash lexer handles octal literals.
  • C++/JavaScript lexer recognizes regex literals in more situations.
  • Haskell lexer fixed for quoted strings.
  • HTML/XML lexer does not notice XML indicator if there is non-whitespace between the "<?" and "XML". ASP problem fixed where </ is used inside a comment.
  • Error messages from Lua 5.1 are recognized.
  • Folding implemented for Metapost.
  • Perl lexer enhanced for handling minus-prefixed barewords, underscores in numeric literals and vector/version strings, ^D and ^Z similar to __END__, subroutine prototypes as a new lexical class, formats and format blocks as new lexical classes, and '/' suffixed keywords and barewords.
  • Python lexer styles all of a decorator in the decorator style rather than just the name.
  • YAML lexer styles colons as operators.
  • Fixed SciTE bug where undo would group together multiple separate modifications.
  • Bug fixed where setting background colour of calltip failed.
  • SciTE allows wildcard suffixes for file pattern based properties.
  • SciTE on GTK+ bug fixed where user not prompted to save untitled buffer.
  • SciTE bug fixed where property values from one file were not seen by lower priority files.
  • Bug fixed when showing selection with a foreground colour change which highlighted an incorrect range in some positions.
  • Cut now invokes SCN_MODIFYATTEMPTRO notification.
  • Bug fixed where caret not shown at beginning of wrapped lines. Caret made visible in some cases after wrapping and scroll bar updated after wrapping.
  • Modern indicators now work on wrapped lines.
  • Some crashes fixed for 64-bit GTK+.
  • On GTK+ clipboard features improved for VMWare tools copy and paste. SciTE exports the clipboard more consistently on shut down.

Release 1.74

  • Released on 18 June 2007.
  • OS X support.
  • Indicators changed to be a separate data structure allowing more indicators. Storing indicators in high bits of styling bytes is deprecated and will be removed in the next version.
  • Unicode support extended to all Unicode characters not just the Basic Multilingual Plane.
  • Performance improved on wide lines by breaking long runs in a single style into shorter segments.
  • Performance improved by caching layout of short text segments.
  • SciTE includes Lua 5.1.
  • Caret may be displayed as a block.
  • Lexer added for GAP.
  • Lexer added for PL/M.
  • Lexer added for Progress.
  • SciTE session files have changed format to be like other SciTE .properties files and now use the extension .session. Bookmarks and folds may optionally be saved in session files. Session files created with previous versions of SciTE will not load into this version.
  • SciTE's extension and scripting interfaces add OnKey, OnDwellStart, and OnClose methods.
  • On GTK+, copying to the clipboard does not include the text/urilist type since this caused problems when pasting into Open Office.
  • On GTK+, Scintilla defaults caret blink rate to platform preference.
  • Dragging does not start until the mouse has been dragged a certain amount. This stops spurious drags when just clicking inside the selection.
  • Bug fixed where brace highlight not shown when caret line background set.
  • Bug fixed in Ruby lexer where out of bounds access could occur.
  • Bug fixed in XML folding where tags were not being folded because they are singletons in HTML.
  • Bug fixed when many font names used.
  • Layout bug fixed on GTK+ where fonts have ligatures available.
  • Bug fixed with SCI_LINETRANSPOSE on a blank line.
  • SciTE hang fixed when using UNC path with directory properties feature.
  • Bug on Windows fixed by examining dropped text for Unicode even in non-Unicode mode so it can work when source only provides Unicode or when using an encoding different from the system default.
  • SciTE bug on GTK+ fixed where Stop Executing did not work when more than a single process started.
  • SciTE bug on GTK+ fixed where mouse wheel was not switching between buffers.
  • Minor line end fix to PostScript lexer.

Release 1.73

  • Released on 31 March 2007.
  • SciTE adds a Directory properties file to configure behaviour for files in a directory and its subdirectories.
  • Style changes may be made during text modification events.
  • Regular expressions recognize \d, \D, \s, \S, \w, \W, and \xHH.
  • Support for cmake language added.
  • More Scintilla properties can be queried.
  • Edge line drawn under text.
  • A savesession command added to SciTE director interface.
  • SciTE File | Encoding menu item names changed to be less confusing.
  • SciTE on GTK+ dialog buttons reordered to follow guidelines.
  • SciTE on GTK+ removed GTK+ 1.x compatible file dialog code.
  • SciTE on GTK+ recognizes key names KeypadMultiply and KeypadDivide.
  • Background colour of line wrapping visual flag changed to STYLE_DEFAULT.
  • Makefile lexing enhanced for ':=' operator and when lines start with tab.
  • TADS3 lexer and folder improved.
  • SCN_DOUBLECLICK notification may set SCI_SHIFT, SCI_CTRL, and SCI_ALT flags on modifiers field.
  • Slow folding of large constructs in Python fixed.
  • MSSQL folding fixed to be case-insensitive and fold at more keywords.
  • SciTE's brace matching works better for HTML.
  • Determining API list items checks for specified parameters start character before default '('.
  • Hang fixed in HTML lexer.
  • Bug fixed in with LineTranspose command where markers could move to different line.
  • Memory released when buffer completely emptied.
  • If translucency not available on Windows, draw rectangular outline instead.
  • Bash lexer handles "-x" in "--x-includes..." better.
  • AutoIt3 lexer fixes string followed by '+'.
  • LinesJoin fixed where it stopped early due to not adjusting for inserted spaces..
  • StutteredPageDown fixed when lines wrapped.
  • FormatRange fixed to not double count line number width which could lead to a large space.
  • SciTE Export As PDF and Latex commands fixed to format floating point numbers with '.' even in locales that use ','.
  • SciTE bug fixed where File | New could produce buffer with contents of previous file when using read-only mode.
  • SciTE retains current scroll position when switching buffers and fold.on.open set.
  • SciTE crash fixed where '*' used to invoke parameters dialog.
  • SciTE bugs when writing large UCS-2 files fixed.
  • Bug fixed when scrolling inside a SCN_PAINTED event by invalidating window rather than trying to perform synchronous painting.
  • SciTE for GTK+ View | Full Screen works on recent versions of GTK+.
  • SciTE for Windows enables and disables toolbar commands correctly.

Release 1.72

  • Released on 15 January 2007.
  • Performance of per-line data improved.
  • SC_STARTACTION flag set on the first modification notification in an undo transaction to help synchronize the container's undo stack with Scintilla's.
  • On GTK+ drag and drop defaults to move rather than copy.
  • Scintilla supports extending appearance of selection to right hand margin.
  • Incremental search available on GTK+.
  • SciTE Indentation Settings dialog available on GTK+ and adds a "Convert" button.
  • Find in Files can optionally ignore binary files or directories that start with ".".
  • Lexer added for "D" language.
  • Export as HTML shows folding with underline lines and +/- symbols.
  • Ruby lexer interprets interpolated strings as expressions.
  • Lua lexer fixes some cases of numeric literals.
  • C++ folder fixes bug with "@" in doc comments.
  • NSIS folder handles !if and related commands.
  • Inno setup lexer adds styling for single and double quoted strings.
  • Matlab lexer handles backslashes in string literals correctly.
  • HTML lexer fixed to allow "?>" in comments in Basic script.
  • Added key codes for Windows key and Menu key.
  • Lua script method scite.MenuCommand(x) performs a menu command.
  • SciTE bug fixed with box comment command near start of file setting selection to end of file.
  • SciTE on GTK+, fixed loop that occurred with automatic loading for an unreadable file.
  • SciTE asks whether to save files when Windows shuts down.
  • Save Session on Windows now defaults the extension to "ses".
  • Bug fixed with single character keywords.
  • Fixed infinite loop for SCI_GETCOLUMN for position beyond end of document.
  • Fixed failure to accept typing on Solaris/GTK+ when using default ISO-8859-1 encoding.
  • Fixed warning from Lua in SciTE when creating a new buffer when already have maximum number of buffers open.
  • Crash fixed with "%%" at end of batch file.

Release 1.71

  • Released on 21 August 2006.
  • Double click notification includes line and position.
  • VB lexer bugs fixed for preprocessor directive below a comment or some other states and to use string not closed style back to the starting quote when there are internal doubled quotes.
  • C++ lexer allows identifiers to contain '$' and non-ASCII characters such as UTF-8. The '$' character can be disallowed with lexer.cpp.allow.dollars=0.
  • Perl lexer allows UTF-8 identifiers and has some other small improvements.
  • SciTE's $(CurrentWord) uses word.characters.<filepattern> to define the word rather than a hardcoded list of word characters.
  • SciTE Export as HTML adds encoding information for UTF-8 file and fixes DOCTYPE.
  • SciTE session and .recent files default to the user properties directory rather than global properties directory.
  • Left and right scroll events handled correctly on GTK+ and horizontal scroll bar has more sensible distances for page and arrow clicks.
  • SciTE on GTK+ tab bar fixed to work on recent versions of GTK+.
  • On GTK+, if the approximate character set conversion is unavailable, a second attempt is made without approximations. This may allow keyboard input and paste to work on older systems.
  • SciTE on GTK+ can redefine the Insert key.
  • SciTE scripting interface bug fixed where some string properties could not be changed.

Release 1.70

  • Released on 20 June 2006.
  • On GTK+, character set conversion is performed using an option that allows approximate conversions rather than failures when a character can not be converted. This may lead to similar characters being inserted or when no similar character is available a '?' may be inserted.
  • On GTK+, the internationalized IM (Input Method) feature is used for all typed input for all character sets.
  • Scintilla has new margin types SC_MARGIN_BACK and SC_MARGIN_FORE that use the default style's background and foreground colours (normally white and black) as the background to the margin.
  • Scintilla/GTK+ allows file drops on Windows when drop is of type DROPFILES_DND as well as text/uri-list.
  • Code page can only be set to one of the listed valid values.
  • Text wrapping fixed for cases where insertion was not wide enough to trigger wrapping before being styled but was after styling.
  • SciTE find marks are removed before printing or exporting to avoid producing incorrect styles.

Release 1.69

  • Released on 29 May 2006.
  • SciTE supports z-order based buffer switching on Ctrl+Tab.
  • Translucent support for selection and whole line markers.
  • SciTE may have per-language abbreviations files.
  • Support for Spice language.
  • On GTK+ autocompletion lists are optimized and use correct selection colours.
  • On GTK+ the URI data type is preferred in drag and drop so that applications will see files dragged from the shell rather than dragging the text of the file name into the document.
  • Increased number of margins to 5.
  • Basic lexer allows include directive $include: "file name".
  • SQL lexer no longer bases folding on indentation.
  • Line ends are transformed when copied to clipboard on Windows/GTK+2 as well as Windows/GTK+ 1.
  • Lexing code masks off the indicator bits on the start style before calling the lexer to avoid confusing the lexer when an application has used an indicator.
  • SciTE savebefore:yes only saves the file when it has been changed.
  • SciTE adds output.initial.hide setting to allow setting the size of the output pane without it showing initially.
  • SciTE on Windows Go To dialog allows line number with more digits.
  • Bug in HTML lexer fixed where a segment of PHP could switch scripting language based on earlier text on that line.
  • Memory bug fixed when freeing regions on GTK+. Other minor bugs fixed on GTK+.
  • Deprecated GTK+ calls in Scintilla replaced with current calls.
  • Fixed a SciTE bug where closing the final buffer, if read-only, left the text present in an untitled buffer.
  • Bug fixed in bash lexer that prevented folding.
  • Crash fixed in bash lexer when backslash at end of file.
  • Crash on recent releases of GTK+ 2.x avoided by changing default font from X core font to Pango font "!Sans".
  • Fix for SciTE properties files where multiline properties continued over completely blank lines.
  • Bug fixed in SciTE/GTK+ director interface where more data available than buffer size.
  • Minor visual fixes to SciTE splitter on GTK+.

Release 1.68

  • Released on 9 March 2006.
  • Translucent drawing implemented for caret line and box indicators.
  • Lexer specifically for TCL is much more accurate than reusing C++ lexer.
  • Support for Inno Setup scripts.
  • Support for Opal language.
  • Calltips may use a new style, STYLE_CALLTIP which allows choosing a different font for calltips.
  • Python lexer styles comments on decorators.
  • HTML lexer refined handling of "?>" and "%>" within server side scripts.
  • Batch file lexer improved.
  • Eiffel lexer doesn't treat '.' as a name character.
  • Lua lexer handles length operator, #, and hex literals.
  • Properties file lexer has separate style for keys.
  • PL/SQL folding improved.
  • SciTE Replace dialog always searches in forwards direction.
  • SciTE can detect language of file from initial #! line.
  • SciTE on GTK+ supports output.scroll=2 setting.
  • SciTE can perform an import a properties file from the command line.
  • Set of word characters used for regular expression \< and \>.
  • Bug fixed with SCI_COPYTEXT stopping too early.
  • Bug fixed with splitting lines so that all lines are split.
  • SciTE calls OnSwitchFile when closing one buffer causes a switch to another.
  • SciTE bug fixed where properties were being reevaluated without good reason after running a macro.
  • Crash fixed when clearing document with some lines contracted in word wrap mode.
  • Palette expands as more entries are needed.
  • SCI_POSITIONFROMPOINT returns more reasonable value when close to last text on a line.
  • On Windows, long pieces of text may be drawn in segments if they fail to draw as a whole.
  • Bug fixed with bad drawing when some visual changes made inside SCN_UPDATEUI notification.
  • SciTE bug fixed with groupundo setting.

Release 1.67

  • Released on 17 December 2005.
  • Scintilla checks the paint region more accurately when seeing if an area is being repainted. Platform layer implementations may need to change for this to take effect. This fixes some drawing and styling bugs. Also optimized some parts of marker code to only redraw the line of the marker rather than whole of the margin.
  • Quoted identifier style for SQL. SQL folding performed more simply.
  • Ruby lexer improved to better handle here documents and non-ASCII characters.
  • Lua lexer supports long string and block comment syntax from Lua 5.1.
  • Bash lexer handles here documents better.
  • JavaScript lexing recognizes regular expressions more accurately and includes flag characters in the regular expression style. This is both in JavaScript files and when JavaScript is embedded in HTML.
  • Scintilla API provided to reveal how many style bits are needed for the current lexer.
  • Selection duplicate added.
  • Scintilla API for adding a set of markers to a line.
  • DBCS encodings work on Windows 9x.
  • Convention defined for property names to be used by lexers and folders so they can be automatically discovered and forwarded from containers.
  • Default bookmark in SciTE changed to a blue sphere image.
  • SciTE stores the time of last asking for a save separately for each buffer which fixes bugs with automatic reloading.
  • On Windows, pasted text has line ends converted to current preference. GTK+ already did this.
  • Kid template language better handled by HTML lexer by finishing ASP Python mode when a ?> is found.
  • SciTE counts number of characters in a rectangular selection correctly.
  • 64-bit compatibility improved. One change that may affect user code is that the notification message header changed to include a pointer-sized id field to match the current Windows definition.
  • Empty ranges can no longer be dragged.
  • Crash fixed when calls made that use layout inside the painted notification.
  • Bug fixed where Scintilla created pixmap buffers that were too large leading to failures when many instances used.
  • SciTE sets the directory of a new file to the directory of the currently active file.
  • SciTE allows choosing a code page for the output pane.
  • SciTE HTML exporter no longer honours monospaced font setting.
  • Line layout cache in page mode caches the line of the caret. An assertion is now used to ensure that the layout reentrancy problem that caused this is easier to find.
  • Speed optimized for long lines and lines containing many control characters.
  • Bug fixed in brace matching in DBCS files where byte inside character is same as brace.
  • Indent command does not indent empty lines.
  • SciTE bug fixed for commands that operate on files with empty extensions.
  • SciTE bug fixed where monospaced option was copied for subsequently opened files.
  • SciTE on Windows bug fixed in the display of a non-ASCII search string which can not be found.
  • Bugs fixed with nested calls displaying a new calltip while one is already displayed.
  • Bug fixed when styling PHP strings.
  • Bug fixed when styling C++ continued preprocessor lines.
  • SciTE bug fixed where opening file from recently used list reset choice of language.
  • SciTE bug fixed when compiled with NO_EXTENSIONS and closing one file closes the application.
  • SciTE crash fixed for error messages that look like Lua messages but aren't in the same order.
  • Remaining fold box support deprecated. The symbols SC_FOLDLEVELBOXHEADERFLAG, SC_FOLDLEVELBOXFOOTERFLAG, SC_FOLDLEVELCONTRACTED, SC_FOLDLEVELUNINDENT, and SC_FOLDFLAG_BOX are deprecated.

Release 1.66

  • Released on 26 August 2005.
  • New, more ambitious Ruby lexer.
  • SciTE Find in Files dialog has options for matching case and whole words which are enabled when the internal find command is used.
  • SciTE output pane can display automatic completion after "$(" typed. An initial ">" on a line is ignored when Enter pressed.
  • C++ lexer recognizes keywords within line doc comments. It continues styles over line end characters more consistently so that eolfilled style can be used for preprocessor lines and line comments.
  • VB lexer improves handling of file numbers and date literals.
  • Lua folder handles repeat until, nested comments and nested strings.
  • POV lexer improves handling of comment lines.
  • AU3 lexer and folder updated. COMOBJ style added.
  • Bug fixed with text display on GTK+ with Pango 1.8.
  • Caret painting avoided when not focused.
  • SciTE on GTK+ handles file names used to reference properties as case-sensitive.
  • SciTE on GTK+ Save As and Export commands set the file name field. On GTK+ the Export commands modify the file name in the same way as on Windows.
  • Fixed SciTE problem where confirmation was not displaying when closing a file where all contents had been deleted.
  • Middle click on SciTE tab now closes correct buffer on Windows when tool bar is visible.
  • SciTE bugs fixed where files contained in directory that includes '.' character.
  • SciTE bug fixed where import in user options was reading file from directory of global options.
  • SciTE calltip bug fixed where single line calltips had arrow displayed incorrectly.
  • SciTE folding bug fixed where empty lines were shown for no reason.
  • Bug fixed where 2 byte per pixel XPM images caused crash although they are still not displayed.
  • Autocompletion list size tweaked.

Release 1.65

  • Released on 1 August 2005.
  • FreeBasic support.
  • SciTE on Windows handles command line arguments "-" (read standard input into buffer), "--" (read standard input into output pane) and "-@" (read file names from standard input and open each).
  • SciTE includes a simple implementation of Find in Files which is used if no find.command is set.
  • SciTE can close tabs with a mouse middle click.
  • SciTE includes a save.all.for.build setting.
  • Folder for MSSQL.
  • Batch file lexer understands more of the syntax and the behaviour of built in commands.
  • Perl lexer handles here docs better; disambiguates barewords, quote-like delimiters, and repetition operators; handles Pods after __END__; recognizes numbers better; and handles some typeglob special variables.
  • Lisp adds more lexical states.
  • PHP allows spaces after <<<.
  • TADS3 has a simpler set of states and recognizes identifiers.
  • Avenue elseif folds better.
  • Errorlist lexer treats lines starting with '+++' and '---' as separate styles from '+' and '-' as they indicate file names in diffs.
  • SciTE error recognizer handles file paths in extra explanatory lines from MSVC and in '+++' and '---' lines from diff.
  • Bugs fixed in SciTE and Scintilla folding behaviour when text pasted before folded text caused unnecessary unfolding and cutting text could lead to text being irretrievably hidden.
  • SciTE on Windows uses correct font for dialogs and better font for tab bar allowing better localization
  • When Windows is used with a secondary monitor before the primary monitor, autocompletion lists are not forced onto the primary monitor.
  • Scintilla calltip bug fixed where down arrow setting wrong value in notification if not in first line. SciTE bug fixed where second arrow only shown on multiple line calltip and was therefore misinterpreting the notification value.
  • Lexers will no longer be re-entered recursively during, for example, fold level setting.
  • Undo of typing in overwrite mode undoes one character at a time rather than requiring a removal and addition step for each character.
  • EM_EXSETSEL(0,-1) fixed.
  • Bug fixed where part of a rectangular selection was not shown as selected.
  • Autocomplete window size fixed.

Release 1.64

  • Released on 6 June 2005.
  • TADS3 support
  • Smalltalk support.
  • Rebol support.
  • Flagship (Clipper / XBase) support.
  • CSound support.
  • SQL enhanced to support SQL*Plus.
  • SC_MARK_FULLRECT margin marker fills the whole marker margin for marked lines with a colour.
  • Performance improved for some large undo and redo operations and modification flags added in notifications.
  • SciTE adds command equivalents for fold margin mouse actions.
  • SciTE adds OnUpdateUI to set of events that can be handled by a Lua script.
  • Properties set in Scintilla can be read.
  • GTK+ SciTE exit confirmation adds Cancel button.
  • More accurate lexing of numbers in PHP and Caml.
  • Perl can fold POD and package sections. POD verbatim section style. Globbing syntax recognized better.
  • Context menu moved slightly on GTK+ so that it will be under the mouse and will stay open if just clicked rather than held.
  • Rectangular selection paste works the same whichever direction the selection was dragged in.
  • EncodedFromUTF8 handles -1 length argument as documented.
  • Undo and redo can cause SCN_MODIFYATTEMPTRO notifications.
  • Indicators display correctly when they start at the second character on a line.
  • SciTE Export As HTML uses standards compliant CSS.
  • SciTE automatic indentation handles keywords for indentation better.
  • SciTE fold.comment.python property removed as does not work.
  • Fixed problem with character set conversion when pasting on GTK+.
  • SciTE default character set changed from ANSI_CHARSET to DEFAULT_CHARSET.
  • Fixed crash when creating empty autocompletion list.
  • Autocomplete window size made larger under some conditions to make truncation less common.
  • Bug fixed where changing case of a selection did not affect initial character of lines in multi-byte encodings.
  • Bug fixed where rectangular selection not displayed after Alt+Shift+Click.

Release 1.63

  • Released on 4 April 2005.
  • Autocompletion on Windows changed to use pop up window, be faster, allow choice of maximum width and height, and to highlight only the text of the selected item rather than both the text and icon if any.
  • Extra items can be added to the context menu in SciTE.
  • Character wrap mode in Scintilla helps East Asian languages.
  • Lexer added for Haskell.
  • Objective Caml support.
  • BlitzBasic and PureBasic support.
  • CSS support updated to handle CSS2.
  • C++ lexer is more selective about document comment keywords.
  • AutoIt 3 lexer improved.
  • Lua lexer styles end of line characters on comment and preprocessor lines so that the eolfilled style can be applied to them.
  • NSIS support updated for line continuations, box comments, SectionGroup and PageEx, and with more up-to-date properties.
  • Clarion lexer updated to perform folding and have more styles.
  • SQL lexer gains second set of keywords.
  • Errorlist lexer recognizes Borland Delphi error messages.
  • Method added for determining number of visual lines occupied by a document line due to wrapping.
  • Sticky caret mode does not modify the preferred caret x position when typing and may be useful for typing columns of text.
  • Dwell end notification sent when scroll occurs.
  • On GTK+, Scintilla requisition height is screen height rather than large fixed value.
  • Case insensitive autocompletion prefers exact case match.
  • SCI_PARADOWN and SCI_PARAUP treat lines containing only white space as empty and handle text hidden by folding.
  • Scintilla on Windows supports WM_PRINTCLIENT although there are some limitations.
  • SCN_AUTOCSELECTION notification sent when user selects from autoselection list.
  • SciTE's standard properties file sets buffers to 10, uses Pango fonts on GTK+ and has dropped several languages to make the menu fit on screen.
  • SciTE's encoding cookie detection loosened so that common XML files will load in UTF-8 if that is their declared encoding.
  • SciTE on GTK+ changes menus and toolbars to not be detachable unless turned on with a property. Menus no longer tear off. The toolbar may be set to use the default theme icons rather than SciTE's set. Changed key for View | End of Line because of a conflict. Language menu can contain more items.
  • SciTE on GTK+ 2.x allows the height and width of the file open file chooser to be set, for the show hidden files check box to be set from an option and for it to be opened in the directory of the current file explicitly. Enter key works in save chooser.
  • Scintilla lexers should no longer see bits in style bytes that are outside the set they modify so should be able to correctly lex documents where the container has used indicators.
  • SciTE no longer asks to save before performing a revert.
  • SciTE director interface adds a reloadproperties command to reload properties from files.
  • Allow build on CYGWIN platform.
  • Allow use from LccWin compiler.
  • SCI_COLOURISE for SCLEX_CONTAINER causes a SCN_STYLENEEDED notification.
  • Bugs fixed in lexing of HTML/ASP/JScript.
  • Fix for folding becoming confused.
  • On Windows, fixes for Japanese Input Method Editor and for 8 bit Katakana characters.
  • Fixed buffer size bug avoided when typing long words by making buffer bigger.
  • Undo after automatic indentation more sensible.
  • SciTE menus on GTK+ uses Shift and Ctrl rather than old style abbreviations.
  • SciTE full screen mode on Windows calculates size more correctly.
  • SciTE on Windows menus work better with skinning applications.
  • Searching bugs fixed.
  • Colours reallocated when changing image using SCI_REGISTERIMAGE.
  • Caret stays visible when Enter held down.
  • Undo of automatic indentation more reasonable.
  • High processor usage fixed in background wrapping under some circumstances.
  • Crashing bug fixed on AMD64.
  • SciTE crashing bug fixed when position.height or position.width not set.
  • Crashing bug on GTK+ fixed when setting cursor and window is NULL.
  • Crashing bug on GTK+ preedit window fixed.
  • SciTE crashing bug fixed in incremental search on Windows ME.
  • SciTE on Windows has an optional find and replace dialogs that can search through all buffers and search within a particular style number.

Release 1.62

  • Released on 31 October 2004.
  • Lexer added for ASN.1.
  • Lexer added for VHDL.
  • On Windows, an invisible system caret is used to allow screen readers to determine where the caret is. The visible caret is still drawn by the painting code.
  • On GTK+, Scintilla has methods to read the target as UTF-8 and to convert a string from UTF-8 to the document encoding. This eases integration with containers that use the UTF-8 encoding which is the API encoding for GTK+ 2.
  • SciTE on GTK+2 and Windows NT/2000/XP allows search and replace of Unicode text.
  • SciTE calltips allow setting the characters used to start and end parameter lists and to separate parameters.
  • FindColumn method converts a line and column into a position, taking into account tabs and multi-byte characters.
  • On Windows, when Scintilla copies text to the clipboard as Unicode, it avoids adding an ANSI copy as the system will automatically convert as required in a context-sensitive manner.
  • SciTE indent.auto setting automatically determines indent.size and use.tabs from document contents.
  • SciTE defines a CurrentMessage property that holds the most recently selected output pane message.
  • SciTE Lua scripting enhanced with
    • A Lua table called 'buffer' is associated with each buffer and can be used to maintain buffer-specific state.
    • A 'scite' object allows interaction with the application such as opening files from script.
    • Dynamic properties can be reset by assigning nil to a given key in the props table.
    • An 'OnClear' event fires whenever properties and extension scripts are about to be reloaded.
    • On Windows, loadlib is enabled and can be used to access Lua binary modules / DLLs.
  • SciTE Find in Files on Windows can be used in a modeless way and gains a '..' button to move up to the parent directory. It is also wider so that longer paths can be seen.
  • Close buttons added to dialogs in SciTE on Windows.
  • SciTE on GTK+ 2 has a "hidden files" check box in file open dialog.
  • SciTE use.monospaced setting removed. More information in the FAQ.
  • APDL lexer updated with more lexical classes
  • AutoIt3 lexer updated.
  • Ada lexer fixed to support non-ASCII text.
  • Cpp lexer now only matches exactly three slashes as starting a doc-comment so that lines of slashes are seen as a normal comment. Line ending characters are appear in default style on preprocessor and single line comment lines.
  • CSS lexer updated to support CSS2 including second set of keywords.
  • Errorlist lexer now understands Java stack trace lines.
  • SciTE's handling of HTML Tidy messages jumps to column as well as line indicated.
  • Lisp lexer allows multiline strings.
  • Lua lexer treats .. as an operator when between identifiers.
  • PHP lexer handles 'e' in numerical literals.
  • PowerBasic lexer updated for macros and optimized.
  • Properties file folder changed to leave lines before a header at the base level and thus avoid a vertical line when using connected folding symbols.
  • GTK+ on Windows version uses Alt for rectangular selection to be compatible with platform convention.
  • SciTE abbreviations file moved from system directory to user directory so each user can have separate abbreviations.
  • SciTE on GTK+ has improved .desktop file and make install support that may lead to better integration with system shell.
  • Disabling of themed background drawing on GTK+ extended to all cases.
  • SciTE date formatting on Windows performed with the user setting rather than the system setting.
  • GTK+ 2 redraw while scrolling fixed.
  • Recursive property definitions are safer, avoiding expansion when detected.
  • SciTE thread synchronization for scripts no longer uses HWND_MESSAGE so is compatible with older versions of Windows. Other Lua scripting bugs fixed.
  • SciTE on Windows localization of menu accelerators changed to be compatible with alternative UI themes.
  • SciTE on Windows full screen mode now fits better when menu different height to title bar height.
  • SC_MARK_EMPTY marker is now invisible and does not change the background colour.
  • Bug fixed in HTML lexer to allow use of <?xml in strings in scripts without triggering xml mode.
  • Bug fixed in SciTE abbreviation expansion that could break indentation or crash.
  • Bug fixed when searching for a whole word string that ends one character before end of document.
  • Drawing bug fixed when indicators drawn on wrapped lines.
  • Bug fixed when double clicking a hotspot.
  • Bug fixed where autocompletion would remove typed text if no match found.
  • Bug fixed where display does not scroll when inserting in long wrapped line.
  • Bug fixed where SCI_MARKERDELETEALL would only remove one of the markers on a line that contained multiple markers with the same number.
  • Bug fixed where markers would move when converting line endings.
  • Bug fixed where SCI_LINEENDWRAP would move too far when line ends are visible.
  • Bugs fixed where calltips with unicode or other non-ASCII text would display incorrectly.
  • Bug fixed in determining if at save point after undoing from save point and then performing changes.
  • Bug fixed on GTK+ using unsupported code pages where extraneous text could be drawn.
  • Bug fixed in drag and drop code on Windows where dragging from SciTE to Firefox could hang both applications.
  • Crashing bug fixed on GTK+ when no font allocation succeeds.
  • Crashing bug fixed when autocompleting word longer than 1000 characters.
  • SciTE crashing bug fixed when both Find and Replace dialogs shown by disallowing this situation.

Release 1.61

  • Released on 29 May 2004.
  • Improvements to selection handling on GTK+.
  • SciTE on GTK+ 2.4 uses the improved file chooser which allows file extension filters, multiple selection, and remembers favourite directories.
  • SciTE Load Session and Save Session commands available on GTK+.
  • SciTE lists Lua Startup Script in Options menu when loaded.
  • In SciTE, OnUserListSelection can be implemented in Lua.
  • SciTE on Windows has a context menu on the file tabs.
  • SQL lexer allows '#' comments and optionally '\' quoting inside strings.
  • Mssql lexer improved.
  • AutoIt3 lexer updated.
  • Perl lexer recognizes regular expression use better.
  • Errorlist lexer understands Lua tracebacks and copes with findstr output for file names that end with digits.
  • Drawing of lines on GTK+ improved and made more like Windows without final point.
  • SciTE on GTK+ uses a high resolution window icon.
  • SciTE can be set to warn before loading files larger than a particular size.
  • SciTE Lua scripting bugs fixed included a crashing bug when using an undefined function name that would go before first actual name.
  • SciTE bug fixed where a modified buffer was not saved if it was the last buffer and was not current when the New command used.
  • SciTE monofont mode no longer affects line numbers.
  • Crashing bug in SciTE avoided by not allowing both the Find and Replace dialogs to be visible at one time.
  • Crashing bug in SciTE fixed when Lua scripts were being run concurrently.
  • Bug fixed that caused incorrect line number width in SciTE.
  • PHP folding bug fixed.
  • Regression fixed when setting word characters to not include some of the standard word characters.

Release 1.60

  • Released on 1 May 2004.
  • SciTE can be scripted using the Lua programming language.
  • command.mode is a better way to specify tool command options in SciTE.
  • Continuation markers can be displayed so that you can see which lines are wrapped.
  • Lexer for Gui4Cli language.
  • Lexer for Kix language.
  • Lexer for Specman E language.
  • Lexer for AutoIt3 language.
  • Lexer for APDL language.
  • Lexer for Bash language. Also reasonable for other Unix shells.
  • SciTE can load lexers implemented in external shared libraries.
  • Perl treats "." not as part of an identifier and interprets '/' and '->' correctly in more circumstances.
  • PHP recognizes variables within strings.
  • NSIS has properties "nsis.uservars" and "nsis.ignorecase".
  • MSSQL lexer adds keyword list for operators and stored procedures, defines '(', ')', and ',' as operators and changes some other details.
  • Input method preedit window on GTK+ 2 may support some Asian languages.
  • Platform interface adds an extra platform-specific flag to Font::Create. Used on wxWidgets to choose antialiased text display but may be used for any task that a platform needs.
  • OnBeforeSave method added to Extension interface.
  • Scintilla methods that return strings can be called with a NULL pointer to find out how long the string should be.
  • Visual Studio .NET project file now in VS .NET 2003 format so can not be used directly in VS .NET 2002.
  • Scintilla can be built with GTK+ 2 on Windows.
  • Updated RPM spec for SciTE on GTK+.
  • GTK+ makefile for SciTE allows selection of destination directory, creates destination directories and sets file modes and owners better.
  • Tab indents now go to next tab multiple rather than add tab size.
  • SciTE abbreviations now use the longest possible match rather than the shortest.
  • Autocompletion does not remove prefix when actioned with no choice selected.
  • Autocompletion cancels when moving beyond the start position, not at the start position.
  • SciTE now shows only calltips for functions that match exactly, not those that match as a prefix.
  • SciTE can repair box comment sections where some lines were added without the box comment middle line prefix.
  • Alt+ works in user.shortcuts on Windows.
  • SciTE on GTK+ enables replace in selection for rectangular selections.
  • Key bindings for command.shortcut implemented in a way that doesn't break when the menus are localized.
  • Drawing of background on GTK+ faster as theme drawing disabled.
  • On GTK+, calltips are moved back onto the screen if they extend beyond the screen bounds.
  • On Windows, the Scintilla object is destroyed on WM_NCDESTROY rather than WM_DESTROY which arrives earlier. This fixes some problems when Scintilla was subclassed.
  • The zorder switching feature removed due to number of crashing bugs.
  • Code for XPM images made more robust.
  • Bug fixed with primary selection on GTK+.
  • On GTK+ 2, copied or cut text can still be pasted after the Scintilla widget is destroyed.
  • Styling change not visible problem fixed when line was cached.
  • Bug in SciTE on Windows fixed where clipboard commands stopped working.
  • Crashing bugs in display fixed in line layout cache.
  • Crashing bug may be fixed on AMD64 processor on GTK+.
  • Rare hanging crash fixed in Python lexer.
  • Display bugs fixed with DBCS characters on GTK+.
  • Autocompletion lists on GTK+ 2 are not sorted by the ListModel as the contents are sorted correctly by Scintilla.
  • SciTE fixed to not open extra untitled buffers with check.if.already.open.
  • Sizing bug fixed on GTK+ when window resized while unmapped.
  • Text drawing crashing bug fixed on GTK+ with non-Pango fonts and long strings.
  • Fixed some issues if characters are unsigned.
  • Fixes in NSIS support.

Release 1.59

  • Released on 19 February 2004.
  • SciTE Options and Language menus reduced in length by commenting out some languages. Languages can be enabled by editing the global properties file.
  • Verilog language supported.
  • Lexer for Microsoft dialect of SQL. SciTE properties file available from extras page.
  • Perl lexer disambiguates '/' better.
  • NSIS lexer improved with a lexical class for numbers, option for ignoring case of keywords, and folds only occurring when folding keyword first on line.
  • PowerBasic lexer improved with styles for constants and assembler and folding improvements.
  • On GTK+, input method support only invoked for Asian languages and not European languages as the old European keyboard code works better.
  • Scintilla can be requested to allocate a certain amount and so avoid repeated reallocations and memory inefficiencies. SciTE uses this and so should require less memory.
  • SciTE's "toggle current fold" works when invoked on child line as well as fold header.
  • SciTE output pane scrolling can be set to not scroll back to start after completion of command.
  • SciTE has a $(SessionPath) property.
  • SciTE on Windows can use VK_* codes for keys in user.shortcuts.
  • Stack overwrite bug fixed in SciTE's command to move to the end of a preprocessor conditional.
  • Bug fixed where vertical selection appeared to select a different set of characters then would be used by, for example, a copy.
  • SciTE memory leak fixed in fold state remembering.
  • Bug fixed where changing the style of some text outside the standard StyleNeeded notification would not be visible.
  • On GTK+ 2 g_iconv is used in preference to iconv, as it is provided by GTK+ so should avoid problems finding the iconv library.
  • On GTK+ fixed a style reference count bug.
  • Memory corruption bug fixed with GetSelText.
  • On Windows Scintilla deletes memory on WM_NCDESTROY rather than the earlier WM_DESTROY to avoid problems when the window is subclassed.

Release 1.58

  • Released on 11 January 2004.
  • Method to discover the currently highlighted element in an autocompletion list.
  • On GTK+, the lexers are now included in the scintilla.a library file. This will require changes to the make files of dependent projects.
  • Octave support added alongside related Matlab language and Matlab support improved.
  • VB lexer gains an unterminated string state and 4 sets of keywords.
  • Ruby lexer handles $' correctly.
  • Error line handling improved for FORTRAN compilers from Absoft and Intel.
  • International input enabled on GTK+ 2 although there is no way to choose an input method.
  • MultiplexExtension in SciTE allows multiple extensions to be used at once.
  • Regular expression replace interprets backslash expressions \a, \b, \f, \n, \r, \t, and \v in the replacement value.
  • SciTE Replace dialog displays number of replacements made when Replace All or Replace in Selection performed.
  • Localization files may contain a translation.encoding setting which is used on GTK+ 2 to automatically reencode the translation to UTF-8 so it will be the localized text will be displayed correctly.
  • SciTE on GTK+ implements check.if.already.open.
  • Make files for Mac OS X made more robust.
  • Performance improved in SciTE when switching buffers when there is a rectangular selection.
  • Fixed failure to display some text when wrapped.
  • SciTE crashes from Ctrl+Tab buffer cycling fixed. May still be some rare bugs here.
  • Crash fixed when decoding an error message that appears similar to a Borland error message.
  • Fix to auto-scrolling allows containers to implement enhanced double click selection.
  • Hang fixed in idle word wrap.
  • Crash fixed in hotspot display code..
  • SciTE on Windows Incremental Search no longer moves caret back.
  • SciTE hang fixed when performing a replace with a find string that matched zero length strings such as ".*".
  • SciTE no longer styles the whole file when saving buffer fold state as that was slow.

Release 1.57

  • Released on 27 November 2003.
  • SciTE remembers folding of each buffer.
  • Lexer for Erlang language.
  • Scintilla allows setting the set of white space characters.
  • Scintilla has 'stuttered' page movement commands to first move to top or bottom within current visible lines before scrolling.
  • Scintilla commands for moving to end of words.
  • Incremental line wrap enabled on Windows.
  • SciTE PDF exporter produces output that is more compliant with reader applications, is smaller and allows more configuration. HTML exporter optimizes size of output files.
  • SciTE defines properties PLAT_WINNT and PLAT_WIN95 on the corresponding platforms.
  • SciTE can adjust the line margin width to fit the largest line number. The line.numbers property is split between line.margin.visible and line.margin.width.
  • SciTE on GTK+ allows user defined menu accelerators. Alt can be included in user.shortcuts.
  • SciTE Language menu can have items commented out.
  • SciTE on Windows Go to dialog allows choosing a column number as well as a line number.
  • SciTE on GTK+ make file uses prefix setting more consistently.
  • Bug fixed that caused word wrapping to fail to display all text.
  • Crashing bug fixed in GTK+ version of Scintilla when using GDK fonts and opening autocompletion.
  • Bug fixed in Scintilla SCI_GETSELTEXT where an extra NUL was included at end of returned string
  • Crashing bug fixed in SciTE z-order switching implementation.
  • Hanging bug fixed in Perl lexer.
  • SciTE crashing bug fixed for using 'case' without argument in style definition.

Release 1.56

  • Released on 25 October 2003.
  • Rectangular selection can be performed using the keyboard. Greater programmatic control over rectangular selection. This has caused several changes to key bindings.
  • SciTE Replace In Selection works on rectangular selections.
  • Improved lexer for TeX, new lexer for Metapost and other support for these languages.
  • Lexer for PowerBasic.
  • Lexer for Forth.
  • YAML lexer improved to include error styling.
  • Perl lexer improved to correctly handle more cases.
  • Assembler lexer updated to support single-quote strings and fix some problems.
  • SciTE on Windows can switch between buffers in order of use (z-order) rather than static order.
  • SciTE supports adding an extension for "Open Selected Filename". The openpath setting works on GTK+.
  • SciTE can Export as XML.
  • SciTE $(SelHeight) variable gives a more natural result for empty and whole line selections.
  • Fixes to wrapping problems, such as only first display line being visible in some cases.
  • Fixes to hotspot to only highlight when over the hotspot, only use background colour when set and option to limit hotspots to a single line.
  • Small fixes to FORTRAN lexing and folding.
  • SQL lexer treats single quote strings as a separate class to double quote strings..
  • Scintilla made compatible with expectations of container widget in GTK+ 2.3.
  • Fix to strip out pixmap ID when automatically choosing from an autocompletion list with only one element.
  • SciTE bug fixed where UTF-8 files longer than 128K were gaining more than one BOM.
  • Crashing bug fixed in SciTE on GTK+ where using "Stop Executing" twice leads to all applications exiting.
  • Bug fixed in autocompletion scrolling on GTK+ 2 with a case sensitive list. The ListBox::Sort method is no longer needed or available so platform maintainers should remove it.
  • SciTE check.if.already.open setting removed from GTK+ version as unmaintained.

Release 1.55

  • Released on 25 September 2003.
  • Fix a crashing bug in indicator display in Scintilla.
  • GTK+ version now defaults to building for GTK+ 2 rather than 1.
  • Mingw make file detects compiler version and avoids options that are cause problems for some versions.
  • Large performance improvement on GTK+ 2 for long lines.
  • Incremental line wrap on GTK+.
  • International text entry works much better on GTK+ with particular improvements for Baltic languages and languages that use 'dead' accents. NUL key events such as those generated by some function keys, ignored.
  • Unicode clipboard support on GTK+.
  • Indicator type INDIC_BOX draws a rectangle around the text.
  • Clarion language support.
  • YAML language support.
  • MPT LOG language support.
  • On Windows, SciTE can switch buffers based on activation order rather than buffer number.
  • SciTE save.on.deactivate saves all buffers rather than just the current buffer.
  • Lua lexer handles non-ASCII characters correctly.
  • Error lexer understands Borland errors with pathnames that contain space.
  • On GTK+ 2, autocompletion uses TreeView rather than deprecated CList.
  • SciTE autocompletion removed when expand abbreviation command used.
  • SciTE calltips support overloaded functions.
  • When Save fails in SciTE, choice offered to Save As.
  • SciTE message boxes on Windows may be moved to front when needed.
  • Indicators drawn correctly on wrapped lines.
  • Regular expression search no longer matches characters with high bit set to characters without high bit set.
  • Hang fixed in backwards search in multi byte character documents.
  • Hang fixed in SciTE Mark All command when wrap around turned off.
  • SciTE Incremental Search no longer uses hot keys on Windows.
  • Calltips draw non-ASCII characters correctly rather than as arrows.
  • SciTE crash fixed when going to an error message with empty file name.
  • Bugs fixed in XPM image handling code.

Release 1.54

  • Released on 12 August 2003.
  • SciTE on GTK+ 2.x can display a tab bar.
  • SciTE on Windows provides incremental search.
  • Lexer for PostScript.
  • Lexer for the NSIS scripting language.
  • New lexer for POV-Ray Scene Description Language replaces previous implementation.
  • Lexer for the MMIX Assembler language.
  • Lexer for the Scriptol language.
  • Incompatibility: SQL keywords are specified in lower case rather than upper case. SQL lexer allows double quoted strings.
  • Pascal lexer: character constants that start with '#' understood, '@' only allowed within assembler blocks, '$' can be the start of a number, initial '.' in 0..constant not treated as part of a number, and assembler blocks made more distinctive.
  • Lua lexer allows '.' in keywords. Multi-line strings and comments can be folded.
  • CSS lexer handles multiple psuedoclasses.
  • Properties file folder works for INI file format.
  • Hidden indicator style allows the container to mark text within Scintilla without there being any visual effect.
  • SciTE does not prompt to save changes when the buffer is empty and untitled.
  • Modification notifications caused by SCI_INSERTSTYLEDSTRING now include the contents of the insertion.
  • SCI_MARKERDELETEALL deletes all the markers on a line rather than just the first match.
  • Better handling of 'dead' accents on GTK+ 2 for languages that use accented characters.
  • SciTE now uses value of output.vertical.size property.
  • Crash fixed in SciTE autocompletion on long lines.
  • Crash fixed in SciTE comment command on long lines.
  • Bug fixed with backwards regular expression search skipping every second match.
  • Hang fixed with regular expression replace where both target and replacement were empty.

Release 1.53

  • Released on 16 May 2003.
  • On GTK+ 2, encodings other than ASCII, Latin1, and Unicode are supported for both display and input using iconv.
  • External lexers supported on GTK+/Linux. External lexers must now be explicitly loaded with SCI_LOADLEXERLIBRARY rather than relying upon a naming convention and automatic loading.
  • Support of Lout typesetting language.
  • Support of E-Scripts language used in the POL Ultima Online Emulator.
  • Scrolling and drawing performance on GTK+ enhanced, particularly for GTK+ 2.x with an extra window for the text area avoiding conflicts with the scroll bars.
  • CopyText and CopyRange methods in Scintilla allow container to easily copy to the system clipboard.
  • Line Copy command implemented and bound to Ctrl+Shift+T.
  • Scintilla APIs PositionBefore and PositionAfter can be used to iterate through a document taking into account the encoding and multi-byte characters.
  • C++ folder can fold on the "} else {" line of an if statement by setting fold.at.else property to 1.
  • C++ lexer allows an extra set of keywords.
  • Property names and thus abbreviations may be non-ASCII.
  • Removed attempt to load a file when setting properties that was part of an old scripting experiment.
  • SciTE no longer warns about a file not existing when opening properties files from the Options menu as there is a good chance the user wants to create one.
  • Bug fixed with brace recognition in multi-byte encoded files where a partial character matched a brace byte.
  • More protection against infinite loops or recursion with recursive property definitions.
  • On Windows, cursor will no longer disappear over margins in custom builds when cursor resource not present. The Windows default cursor is displayed instead.
  • load.on.activate fixed in SciTE as was broken in 1.52.

Release 1.52

  • Released on 17 April 2003.
  • Pango font support on GTK+ 2. Unicode input improved on GTK+ 2.
  • Hotspot style implemented in Scintilla.
  • Small up and down arrows can be displayed in calltips and the container is notified when the mouse is clicked on a calltip. Normal and selected calltip text colours can be set.
  • POSIX compatibility flag in Scintilla regular expression search interprets bare ( and ) as tagged sections.
  • Error message lexer tightened to yield fewer false matches. Recognition of Lahey and Intel FORTRAN error formats.
  • Scintilla keyboard commands for moving to start and end of screen lines rather than document lines, unless already there where these keys move to the start or end of the document line.
  • Line joining command.
  • Lexer for POV-Ray.
  • Calltips on Windows are no longer clipped by the parent window.
  • Autocompletion lists are cancelled when focus leaves their parent window.
  • Move to next/previous empty line delimited paragraph key commands.
  • SciTE hang fixed with recursive property definitions by placing limit on number of substitutions performed.
  • SciTE Export as PDF reenabled and works.
  • Added loadsession: command line command to SciTE.
  • SciTE option to quit application when last document closed.
  • SciTE option to ask user if it is OK to reload a file that has been modified outside SciTE.
  • SciTE option to automatically save before running particular command tools or to ask user or to not save.
  • SciTE on Windows 9x will write a Ctrl+Z to the process input pipe before closing the pipe when running tool commands that take input.
  • Added a manifest resource to SciTE on Windows to enable Windows XP themed UI.
  • SciTE calltips handle nested calls and other situations better.
  • CSS lexer improved.
  • Interface to platform layer changed - Surface initialization now requires a WindowID parameter.
  • Bug fixed with drawing or measuring long pieces of text on Windows 9x by truncating the pieces.
  • Bug fixed with SciTE on GTK+ where a user shortcut for a visible character inserted the character as well as executing the command.
  • Bug fixed where primary selection on GTK+ was reset by Scintilla during creation.
  • Bug fixed where SciTE would close immediately on startup when using save.session.
  • Crash fixed when entering '\' in LaTeX file.
  • Hang fixed when '#' last character in VB file.
  • Crash fixed in error message lexer.
  • Crash fixed when searching for long regular expressions.
  • Pressing return when nothing selected in user list sends notification with empty text rather than random text.
  • Mouse debouncing disabled on Windows as it interfered with some mouse utilities.
  • Bug fixed where overstrike mode inserted before rather than replaced last character in document.
  • Bug fixed with syntax highlighting of Japanese text.
  • Bug fixed in split lines function.
  • Cosmetic fix to SciTE tab bar on Windows when window resized. Focus sticks to either pane more consistently.

Release 1.51

  • Released on 16 February 2003.
  • Two phase drawing avoids cutting off text that overlaps runs by drawing all the backgrounds of a line then drawing all the text transparently. Single phase drawing is an option.
  • Scintilla method to split lines at a particular width by adding new line characters.
  • The character used in autocompletion lists to separate the text from the image number can be changed.
  • The scrollbar range will automatically expand when the caret is moved beyond the current range. The scroll bar is updated when SCI_SETXOFFSET is called.
  • Mouse cursors on GTK+ improved to be consistent with other applications and the Windows version.
  • Horizontal scrollbar on GTK+ now disappears in wrapped mode.
  • Scintilla on GTK+ 2: mouse wheel scrolling, cursor over scrollbars, focus, and syntax highlighting now work. gtk_selection_notify avoided for compatibility with GTK+ 2.2.
  • Fold margin colours can now be set.
  • SciTE can be built for GTK+ 2.
  • SciTE can optionally preserve the undo history over an automatic file reload.
  • Tags can optionally be case insensitive in XML and HTML.
  • SciTE on Windows handles input to tool commands in a way that should avoid deadlock. Output from tools can be used to replace the selection.
  • SciTE on GTK+ automatically substitutes '|' for '/' in menu items as '/' is used to define the menu hierarchy.
  • Optional buffer number in SciTE title bar.
  • Crash fixed in SciTE brace matching.
  • Bug fixed where automatic scrolling past end of document flipped back to the beginning.
  • Bug fixed where wrapping caused text to disappear.
  • Bug fixed on Windows where images in autocompletion lists were shown on the wrong item.
  • Crash fixed due to memory bug in autocompletion lists on Windows.
  • Crash fixed when double clicking some error messages.
  • Bug fixed in word part movement where sometimes no movement would occur.
  • Bug fixed on Windows NT where long text runs were truncated by treating NT differently to 9x where there is a limitation.
  • Text in not-changeable style works better but there remain some cases where it is still possible to delete text protected this way.

Release 1.50

  • Released on 24 January 2003.
  • Autocompletion lists may have a per-item pixmap.
  • Autocompletion lists allow Unicode text on Windows.
  • Scintilla documentation rewritten.
  • Additional DBCS encoding support in Scintilla on GTK+ primarily aimed at Japanese EUC encoding.
  • CSS (Cascading Style Sheets) lexer added.
  • diff lexer understands some more formats.
  • Fold box feature is an alternative way to show the structure of code.
  • Avenue lexer supports multiple keyword lists.
  • The caret may now be made invisible by setting the caret width to 0.
  • Python folder attaches comments before blocks to the next block rather than the previous block.
  • SciTE openpath property on Windows searches a path for files that are the subject of the Open Selected Filename command.
  • The localization file name can be changed with the locale.properties property.
  • On Windows, SciTE can pipe the result of a string expression into a command line tool.
  • On Windows, SciTE's Find dialog has a Mark All button.
  • On Windows, there is an Insert Abbreviation command that allows a choice from the defined abbreviations and inserts the selection into the abbreviation at the position of a '|'.
  • Minor fixes to Fortran lexer.
  • fold.html.preprocessor decides whether to fold <? and ?>. Minor improvements to PHP folding.
  • Maximum number of keyword lists allowed increased from 6 to 9.
  • Duplicate line command added with default assignment to Ctrl+D.
  • SciTE sets $(Replacements) to the number of replacements made by the Replace All command. $(CurrentWord) is set to the word before the caret if the caret is at the end of a word.
  • Opening a SciTE session now loads files in remembered order, sets the current file as remembered, and moves the caret to the remembered line.
  • Bugs fixed with printing on Windows where line wrapping was causing some text to not print.
  • Bug fixed with Korean Input Method Editor on Windows.
  • Bugs fixed with line wrap which would sometimes choose different break positions after switching focus away and back.
  • Bug fixed where wheel scrolling had no effect on GTK+ after opening a fold.
  • Bug fixed with file paths containing non-ASCII characters on Windows.
  • Crash fixed with printing on Windows after defining pixmap marker.
  • Crash fixed in makefile lexer when first character on line was '='.
  • Bug fixed where local properties were not always being applied.
  • Ctrl+Keypad* fold command works on GTK+.
  • Hangs fixed in SciTE's Replace All command when replacing regular expressions '^' or '$'.
  • SciTE monospace setting behaves more sensibly.

Release 1.49

  • Released on 1 November 2002.
  • Unicode supported on GTK+. To perform well, this added a font cache to GTK+ and to make that safe, a mutex is used. The mutex requires the application to link in the threading library by evaluating `glib-config --libs gthread`. A Unicode locale should also be set up by a call like setlocale(LC_CTYPE, "en_US.UTF-8"). scintilla_release_resources function added to release mutex.
  • FORTRAN and assembler lexers added along with other support for these languages in SciTE.
  • Ada lexer improved handling of based numbers, identifier validity and attributes distinguished from character literals.
  • Lua lexer handles block comments and a deep level of nesting for literal strings and block comments.
  • Errorlist lexer recognizes PHP error messages.
  • Variant of the C++ lexer with case insensitive keywords called cppnocase. Whitespace in preprocessor text handled more correctly.
  • Folder added for Perl.
  • Compilation with GCC 3.2 supported.
  • Markers can be pixmaps.
  • Lines are wrapped when printing. Bug fixed which printed line numbers in different styles.
  • Text can be appended to end with AppendText method.
  • ChooseCaretX method added.
  • Vertical scroll bar can be turned off with SetVScrollBar method.
  • SciTE Save All command saves all buffers.
  • SciTE localization compares keys case insensitively to make translations more flexible.
  • SciTE detects a utf-8 coding cookie "coding: utf-8" in first two lines and goes into Unicode mode.
  • SciTE key bindings are definable.
  • SciTE Find in Files dialog can display directory browser to choose directory to search.
  • SciTE enabling of undo and redo toolbar buttons improved.
  • SciTE on Windows file type filters in open dialog sorted.
  • Fixed crashing bug when using automatic tag closing in XML or HTML.
  • Fixed bug on Windows causing very long (>64K) lines to not display.
  • Fixed bug in backwards regular expression searching.
  • Fixed bug in calltips where wrong argument was highlighted.
  • Fixed bug in tab timmy feature when file has line feed line endings.
  • Fixed bug in compiling without INCLUDE_DEPRECATED_FEATURES defined.

Release 1.48

  • Released on 9 September 2002.
  • Improved Pascal lexer with context sensitive keywords and separate folder which handles //{ and //} folding comments and {$region} and {$end} folding directives. The "case" statement now folds correctly.
  • C++ lexer correctly handles comments on preprocessor lines.
  • New commands for moving to beginning and end of display lines when in line wrap mode. Key bindings added for these commands.
  • New marker symbols that look like ">>>" and "..." which can be used for interactive shell prompts for Python.
  • The foreground and background colours of visible whitespace can be chosen independent of the colours chosen for the lexical class of that whitespace.
  • Per line data optimized by using an exponential allocation scheme.
  • SciTE API file loading optimized.
  • SciTE for GTK+ subsystem 2 documented. The exit status of commands is decoded into more understandable fields.
  • SciTE find dialog remembers previous find string when there is no selection. Find in Selection button disabled when selection is rectangular as command did not work.
  • Shift+Enter made equivalent to Enter to avoid users having to let go of the shift key when typing. Avoids the possibility of entering single carriage returns in a file that contains CR+LF line ends.
  • Autocompletion does not immediately disappear when the length parameter to SCI_AUTOCSHOW is 0.
  • SciTE focuses on the editor pane when File | New executed and when the output pane is closed with F8. Double clicking on a non-highlighted output pane line selects the word under the cursor rather than seeking the next highlighted line.
  • SciTE director interface implements an "askproperty" command.
  • SciTE's Export as LaTeX output improved.
  • Better choice of autocompletion displaying above the caret rather than below when that is more sensible.
  • Bug fixed where context menu would not be completely visible if invoked when cursor near bottom or left of screen.
  • Crashing bug fixed when displaying long strings on GTK+ caused failure of X server by displaying long text in segments.
  • Crashing bug fixed on GTK+ when a Scintilla window was removed from its parent but was still the selection owner.
  • Bug fixed on Windows in Unicode mode where not all characters on a line were displayed when that line contained some characters not in ASCII.
  • Crashing bug fixed in SciTE on Windows with clearing output while running command.
  • Bug fixed in SciTE for GTK+ with command completion not detected when no output was produced by the command.
  • Bug fixed in SciTE for Windows where menus were not shown translated.
  • Bug fixed where words failed to display in line wrapping mode with visible line ends.
  • Bug fixed in SciTE where files opened from a session file were not closed.
  • Cosmetic flicker fixed when using Ctrl+Up and Ctrl+Down with some caret policies.

Release 1.47

  • Released on 1 August 2002.
  • Support for GTK+ 2 in Scintilla. International input methods not supported on GTK+2.
  • Line wrapping performance improved greatly.
  • New caret policy implementation that treats horizontal and vertical positioning equivalently and independently. Old caret policy methods deprecated and not all options work correctly with old methods.
  • Extra fold points for C, C++, Java, ... for fold comments //{ .. //} and #if / #ifdef .. #endif and the #region .. #endregion feature of C#.
  • Scintilla method to find the height in pixels of a line. Currently returns the same result for every line as all lines are same height.
  • Separate make file, scintilla_vc6.mak, for Scintilla to use Visual C++ version 6 since main makefile now assumes VS .NET. VS .NET project files available for combined Scintilla and SciTE in scite/boundscheck.
  • SciTE automatically recognizes Unicode files based on their Byte Order Marks and switches to Unicode mode. On Windows, where SciTE supports Unicode display, this allows display of non European characters. The file is saved back into the same character encoding unless the user decides to switch using the File | Encoding menu.
  • Handling of character input changed so that a fillup character, typically '(' displays a calltip when an autocompletion list was being displayed.
  • Multiline strings lexed better for C++ and Lua.
  • Regular expressions in JavaScript within hypertext files are lexed better.
  • On Windows, Scintilla exports a function called Scintilla_DirectFunction that can be used the same as the function returned by GetDirectFunction.
  • Scintilla converts line endings of text obtained from the clipboard to the current default line endings.
  • New SciTE property ensure.final.line.end can ensure that saved files always end with a new line as this is required by some tools. The ensure.consistent.line.ends property ensures all line ends are the current default when saving files. The strip.trailing.spaces property now works on the buffer so the buffer in memory and the file on disk are the same after a save is performed.
  • The SciTE expand abbreviation command again allows '|' characters in expansions to be quoted by using '||'.
  • SciTE on Windows can send data to the find tool through standard input rather than using a command line argument to avoid problems with quoting command line arguments.
  • The Stop Executing command in SciTE on Windows improved to send a Ctrl+Z character to the tool. Better messages when stopping a tool.
  • Autocompletion can automatically "fill up" when one of a set of characters is type with the autocomplete.<lexer>.fillups property.
  • New predefined properties in SciTE, SelectionStartColumn, SelectionStartLine, SelectionEndColumn, SelectionEndLine can be used to integrate with other applications.
  • Environment variables are available as properties in SciTE.
  • SciTE on Windows keeps status line more current.
  • Abbreviations work in SciTE on Linux when first opened.
  • File saving fixed in SciTE to ensure files are not closed when they can not be saved because of file permissions. Also fixed a problem with buffers that caused files to not be saved.
  • SciTE bug fixed where monospace mode not remembered when saving files. Some searching options now remembered when switching files.
  • SciTE on Linux now waits on child termination when it shuts a child down to avoid zombies.
  • SciTE on Linux has a Print menu command that defaults to invoking a2ps.
  • Fixed incorrect highlighting of indentation guides in SciTE for Python.
  • Crash fixed in Scintilla when calling GetText for 0 characters.
  • Exporting as LaTeX improved when processing backslashes and tabs and setting up font.
  • Crash fixed in SciTE when exporting or copying as RTF.
  • SciTE session loading fixed to handle more than 10 files in session.

Release 1.46

  • Released on 10 May 2002.
  • Set of lexers compiled into Scintilla can now be changed by adding and removing lexer source files from scintilla/src and running LexGen.py.
  • SCN_ZOOM notification provided by Scintilla when user changes zoom level. Method to determine width of strings in pixels so that elements can be sized relative to text size. SciTE changed to keep line number column displaying a given number of characters.
  • The logical width of the document used to determine scroll bar range can be set.
  • Setting to allow vertical scrolling to display last line at top rather than bottom of window.
  • Read-only mode improved to avoid changing the selection in most cases when a modification is attempted. Drag and drop cursors display correctly for read-only in some cases.
  • Visual C++ options in make files changed to suit Visual Studio .NET.
  • Scintilla.iface includes feature types for enumerations and lexers.
  • Lua lexer improves handling of literal strings and copes with nested literal strings.
  • Diff lexer changed to treat lines starting with "***" similarly to "---". Symbolic names defined for lexical classes.
  • nncrontab lexer improved.
  • Turkish fonts (iso8859-9) supported on GTK+.
  • Automatic close tag feature for XML and HTML in SciTE.
  • Automatic indentation in SciTE improved.
  • Maximum number of buffers available in SciTE increased. May be up to 100 although other restrictions on menu length limit the real maximum.
  • Save a Copy command added to SciTE.
  • Export as TeX command added to SciTE.
  • Export as HTML command in SciTE respects Use Monospaced Font and background colour settings.
  • Compilation problem on Solaris fixed.
  • Order of files displayed for SciTE's previous and next menu and key commands are now consistent.
  • Saving of MRU in recent file changed so files open when SciTE quit are remembered.
  • More variants of ctags tags handled by Open Selected Filename in SciTE.
  • JavaScript embedded in XML highlighted again.
  • SciTE status bar updated after changing parameters in case they are being displayed in status bar.
  • Crash fixed when handling some multi-byte languages.
  • Crash fixed when replacing end of line characters.
  • Bug in SciTE fixed in multiple buffer mode where automatic loading turned on could lead to losing file contents.
  • Bug in SciTE on GTK+ fixed where dismissing dialogs with close box led to those dialogs never being shown again.
  • Bug in SciTE on Windows fixed where position.tile with default positions led to SciTE being positioned off-screen.
  • Bug fixed in read-only mode, clearing all deletes contraction state data leading to it not being synchronized with text.
  • Crash fixed in SciTE on Windows when tab bar displayed.

Release 1.45

  • Released on 15 March 2002.
  • Line layout cache implemented to improve performance by maintaining the positioning of characters on lines. Can be set to cache nothing, the line with the caret, the visible page or the whole document.
  • Support, including a new lexer, added for Matlab programs.
  • Lua folder supports folding {} ranges and compact mode. Lua lexer styles floating point numbers in number style instead of setting the '.' in operator style. Up to 6 sets of keywords. Better support for [[ although only works well when all on one line.
  • Python lexer improved to handle floating point numbers that contain negative exponents and that start with '.'.
  • When performing a rectangular paste, the caret now remains at the insertion point.
  • On Windows with a wheel mouse, page-at-a-time mode is recognized.
  • Read-only mode added to SciTE with a property to initialize it and another property, $(ReadOnly) available to show this mode in the status bar.
  • SciTE status bar can show the number of lines in the selection with the $(SelHeight) property.
  • SciTE's "Export as HTML" command uses the current character set to produce correct output for non-Western-European character sets, such as Russian.
  • SciTE's "Export as RTF" fixed to produce correct output when file contains '\'.
  • SciTE goto command accepts a column as well as a line. If given a column, it selects the word at that column.
  • SciTE's Build, Compile and Go commands are now disabled if no action has been assigned to them.
  • The Refresh button in the status bar has been removed from SciTE on Windows.
  • Bug fixed in line wrap mode where cursor up or down command did not work.
  • Some styling bugs fixed that were due to a compilation problem with gcc and inline functions with same name but different code.
  • The way that lexers loop over text was changed to avoid accessing beyond the end or setting beyond the end. May fix some bugs and make the code safer but may also cause new bugs.
  • Bug fixed in HTML lexer's handling of SGML.
  • Bug fixed on GTK+/X where lines wider than 32767 pixels did not display.
  • SciTE bug fixed with file name generation for standard property files.
  • SciTE bug fixed with Open Selected Filename command when used with file name and line number combination.
  • In SciTE, indentation and tab settings stored with buffers so maintained correctly as buffers selected. The properties used to initialize these settings can now be set separately for different file patterns.
  • Thread safety improved on Windows with a critical section protecting the font cache and initialization of globals performed within Scintilla_RegisterClasses. New Scintilla_ReleaseResources call provided to allow explicit freeing of resources when statically bound into another application. Resources automatically freed in DLL version. The window classes are now unregistered as part of resource freeing which fixes bugs that occurred in some containers such as Internet Explorer.
  • 'make install' fixed on Solaris.
  • Bug fixed that could lead to a file being opened twice in SciTE.

Release 1.44

  • Released on 4 February 2002.
  • Crashing bug fixed in Editor::Paint.
  • Lua lexer no longer treats '.' as a word character and handles 6 keyword sets.
  • WordStartPosition and WordEndPosition take an onlyWordCharacters argument.
  • SciTE option for simplified automatic indentation which repeats the indentation of the previous line.
  • Compilation fix on Alpha because of 64 bit.
  • Compilation fix for static linking.
  • Limited maximum line length handled to 8000 characters as previous value of 16000 was causing stack exhaustion crashes for some.
  • When whole document line selected, only the last display line gets the extra selected rectangle at the right hand side rather than every display line.
  • Caret disappearing bug fixed for the case that the caret was not on the first display line of a document line.
  • SciTE bug fixed where untitled buffer containing text was sometimes deleted without chance to save.
  • SciTE bug fixed where use.monospaced not working with multiple buffers.

Release 1.43

  • Released on 19 January 2002.
  • Line wrapping robustness and performance improved in Scintilla.
  • Line wrapping option added to SciTE for both edit and output panes.
  • Static linking on Windows handles cursor resource better. Documentation of static linking improved.
  • Autocompletion has an option to delete any word characters after the caret upon selecting an item.
  • FOX version identified by PLAT_FOX in Platform.h.
  • Calltips in SciTE use the calltip.<lexer>.word.characters setting to correctly find calltips for functions that include characters like '$' which is not normally considered a word character.
  • SciTE has a command to show help on itself which gets hooked up to displaying SciTEDoc.html.
  • SciTE option calltip.<lexer>.end.definition to display help text on a second line of calltip.
  • Fixed the handling of the Buffers menu on GTK+ to ensure current buffer indicated and no warnings occur. Changed some menu items on GTK+ version to be same as Windows version.
  • use.monospaced property for SciTE determines initial state of Use Monospaced Font setting.
  • The SciTE Complete Symbol command now works when there are no word characters before the caret, even though it is slow to display the whole set of symbols.
  • Function names removed from SciTE's list of PHP keywords. The full list of predefined functions is available from another web site mentioned on the Extras page.
  • Crashing bug at startup on GTK+ for some configurations fixed.
  • Crashing bug on GTK+ on 64 bit platforms fixed.
  • Compilation problem with some compilers fixed in GTK+.
  • Japanese text entry improved on Windows 9x.
  • SciTE recent files directory problem on Windows when HOME and SciTE_HOME environment variables not set is now the directory of the executable.
  • Session files no longer include untitled buffers.

Release 1.42

  • Released on 24 December 2001.
  • Better localization support including context menus and most messages. Translations of the SciTE user interface available for Bulgarian, French, German, Italian, Russian, and Turkish.
  • Can specify a character to use to indicate control characters rather than having them displayed as mnemonics.
  • Scintilla key command for backspace that will not delete line end characters.
  • Scintilla method to find start and end of words.
  • SciTE on GTK+ now supports the load.on.activate and save.on.deactivate properties in an equivalent way to the Windows version.
  • The output pane of SciTE on Windows is now interactive so command line utilities that prompt for input or confirmation can be used.
  • SciTE on Windows can choose directory for a "Find in Files" command like the GTK+ version could.
  • SciTE can now load a set of API files rather than just one file.
  • ElapsedTime class added to Platform for accurate measurement of durations. Used for debugging and for showing the user how long commands take in SciTE.
  • Baan lexer added.
  • In C++ lexer, document comment keywords no longer have to be at the start of the line.
  • PHP lexer changed to match keywords case insensitively.
  • More shell keywords added.
  • SciTE support for VoiceXML added to xml.properties.
  • In SciTE the selection is not copied to the find field of the Search and Replace dialogs if it contains end of line characters.
  • SciTE on Windows has a menu item to decide whether to respond to other instances which are performing their check.if.already.open check.
  • SciTE accelerator key for Box Comment command changed to avoid problems in non-English locales.
  • SciTE context menu includes Close command for the editor pane and Hide command for the output pane.
  • output: command added to SciTE director interface to add text to the output pane. The director interface can execute commands (such as tool commands with subsystem set to 3) by sending a macro:run message.
  • SciTE on GTK+ will defer to the Window Manager for position if position.left or position.top not set and for size if position.width or position.height not set.
  • SciTE on Windows has a position.tile property to place a second instance to the right of the first.
  • Scintilla on Windows again supports EM_GETSEL and EM_SETSEL.
  • Problem fixed in Scintilla on Windows where control ID is no longer cached as it could be changed by external code.
  • Problems fixed in SciTE on Windows when finding any other open instances at start up when check.if.already.open is true.
  • Bugs fixed in SciTE where command strings were not always having variables evaluated.
  • Bugs fixed with displaying partial double-byte and Unicode characters in rectangular selections and at the edge when edge mode is EDGE_BACKGROUND. Column numbers reported by GetColumn treat multiple byte characters as one column rather than counting bytes.
  • Bug fixed with caret movement over folded lines.
  • Another bug fixed with tracking selection in secondary views when performing modifications.
  • Horizontal scrolling and display of long lines optimized.
  • Cursor setting in Scintilla on GTK+ optimized.
  • Experimental changeable style attribute. Set to false to make text read-only. Currently only stops caret from being within not-changeable text and does not yet stop deleting a range that contains not-changeable text. Can be used from SciTE by adding notchangeable to style entries.
  • Experimental line wrapping. Currently has performance and appearance problems.

Release 1.41

  • Released on 6 November 2001.
  • Changed Platform.h to not include platform headers. This lessens likelihood and impact of name clashes from system headers and also speeds up compilation. Renamed DrawText to DrawTextNoClip to avoid name clash.
  • Changed way word functions work to treat a sequence of punctuation as a word. This is more sensible and also more compatible with other editors.
  • Cursor changes over the margins and selection on GTK+ platform.
  • SC_MARK_BACKGROUND is a marker that only changes the line's background colour.
  • Enhanced Visual Basic lexer handles character date and octal literals, and bracketed keywords for VB.NET. There are two VB lexers, vb and vbscript with type indication characters like ! and $ allowed at the end of identifiers in vb but not vbscript. Lexer states now separate from those used for C++ and names start with SCE_B.
  • Lexer added for Bullant language.
  • The horizontal scroll position, xOffset, is now exposed through the API.
  • The SCN_POSCHANGED notification is deprecated as it was causing confusion. Use SCN_UPDATEUI instead.
  • Compilation problems fixed for some versions of gcc.
  • Support for WM_GETTEXT restored on Windows.
  • Double clicking on an autocompletion list entry works on GTK+.
  • Bug fixed with case insensitive sorts for autocompletion lists.
  • Bug fixed with tracking selection in secondary views when performing modifications.
  • SciTE's abbreviation expansion feature will now indent expansions to the current indentation level if indent.automatic is on.
  • SciTE allows setting up of parameters to commands from a dialog and can also show this dialog automatically to prompt for arguments when running a command.
  • SciTE's Language menu (formerly Options | Use Lexer) is now defined by the menu.language property rather than being hardcoded.
  • The user interface of SciTE can be localized to a particular language by editing a locale.properties file.
  • On Windows, SciTE will try to move to the front when opening a new file from the shell and using check.if.already.open.
  • SciTE can display the file name and directory in the title bar in the form "file @ directory" when title.full.path=2.
  • The SciTE time.commands property reports the time taken by a command as well as its status when completed.
  • The SciTE find.files property is now a list separated by '|' characters and this list is added into the Files pull down of the Find in Files dialog.

Release 1.40

  • Released on 23 September 2001.
  • Removal of emulation of Win32 RichEdit control in core of Scintilla. This change may be incompatible with existing client code. Some emulation still done in Windows platform layer.
  • SGML support in the HTML/XML lexer.
  • SciTE's "Stop Executing" command will terminate GUI programs on Windows NT and Windows 2000.
  • StyleContext class helps construct lexers that are simple and accurate. Used in the C++, Eiffel, and Python lexers.
  • Clipboard operations in GTK+ version convert between platform '\n' line endings and currently chosen line endings.
  • Any character in range 0..255 can be used as a marker. This can be used to support numbered bookmarks, for example.
  • The default scripting language for ASP can be set.
  • New lexer and other support for crontab files used with the nncron scheduler.
  • Folding of Python improved.
  • The ` character is treated as a Python operator.
  • Line continuations ("\" at end of line) handled inside Python strings.
  • More consistent handling of line continuation ('\' at end of line) in C++ lexer. This fixes macro definitions that span more than one line.
  • C++ lexer can understand Doxygen keywords in doc comments.
  • SciTE on Windows allows choosing to open the "open" dialog on the directory of the current file rather than in the default directory.
  • SciTE on Windows handles command line arguments in "check.if.already.open" correctly when the current directory of the new instance is different to the already open instance of SciTE.
  • "cwd" command (change working directory) defined for SciTE director interface.
  • SciTE "Export As HTML" produces better, more compliant, and shorter files.
  • SciTE on Windows allows several options for determining default file name for exported files.
  • Automatic indentation of Python in SciTE fixed.
  • Exported HTML can support folding.
  • Bug fixed in SCI_GETTEXT macro command of director interface.
  • Cursor leak fixed on GTK+.
  • During SciTE shutdown, "identity" messages are no longer sent over the director interface.

Release 1.39

  • Released on 22 August 2001.
  • Windows version requires msvcrt.dll to be available so will not work on original Windows 95 version 1. The msvcrt.dll file is installed by almost everything including Internet Explorer so should be available.
  • Flattened tree control style folding margin. The SciTE fold.plus option is now fold.symbols and has more values for the new styles.
  • Mouse dwell events are generated when the user holds the mouse steady over Scintilla.
  • PositionFromPointClose is like PositionFromPoint but returns INVALID_POSITION when point outside window or after end of line.
  • Input of Hungarian and Russian characters in GTK+ version works by truncating input to 8 bits if in the range of normal characters.
  • Better choices for font descriptors on GTK+ for most character sets.
  • GTK+ Scintilla is destroyed upon receiving destroy signal rather than destroy_event signal.
  • Style setting that force upper or lower case text.
  • Case-insensitive autocompletion lists work correctly.
  • Keywords can be prefix based so ^GTK_ will treat all words that start with GTK_ as keywords.
  • Horizontal scrolling can be jumpy rather than gradual.
  • GetSelText places a '\0' in the buffer if the selection is empty..
  • EnsureVisible split into two methods EnsureVisible which will not scroll to show the line and EnsureVisibleEnforcePolicy which may scroll.
  • Python folder has options to fold multi-line comments and triple quoted strings.
  • C++ lexer handles keywords before '.' like "this.x" in Java as keywords. Compact folding mode option chooses whether blank lines after a structure are folded with that structure. Second set of keywords with separate style supported.
  • Ruby lexer handles multi-line comments.
  • VB has folder.
  • PHP lexer has an operator style, handles "<?" and "?>" inside strings and some comments.
  • TCL lexer which is just an alias for the C++ lexer so does not really understand TCL syntax.
  • Error lines lexer has styles for Lua error messages and .NET stack traces.
  • Makefile lexer has a target style.
  • Lua lexer handles some [[]] string literals.
  • HTML and XML lexer have a SCE_H_SGML state for tags that start with "<!".
  • Fixed Scintilla bugs with folding. When modifications were performed near folded regions sometimes no unfolding occurred when it should have. Deleting a fold causing character sometimes failed to update fold information correctly.
  • Better support for Scintilla on GTK+ for Win32 including separate PLAT_GTK_WIN32 definition and correct handling of rectangular selection with clipboard operations.
  • SciTE has a Tools | Switch Pane (Ctrl+F6) command to switch focus between edit and output panes.
  • SciTE option output.scroll allows automatic scrolling of output pane to be turned off.
  • Commands can be typed into the SciTE output pane similar to a shell window.
  • SciTE properties magnification and output magnification set initial zoom levels.
  • Option for SciTE comment block command to place comments at start of line.
  • SciTE for Win32 has an option to minimize to the tray rather than the task bar.
  • Close button on SciTE tool bar for Win32.
  • SciTE compiles with GCC 3.0.
  • SciTE's automatic indentation of C++ handles braces without preceding keyword correctly.
  • Bug fixed with GetLine method writing past the end of where it should.
  • Bug fixed with mouse drag automatic scrolling when some lines were folded.
  • Bug fixed because caret XEven setting was inverted.
  • Bug fixed where caret was initially visible even though window was not focussed.
  • Bug fixed where some file names could end with "\\" which caused slow downs on Windows 9x.
  • On Win32, SciTE Replace dialog starts with focus on replacement text.
  • SciTE Go to dialog displays correct current line.
  • Fixed bug with SciTE opening multiple files at once.
  • Fixed bug with Unicode key values reported to container truncated.
  • Fixed bug with unnecessary save point notifications.
  • Fixed bugs with indenting and unindenting at start of line.
  • Monospace Font setting behaves more consistently.

Release 1.38

  • Released on 23 May 2001.
  • Loadable lexer plugins on Windows.
  • Ruby lexer and support.
  • Lisp lexer and support.
  • Eiffel lexer and support.
  • Modes for better handling of Tab and BackSpace keys within indentation. Mode to avoid autocompletion list cancelling when there are no viable matches.
  • ReplaceTarget replaced with two calls ReplaceTarget (which is incompatible with previous ReplaceTarget) and ReplaceTargetRE. Both of these calls have a count first parameter which allows using strings containing nulls. SearchInTarget and SetSearchFlags functions allow specifying a search in several simple steps which helps some clients which can not create structs or pointers easily.
  • Asian language input through an Input Method Editor works on Windows 2000.
  • On Windows, control characters can be entered through use of the numeric keypad in conjunction with the Alt key.
  • Document memory allocation changed to grow exponentially which reduced time to load a 30 Megabyte file from 1000 seconds to 25. Change means more memory may be used.
  • Word part movement keys now handled in Scintilla rather than SciTE.
  • Regular expression '^' and '$' work more often allowing insertion of text at start or end of line with a replace command. Backslash quoted control characters \a, \b, \f, \t, and \v recognized within sets.
  • Session files for SciTE.
  • Export as PDF command hidden in SciTE as it often failed. Code still present so can be turned on by those willing to cope.
  • Bug fixed in HTML lexer handling % before > as end ASP even when no start ASP encountered. Bug fixed when scripts ended with a quoted string and end tag was not seen.
  • Bug fixed on Windows where context menu key caused menu to appear in corner of screen rather than within window.
  • Bug fixed in SciTE's Replace All command not processing whole file when replace string longer than search string.
  • Bug fixed in SciTE's MRU list repeating entries if Ctrl+Tab used when all entries filled.
  • ConvertEOLs call documentation fixed.

Release 1.37

  • Released on 17 April 2001.
  • Bug fixed with scroll bars being invisible on GTK+ 1.2.9.
  • Scintilla and SciTE support find and replace using simple regular expressions with tagged expressions. SciTE supports C '\' escapes in the Find and Replace dialogs. Replace in Selection available in SciTE.
  • Scintilla has a 'target' feature for replacing code rapidly without causing display updates.
  • Scintilla and SciTE on GTK+ support file dropping from file managers such as Nautilus and gmc. Files or other URIs dropped on Scintilla result in a URIDropped notification.
  • Lexers may have separate Lex and Fold functions.
  • Lexer infrastructure improved to allow for plug in lexers and for referring to lexers by name rather than by ID.
  • Ada lexer and support added.
  • Option in both Scintilla and SciTE to treat both left and right margin as equally important when repositioning visible area in response to caret movement. Default is to prefer visible area positioning which minimizes the horizontal scroll position thus favouring the left margin.
  • Caret line highlighting.
  • Commands to delete from the caret to the end of line and from the caret to the beginning of line.
  • SciTE has commands for inserting and removing block comments and for inserting stream comments.
  • SciTE Director interface uses C++ '\' escapes to send control characters.
  • SciTE Director interface adds more commands including support for macros.
  • SciTE has menu options for recording and playing macros which are visible when used with a companion program that supports these features.
  • SciTE has an Expand Abbreviation command. Abbreviations are stored in a global abbrev.properties file.
  • SciTE has a Full Screen command to switch between a normal window size and using the full screen. On Windows, the menu bar can be turned off when in full screen mode.
  • SciTE has a Use monospaced font command to switch between the normal set of fonts and one size of a particular fixed width font.
  • SciTE's use of tabs can be controlled for particular file names as well as globally.
  • The contents of SciTE's status bar can be defined by a property and include variables. On Windows, several status bar definitions can be active with a click on the status bar cycling through them.
  • Copy as RTF command in SciTE on Windows to allow pasting styled text into word processors.
  • SciTE can allow the use of non-alphabetic characters in Complete Symbol lists and can automatically display this autocompletion list when a trigger character such as '.' is typed. Complete word can be set to pop up when the user is typing a word and there is only one matching word in the document.
  • SciTE lists the imported properties files on a menu to allow rapid access to them.
  • SciTE on GTK+ improvements to handling accelerator keys and focus in dialogs. Message boxes respond to key presses without the Alt key as they have no text entries to accept normal keystrokes.
  • SciTE on GTK+ sets the application icon.
  • SciTE allows setting the colours used to indicate the current error line.
  • Variables within PHP strings have own style. Keyword list updated.
  • Keyword list for Lua updated for Lua 4.0.
  • Bug fixed in rectangular selection where rectangle still appeared selected after using cursor keys to move caret.
  • Bug fixed in C++ lexer when deleting a '{' controlling a folded range led to that range becoming permanently invisible.
  • Bug fixed in Batch lexer where comments were not recognized.
  • Bug fixed with undo actions coalescing into steps incorrectly.
  • Bug fixed with Scintilla on GTK+ positioning scroll bars 1 pixel over the Scintilla window leading to their sides being chopped off.
  • Bugs fixed in SciTE when doing some actions led to the start or end of the file being displayed rather than the current location.
  • Appearance of calltips fixed to look like document text including any zoom factor. Positioned to be outside current line even when multiple fonts and sizes used.
  • Bug fixed in Scintilla macro support where typing Enter caused both a newline command and newline character insertion to be recorded.
  • Bug fixed in SciTE on GTK+ where focus was moving between widgets incorrectly.
  • Bug fixed with fold symbols sometimes not updating when the text changed.
  • Bugs fixed in SciTE's handling of folding commands.
  • Deprecated undo collection enumeration removed from API.

Release 1.36

  • Released on 1 March 2001.
  • Scintilla supports GTK+ on Win32.
  • Some untested work on making Scintilla and SciTE 64 bit compatible. For users on GTK+ this requires including Scintilla.h before ScintillaWidget.h.
  • HTML lexer allows folding HTML.
  • New lexer for Avenue files which are used in the ESRI ArcView GIS.
  • DOS Batch file lexer has states for '@', external commands, variables and operators.
  • C++ lexer can fold comments of /* .. */ form.
  • Better disabling of pop up menu items in Scintilla when in read-only mode.
  • Starting to move to Doxygen compatible commenting.
  • Director interface on Windows enables another application to control SciTE.
  • Opening SciTE on Windows 9x sped up greatly for some cases.
  • The command.build.directory property allows SciTE to run the build command in a different directory to the source files.
  • SciTE on Windows allows setting foreground and background colours for printed headers and footers.
  • Bug fixed in finding calltips in SciTE which led to no calltips for some identifiers.
  • Documentation added for lexers and for the extension and director interfaces.
  • SciTE menus rearranged with new View menu taking over some of the items that were under the Options menu. Clear All Bookmarks command added.
  • Clear Output command in SciTE.
  • SciTE on Windows gains an Always On Top command.
  • Bug fixed in SciTE with attempts to define properties recursively.
  • Bug fixed in SciTE properties where only one level of substitution was done.
  • Bug fixed in SciTE properties where extensions were not being matched in a case insensitive manner.
  • Bug fixed in SciTE on Windows where the Go to dialog displays the correct line number.
  • In SciTE, if fold.on.open set then switching buffers also performs fold.
  • Bug fixed in Scintilla where ensuring a line was visible in the presence of folding operated on the document line instead of the visible line.
  • SciTE command line processing modified to operate on arguments in order and in two phases. First any arguments before the first file name are processed, then the UI is opened, then the remaining arguments are processed. Actions defined for the Director interface (currently only "open") may also be used on the command line. For example, "SciTE -open:x.txt" will start SciTE and open x.txt.
  • Numbered menu items SciTE's Buffers menu and the Most Recently Used portion of the File menu go from 1..0 rather than 0..9.
  • The tab bar in SciTE for Windows has numbers. The tab.hide.one option hides the tab bar until there is more than one buffer open.

Release 1.35

  • Released on 29 January 2001.
  • Rewritten and simplified widget code for the GTK+ version to enhance solidity and make more fully compliant with platform norms. This includes more normal handling of keystrokes so they are forwarded to containers correctly.
  • User defined lists can be shown.
  • Many fixes to the Perl lexer.
  • Pascal lexer handles comments more correctly.
  • C/C++/Java/JavaScript lexer has a state for line doc comments.
  • Error output lexer understands Sun CC messages.
  • Make file lexer has variable, preprocessor, and operator states.
  • Wider area given to an italics character that is at the end of a line to prevent it being cut off.
  • Call to move the caret inside the currently visible area.
  • Paste Rectangular will space fill on the left hand side of the pasted text as needed to ensure it is kept rectangular.
  • Cut and Paste Rectangular does nothing in read-only mode.
  • Undo batching changed so that a paste followed by typing creates two undo actions..
  • A "visibility policy" setting for Scintilla determines which range of lines are displayed when a particular line is moved to. Also exposed as a property in SciTE.
  • SciTE command line allows property settings.
  • SciTE has a View Output command to hide or show the output pane.
  • SciTE's Edit menu has been split in two with searching commands moved to a new Search menu. Find Previous and Previous Bookmark are in the Search menu.
  • SciTE on Windows has options for setting print margins, headers and footers.
  • SciTE on Windows has tooltips for toolbar.
  • SciTE on GTK+ has properties for setting size of file selector.
  • Visual and audio cues in SciTE on Windows enhanced.
  • Fixed performance problem in SciTE for GTK+ by dropping the extra 3D effect on the content windows.
  • Fixed problem in SciTE where choosing a specific lexer then meant that no lexer was chosen when files opened.
  • Default selection colour changed to be visible on low colour displays.
  • Fixed problems with automatically reloading changed documents in SciTE on Windows.
  • Fixed problem with uppercase file extensions in SciTE.
  • Fixed some problems when using characters >= 128, some of which were being incorrectly treated as spaces.
  • Fixed handling multiple line tags, non-inline scripts, and XML end tags /> in HTML/XML lexer.
  • Bookmarks in SciTE no longer disappear when switching between buffers.

Release 1.34

  • Released on 28 November 2000.
  • Pascal lexer.
  • Export as PDF in SciTE.
  • Support for the OpenVMS operating system in SciTE.
  • SciTE for GTK+ can check for another instance of SciTE editing a file and switch to it rather than open a second instance on one file.
  • Fixes to quoting and here documents in the Perl lexer.
  • SciTE on Windows can give extra visual and audio cues when a warning is shown or find restarts from beginning of file.
  • Open Selected Filename command in SciTE. Also understands some warning message formats.
  • Wider area for line numbers when printing.
  • Better scrolling performance on GTK+.
  • Fixed problem where rectangles with negative coordinates were invalidated leading to trouble with platforms that use unsigned coordinates.
  • GTK+ Scintilla uses more compliant signalling code so that keyboard events should propagate to containers.
  • Bug fixed with opening full or partial paths.
  • Improved handling of paths in error messages in SciTE.
  • Better handling of F6 in SciTE.

Release 1.33

  • Released on 6 November 2000.
  • XIM support for the GTK+ version of Scintilla ensures that more non-English characters can be typed.
  • Caret may be 1, 2, or 3 pixels wide.
  • Cursor may be switched to wait image during lengthy processing.
  • Scintilla's internal focus flag is exposed for clients where focus is handled in complex ways.
  • Error status defined for Scintilla to hold indication that an operation failed and the reason for that failure. No detection yet implemented but clients may start using the interface so as to be ready for when it does.
  • Context sensitive help in SciTE.
  • CurrentWord property available in SciTE holding the value of the word the caret is within or near.
  • Apache CONF file lexer.
  • Changes to Python lexer to allow 'as' as a context sensitive keyword and the string forms starting with u, r, and ur to be recognized.
  • SCN_POSCHANGED notification now working and SCN_PAINTED notification added.
  • Word part movement commands for cursoring between the parts of reallyLongCamelIdentifiers and other_ways_of_making_words.
  • When text on only one line is selected, Shift+Tab moves to the previous tab stop.
  • Tab control available for Windows version of SciTE listing all the buffers and making it easy to switch between them.
  • SciTE can be set to automatically determine the line ending type from the contents of a file when it is opened.
  • Dialogs in GTK+ version of SciTE made more modal and have accelerator keys.
  • Find in Files command in GTK+ version of SciTE allows choice of directory.
  • On Windows, multiple files can be opened at once.
  • SciTE source broken up into more files.
  • Scintilla headers made safe for C language, not just C++.
  • New printing modes - force background to white and force default background to white.
  • Automatic unfolding not occurring when Enter pressed at end of line bug fixed.
  • Bugs fixed in line selection.
  • Bug fixed with escapes in PHP strings in the HTML lexer.
  • Bug fixed in SciTE for GTK+ opening files when given full paths.
  • Bug fixed in autocompletion where user backspaces into existing text.
  • Bugs fixed in opening files and ensuring they are saved before running. A case bug also fixed here.

Release 1.32

  • Released on 8 September 2000.
  • Fixes bugs in complete word and related code. Protection against a bug when receiving a bad argument.

Release 1.31

  • Released on 6 September 2000.
  • Scintilla is available as a COM control from the scintillactrl module in CVS.
  • Style setting to underline text. Exposed in SciTE as "underlined".
  • Style setting to make text invisible.
  • SciTE has an extensibility interface that can be used to implement features such as a scripting language or remote control. An example use of this is the extlua module available from CVS which allows SciTE to be scripted in Lua.
  • Many minor fixes to all of the lexers.
  • New lexer for diff and patch files.
  • Error message lexer understands Perl error messages.
  • C/C++/Java lexer now supports C#, specifically verbatim strings and @ quoting of identifiers that are the same as keywords. SciTE has a set of keywords for C# and a build command set up for C#.
  • Scintilla property to see whether in overtype or insert state.
  • PosChanged notification fired when caret moved.
  • Comboboxes in dialogs in SciTE on Windows can be horizontally scrolled.
  • Autocompletion and calltips can treat the document as case sensitive or case insensitive.
  • Autocompletion can be set to automatically choose the only element in a single element list.
  • Set of characters that automatically complete an autocompletion list can be set.
  • SciTE command to display calltip - useful when dropped because of editing.
  • SciTE has a Revert command to go back to the last saved version.
  • SciTE has an Export as RTF command. Save as HTML is renamed to Export as HTML and is located on the Export sub menu.
  • SciTE command "Complete Word" searches document for any words starting with characters before caret.
  • SciTE options for changing aspects of the formatting of files exported as HTML or RTF.
  • SciTE "character.set" option for choosing the character set for all fonts.
  • SciTE has a "Toggle all folds" command.
  • The makefiles have changed. The makefile_vc and makefile_bor files in scintilla/win32 and scite/win32 have been merged into scintilla/win32/scintilla.mak and scite/win32/scite.mak. DEBUG may be defined for all make files and this will turn on assertions and for some make files will choose other debugging options.
  • To make debugging easier and allow good use of BoundsChecker there is a Visual C++ project file in scite/boundscheck that builds all of Scintilla and SciTE into one executable.
  • The size of the SciTE output window can be set with the output.horizontal.size and output.vertical.size settings.
  • SciTE status bar indicator for insert or overwrite mode.
  • Performance improvements to autocompletion and calltips.
  • A caret redraw problem when undoing is fixed.
  • Crash with long lines fixed.
  • Bug fixed with merging markers when lines merged.

Release 1.30

  • Released on 26 July 2000.
  • Much better support for PHP which is now an integral part of the HTML support.
  • Start replacement of Windows-specific APIs with cross platform APIs. In 1.30, the new APIs are introduced but the old APIs are still available. For the GTK+ version, may have to include "WinDefs.h" explicitly to use the old APIs.
  • "if" and "import" statements in SciTE properties files allows modularization into language-specific properties files and choices based upon platform. This means that SciTE is delivered with 9 language-specific properties files as well as the standard SciTEGlobal.properties file.
  • Much lower resource usage on Windows 9x.
  • "/p" option in SciTE on Windows for printing a file and then exiting.
  • Options for printing with inverted brightness (when the screen is set to use a dark background) and to force black on white printing.
  • Option for printing magnified or miniaturized from screen settings.
  • In SciTE, Ctrl+F3 and Ctrl+Shift+F3 find the selection in the forwards and backwards directions respectively.
  • Auto-completion lists may be set to cancel when the cursor goes before its start position or before the start of string being completed.
  • Auto-completion lists automatically size more sensibly.
  • SCI_CLEARDOCUMENTSTYLE zeroes all style bytes, ensures all lines are shown and deletes all folding information.
  • On Windows, auto-completion lists are visually outdented rather than indented.
  • Close all command in SciTE.
  • On Windows multiple files can be dragged into SciTE.
  • When saving a file, the SciTE option save.deletes.first deletes it before doing the save. This allows saving with a different capitalization on Windows.
  • When use tabs option is off pressing the tab key inserts spaces.
  • Bug in indicators leading to extra line drawn fixed.

Release 1.28

  • Released on 27 June 2000.
  • Fixes crash in indentation guides when indent size set to 0.
  • Fixes to installation on GTK+/Linux. User properties file on GTK+ has a dot at front of name: .SciTEUser.properties. Global properties file location configurable at compile time defaulting to $prefix/share/scite. $prefix determined from Gnome if present else its /usr/local and can be overridden by installer. Gnome menu integration performed in make install if Gnome present.

Release 1.27

  • Released on 23 June 2000.
  • Indentation guides. View whitespace mode may be set to not display whitespace in indentation.
  • Set methods have corresponding gets for UndoCollection, BufferedDraw, CodePage, UsePalette, ReadOnly, CaretFore, and ModEventMask.
  • Caret is continuously on rather than blinking while typing or holding down delete or backspace. And is now always shown if non blinking when focused on GTK+.
  • Bug fixed in SciTE with file extension comparison now done in case insensitive way.
  • Bugs fixed in SciTE's file path handling on Windows.
  • Bug fixed with preprocessor '#' last visible character causing hang.

Release 1.26

  • Released on 13 June 2000.
  • Support for the Lua language in both Scintilla and SciTE.
  • Multiple buffers may be open in SciTE.
  • Each style may have a character set configured. This may determine the characters that are displayed by the style.
  • In the C++ lexer, lexing of preprocessor source may either treat it all as being in the preprocessor class or only the initial # and preprocessor command word as being in the preprocessor class.
  • Scintilla provides SCI_CREATEDOCUMENT, SCI_ADDREFDOCUMENT, and SCI_RELEASEDOCUMENT to make it easier for a container to deal with multiple documents.
  • GTK+ specific definitions in Scintilla.h were removed to ScintillaWidget.h. All GTK+ clients will need to #include "ScintillaWidget.h".
  • For GTK+, tools can be executed in the background by setting subsystem to 2.
  • Keys in the properties files are now case sensitive. This leads to a performance increase.
  • Menu to choose which lexer to use on a file.
  • Tab size dialog on Windows.
  • File dialogs enlarged on GTK+.
  • Match Brace command bound to Ctrl+E on both platforms with Ctrl+] a synonym on Windows. Ctrl+Shift+E is select to matching brace. Brace matching tries to match to either the inside or the outside, depending on whether the cursor is inside or outside the braces initially. View End of Line bound to Ctrl+Shift+O.
  • The Home key may be bound to move the caret to either the start of the line or the start of the text on the line.
  • Visual C++ project file for SciTE.
  • Bug fixed with current x location after Tab key.
  • Bug fixed with hiding fold margin by setting fold.margin.width to 0.
  • Bugs fixed with file name confusion on Windows when long and short names used, or different capitalizations, or relative paths.

Release 1.25

  • Released on 9 May 2000.
  • Some Unicode support on Windows. Treats buffer and API as UTF-8 and displays through UCS-2 of Windows.
  • Automatic indentation. Indentation size can be different to tab size.
  • Tool bar.
  • Status bar now on Windows as well as GTK+.
  • Input fields in Find and Replace dialogs now have history on both Windows and GTK+.
  • Auto completion list items may be separated by a chosen character to allow spaces in items. The selected item may be changed through the API.
  • Horizontal scrollbar can be turned off.
  • Property to remove trailing spaces when saving file.
  • On Windows, changed font size calculation to be more compatible with other applications.
  • On GTK+, SciTE's global properties files are looked for in the directory specified in the SCITE_HOME environment variable if it is set. This allows hiding in a dot directory.
  • Keyword lists in SciTE updated for JavaScript to include those destined to be used in the future. IDL includes XPIDL keywords as well as MSIDL keywords.
  • Zoom level can be set and queried through API.
  • New notification sent before insertions and deletions.
  • LaTeX lexer.
  • Fixes to folding including when deletions and additions are performed.
  • Fix for crash with very long lines.
  • Fix to affect all of rectangular selections with deletion and case changing.
  • Removed non-working messages that had been included only for Richedit compatibility.

Release 1.24

  • Released on 29 March 2000.
  • Added lexing of IDL based on C++ lexer with extra UUID lexical class.
  • Functions and associated keys for Line Delete, Line Cut, Line Transpose, Selection Lower Case and Selection Upper Case.
  • Property setting for SciTE, eol.mode, chooses initial state of line end characters.
  • Fixed bugs in undo history with small almost-contiguous changes being incorrectly coalesced.
  • Fixed bugs with incorrect expansion of ContractionState data structures causing crash.
  • Fixed bugs relating to null fonts.
  • Fixed bugs where recolourization was not done sometimes when required.
  • Fixed compilation problems with SVector.h.
  • Fixed bad setting of fold points in Python.

Release 1.23

  • Released on 21 March 2000.
  • Directory structure to separate on basis of product (Scintilla, SciTE, DMApp) and environment (Cross-platform, Win32, GTK+).
  • Download packaging to allow download of the source or platform dependent executables.
  • Source code now available from CVS at SourceForge.
  • Very simple Windows-only demonstration application DMApp is available from cvs as dmapp.
  • Lexing functionality may optionally be included in Scintilla rather than be provided by the container.
  • Set of lexers included is determined at link time by defining which of the Lex* object files are linked in.
  • On Windows, the SciLexer.DLL extends Scintilla.DLL with the standard lexers.
  • Enhanced HTML lexer styles embedded VBScript and Python. ASP segments are styled and ASP scripts in JavaScript, VBScript and Python are styled.
  • PLSQL and PHP supported.
  • Maximum number of lexical states extended to 128.
  • Lexers may store per line parse state for multiple line features such as ASP script language choice.
  • Lexing API simplified.
  • Project file for Visual C++.
  • Can now cycle through all recent files with Ctrl+Tab in SciTE.
  • Bookmarks in SciTE.
  • Drag and drop copy works when dragging to the edge of the selection.
  • Fixed bug with value sizes in properties file.
  • Fixed bug with last line in properties file not being used.
  • Bug with multiple views of one document fixed.
  • Keypad now works on GTK+.

Release 1.22

  • Released on 27 February 2000.
  • wxWindows platform defined. Implementation for wxWindows will be available separately from main Scintilla distribution.
  • Line folding in Scintilla.
  • SciTE performs syntax directed folding for C/C++/Java/JavaScript and for Python.
  • Optional macro recording support.
  • User properties file (SciTEUser.properties) allows for customization by the user that is not overwritten with each installation of SciTE.
  • Python lexer detects and highlights inconsistent indentation.
  • Margin API made more orthogonal. SCI_SETMARGINWIDTH and SCI_SETLINENUMBERWIDTH are deprecated in favour of this new API.
  • Margins may be made sensitive to forward mouse click events to container.
  • SQL lexer and styles included.
  • Perl lexer handles regular expressions better.
  • Caret policy determines how closely caret is tracked by visible area.
  • New marker shapes: arrow pointing down, plus and minus.
  • Optionally display full path in title rather than just file name.
  • Container is notified when Scintilla gains or loses focus.
  • SciTE handles focus in a more standard way and applies the main edit commands to the focused pane.
  • Container is notified when Scintilla determines that a line needs to be made visible.
  • Document watchers receive notification when document about to be deleted.
  • Document interface allows access to list of watchers.
  • Line end determined correctly for lines ending with only a '\n'.
  • Search variant that searches form current selection and sets selection.
  • SciTE understands format of diagnostic messages from WScript.
  • SciTE remembers top line of window for each file in MRU list so switching to a recent file is more likely to show the same text as when the file was previously visible.
  • Document reference count now initialized correctly.
  • Setting a null document pointer creates an empty document.
  • WM_GETTEXT can no longer overrun buffer.
  • Polygon drawing bug fixed on GTK+.
  • Java and JavaScript lexers merged into C++ lexer.
  • C++ lexer indicates unterminated strings by colouring the end of the line rather than changing the rest of the file to string style. This is less obtrusive and helps the folding.

Release 1.21

  • Released on 2 February 2000.
  • Blank margins on left and right side of text.
  • SCN_CHECKBRACE renamed SCN_UPDATEUI and made more efficient.
  • SciTE source code refactored into platform independent and platform specific classes.
  • XML and Perl subset lexers in SciTE.
  • Large improvement to lexing speed.
  • A new subsystem, 2, allows use of ShellExec on Windows.
  • Borland compatible makefile.
  • Status bar showing caret position in GTK+ version of SciTE.
  • Bug fixes to selection drawing when part of selection outside window, mouse release over scroll bars, and scroll positioning after deletion.

Release 1.2

  • Released on 21 January 2000.
  • Multiple views of one document.
  • Rectangular selection, cut, copy, paste, drag and drop.
  • Long line indication.
  • Reverse searching
  • Line end conversion.
  • Generic autocompletion and calltips in SciTE.
  • Call tip background colour can be set.
  • SCI_MARKERPREV for moving to a previous marker.
  • Caret kept more within window where possible.

Release 1.15

  • Released on 15 December 1999.
  • Brace highlighting and badlighting (for mismatched braces).
  • Visible line ends.
  • Multiple line call tips.
  • Printing now works from SciTE on Windows.
  • SciTE has a global "*" lexer style that is used as the basis for all the lexers' styles.
  • Fixes some warnings on GTK+ 1.2.6.
  • Better handling of modal dialogs on GTK+.
  • Resize handle drawn on pane splitter in SciTE on GTK+ so it looks more like a regular GTK+ *paned widget.
  • SciTE does not place window origin offscreen if no properties file found on GTK+.
  • File open filter remembered in SciTE on Windows.
  • New mechanism using style numbers 32 to 36 standardizes the setting of styles for brace highlighting, brace badlighting, line numbers, control characters and the default style.
  • Old messages SCI_SETFORE .. SCI_SETFONT have been replaced by the default style 32. The old messages are deprecated and will disappear in a future version.

Release 1.14

  • Released on 20 November 1999.
  • Fixes a scrolling bug reported on GTK+.

Release 1.13

  • Released on 18 November 1999.
  • Fixes compilation problems with the mingw32 GCC 2.95.2 on Windows.
  • Control characters are now visible.
  • Performance has improved, particularly for scrolling.
  • Windows RichEdit emulation is more accurate. This may break client code that uses these messages: EM_GETLINE, EM_GETLINECOUNT, EM_EXGETSEL, EM_EXSETSEL, EM_EXLINEFROMCHAR, EM_LINELENGTH, EM_LINEINDEX, EM_CHARFROMPOS, EM_POSFROMCHAR, and EM_GETTEXTRANGE.
  • Menus rearranged and accelerator keys set for all static items.
  • Placement of space indicators in view whitespace mode is more accurate with some fonts.

Release 1.12

  • Released on 9 November 1999.
  • Packaging error in 1.11 meant that the compilation error was not fixed in that release. Linux/GTK+ should compile with GCC 2.95 this time.

Release 1.11

  • Released on 7 November 1999.
  • Fixed a compilation bug in ScintillaGTK.cxx.
  • Added a README file to explain how to build.
  • GTK+/Linux downloads now include documentation.
  • Binary only Sc1.EXE one file download for Windows.

Release 1.1

  • Released on 6 November 1999.
  • Major restructuring for better modularity and platform independence.
  • Inter-application drag and drop.
  • Printing support in Scintilla on Windows.
  • Styles can select colouring to end of line. This can be used when a file contains more than one language to differentiate between the areas in each language. An example is the HTML + JavaScript styling in SciTE.
  • Actions can be grouped in the undo stack, so they will be undone together. This grouping is hierarchical so higher level actions such as replace all can be undone in one go. Call to discover whether there are any actions to redo.
  • The set of characters that define words can be changed.
  • Markers now have identifiers and can be found and deleted by their identifier. The empty marker type can be used to make a marker that is invisible and which is only used to trace where a particular line moves to.
  • Double click notification.
  • HTML styling in SciTE also styles embedded JavaScript.
  • Additional tool commands can be added to SciTE.
  • SciTE option to allow reloading if changed upon application activation and saving on application deactivation. Not yet working on GTK+ version.
  • Entry fields in search dialogs remember last 10 user entries. Not working in all cases in Windows version.
  • SciTE can save a styled copy of the current file in HTML format. As SciTE does not yet support printing, this can be used to print a file by then using a browser to print the HTML file.

Release 1.02

  • Released on 1 October 1999.
  • GTK+ version compiles with GCC 2.95.
  • Properly deleting objects when window destroyed under GTK+.
  • If the selection is not empty backspace deletes the selection.
  • Some X style middle mouse button handling for copying the primary selection to and from Scintilla. Does not work in all cases.
  • HTML styling in SciTE.
  • Stopped dirty flag being set in SciTE when results pane modified.

Release 1.01

  • Released on 28 September 1999.
  • Better DBCS support on Windows including IME.
  • Wheel mouse support for scrolling and zooming on Windows. Zooming with Ctrl+KeypadPlus and Ctrl+KeypadMinus.
  • Performance improvements especially on GTK+.
  • Caret blinking and settable colour on both GTK+ and Windows.
  • Drag and drop within a Scintilla window. On Windows, files can be dragged into SciTE.

Release 1.0

  • Released on 17 May 1999.
  • Changed name of "Tide" to "SciTE" to avoid clash with a TCL based IDE. "SciTE" is a SCIntilla based Text Editor and is Latin meaning something like "understanding in a neat way" and is also an Old English version of the word "shit".
  • There is a SCI_AUTOCSTOPS message for defining a string of characters that will stop autocompletion mode. Autocompletion mode is cancelled when any cursor movement occurs apart from backspace.
  • GTK+ version now splits horizontally as well as vertically and all dialogs cancel when the escape key is pressed.

Beta release 0.93

  • Released on 12 May 1999.
  • A bit more robust than 0.92 and supports SCI_MARKERNEXT message.

Beta release 0.92

  • Released on 11 May 1999.
  • GTK+ version now contains all features of Windows version with some very small differences. Executing programs works much better now.
  • New palette code to allow more colours to be displayed in 256 colour screen modes. A line number column can be displayed to the left of the selection margin.
  • The code that maps from line numbers to text positions and back has been completely rewritten to be faster, and to allow markers to move with the text.

Beta release 0.91

  • Released on 30 April 1999, containing fixes to text measuring to make Scintilla work better with bitmap fonts. Also some small fixes to make compiling work with Visual C++.

Beta release 0.90

  • Released on 29 April 1999, containing working GTK+/Linux version.
  • The Java, C++ and Python lexers recognize operators as distinct from default allowing them to be highlighted.

Beta release 0.82

  • Released on 1 April 1999, to fix a problem with handling the Enter key in PythonWin. Also fixes some problems with cmd key mapping.

Beta release 0.81

  • Released on 30th March 1999, containing bug fixes and a few more features.
  • Static linking supported and Tidy.EXE, a statically linked version of Tide.EXE. Changes to compiler flags in the makefiles to optimize for size.
  • Scintilla supports a 'savepoint' in the undo stack which can be set by the container when the document is saved. Notifications are sent to the container when the savepoint is entered or left, allowing the container to display a dirty indicator and change its menus.
  • When Scintilla is set to read-only mode, a notification is sent to the container should the user try to edit the document. This can be used to check the document out of a version control system.
  • There is an API for setting the appearance of indicators.
  • The keyboard mapping can be redefined or removed so it can be implemented completely by the container. All of the keyboard commands are now commands which can be sent by the container.
  • A home command like Visual C++ with one hit going to the start of the text on the line and the next going to the left margin is available. I do not personally like this but my fingers have become trained to it by much repetition.
  • SCI_MARKERDELETEALL has an argument in wParam which is the number of the type marker to delete with -1 performing the old action of removing all marker types.
  • Tide now understands both the file name and line numbers in error messages in most cases.
  • Tide remembers the current lines of files in the recently used list.
  • Tide has a Find in Files command.

Beta release 0.80

  • This was the first public release on 14th March 1999, containing a mostly working Win32 Scintilla DLL and Tide EXE.

Beta releases of SciTE were called Tide

================================================ FILE: lexilla/examples/CheckLexilla/CheckLexilla.c ================================================ // Lexilla lexer library use example /** @file CheckLexilla.c ** Check that Lexilla.h works. **/ // Copyright 2021 by Neil Hodgson // This file is in the public domain. // If the public domain is not possible in your location then it can also be used under the same // license as Scintilla. https://www.scintilla.org/License.txt /* Build and run Win32 gcc CheckLexilla.c -I ../../include -o CheckLexilla CheckLexilla CheckLexilla ../SimpleLexer/SimpleLexer.dll Win32 Visual C++ cl CheckLexilla.c -I ../../include -Fe: CheckLexilla CheckLexilla CheckLexilla ../SimpleLexer/SimpleLexer.dll macOS clang CheckLexilla.c -I ../../include -o CheckLexilla ./CheckLexilla ./CheckLexilla ../SimpleLexer/SimpleLexer.dylib Linux gcc CheckLexilla.c -I ../../include -ldl -o CheckLexilla ./CheckLexilla ./CheckLexilla ../SimpleLexer/SimpleLexer.so While principally meant for compilation as C to act as an example of using Lexilla from C it can also be built as C++. Warnings are intentionally shown for the deprecated typedef LexerNameFromIDFn when compiled with GCC or Clang or as C++. */ #include #if defined(_WIN32) #include #else #include #endif #if defined(__cplusplus) #include "ILexer.h" #endif #include "Lexilla.h" #if defined(__cplusplus) using namespace Lexilla; #endif #if defined(_WIN32) typedef FARPROC Function; typedef HMODULE Module; #else typedef void *Function; typedef void *Module; #endif static Function FindSymbol(Module m, const char *symbol) { #if defined(_WIN32) return GetProcAddress(m, symbol); #else return dlsym(m, symbol); #endif } int main(int argc, char *argv[]) { char szLexillaPath[] = "../../bin/" LEXILLA_LIB LEXILLA_EXTENSION; const char *libPath = szLexillaPath; if (argc > 1) { libPath = argv[1]; } #if defined(_WIN32) Module lexillaLibrary = LoadLibraryA(libPath); #else Module lexillaLibrary = dlopen(libPath, RTLD_LAZY); #endif printf("Opened %s -> %p.\n", libPath, lexillaLibrary); if (lexillaLibrary) { GetLexerCountFn lexerCount = (GetLexerCountFn)FindSymbol(lexillaLibrary, LEXILLA_GETLEXERCOUNT); if (lexerCount) { int nLexers = lexerCount(); printf("There are %d lexers.\n", nLexers); GetLexerNameFn lexerName = (GetLexerNameFn)FindSymbol(lexillaLibrary, LEXILLA_GETLEXERNAME); for (int i = 0; i < nLexers; i++) { char name[100] = ""; lexerName(i, name, sizeof(name)); printf("%s ", name); } printf("\n"); GetLexerFactoryFn lexerFactory = (GetLexerFactoryFn)FindSymbol(lexillaLibrary, LEXILLA_GETLEXERFACTORY); LexerFactoryFunction lexerFactory4 = lexerFactory(4); // 4th entry is "as" which is an object lexer so works printf("Lexer factory 4 -> %p.\n", lexerFactory4); CreateLexerFn lexerCreate = (CreateLexerFn)FindSymbol(lexillaLibrary, LEXILLA_CREATELEXER); ILexer5 *lexerCpp = lexerCreate("cpp"); printf("Created cpp lexer -> %p.\n", lexerCpp); LexerNameFromIDFn lexerNameFromID = (LexerNameFromIDFn)FindSymbol(lexillaLibrary, LEXILLA_LEXERNAMEFROMID); if (lexerNameFromID) { const char *lexerNameCpp = lexerNameFromID(3); // SCLEX_CPP=3 if (lexerNameCpp) { printf("Lexer name 3 -> %s.\n", lexerNameCpp); } else { printf("Lexer name 3 not available.\n"); } } else { printf("Lexer name from ID not supported.\n"); } GetLibraryPropertyNamesFn libraryProperties = (GetLibraryPropertyNamesFn)FindSymbol(lexillaLibrary, LEXILLA_GETLIBRARYPROPERTYNAMES); if (libraryProperties) { const char *names = libraryProperties(); printf("Property names '%s'.\n", names); } else { printf("Property names not supported.\n"); } SetLibraryPropertyFn librarySetProperty = (SetLibraryPropertyFn)FindSymbol(lexillaLibrary, LEXILLA_SETLIBRARYPROPERTY); if (librarySetProperty) { librarySetProperty("key", "value"); } else { printf("Set property not supported.\n"); } GetNameSpaceFn libraryNameSpace = (GetLibraryPropertyNamesFn)FindSymbol(lexillaLibrary, LEXILLA_GETNAMESPACE); if (libraryNameSpace) { const char *nameSpace = libraryNameSpace(); printf("Name space '%s'.\n", nameSpace); } else { printf("Name space not supported.\n"); } } } } ================================================ FILE: lexilla/examples/CheckLexilla/makefile ================================================ .PHONY: all check clean INCLUDES = -I ../../include EXE = $(if $(windir),CheckLexilla.exe,CheckLexilla) ifdef windir RM = $(if $(wildcard $(dir $(SHELL))rm.exe), $(dir $(SHELL))rm.exe -f, del /q) CC = gcc else LIBS += -ldl endif all: $(EXE) check: $(EXE) ./$(EXE) clean: $(RM) $(EXE) $(EXE): *.c $(CC) $(INCLUDES) $(CPPFLAGS) $(CFLAGS) $^ $(LIBS) $(LDLIBS) -o $@ ================================================ FILE: lexilla/examples/SimpleLexer/SimpleLexer.cxx ================================================ // A simple lexer /** @file SimpleLexer.cxx ** A lexer that follows the Lexilla protocol to allow it to be used from Lexilla clients like SciTE. ** The lexer applies alternating styles (0,1) to bytes of the text. **/ // Copyright 2021 by Neil Hodgson // This file is in the public domain. // If the public domain is not possible in your location then it can also be used under the same // license as Scintilla. https://www.scintilla.org/License.txt // Windows/MSVC // cl -std:c++17 -EHsc -LD -I ../../../scintilla/include -I ../../include -I ../../lexlib SimpleLexer.cxx ../../lexlib/*.cxx // macOS/clang // clang++ -dynamiclib --std=c++17 -I ../../../scintilla/include -I ../../include -I ../../lexlib SimpleLexer.cxx ../../lexlib/*.cxx -o SimpleLexer.dylib // Linux/g++ // g++ -fPIC -shared --std=c++17 -I ../../../scintilla/include -I ../../include -I ../../lexlib SimpleLexer.cxx ../../lexlib/*.cxx -o SimpleLexer.so /* It can be demonstrated in SciTE like this, substituting the actual shared library location as lexilla.path: lexilla.path=.;C:\u\hg\lexilla\examples\SimpleLexer\SimpleLexer.dll lexer.*.xx=simple style.simple.1=fore:#FF0000 */ #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" // Lexilla.h should not be included here as it declares statically linked functions without the __declspec( dllexport ) #include "WordList.h" #include "PropSetSimple.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "LexerBase.h" using namespace Scintilla; using namespace Lexilla; class LexerSimple : public LexerBase { public: LexerSimple() { } void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override { try { Accessor astyler(pAccess, &props); if (length > 0) { astyler.StartAt(startPos); astyler.StartSegment(startPos); for (unsigned int k=0; kSetErrorStatus(SC_STATUS_FAILURE); } } void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override { } static ILexer5 *LexerFactorySimple() { try { return new LexerSimple(); } catch (...) { // Should not throw into caller as may be compiled with different compiler or options return nullptr; } } }; #if defined(_WIN32) #define EXPORT_FUNCTION __declspec(dllexport) #define CALLING_CONVENTION __stdcall #else #define EXPORT_FUNCTION __attribute__((visibility("default"))) #define CALLING_CONVENTION #endif static const char *lexerName = "simple"; extern "C" { EXPORT_FUNCTION int CALLING_CONVENTION GetLexerCount() { return 1; } EXPORT_FUNCTION void CALLING_CONVENTION GetLexerName(unsigned int index, char *name, int buflength) { *name = 0; if ((index == 0) && (buflength > static_cast(strlen(lexerName)))) { strcpy(name, lexerName); } } EXPORT_FUNCTION LexerFactoryFunction CALLING_CONVENTION GetLexerFactory(unsigned int index) { if (index == 0) return LexerSimple::LexerFactorySimple; else return 0; } EXPORT_FUNCTION Scintilla::ILexer5* CALLING_CONVENTION CreateLexer(const char *name) { if (0 == strcmp(name, lexerName)) { return LexerSimple::LexerFactorySimple(); } return nullptr; } EXPORT_FUNCTION const char * CALLING_CONVENTION GetNameSpace() { return "example"; } } ================================================ FILE: lexilla/examples/SimpleLexer/makefile ================================================ .PHONY: all check clean INCLUDES = -I ../../../scintilla/include -I ../../include -I ../../lexlib BASE_FLAGS += --std=c++17 -shared ifdef windir SHAREDEXTENSION = dll else ifeq ($(shell uname),Darwin) SHAREDEXTENSION = dylib BASE_FLAGS += -dynamiclib -arch arm64 -arch x86_64 else BASE_FLAGS += -fPIC SHAREDEXTENSION = so endif BASE_FLAGS += -fvisibility=hidden endif ifdef windir RM = $(if $(wildcard $(dir $(SHELL))rm.exe), $(dir $(SHELL))rm.exe -f, del /q) CXX = g++ endif LIBRARY = SimpleLexer.$(SHAREDEXTENSION) LEXLIB = ../../lexlib/*.cxx all: $(LIBRARY) # make check requires CheckLexilla to have already been built check: $(LIBRARY) ../CheckLexilla/CheckLexilla ./$(LIBRARY) clean: $(RM) *.o *obj *.lib *.exp $(LIBRARY) $(LIBRARY): *.cxx $(CXX) $(INCLUDES) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) $^ $(LEXLIB) $(LIBS) $(LDLIBS) -o $@ ================================================ FILE: lexilla/include/LexicalStyles.iface ================================================ ## This file defines the interface to Lexilla ## Copyright 2000-2020 by Neil Hodgson ## The License.txt file describes the conditions under which this software may be distributed. ## Similar file structure as Scintilla.iface but only contains constants. cat Default ################################################ # For SciLexer.h enu Lexer=SCLEX_ val SCLEX_CONTAINER=0 val SCLEX_NULL=1 val SCLEX_PYTHON=2 val SCLEX_CPP=3 val SCLEX_HTML=4 val SCLEX_XML=5 val SCLEX_PERL=6 val SCLEX_SQL=7 val SCLEX_VB=8 val SCLEX_PROPERTIES=9 val SCLEX_ERRORLIST=10 val SCLEX_MAKEFILE=11 val SCLEX_BATCH=12 val SCLEX_XCODE=13 val SCLEX_LATEX=14 val SCLEX_LUA=15 val SCLEX_DIFF=16 val SCLEX_CONF=17 val SCLEX_PASCAL=18 val SCLEX_AVE=19 val SCLEX_ADA=20 val SCLEX_LISP=21 val SCLEX_RUBY=22 val SCLEX_EIFFEL=23 val SCLEX_EIFFELKW=24 val SCLEX_TCL=25 val SCLEX_NNCRONTAB=26 val SCLEX_BULLANT=27 val SCLEX_VBSCRIPT=28 val SCLEX_BAAN=31 val SCLEX_MATLAB=32 val SCLEX_SCRIPTOL=33 val SCLEX_ASM=34 val SCLEX_CPPNOCASE=35 val SCLEX_FORTRAN=36 val SCLEX_F77=37 val SCLEX_CSS=38 val SCLEX_POV=39 val SCLEX_LOUT=40 val SCLEX_ESCRIPT=41 val SCLEX_PS=42 val SCLEX_NSIS=43 val SCLEX_MMIXAL=44 val SCLEX_CLW=45 val SCLEX_CLWNOCASE=46 val SCLEX_LOT=47 val SCLEX_YAML=48 val SCLEX_TEX=49 val SCLEX_METAPOST=50 val SCLEX_POWERBASIC=51 val SCLEX_FORTH=52 val SCLEX_ERLANG=53 val SCLEX_OCTAVE=54 val SCLEX_MSSQL=55 val SCLEX_VERILOG=56 val SCLEX_KIX=57 val SCLEX_GUI4CLI=58 val SCLEX_SPECMAN=59 val SCLEX_AU3=60 val SCLEX_APDL=61 val SCLEX_BASH=62 val SCLEX_ASN1=63 val SCLEX_VHDL=64 val SCLEX_CAML=65 val SCLEX_BLITZBASIC=66 val SCLEX_PUREBASIC=67 val SCLEX_HASKELL=68 val SCLEX_PHPSCRIPT=69 val SCLEX_TADS3=70 val SCLEX_REBOL=71 val SCLEX_SMALLTALK=72 val SCLEX_FLAGSHIP=73 val SCLEX_CSOUND=74 val SCLEX_FREEBASIC=75 val SCLEX_INNOSETUP=76 val SCLEX_OPAL=77 val SCLEX_SPICE=78 val SCLEX_D=79 val SCLEX_CMAKE=80 val SCLEX_GAP=81 val SCLEX_PLM=82 val SCLEX_PROGRESS=83 val SCLEX_ABAQUS=84 val SCLEX_ASYMPTOTE=85 val SCLEX_R=86 val SCLEX_MAGIK=87 val SCLEX_POWERSHELL=88 val SCLEX_MYSQL=89 val SCLEX_PO=90 val SCLEX_TAL=91 val SCLEX_COBOL=92 val SCLEX_TACL=93 val SCLEX_SORCUS=94 val SCLEX_POWERPRO=95 val SCLEX_NIMROD=96 val SCLEX_SML=97 val SCLEX_MARKDOWN=98 val SCLEX_TXT2TAGS=99 val SCLEX_A68K=100 val SCLEX_MODULA=101 val SCLEX_COFFEESCRIPT=102 val SCLEX_TCMD=103 val SCLEX_AVS=104 val SCLEX_ECL=105 val SCLEX_OSCRIPT=106 val SCLEX_VISUALPROLOG=107 val SCLEX_LITERATEHASKELL=108 val SCLEX_STTXT=109 val SCLEX_KVIRC=110 val SCLEX_RUST=111 val SCLEX_DMAP=112 val SCLEX_AS=113 val SCLEX_DMIS=114 val SCLEX_REGISTRY=115 val SCLEX_BIBTEX=116 val SCLEX_SREC=117 val SCLEX_IHEX=118 val SCLEX_TEHEX=119 val SCLEX_JSON=120 val SCLEX_EDIFACT=121 val SCLEX_INDENT=122 val SCLEX_MAXIMA=123 val SCLEX_STATA=124 val SCLEX_SAS=125 val SCLEX_NIM=126 val SCLEX_CIL=127 val SCLEX_X12=128 val SCLEX_DATAFLEX=129 val SCLEX_HOLLYWOOD=130 val SCLEX_RAKU=131 val SCLEX_FSHARP=132 val SCLEX_JULIA=133 val SCLEX_ASCIIDOC=134 val SCLEX_GDSCRIPT=135 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. val SCLEX_AUTOMATIC=1000 # Lexical states for SCLEX_PYTHON lex Python=SCLEX_PYTHON SCE_P_ lex Nimrod=SCLEX_NIMROD SCE_P_ val SCE_P_DEFAULT=0 val SCE_P_COMMENTLINE=1 val SCE_P_NUMBER=2 val SCE_P_STRING=3 val SCE_P_CHARACTER=4 val SCE_P_WORD=5 val SCE_P_TRIPLE=6 val SCE_P_TRIPLEDOUBLE=7 val SCE_P_CLASSNAME=8 val SCE_P_DEFNAME=9 val SCE_P_OPERATOR=10 val SCE_P_IDENTIFIER=11 val SCE_P_COMMENTBLOCK=12 val SCE_P_STRINGEOL=13 val SCE_P_WORD2=14 val SCE_P_DECORATOR=15 val SCE_P_FSTRING=16 val SCE_P_FCHARACTER=17 val SCE_P_FTRIPLE=18 val SCE_P_FTRIPLEDOUBLE=19 val SCE_P_ATTRIBUTE=20 # Lexical states for SCLEX_CPP # Lexical states for SCLEX_BULLANT # Lexical states for SCLEX_COBOL # Lexical states for SCLEX_TACL # Lexical states for SCLEX_TAL lex Cpp=SCLEX_CPP SCE_C_ lex BullAnt=SCLEX_BULLANT SCE_C_ lex COBOL=SCLEX_COBOL SCE_C_ lex TACL=SCLEX_TACL SCE_C_ lex TAL=SCLEX_TAL SCE_C_ val SCE_C_DEFAULT=0 val SCE_C_COMMENT=1 val SCE_C_COMMENTLINE=2 val SCE_C_COMMENTDOC=3 val SCE_C_NUMBER=4 val SCE_C_WORD=5 val SCE_C_STRING=6 val SCE_C_CHARACTER=7 val SCE_C_UUID=8 val SCE_C_PREPROCESSOR=9 val SCE_C_OPERATOR=10 val SCE_C_IDENTIFIER=11 val SCE_C_STRINGEOL=12 val SCE_C_VERBATIM=13 val SCE_C_REGEX=14 val SCE_C_COMMENTLINEDOC=15 val SCE_C_WORD2=16 val SCE_C_COMMENTDOCKEYWORD=17 val SCE_C_COMMENTDOCKEYWORDERROR=18 val SCE_C_GLOBALCLASS=19 val SCE_C_STRINGRAW=20 val SCE_C_TRIPLEVERBATIM=21 val SCE_C_HASHQUOTEDSTRING=22 val SCE_C_PREPROCESSORCOMMENT=23 val SCE_C_PREPROCESSORCOMMENTDOC=24 val SCE_C_USERLITERAL=25 val SCE_C_TASKMARKER=26 val SCE_C_ESCAPESEQUENCE=27 # Lexical states for SCLEX_D lex D=SCLEX_D SCE_D_ val SCE_D_DEFAULT=0 val SCE_D_COMMENT=1 val SCE_D_COMMENTLINE=2 val SCE_D_COMMENTDOC=3 val SCE_D_COMMENTNESTED=4 val SCE_D_NUMBER=5 val SCE_D_WORD=6 val SCE_D_WORD2=7 val SCE_D_WORD3=8 val SCE_D_TYPEDEF=9 val SCE_D_STRING=10 val SCE_D_STRINGEOL=11 val SCE_D_CHARACTER=12 val SCE_D_OPERATOR=13 val SCE_D_IDENTIFIER=14 val SCE_D_COMMENTLINEDOC=15 val SCE_D_COMMENTDOCKEYWORD=16 val SCE_D_COMMENTDOCKEYWORDERROR=17 val SCE_D_STRINGB=18 val SCE_D_STRINGR=19 val SCE_D_WORD5=20 val SCE_D_WORD6=21 val SCE_D_WORD7=22 # Lexical states for SCLEX_TCL lex TCL=SCLEX_TCL SCE_TCL_ val SCE_TCL_DEFAULT=0 val SCE_TCL_COMMENT=1 val SCE_TCL_COMMENTLINE=2 val SCE_TCL_NUMBER=3 val SCE_TCL_WORD_IN_QUOTE=4 val SCE_TCL_IN_QUOTE=5 val SCE_TCL_OPERATOR=6 val SCE_TCL_IDENTIFIER=7 val SCE_TCL_SUBSTITUTION=8 val SCE_TCL_SUB_BRACE=9 val SCE_TCL_MODIFIER=10 val SCE_TCL_EXPAND=11 val SCE_TCL_WORD=12 val SCE_TCL_WORD2=13 val SCE_TCL_WORD3=14 val SCE_TCL_WORD4=15 val SCE_TCL_WORD5=16 val SCE_TCL_WORD6=17 val SCE_TCL_WORD7=18 val SCE_TCL_WORD8=19 val SCE_TCL_COMMENT_BOX=20 val SCE_TCL_BLOCK_COMMENT=21 # Lexical states for SCLEX_HTML, SCLEX_XML lex HTML=SCLEX_HTML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_ lex XML=SCLEX_XML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_ val SCE_H_DEFAULT=0 val SCE_H_TAG=1 val SCE_H_TAGUNKNOWN=2 val SCE_H_ATTRIBUTE=3 val SCE_H_ATTRIBUTEUNKNOWN=4 val SCE_H_NUMBER=5 val SCE_H_DOUBLESTRING=6 val SCE_H_SINGLESTRING=7 val SCE_H_OTHER=8 val SCE_H_COMMENT=9 val SCE_H_ENTITY=10 # XML and ASP val SCE_H_TAGEND=11 val SCE_H_XMLSTART=12 val SCE_H_XMLEND=13 val SCE_H_SCRIPT=14 val SCE_H_ASP=15 val SCE_H_ASPAT=16 val SCE_H_CDATA=17 val SCE_H_QUESTION=18 # More HTML val SCE_H_VALUE=19 # X-Code, ASP.NET, JSP val SCE_H_XCCOMMENT=20 # SGML val SCE_H_SGML_DEFAULT=21 val SCE_H_SGML_COMMAND=22 val SCE_H_SGML_1ST_PARAM=23 val SCE_H_SGML_DOUBLESTRING=24 val SCE_H_SGML_SIMPLESTRING=25 val SCE_H_SGML_ERROR=26 val SCE_H_SGML_SPECIAL=27 val SCE_H_SGML_ENTITY=28 val SCE_H_SGML_COMMENT=29 val SCE_H_SGML_1ST_PARAM_COMMENT=30 val SCE_H_SGML_BLOCK_DEFAULT=31 # Embedded Javascript val SCE_HJ_START=40 val SCE_HJ_DEFAULT=41 val SCE_HJ_COMMENT=42 val SCE_HJ_COMMENTLINE=43 val SCE_HJ_COMMENTDOC=44 val SCE_HJ_NUMBER=45 val SCE_HJ_WORD=46 val SCE_HJ_KEYWORD=47 val SCE_HJ_DOUBLESTRING=48 val SCE_HJ_SINGLESTRING=49 val SCE_HJ_SYMBOLS=50 val SCE_HJ_STRINGEOL=51 val SCE_HJ_REGEX=52 # ASP Javascript val SCE_HJA_START=55 val SCE_HJA_DEFAULT=56 val SCE_HJA_COMMENT=57 val SCE_HJA_COMMENTLINE=58 val SCE_HJA_COMMENTDOC=59 val SCE_HJA_NUMBER=60 val SCE_HJA_WORD=61 val SCE_HJA_KEYWORD=62 val SCE_HJA_DOUBLESTRING=63 val SCE_HJA_SINGLESTRING=64 val SCE_HJA_SYMBOLS=65 val SCE_HJA_STRINGEOL=66 val SCE_HJA_REGEX=67 # Embedded VBScript val SCE_HB_START=70 val SCE_HB_DEFAULT=71 val SCE_HB_COMMENTLINE=72 val SCE_HB_NUMBER=73 val SCE_HB_WORD=74 val SCE_HB_STRING=75 val SCE_HB_IDENTIFIER=76 val SCE_HB_STRINGEOL=77 # ASP VBScript val SCE_HBA_START=80 val SCE_HBA_DEFAULT=81 val SCE_HBA_COMMENTLINE=82 val SCE_HBA_NUMBER=83 val SCE_HBA_WORD=84 val SCE_HBA_STRING=85 val SCE_HBA_IDENTIFIER=86 val SCE_HBA_STRINGEOL=87 # Embedded Python val SCE_HP_START=90 val SCE_HP_DEFAULT=91 val SCE_HP_COMMENTLINE=92 val SCE_HP_NUMBER=93 val SCE_HP_STRING=94 val SCE_HP_CHARACTER=95 val SCE_HP_WORD=96 val SCE_HP_TRIPLE=97 val SCE_HP_TRIPLEDOUBLE=98 val SCE_HP_CLASSNAME=99 val SCE_HP_DEFNAME=100 val SCE_HP_OPERATOR=101 val SCE_HP_IDENTIFIER=102 # PHP val SCE_HPHP_COMPLEX_VARIABLE=104 # ASP Python val SCE_HPA_START=105 val SCE_HPA_DEFAULT=106 val SCE_HPA_COMMENTLINE=107 val SCE_HPA_NUMBER=108 val SCE_HPA_STRING=109 val SCE_HPA_CHARACTER=110 val SCE_HPA_WORD=111 val SCE_HPA_TRIPLE=112 val SCE_HPA_TRIPLEDOUBLE=113 val SCE_HPA_CLASSNAME=114 val SCE_HPA_DEFNAME=115 val SCE_HPA_OPERATOR=116 val SCE_HPA_IDENTIFIER=117 # PHP val SCE_HPHP_DEFAULT=118 val SCE_HPHP_HSTRING=119 val SCE_HPHP_SIMPLESTRING=120 val SCE_HPHP_WORD=121 val SCE_HPHP_NUMBER=122 val SCE_HPHP_VARIABLE=123 val SCE_HPHP_COMMENT=124 val SCE_HPHP_COMMENTLINE=125 val SCE_HPHP_HSTRING_VARIABLE=126 val SCE_HPHP_OPERATOR=127 # Lexical states for SCLEX_PERL lex Perl=SCLEX_PERL SCE_PL_ val SCE_PL_DEFAULT=0 val SCE_PL_ERROR=1 val SCE_PL_COMMENTLINE=2 val SCE_PL_POD=3 val SCE_PL_NUMBER=4 val SCE_PL_WORD=5 val SCE_PL_STRING=6 val SCE_PL_CHARACTER=7 val SCE_PL_PUNCTUATION=8 val SCE_PL_PREPROCESSOR=9 val SCE_PL_OPERATOR=10 val SCE_PL_IDENTIFIER=11 val SCE_PL_SCALAR=12 val SCE_PL_ARRAY=13 val SCE_PL_HASH=14 val SCE_PL_SYMBOLTABLE=15 val SCE_PL_VARIABLE_INDEXER=16 val SCE_PL_REGEX=17 val SCE_PL_REGSUBST=18 val SCE_PL_LONGQUOTE=19 val SCE_PL_BACKTICKS=20 val SCE_PL_DATASECTION=21 val SCE_PL_HERE_DELIM=22 val SCE_PL_HERE_Q=23 val SCE_PL_HERE_QQ=24 val SCE_PL_HERE_QX=25 val SCE_PL_STRING_Q=26 val SCE_PL_STRING_QQ=27 val SCE_PL_STRING_QX=28 val SCE_PL_STRING_QR=29 val SCE_PL_STRING_QW=30 val SCE_PL_POD_VERB=31 val SCE_PL_SUB_PROTOTYPE=40 val SCE_PL_FORMAT_IDENT=41 val SCE_PL_FORMAT=42 val SCE_PL_STRING_VAR=43 val SCE_PL_XLAT=44 val SCE_PL_REGEX_VAR=54 val SCE_PL_REGSUBST_VAR=55 val SCE_PL_BACKTICKS_VAR=57 val SCE_PL_HERE_QQ_VAR=61 val SCE_PL_HERE_QX_VAR=62 val SCE_PL_STRING_QQ_VAR=64 val SCE_PL_STRING_QX_VAR=65 val SCE_PL_STRING_QR_VAR=66 # Lexical states for SCLEX_RUBY lex Ruby=SCLEX_RUBY SCE_RB_ val SCE_RB_DEFAULT=0 val SCE_RB_ERROR=1 val SCE_RB_COMMENTLINE=2 val SCE_RB_POD=3 val SCE_RB_NUMBER=4 val SCE_RB_WORD=5 val SCE_RB_STRING=6 val SCE_RB_CHARACTER=7 val SCE_RB_CLASSNAME=8 val SCE_RB_DEFNAME=9 val SCE_RB_OPERATOR=10 val SCE_RB_IDENTIFIER=11 val SCE_RB_REGEX=12 val SCE_RB_GLOBAL=13 val SCE_RB_SYMBOL=14 val SCE_RB_MODULE_NAME=15 val SCE_RB_INSTANCE_VAR=16 val SCE_RB_CLASS_VAR=17 val SCE_RB_BACKTICKS=18 val SCE_RB_DATASECTION=19 val SCE_RB_HERE_DELIM=20 val SCE_RB_HERE_Q=21 val SCE_RB_HERE_QQ=22 val SCE_RB_HERE_QX=23 val SCE_RB_STRING_Q=24 val SCE_RB_STRING_QQ=25 val SCE_RB_STRING_QX=26 val SCE_RB_STRING_QR=27 val SCE_RB_STRING_QW=28 val SCE_RB_WORD_DEMOTED=29 val SCE_RB_STDIN=30 val SCE_RB_STDOUT=31 val SCE_RB_STDERR=40 val SCE_RB_STRING_W=41 val SCE_RB_STRING_I=42 val SCE_RB_STRING_QI=43 val SCE_RB_STRING_QS=44 val SCE_RB_UPPER_BOUND=45 # Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC, SCLEX_BLITZBASIC, SCLEX_PUREBASIC, SCLEX_FREEBASIC lex VB=SCLEX_VB SCE_B_ lex VBScript=SCLEX_VBSCRIPT SCE_B_ lex PowerBasic=SCLEX_POWERBASIC SCE_B_ lex BlitzBasic=SCLEX_BLITZBASIC SCE_B_ lex PureBasic=SCLEX_PUREBASIC SCE_B_ lex FreeBasic=SCLEX_FREEBASIC SCE_B_ val SCE_B_DEFAULT=0 val SCE_B_COMMENT=1 val SCE_B_NUMBER=2 val SCE_B_KEYWORD=3 val SCE_B_STRING=4 val SCE_B_PREPROCESSOR=5 val SCE_B_OPERATOR=6 val SCE_B_IDENTIFIER=7 val SCE_B_DATE=8 val SCE_B_STRINGEOL=9 val SCE_B_KEYWORD2=10 val SCE_B_KEYWORD3=11 val SCE_B_KEYWORD4=12 val SCE_B_CONSTANT=13 val SCE_B_ASM=14 val SCE_B_LABEL=15 val SCE_B_ERROR=16 val SCE_B_HEXNUMBER=17 val SCE_B_BINNUMBER=18 val SCE_B_COMMENTBLOCK=19 val SCE_B_DOCLINE=20 val SCE_B_DOCBLOCK=21 val SCE_B_DOCKEYWORD=22 # Lexical states for SCLEX_PROPERTIES lex Properties=SCLEX_PROPERTIES SCE_PROPS_ val SCE_PROPS_DEFAULT=0 val SCE_PROPS_COMMENT=1 val SCE_PROPS_SECTION=2 val SCE_PROPS_ASSIGNMENT=3 val SCE_PROPS_DEFVAL=4 val SCE_PROPS_KEY=5 # Lexical states for SCLEX_LATEX lex LaTeX=SCLEX_LATEX SCE_L_ val SCE_L_DEFAULT=0 val SCE_L_COMMAND=1 val SCE_L_TAG=2 val SCE_L_MATH=3 val SCE_L_COMMENT=4 val SCE_L_TAG2=5 val SCE_L_MATH2=6 val SCE_L_COMMENT2=7 val SCE_L_VERBATIM=8 val SCE_L_SHORTCMD=9 val SCE_L_SPECIAL=10 val SCE_L_CMDOPT=11 val SCE_L_ERROR=12 # Lexical states for SCLEX_LUA lex Lua=SCLEX_LUA SCE_LUA_ val SCE_LUA_DEFAULT=0 val SCE_LUA_COMMENT=1 val SCE_LUA_COMMENTLINE=2 val SCE_LUA_COMMENTDOC=3 val SCE_LUA_NUMBER=4 val SCE_LUA_WORD=5 val SCE_LUA_STRING=6 val SCE_LUA_CHARACTER=7 val SCE_LUA_LITERALSTRING=8 val SCE_LUA_PREPROCESSOR=9 val SCE_LUA_OPERATOR=10 val SCE_LUA_IDENTIFIER=11 val SCE_LUA_STRINGEOL=12 val SCE_LUA_WORD2=13 val SCE_LUA_WORD3=14 val SCE_LUA_WORD4=15 val SCE_LUA_WORD5=16 val SCE_LUA_WORD6=17 val SCE_LUA_WORD7=18 val SCE_LUA_WORD8=19 val SCE_LUA_LABEL=20 # Lexical states for SCLEX_ERRORLIST lex ErrorList=SCLEX_ERRORLIST SCE_ERR_ val SCE_ERR_DEFAULT=0 val SCE_ERR_PYTHON=1 val SCE_ERR_GCC=2 val SCE_ERR_MS=3 val SCE_ERR_CMD=4 val SCE_ERR_BORLAND=5 val SCE_ERR_PERL=6 val SCE_ERR_NET=7 val SCE_ERR_LUA=8 val SCE_ERR_CTAG=9 val SCE_ERR_DIFF_CHANGED=10 val SCE_ERR_DIFF_ADDITION=11 val SCE_ERR_DIFF_DELETION=12 val SCE_ERR_DIFF_MESSAGE=13 val SCE_ERR_PHP=14 val SCE_ERR_ELF=15 val SCE_ERR_IFC=16 val SCE_ERR_IFORT=17 val SCE_ERR_ABSF=18 val SCE_ERR_TIDY=19 val SCE_ERR_JAVA_STACK=20 val SCE_ERR_VALUE=21 val SCE_ERR_GCC_INCLUDED_FROM=22 val SCE_ERR_ESCSEQ=23 val SCE_ERR_ESCSEQ_UNKNOWN=24 val SCE_ERR_GCC_EXCERPT=25 val SCE_ERR_BASH=26 val SCE_ERR_ES_BLACK=40 val SCE_ERR_ES_RED=41 val SCE_ERR_ES_GREEN=42 val SCE_ERR_ES_BROWN=43 val SCE_ERR_ES_BLUE=44 val SCE_ERR_ES_MAGENTA=45 val SCE_ERR_ES_CYAN=46 val SCE_ERR_ES_GRAY=47 val SCE_ERR_ES_DARK_GRAY=48 val SCE_ERR_ES_BRIGHT_RED=49 val SCE_ERR_ES_BRIGHT_GREEN=50 val SCE_ERR_ES_YELLOW=51 val SCE_ERR_ES_BRIGHT_BLUE=52 val SCE_ERR_ES_BRIGHT_MAGENTA=53 val SCE_ERR_ES_BRIGHT_CYAN=54 val SCE_ERR_ES_WHITE=55 # Lexical states for SCLEX_BATCH lex Batch=SCLEX_BATCH SCE_BAT_ val SCE_BAT_DEFAULT=0 val SCE_BAT_COMMENT=1 val SCE_BAT_WORD=2 val SCE_BAT_LABEL=3 val SCE_BAT_HIDE=4 val SCE_BAT_COMMAND=5 val SCE_BAT_IDENTIFIER=6 val SCE_BAT_OPERATOR=7 val SCE_BAT_AFTER_LABEL=8 # Lexical states for SCLEX_TCMD lex TCMD=SCLEX_TCMD SCE_TCMD_ val SCE_TCMD_DEFAULT=0 val SCE_TCMD_COMMENT=1 val SCE_TCMD_WORD=2 val SCE_TCMD_LABEL=3 val SCE_TCMD_HIDE=4 val SCE_TCMD_COMMAND=5 val SCE_TCMD_IDENTIFIER=6 val SCE_TCMD_OPERATOR=7 val SCE_TCMD_ENVIRONMENT=8 val SCE_TCMD_EXPANSION=9 val SCE_TCMD_CLABEL=10 # Lexical states for SCLEX_MAKEFILE lex MakeFile=SCLEX_MAKEFILE SCE_MAKE_ val SCE_MAKE_DEFAULT=0 val SCE_MAKE_COMMENT=1 val SCE_MAKE_PREPROCESSOR=2 val SCE_MAKE_IDENTIFIER=3 val SCE_MAKE_OPERATOR=4 val SCE_MAKE_TARGET=5 val SCE_MAKE_IDEOL=9 # Lexical states for SCLEX_DIFF lex Diff=SCLEX_DIFF SCE_DIFF_ val SCE_DIFF_DEFAULT=0 val SCE_DIFF_COMMENT=1 val SCE_DIFF_COMMAND=2 val SCE_DIFF_HEADER=3 val SCE_DIFF_POSITION=4 val SCE_DIFF_DELETED=5 val SCE_DIFF_ADDED=6 val SCE_DIFF_CHANGED=7 val SCE_DIFF_PATCH_ADD=8 val SCE_DIFF_PATCH_DELETE=9 val SCE_DIFF_REMOVED_PATCH_ADD=10 val SCE_DIFF_REMOVED_PATCH_DELETE=11 # Lexical states for SCLEX_CONF (Apache Configuration Files Lexer) lex Conf=SCLEX_CONF SCE_CONF_ val SCE_CONF_DEFAULT=0 val SCE_CONF_COMMENT=1 val SCE_CONF_NUMBER=2 val SCE_CONF_IDENTIFIER=3 val SCE_CONF_EXTENSION=4 val SCE_CONF_PARAMETER=5 val SCE_CONF_STRING=6 val SCE_CONF_OPERATOR=7 val SCE_CONF_IP=8 val SCE_CONF_DIRECTIVE=9 # Lexical states for SCLEX_AVE, Avenue lex Avenue=SCLEX_AVE SCE_AVE_ val SCE_AVE_DEFAULT=0 val SCE_AVE_COMMENT=1 val SCE_AVE_NUMBER=2 val SCE_AVE_WORD=3 val SCE_AVE_STRING=6 val SCE_AVE_ENUM=7 val SCE_AVE_STRINGEOL=8 val SCE_AVE_IDENTIFIER=9 val SCE_AVE_OPERATOR=10 val SCE_AVE_WORD1=11 val SCE_AVE_WORD2=12 val SCE_AVE_WORD3=13 val SCE_AVE_WORD4=14 val SCE_AVE_WORD5=15 val SCE_AVE_WORD6=16 # Lexical states for SCLEX_ADA lex Ada=SCLEX_ADA SCE_ADA_ val SCE_ADA_DEFAULT=0 val SCE_ADA_WORD=1 val SCE_ADA_IDENTIFIER=2 val SCE_ADA_NUMBER=3 val SCE_ADA_DELIMITER=4 val SCE_ADA_CHARACTER=5 val SCE_ADA_CHARACTEREOL=6 val SCE_ADA_STRING=7 val SCE_ADA_STRINGEOL=8 val SCE_ADA_LABEL=9 val SCE_ADA_COMMENTLINE=10 val SCE_ADA_ILLEGAL=11 # Lexical states for SCLEX_BAAN lex Baan=SCLEX_BAAN SCE_BAAN_ val SCE_BAAN_DEFAULT=0 val SCE_BAAN_COMMENT=1 val SCE_BAAN_COMMENTDOC=2 val SCE_BAAN_NUMBER=3 val SCE_BAAN_WORD=4 val SCE_BAAN_STRING=5 val SCE_BAAN_PREPROCESSOR=6 val SCE_BAAN_OPERATOR=7 val SCE_BAAN_IDENTIFIER=8 val SCE_BAAN_STRINGEOL=9 val SCE_BAAN_WORD2=10 val SCE_BAAN_WORD3=11 val SCE_BAAN_WORD4=12 val SCE_BAAN_WORD5=13 val SCE_BAAN_WORD6=14 val SCE_BAAN_WORD7=15 val SCE_BAAN_WORD8=16 val SCE_BAAN_WORD9=17 val SCE_BAAN_TABLEDEF=18 val SCE_BAAN_TABLESQL=19 val SCE_BAAN_FUNCTION=20 val SCE_BAAN_DOMDEF=21 val SCE_BAAN_FUNCDEF=22 val SCE_BAAN_OBJECTDEF=23 val SCE_BAAN_DEFINEDEF=24 # Lexical states for SCLEX_LISP lex Lisp=SCLEX_LISP SCE_LISP_ val SCE_LISP_DEFAULT=0 val SCE_LISP_COMMENT=1 val SCE_LISP_NUMBER=2 val SCE_LISP_KEYWORD=3 val SCE_LISP_KEYWORD_KW=4 val SCE_LISP_SYMBOL=5 val SCE_LISP_STRING=6 val SCE_LISP_STRINGEOL=8 val SCE_LISP_IDENTIFIER=9 val SCE_LISP_OPERATOR=10 val SCE_LISP_SPECIAL=11 val SCE_LISP_MULTI_COMMENT=12 # Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_ lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_ val SCE_EIFFEL_DEFAULT=0 val SCE_EIFFEL_COMMENTLINE=1 val SCE_EIFFEL_NUMBER=2 val SCE_EIFFEL_WORD=3 val SCE_EIFFEL_STRING=4 val SCE_EIFFEL_CHARACTER=5 val SCE_EIFFEL_OPERATOR=6 val SCE_EIFFEL_IDENTIFIER=7 val SCE_EIFFEL_STRINGEOL=8 # Lexical states for SCLEX_NNCRONTAB (nnCron crontab Lexer) lex NNCronTab=SCLEX_NNCRONTAB SCE_NNCRONTAB_ val SCE_NNCRONTAB_DEFAULT=0 val SCE_NNCRONTAB_COMMENT=1 val SCE_NNCRONTAB_TASK=2 val SCE_NNCRONTAB_SECTION=3 val SCE_NNCRONTAB_KEYWORD=4 val SCE_NNCRONTAB_MODIFIER=5 val SCE_NNCRONTAB_ASTERISK=6 val SCE_NNCRONTAB_NUMBER=7 val SCE_NNCRONTAB_STRING=8 val SCE_NNCRONTAB_ENVIRONMENT=9 val SCE_NNCRONTAB_IDENTIFIER=10 # Lexical states for SCLEX_FORTH (Forth Lexer) lex Forth=SCLEX_FORTH SCE_FORTH_ val SCE_FORTH_DEFAULT=0 val SCE_FORTH_COMMENT=1 val SCE_FORTH_COMMENT_ML=2 val SCE_FORTH_IDENTIFIER=3 val SCE_FORTH_CONTROL=4 val SCE_FORTH_KEYWORD=5 val SCE_FORTH_DEFWORD=6 val SCE_FORTH_PREWORD1=7 val SCE_FORTH_PREWORD2=8 val SCE_FORTH_NUMBER=9 val SCE_FORTH_STRING=10 val SCE_FORTH_LOCALE=11 # Lexical states for SCLEX_MATLAB lex MatLab=SCLEX_MATLAB SCE_MATLAB_ val SCE_MATLAB_DEFAULT=0 val SCE_MATLAB_COMMENT=1 val SCE_MATLAB_COMMAND=2 val SCE_MATLAB_NUMBER=3 val SCE_MATLAB_KEYWORD=4 # single quoted string val SCE_MATLAB_STRING=5 val SCE_MATLAB_OPERATOR=6 val SCE_MATLAB_IDENTIFIER=7 val SCE_MATLAB_DOUBLEQUOTESTRING=8 # Lexical states for SCLEX_MAXIMA lex Maxima=SCLEX_MAXIMA SCE_MAXIMA_ val SCE_MAXIMA_OPERATOR=0 val SCE_MAXIMA_COMMANDENDING=1 val SCE_MAXIMA_COMMENT=2 val SCE_MAXIMA_NUMBER=3 val SCE_MAXIMA_STRING=4 val SCE_MAXIMA_COMMAND=5 val SCE_MAXIMA_VARIABLE=6 val SCE_MAXIMA_UNKNOWN=7 # Lexical states for SCLEX_SCRIPTOL lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_ val SCE_SCRIPTOL_DEFAULT=0 val SCE_SCRIPTOL_WHITE=1 val SCE_SCRIPTOL_COMMENTLINE=2 val SCE_SCRIPTOL_PERSISTENT=3 val SCE_SCRIPTOL_CSTYLE=4 val SCE_SCRIPTOL_COMMENTBLOCK=5 val SCE_SCRIPTOL_NUMBER=6 val SCE_SCRIPTOL_STRING=7 val SCE_SCRIPTOL_CHARACTER=8 val SCE_SCRIPTOL_STRINGEOL=9 val SCE_SCRIPTOL_KEYWORD=10 val SCE_SCRIPTOL_OPERATOR=11 val SCE_SCRIPTOL_IDENTIFIER=12 val SCE_SCRIPTOL_TRIPLE=13 val SCE_SCRIPTOL_CLASSNAME=14 val SCE_SCRIPTOL_PREPROCESSOR=15 # Lexical states for SCLEX_ASM, SCLEX_AS lex Asm=SCLEX_ASM SCE_ASM_ lex As=SCLEX_AS SCE_ASM_ val SCE_ASM_DEFAULT=0 val SCE_ASM_COMMENT=1 val SCE_ASM_NUMBER=2 val SCE_ASM_STRING=3 val SCE_ASM_OPERATOR=4 val SCE_ASM_IDENTIFIER=5 val SCE_ASM_CPUINSTRUCTION=6 val SCE_ASM_MATHINSTRUCTION=7 val SCE_ASM_REGISTER=8 val SCE_ASM_DIRECTIVE=9 val SCE_ASM_DIRECTIVEOPERAND=10 val SCE_ASM_COMMENTBLOCK=11 val SCE_ASM_CHARACTER=12 val SCE_ASM_STRINGEOL=13 val SCE_ASM_EXTINSTRUCTION=14 val SCE_ASM_COMMENTDIRECTIVE=15 # Lexical states for SCLEX_FORTRAN lex Fortran=SCLEX_FORTRAN SCE_F_ lex F77=SCLEX_F77 SCE_F_ val SCE_F_DEFAULT=0 val SCE_F_COMMENT=1 val SCE_F_NUMBER=2 val SCE_F_STRING1=3 val SCE_F_STRING2=4 val SCE_F_STRINGEOL=5 val SCE_F_OPERATOR=6 val SCE_F_IDENTIFIER=7 val SCE_F_WORD=8 val SCE_F_WORD2=9 val SCE_F_WORD3=10 val SCE_F_PREPROCESSOR=11 val SCE_F_OPERATOR2=12 val SCE_F_LABEL=13 val SCE_F_CONTINUATION=14 # Lexical states for SCLEX_CSS lex CSS=SCLEX_CSS SCE_CSS_ val SCE_CSS_DEFAULT=0 val SCE_CSS_TAG=1 val SCE_CSS_CLASS=2 val SCE_CSS_PSEUDOCLASS=3 val SCE_CSS_UNKNOWN_PSEUDOCLASS=4 val SCE_CSS_OPERATOR=5 val SCE_CSS_IDENTIFIER=6 val SCE_CSS_UNKNOWN_IDENTIFIER=7 val SCE_CSS_VALUE=8 val SCE_CSS_COMMENT=9 val SCE_CSS_ID=10 val SCE_CSS_IMPORTANT=11 val SCE_CSS_DIRECTIVE=12 val SCE_CSS_DOUBLESTRING=13 val SCE_CSS_SINGLESTRING=14 val SCE_CSS_IDENTIFIER2=15 val SCE_CSS_ATTRIBUTE=16 val SCE_CSS_IDENTIFIER3=17 val SCE_CSS_PSEUDOELEMENT=18 val SCE_CSS_EXTENDED_IDENTIFIER=19 val SCE_CSS_EXTENDED_PSEUDOCLASS=20 val SCE_CSS_EXTENDED_PSEUDOELEMENT=21 val SCE_CSS_GROUP_RULE=22 val SCE_CSS_VARIABLE=23 # Lexical states for SCLEX_POV lex POV=SCLEX_POV SCE_POV_ val SCE_POV_DEFAULT=0 val SCE_POV_COMMENT=1 val SCE_POV_COMMENTLINE=2 val SCE_POV_NUMBER=3 val SCE_POV_OPERATOR=4 val SCE_POV_IDENTIFIER=5 val SCE_POV_STRING=6 val SCE_POV_STRINGEOL=7 val SCE_POV_DIRECTIVE=8 val SCE_POV_BADDIRECTIVE=9 val SCE_POV_WORD2=10 val SCE_POV_WORD3=11 val SCE_POV_WORD4=12 val SCE_POV_WORD5=13 val SCE_POV_WORD6=14 val SCE_POV_WORD7=15 val SCE_POV_WORD8=16 # Lexical states for SCLEX_LOUT lex LOUT=SCLEX_LOUT SCE_LOUT_ val SCE_LOUT_DEFAULT=0 val SCE_LOUT_COMMENT=1 val SCE_LOUT_NUMBER=2 val SCE_LOUT_WORD=3 val SCE_LOUT_WORD2=4 val SCE_LOUT_WORD3=5 val SCE_LOUT_WORD4=6 val SCE_LOUT_STRING=7 val SCE_LOUT_OPERATOR=8 val SCE_LOUT_IDENTIFIER=9 val SCE_LOUT_STRINGEOL=10 # Lexical states for SCLEX_ESCRIPT lex ESCRIPT=SCLEX_ESCRIPT SCE_ESCRIPT_ val SCE_ESCRIPT_DEFAULT=0 val SCE_ESCRIPT_COMMENT=1 val SCE_ESCRIPT_COMMENTLINE=2 val SCE_ESCRIPT_COMMENTDOC=3 val SCE_ESCRIPT_NUMBER=4 val SCE_ESCRIPT_WORD=5 val SCE_ESCRIPT_STRING=6 val SCE_ESCRIPT_OPERATOR=7 val SCE_ESCRIPT_IDENTIFIER=8 val SCE_ESCRIPT_BRACE=9 val SCE_ESCRIPT_WORD2=10 val SCE_ESCRIPT_WORD3=11 # Lexical states for SCLEX_PS lex PS=SCLEX_PS SCE_PS_ val SCE_PS_DEFAULT=0 val SCE_PS_COMMENT=1 val SCE_PS_DSC_COMMENT=2 val SCE_PS_DSC_VALUE=3 val SCE_PS_NUMBER=4 val SCE_PS_NAME=5 val SCE_PS_KEYWORD=6 val SCE_PS_LITERAL=7 val SCE_PS_IMMEVAL=8 val SCE_PS_PAREN_ARRAY=9 val SCE_PS_PAREN_DICT=10 val SCE_PS_PAREN_PROC=11 val SCE_PS_TEXT=12 val SCE_PS_HEXSTRING=13 val SCE_PS_BASE85STRING=14 val SCE_PS_BADSTRINGCHAR=15 # Lexical states for SCLEX_NSIS lex NSIS=SCLEX_NSIS SCE_NSIS_ val SCE_NSIS_DEFAULT=0 val SCE_NSIS_COMMENT=1 val SCE_NSIS_STRINGDQ=2 val SCE_NSIS_STRINGLQ=3 val SCE_NSIS_STRINGRQ=4 val SCE_NSIS_FUNCTION=5 val SCE_NSIS_VARIABLE=6 val SCE_NSIS_LABEL=7 val SCE_NSIS_USERDEFINED=8 val SCE_NSIS_SECTIONDEF=9 val SCE_NSIS_SUBSECTIONDEF=10 val SCE_NSIS_IFDEFINEDEF=11 val SCE_NSIS_MACRODEF=12 val SCE_NSIS_STRINGVAR=13 val SCE_NSIS_NUMBER=14 val SCE_NSIS_SECTIONGROUP=15 val SCE_NSIS_PAGEEX=16 val SCE_NSIS_FUNCTIONDEF=17 val SCE_NSIS_COMMENTBOX=18 # Lexical states for SCLEX_MMIXAL lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_ val SCE_MMIXAL_LEADWS=0 val SCE_MMIXAL_COMMENT=1 val SCE_MMIXAL_LABEL=2 val SCE_MMIXAL_OPCODE=3 val SCE_MMIXAL_OPCODE_PRE=4 val SCE_MMIXAL_OPCODE_VALID=5 val SCE_MMIXAL_OPCODE_UNKNOWN=6 val SCE_MMIXAL_OPCODE_POST=7 val SCE_MMIXAL_OPERANDS=8 val SCE_MMIXAL_NUMBER=9 val SCE_MMIXAL_REF=10 val SCE_MMIXAL_CHAR=11 val SCE_MMIXAL_STRING=12 val SCE_MMIXAL_REGISTER=13 val SCE_MMIXAL_HEX=14 val SCE_MMIXAL_OPERATOR=15 val SCE_MMIXAL_SYMBOL=16 val SCE_MMIXAL_INCLUDE=17 # Lexical states for SCLEX_CLW lex Clarion=SCLEX_CLW SCE_CLW_ val SCE_CLW_DEFAULT=0 val SCE_CLW_LABEL=1 val SCE_CLW_COMMENT=2 val SCE_CLW_STRING=3 val SCE_CLW_USER_IDENTIFIER=4 val SCE_CLW_INTEGER_CONSTANT=5 val SCE_CLW_REAL_CONSTANT=6 val SCE_CLW_PICTURE_STRING=7 val SCE_CLW_KEYWORD=8 val SCE_CLW_COMPILER_DIRECTIVE=9 val SCE_CLW_RUNTIME_EXPRESSIONS=10 val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=11 val SCE_CLW_STRUCTURE_DATA_TYPE=12 val SCE_CLW_ATTRIBUTE=13 val SCE_CLW_STANDARD_EQUATE=14 val SCE_CLW_ERROR=15 val SCE_CLW_DEPRECATED=16 # Lexical states for SCLEX_LOT lex LOT=SCLEX_LOT SCE_LOT_ val SCE_LOT_DEFAULT=0 val SCE_LOT_HEADER=1 val SCE_LOT_BREAK=2 val SCE_LOT_SET=3 val SCE_LOT_PASS=4 val SCE_LOT_FAIL=5 val SCE_LOT_ABORT=6 # Lexical states for SCLEX_YAML lex YAML=SCLEX_YAML SCE_YAML_ val SCE_YAML_DEFAULT=0 val SCE_YAML_COMMENT=1 val SCE_YAML_IDENTIFIER=2 val SCE_YAML_KEYWORD=3 val SCE_YAML_NUMBER=4 val SCE_YAML_REFERENCE=5 val SCE_YAML_DOCUMENT=6 val SCE_YAML_TEXT=7 val SCE_YAML_ERROR=8 val SCE_YAML_OPERATOR=9 # Lexical states for SCLEX_TEX lex TeX=SCLEX_TEX SCE_TEX_ val SCE_TEX_DEFAULT=0 val SCE_TEX_SPECIAL=1 val SCE_TEX_GROUP=2 val SCE_TEX_SYMBOL=3 val SCE_TEX_COMMAND=4 val SCE_TEX_TEXT=5 lex Metapost=SCLEX_METAPOST SCE_METAPOST_ val SCE_METAPOST_DEFAULT=0 val SCE_METAPOST_SPECIAL=1 val SCE_METAPOST_GROUP=2 val SCE_METAPOST_SYMBOL=3 val SCE_METAPOST_COMMAND=4 val SCE_METAPOST_TEXT=5 val SCE_METAPOST_EXTRA=6 # Lexical states for SCLEX_ERLANG lex Erlang=SCLEX_ERLANG SCE_ERLANG_ val SCE_ERLANG_DEFAULT=0 val SCE_ERLANG_COMMENT=1 val SCE_ERLANG_VARIABLE=2 val SCE_ERLANG_NUMBER=3 val SCE_ERLANG_KEYWORD=4 val SCE_ERLANG_STRING=5 val SCE_ERLANG_OPERATOR=6 val SCE_ERLANG_ATOM=7 val SCE_ERLANG_FUNCTION_NAME=8 val SCE_ERLANG_CHARACTER=9 val SCE_ERLANG_MACRO=10 val SCE_ERLANG_RECORD=11 val SCE_ERLANG_PREPROC=12 val SCE_ERLANG_NODE_NAME=13 val SCE_ERLANG_COMMENT_FUNCTION=14 val SCE_ERLANG_COMMENT_MODULE=15 val SCE_ERLANG_COMMENT_DOC=16 val SCE_ERLANG_COMMENT_DOC_MACRO=17 val SCE_ERLANG_ATOM_QUOTED=18 val SCE_ERLANG_MACRO_QUOTED=19 val SCE_ERLANG_RECORD_QUOTED=20 val SCE_ERLANG_NODE_NAME_QUOTED=21 val SCE_ERLANG_BIFS=22 val SCE_ERLANG_MODULES=23 val SCE_ERLANG_MODULES_ATT=24 val SCE_ERLANG_UNKNOWN=31 # Lexical states for SCLEX_OCTAVE are identical to MatLab lex Octave=SCLEX_OCTAVE SCE_MATLAB_ # Lexical states for SCLEX_JULIA lex Julia=SCLEX_JULIA SCE_JULIA_ val SCE_JULIA_DEFAULT=0 val SCE_JULIA_COMMENT=1 val SCE_JULIA_NUMBER=2 val SCE_JULIA_KEYWORD1=3 val SCE_JULIA_KEYWORD2=4 val SCE_JULIA_KEYWORD3=5 val SCE_JULIA_CHAR=6 val SCE_JULIA_OPERATOR=7 val SCE_JULIA_BRACKET=8 val SCE_JULIA_IDENTIFIER=9 val SCE_JULIA_STRING=10 val SCE_JULIA_SYMBOL=11 val SCE_JULIA_MACRO=12 val SCE_JULIA_STRINGINTERP=13 val SCE_JULIA_DOCSTRING=14 val SCE_JULIA_STRINGLITERAL=15 val SCE_JULIA_COMMAND=16 val SCE_JULIA_COMMANDLITERAL=17 val SCE_JULIA_TYPEANNOT=18 val SCE_JULIA_LEXERROR=19 val SCE_JULIA_KEYWORD4=20 val SCE_JULIA_TYPEOPERATOR=21 # Lexical states for SCLEX_MSSQL lex MSSQL=SCLEX_MSSQL SCE_MSSQL_ val SCE_MSSQL_DEFAULT=0 val SCE_MSSQL_COMMENT=1 val SCE_MSSQL_LINE_COMMENT=2 val SCE_MSSQL_NUMBER=3 val SCE_MSSQL_STRING=4 val SCE_MSSQL_OPERATOR=5 val SCE_MSSQL_IDENTIFIER=6 val SCE_MSSQL_VARIABLE=7 val SCE_MSSQL_COLUMN_NAME=8 val SCE_MSSQL_STATEMENT=9 val SCE_MSSQL_DATATYPE=10 val SCE_MSSQL_SYSTABLE=11 val SCE_MSSQL_GLOBAL_VARIABLE=12 val SCE_MSSQL_FUNCTION=13 val SCE_MSSQL_STORED_PROCEDURE=14 val SCE_MSSQL_DEFAULT_PREF_DATATYPE=15 val SCE_MSSQL_COLUMN_NAME_2=16 # Lexical states for SCLEX_VERILOG lex Verilog=SCLEX_VERILOG SCE_V_ val SCE_V_DEFAULT=0 val SCE_V_COMMENT=1 val SCE_V_COMMENTLINE=2 val SCE_V_COMMENTLINEBANG=3 val SCE_V_NUMBER=4 val SCE_V_WORD=5 val SCE_V_STRING=6 val SCE_V_WORD2=7 val SCE_V_WORD3=8 val SCE_V_PREPROCESSOR=9 val SCE_V_OPERATOR=10 val SCE_V_IDENTIFIER=11 val SCE_V_STRINGEOL=12 val SCE_V_USER=19 val SCE_V_COMMENT_WORD=20 val SCE_V_INPUT=21 val SCE_V_OUTPUT=22 val SCE_V_INOUT=23 val SCE_V_PORT_CONNECT=24 # Lexical states for SCLEX_KIX lex Kix=SCLEX_KIX SCE_KIX_ val SCE_KIX_DEFAULT=0 val SCE_KIX_COMMENT=1 val SCE_KIX_STRING1=2 val SCE_KIX_STRING2=3 val SCE_KIX_NUMBER=4 val SCE_KIX_VAR=5 val SCE_KIX_MACRO=6 val SCE_KIX_KEYWORD=7 val SCE_KIX_FUNCTIONS=8 val SCE_KIX_OPERATOR=9 val SCE_KIX_COMMENTSTREAM=10 val SCE_KIX_IDENTIFIER=31 # Lexical states for SCLEX_GUI4CLI lex Gui4Cli=SCLEX_GUI4CLI SCE_GC_ val SCE_GC_DEFAULT=0 val SCE_GC_COMMENTLINE=1 val SCE_GC_COMMENTBLOCK=2 val SCE_GC_GLOBAL=3 val SCE_GC_EVENT=4 val SCE_GC_ATTRIBUTE=5 val SCE_GC_CONTROL=6 val SCE_GC_COMMAND=7 val SCE_GC_STRING=8 val SCE_GC_OPERATOR=9 # Lexical states for SCLEX_SPECMAN lex Specman=SCLEX_SPECMAN SCE_SN_ val SCE_SN_DEFAULT=0 val SCE_SN_CODE=1 val SCE_SN_COMMENTLINE=2 val SCE_SN_COMMENTLINEBANG=3 val SCE_SN_NUMBER=4 val SCE_SN_WORD=5 val SCE_SN_STRING=6 val SCE_SN_WORD2=7 val SCE_SN_WORD3=8 val SCE_SN_PREPROCESSOR=9 val SCE_SN_OPERATOR=10 val SCE_SN_IDENTIFIER=11 val SCE_SN_STRINGEOL=12 val SCE_SN_REGEXTAG=13 val SCE_SN_SIGNAL=14 val SCE_SN_USER=19 # Lexical states for SCLEX_AU3 lex Au3=SCLEX_AU3 SCE_AU3_ val SCE_AU3_DEFAULT=0 val SCE_AU3_COMMENT=1 val SCE_AU3_COMMENTBLOCK=2 val SCE_AU3_NUMBER=3 val SCE_AU3_FUNCTION=4 val SCE_AU3_KEYWORD=5 val SCE_AU3_MACRO=6 val SCE_AU3_STRING=7 val SCE_AU3_OPERATOR=8 val SCE_AU3_VARIABLE=9 val SCE_AU3_SENT=10 val SCE_AU3_PREPROCESSOR=11 val SCE_AU3_SPECIAL=12 val SCE_AU3_EXPAND=13 val SCE_AU3_COMOBJ=14 val SCE_AU3_UDF=15 # Lexical states for SCLEX_APDL lex APDL=SCLEX_APDL SCE_APDL_ val SCE_APDL_DEFAULT=0 val SCE_APDL_COMMENT=1 val SCE_APDL_COMMENTBLOCK=2 val SCE_APDL_NUMBER=3 val SCE_APDL_STRING=4 val SCE_APDL_OPERATOR=5 val SCE_APDL_WORD=6 val SCE_APDL_PROCESSOR=7 val SCE_APDL_COMMAND=8 val SCE_APDL_SLASHCOMMAND=9 val SCE_APDL_STARCOMMAND=10 val SCE_APDL_ARGUMENT=11 val SCE_APDL_FUNCTION=12 # Lexical states for SCLEX_BASH lex Bash=SCLEX_BASH SCE_SH_ val SCE_SH_DEFAULT=0 val SCE_SH_ERROR=1 val SCE_SH_COMMENTLINE=2 val SCE_SH_NUMBER=3 val SCE_SH_WORD=4 val SCE_SH_STRING=5 val SCE_SH_CHARACTER=6 val SCE_SH_OPERATOR=7 val SCE_SH_IDENTIFIER=8 val SCE_SH_SCALAR=9 val SCE_SH_PARAM=10 val SCE_SH_BACKTICKS=11 val SCE_SH_HERE_DELIM=12 val SCE_SH_HERE_Q=13 # Lexical states for SCLEX_ASN1 lex Asn1=SCLEX_ASN1 SCE_ASN1_ val SCE_ASN1_DEFAULT=0 val SCE_ASN1_COMMENT=1 val SCE_ASN1_IDENTIFIER=2 val SCE_ASN1_STRING=3 val SCE_ASN1_OID=4 val SCE_ASN1_SCALAR=5 val SCE_ASN1_KEYWORD=6 val SCE_ASN1_ATTRIBUTE=7 val SCE_ASN1_DESCRIPTOR=8 val SCE_ASN1_TYPE=9 val SCE_ASN1_OPERATOR=10 # Lexical states for SCLEX_VHDL lex VHDL=SCLEX_VHDL SCE_VHDL_ val SCE_VHDL_DEFAULT=0 val SCE_VHDL_COMMENT=1 val SCE_VHDL_COMMENTLINEBANG=2 val SCE_VHDL_NUMBER=3 val SCE_VHDL_STRING=4 val SCE_VHDL_OPERATOR=5 val SCE_VHDL_IDENTIFIER=6 val SCE_VHDL_STRINGEOL=7 val SCE_VHDL_KEYWORD=8 val SCE_VHDL_STDOPERATOR=9 val SCE_VHDL_ATTRIBUTE=10 val SCE_VHDL_STDFUNCTION=11 val SCE_VHDL_STDPACKAGE=12 val SCE_VHDL_STDTYPE=13 val SCE_VHDL_USERWORD=14 val SCE_VHDL_BLOCK_COMMENT=15 # Lexical states for SCLEX_CAML lex Caml=SCLEX_CAML SCE_CAML_ val SCE_CAML_DEFAULT=0 val SCE_CAML_IDENTIFIER=1 val SCE_CAML_TAGNAME=2 val SCE_CAML_KEYWORD=3 val SCE_CAML_KEYWORD2=4 val SCE_CAML_KEYWORD3=5 val SCE_CAML_LINENUM=6 val SCE_CAML_OPERATOR=7 val SCE_CAML_NUMBER=8 val SCE_CAML_CHAR=9 val SCE_CAML_WHITE=10 val SCE_CAML_STRING=11 val SCE_CAML_COMMENT=12 val SCE_CAML_COMMENT1=13 val SCE_CAML_COMMENT2=14 val SCE_CAML_COMMENT3=15 # Lexical states for SCLEX_HASKELL lex Haskell=SCLEX_HASKELL SCE_HA_ val SCE_HA_DEFAULT=0 val SCE_HA_IDENTIFIER=1 val SCE_HA_KEYWORD=2 val SCE_HA_NUMBER=3 val SCE_HA_STRING=4 val SCE_HA_CHARACTER=5 val SCE_HA_CLASS=6 val SCE_HA_MODULE=7 val SCE_HA_CAPITAL=8 val SCE_HA_DATA=9 val SCE_HA_IMPORT=10 val SCE_HA_OPERATOR=11 val SCE_HA_INSTANCE=12 val SCE_HA_COMMENTLINE=13 val SCE_HA_COMMENTBLOCK=14 val SCE_HA_COMMENTBLOCK2=15 val SCE_HA_COMMENTBLOCK3=16 val SCE_HA_PRAGMA=17 val SCE_HA_PREPROCESSOR=18 val SCE_HA_STRINGEOL=19 val SCE_HA_RESERVED_OPERATOR=20 val SCE_HA_LITERATE_COMMENT=21 val SCE_HA_LITERATE_CODEDELIM=22 # Lexical states of SCLEX_TADS3 lex TADS3=SCLEX_TADS3 SCE_T3_ val SCE_T3_DEFAULT=0 val SCE_T3_X_DEFAULT=1 val SCE_T3_PREPROCESSOR=2 val SCE_T3_BLOCK_COMMENT=3 val SCE_T3_LINE_COMMENT=4 val SCE_T3_OPERATOR=5 val SCE_T3_KEYWORD=6 val SCE_T3_NUMBER=7 val SCE_T3_IDENTIFIER=8 val SCE_T3_S_STRING=9 val SCE_T3_D_STRING=10 val SCE_T3_X_STRING=11 val SCE_T3_LIB_DIRECTIVE=12 val SCE_T3_MSG_PARAM=13 val SCE_T3_HTML_TAG=14 val SCE_T3_HTML_DEFAULT=15 val SCE_T3_HTML_STRING=16 val SCE_T3_USER1=17 val SCE_T3_USER2=18 val SCE_T3_USER3=19 val SCE_T3_BRACE=20 # Lexical states for SCLEX_REBOL lex Rebol=SCLEX_REBOL SCE_REBOL_ val SCE_REBOL_DEFAULT=0 val SCE_REBOL_COMMENTLINE=1 val SCE_REBOL_COMMENTBLOCK=2 val SCE_REBOL_PREFACE=3 val SCE_REBOL_OPERATOR=4 val SCE_REBOL_CHARACTER=5 val SCE_REBOL_QUOTEDSTRING=6 val SCE_REBOL_BRACEDSTRING=7 val SCE_REBOL_NUMBER=8 val SCE_REBOL_PAIR=9 val SCE_REBOL_TUPLE=10 val SCE_REBOL_BINARY=11 val SCE_REBOL_MONEY=12 val SCE_REBOL_ISSUE=13 val SCE_REBOL_TAG=14 val SCE_REBOL_FILE=15 val SCE_REBOL_EMAIL=16 val SCE_REBOL_URL=17 val SCE_REBOL_DATE=18 val SCE_REBOL_TIME=19 val SCE_REBOL_IDENTIFIER=20 val SCE_REBOL_WORD=21 val SCE_REBOL_WORD2=22 val SCE_REBOL_WORD3=23 val SCE_REBOL_WORD4=24 val SCE_REBOL_WORD5=25 val SCE_REBOL_WORD6=26 val SCE_REBOL_WORD7=27 val SCE_REBOL_WORD8=28 # Lexical states for SCLEX_SQL lex SQL=SCLEX_SQL SCE_SQL_ val SCE_SQL_DEFAULT=0 val SCE_SQL_COMMENT=1 val SCE_SQL_COMMENTLINE=2 val SCE_SQL_COMMENTDOC=3 val SCE_SQL_NUMBER=4 val SCE_SQL_WORD=5 val SCE_SQL_STRING=6 val SCE_SQL_CHARACTER=7 val SCE_SQL_SQLPLUS=8 val SCE_SQL_SQLPLUS_PROMPT=9 val SCE_SQL_OPERATOR=10 val SCE_SQL_IDENTIFIER=11 val SCE_SQL_SQLPLUS_COMMENT=13 val SCE_SQL_COMMENTLINEDOC=15 val SCE_SQL_WORD2=16 val SCE_SQL_COMMENTDOCKEYWORD=17 val SCE_SQL_COMMENTDOCKEYWORDERROR=18 val SCE_SQL_USER1=19 val SCE_SQL_USER2=20 val SCE_SQL_USER3=21 val SCE_SQL_USER4=22 val SCE_SQL_QUOTEDIDENTIFIER=23 val SCE_SQL_QOPERATOR=24 # Lexical states for SCLEX_SMALLTALK lex Smalltalk=SCLEX_SMALLTALK SCE_ST_ val SCE_ST_DEFAULT=0 val SCE_ST_STRING=1 val SCE_ST_NUMBER=2 val SCE_ST_COMMENT=3 val SCE_ST_SYMBOL=4 val SCE_ST_BINARY=5 val SCE_ST_BOOL=6 val SCE_ST_SELF=7 val SCE_ST_SUPER=8 val SCE_ST_NIL=9 val SCE_ST_GLOBAL=10 val SCE_ST_RETURN=11 val SCE_ST_SPECIAL=12 val SCE_ST_KWSEND=13 val SCE_ST_ASSIGN=14 val SCE_ST_CHARACTER=15 val SCE_ST_SPEC_SEL=16 # Lexical states for SCLEX_FLAGSHIP (clipper) lex FlagShip=SCLEX_FLAGSHIP SCE_FS_ val SCE_FS_DEFAULT=0 val SCE_FS_COMMENT=1 val SCE_FS_COMMENTLINE=2 val SCE_FS_COMMENTDOC=3 val SCE_FS_COMMENTLINEDOC=4 val SCE_FS_COMMENTDOCKEYWORD=5 val SCE_FS_COMMENTDOCKEYWORDERROR=6 val SCE_FS_KEYWORD=7 val SCE_FS_KEYWORD2=8 val SCE_FS_KEYWORD3=9 val SCE_FS_KEYWORD4=10 val SCE_FS_NUMBER=11 val SCE_FS_STRING=12 val SCE_FS_PREPROCESSOR=13 val SCE_FS_OPERATOR=14 val SCE_FS_IDENTIFIER=15 val SCE_FS_DATE=16 val SCE_FS_STRINGEOL=17 val SCE_FS_CONSTANT=18 val SCE_FS_WORDOPERATOR=19 val SCE_FS_DISABLEDCODE=20 val SCE_FS_DEFAULT_C=21 val SCE_FS_COMMENTDOC_C=22 val SCE_FS_COMMENTLINEDOC_C=23 val SCE_FS_KEYWORD_C=24 val SCE_FS_KEYWORD2_C=25 val SCE_FS_NUMBER_C=26 val SCE_FS_STRING_C=27 val SCE_FS_PREPROCESSOR_C=28 val SCE_FS_OPERATOR_C=29 val SCE_FS_IDENTIFIER_C=30 val SCE_FS_STRINGEOL_C=31 # Lexical states for SCLEX_CSOUND lex Csound=SCLEX_CSOUND SCE_CSOUND_ val SCE_CSOUND_DEFAULT=0 val SCE_CSOUND_COMMENT=1 val SCE_CSOUND_NUMBER=2 val SCE_CSOUND_OPERATOR=3 val SCE_CSOUND_INSTR=4 val SCE_CSOUND_IDENTIFIER=5 val SCE_CSOUND_OPCODE=6 val SCE_CSOUND_HEADERSTMT=7 val SCE_CSOUND_USERKEYWORD=8 val SCE_CSOUND_COMMENTBLOCK=9 val SCE_CSOUND_PARAM=10 val SCE_CSOUND_ARATE_VAR=11 val SCE_CSOUND_KRATE_VAR=12 val SCE_CSOUND_IRATE_VAR=13 val SCE_CSOUND_GLOBAL_VAR=14 val SCE_CSOUND_STRINGEOL=15 # Lexical states for SCLEX_INNOSETUP lex Inno=SCLEX_INNOSETUP SCE_INNO_ val SCE_INNO_DEFAULT=0 val SCE_INNO_COMMENT=1 val SCE_INNO_KEYWORD=2 val SCE_INNO_PARAMETER=3 val SCE_INNO_SECTION=4 val SCE_INNO_PREPROC=5 val SCE_INNO_INLINE_EXPANSION=6 val SCE_INNO_COMMENT_PASCAL=7 val SCE_INNO_KEYWORD_PASCAL=8 val SCE_INNO_KEYWORD_USER=9 val SCE_INNO_STRING_DOUBLE=10 val SCE_INNO_STRING_SINGLE=11 val SCE_INNO_IDENTIFIER=12 # Lexical states for SCLEX_OPAL lex Opal=SCLEX_OPAL SCE_OPAL_ val SCE_OPAL_SPACE=0 val SCE_OPAL_COMMENT_BLOCK=1 val SCE_OPAL_COMMENT_LINE=2 val SCE_OPAL_INTEGER=3 val SCE_OPAL_KEYWORD=4 val SCE_OPAL_SORT=5 val SCE_OPAL_STRING=6 val SCE_OPAL_PAR=7 val SCE_OPAL_BOOL_CONST=8 val SCE_OPAL_DEFAULT=32 # Lexical states for SCLEX_SPICE lex Spice=SCLEX_SPICE SCE_SPICE_ val SCE_SPICE_DEFAULT=0 val SCE_SPICE_IDENTIFIER=1 val SCE_SPICE_KEYWORD=2 val SCE_SPICE_KEYWORD2=3 val SCE_SPICE_KEYWORD3=4 val SCE_SPICE_NUMBER=5 val SCE_SPICE_DELIMITER=6 val SCE_SPICE_VALUE=7 val SCE_SPICE_COMMENTLINE=8 # Lexical states for SCLEX_CMAKE lex CMAKE=SCLEX_CMAKE SCE_CMAKE_ val SCE_CMAKE_DEFAULT=0 val SCE_CMAKE_COMMENT=1 val SCE_CMAKE_STRINGDQ=2 val SCE_CMAKE_STRINGLQ=3 val SCE_CMAKE_STRINGRQ=4 val SCE_CMAKE_COMMANDS=5 val SCE_CMAKE_PARAMETERS=6 val SCE_CMAKE_VARIABLE=7 val SCE_CMAKE_USERDEFINED=8 val SCE_CMAKE_WHILEDEF=9 val SCE_CMAKE_FOREACHDEF=10 val SCE_CMAKE_IFDEFINEDEF=11 val SCE_CMAKE_MACRODEF=12 val SCE_CMAKE_STRINGVAR=13 val SCE_CMAKE_NUMBER=14 # Lexical states for SCLEX_GAP lex Gap=SCLEX_GAP SCE_GAP_ val SCE_GAP_DEFAULT=0 val SCE_GAP_IDENTIFIER=1 val SCE_GAP_KEYWORD=2 val SCE_GAP_KEYWORD2=3 val SCE_GAP_KEYWORD3=4 val SCE_GAP_KEYWORD4=5 val SCE_GAP_STRING=6 val SCE_GAP_CHAR=7 val SCE_GAP_OPERATOR=8 val SCE_GAP_COMMENT=9 val SCE_GAP_NUMBER=10 val SCE_GAP_STRINGEOL=11 # Lexical state for SCLEX_PLM lex PLM=SCLEX_PLM SCE_PLM_ val SCE_PLM_DEFAULT=0 val SCE_PLM_COMMENT=1 val SCE_PLM_STRING=2 val SCE_PLM_NUMBER=3 val SCE_PLM_IDENTIFIER=4 val SCE_PLM_OPERATOR=5 val SCE_PLM_CONTROL=6 val SCE_PLM_KEYWORD=7 # Lexical state for SCLEX_PROGRESS lex Progress=SCLEX_PROGRESS SCE_ABL_ val SCE_ABL_DEFAULT=0 val SCE_ABL_NUMBER=1 val SCE_ABL_WORD=2 val SCE_ABL_STRING=3 val SCE_ABL_CHARACTER=4 val SCE_ABL_PREPROCESSOR=5 val SCE_ABL_OPERATOR=6 val SCE_ABL_IDENTIFIER=7 val SCE_ABL_BLOCK=8 val SCE_ABL_END=9 val SCE_ABL_COMMENT=10 val SCE_ABL_TASKMARKER=11 val SCE_ABL_LINECOMMENT=12 # Lexical states for SCLEX_ABAQUS lex ABAQUS=SCLEX_ABAQUS SCE_ABAQUS_ val SCE_ABAQUS_DEFAULT=0 val SCE_ABAQUS_COMMENT=1 val SCE_ABAQUS_COMMENTBLOCK=2 val SCE_ABAQUS_NUMBER=3 val SCE_ABAQUS_STRING=4 val SCE_ABAQUS_OPERATOR=5 val SCE_ABAQUS_WORD=6 val SCE_ABAQUS_PROCESSOR=7 val SCE_ABAQUS_COMMAND=8 val SCE_ABAQUS_SLASHCOMMAND=9 val SCE_ABAQUS_STARCOMMAND=10 val SCE_ABAQUS_ARGUMENT=11 val SCE_ABAQUS_FUNCTION=12 # Lexical states for SCLEX_ASYMPTOTE lex Asymptote=SCLEX_ASYMPTOTE SCE_ASY_ val SCE_ASY_DEFAULT=0 val SCE_ASY_COMMENT=1 val SCE_ASY_COMMENTLINE=2 val SCE_ASY_NUMBER=3 val SCE_ASY_WORD=4 val SCE_ASY_STRING=5 val SCE_ASY_CHARACTER=6 val SCE_ASY_OPERATOR=7 val SCE_ASY_IDENTIFIER=8 val SCE_ASY_STRINGEOL=9 val SCE_ASY_COMMENTLINEDOC=10 val SCE_ASY_WORD2=11 # Lexical states for SCLEX_R lex R=SCLEX_R SCE_R_ val SCE_R_DEFAULT=0 val SCE_R_COMMENT=1 val SCE_R_KWORD=2 val SCE_R_BASEKWORD=3 val SCE_R_OTHERKWORD=4 val SCE_R_NUMBER=5 val SCE_R_STRING=6 val SCE_R_STRING2=7 val SCE_R_OPERATOR=8 val SCE_R_IDENTIFIER=9 val SCE_R_INFIX=10 val SCE_R_INFIXEOL=11 val SCE_R_BACKTICKS=12 val SCE_R_RAWSTRING=13 val SCE_R_RAWSTRING2=14 val SCE_R_ESCAPESEQUENCE=15 # Lexical state for SCLEX_MAGIK lex MagikSF=SCLEX_MAGIK SCE_MAGIK_ val SCE_MAGIK_DEFAULT=0 val SCE_MAGIK_COMMENT=1 val SCE_MAGIK_HYPER_COMMENT=16 val SCE_MAGIK_STRING=2 val SCE_MAGIK_CHARACTER=3 val SCE_MAGIK_NUMBER=4 val SCE_MAGIK_IDENTIFIER=5 val SCE_MAGIK_OPERATOR=6 val SCE_MAGIK_FLOW=7 val SCE_MAGIK_CONTAINER=8 val SCE_MAGIK_BRACKET_BLOCK=9 val SCE_MAGIK_BRACE_BLOCK=10 val SCE_MAGIK_SQBRACKET_BLOCK=11 val SCE_MAGIK_UNKNOWN_KEYWORD=12 val SCE_MAGIK_KEYWORD=13 val SCE_MAGIK_PRAGMA=14 val SCE_MAGIK_SYMBOL=15 # Lexical state for SCLEX_POWERSHELL lex PowerShell=SCLEX_POWERSHELL SCE_POWERSHELL_ val SCE_POWERSHELL_DEFAULT=0 val SCE_POWERSHELL_COMMENT=1 val SCE_POWERSHELL_STRING=2 val SCE_POWERSHELL_CHARACTER=3 val SCE_POWERSHELL_NUMBER=4 val SCE_POWERSHELL_VARIABLE=5 val SCE_POWERSHELL_OPERATOR=6 val SCE_POWERSHELL_IDENTIFIER=7 val SCE_POWERSHELL_KEYWORD=8 val SCE_POWERSHELL_CMDLET=9 val SCE_POWERSHELL_ALIAS=10 val SCE_POWERSHELL_FUNCTION=11 val SCE_POWERSHELL_USER1=12 val SCE_POWERSHELL_COMMENTSTREAM=13 val SCE_POWERSHELL_HERE_STRING=14 val SCE_POWERSHELL_HERE_CHARACTER=15 val SCE_POWERSHELL_COMMENTDOCKEYWORD=16 # Lexical state for SCLEX_MYSQL lex MySQL=SCLEX_MYSQL SCE_MYSQL_ val SCE_MYSQL_DEFAULT=0 val SCE_MYSQL_COMMENT=1 val SCE_MYSQL_COMMENTLINE=2 val SCE_MYSQL_VARIABLE=3 val SCE_MYSQL_SYSTEMVARIABLE=4 val SCE_MYSQL_KNOWNSYSTEMVARIABLE=5 val SCE_MYSQL_NUMBER=6 val SCE_MYSQL_MAJORKEYWORD=7 val SCE_MYSQL_KEYWORD=8 val SCE_MYSQL_DATABASEOBJECT=9 val SCE_MYSQL_PROCEDUREKEYWORD=10 val SCE_MYSQL_STRING=11 val SCE_MYSQL_SQSTRING=12 val SCE_MYSQL_DQSTRING=13 val SCE_MYSQL_OPERATOR=14 val SCE_MYSQL_FUNCTION=15 val SCE_MYSQL_IDENTIFIER=16 val SCE_MYSQL_QUOTEDIDENTIFIER=17 val SCE_MYSQL_USER1=18 val SCE_MYSQL_USER2=19 val SCE_MYSQL_USER3=20 val SCE_MYSQL_HIDDENCOMMAND=21 val SCE_MYSQL_PLACEHOLDER=22 # Lexical state for SCLEX_PO lex Po=SCLEX_PO SCE_PO_ val SCE_PO_DEFAULT=0 val SCE_PO_COMMENT=1 val SCE_PO_MSGID=2 val SCE_PO_MSGID_TEXT=3 val SCE_PO_MSGSTR=4 val SCE_PO_MSGSTR_TEXT=5 val SCE_PO_MSGCTXT=6 val SCE_PO_MSGCTXT_TEXT=7 val SCE_PO_FUZZY=8 val SCE_PO_PROGRAMMER_COMMENT=9 val SCE_PO_REFERENCE=10 val SCE_PO_FLAGS=11 val SCE_PO_MSGID_TEXT_EOL=12 val SCE_PO_MSGSTR_TEXT_EOL=13 val SCE_PO_MSGCTXT_TEXT_EOL=14 val SCE_PO_ERROR=15 # Lexical states for SCLEX_PASCAL lex Pascal=SCLEX_PASCAL SCE_PAS_ val SCE_PAS_DEFAULT=0 val SCE_PAS_IDENTIFIER=1 val SCE_PAS_COMMENT=2 val SCE_PAS_COMMENT2=3 val SCE_PAS_COMMENTLINE=4 val SCE_PAS_PREPROCESSOR=5 val SCE_PAS_PREPROCESSOR2=6 val SCE_PAS_NUMBER=7 val SCE_PAS_HEXNUMBER=8 val SCE_PAS_WORD=9 val SCE_PAS_STRING=10 val SCE_PAS_STRINGEOL=11 val SCE_PAS_CHARACTER=12 val SCE_PAS_OPERATOR=13 val SCE_PAS_ASM=14 # Lexical state for SCLEX_SORCUS lex SORCUS=SCLEX_SORCUS SCE_SORCUS_ val SCE_SORCUS_DEFAULT=0 val SCE_SORCUS_COMMAND=1 val SCE_SORCUS_PARAMETER=2 val SCE_SORCUS_COMMENTLINE=3 val SCE_SORCUS_STRING=4 val SCE_SORCUS_STRINGEOL=5 val SCE_SORCUS_IDENTIFIER=6 val SCE_SORCUS_OPERATOR=7 val SCE_SORCUS_NUMBER=8 val SCE_SORCUS_CONSTANT=9 # Lexical state for SCLEX_POWERPRO lex PowerPro=SCLEX_POWERPRO SCE_POWERPRO_ val SCE_POWERPRO_DEFAULT=0 val SCE_POWERPRO_COMMENTBLOCK=1 val SCE_POWERPRO_COMMENTLINE=2 val SCE_POWERPRO_NUMBER=3 val SCE_POWERPRO_WORD=4 val SCE_POWERPRO_WORD2=5 val SCE_POWERPRO_WORD3=6 val SCE_POWERPRO_WORD4=7 val SCE_POWERPRO_DOUBLEQUOTEDSTRING=8 val SCE_POWERPRO_SINGLEQUOTEDSTRING=9 val SCE_POWERPRO_LINECONTINUE=10 val SCE_POWERPRO_OPERATOR=11 val SCE_POWERPRO_IDENTIFIER=12 val SCE_POWERPRO_STRINGEOL=13 val SCE_POWERPRO_VERBATIM=14 val SCE_POWERPRO_ALTQUOTE=15 val SCE_POWERPRO_FUNCTION=16 # Lexical states for SCLEX_SML lex SML=SCLEX_SML SCE_SML_ val SCE_SML_DEFAULT=0 val SCE_SML_IDENTIFIER=1 val SCE_SML_TAGNAME=2 val SCE_SML_KEYWORD=3 val SCE_SML_KEYWORD2=4 val SCE_SML_KEYWORD3=5 val SCE_SML_LINENUM=6 val SCE_SML_OPERATOR=7 val SCE_SML_NUMBER=8 val SCE_SML_CHAR=9 val SCE_SML_STRING=11 val SCE_SML_COMMENT=12 val SCE_SML_COMMENT1=13 val SCE_SML_COMMENT2=14 val SCE_SML_COMMENT3=15 # Lexical state for SCLEX_MARKDOWN lex Markdown=SCLEX_MARKDOWN SCE_MARKDOWN_ val SCE_MARKDOWN_DEFAULT=0 val SCE_MARKDOWN_LINE_BEGIN=1 val SCE_MARKDOWN_STRONG1=2 val SCE_MARKDOWN_STRONG2=3 val SCE_MARKDOWN_EM1=4 val SCE_MARKDOWN_EM2=5 val SCE_MARKDOWN_HEADER1=6 val SCE_MARKDOWN_HEADER2=7 val SCE_MARKDOWN_HEADER3=8 val SCE_MARKDOWN_HEADER4=9 val SCE_MARKDOWN_HEADER5=10 val SCE_MARKDOWN_HEADER6=11 val SCE_MARKDOWN_PRECHAR=12 val SCE_MARKDOWN_ULIST_ITEM=13 val SCE_MARKDOWN_OLIST_ITEM=14 val SCE_MARKDOWN_BLOCKQUOTE=15 val SCE_MARKDOWN_STRIKEOUT=16 val SCE_MARKDOWN_HRULE=17 val SCE_MARKDOWN_LINK=18 val SCE_MARKDOWN_CODE=19 val SCE_MARKDOWN_CODE2=20 val SCE_MARKDOWN_CODEBK=21 # Lexical state for SCLEX_TXT2TAGS lex Txt2tags=SCLEX_TXT2TAGS SCE_TXT2TAGS_ val SCE_TXT2TAGS_DEFAULT=0 val SCE_TXT2TAGS_LINE_BEGIN=1 val SCE_TXT2TAGS_STRONG1=2 val SCE_TXT2TAGS_STRONG2=3 val SCE_TXT2TAGS_EM1=4 val SCE_TXT2TAGS_EM2=5 val SCE_TXT2TAGS_HEADER1=6 val SCE_TXT2TAGS_HEADER2=7 val SCE_TXT2TAGS_HEADER3=8 val SCE_TXT2TAGS_HEADER4=9 val SCE_TXT2TAGS_HEADER5=10 val SCE_TXT2TAGS_HEADER6=11 val SCE_TXT2TAGS_PRECHAR=12 val SCE_TXT2TAGS_ULIST_ITEM=13 val SCE_TXT2TAGS_OLIST_ITEM=14 val SCE_TXT2TAGS_BLOCKQUOTE=15 val SCE_TXT2TAGS_STRIKEOUT=16 val SCE_TXT2TAGS_HRULE=17 val SCE_TXT2TAGS_LINK=18 val SCE_TXT2TAGS_CODE=19 val SCE_TXT2TAGS_CODE2=20 val SCE_TXT2TAGS_CODEBK=21 val SCE_TXT2TAGS_COMMENT=22 val SCE_TXT2TAGS_OPTION=23 val SCE_TXT2TAGS_PREPROC=24 val SCE_TXT2TAGS_POSTPROC=25 # Lexical states for SCLEX_A68K lex A68k=SCLEX_A68K SCE_A68K_ val SCE_A68K_DEFAULT=0 val SCE_A68K_COMMENT=1 val SCE_A68K_NUMBER_DEC=2 val SCE_A68K_NUMBER_BIN=3 val SCE_A68K_NUMBER_HEX=4 val SCE_A68K_STRING1=5 val SCE_A68K_OPERATOR=6 val SCE_A68K_CPUINSTRUCTION=7 val SCE_A68K_EXTINSTRUCTION=8 val SCE_A68K_REGISTER=9 val SCE_A68K_DIRECTIVE=10 val SCE_A68K_MACRO_ARG=11 val SCE_A68K_LABEL=12 val SCE_A68K_STRING2=13 val SCE_A68K_IDENTIFIER=14 val SCE_A68K_MACRO_DECLARATION=15 val SCE_A68K_COMMENT_WORD=16 val SCE_A68K_COMMENT_SPECIAL=17 val SCE_A68K_COMMENT_DOXYGEN=18 # Lexical states for SCLEX_MODULA lex Modula=SCLEX_MODULA SCE_MODULA_ val SCE_MODULA_DEFAULT=0 val SCE_MODULA_COMMENT=1 val SCE_MODULA_DOXYCOMM=2 val SCE_MODULA_DOXYKEY=3 val SCE_MODULA_KEYWORD=4 val SCE_MODULA_RESERVED=5 val SCE_MODULA_NUMBER=6 val SCE_MODULA_BASENUM=7 val SCE_MODULA_FLOAT=8 val SCE_MODULA_STRING=9 val SCE_MODULA_STRSPEC=10 val SCE_MODULA_CHAR=11 val SCE_MODULA_CHARSPEC=12 val SCE_MODULA_PROC=13 val SCE_MODULA_PRAGMA=14 val SCE_MODULA_PRGKEY=15 val SCE_MODULA_OPERATOR=16 val SCE_MODULA_BADSTR=17 # Lexical states for SCLEX_COFFEESCRIPT lex CoffeeScript=SCLEX_COFFEESCRIPT SCE_COFFEESCRIPT_ val SCE_COFFEESCRIPT_DEFAULT=0 val SCE_COFFEESCRIPT_COMMENT=1 val SCE_COFFEESCRIPT_COMMENTLINE=2 val SCE_COFFEESCRIPT_COMMENTDOC=3 val SCE_COFFEESCRIPT_NUMBER=4 val SCE_COFFEESCRIPT_WORD=5 val SCE_COFFEESCRIPT_STRING=6 val SCE_COFFEESCRIPT_CHARACTER=7 val SCE_COFFEESCRIPT_UUID=8 val SCE_COFFEESCRIPT_PREPROCESSOR=9 val SCE_COFFEESCRIPT_OPERATOR=10 val SCE_COFFEESCRIPT_IDENTIFIER=11 val SCE_COFFEESCRIPT_STRINGEOL=12 val SCE_COFFEESCRIPT_VERBATIM=13 val SCE_COFFEESCRIPT_REGEX=14 val SCE_COFFEESCRIPT_COMMENTLINEDOC=15 val SCE_COFFEESCRIPT_WORD2=16 val SCE_COFFEESCRIPT_COMMENTDOCKEYWORD=17 val SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR=18 val SCE_COFFEESCRIPT_GLOBALCLASS=19 val SCE_COFFEESCRIPT_STRINGRAW=20 val SCE_COFFEESCRIPT_TRIPLEVERBATIM=21 val SCE_COFFEESCRIPT_COMMENTBLOCK=22 val SCE_COFFEESCRIPT_VERBOSE_REGEX=23 val SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT=24 val SCE_COFFEESCRIPT_INSTANCEPROPERTY=25 # Lexical states for SCLEX_AVS lex AVS=SCLEX_AVS SCE_AVS_ val SCE_AVS_DEFAULT=0 val SCE_AVS_COMMENTBLOCK=1 val SCE_AVS_COMMENTBLOCKN=2 val SCE_AVS_COMMENTLINE=3 val SCE_AVS_NUMBER=4 val SCE_AVS_OPERATOR=5 val SCE_AVS_IDENTIFIER=6 val SCE_AVS_STRING=7 val SCE_AVS_TRIPLESTRING=8 val SCE_AVS_KEYWORD=9 val SCE_AVS_FILTER=10 val SCE_AVS_PLUGIN=11 val SCE_AVS_FUNCTION=12 val SCE_AVS_CLIPPROP=13 val SCE_AVS_USERDFN=14 # Lexical states for SCLEX_ECL lex ECL=SCLEX_ECL SCE_ECL_ val SCE_ECL_DEFAULT=0 val SCE_ECL_COMMENT=1 val SCE_ECL_COMMENTLINE=2 val SCE_ECL_NUMBER=3 val SCE_ECL_STRING=4 val SCE_ECL_WORD0=5 val SCE_ECL_OPERATOR=6 val SCE_ECL_CHARACTER=7 val SCE_ECL_UUID=8 val SCE_ECL_PREPROCESSOR=9 val SCE_ECL_UNKNOWN=10 val SCE_ECL_IDENTIFIER=11 val SCE_ECL_STRINGEOL=12 val SCE_ECL_VERBATIM=13 val SCE_ECL_REGEX=14 val SCE_ECL_COMMENTLINEDOC=15 val SCE_ECL_WORD1=16 val SCE_ECL_COMMENTDOCKEYWORD=17 val SCE_ECL_COMMENTDOCKEYWORDERROR=18 val SCE_ECL_WORD2=19 val SCE_ECL_WORD3=20 val SCE_ECL_WORD4=21 val SCE_ECL_WORD5=22 val SCE_ECL_COMMENTDOC=23 val SCE_ECL_ADDED=24 val SCE_ECL_DELETED=25 val SCE_ECL_CHANGED=26 val SCE_ECL_MOVED=27 # Lexical states for SCLEX_OSCRIPT lex OScript=SCLEX_OSCRIPT SCE_OSCRIPT_ val SCE_OSCRIPT_DEFAULT=0 val SCE_OSCRIPT_LINE_COMMENT=1 val SCE_OSCRIPT_BLOCK_COMMENT=2 val SCE_OSCRIPT_DOC_COMMENT=3 val SCE_OSCRIPT_PREPROCESSOR=4 val SCE_OSCRIPT_NUMBER=5 val SCE_OSCRIPT_SINGLEQUOTE_STRING=6 val SCE_OSCRIPT_DOUBLEQUOTE_STRING=7 val SCE_OSCRIPT_CONSTANT=8 val SCE_OSCRIPT_IDENTIFIER=9 val SCE_OSCRIPT_GLOBAL=10 val SCE_OSCRIPT_KEYWORD=11 val SCE_OSCRIPT_OPERATOR=12 val SCE_OSCRIPT_LABEL=13 val SCE_OSCRIPT_TYPE=14 val SCE_OSCRIPT_FUNCTION=15 val SCE_OSCRIPT_OBJECT=16 val SCE_OSCRIPT_PROPERTY=17 val SCE_OSCRIPT_METHOD=18 # Lexical states for SCLEX_VISUALPROLOG lex VisualProlog=SCLEX_VISUALPROLOG SCE_VISUALPROLOG_ val SCE_VISUALPROLOG_DEFAULT=0 val SCE_VISUALPROLOG_KEY_MAJOR=1 val SCE_VISUALPROLOG_KEY_MINOR=2 val SCE_VISUALPROLOG_KEY_DIRECTIVE=3 val SCE_VISUALPROLOG_COMMENT_BLOCK=4 val SCE_VISUALPROLOG_COMMENT_LINE=5 val SCE_VISUALPROLOG_COMMENT_KEY=6 val SCE_VISUALPROLOG_COMMENT_KEY_ERROR=7 val SCE_VISUALPROLOG_IDENTIFIER=8 val SCE_VISUALPROLOG_VARIABLE=9 val SCE_VISUALPROLOG_ANONYMOUS=10 val SCE_VISUALPROLOG_NUMBER=11 val SCE_VISUALPROLOG_OPERATOR=12 val SCE_VISUALPROLOG_UNUSED1=13 val SCE_VISUALPROLOG_UNUSED2=14 val SCE_VISUALPROLOG_UNUSED3=15 val SCE_VISUALPROLOG_STRING_QUOTE=16 val SCE_VISUALPROLOG_STRING_ESCAPE=17 val SCE_VISUALPROLOG_STRING_ESCAPE_ERROR=18 val SCE_VISUALPROLOG_UNUSED4=19 val SCE_VISUALPROLOG_STRING=20 val SCE_VISUALPROLOG_UNUSED5=21 val SCE_VISUALPROLOG_STRING_EOL=22 val SCE_VISUALPROLOG_EMBEDDED=23 val SCE_VISUALPROLOG_PLACEHOLDER=24 # Lexical states for SCLEX_STTXT lex StructuredText=SCLEX_STTXT SCE_STTXT_ val SCE_STTXT_DEFAULT=0 val SCE_STTXT_COMMENT=1 val SCE_STTXT_COMMENTLINE=2 val SCE_STTXT_KEYWORD=3 val SCE_STTXT_TYPE=4 val SCE_STTXT_FUNCTION=5 val SCE_STTXT_FB=6 val SCE_STTXT_NUMBER=7 val SCE_STTXT_HEXNUMBER=8 val SCE_STTXT_PRAGMA=9 val SCE_STTXT_OPERATOR=10 val SCE_STTXT_CHARACTER=11 val SCE_STTXT_STRING1=12 val SCE_STTXT_STRING2=13 val SCE_STTXT_STRINGEOL=14 val SCE_STTXT_IDENTIFIER=15 val SCE_STTXT_DATETIME=16 val SCE_STTXT_VARS=17 val SCE_STTXT_PRAGMAS=18 # Lexical states for SCLEX_KVIRC lex KVIrc=SCLEX_KVIRC SCE_KVIRC_ val SCE_KVIRC_DEFAULT=0 val SCE_KVIRC_COMMENT=1 val SCE_KVIRC_COMMENTBLOCK=2 val SCE_KVIRC_STRING=3 val SCE_KVIRC_WORD=4 val SCE_KVIRC_KEYWORD=5 val SCE_KVIRC_FUNCTION_KEYWORD=6 val SCE_KVIRC_FUNCTION=7 val SCE_KVIRC_VARIABLE=8 val SCE_KVIRC_NUMBER=9 val SCE_KVIRC_OPERATOR=10 val SCE_KVIRC_STRING_FUNCTION=11 val SCE_KVIRC_STRING_VARIABLE=12 # Lexical states for SCLEX_RUST lex Rust=SCLEX_RUST SCE_RUST_ val SCE_RUST_DEFAULT=0 val SCE_RUST_COMMENTBLOCK=1 val SCE_RUST_COMMENTLINE=2 val SCE_RUST_COMMENTBLOCKDOC=3 val SCE_RUST_COMMENTLINEDOC=4 val SCE_RUST_NUMBER=5 val SCE_RUST_WORD=6 val SCE_RUST_WORD2=7 val SCE_RUST_WORD3=8 val SCE_RUST_WORD4=9 val SCE_RUST_WORD5=10 val SCE_RUST_WORD6=11 val SCE_RUST_WORD7=12 val SCE_RUST_STRING=13 val SCE_RUST_STRINGR=14 val SCE_RUST_CHARACTER=15 val SCE_RUST_OPERATOR=16 val SCE_RUST_IDENTIFIER=17 val SCE_RUST_LIFETIME=18 val SCE_RUST_MACRO=19 val SCE_RUST_LEXERROR=20 val SCE_RUST_BYTESTRING=21 val SCE_RUST_BYTESTRINGR=22 val SCE_RUST_BYTECHARACTER=23 # Lexical states for SCLEX_DMAP lex DMAP=SCLEX_DMAP SCE_DMAP_ val SCE_DMAP_DEFAULT=0 val SCE_DMAP_COMMENT=1 val SCE_DMAP_NUMBER=2 val SCE_DMAP_STRING1=3 val SCE_DMAP_STRING2=4 val SCE_DMAP_STRINGEOL=5 val SCE_DMAP_OPERATOR=6 val SCE_DMAP_IDENTIFIER=7 val SCE_DMAP_WORD=8 val SCE_DMAP_WORD2=9 val SCE_DMAP_WORD3=10 # Lexical states for SCLEX_DMIS lex DMIS=SCLEX_DMIS SCE_DMIS_ val SCE_DMIS_DEFAULT=0 val SCE_DMIS_COMMENT=1 val SCE_DMIS_STRING=2 val SCE_DMIS_NUMBER=3 val SCE_DMIS_KEYWORD=4 val SCE_DMIS_MAJORWORD=5 val SCE_DMIS_MINORWORD=6 val SCE_DMIS_UNSUPPORTED_MAJOR=7 val SCE_DMIS_UNSUPPORTED_MINOR=8 val SCE_DMIS_LABEL=9 # Lexical states for SCLEX_REGISTRY lex REG=SCLEX_REGISTRY SCE_REG_ val SCE_REG_DEFAULT=0 val SCE_REG_COMMENT=1 val SCE_REG_VALUENAME=2 val SCE_REG_STRING=3 val SCE_REG_HEXDIGIT=4 val SCE_REG_VALUETYPE=5 val SCE_REG_ADDEDKEY=6 val SCE_REG_DELETEDKEY=7 val SCE_REG_ESCAPED=8 val SCE_REG_KEYPATH_GUID=9 val SCE_REG_STRING_GUID=10 val SCE_REG_PARAMETER=11 val SCE_REG_OPERATOR=12 # Lexical state for SCLEX_BIBTEX lex BibTeX=SCLEX_BIBTEX SCE_BIBTEX_ val SCE_BIBTEX_DEFAULT=0 val SCE_BIBTEX_ENTRY=1 val SCE_BIBTEX_UNKNOWN_ENTRY=2 val SCE_BIBTEX_KEY=3 val SCE_BIBTEX_PARAMETER=4 val SCE_BIBTEX_VALUE=5 val SCE_BIBTEX_COMMENT=6 # Lexical state for SCLEX_SREC lex Srec=SCLEX_SREC SCE_HEX_ val SCE_HEX_DEFAULT=0 val SCE_HEX_RECSTART=1 val SCE_HEX_RECTYPE=2 val SCE_HEX_RECTYPE_UNKNOWN=3 val SCE_HEX_BYTECOUNT=4 val SCE_HEX_BYTECOUNT_WRONG=5 val SCE_HEX_NOADDRESS=6 val SCE_HEX_DATAADDRESS=7 val SCE_HEX_RECCOUNT=8 val SCE_HEX_STARTADDRESS=9 val SCE_HEX_ADDRESSFIELD_UNKNOWN=10 val SCE_HEX_EXTENDEDADDRESS=11 val SCE_HEX_DATA_ODD=12 val SCE_HEX_DATA_EVEN=13 val SCE_HEX_DATA_UNKNOWN=14 val SCE_HEX_DATA_EMPTY=15 val SCE_HEX_CHECKSUM=16 val SCE_HEX_CHECKSUM_WRONG=17 val SCE_HEX_GARBAGE=18 # Lexical state for SCLEX_IHEX (shared with Srec) lex IHex=SCLEX_IHEX SCE_HEX_ # Lexical state for SCLEX_TEHEX (shared with Srec) lex TEHex=SCLEX_TEHEX SCE_HEX_ # Lexical states for SCLEX_JSON lex JSON=SCLEX_JSON SCE_JSON_ val SCE_JSON_DEFAULT=0 val SCE_JSON_NUMBER=1 val SCE_JSON_STRING=2 val SCE_JSON_STRINGEOL=3 val SCE_JSON_PROPERTYNAME=4 val SCE_JSON_ESCAPESEQUENCE=5 val SCE_JSON_LINECOMMENT=6 val SCE_JSON_BLOCKCOMMENT=7 val SCE_JSON_OPERATOR=8 val SCE_JSON_URI=9 val SCE_JSON_COMPACTIRI=10 val SCE_JSON_KEYWORD=11 val SCE_JSON_LDKEYWORD=12 val SCE_JSON_ERROR=13 lex EDIFACT=SCLEX_EDIFACT SCE_EDI_ val SCE_EDI_DEFAULT=0 val SCE_EDI_SEGMENTSTART=1 val SCE_EDI_SEGMENTEND=2 val SCE_EDI_SEP_ELEMENT=3 val SCE_EDI_SEP_COMPOSITE=4 val SCE_EDI_SEP_RELEASE=5 val SCE_EDI_UNA=6 val SCE_EDI_UNH=7 val SCE_EDI_BADSEGMENT=8 # Lexical states for SCLEX_STATA lex STATA=SCLEX_STATA SCE_STATA_ val SCE_STATA_DEFAULT=0 val SCE_STATA_COMMENT=1 val SCE_STATA_COMMENTLINE=2 val SCE_STATA_COMMENTBLOCK=3 val SCE_STATA_NUMBER=4 val SCE_STATA_OPERATOR=5 val SCE_STATA_IDENTIFIER=6 val SCE_STATA_STRING=7 val SCE_STATA_TYPE=8 val SCE_STATA_WORD=9 val SCE_STATA_GLOBAL_MACRO=10 val SCE_STATA_MACRO=11 # Lexical states for SCLEX_SAS lex SAS=SCLEX_SAS SCE_SAS_ val SCE_SAS_DEFAULT=0 val SCE_SAS_COMMENT=1 val SCE_SAS_COMMENTLINE=2 val SCE_SAS_COMMENTBLOCK=3 val SCE_SAS_NUMBER=4 val SCE_SAS_OPERATOR=5 val SCE_SAS_IDENTIFIER=6 val SCE_SAS_STRING=7 val SCE_SAS_TYPE=8 val SCE_SAS_WORD=9 val SCE_SAS_GLOBAL_MACRO=10 val SCE_SAS_MACRO=11 val SCE_SAS_MACRO_KEYWORD=12 val SCE_SAS_BLOCK_KEYWORD=13 val SCE_SAS_MACRO_FUNCTION=14 val SCE_SAS_STATEMENT=15 # Lexical states for SCLEX_NIM lex Nim=SCLEX_NIM SCE_NIM_ val SCE_NIM_DEFAULT=0 val SCE_NIM_COMMENT=1 val SCE_NIM_COMMENTDOC=2 val SCE_NIM_COMMENTLINE=3 val SCE_NIM_COMMENTLINEDOC=4 val SCE_NIM_NUMBER=5 val SCE_NIM_STRING=6 val SCE_NIM_CHARACTER=7 val SCE_NIM_WORD=8 val SCE_NIM_TRIPLE=9 val SCE_NIM_TRIPLEDOUBLE=10 val SCE_NIM_BACKTICKS=11 val SCE_NIM_FUNCNAME=12 val SCE_NIM_STRINGEOL=13 val SCE_NIM_NUMERROR=14 val SCE_NIM_OPERATOR=15 val SCE_NIM_IDENTIFIER=16 # Lexical states for SCLEX_CIL lex CIL=SCLEX_CIL SCE_CIL_ val SCE_CIL_DEFAULT=0 val SCE_CIL_COMMENT=1 val SCE_CIL_COMMENTLINE=2 val SCE_CIL_WORD=3 val SCE_CIL_WORD2=4 val SCE_CIL_WORD3=5 val SCE_CIL_STRING=6 val SCE_CIL_LABEL=7 val SCE_CIL_OPERATOR=8 val SCE_CIL_IDENTIFIER=9 val SCE_CIL_STRINGEOL=10 # Lexical states for SCLEX_X12 lex X12=SCLEX_X12 SCE_X12_ val SCE_X12_DEFAULT=0 val SCE_X12_BAD=1 val SCE_X12_ENVELOPE=2 val SCE_X12_FUNCTIONGROUP=3 val SCE_X12_TRANSACTIONSET=4 val SCE_X12_SEGMENTHEADER=5 val SCE_X12_SEGMENTEND=6 val SCE_X12_SEP_ELEMENT=7 val SCE_X12_SEP_SUBELEMENT=8 # Lexical states for SCLEX_DATAFLEX lex Dataflex=SCLEX_DATAFLEX SCE_DF_ val SCE_DF_DEFAULT=0 val SCE_DF_IDENTIFIER=1 val SCE_DF_METATAG=2 val SCE_DF_IMAGE=3 val SCE_DF_COMMENTLINE=4 val SCE_DF_PREPROCESSOR=5 val SCE_DF_PREPROCESSOR2=6 val SCE_DF_NUMBER=7 val SCE_DF_HEXNUMBER=8 val SCE_DF_WORD=9 val SCE_DF_STRING=10 val SCE_DF_STRINGEOL=11 val SCE_DF_SCOPEWORD=12 val SCE_DF_OPERATOR=13 val SCE_DF_ICODE=14 # Lexical states for SCLEX_HOLLYWOOD lex Hollywood=SCLEX_HOLLYWOOD SCE_HOLLYWOOD_ val SCE_HOLLYWOOD_DEFAULT=0 val SCE_HOLLYWOOD_COMMENT=1 val SCE_HOLLYWOOD_COMMENTBLOCK=2 val SCE_HOLLYWOOD_NUMBER=3 val SCE_HOLLYWOOD_KEYWORD=4 val SCE_HOLLYWOOD_STDAPI=5 val SCE_HOLLYWOOD_PLUGINAPI=6 val SCE_HOLLYWOOD_PLUGINMETHOD=7 val SCE_HOLLYWOOD_STRING=8 val SCE_HOLLYWOOD_STRINGBLOCK=9 val SCE_HOLLYWOOD_PREPROCESSOR=10 val SCE_HOLLYWOOD_OPERATOR=11 val SCE_HOLLYWOOD_IDENTIFIER=12 val SCE_HOLLYWOOD_CONSTANT=13 val SCE_HOLLYWOOD_HEXNUMBER=14 # Lexical states for SCLEX_RAKU lex Raku=SCLEX_RAKU SCE_RAKU_ val SCE_RAKU_DEFAULT=0 val SCE_RAKU_ERROR=1 val SCE_RAKU_COMMENTLINE=2 val SCE_RAKU_COMMENTEMBED=3 val SCE_RAKU_POD=4 val SCE_RAKU_CHARACTER=5 val SCE_RAKU_HEREDOC_Q=6 val SCE_RAKU_HEREDOC_QQ=7 val SCE_RAKU_STRING=8 val SCE_RAKU_STRING_Q=9 val SCE_RAKU_STRING_QQ=10 val SCE_RAKU_STRING_Q_LANG=11 val SCE_RAKU_STRING_VAR=12 val SCE_RAKU_REGEX=13 val SCE_RAKU_REGEX_VAR=14 val SCE_RAKU_ADVERB=15 val SCE_RAKU_NUMBER=16 val SCE_RAKU_PREPROCESSOR=17 val SCE_RAKU_OPERATOR=18 val SCE_RAKU_WORD=19 val SCE_RAKU_FUNCTION=20 val SCE_RAKU_IDENTIFIER=21 val SCE_RAKU_TYPEDEF=22 val SCE_RAKU_MU=23 val SCE_RAKU_POSITIONAL=24 val SCE_RAKU_ASSOCIATIVE=25 val SCE_RAKU_CALLABLE=26 val SCE_RAKU_GRAMMAR=27 val SCE_RAKU_CLASS=28 # Lexical states for SCLEX_FSHARP lex FSharp=SCLEX_FSHARP SCE_FSHARP_ val SCE_FSHARP_DEFAULT=0 val SCE_FSHARP_KEYWORD=1 val SCE_FSHARP_KEYWORD2=2 val SCE_FSHARP_KEYWORD3=3 val SCE_FSHARP_KEYWORD4=4 val SCE_FSHARP_KEYWORD5=5 val SCE_FSHARP_IDENTIFIER=6 val SCE_FSHARP_QUOT_IDENTIFIER=7 val SCE_FSHARP_COMMENT=8 val SCE_FSHARP_COMMENTLINE=9 val SCE_FSHARP_PREPROCESSOR=10 val SCE_FSHARP_LINENUM=11 val SCE_FSHARP_OPERATOR=12 val SCE_FSHARP_NUMBER=13 val SCE_FSHARP_CHARACTER=14 val SCE_FSHARP_STRING=15 val SCE_FSHARP_VERBATIM=16 val SCE_FSHARP_QUOTATION=17 val SCE_FSHARP_ATTRIBUTE=18 val SCE_FSHARP_FORMAT_SPEC=19 # Lexical states for SCLEX_ASCIIDOC lex Asciidoc=SCLEX_ASCIIDOC SCE_ASCIIDOC_ val SCE_ASCIIDOC_DEFAULT=0 val SCE_ASCIIDOC_STRONG1=1 val SCE_ASCIIDOC_STRONG2=2 val SCE_ASCIIDOC_EM1=3 val SCE_ASCIIDOC_EM2=4 val SCE_ASCIIDOC_HEADER1=5 val SCE_ASCIIDOC_HEADER2=6 val SCE_ASCIIDOC_HEADER3=7 val SCE_ASCIIDOC_HEADER4=8 val SCE_ASCIIDOC_HEADER5=9 val SCE_ASCIIDOC_HEADER6=10 val SCE_ASCIIDOC_ULIST_ITEM=11 val SCE_ASCIIDOC_OLIST_ITEM=12 val SCE_ASCIIDOC_BLOCKQUOTE=13 val SCE_ASCIIDOC_LINK=14 val SCE_ASCIIDOC_CODEBK=15 val SCE_ASCIIDOC_PASSBK=16 val SCE_ASCIIDOC_COMMENT=17 val SCE_ASCIIDOC_COMMENTBK=18 val SCE_ASCIIDOC_LITERAL=19 val SCE_ASCIIDOC_LITERALBK=20 val SCE_ASCIIDOC_ATTRIB=21 val SCE_ASCIIDOC_ATTRIBVAL=22 val SCE_ASCIIDOC_MACRO=23 # Lexical states for SCLEX_GDSCRIPT lex GDScript=SCLEX_GDSCRIPT SCE_GD_ val SCE_GD_DEFAULT=0 val SCE_GD_COMMENTLINE=1 val SCE_GD_NUMBER=2 val SCE_GD_STRING=3 val SCE_GD_CHARACTER=4 val SCE_GD_WORD=5 val SCE_GD_TRIPLE=6 val SCE_GD_TRIPLEDOUBLE=7 val SCE_GD_CLASSNAME=8 val SCE_GD_FUNCNAME=9 val SCE_GD_OPERATOR=10 val SCE_GD_IDENTIFIER=11 val SCE_GD_COMMENTBLOCK=12 val SCE_GD_STRINGEOL=13 val SCE_GD_WORD2=14 val SCE_GD_ANNOTATION=15 val SCE_GD_NODEPATH=16 ================================================ FILE: lexilla/include/Lexilla.h ================================================ // 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 // The License.txt file describes the conditions under which this software may be distributed. #ifndef LEXILLA_H #define LEXILLA_H // Define the default Lexilla shared library name for each platform #if defined(_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 defined(_WIN32) #define LEXILLA_CALL __stdcall #else #define LEXILLA_CALL #endif #if defined(__OBJC2__) // Objective C(++) treats '[' as a message expression. #define DEPRECATE_DEFINITION #elif defined(__cplusplus) #define DEPRECATE_DEFINITION [[deprecated]] #elif defined(__GNUC__) || defined(__clang__) #define DEPRECATE_DEFINITION __attribute__((deprecated)) #else // MSVC __declspec(deprecated) has different positioning rules to GCC so define to nothing #define DEPRECATE_DEFINITION #endif #if defined(__cplusplus) // Must have already included ILexer.h to have Scintilla::ILexer5 defined. using Scintilla::ILexer5; #else typedef void ILexer5; #endif typedef ILexer5 *(*LexerFactoryFunction)(void); #if defined(__cplusplus) namespace Lexilla { #endif typedef int (LEXILLA_CALL *GetLexerCountFn)(void); 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); DEPRECATE_DEFINITION typedef const char *(LEXILLA_CALL *LexerNameFromIDFn)(int identifier); typedef const char *(LEXILLA_CALL *GetLibraryPropertyNamesFn)(void); typedef void(LEXILLA_CALL *SetLibraryPropertyFn)(const char *key, const char *value); typedef const char *(LEXILLA_CALL *GetNameSpaceFn)(void); #if defined(__cplusplus) } #endif #define LEXILLA_NAMESPACE_SEPARATOR '.' #define LEXILLA_GETLEXERCOUNT "GetLexerCount" #define LEXILLA_GETLEXERNAME "GetLexerName" #define LEXILLA_GETLEXERFACTORY "GetLexerFactory" #define LEXILLA_CREATELEXER "CreateLexer" #define LEXILLA_LEXERNAMEFROMID "LexerNameFromID" #define LEXILLA_GETLIBRARYPROPERTYNAMES "GetLibraryPropertyNames" #define LEXILLA_SETLIBRARYPROPERTY "SetLibraryProperty" #define LEXILLA_GETNAMESPACE "GetNameSpace" // Static linking prototypes #if defined(__cplusplus) extern "C" { #endif ILexer5 * LEXILLA_CALL CreateLexer(const char *name); int LEXILLA_CALL GetLexerCount(void); void LEXILLA_CALL GetLexerName(unsigned int index, char *name, int buflength); LexerFactoryFunction LEXILLA_CALL GetLexerFactory(unsigned int index); DEPRECATE_DEFINITION const char *LEXILLA_CALL LexerNameFromID(int identifier); const char * LEXILLA_CALL GetLibraryPropertyNames(void); void LEXILLA_CALL SetLibraryProperty(const char *key, const char *value); const char *LEXILLA_CALL GetNameSpace(void); #if defined(__cplusplus) } #endif #if defined(__cplusplus) namespace Lexilla { class LexerModule; } // Add a static lexer (in the same binary) to Lexilla's list void AddStaticLexerModule(Lexilla::LexerModule *plm); #endif #endif ================================================ FILE: lexilla/include/SciLexer.h ================================================ /* Scintilla source code edit control */ /** @file SciLexer.h ** Interface to the added lexer functions in the SciLexer version of the edit control. **/ /* Copyright 1998-2002 by Neil Hodgson * The License.txt file describes the conditions under which this software may be distributed. */ /* Most of this file is automatically generated from the Scintilla.iface interface definition * file which contains any comments about the definitions. HFacer.py does the generation. */ #ifndef SCILEXER_H #define SCILEXER_H /* SciLexer features - not in standard Scintilla */ /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */ #define SCLEX_CONTAINER 0 #define SCLEX_NULL 1 #define SCLEX_PYTHON 2 #define SCLEX_CPP 3 #define SCLEX_HTML 4 #define SCLEX_XML 5 #define SCLEX_PERL 6 #define SCLEX_SQL 7 #define SCLEX_VB 8 #define SCLEX_PROPERTIES 9 #define SCLEX_ERRORLIST 10 #define SCLEX_MAKEFILE 11 #define SCLEX_BATCH 12 #define SCLEX_XCODE 13 #define SCLEX_LATEX 14 #define SCLEX_LUA 15 #define SCLEX_DIFF 16 #define SCLEX_CONF 17 #define SCLEX_PASCAL 18 #define SCLEX_AVE 19 #define SCLEX_ADA 20 #define SCLEX_LISP 21 #define SCLEX_RUBY 22 #define SCLEX_EIFFEL 23 #define SCLEX_EIFFELKW 24 #define SCLEX_TCL 25 #define SCLEX_NNCRONTAB 26 #define SCLEX_BULLANT 27 #define SCLEX_VBSCRIPT 28 #define SCLEX_BAAN 31 #define SCLEX_MATLAB 32 #define SCLEX_SCRIPTOL 33 #define SCLEX_ASM 34 #define SCLEX_CPPNOCASE 35 #define SCLEX_FORTRAN 36 #define SCLEX_F77 37 #define SCLEX_CSS 38 #define SCLEX_POV 39 #define SCLEX_LOUT 40 #define SCLEX_ESCRIPT 41 #define SCLEX_PS 42 #define SCLEX_NSIS 43 #define SCLEX_MMIXAL 44 #define SCLEX_CLW 45 #define SCLEX_CLWNOCASE 46 #define SCLEX_LOT 47 #define SCLEX_YAML 48 #define SCLEX_TEX 49 #define SCLEX_METAPOST 50 #define SCLEX_POWERBASIC 51 #define SCLEX_FORTH 52 #define SCLEX_ERLANG 53 #define SCLEX_OCTAVE 54 #define SCLEX_MSSQL 55 #define SCLEX_VERILOG 56 #define SCLEX_KIX 57 #define SCLEX_GUI4CLI 58 #define SCLEX_SPECMAN 59 #define SCLEX_AU3 60 #define SCLEX_APDL 61 #define SCLEX_BASH 62 #define SCLEX_ASN1 63 #define SCLEX_VHDL 64 #define SCLEX_CAML 65 #define SCLEX_BLITZBASIC 66 #define SCLEX_PUREBASIC 67 #define SCLEX_HASKELL 68 #define SCLEX_PHPSCRIPT 69 #define SCLEX_TADS3 70 #define SCLEX_REBOL 71 #define SCLEX_SMALLTALK 72 #define SCLEX_FLAGSHIP 73 #define SCLEX_CSOUND 74 #define SCLEX_FREEBASIC 75 #define SCLEX_INNOSETUP 76 #define SCLEX_OPAL 77 #define SCLEX_SPICE 78 #define SCLEX_D 79 #define SCLEX_CMAKE 80 #define SCLEX_GAP 81 #define SCLEX_PLM 82 #define SCLEX_PROGRESS 83 #define SCLEX_ABAQUS 84 #define SCLEX_ASYMPTOTE 85 #define SCLEX_R 86 #define SCLEX_MAGIK 87 #define SCLEX_POWERSHELL 88 #define SCLEX_MYSQL 89 #define SCLEX_PO 90 #define SCLEX_TAL 91 #define SCLEX_COBOL 92 #define SCLEX_TACL 93 #define SCLEX_SORCUS 94 #define SCLEX_POWERPRO 95 #define SCLEX_NIMROD 96 #define SCLEX_SML 97 #define SCLEX_MARKDOWN 98 #define SCLEX_TXT2TAGS 99 #define SCLEX_A68K 100 #define SCLEX_MODULA 101 #define SCLEX_COFFEESCRIPT 102 #define SCLEX_TCMD 103 #define SCLEX_AVS 104 #define SCLEX_ECL 105 #define SCLEX_OSCRIPT 106 #define SCLEX_VISUALPROLOG 107 #define SCLEX_LITERATEHASKELL 108 #define SCLEX_STTXT 109 #define SCLEX_KVIRC 110 #define SCLEX_RUST 111 #define SCLEX_DMAP 112 #define SCLEX_AS 113 #define SCLEX_DMIS 114 #define SCLEX_REGISTRY 115 #define SCLEX_BIBTEX 116 #define SCLEX_SREC 117 #define SCLEX_IHEX 118 #define SCLEX_TEHEX 119 #define SCLEX_JSON 120 #define SCLEX_EDIFACT 121 #define SCLEX_INDENT 122 #define SCLEX_MAXIMA 123 #define SCLEX_STATA 124 #define SCLEX_SAS 125 #define SCLEX_NIM 126 #define SCLEX_CIL 127 #define SCLEX_X12 128 #define SCLEX_DATAFLEX 129 #define SCLEX_HOLLYWOOD 130 #define SCLEX_RAKU 131 #define SCLEX_FSHARP 132 #define SCLEX_JULIA 133 #define SCLEX_ASCIIDOC 134 #define SCLEX_GDSCRIPT 135 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 #define SCE_P_NUMBER 2 #define SCE_P_STRING 3 #define SCE_P_CHARACTER 4 #define SCE_P_WORD 5 #define SCE_P_TRIPLE 6 #define SCE_P_TRIPLEDOUBLE 7 #define SCE_P_CLASSNAME 8 #define SCE_P_DEFNAME 9 #define SCE_P_OPERATOR 10 #define SCE_P_IDENTIFIER 11 #define SCE_P_COMMENTBLOCK 12 #define SCE_P_STRINGEOL 13 #define SCE_P_WORD2 14 #define SCE_P_DECORATOR 15 #define SCE_P_FSTRING 16 #define SCE_P_FCHARACTER 17 #define SCE_P_FTRIPLE 18 #define SCE_P_FTRIPLEDOUBLE 19 #define SCE_P_ATTRIBUTE 20 #define SCE_C_DEFAULT 0 #define SCE_C_COMMENT 1 #define SCE_C_COMMENTLINE 2 #define SCE_C_COMMENTDOC 3 #define SCE_C_NUMBER 4 #define SCE_C_WORD 5 #define SCE_C_STRING 6 #define SCE_C_CHARACTER 7 #define SCE_C_UUID 8 #define SCE_C_PREPROCESSOR 9 #define SCE_C_OPERATOR 10 #define SCE_C_IDENTIFIER 11 #define SCE_C_STRINGEOL 12 #define SCE_C_VERBATIM 13 #define SCE_C_REGEX 14 #define SCE_C_COMMENTLINEDOC 15 #define SCE_C_WORD2 16 #define SCE_C_COMMENTDOCKEYWORD 17 #define SCE_C_COMMENTDOCKEYWORDERROR 18 #define SCE_C_GLOBALCLASS 19 #define SCE_C_STRINGRAW 20 #define SCE_C_TRIPLEVERBATIM 21 #define SCE_C_HASHQUOTEDSTRING 22 #define SCE_C_PREPROCESSORCOMMENT 23 #define SCE_C_PREPROCESSORCOMMENTDOC 24 #define SCE_C_USERLITERAL 25 #define SCE_C_TASKMARKER 26 #define SCE_C_ESCAPESEQUENCE 27 #define SCE_D_DEFAULT 0 #define SCE_D_COMMENT 1 #define SCE_D_COMMENTLINE 2 #define SCE_D_COMMENTDOC 3 #define SCE_D_COMMENTNESTED 4 #define SCE_D_NUMBER 5 #define SCE_D_WORD 6 #define SCE_D_WORD2 7 #define SCE_D_WORD3 8 #define SCE_D_TYPEDEF 9 #define SCE_D_STRING 10 #define SCE_D_STRINGEOL 11 #define SCE_D_CHARACTER 12 #define SCE_D_OPERATOR 13 #define SCE_D_IDENTIFIER 14 #define SCE_D_COMMENTLINEDOC 15 #define SCE_D_COMMENTDOCKEYWORD 16 #define SCE_D_COMMENTDOCKEYWORDERROR 17 #define SCE_D_STRINGB 18 #define SCE_D_STRINGR 19 #define SCE_D_WORD5 20 #define SCE_D_WORD6 21 #define SCE_D_WORD7 22 #define SCE_TCL_DEFAULT 0 #define SCE_TCL_COMMENT 1 #define SCE_TCL_COMMENTLINE 2 #define SCE_TCL_NUMBER 3 #define SCE_TCL_WORD_IN_QUOTE 4 #define SCE_TCL_IN_QUOTE 5 #define SCE_TCL_OPERATOR 6 #define SCE_TCL_IDENTIFIER 7 #define SCE_TCL_SUBSTITUTION 8 #define SCE_TCL_SUB_BRACE 9 #define SCE_TCL_MODIFIER 10 #define SCE_TCL_EXPAND 11 #define SCE_TCL_WORD 12 #define SCE_TCL_WORD2 13 #define SCE_TCL_WORD3 14 #define SCE_TCL_WORD4 15 #define SCE_TCL_WORD5 16 #define SCE_TCL_WORD6 17 #define SCE_TCL_WORD7 18 #define SCE_TCL_WORD8 19 #define SCE_TCL_COMMENT_BOX 20 #define SCE_TCL_BLOCK_COMMENT 21 #define SCE_H_DEFAULT 0 #define SCE_H_TAG 1 #define SCE_H_TAGUNKNOWN 2 #define SCE_H_ATTRIBUTE 3 #define SCE_H_ATTRIBUTEUNKNOWN 4 #define SCE_H_NUMBER 5 #define SCE_H_DOUBLESTRING 6 #define SCE_H_SINGLESTRING 7 #define SCE_H_OTHER 8 #define SCE_H_COMMENT 9 #define SCE_H_ENTITY 10 #define SCE_H_TAGEND 11 #define SCE_H_XMLSTART 12 #define SCE_H_XMLEND 13 #define SCE_H_SCRIPT 14 #define SCE_H_ASP 15 #define SCE_H_ASPAT 16 #define SCE_H_CDATA 17 #define SCE_H_QUESTION 18 #define SCE_H_VALUE 19 #define SCE_H_XCCOMMENT 20 #define SCE_H_SGML_DEFAULT 21 #define SCE_H_SGML_COMMAND 22 #define SCE_H_SGML_1ST_PARAM 23 #define SCE_H_SGML_DOUBLESTRING 24 #define SCE_H_SGML_SIMPLESTRING 25 #define SCE_H_SGML_ERROR 26 #define SCE_H_SGML_SPECIAL 27 #define SCE_H_SGML_ENTITY 28 #define SCE_H_SGML_COMMENT 29 #define SCE_H_SGML_1ST_PARAM_COMMENT 30 #define SCE_H_SGML_BLOCK_DEFAULT 31 #define SCE_HJ_START 40 #define SCE_HJ_DEFAULT 41 #define SCE_HJ_COMMENT 42 #define SCE_HJ_COMMENTLINE 43 #define SCE_HJ_COMMENTDOC 44 #define SCE_HJ_NUMBER 45 #define SCE_HJ_WORD 46 #define SCE_HJ_KEYWORD 47 #define SCE_HJ_DOUBLESTRING 48 #define SCE_HJ_SINGLESTRING 49 #define SCE_HJ_SYMBOLS 50 #define SCE_HJ_STRINGEOL 51 #define SCE_HJ_REGEX 52 #define SCE_HJA_START 55 #define SCE_HJA_DEFAULT 56 #define SCE_HJA_COMMENT 57 #define SCE_HJA_COMMENTLINE 58 #define SCE_HJA_COMMENTDOC 59 #define SCE_HJA_NUMBER 60 #define SCE_HJA_WORD 61 #define SCE_HJA_KEYWORD 62 #define SCE_HJA_DOUBLESTRING 63 #define SCE_HJA_SINGLESTRING 64 #define SCE_HJA_SYMBOLS 65 #define SCE_HJA_STRINGEOL 66 #define SCE_HJA_REGEX 67 #define SCE_HB_START 70 #define SCE_HB_DEFAULT 71 #define SCE_HB_COMMENTLINE 72 #define SCE_HB_NUMBER 73 #define SCE_HB_WORD 74 #define SCE_HB_STRING 75 #define SCE_HB_IDENTIFIER 76 #define SCE_HB_STRINGEOL 77 #define SCE_HBA_START 80 #define SCE_HBA_DEFAULT 81 #define SCE_HBA_COMMENTLINE 82 #define SCE_HBA_NUMBER 83 #define SCE_HBA_WORD 84 #define SCE_HBA_STRING 85 #define SCE_HBA_IDENTIFIER 86 #define SCE_HBA_STRINGEOL 87 #define SCE_HP_START 90 #define SCE_HP_DEFAULT 91 #define SCE_HP_COMMENTLINE 92 #define SCE_HP_NUMBER 93 #define SCE_HP_STRING 94 #define SCE_HP_CHARACTER 95 #define SCE_HP_WORD 96 #define SCE_HP_TRIPLE 97 #define SCE_HP_TRIPLEDOUBLE 98 #define SCE_HP_CLASSNAME 99 #define SCE_HP_DEFNAME 100 #define SCE_HP_OPERATOR 101 #define SCE_HP_IDENTIFIER 102 #define SCE_HPHP_COMPLEX_VARIABLE 104 #define SCE_HPA_START 105 #define SCE_HPA_DEFAULT 106 #define SCE_HPA_COMMENTLINE 107 #define SCE_HPA_NUMBER 108 #define SCE_HPA_STRING 109 #define SCE_HPA_CHARACTER 110 #define SCE_HPA_WORD 111 #define SCE_HPA_TRIPLE 112 #define SCE_HPA_TRIPLEDOUBLE 113 #define SCE_HPA_CLASSNAME 114 #define SCE_HPA_DEFNAME 115 #define SCE_HPA_OPERATOR 116 #define SCE_HPA_IDENTIFIER 117 #define SCE_HPHP_DEFAULT 118 #define SCE_HPHP_HSTRING 119 #define SCE_HPHP_SIMPLESTRING 120 #define SCE_HPHP_WORD 121 #define SCE_HPHP_NUMBER 122 #define SCE_HPHP_VARIABLE 123 #define SCE_HPHP_COMMENT 124 #define SCE_HPHP_COMMENTLINE 125 #define SCE_HPHP_HSTRING_VARIABLE 126 #define SCE_HPHP_OPERATOR 127 #define SCE_PL_DEFAULT 0 #define SCE_PL_ERROR 1 #define SCE_PL_COMMENTLINE 2 #define SCE_PL_POD 3 #define SCE_PL_NUMBER 4 #define SCE_PL_WORD 5 #define SCE_PL_STRING 6 #define SCE_PL_CHARACTER 7 #define SCE_PL_PUNCTUATION 8 #define SCE_PL_PREPROCESSOR 9 #define SCE_PL_OPERATOR 10 #define SCE_PL_IDENTIFIER 11 #define SCE_PL_SCALAR 12 #define SCE_PL_ARRAY 13 #define SCE_PL_HASH 14 #define SCE_PL_SYMBOLTABLE 15 #define SCE_PL_VARIABLE_INDEXER 16 #define SCE_PL_REGEX 17 #define SCE_PL_REGSUBST 18 #define SCE_PL_LONGQUOTE 19 #define SCE_PL_BACKTICKS 20 #define SCE_PL_DATASECTION 21 #define SCE_PL_HERE_DELIM 22 #define SCE_PL_HERE_Q 23 #define SCE_PL_HERE_QQ 24 #define SCE_PL_HERE_QX 25 #define SCE_PL_STRING_Q 26 #define SCE_PL_STRING_QQ 27 #define SCE_PL_STRING_QX 28 #define SCE_PL_STRING_QR 29 #define SCE_PL_STRING_QW 30 #define SCE_PL_POD_VERB 31 #define SCE_PL_SUB_PROTOTYPE 40 #define SCE_PL_FORMAT_IDENT 41 #define SCE_PL_FORMAT 42 #define SCE_PL_STRING_VAR 43 #define SCE_PL_XLAT 44 #define SCE_PL_REGEX_VAR 54 #define SCE_PL_REGSUBST_VAR 55 #define SCE_PL_BACKTICKS_VAR 57 #define SCE_PL_HERE_QQ_VAR 61 #define SCE_PL_HERE_QX_VAR 62 #define SCE_PL_STRING_QQ_VAR 64 #define SCE_PL_STRING_QX_VAR 65 #define SCE_PL_STRING_QR_VAR 66 #define SCE_RB_DEFAULT 0 #define SCE_RB_ERROR 1 #define SCE_RB_COMMENTLINE 2 #define SCE_RB_POD 3 #define SCE_RB_NUMBER 4 #define SCE_RB_WORD 5 #define SCE_RB_STRING 6 #define SCE_RB_CHARACTER 7 #define SCE_RB_CLASSNAME 8 #define SCE_RB_DEFNAME 9 #define SCE_RB_OPERATOR 10 #define SCE_RB_IDENTIFIER 11 #define SCE_RB_REGEX 12 #define SCE_RB_GLOBAL 13 #define SCE_RB_SYMBOL 14 #define SCE_RB_MODULE_NAME 15 #define SCE_RB_INSTANCE_VAR 16 #define SCE_RB_CLASS_VAR 17 #define SCE_RB_BACKTICKS 18 #define SCE_RB_DATASECTION 19 #define SCE_RB_HERE_DELIM 20 #define SCE_RB_HERE_Q 21 #define SCE_RB_HERE_QQ 22 #define SCE_RB_HERE_QX 23 #define SCE_RB_STRING_Q 24 #define SCE_RB_STRING_QQ 25 #define SCE_RB_STRING_QX 26 #define SCE_RB_STRING_QR 27 #define SCE_RB_STRING_QW 28 #define SCE_RB_WORD_DEMOTED 29 #define SCE_RB_STDIN 30 #define SCE_RB_STDOUT 31 #define SCE_RB_STDERR 40 #define SCE_RB_STRING_W 41 #define SCE_RB_STRING_I 42 #define SCE_RB_STRING_QI 43 #define SCE_RB_STRING_QS 44 #define SCE_RB_UPPER_BOUND 45 #define SCE_B_DEFAULT 0 #define SCE_B_COMMENT 1 #define SCE_B_NUMBER 2 #define SCE_B_KEYWORD 3 #define SCE_B_STRING 4 #define SCE_B_PREPROCESSOR 5 #define SCE_B_OPERATOR 6 #define SCE_B_IDENTIFIER 7 #define SCE_B_DATE 8 #define SCE_B_STRINGEOL 9 #define SCE_B_KEYWORD2 10 #define SCE_B_KEYWORD3 11 #define SCE_B_KEYWORD4 12 #define SCE_B_CONSTANT 13 #define SCE_B_ASM 14 #define SCE_B_LABEL 15 #define SCE_B_ERROR 16 #define SCE_B_HEXNUMBER 17 #define SCE_B_BINNUMBER 18 #define SCE_B_COMMENTBLOCK 19 #define SCE_B_DOCLINE 20 #define SCE_B_DOCBLOCK 21 #define SCE_B_DOCKEYWORD 22 #define SCE_PROPS_DEFAULT 0 #define SCE_PROPS_COMMENT 1 #define SCE_PROPS_SECTION 2 #define SCE_PROPS_ASSIGNMENT 3 #define SCE_PROPS_DEFVAL 4 #define SCE_PROPS_KEY 5 #define SCE_L_DEFAULT 0 #define SCE_L_COMMAND 1 #define SCE_L_TAG 2 #define SCE_L_MATH 3 #define SCE_L_COMMENT 4 #define SCE_L_TAG2 5 #define SCE_L_MATH2 6 #define SCE_L_COMMENT2 7 #define SCE_L_VERBATIM 8 #define SCE_L_SHORTCMD 9 #define SCE_L_SPECIAL 10 #define SCE_L_CMDOPT 11 #define SCE_L_ERROR 12 #define SCE_LUA_DEFAULT 0 #define SCE_LUA_COMMENT 1 #define SCE_LUA_COMMENTLINE 2 #define SCE_LUA_COMMENTDOC 3 #define SCE_LUA_NUMBER 4 #define SCE_LUA_WORD 5 #define SCE_LUA_STRING 6 #define SCE_LUA_CHARACTER 7 #define SCE_LUA_LITERALSTRING 8 #define SCE_LUA_PREPROCESSOR 9 #define SCE_LUA_OPERATOR 10 #define SCE_LUA_IDENTIFIER 11 #define SCE_LUA_STRINGEOL 12 #define SCE_LUA_WORD2 13 #define SCE_LUA_WORD3 14 #define SCE_LUA_WORD4 15 #define SCE_LUA_WORD5 16 #define SCE_LUA_WORD6 17 #define SCE_LUA_WORD7 18 #define SCE_LUA_WORD8 19 #define SCE_LUA_LABEL 20 #define SCE_ERR_DEFAULT 0 #define SCE_ERR_PYTHON 1 #define SCE_ERR_GCC 2 #define SCE_ERR_MS 3 #define SCE_ERR_CMD 4 #define SCE_ERR_BORLAND 5 #define SCE_ERR_PERL 6 #define SCE_ERR_NET 7 #define SCE_ERR_LUA 8 #define SCE_ERR_CTAG 9 #define SCE_ERR_DIFF_CHANGED 10 #define SCE_ERR_DIFF_ADDITION 11 #define SCE_ERR_DIFF_DELETION 12 #define SCE_ERR_DIFF_MESSAGE 13 #define SCE_ERR_PHP 14 #define SCE_ERR_ELF 15 #define SCE_ERR_IFC 16 #define SCE_ERR_IFORT 17 #define SCE_ERR_ABSF 18 #define SCE_ERR_TIDY 19 #define SCE_ERR_JAVA_STACK 20 #define SCE_ERR_VALUE 21 #define SCE_ERR_GCC_INCLUDED_FROM 22 #define SCE_ERR_ESCSEQ 23 #define SCE_ERR_ESCSEQ_UNKNOWN 24 #define SCE_ERR_GCC_EXCERPT 25 #define SCE_ERR_BASH 26 #define SCE_ERR_ES_BLACK 40 #define SCE_ERR_ES_RED 41 #define SCE_ERR_ES_GREEN 42 #define SCE_ERR_ES_BROWN 43 #define SCE_ERR_ES_BLUE 44 #define SCE_ERR_ES_MAGENTA 45 #define SCE_ERR_ES_CYAN 46 #define SCE_ERR_ES_GRAY 47 #define SCE_ERR_ES_DARK_GRAY 48 #define SCE_ERR_ES_BRIGHT_RED 49 #define SCE_ERR_ES_BRIGHT_GREEN 50 #define SCE_ERR_ES_YELLOW 51 #define SCE_ERR_ES_BRIGHT_BLUE 52 #define SCE_ERR_ES_BRIGHT_MAGENTA 53 #define SCE_ERR_ES_BRIGHT_CYAN 54 #define SCE_ERR_ES_WHITE 55 #define SCE_BAT_DEFAULT 0 #define SCE_BAT_COMMENT 1 #define SCE_BAT_WORD 2 #define SCE_BAT_LABEL 3 #define SCE_BAT_HIDE 4 #define SCE_BAT_COMMAND 5 #define SCE_BAT_IDENTIFIER 6 #define SCE_BAT_OPERATOR 7 #define SCE_BAT_AFTER_LABEL 8 #define SCE_TCMD_DEFAULT 0 #define SCE_TCMD_COMMENT 1 #define SCE_TCMD_WORD 2 #define SCE_TCMD_LABEL 3 #define SCE_TCMD_HIDE 4 #define SCE_TCMD_COMMAND 5 #define SCE_TCMD_IDENTIFIER 6 #define SCE_TCMD_OPERATOR 7 #define SCE_TCMD_ENVIRONMENT 8 #define SCE_TCMD_EXPANSION 9 #define SCE_TCMD_CLABEL 10 #define SCE_MAKE_DEFAULT 0 #define SCE_MAKE_COMMENT 1 #define SCE_MAKE_PREPROCESSOR 2 #define SCE_MAKE_IDENTIFIER 3 #define SCE_MAKE_OPERATOR 4 #define SCE_MAKE_TARGET 5 #define SCE_MAKE_IDEOL 9 #define SCE_DIFF_DEFAULT 0 #define SCE_DIFF_COMMENT 1 #define SCE_DIFF_COMMAND 2 #define SCE_DIFF_HEADER 3 #define SCE_DIFF_POSITION 4 #define SCE_DIFF_DELETED 5 #define SCE_DIFF_ADDED 6 #define SCE_DIFF_CHANGED 7 #define SCE_DIFF_PATCH_ADD 8 #define SCE_DIFF_PATCH_DELETE 9 #define SCE_DIFF_REMOVED_PATCH_ADD 10 #define SCE_DIFF_REMOVED_PATCH_DELETE 11 #define SCE_CONF_DEFAULT 0 #define SCE_CONF_COMMENT 1 #define SCE_CONF_NUMBER 2 #define SCE_CONF_IDENTIFIER 3 #define SCE_CONF_EXTENSION 4 #define SCE_CONF_PARAMETER 5 #define SCE_CONF_STRING 6 #define SCE_CONF_OPERATOR 7 #define SCE_CONF_IP 8 #define SCE_CONF_DIRECTIVE 9 #define SCE_AVE_DEFAULT 0 #define SCE_AVE_COMMENT 1 #define SCE_AVE_NUMBER 2 #define SCE_AVE_WORD 3 #define SCE_AVE_STRING 6 #define SCE_AVE_ENUM 7 #define SCE_AVE_STRINGEOL 8 #define SCE_AVE_IDENTIFIER 9 #define SCE_AVE_OPERATOR 10 #define SCE_AVE_WORD1 11 #define SCE_AVE_WORD2 12 #define SCE_AVE_WORD3 13 #define SCE_AVE_WORD4 14 #define SCE_AVE_WORD5 15 #define SCE_AVE_WORD6 16 #define SCE_ADA_DEFAULT 0 #define SCE_ADA_WORD 1 #define SCE_ADA_IDENTIFIER 2 #define SCE_ADA_NUMBER 3 #define SCE_ADA_DELIMITER 4 #define SCE_ADA_CHARACTER 5 #define SCE_ADA_CHARACTEREOL 6 #define SCE_ADA_STRING 7 #define SCE_ADA_STRINGEOL 8 #define SCE_ADA_LABEL 9 #define SCE_ADA_COMMENTLINE 10 #define SCE_ADA_ILLEGAL 11 #define SCE_BAAN_DEFAULT 0 #define SCE_BAAN_COMMENT 1 #define SCE_BAAN_COMMENTDOC 2 #define SCE_BAAN_NUMBER 3 #define SCE_BAAN_WORD 4 #define SCE_BAAN_STRING 5 #define SCE_BAAN_PREPROCESSOR 6 #define SCE_BAAN_OPERATOR 7 #define SCE_BAAN_IDENTIFIER 8 #define SCE_BAAN_STRINGEOL 9 #define SCE_BAAN_WORD2 10 #define SCE_BAAN_WORD3 11 #define SCE_BAAN_WORD4 12 #define SCE_BAAN_WORD5 13 #define SCE_BAAN_WORD6 14 #define SCE_BAAN_WORD7 15 #define SCE_BAAN_WORD8 16 #define SCE_BAAN_WORD9 17 #define SCE_BAAN_TABLEDEF 18 #define SCE_BAAN_TABLESQL 19 #define SCE_BAAN_FUNCTION 20 #define SCE_BAAN_DOMDEF 21 #define SCE_BAAN_FUNCDEF 22 #define SCE_BAAN_OBJECTDEF 23 #define SCE_BAAN_DEFINEDEF 24 #define SCE_LISP_DEFAULT 0 #define SCE_LISP_COMMENT 1 #define SCE_LISP_NUMBER 2 #define SCE_LISP_KEYWORD 3 #define SCE_LISP_KEYWORD_KW 4 #define SCE_LISP_SYMBOL 5 #define SCE_LISP_STRING 6 #define SCE_LISP_STRINGEOL 8 #define SCE_LISP_IDENTIFIER 9 #define SCE_LISP_OPERATOR 10 #define SCE_LISP_SPECIAL 11 #define SCE_LISP_MULTI_COMMENT 12 #define SCE_EIFFEL_DEFAULT 0 #define SCE_EIFFEL_COMMENTLINE 1 #define SCE_EIFFEL_NUMBER 2 #define SCE_EIFFEL_WORD 3 #define SCE_EIFFEL_STRING 4 #define SCE_EIFFEL_CHARACTER 5 #define SCE_EIFFEL_OPERATOR 6 #define SCE_EIFFEL_IDENTIFIER 7 #define SCE_EIFFEL_STRINGEOL 8 #define SCE_NNCRONTAB_DEFAULT 0 #define SCE_NNCRONTAB_COMMENT 1 #define SCE_NNCRONTAB_TASK 2 #define SCE_NNCRONTAB_SECTION 3 #define SCE_NNCRONTAB_KEYWORD 4 #define SCE_NNCRONTAB_MODIFIER 5 #define SCE_NNCRONTAB_ASTERISK 6 #define SCE_NNCRONTAB_NUMBER 7 #define SCE_NNCRONTAB_STRING 8 #define SCE_NNCRONTAB_ENVIRONMENT 9 #define SCE_NNCRONTAB_IDENTIFIER 10 #define SCE_FORTH_DEFAULT 0 #define SCE_FORTH_COMMENT 1 #define SCE_FORTH_COMMENT_ML 2 #define SCE_FORTH_IDENTIFIER 3 #define SCE_FORTH_CONTROL 4 #define SCE_FORTH_KEYWORD 5 #define SCE_FORTH_DEFWORD 6 #define SCE_FORTH_PREWORD1 7 #define SCE_FORTH_PREWORD2 8 #define SCE_FORTH_NUMBER 9 #define SCE_FORTH_STRING 10 #define SCE_FORTH_LOCALE 11 #define SCE_MATLAB_DEFAULT 0 #define SCE_MATLAB_COMMENT 1 #define SCE_MATLAB_COMMAND 2 #define SCE_MATLAB_NUMBER 3 #define SCE_MATLAB_KEYWORD 4 #define SCE_MATLAB_STRING 5 #define SCE_MATLAB_OPERATOR 6 #define SCE_MATLAB_IDENTIFIER 7 #define SCE_MATLAB_DOUBLEQUOTESTRING 8 #define SCE_MAXIMA_OPERATOR 0 #define SCE_MAXIMA_COMMANDENDING 1 #define SCE_MAXIMA_COMMENT 2 #define SCE_MAXIMA_NUMBER 3 #define SCE_MAXIMA_STRING 4 #define SCE_MAXIMA_COMMAND 5 #define SCE_MAXIMA_VARIABLE 6 #define SCE_MAXIMA_UNKNOWN 7 #define SCE_SCRIPTOL_DEFAULT 0 #define SCE_SCRIPTOL_WHITE 1 #define SCE_SCRIPTOL_COMMENTLINE 2 #define SCE_SCRIPTOL_PERSISTENT 3 #define SCE_SCRIPTOL_CSTYLE 4 #define SCE_SCRIPTOL_COMMENTBLOCK 5 #define SCE_SCRIPTOL_NUMBER 6 #define SCE_SCRIPTOL_STRING 7 #define SCE_SCRIPTOL_CHARACTER 8 #define SCE_SCRIPTOL_STRINGEOL 9 #define SCE_SCRIPTOL_KEYWORD 10 #define SCE_SCRIPTOL_OPERATOR 11 #define SCE_SCRIPTOL_IDENTIFIER 12 #define SCE_SCRIPTOL_TRIPLE 13 #define SCE_SCRIPTOL_CLASSNAME 14 #define SCE_SCRIPTOL_PREPROCESSOR 15 #define SCE_ASM_DEFAULT 0 #define SCE_ASM_COMMENT 1 #define SCE_ASM_NUMBER 2 #define SCE_ASM_STRING 3 #define SCE_ASM_OPERATOR 4 #define SCE_ASM_IDENTIFIER 5 #define SCE_ASM_CPUINSTRUCTION 6 #define SCE_ASM_MATHINSTRUCTION 7 #define SCE_ASM_REGISTER 8 #define SCE_ASM_DIRECTIVE 9 #define SCE_ASM_DIRECTIVEOPERAND 10 #define SCE_ASM_COMMENTBLOCK 11 #define SCE_ASM_CHARACTER 12 #define SCE_ASM_STRINGEOL 13 #define SCE_ASM_EXTINSTRUCTION 14 #define SCE_ASM_COMMENTDIRECTIVE 15 #define SCE_F_DEFAULT 0 #define SCE_F_COMMENT 1 #define SCE_F_NUMBER 2 #define SCE_F_STRING1 3 #define SCE_F_STRING2 4 #define SCE_F_STRINGEOL 5 #define SCE_F_OPERATOR 6 #define SCE_F_IDENTIFIER 7 #define SCE_F_WORD 8 #define SCE_F_WORD2 9 #define SCE_F_WORD3 10 #define SCE_F_PREPROCESSOR 11 #define SCE_F_OPERATOR2 12 #define SCE_F_LABEL 13 #define SCE_F_CONTINUATION 14 #define SCE_CSS_DEFAULT 0 #define SCE_CSS_TAG 1 #define SCE_CSS_CLASS 2 #define SCE_CSS_PSEUDOCLASS 3 #define SCE_CSS_UNKNOWN_PSEUDOCLASS 4 #define SCE_CSS_OPERATOR 5 #define SCE_CSS_IDENTIFIER 6 #define SCE_CSS_UNKNOWN_IDENTIFIER 7 #define SCE_CSS_VALUE 8 #define SCE_CSS_COMMENT 9 #define SCE_CSS_ID 10 #define SCE_CSS_IMPORTANT 11 #define SCE_CSS_DIRECTIVE 12 #define SCE_CSS_DOUBLESTRING 13 #define SCE_CSS_SINGLESTRING 14 #define SCE_CSS_IDENTIFIER2 15 #define SCE_CSS_ATTRIBUTE 16 #define SCE_CSS_IDENTIFIER3 17 #define SCE_CSS_PSEUDOELEMENT 18 #define SCE_CSS_EXTENDED_IDENTIFIER 19 #define SCE_CSS_EXTENDED_PSEUDOCLASS 20 #define SCE_CSS_EXTENDED_PSEUDOELEMENT 21 #define SCE_CSS_GROUP_RULE 22 #define SCE_CSS_VARIABLE 23 #define SCE_POV_DEFAULT 0 #define SCE_POV_COMMENT 1 #define SCE_POV_COMMENTLINE 2 #define SCE_POV_NUMBER 3 #define SCE_POV_OPERATOR 4 #define SCE_POV_IDENTIFIER 5 #define SCE_POV_STRING 6 #define SCE_POV_STRINGEOL 7 #define SCE_POV_DIRECTIVE 8 #define SCE_POV_BADDIRECTIVE 9 #define SCE_POV_WORD2 10 #define SCE_POV_WORD3 11 #define SCE_POV_WORD4 12 #define SCE_POV_WORD5 13 #define SCE_POV_WORD6 14 #define SCE_POV_WORD7 15 #define SCE_POV_WORD8 16 #define SCE_LOUT_DEFAULT 0 #define SCE_LOUT_COMMENT 1 #define SCE_LOUT_NUMBER 2 #define SCE_LOUT_WORD 3 #define SCE_LOUT_WORD2 4 #define SCE_LOUT_WORD3 5 #define SCE_LOUT_WORD4 6 #define SCE_LOUT_STRING 7 #define SCE_LOUT_OPERATOR 8 #define SCE_LOUT_IDENTIFIER 9 #define SCE_LOUT_STRINGEOL 10 #define SCE_ESCRIPT_DEFAULT 0 #define SCE_ESCRIPT_COMMENT 1 #define SCE_ESCRIPT_COMMENTLINE 2 #define SCE_ESCRIPT_COMMENTDOC 3 #define SCE_ESCRIPT_NUMBER 4 #define SCE_ESCRIPT_WORD 5 #define SCE_ESCRIPT_STRING 6 #define SCE_ESCRIPT_OPERATOR 7 #define SCE_ESCRIPT_IDENTIFIER 8 #define SCE_ESCRIPT_BRACE 9 #define SCE_ESCRIPT_WORD2 10 #define SCE_ESCRIPT_WORD3 11 #define SCE_PS_DEFAULT 0 #define SCE_PS_COMMENT 1 #define SCE_PS_DSC_COMMENT 2 #define SCE_PS_DSC_VALUE 3 #define SCE_PS_NUMBER 4 #define SCE_PS_NAME 5 #define SCE_PS_KEYWORD 6 #define SCE_PS_LITERAL 7 #define SCE_PS_IMMEVAL 8 #define SCE_PS_PAREN_ARRAY 9 #define SCE_PS_PAREN_DICT 10 #define SCE_PS_PAREN_PROC 11 #define SCE_PS_TEXT 12 #define SCE_PS_HEXSTRING 13 #define SCE_PS_BASE85STRING 14 #define SCE_PS_BADSTRINGCHAR 15 #define SCE_NSIS_DEFAULT 0 #define SCE_NSIS_COMMENT 1 #define SCE_NSIS_STRINGDQ 2 #define SCE_NSIS_STRINGLQ 3 #define SCE_NSIS_STRINGRQ 4 #define SCE_NSIS_FUNCTION 5 #define SCE_NSIS_VARIABLE 6 #define SCE_NSIS_LABEL 7 #define SCE_NSIS_USERDEFINED 8 #define SCE_NSIS_SECTIONDEF 9 #define SCE_NSIS_SUBSECTIONDEF 10 #define SCE_NSIS_IFDEFINEDEF 11 #define SCE_NSIS_MACRODEF 12 #define SCE_NSIS_STRINGVAR 13 #define SCE_NSIS_NUMBER 14 #define SCE_NSIS_SECTIONGROUP 15 #define SCE_NSIS_PAGEEX 16 #define SCE_NSIS_FUNCTIONDEF 17 #define SCE_NSIS_COMMENTBOX 18 #define SCE_MMIXAL_LEADWS 0 #define SCE_MMIXAL_COMMENT 1 #define SCE_MMIXAL_LABEL 2 #define SCE_MMIXAL_OPCODE 3 #define SCE_MMIXAL_OPCODE_PRE 4 #define SCE_MMIXAL_OPCODE_VALID 5 #define SCE_MMIXAL_OPCODE_UNKNOWN 6 #define SCE_MMIXAL_OPCODE_POST 7 #define SCE_MMIXAL_OPERANDS 8 #define SCE_MMIXAL_NUMBER 9 #define SCE_MMIXAL_REF 10 #define SCE_MMIXAL_CHAR 11 #define SCE_MMIXAL_STRING 12 #define SCE_MMIXAL_REGISTER 13 #define SCE_MMIXAL_HEX 14 #define SCE_MMIXAL_OPERATOR 15 #define SCE_MMIXAL_SYMBOL 16 #define SCE_MMIXAL_INCLUDE 17 #define SCE_CLW_DEFAULT 0 #define SCE_CLW_LABEL 1 #define SCE_CLW_COMMENT 2 #define SCE_CLW_STRING 3 #define SCE_CLW_USER_IDENTIFIER 4 #define SCE_CLW_INTEGER_CONSTANT 5 #define SCE_CLW_REAL_CONSTANT 6 #define SCE_CLW_PICTURE_STRING 7 #define SCE_CLW_KEYWORD 8 #define SCE_CLW_COMPILER_DIRECTIVE 9 #define SCE_CLW_RUNTIME_EXPRESSIONS 10 #define SCE_CLW_BUILTIN_PROCEDURES_FUNCTION 11 #define SCE_CLW_STRUCTURE_DATA_TYPE 12 #define SCE_CLW_ATTRIBUTE 13 #define SCE_CLW_STANDARD_EQUATE 14 #define SCE_CLW_ERROR 15 #define SCE_CLW_DEPRECATED 16 #define SCE_LOT_DEFAULT 0 #define SCE_LOT_HEADER 1 #define SCE_LOT_BREAK 2 #define SCE_LOT_SET 3 #define SCE_LOT_PASS 4 #define SCE_LOT_FAIL 5 #define SCE_LOT_ABORT 6 #define SCE_YAML_DEFAULT 0 #define SCE_YAML_COMMENT 1 #define SCE_YAML_IDENTIFIER 2 #define SCE_YAML_KEYWORD 3 #define SCE_YAML_NUMBER 4 #define SCE_YAML_REFERENCE 5 #define SCE_YAML_DOCUMENT 6 #define SCE_YAML_TEXT 7 #define SCE_YAML_ERROR 8 #define SCE_YAML_OPERATOR 9 #define SCE_TEX_DEFAULT 0 #define SCE_TEX_SPECIAL 1 #define SCE_TEX_GROUP 2 #define SCE_TEX_SYMBOL 3 #define SCE_TEX_COMMAND 4 #define SCE_TEX_TEXT 5 #define SCE_METAPOST_DEFAULT 0 #define SCE_METAPOST_SPECIAL 1 #define SCE_METAPOST_GROUP 2 #define SCE_METAPOST_SYMBOL 3 #define SCE_METAPOST_COMMAND 4 #define SCE_METAPOST_TEXT 5 #define SCE_METAPOST_EXTRA 6 #define SCE_ERLANG_DEFAULT 0 #define SCE_ERLANG_COMMENT 1 #define SCE_ERLANG_VARIABLE 2 #define SCE_ERLANG_NUMBER 3 #define SCE_ERLANG_KEYWORD 4 #define SCE_ERLANG_STRING 5 #define SCE_ERLANG_OPERATOR 6 #define SCE_ERLANG_ATOM 7 #define SCE_ERLANG_FUNCTION_NAME 8 #define SCE_ERLANG_CHARACTER 9 #define SCE_ERLANG_MACRO 10 #define SCE_ERLANG_RECORD 11 #define SCE_ERLANG_PREPROC 12 #define SCE_ERLANG_NODE_NAME 13 #define SCE_ERLANG_COMMENT_FUNCTION 14 #define SCE_ERLANG_COMMENT_MODULE 15 #define SCE_ERLANG_COMMENT_DOC 16 #define SCE_ERLANG_COMMENT_DOC_MACRO 17 #define SCE_ERLANG_ATOM_QUOTED 18 #define SCE_ERLANG_MACRO_QUOTED 19 #define SCE_ERLANG_RECORD_QUOTED 20 #define SCE_ERLANG_NODE_NAME_QUOTED 21 #define SCE_ERLANG_BIFS 22 #define SCE_ERLANG_MODULES 23 #define SCE_ERLANG_MODULES_ATT 24 #define SCE_ERLANG_UNKNOWN 31 #define SCE_JULIA_DEFAULT 0 #define SCE_JULIA_COMMENT 1 #define SCE_JULIA_NUMBER 2 #define SCE_JULIA_KEYWORD1 3 #define SCE_JULIA_KEYWORD2 4 #define SCE_JULIA_KEYWORD3 5 #define SCE_JULIA_CHAR 6 #define SCE_JULIA_OPERATOR 7 #define SCE_JULIA_BRACKET 8 #define SCE_JULIA_IDENTIFIER 9 #define SCE_JULIA_STRING 10 #define SCE_JULIA_SYMBOL 11 #define SCE_JULIA_MACRO 12 #define SCE_JULIA_STRINGINTERP 13 #define SCE_JULIA_DOCSTRING 14 #define SCE_JULIA_STRINGLITERAL 15 #define SCE_JULIA_COMMAND 16 #define SCE_JULIA_COMMANDLITERAL 17 #define SCE_JULIA_TYPEANNOT 18 #define SCE_JULIA_LEXERROR 19 #define SCE_JULIA_KEYWORD4 20 #define SCE_JULIA_TYPEOPERATOR 21 #define SCE_MSSQL_DEFAULT 0 #define SCE_MSSQL_COMMENT 1 #define SCE_MSSQL_LINE_COMMENT 2 #define SCE_MSSQL_NUMBER 3 #define SCE_MSSQL_STRING 4 #define SCE_MSSQL_OPERATOR 5 #define SCE_MSSQL_IDENTIFIER 6 #define SCE_MSSQL_VARIABLE 7 #define SCE_MSSQL_COLUMN_NAME 8 #define SCE_MSSQL_STATEMENT 9 #define SCE_MSSQL_DATATYPE 10 #define SCE_MSSQL_SYSTABLE 11 #define SCE_MSSQL_GLOBAL_VARIABLE 12 #define SCE_MSSQL_FUNCTION 13 #define SCE_MSSQL_STORED_PROCEDURE 14 #define SCE_MSSQL_DEFAULT_PREF_DATATYPE 15 #define SCE_MSSQL_COLUMN_NAME_2 16 #define SCE_V_DEFAULT 0 #define SCE_V_COMMENT 1 #define SCE_V_COMMENTLINE 2 #define SCE_V_COMMENTLINEBANG 3 #define SCE_V_NUMBER 4 #define SCE_V_WORD 5 #define SCE_V_STRING 6 #define SCE_V_WORD2 7 #define SCE_V_WORD3 8 #define SCE_V_PREPROCESSOR 9 #define SCE_V_OPERATOR 10 #define SCE_V_IDENTIFIER 11 #define SCE_V_STRINGEOL 12 #define SCE_V_USER 19 #define SCE_V_COMMENT_WORD 20 #define SCE_V_INPUT 21 #define SCE_V_OUTPUT 22 #define SCE_V_INOUT 23 #define SCE_V_PORT_CONNECT 24 #define SCE_KIX_DEFAULT 0 #define SCE_KIX_COMMENT 1 #define SCE_KIX_STRING1 2 #define SCE_KIX_STRING2 3 #define SCE_KIX_NUMBER 4 #define SCE_KIX_VAR 5 #define SCE_KIX_MACRO 6 #define SCE_KIX_KEYWORD 7 #define SCE_KIX_FUNCTIONS 8 #define SCE_KIX_OPERATOR 9 #define SCE_KIX_COMMENTSTREAM 10 #define SCE_KIX_IDENTIFIER 31 #define SCE_GC_DEFAULT 0 #define SCE_GC_COMMENTLINE 1 #define SCE_GC_COMMENTBLOCK 2 #define SCE_GC_GLOBAL 3 #define SCE_GC_EVENT 4 #define SCE_GC_ATTRIBUTE 5 #define SCE_GC_CONTROL 6 #define SCE_GC_COMMAND 7 #define SCE_GC_STRING 8 #define SCE_GC_OPERATOR 9 #define SCE_SN_DEFAULT 0 #define SCE_SN_CODE 1 #define SCE_SN_COMMENTLINE 2 #define SCE_SN_COMMENTLINEBANG 3 #define SCE_SN_NUMBER 4 #define SCE_SN_WORD 5 #define SCE_SN_STRING 6 #define SCE_SN_WORD2 7 #define SCE_SN_WORD3 8 #define SCE_SN_PREPROCESSOR 9 #define SCE_SN_OPERATOR 10 #define SCE_SN_IDENTIFIER 11 #define SCE_SN_STRINGEOL 12 #define SCE_SN_REGEXTAG 13 #define SCE_SN_SIGNAL 14 #define SCE_SN_USER 19 #define SCE_AU3_DEFAULT 0 #define SCE_AU3_COMMENT 1 #define SCE_AU3_COMMENTBLOCK 2 #define SCE_AU3_NUMBER 3 #define SCE_AU3_FUNCTION 4 #define SCE_AU3_KEYWORD 5 #define SCE_AU3_MACRO 6 #define SCE_AU3_STRING 7 #define SCE_AU3_OPERATOR 8 #define SCE_AU3_VARIABLE 9 #define SCE_AU3_SENT 10 #define SCE_AU3_PREPROCESSOR 11 #define SCE_AU3_SPECIAL 12 #define SCE_AU3_EXPAND 13 #define SCE_AU3_COMOBJ 14 #define SCE_AU3_UDF 15 #define SCE_APDL_DEFAULT 0 #define SCE_APDL_COMMENT 1 #define SCE_APDL_COMMENTBLOCK 2 #define SCE_APDL_NUMBER 3 #define SCE_APDL_STRING 4 #define SCE_APDL_OPERATOR 5 #define SCE_APDL_WORD 6 #define SCE_APDL_PROCESSOR 7 #define SCE_APDL_COMMAND 8 #define SCE_APDL_SLASHCOMMAND 9 #define SCE_APDL_STARCOMMAND 10 #define SCE_APDL_ARGUMENT 11 #define SCE_APDL_FUNCTION 12 #define SCE_SH_DEFAULT 0 #define SCE_SH_ERROR 1 #define SCE_SH_COMMENTLINE 2 #define SCE_SH_NUMBER 3 #define SCE_SH_WORD 4 #define SCE_SH_STRING 5 #define SCE_SH_CHARACTER 6 #define SCE_SH_OPERATOR 7 #define SCE_SH_IDENTIFIER 8 #define SCE_SH_SCALAR 9 #define SCE_SH_PARAM 10 #define SCE_SH_BACKTICKS 11 #define SCE_SH_HERE_DELIM 12 #define SCE_SH_HERE_Q 13 #define SCE_ASN1_DEFAULT 0 #define SCE_ASN1_COMMENT 1 #define SCE_ASN1_IDENTIFIER 2 #define SCE_ASN1_STRING 3 #define SCE_ASN1_OID 4 #define SCE_ASN1_SCALAR 5 #define SCE_ASN1_KEYWORD 6 #define SCE_ASN1_ATTRIBUTE 7 #define SCE_ASN1_DESCRIPTOR 8 #define SCE_ASN1_TYPE 9 #define SCE_ASN1_OPERATOR 10 #define SCE_VHDL_DEFAULT 0 #define SCE_VHDL_COMMENT 1 #define SCE_VHDL_COMMENTLINEBANG 2 #define SCE_VHDL_NUMBER 3 #define SCE_VHDL_STRING 4 #define SCE_VHDL_OPERATOR 5 #define SCE_VHDL_IDENTIFIER 6 #define SCE_VHDL_STRINGEOL 7 #define SCE_VHDL_KEYWORD 8 #define SCE_VHDL_STDOPERATOR 9 #define SCE_VHDL_ATTRIBUTE 10 #define SCE_VHDL_STDFUNCTION 11 #define SCE_VHDL_STDPACKAGE 12 #define SCE_VHDL_STDTYPE 13 #define SCE_VHDL_USERWORD 14 #define SCE_VHDL_BLOCK_COMMENT 15 #define SCE_CAML_DEFAULT 0 #define SCE_CAML_IDENTIFIER 1 #define SCE_CAML_TAGNAME 2 #define SCE_CAML_KEYWORD 3 #define SCE_CAML_KEYWORD2 4 #define SCE_CAML_KEYWORD3 5 #define SCE_CAML_LINENUM 6 #define SCE_CAML_OPERATOR 7 #define SCE_CAML_NUMBER 8 #define SCE_CAML_CHAR 9 #define SCE_CAML_WHITE 10 #define SCE_CAML_STRING 11 #define SCE_CAML_COMMENT 12 #define SCE_CAML_COMMENT1 13 #define SCE_CAML_COMMENT2 14 #define SCE_CAML_COMMENT3 15 #define SCE_HA_DEFAULT 0 #define SCE_HA_IDENTIFIER 1 #define SCE_HA_KEYWORD 2 #define SCE_HA_NUMBER 3 #define SCE_HA_STRING 4 #define SCE_HA_CHARACTER 5 #define SCE_HA_CLASS 6 #define SCE_HA_MODULE 7 #define SCE_HA_CAPITAL 8 #define SCE_HA_DATA 9 #define SCE_HA_IMPORT 10 #define SCE_HA_OPERATOR 11 #define SCE_HA_INSTANCE 12 #define SCE_HA_COMMENTLINE 13 #define SCE_HA_COMMENTBLOCK 14 #define SCE_HA_COMMENTBLOCK2 15 #define SCE_HA_COMMENTBLOCK3 16 #define SCE_HA_PRAGMA 17 #define SCE_HA_PREPROCESSOR 18 #define SCE_HA_STRINGEOL 19 #define SCE_HA_RESERVED_OPERATOR 20 #define SCE_HA_LITERATE_COMMENT 21 #define SCE_HA_LITERATE_CODEDELIM 22 #define SCE_T3_DEFAULT 0 #define SCE_T3_X_DEFAULT 1 #define SCE_T3_PREPROCESSOR 2 #define SCE_T3_BLOCK_COMMENT 3 #define SCE_T3_LINE_COMMENT 4 #define SCE_T3_OPERATOR 5 #define SCE_T3_KEYWORD 6 #define SCE_T3_NUMBER 7 #define SCE_T3_IDENTIFIER 8 #define SCE_T3_S_STRING 9 #define SCE_T3_D_STRING 10 #define SCE_T3_X_STRING 11 #define SCE_T3_LIB_DIRECTIVE 12 #define SCE_T3_MSG_PARAM 13 #define SCE_T3_HTML_TAG 14 #define SCE_T3_HTML_DEFAULT 15 #define SCE_T3_HTML_STRING 16 #define SCE_T3_USER1 17 #define SCE_T3_USER2 18 #define SCE_T3_USER3 19 #define SCE_T3_BRACE 20 #define SCE_REBOL_DEFAULT 0 #define SCE_REBOL_COMMENTLINE 1 #define SCE_REBOL_COMMENTBLOCK 2 #define SCE_REBOL_PREFACE 3 #define SCE_REBOL_OPERATOR 4 #define SCE_REBOL_CHARACTER 5 #define SCE_REBOL_QUOTEDSTRING 6 #define SCE_REBOL_BRACEDSTRING 7 #define SCE_REBOL_NUMBER 8 #define SCE_REBOL_PAIR 9 #define SCE_REBOL_TUPLE 10 #define SCE_REBOL_BINARY 11 #define SCE_REBOL_MONEY 12 #define SCE_REBOL_ISSUE 13 #define SCE_REBOL_TAG 14 #define SCE_REBOL_FILE 15 #define SCE_REBOL_EMAIL 16 #define SCE_REBOL_URL 17 #define SCE_REBOL_DATE 18 #define SCE_REBOL_TIME 19 #define SCE_REBOL_IDENTIFIER 20 #define SCE_REBOL_WORD 21 #define SCE_REBOL_WORD2 22 #define SCE_REBOL_WORD3 23 #define SCE_REBOL_WORD4 24 #define SCE_REBOL_WORD5 25 #define SCE_REBOL_WORD6 26 #define SCE_REBOL_WORD7 27 #define SCE_REBOL_WORD8 28 #define SCE_SQL_DEFAULT 0 #define SCE_SQL_COMMENT 1 #define SCE_SQL_COMMENTLINE 2 #define SCE_SQL_COMMENTDOC 3 #define SCE_SQL_NUMBER 4 #define SCE_SQL_WORD 5 #define SCE_SQL_STRING 6 #define SCE_SQL_CHARACTER 7 #define SCE_SQL_SQLPLUS 8 #define SCE_SQL_SQLPLUS_PROMPT 9 #define SCE_SQL_OPERATOR 10 #define SCE_SQL_IDENTIFIER 11 #define SCE_SQL_SQLPLUS_COMMENT 13 #define SCE_SQL_COMMENTLINEDOC 15 #define SCE_SQL_WORD2 16 #define SCE_SQL_COMMENTDOCKEYWORD 17 #define SCE_SQL_COMMENTDOCKEYWORDERROR 18 #define SCE_SQL_USER1 19 #define SCE_SQL_USER2 20 #define SCE_SQL_USER3 21 #define SCE_SQL_USER4 22 #define SCE_SQL_QUOTEDIDENTIFIER 23 #define SCE_SQL_QOPERATOR 24 #define SCE_ST_DEFAULT 0 #define SCE_ST_STRING 1 #define SCE_ST_NUMBER 2 #define SCE_ST_COMMENT 3 #define SCE_ST_SYMBOL 4 #define SCE_ST_BINARY 5 #define SCE_ST_BOOL 6 #define SCE_ST_SELF 7 #define SCE_ST_SUPER 8 #define SCE_ST_NIL 9 #define SCE_ST_GLOBAL 10 #define SCE_ST_RETURN 11 #define SCE_ST_SPECIAL 12 #define SCE_ST_KWSEND 13 #define SCE_ST_ASSIGN 14 #define SCE_ST_CHARACTER 15 #define SCE_ST_SPEC_SEL 16 #define SCE_FS_DEFAULT 0 #define SCE_FS_COMMENT 1 #define SCE_FS_COMMENTLINE 2 #define SCE_FS_COMMENTDOC 3 #define SCE_FS_COMMENTLINEDOC 4 #define SCE_FS_COMMENTDOCKEYWORD 5 #define SCE_FS_COMMENTDOCKEYWORDERROR 6 #define SCE_FS_KEYWORD 7 #define SCE_FS_KEYWORD2 8 #define SCE_FS_KEYWORD3 9 #define SCE_FS_KEYWORD4 10 #define SCE_FS_NUMBER 11 #define SCE_FS_STRING 12 #define SCE_FS_PREPROCESSOR 13 #define SCE_FS_OPERATOR 14 #define SCE_FS_IDENTIFIER 15 #define SCE_FS_DATE 16 #define SCE_FS_STRINGEOL 17 #define SCE_FS_CONSTANT 18 #define SCE_FS_WORDOPERATOR 19 #define SCE_FS_DISABLEDCODE 20 #define SCE_FS_DEFAULT_C 21 #define SCE_FS_COMMENTDOC_C 22 #define SCE_FS_COMMENTLINEDOC_C 23 #define SCE_FS_KEYWORD_C 24 #define SCE_FS_KEYWORD2_C 25 #define SCE_FS_NUMBER_C 26 #define SCE_FS_STRING_C 27 #define SCE_FS_PREPROCESSOR_C 28 #define SCE_FS_OPERATOR_C 29 #define SCE_FS_IDENTIFIER_C 30 #define SCE_FS_STRINGEOL_C 31 #define SCE_CSOUND_DEFAULT 0 #define SCE_CSOUND_COMMENT 1 #define SCE_CSOUND_NUMBER 2 #define SCE_CSOUND_OPERATOR 3 #define SCE_CSOUND_INSTR 4 #define SCE_CSOUND_IDENTIFIER 5 #define SCE_CSOUND_OPCODE 6 #define SCE_CSOUND_HEADERSTMT 7 #define SCE_CSOUND_USERKEYWORD 8 #define SCE_CSOUND_COMMENTBLOCK 9 #define SCE_CSOUND_PARAM 10 #define SCE_CSOUND_ARATE_VAR 11 #define SCE_CSOUND_KRATE_VAR 12 #define SCE_CSOUND_IRATE_VAR 13 #define SCE_CSOUND_GLOBAL_VAR 14 #define SCE_CSOUND_STRINGEOL 15 #define SCE_INNO_DEFAULT 0 #define SCE_INNO_COMMENT 1 #define SCE_INNO_KEYWORD 2 #define SCE_INNO_PARAMETER 3 #define SCE_INNO_SECTION 4 #define SCE_INNO_PREPROC 5 #define SCE_INNO_INLINE_EXPANSION 6 #define SCE_INNO_COMMENT_PASCAL 7 #define SCE_INNO_KEYWORD_PASCAL 8 #define SCE_INNO_KEYWORD_USER 9 #define SCE_INNO_STRING_DOUBLE 10 #define SCE_INNO_STRING_SINGLE 11 #define SCE_INNO_IDENTIFIER 12 #define SCE_OPAL_SPACE 0 #define SCE_OPAL_COMMENT_BLOCK 1 #define SCE_OPAL_COMMENT_LINE 2 #define SCE_OPAL_INTEGER 3 #define SCE_OPAL_KEYWORD 4 #define SCE_OPAL_SORT 5 #define SCE_OPAL_STRING 6 #define SCE_OPAL_PAR 7 #define SCE_OPAL_BOOL_CONST 8 #define SCE_OPAL_DEFAULT 32 #define SCE_SPICE_DEFAULT 0 #define SCE_SPICE_IDENTIFIER 1 #define SCE_SPICE_KEYWORD 2 #define SCE_SPICE_KEYWORD2 3 #define SCE_SPICE_KEYWORD3 4 #define SCE_SPICE_NUMBER 5 #define SCE_SPICE_DELIMITER 6 #define SCE_SPICE_VALUE 7 #define SCE_SPICE_COMMENTLINE 8 #define SCE_CMAKE_DEFAULT 0 #define SCE_CMAKE_COMMENT 1 #define SCE_CMAKE_STRINGDQ 2 #define SCE_CMAKE_STRINGLQ 3 #define SCE_CMAKE_STRINGRQ 4 #define SCE_CMAKE_COMMANDS 5 #define SCE_CMAKE_PARAMETERS 6 #define SCE_CMAKE_VARIABLE 7 #define SCE_CMAKE_USERDEFINED 8 #define SCE_CMAKE_WHILEDEF 9 #define SCE_CMAKE_FOREACHDEF 10 #define SCE_CMAKE_IFDEFINEDEF 11 #define SCE_CMAKE_MACRODEF 12 #define SCE_CMAKE_STRINGVAR 13 #define SCE_CMAKE_NUMBER 14 #define SCE_GAP_DEFAULT 0 #define SCE_GAP_IDENTIFIER 1 #define SCE_GAP_KEYWORD 2 #define SCE_GAP_KEYWORD2 3 #define SCE_GAP_KEYWORD3 4 #define SCE_GAP_KEYWORD4 5 #define SCE_GAP_STRING 6 #define SCE_GAP_CHAR 7 #define SCE_GAP_OPERATOR 8 #define SCE_GAP_COMMENT 9 #define SCE_GAP_NUMBER 10 #define SCE_GAP_STRINGEOL 11 #define SCE_PLM_DEFAULT 0 #define SCE_PLM_COMMENT 1 #define SCE_PLM_STRING 2 #define SCE_PLM_NUMBER 3 #define SCE_PLM_IDENTIFIER 4 #define SCE_PLM_OPERATOR 5 #define SCE_PLM_CONTROL 6 #define SCE_PLM_KEYWORD 7 #define SCE_ABL_DEFAULT 0 #define SCE_ABL_NUMBER 1 #define SCE_ABL_WORD 2 #define SCE_ABL_STRING 3 #define SCE_ABL_CHARACTER 4 #define SCE_ABL_PREPROCESSOR 5 #define SCE_ABL_OPERATOR 6 #define SCE_ABL_IDENTIFIER 7 #define SCE_ABL_BLOCK 8 #define SCE_ABL_END 9 #define SCE_ABL_COMMENT 10 #define SCE_ABL_TASKMARKER 11 #define SCE_ABL_LINECOMMENT 12 #define SCE_ABAQUS_DEFAULT 0 #define SCE_ABAQUS_COMMENT 1 #define SCE_ABAQUS_COMMENTBLOCK 2 #define SCE_ABAQUS_NUMBER 3 #define SCE_ABAQUS_STRING 4 #define SCE_ABAQUS_OPERATOR 5 #define SCE_ABAQUS_WORD 6 #define SCE_ABAQUS_PROCESSOR 7 #define SCE_ABAQUS_COMMAND 8 #define SCE_ABAQUS_SLASHCOMMAND 9 #define SCE_ABAQUS_STARCOMMAND 10 #define SCE_ABAQUS_ARGUMENT 11 #define SCE_ABAQUS_FUNCTION 12 #define SCE_ASY_DEFAULT 0 #define SCE_ASY_COMMENT 1 #define SCE_ASY_COMMENTLINE 2 #define SCE_ASY_NUMBER 3 #define SCE_ASY_WORD 4 #define SCE_ASY_STRING 5 #define SCE_ASY_CHARACTER 6 #define SCE_ASY_OPERATOR 7 #define SCE_ASY_IDENTIFIER 8 #define SCE_ASY_STRINGEOL 9 #define SCE_ASY_COMMENTLINEDOC 10 #define SCE_ASY_WORD2 11 #define SCE_R_DEFAULT 0 #define SCE_R_COMMENT 1 #define SCE_R_KWORD 2 #define SCE_R_BASEKWORD 3 #define SCE_R_OTHERKWORD 4 #define SCE_R_NUMBER 5 #define SCE_R_STRING 6 #define SCE_R_STRING2 7 #define SCE_R_OPERATOR 8 #define SCE_R_IDENTIFIER 9 #define SCE_R_INFIX 10 #define SCE_R_INFIXEOL 11 #define SCE_R_BACKTICKS 12 #define SCE_R_RAWSTRING 13 #define SCE_R_RAWSTRING2 14 #define SCE_R_ESCAPESEQUENCE 15 #define SCE_MAGIK_DEFAULT 0 #define SCE_MAGIK_COMMENT 1 #define SCE_MAGIK_HYPER_COMMENT 16 #define SCE_MAGIK_STRING 2 #define SCE_MAGIK_CHARACTER 3 #define SCE_MAGIK_NUMBER 4 #define SCE_MAGIK_IDENTIFIER 5 #define SCE_MAGIK_OPERATOR 6 #define SCE_MAGIK_FLOW 7 #define SCE_MAGIK_CONTAINER 8 #define SCE_MAGIK_BRACKET_BLOCK 9 #define SCE_MAGIK_BRACE_BLOCK 10 #define SCE_MAGIK_SQBRACKET_BLOCK 11 #define SCE_MAGIK_UNKNOWN_KEYWORD 12 #define SCE_MAGIK_KEYWORD 13 #define SCE_MAGIK_PRAGMA 14 #define SCE_MAGIK_SYMBOL 15 #define SCE_POWERSHELL_DEFAULT 0 #define SCE_POWERSHELL_COMMENT 1 #define SCE_POWERSHELL_STRING 2 #define SCE_POWERSHELL_CHARACTER 3 #define SCE_POWERSHELL_NUMBER 4 #define SCE_POWERSHELL_VARIABLE 5 #define SCE_POWERSHELL_OPERATOR 6 #define SCE_POWERSHELL_IDENTIFIER 7 #define SCE_POWERSHELL_KEYWORD 8 #define SCE_POWERSHELL_CMDLET 9 #define SCE_POWERSHELL_ALIAS 10 #define SCE_POWERSHELL_FUNCTION 11 #define SCE_POWERSHELL_USER1 12 #define SCE_POWERSHELL_COMMENTSTREAM 13 #define SCE_POWERSHELL_HERE_STRING 14 #define SCE_POWERSHELL_HERE_CHARACTER 15 #define SCE_POWERSHELL_COMMENTDOCKEYWORD 16 #define SCE_MYSQL_DEFAULT 0 #define SCE_MYSQL_COMMENT 1 #define SCE_MYSQL_COMMENTLINE 2 #define SCE_MYSQL_VARIABLE 3 #define SCE_MYSQL_SYSTEMVARIABLE 4 #define SCE_MYSQL_KNOWNSYSTEMVARIABLE 5 #define SCE_MYSQL_NUMBER 6 #define SCE_MYSQL_MAJORKEYWORD 7 #define SCE_MYSQL_KEYWORD 8 #define SCE_MYSQL_DATABASEOBJECT 9 #define SCE_MYSQL_PROCEDUREKEYWORD 10 #define SCE_MYSQL_STRING 11 #define SCE_MYSQL_SQSTRING 12 #define SCE_MYSQL_DQSTRING 13 #define SCE_MYSQL_OPERATOR 14 #define SCE_MYSQL_FUNCTION 15 #define SCE_MYSQL_IDENTIFIER 16 #define SCE_MYSQL_QUOTEDIDENTIFIER 17 #define SCE_MYSQL_USER1 18 #define SCE_MYSQL_USER2 19 #define SCE_MYSQL_USER3 20 #define SCE_MYSQL_HIDDENCOMMAND 21 #define SCE_MYSQL_PLACEHOLDER 22 #define SCE_PO_DEFAULT 0 #define SCE_PO_COMMENT 1 #define SCE_PO_MSGID 2 #define SCE_PO_MSGID_TEXT 3 #define SCE_PO_MSGSTR 4 #define SCE_PO_MSGSTR_TEXT 5 #define SCE_PO_MSGCTXT 6 #define SCE_PO_MSGCTXT_TEXT 7 #define SCE_PO_FUZZY 8 #define SCE_PO_PROGRAMMER_COMMENT 9 #define SCE_PO_REFERENCE 10 #define SCE_PO_FLAGS 11 #define SCE_PO_MSGID_TEXT_EOL 12 #define SCE_PO_MSGSTR_TEXT_EOL 13 #define SCE_PO_MSGCTXT_TEXT_EOL 14 #define SCE_PO_ERROR 15 #define SCE_PAS_DEFAULT 0 #define SCE_PAS_IDENTIFIER 1 #define SCE_PAS_COMMENT 2 #define SCE_PAS_COMMENT2 3 #define SCE_PAS_COMMENTLINE 4 #define SCE_PAS_PREPROCESSOR 5 #define SCE_PAS_PREPROCESSOR2 6 #define SCE_PAS_NUMBER 7 #define SCE_PAS_HEXNUMBER 8 #define SCE_PAS_WORD 9 #define SCE_PAS_STRING 10 #define SCE_PAS_STRINGEOL 11 #define SCE_PAS_CHARACTER 12 #define SCE_PAS_OPERATOR 13 #define SCE_PAS_ASM 14 #define SCE_SORCUS_DEFAULT 0 #define SCE_SORCUS_COMMAND 1 #define SCE_SORCUS_PARAMETER 2 #define SCE_SORCUS_COMMENTLINE 3 #define SCE_SORCUS_STRING 4 #define SCE_SORCUS_STRINGEOL 5 #define SCE_SORCUS_IDENTIFIER 6 #define SCE_SORCUS_OPERATOR 7 #define SCE_SORCUS_NUMBER 8 #define SCE_SORCUS_CONSTANT 9 #define SCE_POWERPRO_DEFAULT 0 #define SCE_POWERPRO_COMMENTBLOCK 1 #define SCE_POWERPRO_COMMENTLINE 2 #define SCE_POWERPRO_NUMBER 3 #define SCE_POWERPRO_WORD 4 #define SCE_POWERPRO_WORD2 5 #define SCE_POWERPRO_WORD3 6 #define SCE_POWERPRO_WORD4 7 #define SCE_POWERPRO_DOUBLEQUOTEDSTRING 8 #define SCE_POWERPRO_SINGLEQUOTEDSTRING 9 #define SCE_POWERPRO_LINECONTINUE 10 #define SCE_POWERPRO_OPERATOR 11 #define SCE_POWERPRO_IDENTIFIER 12 #define SCE_POWERPRO_STRINGEOL 13 #define SCE_POWERPRO_VERBATIM 14 #define SCE_POWERPRO_ALTQUOTE 15 #define SCE_POWERPRO_FUNCTION 16 #define SCE_SML_DEFAULT 0 #define SCE_SML_IDENTIFIER 1 #define SCE_SML_TAGNAME 2 #define SCE_SML_KEYWORD 3 #define SCE_SML_KEYWORD2 4 #define SCE_SML_KEYWORD3 5 #define SCE_SML_LINENUM 6 #define SCE_SML_OPERATOR 7 #define SCE_SML_NUMBER 8 #define SCE_SML_CHAR 9 #define SCE_SML_STRING 11 #define SCE_SML_COMMENT 12 #define SCE_SML_COMMENT1 13 #define SCE_SML_COMMENT2 14 #define SCE_SML_COMMENT3 15 #define SCE_MARKDOWN_DEFAULT 0 #define SCE_MARKDOWN_LINE_BEGIN 1 #define SCE_MARKDOWN_STRONG1 2 #define SCE_MARKDOWN_STRONG2 3 #define SCE_MARKDOWN_EM1 4 #define SCE_MARKDOWN_EM2 5 #define SCE_MARKDOWN_HEADER1 6 #define SCE_MARKDOWN_HEADER2 7 #define SCE_MARKDOWN_HEADER3 8 #define SCE_MARKDOWN_HEADER4 9 #define SCE_MARKDOWN_HEADER5 10 #define SCE_MARKDOWN_HEADER6 11 #define SCE_MARKDOWN_PRECHAR 12 #define SCE_MARKDOWN_ULIST_ITEM 13 #define SCE_MARKDOWN_OLIST_ITEM 14 #define SCE_MARKDOWN_BLOCKQUOTE 15 #define SCE_MARKDOWN_STRIKEOUT 16 #define SCE_MARKDOWN_HRULE 17 #define SCE_MARKDOWN_LINK 18 #define SCE_MARKDOWN_CODE 19 #define SCE_MARKDOWN_CODE2 20 #define SCE_MARKDOWN_CODEBK 21 #define SCE_TXT2TAGS_DEFAULT 0 #define SCE_TXT2TAGS_LINE_BEGIN 1 #define SCE_TXT2TAGS_STRONG1 2 #define SCE_TXT2TAGS_STRONG2 3 #define SCE_TXT2TAGS_EM1 4 #define SCE_TXT2TAGS_EM2 5 #define SCE_TXT2TAGS_HEADER1 6 #define SCE_TXT2TAGS_HEADER2 7 #define SCE_TXT2TAGS_HEADER3 8 #define SCE_TXT2TAGS_HEADER4 9 #define SCE_TXT2TAGS_HEADER5 10 #define SCE_TXT2TAGS_HEADER6 11 #define SCE_TXT2TAGS_PRECHAR 12 #define SCE_TXT2TAGS_ULIST_ITEM 13 #define SCE_TXT2TAGS_OLIST_ITEM 14 #define SCE_TXT2TAGS_BLOCKQUOTE 15 #define SCE_TXT2TAGS_STRIKEOUT 16 #define SCE_TXT2TAGS_HRULE 17 #define SCE_TXT2TAGS_LINK 18 #define SCE_TXT2TAGS_CODE 19 #define SCE_TXT2TAGS_CODE2 20 #define SCE_TXT2TAGS_CODEBK 21 #define SCE_TXT2TAGS_COMMENT 22 #define SCE_TXT2TAGS_OPTION 23 #define SCE_TXT2TAGS_PREPROC 24 #define SCE_TXT2TAGS_POSTPROC 25 #define SCE_A68K_DEFAULT 0 #define SCE_A68K_COMMENT 1 #define SCE_A68K_NUMBER_DEC 2 #define SCE_A68K_NUMBER_BIN 3 #define SCE_A68K_NUMBER_HEX 4 #define SCE_A68K_STRING1 5 #define SCE_A68K_OPERATOR 6 #define SCE_A68K_CPUINSTRUCTION 7 #define SCE_A68K_EXTINSTRUCTION 8 #define SCE_A68K_REGISTER 9 #define SCE_A68K_DIRECTIVE 10 #define SCE_A68K_MACRO_ARG 11 #define SCE_A68K_LABEL 12 #define SCE_A68K_STRING2 13 #define SCE_A68K_IDENTIFIER 14 #define SCE_A68K_MACRO_DECLARATION 15 #define SCE_A68K_COMMENT_WORD 16 #define SCE_A68K_COMMENT_SPECIAL 17 #define SCE_A68K_COMMENT_DOXYGEN 18 #define SCE_MODULA_DEFAULT 0 #define SCE_MODULA_COMMENT 1 #define SCE_MODULA_DOXYCOMM 2 #define SCE_MODULA_DOXYKEY 3 #define SCE_MODULA_KEYWORD 4 #define SCE_MODULA_RESERVED 5 #define SCE_MODULA_NUMBER 6 #define SCE_MODULA_BASENUM 7 #define SCE_MODULA_FLOAT 8 #define SCE_MODULA_STRING 9 #define SCE_MODULA_STRSPEC 10 #define SCE_MODULA_CHAR 11 #define SCE_MODULA_CHARSPEC 12 #define SCE_MODULA_PROC 13 #define SCE_MODULA_PRAGMA 14 #define SCE_MODULA_PRGKEY 15 #define SCE_MODULA_OPERATOR 16 #define SCE_MODULA_BADSTR 17 #define SCE_COFFEESCRIPT_DEFAULT 0 #define SCE_COFFEESCRIPT_COMMENT 1 #define SCE_COFFEESCRIPT_COMMENTLINE 2 #define SCE_COFFEESCRIPT_COMMENTDOC 3 #define SCE_COFFEESCRIPT_NUMBER 4 #define SCE_COFFEESCRIPT_WORD 5 #define SCE_COFFEESCRIPT_STRING 6 #define SCE_COFFEESCRIPT_CHARACTER 7 #define SCE_COFFEESCRIPT_UUID 8 #define SCE_COFFEESCRIPT_PREPROCESSOR 9 #define SCE_COFFEESCRIPT_OPERATOR 10 #define SCE_COFFEESCRIPT_IDENTIFIER 11 #define SCE_COFFEESCRIPT_STRINGEOL 12 #define SCE_COFFEESCRIPT_VERBATIM 13 #define SCE_COFFEESCRIPT_REGEX 14 #define SCE_COFFEESCRIPT_COMMENTLINEDOC 15 #define SCE_COFFEESCRIPT_WORD2 16 #define SCE_COFFEESCRIPT_COMMENTDOCKEYWORD 17 #define SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR 18 #define SCE_COFFEESCRIPT_GLOBALCLASS 19 #define SCE_COFFEESCRIPT_STRINGRAW 20 #define SCE_COFFEESCRIPT_TRIPLEVERBATIM 21 #define SCE_COFFEESCRIPT_COMMENTBLOCK 22 #define SCE_COFFEESCRIPT_VERBOSE_REGEX 23 #define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24 #define SCE_COFFEESCRIPT_INSTANCEPROPERTY 25 #define SCE_AVS_DEFAULT 0 #define SCE_AVS_COMMENTBLOCK 1 #define SCE_AVS_COMMENTBLOCKN 2 #define SCE_AVS_COMMENTLINE 3 #define SCE_AVS_NUMBER 4 #define SCE_AVS_OPERATOR 5 #define SCE_AVS_IDENTIFIER 6 #define SCE_AVS_STRING 7 #define SCE_AVS_TRIPLESTRING 8 #define SCE_AVS_KEYWORD 9 #define SCE_AVS_FILTER 10 #define SCE_AVS_PLUGIN 11 #define SCE_AVS_FUNCTION 12 #define SCE_AVS_CLIPPROP 13 #define SCE_AVS_USERDFN 14 #define SCE_ECL_DEFAULT 0 #define SCE_ECL_COMMENT 1 #define SCE_ECL_COMMENTLINE 2 #define SCE_ECL_NUMBER 3 #define SCE_ECL_STRING 4 #define SCE_ECL_WORD0 5 #define SCE_ECL_OPERATOR 6 #define SCE_ECL_CHARACTER 7 #define SCE_ECL_UUID 8 #define SCE_ECL_PREPROCESSOR 9 #define SCE_ECL_UNKNOWN 10 #define SCE_ECL_IDENTIFIER 11 #define SCE_ECL_STRINGEOL 12 #define SCE_ECL_VERBATIM 13 #define SCE_ECL_REGEX 14 #define SCE_ECL_COMMENTLINEDOC 15 #define SCE_ECL_WORD1 16 #define SCE_ECL_COMMENTDOCKEYWORD 17 #define SCE_ECL_COMMENTDOCKEYWORDERROR 18 #define SCE_ECL_WORD2 19 #define SCE_ECL_WORD3 20 #define SCE_ECL_WORD4 21 #define SCE_ECL_WORD5 22 #define SCE_ECL_COMMENTDOC 23 #define SCE_ECL_ADDED 24 #define SCE_ECL_DELETED 25 #define SCE_ECL_CHANGED 26 #define SCE_ECL_MOVED 27 #define SCE_OSCRIPT_DEFAULT 0 #define SCE_OSCRIPT_LINE_COMMENT 1 #define SCE_OSCRIPT_BLOCK_COMMENT 2 #define SCE_OSCRIPT_DOC_COMMENT 3 #define SCE_OSCRIPT_PREPROCESSOR 4 #define SCE_OSCRIPT_NUMBER 5 #define SCE_OSCRIPT_SINGLEQUOTE_STRING 6 #define SCE_OSCRIPT_DOUBLEQUOTE_STRING 7 #define SCE_OSCRIPT_CONSTANT 8 #define SCE_OSCRIPT_IDENTIFIER 9 #define SCE_OSCRIPT_GLOBAL 10 #define SCE_OSCRIPT_KEYWORD 11 #define SCE_OSCRIPT_OPERATOR 12 #define SCE_OSCRIPT_LABEL 13 #define SCE_OSCRIPT_TYPE 14 #define SCE_OSCRIPT_FUNCTION 15 #define SCE_OSCRIPT_OBJECT 16 #define SCE_OSCRIPT_PROPERTY 17 #define SCE_OSCRIPT_METHOD 18 #define SCE_VISUALPROLOG_DEFAULT 0 #define SCE_VISUALPROLOG_KEY_MAJOR 1 #define SCE_VISUALPROLOG_KEY_MINOR 2 #define SCE_VISUALPROLOG_KEY_DIRECTIVE 3 #define SCE_VISUALPROLOG_COMMENT_BLOCK 4 #define SCE_VISUALPROLOG_COMMENT_LINE 5 #define SCE_VISUALPROLOG_COMMENT_KEY 6 #define SCE_VISUALPROLOG_COMMENT_KEY_ERROR 7 #define SCE_VISUALPROLOG_IDENTIFIER 8 #define SCE_VISUALPROLOG_VARIABLE 9 #define SCE_VISUALPROLOG_ANONYMOUS 10 #define SCE_VISUALPROLOG_NUMBER 11 #define SCE_VISUALPROLOG_OPERATOR 12 #define SCE_VISUALPROLOG_UNUSED1 13 #define SCE_VISUALPROLOG_UNUSED2 14 #define SCE_VISUALPROLOG_UNUSED3 15 #define SCE_VISUALPROLOG_STRING_QUOTE 16 #define SCE_VISUALPROLOG_STRING_ESCAPE 17 #define SCE_VISUALPROLOG_STRING_ESCAPE_ERROR 18 #define SCE_VISUALPROLOG_UNUSED4 19 #define SCE_VISUALPROLOG_STRING 20 #define SCE_VISUALPROLOG_UNUSED5 21 #define SCE_VISUALPROLOG_STRING_EOL 22 #define SCE_VISUALPROLOG_EMBEDDED 23 #define SCE_VISUALPROLOG_PLACEHOLDER 24 #define SCE_STTXT_DEFAULT 0 #define SCE_STTXT_COMMENT 1 #define SCE_STTXT_COMMENTLINE 2 #define SCE_STTXT_KEYWORD 3 #define SCE_STTXT_TYPE 4 #define SCE_STTXT_FUNCTION 5 #define SCE_STTXT_FB 6 #define SCE_STTXT_NUMBER 7 #define SCE_STTXT_HEXNUMBER 8 #define SCE_STTXT_PRAGMA 9 #define SCE_STTXT_OPERATOR 10 #define SCE_STTXT_CHARACTER 11 #define SCE_STTXT_STRING1 12 #define SCE_STTXT_STRING2 13 #define SCE_STTXT_STRINGEOL 14 #define SCE_STTXT_IDENTIFIER 15 #define SCE_STTXT_DATETIME 16 #define SCE_STTXT_VARS 17 #define SCE_STTXT_PRAGMAS 18 #define SCE_KVIRC_DEFAULT 0 #define SCE_KVIRC_COMMENT 1 #define SCE_KVIRC_COMMENTBLOCK 2 #define SCE_KVIRC_STRING 3 #define SCE_KVIRC_WORD 4 #define SCE_KVIRC_KEYWORD 5 #define SCE_KVIRC_FUNCTION_KEYWORD 6 #define SCE_KVIRC_FUNCTION 7 #define SCE_KVIRC_VARIABLE 8 #define SCE_KVIRC_NUMBER 9 #define SCE_KVIRC_OPERATOR 10 #define SCE_KVIRC_STRING_FUNCTION 11 #define SCE_KVIRC_STRING_VARIABLE 12 #define SCE_RUST_DEFAULT 0 #define SCE_RUST_COMMENTBLOCK 1 #define SCE_RUST_COMMENTLINE 2 #define SCE_RUST_COMMENTBLOCKDOC 3 #define SCE_RUST_COMMENTLINEDOC 4 #define SCE_RUST_NUMBER 5 #define SCE_RUST_WORD 6 #define SCE_RUST_WORD2 7 #define SCE_RUST_WORD3 8 #define SCE_RUST_WORD4 9 #define SCE_RUST_WORD5 10 #define SCE_RUST_WORD6 11 #define SCE_RUST_WORD7 12 #define SCE_RUST_STRING 13 #define SCE_RUST_STRINGR 14 #define SCE_RUST_CHARACTER 15 #define SCE_RUST_OPERATOR 16 #define SCE_RUST_IDENTIFIER 17 #define SCE_RUST_LIFETIME 18 #define SCE_RUST_MACRO 19 #define SCE_RUST_LEXERROR 20 #define SCE_RUST_BYTESTRING 21 #define SCE_RUST_BYTESTRINGR 22 #define SCE_RUST_BYTECHARACTER 23 #define SCE_DMAP_DEFAULT 0 #define SCE_DMAP_COMMENT 1 #define SCE_DMAP_NUMBER 2 #define SCE_DMAP_STRING1 3 #define SCE_DMAP_STRING2 4 #define SCE_DMAP_STRINGEOL 5 #define SCE_DMAP_OPERATOR 6 #define SCE_DMAP_IDENTIFIER 7 #define SCE_DMAP_WORD 8 #define SCE_DMAP_WORD2 9 #define SCE_DMAP_WORD3 10 #define SCE_DMIS_DEFAULT 0 #define SCE_DMIS_COMMENT 1 #define SCE_DMIS_STRING 2 #define SCE_DMIS_NUMBER 3 #define SCE_DMIS_KEYWORD 4 #define SCE_DMIS_MAJORWORD 5 #define SCE_DMIS_MINORWORD 6 #define SCE_DMIS_UNSUPPORTED_MAJOR 7 #define SCE_DMIS_UNSUPPORTED_MINOR 8 #define SCE_DMIS_LABEL 9 #define SCE_REG_DEFAULT 0 #define SCE_REG_COMMENT 1 #define SCE_REG_VALUENAME 2 #define SCE_REG_STRING 3 #define SCE_REG_HEXDIGIT 4 #define SCE_REG_VALUETYPE 5 #define SCE_REG_ADDEDKEY 6 #define SCE_REG_DELETEDKEY 7 #define SCE_REG_ESCAPED 8 #define SCE_REG_KEYPATH_GUID 9 #define SCE_REG_STRING_GUID 10 #define SCE_REG_PARAMETER 11 #define SCE_REG_OPERATOR 12 #define SCE_BIBTEX_DEFAULT 0 #define SCE_BIBTEX_ENTRY 1 #define SCE_BIBTEX_UNKNOWN_ENTRY 2 #define SCE_BIBTEX_KEY 3 #define SCE_BIBTEX_PARAMETER 4 #define SCE_BIBTEX_VALUE 5 #define SCE_BIBTEX_COMMENT 6 #define SCE_HEX_DEFAULT 0 #define SCE_HEX_RECSTART 1 #define SCE_HEX_RECTYPE 2 #define SCE_HEX_RECTYPE_UNKNOWN 3 #define SCE_HEX_BYTECOUNT 4 #define SCE_HEX_BYTECOUNT_WRONG 5 #define SCE_HEX_NOADDRESS 6 #define SCE_HEX_DATAADDRESS 7 #define SCE_HEX_RECCOUNT 8 #define SCE_HEX_STARTADDRESS 9 #define SCE_HEX_ADDRESSFIELD_UNKNOWN 10 #define SCE_HEX_EXTENDEDADDRESS 11 #define SCE_HEX_DATA_ODD 12 #define SCE_HEX_DATA_EVEN 13 #define SCE_HEX_DATA_UNKNOWN 14 #define SCE_HEX_DATA_EMPTY 15 #define SCE_HEX_CHECKSUM 16 #define SCE_HEX_CHECKSUM_WRONG 17 #define SCE_HEX_GARBAGE 18 #define SCE_JSON_DEFAULT 0 #define SCE_JSON_NUMBER 1 #define SCE_JSON_STRING 2 #define SCE_JSON_STRINGEOL 3 #define SCE_JSON_PROPERTYNAME 4 #define SCE_JSON_ESCAPESEQUENCE 5 #define SCE_JSON_LINECOMMENT 6 #define SCE_JSON_BLOCKCOMMENT 7 #define SCE_JSON_OPERATOR 8 #define SCE_JSON_URI 9 #define SCE_JSON_COMPACTIRI 10 #define SCE_JSON_KEYWORD 11 #define SCE_JSON_LDKEYWORD 12 #define SCE_JSON_ERROR 13 #define SCE_EDI_DEFAULT 0 #define SCE_EDI_SEGMENTSTART 1 #define SCE_EDI_SEGMENTEND 2 #define SCE_EDI_SEP_ELEMENT 3 #define SCE_EDI_SEP_COMPOSITE 4 #define SCE_EDI_SEP_RELEASE 5 #define SCE_EDI_UNA 6 #define SCE_EDI_UNH 7 #define SCE_EDI_BADSEGMENT 8 #define SCE_STATA_DEFAULT 0 #define SCE_STATA_COMMENT 1 #define SCE_STATA_COMMENTLINE 2 #define SCE_STATA_COMMENTBLOCK 3 #define SCE_STATA_NUMBER 4 #define SCE_STATA_OPERATOR 5 #define SCE_STATA_IDENTIFIER 6 #define SCE_STATA_STRING 7 #define SCE_STATA_TYPE 8 #define SCE_STATA_WORD 9 #define SCE_STATA_GLOBAL_MACRO 10 #define SCE_STATA_MACRO 11 #define SCE_SAS_DEFAULT 0 #define SCE_SAS_COMMENT 1 #define SCE_SAS_COMMENTLINE 2 #define SCE_SAS_COMMENTBLOCK 3 #define SCE_SAS_NUMBER 4 #define SCE_SAS_OPERATOR 5 #define SCE_SAS_IDENTIFIER 6 #define SCE_SAS_STRING 7 #define SCE_SAS_TYPE 8 #define SCE_SAS_WORD 9 #define SCE_SAS_GLOBAL_MACRO 10 #define SCE_SAS_MACRO 11 #define SCE_SAS_MACRO_KEYWORD 12 #define SCE_SAS_BLOCK_KEYWORD 13 #define SCE_SAS_MACRO_FUNCTION 14 #define SCE_SAS_STATEMENT 15 #define SCE_NIM_DEFAULT 0 #define SCE_NIM_COMMENT 1 #define SCE_NIM_COMMENTDOC 2 #define SCE_NIM_COMMENTLINE 3 #define SCE_NIM_COMMENTLINEDOC 4 #define SCE_NIM_NUMBER 5 #define SCE_NIM_STRING 6 #define SCE_NIM_CHARACTER 7 #define SCE_NIM_WORD 8 #define SCE_NIM_TRIPLE 9 #define SCE_NIM_TRIPLEDOUBLE 10 #define SCE_NIM_BACKTICKS 11 #define SCE_NIM_FUNCNAME 12 #define SCE_NIM_STRINGEOL 13 #define SCE_NIM_NUMERROR 14 #define SCE_NIM_OPERATOR 15 #define SCE_NIM_IDENTIFIER 16 #define SCE_CIL_DEFAULT 0 #define SCE_CIL_COMMENT 1 #define SCE_CIL_COMMENTLINE 2 #define SCE_CIL_WORD 3 #define SCE_CIL_WORD2 4 #define SCE_CIL_WORD3 5 #define SCE_CIL_STRING 6 #define SCE_CIL_LABEL 7 #define SCE_CIL_OPERATOR 8 #define SCE_CIL_IDENTIFIER 9 #define SCE_CIL_STRINGEOL 10 #define SCE_X12_DEFAULT 0 #define SCE_X12_BAD 1 #define SCE_X12_ENVELOPE 2 #define SCE_X12_FUNCTIONGROUP 3 #define SCE_X12_TRANSACTIONSET 4 #define SCE_X12_SEGMENTHEADER 5 #define SCE_X12_SEGMENTEND 6 #define SCE_X12_SEP_ELEMENT 7 #define SCE_X12_SEP_SUBELEMENT 8 #define SCE_DF_DEFAULT 0 #define SCE_DF_IDENTIFIER 1 #define SCE_DF_METATAG 2 #define SCE_DF_IMAGE 3 #define SCE_DF_COMMENTLINE 4 #define SCE_DF_PREPROCESSOR 5 #define SCE_DF_PREPROCESSOR2 6 #define SCE_DF_NUMBER 7 #define SCE_DF_HEXNUMBER 8 #define SCE_DF_WORD 9 #define SCE_DF_STRING 10 #define SCE_DF_STRINGEOL 11 #define SCE_DF_SCOPEWORD 12 #define SCE_DF_OPERATOR 13 #define SCE_DF_ICODE 14 #define SCE_HOLLYWOOD_DEFAULT 0 #define SCE_HOLLYWOOD_COMMENT 1 #define SCE_HOLLYWOOD_COMMENTBLOCK 2 #define SCE_HOLLYWOOD_NUMBER 3 #define SCE_HOLLYWOOD_KEYWORD 4 #define SCE_HOLLYWOOD_STDAPI 5 #define SCE_HOLLYWOOD_PLUGINAPI 6 #define SCE_HOLLYWOOD_PLUGINMETHOD 7 #define SCE_HOLLYWOOD_STRING 8 #define SCE_HOLLYWOOD_STRINGBLOCK 9 #define SCE_HOLLYWOOD_PREPROCESSOR 10 #define SCE_HOLLYWOOD_OPERATOR 11 #define SCE_HOLLYWOOD_IDENTIFIER 12 #define SCE_HOLLYWOOD_CONSTANT 13 #define SCE_HOLLYWOOD_HEXNUMBER 14 #define SCE_RAKU_DEFAULT 0 #define SCE_RAKU_ERROR 1 #define SCE_RAKU_COMMENTLINE 2 #define SCE_RAKU_COMMENTEMBED 3 #define SCE_RAKU_POD 4 #define SCE_RAKU_CHARACTER 5 #define SCE_RAKU_HEREDOC_Q 6 #define SCE_RAKU_HEREDOC_QQ 7 #define SCE_RAKU_STRING 8 #define SCE_RAKU_STRING_Q 9 #define SCE_RAKU_STRING_QQ 10 #define SCE_RAKU_STRING_Q_LANG 11 #define SCE_RAKU_STRING_VAR 12 #define SCE_RAKU_REGEX 13 #define SCE_RAKU_REGEX_VAR 14 #define SCE_RAKU_ADVERB 15 #define SCE_RAKU_NUMBER 16 #define SCE_RAKU_PREPROCESSOR 17 #define SCE_RAKU_OPERATOR 18 #define SCE_RAKU_WORD 19 #define SCE_RAKU_FUNCTION 20 #define SCE_RAKU_IDENTIFIER 21 #define SCE_RAKU_TYPEDEF 22 #define SCE_RAKU_MU 23 #define SCE_RAKU_POSITIONAL 24 #define SCE_RAKU_ASSOCIATIVE 25 #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 #define SCE_ASCIIDOC_DEFAULT 0 #define SCE_ASCIIDOC_STRONG1 1 #define SCE_ASCIIDOC_STRONG2 2 #define SCE_ASCIIDOC_EM1 3 #define SCE_ASCIIDOC_EM2 4 #define SCE_ASCIIDOC_HEADER1 5 #define SCE_ASCIIDOC_HEADER2 6 #define SCE_ASCIIDOC_HEADER3 7 #define SCE_ASCIIDOC_HEADER4 8 #define SCE_ASCIIDOC_HEADER5 9 #define SCE_ASCIIDOC_HEADER6 10 #define SCE_ASCIIDOC_ULIST_ITEM 11 #define SCE_ASCIIDOC_OLIST_ITEM 12 #define SCE_ASCIIDOC_BLOCKQUOTE 13 #define SCE_ASCIIDOC_LINK 14 #define SCE_ASCIIDOC_CODEBK 15 #define SCE_ASCIIDOC_PASSBK 16 #define SCE_ASCIIDOC_COMMENT 17 #define SCE_ASCIIDOC_COMMENTBK 18 #define SCE_ASCIIDOC_LITERAL 19 #define SCE_ASCIIDOC_LITERALBK 20 #define SCE_ASCIIDOC_ATTRIB 21 #define SCE_ASCIIDOC_ATTRIBVAL 22 #define SCE_ASCIIDOC_MACRO 23 #define SCE_GD_DEFAULT 0 #define SCE_GD_COMMENTLINE 1 #define SCE_GD_NUMBER 2 #define SCE_GD_STRING 3 #define SCE_GD_CHARACTER 4 #define SCE_GD_WORD 5 #define SCE_GD_TRIPLE 6 #define SCE_GD_TRIPLEDOUBLE 7 #define SCE_GD_CLASSNAME 8 #define SCE_GD_FUNCNAME 9 #define SCE_GD_OPERATOR 10 #define SCE_GD_IDENTIFIER 11 #define SCE_GD_COMMENTBLOCK 12 #define SCE_GD_STRINGEOL 13 #define SCE_GD_WORD2 14 #define SCE_GD_ANNOTATION 15 #define SCE_GD_NODEPATH 16 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ #endif ================================================ FILE: lexilla/lexers/LexA68k.cxx ================================================ // Scintilla source code edit control /** @file LexA68k.cxx ** Lexer for Assembler, just for the MASM syntax ** Written by Martial Demolins AKA Folco **/ // Copyright 2010 Martial Demolins // The License.txt file describes the conditions under which this software // may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; // Return values for GetOperatorType #define NO_OPERATOR 0 #define OPERATOR_1CHAR 1 #define OPERATOR_2CHAR 2 /** * IsIdentifierStart * * Return true if the given char is a valid identifier first char */ static inline bool IsIdentifierStart (const int ch) { return (isalpha(ch) || (ch == '_') || (ch == '\\')); } /** * IsIdentifierChar * * Return true if the given char is a valid identifier char */ static inline bool IsIdentifierChar (const int ch) { return (isalnum(ch) || (ch == '_') || (ch == '@') || (ch == ':') || (ch == '.')); } /** * GetOperatorType * * Return: * NO_OPERATOR if char is not an operator * OPERATOR_1CHAR if the operator is one char long * OPERATOR_2CHAR if the operator is two chars long */ static inline int GetOperatorType (const int ch1, const int ch2) { int OpType = NO_OPERATOR; if ((ch1 == '+') || (ch1 == '-') || (ch1 == '*') || (ch1 == '/') || (ch1 == '#') || (ch1 == '(') || (ch1 == ')') || (ch1 == '~') || (ch1 == '&') || (ch1 == '|') || (ch1 == ',')) OpType = OPERATOR_1CHAR; else if ((ch1 == ch2) && (ch1 == '<' || ch1 == '>')) OpType = OPERATOR_2CHAR; return OpType; } /** * IsBin * * Return true if the given char is 0 or 1 */ static inline bool IsBin (const int ch) { return (ch == '0') || (ch == '1'); } /** * IsDoxygenChar * * Return true if the char may be part of a Doxygen keyword */ static inline bool IsDoxygenChar (const int ch) { return isalpha(ch) || (ch == '$') || (ch == '[') || (ch == ']') || (ch == '{') || (ch == '}'); } /** * ColouriseA68kDoc * * Main function, which colourises a 68k source */ static void ColouriseA68kDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { // Used to buffer a string, to be able to compare it using built-in functions char Buffer[100]; // Used to know the length of an operator int OpType; // Get references to keywords lists WordList &cpuInstruction = *keywordlists[0]; WordList ®isters = *keywordlists[1]; WordList &directive = *keywordlists[2]; WordList &extInstruction = *keywordlists[3]; WordList &alert = *keywordlists[4]; WordList &doxygenKeyword = *keywordlists[5]; // Instanciate a context for our source StyleContext sc(startPos, length, initStyle, styler); /************************************************************ * * Parse the source * ************************************************************/ for ( ; sc.More(); sc.Forward()) { /************************************************************ * * A style always terminates at the end of a line, even for * comments (no multi-lines comments) * ************************************************************/ if (sc.atLineStart) { sc.SetState(SCE_A68K_DEFAULT); } /************************************************************ * * If we are not in "default style", check if the style continues * In this case, we just have to loop * ************************************************************/ if (sc.state != SCE_A68K_DEFAULT) { if ( ((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number || ((sc.state == SCE_A68K_NUMBER_BIN) && IsBin(sc.ch)) // Binary number || ((sc.state == SCE_A68K_NUMBER_HEX) && isxdigit(sc.ch)) // Hexa number || ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument || ((sc.state == SCE_A68K_STRING1) && (sc.ch != '\'')) // String single-quoted || ((sc.state == SCE_A68K_STRING2) && (sc.ch != '\"')) // String double-quoted || ((sc.state == SCE_A68K_MACRO_DECLARATION) && IsIdentifierChar(sc.ch)) // Macro declaration (or global label, we don't know at this point) || ((sc.state == SCE_A68K_IDENTIFIER) && IsIdentifierChar(sc.ch)) // Identifier || ((sc.state == SCE_A68K_LABEL) && IsIdentifierChar(sc.ch)) // Label (local) || ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && IsDoxygenChar(sc.ch)) // Doxygen keyword || ((sc.state == SCE_A68K_COMMENT_SPECIAL) && isalpha(sc.ch)) // Alert || ((sc.state == SCE_A68K_COMMENT) && !isalpha(sc.ch) && (sc.ch != '\\'))) // Normal comment { continue; } /************************************************************ * * Check if current state terminates * ************************************************************/ // Strings: include terminal ' or " in the current string by skipping it if ((sc.state == SCE_A68K_STRING1) || (sc.state == SCE_A68K_STRING2)) { sc.Forward(); } // If a macro declaration was terminated with ':', it was a label else if ((sc.state == SCE_A68K_MACRO_DECLARATION) && (sc.chPrev == ':')) { sc.ChangeState(SCE_A68K_LABEL); } // If it wasn't a Doxygen keyword, change it to normal comment else if (sc.state == SCE_A68K_COMMENT_DOXYGEN) { sc.GetCurrent(Buffer, sizeof(Buffer)); if (!doxygenKeyword.InList(Buffer)) { sc.ChangeState(SCE_A68K_COMMENT); } sc.SetState(SCE_A68K_COMMENT); continue; } // If it wasn't an Alert, change it to normal comment else if (sc.state == SCE_A68K_COMMENT_SPECIAL) { sc.GetCurrent(Buffer, sizeof(Buffer)); if (!alert.InList(Buffer)) { sc.ChangeState(SCE_A68K_COMMENT); } // Reset style to normal comment, or to Doxygen keyword if it begins with '\' if (sc.ch == '\\') { sc.SetState(SCE_A68K_COMMENT_DOXYGEN); } else { sc.SetState(SCE_A68K_COMMENT); } continue; } // If we are in a comment, it's a Doxygen keyword or an Alert else if (sc.state == SCE_A68K_COMMENT) { if (sc.ch == '\\') { sc.SetState(SCE_A68K_COMMENT_DOXYGEN); } else { sc.SetState(SCE_A68K_COMMENT_SPECIAL); } continue; } // Check if we are at the end of an identifier // In this case, colourise it if was a keyword. else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) { sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context if (cpuInstruction.InList(Buffer)) { // And check if it belongs to a keyword list sc.ChangeState(SCE_A68K_CPUINSTRUCTION); } else if (extInstruction.InList(Buffer)) { sc.ChangeState(SCE_A68K_EXTINSTRUCTION); } else if (registers.InList(Buffer)) { sc.ChangeState(SCE_A68K_REGISTER); } else if (directive.InList(Buffer)) { sc.ChangeState(SCE_A68K_DIRECTIVE); } } // All special contexts are now handled.Come back to default style sc.SetState(SCE_A68K_DEFAULT); } /************************************************************ * * Check if we must enter a new state * ************************************************************/ // Something which begins at the beginning of a line, and with // - '\' + an identifier start char, or // - '\\@' + an identifier start char // is a local label (second case is used for macro local labels). We set it already as a label, it can't be a macro/equ declaration if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.chNext) && (sc.ch == '\\')) { sc.SetState(SCE_A68K_LABEL); } if (sc.atLineStart && (sc.ch < 0x80) && (sc.ch == '\\') && (sc.chNext == '\\')) { sc.Forward(2); if ((sc.ch == '@') && IsIdentifierStart(sc.chNext)) { sc.ChangeState(SCE_A68K_LABEL); sc.SetState(SCE_A68K_LABEL); } } // Label and macro identifiers start at the beginning of a line // We set both as a macro id, but if it wasn't one (':' at the end), // it will be changed as a label. if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { sc.SetState(SCE_A68K_MACRO_DECLARATION); } else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Default: alert in a comment. If it doesn't match sc.SetState(SCE_A68K_COMMENT); // with an alert, it will be toggle to a normal comment } else if ((sc.ch < 0x80) && isdigit(sc.ch)) { // Decimal numbers haven't prefix sc.SetState(SCE_A68K_NUMBER_DEC); } else if ((sc.ch < 0x80) && (sc.ch == '%')) { // Binary numbers are prefixed with '%' sc.SetState(SCE_A68K_NUMBER_BIN); } else if ((sc.ch < 0x80) && (sc.ch == '$')) { // Hexadecimal numbers are prefixed with '$' sc.SetState(SCE_A68K_NUMBER_HEX); } else if ((sc.ch < 0x80) && (sc.ch == '\'')) { // String (single-quoted) sc.SetState(SCE_A68K_STRING1); } else if ((sc.ch < 0x80) && (sc.ch == '\"')) { // String (double-quoted) sc.SetState(SCE_A68K_STRING2); } else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro are prefixed with '\' sc.SetState(SCE_A68K_MACRO_ARG); } else if ((sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { // An identifier: constant, label, etc... sc.SetState(SCE_A68K_IDENTIFIER); } else { if (sc.ch < 0x80) { OpType = GetOperatorType(sc.ch, sc.chNext); // Check if current char is an operator if (OpType != NO_OPERATOR) { sc.SetState(SCE_A68K_OPERATOR); if (OpType == OPERATOR_2CHAR) { // Check if the operator is 2 bytes long sc.ForwardSetState(SCE_A68K_OPERATOR); // (>> or <<) } } } } } // End of for() sc.Complete(); } // Names of the keyword lists static const char * const a68kWordListDesc[] = { "CPU instructions", "Registers", "Directives", "Extended instructions", "Comment special words", "Doxygen keywords", 0 }; LexerModule lmA68k(SCLEX_A68K, ColouriseA68kDoc, "a68k", 0, a68kWordListDesc); ================================================ FILE: lexilla/lexers/LexAPDL.cxx ================================================ // Scintilla source code edit control /** @file LexAPDL.cxx ** Lexer for APDL. Based on the lexer for Assembler by The Black Horus. ** By Hadar Raz. **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsAWordChar(const int ch) { return (ch < 0x80 && (isalnum(ch) || ch == '_')); } static inline bool IsAnOperator(char ch) { // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '^' || ch == '[' || ch == ']' || ch == '<' || ch == '&' || ch == '>' || ch == ',' || ch == '|' || ch == '~' || ch == '$' || ch == ':' || ch == '%') return true; return false; } static void ColouriseAPDLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { int stringStart = ' '; WordList &processors = *keywordlists[0]; WordList &commands = *keywordlists[1]; WordList &slashcommands = *keywordlists[2]; WordList &starcommands = *keywordlists[3]; WordList &arguments = *keywordlists[4]; WordList &functions = *keywordlists[5]; // Do not leak onto next line initStyle = SCE_APDL_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // Determine if the current state should terminate. if (sc.state == SCE_APDL_NUMBER) { if (!(IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { sc.SetState(SCE_APDL_DEFAULT); } } else if (sc.state == SCE_APDL_COMMENT) { if (sc.atLineEnd) { sc.SetState(SCE_APDL_DEFAULT); } } else if (sc.state == SCE_APDL_COMMENTBLOCK) { if (sc.atLineEnd) { if (sc.ch == '\r') { sc.Forward(); } sc.ForwardSetState(SCE_APDL_DEFAULT); } } else if (sc.state == SCE_APDL_STRING) { if (sc.atLineEnd) { sc.SetState(SCE_APDL_DEFAULT); } else if ((sc.ch == '\'' && stringStart == '\'') || (sc.ch == '\"' && stringStart == '\"')) { sc.ForwardSetState(SCE_APDL_DEFAULT); } } else if (sc.state == SCE_APDL_WORD) { if (!IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (processors.InList(s)) { sc.ChangeState(SCE_APDL_PROCESSOR); } else if (slashcommands.InList(s)) { sc.ChangeState(SCE_APDL_SLASHCOMMAND); } else if (starcommands.InList(s)) { sc.ChangeState(SCE_APDL_STARCOMMAND); } else if (commands.InList(s)) { sc.ChangeState(SCE_APDL_COMMAND); } else if (arguments.InList(s)) { sc.ChangeState(SCE_APDL_ARGUMENT); } else if (functions.InList(s)) { sc.ChangeState(SCE_APDL_FUNCTION); } sc.SetState(SCE_APDL_DEFAULT); } } else if (sc.state == SCE_APDL_OPERATOR) { if (!IsAnOperator(static_cast(sc.ch))) { sc.SetState(SCE_APDL_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_APDL_DEFAULT) { if (sc.ch == '!' && sc.chNext == '!') { sc.SetState(SCE_APDL_COMMENTBLOCK); } else if (sc.ch == '!') { sc.SetState(SCE_APDL_COMMENT); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_APDL_NUMBER); } else if (sc.ch == '\'' || sc.ch == '\"') { sc.SetState(SCE_APDL_STRING); stringStart = sc.ch; } else if (IsAWordChar(sc.ch) || ((sc.ch == '*' || sc.ch == '/') && !isgraph(sc.chPrev))) { sc.SetState(SCE_APDL_WORD); } else if (IsAnOperator(static_cast(sc.ch))) { sc.SetState(SCE_APDL_OPERATOR); } } } sc.Complete(); } //------------------------------------------------------------------------------ // 06-27-07 Sergio Lucato // - Included code folding for Ansys APDL lexer // - Copyied from LexBasic.cxx and modified for APDL //------------------------------------------------------------------------------ /* Bits: * 1 - whitespace * 2 - operator * 4 - identifier * 8 - decimal digit * 16 - hex digit * 32 - bin digit */ static int character_classification[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 10, 6, 60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2, 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4, 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0 }; static bool IsSpace(int c) { return c < 128 && (character_classification[c] & 1); } static bool IsIdentifier(int c) { return c < 128 && (character_classification[c] & 4); } static int LowerCase(int c) { if (c >= 'A' && c <= 'Z') return 'a' + c - 'A'; return c; } static int CheckAPDLFoldPoint(char const *token, int &level) { if (!strcmp(token, "*if") || !strcmp(token, "*do") || !strcmp(token, "*dowhile") ) { level |= SC_FOLDLEVELHEADERFLAG; return 1; } if (!strcmp(token, "*endif") || !strcmp(token, "*enddo") ) { return -1; } return 0; } static void FoldAPDLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { Sci_Position line = styler.GetLine(startPos); int level = styler.LevelAt(line); int go = 0, done = 0; Sci_Position endPos = startPos + length; char word[256]; int wordlen = 0; Sci_Position i; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; // Scan for tokens at the start of the line (they may include // whitespace, for tokens like "End Function" for (i = startPos; i < endPos; i++) { int c = styler.SafeGetCharAt(i); if (!done && !go) { if (wordlen) { // are we scanning a token already? word[wordlen] = static_cast(LowerCase(c)); if (!IsIdentifier(c)) { // done with token word[wordlen] = '\0'; go = CheckAPDLFoldPoint(word, level); if (!go) { // Treat any whitespace as single blank, for // things like "End Function". if (IsSpace(c) && IsIdentifier(word[wordlen - 1])) { word[wordlen] = ' '; if (wordlen < 255) wordlen++; } else // done with this line done = 1; } } else if (wordlen < 255) { wordlen++; } } else { // start scanning at first non-whitespace character if (!IsSpace(c)) { if (IsIdentifier(c)) { word[0] = static_cast(LowerCase(c)); wordlen = 1; } else // done with this line done = 1; } } } if (c == '\n') { // line end if (!done && wordlen == 0 && foldCompact) // line was only space level |= SC_FOLDLEVELWHITEFLAG; if (level != styler.LevelAt(line)) styler.SetLevel(line, level); level += go; line++; // reset state wordlen = 0; level &= ~SC_FOLDLEVELHEADERFLAG; level &= ~SC_FOLDLEVELWHITEFLAG; go = 0; done = 0; } } } static const char * const apdlWordListDesc[] = { "processors", "commands", "slashommands", "starcommands", "arguments", "functions", 0 }; LexerModule lmAPDL(SCLEX_APDL, ColouriseAPDLDoc, "apdl", FoldAPDLDoc, apdlWordListDesc); ================================================ FILE: lexilla/lexers/LexASY.cxx ================================================ // Scintilla source code edit control // @file LexASY.cxx //Author: instanton (email: soft_share126com) // This lexer is for the Asymptote vector graphics language // https://en.wikipedia.org/wiki/Asymptote_(vector_graphics_language) // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static void ColouriseAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); int visibleChars = 0; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { if (sc.state == SCE_ASY_STRING) { sc.SetState(SCE_ASY_STRING); } visibleChars = 0; } if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } // continuationLine = true; continue; } } // Determine if the current state should terminate. switch (sc.state) { case SCE_ASY_OPERATOR: sc.SetState(SCE_ASY_DEFAULT); break; case SCE_ASY_NUMBER: if (!setWord.Contains(sc.ch)) { sc.SetState(SCE_ASY_DEFAULT); } break; case SCE_ASY_IDENTIFIER: if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { char s[1000]; sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_ASY_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_ASY_WORD2); } sc.SetState(SCE_ASY_DEFAULT); } break; case SCE_ASY_COMMENT: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_ASY_DEFAULT); } break; case SCE_ASY_COMMENTLINE: if (sc.atLineStart) { sc.SetState(SCE_ASY_DEFAULT); } break; case SCE_ASY_STRING: if (sc.atLineEnd) { sc.ChangeState(SCE_ASY_STRINGEOL); } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_ASY_DEFAULT); } break; case SCE_ASY_CHARACTER: if (sc.atLineEnd) { sc.ChangeState(SCE_ASY_STRINGEOL); } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_ASY_DEFAULT); } break; } // Determine if a new state should be entered. if (sc.state == SCE_ASY_DEFAULT) { if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) { sc.SetState(SCE_ASY_IDENTIFIER); } else if (sc.Match('/', '*')) { sc.SetState(SCE_ASY_COMMENT); sc.Forward(); // } else if (sc.Match('/', '/')) { sc.SetState(SCE_ASY_COMMENTLINE); } else if (sc.ch == '\"') { sc.SetState(SCE_ASY_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_ASY_CHARACTER); } else if (sc.ch == '#' && visibleChars == 0) { do { sc.Forward(); } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); if (sc.atLineEnd) { sc.SetState(SCE_ASY_DEFAULT); } } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_ASY_OPERATOR); } } } sc.Complete(); } static bool IsAsyCommentStyle(int style) { return style == SCE_ASY_COMMENT; } static inline bool isASYidentifier(int ch) { return ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ; } static int ParseASYWord(Sci_PositionU pos, Accessor &styler, char *word) { int length=0; char ch=styler.SafeGetCharAt(pos); *word=0; while(isASYidentifier(ch) && length<100){ word[length]=ch; length++; ch=styler.SafeGetCharAt(pos+length); } word[length]=0; return length; } static bool IsASYDrawingLine(Sci_Position line, Accessor &styler) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; Sci_Position startpos = pos; char buffer[100]=""; while (startpos 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && IsAsyCommentStyle(style)) { if (!IsAsyCommentStyle(stylePrev) && (stylePrev != SCE_ASY_COMMENTLINEDOC)) { levelNext++; } else if (!IsAsyCommentStyle(styleNext) && (styleNext != SCE_ASY_COMMENTLINEDOC) && !atEOL) { levelNext--; } } if (style == SCE_ASY_OPERATOR) { if (ch == '{') { if (levelMinCurrent > levelNext) { levelMinCurrent = levelNext; } levelNext++; } else if (ch == '}') { levelNext--; } } if (atEOL && IsASYDrawingLine(lineCurrent, styler)){ if (lineCurrent==0 && IsASYDrawingLine(lineCurrent + 1, styler)) levelNext++; else if (lineCurrent!=0 && !IsASYDrawingLine(lineCurrent - 1, styler) && IsASYDrawingLine(lineCurrent + 1, styler) ) levelNext++; else if (lineCurrent!=0 && IsASYDrawingLine(lineCurrent - 1, styler) && !IsASYDrawingLine(lineCurrent+1, styler)) levelNext--; } if (atEOL) { int levelUse = levelCurrent; if (foldAtElse) { levelUse = levelMinCurrent; } int lev = levelUse | levelNext << 16; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelCurrent = levelNext; levelMinCurrent = levelCurrent; visibleChars = 0; } if (!IsASpace(ch)) visibleChars++; } } static const char * const asyWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", 0, }; LexerModule lmASY(SCLEX_ASYMPTOTE, ColouriseAsyDoc, "asy", FoldAsyDoc, asyWordLists); ================================================ FILE: lexilla/lexers/LexAU3.cxx ================================================ // Scintilla source code edit control // @file LexAU3.cxx // Lexer for AutoIt3 https://www.autoitscript.com/site/ // by Jos van der Zande, jvdzande@yahoo.com // // Changes: // March 28, 2004 - Added the standard Folding code // April 21, 2004 - Added Preprosessor Table + Syntax Highlighting // Fixed Number highlighting // Changed default isoperator to IsAOperator to have a better match to AutoIt3 // Fixed "#comments_start" -> "#comments-start" // Fixed "#comments_end" -> "#comments-end" // Fixed Sendkeys in Strings when not terminated with } // Added support for Sendkey strings that have second parameter e.g. {UP 5} or {a down} // April 26, 2004 - Fixed # pre-processor statement inside of comment block would invalidly change the color. // Added logic for #include to treat the <> as string // Added underscore to IsAOperator. // May 17, 2004 - Changed the folding logic from indent to keyword folding. // Added Folding logic for blocks of single-commentlines or commentblock. // triggered by: fold.comment=1 // Added Folding logic for preprocessor blocks triggered by fold.preprocessor=1 // Added Special for #region - #endregion syntax highlight and folding. // May 30, 2004 - Fixed issue with continuation lines on If statements. // June 5, 2004 - Added comma to Operators for better readability. // Added fold.compact support set with fold.compact=1 // Changed folding inside of #cs-#ce. Default is no keyword folding inside comment blocks when fold.comment=1 // it will now only happen when fold.comment=2. // Sep 5, 2004 - Added logic to handle colourizing words on the last line. // Typed Characters now show as "default" till they match any table. // Oct 10, 2004 - Added logic to show Comments in "Special" directives. // Nov 1, 2004 - Added better testing for Numbers supporting x and e notation. // Nov 28, 2004 - Added logic to handle continuation lines for syntax highlighting. // Jan 10, 2005 - Added Abbreviations Keyword used for expansion // Mar 24, 2005 - Updated Abbreviations Keywords to fix when followed by Operator. // Apr 18, 2005 - Updated #CE/#Comment-End logic to take a linecomment ";" into account // - Added folding support for With...EndWith // - Added support for a DOT in variable names // - Fixed Underscore in CommentBlock // May 23, 2005 - Fixed the SentKey lexing in case of a missing } // Aug 11, 2005 - Fixed possible bug with s_save length > 100. // Aug 23, 2005 - Added Switch/endswitch support to the folding logic. // Sep 27, 2005 - Fixed the SentKey lexing logic in case of multiple sentkeys. // Mar 12, 2006 - Fixed issue with <> coloring as String in stead of Operator in rare occasions. // Apr 8, 2006 - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF) // Mar 9, 2007 - Fixed bug with + following a String getting the wrong Color. // Jun 20, 2007 - Fixed Commentblock issue when LF's are used as EOL. // Jul 26, 2007 - Fixed #endregion undetected bug. // // Copyright for Scintilla: 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. // Scintilla source code edit control #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsTypeCharacter(const int ch) { return ch == '$'; } static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '@' || ch == '#' || ch == '$' || ch == '.'); } static inline bool IsAOperator(char ch) { if (IsASCII(ch) && isalnum(ch)) return false; if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '&' || ch == '^' || ch == '=' || ch == '<' || ch == '>' || ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == ',' ) return true; return false; } /////////////////////////////////////////////////////////////////////////////// // GetSendKey() filters the portion before and after a/multiple space(s) // and return the first portion to be looked-up in the table // also check if the second portion is valid... (up,down.on.off,toggle or a number) /////////////////////////////////////////////////////////////////////////////// static int GetSendKey(const char *szLine, char *szKey) { int nFlag = 0; int nStartFound = 0; int nKeyPos = 0; int nSpecPos= 0; int nSpecNum= 1; int nPos = 0; char cTemp; char szSpecial[100]; // split the portion of the sendkey in the part before and after the spaces while ( ( (cTemp = szLine[nPos]) != '\0')) { // skip leading Ctrl/Shift/Alt state if (cTemp == '{') { nStartFound = 1; } // if (nStartFound == 1) { if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space { nFlag = 1; // Add } to the end of the first bit for table lookup later. szKey[nKeyPos++] = '}'; } else if (cTemp == ' ') { // skip other spaces } else if (nFlag == 0) { // save first portion into var till space or } is hit szKey[nKeyPos++] = cTemp; } else if ((nFlag == 1) && (cTemp != '}')) { // Save second portion into var... szSpecial[nSpecPos++] = cTemp; // check if Second portion is all numbers for repeat fuction if (isdigit(cTemp) == false) {nSpecNum = 0;} } } nPos++; // skip to next char } // End While // Check if the second portion is either a number or one of these keywords szKey[nKeyPos] = '\0'; szSpecial[nSpecPos] = '\0'; if (strcmp(szSpecial,"down")== 0 || strcmp(szSpecial,"up")== 0 || strcmp(szSpecial,"on")== 0 || strcmp(szSpecial,"off")== 0 || strcmp(szSpecial,"toggle")== 0 || nSpecNum == 1 ) { nFlag = 0; } else { nFlag = 1; } return nFlag; // 1 is bad, 0 is good } // GetSendKey() // // Routine to check the last "none comment" character on a line to see if its a continuation // static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler) { Sci_Position nsPos = styler.LineStart(szLine); Sci_Position nePos = styler.LineStart(szLine+1) - 2; //int stylech = styler.StyleAt(nsPos); while (nsPos < nePos) { //stylech = styler.StyleAt(nePos); int stylech = styler.StyleAt(nsPos); if (!(stylech == SCE_AU3_COMMENT)) { char ch = styler.SafeGetCharAt(nePos); if (!isspacechar(ch)) { if (ch == '_') return true; else return false; } } nePos--; // skip to next char } // End While return false; } // IsContinuationLine() // // syntax highlighting logic static void ColouriseAU3Doc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; WordList &keywords5 = *keywordlists[4]; WordList &keywords6 = *keywordlists[5]; WordList &keywords7 = *keywordlists[6]; WordList &keywords8 = *keywordlists[7]; // find the first previous line without continuation character at the end Sci_Position lineCurrent = styler.GetLine(startPos); Sci_Position s_startPos = startPos; // When not inside a Block comment: find First line without _ if (!(initStyle==SCE_AU3_COMMENTBLOCK)) { while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) || (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) { lineCurrent--; startPos = styler.LineStart(lineCurrent); // get start position initStyle = 0; // reset the start style to 0 } } // Set the new length to include it from the start and set the start position length = length + s_startPos - startPos; // correct the total length to process styler.StartAt(startPos); StyleContext sc(startPos, length, initStyle, styler); char si; // string indicator "=1 '=2 char ni; // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3 char ci; // comment indicator 0=not linecomment(;) char s_save[100] = ""; si=0; ni=0; ci=0; //$$$ for (; sc.More(); sc.Forward()) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); // ********************************************** // save the total current word for eof processing if (IsAWordChar(sc.ch) || sc.ch == '}') { strcpy(s_save,s); int tp = static_cast(strlen(s_save)); if (tp < 99) { s_save[tp] = static_cast(tolower(sc.ch)); s_save[tp+1] = '\0'; } } // ********************************************** // switch (sc.state) { case SCE_AU3_COMMENTBLOCK: { //Reset at line end if (sc.atLineEnd) { ci=0; if (strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0) { if (sc.atLineEnd) sc.SetState(SCE_AU3_DEFAULT); else sc.SetState(SCE_AU3_COMMENTBLOCK); } break; } //skip rest of line when a ; is encountered if (sc.chPrev == ';') { ci=2; sc.SetState(SCE_AU3_COMMENTBLOCK); } // skip rest of the line if (ci==2) break; // check when first character is detected on the line if (ci==0) { if (IsAWordStart(static_cast(sc.ch)) || IsAOperator(static_cast(sc.ch))) { ci=1; sc.SetState(SCE_AU3_COMMENTBLOCK); } break; } if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && strcmp(s, "#comments") == 0))) { if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0)) sc.SetState(SCE_AU3_COMMENT); // set to comment line for the rest of the line else ci=2; // line doesn't begin with #CE so skip the rest of the line } break; } case SCE_AU3_COMMENT: { if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);} break; } case SCE_AU3_OPERATOR: { // check if its a COMobject if (sc.chPrev == '.' && IsAWordChar(sc.ch)) { sc.SetState(SCE_AU3_COMOBJ); } else { sc.SetState(SCE_AU3_DEFAULT); } break; } case SCE_AU3_SPECIAL: { if (sc.ch == ';') {sc.SetState(SCE_AU3_COMMENT);} if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);} break; } case SCE_AU3_KEYWORD: { if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && (strcmp(s, "#comments") == 0 || strcmp(s, "#include") == 0)))) { if (!IsTypeCharacter(sc.ch)) { if (strcmp(s, "#cs")== 0 || strcmp(s, "#comments-start")== 0 ) { sc.ChangeState(SCE_AU3_COMMENTBLOCK); sc.SetState(SCE_AU3_COMMENTBLOCK); break; } else if (keywords.InList(s)) { sc.ChangeState(SCE_AU3_KEYWORD); sc.SetState(SCE_AU3_DEFAULT); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_AU3_FUNCTION); sc.SetState(SCE_AU3_DEFAULT); } else if (keywords3.InList(s)) { sc.ChangeState(SCE_AU3_MACRO); sc.SetState(SCE_AU3_DEFAULT); } else if (keywords5.InList(s)) { sc.ChangeState(SCE_AU3_PREPROCESSOR); sc.SetState(SCE_AU3_DEFAULT); if (strcmp(s, "#include")== 0) { si = 3; // use to determine string start for #inlude <> } } else if (keywords6.InList(s)) { sc.ChangeState(SCE_AU3_SPECIAL); sc.SetState(SCE_AU3_SPECIAL); } else if ((keywords7.InList(s)) && (!IsAOperator(static_cast(sc.ch)))) { sc.ChangeState(SCE_AU3_EXPAND); sc.SetState(SCE_AU3_DEFAULT); } else if (keywords8.InList(s)) { sc.ChangeState(SCE_AU3_UDF); sc.SetState(SCE_AU3_DEFAULT); } else if (strcmp(s, "_") == 0) { sc.ChangeState(SCE_AU3_OPERATOR); sc.SetState(SCE_AU3_DEFAULT); } else if (!IsAWordChar(sc.ch)) { sc.ChangeState(SCE_AU3_DEFAULT); sc.SetState(SCE_AU3_DEFAULT); } } } if (sc.atLineEnd) { sc.SetState(SCE_AU3_DEFAULT);} break; } case SCE_AU3_NUMBER: { // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 E-not=3 // // test for Hex notation if (strcmp(s, "0") == 0 && (sc.ch == 'x' || sc.ch == 'X') && ni == 0) { ni = 2; break; } // test for E notation if (IsADigit(sc.chPrev) && (sc.ch == 'e' || sc.ch == 'E') && ni <= 1) { ni = 3; break; } // Allow Hex characters inside hex numeric strings if ((ni == 2) && (sc.ch == 'a' || sc.ch == 'b' || sc.ch == 'c' || sc.ch == 'd' || sc.ch == 'e' || sc.ch == 'f' || sc.ch == 'A' || sc.ch == 'B' || sc.ch == 'C' || sc.ch == 'D' || sc.ch == 'E' || sc.ch == 'F' )) { break; } // test for 1 dec point only if (sc.ch == '.') { if (ni==0) { ni=1; } else { ni=9; } break; } // end of numeric string ? if (!(IsADigit(sc.ch))) { if (ni==9) { sc.ChangeState(SCE_AU3_DEFAULT); } sc.SetState(SCE_AU3_DEFAULT); } break; } case SCE_AU3_VARIABLE: { // Check if its a COMObject if (sc.ch == '.' && !IsADigit(sc.chNext)) { sc.SetState(SCE_AU3_OPERATOR); } else if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_AU3_DEFAULT); } break; } case SCE_AU3_COMOBJ: { if (!(IsAWordChar(sc.ch))) { sc.SetState(SCE_AU3_DEFAULT); } break; } case SCE_AU3_STRING: { // check for " to end a double qouted string or // check for ' to end a single qouted string if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>')) { sc.ForwardSetState(SCE_AU3_DEFAULT); si=0; break; } if (sc.atLineEnd) { si=0; // at line end and not found a continuation char then reset to default Sci_Position lineCurrent = styler.GetLine(sc.currentPos); if (!IsContinuationLine(lineCurrent,styler)) { sc.SetState(SCE_AU3_DEFAULT); break; } } // find Sendkeys in a STRING if (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ) { sc.SetState(SCE_AU3_SENT);} break; } case SCE_AU3_SENT: { // Send key string ended if (sc.chPrev == '}' && sc.ch != '}') { // set color to SENDKEY when valid sendkey .. else set back to regular string char sk[100]; // split {111 222} and return {111} and check if 222 is valid. // if return code = 1 then invalid 222 so must be string if (GetSendKey(s,sk)) { sc.ChangeState(SCE_AU3_STRING); } // if single char between {?} then its ok as sendkey for a single character else if (strlen(sk) == 3) { sc.ChangeState(SCE_AU3_SENT); } // if sendkey {111} is in table then ok as sendkey else if (keywords4.InList(sk)) { sc.ChangeState(SCE_AU3_SENT); } else { sc.ChangeState(SCE_AU3_STRING); } sc.SetState(SCE_AU3_STRING); } else { // check if the start is a valid SendKey start Sci_Position nPos = 0; int nState = 1; char cTemp; while (!(nState == 2) && ((cTemp = s[nPos]) != '\0')) { if (cTemp == '{' && nState == 1) { nState = 2; } if (nState == 1 && !(cTemp == '+' || cTemp == '!' || cTemp == '^' || cTemp == '#' )) { nState = 0; } nPos++; } //Verify characters infront of { ... if not assume regular string if (nState == 1 && (!(sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ))) { sc.ChangeState(SCE_AU3_STRING); sc.SetState(SCE_AU3_STRING); } // If invalid character found then assume its a regular string if (nState == 0) { sc.ChangeState(SCE_AU3_STRING); sc.SetState(SCE_AU3_STRING); } } // check if next portion is again a sendkey if (sc.atLineEnd) { sc.ChangeState(SCE_AU3_STRING); sc.SetState(SCE_AU3_DEFAULT); si = 0; // reset string indicator } //* check in next characters following a sentkey are again a sent key // Need this test incase of 2 sentkeys like {F1}{ENTER} but not detect {{} if (sc.state == SCE_AU3_STRING && (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' )) { sc.SetState(SCE_AU3_SENT);} // check to see if the string ended... // Sendkey string isn't complete but the string ended.... if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'')) { sc.ChangeState(SCE_AU3_STRING); sc.ForwardSetState(SCE_AU3_DEFAULT); } break; } } //switch (sc.state) // Determine if a new state should be entered: if (sc.state == SCE_AU3_DEFAULT) { if (sc.ch == ';') {sc.SetState(SCE_AU3_COMMENT);} else if (sc.ch == '#') {sc.SetState(SCE_AU3_KEYWORD);} else if (sc.ch == '$') {sc.SetState(SCE_AU3_VARIABLE);} else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);} else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);} //else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);} else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include else if (sc.ch == '\"') { sc.SetState(SCE_AU3_STRING); si = 1; } else if (sc.ch == '\'') { sc.SetState(SCE_AU3_STRING); si = 2; } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_AU3_NUMBER); ni = 0; } else if (IsAWordStart(sc.ch)) {sc.SetState(SCE_AU3_KEYWORD);} else if (IsAOperator(static_cast(sc.ch))) {sc.SetState(SCE_AU3_OPERATOR);} else if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);} } } //for (; sc.More(); sc.Forward()) //************************************* // Colourize the last word correctly //************************************* if (sc.state == SCE_AU3_KEYWORD) { if (strcmp(s_save, "#cs")== 0 || strcmp(s_save, "#comments-start")== 0 ) { sc.ChangeState(SCE_AU3_COMMENTBLOCK); sc.SetState(SCE_AU3_COMMENTBLOCK); } else if (keywords.InList(s_save)) { sc.ChangeState(SCE_AU3_KEYWORD); sc.SetState(SCE_AU3_KEYWORD); } else if (keywords2.InList(s_save)) { sc.ChangeState(SCE_AU3_FUNCTION); sc.SetState(SCE_AU3_FUNCTION); } else if (keywords3.InList(s_save)) { sc.ChangeState(SCE_AU3_MACRO); sc.SetState(SCE_AU3_MACRO); } else if (keywords5.InList(s_save)) { sc.ChangeState(SCE_AU3_PREPROCESSOR); sc.SetState(SCE_AU3_PREPROCESSOR); } else if (keywords6.InList(s_save)) { sc.ChangeState(SCE_AU3_SPECIAL); sc.SetState(SCE_AU3_SPECIAL); } else if (keywords7.InList(s_save) && sc.atLineEnd) { sc.ChangeState(SCE_AU3_EXPAND); sc.SetState(SCE_AU3_EXPAND); } else if (keywords8.InList(s_save)) { sc.ChangeState(SCE_AU3_UDF); sc.SetState(SCE_AU3_UDF); } else { sc.ChangeState(SCE_AU3_DEFAULT); sc.SetState(SCE_AU3_DEFAULT); } } if (sc.state == SCE_AU3_SENT) { // Send key string ended if (sc.chPrev == '}' && sc.ch != '}') { // set color to SENDKEY when valid sendkey .. else set back to regular string char sk[100]; // split {111 222} and return {111} and check if 222 is valid. // if return code = 1 then invalid 222 so must be string if (GetSendKey(s_save,sk)) { sc.ChangeState(SCE_AU3_STRING); } // if single char between {?} then its ok as sendkey for a single character else if (strlen(sk) == 3) { sc.ChangeState(SCE_AU3_SENT); } // if sendkey {111} is in table then ok as sendkey else if (keywords4.InList(sk)) { sc.ChangeState(SCE_AU3_SENT); } else { sc.ChangeState(SCE_AU3_STRING); } sc.SetState(SCE_AU3_STRING); } // check if next portion is again a sendkey if (sc.atLineEnd) { sc.ChangeState(SCE_AU3_STRING); sc.SetState(SCE_AU3_DEFAULT); } } //************************************* sc.Complete(); } // static bool IsStreamCommentStyle(int style) { return style == SCE_AU3_COMMENT || style == SCE_AU3_COMMENTBLOCK; } // // Routine to find first none space on the current line and return its Style // needed for comment lines not starting on pos 1 static int GetStyleFirstWord(Sci_PositionU szLine, Accessor &styler) { Sci_Position nsPos = styler.LineStart(szLine); Sci_Position nePos = styler.LineStart(szLine+1) - 1; while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos) { nsPos++; // skip to next char } // End While return styler.StyleAt(nsPos); } // GetStyleFirstWord() // static void FoldAU3Doc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { Sci_Position endPos = startPos + length; // get settings from the config files for folding comments and preprocessor lines bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldInComment = styler.GetPropertyInt("fold.comment") == 2; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldpreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; // Backtrack to previous line in case need to fix its fold status Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); } } // vars for style of previous/current/next lines int style = GetStyleFirstWord(lineCurrent,styler); int stylePrev = 0; // find the first previous line without continuation character at the end while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) || (lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) { lineCurrent--; startPos = styler.LineStart(lineCurrent); } if (lineCurrent > 0) { stylePrev = GetStyleFirstWord(lineCurrent-1,styler); } // vars for getting first word to check for keywords bool FirstWordStart = false; bool FirstWordEnd = false; char szKeyword[11]=""; int szKeywordlen = 0; char szThen[5]=""; int szThenlen = 0; bool ThenFoundLast = false; // var for indentlevel int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelNext = levelCurrent; // int visibleChars = 0; char chNext = styler.SafeGetCharAt(startPos); char chPrev = ' '; // for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if (IsAWordChar(ch)) { visibleChars++; } // get the syle for the current character neede to check in comment int stylech = styler.StyleAt(i); // get first word for the line for indent check max 9 characters if (FirstWordStart && (!(FirstWordEnd))) { if (!IsAWordChar(ch)) { FirstWordEnd = true; szKeyword[szKeywordlen] = '\0'; } else { if (szKeywordlen < 10) { szKeyword[szKeywordlen++] = static_cast(tolower(ch)); } } } // start the capture of the first word if (!(FirstWordStart)) { if (IsAWordChar(ch) || IsAWordStart(ch) || ch == ';') { FirstWordStart = true; szKeyword[szKeywordlen++] = static_cast(tolower(ch)); } } // only process this logic when not in comment section if (!(stylech == SCE_AU3_COMMENT)) { if (ThenFoundLast) { if (IsAWordChar(ch)) { ThenFoundLast = false; } } // find out if the word "then" is the last on a "if" line if (FirstWordEnd && strcmp(szKeyword,"if") == 0) { if (szThenlen == 4) { szThen[0] = szThen[1]; szThen[1] = szThen[2]; szThen[2] = szThen[3]; szThen[3] = static_cast(tolower(ch)); if (strcmp(szThen,"then") == 0 ) { ThenFoundLast = true; } } else { szThen[szThenlen++] = static_cast(tolower(ch)); if (szThenlen == 5) { szThen[4] = '\0'; } } } } // End of Line found so process the information if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) { // ************************** // Folding logic for Keywords // ************************** // if a keyword is found on the current line and the line doesn't end with _ (continuation) // and we are not inside a commentblock. if (szKeywordlen > 0 && (!(chPrev == '_')) && ((!(IsStreamCommentStyle(style)) || foldInComment)) ) { szKeyword[szKeywordlen] = '\0'; // only fold "if" last keyword is "then" (else its a one line if) if (strcmp(szKeyword,"if") == 0 && ThenFoundLast) { levelNext++; } // create new fold for these words if (strcmp(szKeyword,"do") == 0 || strcmp(szKeyword,"for") == 0 || strcmp(szKeyword,"func") == 0 || strcmp(szKeyword,"while") == 0|| strcmp(szKeyword,"with") == 0 || strcmp(szKeyword,"#region") == 0 ) { levelNext++; } // create double Fold for select&switch because Case will subtract one of the current level if (strcmp(szKeyword,"select") == 0 || strcmp(szKeyword,"switch") == 0) { levelNext++; levelNext++; } // end the fold for these words before the current line if (strcmp(szKeyword,"endfunc") == 0 || strcmp(szKeyword,"endif") == 0 || strcmp(szKeyword,"next") == 0 || strcmp(szKeyword,"until") == 0 || strcmp(szKeyword,"endwith") == 0 ||strcmp(szKeyword,"wend") == 0){ levelNext--; levelCurrent--; } // end the fold for these words before the current line and Start new fold if (strcmp(szKeyword,"case") == 0 || strcmp(szKeyword,"else") == 0 || strcmp(szKeyword,"elseif") == 0 ) { levelCurrent--; } // end the double fold for this word before the current line if (strcmp(szKeyword,"endselect") == 0 || strcmp(szKeyword,"endswitch") == 0 ) { levelNext--; levelNext--; levelCurrent--; levelCurrent--; } // end the fold for these words on the current line if (strcmp(szKeyword,"#endregion") == 0 ) { levelNext--; } } // Preprocessor and Comment folding int styleNext = GetStyleFirstWord(lineCurrent + 1,styler); // ************************************* // Folding logic for preprocessor blocks // ************************************* // process preprosessor line if (foldpreprocessor && style == SCE_AU3_PREPROCESSOR) { if (!(stylePrev == SCE_AU3_PREPROCESSOR) && (styleNext == SCE_AU3_PREPROCESSOR)) { levelNext++; } // fold till the last line for normal comment lines else if (stylePrev == SCE_AU3_PREPROCESSOR && !(styleNext == SCE_AU3_PREPROCESSOR)) { levelNext--; } } // ********************************* // Folding logic for Comment blocks // ********************************* if (foldComment && IsStreamCommentStyle(style)) { // Start of a comment block if (!(stylePrev==style) && IsStreamCommentStyle(styleNext) && styleNext==style) { levelNext++; } // fold till the last line for normal comment lines else if (IsStreamCommentStyle(stylePrev) && !(styleNext == SCE_AU3_COMMENT) && stylePrev == SCE_AU3_COMMENT && style == SCE_AU3_COMMENT) { levelNext--; } // fold till the one but last line for Blockcomment lines else if (IsStreamCommentStyle(stylePrev) && !(styleNext == SCE_AU3_COMMENTBLOCK) && style == SCE_AU3_COMMENTBLOCK) { levelNext--; levelCurrent--; } } int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } // reset values for the next line lineCurrent++; stylePrev = style; style = styleNext; levelCurrent = levelNext; visibleChars = 0; // if the last character is an Underscore then don't reset since the line continues on the next line. if (!(chPrev == '_')) { szKeywordlen = 0; szThenlen = 0; FirstWordStart = false; FirstWordEnd = false; ThenFoundLast = false; } } // save the last processed character if (!isspacechar(ch)) { chPrev = ch; visibleChars++; } } } // static const char * const AU3WordLists[] = { "#autoit keywords", "#autoit functions", "#autoit macros", "#autoit Sent keys", "#autoit Pre-processors", "#autoit Special", "#autoit Expand", "#autoit UDF", 0 }; LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists); ================================================ FILE: lexilla/lexers/LexAVE.cxx ================================================ // SciTE - Scintilla based Text Editor /** @file LexAVE.cxx ** Lexer for Avenue. ** ** Written by Alexey Yutkin . **/ // Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); } static inline bool IsEnumChar(const int ch) { return (ch < 0x80) && (isalnum(ch)|| ch == '_'); } static inline bool IsANumberChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' ); } inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } inline bool isAveOperator(char ch) { if (IsASCII(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == ';' || ch == '<' || ch == '>' || ch == ',' || ch == '.' ) return true; return false; } static void ColouriseAveDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; WordList &keywords5 = *keywordlists[4]; WordList &keywords6 = *keywordlists[5]; // Do not leak onto next line if (initStyle == SCE_AVE_STRINGEOL) { initStyle = SCE_AVE_DEFAULT; } StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineEnd) { // Update the line state, so it can be seen by next line Sci_Position currentLine = styler.GetLine(sc.currentPos); styler.SetLineState(currentLine, 0); } if (sc.atLineStart && (sc.state == SCE_AVE_STRING)) { // Prevent SCE_AVE_STRINGEOL from leaking back to previous line sc.SetState(SCE_AVE_STRING); } // Determine if the current state should terminate. if (sc.state == SCE_AVE_OPERATOR) { sc.SetState(SCE_AVE_DEFAULT); } else if (sc.state == SCE_AVE_NUMBER) { if (!IsANumberChar(sc.ch)) { sc.SetState(SCE_AVE_DEFAULT); } } else if (sc.state == SCE_AVE_ENUM) { if (!IsEnumChar(sc.ch)) { sc.SetState(SCE_AVE_DEFAULT); } } else if (sc.state == SCE_AVE_IDENTIFIER) { if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { char s[100]; //sc.GetCurrent(s, sizeof(s)); sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_AVE_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_AVE_WORD2); } else if (keywords3.InList(s)) { sc.ChangeState(SCE_AVE_WORD3); } else if (keywords4.InList(s)) { sc.ChangeState(SCE_AVE_WORD4); } else if (keywords5.InList(s)) { sc.ChangeState(SCE_AVE_WORD5); } else if (keywords6.InList(s)) { sc.ChangeState(SCE_AVE_WORD6); } sc.SetState(SCE_AVE_DEFAULT); } } else if (sc.state == SCE_AVE_COMMENT) { if (sc.atLineEnd) { sc.SetState(SCE_AVE_DEFAULT); } } else if (sc.state == SCE_AVE_STRING) { if (sc.ch == '\"') { sc.ForwardSetState(SCE_AVE_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_AVE_STRINGEOL); sc.ForwardSetState(SCE_AVE_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_AVE_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_AVE_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_AVE_IDENTIFIER); } else if (sc.Match('\"')) { sc.SetState(SCE_AVE_STRING); } else if (sc.Match('\'')) { sc.SetState(SCE_AVE_COMMENT); sc.Forward(); } else if (isAveOperator(static_cast(sc.ch))) { sc.SetState(SCE_AVE_OPERATOR); } else if (sc.Match('#')) { sc.SetState(SCE_AVE_ENUM); sc.Forward(); } } } sc.Complete(); } static void FoldAveDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = static_cast(tolower(styler[startPos])); bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; int styleNext = styler.StyleAt(startPos); char s[10] = ""; for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = static_cast(tolower(chNext)); chNext = static_cast(tolower(styler.SafeGetCharAt(i + 1))); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_AVE_WORD) { if (ch == 't' || ch == 'f' || ch == 'w' || ch == 'e') { for (unsigned int j = 0; j < 6; j++) { if (!iswordchar(styler[i + j])) { break; } s[j] = static_cast(tolower(styler[i + j])); s[j + 1] = '\0'; } if ((strcmp(s, "then") == 0) || (strcmp(s, "for") == 0) || (strcmp(s, "while") == 0)) { levelCurrent++; } if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) { // Normally "elseif" and "then" will be on the same line and will cancel // each other out. // As implemented, this does not support fold.at.else. levelCurrent--; } } } else if (style == SCE_AVE_OPERATOR) { if (ch == '{' || ch == '(') { levelCurrent++; } else if (ch == '}' || ch == ')') { levelCurrent--; } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) { lev |= SC_FOLDLEVELWHITEFLAG; } if ((levelCurrent > levelPrev) && (visibleChars > 0)) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) { visibleChars++; } } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } LexerModule lmAVE(SCLEX_AVE, ColouriseAveDoc, "ave", FoldAveDoc); ================================================ FILE: lexilla/lexers/LexAVS.cxx ================================================ // Scintilla source code edit control /** @file LexAVS.cxx ** Lexer for AviSynth. **/ // Copyright 2012 by Bruno Barbieri // Heavily based on LexPOV by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static inline bool IsAWordStart(int ch) { return isalpha(ch) || (ch != ' ' && ch != '\n' && ch != '(' && ch != '.' && ch != ','); } static inline bool IsANumberChar(int ch) { // Not exactly following number definition (several dots are seen as OK, etc.) // but probably enough in most cases. return (ch < 0x80) && (isdigit(ch) || ch == '.' || ch == '-' || ch == '+'); } static void ColouriseAvsDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &filters = *keywordlists[1]; WordList &plugins = *keywordlists[2]; WordList &functions = *keywordlists[3]; WordList &clipProperties = *keywordlists[4]; WordList &userDefined = *keywordlists[5]; Sci_Position currentLine = styler.GetLine(startPos); // Initialize the block comment nesting level, if we are inside such a comment. int blockCommentLevel = 0; if (initStyle == SCE_AVS_COMMENTBLOCK || initStyle == SCE_AVS_COMMENTBLOCKN) { blockCommentLevel = styler.GetLineState(currentLine - 1); } // Do not leak onto next line if (initStyle == SCE_AVS_COMMENTLINE) { initStyle = SCE_AVS_DEFAULT; } StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineEnd) { // Update the line state, so it can be seen by next line currentLine = styler.GetLine(sc.currentPos); if (sc.state == SCE_AVS_COMMENTBLOCK || sc.state == SCE_AVS_COMMENTBLOCKN) { // Inside a block comment, we set the line state styler.SetLineState(currentLine, blockCommentLevel); } else { // Reset the line state styler.SetLineState(currentLine, 0); } } // Determine if the current state should terminate. if (sc.state == SCE_AVS_OPERATOR) { sc.SetState(SCE_AVS_DEFAULT); } else if (sc.state == SCE_AVS_NUMBER) { // We stop the number definition on non-numerical non-dot non-sign char if (!IsANumberChar(sc.ch)) { sc.SetState(SCE_AVS_DEFAULT); } } else if (sc.state == SCE_AVS_IDENTIFIER) { if (!IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_AVS_KEYWORD); } else if (filters.InList(s)) { sc.ChangeState(SCE_AVS_FILTER); } else if (plugins.InList(s)) { sc.ChangeState(SCE_AVS_PLUGIN); } else if (functions.InList(s)) { sc.ChangeState(SCE_AVS_FUNCTION); } else if (clipProperties.InList(s)) { sc.ChangeState(SCE_AVS_CLIPPROP); } else if (userDefined.InList(s)) { sc.ChangeState(SCE_AVS_USERDFN); } sc.SetState(SCE_AVS_DEFAULT); } } else if (sc.state == SCE_AVS_COMMENTBLOCK) { if (sc.Match('/', '*')) { blockCommentLevel++; sc.Forward(); } else if (sc.Match('*', '/') && blockCommentLevel > 0) { blockCommentLevel--; sc.Forward(); if (blockCommentLevel == 0) { sc.ForwardSetState(SCE_AVS_DEFAULT); } } } else if (sc.state == SCE_AVS_COMMENTBLOCKN) { if (sc.Match('[', '*')) { blockCommentLevel++; sc.Forward(); } else if (sc.Match('*', ']') && blockCommentLevel > 0) { blockCommentLevel--; sc.Forward(); if (blockCommentLevel == 0) { sc.ForwardSetState(SCE_AVS_DEFAULT); } } } else if (sc.state == SCE_AVS_COMMENTLINE) { if (sc.atLineEnd) { sc.ForwardSetState(SCE_AVS_DEFAULT); } } else if (sc.state == SCE_AVS_STRING) { if (sc.ch == '\"') { sc.ForwardSetState(SCE_AVS_DEFAULT); } } else if (sc.state == SCE_AVS_TRIPLESTRING) { if (sc.Match("\"\"\"")) { sc.Forward(); sc.Forward(); sc.ForwardSetState(SCE_AVS_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_AVS_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_AVS_NUMBER); } else if (IsADigit(sc.ch) || (sc.ch == ',' && IsADigit(sc.chNext))) { sc.Forward(); sc.SetState(SCE_AVS_NUMBER); } else if (sc.Match('/', '*')) { blockCommentLevel = 1; sc.SetState(SCE_AVS_COMMENTBLOCK); sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match('[', '*')) { blockCommentLevel = 1; sc.SetState(SCE_AVS_COMMENTBLOCKN); sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.ch == '#') { sc.SetState(SCE_AVS_COMMENTLINE); } else if (sc.ch == '\"') { if (sc.Match("\"\"\"")) { sc.SetState(SCE_AVS_TRIPLESTRING); } else { sc.SetState(SCE_AVS_STRING); } } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_AVS_OPERATOR); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_AVS_IDENTIFIER); } } } // End of file: complete any pending changeState if (sc.state == SCE_AVS_IDENTIFIER) { if (!IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_AVS_KEYWORD); } else if (filters.InList(s)) { sc.ChangeState(SCE_AVS_FILTER); } else if (plugins.InList(s)) { sc.ChangeState(SCE_AVS_PLUGIN); } else if (functions.InList(s)) { sc.ChangeState(SCE_AVS_FUNCTION); } else if (clipProperties.InList(s)) { sc.ChangeState(SCE_AVS_CLIPPROP); } else if (userDefined.InList(s)) { sc.ChangeState(SCE_AVS_USERDFN); } sc.SetState(SCE_AVS_DEFAULT); } } sc.Complete(); } static void FoldAvsDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && style == SCE_AVS_COMMENTBLOCK) { if (stylePrev != SCE_AVS_COMMENTBLOCK) { levelCurrent++; } else if ((styleNext != SCE_AVS_COMMENTBLOCK) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelCurrent--; } } if (foldComment && style == SCE_AVS_COMMENTBLOCKN) { if (stylePrev != SCE_AVS_COMMENTBLOCKN) { levelCurrent++; } else if ((styleNext != SCE_AVS_COMMENTBLOCKN) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelCurrent--; } } if (style == SCE_AVS_OPERATOR) { if (ch == '{') { levelCurrent++; } else if (ch == '}') { levelCurrent--; } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const avsWordLists[] = { "Keywords", "Filters", "Plugins", "Functions", "Clip properties", "User defined functions", 0, }; LexerModule lmAVS(SCLEX_AVS, ColouriseAvsDoc, "avs", FoldAvsDoc, avsWordLists); ================================================ FILE: lexilla/lexers/LexAbaqus.cxx ================================================ // Scintilla source code edit control /** @file LexAbaqus.cxx ** Lexer for ABAQUS. Based on the lexer for APDL by Hadar Raz. ** By Sergio Lucato. ** Sort of completely rewritten by Gertjan Kloosterman **/ // The License.txt file describes the conditions under which this software may be distributed. // Code folding copyied and modified from LexBasic.cxx #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsAKeywordChar(const int ch) { return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == ' '))); } static inline bool IsASetChar(const int ch) { return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-'))); } static void ColouriseABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList*[] /* *keywordlists[] */, Accessor &styler) { enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \ DAT_LINE_VAL, DAT_LINE_COMMA,\ COMMENT_LINE,\ ST_ERROR, LINE_END } state ; // Do not leak onto next line state = LINE_END ; initStyle = SCE_ABAQUS_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); // Things are actually quite simple // we have commentlines // keywordlines and datalines // On a data line there will only be colouring of numbers // a keyword line is constructed as // *word,[ paramname[=paramvalue]]* // if the line ends with a , the keyword line continues onto the new line for (; sc.More(); sc.Forward()) { switch ( state ) { case KW_LINE_KW : if ( sc.atLineEnd ) { // finished the line in keyword state, switch to LINE_END sc.SetState(SCE_ABAQUS_DEFAULT) ; state = LINE_END ; } else if ( IsAKeywordChar(sc.ch) ) { // nothing changes state = KW_LINE_KW ; } else if ( sc.ch == ',' ) { // Well well we say a comma, arguments *MUST* follow sc.SetState(SCE_ABAQUS_OPERATOR) ; state = KW_LINE_COMMA ; } else { // Flag an error sc.SetState(SCE_ABAQUS_PROCESSOR) ; state = ST_ERROR ; } // Done with processing break ; case KW_LINE_COMMA : // acomma on a keywordline was seen if ( IsAKeywordChar(sc.ch)) { sc.SetState(SCE_ABAQUS_ARGUMENT) ; state = KW_LINE_PAR ; } else if ( sc.atLineEnd || (sc.ch == ',') ) { // we remain in keyword mode state = KW_LINE_COMMA ; } else if ( sc.ch == ' ' ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = KW_LINE_COMMA ; } else { // Anything else constitutes an error sc.SetState(SCE_ABAQUS_PROCESSOR) ; state = ST_ERROR ; } break ; case KW_LINE_PAR : if ( sc.atLineEnd ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = LINE_END ; } else if ( IsAKeywordChar(sc.ch) || (sc.ch == '-') ) { // remain in this state state = KW_LINE_PAR ; } else if ( sc.ch == ',' ) { sc.SetState(SCE_ABAQUS_OPERATOR) ; state = KW_LINE_COMMA ; } else if ( sc.ch == '=' ) { sc.SetState(SCE_ABAQUS_OPERATOR) ; state = KW_LINE_EQ ; } else { // Anything else constitutes an error sc.SetState(SCE_ABAQUS_PROCESSOR) ; state = ST_ERROR ; } break ; case KW_LINE_EQ : if ( sc.ch == ' ' ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; // remain in this state state = KW_LINE_EQ ; } else if ( IsADigit(sc.ch) || (sc.ch == '-') || (sc.ch == '.' && IsADigit(sc.chNext)) ) { sc.SetState(SCE_ABAQUS_NUMBER) ; state = KW_LINE_VAL ; } else if ( IsAKeywordChar(sc.ch) ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = KW_LINE_VAL ; } else if ( (sc.ch == '\'') || (sc.ch == '\"') ) { sc.SetState(SCE_ABAQUS_STRING) ; state = KW_LINE_VAL ; } else { sc.SetState(SCE_ABAQUS_PROCESSOR) ; state = ST_ERROR ; } break ; case KW_LINE_VAL : if ( sc.atLineEnd ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = LINE_END ; } else if ( IsASetChar(sc.ch) && (sc.state == SCE_ABAQUS_DEFAULT) ) { // nothing changes state = KW_LINE_VAL ; } else if (( (IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) && (sc.state == SCE_ABAQUS_NUMBER)) { // remain in number mode state = KW_LINE_VAL ; } else if (sc.state == SCE_ABAQUS_STRING) { // accept everything until a closing quote if ( sc.ch == '\'' || sc.ch == '\"' ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = KW_LINE_VAL ; } } else if ( sc.ch == ',' ) { sc.SetState(SCE_ABAQUS_OPERATOR) ; state = KW_LINE_COMMA ; } else { // anything else is an error sc.SetState(SCE_ABAQUS_PROCESSOR) ; state = ST_ERROR ; } break ; case DAT_LINE_VAL : if ( sc.atLineEnd ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = LINE_END ; } else if ( IsASetChar(sc.ch) && (sc.state == SCE_ABAQUS_DEFAULT) ) { // nothing changes state = DAT_LINE_VAL ; } else if (( (IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) && (sc.state == SCE_ABAQUS_NUMBER)) { // remain in number mode state = DAT_LINE_VAL ; } else if (sc.state == SCE_ABAQUS_STRING) { // accept everything until a closing quote if ( sc.ch == '\'' || sc.ch == '\"' ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = DAT_LINE_VAL ; } } else if ( sc.ch == ',' ) { sc.SetState(SCE_ABAQUS_OPERATOR) ; state = DAT_LINE_COMMA ; } else { // anything else is an error sc.SetState(SCE_ABAQUS_PROCESSOR) ; state = ST_ERROR ; } break ; case DAT_LINE_COMMA : // a comma on a data line was seen if ( sc.atLineEnd ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = LINE_END ; } else if ( sc.ch == ' ' ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = DAT_LINE_COMMA ; } else if (sc.ch == ',') { sc.SetState(SCE_ABAQUS_OPERATOR) ; state = DAT_LINE_COMMA ; } else if ( IsADigit(sc.ch) || (sc.ch == '-')|| (sc.ch == '.' && IsADigit(sc.chNext)) ) { sc.SetState(SCE_ABAQUS_NUMBER) ; state = DAT_LINE_VAL ; } else if ( IsAKeywordChar(sc.ch) ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = DAT_LINE_VAL ; } else if ( (sc.ch == '\'') || (sc.ch == '\"') ) { sc.SetState(SCE_ABAQUS_STRING) ; state = DAT_LINE_VAL ; } else { sc.SetState(SCE_ABAQUS_PROCESSOR) ; state = ST_ERROR ; } break ; case COMMENT_LINE : if ( sc.atLineEnd ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = LINE_END ; } break ; case ST_ERROR : if ( sc.atLineEnd ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = LINE_END ; } break ; case LINE_END : if ( sc.atLineEnd || sc.ch == ' ' ) { // nothing changes state = LINE_END ; } else if ( sc.ch == '*' ) { if ( sc.chNext == '*' ) { state = COMMENT_LINE ; sc.SetState(SCE_ABAQUS_COMMENT) ; } else { state = KW_LINE_KW ; sc.SetState(SCE_ABAQUS_STARCOMMAND) ; } } else { // it must be a data line, things are as if we are in DAT_LINE_COMMA if ( sc.ch == ',' ) { sc.SetState(SCE_ABAQUS_OPERATOR) ; state = DAT_LINE_COMMA ; } else if ( IsADigit(sc.ch) || (sc.ch == '-')|| (sc.ch == '.' && IsADigit(sc.chNext)) ) { sc.SetState(SCE_ABAQUS_NUMBER) ; state = DAT_LINE_VAL ; } else if ( IsAKeywordChar(sc.ch) ) { sc.SetState(SCE_ABAQUS_DEFAULT) ; state = DAT_LINE_VAL ; } else if ( (sc.ch == '\'') || (sc.ch == '\"') ) { sc.SetState(SCE_ABAQUS_STRING) ; state = DAT_LINE_VAL ; } else { sc.SetState(SCE_ABAQUS_PROCESSOR) ; state = ST_ERROR ; } } break ; } } sc.Complete(); } //------------------------------------------------------------------------------ // This copyied and modified from LexBasic.cxx //------------------------------------------------------------------------------ /* Bits: * 1 - whitespace * 2 - operator * 4 - identifier * 8 - decimal digit * 16 - hex digit * 32 - bin digit */ static int character_classification[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 6, 2, 2, 2, 10, 6, 60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2, 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4, 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0 }; static bool IsSpace(int c) { return c < 128 && (character_classification[c] & 1); } static bool IsIdentifier(int c) { return c < 128 && (character_classification[c] & 4); } static int LowerCase(int c) { if (c >= 'A' && c <= 'Z') return 'a' + c - 'A'; return c; } static Sci_Position LineEnd(Sci_Position line, Accessor &styler) { const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line Sci_Position eol_pos ; // if the line is the last line, the eol_pos is styler.Length() // eol will contain a new line, or a virtual new line if ( docLines == line ) eol_pos = styler.Length() ; else eol_pos = styler.LineStart(line + 1) - 1; return eol_pos ; } static Sci_Position LineStart(Sci_Position line, Accessor &styler) { return styler.LineStart(line) ; } // LineType // // bits determines the line type // 1 : data line // 2 : only whitespace // 3 : data line with only whitespace // 4 : keyword line // 5 : block open keyword line // 6 : block close keyword line // 7 : keyword line in error // 8 : comment line static int LineType(Sci_Position line, Accessor &styler) { Sci_Position pos = LineStart(line, styler) ; Sci_Position eol_pos = LineEnd(line, styler) ; int c ; char ch = ' '; Sci_Position i = pos ; while ( i < eol_pos ) { c = styler.SafeGetCharAt(i); ch = static_cast(LowerCase(c)); // We can say something as soon as no whitespace // was encountered if ( !IsSpace(c) ) break ; i++ ; } if ( i >= eol_pos ) { // This is a whitespace line, currently // classifies as data line return 3 ; } if ( ch != '*' ) { // This is a data line return 1 ; } if ( i == eol_pos - 1 ) { // Only a single *, error but make keyword line return 4+3 ; } // This means we can have a second character // if that is also a * this means a comment // otherwise it is a keyword. c = styler.SafeGetCharAt(i+1); ch = static_cast(LowerCase(c)); if ( ch == '*' ) { return 8 ; } // At this point we know this is a keyword line // the character at position i is a * // it is not a comment line char word[256] ; int wlen = 0; word[wlen] = '*' ; wlen++ ; i++ ; while ( (i < eol_pos) && (wlen < 255) ) { c = styler.SafeGetCharAt(i); ch = static_cast(LowerCase(c)); if ( (!IsSpace(c)) && (!IsIdentifier(c)) ) break ; if ( IsIdentifier(c) ) { word[wlen] = ch ; wlen++ ; } i++ ; } word[wlen] = 0 ; // Make a comparison if ( !strcmp(word, "*step") || !strcmp(word, "*part") || !strcmp(word, "*instance") || !strcmp(word, "*assembly")) { return 4+1 ; } if ( !strcmp(word, "*endstep") || !strcmp(word, "*endpart") || !strcmp(word, "*endinstance") || !strcmp(word, "*endassembly")) { return 4+2 ; } return 4 ; } static void SafeSetLevel(Sci_Position line, int level, Accessor &styler) { if ( line < 0 ) return ; int mask = ((~SC_FOLDLEVELHEADERFLAG) | (~SC_FOLDLEVELWHITEFLAG)); if ( (level & mask) < 0 ) return ; if ( styler.LevelAt(line) != level ) styler.SetLevel(line, level) ; } static void FoldABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { Sci_Position startLine = styler.GetLine(startPos) ; Sci_Position endLine = styler.GetLine(startPos+length-1) ; // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; // We want to deal with all the cases // To know the correct indentlevel, we need to look back to the // previous command line indentation level // order of formatting keyline datalines commentlines Sci_Position beginData = -1 ; Sci_Position beginComment = -1 ; Sci_Position prvKeyLine = startLine ; Sci_Position prvKeyLineTp = 0 ; // Scan until we find the previous keyword line // this will give us the level reference that we need while ( prvKeyLine > 0 ) { prvKeyLine-- ; prvKeyLineTp = LineType(prvKeyLine, styler) ; if ( prvKeyLineTp & 4 ) break ; } // Determine the base line level of all lines following // the previous keyword // new keyword lines are placed on this level //if ( prvKeyLineTp & 4 ) { int level = styler.LevelAt(prvKeyLine) & ~SC_FOLDLEVELHEADERFLAG ; //} // uncomment line below if weird behaviour continues prvKeyLine = -1 ; // Now start scanning over the lines. for ( Sci_Position line = startLine; line <= endLine; line++ ) { int lineType = LineType(line, styler) ; // Check for comment line if ( lineType == 8 ) { if ( beginComment < 0 ) { beginComment = line ; } } // Check for data line if ( (lineType == 1) || (lineType == 3) ) { if ( beginData < 0 ) { if ( beginComment >= 0 ) { beginData = beginComment ; } else { beginData = line ; } } beginComment = -1 ; } // Check for keywordline. // As soon as a keyword line is encountered, we can set the // levels of everything from the previous keyword line to this one if ( lineType & 4 ) { // this is a keyword, we can now place the previous keyword // all its data lines and the remainder // Write comments and data line if ( beginComment < 0 ) { beginComment = line ; } if ( beginData < 0 ) { beginData = beginComment ; if ( prvKeyLineTp != 5 ) SafeSetLevel(prvKeyLine, level, styler) ; else SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ; } else { SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ; } int datLevel = level + 1 ; if ( !(prvKeyLineTp & 4) ) { datLevel = level ; } for ( Sci_Position ll = beginData; ll < beginComment; ll++ ) SafeSetLevel(ll, datLevel, styler) ; // The keyword we just found is going to be written at another level // if we have a type 5 and type 6 if ( prvKeyLineTp == 5 ) { level += 1 ; } if ( prvKeyLineTp == 6 ) { level -= 1 ; if ( level < 0 ) { level = 0 ; } } for ( Sci_Position lll = beginComment; lll < line; lll++ ) SafeSetLevel(lll, level, styler) ; // wrap and reset beginComment = -1 ; beginData = -1 ; prvKeyLine = line ; prvKeyLineTp = lineType ; } } if ( beginComment < 0 ) { beginComment = endLine + 1 ; } else { // We need to find out whether this comment block is followed by // a data line or a keyword line const Sci_Position docLines = styler.GetLine(styler.Length() - 1); for ( Sci_Position line = endLine + 1; line <= docLines; line++ ) { Sci_Position lineType = LineType(line, styler) ; if ( lineType != 8 ) { if ( !(lineType & 4) ) { beginComment = endLine + 1 ; } break ; } } } if ( beginData < 0 ) { beginData = beginComment ; if ( prvKeyLineTp != 5 ) SafeSetLevel(prvKeyLine, level, styler) ; else SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ; } else { SafeSetLevel(prvKeyLine, level | SC_FOLDLEVELHEADERFLAG, styler) ; } int datLevel = level + 1 ; if ( !(prvKeyLineTp & 4) ) { datLevel = level ; } for ( Sci_Position ll = beginData; ll < beginComment; ll++ ) SafeSetLevel(ll, datLevel, styler) ; if ( prvKeyLineTp == 5 ) { level += 1 ; } if ( prvKeyLineTp == 6 ) { level -= 1 ; } for ( Sci_Position m = beginComment; m <= endLine; m++ ) SafeSetLevel(m, level, styler) ; } static const char * const abaqusWordListDesc[] = { "processors", "commands", "slashommands", "starcommands", "arguments", "functions", 0 }; LexerModule lmAbaqus(SCLEX_ABAQUS, ColouriseABAQUSDoc, "abaqus", FoldABAQUSDoc, abaqusWordListDesc); ================================================ FILE: lexilla/lexers/LexAda.cxx ================================================ // Scintilla source code edit control /** @file LexAda.cxx ** Lexer for Ada 95 **/ // Copyright 2002 by Sergey Koshcheyev // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; /* * Interface */ static void ColouriseDocument( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler); static const char * const adaWordListDesc[] = { "Keywords", 0 }; LexerModule lmAda(SCLEX_ADA, ColouriseDocument, "ada", NULL, adaWordListDesc); /* * Implementation */ // Functions that have apostropheStartsAttribute as a parameter set it according to whether // an apostrophe encountered after processing the current token will start an attribute or // a character literal. static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL); static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute); static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute); static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute); static inline bool IsDelimiterCharacter(int ch); static inline bool IsSeparatorOrDelimiterCharacter(int ch); static bool IsValidIdentifier(const std::string& identifier); static bool IsValidNumber(const std::string& number); static inline bool IsWordStartCharacter(int ch); static inline bool IsWordCharacter(int ch); static void ColouriseCharacter(StyleContext& sc, bool& apostropheStartsAttribute) { apostropheStartsAttribute = true; sc.SetState(SCE_ADA_CHARACTER); // Skip the apostrophe and one more character (so that '' is shown as non-terminated and ''' // is handled correctly) sc.Forward(); sc.Forward(); ColouriseContext(sc, '\'', SCE_ADA_CHARACTEREOL); } static void ColouriseContext(StyleContext& sc, char chEnd, int stateEOL) { while (!sc.atLineEnd && !sc.Match(chEnd)) { sc.Forward(); } if (!sc.atLineEnd) { sc.ForwardSetState(SCE_ADA_DEFAULT); } else { sc.ChangeState(stateEOL); } } static void ColouriseComment(StyleContext& sc, bool& /*apostropheStartsAttribute*/) { // Apostrophe meaning is not changed, but the parameter is present for uniformity sc.SetState(SCE_ADA_COMMENTLINE); while (!sc.atLineEnd) { sc.Forward(); } } static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) { apostropheStartsAttribute = sc.Match (')'); sc.SetState(SCE_ADA_DELIMITER); sc.ForwardSetState(SCE_ADA_DEFAULT); } static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) { apostropheStartsAttribute = false; sc.SetState(SCE_ADA_LABEL); // Skip "<<" sc.Forward(); sc.Forward(); std::string identifier; while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { identifier += static_cast(tolower(sc.ch)); sc.Forward(); } // Skip ">>" if (sc.Match('>', '>')) { sc.Forward(); sc.Forward(); } else { sc.ChangeState(SCE_ADA_ILLEGAL); } // If the name is an invalid identifier or a keyword, then make it invalid label if (!IsValidIdentifier(identifier) || keywords.InList(identifier.c_str())) { sc.ChangeState(SCE_ADA_ILLEGAL); } sc.SetState(SCE_ADA_DEFAULT); } static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) { apostropheStartsAttribute = true; std::string number; sc.SetState(SCE_ADA_NUMBER); // Get all characters up to a delimiter or a separator, including points, but excluding // double points (ranges). while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) { number += static_cast(sc.ch); sc.Forward(); } // Special case: exponent with sign if ((sc.chPrev == 'e' || sc.chPrev == 'E') && (sc.ch == '+' || sc.ch == '-')) { number += static_cast(sc.ch); sc.Forward (); while (!IsSeparatorOrDelimiterCharacter(sc.ch)) { number += static_cast(sc.ch); sc.Forward(); } } if (!IsValidNumber(number)) { sc.ChangeState(SCE_ADA_ILLEGAL); } sc.SetState(SCE_ADA_DEFAULT); } static void ColouriseString(StyleContext& sc, bool& apostropheStartsAttribute) { apostropheStartsAttribute = true; sc.SetState(SCE_ADA_STRING); sc.Forward(); ColouriseContext(sc, '"', SCE_ADA_STRINGEOL); } static void ColouriseWhiteSpace(StyleContext& sc, bool& /*apostropheStartsAttribute*/) { // Apostrophe meaning is not changed, but the parameter is present for uniformity sc.SetState(SCE_ADA_DEFAULT); sc.ForwardSetState(SCE_ADA_DEFAULT); } static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute) { apostropheStartsAttribute = true; sc.SetState(SCE_ADA_IDENTIFIER); std::string word; while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { word += static_cast(tolower(sc.ch)); sc.Forward(); } if (!IsValidIdentifier(word)) { sc.ChangeState(SCE_ADA_ILLEGAL); } else if (keywords.InList(word.c_str())) { sc.ChangeState(SCE_ADA_WORD); if (word != "all") { apostropheStartsAttribute = false; } } sc.SetState(SCE_ADA_DEFAULT); } // // ColouriseDocument // static void ColouriseDocument( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; StyleContext sc(startPos, length, initStyle, styler); Sci_Position lineCurrent = styler.GetLine(startPos); bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0; while (sc.More()) { if (sc.atLineEnd) { // Go to the next line sc.Forward(); lineCurrent++; // Remember the line state for future incremental lexing styler.SetLineState(lineCurrent, apostropheStartsAttribute); // Don't continue any styles on the next line sc.SetState(SCE_ADA_DEFAULT); } // Comments if (sc.Match('-', '-')) { ColouriseComment(sc, apostropheStartsAttribute); // Strings } else if (sc.Match('"')) { ColouriseString(sc, apostropheStartsAttribute); // Characters } else if (sc.Match('\'') && !apostropheStartsAttribute) { ColouriseCharacter(sc, apostropheStartsAttribute); // Labels } else if (sc.Match('<', '<')) { ColouriseLabel(sc, keywords, apostropheStartsAttribute); // Whitespace } else if (IsASpace(sc.ch)) { ColouriseWhiteSpace(sc, apostropheStartsAttribute); // Delimiters } else if (IsDelimiterCharacter(sc.ch)) { ColouriseDelimiter(sc, apostropheStartsAttribute); // Numbers } else if (IsADigit(sc.ch) || sc.ch == '#') { ColouriseNumber(sc, apostropheStartsAttribute); // Keywords or identifiers } else { ColouriseWord(sc, keywords, apostropheStartsAttribute); } } sc.Complete(); } static inline bool IsDelimiterCharacter(int ch) { switch (ch) { case '&': case '\'': case '(': case ')': case '*': case '+': case ',': case '-': case '.': case '/': case ':': case ';': case '<': case '=': case '>': case '|': return true; default: return false; } } static inline bool IsSeparatorOrDelimiterCharacter(int ch) { return IsASpace(ch) || IsDelimiterCharacter(ch); } static bool IsValidIdentifier(const std::string& identifier) { // First character can't be '_', so initialize the flag to true bool lastWasUnderscore = true; size_t length = identifier.length(); // Zero-length identifiers are not valid (these can occur inside labels) if (length == 0) { return false; } // Check for valid character at the start if (!IsWordStartCharacter(identifier[0])) { return false; } // Check for only valid characters and no double underscores for (size_t i = 0; i < length; i++) { if (!IsWordCharacter(identifier[i]) || (identifier[i] == '_' && lastWasUnderscore)) { return false; } lastWasUnderscore = identifier[i] == '_'; } // Check for underscore at the end if (lastWasUnderscore == true) { return false; } // All checks passed return true; } static bool IsValidNumber(const std::string& number) { size_t hashPos = number.find("#"); bool seenDot = false; size_t i = 0; size_t length = number.length(); if (length == 0) return false; // Just in case // Decimal number if (hashPos == std::string::npos) { bool canBeSpecial = false; for (; i < length; i++) { if (number[i] == '_') { if (!canBeSpecial) { return false; } canBeSpecial = false; } else if (number[i] == '.') { if (!canBeSpecial || seenDot) { return false; } canBeSpecial = false; seenDot = true; } else if (IsADigit(number[i])) { canBeSpecial = true; } else { break; } } if (!canBeSpecial) return false; } else { // Based number bool canBeSpecial = false; int base = 0; // Parse base for (; i < length; i++) { int ch = number[i]; if (ch == '_') { if (!canBeSpecial) return false; canBeSpecial = false; } else if (IsADigit(ch)) { base = base * 10 + (ch - '0'); if (base > 16) return false; canBeSpecial = true; } else if (ch == '#' && canBeSpecial) { break; } else { return false; } } if (base < 2) return false; if (i == length) return false; i++; // Skip over '#' // Parse number canBeSpecial = false; for (; i < length; i++) { int ch = tolower(number[i]); if (ch == '_') { if (!canBeSpecial) { return false; } canBeSpecial = false; } else if (ch == '.') { if (!canBeSpecial || seenDot) { return false; } canBeSpecial = false; seenDot = true; } else if (IsADigit(ch)) { if (ch - '0' >= base) { return false; } canBeSpecial = true; } else if (ch >= 'a' && ch <= 'f') { if (ch - 'a' + 10 >= base) { return false; } canBeSpecial = true; } else if (ch == '#' && canBeSpecial) { break; } else { return false; } } if (i == length) { return false; } i++; } // Exponent (optional) if (i < length) { if (number[i] != 'e' && number[i] != 'E') return false; i++; // Move past 'E' if (i == length) { return false; } if (number[i] == '+') i++; else if (number[i] == '-') { if (seenDot) { i++; } else { return false; // Integer literals should not have negative exponents } } if (i == length) { return false; } bool canBeSpecial = false; for (; i < length; i++) { if (number[i] == '_') { if (!canBeSpecial) { return false; } canBeSpecial = false; } else if (IsADigit(number[i])) { canBeSpecial = true; } else { return false; } } if (!canBeSpecial) return false; } // if i == length, number was parsed successfully. return i == length; } static inline bool IsWordCharacter(int ch) { return IsWordStartCharacter(ch) || IsADigit(ch); } static inline bool IsWordStartCharacter(int ch) { return (IsASCII(ch) && isalpha(ch)) || ch == '_'; } ================================================ FILE: lexilla/lexers/LexAsciidoc.cxx ================================================ /****************************************************************** * LexAsciidoc.cxx * * A simple Asciidoc lexer for scintilla. * * Based on the LexMarkdown.cxx by Jon Strait - jstrait@moonloop.net * * The License.txt file describes the conditions under which this * software may be distributed. * *****************************************************************/ #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; namespace { typedef struct { bool start; int len1; int len2; const char *name; } MacroItem; static const MacroItem MacroList[] = { // Directives {true, 5, 2, "ifdef::"}, {true, 6, 2, "ifeval::"}, {true, 6, 2, "ifndef::"}, {true, 5, 2, "endif::"}, // Macros {true, 5, 2, "audio::"}, {true, 7, 2, "include::"}, {true, 5, 2, "image::"}, {true, 5, 2, "video::"}, {false, 8, 1, "asciimath:"}, {false, 3, 1, "btn:"}, {false, 5, 1, "image:"}, {false, 3, 1, "kbd:"}, {false, 9, 1, "latexmath:"}, {false, 4, 1, "link:"}, {false, 6, 1, "mailto:"}, {false, 4, 1, "menu:"}, {false, 4, 1, "pass:"}, {false, 4, 1, "stem:"}, {false, 4, 1, "xref:"}, // Admonitions {true, 7, 1, "CAUTION:"}, {true, 9, 1, "IMPORTANT:"}, {true, 4, 1, "NOTE:"}, {true, 3, 1, "TIP:"}, {true, 7, 1, "WARNING:"}, {false, 0, 0, NULL} }; constexpr bool IsNewline(const int ch) { // sc.GetRelative(i) returns '\0' if out of range return (ch == '\n' || ch == '\r' || ch == '\0'); } } static bool AtTermStart(StyleContext &sc) { return sc.currentPos == 0 || sc.chPrev == 0 || isspacechar(sc.chPrev); } static void ColorizeAsciidocDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList **, Accessor &styler) { bool freezeCursor = false; StyleContext sc(startPos, static_cast(length), initStyle, styler); while (sc.More()) { // Skip past escaped characters if (sc.ch == '\\') { sc.Forward(); continue; } // Skip newline. if (IsNewline(sc.ch)) { // Newline doesn't end blocks if (sc.state != SCE_ASCIIDOC_CODEBK && \ sc.state != SCE_ASCIIDOC_PASSBK && \ sc.state != SCE_ASCIIDOC_COMMENTBK && \ sc.state != SCE_ASCIIDOC_LITERALBK) { sc.SetState(SCE_ASCIIDOC_DEFAULT); } sc.Forward(); continue; } // Conditional state-based actions switch (sc.state) { // Strong case SCE_ASCIIDOC_STRONG1: if (sc.ch == '*' && sc.chPrev != ' ') { sc.Forward(); sc.SetState(SCE_ASCIIDOC_DEFAULT); freezeCursor = true; } break; case SCE_ASCIIDOC_STRONG2: if (sc.Match("**") && sc.chPrev != ' ') { sc.Forward(2); sc.SetState(SCE_ASCIIDOC_DEFAULT); freezeCursor = true; } break; // Emphasis case SCE_ASCIIDOC_EM1: if (sc.ch == '_' && sc.chPrev != ' ') { sc.Forward(); sc.SetState(SCE_ASCIIDOC_DEFAULT); freezeCursor = true; } break; case SCE_ASCIIDOC_EM2: if (sc.Match("__") && sc.chPrev != ' ') { sc.Forward(2); sc.SetState(SCE_ASCIIDOC_DEFAULT); freezeCursor = true; } break; // Link case SCE_ASCIIDOC_LINK: if (sc.ch == ']' && sc.chPrev != '\\') { sc.SetState(SCE_ASCIIDOC_DEFAULT); } break; // Code block case SCE_ASCIIDOC_CODEBK: if (sc.atLineStart && sc.Match("----") && IsNewline(sc.GetRelative(4))) { sc.Forward(4); sc.SetState(SCE_ASCIIDOC_DEFAULT); } break; // Passthrough block case SCE_ASCIIDOC_PASSBK: if (sc.atLineStart && sc.Match("++++") && IsNewline(sc.GetRelative(4))) { sc.Forward(4); sc.SetState(SCE_ASCIIDOC_DEFAULT); } break; // Comment block case SCE_ASCIIDOC_COMMENTBK: if (sc.atLineStart && sc.Match("////") && IsNewline(sc.GetRelative(4))) { sc.Forward(4); sc.SetState(SCE_ASCIIDOC_DEFAULT); } break; // Literal case SCE_ASCIIDOC_LITERAL: if (sc.ch == '+' && sc.chPrev != '\\') { sc.SetState(SCE_ASCIIDOC_DEFAULT); } break; // Literal block case SCE_ASCIIDOC_LITERALBK: if (sc.atLineStart && sc.Match("....") && IsNewline(sc.GetRelative(4))) { sc.Forward(4); sc.SetState(SCE_ASCIIDOC_DEFAULT); } break; // Attribute case SCE_ASCIIDOC_ATTRIB: if (sc.ch == ':' && sc.chPrev != ' ' && sc.chNext == ' ') { sc.Forward(); sc.SetState(SCE_ASCIIDOC_ATTRIBVAL); } break; // Macro case SCE_ASCIIDOC_MACRO: if (sc.ch == ']' && sc.chPrev != '\\') { sc.SetState(SCE_ASCIIDOC_DEFAULT); } break; // Default case SCE_ASCIIDOC_DEFAULT: // Headers if (sc.atLineStart && sc.Match("====== ")) { sc.SetState(SCE_ASCIIDOC_HEADER6); sc.Forward(6); } else if (sc.atLineStart && sc.Match("===== ")) { sc.SetState(SCE_ASCIIDOC_HEADER5); sc.Forward(5); } else if (sc.atLineStart && sc.Match("==== ")) { sc.SetState(SCE_ASCIIDOC_HEADER4); sc.Forward(4); } else if (sc.atLineStart && sc.Match("=== ")) { sc.SetState(SCE_ASCIIDOC_HEADER3); sc.Forward(3); } else if (sc.atLineStart && sc.Match("== ")) { sc.SetState(SCE_ASCIIDOC_HEADER2); sc.Forward(2); } else if (sc.atLineStart && sc.Match("= ")) { sc.SetState(SCE_ASCIIDOC_HEADER1); sc.Forward(1); } // Unordered list item else if (sc.atLineStart && sc.Match("****** ")) { sc.SetState(SCE_ASCIIDOC_ULIST_ITEM); sc.Forward(6); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match("***** ")) { sc.SetState(SCE_ASCIIDOC_ULIST_ITEM); sc.Forward(5); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match("**** ")) { sc.SetState(SCE_ASCIIDOC_ULIST_ITEM); sc.Forward(4); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match("*** ")) { sc.SetState(SCE_ASCIIDOC_ULIST_ITEM); sc.Forward(3); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match("** ")) { sc.SetState(SCE_ASCIIDOC_ULIST_ITEM); sc.Forward(2); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match("* ")) { sc.SetState(SCE_ASCIIDOC_ULIST_ITEM); sc.Forward(1); sc.SetState(SCE_ASCIIDOC_DEFAULT); } // Ordered list item else if (sc.atLineStart && sc.Match("...... ")) { sc.SetState(SCE_ASCIIDOC_OLIST_ITEM); sc.Forward(6); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match("..... ")) { sc.SetState(SCE_ASCIIDOC_OLIST_ITEM); sc.Forward(5); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match(".... ")) { sc.SetState(SCE_ASCIIDOC_OLIST_ITEM); sc.Forward(4); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match("... ")) { sc.SetState(SCE_ASCIIDOC_OLIST_ITEM); sc.Forward(3); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match(".. ")) { sc.SetState(SCE_ASCIIDOC_OLIST_ITEM); sc.Forward(2); sc.SetState(SCE_ASCIIDOC_DEFAULT); } else if (sc.atLineStart && sc.Match(". ")) { sc.SetState(SCE_ASCIIDOC_OLIST_ITEM); sc.Forward(1); sc.SetState(SCE_ASCIIDOC_DEFAULT); } // Blockquote else if (sc.atLineStart && sc.Match("> ")) { sc.SetState(SCE_ASCIIDOC_BLOCKQUOTE); sc.Forward(); } // Link else if (!sc.atLineStart && sc.ch == '[' && sc.chPrev != '\\' && sc.chNext != ' ') { sc.Forward(); sc.SetState(SCE_ASCIIDOC_LINK); freezeCursor = true; } // Code block else if (sc.atLineStart && sc.Match("----") && IsNewline(sc.GetRelative(4))) { sc.SetState(SCE_ASCIIDOC_CODEBK); sc.Forward(4); } // Passthrough block else if (sc.atLineStart && sc.Match("++++") && IsNewline(sc.GetRelative(4))) { sc.SetState(SCE_ASCIIDOC_PASSBK); sc.Forward(4); } // Comment block else if (sc.atLineStart && sc.Match("////") && IsNewline(sc.GetRelative(4))) { sc.SetState(SCE_ASCIIDOC_COMMENTBK); sc.Forward(4); } // Comment else if (sc.atLineStart && sc.Match("//")) { sc.SetState(SCE_ASCIIDOC_COMMENT); sc.Forward(); } // Literal else if (sc.ch == '+' && sc.chPrev != '\\' && sc.chNext != ' ' && AtTermStart(sc)) { sc.Forward(); sc.SetState(SCE_ASCIIDOC_LITERAL); freezeCursor = true; } // Literal block else if (sc.atLineStart && sc.Match("....") && IsNewline(sc.GetRelative(4))) { sc.SetState(SCE_ASCIIDOC_LITERALBK); sc.Forward(4); } // Attribute else if (sc.atLineStart && sc.ch == ':' && sc.chNext != ' ') { sc.SetState(SCE_ASCIIDOC_ATTRIB); } // Strong else if (sc.Match("**") && sc.GetRelative(2) != ' ') { sc.SetState(SCE_ASCIIDOC_STRONG2); sc.Forward(); } else if (sc.ch == '*' && sc.chNext != ' ' && AtTermStart(sc)) { sc.SetState(SCE_ASCIIDOC_STRONG1); } // Emphasis else if (sc.Match("__") && sc.GetRelative(2) != ' ') { sc.SetState(SCE_ASCIIDOC_EM2); sc.Forward(); } else if (sc.ch == '_' && sc.chNext != ' ' && AtTermStart(sc)) { sc.SetState(SCE_ASCIIDOC_EM1); } // Macro else if (sc.atLineStart && sc.ch == '[' && sc.chNext != ' ') { sc.Forward(); sc.SetState(SCE_ASCIIDOC_MACRO); freezeCursor = true; } else { int i = 0; bool found = false; while (!found && MacroList[i].name != NULL) { if (MacroList[i].start) found = sc.atLineStart && sc.Match(MacroList[i].name); else found = sc.Match(MacroList[i].name); if (found) { sc.SetState(SCE_ASCIIDOC_MACRO); sc.Forward(MacroList[i].len1); sc.SetState(SCE_ASCIIDOC_DEFAULT); if (MacroList[i].len2 > 1) sc.Forward(MacroList[i].len2 - 1); } i++; } } break; } // Advance if not holding back the cursor for this iteration. if (!freezeCursor) sc.Forward(); freezeCursor = false; } sc.Complete(); } LexerModule lmAsciidoc(SCLEX_ASCIIDOC, ColorizeAsciidocDoc, "asciidoc"); ================================================ FILE: lexilla/lexers/LexAsm.cxx ================================================ // Scintilla source code edit control /** @file LexAsm.cxx ** Lexer for Assembler, just for the MASM syntax ** Written by The Black Horus ** Enhancements and NASM stuff by Kein-Hong Man, 2003-10 ** SCE_ASM_COMMENTBLOCK and SCE_ASM_CHARACTER are for future GNU as colouring ** Converted to lexer object and added further folding features/properties by "Udo Lechner" **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '?'); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' || ch == '%' || ch == '@' || ch == '$' || ch == '?'); } static inline bool IsAsmOperator(const int ch) { if ((ch < 0x80) && (isalnum(ch))) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '^' || ch == '[' || ch == ']' || ch == '<' || ch == '&' || ch == '>' || ch == ',' || ch == '|' || ch == '~' || ch == '%' || ch == ':') return true; return false; } static bool IsStreamCommentStyle(int style) { return style == SCE_ASM_COMMENTDIRECTIVE || style == SCE_ASM_COMMENTBLOCK; } static inline int LowerCase(int c) { if (c >= 'A' && c <= 'Z') return 'a' + c - 'A'; return c; } // An individual named option for use in an OptionSet // Options used for LexerAsm struct OptionsAsm { std::string delimiter; bool fold; bool foldSyntaxBased; bool foldCommentMultiline; bool foldCommentExplicit; std::string foldExplicitStart; std::string foldExplicitEnd; bool foldExplicitAnywhere; bool foldCompact; std::string commentChar; OptionsAsm() { delimiter = ""; fold = false; foldSyntaxBased = true; foldCommentMultiline = false; foldCommentExplicit = false; foldExplicitStart = ""; foldExplicitEnd = ""; foldExplicitAnywhere = false; foldCompact = true; commentChar = ""; } }; static const char * const asmWordListDesc[] = { "CPU instructions", "FPU instructions", "Registers", "Directives", "Directive operands", "Extended instructions", "Directives4Foldstart", "Directives4Foldend", 0 }; struct OptionSetAsm : public OptionSet { OptionSetAsm() { DefineProperty("lexer.asm.comment.delimiter", &OptionsAsm::delimiter, "Character used for COMMENT directive's delimiter, replacing the standard \"~\"."); DefineProperty("fold", &OptionsAsm::fold); DefineProperty("fold.asm.syntax.based", &OptionsAsm::foldSyntaxBased, "Set this property to 0 to disable syntax based folding."); DefineProperty("fold.asm.comment.multiline", &OptionsAsm::foldCommentMultiline, "Set this property to 1 to enable folding multi-line comments."); DefineProperty("fold.asm.comment.explicit", &OptionsAsm::foldCommentExplicit, "This option enables folding explicit fold points when using the Asm lexer. " "Explicit fold points allows adding extra folding by placing a ;{ comment at the start and a ;} " "at the end of a section that should fold."); DefineProperty("fold.asm.explicit.start", &OptionsAsm::foldExplicitStart, "The string to use for explicit fold start points, replacing the standard ;{."); DefineProperty("fold.asm.explicit.end", &OptionsAsm::foldExplicitEnd, "The string to use for explicit fold end points, replacing the standard ;}."); DefineProperty("fold.asm.explicit.anywhere", &OptionsAsm::foldExplicitAnywhere, "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); DefineProperty("fold.compact", &OptionsAsm::foldCompact); DefineProperty("lexer.as.comment.character", &OptionsAsm::commentChar, "Overrides the default comment character (which is ';' for asm and '#' for as)."); DefineWordListSets(asmWordListDesc); } }; class LexerAsm : public DefaultLexer { WordList cpuInstruction; WordList mathInstruction; WordList registers; WordList directive; WordList directiveOperand; WordList extInstruction; WordList directives4foldstart; WordList directives4foldend; OptionsAsm options; OptionSetAsm osAsm; int commentChar; public: LexerAsm(const char *languageName_, int language_, int commentChar_) : DefaultLexer(languageName_, language_) { commentChar = commentChar_; } virtual ~LexerAsm() { } void SCI_METHOD Release() override { delete this; } int SCI_METHOD Version() const override { return lvRelease5; } const char * SCI_METHOD PropertyNames() override { return osAsm.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osAsm.PropertyType(name); } const char * SCI_METHOD DescribeProperty(const char *name) override { return osAsm.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char *key) override { return osAsm.PropertyGet(key); } const char * SCI_METHOD DescribeWordListSets() override { return osAsm.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return 0; } static ILexer5 *LexerFactoryAsm() { return new LexerAsm("asm", SCLEX_ASM, ';'); } static ILexer5 *LexerFactoryAs() { return new LexerAsm("as", SCLEX_AS, '#'); } }; Sci_Position SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) { if (osAsm.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: wordListN = &cpuInstruction; break; case 1: wordListN = &mathInstruction; break; case 2: wordListN = ®isters; break; case 3: wordListN = &directive; break; case 4: wordListN = &directiveOperand; break; case 5: wordListN = &extInstruction; break; case 6: wordListN = &directives4foldstart; break; case 7: wordListN = &directives4foldend; break; } Sci_Position firstModification = -1; if (wordListN) { if (wordListN->Set(wl)) { firstModification = 0; } } return firstModification; } void SCI_METHOD LexerAsm::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); const char commentCharacter = options.commentChar.empty() ? commentChar : options.commentChar.front(); // Do not leak onto next line if (initStyle == SCE_ASM_STRINGEOL) initStyle = SCE_ASM_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { switch (sc.state) { case SCE_ASM_STRING: case SCE_ASM_CHARACTER: // Prevent SCE_ASM_STRINGEOL from leaking back to previous line sc.SetState(sc.state); break; case SCE_ASM_COMMENT: sc.SetState(SCE_ASM_DEFAULT); break; default: break; } } // Handle line continuation generically. if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate. if (sc.state == SCE_ASM_OPERATOR) { if (!IsAsmOperator(sc.ch)) { sc.SetState(SCE_ASM_DEFAULT); } } else if (sc.state == SCE_ASM_NUMBER) { if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_ASM_DEFAULT); } } else if (sc.state == SCE_ASM_IDENTIFIER) { if (!IsAWordChar(sc.ch) ) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); bool IsDirective = false; if (cpuInstruction.InList(s)) { sc.ChangeState(SCE_ASM_CPUINSTRUCTION); } else if (mathInstruction.InList(s)) { sc.ChangeState(SCE_ASM_MATHINSTRUCTION); } else if (registers.InList(s)) { sc.ChangeState(SCE_ASM_REGISTER); } else if (directive.InList(s)) { sc.ChangeState(SCE_ASM_DIRECTIVE); IsDirective = true; } else if (directiveOperand.InList(s)) { sc.ChangeState(SCE_ASM_DIRECTIVEOPERAND); } else if (extInstruction.InList(s)) { sc.ChangeState(SCE_ASM_EXTINSTRUCTION); } sc.SetState(SCE_ASM_DEFAULT); if (IsDirective && !strcmp(s, "comment")) { char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0]; while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd) { sc.ForwardSetState(SCE_ASM_DEFAULT); } if (sc.ch == delimiter) { sc.SetState(SCE_ASM_COMMENTDIRECTIVE); } } } } else if (sc.state == SCE_ASM_COMMENTDIRECTIVE) { char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0]; if (sc.ch == delimiter) { while (!sc.MatchLineEnd()) { sc.Forward(); } sc.SetState(SCE_ASM_DEFAULT); } } else if (sc.state == SCE_ASM_STRING) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_ASM_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_ASM_STRINGEOL); sc.ForwardSetState(SCE_ASM_DEFAULT); } } else if (sc.state == SCE_ASM_CHARACTER) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_ASM_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_ASM_STRINGEOL); sc.ForwardSetState(SCE_ASM_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_ASM_DEFAULT) { if (sc.ch == commentCharacter) { sc.SetState(SCE_ASM_COMMENT); } else if (IsASCII(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && IsASCII(sc.chNext) && isdigit(sc.chNext)))) { sc.SetState(SCE_ASM_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_ASM_IDENTIFIER); } else if (sc.ch == '\"') { sc.SetState(SCE_ASM_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_ASM_CHARACTER); } else if (IsAsmOperator(sc.ch)) { sc.SetState(SCE_ASM_OPERATOR); } } } sc.Complete(); } // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "else". void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) return; LexAccessor styler(pAccess); Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; char word[100]; int wordlen = 0; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (options.foldCommentMultiline && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev)) { levelNext++; } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } } if (options.foldCommentExplicit && ((style == SCE_ASM_COMMENT) || options.foldExplicitAnywhere)) { if (userDefinedFoldMarkers) { if (styler.Match(i, options.foldExplicitStart.c_str())) { levelNext++; } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { levelNext--; } } else { if (ch == ';') { if (chNext == '{') { levelNext++; } else if (chNext == '}') { levelNext--; } } } } if (options.foldSyntaxBased && (style == SCE_ASM_DIRECTIVE)) { word[wordlen++] = static_cast(LowerCase(ch)); if (wordlen == 100) { // prevent overflow word[0] = '\0'; wordlen = 1; } if (styleNext != SCE_ASM_DIRECTIVE) { // reading directive ready word[wordlen] = '\0'; wordlen = 0; if (directives4foldstart.InList(word)) { levelNext++; } else if (directives4foldend.InList(word)){ levelNext--; } } } if (!IsASpace(ch)) visibleChars++; if (atEOL || (i == endPos-1)) { int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (visibleChars == 0 && options.foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelCurrent = levelNext; if (atEOL && (i == static_cast(styler.Length() - 1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } visibleChars = 0; } } } LexerModule lmAsm(SCLEX_ASM, LexerAsm::LexerFactoryAsm, "asm", asmWordListDesc); LexerModule lmAs(SCLEX_AS, LexerAsm::LexerFactoryAs, "as", asmWordListDesc); ================================================ FILE: lexilla/lexers/LexAsn1.cxx ================================================ // Scintilla source code edit control /** @file LexAsn1.cxx ** Lexer for ASN.1 **/ // Copyright 2004 by Herr Pfarrer rpfarrer yahoo de // Last Updated: 20/07/2004 // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; // Some char test functions static bool isAsn1Number(int ch) { return (ch >= '0' && ch <= '9'); } static bool isAsn1Letter(int ch) { return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } static bool isAsn1Char(int ch) { return (ch == '-' ) || isAsn1Number(ch) || isAsn1Letter (ch); } // // Function determining the color of a given code portion // Based on a "state" // static void ColouriseAsn1Doc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordLists[], Accessor &styler) { // The keywords WordList &Keywords = *keywordLists[0]; WordList &Attributes = *keywordLists[1]; WordList &Descriptors = *keywordLists[2]; WordList &Types = *keywordLists[3]; // Parse the whole buffer character by character using StyleContext StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // The state engine switch (sc.state) { case SCE_ASN1_DEFAULT: // Plain characters asn1_default: if (sc.ch == '-' && sc.chNext == '-') // A comment begins here sc.SetState(SCE_ASN1_COMMENT); else if (sc.ch == '"') // A string begins here sc.SetState(SCE_ASN1_STRING); else if (isAsn1Number (sc.ch)) // A number starts here (identifier should start with a letter in ASN.1) sc.SetState(SCE_ASN1_SCALAR); else if (isAsn1Char (sc.ch)) // An identifier starts here (identifier always start with a letter) sc.SetState(SCE_ASN1_IDENTIFIER); else if (sc.ch == ':') // A ::= operator starts here sc.SetState(SCE_ASN1_OPERATOR); break; case SCE_ASN1_COMMENT: // A comment if (sc.ch == '\r' || sc.ch == '\n') // A comment ends here sc.SetState(SCE_ASN1_DEFAULT); break; case SCE_ASN1_IDENTIFIER: // An identifier (keyword, attribute, descriptor or type) if (!isAsn1Char (sc.ch)) { // The end of identifier is here: we can look for it in lists by now and change its state char s[100]; sc.GetCurrent(s, sizeof(s)); if (Keywords.InList(s)) // It's a keyword, change its state sc.ChangeState(SCE_ASN1_KEYWORD); else if (Attributes.InList(s)) // It's an attribute, change its state sc.ChangeState(SCE_ASN1_ATTRIBUTE); else if (Descriptors.InList(s)) // It's a descriptor, change its state sc.ChangeState(SCE_ASN1_DESCRIPTOR); else if (Types.InList(s)) // It's a type, change its state sc.ChangeState(SCE_ASN1_TYPE); // Set to default now sc.SetState(SCE_ASN1_DEFAULT); } break; case SCE_ASN1_STRING: // A string delimited by "" if (sc.ch == '"') { // A string ends here sc.ForwardSetState(SCE_ASN1_DEFAULT); // To correctly manage a char sticking to the string quote goto asn1_default; } break; case SCE_ASN1_SCALAR: // A plain number if (!isAsn1Number (sc.ch)) // A number ends here sc.SetState(SCE_ASN1_DEFAULT); break; case SCE_ASN1_OPERATOR: // The affectation operator ::= and wath follows (eg: ::= { org 6 } OID or ::= 12 trap) if (sc.ch == '{') { // An OID definition starts here: enter the sub loop for (; sc.More(); sc.Forward()) { if (isAsn1Number (sc.ch) && (!isAsn1Char (sc.chPrev) || isAsn1Number (sc.chPrev))) // The OID number is highlighted sc.SetState(SCE_ASN1_OID); else if (isAsn1Char (sc.ch)) // The OID parent identifier is plain sc.SetState(SCE_ASN1_IDENTIFIER); else sc.SetState(SCE_ASN1_DEFAULT); if (sc.ch == '}') // Here ends the OID and the operator sub loop: go back to main loop break; } } else if (isAsn1Number (sc.ch)) { // A trap number definition starts here: enter the sub loop for (; sc.More(); sc.Forward()) { if (isAsn1Number (sc.ch)) // The trap number is highlighted sc.SetState(SCE_ASN1_OID); else { // The number ends here: go back to main loop sc.SetState(SCE_ASN1_DEFAULT); break; } } } else if (sc.ch != ':' && sc.ch != '=' && sc.ch != ' ') // The operator doesn't imply an OID definition nor a trap, back to main loop goto asn1_default; // To be sure to handle actually the state change break; } } sc.Complete(); } static void FoldAsn1Doc(Sci_PositionU, Sci_Position, int, WordList *[], Accessor &styler) { // No folding enabled, no reason to continue... if( styler.GetPropertyInt("fold") == 0 ) return; // No folding implemented: doesn't make sense for ASN.1 } static const char * const asn1WordLists[] = { "Keywords", "Attributes", "Descriptors", "Types", 0, }; LexerModule lmAsn1(SCLEX_ASN1, ColouriseAsn1Doc, "asn1", FoldAsn1Doc, asn1WordLists); ================================================ FILE: lexilla/lexers/LexBaan.cxx ================================================ // Scintilla source code edit control /** @file LexBaan.cxx ** Lexer for Baan. ** Based heavily on LexCPP.cxx **/ // Copyright 2001- by Vamsi Potluru & Praveen Ambekar // Maintainer Email: oirfeodent@yahoo.co.in // The License.txt file describes the conditions under which this software may be distributed. // C standard library #include #include // C++ wrappers of C standard library #include // C++ standard library #include #include #include #include // Scintilla headers // Non-platform-specific headers // include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" // lexlib #include "WordList.h" #include "LexAccessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; namespace { // Use an unnamed namespace to protect the functions and classes from name conflicts // Options used for LexerBaan struct OptionsBaan { bool fold; bool foldComment; bool foldPreprocessor; bool foldCompact; bool baanFoldSyntaxBased; bool baanFoldKeywordsBased; bool baanFoldSections; bool baanFoldInnerLevel; bool baanStylingWithinPreprocessor; OptionsBaan() { fold = false; foldComment = false; foldPreprocessor = false; foldCompact = false; baanFoldSyntaxBased = false; baanFoldKeywordsBased = false; baanFoldSections = false; baanFoldInnerLevel = false; baanStylingWithinPreprocessor = false; } }; const char *const baanWordLists[] = { "Baan & BaanSQL Reserved Keywords ", "Baan Standard functions", "Baan Functions Abridged", "Baan Main Sections ", "Baan Sub Sections", "PreDefined Variables", "PreDefined Attributes", "Enumerates", 0, }; struct OptionSetBaan : public OptionSet { OptionSetBaan() { DefineProperty("fold", &OptionsBaan::fold); DefineProperty("fold.comment", &OptionsBaan::foldComment); DefineProperty("fold.preprocessor", &OptionsBaan::foldPreprocessor); DefineProperty("fold.compact", &OptionsBaan::foldCompact); DefineProperty("fold.baan.syntax.based", &OptionsBaan::baanFoldSyntaxBased, "Set this property to 0 to disable syntax based folding, which is folding based on '{' & '('."); DefineProperty("fold.baan.keywords.based", &OptionsBaan::baanFoldKeywordsBased, "Set this property to 0 to disable keywords based folding, which is folding based on " " for, if, on (case), repeat, select, while and fold ends based on endfor, endif, endcase, until, endselect, endwhile respectively." "Also folds declarations which are grouped together."); DefineProperty("fold.baan.sections", &OptionsBaan::baanFoldSections, "Set this property to 0 to disable folding of Main Sections as well as Sub Sections."); DefineProperty("fold.baan.inner.level", &OptionsBaan::baanFoldInnerLevel, "Set this property to 1 to enable folding of inner levels of select statements." "Disabled by default. case and if statements are also eligible" ); DefineProperty("lexer.baan.styling.within.preprocessor", &OptionsBaan::baanStylingWithinPreprocessor, "For Baan code, determines whether all preprocessor code is styled in the " "preprocessor style (0, the default) or only from the initial # to the end " "of the command word(1)."); DefineWordListSets(baanWordLists); } }; static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '$'); } static inline bool IsAnOperator(int ch) { if (IsAlphaNumeric(ch)) return false; if (ch == '#' || ch == '^' || ch == '&' || ch == '*' || ch == '(' || ch == ')' || ch == '-' || ch == '+' || ch == '=' || ch == '|' || ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == ':' || ch == ';' || ch == '<' || ch == '>' || ch == ',' || ch == '/' || ch == '?' || ch == '!' || ch == '"' || ch == '~' || ch == '\\') return true; return false; } static inline int IsAnyOtherIdentifier(char *s, Sci_Position sLength) { /* IsAnyOtherIdentifier uses standard templates used in baan. The matching template is shown as comments just above the return condition. ^ - refers to any character [a-z]. # - refers to any number [0-9]. Other characters shown are compared as is. Tried implementing with Regex... it was too complicated for me. Any other implementation suggestion welcome. */ switch (sLength) { case 8: if (isalpha(s[0]) && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isalpha(s[4]) && IsADigit(s[5]) && IsADigit(s[6]) && IsADigit(s[7])) { //^^^^^### return(SCE_BAAN_TABLEDEF); } break; case 9: if (s[0] == 't' && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isalpha(s[4]) && isalpha(s[5]) && IsADigit(s[6]) && IsADigit(s[7]) && IsADigit(s[8])) { //t^^^^^### return(SCE_BAAN_TABLEDEF); } else if (s[8] == '.' && isalpha(s[0]) && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isalpha(s[4]) && IsADigit(s[5]) && IsADigit(s[6]) && IsADigit(s[7])) { //^^^^^###. return(SCE_BAAN_TABLESQL); } break; case 13: if (s[8] == '.' && isalpha(s[0]) && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isalpha(s[4]) && IsADigit(s[5]) && IsADigit(s[6]) && IsADigit(s[7])) { //^^^^^###.**** return(SCE_BAAN_TABLESQL); } else if (s[0] == 'r' && s[1] == 'c' && s[2] == 'd' && s[3] == '.' && s[4] == 't' && isalpha(s[5]) && isalpha(s[6]) && isalpha(s[7]) && isalpha(s[8]) && isalpha(s[9]) && IsADigit(s[10]) && IsADigit(s[11]) && IsADigit(s[12])) { //rcd.t^^^^^### return(SCE_BAAN_TABLEDEF); } break; case 14: case 15: if (s[8] == '.' && isalpha(s[0]) && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isalpha(s[4]) && IsADigit(s[5]) && IsADigit(s[6]) && IsADigit(s[7])) { if (s[13] != ':') { //^^^^^###.****** return(SCE_BAAN_TABLESQL); } } break; case 16: case 17: if (s[8] == '.' && s[9] == '_' && s[10] == 'i' && s[11] == 'n' && s[12] == 'd' && s[13] == 'e' && s[14] == 'x' && IsADigit(s[15]) && isalpha(s[0]) && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isalpha(s[4]) && IsADigit(s[5]) && IsADigit(s[6]) && IsADigit(s[7])) { //^^^^^###._index## return(SCE_BAAN_TABLEDEF); } else if (s[8] == '.' && s[9] == '_' && s[10] == 'c' && s[11] == 'o' && s[12] == 'm' && s[13] == 'p' && s[14] == 'n' && s[15] == 'r' && isalpha(s[0]) && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isalpha(s[4]) && IsADigit(s[5]) && IsADigit(s[6]) && IsADigit(s[7])) { //^^^^^###._compnr return(SCE_BAAN_TABLEDEF); } break; default: break; } if (sLength > 14 && s[5] == '.' && s[6] == 'd' && s[7] == 'l' && s[8] == 'l' && s[13] == '.' && isalpha(s[0]) && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isalpha(s[4]) && IsADigit(s[9]) && IsADigit(s[10]) && IsADigit(s[11]) && IsADigit(s[12])) { //^^^^^.dll####. return(SCE_BAAN_FUNCTION); } else if (sLength > 15 && s[2] == 'i' && s[3] == 'n' && s[4] == 't' && s[5] == '.' && s[6] == 'd' && s[7] == 'l' && s[8] == 'l' && isalpha(s[0]) && isalpha(s[1]) && isalpha(s[9]) && isalpha(s[10]) && isalpha(s[11]) && isalpha(s[12]) && isalpha(s[13])) { //^^int.dll^^^^^. return(SCE_BAAN_FUNCTION); } else if (sLength > 11 && s[0] == 'i' && s[10] == '.' && isalpha(s[1]) && isalpha(s[2]) && isalpha(s[3]) && isalpha(s[4]) && isalpha(s[5]) && IsADigit(s[6]) && IsADigit(s[7]) && IsADigit(s[8]) && IsADigit(s[9])) { //i^^^^^####. return(SCE_BAAN_FUNCTION); } return(SCE_BAAN_DEFAULT); } static bool IsCommentLine(Sci_Position line, LexAccessor &styler) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; int style = styler.StyleAt(i); if (ch == '|' && style == SCE_BAAN_COMMENT) return true; else if (!IsASpaceOrTab(ch)) return false; } return false; } static bool IsPreProcLine(Sci_Position line, LexAccessor &styler) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; int style = styler.StyleAt(i); if (ch == '#' && style == SCE_BAAN_PREPROCESSOR) { if (styler.Match(i, "#elif") || styler.Match(i, "#else") || styler.Match(i, "#endif") || styler.Match(i, "#if") || styler.Match(i, "#ifdef") || styler.Match(i, "#ifndef")) // Above PreProcessors has a seperate fold mechanism. return false; else return true; } else if (ch == '^') return true; else if (!IsASpaceOrTab(ch)) return false; } return false; } static int mainOrSubSectionLine(Sci_Position line, LexAccessor &styler) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; int style = styler.StyleAt(i); if (style == SCE_BAAN_WORD5 || style == SCE_BAAN_WORD4) return style; else if (IsASpaceOrTab(ch)) continue; else break; } return 0; } static bool priorSectionIsSubSection(Sci_Position line, LexAccessor &styler){ while (line > 0) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; int style = styler.StyleAt(i); if (style == SCE_BAAN_WORD4) return true; else if (style == SCE_BAAN_WORD5) return false; else if (IsASpaceOrTab(ch)) continue; else break; } line--; } return false; } static bool nextSectionIsSubSection(Sci_Position line, LexAccessor &styler) { while (line > 0) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; int style = styler.StyleAt(i); if (style == SCE_BAAN_WORD4) return true; else if (style == SCE_BAAN_WORD5) return false; else if (IsASpaceOrTab(ch)) continue; else break; } line++; } return false; } static bool IsDeclarationLine(Sci_Position line, LexAccessor &styler) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; int style = styler.StyleAt(i); if (style == SCE_BAAN_WORD) { if (styler.Match(i, "table") || styler.Match(i, "extern") || styler.Match(i, "long") || styler.Match(i, "double") || styler.Match(i, "boolean") || styler.Match(i, "string") || styler.Match(i, "domain")) { for (Sci_Position j = eol_pos; j > pos; j--) { int styleFromEnd = styler.StyleAt(j); if (styleFromEnd == SCE_BAAN_COMMENT) continue; else if (IsASpace(styler[j])) continue; else if (styler[j] != ',') //Above conditions ensures, Declaration is not part of any function parameters. return true; else return false; } } else return false; } else if (!IsASpaceOrTab(ch)) return false; } return false; } static bool IsInnerLevelFold(Sci_Position line, LexAccessor &styler) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; int style = styler.StyleAt(i); if (style == SCE_BAAN_WORD && (styler.Match(i, "else" ) || styler.Match(i, "case") || styler.Match(i, "default") || styler.Match(i, "selectdo") || styler.Match(i, "selecteos") || styler.Match(i, "selectempty") || styler.Match(i, "selecterror"))) return true; else if (IsASpaceOrTab(ch)) continue; else return false; } return false; } static inline bool wordInArray(const std::string& value, std::string *array, int length) { for (int i = 0; i < length; i++) { if (value == array[i]) { return true; } } return false; } class WordListAbridged : public WordList { public: WordListAbridged() { kwAbridged = false; kwHasSection = false; }; ~WordListAbridged() { Clear(); }; bool kwAbridged; bool kwHasSection; bool Contains(const char *s) { return kwAbridged ? InListAbridged(s, '~') : InList(s); }; }; } class LexerBaan : public DefaultLexer { WordListAbridged keywords; WordListAbridged keywords2; WordListAbridged keywords3; WordListAbridged keywords4; WordListAbridged keywords5; WordListAbridged keywords6; WordListAbridged keywords7; WordListAbridged keywords8; WordListAbridged keywords9; OptionsBaan options; OptionSetBaan osBaan; public: LexerBaan() : DefaultLexer("baan", SCLEX_BAAN) { } virtual ~LexerBaan() { } int SCI_METHOD Version() const override { return lvRelease5; } void SCI_METHOD Release() override { delete this; } const char * SCI_METHOD PropertyNames() override { return osBaan.PropertyNames(); } int SCI_METHOD PropertyType(const char * name) override { return osBaan.PropertyType(name); } const char * SCI_METHOD DescribeProperty(const char * name) override { return osBaan.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char *key) override { return osBaan.PropertyGet(key); } const char * SCI_METHOD DescribeWordListSets() override { return osBaan.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return NULL; } static ILexer5 * LexerFactoryBaan() { return new LexerBaan(); } }; Sci_Position SCI_METHOD LexerBaan::PropertySet(const char *key, const char *val) { if (osBaan.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerBaan::WordListSet(int n, const char *wl) { WordListAbridged *WordListAbridgedN = 0; switch (n) { case 0: WordListAbridgedN = &keywords; break; case 1: WordListAbridgedN = &keywords2; break; case 2: WordListAbridgedN = &keywords3; break; case 3: WordListAbridgedN = &keywords4; break; case 4: WordListAbridgedN = &keywords5; break; case 5: WordListAbridgedN = &keywords6; break; case 6: WordListAbridgedN = &keywords7; break; case 7: WordListAbridgedN = &keywords8; break; case 8: WordListAbridgedN = &keywords9; break; } Sci_Position firstModification = -1; if (WordListAbridgedN) { WordListAbridged wlNew; wlNew.Set(wl); if (*WordListAbridgedN != wlNew) { WordListAbridgedN->Set(wl); WordListAbridgedN->kwAbridged = strchr(wl, '~') != NULL; WordListAbridgedN->kwHasSection = strchr(wl, ':') != NULL; firstModification = 0; } } return firstModification; } void SCI_METHOD LexerBaan::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (initStyle == SCE_BAAN_STRINGEOL) // Does not leak onto next line initStyle = SCE_BAAN_DEFAULT; int visibleChars = 0; bool lineHasDomain = false; bool lineHasFunction = false; bool lineHasPreProc = false; bool lineIgnoreString = false; bool lineHasDefines = false; bool numberIsHex = false; char word[1000]; int wordlen = 0; std::string preProcessorTags[13] = { "#context_off", "#context_on", "#define", "#elif", "#else", "#endif", "#ident", "#if", "#ifdef", "#ifndef", "#include", "#pragma", "#undef" }; LexAccessor styler(pAccess); StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // Determine if the current state should terminate. switch (sc.state) { case SCE_BAAN_OPERATOR: sc.SetState(SCE_BAAN_DEFAULT); break; case SCE_BAAN_NUMBER: if (IsASpaceOrTab(sc.ch) || sc.ch == '\r' || sc.ch == '\n' || IsAnOperator(sc.ch)) { sc.SetState(SCE_BAAN_DEFAULT); } else if ((numberIsHex && !(MakeLowerCase(sc.ch) == 'x' || MakeLowerCase(sc.ch) == 'e' || IsADigit(sc.ch, 16) || sc.ch == '.' || sc.ch == '-' || sc.ch == '+')) || (!numberIsHex && !(MakeLowerCase(sc.ch) == 'e' || IsADigit(sc.ch) || sc.ch == '.' || sc.ch == '-' || sc.ch == '+'))) { // check '-' for possible -10e-5. Add '+' as well. numberIsHex = false; sc.ChangeState(SCE_BAAN_IDENTIFIER); sc.SetState(SCE_BAAN_DEFAULT); } break; case SCE_BAAN_IDENTIFIER: if (!IsAWordChar(sc.ch)) { char s[1000]; char s1[1000]; sc.GetCurrentLowered(s, sizeof(s)); if (sc.ch == ':') { memcpy(s1, s, sizeof(s)); s1[sc.LengthCurrent()] = sc.ch; s1[sc.LengthCurrent() + 1] = '\0'; } if ((keywords.kwHasSection && (sc.ch == ':')) ? keywords.Contains(s1) : keywords.Contains(s)) { sc.ChangeState(SCE_BAAN_WORD); if (0 == strcmp(s, "domain")) { lineHasDomain = true; } else if (0 == strcmp(s, "function")) { lineHasFunction = true; } } else if (lineHasDomain) { sc.ChangeState(SCE_BAAN_DOMDEF); lineHasDomain = false; } else if (lineHasFunction) { sc.ChangeState(SCE_BAAN_FUNCDEF); lineHasFunction = false; } else if ((keywords2.kwHasSection && (sc.ch == ':')) ? keywords2.Contains(s1) : keywords2.Contains(s)) { sc.ChangeState(SCE_BAAN_WORD2); } else if ((keywords3.kwHasSection && (sc.ch == ':')) ? keywords3.Contains(s1) : keywords3.Contains(s)) { if (sc.ch == '(') sc.ChangeState(SCE_BAAN_WORD3); else sc.ChangeState(SCE_BAAN_IDENTIFIER); } else if ((keywords4.kwHasSection && (sc.ch == ':')) ? keywords4.Contains(s1) : keywords4.Contains(s)) { sc.ChangeState(SCE_BAAN_WORD4); } else if ((keywords5.kwHasSection && (sc.ch == ':')) ? keywords5.Contains(s1) : keywords5.Contains(s)) { sc.ChangeState(SCE_BAAN_WORD5); } else if ((keywords6.kwHasSection && (sc.ch == ':')) ? keywords6.Contains(s1) : keywords6.Contains(s)) { sc.ChangeState(SCE_BAAN_WORD6); } else if ((keywords7.kwHasSection && (sc.ch == ':')) ? keywords7.Contains(s1) : keywords7.Contains(s)) { sc.ChangeState(SCE_BAAN_WORD7); } else if ((keywords8.kwHasSection && (sc.ch == ':')) ? keywords8.Contains(s1) : keywords8.Contains(s)) { sc.ChangeState(SCE_BAAN_WORD8); } else if ((keywords9.kwHasSection && (sc.ch == ':')) ? keywords9.Contains(s1) : keywords9.Contains(s)) { sc.ChangeState(SCE_BAAN_WORD9); } else if (lineHasPreProc) { sc.ChangeState(SCE_BAAN_OBJECTDEF); lineHasPreProc = false; } else if (lineHasDefines) { sc.ChangeState(SCE_BAAN_DEFINEDEF); lineHasDefines = false; } else { int state = IsAnyOtherIdentifier(s, sc.LengthCurrent()); if (state > 0) { sc.ChangeState(state); } } sc.SetState(SCE_BAAN_DEFAULT); } break; case SCE_BAAN_PREPROCESSOR: if (options.baanStylingWithinPreprocessor) { if (IsASpace(sc.ch) || IsAnOperator(sc.ch)) { sc.SetState(SCE_BAAN_DEFAULT); } } else { if (sc.atLineEnd && (sc.chNext != '^')) { sc.SetState(SCE_BAAN_DEFAULT); } } break; case SCE_BAAN_COMMENT: if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_BAAN_DEFAULT); } break; case SCE_BAAN_COMMENTDOC: if (sc.MatchIgnoreCase("enddllusage")) { for (unsigned int i = 0; i < 10; i++) { sc.Forward(); } sc.ForwardSetState(SCE_BAAN_DEFAULT); } else if (sc.MatchIgnoreCase("endfunctionusage")) { for (unsigned int i = 0; i < 15; i++) { sc.Forward(); } sc.ForwardSetState(SCE_BAAN_DEFAULT); } break; case SCE_BAAN_STRING: if (sc.ch == '\"') { sc.ForwardSetState(SCE_BAAN_DEFAULT); } else if ((sc.atLineEnd) && (sc.chNext != '^')) { sc.ChangeState(SCE_BAAN_STRINGEOL); sc.ForwardSetState(SCE_BAAN_DEFAULT); visibleChars = 0; } break; } // Determine if a new state should be entered. if (sc.state == SCE_BAAN_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) || ((sc.ch == '-' || sc.ch == '+') && (IsADigit(sc.chNext) || sc.chNext == '.')) || (MakeLowerCase(sc.ch) == 'e' && (IsADigit(sc.chNext) || sc.chNext == '+' || sc.chNext == '-'))) { if ((sc.ch == '0' && MakeLowerCase(sc.chNext) == 'x') || ((sc.ch == '-' || sc.ch == '+') && sc.chNext == '0' && MakeLowerCase(sc.GetRelativeCharacter(2)) == 'x')){ numberIsHex = true; } sc.SetState(SCE_BAAN_NUMBER); } else if (sc.MatchIgnoreCase("dllusage") || sc.MatchIgnoreCase("functionusage")) { sc.SetState(SCE_BAAN_COMMENTDOC); do { sc.Forward(); } while ((!sc.atLineEnd) && sc.More()); } else if (iswordstart(sc.ch)) { sc.SetState(SCE_BAAN_IDENTIFIER); } else if (sc.Match('|')) { sc.SetState(SCE_BAAN_COMMENT); } else if (sc.ch == '\"' && !(lineIgnoreString)) { sc.SetState(SCE_BAAN_STRING); } else if (sc.ch == '#' && visibleChars == 0) { // Preprocessor commands are alone on their line sc.SetState(SCE_BAAN_PREPROCESSOR); word[0] = '\0'; wordlen = 0; while (sc.More() && !(IsASpace(sc.chNext) || IsAnOperator(sc.chNext))) { sc.Forward(); wordlen++; } sc.GetCurrentLowered(word, sizeof(word)); if (!sc.atLineEnd) { word[wordlen++] = sc.ch; word[wordlen++] = '\0'; } if (!wordInArray(word, preProcessorTags, 13)) // Colorise only preprocessor built in Baan. sc.ChangeState(SCE_BAAN_IDENTIFIER); if (strcmp(word, "#pragma") == 0 || strcmp(word, "#include") == 0) { lineHasPreProc = true; lineIgnoreString = true; } else if (strcmp(word, "#define") == 0 || strcmp(word, "#undef") == 0 || strcmp(word, "#ifdef") == 0 || strcmp(word, "#if") == 0 || strcmp(word, "#ifndef") == 0) { lineHasDefines = true; lineIgnoreString = false; } } else if (IsAnOperator(static_cast(sc.ch))) { sc.SetState(SCE_BAAN_OPERATOR); } } if (sc.atLineEnd) { // Reset states to begining of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; lineHasDomain = false; lineHasFunction = false; lineHasPreProc = false; lineIgnoreString = false; lineHasDefines = false; numberIsHex = false; } if (!IsASpace(sc.ch)) { visibleChars++; } } sc.Complete(); } void SCI_METHOD LexerBaan::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) return; char word[100]; int wordlen = 0; bool foldStart = true; bool foldNextSelect = true; bool afterFunctionSection = false; bool beforeDeclarationSection = false; int currLineStyle = 0; int nextLineStyle = 0; std::string startTags[6] = { "for", "if", "on", "repeat", "select", "while" }; std::string endTags[6] = { "endcase", "endfor", "endif", "endselect", "endwhile", "until" }; std::string selectCloseTags[5] = { "selectdo", "selecteos", "selectempty", "selecterror", "endselect" }; LexAccessor styler(pAccess); Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); // Backtrack to previous line in case need to fix its fold status if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); } } int levelPrev = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelPrev = styler.LevelAt(lineCurrent - 1) >> 16; int levelCurrent = levelPrev; char chNext = styler[startPos]; int style = initStyle; int styleNext = styler.StyleAt(startPos); for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); style = styleNext; styleNext = styler.StyleAt(i + 1); int stylePrev = (i) ? styler.StyleAt(i - 1) : SCE_BAAN_DEFAULT; bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); // Comment folding if (options.foldComment && style == SCE_BAAN_COMMENTDOC) { if (style != stylePrev) { levelCurrent++; } else if (style != styleNext) { levelCurrent--; } } if (options.foldComment && atEOL && IsCommentLine(lineCurrent, styler)) { if (!IsCommentLine(lineCurrent - 1, styler) && IsCommentLine(lineCurrent + 1, styler)) levelCurrent++; else if (IsCommentLine(lineCurrent - 1, styler) && !IsCommentLine(lineCurrent + 1, styler)) levelCurrent--; } // PreProcessor Folding if (options.foldPreprocessor) { if (atEOL && IsPreProcLine(lineCurrent, styler)) { if (!IsPreProcLine(lineCurrent - 1, styler) && IsPreProcLine(lineCurrent + 1, styler)) levelCurrent++; else if (IsPreProcLine(lineCurrent - 1, styler) && !IsPreProcLine(lineCurrent + 1, styler)) levelCurrent--; } else if (style == SCE_BAAN_PREPROCESSOR) { // folds #ifdef/#if/#ifndef - they are not part of the IsPreProcLine folding. if (ch == '#') { if (styler.Match(i, "#ifdef") || styler.Match(i, "#if") || styler.Match(i, "#ifndef") || styler.Match(i, "#context_on")) levelCurrent++; else if (styler.Match(i, "#endif") || styler.Match(i, "#context_off")) levelCurrent--; } } } //Syntax Folding if (options.baanFoldSyntaxBased && (style == SCE_BAAN_OPERATOR)) { if (ch == '{' || ch == '(') { levelCurrent++; } else if (ch == '}' || ch == ')') { levelCurrent--; } } //Keywords Folding if (options.baanFoldKeywordsBased) { if (atEOL && IsDeclarationLine(lineCurrent, styler)) { if (!IsDeclarationLine(lineCurrent - 1, styler) && IsDeclarationLine(lineCurrent + 1, styler)) levelCurrent++; else if (IsDeclarationLine(lineCurrent - 1, styler) && !IsDeclarationLine(lineCurrent + 1, styler)) levelCurrent--; } else if (style == SCE_BAAN_WORD) { word[wordlen++] = static_cast(MakeLowerCase(ch)); if (wordlen == 100) { // prevent overflow word[0] = '\0'; wordlen = 1; } if (styleNext != SCE_BAAN_WORD) { word[wordlen] = '\0'; wordlen = 0; if (strcmp(word, "for") == 0) { Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } if (styler.Match(j, "update")) { // Means this is a "for update" used by Select which is already folded. foldStart = false; } } else if (strcmp(word, "on") == 0) { Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } if (!styler.Match(j, "case")) { // Means this is not a "on Case" statement... could be "on" used by index. foldStart = false; } } else if (strcmp(word, "select") == 0) { if (foldNextSelect) { // Next Selects are sub-clause till reach of selectCloseTags[] array. foldNextSelect = false; foldStart = true; } else { foldNextSelect = false; foldStart = false; } } else if (wordInArray(word, selectCloseTags, 5)) { // select clause ends, next select clause can be folded. foldNextSelect = true; foldStart = true; } else { foldStart = true; } if (foldStart) { if (wordInArray(word, startTags, 6)) { levelCurrent++; } else if (wordInArray(word, endTags, 6)) { levelCurrent--; } } } } } // Fold inner level of if/select/case statements if (options.baanFoldInnerLevel && atEOL) { bool currLineInnerLevel = IsInnerLevelFold(lineCurrent, styler); bool nextLineInnerLevel = IsInnerLevelFold(lineCurrent + 1, styler); if (currLineInnerLevel && currLineInnerLevel != nextLineInnerLevel) { levelCurrent++; } else if (nextLineInnerLevel && nextLineInnerLevel != currLineInnerLevel) { levelCurrent--; } } // Section Foldings. // One way of implementing Section Foldings, as there is no END markings of sections. // first section ends on the previous line of next section. // Re-written whole folding to accomodate this. if (options.baanFoldSections && atEOL) { currLineStyle = mainOrSubSectionLine(lineCurrent, styler); nextLineStyle = mainOrSubSectionLine(lineCurrent + 1, styler); if (currLineStyle != 0 && currLineStyle != nextLineStyle) { if (levelCurrent < levelPrev) --levelPrev; for (Sci_Position j = styler.LineStart(lineCurrent); j < styler.LineStart(lineCurrent + 1) - 1; j++) { if (IsASpaceOrTab(styler[j])) continue; else if (styler.StyleAt(j) == SCE_BAAN_WORD5) { if (styler.Match(j, "functions:")) { // Means functions: is the end of MainSections. // Nothing to fold after this. afterFunctionSection = true; break; } else { afterFunctionSection = false; break; } } else { afterFunctionSection = false; break; } } if (!afterFunctionSection) levelCurrent++; } else if (nextLineStyle != 0 && currLineStyle != nextLineStyle && (priorSectionIsSubSection(lineCurrent -1 ,styler) || !nextSectionIsSubSection(lineCurrent + 1, styler))) { for (Sci_Position j = styler.LineStart(lineCurrent + 1); j < styler.LineStart(lineCurrent + 1 + 1) - 1; j++) { if (IsASpaceOrTab(styler[j])) continue; else if (styler.StyleAt(j) == SCE_BAAN_WORD5) { if (styler.Match(j, "declaration:")) { // Means declaration: is the start of MainSections. // Nothing to fold before this. beforeDeclarationSection = true; break; } else { beforeDeclarationSection = false; break; } } else { beforeDeclarationSection = false; break; } } if (!beforeDeclarationSection) { levelCurrent--; if (nextLineStyle == SCE_BAAN_WORD5 && priorSectionIsSubSection(lineCurrent-1, styler)) // next levelCurrent--; is to unfold previous subsection fold. // On reaching the next main section, the previous main as well sub section ends. levelCurrent--; } } } if (atEOL) { int lev = levelPrev; lev |= levelCurrent << 16; if (visibleChars == 0 && options.foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } LexerModule lmBaan(SCLEX_BAAN, LexerBaan::LexerFactoryBaan, "baan", baanWordLists); ================================================ FILE: lexilla/lexers/LexBash.cxx ================================================ // Scintilla source code edit control /** @file LexBash.cxx ** Lexer for Bash. **/ // Copyright 2004-2012 by Neil Hodgson // Adapted from LexPerl by Kein-Hong Man 2004 // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "StringCopy.h" #include "InList.h" #include "WordList.h" #include "LexAccessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "SubStyles.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; namespace { #define HERE_DELIM_MAX 256 // define this if you want 'invalid octals' to be marked as errors // usually, this is not a good idea, permissive lexing is better #undef PEDANTIC_OCTAL #define BASH_BASE_ERROR 65 #define BASH_BASE_DECIMAL 66 #define BASH_BASE_HEX 67 #ifdef PEDANTIC_OCTAL #define BASH_BASE_OCTAL 68 #define BASH_BASE_OCTAL_ERROR 69 #endif // state constants for parts of a bash command segment enum class CmdState { Body, Start, Word, Test, // test SingleBracket, // [] DoubleBracket, // [[]] Arithmetic, Delimiter, }; enum class CommandSubstitution : int { Backtick, Inside, InsideTrack, }; // state constants for nested delimiter pairs, used by // SCE_SH_STRING, SCE_SH_PARAM and SCE_SH_BACKTICKS processing enum class QuoteStyle { Literal, // '' CString, // $'' String, // "" LString, // $"" HereDoc, // here document Backtick, // `` Parameter, // ${} Command, // $() CommandInside, // $() with styling inside Arithmetic, // $(()), $[] }; #define BASH_QUOTE_STACK_MAX 7 #define BASH_SPECIAL_PARAMETER "*@#?-$!" constexpr int commandSubstitutionFlag = 0x40; constexpr int MaskCommand(int state) noexcept { return state & ~commandSubstitutionFlag; } constexpr int translateBashDigit(int ch) noexcept { if (ch >= '0' && ch <= '9') { return ch - '0'; } else if (ch >= 'a' && ch <= 'z') { return ch - 'a' + 10; } else if (ch >= 'A' && ch <= 'Z') { return ch - 'A' + 36; } else if (ch == '@') { return 62; } else if (ch == '_') { return 63; } return BASH_BASE_ERROR; } int getBashNumberBase(char *s) noexcept { int i = 0; int base = 0; while (*s) { base = base * 10 + (*s++ - '0'); i++; } if (base > 64 || i > 2) { return BASH_BASE_ERROR; } return base; } constexpr int opposite(int ch) noexcept { if (ch == '(') return ')'; if (ch == '[') return ']'; if (ch == '{') return '}'; if (ch == '<') return '>'; return ch; } int GlobScan(StyleContext &sc) { // forward scan for zsh globs, disambiguate versus bash arrays // complex expressions may still fail, e.g. unbalanced () '' "" etc int c = 0; int sLen = 0; int pCount = 0; int hash = 0; while ((c = sc.GetRelativeCharacter(++sLen)) != 0) { if (IsASpace(c)) { return 0; } else if (c == '\'' || c == '\"') { if (hash != 2) return 0; } else if (c == '#' && hash == 0) { hash = (sLen == 1) ? 2:1; } else if (c == '(') { pCount++; } else if (c == ')') { if (pCount == 0) { if (hash) return sLen; return 0; } pCount--; } } return 0; } bool IsCommentLine(Sci_Position line, LexAccessor &styler) { const Sci_Position pos = styler.LineStart(line); const Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { const char ch = styler[i]; if (ch == '#') return true; else if (ch != ' ' && ch != '\t') return false; } return false; } constexpr bool StyleForceBacktrack(int state) noexcept { return AnyOf(state, SCE_SH_CHARACTER, SCE_SH_STRING, SCE_SH_BACKTICKS, SCE_SH_HERE_Q, SCE_SH_PARAM); } struct OptionsBash { bool fold = false; bool foldComment = false; bool foldCompact = true; bool stylingInsideString = false; bool stylingInsideBackticks = false; bool stylingInsideParameter = false; bool stylingInsideHeredoc = false; bool nestedBackticks = true; CommandSubstitution commandSubstitution = CommandSubstitution::Backtick; std::string specialParameter = BASH_SPECIAL_PARAMETER; [[nodiscard]] bool stylingInside(int state) const noexcept { switch (state) { case SCE_SH_STRING: return stylingInsideString; case SCE_SH_BACKTICKS: return stylingInsideBackticks; case SCE_SH_PARAM: return stylingInsideParameter; case SCE_SH_HERE_Q: return stylingInsideHeredoc; default: return false; } } }; const char * const bashWordListDesc[] = { "Keywords", nullptr }; struct OptionSetBash : public OptionSet { OptionSetBash() { DefineProperty("fold", &OptionsBash::fold); DefineProperty("fold.comment", &OptionsBash::foldComment); DefineProperty("fold.compact", &OptionsBash::foldCompact); DefineProperty("lexer.bash.styling.inside.string", &OptionsBash::stylingInsideString, "Set this property to 1 to highlight shell expansions inside string."); DefineProperty("lexer.bash.styling.inside.backticks", &OptionsBash::stylingInsideBackticks, "Set this property to 1 to highlight shell expansions inside backticks."); DefineProperty("lexer.bash.styling.inside.parameter", &OptionsBash::stylingInsideParameter, "Set this property to 1 to highlight shell expansions inside ${} parameter expansion."); DefineProperty("lexer.bash.styling.inside.heredoc", &OptionsBash::stylingInsideHeredoc, "Set this property to 1 to highlight shell expansions inside here document."); DefineProperty("lexer.bash.command.substitution", &OptionsBash::commandSubstitution, "Set how to highlight $() command substitution. " "0 (the default) highlighted as backticks. " "1 highlighted inside. " "2 highlighted inside with extra scope tracking."); DefineProperty("lexer.bash.nested.backticks", &OptionsBash::nestedBackticks, "Set this property to 0 to disable nested backquoted command substitution."); DefineProperty("lexer.bash.special.parameter", &OptionsBash::specialParameter, "Set shell (default is Bash) special parameters."); DefineWordListSets(bashWordListDesc); } }; class QuoteCls { // Class to manage quote pairs (simplified vs LexPerl) public: int Count = 0; int Up = '\0'; int Down = '\0'; QuoteStyle Style = QuoteStyle::Literal; int Outer = SCE_SH_DEFAULT; CmdState State = CmdState::Body; void Clear() noexcept { Count = 0; Up = '\0'; Down = '\0'; Style = QuoteStyle::Literal; Outer = SCE_SH_DEFAULT; State = CmdState::Body; } void Start(int u, QuoteStyle s, int outer, CmdState state) noexcept { Count = 1; Up = u; Down = opposite(Up); Style = s; Outer = outer; State = state; } }; class QuoteStackCls { // Class to manage quote pairs that nest public: int Depth = 0; int State = SCE_SH_DEFAULT; bool lineContinuation = false; bool nestedBackticks = false; CommandSubstitution commandSubstitution = CommandSubstitution::Backtick; int insideCommand = 0; unsigned backtickLevel = 0; QuoteCls Current; QuoteCls Stack[BASH_QUOTE_STACK_MAX]; const CharacterSet &setParamStart; QuoteStackCls(const CharacterSet &setParamStart_) noexcept : setParamStart{setParamStart_} {} [[nodiscard]] bool Empty() const noexcept { return Current.Up == '\0'; } void Start(int u, QuoteStyle s, int outer, CmdState state) noexcept { if (Empty()) { Current.Start(u, s, outer, state); if (s == QuoteStyle::Backtick) { ++backtickLevel; } } else { Push(u, s, outer, state); } } void Push(int u, QuoteStyle s, int outer, CmdState state) noexcept { if (Depth >= BASH_QUOTE_STACK_MAX) { return; } Stack[Depth] = Current; Depth++; Current.Start(u, s, outer, state); if (s == QuoteStyle::Backtick) { ++backtickLevel; } } void Pop() noexcept { if (Depth == 0) { Clear(); return; } if (backtickLevel != 0 && Current.Style == QuoteStyle::Backtick) { --backtickLevel; } if (insideCommand != 0 && Current.Style == QuoteStyle::CommandInside) { insideCommand = 0; for (int i = 0; i < Depth; i++) { if (Stack[i].Style == QuoteStyle::CommandInside) { insideCommand = commandSubstitutionFlag; break; } } } Depth--; Current = Stack[Depth]; } void Clear() noexcept { Depth = 0; State = SCE_SH_DEFAULT; insideCommand = 0; backtickLevel = 0; Current.Clear(); } bool CountDown(StyleContext &sc, CmdState &cmdState) { Current.Count--; while (Current.Count > 0 && sc.chNext == Current.Down) { Current.Count--; sc.Forward(); } if (Current.Count == 0) { cmdState = Current.State; const int outer = Current.Outer; Pop(); sc.ForwardSetState(outer | insideCommand); return true; } return false; } void Expand(StyleContext &sc, CmdState &cmdState, bool stylingInside) { const CmdState current = cmdState; const int state = sc.state; QuoteStyle style = QuoteStyle::Literal; State = state; sc.SetState(SCE_SH_SCALAR); sc.Forward(); if (sc.ch == '{') { style = QuoteStyle::Parameter; sc.ChangeState(SCE_SH_PARAM); } else if (sc.ch == '\'') { style = QuoteStyle::CString; sc.ChangeState(SCE_SH_STRING); } else if (sc.ch == '"') { style = QuoteStyle::LString; sc.ChangeState(SCE_SH_STRING); } else if (sc.ch == '(' || sc.ch == '[') { if (sc.ch == '[' || sc.chNext == '(') { style = QuoteStyle::Arithmetic; cmdState = CmdState::Arithmetic; sc.ChangeState(SCE_SH_OPERATOR); } else { if (stylingInside && commandSubstitution >= CommandSubstitution::Inside) { style = QuoteStyle::CommandInside; cmdState = CmdState::Delimiter; sc.ChangeState(SCE_SH_OPERATOR); if (commandSubstitution == CommandSubstitution::InsideTrack) { insideCommand = commandSubstitutionFlag; } } else { style = QuoteStyle::Command; sc.ChangeState(SCE_SH_BACKTICKS); } } } else { // scalar has no delimiter pair if (!setParamStart.Contains(sc.ch)) { stylingInside = false; // not scalar } } if (!stylingInside) { sc.ChangeState(state); } else { sc.ChangeState(sc.state | insideCommand); } if (style != QuoteStyle::Literal) { Start(sc.ch, style, state, current); sc.Forward(); } } void Escape(StyleContext &sc) { unsigned count = 1; while (sc.chNext == '\\') { ++count; sc.Forward(); } bool escaped = count & 1U; // odd backslash escape next character if (escaped && (sc.chNext == '\r' || sc.chNext == '\n')) { lineContinuation = true; if (sc.state == SCE_SH_IDENTIFIER) { sc.SetState(SCE_SH_OPERATOR | insideCommand); } return; } if (backtickLevel > 0 && nestedBackticks) { /* for $k$ level substitution with $N$ backslashes: * when $N/2^k$ is odd, following dollar is escaped. * when $(N - 1)/2^k$ is even, following quote is escaped. * when $N = n\times 2^{k + 1} - 1$, following backtick is escaped. * when $N = n\times 2^{k + 1} + 2^k - 1$, following backtick starts inner substitution. * when $N = m\times 2^k + 2^{k - 1} - 1$ and $k > 1$, following backtick ends current substitution. */ if (sc.chNext == '$') { escaped = (count >> backtickLevel) & 1U; } else if (sc.chNext == '\"' || sc.chNext == '\'') { escaped = (((count - 1) >> backtickLevel) & 1U) == 0; } else if (sc.chNext == '`' && escaped) { unsigned mask = 1U << (backtickLevel + 1); count += 1; escaped = (count & (mask - 1)) == 0; if (!escaped) { unsigned remain = count - (mask >> 1U); if (static_cast(remain) >= 0 && (remain & (mask - 1)) == 0) { escaped = true; ++backtickLevel; } else if (backtickLevel > 1) { mask >>= 1U; remain = count - (mask >> 1U); if (static_cast(remain) >= 0 && (remain & (mask - 1)) == 0) { escaped = true; --backtickLevel; } } } } } if (escaped) { sc.Forward(); } } }; const char styleSubable[] = { SCE_SH_IDENTIFIER, SCE_SH_SCALAR, 0 }; const LexicalClass lexicalClasses[] = { // Lexer Bash SCLEX_BASH SCE_SH_: 0, "SCE_SH_DEFAULT", "default", "White space", 1, "SCE_SH_ERROR", "error", "Error", 2, "SCE_SH_COMMENTLINE", "comment line", "Line comment: #", 3, "SCE_SH_NUMBER", "literal numeric", "Number", 4, "SCE_SH_WORD", "keyword", "Keyword", 5, "SCE_SH_STRING", "literal string", "String", 6, "SCE_SH_CHARACTER", "literal string", "Single quoted string", 7, "SCE_SH_OPERATOR", "operator", "Operators", 8, "SCE_SH_IDENTIFIER", "identifier", "Identifiers", 9, "SCE_SH_SCALAR", "identifier", "Scalar variable", 10, "SCE_SH_PARAM", "identifier", "Parameter", 11, "SCE_SH_BACKTICKS", "literal string", "Backtick quoted command", 12, "SCE_SH_HERE_DELIM", "operator", "Heredoc delimiter", 13, "SCE_SH_HERE_Q", "here-doc literal string", "Heredoc quoted string", }; } class LexerBash final : public DefaultLexer { WordList keywords; WordList cmdDelimiter; WordList bashStruct; WordList bashStruct_in; WordList testOperator; OptionsBash options; OptionSetBash osBash; CharacterSet setParamStart; enum { ssIdentifier, ssScalar }; SubStyles subStyles{styleSubable}; public: LexerBash() : DefaultLexer("bash", SCLEX_BASH, lexicalClasses, std::size(lexicalClasses)), setParamStart(CharacterSet::setAlphaNum, "_" BASH_SPECIAL_PARAMETER) { cmdDelimiter.Set("| || |& & && ; ;; ( ) { }"); bashStruct.Set("if elif fi while until else then do done esac eval"); bashStruct_in.Set("for case select"); testOperator.Set("eq ge gt le lt ne ef nt ot"); } void SCI_METHOD Release() override { delete this; } int SCI_METHOD Version() const override { return lvRelease5; } const char * SCI_METHOD PropertyNames() override { return osBash.PropertyNames(); } int SCI_METHOD PropertyType(const char* name) override { return osBash.PropertyType(name); } const char * SCI_METHOD DescribeProperty(const char *name) override { return osBash.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char* key) override { return osBash.PropertyGet(key); } const char * SCI_METHOD DescribeWordListSets() override { return osBash.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos_, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return nullptr; } int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override { return subStyles.Allocate(styleBase, numberStyles); } int SCI_METHOD SubStylesStart(int styleBase) override { return subStyles.Start(styleBase); } int SCI_METHOD SubStylesLength(int styleBase) override { return subStyles.Length(styleBase); } int SCI_METHOD StyleFromSubStyle(int subStyle) override { const int styleBase = subStyles.BaseStyle(subStyle); return styleBase; } int SCI_METHOD PrimaryStyleFromStyle(int style) override { return style; } void SCI_METHOD FreeSubStyles() override { subStyles.Free(); } void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override { subStyles.SetIdentifiers(style, identifiers); } int SCI_METHOD DistanceToSecondaryStyles() override { return 0; } const char *SCI_METHOD GetSubStyleBases() override { return styleSubable; } bool IsTestOperator(const char *s, const CharacterSet &setSingleCharOp) const noexcept { return (s[2] == '\0' && setSingleCharOp.Contains(s[1])) || testOperator.InList(s + 1); } static ILexer5 *LexerFactoryBash() { return new LexerBash(); } }; Sci_Position SCI_METHOD LexerBash::PropertySet(const char *key, const char *val) { if (osBash.PropertySet(&options, key, val)) { if (strcmp(key, "lexer.bash.special.parameter") == 0) { setParamStart = CharacterSet(CharacterSet::setAlphaNum, "_"); setParamStart.AddString(options.specialParameter.empty() ? BASH_SPECIAL_PARAMETER : options.specialParameter.c_str()); } return 0; } return -1; } Sci_Position SCI_METHOD LexerBash::WordListSet(int n, const char *wl) { WordList *wordListN = nullptr; switch (n) { case 0: wordListN = &keywords; break; } Sci_Position firstModification = -1; if (wordListN) { if (wordListN->Set(wl)) { firstModification = 0; } } return firstModification; } void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { const CharacterSet setWordStart(CharacterSet::setAlpha, "_"); // note that [+-] are often parts of identifiers in shell scripts const CharacterSet setWord(CharacterSet::setAlphaNum, "._+-"); CharacterSet setMetaCharacter(CharacterSet::setNone, "|&;()<> \t\r\n"); setMetaCharacter.Add(0); const CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/(ch); Delimiter[DelimiterLength] = '\0'; } }; HereDocCls HereDoc; QuoteStackCls QuoteStack(setParamStart); QuoteStack.nestedBackticks = options.nestedBackticks; QuoteStack.commandSubstitution = options.commandSubstitution; const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_SH_IDENTIFIER); const WordClassifier &classifierScalars = subStyles.Classifier(SCE_SH_SCALAR); int numBase = 0; int digit = 0; const Sci_PositionU endPos = startPos + length; CmdState cmdState = CmdState::Start; LexAccessor styler(pAccess); // Always backtracks to the start of a line that is not a continuation // of the previous line (i.e. start of a bash command segment) Sci_Position ln = styler.GetLine(startPos); if (ln > 0 && startPos == static_cast(styler.LineStart(ln))) ln--; for (;;) { startPos = styler.LineStart(ln); if (ln == 0 || styler.GetLineState(ln) == static_cast(CmdState::Start)) break; ln--; } initStyle = SCE_SH_DEFAULT; StyleContext sc(startPos, endPos - startPos, initStyle, styler); while (sc.More()) { // handle line continuation, updates per-line stored state if (sc.atLineStart) { CmdState state = CmdState::Body; // force backtrack while retaining cmdState if (!StyleForceBacktrack(MaskCommand(sc.state))) { // retain last line's state // arithmetic expression and double bracket test can span multiline without line continuation if (!QuoteStack.lineContinuation && !AnyOf(cmdState, CmdState::DoubleBracket, CmdState::Arithmetic)) { cmdState = CmdState::Start; } if (QuoteStack.Empty()) { // force backtrack when nesting state = cmdState; } } QuoteStack.lineContinuation = false; styler.SetLineState(sc.currentLine, static_cast(state)); } // controls change of cmdState at the end of a non-whitespace element // states Body|Test|Arithmetic persist until the end of a command segment // state Word persist, but ends with 'in' or 'do' construct keywords CmdState cmdStateNew = CmdState::Body; if (cmdState >= CmdState::Word && cmdState <= CmdState::Arithmetic) cmdStateNew = cmdState; const int stylePrev = MaskCommand(sc.state); const int insideCommand = QuoteStack.insideCommand; // Determine if the current state should terminate. switch (MaskCommand(sc.state)) { case SCE_SH_OPERATOR: sc.SetState(SCE_SH_DEFAULT | insideCommand); if (cmdState == CmdState::Delimiter) // if command delimiter, start new command cmdStateNew = CmdState::Start; else if (sc.chPrev == '\\') // propagate command state if line continued cmdStateNew = cmdState; break; case SCE_SH_WORD: // "." never used in Bash variable names but used in file names if (!setWord.Contains(sc.ch) || sc.Match('+', '=') || sc.Match('.', '.')) { char s[500]; sc.GetCurrent(s, sizeof(s)); int identifierStyle = SCE_SH_IDENTIFIER | insideCommand; const int subStyle = classifierIdentifiers.ValueFor(s); if (subStyle >= 0) { identifierStyle = subStyle | insideCommand; } // allow keywords ending in a whitespace, meta character or command delimiter char s2[10]; s2[0] = static_cast(sc.ch); s2[1] = '\0'; const bool keywordEnds = IsASpace(sc.ch) || setMetaCharacter.Contains(sc.ch) || cmdDelimiter.InList(s2); // 'in' or 'do' may be construct keywords if (cmdState == CmdState::Word) { if (strcmp(s, "in") == 0 && keywordEnds) cmdStateNew = CmdState::Body; else if (strcmp(s, "do") == 0 && keywordEnds) cmdStateNew = CmdState::Start; else sc.ChangeState(identifierStyle); sc.SetState(SCE_SH_DEFAULT | insideCommand); break; } // a 'test' keyword starts a test expression if (strcmp(s, "test") == 0) { if (cmdState == CmdState::Start && keywordEnds) { cmdStateNew = CmdState::Test; } else sc.ChangeState(identifierStyle); } // detect bash construct keywords else if (bashStruct.InList(s)) { if (cmdState == CmdState::Start && keywordEnds) cmdStateNew = CmdState::Start; else sc.ChangeState(identifierStyle); } // 'for'|'case'|'select' needs 'in'|'do' to be highlighted later else if (bashStruct_in.InList(s)) { if (cmdState == CmdState::Start && keywordEnds) cmdStateNew = CmdState::Word; else sc.ChangeState(identifierStyle); } // disambiguate option items and file test operators else if (s[0] == '-') { if (!AnyOf(cmdState, CmdState::Test, CmdState::SingleBracket, CmdState::DoubleBracket) || !keywordEnds || !IsTestOperator(s, setSingleCharOp)) sc.ChangeState(identifierStyle); } // disambiguate keywords and identifiers else if (cmdState != CmdState::Start || !(keywords.InList(s) && keywordEnds)) { sc.ChangeState(identifierStyle); } sc.SetState(SCE_SH_DEFAULT | insideCommand); } break; case SCE_SH_IDENTIFIER: if (!setWord.Contains(sc.ch) || (cmdState == CmdState::Arithmetic && !setWordStart.Contains(sc.ch))) { char s[500]; sc.GetCurrent(s, sizeof(s)); const int subStyle = classifierIdentifiers.ValueFor(s); if (subStyle >= 0) { sc.ChangeState(subStyle | insideCommand); } sc.SetState(SCE_SH_DEFAULT | insideCommand); } break; case SCE_SH_NUMBER: digit = translateBashDigit(sc.ch); if (numBase == BASH_BASE_DECIMAL) { if (sc.ch == '#') { char s[10]; sc.GetCurrent(s, sizeof(s)); numBase = getBashNumberBase(s); if (numBase != BASH_BASE_ERROR) break; } else if (IsADigit(sc.ch)) break; } else if (numBase == BASH_BASE_HEX) { if (IsADigit(sc.ch, 16)) break; #ifdef PEDANTIC_OCTAL } else if (numBase == BASH_BASE_OCTAL || numBase == BASH_BASE_OCTAL_ERROR) { if (digit <= 7) break; if (digit <= 9) { numBase = BASH_BASE_OCTAL_ERROR; break; } #endif } else if (numBase == BASH_BASE_ERROR) { if (digit <= 9) break; } else { // DD#DDDD number style handling if (digit != BASH_BASE_ERROR) { if (numBase <= 36) { // case-insensitive if base<=36 if (digit >= 36) digit -= 26; } if (digit < numBase) break; if (digit <= 9) { numBase = BASH_BASE_ERROR; break; } } } // fallthrough when number is at an end or error if (numBase == BASH_BASE_ERROR #ifdef PEDANTIC_OCTAL || numBase == BASH_BASE_OCTAL_ERROR #endif ) { sc.ChangeState(SCE_SH_ERROR | insideCommand); } else if (digit < 62 || digit == 63 || (cmdState != CmdState::Arithmetic && (sc.ch == '-' || (sc.ch == '.' && sc.chNext != '.')))) { // current character is alpha numeric, underscore, hyphen or dot sc.ChangeState(SCE_SH_IDENTIFIER | insideCommand); break; } sc.SetState(SCE_SH_DEFAULT | insideCommand); break; case SCE_SH_COMMENTLINE: if (sc.MatchLineEnd()) { sc.SetState(SCE_SH_DEFAULT | insideCommand); } break; case SCE_SH_HERE_DELIM: // From Bash info: // --------------- // Specifier format is: <<[-]WORD // Optional '-' is for removal of leading tabs from here-doc. // Whitespace acceptable after <<[-] operator // if (HereDoc.State == 0) { // '<<' encountered HereDoc.Quote = sc.chNext; HereDoc.Quoted = false; HereDoc.Escaped = false; HereDoc.DelimiterLength = 0; HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; if (sc.chNext == '\'' || sc.chNext == '\"') { // a quoted here-doc delimiter (' or ") sc.Forward(); HereDoc.Quoted = true; HereDoc.State = 1; } else if (setHereDoc.Contains(sc.chNext) || (sc.chNext == '=' && cmdState != CmdState::Arithmetic)) { // an unquoted here-doc delimiter, no special handling HereDoc.State = 1; } else if (sc.chNext == '<') { // HERE string <<< sc.Forward(); sc.ForwardSetState(SCE_SH_DEFAULT | insideCommand); } else if (IsASpace(sc.chNext)) { // eat whitespace } else if (setLeftShift.Contains(sc.chNext) || (sc.chNext == '=' && cmdState == CmdState::Arithmetic)) { // left shift <<$var or <<= cases sc.ChangeState(SCE_SH_OPERATOR | insideCommand); sc.ForwardSetState(SCE_SH_DEFAULT | insideCommand); } else { // symbols terminates; deprecated zero-length delimiter HereDoc.State = 1; } } else if (HereDoc.State == 1) { // collect the delimiter // * if single quoted, there's no escape // * if double quoted, there are \\ and \" escapes if ((HereDoc.Quote == '\'' && sc.ch != HereDoc.Quote) || (HereDoc.Quoted && sc.ch != HereDoc.Quote && sc.ch != '\\') || (HereDoc.Quote != '\'' && sc.chPrev == '\\') || (setHereDoc2.Contains(sc.ch))) { HereDoc.Append(sc.ch); } else if (HereDoc.Quoted && sc.ch == HereDoc.Quote) { // closing quote => end of delimiter sc.ForwardSetState(SCE_SH_DEFAULT); } else if (sc.ch == '\\') { HereDoc.Escaped = true; if (HereDoc.Quoted && sc.chNext != HereDoc.Quote && sc.chNext != '\\') { // in quoted prefixes only \ and the quote eat the escape HereDoc.Append(sc.ch); } else { // skip escape prefix } } else if (!HereDoc.Quoted) { sc.SetState(SCE_SH_DEFAULT | insideCommand); } if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup sc.SetState(SCE_SH_ERROR | insideCommand); HereDoc.State = 0; } } break; case SCE_SH_SCALAR: // variable names if (!setParam.Contains(sc.ch)) { char s[500]; sc.GetCurrent(s, sizeof(s)); const int subStyle = classifierScalars.ValueFor(&s[1]); // skip the $ if (subStyle >= 0) { sc.ChangeState(subStyle | insideCommand); } if (sc.LengthCurrent() == 1) { // Special variable sc.Forward(); } sc.SetState(QuoteStack.State | insideCommand); continue; } break; case SCE_SH_HERE_Q: // HereDoc.State == 2 if (sc.atLineStart && QuoteStack.Current.Style == QuoteStyle::HereDoc) { sc.SetState(SCE_SH_HERE_Q | insideCommand); if (HereDoc.Indent) { // tabulation prefix while (sc.ch == '\t') { sc.Forward(); } } if ((static_cast(sc.currentPos + HereDoc.DelimiterLength) == sc.lineEnd) && (HereDoc.DelimiterLength == 0 || sc.Match(HereDoc.Delimiter))) { if (HereDoc.DelimiterLength != 0) { sc.SetState(SCE_SH_HERE_DELIM | insideCommand); while (!sc.MatchLineEnd()) { sc.Forward(); } } QuoteStack.Pop(); sc.SetState(SCE_SH_DEFAULT | QuoteStack.insideCommand); break; } } if (HereDoc.Quoted || HereDoc.Escaped) { break; } // fall through to handle nested shell expansions [[fallthrough]]; case SCE_SH_STRING: // delimited styles, can nest case SCE_SH_PARAM: // ${parameter} case SCE_SH_BACKTICKS: if (sc.ch == '\\') { if (QuoteStack.Current.Style != QuoteStyle::Literal) QuoteStack.Escape(sc); } else if (sc.ch == QuoteStack.Current.Down) { if (QuoteStack.CountDown(sc, cmdState)) { continue; } } else if (sc.ch == QuoteStack.Current.Up) { if (QuoteStack.Current.Style != QuoteStyle::Parameter) { QuoteStack.Current.Count++; } } else { if (QuoteStack.Current.Style == QuoteStyle::String || QuoteStack.Current.Style == QuoteStyle::HereDoc || QuoteStack.Current.Style == QuoteStyle::LString ) { // do nesting for "string", $"locale-string", heredoc const bool stylingInside = options.stylingInside(MaskCommand(sc.state)); if (sc.ch == '`') { QuoteStack.Push(sc.ch, QuoteStyle::Backtick, sc.state, cmdState); if (stylingInside) { sc.SetState(SCE_SH_BACKTICKS | insideCommand); } } else if (sc.ch == '$' && !AnyOf(sc.chNext, '\"', '\'')) { QuoteStack.Expand(sc, cmdState, stylingInside); continue; } } else if (QuoteStack.Current.Style == QuoteStyle::Command || QuoteStack.Current.Style == QuoteStyle::Parameter || QuoteStack.Current.Style == QuoteStyle::Backtick ) { // do nesting for $(command), `command`, ${parameter} const bool stylingInside = options.stylingInside(MaskCommand(sc.state)); if (sc.ch == '\'') { if (stylingInside) { QuoteStack.State = sc.state; sc.SetState(SCE_SH_CHARACTER | insideCommand); } else { QuoteStack.Push(sc.ch, QuoteStyle::Literal, sc.state, cmdState); } } else if (sc.ch == '\"') { QuoteStack.Push(sc.ch, QuoteStyle::String, sc.state, cmdState); if (stylingInside) { sc.SetState(SCE_SH_STRING | insideCommand); } } else if (sc.ch == '`') { QuoteStack.Push(sc.ch, QuoteStyle::Backtick, sc.state, cmdState); if (stylingInside) { sc.SetState(SCE_SH_BACKTICKS | insideCommand); } } else if (sc.ch == '$') { QuoteStack.Expand(sc, cmdState, stylingInside); continue; } } } break; case SCE_SH_CHARACTER: // singly-quoted strings if (sc.ch == '\'') { sc.ForwardSetState(QuoteStack.State | insideCommand); continue; } break; } // Must check end of HereDoc state 1 before default state is handled if (HereDoc.State == 1 && sc.MatchLineEnd()) { // Begin of here-doc (the line after the here-doc delimiter): // Lexically, the here-doc starts from the next line after the >>, but the // first line of here-doc seem to follow the style of the last EOL sequence HereDoc.State = 2; if (HereDoc.Quoted) { if (MaskCommand(sc.state) == SCE_SH_HERE_DELIM) { // Missing quote at end of string! Syntax error in bash 4.3 // Mark this bit as an error, do not colour any here-doc sc.ChangeState(SCE_SH_ERROR | insideCommand); sc.SetState(SCE_SH_DEFAULT | insideCommand); } else { // HereDoc.Quote always == '\'' sc.SetState(SCE_SH_HERE_Q | insideCommand); QuoteStack.Start(-1, QuoteStyle::HereDoc, SCE_SH_DEFAULT, cmdState); } } else if (HereDoc.DelimiterLength == 0) { // no delimiter, illegal (but '' and "" are legal) sc.ChangeState(SCE_SH_ERROR | insideCommand); sc.SetState(SCE_SH_DEFAULT | insideCommand); } else { sc.SetState(SCE_SH_HERE_Q | insideCommand); QuoteStack.Start(-1, QuoteStyle::HereDoc, SCE_SH_DEFAULT, cmdState); } } // update cmdState about the current command segment if (stylePrev != SCE_SH_DEFAULT && MaskCommand(sc.state) == SCE_SH_DEFAULT) { cmdState = cmdStateNew; } // Determine if a new state should be entered. if (MaskCommand(sc.state) == SCE_SH_DEFAULT) { if (sc.ch == '\\') { // Bash can escape any non-newline as a literal sc.SetState(SCE_SH_IDENTIFIER | insideCommand); QuoteStack.Escape(sc); } else if (IsADigit(sc.ch)) { sc.SetState(SCE_SH_NUMBER | insideCommand); numBase = BASH_BASE_DECIMAL; if (sc.ch == '0') { // hex,octal if (sc.chNext == 'x' || sc.chNext == 'X') { numBase = BASH_BASE_HEX; sc.Forward(); } else if (IsADigit(sc.chNext)) { #ifdef PEDANTIC_OCTAL numBase = BASH_BASE_OCTAL; #endif } } } else if (setWordStart.Contains(sc.ch)) { sc.SetState(((cmdState == CmdState::Arithmetic)? SCE_SH_IDENTIFIER : SCE_SH_WORD) | insideCommand); } else if (sc.ch == '#') { if (stylePrev != SCE_SH_WORD && stylePrev != SCE_SH_IDENTIFIER && (sc.currentPos == 0 || setMetaCharacter.Contains(sc.chPrev))) { sc.SetState(SCE_SH_COMMENTLINE | insideCommand); } else { sc.SetState(SCE_SH_WORD | insideCommand); } // handle some zsh features within arithmetic expressions only if (cmdState == CmdState::Arithmetic) { if (sc.chPrev == '[') { // [#8] [##8] output digit setting sc.SetState(SCE_SH_WORD | insideCommand); if (sc.chNext == '#') { sc.Forward(); } } else if (sc.Match("##^") && IsUpperCase(sc.GetRelative(3))) { // ##^A sc.SetState(SCE_SH_IDENTIFIER | insideCommand); sc.Forward(3); } else if (sc.chNext == '#' && !IsASpace(sc.GetRelative(2))) { // ##a sc.SetState(SCE_SH_IDENTIFIER | insideCommand); sc.Forward(2); } else if (setWordStart.Contains(sc.chNext)) { // #name sc.SetState(SCE_SH_IDENTIFIER | insideCommand); } } } else if (sc.ch == '\"') { sc.SetState(SCE_SH_STRING | insideCommand); QuoteStack.Start(sc.ch, QuoteStyle::String, SCE_SH_DEFAULT, cmdState); } else if (sc.ch == '\'') { QuoteStack.State = SCE_SH_DEFAULT; sc.SetState(SCE_SH_CHARACTER | insideCommand); } else if (sc.ch == '`') { sc.SetState(SCE_SH_BACKTICKS | insideCommand); QuoteStack.Start(sc.ch, QuoteStyle::Backtick, SCE_SH_DEFAULT, cmdState); } else if (sc.ch == '$') { QuoteStack.Expand(sc, cmdState, true); continue; } else if (cmdState != CmdState::Arithmetic && sc.Match('<', '<')) { sc.SetState(SCE_SH_HERE_DELIM | insideCommand); HereDoc.State = 0; if (sc.GetRelative(2) == '-') { // <<- indent case HereDoc.Indent = true; sc.Forward(); } else { HereDoc.Indent = false; } } else if (sc.ch == '-' && // test operator or short and long option cmdState != CmdState::Arithmetic && sc.chPrev != '~' && !IsADigit(sc.chNext)) { if (IsASpace(sc.chPrev) || setMetaCharacter.Contains(sc.chPrev)) { sc.SetState(SCE_SH_WORD | insideCommand); } else { sc.SetState(SCE_SH_IDENTIFIER | insideCommand); } } else if (setBashOperator.Contains(sc.ch)) { bool isCmdDelim = false; sc.SetState(SCE_SH_OPERATOR | insideCommand); // arithmetic expansion and command substitution if (QuoteStack.Current.Style == QuoteStyle::Arithmetic || QuoteStack.Current.Style == QuoteStyle::CommandInside) { if (sc.ch == QuoteStack.Current.Down) { if (QuoteStack.CountDown(sc, cmdState)) { continue; } } else if (sc.ch == QuoteStack.Current.Up) { QuoteStack.Current.Count++; } } // globs have no whitespace, do not appear in arithmetic expressions if (cmdState != CmdState::Arithmetic && sc.ch == '(' && sc.chNext != '(') { const int i = GlobScan(sc); if (i > 1) { sc.SetState(SCE_SH_IDENTIFIER | insideCommand); sc.Forward(i + 1); continue; } } // handle opening delimiters for test/arithmetic expressions - ((,[[,[ if (cmdState == CmdState::Start || cmdState == CmdState::Body) { if (sc.Match('(', '(')) { cmdState = CmdState::Arithmetic; sc.Forward(); } else if (sc.Match('[', '[') && IsASpace(sc.GetRelative(2))) { cmdState = CmdState::DoubleBracket; sc.Forward(); } else if (sc.ch == '[' && IsASpace(sc.chNext)) { cmdState = CmdState::SingleBracket; } } // special state -- for ((x;y;z)) in ... looping if (cmdState == CmdState::Word && sc.Match('(', '(')) { cmdState = CmdState::Arithmetic; sc.Forward(2); continue; } // handle command delimiters in command Start|Body|Word state, also Test if 'test' or '[]' if (cmdState < CmdState::DoubleBracket) { char s[10]; s[0] = static_cast(sc.ch); if (setBashOperator.Contains(sc.chNext)) { s[1] = static_cast(sc.chNext); s[2] = '\0'; isCmdDelim = cmdDelimiter.InList(s); if (isCmdDelim) sc.Forward(); } if (!isCmdDelim) { s[1] = '\0'; isCmdDelim = cmdDelimiter.InList(s); } if (isCmdDelim) { cmdState = CmdState::Delimiter; sc.Forward(); continue; } } // handle closing delimiters for test/arithmetic expressions - )),]],] if (cmdState == CmdState::Arithmetic && sc.Match(')', ')')) { cmdState = CmdState::Body; sc.Forward(); } else if (sc.ch == ']' && IsASpace(sc.chPrev)) { if (cmdState == CmdState::SingleBracket) { cmdState = CmdState::Body; } else if (cmdState == CmdState::DoubleBracket && sc.chNext == ']') { cmdState = CmdState::Body; sc.Forward(); } } } }// sc.state sc.Forward(); } sc.Complete(); if (MaskCommand(sc.state) == SCE_SH_HERE_Q) { styler.ChangeLexerState(sc.currentPos, styler.Length()); } sc.Complete(); } void SCI_METHOD LexerBash::Fold(Sci_PositionU startPos_, Sci_Position length, int initStyle, IDocument *pAccess) { if(!options.fold) return; LexAccessor styler(pAccess); Sci_Position startPos = startPos_; const Sci_Position endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); // Backtrack to previous line in case need to fix its fold status if (lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); initStyle = (startPos > 0) ? styler.StyleIndexAt(startPos - 1) : 0; } int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = MaskCommand(styler.StyleIndexAt(startPos)); int style = MaskCommand(initStyle); char word[8] = { '\0' }; // we're not interested in long words anyway size_t wordlen = 0; for (Sci_Position i = startPos; i < endPos; i++) { const char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); const int stylePrev = style; style = styleNext; styleNext = MaskCommand(styler.StyleIndexAt(i + 1)); const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); // Comment folding if (options.foldComment && atEOL && IsCommentLine(lineCurrent, styler)) { if (!IsCommentLine(lineCurrent - 1, styler) && IsCommentLine(lineCurrent + 1, styler)) levelCurrent++; else if (IsCommentLine(lineCurrent - 1, styler) && !IsCommentLine(lineCurrent + 1, styler)) levelCurrent--; } switch (style) { case SCE_SH_WORD: if ((wordlen + 1) < sizeof(word)) word[wordlen++] = ch; if (styleNext != style) { word[wordlen] = '\0'; wordlen = 0; if (InList(word, {"if", "case", "do"})) { levelCurrent++; } else if (InList(word, {"fi", "esac", "done"})) { levelCurrent--; } } break; case SCE_SH_OPERATOR: if (ch == '{') { levelCurrent++; } else if (ch == '}') { levelCurrent--; } break; // Here Document folding case SCE_SH_HERE_DELIM: if (stylePrev == SCE_SH_HERE_Q) { levelCurrent--; } else if (stylePrev != SCE_SH_HERE_DELIM) { if (ch == '<' && chNext == '<') { if (styler.SafeGetCharAt(i + 2) != '<') { levelCurrent++; } } } break; case SCE_SH_HERE_Q: if (styleNext == SCE_SH_DEFAULT) { levelCurrent--; } break; } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && options.foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later const int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } LexerModule lmBash(SCLEX_BASH, LexerBash::LexerFactoryBash, "bash", bashWordListDesc); ================================================ FILE: lexilla/lexers/LexBasic.cxx ================================================ // Scintilla source code edit control /** @file LexBasic.cxx ** Lexer for BlitzBasic and PureBasic. ** Converted to lexer object and added further folding features/properties by "Udo Lechner" **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. // This tries to be a unified Lexer/Folder for all the BlitzBasic/BlitzMax/PurBasic basics // and derivatives. Once they diverge enough, might want to split it into multiple // lexers for more code clearity. // // Mail me (elias users sf net) for any bugs. // Folding only works for simple things like functions or types. // You may want to have a look at my ctags lexer as well, if you additionally to coloring // and folding need to extract things like label tags in your editor. #include #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; /* Bits: * 1 - whitespace * 2 - operator * 4 - identifier * 8 - decimal digit * 16 - hex digit * 32 - bin digit * 64 - letter */ static int character_classification[128] = { 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 2, 60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2, 2, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 2, 2, 2, 2, 68, 2, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 2, 2, 2, 2, 0 }; static bool IsSpace(int c) { return c < 128 && (character_classification[c] & 1); } static bool IsOperator(int c) { return c < 128 && (character_classification[c] & 2); } static bool IsIdentifier(int c) { return c < 128 && (character_classification[c] & 4); } static bool IsDigit(int c) { return c < 128 && (character_classification[c] & 8); } static bool IsHexDigit(int c) { return c < 128 && (character_classification[c] & 16); } static bool IsBinDigit(int c) { return c < 128 && (character_classification[c] & 32); } static bool IsLetter(int c) { return c < 128 && (character_classification[c] & 64); } static int LowerCase(int c) { if (c >= 'A' && c <= 'Z') return 'a' + c - 'A'; return c; } static int CheckBlitzFoldPoint(char const *token, int &level) { if (!strcmp(token, "function") || !strcmp(token, "type")) { level |= SC_FOLDLEVELHEADERFLAG; return 1; } if (!strcmp(token, "end function") || !strcmp(token, "end type")) { return -1; } return 0; } static int CheckPureFoldPoint(char const *token, int &level) { if (!strcmp(token, "procedure") || !strcmp(token, "enumeration") || !strcmp(token, "interface") || !strcmp(token, "structure")) { level |= SC_FOLDLEVELHEADERFLAG; return 1; } if (!strcmp(token, "endprocedure") || !strcmp(token, "endenumeration") || !strcmp(token, "endinterface") || !strcmp(token, "endstructure")) { return -1; } return 0; } static int CheckFreeFoldPoint(char const *token, int &level) { if (!strcmp(token, "function") || !strcmp(token, "sub") || !strcmp(token, "enum") || !strcmp(token, "type") || !strcmp(token, "union") || !strcmp(token, "property") || !strcmp(token, "destructor") || !strcmp(token, "constructor")) { level |= SC_FOLDLEVELHEADERFLAG; return 1; } if (!strcmp(token, "end function") || !strcmp(token, "end sub") || !strcmp(token, "end enum") || !strcmp(token, "end type") || !strcmp(token, "end union") || !strcmp(token, "end property") || !strcmp(token, "end destructor") || !strcmp(token, "end constructor")) { return -1; } return 0; } // An individual named option for use in an OptionSet // Options used for LexerBasic struct OptionsBasic { bool fold; bool foldSyntaxBased; bool foldCommentExplicit; std::string foldExplicitStart; std::string foldExplicitEnd; bool foldExplicitAnywhere; bool foldCompact; OptionsBasic() { fold = false; foldSyntaxBased = true; foldCommentExplicit = false; foldExplicitStart = ""; foldExplicitEnd = ""; foldExplicitAnywhere = false; foldCompact = true; } }; static const char * const blitzbasicWordListDesc[] = { "BlitzBasic Keywords", "user1", "user2", "user3", 0 }; static const char * const purebasicWordListDesc[] = { "PureBasic Keywords", "PureBasic PreProcessor Keywords", "user defined 1", "user defined 2", 0 }; static const char * const freebasicWordListDesc[] = { "FreeBasic Keywords", "FreeBasic PreProcessor Keywords", "user defined 1", "user defined 2", 0 }; struct OptionSetBasic : public OptionSet { OptionSetBasic(const char * const wordListDescriptions[]) { DefineProperty("fold", &OptionsBasic::fold); DefineProperty("fold.basic.syntax.based", &OptionsBasic::foldSyntaxBased, "Set this property to 0 to disable syntax based folding."); DefineProperty("fold.basic.comment.explicit", &OptionsBasic::foldCommentExplicit, "This option enables folding explicit fold points when using the Basic lexer. " "Explicit fold points allows adding extra folding by placing a ;{ (BB/PB) or '{ (FB) comment at the start " "and a ;} (BB/PB) or '} (FB) at the end of a section that should be folded."); DefineProperty("fold.basic.explicit.start", &OptionsBasic::foldExplicitStart, "The string to use for explicit fold start points, replacing the standard ;{ (BB/PB) or '{ (FB)."); DefineProperty("fold.basic.explicit.end", &OptionsBasic::foldExplicitEnd, "The string to use for explicit fold end points, replacing the standard ;} (BB/PB) or '} (FB)."); DefineProperty("fold.basic.explicit.anywhere", &OptionsBasic::foldExplicitAnywhere, "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); DefineProperty("fold.compact", &OptionsBasic::foldCompact); DefineWordListSets(wordListDescriptions); } }; class LexerBasic : public DefaultLexer { char comment_char; int (*CheckFoldPoint)(char const *, int &); WordList keywordlists[4]; OptionsBasic options; OptionSetBasic osBasic; public: LexerBasic(const char *languageName_, int language_, char comment_char_, int (*CheckFoldPoint_)(char const *, int &), const char * const wordListDescriptions[]) : DefaultLexer(languageName_, language_), comment_char(comment_char_), CheckFoldPoint(CheckFoldPoint_), osBasic(wordListDescriptions) { } virtual ~LexerBasic() { } void SCI_METHOD Release() override { delete this; } int SCI_METHOD Version() const override { return lvRelease5; } const char * SCI_METHOD PropertyNames() override { return osBasic.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osBasic.PropertyType(name); } const char * SCI_METHOD DescribeProperty(const char *name) override { return osBasic.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char *key) override { return osBasic.PropertyGet(key); } const char * SCI_METHOD DescribeWordListSets() override { return osBasic.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return 0; } static ILexer5 *LexerFactoryBlitzBasic() { return new LexerBasic("blitzbasic", SCLEX_BLITZBASIC, ';', CheckBlitzFoldPoint, blitzbasicWordListDesc); } static ILexer5 *LexerFactoryPureBasic() { return new LexerBasic("purebasic", SCLEX_PUREBASIC, ';', CheckPureFoldPoint, purebasicWordListDesc); } static ILexer5 *LexerFactoryFreeBasic() { return new LexerBasic("freebasic", SCLEX_FREEBASIC, '\'', CheckFreeFoldPoint, freebasicWordListDesc ); } }; Sci_Position SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) { if (osBasic.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: wordListN = &keywordlists[0]; break; case 1: wordListN = &keywordlists[1]; break; case 2: wordListN = &keywordlists[2]; break; case 3: wordListN = &keywordlists[3]; break; } Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); if (*wordListN != wlNew) { wordListN->Set(wl); firstModification = 0; } } return firstModification; } void SCI_METHOD LexerBasic::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); bool wasfirst = true, isfirst = true; // true if first token in a line styler.StartAt(startPos); int styleBeforeKeyword = SCE_B_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); // Can't use sc.More() here else we miss the last character for (; ; sc.Forward()) { if (sc.state == SCE_B_IDENTIFIER) { if (!IsIdentifier(sc.ch)) { // Labels if (wasfirst && sc.Match(':')) { sc.ChangeState(SCE_B_LABEL); sc.ForwardSetState(SCE_B_DEFAULT); } else { char s[100]; int kstates[4] = { SCE_B_KEYWORD, SCE_B_KEYWORD2, SCE_B_KEYWORD3, SCE_B_KEYWORD4, }; sc.GetCurrentLowered(s, sizeof(s)); for (int i = 0; i < 4; i++) { if (keywordlists[i].InList(s)) { sc.ChangeState(kstates[i]); } } // Types, must set them as operator else they will be // matched as number/constant if (sc.Match('.') || sc.Match('$') || sc.Match('%') || sc.Match('#')) { sc.SetState(SCE_B_OPERATOR); } else { sc.SetState(SCE_B_DEFAULT); } } } } else if (sc.state == SCE_B_OPERATOR) { if (!IsOperator(sc.ch) || sc.Match('#')) sc.SetState(SCE_B_DEFAULT); } else if (sc.state == SCE_B_LABEL) { if (!IsIdentifier(sc.ch)) sc.SetState(SCE_B_DEFAULT); } else if (sc.state == SCE_B_CONSTANT) { if (!IsIdentifier(sc.ch)) sc.SetState(SCE_B_DEFAULT); } else if (sc.state == SCE_B_NUMBER) { if (!IsDigit(sc.ch)) sc.SetState(SCE_B_DEFAULT); } else if (sc.state == SCE_B_HEXNUMBER) { if (!IsHexDigit(sc.ch)) sc.SetState(SCE_B_DEFAULT); } else if (sc.state == SCE_B_BINNUMBER) { if (!IsBinDigit(sc.ch)) sc.SetState(SCE_B_DEFAULT); } else if (sc.state == SCE_B_STRING) { if (sc.ch == '"') { sc.ForwardSetState(SCE_B_DEFAULT); } if (sc.atLineEnd) { sc.ChangeState(SCE_B_ERROR); sc.SetState(SCE_B_DEFAULT); } } else if (sc.state == SCE_B_COMMENT || sc.state == SCE_B_PREPROCESSOR) { if (sc.atLineEnd) { sc.SetState(SCE_B_DEFAULT); } } else if (sc.state == SCE_B_DOCLINE) { if (sc.atLineEnd) { sc.SetState(SCE_B_DEFAULT); } else if (sc.ch == '\\' || sc.ch == '@') { if (IsLetter(sc.chNext) && sc.chPrev != '\\') { styleBeforeKeyword = sc.state; sc.SetState(SCE_B_DOCKEYWORD); }; } } else if (sc.state == SCE_B_DOCKEYWORD) { if (IsSpace(sc.ch)) { sc.SetState(styleBeforeKeyword); } else if (sc.atLineEnd && styleBeforeKeyword == SCE_B_DOCLINE) { sc.SetState(SCE_B_DEFAULT); } } else if (sc.state == SCE_B_COMMENTBLOCK) { if (sc.Match("\'/")) { sc.Forward(); sc.ForwardSetState(SCE_B_DEFAULT); } } else if (sc.state == SCE_B_DOCBLOCK) { if (sc.Match("\'/")) { sc.Forward(); sc.ForwardSetState(SCE_B_DEFAULT); } else if (sc.ch == '\\' || sc.ch == '@') { if (IsLetter(sc.chNext) && sc.chPrev != '\\') { styleBeforeKeyword = sc.state; sc.SetState(SCE_B_DOCKEYWORD); }; } } if (sc.atLineStart) isfirst = true; if (sc.state == SCE_B_DEFAULT || sc.state == SCE_B_ERROR) { if (isfirst && sc.Match('.') && comment_char != '\'') { sc.SetState(SCE_B_LABEL); } else if (isfirst && sc.Match('#')) { wasfirst = isfirst; sc.SetState(SCE_B_IDENTIFIER); } else if (sc.Match(comment_char)) { // Hack to make deprecated QBASIC '$Include show // up in freebasic with SCE_B_PREPROCESSOR. if (comment_char == '\'' && sc.Match(comment_char, '$')) sc.SetState(SCE_B_PREPROCESSOR); else if (sc.Match("\'*") || sc.Match("\'!")) { sc.SetState(SCE_B_DOCLINE); } else { sc.SetState(SCE_B_COMMENT); } } else if (sc.Match("/\'")) { if (sc.Match("/\'*") || sc.Match("/\'!")) { // Support of gtk-doc/Doxygen doc. style sc.SetState(SCE_B_DOCBLOCK); } else { sc.SetState(SCE_B_COMMENTBLOCK); } sc.Forward(); // Eat the ' so it isn't used for the end of the comment } else if (sc.Match('"')) { sc.SetState(SCE_B_STRING); } else if (IsDigit(sc.ch)) { sc.SetState(SCE_B_NUMBER); } else if (sc.Match('$') || sc.Match("&h") || sc.Match("&H") || sc.Match("&o") || sc.Match("&O")) { sc.SetState(SCE_B_HEXNUMBER); } else if (sc.Match('%') || sc.Match("&b") || sc.Match("&B")) { sc.SetState(SCE_B_BINNUMBER); } else if (sc.Match('#')) { sc.SetState(SCE_B_CONSTANT); } else if (IsOperator(sc.ch)) { sc.SetState(SCE_B_OPERATOR); } else if (IsIdentifier(sc.ch)) { wasfirst = isfirst; sc.SetState(SCE_B_IDENTIFIER); } else if (!IsSpace(sc.ch)) { sc.SetState(SCE_B_ERROR); } } if (!IsSpace(sc.ch)) isfirst = false; if (!sc.More()) break; } sc.Complete(); } void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, IDocument *pAccess) { if (!options.fold) return; LexAccessor styler(pAccess); Sci_Position line = styler.GetLine(startPos); int level = styler.LevelAt(line); int go = 0, done = 0; Sci_Position endPos = startPos + length; char word[256]; int wordlen = 0; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); int cNext = styler[startPos]; // Scan for tokens at the start of the line (they may include // whitespace, for tokens like "End Function" for (Sci_Position i = startPos; i < endPos; i++) { int c = cNext; cNext = styler.SafeGetCharAt(i + 1); bool atEOL = (c == '\r' && cNext != '\n') || (c == '\n'); if (options.foldSyntaxBased && !done && !go) { if (wordlen) { // are we scanning a token already? word[wordlen] = static_cast(LowerCase(c)); if (!IsIdentifier(c)) { // done with token word[wordlen] = '\0'; go = CheckFoldPoint(word, level); if (!go) { // Treat any whitespace as single blank, for // things like "End Function". if (IsSpace(c) && IsIdentifier(word[wordlen - 1])) { word[wordlen] = ' '; if (wordlen < 255) wordlen++; } else // done with this line done = 1; } } else if (wordlen < 255) { wordlen++; } } else { // start scanning at first non-whitespace character if (!IsSpace(c)) { if (IsIdentifier(c)) { word[0] = static_cast(LowerCase(c)); wordlen = 1; } else // done with this line done = 1; } } } if (options.foldCommentExplicit && ((styler.StyleAt(i) == SCE_B_COMMENT) || options.foldExplicitAnywhere)) { if (userDefinedFoldMarkers) { if (styler.Match(i, options.foldExplicitStart.c_str())) { level |= SC_FOLDLEVELHEADERFLAG; go = 1; } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { go = -1; } } else { if (c == comment_char) { if (cNext == '{') { level |= SC_FOLDLEVELHEADERFLAG; go = 1; } else if (cNext == '}') { go = -1; } } } } if (atEOL) { // line end if (!done && wordlen == 0 && options.foldCompact) // line was only space level |= SC_FOLDLEVELWHITEFLAG; if (level != styler.LevelAt(line)) styler.SetLevel(line, level); level += go; line++; // reset state wordlen = 0; level &= ~SC_FOLDLEVELHEADERFLAG; level &= ~SC_FOLDLEVELWHITEFLAG; go = 0; done = 0; } } } LexerModule lmBlitzBasic(SCLEX_BLITZBASIC, LexerBasic::LexerFactoryBlitzBasic, "blitzbasic", blitzbasicWordListDesc); LexerModule lmPureBasic(SCLEX_PUREBASIC, LexerBasic::LexerFactoryPureBasic, "purebasic", purebasicWordListDesc); LexerModule lmFreeBasic(SCLEX_FREEBASIC, LexerBasic::LexerFactoryFreeBasic, "freebasic", freebasicWordListDesc); ================================================ FILE: lexilla/lexers/LexBatch.cxx ================================================ // Scintilla source code edit control /** @file LexBatch.cxx ** Lexer for batch files. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "InList.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; namespace { constexpr bool Is0To9(char ch) noexcept { return (ch >= '0') && (ch <= '9'); } bool IsAlphabetic(int ch) noexcept { return IsASCII(ch) && isalpha(ch); } inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } // Tests for BATCH Operators constexpr bool IsBOperator(char ch) noexcept { return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') || (ch == '|') || (ch == '?') || (ch == '*')|| (ch == '&') || (ch == '(') || (ch == ')'); } // Tests for BATCH Separators constexpr bool IsBSeparator(char ch) noexcept { return (ch == '\\') || (ch == '.') || (ch == ';') || (ch == '\"') || (ch == '\'') || (ch == '/'); } // Tests for escape character constexpr bool IsEscaped(const char* wordStr, Sci_PositionU pos) noexcept { bool isQoted=false; while (pos>0){ pos--; if (wordStr[pos]=='^') isQoted=!isQoted; else break; } return isQoted; } constexpr bool IsQuotedBy(std::string_view svBuffer, char quote) noexcept { bool CurrentStatus = false; size_t pQuote = svBuffer.find(quote); while (pQuote != std::string_view::npos) { if (!IsEscaped(svBuffer.data(), pQuote)) { CurrentStatus = !CurrentStatus; } pQuote = svBuffer.find(quote, pQuote + 1); } return CurrentStatus; } // Tests for quote character constexpr bool textQuoted(const char *lineBuffer, Sci_PositionU endPos) noexcept { const std::string_view svBuffer(lineBuffer, endPos); return IsQuotedBy(svBuffer, '\"') || IsQuotedBy(svBuffer, '\''); } void ColouriseBatchDoc( Sci_PositionU startPos, Sci_Position length, int /*initStyle*/, WordList *keywordlists[], Accessor &styler) { // Always backtracks to the start of a line that is not a continuation // of the previous line if (startPos > 0) { Sci_Position ln = styler.GetLine(startPos); // Current line number while (startPos > 0) { ln--; if ((styler.SafeGetCharAt(startPos-3) == '^' && styler.SafeGetCharAt(startPos-2) == '\r' && styler.SafeGetCharAt(startPos-1) == '\n') || styler.SafeGetCharAt(startPos-2) == '^') { // handle '^' line continuation // When the line continuation is found, // set the Start Position to the Start of the previous line length+=startPos-styler.LineStart(ln); startPos=styler.LineStart(ln); } else break; } } char lineBuffer[1024] {}; styler.StartAt(startPos); styler.StartSegment(startPos); Sci_PositionU linePos = 0; Sci_PositionU startLine = startPos; bool continueProcessing = true; // Used to toggle Regular Keyword Checking bool isNotAssigned=false; // Used to flag Assignment in Set operation for (Sci_PositionU i = startPos; i < startPos + length; i++) { lineBuffer[linePos++] = styler[i]; if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1) || (i==startPos + length-1)) { // End of line (or of line buffer) (or End of Last Line) met, colourise it lineBuffer[linePos] = '\0'; const Sci_PositionU lengthLine=linePos; const Sci_PositionU endPos=i; const WordList &keywords = *keywordlists[0]; // Internal Commands const WordList &keywords2 = *keywordlists[1]; // External Commands (optional) // CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords // Toggling Regular Keyword Checking off improves readability // Other Regular Keywords and External Commands / Programs might also benefit from toggling // Need a more robust algorithm to properly toggle Regular Keyword Checking bool stopLineProcessing=false; // Used to stop line processing if Comment or Drive Change found Sci_PositionU offset = 0; // Line Buffer Offset // Skip initial spaces while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { offset++; } // Colorize Default Text styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); // Set External Command / Program Location Sci_PositionU cmdLoc = offset; // Check for Fake Label (Comment) or Real Label - return if found if (lineBuffer[offset] == ':') { if (lineBuffer[offset + 1] == ':') { // Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm styler.ColourTo(endPos, SCE_BAT_COMMENT); } else { // Colorize Real Label // :[\t ]*[^\t &+:<>|]+ const char *startLabelName = lineBuffer + offset + 1; const size_t whitespaceLength = strspn(startLabelName, "\t "); // Set of label-terminating characters determined experimentally const char *endLabel = strpbrk(startLabelName + whitespaceLength, "\t &+:<>|"); if (endLabel) { styler.ColourTo(startLine + offset + endLabel - startLabelName, SCE_BAT_LABEL); styler.ColourTo(endPos, SCE_BAT_AFTER_LABEL); // New style } else { styler.ColourTo(endPos, SCE_BAT_LABEL); } } stopLineProcessing=true; // Check for Drive Change (Drive Change is internal command) - return if found } else if ((IsAlphabetic(lineBuffer[offset])) && (lineBuffer[offset + 1] == ':') && ((isspacechar(lineBuffer[offset + 2])) || (((lineBuffer[offset + 2] == '\\')) && (isspacechar(lineBuffer[offset + 3]))))) { // Colorize Regular Keyword styler.ColourTo(endPos, SCE_BAT_WORD); stopLineProcessing=true; } // Check for Hide Command (@ECHO OFF/ON) if (lineBuffer[offset] == '@') { styler.ColourTo(startLine + offset, SCE_BAT_HIDE); offset++; } // Skip next spaces while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { offset++; } // Read remainder of line word-at-a-time or remainder-of-word-at-a-time while (offset < lengthLine && !stopLineProcessing) { if (offset > startLine) { // Colorize Default Text styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); } char wordBuffer[81]{}; // Word Buffer - large to catch long paths // Copy word from Line Buffer into Word Buffer and convert to lower case Sci_PositionU wbl = 0; // Word Buffer Length for (; offset < lengthLine && wbl < 80 && !isspacechar(lineBuffer[offset]); wbl++, offset++) { wordBuffer[wbl] = MakeLowerCase(lineBuffer[offset]); } wordBuffer[wbl] = '\0'; const std::string_view wordView(wordBuffer); Sci_PositionU wbo = 0; // Word Buffer Offset - also Special Keyword Buffer Length // Check for Comment - return if found if (continueProcessing) { if ((wordView == "rem") || (wordBuffer[0] == ':' && wordBuffer[1] == ':')) { if ((offset == wbl) || !textQuoted(lineBuffer, offset - wbl)) { styler.ColourTo(startLine + offset - wbl - 1, SCE_BAT_DEFAULT); styler.ColourTo(endPos, SCE_BAT_COMMENT); break; } } } // Check for Separator if (IsBSeparator(wordBuffer[0])) { // Check for External Command / Program if ((cmdLoc == offset - wbl) && ((wordBuffer[0] == ':') || (wordBuffer[0] == '\\') || (wordBuffer[0] == '.'))) { // Reset Offset to re-process remainder of word offset -= (wbl - 1); // Colorize External Command / Program if (!keywords2) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); } else if (keywords2.InList(wordBuffer)) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); } else { styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); } // Reset External Command / Program Location cmdLoc = offset; } else { // Reset Offset to re-process remainder of word offset -= (wbl - 1); // Colorize Default Text styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); } // Check for Regular Keyword in list } else if ((keywords.InList(wordBuffer)) && (continueProcessing)) { // ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking if (InList(wordView, {"echo", "goto", "prompt"})) { continueProcessing = false; } // SET requires additional processing for the assignment operator if (wordView == "set") { continueProcessing = false; isNotAssigned=true; } // Identify External Command / Program Location for ERRORLEVEL, and EXIST if (InList(wordView, {"errorlevel", "exist"})) { // Reset External Command / Program Location cmdLoc = offset; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Skip comparison while ((cmdLoc < lengthLine) && (!isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Identify External Command / Program Location for CALL, DO, LOADHIGH and LH } else if (InList(wordView, {"call", "do", "loadhigh", "lh"})) { // Reset External Command / Program Location cmdLoc = offset; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Check if call is followed by a label if ((lineBuffer[cmdLoc] == ':') && (wordView == "call")) { continueProcessing = false; } } // Colorize Regular keyword styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD); // No need to Reset Offset // Check for Special Keyword in list, External Command / Program, or Default Text } else if ((wordBuffer[0] != '%') && (wordBuffer[0] != '!') && (!IsBOperator(wordBuffer[0])) && (continueProcessing)) { // Check for Special Keyword // Affected Commands are in Length range 2-6 // Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected bool sKeywordFound = false; // Exit Special Keyword for-loop if found for (Sci_PositionU keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { // Special Keywords are those that allow certain characters without whitespace after the command // Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path= // Special Keyword Buffer used to determine if the first n characters is a Keyword char sKeywordBuffer[10]{}; // Special Keyword Buffer wbo = 0; // Copy Keyword Length from Word Buffer into Special Keyword Buffer for (; wbo < keywordLength; wbo++) { sKeywordBuffer[wbo] = wordBuffer[wbo]; } sKeywordBuffer[wbo] = '\0'; // Check for Special Keyword in list if ((keywords.InList(sKeywordBuffer)) && ((IsBOperator(wordBuffer[wbo])) || (IsBSeparator(wordBuffer[wbo])) || (wordBuffer[wbo] == ':' && (InList(sKeywordBuffer, {"call", "echo", "goto"}) )))) { sKeywordFound = true; // ECHO requires no further Regular Keyword Checking if (std::string_view(sKeywordBuffer) == "echo") { continueProcessing = false; } // Colorize Special Keyword as Regular Keyword styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); } } // Check for External Command / Program or Default Text if (!sKeywordFound) { wbo = 0; // Check for External Command / Program if (cmdLoc == offset - wbl) { // Read up to %, Operator or Separator while ((wbo < wbl) && (((wordBuffer[wbo] != '%') && (wordBuffer[wbo] != '!') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))))) { wbo++; } // Reset External Command / Program Location cmdLoc = offset - (wbl - wbo); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); // CHOICE requires no further Regular Keyword Checking if (wordView == "choice") { continueProcessing = false; } // Check for START (and its switches) - What follows is External Command \ Program if (wordView == "start") { // Reset External Command / Program Location cmdLoc = offset; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Reset External Command / Program Location if command switch detected if (lineBuffer[cmdLoc] == '/') { // Skip command switch while ((cmdLoc < lengthLine) && (!isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } } } // Colorize External Command / Program if (!keywords2) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); } else if (keywords2.InList(wordBuffer)) { styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); } else { styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); } // No need to Reset Offset // Check for Default Text } else { // Read up to %, Operator or Separator while ((wbo < wbl) && (((wordBuffer[wbo] != '%') && (wordBuffer[wbo] != '!') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))))) { wbo++; } // Colorize Default Text styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); } } // Check for Argument (%n), Environment Variable (%x...%) or Local Variable (%%a) } else if (wordBuffer[0] == '%') { // Colorize Default Text styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); wbo++; // Search to end of word for second % (can be a long path) while ((wbo < wbl) && (wordBuffer[wbo] != '%')) { wbo++; } // Check for Argument (%n) or (%*) if (((Is0To9(wordBuffer[1])) || (wordBuffer[1] == '*')) && (wordBuffer[wbo] != '%')) { // Check for External Command / Program if (cmdLoc == offset - wbl) { cmdLoc = offset - (wbl - 2); } // Colorize Argument styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER); // Reset Offset to re-process remainder of word offset -= (wbl - 2); // Check for Expanded Argument (%~...) / Variable (%%~...) // Expanded Argument: %~[] // Expanded Variable: %%~[] // Path operators are exclusively alphabetic. // Expanded arguments have a single digit at the end. // Expanded variables have a single identifier character as variable name. } else if (((wbl > 1) && (wordBuffer[1] == '~')) || ((wbl > 2) && (wordBuffer[1] == '%') && (wordBuffer[2] == '~'))) { // Check for External Command / Program if (cmdLoc == offset - wbl) { cmdLoc = offset - (wbl - wbo); } const bool isArgument = (wordBuffer[1] == '~'); if (isArgument) { Sci_PositionU expansionStopOffset = 2; bool isValid = false; for (; expansionStopOffset < wbl; expansionStopOffset++) { if (Is0To9(wordBuffer[expansionStopOffset])) { expansionStopOffset++; isValid = true; wbo = expansionStopOffset; // Colorize Expanded Argument styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); break; } } if (!isValid) { // not a valid expanded argument or variable styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); } // Expanded Variable } else { // start after ~ wbo = 3; // Search to end of word for another % (can be a long path) while ((wbo < wbl) && (wordBuffer[wbo] != '%') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { wbo++; } if (wbo > 3) { // Colorize Expanded Variable styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); } else { // not a valid expanded argument or variable styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); } } // Reset Offset to re-process remainder of word offset -= (wbl - wbo); // Check for Environment Variable (%x...%) } else if ((wordBuffer[1] != '%') && (wordBuffer[wbo] == '%')) { wbo++; // Check for External Command / Program if (cmdLoc == offset - wbl) { cmdLoc = offset - (wbl - wbo); } // Colorize Environment Variable styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); // Check for Local Variable (%%a) } else if ( (wbl > 2) && (wordBuffer[1] == '%') && (wordBuffer[2] != '%') && (!IsBOperator(wordBuffer[2])) && (!IsBSeparator(wordBuffer[2]))) { // Check for External Command / Program if (cmdLoc == offset - wbl) { cmdLoc = offset - (wbl - 3); } // Colorize Local Variable styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER); // Reset Offset to re-process remainder of word offset -= (wbl - 3); // escaped % } else if ( (wbl > 1) && (wordBuffer[1] == '%')) { // Reset Offset to re-process remainder of word styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_DEFAULT); offset -= (wbl - 2); } // Check for Environment Variable (!x...!) } else if (wordBuffer[0] == '!') { // Colorize Default Text styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); wbo++; // Search to end of word for second ! (can be a long path) while ((wbo < wbl) && (wordBuffer[wbo] != '!')) { wbo++; } if (wordBuffer[wbo] == '!') { wbo++; // Check for External Command / Program if (cmdLoc == offset - wbl) { cmdLoc = offset - (wbl - wbo); } // Colorize Environment Variable styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); } // Check for Operator } else if (IsBOperator(wordBuffer[0])) { // Colorize Default Text styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT); // Check for Comparison Operator if ((wordBuffer[0] == '=') && (wordBuffer[1] == '=')) { // Identify External Command / Program Location for IF cmdLoc = offset; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Colorize Comparison Operator if (continueProcessing) styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_OPERATOR); else styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_DEFAULT); // Reset Offset to re-process remainder of word offset -= (wbl - 2); // Check for Pipe Operator } else if ((wordBuffer[0] == '|') && !(IsEscaped(lineBuffer,offset - wbl + wbo) || textQuoted(lineBuffer, offset - wbl) )) { // Reset External Command / Program Location cmdLoc = offset - wbl + 1; // Skip next spaces while ((cmdLoc < lengthLine) && (isspacechar(lineBuffer[cmdLoc]))) { cmdLoc++; } // Colorize Pipe Operator styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); // Reset Offset to re-process remainder of word offset -= (wbl - 1); continueProcessing = true; // Check for Other Operator } else { // Check for Operators: >, |, & if (((wordBuffer[0] == '>')|| (wordBuffer[0] == ')')|| (wordBuffer[0] == '(')|| (wordBuffer[0] == '&' )) && !(!continueProcessing && (IsEscaped(lineBuffer,offset - wbl + wbo) || textQuoted(lineBuffer, offset - wbl) ))){ // Turn Keyword and External Command / Program checking back on continueProcessing = true; isNotAssigned=false; } // Colorize Other Operators // Do not Colorize Parenthesis, quoted text and escaped operators if (((wordBuffer[0] != ')') && (wordBuffer[0] != '(') && !textQuoted(lineBuffer, offset - wbl) && !IsEscaped(lineBuffer,offset - wbl + wbo)) && !((wordBuffer[0] == '=') && !isNotAssigned )) styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR); else styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_DEFAULT); // Reset Offset to re-process remainder of word offset -= (wbl - 1); if ((wordBuffer[0] == '=') && isNotAssigned ){ isNotAssigned=false; } } // Check for Default Text } else { // Read up to %, Operator or Separator while ((wbo < wbl) && ((wordBuffer[wbo] != '%') && (wordBuffer[wbo] != '!') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo])))) { wbo++; } // Colorize Default Text styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT); // Reset Offset to re-process remainder of word offset -= (wbl - wbo); } // Skip next spaces - nothing happens if Offset was Reset while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { offset++; } } // Colorize Default Text for remainder of line - currently not lexed styler.ColourTo(endPos, SCE_BAT_DEFAULT); // handle line continuation for SET and ECHO commands except the last line if (!continueProcessing && (i2) && lineBuffer[linePos-2]=='\r') // Windows EOL lineContinuationPos=linePos-3; else lineContinuationPos=linePos-2; // Unix or Mac EOL // Reset continueProcessing if line continuation was not found if ((lineBuffer[lineContinuationPos]!='^') || IsEscaped(lineBuffer, lineContinuationPos) || textQuoted(lineBuffer, lineContinuationPos)) continueProcessing=true; } } linePos = 0; startLine = i + 1; } } } const char *const batchWordListDesc[] = { "Internal Commands", "External Commands", nullptr }; } LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", nullptr, batchWordListDesc); ================================================ FILE: lexilla/lexers/LexBibTeX.cxx ================================================ // Copyright 2008-2010 Sergiu Dotenco. The License.txt file describes the // conditions under which this software may be distributed. /** * @file LexBibTeX.cxx * @brief General BibTeX coloring scheme. * @author Sergiu Dotenco * @date April 18, 2009 */ #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "PropSetSimple.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; namespace { bool IsAlphabetic(unsigned int ch) { return IsASCII(ch) && std::isalpha(ch) != 0; } bool IsAlphaNumeric(char ch) { return IsASCII(ch) && std::isalnum(ch); } bool EqualCaseInsensitive(const char* a, const char* b) { return CompareCaseInsensitive(a, b) == 0; } bool EntryWithoutKey(const char* name) { return EqualCaseInsensitive(name,"string"); } char GetClosingBrace(char openbrace) { char result = openbrace; switch (openbrace) { case '(': result = ')'; break; case '{': result = '}'; break; } return result; } bool IsEntryStart(char prev, char ch) { return prev != '\\' && ch == '@'; } bool IsEntryStart(const StyleContext& sc) { return IsEntryStart(sc.chPrev, sc.ch); } void ColorizeBibTeX(Sci_PositionU start_pos, Sci_Position length, int /*init_style*/, WordList* keywordlists[], Accessor& styler) { WordList &EntryNames = *keywordlists[0]; bool fold_compact = styler.GetPropertyInt("fold.compact", 1) != 0; std::string buffer; buffer.reserve(25); // We always colorize a section from the beginning, so let's // search for the @ character which isn't escaped, i.e. \@ while (start_pos > 0 && !IsEntryStart(styler.SafeGetCharAt(start_pos - 1), styler.SafeGetCharAt(start_pos))) { --start_pos; ++length; } styler.StartAt(start_pos); styler.StartSegment(start_pos); Sci_Position current_line = styler.GetLine(start_pos); int prev_level = styler.LevelAt(current_line) & SC_FOLDLEVELNUMBERMASK; int current_level = prev_level; int visible_chars = 0; bool in_comment = false ; StyleContext sc(start_pos, length, SCE_BIBTEX_DEFAULT, styler); bool going = sc.More(); // needed because of a fuzzy end of file state char closing_brace = 0; bool collect_entry_name = false; for (; going; sc.Forward()) { if (!sc.More()) going = false; // we need to go one behind the end of text if (in_comment) { if (sc.atLineEnd) { sc.SetState(SCE_BIBTEX_DEFAULT); in_comment = false; } } else { // Found @entry if (IsEntryStart(sc)) { sc.SetState(SCE_BIBTEX_UNKNOWN_ENTRY); sc.Forward(); ++current_level; buffer.clear(); collect_entry_name = true; } else if ((sc.state == SCE_BIBTEX_ENTRY || sc.state == SCE_BIBTEX_UNKNOWN_ENTRY) && (sc.ch == '{' || sc.ch == '(')) { // Entry name colorization done // Found either a { or a ( after entry's name, e.g. @entry(...) @entry{...} // Closing counterpart needs to be stored. closing_brace = GetClosingBrace(sc.ch); sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize { ( // @string doesn't have any key if (EntryWithoutKey(buffer.c_str())) sc.ForwardSetState(SCE_BIBTEX_PARAMETER); else sc.ForwardSetState(SCE_BIBTEX_KEY); // Key/label colorization } // Need to handle the case where entry's key is empty // e.g. @book{,...} if (sc.state == SCE_BIBTEX_KEY && sc.ch == ',') { // Key/label colorization done sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the , sc.ForwardSetState(SCE_BIBTEX_PARAMETER); // Parameter colorization } else if (sc.state == SCE_BIBTEX_PARAMETER && sc.ch == '=') { sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the = sc.ForwardSetState(SCE_BIBTEX_VALUE); // Parameter value colorization Sci_Position start = sc.currentPos; // We need to handle multiple situations: // 1. name"one two {three}" // 2. name={one {one two {two}} three} // 3. year=2005 // Skip ", { until we encounter the first alphanumerical character while (sc.More() && !(IsAlphaNumeric(sc.ch) || sc.ch == '"' || sc.ch == '{')) sc.Forward(); if (sc.More()) { // Store " or { char ch = sc.ch; // Not interested in alphanumerical characters if (IsAlphaNumeric(ch)) ch = 0; int skipped = 0; if (ch) { // Skip preceding " or { such as in name={{test}}. // Remember how many characters have been skipped // Make sure that empty values, i.e. "" are also handled correctly while (sc.More() && (sc.ch == ch && (ch != '"' || skipped < 1))) { sc.Forward(); ++skipped; } } // Closing counterpart for " is the same character if (ch == '{') ch = '}'; // We have reached the parameter value // In case the open character was a alnum char, skip until , is found // otherwise until skipped == 0 while (sc.More() && (skipped > 0 || (!ch && !(sc.ch == ',' || sc.ch == closing_brace)))) { // Make sure the character isn't escaped if (sc.chPrev != '\\') { // Parameter value contains a { which is the 2nd case described above if (sc.ch == '{') ++skipped; // Remember it else if (sc.ch == '}') --skipped; else if (skipped == 1 && sc.ch == ch && ch == '"') // Don't ignore cases like {"o} skipped = 0; } sc.Forward(); } } // Don't colorize the , sc.SetState(SCE_BIBTEX_DEFAULT); // Skip until the , or entry's closing closing_brace is found // since this parameter might be the last one while (sc.More() && !(sc.ch == ',' || sc.ch == closing_brace)) sc.Forward(); int state = SCE_BIBTEX_PARAMETER; // The might be more parameters // We've reached the closing closing_brace for the bib entry // in case no " or {} has been used to enclose the value, // as in 3rd case described above if (sc.ch == closing_brace) { --current_level; // Make sure the text between entries is not colored // using parameter's style state = SCE_BIBTEX_DEFAULT; } Sci_Position end = sc.currentPos; current_line = styler.GetLine(end); // We have possibly skipped some lines, so the folding levels // have to be adjusted separately for (Sci_Position i = styler.GetLine(start); i <= styler.GetLine(end); ++i) styler.SetLevel(i, prev_level); sc.ForwardSetState(state); } if (sc.state == SCE_BIBTEX_PARAMETER && sc.ch == closing_brace) { sc.SetState(SCE_BIBTEX_DEFAULT); --current_level; } // Non escaped % found which represents a comment until the end of the line if (sc.chPrev != '\\' && sc.ch == '%') { in_comment = true; sc.SetState(SCE_BIBTEX_COMMENT); } } if (sc.state == SCE_BIBTEX_UNKNOWN_ENTRY || sc.state == SCE_BIBTEX_ENTRY) { if (!IsAlphabetic(sc.ch) && collect_entry_name) collect_entry_name = false; if (collect_entry_name) { buffer += static_cast(tolower(sc.ch)); if (EntryNames.InList(buffer.c_str())) sc.ChangeState(SCE_BIBTEX_ENTRY); else sc.ChangeState(SCE_BIBTEX_UNKNOWN_ENTRY); } } if (sc.atLineEnd) { int level = prev_level; if (visible_chars == 0 && fold_compact) level |= SC_FOLDLEVELWHITEFLAG; if ((current_level > prev_level)) level |= SC_FOLDLEVELHEADERFLAG; // else if (current_level < prev_level) // level |= SC_FOLDLEVELBOXFOOTERFLAG; // Deprecated if (level != styler.LevelAt(current_line)) { styler.SetLevel(current_line, level); } ++current_line; prev_level = current_level; visible_chars = 0; } if (!isspacechar(sc.ch)) ++visible_chars; } sc.Complete(); // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(current_line) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(current_line, prev_level | flagsNext); } } static const char * const BibTeXWordLists[] = { "Entry Names", 0, }; LexerModule lmBibTeX(SCLEX_BIBTEX, ColorizeBibTeX, "bib", 0, BibTeXWordLists); // Entry Names // article, book, booklet, conference, inbook, // incollection, inproceedings, manual, mastersthesis, // misc, phdthesis, proceedings, techreport, unpublished, // string, url ================================================ FILE: lexilla/lexers/LexBullant.cxx ================================================ // SciTE - Scintilla based Text Editor // LexBullant.cxx - lexer for Bullant #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static int classifyWordBullant(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) { char s[100]; s[0] = '\0'; for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) { s[i] = static_cast(tolower(styler[start + i])); s[i + 1] = '\0'; } int lev= 0; char chAttr = SCE_C_IDENTIFIER; if (isdigit(s[0]) || (s[0] == '.')){ chAttr = SCE_C_NUMBER; } else { if (keywords.InList(s)) { chAttr = SCE_C_WORD; if (strcmp(s, "end") == 0) lev = -1; else if (strcmp(s, "method") == 0 || strcmp(s, "case") == 0 || strcmp(s, "class") == 0 || strcmp(s, "debug") == 0 || strcmp(s, "test") == 0 || strcmp(s, "if") == 0 || strcmp(s, "lock") == 0 || strcmp(s, "transaction") == 0 || strcmp(s, "trap") == 0 || strcmp(s, "until") == 0 || strcmp(s, "while") == 0) lev = 1; } } styler.ColourTo(end, chAttr); return lev; } static void ColouriseBullantDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; styler.StartAt(startPos); bool fold = styler.GetPropertyInt("fold") != 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int state = initStyle; if (state == SCE_C_STRINGEOL) // Does not leak onto next line state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; styler.StartSegment(startPos); int endFoundThisLine = 0; for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix) // Avoid triggering two times on Dos/Win // End of line endFoundThisLine = 0; if (state == SCE_C_STRINGEOL) { styler.ColourTo(i, state); state = SCE_C_DEFAULT; } if (fold) { int lev = levelPrev; if (visibleChars == 0) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; styler.SetLevel(lineCurrent, lev); lineCurrent++; levelPrev = levelCurrent; } visibleChars = 0; /* int indentBlock = GetLineIndentation(lineCurrent); if (blockChange==1){ lineCurrent++; int pos=SetLineIndentation(lineCurrent, indentBlock + indentSize); } else if (blockChange==-1) { indentBlock -= indentSize; if (indentBlock < 0) indentBlock = 0; SetLineIndentation(lineCurrent, indentBlock); lineCurrent++; } blockChange=0; */ } if (!(IsASCII(ch) && isspace(ch))) visibleChars++; if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); chPrev = ' '; i += 1; continue; } if (state == SCE_C_DEFAULT) { if (iswordstart(ch)) { styler.ColourTo(i-1, state); state = SCE_C_IDENTIFIER; } else if (ch == '@' && chNext == 'o') { if ((styler.SafeGetCharAt(i+2) =='f') && (styler.SafeGetCharAt(i+3) == 'f')) { styler.ColourTo(i-1, state); state = SCE_C_COMMENT; } } else if (ch == '#') { styler.ColourTo(i-1, state); state = SCE_C_COMMENTLINE; } else if (ch == '\"') { styler.ColourTo(i-1, state); state = SCE_C_STRING; } else if (ch == '\'') { styler.ColourTo(i-1, state); state = SCE_C_CHARACTER; } else if (isoperator(ch)) { styler.ColourTo(i-1, state); styler.ColourTo(i, SCE_C_OPERATOR); } } else if (state == SCE_C_IDENTIFIER) { if (!iswordchar(ch)) { int levelChange = classifyWordBullant(styler.GetStartSegment(), i - 1, keywords, styler); state = SCE_C_DEFAULT; chNext = styler.SafeGetCharAt(i + 1); if (ch == '#') { state = SCE_C_COMMENTLINE; } else if (ch == '\"') { state = SCE_C_STRING; } else if (ch == '\'') { state = SCE_C_CHARACTER; } else if (isoperator(ch)) { styler.ColourTo(i, SCE_C_OPERATOR); } if (endFoundThisLine == 0) levelCurrent+=levelChange; if (levelChange == -1) endFoundThisLine=1; } } else if (state == SCE_C_COMMENT) { if (ch == '@' && chNext == 'o') { if (styler.SafeGetCharAt(i+2) == 'n') { styler.ColourTo(i+2, state); state = SCE_C_DEFAULT; i+=2; } } } else if (state == SCE_C_COMMENTLINE) { if (ch == '\r' || ch == '\n') { endFoundThisLine = 0; styler.ColourTo(i-1, state); state = SCE_C_DEFAULT; } } else if (state == SCE_C_STRING) { if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); } } else if (ch == '\"') { styler.ColourTo(i, state); state = SCE_C_DEFAULT; } else if (chNext == '\r' || chNext == '\n') { endFoundThisLine = 0; styler.ColourTo(i-1, SCE_C_STRINGEOL); state = SCE_C_STRINGEOL; } } else if (state == SCE_C_CHARACTER) { if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) { endFoundThisLine = 0; styler.ColourTo(i-1, SCE_C_STRINGEOL); state = SCE_C_STRINGEOL; } else if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); } } else if (ch == '\'') { styler.ColourTo(i, state); state = SCE_C_DEFAULT; } } chPrev = ch; } styler.ColourTo(lengthDoc - 1, state); // Fill in the real level of the next line, keeping the current flags as they will be filled in later if (fold) { int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; //styler.SetLevel(lineCurrent, levelCurrent | flagsNext); styler.SetLevel(lineCurrent, levelPrev | flagsNext); } } static const char * const bullantWordListDesc[] = { "Keywords", 0 }; LexerModule lmBullant(SCLEX_BULLANT, ColouriseBullantDoc, "bullant", 0, bullantWordListDesc); ================================================ FILE: lexilla/lexers/LexCIL.cxx ================================================ // Scintilla source code edit control /** @file LexCIL.cxx ** Lexer for Common Intermediate Language ** Written by Jad Altahan (github.com/xv) ** CIL manual: https://www.ecma-international.org/publications/standards/Ecma-335.htm **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "StringCopy.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; namespace { // Use an unnamed namespace to protect the functions and classes from name conflicts bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); } bool IsOperator(const int ch) { if ((ch < 0x80) && (isalnum(ch))) return false; if (strchr("!%&*+-/<=>@^|~()[]{}", ch)) { return true; } return false; } constexpr bool IsStreamCommentStyle(const int style) noexcept { return style == SCE_CIL_COMMENT; } struct OptionsCIL { bool fold; bool foldComment; bool foldCommentMultiline; bool foldCompact; OptionsCIL() { fold = true; foldComment = false; foldCommentMultiline = true; foldCompact = true; } }; static const char *const cilWordListDesc[] = { "Primary CIL keywords", "Metadata", "Opcode instructions", 0 }; struct OptionSetCIL : public OptionSet { OptionSetCIL() { DefineProperty("fold", &OptionsCIL::fold); DefineProperty("fold.comment", &OptionsCIL::foldComment); DefineProperty("fold.cil.comment.multiline", &OptionsCIL::foldCommentMultiline, "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); DefineProperty("fold.compact", &OptionsCIL::foldCompact); DefineWordListSets(cilWordListDesc); } }; LexicalClass lexicalClasses[] = { // Lexer CIL SCLEX_CIL SCE_CIL_: 0, "SCE_CIL_DEFAULT", "default", "White space", 1, "SCE_CIL_COMMENT", "comment", "Multi-line comment", 2, "SCE_CIL_COMMENTLINE", "comment line", "Line comment", 3, "SCE_CIL_WORD", "keyword", "Keyword 1", 4, "SCE_CIL_WORD2", "keyword", "Keyword 2", 5, "SCE_CIL_WORD3", "keyword", "Keyword 3", 6, "SCE_CIL_STRING", "literal string", "Double quoted string", 7, "SCE_CIL_LABEL", "label", "Code label", 8, "SCE_CIL_OPERATOR", "operator", "Operators", 9, "SCE_CIL_STRINGEOL", "error literal string", "String is not closed", 10, "SCE_CIL_IDENTIFIER", "identifier", "Identifiers", }; } class LexerCIL : public DefaultLexer { WordList keywords, keywords2, keywords3; OptionsCIL options; OptionSetCIL osCIL; public: LexerCIL() : DefaultLexer("cil", SCLEX_CIL, lexicalClasses, ELEMENTS(lexicalClasses)) { } virtual ~LexerCIL() { } void SCI_METHOD Release() override { delete this; } int SCI_METHOD Version() const override { return lvRelease5; } const char * SCI_METHOD PropertyNames() override { return osCIL.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osCIL.PropertyType(name); } const char * SCI_METHOD DescribeProperty(const char *name) override { return osCIL.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char* key) override { return osCIL.PropertyGet(key); } const char * SCI_METHOD DescribeWordListSets() override { return osCIL.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return 0; } int SCI_METHOD LineEndTypesSupported() override { return SC_LINE_END_TYPE_UNICODE; } int SCI_METHOD PrimaryStyleFromStyle(int style) override { return style; } static ILexer5 *LexerFactoryCIL() { return new LexerCIL(); } }; Sci_Position SCI_METHOD LexerCIL::PropertySet(const char *key, const char *val) { if (osCIL.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerCIL::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: wordListN = &keywords; break; case 1: wordListN = &keywords2; break; case 2: wordListN = &keywords3; break; } Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); if (*wordListN != wlNew) { wordListN->Set(wl); firstModification = 0; } } return firstModification; } void SCI_METHOD LexerCIL::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (initStyle == SCE_CIL_STRINGEOL) { initStyle = SCE_CIL_DEFAULT; } Accessor styler(pAccess, NULL); StyleContext sc(startPos, length, initStyle, styler); bool identAtLineStart = false, // Checks if an identifier is at line start (ignoring spaces) canStyleLabels = false; // Checks if conditions are met to style SCE_CIL_LABEL for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { if (sc.state == SCE_CIL_STRING) { sc.SetState(SCE_CIL_STRING); } identAtLineStart = true; } // Handle string line continuation if (sc.ch == '\\' && (sc.chNext == '\n' || sc.chNext == '\r') && (sc.state == SCE_CIL_STRING)) { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } switch (sc.state) { case SCE_CIL_OPERATOR: sc.SetState(SCE_CIL_DEFAULT); break; case SCE_CIL_IDENTIFIER: if (!IsAWordChar(sc.ch)) { if (canStyleLabels && (sc.ch == ':' && sc.chNext != ':')) { sc.ChangeState(SCE_CIL_LABEL); sc.ForwardSetState(SCE_CIL_DEFAULT); } else { char kwSize[100]; sc.GetCurrent(kwSize, sizeof(kwSize)); int style = SCE_CIL_IDENTIFIER; if (keywords.InList(kwSize)) { style = SCE_CIL_WORD; } else if (keywords2.InList(kwSize)) { style = SCE_CIL_WORD2; } else if (keywords3.InList(kwSize)) { style = SCE_CIL_WORD3; } sc.ChangeState(style); sc.SetState(SCE_CIL_DEFAULT); } } break; case SCE_CIL_COMMENT: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_CIL_DEFAULT); } break; case SCE_CIL_COMMENTLINE: if (sc.atLineStart) { sc.SetState(SCE_CIL_DEFAULT); } break; case SCE_CIL_STRING: if (sc.ch == '\\') { if (sc.chNext == '"' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '"') { sc.ForwardSetState(SCE_CIL_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_CIL_STRINGEOL); sc.ForwardSetState(SCE_CIL_DEFAULT); } break; } if (sc.state == SCE_CIL_DEFAULT) { // String if (sc.ch == '"') { sc.SetState(SCE_CIL_STRING); } // Keyword else if (IsAWordChar(sc.ch)) { // Allow setting SCE_CIL_LABEL style only if the label is the // first token in the line and does not start with a dot or a digit canStyleLabels = identAtLineStart && !(sc.ch == '.' || IsADigit(sc.ch)); sc.SetState(SCE_CIL_IDENTIFIER); } // Multi-line comment else if (sc.Match('/', '*')) { sc.SetState(SCE_CIL_COMMENT); sc.Forward(); } // Line comment else if (sc.Match('/', '/')) { sc.SetState(SCE_CIL_COMMENTLINE); } // Operators else if (IsOperator(sc.ch)) { sc.SetState(SCE_CIL_OPERATOR); } } if (!IsASpace(sc.ch)) { identAtLineStart = false; } } sc.Complete(); } void SCI_METHOD LexerCIL::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) { return; } LexAccessor styler(pAccess); const Sci_PositionU endPos = startPos + length; Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16; int style = initStyle; int styleNext = styler.StyleAt(startPos); int levelNext = levelCurrent; int visibleChars = 0; char chNext = styler[startPos]; for (Sci_PositionU i = startPos; i < endPos; i++) { const char ch = chNext; int stylePrev = style; chNext = styler.SafeGetCharAt(i + 1); style = styleNext; styleNext = styler.StyleAt(i + 1); const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev)) { levelNext++; } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { levelNext--; } } if (style == SCE_CIL_OPERATOR) { if (ch == '{') { levelNext++; } else if (ch == '}') { levelNext--; } } if (!IsASpace(ch)) { visibleChars++; } if (atEOL || (i == endPos - 1)) { int lev = levelCurrent | levelNext << 16; if (visibleChars == 0 && options.foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelCurrent < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelCurrent = levelNext; if (options.foldCompact && i == static_cast(styler.Length() - 1)) { styler.SetLevel(lineCurrent, lev | SC_FOLDLEVELWHITEFLAG); } visibleChars = 0; } } } LexerModule lmCIL(SCLEX_CIL, LexerCIL::LexerFactoryCIL, "cil", cilWordListDesc); ================================================ FILE: lexilla/lexers/LexCLW.cxx ================================================ // Scintilla source code edit control /** @file LexCLW.cxx ** Lexer for Clarion. ** 2004/12/17 Updated Lexer **/ // Copyright 2003-2004 by Ron Schofield // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; // Is an end of line character inline bool IsEOL(const int ch) { return(ch == '\n'); } // Convert character to uppercase static char CharacterUpper(char chChar) { if (chChar < 'a' || chChar > 'z') { return(chChar); } else { return(static_cast(chChar - 'a' + 'A')); } } // Convert string to uppercase static void StringUpper(char *szString) { while (*szString) { *szString = CharacterUpper(*szString); szString++; } } // Is a label start character inline bool IsALabelStart(const int iChar) { return(isalpha(iChar) || iChar == '_'); } // Is a label character inline bool IsALabelCharacter(const int iChar) { return(isalnum(iChar) || iChar == '_' || iChar == ':'); } // Is the character is a ! and the the next character is not a ! inline bool IsACommentStart(const int iChar) { return(iChar == '!'); } // Is the character a Clarion hex character (ABCDEF) inline bool IsAHexCharacter(const int iChar, bool bCaseSensitive) { // Case insensitive. if (!bCaseSensitive) { if (strchr("ABCDEFabcdef", iChar) != NULL) { return(true); } } // Case sensitive else { if (strchr("ABCDEF", iChar) != NULL) { return(true); } } return(false); } // Is the character a Clarion base character (B=Binary, O=Octal, H=Hex) inline bool IsANumericBaseCharacter(const int iChar, bool bCaseSensitive) { // Case insensitive. if (!bCaseSensitive) { // If character is a numeric base character if (strchr("BOHboh", iChar) != NULL) { return(true); } } // Case sensitive else { // If character is a numeric base character if (strchr("BOH", iChar) != NULL) { return(true); } } return(false); } // Set the correct numeric constant state inline bool SetNumericConstantState(StyleContext &scDoc) { int iPoints = 0; // Point counter char cNumericString[512]; // Numeric string buffer // Buffer the current numberic string scDoc.GetCurrent(cNumericString, sizeof(cNumericString)); // Loop through the string until end of string (NULL termination) for (int iIndex = 0; cNumericString[iIndex] != '\0'; iIndex++) { // Depending on the character switch (cNumericString[iIndex]) { // Is a . (point) case '.' : // Increment point counter iPoints++; break; default : break; } } // If points found (can be more than one for improper formatted number if (iPoints > 0) { return(true); } // Else no points found else { return(false); } } // Get the next word in uppercase from the current position (keyword lookahead) inline bool GetNextWordUpper(Accessor &styler, Sci_PositionU uiStartPos, Sci_Position iLength, char *cWord) { Sci_PositionU iIndex = 0; // Buffer Index // Loop through the remaining string from the current position for (Sci_Position iOffset = uiStartPos; iOffset < iLength; iOffset++) { // Get the character from the buffer using the offset char cCharacter = styler[iOffset]; if (IsEOL(cCharacter)) { break; } // If the character is alphabet character if (isalpha(cCharacter)) { // Add UPPERCASE character to the word buffer cWord[iIndex++] = CharacterUpper(cCharacter); } } // Add null termination cWord[iIndex] = '\0'; // If no word was found if (iIndex == 0) { // Return failure return(false); } // Else word was found else { // Return success return(true); } } // Clarion Language Colouring Procedure static void ColouriseClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) { int iParenthesesLevel = 0; // Parenthese Level int iColumn1Label = false; // Label starts in Column 1 WordList &wlClarionKeywords = *wlKeywords[0]; // Clarion Keywords WordList &wlCompilerDirectives = *wlKeywords[1]; // Compiler Directives WordList &wlRuntimeExpressions = *wlKeywords[2]; // Runtime Expressions WordList &wlBuiltInProcsFuncs = *wlKeywords[3]; // Builtin Procedures and Functions WordList &wlStructsDataTypes = *wlKeywords[4]; // Structures and Data Types WordList &wlAttributes = *wlKeywords[5]; // Procedure Attributes WordList &wlStandardEquates = *wlKeywords[6]; // Standard Equates WordList &wlLabelReservedWords = *wlKeywords[7]; // Clarion Reserved Keywords (Labels) WordList &wlProcLabelReservedWords = *wlKeywords[8]; // Clarion Reserved Keywords (Procedure Labels) const char wlProcReservedKeywordList[] = "PROCEDURE FUNCTION"; WordList wlProcReservedKeywords; wlProcReservedKeywords.Set(wlProcReservedKeywordList); const char wlCompilerKeywordList[] = "COMPILE OMIT"; WordList wlCompilerKeywords; wlCompilerKeywords.Set(wlCompilerKeywordList); const char wlLegacyStatementsList[] = "BOF EOF FUNCTION POINTER SHARE"; WordList wlLegacyStatements; wlLegacyStatements.Set(wlLegacyStatementsList); StyleContext scDoc(uiStartPos, iLength, iInitStyle, accStyler); // lex source code for (; scDoc.More(); scDoc.Forward()) { // // Determine if the current state should terminate. // // Label State Handling if (scDoc.state == SCE_CLW_LABEL) { // If the character is not a valid label if (!IsALabelCharacter(scDoc.ch)) { // If the character is a . (dot syntax) if (scDoc.ch == '.') { // Turn off column 1 label flag as label now cannot be reserved work iColumn1Label = false; // Uncolour the . (dot) to default state, move forward one character, // and change back to the label state. scDoc.SetState(SCE_CLW_DEFAULT); scDoc.Forward(); scDoc.SetState(SCE_CLW_LABEL); } // Else check label else { char cLabel[512]; // Label buffer // Buffer the current label string scDoc.GetCurrent(cLabel,sizeof(cLabel)); // If case insensitive, convert string to UPPERCASE to match passed keywords. if (!bCaseSensitive) { StringUpper(cLabel); } // Else if UPPERCASE label string is in the Clarion compiler keyword list if (wlCompilerKeywords.InList(cLabel) && iColumn1Label){ // change the label to error state scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE); } // Else if UPPERCASE label string is in the Clarion reserved keyword list else if (wlLabelReservedWords.InList(cLabel) && iColumn1Label){ // change the label to error state scDoc.ChangeState(SCE_CLW_ERROR); } // Else if UPPERCASE label string is else if (wlProcLabelReservedWords.InList(cLabel) && iColumn1Label) { char cWord[512]; // Word buffer // Get the next word from the current position if (GetNextWordUpper(accStyler,scDoc.currentPos,uiStartPos+iLength,cWord)) { // If the next word is a procedure reserved word if (wlProcReservedKeywords.InList(cWord)) { // Change the label to error state scDoc.ChangeState(SCE_CLW_ERROR); } } } // Else if label string is in the compiler directive keyword list else if (wlCompilerDirectives.InList(cLabel)) { // change the state to compiler directive state scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE); } // Terminate the label state and set to default state scDoc.SetState(SCE_CLW_DEFAULT); } } } // Keyword State Handling else if (scDoc.state == SCE_CLW_KEYWORD) { // If character is : (colon) if (scDoc.ch == ':') { char cEquate[512]; // Equate buffer // Move forward to include : (colon) in buffer scDoc.Forward(); // Buffer the equate string scDoc.GetCurrent(cEquate,sizeof(cEquate)); // If case insensitive, convert string to UPPERCASE to match passed keywords. if (!bCaseSensitive) { StringUpper(cEquate); } // If statement string is in the equate list if (wlStandardEquates.InList(cEquate)) { // Change to equate state scDoc.ChangeState(SCE_CLW_STANDARD_EQUATE); } } // If the character is not a valid label character else if (!IsALabelCharacter(scDoc.ch)) { char cStatement[512]; // Statement buffer // Buffer the statement string scDoc.GetCurrent(cStatement,sizeof(cStatement)); // If case insensitive, convert string to UPPERCASE to match passed keywords. if (!bCaseSensitive) { StringUpper(cStatement); } // If statement string is in the Clarion keyword list if (wlClarionKeywords.InList(cStatement)) { // Change the statement string to the Clarion keyword state scDoc.ChangeState(SCE_CLW_KEYWORD); } // Else if statement string is in the compiler directive keyword list else if (wlCompilerDirectives.InList(cStatement)) { // Change the statement string to the compiler directive state scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE); } // Else if statement string is in the runtime expressions keyword list else if (wlRuntimeExpressions.InList(cStatement)) { // Change the statement string to the runtime expressions state scDoc.ChangeState(SCE_CLW_RUNTIME_EXPRESSIONS); } // Else if statement string is in the builtin procedures and functions keyword list else if (wlBuiltInProcsFuncs.InList(cStatement)) { // Change the statement string to the builtin procedures and functions state scDoc.ChangeState(SCE_CLW_BUILTIN_PROCEDURES_FUNCTION); } // Else if statement string is in the tructures and data types keyword list else if (wlStructsDataTypes.InList(cStatement)) { // Change the statement string to the structures and data types state scDoc.ChangeState(SCE_CLW_STRUCTURE_DATA_TYPE); } // Else if statement string is in the procedure attribute keyword list else if (wlAttributes.InList(cStatement)) { // Change the statement string to the procedure attribute state scDoc.ChangeState(SCE_CLW_ATTRIBUTE); } // Else if statement string is in the standard equate keyword list else if (wlStandardEquates.InList(cStatement)) { // Change the statement string to the standard equate state scDoc.ChangeState(SCE_CLW_STANDARD_EQUATE); } // Else if statement string is in the deprecated or legacy keyword list else if (wlLegacyStatements.InList(cStatement)) { // Change the statement string to the standard equate state scDoc.ChangeState(SCE_CLW_DEPRECATED); } // Else the statement string doesn't match any work list else { // Change the statement string to the default state scDoc.ChangeState(SCE_CLW_DEFAULT); } // Terminate the keyword state and set to default state scDoc.SetState(SCE_CLW_DEFAULT); } } // String State Handling else if (scDoc.state == SCE_CLW_STRING) { // If the character is an ' (single quote) if (scDoc.ch == '\'') { // Set the state to default and move forward colouring // the ' (single quote) as default state // terminating the string state scDoc.SetState(SCE_CLW_DEFAULT); scDoc.Forward(); } // If the next character is an ' (single quote) if (scDoc.chNext == '\'') { // Move forward one character and set to default state // colouring the next ' (single quote) as default state // terminating the string state scDoc.ForwardSetState(SCE_CLW_DEFAULT); scDoc.Forward(); } } // Picture String State Handling else if (scDoc.state == SCE_CLW_PICTURE_STRING) { // If the character is an ( (open parenthese) if (scDoc.ch == '(') { // Increment the parenthese level iParenthesesLevel++; } // Else if the character is a ) (close parenthese) else if (scDoc.ch == ')') { // If the parenthese level is set to zero // parentheses matched if (!iParenthesesLevel) { scDoc.SetState(SCE_CLW_DEFAULT); } // Else parenthese level is greater than zero // still looking for matching parentheses else { // Decrement the parenthese level iParenthesesLevel--; } } } // Standard Equate State Handling else if (scDoc.state == SCE_CLW_STANDARD_EQUATE) { if (!isalnum(scDoc.ch)) { scDoc.SetState(SCE_CLW_DEFAULT); } } // Integer Constant State Handling else if (scDoc.state == SCE_CLW_INTEGER_CONSTANT) { // If the character is not a digit (0-9) // or character is not a hexidecimal character (A-F) // or character is not a . (point) // or character is not a numberic base character (B,O,H) if (!(isdigit(scDoc.ch) || IsAHexCharacter(scDoc.ch, bCaseSensitive) || scDoc.ch == '.' || IsANumericBaseCharacter(scDoc.ch, bCaseSensitive))) { // If the number was a real if (SetNumericConstantState(scDoc)) { // Colour the matched string to the real constant state scDoc.ChangeState(SCE_CLW_REAL_CONSTANT); } // Else the number was an integer else { // Colour the matched string to an integer constant state scDoc.ChangeState(SCE_CLW_INTEGER_CONSTANT); } // Terminate the integer constant state and set to default state scDoc.SetState(SCE_CLW_DEFAULT); } } // // Determine if a new state should be entered. // // Beginning of Line Handling if (scDoc.atLineStart) { // Reset the column 1 label flag iColumn1Label = false; // If column 1 character is a label start character if (IsALabelStart(scDoc.ch)) { // Label character is found in column 1 // so set column 1 label flag and clear last column 1 label iColumn1Label = true; // Set the state to label scDoc.SetState(SCE_CLW_LABEL); } // else if character is a space or tab else if (IsASpace(scDoc.ch)){ // Set to default state scDoc.SetState(SCE_CLW_DEFAULT); } // else if comment start (!) or is an * (asterisk) else if (IsACommentStart(scDoc.ch) || scDoc.ch == '*' ) { // then set the state to comment. scDoc.SetState(SCE_CLW_COMMENT); } // else the character is a ? (question mark) else if (scDoc.ch == '?') { // Change to the compiler directive state, move forward, // colouring the ? (question mark), change back to default state. scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE); scDoc.Forward(); scDoc.SetState(SCE_CLW_DEFAULT); } // else an invalid character in column 1 else { // Set to error state scDoc.SetState(SCE_CLW_ERROR); } } // End of Line Handling else if (scDoc.atLineEnd) { // Reset to the default state at the end of each line. scDoc.SetState(SCE_CLW_DEFAULT); } // Default Handling else { // If in default state if (scDoc.state == SCE_CLW_DEFAULT) { // If is a letter could be a possible statement if (isalpha(scDoc.ch)) { // Set the state to Clarion Keyword and verify later scDoc.SetState(SCE_CLW_KEYWORD); } // else is a number else if (isdigit(scDoc.ch)) { // Set the state to Integer Constant and verify later scDoc.SetState(SCE_CLW_INTEGER_CONSTANT); } // else if the start of a comment or a | (line continuation) else if (IsACommentStart(scDoc.ch) || scDoc.ch == '|') { // then set the state to comment. scDoc.SetState(SCE_CLW_COMMENT); } // else if the character is a ' (single quote) else if (scDoc.ch == '\'') { // If the character is also a ' (single quote) // Embedded Apostrophe if (scDoc.chNext == '\'') { // Move forward colouring it as default state scDoc.ForwardSetState(SCE_CLW_DEFAULT); } else { // move to the next character and then set the state to comment. scDoc.ForwardSetState(SCE_CLW_STRING); } } // else the character is an @ (ampersand) else if (scDoc.ch == '@') { // Case insensitive. if (!bCaseSensitive) { // If character is a valid picture token character if (strchr("DEKNPSTdeknpst", scDoc.chNext) != NULL) { // Set to the picture string state scDoc.SetState(SCE_CLW_PICTURE_STRING); } } // Case sensitive else { // If character is a valid picture token character if (strchr("DEKNPST", scDoc.chNext) != NULL) { // Set the picture string state scDoc.SetState(SCE_CLW_PICTURE_STRING); } } } } } } // lexing complete scDoc.Complete(); } // Clarion Language Case Sensitive Colouring Procedure static void ColouriseClarionDocSensitive(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) { ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, true); } // Clarion Language Case Insensitive Colouring Procedure static void ColouriseClarionDocInsensitive(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) { ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, false); } // Fill Buffer static void FillBuffer(Sci_PositionU uiStart, Sci_PositionU uiEnd, Accessor &accStyler, char *szBuffer, Sci_PositionU uiLength) { Sci_PositionU uiPos = 0; while ((uiPos < uiEnd - uiStart + 1) && (uiPos < uiLength-1)) { szBuffer[uiPos] = static_cast(toupper(accStyler[uiStart + uiPos])); uiPos++; } szBuffer[uiPos] = '\0'; } // Classify Clarion Fold Point static int ClassifyClarionFoldPoint(int iLevel, const char* szString) { if (!(isdigit(szString[0]) || (szString[0] == '.'))) { if (strcmp(szString, "PROCEDURE") == 0) { // iLevel = SC_FOLDLEVELBASE + 1; } else if (strcmp(szString, "MAP") == 0 || strcmp(szString,"ACCEPT") == 0 || strcmp(szString,"BEGIN") == 0 || strcmp(szString,"CASE") == 0 || strcmp(szString,"EXECUTE") == 0 || strcmp(szString,"IF") == 0 || strcmp(szString,"ITEMIZE") == 0 || strcmp(szString,"INTERFACE") == 0 || strcmp(szString,"JOIN") == 0 || strcmp(szString,"LOOP") == 0 || strcmp(szString,"MODULE") == 0 || strcmp(szString,"RECORD") == 0) { iLevel++; } else if (strcmp(szString, "APPLICATION") == 0 || strcmp(szString, "CLASS") == 0 || strcmp(szString, "DETAIL") == 0 || strcmp(szString, "FILE") == 0 || strcmp(szString, "FOOTER") == 0 || strcmp(szString, "FORM") == 0 || strcmp(szString, "GROUP") == 0 || strcmp(szString, "HEADER") == 0 || strcmp(szString, "INTERFACE") == 0 || strcmp(szString, "MENU") == 0 || strcmp(szString, "MENUBAR") == 0 || strcmp(szString, "OLE") == 0 || strcmp(szString, "OPTION") == 0 || strcmp(szString, "QUEUE") == 0 || strcmp(szString, "REPORT") == 0 || strcmp(szString, "SHEET") == 0 || strcmp(szString, "TAB") == 0 || strcmp(szString, "TOOLBAR") == 0 || strcmp(szString, "VIEW") == 0 || strcmp(szString, "WINDOW") == 0) { iLevel++; } else if (strcmp(szString, "END") == 0 || strcmp(szString, "UNTIL") == 0 || strcmp(szString, "WHILE") == 0) { iLevel--; } } return(iLevel); } // Clarion Language Folding Procedure static void FoldClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *[], Accessor &accStyler) { Sci_PositionU uiEndPos = uiStartPos + iLength; Sci_Position iLineCurrent = accStyler.GetLine(uiStartPos); int iLevelPrev = accStyler.LevelAt(iLineCurrent) & SC_FOLDLEVELNUMBERMASK; int iLevelCurrent = iLevelPrev; char chNext = accStyler[uiStartPos]; int iStyle = iInitStyle; int iStyleNext = accStyler.StyleAt(uiStartPos); int iVisibleChars = 0; Sci_Position iLastStart = 0; for (Sci_PositionU uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) { char chChar = chNext; chNext = accStyler.SafeGetCharAt(uiPos + 1); int iStylePrev = iStyle; iStyle = iStyleNext; iStyleNext = accStyler.StyleAt(uiPos + 1); bool bEOL = (chChar == '\r' && chNext != '\n') || (chChar == '\n'); if (iStylePrev == SCE_CLW_DEFAULT) { if (iStyle == SCE_CLW_KEYWORD || iStyle == SCE_CLW_STRUCTURE_DATA_TYPE) { // Store last word start point. iLastStart = uiPos; } } if (iStylePrev == SCE_CLW_KEYWORD || iStylePrev == SCE_CLW_STRUCTURE_DATA_TYPE) { if(iswordchar(chChar) && !iswordchar(chNext)) { char chBuffer[100]; FillBuffer(iLastStart, uiPos, accStyler, chBuffer, sizeof(chBuffer)); iLevelCurrent = ClassifyClarionFoldPoint(iLevelCurrent,chBuffer); // if ((iLevelCurrent == SC_FOLDLEVELBASE + 1) && iLineCurrent > 1) { // accStyler.SetLevel(iLineCurrent-1,SC_FOLDLEVELBASE); // iLevelPrev = SC_FOLDLEVELBASE; // } } } if (bEOL) { int iLevel = iLevelPrev; if ((iLevelCurrent > iLevelPrev) && (iVisibleChars > 0)) iLevel |= SC_FOLDLEVELHEADERFLAG; if (iLevel != accStyler.LevelAt(iLineCurrent)) { accStyler.SetLevel(iLineCurrent,iLevel); } iLineCurrent++; iLevelPrev = iLevelCurrent; iVisibleChars = 0; } if (!isspacechar(chChar)) iVisibleChars++; } // Fill in the real level of the next line, keeping the current flags // as they will be filled in later. int iFlagsNext = accStyler.LevelAt(iLineCurrent) & ~SC_FOLDLEVELNUMBERMASK; accStyler.SetLevel(iLineCurrent, iLevelPrev | iFlagsNext); } // Word List Descriptions static const char * const rgWordListDescriptions[] = { "Clarion Keywords", "Compiler Directives", "Built-in Procedures and Functions", "Runtime Expressions", "Structure and Data Types", "Attributes", "Standard Equates", "Reserved Words (Labels)", "Reserved Words (Procedure Labels)", 0, }; // Case Sensitive Clarion Language Lexer LexerModule lmClw(SCLEX_CLW, ColouriseClarionDocSensitive, "clarion", FoldClarionDoc, rgWordListDescriptions); // Case Insensitive Clarion Language Lexer LexerModule lmClwNoCase(SCLEX_CLWNOCASE, ColouriseClarionDocInsensitive, "clarionnocase", FoldClarionDoc, rgWordListDescriptions); ================================================ FILE: lexilla/lexers/LexCOBOL.cxx ================================================ // Scintilla source code edit control /** @file LexCOBOL.cxx ** Lexer for COBOL ** Based on LexPascal.cxx ** Written by Laurent le Tynevez ** Updated by Simon Steele September 2002 ** Updated by Mathias Rauen May 2003 (Delphi adjustments) ** Updated by Rod Falck, Aug 2006 Converted to COBOL **/ #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; #define IN_DIVISION 0x01 #define IN_DECLARATIVES 0x02 #define IN_SECTION 0x04 #define IN_PARAGRAPH 0x08 #define IN_FLAGS 0xF #define NOT_HEADER 0x10 inline bool isCOBOLoperator(char ch) { return isoperator(ch); } inline bool isCOBOLwordchar(char ch) { return IsASCII(ch) && (isalnum(ch) || ch == '-'); } inline bool isCOBOLwordstart(char ch) { return IsASCII(ch) && isalnum(ch); } static int CountBits(int nBits) { int count = 0; for (int i = 0; i < 32; ++i) { count += nBits & 1; nBits >>= 1; } return count; } static void getRange(Sci_PositionU start, Sci_PositionU end, Accessor &styler, char *s, Sci_PositionU len) { Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast(tolower(styler[start + i])); i++; } s[i] = '\0'; } static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr) { styler.ColourTo(end, attr); } static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) { int ret = 0; char s[100]; s[0] = '\0'; s[1] = '\0'; getRange(start, end, styler, s, sizeof(s)); int chAttr = SCE_C_IDENTIFIER; if (isdigit(s[0]) || (s[0] == '.') || (s[0] == 'v')) { chAttr = SCE_C_NUMBER; char *p = s + 1; while (*p) { if ((!isdigit(*p) && (*p) != 'v') && isCOBOLwordchar(*p)) { chAttr = SCE_C_IDENTIFIER; break; } ++p; } } if (chAttr == SCE_C_IDENTIFIER) { WordList& a_keywords = *keywordlists[0]; WordList& b_keywords = *keywordlists[1]; WordList& c_keywords = *keywordlists[2]; if (a_keywords.InList(s)) { chAttr = SCE_C_WORD; } else if (b_keywords.InList(s)) { chAttr = SCE_C_WORD2; } else if (c_keywords.InList(s)) { chAttr = SCE_C_UUID; } } if (*bAarea) { if (strcmp(s, "division") == 0) { ret = IN_DIVISION; // we've determined the containment, anything else is just ignored for those purposes *bAarea = false; } else if (strcmp(s, "declaratives") == 0) { ret = IN_DIVISION | IN_DECLARATIVES; if (nContainment & IN_DECLARATIVES) ret |= NOT_HEADER | IN_SECTION; // we've determined the containment, anything else is just ignored for those purposes *bAarea = false; } else if (strcmp(s, "section") == 0) { ret = (nContainment &~ IN_PARAGRAPH) | IN_SECTION; // we've determined the containment, anything else is just ignored for those purposes *bAarea = false; } else if (strcmp(s, "end") == 0 && (nContainment & IN_DECLARATIVES)) { ret = IN_DIVISION | IN_DECLARATIVES | IN_SECTION | NOT_HEADER; } else { ret = nContainment | IN_PARAGRAPH; } } ColourTo(styler, end, chAttr); return ret; } static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { styler.StartAt(startPos); int state = initStyle; if (state == SCE_C_CHARACTER) // Does not leak onto next line state = SCE_C_DEFAULT; char chPrev = ' '; char chNext = styler[startPos]; Sci_PositionU lengthDoc = startPos + length; int nContainment; Sci_Position currentLine = styler.GetLine(startPos); if (currentLine > 0) { styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); nContainment = styler.GetLineState(currentLine); nContainment &= ~NOT_HEADER; } else { styler.SetLineState(currentLine, 0); nContainment = 0; } styler.StartSegment(startPos); bool bNewLine = true; bool bAarea = !isspacechar(chNext); int column = 0; for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); ++column; if (bNewLine) { column = 0; } if (column <= 1 && !bAarea) { bAarea = !isspacechar(ch); } bool bSetNewLine = false; if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix) // Avoid triggering two times on Dos/Win // End of line if (state == SCE_C_CHARACTER) { ColourTo(styler, i, state); state = SCE_C_DEFAULT; } styler.SetLineState(currentLine, nContainment); currentLine++; bSetNewLine = true; if (nContainment & NOT_HEADER) nContainment &= ~(NOT_HEADER | IN_DECLARATIVES | IN_SECTION); } if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); chPrev = ' '; i += 1; continue; } if (state == SCE_C_DEFAULT) { if (isCOBOLwordstart(ch) || (ch == '$' && IsASCII(chNext) && isalpha(chNext))) { ColourTo(styler, i-1, state); state = SCE_C_IDENTIFIER; } else if (column == 6 && (ch == '*' || ch == '/')) { // Cobol comment line: asterisk in column 7. ColourTo(styler, i-1, state); state = SCE_C_COMMENTLINE; } else if (ch == '*' && chNext == '>') { // Cobol inline comment: asterisk, followed by greater than. ColourTo(styler, i-1, state); state = SCE_C_COMMENTLINE; } else if (column == 0 && ch == '*' && chNext != '*') { ColourTo(styler, i-1, state); state = SCE_C_COMMENTLINE; } else if (column == 0 && ch == '/' && chNext != '*') { ColourTo(styler, i-1, state); state = SCE_C_COMMENTLINE; } else if (column == 0 && ch == '*' && chNext == '*') { ColourTo(styler, i-1, state); state = SCE_C_COMMENTDOC; } else if (column == 0 && ch == '/' && chNext == '*') { ColourTo(styler, i-1, state); state = SCE_C_COMMENTDOC; } else if (ch == '"') { ColourTo(styler, i-1, state); state = SCE_C_STRING; } else if (ch == '\'') { ColourTo(styler, i-1, state); state = SCE_C_CHARACTER; } else if (ch == '?' && column == 0) { ColourTo(styler, i-1, state); state = SCE_C_PREPROCESSOR; } else if (isCOBOLoperator(ch)) { ColourTo(styler, i-1, state); ColourTo(styler, i, SCE_C_OPERATOR); } } else if (state == SCE_C_IDENTIFIER) { if (!isCOBOLwordchar(ch)) { int lStateChange = classifyWordCOBOL(styler.GetStartSegment(), i - 1, keywordlists, styler, nContainment, &bAarea); if(lStateChange != 0) { styler.SetLineState(currentLine, lStateChange); nContainment = lStateChange; } state = SCE_C_DEFAULT; chNext = styler.SafeGetCharAt(i + 1); if (column == 6 && (ch == '*' || ch == '/')) { state = SCE_C_COMMENTLINE; } else if (ch == '"') { state = SCE_C_STRING; } else if (ch == '\'') { state = SCE_C_CHARACTER; } else if (isCOBOLoperator(ch)) { ColourTo(styler, i, SCE_C_OPERATOR); } } } else { if (state == SCE_C_PREPROCESSOR) { if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) { ColourTo(styler, i-1, state); state = SCE_C_DEFAULT; } } else if (state == SCE_C_COMMENT) { if (ch == '\r' || ch == '\n') { ColourTo(styler, i-1, state); state = SCE_C_DEFAULT; } } else if (state == SCE_C_COMMENTDOC) { if (ch == '\r' || ch == '\n') { if (((i > styler.GetStartSegment() + 2) || ( (initStyle == SCE_C_COMMENTDOC) && (styler.GetStartSegment() == static_cast(startPos))))) { ColourTo(styler, i-1, state); state = SCE_C_DEFAULT; } } } else if (state == SCE_C_COMMENTLINE) { if (ch == '\r' || ch == '\n') { ColourTo(styler, i-1, state); state = SCE_C_DEFAULT; } } else if (state == SCE_C_STRING) { if (ch == '"') { ColourTo(styler, i, state); state = SCE_C_DEFAULT; } else if (ch == '\r' || ch == '\n') { ColourTo(styler, i-1, state); state = SCE_C_DEFAULT; } } else if (state == SCE_C_CHARACTER) { if (ch == '\'') { ColourTo(styler, i, state); state = SCE_C_DEFAULT; } } } chPrev = ch; bNewLine = bSetNewLine; if (bNewLine) { bAarea = false; } } ColourTo(styler, lengthDoc - 1, state); } static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF; char chNext = styler[startPos]; bool bNewLine = true; bool bAarea = !isspacechar(chNext); int column = 0; bool bComment = false; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); ++column; if (bNewLine) { column = 0; bComment = (ch == '*' || ch == '/' || ch == '?'); } if (column <= 1 && !bAarea) { bAarea = !isspacechar(ch); } bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (atEOL) { int nContainment = styler.GetLineState(lineCurrent); int lev = CountBits(nContainment & IN_FLAGS) | SC_FOLDLEVELBASE; if (bAarea && !bComment) --lev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((bAarea) && (visibleChars > 0) && !(nContainment & NOT_HEADER) && !bComment) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } if ((lev & SC_FOLDLEVELNUMBERMASK) <= (levelPrev & SC_FOLDLEVELNUMBERMASK)) { // this level is at the same level or less than the previous line // therefore these is nothing for the previous header to collapse, so remove the header styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG); } levelPrev = lev; visibleChars = 0; bAarea = false; bNewLine = true; lineCurrent++; } else { bNewLine = false; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const COBOLWordListDesc[] = { "A Keywords", "B Keywords", "Extended Keywords", 0 }; LexerModule lmCOBOL(SCLEX_COBOL, ColouriseCOBOLDoc, "COBOL", FoldCOBOLDoc, COBOLWordListDesc); ================================================ FILE: lexilla/lexers/LexCPP.cxx ================================================ // Scintilla source code edit control /** @file LexCPP.cxx ** Lexer for C++, C, Java, and JavaScript. ** Further folding features and configuration properties added by "Udo Lechner" **/ // Copyright 1998-2005 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "StringCopy.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "SparseState.h" #include "SubStyles.h" using namespace Scintilla; using namespace Lexilla; namespace { // Use an unnamed namespace to protect the functions and classes from name conflicts constexpr bool IsSpaceEquiv(int state) noexcept { return (state <= SCE_C_COMMENTDOC) || // including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE (state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) || (state == SCE_C_COMMENTDOCKEYWORDERROR); } // Preconditions: sc.currentPos points to a character after '+' or '-'. // The test for pos reaching 0 should be redundant, // and is in only for safety measures. // Limitation: this code will give the incorrect answer for code like // a = b+++/ptn/... // Putting a space between the '++' post-inc operator and the '+' binary op // fixes this, and is highly recommended for readability anyway. bool FollowsPostfixOperator(const StyleContext &sc, LexAccessor &styler) { Sci_Position pos = sc.currentPos; while (--pos > 0) { const char ch = styler[pos]; if (ch == '+' || ch == '-') { return styler[pos - 1] == ch; } } return false; } bool followsReturnKeyword(const StyleContext &sc, LexAccessor &styler) { // Don't look at styles, so no need to flush. Sci_Position pos = sc.currentPos; const Sci_Position currentLine = styler.GetLine(pos); const Sci_Position lineStartPos = styler.LineStart(currentLine); while (--pos > lineStartPos) { const char ch = styler.SafeGetCharAt(pos); if (ch != ' ' && ch != '\t') { break; } } const char *retBack = "nruter"; const char *s = retBack; while (*s && pos >= lineStartPos && styler.SafeGetCharAt(pos) == *s) { s++; pos--; } return !*s; } constexpr bool IsOperatorOrSpace(int ch) noexcept { return isoperator(ch) || IsASpace(ch); } bool OnlySpaceOrTab(std::string_view s) noexcept { for (const char ch : s) { if (!IsASpaceOrTab(ch)) return false; } return true; } using Tokens = std::vector; Tokens StringSplit(const std::string &text, int separator) { Tokens vs(text.empty() ? 0 : 1); for (const char ch : text) { if (ch == separator) { vs.emplace_back(); } else { vs.back() += ch; } } return vs; } struct BracketPair { Tokens::iterator itBracket; Tokens::iterator itEndBracket; }; BracketPair FindBracketPair(Tokens &tokens) { const Tokens::iterator itBracket = std::find(tokens.begin(), tokens.end(), "("); if (itBracket != tokens.end()) { size_t nest = 0; for (Tokens::iterator itTok = itBracket; itTok != tokens.end(); ++itTok) { if (*itTok == "(") { nest++; } else if (*itTok == ")") { nest--; if (nest == 0) { return { itBracket, itTok }; } } } } return { tokens.end(), tokens.end() }; } void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, int activity, const WordList &markerList, bool caseSensitive) { if (IsOperatorOrSpace(sc.chPrev) && !IsOperatorOrSpace(sc.ch) && markerList.Length()) { std::string marker; for (Sci_PositionU currPos = sc.currentPos; true; currPos++) { const char ch = styler.SafeGetCharAt(currPos); if (IsOperatorOrSpace(ch)) { break; } if (caseSensitive) marker.push_back(ch); else marker.push_back(MakeLowerCase(ch)); } if (markerList.InList(marker)) { sc.SetState(SCE_C_TASKMARKER|activity); } } } const CharacterSet setHexDigits(CharacterSet::setDigits, "ABCDEFabcdef"); const CharacterSet setOctDigits("01234567"); const CharacterSet setNoneNumeric; class EscapeSequence { const CharacterSet *escapeSetValid = nullptr; int digitsLeft = 0; public: int outerState = SCE_C_DEFAULT; EscapeSequence() = default; void resetEscapeState(int state, int nextChar) noexcept { digitsLeft = 0; outerState = state; escapeSetValid = &setNoneNumeric; if (nextChar == 'U') { digitsLeft = 9; escapeSetValid = &setHexDigits; } else if (nextChar == 'u') { digitsLeft = 5; escapeSetValid = &setHexDigits; } else if (nextChar == 'x') { digitsLeft = 5; escapeSetValid = &setHexDigits; } else if (setOctDigits.Contains(nextChar)) { digitsLeft = 3; escapeSetValid = &setOctDigits; } } [[nodiscard]] bool atEscapeEnd(int currChar) const noexcept { return (digitsLeft <= 0) || !escapeSetValid->Contains(currChar); } void consumeDigit() noexcept { digitsLeft--; } }; std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) { std::string restOfLine; Sci_Position line = styler.GetLine(start); Sci_Position pos = start; Sci_Position endLine = styler.LineEnd(line); char ch = styler.SafeGetCharAt(start, '\n'); while (pos < endLine) { if (ch == '\\' && ((pos + 1) == endLine)) { // Continuation line line++; pos = styler.LineStart(line); endLine = styler.LineEnd(line); ch = styler.SafeGetCharAt(pos, '\n'); } else { const char chNext = styler.SafeGetCharAt(pos + 1, '\n'); if (ch == '/' && (chNext == '/' || chNext == '*')) break; if (allowSpace || (ch != ' ')) { restOfLine += ch; } pos++; ch = chNext; } } return restOfLine; } constexpr bool IsStreamCommentStyle(int style) noexcept { return style == SCE_C_COMMENT || style == SCE_C_COMMENTDOC || style == SCE_C_COMMENTDOCKEYWORD || style == SCE_C_COMMENTDOCKEYWORDERROR; } struct PPDefinition { Sci_Position line; std::string key; std::string value; bool isUndef; std::string arguments; PPDefinition(Sci_Position line_, std::string_view key_, std::string_view value_, bool isUndef_, std::string_view arguments_) : line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) { } }; constexpr int inactiveFlag = 0x40; class LinePPState { // Track the state of preprocessor conditionals to allow showing active and inactive // code in different styles. // Only works up to 31 levels of conditional nesting. // state is a bit mask with 1 bit per level // bit is 1 for level if section inactive, so any bits set = inactive style int state = 0; // ifTaken is a bit mask with 1 bit per level // bit is 1 for level if some branch at this level has been taken int ifTaken = 0; // level is the nesting level of #if constructs int level = -1; static const int maximumNestingLevel = 31; [[nodiscard]] int maskLevel() const noexcept { if (level >= 0) { return 1 << level; } return 1; } public: LinePPState() noexcept = default; [[nodiscard]] bool ValidLevel() const noexcept { return level >= 0 && level < maximumNestingLevel; } [[nodiscard]] bool IsActive() const noexcept { return state == 0; } [[nodiscard]] bool IsInactive() const noexcept { return state != 0; } [[nodiscard]] int ActiveState() const noexcept { return state ? inactiveFlag : 0; } [[nodiscard]] bool CurrentIfTaken() const noexcept { return (ifTaken & maskLevel()) != 0; } void StartSection(bool on) noexcept { level++; if (ValidLevel()) { if (on) { state &= ~maskLevel(); ifTaken |= maskLevel(); } else { state |= maskLevel(); ifTaken &= ~maskLevel(); } } } void EndSection() noexcept { if (ValidLevel()) { state &= ~maskLevel(); ifTaken &= ~maskLevel(); } level--; } void InvertCurrentLevel() noexcept { if (ValidLevel()) { state ^= maskLevel(); ifTaken |= maskLevel(); } } }; // Hold the preprocessor state for each line seen. // Currently one entry per line but could become sparse with just one entry per preprocessor line. class PPStates { std::vector vlls; public: [[nodiscard]] LinePPState ForLine(Sci_Position line) const noexcept { if ((line > 0) && (vlls.size() > static_cast(line))) { return vlls[line]; } return {}; } void Add(Sci_Position line, LinePPState lls) { vlls.resize(line+1); vlls[line] = lls; } }; enum class BackQuotedString : int { None, RawString, TemplateLiteral, }; // string interpolating state struct InterpolatingState { int state; int braceCount; }; struct Definition { std::string_view name; std::string_view value; std::string_view arguments; }; constexpr std::string_view TrimSpaceTab(std::string_view sv) noexcept { while (!sv.empty() && IsASpaceOrTab(sv.front())) { sv.remove_prefix(1); } return sv; } // Parse a macro definition, either from a #define line in a file or from keywords. // Either an object macro or a function macro () . // VALUE is optional and is treated as "1" if missing. // #define ALLOW_PRINT // #define VERSION 37 // #define VER(a,b) a*10+b // Whitespace separates macro and value in files but keywords use '=' separator. // 'endName' contains a set of characters that terminate the name of the macro. constexpr Definition ParseDefine(std::string_view definition, std::string_view endName) { Definition ret; definition = TrimSpaceTab(definition); const size_t afterName = definition.find_first_of(endName); if (afterName != std::string_view::npos) { ret.name = definition.substr(0, afterName); if (definition.at(afterName) == '(') { // Macro definition.remove_prefix(afterName+1); const size_t closeBracket = definition.find(')'); if (closeBracket != std::string_view::npos) { ret.arguments = definition.substr(0, closeBracket); definition.remove_prefix(closeBracket+1); if (!definition.empty() && (endName.find(definition.front()) != std::string_view::npos)) { definition.remove_prefix(1); } ret.value = definition; } // else malformed as requires closing bracket } else { ret.value = definition.substr(afterName+1); } } else { ret.name = definition; ret.value = "1"; } return ret; } // An individual named option for use in an OptionSet // Options used for LexerCPP struct OptionsCPP { bool stylingWithinPreprocessor = false; bool identifiersAllowDollars = true; bool trackPreprocessor = true; bool updatePreprocessor = true; bool verbatimStringsAllowEscapes = false; bool triplequotedStrings = false; bool hashquotedStrings = false; BackQuotedString backQuotedStrings = BackQuotedString::None; bool escapeSequence = false; bool fold = false; bool foldSyntaxBased = true; bool foldComment = false; bool foldCommentMultiline = true; bool foldCommentExplicit = true; std::string foldExplicitStart; std::string foldExplicitEnd; bool foldExplicitAnywhere = false; bool foldPreprocessor = false; bool foldPreprocessorAtElse = false; bool foldCompact = false; bool foldAtElse = false; }; const char *const cppWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", "Documentation comment keywords", "Global classes and typedefs", "Preprocessor definitions", "Task marker and error marker keywords", nullptr, }; struct OptionSetCPP : public OptionSet { OptionSetCPP() { DefineProperty("styling.within.preprocessor", &OptionsCPP::stylingWithinPreprocessor, "For C++ code, determines whether all preprocessor code is styled in the " "preprocessor style (0, the default) or only from the initial # to the end " "of the command word(1)."); DefineProperty("lexer.cpp.allow.dollars", &OptionsCPP::identifiersAllowDollars, "Set to 0 to disallow the '$' character in identifiers with the cpp lexer."); DefineProperty("lexer.cpp.track.preprocessor", &OptionsCPP::trackPreprocessor, "Set to 1 to interpret #if/#else/#endif to grey out code that is not active."); DefineProperty("lexer.cpp.update.preprocessor", &OptionsCPP::updatePreprocessor, "Set to 1 to update preprocessor definitions when #define found."); DefineProperty("lexer.cpp.verbatim.strings.allow.escapes", &OptionsCPP::verbatimStringsAllowEscapes, "Set to 1 to allow verbatim strings to contain escape sequences."); DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings, "Set to 1 to enable highlighting of triple-quoted strings."); DefineProperty("lexer.cpp.hashquoted.strings", &OptionsCPP::hashquotedStrings, "Set to 1 to enable highlighting of hash-quoted strings."); DefineProperty("lexer.cpp.backquoted.strings", &OptionsCPP::backQuotedStrings, "Set how to highlighting back-quoted strings. " "0 (the default) no highlighting. " "1 highlighted as Go raw string. " "2 highlighted as JavaScript template literal."); DefineProperty("lexer.cpp.escape.sequence", &OptionsCPP::escapeSequence, "Set to 1 to enable highlighting of escape sequences in strings"); DefineProperty("fold", &OptionsCPP::fold); DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased, "Set this property to 0 to disable syntax based folding."); DefineProperty("fold.comment", &OptionsCPP::foldComment, "This option enables folding multi-line comments and explicit fold points when using the C++ lexer. " "Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} " "at the end of a section that should fold."); DefineProperty("fold.cpp.comment.multiline", &OptionsCPP::foldCommentMultiline, "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); DefineProperty("fold.cpp.comment.explicit", &OptionsCPP::foldCommentExplicit, "Set this property to 0 to disable folding explicit fold points when fold.comment=1."); DefineProperty("fold.cpp.explicit.start", &OptionsCPP::foldExplicitStart, "The string to use for explicit fold start points, replacing the standard //{."); DefineProperty("fold.cpp.explicit.end", &OptionsCPP::foldExplicitEnd, "The string to use for explicit fold end points, replacing the standard //}."); DefineProperty("fold.cpp.explicit.anywhere", &OptionsCPP::foldExplicitAnywhere, "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); DefineProperty("fold.cpp.preprocessor.at.else", &OptionsCPP::foldPreprocessorAtElse, "This option enables folding on a preprocessor #else or #endif line of an #if statement."); DefineProperty("fold.preprocessor", &OptionsCPP::foldPreprocessor, "This option enables folding preprocessor directives when using the C++ lexer. " "Includes C#'s explicit #region and #endregion folding directives."); DefineProperty("fold.compact", &OptionsCPP::foldCompact); DefineProperty("fold.at.else", &OptionsCPP::foldAtElse, "This option enables C++ folding on a \"} else {\" line of an if statement."); DefineWordListSets(cppWordLists); } }; const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0}; LexicalClass lexicalClasses[] = { // Lexer Cpp SCLEX_CPP SCE_C_: 0, "SCE_C_DEFAULT", "default", "White space", 1, "SCE_C_COMMENT", "comment", "Comment: /* */.", 2, "SCE_C_COMMENTLINE", "comment line", "Line Comment: //.", 3, "SCE_C_COMMENTDOC", "comment documentation", "Doc comment: block comments beginning with /** or /*!", 4, "SCE_C_NUMBER", "literal numeric", "Number", 5, "SCE_C_WORD", "keyword", "Keyword", 6, "SCE_C_STRING", "literal string", "Double quoted string", 7, "SCE_C_CHARACTER", "literal string character", "Single quoted string", 8, "SCE_C_UUID", "literal uuid", "UUIDs (only in IDL)", 9, "SCE_C_PREPROCESSOR", "preprocessor", "Preprocessor", 10, "SCE_C_OPERATOR", "operator", "Operators", 11, "SCE_C_IDENTIFIER", "identifier", "Identifiers", 12, "SCE_C_STRINGEOL", "error literal string", "End of line where string is not closed", 13, "SCE_C_VERBATIM", "literal string multiline raw", "Verbatim strings for C#", 14, "SCE_C_REGEX", "literal regex", "Regular expressions for JavaScript", 15, "SCE_C_COMMENTLINEDOC", "comment documentation line", "Doc Comment Line: line comments beginning with /// or //!.", 16, "SCE_C_WORD2", "identifier", "Keywords2", 17, "SCE_C_COMMENTDOCKEYWORD", "comment documentation keyword", "Comment keyword", 18, "SCE_C_COMMENTDOCKEYWORDERROR", "error comment documentation keyword", "Comment keyword error", 19, "SCE_C_GLOBALCLASS", "identifier", "Global class", 20, "SCE_C_STRINGRAW", "literal string multiline raw", "Raw strings for C++0x", 21, "SCE_C_TRIPLEVERBATIM", "literal string multiline raw", "Triple-quoted strings for Vala", 22, "SCE_C_HASHQUOTEDSTRING", "literal string", "Hash-quoted strings for Pike", 23, "SCE_C_PREPROCESSORCOMMENT", "comment preprocessor", "Preprocessor stream comment", 24, "SCE_C_PREPROCESSORCOMMENTDOC", "comment preprocessor documentation", "Preprocessor stream doc comment", 25, "SCE_C_USERLITERAL", "literal", "User defined literals", 26, "SCE_C_TASKMARKER", "comment taskmarker", "Task Marker", 27, "SCE_C_ESCAPESEQUENCE", "literal string escapesequence", "Escape sequence", }; const int sizeLexicalClasses = static_cast(std::size(lexicalClasses)); } class LexerCPP : public ILexer5 { bool caseSensitive; CharacterSet setWord; CharacterSet setNegationOp; CharacterSet setAddOp; CharacterSet setMultOp; CharacterSet setRelOp; CharacterSet setLogicalOp; CharacterSet setWordStart; PPStates vlls; std::vector ppDefineHistory; std::map> interpolatingAtEol; WordList keywords; WordList keywords2; WordList keywords3; WordList keywords4; WordList ppDefinitions; WordList markerList; struct SymbolValue { std::string value; std::string arguments; SymbolValue() noexcept = default; SymbolValue(std::string_view value_, std::string_view arguments_) : value(value_), arguments(arguments_) { } SymbolValue &operator = (const std::string &value_) { value = value_; arguments.clear(); return *this; } [[nodiscard]] bool IsMacro() const noexcept { return !arguments.empty(); } }; using SymbolTable = std::map; SymbolTable preprocessorDefinitionsStart; OptionsCPP options; OptionSetCPP osCPP; EscapeSequence escapeSeq; SparseState rawStringTerminators; enum { ssIdentifier, ssDocKeyword }; SubStyles subStyles{ styleSubable, SubStylesFirst, SubStylesAvailable, inactiveFlag }; std::string returnBuffer; public: explicit LexerCPP(bool caseSensitive_) : caseSensitive(caseSensitive_), setWord(CharacterSet::setAlphaNum, "._", true), setNegationOp("!"), setAddOp("+-"), setMultOp("*/%"), setRelOp("=!<>"), setLogicalOp("|&") { } // Deleted so LexerCPP objects can not be copied. LexerCPP(const LexerCPP &) = delete; LexerCPP(LexerCPP &&) = delete; void operator=(const LexerCPP &) = delete; void operator=(LexerCPP &&) = delete; virtual ~LexerCPP() = default; void SCI_METHOD Release() noexcept override { delete this; } int SCI_METHOD Version() const noexcept override { return lvRelease5; } const char *SCI_METHOD PropertyNames() override { return osCPP.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osCPP.PropertyType(name); } const char *SCI_METHOD DescribeProperty(const char *name) override { return osCPP.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char *SCI_METHOD DescribeWordListSets() override { return osCPP.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void *SCI_METHOD PrivateCall(int, void *) noexcept override { return nullptr; } int SCI_METHOD LineEndTypesSupported() noexcept override { return SC_LINE_END_TYPE_UNICODE; } int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override { return subStyles.Allocate(styleBase, numberStyles); } int SCI_METHOD SubStylesStart(int styleBase) override { return subStyles.Start(styleBase); } int SCI_METHOD SubStylesLength(int styleBase) override { return subStyles.Length(styleBase); } int SCI_METHOD StyleFromSubStyle(int subStyle) override { const int styleBase = subStyles.BaseStyle(MaskActive(subStyle)); const int inactive = subStyle & inactiveFlag; return styleBase | inactive; } int SCI_METHOD PrimaryStyleFromStyle(int style) noexcept override { return MaskActive(style); } void SCI_METHOD FreeSubStyles() override { subStyles.Free(); } void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override { subStyles.SetIdentifiers(style, identifiers); } int SCI_METHOD DistanceToSecondaryStyles() noexcept override { return inactiveFlag; } const char *SCI_METHOD GetSubStyleBases() noexcept override { return styleSubable; } int SCI_METHOD NamedStyles() override { return std::max(subStyles.LastAllocated() + 1, sizeLexicalClasses) + inactiveFlag; } const char *SCI_METHOD NameOfStyle(int style) override { if (style >= NamedStyles()) return ""; if (style < sizeLexicalClasses) return lexicalClasses[style].name; // TODO: inactive and substyles return ""; } const char *SCI_METHOD TagsOfStyle(int style) override { if (style >= NamedStyles()) return "Excess"; returnBuffer.clear(); const int firstSubStyle = subStyles.FirstAllocated(); if (firstSubStyle >= 0) { const int lastSubStyle = subStyles.LastAllocated(); if (((style >= firstSubStyle) && (style <= (lastSubStyle))) || ((style >= firstSubStyle + inactiveFlag) && (style <= (lastSubStyle + inactiveFlag)))) { int styleActive = style; if (style > lastSubStyle) { returnBuffer = "inactive "; styleActive -= inactiveFlag; } const int styleMain = StyleFromSubStyle(styleActive); returnBuffer += lexicalClasses[styleMain].tags; return returnBuffer.c_str(); } } if (style < sizeLexicalClasses) return lexicalClasses[style].tags; if (style >= inactiveFlag) { returnBuffer = "inactive "; const int styleActive = style - inactiveFlag; if (styleActive < sizeLexicalClasses) returnBuffer += lexicalClasses[styleActive].tags; else returnBuffer.clear(); return returnBuffer.c_str(); } return ""; } const char *SCI_METHOD DescriptionOfStyle(int style) override { if (style >= NamedStyles()) return ""; if (style < sizeLexicalClasses) return lexicalClasses[style].description; // TODO: inactive and substyles return ""; } // ILexer5 methods const char *SCI_METHOD GetName() override { return caseSensitive ? "cpp" : "cppnocase"; } int SCI_METHOD GetIdentifier() override { return caseSensitive ? SCLEX_CPP : SCLEX_CPPNOCASE; } const char *SCI_METHOD PropertyGet(const char *key) override; static ILexer5 *LexerFactoryCPP() { return new LexerCPP(true); } static ILexer5 *LexerFactoryCPPInsensitive() { return new LexerCPP(false); } constexpr static int MaskActive(int style) noexcept { return style & ~inactiveFlag; } void EvaluateTokens(Tokens &tokens, const SymbolTable &preprocessorDefinitions); [[nodiscard]] Tokens Tokenize(const std::string &expr) const; bool EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions); }; Sci_Position SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) { if (osCPP.PropertySet(&options, key, val)) { if (strcmp(key, "lexer.cpp.allow.dollars") == 0) { setWord = CharacterSet(CharacterSet::setAlphaNum, "._", true); if (options.identifiersAllowDollars) { setWord.Add('$'); } } return 0; } return -1; } const char *SCI_METHOD LexerCPP::PropertyGet(const char *key) { return osCPP.PropertyGet(key); } Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { WordList *wordListN = nullptr; switch (n) { case 0: wordListN = &keywords; break; case 1: wordListN = &keywords2; break; case 2: wordListN = &keywords3; break; case 3: wordListN = &keywords4; break; case 4: wordListN = &ppDefinitions; break; case 5: wordListN = &markerList; break; default: break; } Sci_Position firstModification = -1; if (wordListN) { if (wordListN->Set(wl)) { firstModification = 0; if (n == 4) { // Rebuild preprocessorDefinitions preprocessorDefinitionsStart.clear(); for (int nDefinition = 0; nDefinition < ppDefinitions.Length(); nDefinition++) { const Definition def = ParseDefine(ppDefinitions.WordAt(nDefinition), "(="); preprocessorDefinitionsStart[std::string(def.name)] = SymbolValue(def.value, def.arguments); } } } } return firstModification; } void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); const StyleContext::Transform transform = caseSensitive ? StyleContext::Transform::none : StyleContext::Transform::lower; const CharacterSet setOKBeforeRE("([{=,:;!%^&*|?~+-"); const CharacterSet setCouldBePostOp("+-"); const CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); setWordStart = CharacterSet(CharacterSet::setAlpha, "_", true); const CharacterSet setInvalidRawFirst(" )\\\t\v\f\n"); if (options.identifiersAllowDollars) { setWordStart.Add('$'); } int chPrevNonWhite = ' '; int visibleChars = 0; bool lastWordWasUUID = false; int styleBeforeDCKeyword = SCE_C_DEFAULT; int styleBeforeTaskMarker = SCE_C_DEFAULT; bool continuationLine = false; bool isIncludePreprocessor = false; bool isStringInPreprocessor = false; bool inRERange = false; bool seenDocKeyBrace = false; std::vector interpolatingStack; Sci_Position lineCurrent = styler.GetLine(startPos); if (options.backQuotedStrings == BackQuotedString::TemplateLiteral) { // code copied from LexPython auto it = interpolatingAtEol.find(lineCurrent - 1); if (it != interpolatingAtEol.end()) { interpolatingStack = it->second; } it = interpolatingAtEol.lower_bound(lineCurrent); if (it != interpolatingAtEol.end()) { interpolatingAtEol.erase(it, interpolatingAtEol.end()); } } if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || (MaskActive(initStyle) == SCE_C_COMMENTLINE) || (MaskActive(initStyle) == SCE_C_COMMENTLINEDOC)) { // Set continuationLine if last character of previous line is '\' if (lineCurrent > 0) { const Sci_Position endLinePrevious = styler.LineEnd(lineCurrent - 1); if (endLinePrevious > 0) { continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\'; } } } // look back to set chPrevNonWhite properly for better regex colouring if (startPos > 0) { Sci_Position back = startPos; while (--back && IsSpaceEquiv(MaskActive(styler.StyleAt(back)))) ; if (MaskActive(styler.StyleAt(back)) == SCE_C_OPERATOR) { chPrevNonWhite = styler.SafeGetCharAt(back); } } StyleContext sc(startPos, length, initStyle, styler); LinePPState preproc = vlls.ForLine(lineCurrent); bool definitionsChanged = false; // Truncate ppDefineHistory before current line if (!options.updatePreprocessor) ppDefineHistory.clear(); const std::vector::iterator itInvalid = std::find_if( ppDefineHistory.begin(), ppDefineHistory.end(), [lineCurrent](const PPDefinition &p) noexcept { return p.line >= lineCurrent; }); if (itInvalid != ppDefineHistory.end()) { ppDefineHistory.erase(itInvalid, ppDefineHistory.end()); definitionsChanged = true; } SymbolTable preprocessorDefinitions = preprocessorDefinitionsStart; for (const PPDefinition &ppDef : ppDefineHistory) { if (ppDef.isUndef) preprocessorDefinitions.erase(ppDef.key); else preprocessorDefinitions[ppDef.key] = SymbolValue(ppDef.value, ppDef.arguments); } std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1); SparseState rawSTNew(lineCurrent); std::string currentText; int activitySet = preproc.ActiveState(); const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER); const WordClassifier &classifierDocKeyWords = subStyles.Classifier(SCE_C_COMMENTDOCKEYWORD); Sci_PositionU lineEndNext = styler.LineEnd(lineCurrent); for (; sc.More();) { if (sc.atLineStart) { // Using MaskActive() is not needed in the following statement. // Inside inactive preprocessor declaration, state will be reset anyway at the end of this block. if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) { // Prevent SCE_C_STRINGEOL from leaking back to previous line which // ends with a line continuation by locking in the state up to this position. sc.SetState(sc.state); } if ((MaskActive(sc.state) == SCE_C_PREPROCESSOR) && (!continuationLine)) { sc.SetState(SCE_C_DEFAULT|activitySet); } // Reset states to beginning of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; lastWordWasUUID = false; isIncludePreprocessor = false; inRERange = false; if (preproc.IsInactive()) { activitySet = inactiveFlag; sc.SetState(sc.state | activitySet); } } if (sc.atLineEnd) { lineCurrent++; lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); if (!rawStringTerminator.empty()) { rawSTNew.Set(lineCurrent-1, rawStringTerminator); } if (!interpolatingStack.empty()) { interpolatingAtEol[sc.currentLine] = interpolatingStack; } } // Handle line continuation generically. if (sc.ch == '\\') { if ((sc.currentPos+1) >= lineEndNext) { lineCurrent++; lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); if (!rawStringTerminator.empty()) { rawSTNew.Set(lineCurrent-1, rawStringTerminator); } sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { // Even in UTF-8, \r and \n are separate sc.Forward(); } continuationLine = true; sc.Forward(); continue; } } const bool atLineEndBeforeSwitch = sc.atLineEnd; // Determine if the current state should terminate. switch (MaskActive(sc.state)) { case SCE_C_OPERATOR: sc.SetState(SCE_C_DEFAULT|activitySet); break; case SCE_C_NUMBER: // We accept almost anything because of hex. and number suffixes if (sc.ch == '_') { sc.ChangeState(SCE_C_USERLITERAL|activitySet); } else if (!(setWord.Contains(sc.ch) || (sc.ch == '\'') || (AnyOf(sc.chPrev, 'e', 'E', 'p', 'P') && AnyOf(sc.ch, '+', '-')))) { sc.SetState(SCE_C_DEFAULT|activitySet); } break; case SCE_C_USERLITERAL: if (!(setWord.Contains(sc.ch))) sc.SetState(SCE_C_DEFAULT|activitySet); break; case SCE_C_IDENTIFIER: if (sc.atLineStart || sc.atLineEnd || !setWord.Contains(sc.ch) || (sc.ch == '.')) { sc.GetCurrentString(currentText, transform); if (keywords.InList(currentText)) { lastWordWasUUID = currentText == "uuid"; sc.ChangeState(SCE_C_WORD|activitySet); } else if (keywords2.InList(currentText)) { sc.ChangeState(SCE_C_WORD2|activitySet); } else if (keywords4.InList(currentText)) { sc.ChangeState(SCE_C_GLOBALCLASS|activitySet); } else { const int subStyle = classifierIdentifiers.ValueFor(currentText); if (subStyle >= 0) { sc.ChangeState(subStyle|activitySet); } } const bool literalString = sc.ch == '\"'; if (literalString || sc.ch == '\'') { std::string_view s = currentText; size_t lenS = s.length(); const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext); if (raw) { s.remove_suffix(1); lenS--; } const bool valid = (lenS == 0) || ((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) || ((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8')); if (valid) { if (literalString) { if (raw) { // Set the style of the string prefix to SCE_C_STRINGRAW but then change to // SCE_C_DEFAULT as that allows the raw string start code to run. sc.ChangeState(SCE_C_STRINGRAW|activitySet); sc.SetState(SCE_C_DEFAULT|activitySet); } else { sc.ChangeState(SCE_C_STRING|activitySet); } } else { sc.ChangeState(SCE_C_CHARACTER|activitySet); } } else { sc.SetState(SCE_C_DEFAULT | activitySet); } } else { sc.SetState(SCE_C_DEFAULT|activitySet); } } break; case SCE_C_PREPROCESSOR: if (options.stylingWithinPreprocessor) { if (IsASpace(sc.ch) || (sc.ch == '(')) { sc.SetState(SCE_C_DEFAULT|activitySet); } } else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"') || sc.atLineEnd)) { isStringInPreprocessor = false; } else if (!isStringInPreprocessor) { if ((isIncludePreprocessor && sc.Match('<')) || sc.Match('\"')) { isStringInPreprocessor = true; } else if (sc.Match('/', '*')) { if (sc.Match("/**") || sc.Match("/*!")) { sc.SetState(SCE_C_PREPROCESSORCOMMENTDOC|activitySet); } else { sc.SetState(SCE_C_PREPROCESSORCOMMENT|activitySet); } sc.Forward(); // Eat the * } else if (sc.Match('/', '/')) { sc.SetState(SCE_C_DEFAULT|activitySet); } } break; case SCE_C_PREPROCESSORCOMMENT: case SCE_C_PREPROCESSORCOMMENTDOC: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_C_PREPROCESSOR|activitySet); continue; // Without advancing in case of '\'. } break; case SCE_C_COMMENT: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT|activitySet); } else { styleBeforeTaskMarker = SCE_C_COMMENT; highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive); } break; case SCE_C_COMMENTDOC: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT|activitySet); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = SCE_C_COMMENTDOC; sc.SetState(SCE_C_COMMENTDOCKEYWORD|activitySet); } } else if ((sc.ch == '<' && sc.chNext != '/') || (sc.ch == '/' && sc.chPrev == '<')) { // XML comment style styleBeforeDCKeyword = SCE_C_COMMENTDOC; sc.ForwardSetState(SCE_C_COMMENTDOCKEYWORD | activitySet); } break; case SCE_C_COMMENTLINE: if (sc.atLineStart && !continuationLine) { sc.SetState(SCE_C_DEFAULT|activitySet); } else { styleBeforeTaskMarker = SCE_C_COMMENTLINE; highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive); } break; case SCE_C_COMMENTLINEDOC: if (sc.atLineStart && !continuationLine) { sc.SetState(SCE_C_DEFAULT|activitySet); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC; sc.SetState(SCE_C_COMMENTDOCKEYWORD|activitySet); } } else if ((sc.ch == '<' && sc.chNext != '/') || (sc.ch == '/' && sc.chPrev == '<')) { // XML comment style styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC; sc.ForwardSetState(SCE_C_COMMENTDOCKEYWORD | activitySet); } break; case SCE_C_COMMENTDOCKEYWORD: if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) { sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT|activitySet); seenDocKeyBrace = false; } else if (sc.ch == '[' || sc.ch == '{') { seenDocKeyBrace = true; } else if (!setDoxygen.Contains(sc.ch) && !(seenDocKeyBrace && AnyOf(sc.ch, ',', '.'))) { if (!(IsASpace(sc.ch) || (sc.ch == 0))) { sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet); } else { sc.GetCurrentString(currentText, transform); assert(!currentText.empty()); const std::string currentSuffix = currentText.substr(1); if (!keywords3.InList(currentSuffix) && !keywords3.InList(currentText)) { const int subStyleCDKW = classifierDocKeyWords.ValueFor(currentSuffix); if (subStyleCDKW >= 0) { sc.ChangeState(subStyleCDKW | activitySet); } else { sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR | activitySet); } } } sc.SetState(styleBeforeDCKeyword|activitySet); seenDocKeyBrace = false; } else if (sc.ch == '>') { sc.GetCurrentString(currentText, transform); if (!keywords3.InList(currentText)) { const int subStyleCDKW = classifierDocKeyWords.ValueFor(currentText.substr(1)); if (subStyleCDKW >= 0) { sc.ChangeState(subStyleCDKW | activitySet); } else { sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR | activitySet); } } sc.SetState(styleBeforeDCKeyword | activitySet); seenDocKeyBrace = false; } break; case SCE_C_STRING: if (sc.atLineEnd) { sc.ChangeState(SCE_C_STRINGEOL|activitySet); } else if (isIncludePreprocessor) { if (sc.ch == '>') { sc.ForwardSetState(SCE_C_DEFAULT|activitySet); isIncludePreprocessor = false; } } else if (sc.ch == '\\') { if (options.escapeSequence) { escapeSeq.resetEscapeState(sc.state, sc.chNext); sc.SetState(SCE_C_ESCAPESEQUENCE|activitySet); } sc.Forward(); // Skip all characters after the backslash } else if (sc.ch == '\"') { if (sc.chNext == '_') { sc.ChangeState(SCE_C_USERLITERAL|activitySet); } else { sc.ForwardSetState(SCE_C_DEFAULT|activitySet); } } break; case SCE_C_ESCAPESEQUENCE: escapeSeq.consumeDigit(); if (escapeSeq.atEscapeEnd(sc.ch)) { sc.SetState(escapeSeq.outerState); continue; } break; case SCE_C_HASHQUOTEDSTRING: if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_C_DEFAULT|activitySet); } break; case SCE_C_STRINGRAW: if (sc.Match(rawStringTerminator.c_str())) { for (size_t termPos=rawStringTerminator.size(); termPos; termPos--) sc.Forward(); sc.SetState(SCE_C_DEFAULT|activitySet); if (interpolatingStack.empty()) { rawStringTerminator.clear(); } } else if (options.backQuotedStrings == BackQuotedString::TemplateLiteral) { if (sc.ch == '\\') { if (options.escapeSequence) { escapeSeq.resetEscapeState(sc.state, sc.chNext); sc.SetState(SCE_C_ESCAPESEQUENCE|activitySet); } sc.Forward(); // Skip all characters after the backslash } else if (sc.Match('$', '{')) { interpolatingStack.push_back({sc.state, 1}); sc.SetState(SCE_C_OPERATOR|activitySet); sc.Forward(); } } break; case SCE_C_CHARACTER: if (sc.atLineEnd) { sc.ChangeState(SCE_C_STRINGEOL|activitySet); } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { if (sc.chNext == '_') { sc.ChangeState(SCE_C_USERLITERAL|activitySet); } else { sc.ForwardSetState(SCE_C_DEFAULT|activitySet); } } break; case SCE_C_REGEX: if (sc.atLineStart) { sc.SetState(SCE_C_DEFAULT|activitySet); } else if (!inRERange && sc.ch == '/') { sc.Forward(); while (IsLowerCase(sc.ch)) sc.Forward(); // gobble regex flags sc.SetState(SCE_C_DEFAULT|activitySet); } else if (sc.ch == '\\' && ((sc.currentPos+1) < lineEndNext)) { // Gobble up the escaped character sc.Forward(); } else if (sc.ch == '[') { inRERange = true; } else if (sc.ch == ']') { inRERange = false; } break; case SCE_C_STRINGEOL: if (sc.atLineStart) { sc.SetState(SCE_C_DEFAULT|activitySet); } break; case SCE_C_VERBATIM: if (options.verbatimStringsAllowEscapes && (sc.ch == '\\')) { sc.Forward(); // Skip all characters after the backslash } else if (sc.ch == '\"') { if (sc.chNext == '\"') { sc.Forward(); } else { sc.ForwardSetState(SCE_C_DEFAULT|activitySet); } } break; case SCE_C_TRIPLEVERBATIM: if (sc.Match(R"(""")")) { while (sc.Match('"')) { sc.Forward(); } sc.SetState(SCE_C_DEFAULT|activitySet); } break; case SCE_C_UUID: if (sc.atLineEnd || sc.ch == ')') { sc.SetState(SCE_C_DEFAULT|activitySet); } break; case SCE_C_TASKMARKER: if (IsOperatorOrSpace(sc.ch)) { sc.SetState(styleBeforeTaskMarker|activitySet); styleBeforeTaskMarker = SCE_C_DEFAULT; } } if (sc.atLineEnd && !atLineEndBeforeSwitch) { // State exit processing consumed characters up to end of line. lineCurrent++; lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); } const bool atLineEndBeforeStateEntry = sc.atLineEnd; // Determine if a new state should be entered. if (MaskActive(sc.state) == SCE_C_DEFAULT) { if (sc.Match('@', '\"')) { sc.SetState(SCE_C_VERBATIM|activitySet); sc.Forward(); } else if (options.triplequotedStrings && sc.Match(R"(""")")) { sc.SetState(SCE_C_TRIPLEVERBATIM|activitySet); sc.Forward(2); } else if (options.hashquotedStrings && sc.Match('#', '\"')) { sc.SetState(SCE_C_HASHQUOTEDSTRING|activitySet); sc.Forward(); } else if ((options.backQuotedStrings != BackQuotedString::None) && sc.Match('`')) { sc.SetState(SCE_C_STRINGRAW|activitySet); rawStringTerminator = "`"; } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (lastWordWasUUID) { sc.SetState(SCE_C_UUID|activitySet); lastWordWasUUID = false; } else { sc.SetState(SCE_C_NUMBER|activitySet); } } else if (!sc.atLineEnd && (setWordStart.Contains(sc.ch) || (sc.ch == '@'))) { if (lastWordWasUUID) { sc.SetState(SCE_C_UUID|activitySet); lastWordWasUUID = false; } else { sc.SetState(SCE_C_IDENTIFIER|activitySet); } } else if (sc.Match('/', '*')) { if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style sc.SetState(SCE_C_COMMENTDOC|activitySet); } else { sc.SetState(SCE_C_COMMENT|activitySet); } sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match('/', '/')) { if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) // Support of Qt/Doxygen doc. style sc.SetState(SCE_C_COMMENTLINEDOC|activitySet); else sc.SetState(SCE_C_COMMENTLINE|activitySet); } else if (sc.ch == '/' && (setOKBeforeRE.Contains(chPrevNonWhite) || followsReturnKeyword(sc, styler)) && (!setCouldBePostOp.Contains(chPrevNonWhite) || !FollowsPostfixOperator(sc, styler))) { sc.SetState(SCE_C_REGEX|activitySet); // JavaScript's RegEx inRERange = false; } else if (sc.ch == '\"') { if (sc.chPrev == 'R') { styler.Flush(); if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) { sc.SetState(SCE_C_STRINGRAW|activitySet); rawStringTerminator = ")"; for (Sci_Position termPos = sc.currentPos + 1;; termPos++) { const char chTerminator = styler.SafeGetCharAt(termPos, '('); if (chTerminator == '(') break; rawStringTerminator += chTerminator; } rawStringTerminator += '\"'; } else { sc.SetState(SCE_C_STRING|activitySet); } } else { sc.SetState(SCE_C_STRING|activitySet); } isIncludePreprocessor = false; // ensure that '>' won't end the string } else if (isIncludePreprocessor && sc.ch == '<') { sc.SetState(SCE_C_STRING|activitySet); } else if (sc.ch == '\'') { sc.SetState(SCE_C_CHARACTER|activitySet); } else if (sc.ch == '#' && visibleChars == 0) { // Preprocessor commands are alone on their line sc.SetState(SCE_C_PREPROCESSOR|activitySet); // Skip whitespace between # and preprocessor word do { sc.Forward(); } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); if (sc.Match("include")) { isIncludePreprocessor = true; } else { if (options.trackPreprocessor && IsAlphaNumeric(sc.ch)) { // If #if is nested too deeply (>31 levels) the active/inactive appearance // will stop reflecting the code. if (sc.Match("ifdef") || sc.Match("ifndef")) { const bool isIfDef = sc.Match("ifdef"); const int startRest = isIfDef ? 5 : 6; const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + startRest + 1, false); const bool foundDef = preprocessorDefinitions.find(restOfLine) != preprocessorDefinitions.end(); preproc.StartSection(isIfDef == foundDef); } else if (sc.Match("if")) { const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true); const bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions); preproc.StartSection(ifGood); } else if (sc.Match("else")) { // #else is shown as active if either preceding or following section is active // as that means that it contributed to the result. if (preproc.ValidLevel()) { // If #else has no corresponding #if then take no action as invalid if (!preproc.CurrentIfTaken()) { // Inactive, may become active if parent scope active assert(sc.state == (SCE_C_PREPROCESSOR | inactiveFlag)); preproc.InvertCurrentLevel(); activitySet = preproc.ActiveState(); // If following is active then show "else" as active if (!activitySet) sc.ChangeState(SCE_C_PREPROCESSOR); } else if (preproc.IsActive()) { // Active -> inactive assert(sc.state == SCE_C_PREPROCESSOR); preproc.InvertCurrentLevel(); activitySet = preproc.ActiveState(); // Continue to show "else" as active as it ends active section. } } } else if (sc.Match("elif")) { // Ensure only one chosen out of #if .. #elif .. #elif .. #else .. #endif // #elif is shown as active if either preceding or following section is active // as that means that it contributed to the result. if (preproc.ValidLevel()) { if (!preproc.CurrentIfTaken()) { // Inactive, if expression true then may become active if parent scope active assert(sc.state == (SCE_C_PREPROCESSOR | inactiveFlag)); // Similar to #if const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 4, true); const bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions); if (ifGood) { preproc.InvertCurrentLevel(); activitySet = preproc.ActiveState(); if (!activitySet) sc.ChangeState(SCE_C_PREPROCESSOR); } } else if (preproc.IsActive()) { // Active -> inactive assert(sc.state == SCE_C_PREPROCESSOR); preproc.InvertCurrentLevel(); activitySet = preproc.ActiveState(); // Continue to show "elif" as active as it ends active section. } } } else if (sc.Match("endif")) { preproc.EndSection(); activitySet = preproc.ActiveState(); sc.ChangeState(SCE_C_PREPROCESSOR|activitySet); } else if (sc.Match("define")) { if (options.updatePreprocessor && preproc.IsActive()) { const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true); const Definition def = ParseDefine(restOfLine, "( \t"); preprocessorDefinitions[std::string(def.name)] = SymbolValue(def.value, def.arguments); ppDefineHistory.emplace_back(lineCurrent, def.name, def.value, false, def.arguments); definitionsChanged = true; } } else if (sc.Match("undef")) { if (options.updatePreprocessor && preproc.IsActive()) { const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, false); Tokens tokens = Tokenize(restOfLine); if (!tokens.empty()) { const std::string key = tokens[0]; preprocessorDefinitions.erase(key); ppDefineHistory.emplace_back(lineCurrent, key, "", true, ""); definitionsChanged = true; } } } } } } else if (isoperator(sc.ch)) { sc.SetState(SCE_C_OPERATOR|activitySet); if (!interpolatingStack.empty() && AnyOf(sc.ch, '{', '}')) { InterpolatingState ¤t = interpolatingStack.back(); if (sc.ch == '{') { current.braceCount += 1; } else { current.braceCount -= 1; if (current.braceCount == 0) { sc.ForwardSetState(current.state); interpolatingStack.pop_back(); continue; } } } } } if (sc.atLineEnd && !atLineEndBeforeStateEntry) { // State entry processing consumed characters up to end of line. lineCurrent++; lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); } if (!IsASpace(sc.ch) && !IsSpaceEquiv(MaskActive(sc.state))) { chPrevNonWhite = sc.ch; visibleChars++; } continuationLine = false; sc.Forward(); } const bool rawStringsChanged = rawStringTerminators.Merge(rawSTNew, lineCurrent); if (definitionsChanged || rawStringsChanged) styler.ChangeLexerState(startPos, startPos + length); sc.Complete(); } // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) return; LexAccessor styler(pAccess); const Sci_PositionU endPos = startPos + length; int visibleChars = 0; bool inLineComment = false; Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1); int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = MaskActive(styler.StyleAt(startPos)); int style = MaskActive(initStyle); const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); for (Sci_PositionU i = startPos; i < endPos; i++) { const char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); const int stylePrev = style; style = styleNext; styleNext = MaskActive(styler.StyleAt(i + 1)); const bool atEOL = i == (lineStartNext-1); if ((style == SCE_C_COMMENTLINE) || (style == SCE_C_COMMENTLINEDOC)) inLineComment = true; if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) { if (!IsStreamCommentStyle(stylePrev)) { levelNext++; } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } } if (options.foldComment && options.foldCommentExplicit && ((style == SCE_C_COMMENTLINE) || options.foldExplicitAnywhere)) { if (userDefinedFoldMarkers) { if (styler.Match(i, options.foldExplicitStart.c_str())) { levelNext++; } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { levelNext--; } } else { if ((ch == '/') && (chNext == '/')) { const char chNext2 = styler.SafeGetCharAt(i + 2); if (chNext2 == '{') { levelNext++; } else if (chNext2 == '}') { levelNext--; } } } } if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { if (ch == '#') { Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } if (styler.Match(j, "region") || styler.Match(j, "if")) { levelNext++; } else if (styler.Match(j, "end")) { levelNext--; } if (options.foldPreprocessorAtElse && (styler.Match(j, "else") || styler.Match(j, "elif"))) { levelMinCurrent--; } } } if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) { if (ch == '{' || ch == '[' || ch == '(') { // Measure the minimum before a '{' to allow // folding on "} else {" if (options.foldAtElse && levelMinCurrent > levelNext) { levelMinCurrent = levelNext; } levelNext++; } else if (ch == '}' || ch == ']' || ch == ')') { levelNext--; } } if (!IsASpace(ch)) visibleChars++; if (atEOL || (i == endPos-1)) { int levelUse = levelCurrent; if ((options.foldSyntaxBased && options.foldAtElse) || (options.foldPreprocessor && options.foldPreprocessorAtElse) ) { levelUse = levelMinCurrent; } int lev = levelUse | levelNext << 16; if (visibleChars == 0 && options.foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; lineStartNext = styler.LineStart(lineCurrent+1); levelCurrent = levelNext; levelMinCurrent = levelCurrent; if (atEOL && (i == static_cast(styler.Length()-1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } visibleChars = 0; inLineComment = false; } } } void LexerCPP::EvaluateTokens(Tokens &tokens, const SymbolTable &preprocessorDefinitions) { // Remove whitespace tokens tokens.erase(std::remove_if(tokens.begin(), tokens.end(), OnlySpaceOrTab), tokens.end()); // Evaluate defined statements to either 0 or 1 for (size_t i=0; (i+1)) const SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+2]); if (it != preprocessorDefinitions.end()) { val = "1"; } tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4); } else { // Spurious '(' so erase as more likely to result in false tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 2); } } else { // defined const SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+1]); if (it != preprocessorDefinitions.end()) { val = "1"; } tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 2); } tokens[i] = val; } else { i++; } } // Evaluate identifiers constexpr size_t maxIterations = 100; size_t iterations = 0; // Limit number of iterations in case there is a recursive macro. for (size_t i = 0; (isecond.value); if (it->second.IsMacro()) { if ((i + 1 < tokens.size()) && (tokens.at(i + 1) == "(")) { // Create map of argument name to value const Tokens argumentNames = StringSplit(it->second.arguments, ','); std::map arguments; size_t arg = 0; size_t tok = i+2; while ((tok < tokens.size()) && (arg < argumentNames.size()) && (tokens.at(tok) != ")")) { if (tokens.at(tok) != ",") { arguments[argumentNames.at(arg)] = tokens.at(tok); arg++; } tok++; } // Remove invocation tokens.erase(tokens.begin() + i, tokens.begin() + tok + 1); // Substitute values into macro macroTokens.erase(std::remove_if(macroTokens.begin(), macroTokens.end(), OnlySpaceOrTab), macroTokens.end()); for (size_t iMacro = 0; iMacro < macroTokens.size();) { if (setWordStart.Contains(macroTokens[iMacro][0])) { const std::map::const_iterator itFind = arguments.find(macroTokens[iMacro]); if (itFind != arguments.end()) { // TODO: Possible that value will be expression so should insert tokenized form macroTokens[iMacro] = itFind->second; } } iMacro++; } // Insert results back into tokens tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end()); } else { i++; } } else { // Remove invocation tokens.erase(tokens.begin() + i); // Insert results back into tokens tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end()); } } else { // Identifier not found and value defaults to zero tokens[i] = "0"; } } else { i++; } } // Find bracketed subexpressions and recurse on them BracketPair bracketPair = FindBracketPair(tokens); while (bracketPair.itBracket != tokens.end()) { Tokens inBracket(bracketPair.itBracket + 1, bracketPair.itEndBracket); EvaluateTokens(inBracket, preprocessorDefinitions); // The insertion is done before the removal because there were failures with the opposite approach tokens.insert(bracketPair.itBracket, inBracket.begin(), inBracket.end()); // insert invalidated bracketPair. Use a new variable to avoid warning from Coverity. const BracketPair pairToErase = FindBracketPair(tokens); tokens.erase(pairToErase.itBracket, pairToErase.itEndBracket + 1); bracketPair = FindBracketPair(tokens); } // Evaluate logical negations for (size_t j=0; (j+1)") result = valA > valB; else if (tokens[k+1] == ">=") result = valA >= valB; else if (tokens[k+1] == "==") result = valA == valB; else if (tokens[k+1] == "!=") result = valA != valB; else if (tokens[k+1] == "||") result = valA || valB; else if (tokens[k+1] == "&&") result = valA && valB; const Tokens::iterator itInsert = tokens.erase(tokens.begin() + k, tokens.begin() + k + 3); tokens.insert(itInsert, std::to_string(result)); } else { k++; } } } } Tokens LexerCPP::Tokenize(const std::string &expr) const { // Break into tokens Tokens tokens; const char *cp = expr.c_str(); while (*cp) { std::string word; if (setWord.Contains(*cp)) { // Identifiers and numbers while (setWord.Contains(*cp)) { word += *cp; cp++; } } else if (IsASpaceOrTab(*cp)) { while (IsASpaceOrTab(*cp)) { word += *cp; cp++; } } else if (setRelOp.Contains(*cp)) { word += *cp; cp++; if (setRelOp.Contains(*cp)) { word += *cp; cp++; } } else if (setLogicalOp.Contains(*cp)) { word += *cp; cp++; if (setLogicalOp.Contains(*cp)) { word += *cp; cp++; } } else { // Should handle strings, characters, and comments here word += *cp; cp++; } tokens.push_back(word); } return tokens; } bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions) { Tokens tokens = Tokenize(expr); EvaluateTokens(tokens, preprocessorDefinitions); // "0" or "" -> false else true const bool isFalse = tokens.empty() || ((tokens.size() == 1) && (tokens[0].empty() || tokens[0] == "0")); return !isFalse; } LexerModule lmCPP(SCLEX_CPP, LexerCPP::LexerFactoryCPP, "cpp", cppWordLists); LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, LexerCPP::LexerFactoryCPPInsensitive, "cppnocase", cppWordLists); ================================================ FILE: lexilla/lexers/LexCSS.cxx ================================================ // Scintilla source code edit control // Encoding: UTF-8 /** @file LexCSS.cxx ** Lexer for Cascading Style Sheets ** Written by Jakub Vrána ** Improved by Philippe Lhoste (CSS2) ** Improved by Ross McKay (SCSS mode; see http://sass-lang.com/ ) **/ // Copyright 1998-2002 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. // TODO: handle SCSS nested properties like font: { weight: bold; size: 1em; } // TODO: handle SCSS interpolation: #{} // TODO: add features for Less if somebody feels like contributing; http://lesscss.org/ // TODO: refactor this monster so that the next poor slob can read it! #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsAWordChar(const unsigned int ch) { /* FIXME: * The CSS spec allows "ISO 10646 characters U+00A1 and higher" to be treated as word chars. * Unfortunately, we are only getting string bytes here, and not full unicode characters. We cannot guarantee * that our byte is between U+0080 - U+00A0 (to return false), so we have to allow all characters U+0080 and higher */ return ch >= 0x80 || isalnum(ch) || ch == '-' || ch == '_'; } inline bool IsCssOperator(const int ch) { if (!((ch < 0x80) && isalnum(ch)) && (ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' || ch == '.' || ch == '#' || ch == '!' || ch == '@' || /* CSS2 */ ch == '*' || ch == '>' || ch == '+' || ch == '=' || ch == '~' || ch == '|' || ch == '[' || ch == ']' || ch == '(' || ch == ')')) { return true; } return false; } // look behind (from start of document to our start position) to determine current nesting level inline int NestingLevelLookBehind(Sci_PositionU startPos, Accessor &styler) { int ch; int nestingLevel = 0; for (Sci_PositionU i = 0; i < startPos; i++) { ch = styler.SafeGetCharAt(i); if (ch == '{') nestingLevel++; else if (ch == '}') nestingLevel--; } return nestingLevel; } static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &css1Props = *keywordlists[0]; WordList &pseudoClasses = *keywordlists[1]; WordList &css2Props = *keywordlists[2]; WordList &css3Props = *keywordlists[3]; WordList &pseudoElements = *keywordlists[4]; WordList &exProps = *keywordlists[5]; WordList &exPseudoClasses = *keywordlists[6]; WordList &exPseudoElements = *keywordlists[7]; StyleContext sc(startPos, length, initStyle, styler); int lastState = -1; // before operator int lastStateC = -1; // before comment int lastStateS = -1; // before single-quoted/double-quoted string int lastStateVar = -1; // before variable (SCSS) int lastStateVal = -1; // before value (SCSS) int op = ' '; // last operator int opPrev = ' '; // last operator bool insideParentheses = false; // true if currently in a CSS url() or similar construct // property lexer.css.scss.language // Set to 1 for Sassy CSS (.scss) bool isScssDocument = styler.GetPropertyInt("lexer.css.scss.language") != 0; // property lexer.css.less.language // Set to 1 for Less CSS (.less) bool isLessDocument = styler.GetPropertyInt("lexer.css.less.language") != 0; // property lexer.css.hss.language // Set to 1 for HSS (.hss) bool isHssDocument = styler.GetPropertyInt("lexer.css.hss.language") != 0; // SCSS/LESS/HSS have the concept of variable bool hasVariables = isScssDocument || isLessDocument || isHssDocument; char varPrefix = 0; if (hasVariables) varPrefix = isLessDocument ? '@' : '$'; // SCSS/LESS/HSS support single-line comments typedef enum _CommentModes { eCommentBlock = 0, eCommentLine = 1} CommentMode; CommentMode comment_mode = eCommentBlock; bool hasSingleLineComments = isScssDocument || isLessDocument || isHssDocument; // must keep track of nesting level in document types that support it (SCSS/LESS/HSS) bool hasNesting = false; int nestingLevel = 0; if (isScssDocument || isLessDocument || isHssDocument) { hasNesting = true; nestingLevel = NestingLevelLookBehind(startPos, styler); } // "the loop" for (; sc.More(); sc.Forward()) { if (sc.state == SCE_CSS_COMMENT && ((comment_mode == eCommentBlock && sc.Match('*', '/')) || (comment_mode == eCommentLine && sc.atLineEnd))) { if (lastStateC == -1) { // backtrack to get last state: // comments are like whitespace, so we must return to the previous state Sci_PositionU i = startPos; for (; i > 0; i--) { if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) { if (lastStateC == SCE_CSS_OPERATOR) { op = styler.SafeGetCharAt(i-1); opPrev = styler.SafeGetCharAt(i-2); while (--i) { lastState = styler.StyleAt(i-1); if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT) break; } if (i == 0) lastState = SCE_CSS_DEFAULT; } break; } } if (i == 0) lastStateC = SCE_CSS_DEFAULT; } if (comment_mode == eCommentBlock) { sc.Forward(); sc.ForwardSetState(lastStateC); } else /* eCommentLine */ { sc.SetState(lastStateC); } } if (sc.state == SCE_CSS_COMMENT) continue; if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) { if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\'')) continue; Sci_PositionU i = sc.currentPos; while (i && styler[i-1] == '\\') i--; if ((sc.currentPos - i) % 2 == 1) continue; sc.ForwardSetState(lastStateS); } if (sc.state == SCE_CSS_OPERATOR) { if (op == ' ') { Sci_PositionU i = startPos; op = styler.SafeGetCharAt(i-1); opPrev = styler.SafeGetCharAt(i-2); while (--i) { lastState = styler.StyleAt(i-1); if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT) break; } } switch (op) { case '@': if (lastState == SCE_CSS_DEFAULT || hasNesting) sc.SetState(SCE_CSS_DIRECTIVE); break; case '>': case '+': if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) sc.SetState(SCE_CSS_DEFAULT); break; case '[': if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) sc.SetState(SCE_CSS_ATTRIBUTE); break; case ']': if (lastState == SCE_CSS_ATTRIBUTE) sc.SetState(SCE_CSS_TAG); break; case '{': nestingLevel++; switch (lastState) { case SCE_CSS_GROUP_RULE: sc.SetState(SCE_CSS_DEFAULT); break; case SCE_CSS_TAG: case SCE_CSS_DIRECTIVE: sc.SetState(SCE_CSS_IDENTIFIER); break; } break; case '}': if (--nestingLevel < 0) nestingLevel = 0; switch (lastState) { case SCE_CSS_DEFAULT: case SCE_CSS_VALUE: case SCE_CSS_IMPORTANT: case SCE_CSS_IDENTIFIER: case SCE_CSS_IDENTIFIER2: case SCE_CSS_IDENTIFIER3: if (hasNesting) sc.SetState(nestingLevel > 0 ? SCE_CSS_IDENTIFIER : SCE_CSS_DEFAULT); else sc.SetState(SCE_CSS_DEFAULT); break; } break; case '(': if (lastState == SCE_CSS_PSEUDOCLASS) sc.SetState(SCE_CSS_TAG); else if (lastState == SCE_CSS_EXTENDED_PSEUDOCLASS) sc.SetState(SCE_CSS_EXTENDED_PSEUDOCLASS); break; case ')': if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS || lastState == SCE_CSS_PSEUDOELEMENT || lastState == SCE_CSS_EXTENDED_PSEUDOELEMENT) sc.SetState(SCE_CSS_TAG); break; case ':': switch (lastState) { case SCE_CSS_TAG: case SCE_CSS_DEFAULT: case SCE_CSS_CLASS: case SCE_CSS_ID: case SCE_CSS_PSEUDOCLASS: case SCE_CSS_EXTENDED_PSEUDOCLASS: case SCE_CSS_UNKNOWN_PSEUDOCLASS: case SCE_CSS_PSEUDOELEMENT: case SCE_CSS_EXTENDED_PSEUDOELEMENT: sc.SetState(SCE_CSS_PSEUDOCLASS); break; case SCE_CSS_IDENTIFIER: case SCE_CSS_IDENTIFIER2: case SCE_CSS_IDENTIFIER3: case SCE_CSS_EXTENDED_IDENTIFIER: case SCE_CSS_UNKNOWN_IDENTIFIER: case SCE_CSS_VARIABLE: sc.SetState(SCE_CSS_VALUE); lastStateVal = lastState; break; } break; case '.': if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) sc.SetState(SCE_CSS_CLASS); break; case '#': if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) sc.SetState(SCE_CSS_ID); break; case ',': case '|': case '~': if (lastState == SCE_CSS_TAG) sc.SetState(SCE_CSS_DEFAULT); break; case ';': switch (lastState) { case SCE_CSS_DIRECTIVE: if (hasNesting) { sc.SetState(nestingLevel > 0 ? SCE_CSS_IDENTIFIER : SCE_CSS_DEFAULT); } else { sc.SetState(SCE_CSS_DEFAULT); } break; case SCE_CSS_VALUE: case SCE_CSS_IMPORTANT: // data URLs can have semicolons; simplistically check for wrapping parentheses and move along if (insideParentheses) { sc.SetState(lastState); } else { if (lastStateVal == SCE_CSS_VARIABLE) { sc.SetState(SCE_CSS_DEFAULT); } else { sc.SetState(SCE_CSS_IDENTIFIER); } } break; case SCE_CSS_VARIABLE: if (lastStateVar == SCE_CSS_VALUE) { // data URLs can have semicolons; simplistically check for wrapping parentheses and move along if (insideParentheses) { sc.SetState(SCE_CSS_VALUE); } else { sc.SetState(SCE_CSS_IDENTIFIER); } } else { sc.SetState(SCE_CSS_DEFAULT); } break; } break; case '!': if (lastState == SCE_CSS_VALUE) sc.SetState(SCE_CSS_IMPORTANT); break; } } if (sc.ch == '*' && sc.state == SCE_CSS_DEFAULT) { sc.SetState(SCE_CSS_TAG); continue; } // check for inside parentheses (whether part of an "operator" or not) if (sc.ch == '(') insideParentheses = true; else if (sc.ch == ')') insideParentheses = false; // SCSS special modes if (hasVariables) { // variable name if (sc.ch == varPrefix) { switch (sc.state) { case SCE_CSS_DEFAULT: if (isLessDocument) // give priority to pseudo elements break; // Falls through. case SCE_CSS_VALUE: lastStateVar = sc.state; sc.SetState(SCE_CSS_VARIABLE); continue; } } if (sc.state == SCE_CSS_VARIABLE) { if (IsAWordChar(sc.ch)) { // still looking at the variable name continue; } if (lastStateVar == SCE_CSS_VALUE) { // not looking at the variable name any more, and it was part of a value sc.SetState(SCE_CSS_VALUE); } } // nested rule parent selector if (sc.ch == '&') { switch (sc.state) { case SCE_CSS_DEFAULT: case SCE_CSS_IDENTIFIER: sc.SetState(SCE_CSS_TAG); continue; } } } // nesting rules that apply to SCSS and Less if (hasNesting) { // check for nested rule selector if (sc.state == SCE_CSS_IDENTIFIER && (IsAWordChar(sc.ch) || sc.ch == ':' || sc.ch == '.' || sc.ch == '#')) { // look ahead to see whether { comes before next ; and } Sci_PositionU endPos = startPos + length; int ch; for (Sci_PositionU i = sc.currentPos; i < endPos; i++) { ch = styler.SafeGetCharAt(i); if (ch == ';' || ch == '}') break; if (ch == '{') { sc.SetState(SCE_CSS_DEFAULT); continue; } } } } if (IsAWordChar(sc.ch)) { if (sc.state == SCE_CSS_DEFAULT) sc.SetState(SCE_CSS_TAG); continue; } if (IsAWordChar(sc.chPrev) && ( sc.state == SCE_CSS_IDENTIFIER || sc.state == SCE_CSS_IDENTIFIER2 || sc.state == SCE_CSS_IDENTIFIER3 || sc.state == SCE_CSS_EXTENDED_IDENTIFIER || sc.state == SCE_CSS_UNKNOWN_IDENTIFIER || sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT || sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_IMPORTANT || sc.state == SCE_CSS_DIRECTIVE )) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); char *s2 = s; while (*s2 && !IsAWordChar(*s2)) s2++; switch (sc.state) { case SCE_CSS_IDENTIFIER: case SCE_CSS_IDENTIFIER2: case SCE_CSS_IDENTIFIER3: case SCE_CSS_EXTENDED_IDENTIFIER: case SCE_CSS_UNKNOWN_IDENTIFIER: if (css1Props.InList(s2)) sc.ChangeState(SCE_CSS_IDENTIFIER); else if (css2Props.InList(s2)) sc.ChangeState(SCE_CSS_IDENTIFIER2); else if (css3Props.InList(s2)) sc.ChangeState(SCE_CSS_IDENTIFIER3); else if (exProps.InList(s2)) sc.ChangeState(SCE_CSS_EXTENDED_IDENTIFIER); else sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER); break; case SCE_CSS_PSEUDOCLASS: case SCE_CSS_PSEUDOELEMENT: case SCE_CSS_EXTENDED_PSEUDOCLASS: case SCE_CSS_EXTENDED_PSEUDOELEMENT: case SCE_CSS_UNKNOWN_PSEUDOCLASS: if (op == ':' && opPrev != ':' && pseudoClasses.InList(s2)) sc.ChangeState(SCE_CSS_PSEUDOCLASS); else if (opPrev == ':' && pseudoElements.InList(s2)) sc.ChangeState(SCE_CSS_PSEUDOELEMENT); else if ((op == ':' || (op == '(' && lastState == SCE_CSS_EXTENDED_PSEUDOCLASS)) && opPrev != ':' && exPseudoClasses.InList(s2)) sc.ChangeState(SCE_CSS_EXTENDED_PSEUDOCLASS); else if (opPrev == ':' && exPseudoElements.InList(s2)) sc.ChangeState(SCE_CSS_EXTENDED_PSEUDOELEMENT); else sc.ChangeState(SCE_CSS_UNKNOWN_PSEUDOCLASS); break; case SCE_CSS_IMPORTANT: if (strcmp(s2, "important") != 0) sc.ChangeState(SCE_CSS_VALUE); break; case SCE_CSS_DIRECTIVE: if (op == '@' && (strcmp(s2, "media") == 0 || strcmp(s2, "supports") == 0 || strcmp(s2, "document") == 0 || strcmp(s2, "-moz-document") == 0)) sc.ChangeState(SCE_CSS_GROUP_RULE); break; } } if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && ( sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_ID || (sc.ch != '(' && sc.ch != ')' && ( /* This line of the condition makes it possible to extend pseudo-classes with parentheses */ sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_PSEUDOELEMENT || sc.state == SCE_CSS_EXTENDED_PSEUDOCLASS || sc.state == SCE_CSS_EXTENDED_PSEUDOELEMENT || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS )) )) sc.SetState(SCE_CSS_TAG); if (sc.Match('/', '*')) { lastStateC = sc.state; comment_mode = eCommentBlock; sc.SetState(SCE_CSS_COMMENT); sc.Forward(); } else if (hasSingleLineComments && sc.Match('/', '/') && !insideParentheses) { // note that we've had to treat ([...]// as the start of a URL not a comment, e.g. url(http://example.com), url(//example.com) lastStateC = sc.state; comment_mode = eCommentLine; sc.SetState(SCE_CSS_COMMENT); sc.Forward(); } else if ((sc.state == SCE_CSS_VALUE || sc.state == SCE_CSS_ATTRIBUTE) && (sc.ch == '\"' || sc.ch == '\'')) { lastStateS = sc.state; sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING)); } else if (IsCssOperator(sc.ch) && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') && (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!') && ((sc.state != SCE_CSS_DIRECTIVE && sc.state != SCE_CSS_GROUP_RULE) || sc.ch == ';' || sc.ch == '{') ) { if (sc.state != SCE_CSS_OPERATOR) lastState = sc.state; sc.SetState(SCE_CSS_OPERATOR); op = sc.ch; opPrev = sc.chPrev; } } sc.Complete(); } static void FoldCSSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT); for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styler.StyleAt(i); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment) { if (!inComment && (style == SCE_CSS_COMMENT)) levelCurrent++; else if (inComment && (style != SCE_CSS_COMMENT)) levelCurrent--; inComment = (style == SCE_CSS_COMMENT); } if (style == SCE_CSS_OPERATOR) { if (ch == '{') { levelCurrent++; } else if (ch == '}') { levelCurrent--; } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const cssWordListDesc[] = { "CSS1 Properties", "Pseudo-classes", "CSS2 Properties", "CSS3 Properties", "Pseudo-elements", "Browser-Specific CSS Properties", "Browser-Specific Pseudo-classes", "Browser-Specific Pseudo-elements", 0 }; LexerModule lmCss(SCLEX_CSS, ColouriseCssDoc, "css", FoldCSSDoc, cssWordListDesc); ================================================ FILE: lexilla/lexers/LexCaml.cxx ================================================ // Scintilla source code edit control /** @file LexCaml.cxx ** Lexer for Objective Caml. **/ // Copyright 2005-2009 by Robert Roessler // The License.txt file describes the conditions under which this software may be distributed. /* Release History 20050204 Initial release. 20050205 Quick compiler standards/"cleanliness" adjustment. 20050206 Added cast for IsLeadByte(). 20050209 Changes to "external" build support. 20050306 Fix for 1st-char-in-doc "corner" case. 20050502 Fix for [harmless] one-past-the-end coloring. 20050515 Refined numeric token recognition logic. 20051125 Added 2nd "optional" keywords class. 20051129 Support "magic" (read-only) comments for RCaml. 20051204 Swtich to using StyleContext infrastructure. 20090629 Add full Standard ML '97 support. */ #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #if defined(__clang__) #pragma clang diagnostic ignored "-Wcomma" #endif // Since the Microsoft __iscsym[f] funcs are not ANSI... inline int iscaml(int c) {return isalnum(c) || c == '_';} inline int iscamlf(int c) {return isalpha(c) || c == '_';} static const int baseT[24] = { 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* A - L */ 0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,16 /* M - X */ }; using namespace Lexilla; static void ColouriseCamlDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { // initialize styler StyleContext sc(startPos, length, initStyle, styler); Sci_PositionU chToken = 0; int chBase = 0, chLit = 0; WordList& keywords = *keywordlists[0]; WordList& keywords2 = *keywordlists[1]; WordList& keywords3 = *keywordlists[2]; const bool isSML = keywords.InList("andalso"); const int useMagic = styler.GetPropertyInt("lexer.caml.magic", 0); // set up [initial] state info (terminating states that shouldn't "bleed") const int state_ = sc.state & 0x0f; if (state_ <= SCE_CAML_CHAR || (isSML && state_ == SCE_CAML_STRING)) sc.state = SCE_CAML_DEFAULT; int nesting = (state_ >= SCE_CAML_COMMENT)? (state_ - SCE_CAML_COMMENT): 0; // foreach char in range... while (sc.More()) { // set up [per-char] state info int state2 = -1; // (ASSUME no state change) Sci_Position chColor = sc.currentPos - 1;// (ASSUME standard coloring range) bool advance = true; // (ASSUME scanner "eats" 1 char) // step state machine switch (sc.state & 0x0f) { case SCE_CAML_DEFAULT: chToken = sc.currentPos; // save [possible] token start (JIC) // it's wide open; what do we have? if (iscamlf(sc.ch)) state2 = SCE_CAML_IDENTIFIER; else if (!isSML && sc.Match('`') && iscamlf(sc.chNext)) state2 = SCE_CAML_TAGNAME; else if (!isSML && sc.Match('#') && isdigit(sc.chNext)) state2 = SCE_CAML_LINENUM; else if (isdigit(sc.ch)) { // it's a number, assume base 10 state2 = SCE_CAML_NUMBER, chBase = 10; if (sc.Match('0')) { // there MAY be a base specified... const char* baseC = "bBoOxX"; if (isSML) { if (sc.chNext == 'w') sc.Forward(); // (consume SML "word" indicator) baseC = "x"; } // ... change to specified base AS REQUIRED if (strchr(baseC, sc.chNext)) chBase = baseT[tolower(sc.chNext) - 'a'], sc.Forward(); } } else if (!isSML && sc.Match('\'')) // (Caml char literal?) state2 = SCE_CAML_CHAR, chLit = 0; else if (isSML && sc.Match('#', '"')) // (SML char literal?) state2 = SCE_CAML_CHAR, sc.Forward(); else if (sc.Match('"')) state2 = SCE_CAML_STRING; else if (sc.Match('(', '*')) state2 = SCE_CAML_COMMENT, sc.Forward(), sc.ch = ' '; // (*)... else if (strchr("!?~" /* Caml "prefix-symbol" */ "=<>@^|&+-*/$%" /* Caml "infix-symbol" */ "()[]{};,:.#", sc.ch) // Caml "bracket" or ;,:.# // SML "extra" ident chars || (isSML && (sc.Match('\\') || sc.Match('`')))) state2 = SCE_CAML_OPERATOR; break; case SCE_CAML_IDENTIFIER: // [try to] interpret as [additional] identifier char if (!(iscaml(sc.ch) || sc.Match('\''))) { const Sci_Position n = sc.currentPos - chToken; if (n < 24) { // length is believable as keyword, [re-]construct token char t[24]; for (Sci_Position i = -n; i < 0; i++) t[n + i] = static_cast(sc.GetRelative(i)); t[n] = '\0'; // special-case "_" token as KEYWORD if ((n == 1 && sc.chPrev == '_') || keywords.InList(t)) sc.ChangeState(SCE_CAML_KEYWORD); else if (keywords2.InList(t)) sc.ChangeState(SCE_CAML_KEYWORD2); else if (keywords3.InList(t)) sc.ChangeState(SCE_CAML_KEYWORD3); } state2 = SCE_CAML_DEFAULT, advance = false; } break; case SCE_CAML_TAGNAME: // [try to] interpret as [additional] tagname char if (!(iscaml(sc.ch) || sc.Match('\''))) state2 = SCE_CAML_DEFAULT, advance = false; break; /*case SCE_CAML_KEYWORD: case SCE_CAML_KEYWORD2: case SCE_CAML_KEYWORD3: // [try to] interpret as [additional] keyword char if (!iscaml(ch)) state2 = SCE_CAML_DEFAULT, advance = false; break;*/ case SCE_CAML_LINENUM: // [try to] interpret as [additional] linenum directive char if (!isdigit(sc.ch)) state2 = SCE_CAML_DEFAULT, advance = false; break; case SCE_CAML_OPERATOR: { // [try to] interpret as [additional] operator char const char* o = 0; if (iscaml(sc.ch) || isspace(sc.ch) // ident or whitespace || (o = strchr(")]};,\'\"#", sc.ch),o) // "termination" chars || (!isSML && sc.Match('`')) // Caml extra term char || (!strchr("!$%&*+-./:<=>?@^|~", sc.ch)// "operator" chars // SML extra ident chars && !(isSML && (sc.Match('\\') || sc.Match('`'))))) { // check for INCLUSIVE termination if (o && strchr(")]};,", sc.ch)) { if ((sc.Match(')') && sc.chPrev == '(') || (sc.Match(']') && sc.chPrev == '[')) // special-case "()" and "[]" tokens as KEYWORDS sc.ChangeState(SCE_CAML_KEYWORD); chColor++; } else advance = false; state2 = SCE_CAML_DEFAULT; } break; } case SCE_CAML_NUMBER: // [try to] interpret as [additional] numeric literal char if ((!isSML && sc.Match('_')) || IsADigit(sc.ch, chBase)) break; // how about an integer suffix? if (!isSML && (sc.Match('l') || sc.Match('L') || sc.Match('n')) && (sc.chPrev == '_' || IsADigit(sc.chPrev, chBase))) break; // or a floating-point literal? if (chBase == 10) { // with a decimal point? if (sc.Match('.') && ((!isSML && sc.chPrev == '_') || IsADigit(sc.chPrev, chBase))) break; // with an exponent? (I) if ((sc.Match('e') || sc.Match('E')) && ((!isSML && (sc.chPrev == '.' || sc.chPrev == '_')) || IsADigit(sc.chPrev, chBase))) break; // with an exponent? (II) if (((!isSML && (sc.Match('+') || sc.Match('-'))) || (isSML && sc.Match('~'))) && (sc.chPrev == 'e' || sc.chPrev == 'E')) break; } // it looks like we have run out of number state2 = SCE_CAML_DEFAULT, advance = false; break; case SCE_CAML_CHAR: if (!isSML) { // [try to] interpret as [additional] char literal char if (sc.Match('\\')) { chLit = 1; // (definitely IS a char literal) if (sc.chPrev == '\\') sc.ch = ' '; // (...\\') // should we be terminating - one way or another? } else if ((sc.Match('\'') && sc.chPrev != '\\') || sc.atLineEnd) { state2 = SCE_CAML_DEFAULT; if (sc.Match('\'')) chColor++; else sc.ChangeState(SCE_CAML_IDENTIFIER); // ... maybe a char literal, maybe not } else if (chLit < 1 && sc.currentPos - chToken >= 2) sc.ChangeState(SCE_CAML_IDENTIFIER), advance = false; break; }/* else // fall through for SML char literal (handle like string) */ // Falls through. case SCE_CAML_STRING: // [try to] interpret as [additional] [SML char/] string literal char if (isSML && sc.Match('\\') && sc.chPrev != '\\' && isspace(sc.chNext)) state2 = SCE_CAML_WHITE; else if (sc.Match('\\') && sc.chPrev == '\\') sc.ch = ' '; // (...\\") // should we be terminating - one way or another? else if ((sc.Match('"') && sc.chPrev != '\\') || (isSML && sc.atLineEnd)) { state2 = SCE_CAML_DEFAULT; if (sc.Match('"')) chColor++; } break; case SCE_CAML_WHITE: // [try to] interpret as [additional] SML embedded whitespace char if (sc.Match('\\')) { // style this puppy NOW... state2 = SCE_CAML_STRING, sc.ch = ' ' /* (...\") */, chColor++, styler.ColourTo(chColor, SCE_CAML_WHITE), styler.Flush(); // ... then backtrack to determine original SML literal type Sci_Position p = chColor - 2; for (; p >= 0 && styler.StyleAt(p) == SCE_CAML_WHITE; p--) ; if (p >= 0) state2 = static_cast(styler.StyleAt(p)); // take care of state change NOW sc.ChangeState(state2), state2 = -1; } break; case SCE_CAML_COMMENT: case SCE_CAML_COMMENT1: case SCE_CAML_COMMENT2: case SCE_CAML_COMMENT3: // we're IN a comment - does this start a NESTED comment? if (sc.Match('(', '*')) state2 = sc.state + 1, chToken = sc.currentPos, sc.Forward(), sc.ch = ' ' /* (*)... */, nesting++; // [try to] interpret as [additional] comment char else if (sc.Match(')') && sc.chPrev == '*') { if (nesting) state2 = (sc.state & 0x0f) - 1, chToken = 0, nesting--; else state2 = SCE_CAML_DEFAULT; chColor++; // enable "magic" (read-only) comment AS REQUIRED } else if (useMagic && sc.currentPos - chToken == 4 && sc.Match('c') && sc.chPrev == 'r' && sc.GetRelative(-2) == '@') sc.state |= 0x10; // (switch to read-only comment style) break; } // handle state change and char coloring AS REQUIRED if (state2 >= 0) styler.ColourTo(chColor, sc.state), sc.ChangeState(state2); // move to next char UNLESS re-scanning current char if (advance) sc.Forward(); } // do any required terminal char coloring (JIC) sc.Complete(); } static void FoldCamlDoc( Sci_PositionU, Sci_Position, int, WordList *[], Accessor &) { } static const char * const camlWordListDesc[] = { "Keywords", // primary Objective Caml keywords "Keywords2", // "optional" keywords (typically from Pervasives) "Keywords3", // "optional" keywords (typically typenames) 0 }; LexerModule lmCaml(SCLEX_CAML, ColouriseCamlDoc, "caml", FoldCamlDoc, camlWordListDesc); ================================================ FILE: lexilla/lexers/LexCmake.cxx ================================================ // Scintilla source code edit control /** @file LexCmake.cxx ** Lexer for Cmake **/ // Copyright 2007 by Cristian Adam // based on the NSIS lexer // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static bool isCmakeNumber(char ch) { return(ch >= '0' && ch <= '9'); } static bool isCmakeChar(char ch) { return(ch == '.' ) || (ch == '_' ) || isCmakeNumber(ch) || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } static bool isCmakeLetter(char ch) { return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); } static bool CmakeNextLineHasElse(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { Sci_Position nNextLine = -1; for ( Sci_PositionU i = start; i < end; i++ ) { char cNext = styler.SafeGetCharAt( i ); if ( cNext == '\n' ) { nNextLine = i+1; break; } } if ( nNextLine == -1 ) // We never foudn the next line... return false; for ( Sci_PositionU firstChar = nNextLine; firstChar < end; firstChar++ ) { char cNext = styler.SafeGetCharAt( firstChar ); if ( cNext == ' ' ) continue; if ( cNext == '\t' ) continue; if ( styler.Match(firstChar, "ELSE") || styler.Match(firstChar, "else")) return true; break; } return false; } static int calculateFoldCmake(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse) { // If the word is too long, it is not what we are looking for if ( end - start > 20 ) return foldlevel; int newFoldlevel = foldlevel; char s[20]; // The key word we are looking for has atmost 13 characters for (unsigned int i = 0; i < end - start + 1 && i < 19; i++) { s[i] = static_cast( styler[ start + i ] ); s[i + 1] = '\0'; } if ( CompareCaseInsensitive(s, "IF") == 0 || CompareCaseInsensitive(s, "WHILE") == 0 || CompareCaseInsensitive(s, "MACRO") == 0 || CompareCaseInsensitive(s, "FOREACH") == 0 || CompareCaseInsensitive(s, "FUNCTION") == 0) newFoldlevel++; else if ( CompareCaseInsensitive(s, "ENDIF") == 0 || CompareCaseInsensitive(s, "ENDWHILE") == 0 || CompareCaseInsensitive(s, "ENDMACRO") == 0 || CompareCaseInsensitive(s, "ENDFOREACH") == 0 || CompareCaseInsensitive(s, "ENDFUNCTION") == 0) newFoldlevel--; else if ( bElse && CompareCaseInsensitive(s, "ELSEIF") == 0 ) newFoldlevel++; else if ( bElse && CompareCaseInsensitive(s, "ELSE") == 0 ) newFoldlevel++; return newFoldlevel; } static int classifyWordCmake(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler ) { char word[100] = {0}; char lowercaseWord[100] = {0}; WordList &Commands = *keywordLists[0]; WordList &Parameters = *keywordLists[1]; WordList &UserDefined = *keywordLists[2]; for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++) { word[i] = static_cast( styler[ start + i ] ); lowercaseWord[i] = static_cast(tolower(word[i])); } // Check for special words... if ( CompareCaseInsensitive(word, "MACRO") == 0 || CompareCaseInsensitive(word, "ENDMACRO") == 0 ) return SCE_CMAKE_MACRODEF; if ( CompareCaseInsensitive(word, "IF") == 0 || CompareCaseInsensitive(word, "ENDIF") == 0 ) return SCE_CMAKE_IFDEFINEDEF; if ( CompareCaseInsensitive(word, "ELSEIF") == 0 || CompareCaseInsensitive(word, "ELSE") == 0 ) return SCE_CMAKE_IFDEFINEDEF; if ( CompareCaseInsensitive(word, "WHILE") == 0 || CompareCaseInsensitive(word, "ENDWHILE") == 0) return SCE_CMAKE_WHILEDEF; if ( CompareCaseInsensitive(word, "FOREACH") == 0 || CompareCaseInsensitive(word, "ENDFOREACH") == 0) return SCE_CMAKE_FOREACHDEF; if ( Commands.InList(lowercaseWord) ) return SCE_CMAKE_COMMANDS; if ( Parameters.InList(word) ) return SCE_CMAKE_PARAMETERS; if ( UserDefined.InList(word) ) return SCE_CMAKE_USERDEFINED; if ( strlen(word) > 3 ) { if ( word[1] == '{' && word[strlen(word)-1] == '}' ) return SCE_CMAKE_VARIABLE; } // To check for numbers if ( isCmakeNumber( word[0] ) ) { bool bHasSimpleCmakeNumber = true; for (unsigned int j = 1; j < end - start + 1 && j < 99; j++) { if ( !isCmakeNumber( word[j] ) ) { bHasSimpleCmakeNumber = false; break; } } if ( bHasSimpleCmakeNumber ) return SCE_CMAKE_NUMBER; } return SCE_CMAKE_DEFAULT; } static void ColouriseCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) { int state = SCE_CMAKE_DEFAULT; if ( startPos > 0 ) state = styler.StyleAt(startPos-1); // Use the style from the previous line, usually default, but could be commentbox styler.StartAt( startPos ); styler.GetLine( startPos ); Sci_PositionU nLengthDoc = startPos + length; styler.StartSegment( startPos ); char cCurrChar; bool bVarInString = false; bool bClassicVarInString = false; Sci_PositionU i; for ( i = startPos; i < nLengthDoc; i++ ) { cCurrChar = styler.SafeGetCharAt( i ); char cNextChar = styler.SafeGetCharAt(i+1); switch (state) { case SCE_CMAKE_DEFAULT: if ( cCurrChar == '#' ) { // we have a comment line styler.ColourTo(i-1, state ); state = SCE_CMAKE_COMMENT; break; } if ( cCurrChar == '"' ) { styler.ColourTo(i-1, state ); state = SCE_CMAKE_STRINGDQ; bVarInString = false; bClassicVarInString = false; break; } if ( cCurrChar == '\'' ) { styler.ColourTo(i-1, state ); state = SCE_CMAKE_STRINGRQ; bVarInString = false; bClassicVarInString = false; break; } if ( cCurrChar == '`' ) { styler.ColourTo(i-1, state ); state = SCE_CMAKE_STRINGLQ; bVarInString = false; bClassicVarInString = false; break; } // CMake Variable if ( cCurrChar == '$' || isCmakeChar(cCurrChar)) { styler.ColourTo(i-1,state); state = SCE_CMAKE_VARIABLE; // If it is a number, we must check and set style here first... if ( isCmakeNumber(cCurrChar) && (cNextChar == '\t' || cNextChar == ' ' || cNextChar == '\r' || cNextChar == '\n' ) ) styler.ColourTo( i, SCE_CMAKE_NUMBER); break; } break; case SCE_CMAKE_COMMENT: if ( cCurrChar == '\n' || cCurrChar == '\r' ) { if ( styler.SafeGetCharAt(i-1) == '\\' ) { styler.ColourTo(i-2,state); styler.ColourTo(i-1,SCE_CMAKE_DEFAULT); } else { styler.ColourTo(i-1,state); state = SCE_CMAKE_DEFAULT; } } break; case SCE_CMAKE_STRINGDQ: case SCE_CMAKE_STRINGLQ: case SCE_CMAKE_STRINGRQ: if ( styler.SafeGetCharAt(i-1) == '\\' && styler.SafeGetCharAt(i-2) == '$' ) break; // Ignore the next character, even if it is a quote of some sort if ( cCurrChar == '"' && state == SCE_CMAKE_STRINGDQ ) { styler.ColourTo(i,state); state = SCE_CMAKE_DEFAULT; break; } if ( cCurrChar == '`' && state == SCE_CMAKE_STRINGLQ ) { styler.ColourTo(i,state); state = SCE_CMAKE_DEFAULT; break; } if ( cCurrChar == '\'' && state == SCE_CMAKE_STRINGRQ ) { styler.ColourTo(i,state); state = SCE_CMAKE_DEFAULT; break; } if ( cNextChar == '\r' || cNextChar == '\n' ) { Sci_Position nCurLine = styler.GetLine(i+1); Sci_Position nBack = i; // We need to check if the previous line has a \ in it... bool bNextLine = false; while ( nBack > 0 ) { if ( styler.GetLine(nBack) != nCurLine ) break; char cTemp = styler.SafeGetCharAt(nBack, 'a'); // Letter 'a' is safe here if ( cTemp == '\\' ) { bNextLine = true; break; } if ( cTemp != '\r' && cTemp != '\n' && cTemp != '\t' && cTemp != ' ' ) break; nBack--; } if ( bNextLine ) { styler.ColourTo(i+1,state); } if ( bNextLine == false ) { styler.ColourTo(i,state); state = SCE_CMAKE_DEFAULT; } } break; case SCE_CMAKE_VARIABLE: // CMake Variable: if ( cCurrChar == '$' ) state = SCE_CMAKE_DEFAULT; else if ( cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) ) state = SCE_CMAKE_DEFAULT; else if ( (isCmakeChar(cCurrChar) && !isCmakeChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' ) { state = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler ); styler.ColourTo( i, state); state = SCE_CMAKE_DEFAULT; } else if ( !isCmakeChar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' ) { if ( classifyWordCmake( styler.GetStartSegment(), i-1, keywordLists, styler) == SCE_CMAKE_NUMBER ) styler.ColourTo( i-1, SCE_CMAKE_NUMBER ); state = SCE_CMAKE_DEFAULT; if ( cCurrChar == '"' ) { state = SCE_CMAKE_STRINGDQ; bVarInString = false; bClassicVarInString = false; } else if ( cCurrChar == '`' ) { state = SCE_CMAKE_STRINGLQ; bVarInString = false; bClassicVarInString = false; } else if ( cCurrChar == '\'' ) { state = SCE_CMAKE_STRINGRQ; bVarInString = false; bClassicVarInString = false; } else if ( cCurrChar == '#' ) { state = SCE_CMAKE_COMMENT; } } break; } if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) { bool bIngoreNextDollarSign = false; if ( bVarInString && cCurrChar == '$' ) { bVarInString = false; bIngoreNextDollarSign = true; } else if ( bVarInString && cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' || cNextChar == '"' || cNextChar == '`' || cNextChar == '\'' ) ) { styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); bVarInString = false; bIngoreNextDollarSign = false; } else if ( bVarInString && !isCmakeChar(cNextChar) ) { int nWordState = classifyWordCmake( styler.GetStartSegment(), i, keywordLists, styler); if ( nWordState == SCE_CMAKE_VARIABLE ) styler.ColourTo( i, SCE_CMAKE_STRINGVAR); bVarInString = false; } // Covers "${TEST}..." else if ( bClassicVarInString && cNextChar == '}' ) { styler.ColourTo( i+1, SCE_CMAKE_STRINGVAR); bClassicVarInString = false; } // Start of var in string if ( !bIngoreNextDollarSign && cCurrChar == '$' && cNextChar == '{' ) { styler.ColourTo( i-1, state); bClassicVarInString = true; bVarInString = false; } else if ( !bIngoreNextDollarSign && cCurrChar == '$' ) { styler.ColourTo( i-1, state); bVarInString = true; bClassicVarInString = false; } } } // Colourise remaining document styler.ColourTo(nLengthDoc-1,state); } static void FoldCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { // No folding enabled, no reason to continue... if ( styler.GetPropertyInt("fold") == 0 ) return; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1; Sci_Position lineCurrent = styler.GetLine(startPos); Sci_PositionU safeStartPos = styler.LineStart( lineCurrent ); bool bArg1 = true; Sci_Position nWordStart = -1; int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelNext = levelCurrent; for (Sci_PositionU i = safeStartPos; i < startPos + length; i++) { char chCurr = styler.SafeGetCharAt(i); if ( bArg1 ) { if ( nWordStart == -1 && (isCmakeLetter(chCurr)) ) { nWordStart = i; } else if ( isCmakeLetter(chCurr) == false && nWordStart > -1 ) { int newLevel = calculateFoldCmake( nWordStart, i-1, levelNext, styler, foldAtElse); if ( newLevel == levelNext ) { if ( foldAtElse ) { if ( CmakeNextLineHasElse(i, startPos + length, styler) ) levelNext--; } } else levelNext = newLevel; bArg1 = false; } } if ( chCurr == '\n' ) { if ( bArg1 && foldAtElse) { if ( CmakeNextLineHasElse(i, startPos + length, styler) ) levelNext--; } // If we are on a new line... int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (levelUse < levelNext ) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) styler.SetLevel(lineCurrent, lev); lineCurrent++; levelCurrent = levelNext; bArg1 = true; // New line, lets look at first argument again nWordStart = -1; } } int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) styler.SetLevel(lineCurrent, lev); } static const char * const cmakeWordLists[] = { "Commands", "Parameters", "UserDefined", 0, 0,}; LexerModule lmCmake(SCLEX_CMAKE, ColouriseCmakeDoc, "cmake", FoldCmakeDoc, cmakeWordLists); ================================================ FILE: lexilla/lexers/LexCoffeeScript.cxx ================================================ // Scintilla source code edit control /** @file LexCoffeeScript.cxx ** Lexer for CoffeeScript. **/ // Copyright 1998-2011 by Neil Hodgson // Based on the Scintilla C++ Lexer // Written by Eric Promislow in 2011 for the Komodo IDE // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static bool IsSpaceEquiv(int state) { return (state == SCE_COFFEESCRIPT_DEFAULT || state == SCE_COFFEESCRIPT_COMMENTLINE || state == SCE_COFFEESCRIPT_COMMENTBLOCK || state == SCE_COFFEESCRIPT_VERBOSE_REGEX || state == SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT || state == SCE_COFFEESCRIPT_WORD || state == SCE_COFFEESCRIPT_REGEX); } // Store the current lexer state and brace count prior to starting a new // `#{}` interpolation level. // Based on LexRuby.cxx. static void enterInnerExpression(int *p_inner_string_types, int *p_inner_expn_brace_counts, int& inner_string_count, int state, int& brace_counts ) { p_inner_string_types[inner_string_count] = state; p_inner_expn_brace_counts[inner_string_count] = brace_counts; brace_counts = 0; ++inner_string_count; } // Restore the lexer state and brace count for the previous `#{}` interpolation // level upon returning to it. // Note the previous lexer state is the return value and needs to be restored // manually by the StyleContext. // Based on LexRuby.cxx. static int exitInnerExpression(int *p_inner_string_types, int *p_inner_expn_brace_counts, int& inner_string_count, int& brace_counts ) { --inner_string_count; brace_counts = p_inner_expn_brace_counts[inner_string_count]; return p_inner_string_types[inner_string_count]; } // Preconditions: sc.currentPos points to a character after '+' or '-'. // The test for pos reaching 0 should be redundant, // and is in only for safety measures. // Limitation: this code will give the incorrect answer for code like // a = b+++/ptn/... // Putting a space between the '++' post-inc operator and the '+' binary op // fixes this, and is highly recommended for readability anyway. static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) { Sci_Position pos = (Sci_Position) sc.currentPos; while (--pos > 0) { char ch = styler[pos]; if (ch == '+' || ch == '-') { return styler[pos - 1] == ch; } } return false; } static bool followsKeyword(StyleContext &sc, Accessor &styler) { Sci_Position pos = (Sci_Position) sc.currentPos; Sci_Position currentLine = styler.GetLine(pos); Sci_Position lineStartPos = styler.LineStart(currentLine); while (--pos > lineStartPos) { char ch = styler.SafeGetCharAt(pos); if (ch != ' ' && ch != '\t') { break; } } styler.Flush(); return styler.StyleAt(pos) == SCE_COFFEESCRIPT_WORD; } #if defined(__clang__) #if __has_warning("-Wunused-but-set-variable") // Disable warning for visibleChars #pragma clang diagnostic ignored "-Wunused-but-set-variable" #endif #endif static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords4 = *keywordlists[3]; CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); CharacterSet setWordStart(CharacterSet::setAlpha, "_$@", 0x80, true); CharacterSet setWord(CharacterSet::setAlphaNum, "._$", 0x80, true); int chPrevNonWhite = ' '; int visibleChars = 0; // String/Regex interpolation variables, based on LexRuby.cxx. // In most cases a value of 2 should be ample for the code the user is // likely to enter. For example, // "Filling the #{container} with #{liquid}..." // from the CoffeeScript homepage nests to a level of 2 // If the user actually hits a 6th occurrence of '#{' in a double-quoted // string (including regexes), it will stay as a string. The problem with // this is that quotes might flip, a 7th '#{' will look like a comment, // and code-folding might be wrong. #define INNER_STRINGS_MAX_COUNT 5 // These vars track our instances of "...#{,,,'..#{,,,}...',,,}..." int inner_string_types[INNER_STRINGS_MAX_COUNT]; // Track # braces when we push a new #{ thing int inner_expn_brace_counts[INNER_STRINGS_MAX_COUNT]; int inner_string_count = 0; int brace_counts = 0; // Number of #{ ... } things within an expression for (int i = 0; i < INNER_STRINGS_MAX_COUNT; i++) { inner_string_types[i] = 0; inner_expn_brace_counts[i] = 0; } // look back to set chPrevNonWhite properly for better regex colouring Sci_Position endPos = startPos + length; if (startPos > 0 && IsSpaceEquiv(initStyle)) { Sci_PositionU back = startPos; styler.Flush(); while (back > 0 && IsSpaceEquiv(styler.StyleAt(--back))) ; if (styler.StyleAt(back) == SCE_COFFEESCRIPT_OPERATOR) { chPrevNonWhite = styler.SafeGetCharAt(back); } if (startPos != back) { initStyle = styler.StyleAt(back); if (IsSpaceEquiv(initStyle)) { initStyle = SCE_COFFEESCRIPT_DEFAULT; } } startPos = back; } StyleContext sc(startPos, endPos - startPos, initStyle, styler); for (; sc.More();) { if (sc.atLineStart) { // Reset states to beginning of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; } // Determine if the current state should terminate. switch (sc.state) { case SCE_COFFEESCRIPT_OPERATOR: sc.SetState(SCE_COFFEESCRIPT_DEFAULT); break; case SCE_COFFEESCRIPT_NUMBER: // We accept almost anything because of hex. and number suffixes if (!setWord.Contains(sc.ch) || sc.Match('.', '.')) { sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; case SCE_COFFEESCRIPT_IDENTIFIER: if (!setWord.Contains(sc.ch) || (sc.ch == '.') || (sc.ch == '$')) { char s[1000]; sc.GetCurrent(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_COFFEESCRIPT_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_COFFEESCRIPT_WORD2); } else if (keywords4.InList(s)) { sc.ChangeState(SCE_COFFEESCRIPT_GLOBALCLASS); } else if (sc.LengthCurrent() > 0 && s[0] == '@') { sc.ChangeState(SCE_COFFEESCRIPT_INSTANCEPROPERTY); } sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; case SCE_COFFEESCRIPT_WORD: case SCE_COFFEESCRIPT_WORD2: case SCE_COFFEESCRIPT_GLOBALCLASS: case SCE_COFFEESCRIPT_INSTANCEPROPERTY: if (!setWord.Contains(sc.ch)) { sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; case SCE_COFFEESCRIPT_COMMENTLINE: if (sc.atLineStart) { sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; case SCE_COFFEESCRIPT_STRING: if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.ch == '#' && sc.chNext == '{' && inner_string_count < INNER_STRINGS_MAX_COUNT) { // process interpolated code #{ ... } enterInnerExpression(inner_string_types, inner_expn_brace_counts, inner_string_count, sc.state, brace_counts); sc.SetState(SCE_COFFEESCRIPT_OPERATOR); sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } break; case SCE_COFFEESCRIPT_CHARACTER: if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } break; case SCE_COFFEESCRIPT_REGEX: if (sc.atLineStart) { sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.ch == '/') { sc.Forward(); while ((sc.ch < 0x80) && islower(sc.ch)) sc.Forward(); // gobble regex flags sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.ch == '\\') { // Gobble up the quoted character if (sc.chNext == '\\' || sc.chNext == '/') { sc.Forward(); } } break; case SCE_COFFEESCRIPT_STRINGEOL: if (sc.atLineStart) { sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; case SCE_COFFEESCRIPT_COMMENTBLOCK: if (sc.Match("###")) { sc.Forward(); sc.Forward(); sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.ch == '\\') { sc.Forward(); } break; case SCE_COFFEESCRIPT_VERBOSE_REGEX: if (sc.Match("///")) { sc.Forward(); sc.Forward(); sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.Match('#')) { sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT); } else if (sc.ch == '\\') { sc.Forward(); } break; case SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT: if (sc.atLineStart) { sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX); } break; } // Determine if a new state should be entered. if (sc.state == SCE_COFFEESCRIPT_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_COFFEESCRIPT_NUMBER); } else if (setWordStart.Contains(sc.ch)) { sc.SetState(SCE_COFFEESCRIPT_IDENTIFIER); } else if (sc.Match("///")) { sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX); sc.Forward(); sc.Forward(); } else if (sc.ch == '/' && (setOKBeforeRE.Contains(chPrevNonWhite) || followsKeyword(sc, styler)) && (!setCouldBePostOp.Contains(chPrevNonWhite) || !FollowsPostfixOperator(sc, styler))) { sc.SetState(SCE_COFFEESCRIPT_REGEX); // JavaScript's RegEx } else if (sc.ch == '\"') { sc.SetState(SCE_COFFEESCRIPT_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_COFFEESCRIPT_CHARACTER); } else if (sc.ch == '#') { if (sc.Match("###")) { sc.SetState(SCE_COFFEESCRIPT_COMMENTBLOCK); sc.Forward(); sc.Forward(); } else { sc.SetState(SCE_COFFEESCRIPT_COMMENTLINE); } } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_COFFEESCRIPT_OPERATOR); // Handle '..' and '...' operators correctly. if (sc.ch == '.') { for (int i = 0; i < 2 && sc.chNext == '.'; i++, sc.Forward()) ; } else if (sc.ch == '{') { ++brace_counts; } else if (sc.ch == '}' && --brace_counts <= 0 && inner_string_count > 0) { // Return to previous state before #{ ... } sc.ForwardSetState(exitInnerExpression(inner_string_types, inner_expn_brace_counts, inner_string_count, brace_counts)); continue; // skip sc.Forward() at loop end } } } if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) { chPrevNonWhite = sc.ch; visibleChars++; } sc.Forward(); } sc.Complete(); } static bool IsCommentLine(Sci_Position line, Accessor &styler) { Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { char ch = styler[i]; if (ch == '#') return true; else if (ch != ' ' && ch != '\t') return false; } return false; } static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { // A simplified version of FoldPyDoc const Sci_Position maxPos = startPos + length; const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line // property fold.coffeescript.comment // Set to 1 to allow folding of comment blocks in CoffeeScript. const bool foldComment = styler.GetPropertyInt("fold.coffeescript.comment") != 0; const bool foldCompact = styler.GetPropertyInt("fold.compact") != 0; // Backtrack to previous non-blank line so we can determine indent level // for any white space lines // and so we can fix any preceding fold level (which is why we go back // at least one line in all cases) int spaceFlags = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); while (lineCurrent > 0) { lineCurrent--; indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) && !IsCommentLine(lineCurrent, styler)) break; } int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; // Set up initial loop state int prevComment = 0; if (lineCurrent >= 1) prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler); // Process all characters to end of requested range // or comment that hangs over the end of the range. Cap processing in all cases // to end of document (in case of comment at end). while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || prevComment)) { // Gather info int lev = indentCurrent; Sci_Position lineNext = lineCurrent + 1; int indentNext = indentCurrent; if (lineNext <= docLines) { // Information about next line is only available if not at end of document indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); } const int comment = foldComment && IsCommentLine(lineCurrent, styler); const int comment_start = (comment && !prevComment && (lineNext <= docLines) && IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE)); const int comment_continue = (comment && prevComment); if (!comment) indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; if (indentNext & SC_FOLDLEVELWHITEFLAG) indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel; if (comment_start) { // Place fold point at start of a block of comments lev |= SC_FOLDLEVELHEADERFLAG; } else if (comment_continue) { // Add level to rest of lines in the block lev = lev + 1; } // Skip past any blank lines for next indent level info; we skip also // comments (all comments, not just those starting in column 0) // which effectively folds them into surrounding code rather // than screwing up folding. while ((lineNext < docLines) && ((indentNext & SC_FOLDLEVELWHITEFLAG) || (lineNext <= docLines && IsCommentLine(lineNext, styler)))) { lineNext++; indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL); } const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK; const int levelBeforeComments = std::max(indentCurrentLevel,levelAfterComments); // Now set all the indent levels on the lines we skipped // Do this from end to start. Once we encounter one line // which is indented more than the line after the end of // the comment-block, use the level of the block before Sci_Position skipLine = lineNext; int skipLevel = levelAfterComments; while (--skipLine > lineCurrent) { int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL); if (foldCompact) { if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) skipLevel = levelBeforeComments; int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; styler.SetLevel(skipLine, skipLevel | whiteFlag); } else { if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments && !(skipLineIndent & SC_FOLDLEVELWHITEFLAG) && !IsCommentLine(skipLine, styler)) skipLevel = levelBeforeComments; styler.SetLevel(skipLine, skipLevel); } } // Set fold header on non-comment line if (!comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) lev |= SC_FOLDLEVELHEADERFLAG; } // Keep track of block comment state of previous line prevComment = comment_start || comment_continue; // Set fold level for this line and move to next line styler.SetLevel(lineCurrent, lev); indentCurrent = indentNext; lineCurrent = lineNext; } } static const char *const csWordLists[] = { "Keywords", "Secondary keywords", "Unused", "Global classes", 0, }; LexerModule lmCoffeeScript(SCLEX_COFFEESCRIPT, ColouriseCoffeeScriptDoc, "coffeescript", FoldCoffeeScriptDoc, csWordLists); ================================================ FILE: lexilla/lexers/LexConf.cxx ================================================ // Scintilla source code edit control /** @file LexConf.cxx ** Lexer for Apache Configuration Files. ** ** First working version contributed by Ahmad Zawawi on October 28, 2000. ** i created this lexer because i needed something pretty when dealing ** when Apache Configuration files... **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static void ColouriseConfDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) { int state = SCE_CONF_DEFAULT; char chNext = styler[startPos]; Sci_Position lengthDoc = startPos + length; // create a buffer large enough to take the largest chunk... char *buffer = new char[length+1]; Sci_Position bufferCount = 0; // this assumes that we have 2 keyword list in conf.properties WordList &directives = *keywordLists[0]; WordList ¶ms = *keywordLists[1]; // go through all provided text segment // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); i++; continue; } switch(state) { case SCE_CONF_DEFAULT: if( ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') { // whitespace is simply ignored here... styler.ColourTo(i,SCE_CONF_DEFAULT); break; } else if( ch == '#' ) { // signals the start of a comment... state = SCE_CONF_COMMENT; styler.ColourTo(i,SCE_CONF_COMMENT); } else if( ch == '.' /*|| ch == '/'*/) { // signals the start of a file... state = SCE_CONF_EXTENSION; styler.ColourTo(i,SCE_CONF_EXTENSION); } else if( ch == '"') { state = SCE_CONF_STRING; styler.ColourTo(i,SCE_CONF_STRING); } else if( IsASCII(ch) && ispunct(ch) ) { // signals an operator... // no state jump necessary for this // simple case... styler.ColourTo(i,SCE_CONF_OPERATOR); } else if( IsASCII(ch) && isalpha(ch) ) { // signals the start of an identifier bufferCount = 0; buffer[bufferCount++] = static_cast(tolower(ch)); state = SCE_CONF_IDENTIFIER; } else if( IsASCII(ch) && isdigit(ch) ) { // signals the start of a number bufferCount = 0; buffer[bufferCount++] = ch; //styler.ColourTo(i,SCE_CONF_NUMBER); state = SCE_CONF_NUMBER; } else { // style it the default style.. styler.ColourTo(i,SCE_CONF_DEFAULT); } break; case SCE_CONF_COMMENT: // if we find a newline here, // we simply go to default state // else continue to work on it... if( ch == '\n' || ch == '\r' ) { state = SCE_CONF_DEFAULT; } else { styler.ColourTo(i,SCE_CONF_COMMENT); } break; case SCE_CONF_EXTENSION: // if we find a non-alphanumeric char, // we simply go to default state // else we're still dealing with an extension... if( (IsASCII(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '$') || (ch == '/') || (ch == '.') || (ch == '*') ) { styler.ColourTo(i,SCE_CONF_EXTENSION); } else { state = SCE_CONF_DEFAULT; chNext = styler[i--]; } break; case SCE_CONF_STRING: // if we find the end of a string char, we simply go to default state // else we're still dealing with an string... if( (ch == '"' && styler.SafeGetCharAt(i-1)!='\\') || (ch == '\n') || (ch == '\r') ) { state = SCE_CONF_DEFAULT; } styler.ColourTo(i,SCE_CONF_STRING); break; case SCE_CONF_IDENTIFIER: // stay in CONF_IDENTIFIER state until we find a non-alphanumeric if( (IsASCII(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) { buffer[bufferCount++] = static_cast(tolower(ch)); } else { state = SCE_CONF_DEFAULT; buffer[bufferCount] = '\0'; // check if the buffer contains a keyword, and highlight it if it is a keyword... if(directives.InList(buffer)) { styler.ColourTo(i-1,SCE_CONF_DIRECTIVE ); } else if(params.InList(buffer)) { styler.ColourTo(i-1,SCE_CONF_PARAMETER ); } else if(strchr(buffer,'/') || strchr(buffer,'.')) { styler.ColourTo(i-1,SCE_CONF_EXTENSION); } else { styler.ColourTo(i-1,SCE_CONF_DEFAULT); } // push back the faulty character chNext = styler[i--]; } break; case SCE_CONF_NUMBER: // stay in CONF_NUMBER state until we find a non-numeric if( (IsASCII(ch) && isdigit(ch)) || ch == '.') { buffer[bufferCount++] = ch; } else { state = SCE_CONF_DEFAULT; buffer[bufferCount] = '\0'; // Colourize here... if( strchr(buffer,'.') ) { // it is an IP address... styler.ColourTo(i-1,SCE_CONF_IP); } else { // normal number styler.ColourTo(i-1,SCE_CONF_NUMBER); } // push back a character chNext = styler[i--]; } break; } } delete []buffer; } static const char * const confWordListDesc[] = { "Directives", "Parameters", 0 }; LexerModule lmConf(SCLEX_CONF, ColouriseConfDoc, "conf", 0, confWordListDesc); ================================================ FILE: lexilla/lexers/LexCrontab.cxx ================================================ // Scintilla source code edit control /** @file LexCrontab.cxx ** Lexer to use with extended crontab files used by a powerful ** Windows scheduler/event monitor/automation manager nnCron. ** (http://nemtsev.eserv.ru/) **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static void ColouriseNncrontabDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) { int state = SCE_NNCRONTAB_DEFAULT; char chNext = styler[startPos]; Sci_Position lengthDoc = startPos + length; // create a buffer large enough to take the largest chunk... char *buffer = new char[length+1]; Sci_Position bufferCount = 0; // used when highliting environment variables inside quoted string: bool insideString = false; // this assumes that we have 3 keyword list in conf.properties WordList §ion = *keywordLists[0]; WordList &keyword = *keywordLists[1]; WordList &modifier = *keywordLists[2]; // go through all provided text segment // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); i++; continue; } switch(state) { case SCE_NNCRONTAB_DEFAULT: if( ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ') { // whitespace is simply ignored here... styler.ColourTo(i,SCE_NNCRONTAB_DEFAULT); break; } else if( ch == '#' && styler.SafeGetCharAt(i+1) == '(') { // signals the start of a task... state = SCE_NNCRONTAB_TASK; styler.ColourTo(i,SCE_NNCRONTAB_TASK); } else if( ch == '\\' && (styler.SafeGetCharAt(i+1) == ' ' || styler.SafeGetCharAt(i+1) == '\t')) { // signals the start of an extended comment... state = SCE_NNCRONTAB_COMMENT; styler.ColourTo(i,SCE_NNCRONTAB_COMMENT); } else if( ch == '#' ) { // signals the start of a plain comment... state = SCE_NNCRONTAB_COMMENT; styler.ColourTo(i,SCE_NNCRONTAB_COMMENT); } else if( ch == ')' && styler.SafeGetCharAt(i+1) == '#') { // signals the end of a task... state = SCE_NNCRONTAB_TASK; styler.ColourTo(i,SCE_NNCRONTAB_TASK); } else if( ch == '"') { state = SCE_NNCRONTAB_STRING; styler.ColourTo(i,SCE_NNCRONTAB_STRING); } else if( ch == '%') { // signals environment variables state = SCE_NNCRONTAB_ENVIRONMENT; styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT); } else if( ch == '<' && styler.SafeGetCharAt(i+1) == '%') { // signals environment variables state = SCE_NNCRONTAB_ENVIRONMENT; styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT); } else if( ch == '*' ) { // signals an asterisk // no state jump necessary for this simple case... styler.ColourTo(i,SCE_NNCRONTAB_ASTERISK); } else if( (IsASCII(ch) && isalpha(ch)) || ch == '<' ) { // signals the start of an identifier bufferCount = 0; buffer[bufferCount++] = ch; state = SCE_NNCRONTAB_IDENTIFIER; } else if( IsASCII(ch) && isdigit(ch) ) { // signals the start of a number bufferCount = 0; buffer[bufferCount++] = ch; state = SCE_NNCRONTAB_NUMBER; } else { // style it the default style.. styler.ColourTo(i,SCE_NNCRONTAB_DEFAULT); } break; case SCE_NNCRONTAB_COMMENT: // if we find a newline here, // we simply go to default state // else continue to work on it... if( ch == '\n' || ch == '\r' ) { state = SCE_NNCRONTAB_DEFAULT; } else { styler.ColourTo(i,SCE_NNCRONTAB_COMMENT); } break; case SCE_NNCRONTAB_TASK: // if we find a newline here, // we simply go to default state // else continue to work on it... if( ch == '\n' || ch == '\r' ) { state = SCE_NNCRONTAB_DEFAULT; } else { styler.ColourTo(i,SCE_NNCRONTAB_TASK); } break; case SCE_NNCRONTAB_STRING: if( ch == '%' ) { state = SCE_NNCRONTAB_ENVIRONMENT; insideString = true; styler.ColourTo(i-1,SCE_NNCRONTAB_STRING); break; } // if we find the end of a string char, we simply go to default state // else we're still dealing with an string... if( (ch == '"' && styler.SafeGetCharAt(i-1)!='\\') || (ch == '\n') || (ch == '\r') ) { state = SCE_NNCRONTAB_DEFAULT; } styler.ColourTo(i,SCE_NNCRONTAB_STRING); break; case SCE_NNCRONTAB_ENVIRONMENT: // if we find the end of a string char, we simply go to default state // else we're still dealing with an string... if( ch == '%' && insideString ) { state = SCE_NNCRONTAB_STRING; insideString = false; break; } if( (ch == '%' && styler.SafeGetCharAt(i-1)!='\\') || (ch == '\n') || (ch == '\r') || (ch == '>') ) { state = SCE_NNCRONTAB_DEFAULT; styler.ColourTo(i,SCE_NNCRONTAB_ENVIRONMENT); break; } styler.ColourTo(i+1,SCE_NNCRONTAB_ENVIRONMENT); break; case SCE_NNCRONTAB_IDENTIFIER: // stay in CONF_IDENTIFIER state until we find a non-alphanumeric if( (IsASCII(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') || (ch == '@') ) { buffer[bufferCount++] = ch; } else { state = SCE_NNCRONTAB_DEFAULT; buffer[bufferCount] = '\0'; // check if the buffer contains a keyword, // and highlight it if it is a keyword... if(section.InList(buffer)) { styler.ColourTo(i,SCE_NNCRONTAB_SECTION ); } else if(keyword.InList(buffer)) { styler.ColourTo(i-1,SCE_NNCRONTAB_KEYWORD ); } // else if(strchr(buffer,'/') || strchr(buffer,'.')) { // styler.ColourTo(i-1,SCE_NNCRONTAB_EXTENSION); // } else if(modifier.InList(buffer)) { styler.ColourTo(i-1,SCE_NNCRONTAB_MODIFIER ); } else { styler.ColourTo(i-1,SCE_NNCRONTAB_DEFAULT); } // push back the faulty character chNext = styler[i--]; } break; case SCE_NNCRONTAB_NUMBER: // stay in CONF_NUMBER state until we find a non-numeric if( IsASCII(ch) && isdigit(ch) /* || ch == '.' */ ) { buffer[bufferCount++] = ch; } else { state = SCE_NNCRONTAB_DEFAULT; buffer[bufferCount] = '\0'; // Colourize here... (normal number) styler.ColourTo(i-1,SCE_NNCRONTAB_NUMBER); // push back a character chNext = styler[i--]; } break; } } delete []buffer; } static const char * const cronWordListDesc[] = { "Section keywords and Forth words", "nnCrontab keywords", "Modifiers", 0 }; LexerModule lmNncrontab(SCLEX_NNCRONTAB, ColouriseNncrontabDoc, "nncrontab", 0, cronWordListDesc); ================================================ FILE: lexilla/lexers/LexCsound.cxx ================================================ // Scintilla source code edit control /** @file LexCsound.cxx ** Lexer for Csound (Orchestra & Score) ** Written by Georg Ritter - **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '?'); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' || ch == '%' || ch == '@' || ch == '$' || ch == '?'); } static inline bool IsCsoundOperator(char ch) { if (IsASCII(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '^' || ch == '[' || ch == ']' || ch == '<' || ch == '&' || ch == '>' || ch == ',' || ch == '|' || ch == '~' || ch == '%' || ch == ':') return true; return false; } static void ColouriseCsoundDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &opcode = *keywordlists[0]; WordList &headerStmt = *keywordlists[1]; WordList &otherKeyword = *keywordlists[2]; // Do not leak onto next line if (initStyle == SCE_CSOUND_STRINGEOL) initStyle = SCE_CSOUND_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // Handle line continuation generically. if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate. if (sc.state == SCE_CSOUND_OPERATOR) { if (!IsCsoundOperator(static_cast(sc.ch))) { sc.SetState(SCE_CSOUND_DEFAULT); } }else if (sc.state == SCE_CSOUND_NUMBER) { if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_CSOUND_DEFAULT); } } else if (sc.state == SCE_CSOUND_IDENTIFIER) { if (!IsAWordChar(sc.ch) ) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (opcode.InList(s)) { sc.ChangeState(SCE_CSOUND_OPCODE); } else if (headerStmt.InList(s)) { sc.ChangeState(SCE_CSOUND_HEADERSTMT); } else if (otherKeyword.InList(s)) { sc.ChangeState(SCE_CSOUND_USERKEYWORD); } else if (s[0] == 'p') { sc.ChangeState(SCE_CSOUND_PARAM); } else if (s[0] == 'a') { sc.ChangeState(SCE_CSOUND_ARATE_VAR); } else if (s[0] == 'k') { sc.ChangeState(SCE_CSOUND_KRATE_VAR); } else if (s[0] == 'i') { // covers both i-rate variables and i-statements sc.ChangeState(SCE_CSOUND_IRATE_VAR); } else if (s[0] == 'g') { sc.ChangeState(SCE_CSOUND_GLOBAL_VAR); } sc.SetState(SCE_CSOUND_DEFAULT); } } else if (sc.state == SCE_CSOUND_COMMENT ) { if (sc.atLineEnd) { sc.SetState(SCE_CSOUND_DEFAULT); } } else if ((sc.state == SCE_CSOUND_ARATE_VAR) || (sc.state == SCE_CSOUND_KRATE_VAR) || (sc.state == SCE_CSOUND_IRATE_VAR)) { if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_CSOUND_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_CSOUND_DEFAULT) { if (sc.ch == ';'){ sc.SetState(SCE_CSOUND_COMMENT); } else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) { sc.SetState(SCE_CSOUND_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_CSOUND_IDENTIFIER); } else if (IsCsoundOperator(static_cast(sc.ch))) { sc.SetState(SCE_CSOUND_OPERATOR); } else if (sc.ch == 'p') { sc.SetState(SCE_CSOUND_PARAM); } else if (sc.ch == 'a') { sc.SetState(SCE_CSOUND_ARATE_VAR); } else if (sc.ch == 'k') { sc.SetState(SCE_CSOUND_KRATE_VAR); } else if (sc.ch == 'i') { // covers both i-rate variables and i-statements sc.SetState(SCE_CSOUND_IRATE_VAR); } else if (sc.ch == 'g') { sc.SetState(SCE_CSOUND_GLOBAL_VAR); } } } sc.Complete(); } static void FoldCsoundInstruments(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int stylePrev = 0; int styleNext = styler.StyleAt(startPos); for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if ((stylePrev != SCE_CSOUND_OPCODE) && (style == SCE_CSOUND_OPCODE)) { char s[20]; unsigned int j = 0; while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) { s[j] = styler[i + j]; j++; } s[j] = '\0'; if (strcmp(s, "instr") == 0) levelCurrent++; if (strcmp(s, "endin") == 0) levelCurrent--; } if (atEOL) { int lev = levelPrev; if (visibleChars == 0) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; stylePrev = style; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const csoundWordListDesc[] = { "Opcodes", "Header Statements", "User keywords", 0 }; LexerModule lmCsound(SCLEX_CSOUND, ColouriseCsoundDoc, "csound", FoldCsoundInstruments, csoundWordListDesc); ================================================ FILE: lexilla/lexers/LexD.cxx ================================================ /** @file LexD.cxx ** Lexer for D. ** ** Copyright (c) 2006 by Waldemar Augustyn ** Converted to lexer object and added further folding features/properties by "Udo Lechner" **/ // Copyright 1998-2005 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; /* Nested comments require keeping the value of the nesting level for every position in the document. But since scintilla always styles line by line, we only need to store one value per line. The non-negative number indicates nesting level at the end of the line. */ // Underscore, letter, digit and universal alphas from C99 Appendix D. static bool IsWordStart(int ch) { return (IsASCII(ch) && (isalpha(ch) || ch == '_')) || !IsASCII(ch); } static bool IsWord(int ch) { return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch); } static bool IsDoxygen(int ch) { if (IsASCII(ch) && islower(ch)) return true; if (ch == '$' || ch == '@' || ch == '\\' || ch == '&' || ch == '#' || ch == '<' || ch == '>' || ch == '{' || ch == '}' || ch == '[' || ch == ']') return true; return false; } static bool IsStringSuffix(int ch) { return ch == 'c' || ch == 'w' || ch == 'd'; } static bool IsStreamCommentStyle(int style) { return style == SCE_D_COMMENT || style == SCE_D_COMMENTDOC || style == SCE_D_COMMENTDOCKEYWORD || style == SCE_D_COMMENTDOCKEYWORDERROR; } // An individual named option for use in an OptionSet // Options used for LexerD struct OptionsD { bool fold; bool foldSyntaxBased; bool foldComment; bool foldCommentMultiline; bool foldCommentExplicit; std::string foldExplicitStart; std::string foldExplicitEnd; bool foldExplicitAnywhere; bool foldCompact; int foldAtElseInt; bool foldAtElse; OptionsD() { fold = false; foldSyntaxBased = true; foldComment = false; foldCommentMultiline = true; foldCommentExplicit = true; foldExplicitStart = ""; foldExplicitEnd = ""; foldExplicitAnywhere = false; foldCompact = true; foldAtElseInt = -1; foldAtElse = false; } }; static const char * const dWordLists[] = { "Primary keywords and identifiers", "Secondary keywords and identifiers", "Documentation comment keywords", "Type definitions and aliases", "Keywords 5", "Keywords 6", "Keywords 7", 0, }; struct OptionSetD : public OptionSet { OptionSetD() { DefineProperty("fold", &OptionsD::fold); DefineProperty("fold.d.syntax.based", &OptionsD::foldSyntaxBased, "Set this property to 0 to disable syntax based folding."); DefineProperty("fold.comment", &OptionsD::foldComment); DefineProperty("fold.d.comment.multiline", &OptionsD::foldCommentMultiline, "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); DefineProperty("fold.d.comment.explicit", &OptionsD::foldCommentExplicit, "Set this property to 0 to disable folding explicit fold points when fold.comment=1."); DefineProperty("fold.d.explicit.start", &OptionsD::foldExplicitStart, "The string to use for explicit fold start points, replacing the standard //{."); DefineProperty("fold.d.explicit.end", &OptionsD::foldExplicitEnd, "The string to use for explicit fold end points, replacing the standard //}."); DefineProperty("fold.d.explicit.anywhere", &OptionsD::foldExplicitAnywhere, "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); DefineProperty("fold.compact", &OptionsD::foldCompact); DefineProperty("lexer.d.fold.at.else", &OptionsD::foldAtElseInt, "This option enables D folding on a \"} else {\" line of an if statement."); DefineProperty("fold.at.else", &OptionsD::foldAtElse); DefineWordListSets(dWordLists); } }; class LexerD : public DefaultLexer { bool caseSensitive; WordList keywords; WordList keywords2; WordList keywords3; WordList keywords4; WordList keywords5; WordList keywords6; WordList keywords7; OptionsD options; OptionSetD osD; public: LexerD(bool caseSensitive_) : DefaultLexer("D", SCLEX_D), caseSensitive(caseSensitive_) { } virtual ~LexerD() { } void SCI_METHOD Release() override { delete this; } int SCI_METHOD Version() const override { return lvRelease5; } const char * SCI_METHOD PropertyNames() override { return osD.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osD.PropertyType(name); } const char * SCI_METHOD DescribeProperty(const char *name) override { return osD.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char *key) override { return osD.PropertyGet(key); } const char * SCI_METHOD DescribeWordListSets() override { return osD.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return 0; } static ILexer5 *LexerFactoryD() { return new LexerD(true); } }; Sci_Position SCI_METHOD LexerD::PropertySet(const char *key, const char *val) { if (osD.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerD::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: wordListN = &keywords; break; case 1: wordListN = &keywords2; break; case 2: wordListN = &keywords3; break; case 3: wordListN = &keywords4; break; case 4: wordListN = &keywords5; break; case 5: wordListN = &keywords6; break; case 6: wordListN = &keywords7; break; } Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); if (*wordListN != wlNew) { wordListN->Set(wl); firstModification = 0; } } return firstModification; } void SCI_METHOD LexerD::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); int styleBeforeDCKeyword = SCE_D_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); Sci_Position curLine = styler.GetLine(startPos); int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0; bool numFloat = false; // Float literals have '+' and '-' signs bool numHex = false; for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { curLine = styler.GetLine(sc.currentPos); styler.SetLineState(curLine, curNcLevel); } // Determine if the current state should terminate. switch (sc.state) { case SCE_D_OPERATOR: sc.SetState(SCE_D_DEFAULT); break; case SCE_D_NUMBER: // We accept almost anything because of hex. and number suffixes if (IsASCII(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) { continue; } else if (sc.ch == '.' && sc.chNext != '.' && !numFloat) { // Don't parse 0..2 as number. numFloat=true; continue; } else if ( ( sc.ch == '-' || sc.ch == '+' ) && ( /*sign and*/ ( !numHex && ( sc.chPrev == 'e' || sc.chPrev == 'E' ) ) || /*decimal or*/ ( sc.chPrev == 'p' || sc.chPrev == 'P' ) ) ) { /*hex*/ // Parse exponent sign in float literals: 2e+10 0x2e+10 continue; } else { sc.SetState(SCE_D_DEFAULT); } break; case SCE_D_IDENTIFIER: if (!IsWord(sc.ch)) { char s[1000]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); } else { sc.GetCurrentLowered(s, sizeof(s)); } if (keywords.InList(s)) { sc.ChangeState(SCE_D_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_D_WORD2); } else if (keywords4.InList(s)) { sc.ChangeState(SCE_D_TYPEDEF); } else if (keywords5.InList(s)) { sc.ChangeState(SCE_D_WORD5); } else if (keywords6.InList(s)) { sc.ChangeState(SCE_D_WORD6); } else if (keywords7.InList(s)) { sc.ChangeState(SCE_D_WORD7); } sc.SetState(SCE_D_DEFAULT); } break; case SCE_D_COMMENT: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_D_DEFAULT); } break; case SCE_D_COMMENTDOC: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_D_DEFAULT); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = SCE_D_COMMENTDOC; sc.SetState(SCE_D_COMMENTDOCKEYWORD); } } break; case SCE_D_COMMENTLINE: if (sc.atLineStart) { sc.SetState(SCE_D_DEFAULT); } break; case SCE_D_COMMENTLINEDOC: if (sc.atLineStart) { sc.SetState(SCE_D_DEFAULT); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = SCE_D_COMMENTLINEDOC; sc.SetState(SCE_D_COMMENTDOCKEYWORD); } } break; case SCE_D_COMMENTDOCKEYWORD: if ((styleBeforeDCKeyword == SCE_D_COMMENTDOC) && sc.Match('*', '/')) { sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); sc.Forward(); sc.ForwardSetState(SCE_D_DEFAULT); } else if (!IsDoxygen(sc.ch)) { char s[100]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); } else { sc.GetCurrentLowered(s, sizeof(s)); } if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); } sc.SetState(styleBeforeDCKeyword); } break; case SCE_D_COMMENTNESTED: if (sc.Match('+', '/')) { if (curNcLevel > 0) curNcLevel -= 1; curLine = styler.GetLine(sc.currentPos); styler.SetLineState(curLine, curNcLevel); sc.Forward(); if (curNcLevel == 0) { sc.ForwardSetState(SCE_D_DEFAULT); } } else if (sc.Match('/','+')) { curNcLevel += 1; curLine = styler.GetLine(sc.currentPos); styler.SetLineState(curLine, curNcLevel); sc.Forward(); } break; case SCE_D_STRING: if (sc.ch == '\\') { if (sc.chNext == '"' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '"') { if(IsStringSuffix(sc.chNext)) sc.Forward(); sc.ForwardSetState(SCE_D_DEFAULT); } break; case SCE_D_CHARACTER: if (sc.atLineEnd) { sc.ChangeState(SCE_D_STRINGEOL); } else if (sc.ch == '\\') { if (sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { // Char has no suffixes sc.ForwardSetState(SCE_D_DEFAULT); } break; case SCE_D_STRINGEOL: if (sc.atLineStart) { sc.SetState(SCE_D_DEFAULT); } break; case SCE_D_STRINGB: if (sc.ch == '`') { if(IsStringSuffix(sc.chNext)) sc.Forward(); sc.ForwardSetState(SCE_D_DEFAULT); } break; case SCE_D_STRINGR: if (sc.ch == '"') { if(IsStringSuffix(sc.chNext)) sc.Forward(); sc.ForwardSetState(SCE_D_DEFAULT); } break; } // Determine if a new state should be entered. if (sc.state == SCE_D_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_D_NUMBER); numFloat = sc.ch == '.'; // Remember hex literal numHex = sc.ch == '0' && ( sc.chNext == 'x' || sc.chNext == 'X' ); } else if ( (sc.ch == 'r' || sc.ch == 'x' || sc.ch == 'q') && sc.chNext == '"' ) { // Limited support for hex and delimited strings: parse as r"" sc.SetState(SCE_D_STRINGR); sc.Forward(); } else if (IsWordStart(sc.ch) || sc.ch == '$') { sc.SetState(SCE_D_IDENTIFIER); } else if (sc.Match('/','+')) { curNcLevel += 1; curLine = styler.GetLine(sc.currentPos); styler.SetLineState(curLine, curNcLevel); sc.SetState(SCE_D_COMMENTNESTED); sc.Forward(); } else if (sc.Match('/', '*')) { if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style sc.SetState(SCE_D_COMMENTDOC); } else { sc.SetState(SCE_D_COMMENT); } sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match('/', '/')) { if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) // Support of Qt/Doxygen doc. style sc.SetState(SCE_D_COMMENTLINEDOC); else sc.SetState(SCE_D_COMMENTLINE); } else if (sc.ch == '"') { sc.SetState(SCE_D_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_D_CHARACTER); } else if (sc.ch == '`') { sc.SetState(SCE_D_STRINGB); } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_D_OPERATOR); if (sc.ch == '.' && sc.chNext == '.') sc.Forward(); // Range operator } } } sc.Complete(); } // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) return; LexAccessor styler(pAccess); Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; bool foldAtElse = options.foldAtElseInt >= 0 ? options.foldAtElseInt != 0 : options.foldAtElse; const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty(); for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev)) { levelNext++; } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } } if (options.foldComment && options.foldCommentExplicit && ((style == SCE_D_COMMENTLINE) || options.foldExplicitAnywhere)) { if (userDefinedFoldMarkers) { if (styler.Match(i, options.foldExplicitStart.c_str())) { levelNext++; } else if (styler.Match(i, options.foldExplicitEnd.c_str())) { levelNext--; } } else { if ((ch == '/') && (chNext == '/')) { char chNext2 = styler.SafeGetCharAt(i + 2); if (chNext2 == '{') { levelNext++; } else if (chNext2 == '}') { levelNext--; } } } } if (options.foldSyntaxBased && (style == SCE_D_OPERATOR)) { if (ch == '{') { // Measure the minimum before a '{' to allow // folding on "} else {" if (levelMinCurrent > levelNext) { levelMinCurrent = levelNext; } levelNext++; } else if (ch == '}') { levelNext--; } } if (atEOL || (i == endPos-1)) { if (options.foldComment && options.foldCommentMultiline) { // Handle nested comments int nc; nc = styler.GetLineState(lineCurrent); nc -= lineCurrent>0? styler.GetLineState(lineCurrent-1): 0; levelNext += nc; } int levelUse = levelCurrent; if (options.foldSyntaxBased && foldAtElse) { levelUse = levelMinCurrent; } int lev = levelUse | levelNext << 16; if (visibleChars == 0 && options.foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelCurrent = levelNext; levelMinCurrent = levelCurrent; visibleChars = 0; } if (!IsASpace(ch)) visibleChars++; } } LexerModule lmD(SCLEX_D, LexerD::LexerFactoryD, "d", dWordLists); ================================================ FILE: lexilla/lexers/LexDMAP.cxx ================================================ // Scintilla source code edit control /** @file LexDMAP.cxx ** Lexer for MSC Nastran DMAP. ** Written by Mark Robinson, based on the Fortran lexer by Chuan-jian Shen, Last changed Aug. 2013 **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. /***************************************/ #include #include #include #include #include #include #include #include /***************************************/ #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" /***************************************/ #if defined(__clang__) && !defined(__APPLE__) // Disable warning for numNonBlank #pragma clang diagnostic ignored "-Wunused-but-set-variable" #endif using namespace Lexilla; /***********************************************/ static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%'); } /**********************************************/ static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch)); } /***************************************/ static void ColouriseDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; /***************************************/ Sci_Position posLineStart = 0, numNonBlank = 0; Sci_Position endPos = startPos + length; /***************************************/ // backtrack to the nearest keyword while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_DMAP_WORD)) { startPos--; } startPos = styler.LineStart(styler.GetLine(startPos)); initStyle = styler.StyleAt(startPos - 1); StyleContext sc(startPos, endPos-startPos, initStyle, styler); /***************************************/ for (; sc.More(); sc.Forward()) { // remember the start position of the line if (sc.atLineStart) { posLineStart = sc.currentPos; numNonBlank = 0; sc.SetState(SCE_DMAP_DEFAULT); } if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; /***********************************************/ // Handle data appearing after column 72; it is ignored Sci_Position toLineStart = sc.currentPos - posLineStart; if (toLineStart >= 72 || sc.ch == '$') { sc.SetState(SCE_DMAP_COMMENT); while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end continue; } /***************************************/ // Determine if the current state should terminate. if (sc.state == SCE_DMAP_OPERATOR) { sc.SetState(SCE_DMAP_DEFAULT); } else if (sc.state == SCE_DMAP_NUMBER) { if (!(IsAWordChar(sc.ch) || sc.ch=='\'' || sc.ch=='\"' || sc.ch=='.')) { sc.SetState(SCE_DMAP_DEFAULT); } } else if (sc.state == SCE_DMAP_IDENTIFIER) { if (!IsAWordChar(sc.ch) || (sc.ch == '%')) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_DMAP_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_DMAP_WORD2); } else if (keywords3.InList(s)) { sc.ChangeState(SCE_DMAP_WORD3); } sc.SetState(SCE_DMAP_DEFAULT); } } else if (sc.state == SCE_DMAP_COMMENT) { if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_DMAP_DEFAULT); } } else if (sc.state == SCE_DMAP_STRING1) { if (sc.ch == '\'') { if (sc.chNext == '\'') { sc.Forward(); } else { sc.ForwardSetState(SCE_DMAP_DEFAULT); } } else if (sc.atLineEnd) { sc.ChangeState(SCE_DMAP_STRINGEOL); sc.ForwardSetState(SCE_DMAP_DEFAULT); } } else if (sc.state == SCE_DMAP_STRING2) { if (sc.atLineEnd) { sc.ChangeState(SCE_DMAP_STRINGEOL); sc.ForwardSetState(SCE_DMAP_DEFAULT); } else if (sc.ch == '\"') { if (sc.chNext == '\"') { sc.Forward(); } else { sc.ForwardSetState(SCE_DMAP_DEFAULT); } } } /***************************************/ // Determine if a new state should be entered. if (sc.state == SCE_DMAP_DEFAULT) { if (sc.ch == '$') { sc.SetState(SCE_DMAP_COMMENT); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) || (sc.ch == '-' && IsADigit(sc.chNext))) { sc.SetState(SCE_F_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_DMAP_IDENTIFIER); } else if (sc.ch == '\"') { sc.SetState(SCE_DMAP_STRING2); } else if (sc.ch == '\'') { sc.SetState(SCE_DMAP_STRING1); } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_DMAP_OPERATOR); } } } sc.Complete(); } /***************************************/ // To determine the folding level depending on keywords static int classifyFoldPointDMAP(const char* s, const char* prevWord) { int lev = 0; if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "enddo") == 0 || strcmp(s, "endif") == 0) { lev = -1; } else if ((strcmp(prevWord, "do") == 0 && strcmp(s, "while") == 0) || strcmp(s, "then") == 0) { lev = 1; } return lev; } // Folding the code static void FoldDMAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { // // bool foldComment = styler.GetPropertyInt("fold.comment") != 0; // Do not know how to fold the comment at the moment. // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; /***************************************/ Sci_Position lastStart = 0; char prevWord[32] = ""; /***************************************/ for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); // if ((stylePrev == SCE_DMAP_DEFAULT || stylePrev == SCE_DMAP_OPERATOR || stylePrev == SCE_DMAP_COMMENT) && (style == SCE_DMAP_WORD)) { // Store last word and label start point. lastStart = i; } /***************************************/ if (style == SCE_DMAP_WORD) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[32]; Sci_PositionU k; for(k=0; (k<31 ) && (k(tolower(styler[lastStart+k])); } s[k] = '\0'; levelCurrent += classifyFoldPointDMAP(s, prevWord); strcpy(prevWord, s); } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; strcpy(prevWord, ""); } /***************************************/ if (!isspacechar(ch)) visibleChars++; } /***************************************/ // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } /***************************************/ static const char * const DMAPWordLists[] = { "Primary keywords and identifiers", "Intrinsic functions", "Extended and user defined functions", 0, }; /***************************************/ LexerModule lmDMAP(SCLEX_DMAP, ColouriseDMAPDoc, "DMAP", FoldDMAPDoc, DMAPWordLists); ================================================ FILE: lexilla/lexers/LexDMIS.cxx ================================================ // Scintilla source code edit control /** @file LexDMIS.cxx ** Lexer for DMIS. **/ // Copyright 1998-2005 by Neil Hodgson // Copyright 2013-2014 by Andreas Tscharner // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "DefaultLexer.h" using namespace Lexilla; static const char *const DMISWordListDesc[] = { "DMIS Major Words", "DMIS Minor Words", "Unsupported DMIS Major Words", "Unsupported DMIS Minor Words", "Keywords for code folding start", "Corresponding keywords for code folding end", 0 }; class LexerDMIS : public DefaultLexer { private: char *m_wordListSets; WordList m_majorWords; WordList m_minorWords; WordList m_unsupportedMajor; WordList m_unsupportedMinor; WordList m_codeFoldingStart; WordList m_codeFoldingEnd; char * SCI_METHOD UpperCase(char *item); void SCI_METHOD InitWordListSets(void); public: LexerDMIS(void); virtual ~LexerDMIS(void); int SCI_METHOD Version() const override { return Scintilla::lvRelease5; } void SCI_METHOD Release() override { delete this; } const char * SCI_METHOD PropertyNames() override { return NULL; } int SCI_METHOD PropertyType(const char *) override { return -1; } const char * SCI_METHOD DescribeProperty(const char *) override { return NULL; } Sci_Position SCI_METHOD PropertySet(const char *, const char *) override { return -1; } const char * SCI_METHOD PropertyGet(const char *) override { return NULL; } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void * SCI_METHOD PrivateCall(int, void *) override { return NULL; } static ILexer5 *LexerFactoryDMIS() { return new LexerDMIS; } const char * SCI_METHOD DescribeWordListSets() override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) override; }; char * SCI_METHOD LexerDMIS::UpperCase(char *item) { char *itemStart; itemStart = item; while (item && *item) { *item = toupper(*item); item++; }; return itemStart; } void SCI_METHOD LexerDMIS::InitWordListSets(void) { size_t totalLen = 0; for (int i=0; DMISWordListDesc[i]; i++) { totalLen += strlen(DMISWordListDesc[i]); totalLen++; }; totalLen++; this->m_wordListSets = new char[totalLen]; memset(this->m_wordListSets, 0, totalLen); for (int i=0; DMISWordListDesc[i]; i++) { strcat(this->m_wordListSets, DMISWordListDesc[i]); strcat(this->m_wordListSets, "\n"); }; } LexerDMIS::LexerDMIS(void) : DefaultLexer("DMIS", SCLEX_DMIS) { this->InitWordListSets(); this->m_majorWords.Clear(); this->m_minorWords.Clear(); this->m_unsupportedMajor.Clear(); this->m_unsupportedMinor.Clear(); this->m_codeFoldingStart.Clear(); this->m_codeFoldingEnd.Clear(); } LexerDMIS::~LexerDMIS(void) { delete[] this->m_wordListSets; } Sci_Position SCI_METHOD LexerDMIS::WordListSet(int n, const char *wl) { switch (n) { case 0: this->m_majorWords.Clear(); this->m_majorWords.Set(wl); break; case 1: this->m_minorWords.Clear(); this->m_minorWords.Set(wl); break; case 2: this->m_unsupportedMajor.Clear(); this->m_unsupportedMajor.Set(wl); break; case 3: this->m_unsupportedMinor.Clear(); this->m_unsupportedMinor.Set(wl); break; case 4: this->m_codeFoldingStart.Clear(); this->m_codeFoldingStart.Set(wl); break; case 5: this->m_codeFoldingEnd.Clear(); this->m_codeFoldingEnd.Set(wl); break; default: return -1; break; } return 0; } const char * SCI_METHOD LexerDMIS::DescribeWordListSets() { return this->m_wordListSets; } void SCI_METHOD LexerDMIS::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, Scintilla::IDocument *pAccess) { const Sci_PositionU MAX_STR_LEN = 100; LexAccessor styler(pAccess); StyleContext scCTX(startPos, lengthDoc, initStyle, styler); CharacterSet setDMISNumber(CharacterSet::setDigits, ".-+eE"); CharacterSet setDMISWordStart(CharacterSet::setAlpha, "-234", 0x80, true); CharacterSet setDMISWord(CharacterSet::setAlpha); bool isIFLine = false; for (; scCTX.More(); scCTX.Forward()) { if (scCTX.atLineEnd) { isIFLine = false; }; switch (scCTX.state) { case SCE_DMIS_DEFAULT: if (scCTX.Match('$', '$')) { scCTX.SetState(SCE_DMIS_COMMENT); scCTX.Forward(); }; if (scCTX.Match('\'')) { scCTX.SetState(SCE_DMIS_STRING); }; if (IsADigit(scCTX.ch) || ((scCTX.Match('-') || scCTX.Match('+')) && IsADigit(scCTX.chNext))) { scCTX.SetState(SCE_DMIS_NUMBER); break; }; if (setDMISWordStart.Contains(scCTX.ch)) { scCTX.SetState(SCE_DMIS_KEYWORD); }; if (scCTX.Match('(') && (!isIFLine)) { scCTX.SetState(SCE_DMIS_LABEL); }; break; case SCE_DMIS_COMMENT: if (scCTX.atLineEnd) { scCTX.SetState(SCE_DMIS_DEFAULT); }; break; case SCE_DMIS_STRING: if (scCTX.Match('\'')) { scCTX.SetState(SCE_DMIS_DEFAULT); }; break; case SCE_DMIS_NUMBER: if (!setDMISNumber.Contains(scCTX.ch)) { scCTX.SetState(SCE_DMIS_DEFAULT); }; break; case SCE_DMIS_KEYWORD: if (!setDMISWord.Contains(scCTX.ch)) { char tmpStr[MAX_STR_LEN]; memset(tmpStr, 0, MAX_STR_LEN*sizeof(char)); scCTX.GetCurrent(tmpStr, (MAX_STR_LEN-1)); // The following strncpy is copying from a string back onto itself which is weird and causes warnings // but is harmless so turn off the warning #if defined(__GNUC__) && !defined(__clang__) // Disable warning for strncpy #pragma GCC diagnostic ignored "-Wrestrict" #endif strncpy(tmpStr, this->UpperCase(tmpStr), (MAX_STR_LEN-1)); if (this->m_minorWords.InList(tmpStr)) { scCTX.ChangeState(SCE_DMIS_MINORWORD); }; if (this->m_majorWords.InList(tmpStr)) { isIFLine = (strcmp(tmpStr, "IF") == 0); scCTX.ChangeState(SCE_DMIS_MAJORWORD); }; if (this->m_unsupportedMajor.InList(tmpStr)) { scCTX.ChangeState(SCE_DMIS_UNSUPPORTED_MAJOR); }; if (this->m_unsupportedMinor.InList(tmpStr)) { scCTX.ChangeState(SCE_DMIS_UNSUPPORTED_MINOR); }; if (scCTX.Match('(') && (!isIFLine)) { scCTX.SetState(SCE_DMIS_LABEL); } else { scCTX.SetState(SCE_DMIS_DEFAULT); }; }; break; case SCE_DMIS_LABEL: if (scCTX.Match(')')) { scCTX.SetState(SCE_DMIS_DEFAULT); }; break; }; }; scCTX.Complete(); } void SCI_METHOD LexerDMIS::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int, Scintilla::IDocument *pAccess) { const int MAX_STR_LEN = 100; LexAccessor styler(pAccess); Sci_PositionU endPos = startPos + lengthDoc; char chNext = styler[startPos]; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int strPos = 0; bool foldWordPossible = false; CharacterSet setDMISFoldWord(CharacterSet::setAlpha); char *tmpStr; tmpStr = new char[MAX_STR_LEN]; memset(tmpStr, 0, MAX_STR_LEN*sizeof(char)); for (Sci_PositionU i=startPos; i= (MAX_STR_LEN-1)) { strPos = MAX_STR_LEN-1; }; int style = styler.StyleAt(i); bool noFoldPos = ((style == SCE_DMIS_COMMENT) || (style == SCE_DMIS_STRING)); if (foldWordPossible) { if (setDMISFoldWord.Contains(ch)) { tmpStr[strPos++] = ch; } else { tmpStr = this->UpperCase(tmpStr); if (this->m_codeFoldingStart.InList(tmpStr) && (!noFoldPos)) { levelCurrent++; }; if (this->m_codeFoldingEnd.InList(tmpStr) && (!noFoldPos)) { levelCurrent--; }; memset(tmpStr, 0, MAX_STR_LEN*sizeof(char)); strPos = 0; foldWordPossible = false; }; } else { if (setDMISFoldWord.Contains(ch)) { tmpStr[strPos++] = ch; foldWordPossible = true; }; }; if (atEOL || (i == (endPos-1))) { int lev = levelPrev; if (levelCurrent > levelPrev) { lev |= SC_FOLDLEVELHEADERFLAG; }; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); }; lineCurrent++; levelPrev = levelCurrent; }; }; delete[] tmpStr; } LexerModule lmDMIS(SCLEX_DMIS, LexerDMIS::LexerFactoryDMIS, "DMIS", DMISWordListDesc); ================================================ FILE: lexilla/lexers/LexDataflex.cxx ================================================ // Scintilla source code edit control /** @file LexDataflex.cxx ** Lexer for DataFlex. ** Based on LexPascal.cxx ** Written by Wil van Antwerpen, June 2019 **/ /* // The License.txt file describes the conditions under which this software may be distributed. A few words about features of LexDataflex... Generally speaking LexDataflex tries to support all available DataFlex features (up to DataFlex 19.1 at this time). ~ FOLDING: Folding is supported in the following cases: - Folding of stream-like comments - Folding of groups of consecutive line comments - Folding of preprocessor blocks (the following preprocessor blocks are supported: #IFDEF, #IFNDEF, #ENDIF and #HEADER / #ENDHEADER blocks), - Folding of code blocks on appropriate keywords (the following code blocks are supported: "begin, struct, type, case / end" blocks, class & object declarations and interface declarations) Remarks: - We pass 4 arrays to the lexer: 1. The DataFlex keyword list, these are normal DataFlex keywords 2. The Scope Open list, for example, begin / procedure / while 3. The Scope Close list, for example, end / end_procedure / loop 4. Operator list, for ex. + / - / * / Lt / iand These lists are all mutually exclusive, scope open words should not be in the keyword list and vice versa - Folding of code blocks tries to handle all special cases in which folding should not occur. ~ KEYWORDS: The list of keywords that can be used in dataflex.properties file (up to DataFlex 19.1): - Keywords: .. snipped .. see dataflex.properties file. */ #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static void GetRangeLowered(Sci_PositionU start, Sci_PositionU end, Accessor &styler, char *s, Sci_PositionU len) { Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast(tolower(styler[start + i])); i++; } s[i] = '\0'; } static void GetForwardRangeLowered(Sci_PositionU start, CharacterSet &charSet, Accessor &styler, char *s, Sci_PositionU len) { Sci_PositionU i = 0; while ((i < len-1) && charSet.Contains(styler.SafeGetCharAt(start + i))) { s[i] = static_cast(tolower(styler.SafeGetCharAt(start + i))); i++; } s[i] = '\0'; } enum { stateInICode = 0x1000, stateSingleQuoteOpen = 0x2000, stateDoubleQuoteOpen = 0x4000, stateFoldInPreprocessor = 0x0100, stateFoldInCaseStatement = 0x0200, stateFoldInPreprocessorLevelMask = 0x00FF, stateFoldMaskAll = 0x0FFF }; static bool IsFirstDataFlexWord(Sci_Position pos, Accessor &styler) { Sci_Position line = styler.GetLine(pos); Sci_Position start_pos = styler.LineStart(line); for (Sci_Position i = start_pos; i < pos; i++) { char ch = styler.SafeGetCharAt(i); if (!(ch == ' ' || ch == '\t')) return false; } return true; } inline bool IsADataFlexField(int ch) { return (ch == '.'); } static void ClassifyDataFlexWord(WordList *keywordlists[], StyleContext &sc, Accessor &styler) { WordList& keywords = *keywordlists[0]; WordList& scopeOpen = *keywordlists[1]; WordList& scopeClosed = *keywordlists[2]; WordList& operators = *keywordlists[3]; char s[100]; int oldState; int newState; size_t tokenlen; oldState = sc.state; newState = oldState; sc.GetCurrentLowered(s, sizeof(s)); tokenlen = strnlen(s,sizeof(s)); if (keywords.InList(s)) { // keywords in DataFlex can be used as table column names (file.field) and as such they // should not be characterized as a keyword. So test for that. // for ex. somebody using date as field name. if (!IsADataFlexField(sc.GetRelative(-static_cast(tokenlen+1)))) { newState = SCE_DF_WORD; } } if (oldState == newState) { if ((scopeOpen.InList(s) || scopeClosed.InList(s)) && (strcmp(s, "for") != 0) && (strcmp(s, "repeat") != 0)) { // scope words in DataFlex can be used as table column names (file.field) and as such they // should not be characterized as a scope word. So test for that. // for ex. somebody using procedure for field name. if (!IsADataFlexField(sc.GetRelative(-static_cast(tokenlen+1)))) { newState = SCE_DF_SCOPEWORD; } } // no code folding on the next words, but just want to paint them like keywords (as they are) (??? doesn't the code to the opposite?) if (strcmp(s, "if") == 0 || strcmp(s, "ifnot") == 0 || strcmp(s, "case") == 0 || strcmp(s, "else") == 0 ) { newState = SCE_DF_SCOPEWORD; } } if (oldState != newState && newState == SCE_DF_WORD) { // a for loop must have for at the start of the line, for is also used in "define abc for 123" if ( (strcmp(s, "for") == 0) && (IsFirstDataFlexWord(sc.currentPos-3, styler)) ) { newState = SCE_DF_SCOPEWORD; } } if (oldState != newState && newState == SCE_DF_WORD) { // a repeat loop must have repeat at the start of the line, repeat is also used in 'move (repeat("d",5)) to sFoo' if ( (strcmp(s, "repeat") == 0) && (IsFirstDataFlexWord(sc.currentPos-6, styler)) ) { newState = SCE_DF_SCOPEWORD; } } if (oldState == newState) { if (operators.InList(s)) { newState = SCE_DF_OPERATOR; } } if (oldState != newState) { sc.ChangeState(newState); } sc.SetState(SCE_DF_DEFAULT); } static void ColouriseDataFlexDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { // bool bSmartHighlighting = styler.GetPropertyInt("lexer.dataflex.smart.highlighting", 1) != 0; CharacterSet setWordStart(CharacterSet::setAlpha, "_$#@", 0x80, true); CharacterSet setWord(CharacterSet::setAlphaNum, "_$#@", 0x80, true); CharacterSet setNumber(CharacterSet::setDigits, ".-+eE"); CharacterSet setHexNumber(CharacterSet::setDigits, "abcdefABCDEF"); CharacterSet setOperator(CharacterSet::setNone, "*+-/<=>^"); Sci_Position curLine = styler.GetLine(startPos); int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineEnd) { // Update the line state, so it can be seen by next line curLine = styler.GetLine(sc.currentPos); styler.SetLineState(curLine, curLineState); } // Determine if the current state should terminate. switch (sc.state) { case SCE_DF_NUMBER: if (!setNumber.Contains(sc.ch) || (sc.ch == '.' && sc.chNext == '.')) { sc.SetState(SCE_DF_DEFAULT); } else if (sc.ch == '-' || sc.ch == '+') { if (sc.chPrev != 'E' && sc.chPrev != 'e') { sc.SetState(SCE_DF_DEFAULT); } } break; case SCE_DF_IDENTIFIER: if (!setWord.Contains(sc.ch)) { ClassifyDataFlexWord(keywordlists, sc, styler); } break; case SCE_DF_HEXNUMBER: if (!(setHexNumber.Contains(sc.ch) || sc.ch == 'I') ) { // in |CI$22a we also want to color the "I" sc.SetState(SCE_DF_DEFAULT); } break; case SCE_DF_METATAG: if (sc.atLineStart || sc.chPrev == '}') { sc.SetState(SCE_DF_DEFAULT); } break; case SCE_DF_PREPROCESSOR: if (sc.atLineStart || IsASpaceOrTab(sc.ch)) { sc.SetState(SCE_DF_DEFAULT); } break; case SCE_DF_IMAGE: if (sc.atLineStart && sc.Match("/*")) { sc.Forward(); // these characters are still part of the DF Image sc.ForwardSetState(SCE_DF_DEFAULT); } break; case SCE_DF_PREPROCESSOR2: // we don't have inline comments or preprocessor2 commands //if (sc.Match('*', ')')) { // sc.Forward(); // sc.ForwardSetState(SCE_DF_DEFAULT); //} break; case SCE_DF_COMMENTLINE: if (sc.atLineStart) { sc.SetState(SCE_DF_DEFAULT); } break; case SCE_DF_STRING: if (sc.atLineEnd) { sc.ChangeState(SCE_DF_STRINGEOL); } else if (sc.ch == '\'' && sc.chNext == '\'') { sc.Forward(); } else if (sc.ch == '\"' && sc.chNext == '\"') { sc.Forward(); } else if (sc.ch == '\'' || sc.ch == '\"') { if (sc.ch == '\'' && (curLineState & stateSingleQuoteOpen) ) { curLineState &= ~(stateSingleQuoteOpen); sc.ForwardSetState(SCE_DF_DEFAULT); } else if (sc.ch == '\"' && (curLineState & stateDoubleQuoteOpen) ) { curLineState &= ~(stateDoubleQuoteOpen); sc.ForwardSetState(SCE_DF_DEFAULT); } } break; case SCE_DF_STRINGEOL: if (sc.atLineStart) { sc.SetState(SCE_DF_DEFAULT); } break; case SCE_DF_SCOPEWORD: //if (!setHexNumber.Contains(sc.ch) && sc.ch != '$') { // sc.SetState(SCE_DF_DEFAULT); //} break; case SCE_DF_OPERATOR: // if (bSmartHighlighting && sc.chPrev == ';') { // curLineState &= ~(stateInProperty | stateInExport); // } sc.SetState(SCE_DF_DEFAULT); break; case SCE_DF_ICODE: if (sc.atLineStart || IsASpace(sc.ch) || isoperator(sc.ch)) { sc.SetState(SCE_DF_DEFAULT); } break; } // Determine if a new state should be entered. if (sc.state == SCE_DF_DEFAULT) { if (IsADigit(sc.ch)) { sc.SetState(SCE_DF_NUMBER); } else if (sc.Match('/', '/') || sc.Match("#REM")) { sc.SetState(SCE_DF_COMMENTLINE); } else if ((sc.ch == '#' && !sc.Match("#REM")) && IsFirstDataFlexWord(sc.currentPos, styler)) { sc.SetState(SCE_DF_PREPROCESSOR); // || (sc.ch == '|' && sc.chNext == 'C' && sc.GetRelativeCharacter(2) == 'I' && sc.GetRelativeCharacter(3) == '$') ) { } else if ((sc.ch == '$' && ((!setWord.Contains(sc.chPrev)) || sc.chPrev == 'I' ) ) || (sc.Match("|CI$")) ) { sc.SetState(SCE_DF_HEXNUMBER); // start with $ and previous character not in a..zA..Z0..9 excluding "I" OR start with |CI$ } else if (setWordStart.Contains(sc.ch)) { sc.SetState(SCE_DF_IDENTIFIER); } else if (sc.ch == '{') { sc.SetState(SCE_DF_METATAG); //} else if (sc.Match("(*$")) { // sc.SetState(SCE_DF_PREPROCESSOR2); } else if (sc.ch == '/' && setWord.Contains(sc.chNext) && sc.atLineStart) { sc.SetState(SCE_DF_IMAGE); // sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.ch == '\'' || sc.ch == '\"') { if (sc.ch == '\'' && !(curLineState & stateDoubleQuoteOpen)) { curLineState |= stateSingleQuoteOpen; } else if (sc.ch == '\"' && !(curLineState & stateSingleQuoteOpen)) { curLineState |= stateDoubleQuoteOpen; } sc.SetState(SCE_DF_STRING); } else if (setOperator.Contains(sc.ch)) { sc.SetState(SCE_DF_OPERATOR); // } else if (curLineState & stateInICode) { // ICode start ! in a string followed by close string mark is not icode } else if ((sc.ch == '!') && !(sc.ch == '!' && ((sc.chNext == '\"') || (sc.ch == '\'')) )) { sc.SetState(SCE_DF_ICODE); } } } if (sc.state == SCE_DF_IDENTIFIER && setWord.Contains(sc.chPrev)) { ClassifyDataFlexWord(keywordlists, sc, styler); } sc.Complete(); } static bool IsStreamCommentStyle(int style) { return style == SCE_DF_IMAGE; } static bool IsCommentLine(Sci_Position line, Accessor &styler) { Sci_Position pos = styler.LineStart(line); Sci_Position eolPos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eolPos; i++) { char ch = styler[i]; char chNext = styler.SafeGetCharAt(i + 1); int style = styler.StyleAt(i); if (ch == '/' && chNext == '/' && style == SCE_DF_COMMENTLINE) { return true; } else if (!IsASpaceOrTab(ch)) { return false; } } return false; } static unsigned int GetFoldInPreprocessorLevelFlag(int lineFoldStateCurrent) { return lineFoldStateCurrent & stateFoldInPreprocessorLevelMask; } static void SetFoldInPreprocessorLevelFlag(int &lineFoldStateCurrent, unsigned int nestLevel) { lineFoldStateCurrent &= ~stateFoldInPreprocessorLevelMask; lineFoldStateCurrent |= nestLevel & stateFoldInPreprocessorLevelMask; } static int ClassifyDataFlexPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent, Sci_PositionU startPos, Accessor &styler) { CharacterSet setWord(CharacterSet::setAlpha); char s[100]; // Size of the longest possible keyword + one additional character + null GetForwardRangeLowered(startPos, setWord, styler, s, sizeof(s)); size_t iLen = strnlen(s,sizeof(s)); size_t iWordSize = 0; unsigned int nestLevel = GetFoldInPreprocessorLevelFlag(lineFoldStateCurrent); if (strcmp(s, "command") == 0 || // The #if/#ifdef etcetera commands are not currently foldable as it is easy to write code that // breaks the collaps logic, so we keep things simple and not include that for now. strcmp(s, "header") == 0) { nestLevel++; SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel); lineFoldStateCurrent |= stateFoldInPreprocessor; levelCurrent++; iWordSize = iLen; } else if (strcmp(s, "endcommand") == 0 || strcmp(s, "endheader") == 0) { nestLevel--; SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel); if (nestLevel == 0) { lineFoldStateCurrent &= ~stateFoldInPreprocessor; } levelCurrent--; iWordSize = iLen; if (levelCurrent < SC_FOLDLEVELBASE) { levelCurrent = SC_FOLDLEVELBASE; } } return static_cast(iWordSize); } static void ClassifyDataFlexWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent, Sci_PositionU lastStart, Sci_PositionU currentPos, WordList *[], Accessor &styler) { char s[100]; // property fold.dataflex.compilerlist // Set to 1 for enabling the code folding feature in *.prn files bool foldPRN = styler.GetPropertyInt("fold.dataflex.compilerlist",0) != 0; GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s)); if (strcmp(s, "case") == 0) { lineFoldStateCurrent |= stateFoldInCaseStatement; } else if (strcmp(s, "begin") == 0) { levelCurrent++; } else if (strcmp(s, "for") == 0 || strcmp(s, "while") == 0 || strcmp(s, "repeat") == 0 || strcmp(s, "for_all") == 0 || strcmp(s, "struct") == 0 || strcmp(s, "type") == 0 || strcmp(s, "begin_row") == 0 || strcmp(s, "item_list") == 0 || strcmp(s, "begin_constraints") == 0 || strcmp(s, "begin_transaction") == 0 || strcmp(s, "enum_list") == 0 || strcmp(s, "class") == 0 || strcmp(s, "object") == 0 || strcmp(s, "cd_popup_object") == 0 || strcmp(s, "procedure") == 0 || strcmp(s, "procedure_section") == 0 || strcmp(s, "function") == 0 ) { if ((IsFirstDataFlexWord(lastStart, styler )) || foldPRN) { levelCurrent++; } } else if (strcmp(s, "end") == 0) { // end is not always the first keyword, for example "case end" levelCurrent--; if (levelCurrent < SC_FOLDLEVELBASE) { levelCurrent = SC_FOLDLEVELBASE; } } else if (strcmp(s, "loop") == 0 || strcmp(s, "until") == 0 || strcmp(s, "end_class") == 0 || strcmp(s, "end_object") == 0 || strcmp(s, "cd_end_object") == 0 || strcmp(s, "end_procedure") == 0 || strcmp(s, "end_function") == 0 || strcmp(s, "end_for_all") == 0 || strcmp(s, "end_struct") == 0 || strcmp(s, "end_type") == 0 || strcmp(s, "end_row") == 0 || strcmp(s, "end_item_list") == 0 || strcmp(s, "end_constraints") == 0 || strcmp(s, "end_transaction") == 0 || strcmp(s, "end_enum_list") == 0 ) { // lineFoldStateCurrent &= ~stateFoldInRecord; if ((IsFirstDataFlexWord(lastStart, styler )) || foldPRN) { levelCurrent--; if (levelCurrent < SC_FOLDLEVELBASE) { levelCurrent = SC_FOLDLEVELBASE; } } } } static void ClassifyDataFlexMetaDataFoldPoint(int &levelCurrent, Sci_PositionU lastStart, Sci_PositionU currentPos, WordList *[], Accessor &styler) { char s[100]; GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s)); if (strcmp(s, "#beginsection") == 0) { levelCurrent++; } else if (strcmp(s, "#endsection") == 0) { levelCurrent--; if (levelCurrent < SC_FOLDLEVELBASE) { levelCurrent = SC_FOLDLEVELBASE; } } } static void FoldDataFlexDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; int lineFoldStateCurrent = lineCurrent > 0 ? styler.GetLineState(lineCurrent - 1) & stateFoldMaskAll : 0; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; int iWordSize; Sci_Position lastStart = 0; CharacterSet setWord(CharacterSet::setAlphaNum, "_$#@", 0x80, true); for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev)) { levelCurrent++; } else if (!IsStreamCommentStyle(styleNext)) { levelCurrent--; } } if (foldComment && atEOL && IsCommentLine(lineCurrent, styler)) { if (!IsCommentLine(lineCurrent - 1, styler) && IsCommentLine(lineCurrent + 1, styler)) levelCurrent++; else if (IsCommentLine(lineCurrent - 1, styler) && !IsCommentLine(lineCurrent+1, styler)) levelCurrent--; } if (foldPreprocessor) { if (style == SCE_DF_PREPROCESSOR) { iWordSize = ClassifyDataFlexPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 1, styler); //} else if (style == SCE_DF_PREPROCESSOR2 && ch == '(' && chNext == '*' // && styler.SafeGetCharAt(i + 2) == '$') { // ClassifyDataFlexPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 3, styler); i = i + iWordSize; } } if (stylePrev != SCE_DF_SCOPEWORD && style == SCE_DF_SCOPEWORD) { // Store last word start point. lastStart = i; } if (stylePrev == SCE_DF_SCOPEWORD) { if(setWord.Contains(ch) && !setWord.Contains(chNext)) { ClassifyDataFlexWordFoldPoint(levelCurrent, lineFoldStateCurrent, lastStart, i, keywordlists, styler); } } if (stylePrev == SCE_DF_METATAG && ch == '#') { // Store last word start point. lastStart = i; } if (stylePrev == SCE_DF_METATAG) { if(setWord.Contains(ch) && !setWord.Contains(chNext)) { ClassifyDataFlexMetaDataFoldPoint(levelCurrent, lastStart, i, keywordlists, styler); } } if (!IsASpace(ch)) visibleChars++; if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } int newLineState = (styler.GetLineState(lineCurrent) & ~stateFoldMaskAll) | lineFoldStateCurrent; styler.SetLineState(lineCurrent, newLineState); lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } } // If we didn't reach the EOL in previous loop, store line level and whitespace information. // The rest will be filled in later... int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; styler.SetLevel(lineCurrent, lev); } static const char * const dataflexWordListDesc[] = { "Keywords", "Scope open", "Scope close", "Operators", 0 }; LexerModule lmDataflex(SCLEX_DATAFLEX, ColouriseDataFlexDoc, "dataflex", FoldDataFlexDoc, dataflexWordListDesc); ================================================ FILE: lexilla/lexers/LexDiff.cxx ================================================ // Scintilla source code edit control /** @file LexDiff.cxx ** Lexer for diff results. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; namespace { inline bool AtEOL(Accessor &styler, Sci_PositionU i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } void ColouriseDiffLine(const char *lineBuffer, Sci_Position endLine, Accessor &styler) { // It is needed to remember the current state to recognize starting // comment lines before the first "diff " or "--- ". If a real // difference starts then each line starting with ' ' is a whitespace // otherwise it is considered a comment (Only in..., Binary file...) if (0 == strncmp(lineBuffer, "diff ", 5)) { styler.ColourTo(endLine, SCE_DIFF_COMMAND); } else if (0 == strncmp(lineBuffer, "Index: ", 7)) { // For subversion's diff styler.ColourTo(endLine, SCE_DIFF_COMMAND); } else if (0 == strncmp(lineBuffer, "---", 3) && lineBuffer[3] != '-') { // In a context diff, --- appears in both the header and the position markers if (lineBuffer[3] == ' ' && atoi(lineBuffer + 4) && !strchr(lineBuffer, '/')) styler.ColourTo(endLine, SCE_DIFF_POSITION); else if (lineBuffer[3] == '\r' || lineBuffer[3] == '\n') styler.ColourTo(endLine, SCE_DIFF_POSITION); else if (lineBuffer[3] == ' ') styler.ColourTo(endLine, SCE_DIFF_HEADER); else styler.ColourTo(endLine, SCE_DIFF_DELETED); } else if (0 == strncmp(lineBuffer, "+++ ", 4)) { // I don't know of any diff where "+++ " is a position marker, but for // consistency, do the same as with "--- " and "*** ". if (atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) styler.ColourTo(endLine, SCE_DIFF_POSITION); else styler.ColourTo(endLine, SCE_DIFF_HEADER); } else if (0 == strncmp(lineBuffer, "====", 4)) { // For p4's diff styler.ColourTo(endLine, SCE_DIFF_HEADER); } else if (0 == strncmp(lineBuffer, "***", 3)) { // In a context diff, *** appears in both the header and the position markers. // Also ******** is a chunk header, but here it's treated as part of the // position marker since there is no separate style for a chunk header. if (lineBuffer[3] == ' ' && atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) styler.ColourTo(endLine, SCE_DIFF_POSITION); else if (lineBuffer[3] == '*') styler.ColourTo(endLine, SCE_DIFF_POSITION); else styler.ColourTo(endLine, SCE_DIFF_HEADER); } else if (0 == strncmp(lineBuffer, "? ", 2)) { // For difflib styler.ColourTo(endLine, SCE_DIFF_HEADER); } else if (lineBuffer[0] == '@') { styler.ColourTo(endLine, SCE_DIFF_POSITION); } else if (lineBuffer[0] >= '0' && lineBuffer[0] <= '9') { styler.ColourTo(endLine, SCE_DIFF_POSITION); } else if (0 == strncmp(lineBuffer, "++", 2)) { styler.ColourTo(endLine, SCE_DIFF_PATCH_ADD); } else if (0 == strncmp(lineBuffer, "+-", 2)) { styler.ColourTo(endLine, SCE_DIFF_PATCH_DELETE); } else if (0 == strncmp(lineBuffer, "-+", 2)) { styler.ColourTo(endLine, SCE_DIFF_REMOVED_PATCH_ADD); } else if (0 == strncmp(lineBuffer, "--", 2)) { styler.ColourTo(endLine, SCE_DIFF_REMOVED_PATCH_DELETE); } else if (lineBuffer[0] == '-' || lineBuffer[0] == '<') { styler.ColourTo(endLine, SCE_DIFF_DELETED); } else if (lineBuffer[0] == '+' || lineBuffer[0] == '>') { styler.ColourTo(endLine, SCE_DIFF_ADDED); } else if (lineBuffer[0] == '!') { styler.ColourTo(endLine, SCE_DIFF_CHANGED); } else if (lineBuffer[0] != ' ') { styler.ColourTo(endLine, SCE_DIFF_COMMENT); } else { styler.ColourTo(endLine, SCE_DIFF_DEFAULT); } } void ColouriseDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { std::string lineBuffer; styler.StartAt(startPos); styler.StartSegment(startPos); for (Sci_PositionU i = startPos; i < startPos + length; i++) { if (AtEOL(styler, i)) { ColouriseDiffLine(lineBuffer.c_str(), i, styler); lineBuffer.clear(); } else { lineBuffer.push_back(styler[i]); } } if (!lineBuffer.empty()) { // Last line does not have ending characters ColouriseDiffLine(lineBuffer.c_str(), startPos + length - 1, styler); } } void FoldDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { Sci_Position curLine = styler.GetLine(startPos); Sci_Position curLineStart = styler.LineStart(curLine); int prevLevel = curLine > 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE; do { int nextLevel = 0; const int lineType = styler.StyleAt(curLineStart); if (lineType == SCE_DIFF_COMMAND) nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; else if (lineType == SCE_DIFF_HEADER) nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG; else if (lineType == SCE_DIFF_POSITION && styler[curLineStart] != '-') nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG; else if (prevLevel & SC_FOLDLEVELHEADERFLAG) nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1; else nextLevel = prevLevel; if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel)) styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG); styler.SetLevel(curLine, nextLevel); prevLevel = nextLevel; curLineStart = styler.LineStart(++curLine); } while (static_cast(startPos)+length > curLineStart); } const char *const emptyWordListDesc[] = { nullptr }; } LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc); ================================================ FILE: lexilla/lexers/LexECL.cxx ================================================ // Scintilla source code edit control /** @file LexECL.cxx ** Lexer for ECL. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #ifdef _MSC_VER #pragma warning(disable: 4786) #endif #ifdef __BORLANDC__ // Borland C++ displays warnings in vector header without this #pragma option -w-ccc -w-rch #endif #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "PropSetSimple.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #define SET_LOWER "abcdefghijklmnopqrstuvwxyz" #define SET_UPPER "ABCDEFGHIJKLMNOPQRSTUVWXYZ" #define SET_DIGITS "0123456789" using namespace Lexilla; static bool IsSpaceEquiv(int state) { switch (state) { case SCE_ECL_DEFAULT: case SCE_ECL_COMMENT: case SCE_ECL_COMMENTLINE: case SCE_ECL_COMMENTLINEDOC: case SCE_ECL_COMMENTDOCKEYWORD: case SCE_ECL_COMMENTDOCKEYWORDERROR: case SCE_ECL_COMMENTDOC: return true; default: return false; } } static void ColouriseEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords0 = *keywordlists[0]; WordList &keywords1 = *keywordlists[1]; WordList &keywords2 = *keywordlists[2]; WordList &keywords3 = *keywordlists[3]; //Value Types WordList &keywords4 = *keywordlists[4]; WordList &keywords5 = *keywordlists[5]; WordList &keywords6 = *keywordlists[6]; //Javadoc Tags WordList cplusplus; cplusplus.Set("beginc endc"); bool stylingWithinPreprocessor = false; CharacterSet setOKBeforeRE(CharacterSet::setNone, "(=,"); CharacterSet setDoxygen(CharacterSet::setLower, "$@\\&<>#{}[]"); CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); CharacterSet setQualified(CharacterSet::setNone, "uUxX"); int chPrevNonWhite = ' '; int visibleChars = 0; bool lastWordWasUUID = false; int styleBeforeDCKeyword = SCE_ECL_DEFAULT; bool continuationLine = false; if (initStyle == SCE_ECL_PREPROCESSOR) { // Set continuationLine if last character of previous line is '\' Sci_Position lineCurrent = styler.GetLine(startPos); if (lineCurrent > 0) { int chBack = styler.SafeGetCharAt(startPos-1, 0); int chBack2 = styler.SafeGetCharAt(startPos-2, 0); int lineEndChar = '!'; if (chBack2 == '\r' && chBack == '\n') { lineEndChar = styler.SafeGetCharAt(startPos-3, 0); } else if (chBack == '\n' || chBack == '\r') { lineEndChar = chBack2; } continuationLine = lineEndChar == '\\'; } } // look back to set chPrevNonWhite properly for better regex colouring if (startPos > 0) { Sci_Position back = startPos; while (--back && IsSpaceEquiv(styler.StyleAt(back))) ; if (styler.StyleAt(back) == SCE_ECL_OPERATOR) { chPrevNonWhite = styler.SafeGetCharAt(back); } } StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { if (sc.state == SCE_ECL_STRING) { // Prevent SCE_ECL_STRINGEOL from leaking back to previous line which // ends with a line continuation by locking in the state upto this position. sc.SetState(SCE_ECL_STRING); } // Reset states to begining of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; lastWordWasUUID = false; } // Handle line continuation generically. if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continuationLine = true; continue; } } // Determine if the current state should terminate. switch (sc.state) { case SCE_ECL_ADDED: case SCE_ECL_DELETED: case SCE_ECL_CHANGED: case SCE_ECL_MOVED: if (sc.atLineStart) sc.SetState(SCE_ECL_DEFAULT); break; case SCE_ECL_OPERATOR: sc.SetState(SCE_ECL_DEFAULT); break; case SCE_ECL_NUMBER: // We accept almost anything because of hex. and number suffixes if (!setWord.Contains(sc.ch)) { sc.SetState(SCE_ECL_DEFAULT); } break; case SCE_ECL_IDENTIFIER: if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { char s[1000]; sc.GetCurrentLowered(s, sizeof(s)); if (keywords0.InList(s)) { lastWordWasUUID = strcmp(s, "uuid") == 0; sc.ChangeState(SCE_ECL_WORD0); } else if (keywords1.InList(s)) { sc.ChangeState(SCE_ECL_WORD1); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_ECL_WORD2); } else if (keywords4.InList(s)) { sc.ChangeState(SCE_ECL_WORD4); } else if (keywords5.InList(s)) { sc.ChangeState(SCE_ECL_WORD5); } else //Data types are of from KEYWORD## { int i = static_cast(strlen(s)) - 1; while(i >= 0 && (isdigit(s[i]) || s[i] == '_')) --i; char s2[1000]; strncpy(s2, s, i + 1); s2[i + 1] = 0; if (keywords3.InList(s2)) { sc.ChangeState(SCE_ECL_WORD3); } } sc.SetState(SCE_ECL_DEFAULT); } break; case SCE_ECL_PREPROCESSOR: if (sc.atLineStart && !continuationLine) { sc.SetState(SCE_ECL_DEFAULT); } else if (stylingWithinPreprocessor) { if (IsASpace(sc.ch)) { sc.SetState(SCE_ECL_DEFAULT); } } else { if (sc.Match('/', '*') || sc.Match('/', '/')) { sc.SetState(SCE_ECL_DEFAULT); } } break; case SCE_ECL_COMMENT: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_ECL_DEFAULT); } break; case SCE_ECL_COMMENTDOC: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_ECL_DEFAULT); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = SCE_ECL_COMMENTDOC; sc.SetState(SCE_ECL_COMMENTDOCKEYWORD); } } break; case SCE_ECL_COMMENTLINE: if (sc.atLineStart) { sc.SetState(SCE_ECL_DEFAULT); } break; case SCE_ECL_COMMENTLINEDOC: if (sc.atLineStart) { sc.SetState(SCE_ECL_DEFAULT); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = SCE_ECL_COMMENTLINEDOC; sc.SetState(SCE_ECL_COMMENTDOCKEYWORD); } } break; case SCE_ECL_COMMENTDOCKEYWORD: if ((styleBeforeDCKeyword == SCE_ECL_COMMENTDOC) && sc.Match('*', '/')) { sc.ChangeState(SCE_ECL_COMMENTDOCKEYWORDERROR); sc.Forward(); sc.ForwardSetState(SCE_ECL_DEFAULT); } else if (!setDoxygen.Contains(sc.ch)) { char s[1000]; sc.GetCurrentLowered(s, sizeof(s)); if (!IsASpace(sc.ch) || !keywords6.InList(s+1)) { sc.ChangeState(SCE_ECL_COMMENTDOCKEYWORDERROR); } sc.SetState(styleBeforeDCKeyword); } break; case SCE_ECL_STRING: if (sc.atLineEnd) { sc.ChangeState(SCE_ECL_STRINGEOL); } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_ECL_DEFAULT); } break; case SCE_ECL_CHARACTER: if (sc.atLineEnd) { sc.ChangeState(SCE_ECL_STRINGEOL); } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_ECL_DEFAULT); } break; case SCE_ECL_REGEX: if (sc.atLineStart) { sc.SetState(SCE_ECL_DEFAULT); } else if (sc.ch == '/') { sc.Forward(); while ((sc.ch < 0x80) && islower(sc.ch)) sc.Forward(); // gobble regex flags sc.SetState(SCE_ECL_DEFAULT); } else if (sc.ch == '\\') { // Gobble up the quoted character if (sc.chNext == '\\' || sc.chNext == '/') { sc.Forward(); } } break; case SCE_ECL_STRINGEOL: if (sc.atLineStart) { sc.SetState(SCE_ECL_DEFAULT); } break; case SCE_ECL_VERBATIM: if (sc.ch == '\"') { if (sc.chNext == '\"') { sc.Forward(); } else { sc.ForwardSetState(SCE_ECL_DEFAULT); } } break; case SCE_ECL_UUID: if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') { sc.SetState(SCE_ECL_DEFAULT); } break; } // Determine if a new state should be entered. Sci_Position lineCurrent = styler.GetLine(sc.currentPos); int lineState = styler.GetLineState(lineCurrent); if (sc.state == SCE_ECL_DEFAULT) { if (lineState) { sc.SetState(lineState); } else if (sc.Match('@', '\"')) { sc.SetState(SCE_ECL_VERBATIM); sc.Forward(); } else if (setQualified.Contains(sc.ch) && sc.chNext == '\'') { sc.SetState(SCE_ECL_CHARACTER); sc.Forward(); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (lastWordWasUUID) { sc.SetState(SCE_ECL_UUID); lastWordWasUUID = false; } else { sc.SetState(SCE_ECL_NUMBER); } } else if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) { if (lastWordWasUUID) { sc.SetState(SCE_ECL_UUID); lastWordWasUUID = false; } else { sc.SetState(SCE_ECL_IDENTIFIER); } } else if (sc.Match('/', '*')) { if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style sc.SetState(SCE_ECL_COMMENTDOC); } else { sc.SetState(SCE_ECL_COMMENT); } sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match('/', '/')) { if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) // Support of Qt/Doxygen doc. style sc.SetState(SCE_ECL_COMMENTLINEDOC); else sc.SetState(SCE_ECL_COMMENTLINE); } else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite)) { sc.SetState(SCE_ECL_REGEX); // JavaScript's RegEx // } else if (sc.ch == '\"') { // sc.SetState(SCE_ECL_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_ECL_CHARACTER); } else if (sc.ch == '#' && visibleChars == 0) { // Preprocessor commands are alone on their line sc.SetState(SCE_ECL_PREPROCESSOR); // Skip whitespace between # and preprocessor word do { sc.Forward(); } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); if (sc.atLineEnd) { sc.SetState(SCE_ECL_DEFAULT); } } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_ECL_OPERATOR); } } if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) { chPrevNonWhite = sc.ch; visibleChars++; } continuationLine = false; } sc.Complete(); } static bool IsStreamCommentStyle(int style) { return style == SCE_ECL_COMMENT || style == SCE_ECL_COMMENTDOC || style == SCE_ECL_COMMENTDOCKEYWORD || style == SCE_ECL_COMMENTDOCKEYWORDERROR; } static bool MatchNoCase(Accessor & styler, Sci_PositionU & pos, const char *s) { Sci_Position i=0; for (; *s; i++) { char compare_char = tolower(*s); char styler_char = tolower(styler.SafeGetCharAt(pos+i)); if (compare_char != styler_char) return false; s++; } pos+=i-1; return true; } // Store both the current line's fold level and the next lines in the // level store to make it easy to pick up with each increment // and to make it possible to fiddle the current level for "} else {". static void FoldEclDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { bool foldComment = true; bool foldPreprocessor = true; bool foldCompact = true; bool foldAtElse = true; Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_ECL_COMMENTLINEDOC)) { levelNext++; } else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_ECL_COMMENTLINEDOC) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } } if (foldComment && (style == SCE_ECL_COMMENTLINE)) { if ((ch == '/') && (chNext == '/')) { char chNext2 = styler.SafeGetCharAt(i + 2); if (chNext2 == '{') { levelNext++; } else if (chNext2 == '}') { levelNext--; } } } if (foldPreprocessor && (style == SCE_ECL_PREPROCESSOR)) { if (ch == '#') { Sci_PositionU j = i + 1; while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } if (MatchNoCase(styler, j, "region") || MatchNoCase(styler, j, "if")) { levelNext++; } else if (MatchNoCase(styler, j, "endregion") || MatchNoCase(styler, j, "end")) { levelNext--; } } } if (style == SCE_ECL_OPERATOR) { if (ch == '{') { // Measure the minimum before a '{' to allow // folding on "} else {" if (levelMinCurrent > levelNext) { levelMinCurrent = levelNext; } levelNext++; } else if (ch == '}') { levelNext--; } } if (style == SCE_ECL_WORD2) { if (MatchNoCase(styler, i, "record") || MatchNoCase(styler, i, "transform") || MatchNoCase(styler, i, "type") || MatchNoCase(styler, i, "function") || MatchNoCase(styler, i, "module") || MatchNoCase(styler, i, "service") || MatchNoCase(styler, i, "interface") || MatchNoCase(styler, i, "ifblock") || MatchNoCase(styler, i, "macro") || MatchNoCase(styler, i, "beginc++")) { levelNext++; } else if (MatchNoCase(styler, i, "endmacro") || MatchNoCase(styler, i, "endc++") || MatchNoCase(styler, i, "end")) { levelNext--; } } if (atEOL || (i == endPos-1)) { int levelUse = levelCurrent; if (foldAtElse) { levelUse = levelMinCurrent; } int lev = levelUse | levelNext << 16; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (levelUse < levelNext) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelCurrent = levelNext; levelMinCurrent = levelCurrent; if (atEOL && (i == static_cast(styler.Length()-1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } visibleChars = 0; } if (!IsASpace(ch)) visibleChars++; } } static const char * const EclWordListDesc[] = { "Keywords", 0 }; LexerModule lmECL( SCLEX_ECL, ColouriseEclDoc, "ecl", FoldEclDoc, EclWordListDesc); ================================================ FILE: lexilla/lexers/LexEDIFACT.cxx ================================================ // Scintilla Lexer for EDIFACT // @file LexEDIFACT.cxx // Written by Iain Clarke, IMCSoft & Inobiz AB. // EDIFACT documented here: https://www.unece.org/cefact/edifact/welcome.html // and more readably here: https://en.wikipedia.org/wiki/EDIFACT // This code is subject to the same license terms as the rest of the scintilla project: // The License.txt file describes the conditions under which this software may be distributed. // // Header order must match order in scripts/HeaderOrder.txt #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "LexAccessor.h" #include "LexerModule.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; class LexerEDIFACT : public DefaultLexer { public: LexerEDIFACT(); virtual ~LexerEDIFACT() {} // virtual destructor, as we inherit from ILexer static ILexer5 *Factory() { return new LexerEDIFACT; } int SCI_METHOD Version() const override { return lvRelease5; } void SCI_METHOD Release() override { delete this; } const char * SCI_METHOD PropertyNames() override { return "fold\nlexer.edifact.highlight.un.all"; } int SCI_METHOD PropertyType(const char *) override { return SC_TYPE_BOOLEAN; // Only one property! } const char * SCI_METHOD DescribeProperty(const char *name) override { if (!strcmp(name, "fold")) return "Whether to apply folding to document or not"; if (!strcmp(name, "lexer.edifact.highlight.un.all")) return "Whether to apply UN* highlighting to all UN segments, or just to UNH"; return NULL; } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override { if (!strcmp(key, "fold")) { m_bFold = strcmp(val, "0") ? true : false; return 0; } if (!strcmp(key, "lexer.edifact.highlight.un.all")) // GetProperty { m_bHighlightAllUN = strcmp(val, "0") ? true : false; return 0; } return -1; } const char * SCI_METHOD PropertyGet(const char *key) override { m_lastPropertyValue = ""; if (!strcmp(key, "fold")) { m_lastPropertyValue = m_bFold ? "1" : "0"; } if (!strcmp(key, "lexer.edifact.highlight.un.all")) // GetProperty { m_lastPropertyValue = m_bHighlightAllUN ? "1" : "0"; } return m_lastPropertyValue.c_str(); } const char * SCI_METHOD DescribeWordListSets() override { return NULL; } Sci_Position SCI_METHOD WordListSet(int, const char *) override { return -1; } void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return NULL; } protected: Sci_Position InitialiseFromUNA(IDocument *pAccess, Sci_PositionU MaxLength); Sci_Position FindPreviousEnd(IDocument *pAccess, Sci_Position startPos) const; Sci_Position ForwardPastWhitespace(IDocument *pAccess, Sci_Position startPos, Sci_Position MaxLength) const; int DetectSegmentHeader(char SegmentHeader[3]) const; bool m_bFold; // property lexer.edifact.highlight.un.all // Set to 0 to highlight only UNA segments, or 1 to highlight all UNx segments. bool m_bHighlightAllUN; char m_chComponent; char m_chData; char m_chDecimal; char m_chRelease; char m_chSegment; std::string m_lastPropertyValue; }; LexerModule lmEDIFACT(SCLEX_EDIFACT, LexerEDIFACT::Factory, "edifact"); /////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////// LexerEDIFACT::LexerEDIFACT() : DefaultLexer("edifact", SCLEX_EDIFACT) { m_bFold = false; m_bHighlightAllUN = false; m_chComponent = ':'; m_chData = '+'; m_chDecimal = '.'; m_chRelease = '?'; m_chSegment = '\''; } void LexerEDIFACT::Lex(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) { Sci_PositionU posFinish = startPos + length; InitialiseFromUNA(pAccess, posFinish); // Look backwards for a ' or a document beginning Sci_PositionU posCurrent = FindPreviousEnd(pAccess, startPos); // And jump past the ' if this was not the beginning of the document if (posCurrent != 0) posCurrent++; // Style buffer, so we're not issuing loads of notifications LexAccessor styler (pAccess); pAccess->StartStyling(posCurrent); styler.StartSegment(posCurrent); Sci_Position posSegmentStart = -1; while ((posCurrent < posFinish) && (posSegmentStart == -1)) { posCurrent = ForwardPastWhitespace(pAccess, posCurrent, posFinish); // Mark whitespace as default styler.ColourTo(posCurrent - 1, SCE_EDI_DEFAULT); if (posCurrent >= posFinish) break; // Does is start with 3 charaters? ie, UNH char SegmentHeader[4] = { 0 }; pAccess->GetCharRange(SegmentHeader, posCurrent, 3); int SegmentStyle = DetectSegmentHeader(SegmentHeader); if (SegmentStyle == SCE_EDI_BADSEGMENT) break; if (SegmentStyle == SCE_EDI_UNA) { posCurrent += 9; styler.ColourTo(posCurrent - 1, SCE_EDI_UNA); // UNA continue; } posSegmentStart = posCurrent; posCurrent += 3; styler.ColourTo(posCurrent - 1, SegmentStyle); // UNH etc // Colour in the rest of the segment for (char c; posCurrent < posFinish; posCurrent++) { pAccess->GetCharRange(&c, posCurrent, 1); if (c == m_chRelease) // ? escape character, check first, in case of ?' posCurrent++; else if (c == m_chSegment) // ' { // Make sure the whole segment is on one line. styler won't let us go back in time, so we'll settle for marking the ' as bad. Sci_Position lineSegmentStart = pAccess->LineFromPosition(posSegmentStart); Sci_Position lineSegmentEnd = pAccess->LineFromPosition(posCurrent); if (lineSegmentStart == lineSegmentEnd) styler.ColourTo(posCurrent, SCE_EDI_SEGMENTEND); else styler.ColourTo(posCurrent, SCE_EDI_BADSEGMENT); posSegmentStart = -1; posCurrent++; break; } else if (c == m_chComponent) // : styler.ColourTo(posCurrent, SCE_EDI_SEP_COMPOSITE); else if (c == m_chData) // + styler.ColourTo(posCurrent, SCE_EDI_SEP_ELEMENT); else styler.ColourTo(posCurrent, SCE_EDI_DEFAULT); } } styler.Flush(); if (posSegmentStart == -1) return; pAccess->StartStyling(posSegmentStart); pAccess->SetStyleFor(posFinish - posSegmentStart, SCE_EDI_BADSEGMENT); } void LexerEDIFACT::Fold(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) { if (!m_bFold) return; Sci_PositionU endPos = startPos + length; startPos = FindPreviousEnd(pAccess, startPos); char c; char SegmentHeader[4] = { 0 }; bool AwaitingSegment = true; Sci_PositionU currLine = pAccess->LineFromPosition(startPos); int levelCurrentStyle = SC_FOLDLEVELBASE; if (currLine > 0) levelCurrentStyle = pAccess->GetLevel(currLine - 1); // bottom 12 bits are level int indentCurrent = levelCurrentStyle & SC_FOLDLEVELNUMBERMASK; int indentNext = indentCurrent; while (startPos < endPos) { pAccess->GetCharRange(&c, startPos, 1); switch (c) { case '\t': case '\r': case ' ': startPos++; continue; case '\n': currLine = pAccess->LineFromPosition(startPos); pAccess->SetLevel(currLine, levelCurrentStyle | indentCurrent); startPos++; levelCurrentStyle = SC_FOLDLEVELBASE; indentCurrent = indentNext; continue; } if (c == m_chRelease) { startPos += 2; continue; } if (c == m_chSegment) { AwaitingSegment = true; startPos++; continue; } if (!AwaitingSegment) { startPos++; continue; } // Segment! pAccess->GetCharRange(SegmentHeader, startPos, 3); if (SegmentHeader[0] != 'U' || SegmentHeader[1] != 'N') { startPos++; continue; } AwaitingSegment = false; switch (SegmentHeader[2]) { case 'H': case 'G': indentNext++; levelCurrentStyle = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; break; case 'T': case 'E': if (indentNext > 0) indentNext--; break; } startPos += 3; } } Sci_Position LexerEDIFACT::InitialiseFromUNA(IDocument *pAccess, Sci_PositionU MaxLength) { MaxLength -= 9; // drop 9 chars, to give us room for UNA:+.? ' Sci_PositionU startPos = 0; startPos += ForwardPastWhitespace(pAccess, 0, MaxLength); if (startPos < MaxLength) { char bufUNA[9]; pAccess->GetCharRange(bufUNA, startPos, 9); // Check it's UNA segment if (!memcmp(bufUNA, "UNA", 3)) { m_chComponent = bufUNA[3]; m_chData = bufUNA[4]; m_chDecimal = bufUNA[5]; m_chRelease = bufUNA[6]; // bufUNA [7] should be space - reserved. m_chSegment = bufUNA[8]; return 0; // success! } } // We failed to find a UNA, so drop to defaults m_chComponent = ':'; m_chData = '+'; m_chDecimal = '.'; m_chRelease = '?'; m_chSegment = '\''; return -1; } Sci_Position LexerEDIFACT::ForwardPastWhitespace(IDocument *pAccess, Sci_Position startPos, Sci_Position MaxLength) const { char c; while (startPos < MaxLength) { pAccess->GetCharRange(&c, startPos, 1); switch (c) { case '\t': case '\r': case '\n': case ' ': break; default: return startPos; } startPos++; } return MaxLength; } int LexerEDIFACT::DetectSegmentHeader(char SegmentHeader[3]) const { if ( SegmentHeader[0] < 'A' || SegmentHeader[0] > 'Z' || SegmentHeader[1] < 'A' || SegmentHeader[1] > 'Z' || SegmentHeader[2] < 'A' || SegmentHeader[2] > 'Z') return SCE_EDI_BADSEGMENT; if (!memcmp(SegmentHeader, "UNA", 3)) return SCE_EDI_UNA; if (m_bHighlightAllUN && !memcmp(SegmentHeader, "UN", 2)) return SCE_EDI_UNH; else if (!memcmp(SegmentHeader, "UNH", 3)) return SCE_EDI_UNH; else if (!memcmp(SegmentHeader, "UNG", 3)) return SCE_EDI_UNH; return SCE_EDI_SEGMENTSTART; } // Look backwards for a ' or a document beginning Sci_Position LexerEDIFACT::FindPreviousEnd(IDocument *pAccess, Sci_Position startPos) const { for (char c; startPos > 0; startPos--) { pAccess->GetCharRange(&c, startPos, 1); if (c == m_chSegment) return startPos; } // We didn't find a ', so just go with the beginning return 0; } ================================================ FILE: lexilla/lexers/LexEScript.cxx ================================================ // Scintilla source code edit control /** @file LexEScript.cxx ** Lexer for ESCRIPT **/ // Copyright 2003 by Patrizio Bekerle (patrizio@bekerle.com) #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); } static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static void ColouriseESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; // Do not leak onto next line /*if (initStyle == SCE_ESCRIPT_STRINGEOL) initStyle = SCE_ESCRIPT_DEFAULT;*/ StyleContext sc(startPos, length, initStyle, styler); bool caseSensitive = styler.GetPropertyInt("escript.case.sensitive", 0) != 0; for (; sc.More(); sc.Forward()) { /*if (sc.atLineStart && (sc.state == SCE_ESCRIPT_STRING)) { // Prevent SCE_ESCRIPT_STRINGEOL from leaking back to previous line sc.SetState(SCE_ESCRIPT_STRING); }*/ // Handle line continuation generically. if (sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate. if (sc.state == SCE_ESCRIPT_OPERATOR || sc.state == SCE_ESCRIPT_BRACE) { sc.SetState(SCE_ESCRIPT_DEFAULT); } else if (sc.state == SCE_ESCRIPT_NUMBER) { if (!IsADigit(sc.ch) || sc.ch != '.') { sc.SetState(SCE_ESCRIPT_DEFAULT); } } else if (sc.state == SCE_ESCRIPT_IDENTIFIER) { if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { char s[100]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); } else { sc.GetCurrentLowered(s, sizeof(s)); } // sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_ESCRIPT_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_ESCRIPT_WORD2); } else if (keywords3.InList(s)) { sc.ChangeState(SCE_ESCRIPT_WORD3); // sc.state = SCE_ESCRIPT_IDENTIFIER; } sc.SetState(SCE_ESCRIPT_DEFAULT); } } else if (sc.state == SCE_ESCRIPT_COMMENT) { if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); } } else if (sc.state == SCE_ESCRIPT_COMMENTDOC) { if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); } } else if (sc.state == SCE_ESCRIPT_COMMENTLINE) { if (sc.atLineEnd) { sc.SetState(SCE_ESCRIPT_DEFAULT); } } else if (sc.state == SCE_ESCRIPT_STRING) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_ESCRIPT_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_ESCRIPT_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_ESCRIPT_NUMBER); } else if (IsAWordStart(sc.ch) || (sc.ch == '#')) { sc.SetState(SCE_ESCRIPT_IDENTIFIER); } else if (sc.Match('/', '*')) { sc.SetState(SCE_ESCRIPT_COMMENT); sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match('/', '/')) { sc.SetState(SCE_ESCRIPT_COMMENTLINE); } else if (sc.ch == '\"') { sc.SetState(SCE_ESCRIPT_STRING); //} else if (isoperator(static_cast(sc.ch))) { } else if (sc.ch == '+' || sc.ch == '-' || sc.ch == '*' || sc.ch == '/' || sc.ch == '=' || sc.ch == '<' || sc.ch == '>' || sc.ch == '&' || sc.ch == '|' || sc.ch == '!' || sc.ch == '?' || sc.ch == ':') { sc.SetState(SCE_ESCRIPT_OPERATOR); } else if (sc.ch == '{' || sc.ch == '}') { sc.SetState(SCE_ESCRIPT_BRACE); } } } sc.Complete(); } static int classifyFoldPointESCRIPT(const char* s, const char* prevWord) { int lev = 0; if (strcmp(prevWord, "end") == 0) return lev; if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) return -1; if (strcmp(s, "for") == 0 || strcmp(s, "foreach") == 0 || strcmp(s, "program") == 0 || strcmp(s, "function") == 0 || strcmp(s, "while") == 0 || strcmp(s, "case") == 0 || strcmp(s, "if") == 0 ) { lev = 1; } else if ( strcmp(s, "endfor") == 0 || strcmp(s, "endforeach") == 0 || strcmp(s, "endprogram") == 0 || strcmp(s, "endfunction") == 0 || strcmp(s, "endwhile") == 0 || strcmp(s, "endcase") == 0 || strcmp(s, "endif") == 0 ) { lev = -1; } return lev; } static bool IsStreamCommentStyle(int style) { return style == SCE_ESCRIPT_COMMENT || style == SCE_ESCRIPT_COMMENTDOC || style == SCE_ESCRIPT_COMMENTLINE; } static void FoldESCRIPTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { //~ bool foldComment = styler.GetPropertyInt("fold.comment") != 0; // Do not know how to fold the comment at the moment. bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldComment = true; Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; Sci_Position lastStart = 0; char prevWord[32] = ""; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (foldComment && IsStreamCommentStyle(style)) { if (!IsStreamCommentStyle(stylePrev)) { levelCurrent++; } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelCurrent--; } } if (foldComment && (style == SCE_ESCRIPT_COMMENTLINE)) { if ((ch == '/') && (chNext == '/')) { char chNext2 = styler.SafeGetCharAt(i + 2); if (chNext2 == '{') { levelCurrent++; } else if (chNext2 == '}') { levelCurrent--; } } } if (stylePrev == SCE_ESCRIPT_DEFAULT && style == SCE_ESCRIPT_WORD3) { // Store last word start point. lastStart = i; } if (style == SCE_ESCRIPT_WORD3) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[32]; Sci_PositionU j; for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) { s[j] = static_cast(tolower(styler[lastStart + j])); } s[j] = '\0'; levelCurrent += classifyFoldPointESCRIPT(s, prevWord); strcpy(prevWord, s); } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; strcpy(prevWord, ""); } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const ESCRIPTWordLists[] = { "Primary keywords and identifiers", "Intrinsic functions", "Extended and user defined functions", 0, }; LexerModule lmESCRIPT(SCLEX_ESCRIPT, ColouriseESCRIPTDoc, "escript", FoldESCRIPTDoc, ESCRIPTWordLists); ================================================ FILE: lexilla/lexers/LexEiffel.cxx ================================================ // Scintilla source code edit control /** @file LexEiffel.cxx ** Lexer for Eiffel. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool isEiffelOperator(unsigned int ch) { // '.' left out as it is used to make up numbers return ch == '*' || ch == '/' || ch == '\\' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '{' || ch == '}' || ch == '~' || ch == '[' || ch == ']' || ch == ';' || ch == '<' || ch == '>' || ch == ',' || ch == '.' || ch == '^' || ch == '%' || ch == ':' || ch == '!' || ch == '@' || ch == '?'; } static inline bool IsAWordChar(unsigned int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static inline bool IsAWordStart(unsigned int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_'); } static void ColouriseEiffelDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.state == SCE_EIFFEL_STRINGEOL) { if (sc.ch != '\r' && sc.ch != '\n') { sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_OPERATOR) { sc.SetState(SCE_EIFFEL_DEFAULT); } else if (sc.state == SCE_EIFFEL_WORD) { if (!IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (!keywords.InList(s)) { sc.ChangeState(SCE_EIFFEL_IDENTIFIER); } sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_NUMBER) { if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_COMMENTLINE) { if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_STRING) { if (sc.ch == '%') { sc.Forward(); } else if (sc.ch == '\"') { sc.Forward(); sc.SetState(SCE_EIFFEL_DEFAULT); } } else if (sc.state == SCE_EIFFEL_CHARACTER) { if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_EIFFEL_STRINGEOL); } else if (sc.ch == '%') { sc.Forward(); } else if (sc.ch == '\'') { sc.Forward(); sc.SetState(SCE_EIFFEL_DEFAULT); } } if (sc.state == SCE_EIFFEL_DEFAULT) { if (sc.ch == '-' && sc.chNext == '-') { sc.SetState(SCE_EIFFEL_COMMENTLINE); } else if (sc.ch == '\"') { sc.SetState(SCE_EIFFEL_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_EIFFEL_CHARACTER); } else if (IsADigit(sc.ch) || (sc.ch == '.')) { sc.SetState(SCE_EIFFEL_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_EIFFEL_WORD); } else if (isEiffelOperator(sc.ch)) { sc.SetState(SCE_EIFFEL_OPERATOR); } } } sc.Complete(); } static bool IsEiffelComment(Accessor &styler, Sci_Position pos, Sci_Position len) { return len>1 && styler[pos]=='-' && styler[pos+1]=='-'; } static void FoldEiffelDocIndent(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { Sci_Position lengthDoc = startPos + length; // Backtrack to previous line in case need to fix its fold status Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); } } int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsEiffelComment); char chNext = styler[startPos]; for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) { int lev = indentCurrent; int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsEiffelComment); if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { // Only non whitespace lines can be headers if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { // Line after is blank so check the next - maybe should continue further? int spaceFlags2 = 0; int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsEiffelComment); if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } } } indentCurrent = indentNext; styler.SetLevel(lineCurrent, lev); lineCurrent++; } } } static void FoldEiffelDocKeyWords(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int stylePrev = 0; int styleNext = styler.StyleAt(startPos); // lastDeferred should be determined by looking back to last keyword in case // the "deferred" is on a line before "class" bool lastDeferred = false; for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if ((stylePrev != SCE_EIFFEL_WORD) && (style == SCE_EIFFEL_WORD)) { char s[20]; Sci_PositionU j = 0; while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) { s[j] = styler[i + j]; j++; } s[j] = '\0'; if ( (strcmp(s, "check") == 0) || (strcmp(s, "debug") == 0) || (strcmp(s, "deferred") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "from") == 0) || (strcmp(s, "if") == 0) || (strcmp(s, "inspect") == 0) || (strcmp(s, "once") == 0) ) levelCurrent++; if (!lastDeferred && (strcmp(s, "class") == 0)) levelCurrent++; if (strcmp(s, "end") == 0) levelCurrent--; lastDeferred = strcmp(s, "deferred") == 0; } if (atEOL) { int lev = levelPrev; if (visibleChars == 0) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; stylePrev = style; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const eiffelWordListDesc[] = { "Keywords", 0 }; LexerModule lmEiffel(SCLEX_EIFFEL, ColouriseEiffelDoc, "eiffel", FoldEiffelDocIndent, eiffelWordListDesc); LexerModule lmEiffelkw(SCLEX_EIFFELKW, ColouriseEiffelDoc, "eiffelkw", FoldEiffelDocKeyWords, eiffelWordListDesc); ================================================ FILE: lexilla/lexers/LexErlang.cxx ================================================ // Scintilla source code edit control // Encoding: UTF-8 // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. /** @file LexErlang.cxx ** Lexer for Erlang. ** Enhanced by Etienne 'Lenain' Girondel (lenaing@gmail.com) ** Originally wrote by Peter-Henry Mander, ** based on Matlab lexer by José Fonseca. **/ #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static int is_radix(int radix, int ch) { int digit; if (36 < radix || 2 > radix) return 0; if (isdigit(ch)) { digit = ch - '0'; } else if (isalnum(ch)) { digit = toupper(ch) - 'A' + 10; } else { return 0; } return (digit < radix); } typedef enum { STATE_NULL, COMMENT, COMMENT_FUNCTION, COMMENT_MODULE, COMMENT_DOC, COMMENT_DOC_MACRO, ATOM_UNQUOTED, ATOM_QUOTED, NODE_NAME_UNQUOTED, NODE_NAME_QUOTED, MACRO_START, MACRO_UNQUOTED, MACRO_QUOTED, RECORD_START, RECORD_UNQUOTED, RECORD_QUOTED, NUMERAL_START, NUMERAL_BASE_VALUE, NUMERAL_FLOAT, NUMERAL_EXPONENT, PREPROCESSOR } atom_parse_state_t; static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (ch != ' ') && (isalnum(ch) || ch == '_'); } static void ColouriseErlangDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); WordList &reservedWords = *keywordlists[0]; WordList &erlangBIFs = *keywordlists[1]; WordList &erlangPreproc = *keywordlists[2]; WordList &erlangModulesAtt = *keywordlists[3]; WordList &erlangDoc = *keywordlists[4]; WordList &erlangDocMacro = *keywordlists[5]; int radix_digits = 0; int exponent_digits = 0; atom_parse_state_t parse_state = STATE_NULL; atom_parse_state_t old_parse_state = STATE_NULL; bool to_late_to_comment = false; char cur[100]; int old_style = SCE_ERLANG_DEFAULT; styler.StartAt(startPos); for (; sc.More(); sc.Forward()) { int style = SCE_ERLANG_DEFAULT; if (STATE_NULL != parse_state) { switch (parse_state) { case STATE_NULL : sc.SetState(SCE_ERLANG_DEFAULT); break; /* COMMENTS ------------------------------------------------------*/ case COMMENT : { if (sc.ch != '%') { to_late_to_comment = true; } else if (!to_late_to_comment && sc.ch == '%') { // Switch to comment level 2 (Function) sc.ChangeState(SCE_ERLANG_COMMENT_FUNCTION); old_style = SCE_ERLANG_COMMENT_FUNCTION; parse_state = COMMENT_FUNCTION; sc.Forward(); } } // V--- Falling through! // Falls through. case COMMENT_FUNCTION : { if (sc.ch != '%') { to_late_to_comment = true; } else if (!to_late_to_comment && sc.ch == '%') { // Switch to comment level 3 (Module) sc.ChangeState(SCE_ERLANG_COMMENT_MODULE); old_style = SCE_ERLANG_COMMENT_MODULE; parse_state = COMMENT_MODULE; sc.Forward(); } } // V--- Falling through! // Falls through. case COMMENT_MODULE : { if (parse_state != COMMENT) { // Search for comment documentation if (sc.chNext == '@') { old_parse_state = parse_state; parse_state = ('{' == sc.ch) ? COMMENT_DOC_MACRO : COMMENT_DOC; sc.ForwardSetState(sc.state); } } // All comments types fall here. if (sc.MatchLineEnd()) { to_late_to_comment = false; sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; case COMMENT_DOC : // V--- Falling through! case COMMENT_DOC_MACRO : { if (!isalnum(sc.ch)) { // Try to match documentation comment sc.GetCurrent(cur, sizeof(cur)); if (parse_state == COMMENT_DOC_MACRO && erlangDocMacro.InList(cur)) { sc.ChangeState(SCE_ERLANG_COMMENT_DOC_MACRO); while (sc.ch != '}' && !sc.atLineEnd) sc.Forward(); } else if (erlangDoc.InList(cur)) { sc.ChangeState(SCE_ERLANG_COMMENT_DOC); } else { sc.ChangeState(old_style); } // Switch back to old state sc.SetState(old_style); parse_state = old_parse_state; } if (sc.MatchLineEnd()) { to_late_to_comment = false; sc.ChangeState(old_style); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; /* -------------------------------------------------------------- */ /* Atoms ---------------------------------------------------------*/ case ATOM_UNQUOTED : { if ('@' == sc.ch){ parse_state = NODE_NAME_UNQUOTED; } else if (sc.ch == ':') { // Searching for module name if (sc.chNext == ' ') { // error sc.ChangeState(SCE_ERLANG_UNKNOWN); parse_state = STATE_NULL; } else { sc.Forward(); if (isalnum(sc.ch) || (sc.ch == '\'')) { sc.GetCurrent(cur, sizeof(cur)); sc.ChangeState(SCE_ERLANG_MODULES); sc.SetState(SCE_ERLANG_MODULES); } if (sc.ch == '\'') { parse_state = ATOM_QUOTED; } } } else if (!IsAWordChar(sc.ch)) { sc.GetCurrent(cur, sizeof(cur)); if (reservedWords.InList(cur)) { style = SCE_ERLANG_KEYWORD; } else if (erlangBIFs.InList(cur) && strcmp(cur,"erlang:")){ style = SCE_ERLANG_BIFS; } else if (sc.ch == '(' || '/' == sc.ch){ style = SCE_ERLANG_FUNCTION_NAME; } else { style = SCE_ERLANG_ATOM; } sc.ChangeState(style); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; case ATOM_QUOTED : { if ( '@' == sc.ch ){ parse_state = NODE_NAME_QUOTED; } else if ('\'' == sc.ch && '\\' != sc.chPrev) { sc.ChangeState(SCE_ERLANG_ATOM_QUOTED); sc.ForwardSetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; /* -------------------------------------------------------------- */ /* Node names ----------------------------------------------------*/ case NODE_NAME_UNQUOTED : { if ('@' == sc.ch) { sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else if (!IsAWordChar(sc.ch)) { sc.ChangeState(SCE_ERLANG_NODE_NAME); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; case NODE_NAME_QUOTED : { if ('@' == sc.ch) { sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else if ('\'' == sc.ch && '\\' != sc.chPrev) { sc.ChangeState(SCE_ERLANG_NODE_NAME_QUOTED); sc.ForwardSetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; /* -------------------------------------------------------------- */ /* Records -------------------------------------------------------*/ case RECORD_START : { if ('\'' == sc.ch) { parse_state = RECORD_QUOTED; } else if (isalpha(sc.ch) && islower(sc.ch)) { parse_state = RECORD_UNQUOTED; } else { // error sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; case RECORD_UNQUOTED : { if (!IsAWordChar(sc.ch)) { sc.ChangeState(SCE_ERLANG_RECORD); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; case RECORD_QUOTED : { if ('\'' == sc.ch && '\\' != sc.chPrev) { sc.ChangeState(SCE_ERLANG_RECORD_QUOTED); sc.ForwardSetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; /* -------------------------------------------------------------- */ /* Macros --------------------------------------------------------*/ case MACRO_START : { if ('\'' == sc.ch) { parse_state = MACRO_QUOTED; } else if (isalpha(sc.ch)) { parse_state = MACRO_UNQUOTED; } else { // error sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; case MACRO_UNQUOTED : { if (!IsAWordChar(sc.ch)) { sc.ChangeState(SCE_ERLANG_MACRO); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; case MACRO_QUOTED : { if ('\'' == sc.ch && '\\' != sc.chPrev) { sc.ChangeState(SCE_ERLANG_MACRO_QUOTED); sc.ForwardSetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; /* -------------------------------------------------------------- */ /* Numerics ------------------------------------------------------*/ /* Simple integer */ case NUMERAL_START : { if (isdigit(sc.ch)) { radix_digits *= 10; radix_digits += sc.ch - '0'; // Assuming ASCII here! } else if ('#' == sc.ch) { if (2 > radix_digits || 36 < radix_digits) { sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else { parse_state = NUMERAL_BASE_VALUE; } } else if ('.' == sc.ch && isdigit(sc.chNext)) { radix_digits = 0; parse_state = NUMERAL_FLOAT; } else if ('e' == sc.ch || 'E' == sc.ch) { exponent_digits = 0; parse_state = NUMERAL_EXPONENT; } else { radix_digits = 0; sc.ChangeState(SCE_ERLANG_NUMBER); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; /* Integer in other base than 10 (x#yyy) */ case NUMERAL_BASE_VALUE : { if (!is_radix(radix_digits,sc.ch)) { radix_digits = 0; if (!isalnum(sc.ch)) sc.ChangeState(SCE_ERLANG_NUMBER); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; /* Float (x.yyy) */ case NUMERAL_FLOAT : { if ('e' == sc.ch || 'E' == sc.ch) { exponent_digits = 0; parse_state = NUMERAL_EXPONENT; } else if (!isdigit(sc.ch)) { sc.ChangeState(SCE_ERLANG_NUMBER); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; /* Exponent, either integer or float (xEyy, x.yyEzzz) */ case NUMERAL_EXPONENT : { if (('-' == sc.ch || '+' == sc.ch) && (isdigit(sc.chNext))) { sc.Forward(); } else if (!isdigit(sc.ch)) { if (0 < exponent_digits) sc.ChangeState(SCE_ERLANG_NUMBER); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } else { ++exponent_digits; } } break; /* -------------------------------------------------------------- */ /* Preprocessor --------------------------------------------------*/ case PREPROCESSOR : { if (!IsAWordChar(sc.ch)) { sc.GetCurrent(cur, sizeof(cur)); if (erlangPreproc.InList(cur)) { style = SCE_ERLANG_PREPROC; } else if (erlangModulesAtt.InList(cur)) { style = SCE_ERLANG_MODULES_ATT; } sc.ChangeState(style); sc.SetState(SCE_ERLANG_DEFAULT); parse_state = STATE_NULL; } } break; } } /* End of : STATE_NULL != parse_state */ else { switch (sc.state) { case SCE_ERLANG_VARIABLE : { if (!IsAWordChar(sc.ch)) sc.SetState(SCE_ERLANG_DEFAULT); } break; case SCE_ERLANG_STRING : { if (sc.ch == '\"' && sc.chPrev != '\\') sc.ForwardSetState(SCE_ERLANG_DEFAULT); } break; case SCE_ERLANG_COMMENT : { if (sc.atLineEnd) sc.SetState(SCE_ERLANG_DEFAULT); } break; case SCE_ERLANG_CHARACTER : { if (sc.chPrev == '\\') { sc.ForwardSetState(SCE_ERLANG_DEFAULT); } else if (sc.ch != '\\') { sc.ForwardSetState(SCE_ERLANG_DEFAULT); } } break; case SCE_ERLANG_OPERATOR : { if (sc.chPrev == '.') { if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' || sc.ch == '^') { sc.ForwardSetState(SCE_ERLANG_DEFAULT); } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_ERLANG_DEFAULT); } else { sc.SetState(SCE_ERLANG_DEFAULT); } } else { sc.SetState(SCE_ERLANG_DEFAULT); } } break; } } if (sc.state == SCE_ERLANG_DEFAULT) { bool no_new_state = false; switch (sc.ch) { case '\"' : sc.SetState(SCE_ERLANG_STRING); break; case '$' : sc.SetState(SCE_ERLANG_CHARACTER); break; case '%' : { parse_state = COMMENT; sc.SetState(SCE_ERLANG_COMMENT); } break; case '#' : { parse_state = RECORD_START; sc.SetState(SCE_ERLANG_UNKNOWN); } break; case '?' : { parse_state = MACRO_START; sc.SetState(SCE_ERLANG_UNKNOWN); } break; case '\'' : { parse_state = ATOM_QUOTED; sc.SetState(SCE_ERLANG_UNKNOWN); } break; case '+' : case '-' : { if (IsADigit(sc.chNext)) { parse_state = NUMERAL_START; radix_digits = 0; sc.SetState(SCE_ERLANG_UNKNOWN); } else if (sc.ch != '+') { parse_state = PREPROCESSOR; sc.SetState(SCE_ERLANG_UNKNOWN); } } break; default : no_new_state = true; } if (no_new_state) { if (isdigit(sc.ch)) { parse_state = NUMERAL_START; radix_digits = sc.ch - '0'; sc.SetState(SCE_ERLANG_UNKNOWN); } else if (isupper(sc.ch) || '_' == sc.ch) { sc.SetState(SCE_ERLANG_VARIABLE); } else if (isalpha(sc.ch)) { parse_state = ATOM_UNQUOTED; sc.SetState(SCE_ERLANG_UNKNOWN); } else if (isoperator(static_cast(sc.ch)) || sc.ch == '\\') { sc.SetState(SCE_ERLANG_OPERATOR); } } } } sc.Complete(); } static int ClassifyErlangFoldPoint( Accessor &styler, int styleNext, Sci_Position keyword_start ) { int lev = 0; if (styler.Match(keyword_start,"case") || ( styler.Match(keyword_start,"fun") && (SCE_ERLANG_FUNCTION_NAME != styleNext) ) || styler.Match(keyword_start,"if") || styler.Match(keyword_start,"query") || styler.Match(keyword_start,"receive") ) { ++lev; } else if (styler.Match(keyword_start,"end")) { --lev; } return lev; } static void FoldErlangDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList** /*keywordlists*/, Accessor &styler ) { Sci_PositionU endPos = startPos + length; Sci_Position currentLine = styler.GetLine(startPos); int lev; int previousLevel = styler.LevelAt(currentLine) & SC_FOLDLEVELNUMBERMASK; int currentLevel = previousLevel; int styleNext = styler.StyleAt(startPos); int style = initStyle; int stylePrev; Sci_Position keyword_start = 0; char ch; char chNext = styler.SafeGetCharAt(startPos); bool atEOL; for (Sci_PositionU i = startPos; i < endPos; i++) { ch = chNext; chNext = styler.SafeGetCharAt(i + 1); // Get styles stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); atEOL = ((ch == '\r') && (chNext != '\n')) || (ch == '\n'); if (stylePrev != SCE_ERLANG_KEYWORD && style == SCE_ERLANG_KEYWORD) { keyword_start = i; } // Fold on keywords if (stylePrev == SCE_ERLANG_KEYWORD && style != SCE_ERLANG_KEYWORD && style != SCE_ERLANG_ATOM ) { currentLevel += ClassifyErlangFoldPoint(styler, styleNext, keyword_start); } // Fold on comments if (style == SCE_ERLANG_COMMENT || style == SCE_ERLANG_COMMENT_MODULE || style == SCE_ERLANG_COMMENT_FUNCTION) { if (ch == '%' && chNext == '{') { currentLevel++; } else if (ch == '%' && chNext == '}') { currentLevel--; } } // Fold on braces if (style == SCE_ERLANG_OPERATOR) { if (ch == '{' || ch == '(' || ch == '[') { currentLevel++; } else if (ch == '}' || ch == ')' || ch == ']') { currentLevel--; } } if (atEOL) { lev = previousLevel; if (currentLevel > previousLevel) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(currentLine)) styler.SetLevel(currentLine, lev); currentLine++; previousLevel = currentLevel; } } // Fill in the real level of the next line, keeping the current flags as they will be filled in later styler.SetLevel(currentLine, previousLevel | (styler.LevelAt(currentLine) & ~SC_FOLDLEVELNUMBERMASK)); } static const char * const erlangWordListDesc[] = { "Erlang Reserved words", "Erlang BIFs", "Erlang Preprocessor", "Erlang Module Attributes", "Erlang Documentation", "Erlang Documentation Macro", 0 }; LexerModule lmErlang( SCLEX_ERLANG, ColouriseErlangDoc, "erlang", FoldErlangDoc, erlangWordListDesc); ================================================ FILE: lexilla/lexers/LexErrorList.cxx ================================================ // Scintilla source code edit control /** @file LexErrorList.cxx ** Lexer for error lists. Used for the output pane in SciTE. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "InList.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; namespace { bool strstart(const char *haystack, const char *needle) noexcept { return strncmp(haystack, needle, strlen(needle)) == 0; } constexpr bool Is0To9(char ch) noexcept { return (ch >= '0') && (ch <= '9'); } constexpr bool Is1To9(char ch) noexcept { return (ch >= '1') && (ch <= '9'); } bool AtEOL(Accessor &styler, Sci_Position i) { return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); } bool IsGccExcerpt(const char *s) noexcept { while (*s) { if (s[0] == ' ' && s[1] == '|' && (s[2] == ' ' || s[2] == '+')) { return true; } if (!(s[0] == ' ' || s[0] == '+' || Is0To9(s[0]))) { return false; } s++; } return true; } const std::string_view bashDiagnosticMark = ": line "; bool IsBashDiagnostic(std::string_view sv) { const size_t mark = sv.find(bashDiagnosticMark); if (mark == std::string_view::npos) { return false; } std::string_view rest = sv.substr(mark + bashDiagnosticMark.length()); if (rest.empty() || !Is0To9(rest.front())) { return false; } while (!rest.empty() && Is0To9(rest.front())) { rest.remove_prefix(1); } return !rest.empty() && (rest.front() == ':'); } int RecogniseErrorListLine(const char *lineBuffer, Sci_PositionU lengthLine, Sci_Position &startValue) { if (lineBuffer[0] == '>') { // Command or return status return SCE_ERR_CMD; } else if (lineBuffer[0] == '<') { // Diff removal. return SCE_ERR_DIFF_DELETION; } else if (lineBuffer[0] == '!') { return SCE_ERR_DIFF_CHANGED; } else if (lineBuffer[0] == '+') { if (strstart(lineBuffer, "+++ ")) { return SCE_ERR_DIFF_MESSAGE; } else { return SCE_ERR_DIFF_ADDITION; } } else if (lineBuffer[0] == '-') { if (strstart(lineBuffer, "--- ")) { return SCE_ERR_DIFF_MESSAGE; } else { return SCE_ERR_DIFF_DELETION; } } else if (strstart(lineBuffer, "cf90-")) { // Absoft Pro Fortran 90/95 v8.2 error and/or warning message return SCE_ERR_ABSF; } else if (strstart(lineBuffer, "fortcom:")) { // Intel Fortran Compiler v8.0 error/warning message return SCE_ERR_IFORT; } else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) { return SCE_ERR_PYTHON; } else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) { return SCE_ERR_PHP; } else if ((strstart(lineBuffer, "Error ") || strstart(lineBuffer, "Warning ")) && strstr(lineBuffer, " at (") && strstr(lineBuffer, ") : ") && (strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) { // Intel Fortran Compiler error/warning message return SCE_ERR_IFC; } else if (strstart(lineBuffer, "Error ")) { // Borland error message return SCE_ERR_BORLAND; } else if (strstart(lineBuffer, "Warning ")) { // Borland warning message return SCE_ERR_BORLAND; } else if (strstr(lineBuffer, "at line ") && (strstr(lineBuffer, "at line ") < (lineBuffer + lengthLine)) && strstr(lineBuffer, "file ") && (strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) { // Lua 4 error message return SCE_ERR_LUA; } else if (strstr(lineBuffer, " at ") && (strstr(lineBuffer, " at ") < (lineBuffer + lengthLine)) && strstr(lineBuffer, " line ") && (strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) && (strstr(lineBuffer, " at ") + 4 < (strstr(lineBuffer, " line ")))) { // perl error message: // at line return SCE_ERR_PERL; } else if ((lengthLine >= 6) && (memcmp(lineBuffer, " at ", 6) == 0) && strstr(lineBuffer, ":line ")) { // A .NET traceback return SCE_ERR_NET; } else if (strstart(lineBuffer, "Line ") && strstr(lineBuffer, ", file ")) { // Essential Lahey Fortran error message return SCE_ERR_ELF; } else if (strstart(lineBuffer, "line ") && strstr(lineBuffer, " column ")) { // HTML tidy style: line 42 column 1 return SCE_ERR_TIDY; } else if (strstart(lineBuffer, "\tat ") && strchr(lineBuffer, '(') && strstr(lineBuffer, ".java:")) { // Java stack back trace return SCE_ERR_JAVA_STACK; } else if (strstart(lineBuffer, "In file included from ") || strstart(lineBuffer, " from ")) { // GCC showing include path to following error return SCE_ERR_GCC_INCLUDED_FROM; } else if (strstart(lineBuffer, "NMAKE : fatal error")) { // Microsoft nmake fatal error: // NMAKE : fatal error : : return code return SCE_ERR_MS; } else if (strstr(lineBuffer, "warning LNK") || strstr(lineBuffer, "error LNK")) { // Microsoft linker warning: // { : } (warning|error) LNK9999 return SCE_ERR_MS; } else if (IsBashDiagnostic(lineBuffer)) { // Bash diagnostic // : line : return SCE_ERR_BASH; } else if (IsGccExcerpt(lineBuffer)) { // GCC code excerpt and pointer to issue // 73 | GTimeVal last_popdown; // | ^~~~~~~~~~~~ return SCE_ERR_GCC_EXCERPT; } else { // Look for one of the following formats: // GCC: :: // Microsoft: () : // Common: (): warning|error|note|remark|catastrophic|fatal // Common: () warning|error|note|remark|catastrophic|fatal // Microsoft: (,) // CTags: \t\t // Lua 5 traceback: \t:: // Lua 5.1: : :: const bool initialTab = (lineBuffer[0] == '\t'); bool initialColonPart = false; bool canBeCtags = !initialTab; // For ctags must have an identifier with no spaces then a tab enum { stInitial, stGccStart, stGccDigit, stGccColumn, stGcc, stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet, stCtagsStart, stCtagsFile, stCtagsStartString, stCtagsStringDollar, stCtags, stUnrecognized } state = stInitial; for (Sci_PositionU i = 0; i < lengthLine; i++) { const char ch = lineBuffer[i]; char chNext = ' '; if ((i + 1) < lengthLine) chNext = lineBuffer[i + 1]; if (state == stInitial) { if (ch == ':') { // May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix) if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) { // This check is not completely accurate as may be on // GTK+ with a file name that includes ':'. state = stGccStart; } else if (chNext == ' ') { // indicates a Lua 5.1 error message initialColonPart = true; } } else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) { // May be Microsoft // Check against '0' often removes phone numbers state = stMsStart; } else if ((ch == '\t') && canBeCtags) { // May be CTags state = stCtagsStart; } else if (ch == ' ') { canBeCtags = false; } } else if (state == stGccStart) { // : state = ((ch == '-') || Is0To9(ch)) ? stGccDigit : stUnrecognized; } else if (state == stGccDigit) { // : if (ch == ':') { state = stGccColumn; // :9.*: is GCC startValue = i + 1; } else if (!Is0To9(ch)) { state = stUnrecognized; } } else if (state == stGccColumn) { // :: if (!Is0To9(ch)) { state = stGcc; if (ch == ':') startValue = i + 1; break; } } else if (state == stMsStart) { // ( state = Is0To9(ch) ? stMsDigit : stUnrecognized; } else if (state == stMsDigit) { // ( if (ch == ',') { state = stMsDigitComma; } else if (ch == ')') { state = stMsBracket; } else if ((ch != ' ') && !Is0To9(ch)) { state = stUnrecognized; } } else if (state == stMsBracket) { // () if ((ch == ' ') && (chNext == ':')) { state = stMsVc; } else if ((ch == ':' && chNext == ' ') || (ch == ' ')) { // Possibly Delphi.. don't test against chNext as it's one of the strings below. char word[512]; unsigned numstep = 0; if (ch == ' ') numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i. else numstep = 2; // otherwise add 2. Sci_PositionU chPos = 0; for (Sci_PositionU j = i + numstep; j < lengthLine && IsUpperOrLowerCase(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) word[chPos++] = lineBuffer[j]; word[chPos] = 0; if (InListCaseInsensitive(word, {"error", "warning", "fatal", "catastrophic", "note", "remark"})) { state = stMsVc; } else { state = stUnrecognized; } } else { state = stUnrecognized; } } else if (state == stMsDigitComma) { // (, if (ch == ')') { state = stMsDotNet; break; } else if ((ch != ' ') && !Is0To9(ch)) { state = stUnrecognized; } } else if (state == stCtagsStart) { if (ch == '\t') { state = stCtagsFile; } } else if (state == stCtagsFile) { if ((lineBuffer[i - 1] == '\t') && ((ch == '/' && chNext == '^') || Is0To9(ch))) { state = stCtags; break; } else if ((ch == '/') && (chNext == '^')) { state = stCtagsStartString; } } else if ((state == stCtagsStartString) && ((lineBuffer[i] == '$') && (lineBuffer[i + 1] == '/'))) { state = stCtagsStringDollar; break; } } if (state == stGcc) { return initialColonPart ? SCE_ERR_LUA : SCE_ERR_GCC; } else if ((state == stMsVc) || (state == stMsDotNet)) { return SCE_ERR_MS; } else if ((state == stCtagsStringDollar) || (state == stCtags)) { return SCE_ERR_CTAG; } else if (initialColonPart && strstr(lineBuffer, ": warning C")) { // Microsoft warning without line number // : warning C9999 return SCE_ERR_MS; } else { return SCE_ERR_DEFAULT; } } } #define CSI "\033[" constexpr bool SequenceEnd(int ch) noexcept { return (ch == 0) || ((ch >= '@') && (ch <= '~')); } int StyleFromSequence(const char *seq) noexcept { int bold = 0; int colour = 0; while (!SequenceEnd(*seq)) { if (Is0To9(*seq)) { int base = *seq - '0'; if (Is0To9(seq[1])) { base = base * 10; base += seq[1] - '0'; seq++; } if (base == 0) { colour = 0; bold = 0; } else if (base == 1) { bold = 1; } else if (base >= 30 && base <= 37) { colour = base - 30; } } seq++; } return SCE_ERR_ES_BLACK + bold * 8 + colour; } void ColouriseErrorListLine( const std::string &lineBuffer, Sci_PositionU endPos, Accessor &styler, bool valueSeparate, bool escapeSequences) { Sci_Position startValue = -1; const Sci_PositionU lengthLine = lineBuffer.length(); const int style = RecogniseErrorListLine(lineBuffer.c_str(), lengthLine, startValue); if (escapeSequences && strstr(lineBuffer.c_str(), CSI)) { const Sci_Position startPos = endPos - lengthLine; const char *linePortion = lineBuffer.c_str(); Sci_Position startPortion = startPos; int portionStyle = style; while (const char *startSeq = strstr(linePortion, CSI)) { if (startSeq > linePortion) { styler.ColourTo(startPortion + (startSeq - linePortion), portionStyle); } const char *endSeq = startSeq + 2; while (!SequenceEnd(*endSeq)) endSeq++; const Sci_Position endSeqPosition = startPortion + (endSeq - linePortion) + 1; switch (*endSeq) { case 0: styler.ColourTo(endPos, SCE_ERR_ESCSEQ_UNKNOWN); return; case 'm': // Colour command styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ); portionStyle = StyleFromSequence(startSeq+2); break; case 'K': // Erase to end of line -> ignore styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ); break; default: styler.ColourTo(endSeqPosition, SCE_ERR_ESCSEQ_UNKNOWN); portionStyle = style; } startPortion = endSeqPosition; linePortion = endSeq + 1; } styler.ColourTo(endPos, portionStyle); } else { if (valueSeparate && (startValue >= 0)) { styler.ColourTo(endPos - (lengthLine - startValue), style); styler.ColourTo(endPos, SCE_ERR_VALUE); } else { styler.ColourTo(endPos, style); } } } void ColouriseErrorListDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { std::string lineBuffer; styler.StartAt(startPos); styler.StartSegment(startPos); // property lexer.errorlist.value.separate // For lines in the output pane that are matches from Find in Files or GCC-style // diagnostics, style the path and line number separately from the rest of the // line with style 21 used for the rest of the line. // This allows matched text to be more easily distinguished from its location. const bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0; // property lexer.errorlist.escape.sequences // Set to 1 to interpret escape sequences. const bool escapeSequences = styler.GetPropertyInt("lexer.errorlist.escape.sequences") != 0; for (Sci_PositionU i = startPos; i < startPos + length; i++) { lineBuffer.push_back(styler[i]); if (AtEOL(styler, i)) { // End of line met, colourise it ColouriseErrorListLine(lineBuffer, i, styler, valueSeparate, escapeSequences); lineBuffer.clear(); } } if (!lineBuffer.empty()) { // Last line does not have ending characters ColouriseErrorListLine(lineBuffer, startPos + length - 1, styler, valueSeparate, escapeSequences); } } const char *const emptyWordListDesc[] = { nullptr }; } LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", nullptr, emptyWordListDesc); ================================================ FILE: lexilla/lexers/LexFSharp.cxx ================================================ /** * @file LexFSharp.cxx * Lexer for F# 5.0 * Copyright (c) 2021 Robert Di Pardo * Parts of LexerFSharp::Lex were adapted from LexCaml.cxx by Robert Roessler ("RR"). * Parts of LexerFSharp::Fold were adapted from LexCPP.cxx by Neil Hodgson and Udo Lechner. * The License.txt file describes the conditions under which this software may be distributed. */ // clang-format off #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "DefaultLexer.h" // clang-format on using namespace Scintilla; using namespace Lexilla; static const char *const lexerName = "fsharp"; static constexpr int WORDLIST_SIZE = 5; static const char *const fsharpWordLists[] = { "standard language keywords", "core functions, including those in the FSharp.Collections namespace", "built-in types, core namespaces, modules", "optional", "optional", nullptr, }; static constexpr int keywordClasses[] = { SCE_FSHARP_KEYWORD, SCE_FSHARP_KEYWORD2, SCE_FSHARP_KEYWORD3, SCE_FSHARP_KEYWORD4, SCE_FSHARP_KEYWORD5, }; namespace { struct OptionsFSharp { bool fold = true; bool foldCompact = true; bool foldComment = true; bool foldCommentStream = true; bool foldCommentMultiLine = true; bool foldPreprocessor = false; bool foldImports = true; }; struct OptionSetFSharp : public OptionSet { OptionSetFSharp() { DefineProperty("fold", &OptionsFSharp::fold); DefineProperty("fold.compact", &OptionsFSharp::foldCompact); DefineProperty("fold.comment", &OptionsFSharp::foldComment, "Setting this option to 0 disables comment folding in F# files."); DefineProperty("fold.fsharp.comment.stream", &OptionsFSharp::foldCommentStream, "Setting this option to 0 disables folding of ML-style comments in F# files when " "fold.comment=1."); DefineProperty("fold.fsharp.comment.multiline", &OptionsFSharp::foldCommentMultiLine, "Setting this option to 0 disables folding of grouped line comments in F# files when " "fold.comment=1."); DefineProperty("fold.fsharp.preprocessor", &OptionsFSharp::foldPreprocessor, "Setting this option to 1 enables folding of F# compiler directives."); DefineProperty("fold.fsharp.imports", &OptionsFSharp::foldImports, "Setting this option to 0 disables folding of F# import declarations."); DefineWordListSets(fsharpWordLists); } }; struct FSharpString { Sci_Position startPos = INVALID_POSITION; int startChar = '"', nextChar = '\0'; constexpr bool HasLength() const { return startPos > INVALID_POSITION; } constexpr bool CanInterpolate() const { return startChar == '$' || (startChar == '@' && nextChar == '$'); } constexpr bool IsVerbatim() const { return startChar == '@' || (startChar == '$' && nextChar == '@'); } }; class UnicodeChar { enum class Notation { none, asciiDec, asciiHex, utf16, utf32 }; Notation type = Notation::none; // single-byte Unicode char (000 - 255) int asciiDigits[3] = { 0 }; int maxDigit = '9'; int toEnd = 0; bool invalid = false; public: UnicodeChar() noexcept = default; explicit UnicodeChar(const int prefix) { if (IsADigit(prefix)) { *asciiDigits = prefix; if (*asciiDigits >= '0' && *asciiDigits <= '2') { type = Notation::asciiDec; // count first digit as "prefix" toEnd = 2; } } else if (prefix == 'x' || prefix == 'u' || prefix == 'U') { switch (prefix) { case 'x': type = Notation::asciiHex; toEnd = 2; break; case 'u': type = Notation::utf16; toEnd = 4; break; case 'U': type = Notation::utf32; toEnd = 8; break; } } } void Parse(const int ch) { invalid = false; switch (type) { case Notation::asciiDec: { maxDigit = (*asciiDigits < '2') ? '9' : (asciiDigits[1] <= '4') ? '9' : '5'; if (IsADigit(ch) && asciiDigits[1] <= maxDigit && ch <= maxDigit) { asciiDigits[1] = ch; toEnd--; } else { invalid = true; } break; } case Notation::asciiHex: case Notation::utf16: if (IsADigit(ch, 16)) { toEnd--; } else { invalid = true; } break; case Notation::utf32: if ((toEnd > 6 && ch == '0') || (toEnd <= 6 && IsADigit(ch, 16))) { toEnd--; } else { invalid = true; } break; case Notation::none: break; } } constexpr bool AtEnd() noexcept { return invalid || type == Notation::none || (type != Notation::none && toEnd < 0); } }; inline bool MatchStreamCommentStart(StyleContext &cxt) { // match (* ... *), but allow point-free usage of the `*` operator, // e.g. List.fold (*) 1 [ 1; 2; 3 ] return (cxt.Match('(', '*') && cxt.GetRelative(2) != ')'); } inline bool MatchStreamCommentEnd(const StyleContext &cxt) { return (cxt.ch == ')' && cxt.chPrev == '*'); } inline bool MatchLineComment(const StyleContext &cxt) { // style shebang lines as comments in F# scripts: // https://fsharp.org/specs/language-spec/4.1/FSharpSpec-4.1-latest.pdf#page=30&zoom=auto,-98,537 return cxt.Match('/', '/') || cxt.Match('#', '!'); } inline bool MatchLineNumberStart(StyleContext &cxt) { return cxt.atLineStart && (cxt.MatchIgnoreCase("#line") || (cxt.ch == '#' && (IsADigit(cxt.chNext) || IsADigit(cxt.GetRelative(2))))); } inline bool MatchPPDirectiveStart(const StyleContext &cxt) { return (cxt.atLineStart && cxt.ch == '#' && iswordstart(cxt.chNext)); } inline bool MatchTypeAttributeStart(const StyleContext &cxt) { return cxt.Match('[', '<'); } inline bool MatchTypeAttributeEnd(const StyleContext &cxt) { return (cxt.ch == ']' && cxt.chPrev == '>'); } inline bool MatchQuotedExpressionStart(const StyleContext &cxt) { return cxt.Match('<', '@'); } inline bool MatchQuotedExpressionEnd(const StyleContext &cxt) { return (cxt.ch == '>' && cxt.chPrev == '@'); } inline bool MatchStringStart(StyleContext &cxt) { return (cxt.ch == '"' || cxt.Match("@\"") || cxt.Match("$\"") || cxt.Match("@$\"") || cxt.Match("$@\"") || cxt.Match("``")); } inline bool FollowsEscapedBackslash(StyleContext &cxt) { int count = 0; for (Sci_Position offset = 1; cxt.GetRelative(-offset) == '\\'; offset++) count++; return count % 2 != 0; } inline bool MatchStringEnd(StyleContext &cxt, const FSharpString &fsStr) { return (fsStr.HasLength() && // end of quoted identifier? ((cxt.ch == '`' && cxt.chPrev == '`') || // end of literal or interpolated triple-quoted string? ((fsStr.startChar == '"' || (fsStr.CanInterpolate() && !(fsStr.IsVerbatim() || cxt.chPrev == '$'))) && cxt.MatchIgnoreCase("\"\"\"")) || // end of verbatim string? (fsStr.IsVerbatim() && // embedded quotes must be in pairs cxt.ch == '"' && cxt.chNext != '"' && (cxt.chPrev != '"' || // empty verbatim string? ((cxt.GetRelative(-2) == '@' || cxt.GetRelative(-2) == '$') || // pair of quotes at end of string? (cxt.GetRelative(-2) == '"' && !(cxt.GetRelative(-3) == '@' || cxt.GetRelative(-3) == '$'))))))) || (!fsStr.HasLength() && cxt.ch == '"' && ((cxt.chPrev != '\\' || (cxt.GetRelative(-2) == '\\' && !FollowsEscapedBackslash(cxt))) || // treat backslashes as char literals in verbatim strings (fsStr.IsVerbatim() && cxt.chPrev == '\\'))); } inline bool MatchCharacterStart(StyleContext &cxt) { // don't style generic type parameters: 'a, 'b, 'T, etc. return (cxt.ch == '\'' && !(cxt.chPrev == ':' || cxt.GetRelative(-2) == ':')); } inline bool CanEmbedQuotes(StyleContext &cxt) { // allow unescaped double quotes inside literal or interpolated triple-quoted strings, verbatim strings, // and quoted identifiers: // - https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/strings // - https://docs.microsoft.com/en-us/dotnet/fsharp/language-reference/interpolated-strings#syntax // - https://fsharp.org/specs/language-spec/4.1/FSharpSpec-4.1-latest.pdf#page=25&zoom=auto,-98,600 return cxt.Match("$\"\"\"") || cxt.Match("\"\"\"") || cxt.Match("@$\"\"\"") || cxt.Match("$@\"\"\"") || cxt.Match('@', '"') || cxt.Match('`', '`'); } inline bool IsLineEnd(StyleContext &cxt, const Sci_Position offset) { const int ch = cxt.GetRelative(offset, '\n'); return (ch == '\r' || ch == '\n'); } class LexerFSharp : public DefaultLexer { WordList keywords[WORDLIST_SIZE]; OptionsFSharp options; OptionSetFSharp optionSet; CharacterSet setOperators; CharacterSet setFormatSpecs; CharacterSet setDotNetFormatSpecs; CharacterSet setFormatFlags; CharacterSet numericMetaChars1; CharacterSet numericMetaChars2; std::map numericPrefixes = { { 'b', 2 }, { 'o', 8 }, { 'x', 16 } }; public: explicit LexerFSharp() : DefaultLexer(lexerName, SCLEX_FSHARP), setOperators(CharacterSet::setNone, "~^'-+*/%=@|&<>()[]{};,:!?"), setFormatSpecs(CharacterSet::setNone, ".%aAbBcdeEfFgGiMoOstuxX0123456789"), setDotNetFormatSpecs(CharacterSet::setNone, "cCdDeEfFgGnNpPxX"), setFormatFlags(CharacterSet::setNone, ".-+0 "), numericMetaChars1(CharacterSet::setNone, "_uU"), numericMetaChars2(CharacterSet::setNone, "fFIlLmMnsy") { } LexerFSharp(const LexerFSharp &) = delete; LexerFSharp(LexerFSharp &&) = delete; LexerFSharp &operator=(const LexerFSharp &) = delete; LexerFSharp &operator=(LexerFSharp &&) = delete; static ILexer5 *LexerFactoryFSharp() { return new LexerFSharp(); } virtual ~LexerFSharp() { } void SCI_METHOD Release() noexcept override { delete this; } int SCI_METHOD Version() const noexcept override { return lvRelease5; } const char *SCI_METHOD GetName() noexcept override { return lexerName; } int SCI_METHOD GetIdentifier() noexcept override { return SCLEX_FSHARP; } int SCI_METHOD LineEndTypesSupported() noexcept override { return SC_LINE_END_TYPE_DEFAULT; } void *SCI_METHOD PrivateCall(int, void *) noexcept override { return nullptr; } const char *SCI_METHOD DescribeWordListSets() override { return optionSet.DescribeWordListSets(); } const char *SCI_METHOD PropertyNames() override { return optionSet.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return optionSet.PropertyType(name); } const char *SCI_METHOD DescribeProperty(const char *name) override { return optionSet.DescribeProperty(name); } const char *SCI_METHOD PropertyGet(const char *key) override { return optionSet.PropertyGet(key); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override { if (optionSet.PropertySet(&options, key, val)) { return 0; } return INVALID_POSITION; } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU start, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU start, Sci_Position length, int initStyle,IDocument *pAccess) override; private: inline bool IsNumber(StyleContext &cxt, const int base = 10) { return IsADigit(cxt.ch, base) || (IsADigit(cxt.chPrev, base) && numericMetaChars1.Contains(cxt.ch)) || (IsADigit(cxt.GetRelative(-2), base) && numericMetaChars2.Contains(cxt.ch)); } inline bool IsFloat(StyleContext &cxt) { if (cxt.MatchIgnoreCase("e+") || cxt.MatchIgnoreCase("e-")) { cxt.Forward(); return true; } return ((cxt.chPrev == '.' && IsADigit(cxt.ch)) || (IsADigit(cxt.chPrev) && (cxt.ch == '.' || numericMetaChars2.Contains(cxt.ch)))); } }; Sci_Position SCI_METHOD LexerFSharp::WordListSet(int n, const char *wl) { WordList *wordListN = nullptr; Sci_Position firstModification = INVALID_POSITION; if (n < WORDLIST_SIZE) { wordListN = &keywords[n]; } if (wordListN && wordListN->Set(wl)) { firstModification = 0; } return firstModification; } void SCI_METHOD LexerFSharp::Lex(Sci_PositionU start, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); StyleContext sc(start, static_cast(length), initStyle, styler); Sci_Position lineCurrent = styler.GetLine(static_cast(start)); Sci_PositionU cursor = 0; UnicodeChar uniCh = UnicodeChar(); FSharpString fsStr = FSharpString(); constexpr Sci_Position MAX_WORD_LEN = 64; constexpr int SPACE = ' '; int currentBase = 10; int levelNesting = (lineCurrent >= 1) ? styler.GetLineState(lineCurrent - 1) : 0; bool isInterpolated = false; while (sc.More()) { Sci_PositionU colorSpan = sc.currentPos - 1; int state = -1; bool advance = true; switch (sc.state & 0xff) { case SCE_FSHARP_DEFAULT: cursor = sc.currentPos; if (MatchLineNumberStart(sc)) { state = SCE_FSHARP_LINENUM; } else if (MatchPPDirectiveStart(sc)) { state = SCE_FSHARP_PREPROCESSOR; } else if (MatchLineComment(sc)) { state = SCE_FSHARP_COMMENTLINE; sc.Forward(); sc.ch = SPACE; } else if (MatchStreamCommentStart(sc)) { state = SCE_FSHARP_COMMENT; sc.Forward(); sc.ch = SPACE; } else if (MatchTypeAttributeStart(sc)) { state = SCE_FSHARP_ATTRIBUTE; sc.Forward(); } else if (MatchQuotedExpressionStart(sc)) { state = SCE_FSHARP_QUOTATION; sc.Forward(); } else if (MatchCharacterStart(sc)) { state = SCE_FSHARP_CHARACTER; } else if (MatchStringStart(sc)) { fsStr.startChar = sc.ch; fsStr.nextChar = sc.chNext; fsStr.startPos = INVALID_POSITION; if (CanEmbedQuotes(sc)) { // double quotes after this position should be non-terminating fsStr.startPos = static_cast(sc.currentPos - cursor); } if (sc.ch == '`') { state = SCE_FSHARP_QUOT_IDENTIFIER; } else if (fsStr.IsVerbatim()) { state = SCE_FSHARP_VERBATIM; } else { state = SCE_FSHARP_STRING; } } else if (IsADigit(sc.ch, currentBase) || ((sc.ch == '+' || sc.ch == '-') && IsADigit(sc.chNext))) { state = SCE_FSHARP_NUMBER; } else if (setOperators.Contains(sc.ch) && // don't use operator style in async keywords (e.g. `return!`) !(sc.ch == '!' && iswordstart(sc.chPrev)) && // don't use operator style in member access, array/string indexing !(sc.ch == '.' && (sc.chPrev == '\"' || iswordstart(sc.chPrev)) && (iswordstart(sc.chNext) || sc.chNext == '['))) { state = SCE_FSHARP_OPERATOR; } else if (iswordstart(sc.ch)) { state = SCE_FSHARP_IDENTIFIER; } else { state = SCE_FSHARP_DEFAULT; } break; case SCE_FSHARP_LINENUM: case SCE_FSHARP_PREPROCESSOR: case SCE_FSHARP_COMMENTLINE: if (sc.MatchLineEnd()) { state = SCE_FSHARP_DEFAULT; advance = false; } break; case SCE_FSHARP_COMMENT: if (MatchStreamCommentStart(sc)) { sc.Forward(); sc.ch = SPACE; levelNesting++; } else if (MatchStreamCommentEnd(sc)) { if (levelNesting > 0) levelNesting--; else { state = SCE_FSHARP_DEFAULT; colorSpan++; } } break; case SCE_FSHARP_ATTRIBUTE: case SCE_FSHARP_QUOTATION: if (MatchTypeAttributeEnd(sc) || MatchQuotedExpressionEnd(sc)) { state = SCE_FSHARP_DEFAULT; colorSpan++; } break; case SCE_FSHARP_CHARACTER: if (sc.chPrev == '\\' && sc.GetRelative(-2) != '\\') { uniCh = UnicodeChar(sc.ch); } else if (sc.ch == '\'' && ((sc.chPrev == ' ' && sc.GetRelative(-2) == '\'') || sc.chPrev != '\\' || (sc.chPrev == '\\' && sc.GetRelative(-2) == '\\'))) { // byte literal? if (sc.Match('\'', 'B')) { sc.Forward(); colorSpan++; } if (!sc.atLineEnd) { colorSpan++; } else { sc.ChangeState(SCE_FSHARP_IDENTIFIER); } state = SCE_FSHARP_DEFAULT; } else { uniCh.Parse(sc.ch); if (uniCh.AtEnd() && (sc.currentPos - cursor) >= 2) { // terminate now, since we left the char behind sc.ChangeState(SCE_FSHARP_IDENTIFIER); advance = false; } } break; case SCE_FSHARP_STRING: case SCE_FSHARP_VERBATIM: case SCE_FSHARP_QUOT_IDENTIFIER: if (MatchStringEnd(sc, fsStr)) { const Sci_Position strLen = static_cast(sc.currentPos - cursor); // backtrack to start of string for (Sci_Position i = -strLen; i < 0; i++) { const int startQuote = sc.GetRelative(i); if (startQuote == '\"' || (startQuote == '`' && sc.GetRelative(i - 1) == '`')) { // byte array? if (sc.Match('\"', 'B')) { sc.Forward(); colorSpan++; } if (!sc.atLineEnd) { colorSpan++; } else { sc.ChangeState(SCE_FSHARP_IDENTIFIER); } state = SCE_FSHARP_DEFAULT; break; } } } else if (sc.ch == '%' && !(fsStr.startChar == '`' || sc.MatchIgnoreCase("% ") || sc.MatchIgnoreCase("% \"")) && (setFormatSpecs.Contains(sc.chNext) || setFormatFlags.Contains(sc.chNext))) { if (fsStr.CanInterpolate() && sc.chNext != '%') { for (Sci_Position i = 2; i < length && !IsLineEnd(sc, i); i++) { if (sc.GetRelative(i) == '{') { state = setFormatSpecs.Contains(sc.GetRelative(i - 1)) ? SCE_FSHARP_FORMAT_SPEC : state; break; } } } else { state = SCE_FSHARP_FORMAT_SPEC; } } else if (isInterpolated) { if (sc.ch == ',') { // .NET alignment specifier? state = (sc.chNext == '+' || sc.chNext == '-' || IsADigit(sc.chNext)) ? SCE_FSHARP_FORMAT_SPEC : state; } else if (sc.ch == ':') { // .NET format specifier? state = setDotNetFormatSpecs.Contains(sc.chNext) ? SCE_FSHARP_FORMAT_SPEC : state; } else if (sc.chNext == '}') { isInterpolated = false; sc.Forward(); state = fsStr.IsVerbatim() ? SCE_FSHARP_VERBATIM : SCE_FSHARP_STRING; } } else if (fsStr.CanInterpolate() && sc.ch == '{') { isInterpolated = true; } break; case SCE_FSHARP_IDENTIFIER: if (!(iswordstart(sc.ch) || sc.ch == '\'')) { const Sci_Position wordLen = static_cast(sc.currentPos - cursor); if (wordLen < MAX_WORD_LEN) { // wordLength is believable as keyword, [re-]construct token - RR char token[MAX_WORD_LEN] = { 0 }; for (Sci_Position i = -wordLen; i < 0; i++) { token[wordLen + i] = static_cast(sc.GetRelative(i)); } token[wordLen] = '\0'; // a snake_case_identifier can never be a keyword if (!(sc.ch == '_' || sc.GetRelative(-wordLen - 1) == '_')) { for (int i = 0; i < WORDLIST_SIZE; i++) { if (keywords[i].InList(token)) { sc.ChangeState(keywordClasses[i]); break; } } } } state = SCE_FSHARP_DEFAULT; advance = false; } break; case SCE_FSHARP_OPERATOR: // special-case "()" and "[]" tokens as KEYWORDS - RR if ((sc.ch == ')' && sc.chPrev == '(') || (sc.ch == ']' && sc.chPrev == '[')) { sc.ChangeState(SCE_FSHARP_KEYWORD); colorSpan++; } else { advance = false; } state = SCE_FSHARP_DEFAULT; break; case SCE_FSHARP_NUMBER: if ((setOperators.Contains(sc.chPrev) || IsASpaceOrTab(sc.chPrev)) && sc.ch == '0') { if (numericPrefixes.find(sc.chNext) != numericPrefixes.end()) { currentBase = numericPrefixes[sc.chNext]; sc.Forward(2); } } else if ((setOperators.Contains(sc.GetRelative(-2)) || IsASpaceOrTab(sc.GetRelative(-2))) && sc.chPrev == '0') { if (numericPrefixes.find(sc.ch) != numericPrefixes.end()) { currentBase = numericPrefixes[sc.ch]; sc.Forward(); } } state = (IsNumber(sc, currentBase) || IsFloat(sc)) ? SCE_FSHARP_NUMBER // change style even when operators aren't spaced : setOperators.Contains(sc.ch) ? SCE_FSHARP_OPERATOR : SCE_FSHARP_DEFAULT; currentBase = (state == SCE_FSHARP_NUMBER) ? currentBase : 10; break; case SCE_FSHARP_FORMAT_SPEC: if (!(isInterpolated && IsADigit(sc.chNext)) && (!setFormatSpecs.Contains(sc.chNext) || !(setFormatFlags.Contains(sc.ch) || IsADigit(sc.ch)) || (setFormatFlags.Contains(sc.ch) && sc.ch == sc.chNext))) { colorSpan++; state = fsStr.IsVerbatim() ? SCE_FSHARP_VERBATIM : SCE_FSHARP_STRING; } break; } if (sc.MatchLineEnd()) { styler.SetLineState(lineCurrent++, (sc.state == SCE_FSHARP_COMMENT) ? levelNesting : 0); advance = true; } if (state >= SCE_FSHARP_DEFAULT) { styler.ColourTo(colorSpan, sc.state); sc.ChangeState(state); } if (advance) { sc.Forward(); } } sc.Complete(); } bool LineContains(LexAccessor &styler, const char *word, const Sci_Position start, const int chAttr = SCE_FSHARP_DEFAULT); void FoldLexicalGroup(LexAccessor &styler, int &levelNext, const Sci_Position lineCurrent, const char *word, const int chAttr); void SCI_METHOD LexerFSharp::Fold(Sci_PositionU start, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) { return; } LexAccessor styler(pAccess); const Sci_Position startPos = static_cast(start); const Sci_PositionU endPos = start + length; Sci_Position lineCurrent = styler.GetLine(startPos); Sci_Position lineNext = lineCurrent + 1; Sci_Position lineStartNext = styler.LineStart(lineNext); int style = initStyle; int styleNext = styler.StyleAt(startPos); char chNext = styler[startPos]; int levelNext; int levelCurrent = SC_FOLDLEVELBASE; int visibleChars = 0; if (lineCurrent > 0) { levelCurrent = styler.LevelAt(lineCurrent - 1) >> 0x10; } levelNext = levelCurrent; for (Sci_PositionU i = start; i < endPos; i++) { const Sci_Position currentPos = static_cast(i); const bool atEOL = (currentPos == (lineStartNext - 1) || styler.SafeGetCharAt(currentPos) == '\r'); const bool atLineOrDocEnd = (atEOL || (i == (endPos - 1))); const int stylePrev = style; const char ch = chNext; const bool inLineComment = (stylePrev == SCE_FSHARP_COMMENTLINE); style = styleNext; styleNext = styler.StyleAt(currentPos + 1); chNext = styler.SafeGetCharAt(currentPos + 1); if (options.foldComment) { if (options.foldCommentMultiLine && inLineComment && atEOL) { FoldLexicalGroup(styler, levelNext, lineCurrent, "//", SCE_FSHARP_COMMENTLINE); } if (options.foldCommentStream && style == SCE_FSHARP_COMMENT && !inLineComment) { if (stylePrev != SCE_FSHARP_COMMENT || (styler.Match(currentPos, "(*") && !LineContains(styler, "*)", currentPos + 2, SCE_FSHARP_COMMENT))) { levelNext++; } else if ((styleNext != SCE_FSHARP_COMMENT || ((styler.Match(currentPos, "*)") && !LineContains(styler, "(*", styler.LineStart(lineCurrent), SCE_FSHARP_COMMENT)) && styler.GetLineState(lineCurrent - 1) > 0)) && !atEOL) { levelNext--; } } } if (options.foldPreprocessor && style == SCE_FSHARP_PREPROCESSOR) { if (styler.Match(currentPos, "#if")) { levelNext++; } else if (styler.Match(currentPos, "#endif")) { levelNext--; } } if (options.foldImports && styler.Match(currentPos, "open ") && styleNext == SCE_FSHARP_KEYWORD) { FoldLexicalGroup(styler, levelNext, lineCurrent, "open ", SCE_FSHARP_KEYWORD); } if (!IsASpace(ch)) { visibleChars++; } if (atLineOrDocEnd) { int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (visibleChars == 0 && options.foldCompact) { lev |= SC_FOLDLEVELWHITEFLAG; } if (levelUse < levelNext) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } visibleChars = 0; lineCurrent++; lineNext = lineCurrent + 1; lineStartNext = styler.LineStart(lineNext); levelCurrent = levelNext; if (atEOL && (currentPos == (styler.Length() - 1))) { styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } } } } bool LineContains(LexAccessor &styler, const char *word, const Sci_Position start, const int chAttr) { bool found = false; bool requireStyle = (chAttr > SCE_FSHARP_DEFAULT); for (Sci_Position i = start; i < styler.LineStart(styler.GetLine(start) + 1) - 1; i++) { if (styler.Match(i, word)) { found = requireStyle ? styler.StyleAt(i) == chAttr : true; break; } } return found; } void FoldLexicalGroup(LexAccessor &styler, int &levelNext, const Sci_Position lineCurrent, const char *word, const int chAttr) { const Sci_Position linePrev = styler.LineStart(lineCurrent - 1); const Sci_Position lineNext = styler.LineStart(lineCurrent + 1); const bool follows = (lineCurrent > 0) && LineContains(styler, word, linePrev, chAttr); const bool isFollowed = LineContains(styler, word, lineNext, chAttr); if (isFollowed && !follows) { levelNext++; } else if (!isFollowed && follows && levelNext > SC_FOLDLEVELBASE) { levelNext--; } } } // namespace LexerModule lmFSharp(SCLEX_FSHARP, LexerFSharp::LexerFactoryFSharp, "fsharp", fsharpWordLists); ================================================ FILE: lexilla/lexers/LexFlagship.cxx ================================================ // Scintilla source code edit control /** @file LexFlagship.cxx ** Lexer for Harbour and FlagShip. ** (Syntactically compatible to other xBase dialects, like Clipper, dBase, Clip, FoxPro etc.) **/ // Copyright 2005 by Randy Butler // Copyright 2010 by Xavi (Harbour) // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; // Extended to accept accented characters static inline bool IsAWordChar(int ch) { return ch >= 0x80 || (isalnum(ch) || ch == '_'); } static void ColouriseFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; WordList &keywords5 = *keywordlists[4]; // property lexer.flagship.styling.within.preprocessor // For Harbour code, determines whether all preprocessor code is styled in the preprocessor style (0) or only from the // initial # to the end of the command word(1, the default). It also determines how to present text, dump, and disabled code. bool stylingWithinPreprocessor = styler.GetPropertyInt("lexer.flagship.styling.within.preprocessor", 1) != 0; CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); int visibleChars = 0; int closeStringChar = 0; int styleBeforeDCKeyword = SCE_FS_DEFAULT; bool bEnableCode = initStyle < SCE_FS_DISABLEDCODE; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // Determine if the current state should terminate. switch (sc.state) { case SCE_FS_OPERATOR: case SCE_FS_OPERATOR_C: case SCE_FS_WORDOPERATOR: sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); break; case SCE_FS_IDENTIFIER: case SCE_FS_IDENTIFIER_C: if (!IsAWordChar(sc.ch)) { char s[64]; sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(bEnableCode ? SCE_FS_KEYWORD : SCE_FS_KEYWORD_C); } else if (keywords2.InList(s)) { sc.ChangeState(bEnableCode ? SCE_FS_KEYWORD2 : SCE_FS_KEYWORD2_C); } else if (bEnableCode && keywords3.InList(s)) { sc.ChangeState(SCE_FS_KEYWORD3); } else if (bEnableCode && keywords4.InList(s)) { sc.ChangeState(SCE_FS_KEYWORD4); }// Else, it is really an identifier... sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } break; case SCE_FS_NUMBER: if (!IsAWordChar(sc.ch) && !(sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_FS_DEFAULT); } break; case SCE_FS_NUMBER_C: if (!IsAWordChar(sc.ch) && sc.ch != '.') { sc.SetState(SCE_FS_DEFAULT_C); } break; case SCE_FS_CONSTANT: if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_FS_DEFAULT); } break; case SCE_FS_STRING: case SCE_FS_STRING_C: if (sc.ch == closeStringChar) { sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } else if (sc.atLineEnd) { sc.ChangeState(bEnableCode ? SCE_FS_STRINGEOL : SCE_FS_STRINGEOL_C); } break; case SCE_FS_STRINGEOL: case SCE_FS_STRINGEOL_C: if (sc.atLineStart) { sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } break; case SCE_FS_COMMENTDOC: case SCE_FS_COMMENTDOC_C: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = bEnableCode ? SCE_FS_COMMENTDOC : SCE_FS_COMMENTDOC_C; sc.SetState(SCE_FS_COMMENTDOCKEYWORD); } } break; case SCE_FS_COMMENT: case SCE_FS_COMMENTLINE: if (sc.atLineStart) { sc.SetState(SCE_FS_DEFAULT); } break; case SCE_FS_COMMENTLINEDOC: case SCE_FS_COMMENTLINEDOC_C: if (sc.atLineStart) { sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { styleBeforeDCKeyword = bEnableCode ? SCE_FS_COMMENTLINEDOC : SCE_FS_COMMENTLINEDOC_C; sc.SetState(SCE_FS_COMMENTDOCKEYWORD); } } break; case SCE_FS_COMMENTDOCKEYWORD: if ((styleBeforeDCKeyword == SCE_FS_COMMENTDOC || styleBeforeDCKeyword == SCE_FS_COMMENTDOC_C) && sc.Match('*', '/')) { sc.ChangeState(SCE_FS_COMMENTDOCKEYWORDERROR); sc.Forward(); sc.ForwardSetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } else if (!setDoxygen.Contains(sc.ch)) { char s[64]; sc.GetCurrentLowered(s, sizeof(s)); if (!IsASpace(sc.ch) || !keywords5.InList(s + 1)) { sc.ChangeState(SCE_FS_COMMENTDOCKEYWORDERROR); } sc.SetState(styleBeforeDCKeyword); } break; case SCE_FS_PREPROCESSOR: case SCE_FS_PREPROCESSOR_C: if (sc.atLineEnd) { if (!(sc.chPrev == ';' || sc.GetRelative(-2) == ';')) { sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } } else if (stylingWithinPreprocessor) { if (IsASpaceOrTab(sc.ch)) { sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } } else if (sc.Match('/', '*') || sc.Match('/', '/') || sc.Match('&', '&')) { sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } break; case SCE_FS_DISABLEDCODE: if (sc.ch == '#' && visibleChars == 0) { sc.SetState(bEnableCode ? SCE_FS_PREPROCESSOR : SCE_FS_PREPROCESSOR_C); do { // Skip whitespace between # and preprocessor word sc.Forward(); } while (IsASpaceOrTab(sc.ch) && sc.More()); if (sc.MatchIgnoreCase("pragma")) { sc.Forward(6); do { // Skip more whitespace until keyword sc.Forward(); } while (IsASpaceOrTab(sc.ch) && sc.More()); if (sc.MatchIgnoreCase("enddump") || sc.MatchIgnoreCase("__endtext")) { bEnableCode = true; sc.SetState(SCE_FS_DISABLEDCODE); sc.Forward(sc.ch == '_' ? 8 : 6); sc.ForwardSetState(SCE_FS_DEFAULT); } else { sc.ChangeState(SCE_FS_DISABLEDCODE); } } else { sc.ChangeState(SCE_FS_DISABLEDCODE); } } break; case SCE_FS_DATE: if (sc.ch == '}') { sc.ForwardSetState(SCE_FS_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_FS_STRINGEOL); } } // Determine if a new state should be entered. if (sc.state == SCE_FS_DEFAULT || sc.state == SCE_FS_DEFAULT_C) { if (bEnableCode && (sc.MatchIgnoreCase(".and.") || sc.MatchIgnoreCase(".not."))) { sc.SetState(SCE_FS_WORDOPERATOR); sc.Forward(4); } else if (bEnableCode && sc.MatchIgnoreCase(".or.")) { sc.SetState(SCE_FS_WORDOPERATOR); sc.Forward(3); } else if (bEnableCode && (sc.MatchIgnoreCase(".t.") || sc.MatchIgnoreCase(".f.") || (!IsAWordChar(sc.GetRelative(3)) && sc.MatchIgnoreCase("nil")))) { sc.SetState(SCE_FS_CONSTANT); sc.Forward(2); } else if (sc.Match('/', '*')) { sc.SetState(bEnableCode ? SCE_FS_COMMENTDOC : SCE_FS_COMMENTDOC_C); sc.Forward(); } else if (bEnableCode && sc.Match('&', '&')) { sc.SetState(SCE_FS_COMMENTLINE); sc.Forward(); } else if (sc.Match('/', '/')) { sc.SetState(bEnableCode ? SCE_FS_COMMENTLINEDOC : SCE_FS_COMMENTLINEDOC_C); sc.Forward(); } else if (bEnableCode && sc.ch == '*' && visibleChars == 0) { sc.SetState(SCE_FS_COMMENT); } else if (sc.ch == '\"' || sc.ch == '\'') { sc.SetState(bEnableCode ? SCE_FS_STRING : SCE_FS_STRING_C); closeStringChar = sc.ch; } else if (closeStringChar == '>' && sc.ch == '<') { sc.SetState(bEnableCode ? SCE_FS_STRING : SCE_FS_STRING_C); } else if (sc.ch == '#' && visibleChars == 0) { sc.SetState(bEnableCode ? SCE_FS_PREPROCESSOR : SCE_FS_PREPROCESSOR_C); do { // Skip whitespace between # and preprocessor word sc.Forward(); } while (IsASpaceOrTab(sc.ch) && sc.More()); if (sc.atLineEnd) { sc.SetState(bEnableCode ? SCE_FS_DEFAULT : SCE_FS_DEFAULT_C); } else if (sc.MatchIgnoreCase("include")) { if (stylingWithinPreprocessor) { closeStringChar = '>'; } } else if (sc.MatchIgnoreCase("pragma")) { sc.Forward(6); do { // Skip more whitespace until keyword sc.Forward(); } while (IsASpaceOrTab(sc.ch) && sc.More()); if (sc.MatchIgnoreCase("begindump") || sc.MatchIgnoreCase("__cstream")) { bEnableCode = false; if (stylingWithinPreprocessor) { sc.SetState(SCE_FS_DISABLEDCODE); sc.Forward(8); sc.ForwardSetState(SCE_FS_DEFAULT_C); } else { sc.SetState(SCE_FS_DISABLEDCODE); } } else if (sc.MatchIgnoreCase("enddump") || sc.MatchIgnoreCase("__endtext")) { bEnableCode = true; sc.SetState(SCE_FS_DISABLEDCODE); sc.Forward(sc.ch == '_' ? 8 : 6); sc.ForwardSetState(SCE_FS_DEFAULT); } } } else if (bEnableCode && sc.ch == '{') { Sci_Position p = 0; int chSeek; Sci_PositionU endPos(startPos + length); do { // Skip whitespace chSeek = sc.GetRelative(++p); } while (IsASpaceOrTab(chSeek) && (sc.currentPos + p < endPos)); if (chSeek == '^') { sc.SetState(SCE_FS_DATE); } else { sc.SetState(SCE_FS_OPERATOR); } } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(bEnableCode ? SCE_FS_NUMBER : SCE_FS_NUMBER_C); } else if (IsAWordChar(sc.ch)) { sc.SetState(bEnableCode ? SCE_FS_IDENTIFIER : SCE_FS_IDENTIFIER_C); } else if (isoperator(static_cast(sc.ch)) || (bEnableCode && sc.ch == '@')) { sc.SetState(bEnableCode ? SCE_FS_OPERATOR : SCE_FS_OPERATOR_C); } } if (sc.atLineEnd) { visibleChars = 0; closeStringChar = 0; } if (!IsASpace(sc.ch)) { visibleChars++; } } sc.Complete(); } static void FoldFlagShipDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { Sci_Position endPos = startPos + length; // Backtrack to previous line in case need to fix its fold status Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0 && lineCurrent > 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); } int spaceFlags = 0; int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags); char chNext = styler[startPos]; for (Sci_Position i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos-1)) { int lev = indentCurrent; int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags); if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } else if (indentNext & SC_FOLDLEVELWHITEFLAG) { int spaceFlags2 = 0; int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2); if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { lev |= SC_FOLDLEVELHEADERFLAG; } } } indentCurrent = indentNext; styler.SetLevel(lineCurrent, lev); lineCurrent++; } } } static const char * const FSWordListDesc[] = { "Keywords Commands", "Std Library Functions", "Procedure, return, exit", "Class (oop)", "Doxygen keywords", 0 }; LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc); ================================================ FILE: lexilla/lexers/LexForth.cxx ================================================ // Scintilla source code edit control /** @file LexForth.cxx ** Lexer for FORTH **/ // Copyright 1998-2003 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsAWordStart(int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); } static inline bool IsANumChar(int ch) { return (ch < 0x80) && (isxdigit(ch) || ch == '.' || ch == 'e' || ch == 'E' ); } static inline bool IsASpaceChar(int ch) { return (ch < 0x80) && isspace(ch); } static void ColouriseForthDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordLists[], Accessor &styler) { WordList &control = *keywordLists[0]; WordList &keyword = *keywordLists[1]; WordList &defword = *keywordLists[2]; WordList &preword1 = *keywordLists[3]; WordList &preword2 = *keywordLists[4]; WordList &strings = *keywordLists[5]; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // Determine if the current state should terminate. if (sc.state == SCE_FORTH_COMMENT) { if (sc.atLineEnd) { sc.SetState(SCE_FORTH_DEFAULT); } }else if (sc.state == SCE_FORTH_COMMENT_ML) { if (sc.ch == ')') { sc.ForwardSetState(SCE_FORTH_DEFAULT); } }else if (sc.state == SCE_FORTH_IDENTIFIER || sc.state == SCE_FORTH_NUMBER) { // handle numbers here too, because what we thought was a number might // turn out to be a keyword e.g. 2DUP if (IsASpaceChar(sc.ch) ) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); int newState = sc.state == SCE_FORTH_NUMBER ? SCE_FORTH_NUMBER : SCE_FORTH_DEFAULT; if (control.InList(s)) { sc.ChangeState(SCE_FORTH_CONTROL); } else if (keyword.InList(s)) { sc.ChangeState(SCE_FORTH_KEYWORD); } else if (defword.InList(s)) { sc.ChangeState(SCE_FORTH_DEFWORD); } else if (preword1.InList(s)) { sc.ChangeState(SCE_FORTH_PREWORD1); } else if (preword2.InList(s)) { sc.ChangeState(SCE_FORTH_PREWORD2); } else if (strings.InList(s)) { sc.ChangeState(SCE_FORTH_STRING); newState = SCE_FORTH_STRING; } sc.SetState(newState); } if (sc.state == SCE_FORTH_NUMBER) { if (IsASpaceChar(sc.ch)) { sc.SetState(SCE_FORTH_DEFAULT); } else if (!IsANumChar(sc.ch)) { sc.ChangeState(SCE_FORTH_IDENTIFIER); } } }else if (sc.state == SCE_FORTH_STRING) { if (sc.ch == '\"') { sc.ForwardSetState(SCE_FORTH_DEFAULT); } }else if (sc.state == SCE_FORTH_LOCALE) { if (sc.ch == '}') { sc.ForwardSetState(SCE_FORTH_DEFAULT); } }else if (sc.state == SCE_FORTH_DEFWORD) { if (IsASpaceChar(sc.ch)) { sc.SetState(SCE_FORTH_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_FORTH_DEFAULT) { if (sc.ch == '\\'){ sc.SetState(SCE_FORTH_COMMENT); } else if (sc.ch == '(' && (sc.atLineStart || IsASpaceChar(sc.chPrev)) && (sc.atLineEnd || IsASpaceChar(sc.chNext))) { sc.SetState(SCE_FORTH_COMMENT_ML); } else if ( (sc.ch == '$' && (IsASCII(sc.chNext) && isxdigit(sc.chNext))) ) { // number starting with $ is a hex number sc.SetState(SCE_FORTH_NUMBER); while(sc.More() && IsASCII(sc.chNext) && isxdigit(sc.chNext)) sc.Forward(); } else if ( (sc.ch == '%' && (IsASCII(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))) ) { // number starting with % is binary sc.SetState(SCE_FORTH_NUMBER); while(sc.More() && IsASCII(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1')) sc.Forward(); } else if ( IsASCII(sc.ch) && (isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && IsASCII(sc.chNext) && isxdigit(sc.chNext)) ) ){ sc.SetState(SCE_FORTH_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_FORTH_IDENTIFIER); } else if (sc.ch == '{') { sc.SetState(SCE_FORTH_LOCALE); } else if (sc.ch == ':' && IsASCII(sc.chNext) && isspace(sc.chNext)) { // highlight word definitions e.g. : GCD ( n n -- n ) ..... ; // ^ ^^^ sc.SetState(SCE_FORTH_DEFWORD); while(sc.More() && IsASCII(sc.chNext) && isspace(sc.chNext)) sc.Forward(); } else if (sc.ch == ';' && (sc.atLineStart || IsASpaceChar(sc.chPrev)) && (sc.atLineEnd || IsASpaceChar(sc.chNext)) ) { // mark the ';' that ends a word sc.SetState(SCE_FORTH_DEFWORD); sc.ForwardSetState(SCE_FORTH_DEFAULT); } } } sc.Complete(); } static void FoldForthDoc(Sci_PositionU, Sci_Position, int, WordList *[], Accessor &) { } static const char * const forthWordLists[] = { "control keywords", "keywords", "definition words", "prewords with one argument", "prewords with two arguments", "string definition keywords", 0, }; LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth", FoldForthDoc, forthWordLists); ================================================ FILE: lexilla/lexers/LexFortran.cxx ================================================ // Scintilla source code edit control /** @file LexFortran.cxx ** Lexer for Fortran. ** Written by Chuan-jian Shen, Last changed Sep. 2003 **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. /***************************************/ #include #include #include #include #include #include #include #include /***************************************/ #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" /***************************************/ using namespace Lexilla; /***********************************************/ static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%'); } /**********************************************/ static inline bool IsAWordStart(const int ch) { return (ch < 0x80) && (isalnum(ch)); } /***************************************/ static inline bool IsABlank(unsigned int ch) { return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ; } /***************************************/ static inline bool IsALineEnd(char ch) { return ((ch == '\n') || (ch == '\r')) ; } /***************************************/ static Sci_PositionU GetContinuedPos(Sci_PositionU pos, Accessor &styler) { while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue; if (styler.SafeGetCharAt(pos) == '\n') pos++; while (IsABlank(styler.SafeGetCharAt(pos++))) continue; char chCur = styler.SafeGetCharAt(pos); if (chCur == '&') { while (IsABlank(styler.SafeGetCharAt(++pos))) continue; return pos; } else { return pos; } } /***************************************/ static void ColouriseFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler, bool isFixFormat) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; /***************************************/ Sci_Position posLineStart = 0; int numNonBlank = 0, prevState = 0; Sci_Position endPos = startPos + length; /***************************************/ // backtrack to the nearest keyword while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) { startPos--; } startPos = styler.LineStart(styler.GetLine(startPos)); initStyle = styler.StyleAt(startPos - 1); StyleContext sc(startPos, endPos-startPos, initStyle, styler); /***************************************/ for (; sc.More(); sc.Forward()) { // remember the start position of the line if (sc.atLineStart) { posLineStart = sc.currentPos; numNonBlank = 0; sc.SetState(SCE_F_DEFAULT); } if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; /***********************************************/ // Handle the fix format generically Sci_Position toLineStart = sc.currentPos - posLineStart; if (isFixFormat && (toLineStart < 6 || toLineStart >= 72)) { if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') { if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") || sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') { sc.SetState(SCE_F_PREPROCESSOR); } else { sc.SetState(SCE_F_COMMENT); } while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end } else if (toLineStart >= 72) { sc.SetState(SCE_F_COMMENT); while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end } else if (toLineStart < 5) { if (IsADigit(sc.ch)) sc.SetState(SCE_F_LABEL); else sc.SetState(SCE_F_DEFAULT); } else if (toLineStart == 5) { //if (!IsASpace(sc.ch) && sc.ch != '0') { if (sc.ch != '\r' && sc.ch != '\n') { sc.SetState(SCE_F_CONTINUATION); if (!IsASpace(sc.ch) && sc.ch != '0') sc.ForwardSetState(prevState); } else sc.SetState(SCE_F_DEFAULT); } continue; } /***************************************/ // Handle line continuation generically. if (!isFixFormat && sc.ch == '&' && sc.state != SCE_F_COMMENT) { char chTemp = ' '; Sci_Position j = 1; while (IsABlank(chTemp) && j<132) { chTemp = static_cast(sc.GetRelative(j)); j++; } if (chTemp == '!') { sc.SetState(SCE_F_CONTINUATION); if (sc.chNext == '!') sc.ForwardSetState(SCE_F_COMMENT); } else if (chTemp == '\r' || chTemp == '\n') { int currentState = sc.state; sc.SetState(SCE_F_CONTINUATION); sc.ForwardSetState(SCE_F_DEFAULT); while (IsASpace(sc.ch) && sc.More()) { sc.Forward(); if (sc.atLineStart) numNonBlank = 0; if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; } if (sc.ch == '&') { sc.SetState(SCE_F_CONTINUATION); sc.Forward(); } sc.SetState(currentState); } } /***************************************/ // Hanndle preprocessor directives if (sc.ch == '#' && numNonBlank == 1) { sc.SetState(SCE_F_PREPROCESSOR); while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end } /***************************************/ // Determine if the current state should terminate. if (sc.state == SCE_F_OPERATOR) { sc.SetState(SCE_F_DEFAULT); } else if (sc.state == SCE_F_NUMBER) { if (!(IsAWordChar(sc.ch) || sc.ch=='\'' || sc.ch=='\"' || sc.ch=='.')) { sc.SetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_IDENTIFIER) { if (!IsAWordChar(sc.ch) || (sc.ch == '%')) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_F_WORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_F_WORD2); } else if (keywords3.InList(s)) { sc.ChangeState(SCE_F_WORD3); } sc.SetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_COMMENT || sc.state == SCE_F_PREPROCESSOR) { if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_STRING1) { prevState = sc.state; if (sc.ch == '\'') { if (sc.chNext == '\'') { sc.Forward(); } else { sc.ForwardSetState(SCE_F_DEFAULT); prevState = SCE_F_DEFAULT; } } else if (sc.atLineEnd) { sc.ChangeState(SCE_F_STRINGEOL); sc.ForwardSetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_STRING2) { prevState = sc.state; if (sc.atLineEnd) { sc.ChangeState(SCE_F_STRINGEOL); sc.ForwardSetState(SCE_F_DEFAULT); } else if (sc.ch == '\"') { if (sc.chNext == '\"') { sc.Forward(); } else { sc.ForwardSetState(SCE_F_DEFAULT); prevState = SCE_F_DEFAULT; } } } else if (sc.state == SCE_F_OPERATOR2) { if (sc.ch == '.') { sc.ForwardSetState(SCE_F_DEFAULT); } } else if (sc.state == SCE_F_CONTINUATION) { sc.SetState(SCE_F_DEFAULT); } else if (sc.state == SCE_F_LABEL) { if (!IsADigit(sc.ch)) { sc.SetState(SCE_F_DEFAULT); } else { if (isFixFormat && sc.currentPos-posLineStart > 4) sc.SetState(SCE_F_DEFAULT); else if (numNonBlank > 5) sc.SetState(SCE_F_DEFAULT); } } /***************************************/ // Determine if a new state should be entered. if (sc.state == SCE_F_DEFAULT) { if (sc.ch == '!') { if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") || sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') { sc.SetState(SCE_F_PREPROCESSOR); } else { sc.SetState(SCE_F_COMMENT); } } else if ((!isFixFormat) && IsADigit(sc.ch) && numNonBlank == 1) { sc.SetState(SCE_F_LABEL); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_F_NUMBER); } else if ((tolower(sc.ch) == 'b' || tolower(sc.ch) == 'o' || tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) { sc.SetState(SCE_F_NUMBER); sc.Forward(); } else if (sc.ch == '.' && isalpha(sc.chNext)) { sc.SetState(SCE_F_OPERATOR2); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_F_IDENTIFIER); } else if (sc.ch == '\"') { sc.SetState(SCE_F_STRING2); } else if (sc.ch == '\'') { sc.SetState(SCE_F_STRING1); } else if (isoperator(static_cast(sc.ch))) { sc.SetState(SCE_F_OPERATOR); } } } sc.Complete(); } /***************************************/ static void CheckLevelCommentLine(const unsigned int nComL, Sci_Position nComColB[], Sci_Position nComColF[], Sci_Position &nComCur, bool comLineB[], bool comLineF[], bool &comLineCur, int &levelDeltaNext) { levelDeltaNext = 0; if (!comLineCur) { return; } if (!comLineF[0] || nComColF[0] != nComCur) { unsigned int i=0; for (; i= nLineTotal) { return; } for (int i=nComL-2; i>=0; i--) { nComColB[i+1] = nComColB[i]; comLineB[i+1] = comLineB[i]; } nComColB[0] = nComCur; comLineB[0] = comLineCur; nComCur = nComColF[0]; comLineCur = comLineF[0]; for (unsigned int i=0; i+1 0) { lineCurrent--; startPos = styler.LineStart(lineCurrent); isPrevLine = true; } else { isPrevLine = false; } char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; int levelDeltaNext = 0; const unsigned int nComL = 3; // defines how many comment lines should be before they are folded Sci_Position nComColB[nComL] = {}; Sci_Position nComColF[nComL] = {}; Sci_Position nComCur = 0; bool comLineB[nComL] = {}; bool comLineF[nComL] = {}; bool comLineCur; Sci_Position nLineTotal = styler.GetLine(styler.Length()-1) + 1; if (foldComment) { for (unsigned int i=0; i= nLineTotal) { comLineF[i] = false; break; } GetIfLineComment(styler, isFixFormat, chL, comLineF[i], nComColF[i]); } GetIfLineComment(styler, isFixFormat, lineCurrent, comLineCur, nComCur); CheckBackComLines(styler, isFixFormat, lineCurrent, nComL, nComColB, nComColF, nComCur, comLineB, comLineF, comLineCur); } int levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; /***************************************/ Sci_Position lastStart = 0; char prevWord[32] = ""; /***************************************/ for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); char chNextNonBlank = chNext; bool nextEOL = false; if (IsALineEnd(chNextNonBlank)) { nextEOL = true; } Sci_PositionU j=i+1; while(IsABlank(chNextNonBlank) && j(tolower(styler[lastStart+k])); } s[k] = '\0'; // Handle the forall and where statement and structure. if (strcmp(s, "forall") == 0 || (strcmp(s, "where") == 0 && strcmp(prevWord, "else") != 0)) { if (strcmp(prevWord, "end") != 0) { j = i + 1; char chBrace = '(', chSeek = ')', ch1 = styler.SafeGetCharAt(j); // Find the position of the first ( while (ch1 != chBrace && j 0) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) styler.SetLevel(lineCurrent, lev); lineCurrent++; levelCurrent += levelDeltaNext; levelDeltaNext = 0; visibleChars = 0; strcpy(prevWord, ""); isPrevLine = false; if (foldComment) { StepCommentLine(styler, isFixFormat, lineCurrent, nComL, nComColB, nComColF, nComCur, comLineB, comLineF, comLineCur); } } /***************************************/ if (!isspacechar(ch)) visibleChars++; } /***************************************/ } /***************************************/ static const char * const FortranWordLists[] = { "Primary keywords and identifiers", "Intrinsic functions", "Extended and user defined functions", 0, }; /***************************************/ static void ColouriseFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false); } /***************************************/ static void ColouriseFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true); } /***************************************/ static void FoldFortranDocFreeFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { FoldFortranDoc(startPos, length, initStyle,styler, false); } /***************************************/ static void FoldFortranDocFixFormat(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { FoldFortranDoc(startPos, length, initStyle,styler, true); } /***************************************/ LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDocFreeFormat, FortranWordLists); LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDocFixFormat, FortranWordLists); ================================================ FILE: lexilla/lexers/LexGAP.cxx ================================================ // Scintilla source code edit control /** @file LexGAP.cxx ** Lexer for the GAP language. (The GAP System for Computational Discrete Algebra) ** http://www.gap-system.org **/ // Copyright 2007 by Istvan Szollosi ( szteven gmail com ) // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsGAPOperator(char ch) { if (IsASCII(ch) && isalnum(ch)) return false; if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '^' || ch == ',' || ch == '!' || ch == '.' || ch == '=' || ch == '<' || ch == '>' || ch == '(' || ch == ')' || ch == ';' || ch == '[' || ch == ']' || ch == '{' || ch == '}' || ch == ':' ) return true; return false; } static void GetRange(Sci_PositionU start, Sci_PositionU end, Accessor &styler, char *s, Sci_PositionU len) { Sci_PositionU i = 0; while ((i < end - start + 1) && (i < len-1)) { s[i] = static_cast(styler[start + i]); i++; } s[i] = '\0'; } static void ColouriseGAPDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords1 = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; WordList &keywords4 = *keywordlists[3]; // Do not leak onto next line if (initStyle == SCE_GAP_STRINGEOL) initStyle = SCE_GAP_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { // Prevent SCE_GAP_STRINGEOL from leaking back to previous line if ( sc.atLineStart ) { if (sc.state == SCE_GAP_STRING) sc.SetState(SCE_GAP_STRING); if (sc.state == SCE_GAP_CHAR) sc.SetState(SCE_GAP_CHAR); } // Handle line continuation generically if (sc.ch == '\\' ) { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate switch (sc.state) { case SCE_GAP_OPERATOR : sc.SetState(SCE_GAP_DEFAULT); break; case SCE_GAP_NUMBER : if (!IsADigit(sc.ch)) { if (sc.ch == '\\') { if (!sc.atLineEnd) { if (!IsADigit(sc.chNext)) { sc.Forward(); sc.ChangeState(SCE_GAP_IDENTIFIER); } } } else if (isalpha(sc.ch) || sc.ch == '_') { sc.ChangeState(SCE_GAP_IDENTIFIER); } else sc.SetState(SCE_GAP_DEFAULT); } break; case SCE_GAP_IDENTIFIER : if (!(iswordstart(static_cast(sc.ch)) || sc.ch == '$')) { if (sc.ch == '\\') sc.Forward(); else { char s[1000]; sc.GetCurrent(s, sizeof(s)); if (keywords1.InList(s)) { sc.ChangeState(SCE_GAP_KEYWORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_GAP_KEYWORD2); } else if (keywords3.InList(s)) { sc.ChangeState(SCE_GAP_KEYWORD3); } else if (keywords4.InList(s)) { sc.ChangeState(SCE_GAP_KEYWORD4); } sc.SetState(SCE_GAP_DEFAULT); } } break; case SCE_GAP_COMMENT : if (sc.atLineEnd) { sc.SetState(SCE_GAP_DEFAULT); } break; case SCE_GAP_STRING: if (sc.atLineEnd) { sc.ChangeState(SCE_GAP_STRINGEOL); } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_GAP_DEFAULT); } break; case SCE_GAP_CHAR: if (sc.atLineEnd) { sc.ChangeState(SCE_GAP_STRINGEOL); } else if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { sc.ForwardSetState(SCE_GAP_DEFAULT); } break; case SCE_GAP_STRINGEOL: if (sc.atLineStart) { sc.SetState(SCE_GAP_DEFAULT); } break; } // Determine if a new state should be entered if (sc.state == SCE_GAP_DEFAULT) { if (IsGAPOperator(static_cast(sc.ch))) { sc.SetState(SCE_GAP_OPERATOR); } else if (IsADigit(sc.ch)) { sc.SetState(SCE_GAP_NUMBER); } else if (isalpha(sc.ch) || sc.ch == '_' || sc.ch == '\\' || sc.ch == '$' || sc.ch == '~') { sc.SetState(SCE_GAP_IDENTIFIER); if (sc.ch == '\\') sc.Forward(); } else if (sc.ch == '#') { sc.SetState(SCE_GAP_COMMENT); } else if (sc.ch == '\"') { sc.SetState(SCE_GAP_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_GAP_CHAR); } } } sc.Complete(); } static int ClassifyFoldPointGAP(const char* s) { int level = 0; if (strcmp(s, "function") == 0 || strcmp(s, "do") == 0 || strcmp(s, "if") == 0 || strcmp(s, "repeat") == 0 ) { level = 1; } else if (strcmp(s, "end") == 0 || strcmp(s, "od") == 0 || strcmp(s, "fi") == 0 || strcmp(s, "until") == 0 ) { level = -1; } return level; } static void FoldGAPDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList** , Accessor &styler) { Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int style = initStyle; Sci_Position lastStart = 0; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int stylePrev = style; style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (stylePrev != SCE_GAP_KEYWORD && style == SCE_GAP_KEYWORD) { // Store last word start point. lastStart = i; } if (stylePrev == SCE_GAP_KEYWORD) { if(iswordchar(ch) && !iswordchar(chNext)) { char s[100]; GetRange(lastStart, i, styler, s, sizeof(s)); levelCurrent += ClassifyFoldPointGAP(s); } } if (atEOL) { int lev = levelPrev; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const GAPWordListDesc[] = { "Keywords 1", "Keywords 2", "Keywords 3 (unused)", "Keywords 4 (unused)", 0 }; LexerModule lmGAP( SCLEX_GAP, ColouriseGAPDoc, "gap", FoldGAPDoc, GAPWordListDesc); ================================================ FILE: lexilla/lexers/LexGDScript.cxx ================================================ // Scintilla source code edit control /** @file LexGDScript.cxx ** Lexer for GDScript. **/ // Copyright 1998-2002 by Neil Hodgson // Heavily modified later for GDScript // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "StringCopy.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "CharacterCategory.h" #include "LexerModule.h" #include "OptionSet.h" #include "SubStyles.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; namespace { enum kwType { kwOther, kwClass, kwDef, kwExtends}; constexpr int indicatorWhitespace = 1; bool IsGDStringStart(int ch) { return (ch == '\'' || ch == '"'); } bool IsGDComment(Accessor &styler, Sci_Position pos, Sci_Position len) { return len > 0 && styler[pos] == '#'; } constexpr bool IsGDSingleQuoteStringState(int st) noexcept { return ((st == SCE_GD_CHARACTER) || (st == SCE_GD_STRING)); } constexpr bool IsGDTripleQuoteStringState(int st) noexcept { return ((st == SCE_GD_TRIPLE) || (st == SCE_GD_TRIPLEDOUBLE)); } char GetGDStringQuoteChar(int st) noexcept { if ((st == SCE_GD_CHARACTER) || (st == SCE_GD_TRIPLE)) return '\''; if ((st == SCE_GD_STRING) || (st == SCE_GD_TRIPLEDOUBLE)) return '"'; return '\0'; } /* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */ int GetGDStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex) { char ch = styler.SafeGetCharAt(i); char chNext = styler.SafeGetCharAt(i + 1); if (ch != '"' && ch != '\'') { *nextIndex = i + 1; return SCE_GD_DEFAULT; } if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) { *nextIndex = i + 3; if (ch == '"') return SCE_GD_TRIPLEDOUBLE; else return SCE_GD_TRIPLE; } else { *nextIndex = i + 1; if (ch == '"') return SCE_GD_STRING; else return SCE_GD_CHARACTER; } } int GetGDStringState(int ch) { if (ch != '"' && ch != '\'') return SCE_GD_DEFAULT; if (ch == '"') return SCE_GD_STRING; else return SCE_GD_CHARACTER; } inline bool IsAWordChar(int ch, bool unicodeIdentifiers) { if (IsASCII(ch)) return (IsAlphaNumeric(ch) || ch == '.' || ch == '_'); if (!unicodeIdentifiers) return false; return IsXidContinue(ch); } inline bool IsANodePathChar(int ch, bool unicodeIdentifiers) { if (IsASCII(ch)) return (IsAlphaNumeric(ch) || ch == '_' || ch == '/' || ch =='%'); if (!unicodeIdentifiers) return false; return IsXidContinue(ch); } inline bool IsAWordStart(int ch, bool unicodeIdentifiers) { if (IsASCII(ch)) return (IsUpperOrLowerCase(ch) || ch == '_'); if (!unicodeIdentifiers) return false; return IsXidStart(ch); } bool IsFirstNonWhitespace(Sci_Position pos, Accessor &styler) { const Sci_Position line = styler.GetLine(pos); const Sci_Position start_pos = styler.LineStart(line); for (Sci_Position i = start_pos; i < pos; i++) { const char ch = styler[i]; if (!(ch == ' ' || ch == '\t')) return false; } return true; } // Options used for LexerGDScript struct OptionsGDScript { int whingeLevel; bool base2or8Literals; bool stringsOverNewline; bool keywords2NoSubIdentifiers; bool fold; bool foldQuotes; bool foldCompact; bool unicodeIdentifiers; OptionsGDScript() noexcept { whingeLevel = 0; base2or8Literals = true; stringsOverNewline = false; keywords2NoSubIdentifiers = false; fold = false; foldQuotes = false; foldCompact = false; unicodeIdentifiers = true; } }; const char *const gdscriptWordListDesc[] = { "Keywords", "Highlighted identifiers", nullptr }; struct OptionSetGDScript : public OptionSet { OptionSetGDScript() { DefineProperty("lexer.gdscript.whinge.level", &OptionsGDScript::whingeLevel, "For GDScript code, checks whether indenting is consistent. " "The default, 0 turns off indentation checking, " "1 checks whether each line is potentially inconsistent with the previous line, " "2 checks whether any space characters occur before a tab character in the indentation, " "3 checks whether any spaces are in the indentation, and " "4 checks for any tab characters in the indentation. " "1 is a good level to use."); DefineProperty("lexer.gdscript.literals.binary", &OptionsGDScript::base2or8Literals, "Set to 0 to not recognise binary and octal literals: 0b1011 0o712."); DefineProperty("lexer.gdscript.strings.over.newline", &OptionsGDScript::stringsOverNewline, "Set to 1 to allow strings to span newline characters."); DefineProperty("lexer.gdscript.keywords2.no.sub.identifiers", &OptionsGDScript::keywords2NoSubIdentifiers, "When enabled, it will not style keywords2 items that are used as a sub-identifier. " "Example: when set, will not highlight \"foo.open\" when \"open\" is a keywords2 item."); DefineProperty("fold", &OptionsGDScript::fold); DefineProperty("fold.gdscript.quotes", &OptionsGDScript::foldQuotes, "This option enables folding multi-line quoted strings when using the GDScript lexer."); DefineProperty("fold.compact", &OptionsGDScript::foldCompact); DefineProperty("lexer.gdscript.unicode.identifiers", &OptionsGDScript::unicodeIdentifiers, "Set to 0 to not recognise Unicode identifiers."); DefineWordListSets(gdscriptWordListDesc); } }; const char styleSubable[] = { SCE_GD_IDENTIFIER, 0 }; LexicalClass lexicalClasses[] = { // Lexer GDScript SCLEX_GDSCRIPT SCE_GD_: 0, "SCE_GD_DEFAULT", "default", "White space", 1, "SCE_GD_COMMENTLINE", "comment line", "Comment", 2, "SCE_GD_NUMBER", "literal numeric", "Number", 3, "SCE_GD_STRING", "literal string", "String", 4, "SCE_GD_CHARACTER", "literal string", "Single quoted string", 5, "SCE_GD_WORD", "keyword", "Keyword", 6, "SCE_GD_TRIPLE", "literal string", "Triple quotes", 7, "SCE_GD_TRIPLEDOUBLE", "literal string", "Triple double quotes", 8, "SCE_GD_CLASSNAME", "identifier", "Class name definition", 9, "SCE_GD_FUNCNAME", "identifier", "Function or method name definition", 10, "SCE_GD_OPERATOR", "operator", "Operators", 11, "SCE_GD_IDENTIFIER", "identifier", "Identifiers", 12, "SCE_GD_COMMENTBLOCK", "comment", "Comment-blocks", 13, "SCE_GD_STRINGEOL", "error literal string", "End of line where string is not closed", 14, "SCE_GD_WORD2", "identifier", "Highlighted identifiers", 15, "SCE_GD_ANNOTATION", "annotation", "Annotations", 16, "SCE_GD_NODEPATH", "path", "Node path", }; } class LexerGDScript : public DefaultLexer { WordList keywords; WordList keywords2; OptionsGDScript options; OptionSetGDScript osGDScript; enum { ssIdentifier }; SubStyles subStyles{styleSubable}; public: explicit LexerGDScript() : DefaultLexer("gdscript", SCLEX_GDSCRIPT, lexicalClasses, ELEMENTS(lexicalClasses)) { } ~LexerGDScript() override { } void SCI_METHOD Release() override { delete this; } int SCI_METHOD Version() const override { return lvRelease5; } const char *SCI_METHOD PropertyNames() override { return osGDScript.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osGDScript.PropertyType(name); } const char *SCI_METHOD DescribeProperty(const char *name) override { return osGDScript.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char *key) override { return osGDScript.PropertyGet(key); } const char *SCI_METHOD DescribeWordListSets() override { return osGDScript.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void *SCI_METHOD PrivateCall(int, void *) override { return nullptr; } int SCI_METHOD LineEndTypesSupported() override { return SC_LINE_END_TYPE_UNICODE; } int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override { return subStyles.Allocate(styleBase, numberStyles); } int SCI_METHOD SubStylesStart(int styleBase) override { return subStyles.Start(styleBase); } int SCI_METHOD SubStylesLength(int styleBase) override { return subStyles.Length(styleBase); } int SCI_METHOD StyleFromSubStyle(int subStyle) override { const int styleBase = subStyles.BaseStyle(subStyle); return styleBase; } int SCI_METHOD PrimaryStyleFromStyle(int style) override { return style; } void SCI_METHOD FreeSubStyles() override { subStyles.Free(); } void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override { subStyles.SetIdentifiers(style, identifiers); } int SCI_METHOD DistanceToSecondaryStyles() override { return 0; } const char *SCI_METHOD GetSubStyleBases() override { return styleSubable; } static ILexer5 *LexerFactoryGDScript() { return new LexerGDScript(); } private: void ProcessLineEnd(StyleContext &sc, bool &inContinuedString); }; Sci_Position SCI_METHOD LexerGDScript::PropertySet(const char *key, const char *val) { if (osGDScript.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerGDScript::WordListSet(int n, const char *wl) { WordList *wordListN = nullptr; switch (n) { case 0: wordListN = &keywords; break; case 1: wordListN = &keywords2; break; default: break; } Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); if (*wordListN != wlNew) { wordListN->Set(wl); firstModification = 0; } } return firstModification; } void LexerGDScript::ProcessLineEnd(StyleContext &sc, bool &inContinuedString) { if ((sc.state == SCE_GD_DEFAULT) || IsGDTripleQuoteStringState(sc.state)) { // Perform colourisation of white space and triple quoted strings at end of each line to allow // tab marking to work inside white space and triple quoted strings sc.SetState(sc.state); } if (IsGDSingleQuoteStringState(sc.state)) { if (inContinuedString || options.stringsOverNewline) { inContinuedString = false; } else { sc.ChangeState(SCE_GD_STRINGEOL); sc.ForwardSetState(SCE_GD_DEFAULT); } } } void SCI_METHOD LexerGDScript::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { Accessor styler(pAccess, nullptr); const Sci_Position endPos = startPos + length; // Backtrack to previous line in case need to fix its tab whinging Sci_Position lineCurrent = styler.GetLine(startPos); if (startPos > 0) { if (lineCurrent > 0) { lineCurrent--; // Look for backslash-continued lines while (lineCurrent > 0) { const Sci_Position eolPos = styler.LineStart(lineCurrent) - 1; const int eolStyle = styler.StyleAt(eolPos); if (eolStyle == SCE_GD_STRING || eolStyle == SCE_GD_CHARACTER || eolStyle == SCE_GD_STRINGEOL) { lineCurrent -= 1; } else { break; } } startPos = styler.LineStart(lineCurrent); } initStyle = startPos == 0 ? SCE_GD_DEFAULT : styler.StyleAt(startPos - 1); } initStyle = initStyle & 31; if (initStyle == SCE_GD_STRINGEOL) { initStyle = SCE_GD_DEFAULT; } kwType kwLast = kwOther; int spaceFlags = 0; styler.IndentAmount(lineCurrent, &spaceFlags, IsGDComment); bool base_n_number = false; const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_GD_IDENTIFIER); StyleContext sc(startPos, endPos - startPos, initStyle, styler); bool indentGood = true; Sci_Position startIndicator = sc.currentPos; bool inContinuedString = false; bool percentIsNodePath = false; int nodePathStringState = SCE_GD_DEFAULT; for (; sc.More(); sc.Forward()) { if (sc.atLineStart) { styler.IndentAmount(lineCurrent, &spaceFlags, IsGDComment); indentGood = true; if (options.whingeLevel == 1) { indentGood = (spaceFlags & wsInconsistent) == 0; } else if (options.whingeLevel == 2) { indentGood = (spaceFlags & wsSpaceTab) == 0; } else if (options.whingeLevel == 3) { indentGood = (spaceFlags & wsSpace) == 0; } else if (options.whingeLevel == 4) { indentGood = (spaceFlags & wsTab) == 0; } if (!indentGood) { styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0); startIndicator = sc.currentPos; } } if (sc.atLineEnd) { percentIsNodePath = false; ProcessLineEnd(sc, inContinuedString); lineCurrent++; if (!sc.More()) break; } bool needEOLCheck = false; if (sc.state == SCE_GD_OPERATOR) { kwLast = kwOther; sc.SetState(SCE_GD_DEFAULT); } else if (sc.state == SCE_GD_NUMBER) { if (!IsAWordChar(sc.ch, false) && !(!base_n_number && ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { sc.SetState(SCE_GD_DEFAULT); } } else if (sc.state == SCE_GD_IDENTIFIER) { if ((sc.ch == '.') || (!IsAWordChar(sc.ch, options.unicodeIdentifiers))) { char s[100]; sc.GetCurrent(s, sizeof(s)); int style = SCE_GD_IDENTIFIER; if (keywords.InList(s)) { style = SCE_GD_WORD; } else if (kwLast == kwClass) { style = SCE_GD_CLASSNAME; } else if (kwLast == kwDef) { style = SCE_GD_FUNCNAME; } else if (keywords2.InList(s)) { if (options.keywords2NoSubIdentifiers) { // We don't want to highlight keywords2 // that are used as a sub-identifier, // i.e. not open in "foo.open". const Sci_Position pos = styler.GetStartSegment() - 1; if (pos < 0 || (styler.SafeGetCharAt(pos, '\0') != '.')) style = SCE_GD_WORD2; } else { style = SCE_GD_WORD2; } } else { const int subStyle = classifierIdentifiers.ValueFor(s); if (subStyle >= 0) { style = subStyle; } } sc.ChangeState(style); sc.SetState(SCE_GD_DEFAULT); if (style == SCE_GD_WORD) { if (0 == strcmp(s, "class")) kwLast = kwClass; else if (0 == strcmp(s, "func")) kwLast = kwDef; else if (0 == strcmp(s, "extends")) kwLast = kwExtends; else kwLast = kwOther; } else { kwLast = kwOther; } } } else if ((sc.state == SCE_GD_COMMENTLINE) || (sc.state == SCE_GD_COMMENTBLOCK)) { if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_GD_DEFAULT); } } else if (sc.state == SCE_GD_ANNOTATION) { if (!IsAWordStart(sc.ch, options.unicodeIdentifiers)) { sc.SetState(SCE_GD_DEFAULT); } } else if (sc.state == SCE_GD_NODEPATH) { if (nodePathStringState != SCE_GD_DEFAULT) { if (sc.ch == GetGDStringQuoteChar(nodePathStringState) ) { nodePathStringState = SCE_GD_DEFAULT; } } else { if (IsGDStringStart(sc.ch)) { nodePathStringState = GetGDStringState(sc.ch); } else if (!IsANodePathChar(sc.ch, options.unicodeIdentifiers)) { sc.SetState(SCE_GD_DEFAULT); } } } else if (IsGDSingleQuoteStringState(sc.state)) { if (sc.ch == '\\') { if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) { sc.Forward(); } if (sc.chNext == '\n' || sc.chNext == '\r') { inContinuedString = true; } else { // Don't roll over the newline. sc.Forward(); } } else if (sc.ch == GetGDStringQuoteChar(sc.state)) { sc.ForwardSetState(SCE_GD_DEFAULT); needEOLCheck = true; } } else if (sc.state == SCE_GD_TRIPLE) { if (sc.ch == '\\') { sc.Forward(); } else if (sc.Match(R"(''')")) { sc.Forward(); sc.Forward(); sc.ForwardSetState(SCE_GD_DEFAULT); needEOLCheck = true; } } else if (sc.state == SCE_GD_TRIPLEDOUBLE) { if (sc.ch == '\\') { sc.Forward(); } else if (sc.Match(R"(""")")) { sc.Forward(); sc.Forward(); sc.ForwardSetState(SCE_GD_DEFAULT); needEOLCheck = true; } } if (!indentGood && !IsASpaceOrTab(sc.ch)) { styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 1); startIndicator = sc.currentPos; indentGood = true; } // State exit code may have moved on to end of line if (needEOLCheck && sc.atLineEnd) { ProcessLineEnd(sc, inContinuedString); lineCurrent++; styler.IndentAmount(lineCurrent, &spaceFlags, IsGDComment); if (!sc.More()) break; } // Check for a new state starting character if (sc.state == SCE_GD_DEFAULT) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) { base_n_number = true; sc.SetState(SCE_GD_NUMBER); } else if (sc.ch == '0' && (sc.chNext == 'o' || sc.chNext == 'O' || sc.chNext == 'b' || sc.chNext == 'B')) { if (options.base2or8Literals) { base_n_number = true; sc.SetState(SCE_GD_NUMBER); } else { sc.SetState(SCE_GD_NUMBER); sc.ForwardSetState(SCE_GD_IDENTIFIER); } } else { base_n_number = false; sc.SetState(SCE_GD_NUMBER); } } else if ((sc.ch == '$') || (sc.ch == '%' && (percentIsNodePath || IsFirstNonWhitespace(sc.currentPos, styler)))) { percentIsNodePath = false; sc.SetState(SCE_GD_NODEPATH); } else if (isoperator(sc.ch) || sc.ch == '`') { percentIsNodePath = !((sc.ch == ')') || (sc.ch == ']') || (sc.ch == '}')); sc.SetState(SCE_GD_OPERATOR); } else if (sc.ch == '#') { sc.SetState(sc.chNext == '#' ? SCE_GD_COMMENTBLOCK : SCE_GD_COMMENTLINE); } else if (sc.ch == '@') { if (IsFirstNonWhitespace(sc.currentPos, styler)) sc.SetState(SCE_GD_ANNOTATION); else sc.SetState(SCE_GD_OPERATOR); } else if (IsGDStringStart(sc.ch)) { Sci_PositionU nextIndex = 0; sc.SetState(GetGDStringState(styler, sc.currentPos, &nextIndex)); while (nextIndex > (sc.currentPos + 1) && sc.More()) { sc.Forward(); } } else if (IsAWordStart(sc.ch, options.unicodeIdentifiers)) { sc.SetState(SCE_GD_IDENTIFIER); } } } styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 0); sc.Complete(); } static bool IsCommentLine(Sci_Position line, Accessor &styler) { const Sci_Position pos = styler.LineStart(line); const Sci_Position eol_pos = styler.LineStart(line + 1) - 1; for (Sci_Position i = pos; i < eol_pos; i++) { const char ch = styler[i]; if (ch == '#') return true; else if (ch != ' ' && ch != '\t') return false; } return false; } static bool IsQuoteLine(Sci_Position line, const Accessor &styler) { const int style = styler.StyleAt(styler.LineStart(line)) & 31; return IsGDTripleQuoteStringState(style); } void SCI_METHOD LexerGDScript::Fold(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, IDocument *pAccess) { if (!options.fold) return; Accessor styler(pAccess, nullptr); const Sci_Position maxPos = startPos + length; const Sci_Position maxLines = (maxPos == styler.Length()) ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line // Backtrack to previous non-blank line so we can determine indent level // for any white space lines (needed esp. within triple quoted strings) // and so we can fix any preceding fold level (which is why we go back // at least one line in all cases) int spaceFlags = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, nullptr); while (lineCurrent > 0) { lineCurrent--; indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, nullptr); if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG) && (!IsCommentLine(lineCurrent, styler)) && (!IsQuoteLine(lineCurrent, styler))) break; } int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; // Set up initial loop state startPos = styler.LineStart(lineCurrent); int prev_state = SCE_GD_DEFAULT & 31; if (lineCurrent >= 1) prev_state = styler.StyleAt(startPos - 1) & 31; int prevQuote = options.foldQuotes && IsGDTripleQuoteStringState(prev_state); // Process all characters to end of requested range or end of any triple quote //that hangs over the end of the range. Cap processing in all cases // to end of document (in case of unclosed quote at end). while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || prevQuote)) { // Gather info int lev = indentCurrent; Sci_Position lineNext = lineCurrent + 1; int indentNext = indentCurrent; int quote = false; if (lineNext <= docLines) { // Information about next line is only available if not at end of document indentNext = styler.IndentAmount(lineNext, &spaceFlags, nullptr); const Sci_Position lookAtPos = (styler.LineStart(lineNext) == styler.Length()) ? styler.Length() - 1 : styler.LineStart(lineNext); const int style = styler.StyleAt(lookAtPos) & 31; quote = options.foldQuotes && IsGDTripleQuoteStringState(style); } const bool quote_start = (quote && !prevQuote); const bool quote_continue = (quote && prevQuote); if (!quote || !prevQuote) indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; if (quote) indentNext = indentCurrentLevel; if (indentNext & SC_FOLDLEVELWHITEFLAG) indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel; if (quote_start) { // Place fold point at start of triple quoted string lev |= SC_FOLDLEVELHEADERFLAG; } else if (quote_continue || prevQuote) { // Add level to rest of lines in the string lev = lev + 1; } // Skip past any blank lines for next indent level info; we skip also // comments (all comments, not just those starting in column 0) // which effectively folds them into surrounding code rather // than screwing up folding. If comments end file, use the min // comment indent as the level after int minCommentLevel = indentCurrentLevel; while (!quote && (lineNext < docLines) && ((indentNext & SC_FOLDLEVELWHITEFLAG) || (IsCommentLine(lineNext, styler)))) { if (IsCommentLine(lineNext, styler) && indentNext < minCommentLevel) { minCommentLevel = indentNext; } lineNext++; indentNext = styler.IndentAmount(lineNext, &spaceFlags, nullptr); } const int levelAfterComments = ((lineNext < docLines) ? indentNext & SC_FOLDLEVELNUMBERMASK : minCommentLevel); const int levelBeforeComments = std::max(indentCurrentLevel, levelAfterComments); // Now set all the indent levels on the lines we skipped // Do this from end to start. Once we encounter one line // which is indented more than the line after the end of // the comment-block, use the level of the block before Sci_Position skipLine = lineNext; int skipLevel = levelAfterComments; while (--skipLine > lineCurrent) { const int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, nullptr); if (options.foldCompact) { if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) skipLevel = levelBeforeComments; const int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; styler.SetLevel(skipLine, skipLevel | whiteFlag); } else { if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments && !(skipLineIndent & SC_FOLDLEVELWHITEFLAG) && !IsCommentLine(skipLine, styler)) skipLevel = levelBeforeComments; styler.SetLevel(skipLine, skipLevel); } } // Set fold header on non-quote line if (!quote && !(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) lev |= SC_FOLDLEVELHEADERFLAG; } // Keep track of triple quote state of previous line prevQuote = quote; // Set fold level for this line and move to next line styler.SetLevel(lineCurrent, options.foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG); indentCurrent = indentNext; lineCurrent = lineNext; } // NOTE: Cannot set level of last line here because indentCurrent doesn't have // header flag set; the loop above is crafted to take care of this case! //styler.SetLevel(lineCurrent, indentCurrent); } LexerModule lmGDScript(SCLEX_GDSCRIPT, LexerGDScript::LexerFactoryGDScript, "gdscript", gdscriptWordListDesc); ================================================ FILE: lexilla/lexers/LexGui4Cli.cxx ================================================ // Scintilla source code edit control // Copyright 1998-2002 by Neil Hodgson // @file LexGui4Cli.cxx /* This is the Lexer for Gui4Cli, included in SciLexer.dll - by d. Keletsekis, 2/10/2003 To add to SciLexer.dll: 1. Add the values below to INCLUDE\Scintilla.iface 2. Run the scripts/HFacer.py script 3. Run the scripts/LexGen.py script val SCE_GC_DEFAULT=0 val SCE_GC_COMMENTLINE=1 val SCE_GC_COMMENTBLOCK=2 val SCE_GC_GLOBAL=3 val SCE_GC_EVENT=4 val SCE_GC_ATTRIBUTE=5 val SCE_GC_CONTROL=6 val SCE_GC_COMMAND=7 val SCE_GC_STRING=8 val SCE_GC_OPERATOR=9 */ #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; #define debug Platform::DebugPrintf static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch =='\\'); } inline bool isGCOperator(int ch) { if (isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || ch == '(' || ch == ')' || ch == '=' || ch == '%' || ch == '[' || ch == ']' || ch == '<' || ch == '>' || ch == ',' || ch == ';' || ch == ':') return true; return false; } #define isSpace(x) ((x)==' ' || (x)=='\t') #define isNL(x) ((x)=='\n' || (x)=='\r') #define isSpaceOrNL(x) (isSpace(x) || isNL(x)) #define BUFFSIZE 500 #define isFoldPoint(x) ((styler.LevelAt(x) & SC_FOLDLEVELNUMBERMASK) == 1024) static void colorFirstWord(WordList *keywordlists[], Accessor &styler, StyleContext *sc, char *buff, Sci_Position length, Sci_Position) { Sci_Position c = 0; while (sc->More() && isSpaceOrNL(sc->ch)) { sc->Forward(); } styler.ColourTo(sc->currentPos - 1, sc->state); if (!IsAWordChar(sc->ch)) // comment, marker, etc.. return; while (sc->More() && !isSpaceOrNL(sc->ch) && (c < length-1) && !isGCOperator(sc->ch)) { buff[c] = static_cast(sc->ch); ++c; sc->Forward(); } buff[c] = '\0'; char *p = buff; while (*p) // capitalize.. { if (islower(*p)) *p = static_cast(toupper(*p)); ++p; } WordList &kGlobal = *keywordlists[0]; // keyword lists set by the user WordList &kEvent = *keywordlists[1]; WordList &kAttribute = *keywordlists[2]; WordList &kControl = *keywordlists[3]; WordList &kCommand = *keywordlists[4]; int state = 0; // int level = styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK; // debug ("line = %d, level = %d", line, level); if (kGlobal.InList(buff)) state = SCE_GC_GLOBAL; else if (kAttribute.InList(buff)) state = SCE_GC_ATTRIBUTE; else if (kControl.InList(buff)) state = SCE_GC_CONTROL; else if (kCommand.InList(buff)) state = SCE_GC_COMMAND; else if (kEvent.InList(buff)) state = SCE_GC_EVENT; if (state) { sc->ChangeState(state); styler.ColourTo(sc->currentPos - 1, sc->state); sc->ChangeState(SCE_GC_DEFAULT); } else { sc->ChangeState(SCE_GC_DEFAULT); styler.ColourTo(sc->currentPos - 1, sc->state); } } // Main colorizing function called by Scintilla static void ColouriseGui4CliDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { styler.StartAt(startPos); Sci_Position currentline = styler.GetLine(startPos); int quotestart = 0, oldstate; styler.StartSegment(startPos); bool noforward; char buff[BUFFSIZE+1]; // buffer for command name StyleContext sc(startPos, length, initStyle, styler); buff[0] = '\0'; // cbuff = 0; if (sc.state != SCE_GC_COMMENTBLOCK) // colorize 1st word.. colorFirstWord(keywordlists, styler, &sc, buff, BUFFSIZE, currentline); while (sc.More()) { noforward = 0; switch (sc.ch) { case '/': if (sc.state == SCE_GC_COMMENTBLOCK || sc.state == SCE_GC_STRING) break; if (sc.chNext == '/') // line comment { sc.SetState (SCE_GC_COMMENTLINE); sc.Forward(); styler.ColourTo(sc.currentPos, sc.state); } else if (sc.chNext == '*') // block comment { sc.SetState(SCE_GC_COMMENTBLOCK); sc.Forward(); styler.ColourTo(sc.currentPos, sc.state); } else styler.ColourTo(sc.currentPos, sc.state); break; case '*': // end of comment block, or operator.. if (sc.state == SCE_GC_STRING) break; if (sc.state == SCE_GC_COMMENTBLOCK && sc.chNext == '/') { sc.Forward(); styler.ColourTo(sc.currentPos, sc.state); sc.ChangeState (SCE_GC_DEFAULT); } else styler.ColourTo(sc.currentPos, sc.state); break; case '\'': case '\"': // strings.. if (sc.state == SCE_GC_COMMENTBLOCK || sc.state == SCE_GC_COMMENTLINE) break; if (sc.state == SCE_GC_STRING) { if (sc.ch == quotestart) // match same quote char.. { styler.ColourTo(sc.currentPos, sc.state); sc.ChangeState(SCE_GC_DEFAULT); quotestart = 0; } } else { styler.ColourTo(sc.currentPos - 1, sc.state); sc.ChangeState(SCE_GC_STRING); quotestart = sc.ch; } break; case ';': // end of commandline character if (sc.state != SCE_GC_COMMENTBLOCK && sc.state != SCE_GC_COMMENTLINE && sc.state != SCE_GC_STRING) { styler.ColourTo(sc.currentPos - 1, sc.state); styler.ColourTo(sc.currentPos, SCE_GC_OPERATOR); sc.ChangeState(SCE_GC_DEFAULT); sc.Forward(); colorFirstWord(keywordlists, styler, &sc, buff, BUFFSIZE, currentline); noforward = 1; // don't move forward - already positioned at next char.. } break; case '+': case '-': case '=': case '!': // operators.. case '<': case '>': case '&': case '|': case '$': if (sc.state != SCE_GC_COMMENTBLOCK && sc.state != SCE_GC_COMMENTLINE && sc.state != SCE_GC_STRING) { styler.ColourTo(sc.currentPos - 1, sc.state); styler.ColourTo(sc.currentPos, SCE_GC_OPERATOR); sc.ChangeState(SCE_GC_DEFAULT); } break; case '\\': // escape - same as operator, but also mark in strings.. if (sc.state != SCE_GC_COMMENTBLOCK && sc.state != SCE_GC_COMMENTLINE) { oldstate = sc.state; styler.ColourTo(sc.currentPos - 1, sc.state); sc.Forward(); // mark also the next char.. styler.ColourTo(sc.currentPos, SCE_GC_OPERATOR); sc.ChangeState(oldstate); } break; case '\n': case '\r': ++currentline; if (sc.state == SCE_GC_COMMENTLINE) { styler.ColourTo(sc.currentPos, sc.state); sc.ChangeState (SCE_GC_DEFAULT); } else if (sc.state != SCE_GC_COMMENTBLOCK) { colorFirstWord(keywordlists, styler, &sc, buff, BUFFSIZE, currentline); noforward = 1; // don't move forward - already positioned at next char.. } break; // case ' ': case '\t': // default : } if (!noforward) sc.Forward(); } sc.Complete(); } // Main folding function called by Scintilla - (based on props (.ini) files function) static void FoldGui4Cli(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); bool headerPoint = false; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler[i+1]; int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_GC_EVENT || style == SCE_GC_GLOBAL) { headerPoint = true; // fold at events and globals } if (atEOL) { int lev = SC_FOLDLEVELBASE+1; if (headerPoint) lev = SC_FOLDLEVELBASE; if (visibleChars == 0 && foldCompact) lev |= SC_FOLDLEVELWHITEFLAG; if (headerPoint) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) // set level, if not already correct { styler.SetLevel(lineCurrent, lev); } lineCurrent++; // re-initialize our flags visibleChars = 0; headerPoint = false; } if (!(isspacechar(ch))) // || (style == SCE_GC_COMMENTLINE) || (style != SCE_GC_COMMENTBLOCK))) visibleChars++; } int lev = headerPoint ? SC_FOLDLEVELBASE : SC_FOLDLEVELBASE+1; int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, lev | flagsNext); } // I have no idea what these are for.. probably accessible by some message. static const char * const gui4cliWordListDesc[] = { "Globals", "Events", "Attributes", "Control", "Commands", 0 }; // Declare language & pass our function pointers to Scintilla LexerModule lmGui4Cli(SCLEX_GUI4CLI, ColouriseGui4CliDoc, "gui4cli", FoldGui4Cli, gui4cliWordListDesc); #undef debug ================================================ FILE: lexilla/lexers/LexHTML.cxx ================================================ // Scintilla source code edit control /** @file LexHTML.cxx ** Lexer for HTML. **/ // Copyright 1998-2005 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "InList.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "SubStyles.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; namespace { #define SCE_HA_JS (SCE_HJA_START - SCE_HJ_START) #define SCE_HA_VBS (SCE_HBA_START - SCE_HB_START) #define SCE_HA_PYTHON (SCE_HPA_START - SCE_HP_START) enum script_type { eScriptNone = 0, eScriptJS, eScriptVBS, eScriptPython, eScriptPHP, eScriptXML, eScriptSGML, eScriptSGMLblock, eScriptComment }; enum script_mode { eHtml = 0, eNonHtmlScript, eNonHtmlPreProc, eNonHtmlScriptPreProc }; constexpr bool IsAWordChar(int ch) noexcept { return IsAlphaNumeric(ch) || ch == '.' || ch == '_'; } constexpr bool IsAWordStart(int ch) noexcept { return IsAlphaNumeric(ch) || ch == '_'; } bool IsOperator(int ch) noexcept { if (IsAlphaNumeric(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '(' || ch == ')' || ch == '-' || ch == '+' || ch == '=' || ch == '|' || ch == '{' || ch == '}' || ch == '[' || ch == ']' || ch == ':' || ch == ';' || ch == '<' || ch == '>' || ch == ',' || ch == '/' || ch == '?' || ch == '!' || ch == '.' || ch == '~') return true; return false; } unsigned char SafeGetUnsignedCharAt(Accessor &styler, Sci_Position position, char chDefault = ' ') { return styler.SafeGetCharAt(position, chDefault); } // Put an upper limit to bound time taken for unexpected text. constexpr Sci_PositionU maxLengthCheck = 200; std::string GetNextWord(Accessor &styler, Sci_PositionU start) { std::string ret; for (Sci_PositionU i = 0; i < maxLengthCheck; i++) { const char ch = styler.SafeGetCharAt(start + i); if ((i == 0) && !IsAWordStart(ch)) break; if ((i > 0) && !IsAWordChar(ch)) break; ret.push_back(ch); } return ret; } bool Contains(const std::string &s, std::string_view search) noexcept { return s.find(search) != std::string::npos; } script_type segIsScriptingIndicator(Accessor &styler, Sci_PositionU start, Sci_PositionU end, script_type prevValue) { const std::string s = styler.GetRangeLowered(start, end+1); if (Contains(s, "vbs")) return eScriptVBS; if (Contains(s, "pyth")) return eScriptPython; // https://html.spec.whatwg.org/multipage/scripting.html#attr-script-type // https://mimesniff.spec.whatwg.org/#javascript-mime-type if (Contains(s, "javas") || Contains(s, "ecmas") || Contains(s, "module") || Contains(s, "jscr")) return eScriptJS; if (Contains(s, "php")) return eScriptPHP; if (Contains(s, "xml")) { const size_t xml = s.find("xml"); if (xml != std::string::npos) { for (size_t t = 0; t < xml; t++) { if (!IsASpace(s[t])) { return prevValue; } } } return eScriptXML; } return prevValue; } int PrintScriptingIndicatorOffset(Accessor &styler, Sci_PositionU start, Sci_PositionU end) { int iResult = 0; const std::string s = styler.GetRangeLowered(start, end+1); if (0 == strncmp(s.c_str(), "php", 3)) { iResult = 3; } return iResult; } script_type ScriptOfState(int state) noexcept { if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) { return eScriptPython; } else if ((state >= SCE_HB_START && state <= SCE_HB_STRINGEOL) || (state == SCE_H_ASPAT || state == SCE_H_XCCOMMENT)) { return eScriptVBS; } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) { return eScriptJS; } else if ((state >= SCE_HPHP_DEFAULT && state <= SCE_HPHP_COMMENTLINE) || (state == SCE_HPHP_COMPLEX_VARIABLE)) { return eScriptPHP; } else if ((state >= SCE_H_SGML_DEFAULT) && (state < SCE_H_SGML_BLOCK_DEFAULT)) { return eScriptSGML; } else if (state == SCE_H_SGML_BLOCK_DEFAULT) { return eScriptSGMLblock; } else { return eScriptNone; } } constexpr int statePrintForState(int state, script_mode inScriptType) noexcept { int StateToPrint = state; if (state >= SCE_HJ_START) { if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) { StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_PYTHON); } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) { StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_VBS); } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) { StateToPrint = state + ((inScriptType == eNonHtmlScript) ? 0 : SCE_HA_JS); } } return StateToPrint; } constexpr int stateForPrintState(int StateToPrint) noexcept { int state = StateToPrint; if ((StateToPrint >= SCE_HPA_START) && (StateToPrint <= SCE_HPA_IDENTIFIER)) { state = StateToPrint - SCE_HA_PYTHON; } else if ((StateToPrint >= SCE_HBA_START) && (StateToPrint <= SCE_HBA_STRINGEOL)) { state = StateToPrint - SCE_HA_VBS; } else if ((StateToPrint >= SCE_HJA_START) && (StateToPrint <= SCE_HJA_REGEX)) { state = StateToPrint - SCE_HA_JS; } return state; } constexpr bool IsNumberChar(char ch) noexcept { return IsADigit(ch) || ch == '.' || ch == '-' || ch == '#'; } constexpr bool isStringState(int state) noexcept { bool bResult = false; switch (state) { case SCE_HJ_DOUBLESTRING: case SCE_HJ_SINGLESTRING: case SCE_HJA_DOUBLESTRING: case SCE_HJA_SINGLESTRING: case SCE_HB_STRING: case SCE_HBA_STRING: case SCE_HP_STRING: case SCE_HP_CHARACTER: case SCE_HP_TRIPLE: case SCE_HP_TRIPLEDOUBLE: case SCE_HPA_STRING: case SCE_HPA_CHARACTER: case SCE_HPA_TRIPLE: case SCE_HPA_TRIPLEDOUBLE: case SCE_HPHP_HSTRING: case SCE_HPHP_SIMPLESTRING: case SCE_HPHP_HSTRING_VARIABLE: case SCE_HPHP_COMPLEX_VARIABLE: bResult = true; break; default : break; } return bResult; } constexpr bool stateAllowsTermination(int state) noexcept { bool allowTermination = !isStringState(state); if (allowTermination) { switch (state) { case SCE_HPHP_COMMENT: case SCE_HP_COMMENTLINE: case SCE_HPA_COMMENTLINE: allowTermination = false; break; default: break; } } return allowTermination; } bool isPreProcessorEndTag(int state, int ch) noexcept { const script_type type = ScriptOfState(state); if (state == SCE_H_ASP || AnyOf(type, eScriptVBS, eScriptJS, eScriptPython)) { return ch == '%'; } if (type == eScriptPHP) { return ch == '%' || ch == '?'; } return ch == '?'; } // not really well done, since it's only comments that should lex the %> and <% constexpr bool isCommentASPState(int state) noexcept { bool bResult = false; switch (state) { case SCE_HJ_COMMENT: case SCE_HJ_COMMENTLINE: case SCE_HJ_COMMENTDOC: case SCE_HB_COMMENTLINE: case SCE_HP_COMMENTLINE: case SCE_HPHP_COMMENT: case SCE_HPHP_COMMENTLINE: bResult = true; break; default : break; } return bResult; } bool classifyAttribHTML(script_mode inScriptType, Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, Accessor &styler, const std::string &tag) { int chAttr = SCE_H_ATTRIBUTEUNKNOWN; bool isLanguageType = false; if (IsNumberChar(styler[start])) { chAttr = SCE_H_NUMBER; } else { const std::string s = styler.GetRangeLowered(start, end+1); if (keywords.InList(s)) { chAttr = SCE_H_ATTRIBUTE; } else { int subStyle = classifier.ValueFor(s); if (subStyle < 0) { // Didn't find attribute, check for tag.attribute const std::string tagAttribute = tag + "." + s; subStyle = classifier.ValueFor(tagAttribute); } if (subStyle >= 0) { chAttr = subStyle; } } if (inScriptType == eNonHtmlScript) { // see https://html.spec.whatwg.org/multipage/scripting.html#script-processing-model if (s == "type" || s == "language") { isLanguageType = true; } } } if ((chAttr == SCE_H_ATTRIBUTEUNKNOWN) && !keywords) // No keywords -> all are known chAttr = SCE_H_ATTRIBUTE; styler.ColourTo(end, chAttr); return isLanguageType; } // https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-core-concepts bool isHTMLCustomElement(const std::string &tag) noexcept { // check valid HTML custom element name: starts with an ASCII lower alpha and contains hyphen. // IsUpperOrLowerCase() is used for `html.tags.case.sensitive=1`. if (tag.length() < 2 || !IsUpperOrLowerCase(tag[0])) { return false; } if (tag.find('-') == std::string::npos) { return false; } return true; } int classifyTagHTML(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, Accessor &styler, bool &tagDontFold, bool caseSensitive, bool isXml, bool allowScripts, const std::set &nonFoldingTags, std::string &tag) { tag.clear(); // Copy after the '<' and stop before ' ' for (Sci_PositionU cPos = start; cPos <= end; cPos++) { const char ch = styler[cPos]; if (IsASpace(ch)) { break; } if ((ch != '<') && (ch != '/')) { tag.push_back(caseSensitive ? ch : MakeLowerCase(ch)); } } // if the current language is XML, I can fold any tag // if the current language is HTML, I don't want to fold certain tags (input, meta, etc.) //...to find it in the list of no-container-tags tagDontFold = (!isXml) && (nonFoldingTags.count(tag) > 0); // No keywords -> all are known int chAttr = SCE_H_TAGUNKNOWN; if (!tag.empty() && (tag[0] == '!')) { chAttr = SCE_H_SGML_DEFAULT; } else if (!keywords || keywords.InList(tag)) { chAttr = SCE_H_TAG; } else if (!isXml && isHTMLCustomElement(tag)) { chAttr = SCE_H_TAG; } else { const int subStyle = classifier.ValueFor(tag); if (subStyle >= 0) { chAttr = subStyle; } } if (chAttr != SCE_H_TAGUNKNOWN) { styler.ColourTo(end, chAttr); } if (chAttr == SCE_H_TAG) { if (allowScripts && (tag == "script")) { // check to see if this is a self-closing tag by sniffing ahead bool isSelfClose = false; for (Sci_PositionU cPos = end; cPos <= end + maxLengthCheck; cPos++) { const char ch = styler.SafeGetCharAt(cPos, '\0'); if (ch == '\0' || ch == '>') break; if (ch == '/' && styler.SafeGetCharAt(cPos + 1, '\0') == '>') { isSelfClose = true; break; } } // do not enter a script state if the tag self-closed if (!isSelfClose) chAttr = SCE_H_SCRIPT; } else if (!isXml && (tag == "comment")) { chAttr = SCE_H_COMMENT; } } return chAttr; } void classifyWordHTJS(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, const WordClassifier &classifierServer, Accessor &styler, script_mode inScriptType) { const std::string s = styler.GetRange(start, end+1); int chAttr = SCE_HJ_WORD; const bool wordIsNumber = IsADigit(s[0]) || ((s[0] == '.') && IsADigit(s[1])); if (wordIsNumber) { chAttr = SCE_HJ_NUMBER; } else if (keywords.InList(s)) { chAttr = SCE_HJ_KEYWORD; } else { const int subStyle = (inScriptType == eNonHtmlScript) ? classifier.ValueFor(s) : classifierServer.ValueFor(s); if (subStyle >= 0) { chAttr = subStyle; } } styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); } int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, Accessor &styler, script_mode inScriptType) { int chAttr = SCE_HB_IDENTIFIER; const bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); if (wordIsNumber) { chAttr = SCE_HB_NUMBER; } else { const std::string s = styler.GetRangeLowered(start, end+1); if (keywords.InList(s)) { chAttr = SCE_HB_WORD; if (s == "rem") chAttr = SCE_HB_COMMENTLINE; } else { const int subStyle = classifier.ValueFor(s); if (subStyle >= 0) { chAttr = subStyle; } } } styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); if (chAttr == SCE_HB_COMMENTLINE) return SCE_HB_COMMENTLINE; else return SCE_HB_DEFAULT; } void classifyWordHTPy(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, Accessor &styler, std::string &prevWord, script_mode inScriptType, bool isMako) { const bool wordIsNumber = IsADigit(styler[start]); const std::string s = styler.GetRange(start, end + 1); int chAttr = SCE_HP_IDENTIFIER; if (prevWord == "class") chAttr = SCE_HP_CLASSNAME; else if (prevWord == "def") chAttr = SCE_HP_DEFNAME; else if (wordIsNumber) chAttr = SCE_HP_NUMBER; else if (keywords.InList(s)) chAttr = SCE_HP_WORD; else if (isMako && (s == "block")) chAttr = SCE_HP_WORD; else { const int subStyle = classifier.ValueFor(s); if (subStyle >= 0) { chAttr = subStyle; } } styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); prevWord = s; } // Update the word colour to default or keyword // Called when in a PHP word void classifyWordHTPHP(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, const WordClassifier &classifier, Accessor &styler) { int chAttr = SCE_HPHP_DEFAULT; const bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1])); if (wordIsNumber) { chAttr = SCE_HPHP_NUMBER; } else { const std::string s = styler.GetRangeLowered(start, end+1);; if (keywords.InList(s)) { chAttr = SCE_HPHP_WORD; } else { const int subStyle = classifier.ValueFor(s); if (subStyle >= 0) { chAttr = subStyle; } } } styler.ColourTo(end, chAttr); } bool isWordHSGML(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, Accessor &styler) { const std::string s = styler.GetRange(start, end + 1); return keywords.InList(s); } bool isWordCdata(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { const std::string s = styler.GetRange(start, end + 1); return s == "[CDATA["; } // Return the first state to reach when entering a scripting language constexpr int StateForScript(script_type scriptLanguage) noexcept { int Result = SCE_HJ_START; switch (scriptLanguage) { case eScriptVBS: Result = SCE_HB_START; break; case eScriptPython: Result = SCE_HP_START; break; case eScriptPHP: Result = SCE_HPHP_DEFAULT; break; case eScriptXML: Result = SCE_H_TAGUNKNOWN; break; case eScriptSGML: Result = SCE_H_SGML_DEFAULT; break; case eScriptComment: Result = SCE_H_COMMENT; break; default : break; } return Result; } constexpr bool issgmlwordchar(int ch) noexcept { return !IsASCII(ch) || (IsAlphaNumeric(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '['); } constexpr bool IsPhpWordStart(int ch) noexcept { return (IsUpperOrLowerCase(ch) || (ch == '_')) || (ch >= 0x7f); } constexpr bool IsPhpWordChar(int ch) noexcept { return IsADigit(ch) || IsPhpWordStart(ch); } constexpr bool InTagState(int state) noexcept { return AnyOf(state, SCE_H_TAG, SCE_H_TAGUNKNOWN, SCE_H_SCRIPT, SCE_H_ATTRIBUTE, SCE_H_ATTRIBUTEUNKNOWN, SCE_H_NUMBER, SCE_H_OTHER, SCE_H_DOUBLESTRING, SCE_H_SINGLESTRING); } constexpr bool IsCommentState(const int state) noexcept { return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT; } constexpr bool IsScriptCommentState(const int state) noexcept { return AnyOf(state, SCE_HJ_COMMENT, SCE_HJ_COMMENTLINE, SCE_HJA_COMMENT, SCE_HJA_COMMENTLINE, SCE_HB_COMMENTLINE, SCE_HBA_COMMENTLINE); } constexpr bool isLineEnd(int ch) noexcept { return ch == '\r' || ch == '\n'; } bool isMakoBlockEnd(const int ch, const int chNext, const std::string &blockType) noexcept { if (blockType.empty()) { return ((ch == '%') && (chNext == '>')); } else if (InList(blockType, { "inherit", "namespace", "include", "page" })) { return ((ch == '/') && (chNext == '>')); } else if (blockType == "%") { if (ch == '/' && isLineEnd(chNext)) return true; else return isLineEnd(ch); } else if (blockType == "{") { return ch == '}'; } else { return (ch == '>'); } } bool isDjangoBlockEnd(const int ch, const int chNext, const std::string &blockType) noexcept { if (blockType.empty()) { return false; } else if (blockType == "%") { return ((ch == '%') && (chNext == '}')); } else if (blockType == "{") { return ((ch == '}') && (chNext == '}')); } else { return false; } } class PhpNumberState { enum NumberBase { BASE_10 = 0, BASE_2, BASE_8, BASE_16 }; static constexpr const char *const digitList[] = { "_0123456789", "_01", "_01234567", "_0123456789abcdefABCDEF" }; NumberBase base = BASE_10; bool decimalPart = false; bool exponentPart = false; bool invalid = false; bool finished = false; bool leadingZero = false; bool invalidBase8 = false; bool betweenDigits = false; bool decimalChar = false; bool exponentChar = false; public: [[nodiscard]] bool isInvalid() const noexcept { return invalid; } [[nodiscard]] bool isFinished() const noexcept { return finished; } bool init(int ch, int chPlus1, int chPlus2) noexcept { base = BASE_10; decimalPart = false; exponentPart = false; invalid = false; finished = false; leadingZero = false; invalidBase8 = false; betweenDigits = false; decimalChar = false; exponentChar = false; if (ch == '.' && strchr(digitList[BASE_10] + !betweenDigits, chPlus1) != nullptr) { decimalPart = true; betweenDigits = true; } else if (ch == '0' && (chPlus1 == 'b' || chPlus1 == 'B')) { base = BASE_2; } else if (ch == '0' && (chPlus1 == 'o' || chPlus1 == 'O')) { base = BASE_8; } else if (ch == '0' && (chPlus1 == 'x' || chPlus1 == 'X')) { base = BASE_16; } else if (strchr(digitList[BASE_10] + !betweenDigits, ch) != nullptr) { leadingZero = ch == '0'; betweenDigits = true; check(chPlus1, chPlus2); if (finished && leadingZero) { // single zero should be base 10 base = BASE_10; } } else { return false; } return true; } bool check(int ch, int chPlus1) noexcept { if (strchr(digitList[base] + !betweenDigits, ch) != nullptr) { if (leadingZero) { invalidBase8 = invalidBase8 || strchr(digitList[BASE_8] + !betweenDigits, ch) == nullptr; } betweenDigits = ch != '_'; decimalChar = false; exponentChar = false; } else if (ch == '_') { invalid = true; betweenDigits = false; decimalChar = false; // exponentChar is unchanged } else if (base == BASE_10 && ch == '.' && ( !(decimalPart || exponentPart) || strchr(digitList[BASE_10] + !betweenDigits, chPlus1) != nullptr) ) { invalid = invalid || !betweenDigits || decimalPart || exponentPart; decimalPart = true; betweenDigits = false; decimalChar = true; exponentChar = false; } else if (base == BASE_10 && (ch == 'e' || ch == 'E')) { invalid = invalid || !(betweenDigits || decimalChar) || exponentPart; exponentPart = true; betweenDigits = false; decimalChar = false; exponentChar = true; } else if (base == BASE_10 && (ch == '-' || ch == '+') && exponentChar) { invalid = invalid || strchr(digitList[BASE_10] + !betweenDigits, chPlus1) == nullptr; betweenDigits = false; decimalChar = false; // exponentChar is unchanged } else if (IsPhpWordChar(ch)) { invalid = true; betweenDigits = false; decimalChar = false; exponentChar = false; } else { invalid = invalid || !(betweenDigits || decimalChar); finished = true; if (base == BASE_10 && leadingZero && !decimalPart && !exponentPart) { base = BASE_8; invalid = invalid || invalidBase8; } } return finished; } }; constexpr bool isPHPStringState(int state) noexcept { return (state == SCE_HPHP_HSTRING) || (state == SCE_HPHP_SIMPLESTRING) || (state == SCE_HPHP_HSTRING_VARIABLE) || (state == SCE_HPHP_COMPLEX_VARIABLE); } Sci_Position FindPhpStringDelimiter(std::string &phpStringDelimiter, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) { const Sci_Position beginning = i - 1; bool isQuoted = false; while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t')) i++; char ch = styler.SafeGetCharAt(i); const char chNext = styler.SafeGetCharAt(i + 1); phpStringDelimiter.clear(); if (!IsPhpWordStart(ch)) { if ((ch == '\'' || ch == '\"') && IsPhpWordStart(chNext)) { isSimpleString = ch == '\''; isQuoted = true; i++; ch = chNext; } else { return beginning; } } phpStringDelimiter.push_back(ch); i++; Sci_Position j = i; for (; j < lengthDoc && !isLineEnd(styler[j]); j++) { if (!IsPhpWordChar(styler[j]) && isQuoted) { if (((isSimpleString && styler[j] == '\'') || (!isSimpleString && styler[j] == '\"')) && isLineEnd(styler.SafeGetCharAt(j + 1))) { isQuoted = false; j++; break; } else { phpStringDelimiter.clear(); return beginning; } } phpStringDelimiter.push_back(styler[j]); } if (isQuoted) { phpStringDelimiter.clear(); return beginning; } return j - 1; } // Options used for LexerHTML struct OptionsHTML { int aspDefaultLanguage = eScriptJS; bool caseSensitive = false; bool allowScripts = true; bool isMako = false; bool isDjango = false; bool fold = false; bool foldHTML = false; bool foldHTMLPreprocessor = true; bool foldCompact = true; bool foldComment = false; bool foldHeredoc = false; bool foldXmlAtTagOpen = false; }; const char * const htmlWordListDesc[] = { "HTML elements and attributes", "JavaScript keywords", "VBScript keywords", "Python keywords", "PHP keywords", "SGML and DTD keywords", nullptr, }; const char * const phpscriptWordListDesc[] = { "", //Unused "", //Unused "", //Unused "", //Unused "PHP keywords", "", //Unused nullptr, }; struct OptionSetHTML : public OptionSet { explicit OptionSetHTML(bool isPHPScript_) { DefineProperty("asp.default.language", &OptionsHTML::aspDefaultLanguage, "Script in ASP code is initially assumed to be in JavaScript. " "To change this to VBScript set asp.default.language to 2. Python is 3."); DefineProperty("html.tags.case.sensitive", &OptionsHTML::caseSensitive, "For XML and HTML, setting this property to 1 will make tags match in a case " "sensitive way which is the expected behaviour for XML and XHTML."); DefineProperty("lexer.xml.allow.scripts", &OptionsHTML::allowScripts, "Set to 0 to disable scripts in XML."); DefineProperty("lexer.html.mako", &OptionsHTML::isMako, "Set to 1 to enable the mako template language."); DefineProperty("lexer.html.django", &OptionsHTML::isDjango, "Set to 1 to enable the django template language."); DefineProperty("fold", &OptionsHTML::fold); DefineProperty("fold.html", &OptionsHTML::foldHTML, "Folding is turned on or off for HTML and XML files with this option. " "The fold option must also be on for folding to occur."); DefineProperty("fold.html.preprocessor", &OptionsHTML::foldHTMLPreprocessor, "Folding is turned on or off for scripts embedded in HTML files with this option. " "The default is on."); DefineProperty("fold.compact", &OptionsHTML::foldCompact); DefineProperty("fold.hypertext.comment", &OptionsHTML::foldComment, "Allow folding for comments in scripts embedded in HTML. " "The default is off."); DefineProperty("fold.hypertext.heredoc", &OptionsHTML::foldHeredoc, "Allow folding for heredocs in scripts embedded in HTML. " "The default is off."); DefineProperty("fold.xml.at.tag.open", &OptionsHTML::foldXmlAtTagOpen, "Enable folding for XML at the start of open tag. " "The default is off."); DefineWordListSets(isPHPScript_ ? phpscriptWordListDesc : htmlWordListDesc); } }; constexpr char styleSubable[] = { SCE_H_TAG, SCE_H_ATTRIBUTE, SCE_HJ_WORD, SCE_HJA_WORD, SCE_HB_WORD, SCE_HP_WORD, SCE_HPHP_WORD, 0 }; // Allow normal styles to be contiguous using 0x80 to 0xBF by assigning sub-styles from 0xC0 to 0xFF constexpr int SubStylesHTML = 0xC0; const LexicalClass lexicalClassesHTML[] = { // Lexer HTML SCLEX_HTML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_: 0, "SCE_H_DEFAULT", "default", "Text", 1, "SCE_H_TAG", "tag", "Tags", 2, "SCE_H_ERRORTAGUNKNOWN", "error tag", "Unknown Tags", 3, "SCE_H_ATTRIBUTE", "attribute", "Attributes", 4, "SCE_H_ATTRIBUTEUNKNOWN", "error attribute", "Unknown Attributes", 5, "SCE_H_NUMBER", "literal numeric", "Numbers", 6, "SCE_H_DOUBLESTRING", "literal string", "Double quoted strings", 7, "SCE_H_SINGLESTRING", "literal string", "Single quoted strings", 8, "SCE_H_OTHER", "tag operator", "Other inside tag, including space and '='", 9, "SCE_H_COMMENT", "comment", "Comment", 10, "SCE_H_ENTITY", "literal", "Entities", 11, "SCE_H_TAGEND", "tag", "XML style tag ends '/>'", 12, "SCE_H_XMLSTART", "identifier", "XML identifier start ''", 14, "SCE_H_SCRIPT", "error", "Internal state which should never be visible", 15, "SCE_H_ASP", "preprocessor", "ASP <% ... %>", 16, "SCE_H_ASPAT", "preprocessor", "ASP <% ... %>", 17, "SCE_H_CDATA", "literal", "CDATA", 18, "SCE_H_QUESTION", "preprocessor", "PHP", 19, "SCE_H_VALUE", "literal string", "Unquoted values", 20, "SCE_H_XCCOMMENT", "comment", "ASP.NET, JSP Comment <%-- ... --%>", 21, "SCE_H_SGML_DEFAULT", "default", "SGML tags ", 22, "SCE_H_SGML_COMMAND", "preprocessor", "SGML command", 23, "SCE_H_SGML_1ST_PARAM", "preprocessor", "SGML 1st param", 24, "SCE_H_SGML_DOUBLESTRING", "literal string", "SGML double string", 25, "SCE_H_SGML_SIMPLESTRING", "literal string", "SGML single string", 26, "SCE_H_SGML_ERROR", "error", "SGML error", 27, "SCE_H_SGML_SPECIAL", "literal", "SGML special (#XXXX type)", 28, "SCE_H_SGML_ENTITY", "literal", "SGML entity", 29, "SCE_H_SGML_COMMENT", "comment", "SGML comment", 30, "SCE_H_SGML_1ST_PARAM_COMMENT", "error comment", "SGML first parameter - lexer internal. It is an error if any text is in this style.", 31, "SCE_H_SGML_BLOCK_DEFAULT", "default", "SGML block", 32, "", "predefined", "", 33, "", "predefined", "", 34, "", "predefined", "", 35, "", "predefined", "", 36, "", "predefined", "", 37, "", "predefined", "", 38, "", "predefined", "", 39, "", "predefined", "", 40, "SCE_HJ_START", "client javascript default", "JS Start - allows eol filled background to not start on same line as SCRIPT tag", 41, "SCE_HJ_DEFAULT", "client javascript default", "JS Default", 42, "SCE_HJ_COMMENT", "client javascript comment", "JS Comment", 43, "SCE_HJ_COMMENTLINE", "client javascript comment line", "JS Line Comment", 44, "SCE_HJ_COMMENTDOC", "client javascript comment documentation", "JS Doc comment", 45, "SCE_HJ_NUMBER", "client javascript literal numeric", "JS Number", 46, "SCE_HJ_WORD", "client javascript identifier", "JS Word", 47, "SCE_HJ_KEYWORD", "client javascript keyword", "JS Keyword", 48, "SCE_HJ_DOUBLESTRING", "client javascript literal string", "JS Double quoted string", 49, "SCE_HJ_SINGLESTRING", "client javascript literal string", "JS Single quoted string", 50, "SCE_HJ_SYMBOLS", "client javascript operator", "JS Symbols", 51, "SCE_HJ_STRINGEOL", "client javascript error literal string", "JavaScript EOL", 52, "SCE_HJ_REGEX", "client javascript literal regex", "JavaScript RegEx", 53, "", "unused", "", 54, "", "unused", "", 55, "SCE_HJA_START", "server javascript default", "JS Start - allows eol filled background to not start on same line as SCRIPT tag", 56, "SCE_HJA_DEFAULT", "server javascript default", "JS Default", 57, "SCE_HJA_COMMENT", "server javascript comment", "JS Comment", 58, "SCE_HJA_COMMENTLINE", "server javascript comment line", "JS Line Comment", 59, "SCE_HJA_COMMENTDOC", "server javascript comment documentation", "JS Doc comment", 60, "SCE_HJA_NUMBER", "server javascript literal numeric", "JS Number", 61, "SCE_HJA_WORD", "server javascript identifier", "JS Word", 62, "SCE_HJA_KEYWORD", "server javascript keyword", "JS Keyword", 63, "SCE_HJA_DOUBLESTRING", "server javascript literal string", "JS Double quoted string", 64, "SCE_HJA_SINGLESTRING", "server javascript literal string", "JS Single quoted string", 65, "SCE_HJA_SYMBOLS", "server javascript operator", "JS Symbols", 66, "SCE_HJA_STRINGEOL", "server javascript error literal string", "JavaScript EOL", 67, "SCE_HJA_REGEX", "server javascript literal regex", "JavaScript RegEx", 68, "", "unused", "", 69, "", "unused", "", 70, "SCE_HB_START", "client basic default", "Start", 71, "SCE_HB_DEFAULT", "client basic default", "Default", 72, "SCE_HB_COMMENTLINE", "client basic comment line", "Comment", 73, "SCE_HB_NUMBER", "client basic literal numeric", "Number", 74, "SCE_HB_WORD", "client basic keyword", "KeyWord", 75, "SCE_HB_STRING", "client basic literal string", "String", 76, "SCE_HB_IDENTIFIER", "client basic identifier", "Identifier", 77, "SCE_HB_STRINGEOL", "client basic literal string", "Unterminated string", 78, "", "unused", "", 79, "", "unused", "", 80, "SCE_HBA_START", "server basic default", "Start", 81, "SCE_HBA_DEFAULT", "server basic default", "Default", 82, "SCE_HBA_COMMENTLINE", "server basic comment line", "Comment", 83, "SCE_HBA_NUMBER", "server basic literal numeric", "Number", 84, "SCE_HBA_WORD", "server basic keyword", "KeyWord", 85, "SCE_HBA_STRING", "server basic literal string", "String", 86, "SCE_HBA_IDENTIFIER", "server basic identifier", "Identifier", 87, "SCE_HBA_STRINGEOL", "server basic literal string", "Unterminated string", 88, "", "unused", "", 89, "", "unused", "", 90, "SCE_HP_START", "client python default", "Embedded Python", 91, "SCE_HP_DEFAULT", "client python default", "Embedded Python", 92, "SCE_HP_COMMENTLINE", "client python comment line", "Comment", 93, "SCE_HP_NUMBER", "client python literal numeric", "Number", 94, "SCE_HP_STRING", "client python literal string", "String", 95, "SCE_HP_CHARACTER", "client python literal string character", "Single quoted string", 96, "SCE_HP_WORD", "client python keyword", "Keyword", 97, "SCE_HP_TRIPLE", "client python literal string", "Triple quotes", 98, "SCE_HP_TRIPLEDOUBLE", "client python literal string", "Triple double quotes", 99, "SCE_HP_CLASSNAME", "client python identifier", "Class name definition", 100, "SCE_HP_DEFNAME", "client python identifier", "Function or method name definition", 101, "SCE_HP_OPERATOR", "client python operator", "Operators", 102, "SCE_HP_IDENTIFIER", "client python identifier", "Identifiers", 103, "", "unused", "", 104, "SCE_HPHP_COMPLEX_VARIABLE", "server php identifier", "PHP complex variable", 105, "SCE_HPA_START", "server python default", "ASP Python", 106, "SCE_HPA_DEFAULT", "server python default", "ASP Python", 107, "SCE_HPA_COMMENTLINE", "server python comment line", "Comment", 108, "SCE_HPA_NUMBER", "server python literal numeric", "Number", 109, "SCE_HPA_STRING", "server python literal string", "String", 110, "SCE_HPA_CHARACTER", "server python literal string character", "Single quoted string", 111, "SCE_HPA_WORD", "server python keyword", "Keyword", 112, "SCE_HPA_TRIPLE", "server python literal string", "Triple quotes", 113, "SCE_HPA_TRIPLEDOUBLE", "server python literal string", "Triple double quotes", 114, "SCE_HPA_CLASSNAME", "server python identifier", "Class name definition", 115, "SCE_HPA_DEFNAME", "server python identifier", "Function or method name definition", 116, "SCE_HPA_OPERATOR", "server python operator", "Operators", 117, "SCE_HPA_IDENTIFIER", "server python identifier", "Identifiers", 118, "SCE_HPHP_DEFAULT", "server php default", "Default", 119, "SCE_HPHP_HSTRING", "server php literal string", "Double quoted String", 120, "SCE_HPHP_SIMPLESTRING", "server php literal string", "Single quoted string", 121, "SCE_HPHP_WORD", "server php keyword", "Keyword", 122, "SCE_HPHP_NUMBER", "server php literal numeric", "Number", 123, "SCE_HPHP_VARIABLE", "server php identifier", "Variable", 124, "SCE_HPHP_COMMENT", "server php comment", "Comment", 125, "SCE_HPHP_COMMENTLINE", "server php comment line", "One line comment", 126, "SCE_HPHP_HSTRING_VARIABLE", "server php literal string identifier", "PHP variable in double quoted string", 127, "SCE_HPHP_OPERATOR", "server php operator", "PHP operator", }; const LexicalClass lexicalClassesXML[] = { // Lexer.Secondary XML SCLEX_XML SCE_H_: 0, "SCE_H_DEFAULT", "default", "Default", 1, "SCE_H_TAG", "tag", "Tags", 2, "SCE_H_TAGUNKNOWN", "error tag", "Unknown Tags", 3, "SCE_H_ATTRIBUTE", "attribute", "Attributes", 4, "SCE_H_ERRORATTRIBUTEUNKNOWN", "error attribute", "Unknown Attributes", 5, "SCE_H_NUMBER", "literal numeric", "Numbers", 6, "SCE_H_DOUBLESTRING", "literal string", "Double quoted strings", 7, "SCE_H_SINGLESTRING", "literal string", "Single quoted strings", 8, "SCE_H_OTHER", "tag operator", "Other inside tag, including space and '='", 9, "SCE_H_COMMENT", "comment", "Comment", 10, "SCE_H_ENTITY", "literal", "Entities", 11, "SCE_H_TAGEND", "tag", "XML style tag ends '/>'", 12, "SCE_H_XMLSTART", "identifier", "XML identifier start ''", 14, "", "unused", "", 15, "", "unused", "", 16, "", "unused", "", 17, "SCE_H_CDATA", "literal", "CDATA", 18, "SCE_H_QUESTION", "preprocessor", "Question", 19, "SCE_H_VALUE", "literal string", "Unquoted Value", 20, "", "unused", "", 21, "SCE_H_SGML_DEFAULT", "default", "SGML tags ", 22, "SCE_H_SGML_COMMAND", "preprocessor", "SGML command", 23, "SCE_H_SGML_1ST_PARAM", "preprocessor", "SGML 1st param", 24, "SCE_H_SGML_DOUBLESTRING", "literal string", "SGML double string", 25, "SCE_H_SGML_SIMPLESTRING", "literal string", "SGML single string", 26, "SCE_H_SGML_ERROR", "error", "SGML error", 27, "SCE_H_SGML_SPECIAL", "literal", "SGML special (#XXXX type)", 28, "SCE_H_SGML_ENTITY", "literal", "SGML entity", 29, "SCE_H_SGML_COMMENT", "comment", "SGML comment", 30, "", "unused", "", 31, "SCE_H_SGML_BLOCK_DEFAULT", "default", "SGML block", }; const char * const tagsThatDoNotFold[] = { "area", "base", "basefont", "br", "col", "command", "embed", "frame", "hr", "img", "input", "isindex", "keygen", "link", "meta", "param", "source", "track", "wbr" }; } class LexerHTML : public DefaultLexer { bool isXml; bool isPHPScript; WordList keywords; WordList keywords2; WordList keywords3; WordList keywords4; WordList keywords5; WordList keywords6; // SGML (DTD) keywords OptionsHTML options; OptionSetHTML osHTML; std::set nonFoldingTags; SubStyles subStyles{styleSubable,SubStylesHTML,SubStylesAvailable,0}; public: explicit LexerHTML(bool isXml_, bool isPHPScript_) : DefaultLexer( isXml_ ? "xml" : (isPHPScript_ ? "phpscript" : "hypertext"), isXml_ ? SCLEX_XML : (isPHPScript_ ? SCLEX_PHPSCRIPT : SCLEX_HTML), isXml_ ? lexicalClassesXML : lexicalClassesHTML, isXml_ ? std::size(lexicalClassesXML) : std::size(lexicalClassesHTML)), isXml(isXml_), isPHPScript(isPHPScript_), osHTML(isPHPScript_), nonFoldingTags(std::begin(tagsThatDoNotFold), std::end(tagsThatDoNotFold)) { } ~LexerHTML() override { } void SCI_METHOD Release() override { delete this; } const char *SCI_METHOD PropertyNames() override { return osHTML.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osHTML.PropertyType(name); } const char *SCI_METHOD DescribeProperty(const char *name) override { return osHTML.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char *key) override { return osHTML.PropertyGet(key); } const char *SCI_METHOD DescribeWordListSets() override { return osHTML.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; // No Fold as all folding performs in Lex. int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override { return subStyles.Allocate(styleBase, numberStyles); } int SCI_METHOD SubStylesStart(int styleBase) override { return subStyles.Start(styleBase); } int SCI_METHOD SubStylesLength(int styleBase) override { return subStyles.Length(styleBase); } int SCI_METHOD StyleFromSubStyle(int subStyle) override { const int styleBase = subStyles.BaseStyle(subStyle); return styleBase; } int SCI_METHOD PrimaryStyleFromStyle(int style) override { return style; } void SCI_METHOD FreeSubStyles() override { subStyles.Free(); } void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override { subStyles.SetIdentifiers(style, identifiers); } int SCI_METHOD DistanceToSecondaryStyles() override { return 0; } const char *SCI_METHOD GetSubStyleBases() override { return styleSubable; } static ILexer5 *LexerFactoryHTML() { return new LexerHTML(false, false); } static ILexer5 *LexerFactoryXML() { return new LexerHTML(true, false); } static ILexer5 *LexerFactoryPHPScript() { return new LexerHTML(false, true); } }; Sci_Position SCI_METHOD LexerHTML::PropertySet(const char *key, const char *val) { if (osHTML.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerHTML::WordListSet(int n, const char *wl) { WordList *wordListN = nullptr; switch (n) { case 0: wordListN = &keywords; break; case 1: wordListN = &keywords2; break; case 2: wordListN = &keywords3; break; case 3: wordListN = &keywords4; break; case 4: wordListN = &keywords5; break; case 5: wordListN = &keywords6; break; default: break; } Sci_Position firstModification = -1; if (wordListN) { if (wordListN->Set(wl)) { firstModification = 0; } } return firstModification; } void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { Accessor styler(pAccess, nullptr); const WordClassifier &classifierTags = subStyles.Classifier(SCE_H_TAG); const WordClassifier &classifierAttributes = subStyles.Classifier(SCE_H_ATTRIBUTE); const WordClassifier &classifierJavaScript = subStyles.Classifier(SCE_HJ_WORD); const WordClassifier &classifierJavaScriptServer = subStyles.Classifier(SCE_HJA_WORD); const WordClassifier &classifierBasic = subStyles.Classifier(SCE_HB_WORD); const WordClassifier &classifierPython = subStyles.Classifier(SCE_HP_WORD); const WordClassifier &classifierPHP = subStyles.Classifier(SCE_HPHP_WORD); if (isPHPScript && (startPos == 0)) { initStyle = SCE_HPHP_DEFAULT; } styler.StartAt(startPos); std::string lastTag; std::string prevWord; PhpNumberState phpNumber; std::string phpStringDelimiter; int StateToPrint = initStyle; int state = stateForPrintState(StateToPrint); std::string makoBlockType; int makoComment = 0; std::string djangoBlockType; // If inside a tag, it may be a script tag, so reread from the start of line starting tag to ensure any language tags are seen if (InTagState(state)) { while ((startPos > 0) && (InTagState(styler.StyleIndexAt(startPos - 1)))) { const Sci_Position backLineStart = styler.LineStart(styler.GetLine(startPos-1)); length += startPos - backLineStart; startPos = backLineStart; } state = SCE_H_DEFAULT; } // String can be heredoc, must find a delimiter first. Reread from beginning of line containing the string, to get the correct lineState if (isPHPStringState(state)) { while (startPos > 0 && (isPHPStringState(state) || !isLineEnd(styler[startPos - 1]))) { startPos--; length++; state = styler.StyleIndexAt(startPos); } if (startPos == 0) state = SCE_H_DEFAULT; } styler.StartAt(startPos); /* Nothing handles getting out of these, so we need not start in any of them. * As we're at line start and they can't span lines, we'll re-detect them anyway */ switch (state) { case SCE_H_QUESTION: case SCE_H_XMLSTART: case SCE_H_XMLEND: case SCE_H_ASP: state = SCE_H_DEFAULT; break; default: break; } Sci_Position lineCurrent = styler.GetLine(startPos); int lineState; if (lineCurrent > 0) { lineState = styler.GetLineState(lineCurrent-1); } else { // Default client and ASP scripting language is JavaScript lineState = eScriptJS << 8; lineState |= options.aspDefaultLanguage << 4; } script_mode inScriptType = static_cast((lineState >> 0) & 0x03); // 2 bits of scripting mode bool tagOpened = (lineState >> 2) & 0x01; // 1 bit to know if we are in an opened tag bool tagClosing = (lineState >> 3) & 0x01; // 1 bit to know if we are in a closing tag bool tagDontFold = false; //some HTML tags should not be folded script_type aspScript = static_cast((lineState >> 4) & 0x0F); // 4 bits of script name script_type clientScript = static_cast((lineState >> 8) & 0x0F); // 4 bits of script name int beforePreProc = (lineState >> 12) & 0xFF; // 8 bits of state bool isLanguageType = (lineState >> 20) & 1; // type or language attribute for script tag script_type scriptLanguage = ScriptOfState(state); // If eNonHtmlScript coincides with SCE_H_COMMENT, assume eScriptComment if (inScriptType == eNonHtmlScript && state == SCE_H_COMMENT) { scriptLanguage = eScriptComment; } script_type beforeLanguage = ScriptOfState(beforePreProc); const bool foldHTML = options.foldHTML; const bool fold = foldHTML && options.fold; const bool foldHTMLPreprocessor = foldHTML && options.foldHTMLPreprocessor; const bool foldCompact = options.foldCompact; const bool foldComment = fold && options.foldComment; const bool foldHeredoc = fold && options.foldHeredoc; const bool foldXmlAtTagOpen = isXml && fold && options.foldXmlAtTagOpen; const bool caseSensitive = options.caseSensitive; const bool allowScripts = options.allowScripts; const bool isMako = options.isMako; const bool isDjango = options.isDjango; const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", true); const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", true); const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", true); // TODO: also handle + and - (except if they're part of ++ or --) and return keywords const CharacterSet setOKBeforeJSRE(CharacterSet::setNone, "([{=,:;!%^&*|?~"); // Only allow [A-Za-z0-9.#-_:] in entities const CharacterSet setEntity(CharacterSet::setAlphaNum, ".#-_:"); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; Sci_Position visibleChars = 0; int lineStartVisibleChars = 0; int chPrev = ' '; int ch = ' '; int chPrevNonWhite = ' '; // look back to set chPrevNonWhite properly for better regex colouring if (scriptLanguage == eScriptJS && startPos > 0) { Sci_Position back = startPos; int style = 0; while (--back) { style = styler.StyleIndexAt(back); if (style < SCE_HJ_DEFAULT || style > SCE_HJ_COMMENTDOC) // includes SCE_HJ_COMMENT & SCE_HJ_COMMENTLINE break; } if (style == SCE_HJ_SYMBOLS) { chPrevNonWhite = SafeGetUnsignedCharAt(styler, back); } } styler.StartSegment(startPos); const Sci_Position lengthDoc = startPos + length; for (Sci_Position i = startPos; i < lengthDoc; i++) { const int chPrev2 = chPrev; chPrev = ch; if (!IsASpace(ch) && state != SCE_HJ_COMMENT && state != SCE_HJ_COMMENTLINE && state != SCE_HJ_COMMENTDOC) chPrevNonWhite = ch; ch = static_cast(styler[i]); int chNext = SafeGetUnsignedCharAt(styler, i + 1); const int chNext2 = SafeGetUnsignedCharAt(styler, i + 2); // Handle DBCS codepages if (styler.IsLeadByte(static_cast(ch))) { chPrev = ' '; i += 1; continue; } if ((!IsASpace(ch) || !foldCompact) && fold) visibleChars++; if (!IsASpace(ch)) lineStartVisibleChars++; // decide what is the current state to print (depending of the script tag) StateToPrint = statePrintForState(state, inScriptType); // handle script folding if (fold) { switch (scriptLanguage) { case eScriptJS: case eScriptPHP: //not currently supported case eScriptVBS: if (!AnyOf(state, SCE_HPHP_COMMENT, SCE_HPHP_COMMENTLINE, SCE_HJ_REGEX, SCE_HJ_COMMENT, SCE_HJ_COMMENTLINE, SCE_HJ_COMMENTDOC) && !isStringState(state)) { //Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle); //if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) { if (ch == '#') { Sci_Position j = i + 1; while ((j < lengthDoc) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { j++; } if (styler.Match(j, "region") || styler.Match(j, "if")) { levelCurrent++; } else if (styler.Match(j, "end")) { levelCurrent--; } } else if ((ch == '{') || (ch == '}') || (foldComment && (ch == '/') && (chNext == '*'))) { levelCurrent += (((ch == '{') || (ch == '/')) ? 1 : -1); } } else if (((state == SCE_HPHP_COMMENT) || (state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTDOC)) && foldComment && (ch == '*') && (chNext == '/')) { levelCurrent--; } break; case eScriptPython: if (state != SCE_HP_COMMENTLINE && !isMako) { if ((ch == ':') && ((chNext == '\n') || (chNext == '\r' && chNext2 == '\n'))) { levelCurrent++; } else if ((ch == '\n') && !((chNext == '\r') && (chNext2 == '\n')) && (chNext != '\n')) { // check if the number of tabs is lower than the level constexpr int tabWidth = 8; int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * tabWidth; for (Sci_Position j = 0; Findlevel > 0; j++) { const char chTmp = styler.SafeGetCharAt(i + j + 1); if (chTmp == '\t') { Findlevel -= tabWidth; } else if (chTmp == ' ') { Findlevel--; } else { break; } } if (Findlevel > 0) { levelCurrent -= Findlevel / tabWidth; if (Findlevel % tabWidth) levelCurrent--; } } } break; default: break; } } if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { // Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix) // Avoid triggering two times on Dos/Win // New line -> record any line state onto /next/ line if (fold) { int lev = levelPrev; if (visibleChars == 0) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; styler.SetLevel(lineCurrent, lev); visibleChars = 0; levelPrev = levelCurrent; } styler.SetLineState(lineCurrent, ((inScriptType & 0x03) << 0) | ((tagOpened ? 1 : 0) << 2) | ((tagClosing ? 1 : 0) << 3) | ((aspScript & 0x0F) << 4) | ((clientScript & 0x0F) << 8) | ((beforePreProc & 0xFF) << 12) | ((isLanguageType ? 1 : 0) << 20)); lineCurrent++; lineStartVisibleChars = 0; } // handle start of Mako comment line if (isMako && ch == '#' && chNext == '#') { makoComment = 1; state = SCE_HP_COMMENTLINE; } // handle end of Mako comment line else if (isMako && makoComment && (ch == '\r' || ch == '\n')) { makoComment = 0; styler.ColourTo(i - 1, StateToPrint); if (scriptLanguage == eScriptPython) { state = SCE_HP_DEFAULT; } else { state = SCE_H_DEFAULT; } } // Allow falling through to mako handling code if newline is going to end a block if (((ch == '\r' && chNext != '\n') || (ch == '\n')) && (!isMako || (makoBlockType != "%"))) { } // Ignore everything in mako comment until the line ends else if (isMako && makoComment) { } // generic end of script processing else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) { // Check if it's the end of the script tag (or any other HTML tag) switch (state) { // in these cases, you can embed HTML tags (to confirm !!!!!!!!!!!!!!!!!!!!!!) case SCE_H_DOUBLESTRING: case SCE_H_SINGLESTRING: case SCE_HJ_COMMENT: case SCE_HJ_COMMENTDOC: //case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide // the end of script marker from some JS interpreters. //case SCE_HB_COMMENTLINE: case SCE_HBA_COMMENTLINE: case SCE_HJ_DOUBLESTRING: case SCE_HJ_SINGLESTRING: case SCE_HJ_REGEX: case SCE_HB_STRING: case SCE_HBA_STRING: case SCE_HP_STRING: case SCE_HP_TRIPLE: case SCE_HP_TRIPLEDOUBLE: case SCE_HPHP_HSTRING: case SCE_HPHP_SIMPLESTRING: case SCE_HPHP_COMMENT: case SCE_HPHP_COMMENTLINE: break; default : // check if the closing tag is a script tag if (const char *tag = (state == SCE_HJ_COMMENTLINE || state == SCE_HB_COMMENTLINE || isXml) ? "script" : state == SCE_H_COMMENT ? "comment" : nullptr) { Sci_Position j = i + 2; int chr; do { chr = static_cast(*tag++); } while (chr != 0 && chr == MakeLowerCase(styler.SafeGetCharAt(j++))); if (chr != 0) break; } // closing tag of the script (it's a closing HTML tag anyway) styler.ColourTo(i - 1, StateToPrint); state = SCE_H_TAGUNKNOWN; inScriptType = eHtml; scriptLanguage = eScriptNone; clientScript = eScriptJS; isLanguageType = false; i += 2; visibleChars += 2; tagClosing = true; if (foldXmlAtTagOpen) { levelCurrent--; } continue; } } ///////////////////////////////////// // handle the start of PHP pre-processor = Non-HTML else if ((state != SCE_H_ASPAT) && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (ch == '<') && (chNext == '?') && !IsScriptCommentState(state)) { beforeLanguage = scriptLanguage; scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 6, isXml ? eScriptXML : eScriptPHP); if ((scriptLanguage != eScriptPHP) && (isStringState(state) || (state==SCE_H_COMMENT))) continue; styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; i++; visibleChars++; i += PrintScriptingIndicatorOffset(styler, styler.GetStartSegment() + 2, i + 6); if (scriptLanguage == eScriptXML) styler.ColourTo(i, SCE_H_XMLSTART); else styler.ColourTo(i, SCE_H_QUESTION); state = StateForScript(scriptLanguage); if (inScriptType == eNonHtmlScript) inScriptType = eNonHtmlScriptPreProc; else inScriptType = eNonHtmlPreProc; // Fold whole script, but not if the XML first tag (all XML-like tags in this case) if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) { levelCurrent++; } // should be better ch = SafeGetUnsignedCharAt(styler, i); continue; } // handle the start Mako template Python code else if (isMako && scriptLanguage == eScriptNone && ((ch == '<' && chNext == '%') || (lineStartVisibleChars == 1 && ch == '%') || (lineStartVisibleChars == 1 && ch == '/' && chNext == '%') || (ch == '$' && chNext == '{') || (ch == '<' && chNext == '/' && chNext2 == '%'))) { if (ch == '%' || ch == '/') makoBlockType = "%"; else if (ch == '$') makoBlockType = "{"; else if (chNext == '/') makoBlockType = GetNextWord(styler, i+3); // Tag end: else makoBlockType = GetNextWord(styler, i+2); // Tag: <%tag...> styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; if (inScriptType == eNonHtmlScript) inScriptType = eNonHtmlScriptPreProc; else inScriptType = eNonHtmlPreProc; if (chNext == '/') { i += 2; visibleChars += 2; } else if (ch != '%') { i++; visibleChars++; } state = SCE_HP_START; scriptLanguage = eScriptPython; styler.ColourTo(i, SCE_H_ASP); if (ch != '%' && ch != '$' && ch != '/') { i += makoBlockType.length(); visibleChars += makoBlockType.length(); if (keywords4.InList(makoBlockType)) styler.ColourTo(i, SCE_HP_WORD); else styler.ColourTo(i, SCE_H_TAGUNKNOWN); } ch = SafeGetUnsignedCharAt(styler, i); continue; } // handle the start/end of Django comment else if (isDjango && state != SCE_H_COMMENT && (ch == '{' && chNext == '#')) { styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; beforeLanguage = scriptLanguage; if (inScriptType == eNonHtmlScript) inScriptType = eNonHtmlScriptPreProc; else inScriptType = eNonHtmlPreProc; i += 1; visibleChars += 1; scriptLanguage = eScriptComment; state = SCE_H_COMMENT; styler.ColourTo(i, SCE_H_ASP); ch = SafeGetUnsignedCharAt(styler, i); continue; } else if (isDjango && state == SCE_H_COMMENT && (ch == '#' && chNext == '}')) { styler.ColourTo(i - 1, StateToPrint); i += 1; visibleChars += 1; styler.ColourTo(i, SCE_H_ASP); state = beforePreProc; if (inScriptType == eNonHtmlScriptPreProc) inScriptType = eNonHtmlScript; else inScriptType = eHtml; scriptLanguage = beforeLanguage; continue; } // handle the start Django template code else if (isDjango && scriptLanguage != eScriptPython && scriptLanguage != eScriptComment && (ch == '{' && (chNext == '%' || chNext == '{'))) { if (chNext == '%') djangoBlockType = "%"; else djangoBlockType = "{"; styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; if (inScriptType == eNonHtmlScript) inScriptType = eNonHtmlScriptPreProc; else inScriptType = eNonHtmlPreProc; i += 1; visibleChars += 1; state = SCE_HP_START; beforeLanguage = scriptLanguage; scriptLanguage = eScriptPython; styler.ColourTo(i, SCE_H_ASP); ch = SafeGetUnsignedCharAt(styler, i); continue; } // handle the start of ASP pre-processor = Non-HTML else if (!isMako && !isDjango && !isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) { styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; if (inScriptType == eNonHtmlScript) inScriptType = eNonHtmlScriptPreProc; else inScriptType = eNonHtmlPreProc; // fold whole script if (foldHTMLPreprocessor) levelCurrent++; if (chNext2 == '@') { i += 2; // place as if it was the second next char treated visibleChars += 2; state = SCE_H_ASPAT; scriptLanguage = eScriptVBS; } else if ((chNext2 == '-') && (styler.SafeGetCharAt(i + 3) == '-')) { styler.ColourTo(i + 3, SCE_H_ASP); state = SCE_H_XCCOMMENT; scriptLanguage = eScriptVBS; continue; } else { if (chNext2 == '=') { i += 2; // place as if it was the second next char treated visibleChars += 2; } else { i++; // place as if it was the next char treated visibleChars++; } state = StateForScript(aspScript); scriptLanguage = aspScript; } styler.ColourTo(i, SCE_H_ASP); // should be better ch = SafeGetUnsignedCharAt(styler, i); continue; } ///////////////////////////////////// // handle the start of SGML language (DTD) else if (((scriptLanguage == eScriptNone) || (scriptLanguage == eScriptXML)) && (chPrev == '<') && (ch == '!') && (StateToPrint != SCE_H_CDATA) && (!isStringState(StateToPrint)) && (!IsCommentState(StateToPrint)) && (!IsScriptCommentState(StateToPrint))) { beforePreProc = state; styler.ColourTo(i - 2, StateToPrint); if ((chNext == '-') && (chNext2 == '-')) { state = SCE_H_COMMENT; // wait for a pending command styler.ColourTo(i + 2, SCE_H_COMMENT); i += 2; // follow styling after the -- if (!isXml) { // handle empty comment: , // https://html.spec.whatwg.org/multipage/parsing.html#parse-error-abrupt-closing-of-empty-comment chNext = SafeGetUnsignedCharAt(styler, i + 1); if ((chNext == '>') || (chNext == '-' && SafeGetUnsignedCharAt(styler, i + 2) == '>')) { if (chNext == '-') { i += 1; } chPrev = '-'; ch = '-'; } } } else if (isWordCdata(i + 1, i + 7, styler)) { state = SCE_H_CDATA; } else { styler.ColourTo(i, SCE_H_SGML_DEFAULT); // ') { i++; visibleChars++; } else if ((makoBlockType == "%") && ch == '/') { i++; visibleChars++; } if ((makoBlockType != "%") || ch == '/') { styler.ColourTo(i, SCE_H_ASP); } state = beforePreProc; if (inScriptType == eNonHtmlScriptPreProc) inScriptType = eNonHtmlScript; else inScriptType = eHtml; scriptLanguage = eScriptNone; continue; } // handle the end of Django template code else if (isDjango && ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && (scriptLanguage != eScriptNone) && stateAllowsTermination(state) && isDjangoBlockEnd(ch, chNext, djangoBlockType)) { if (state == SCE_H_ASPAT) { aspScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, aspScript); } if (state == SCE_HP_WORD) { classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako); } else { styler.ColourTo(i - 1, StateToPrint); } i += 1; visibleChars += 1; styler.ColourTo(i, SCE_H_ASP); state = beforePreProc; if (inScriptType == eNonHtmlScriptPreProc) inScriptType = eNonHtmlScript; else inScriptType = eHtml; scriptLanguage = beforeLanguage; continue; } // handle the end of a pre-processor = Non-HTML else if ((!isMako && !isDjango && ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && (((scriptLanguage != eScriptNone) && stateAllowsTermination(state))) && ((chNext == '>') && isPreProcessorEndTag(state, ch))) || ((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) { if (state == SCE_H_ASPAT) { aspScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, aspScript); } // Bounce out of any ASP mode switch (state) { case SCE_HJ_WORD: classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, classifierJavaScript, classifierJavaScriptServer, styler, inScriptType); break; case SCE_HB_WORD: classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, classifierBasic, styler, inScriptType); break; case SCE_HP_WORD: classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako); break; case SCE_HPHP_WORD: classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, classifierPHP, styler); break; case SCE_H_XCCOMMENT: styler.ColourTo(i - 1, state); break; default : styler.ColourTo(i - 1, StateToPrint); break; } if (scriptLanguage != eScriptSGML) { i++; visibleChars++; } if (ch == '%') styler.ColourTo(i, SCE_H_ASP); else if (scriptLanguage == eScriptXML) styler.ColourTo(i, SCE_H_XMLEND); else if (scriptLanguage == eScriptSGML) styler.ColourTo(i, SCE_H_SGML_DEFAULT); else styler.ColourTo(i, SCE_H_QUESTION); state = beforePreProc; if (inScriptType == eNonHtmlScriptPreProc) inScriptType = eNonHtmlScript; else inScriptType = eHtml; // Unfold all scripting languages, except for XML tag if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) { levelCurrent--; } scriptLanguage = beforeLanguage; continue; } ///////////////////////////////////// switch (state) { case SCE_H_DEFAULT: if (ch == '<') { // in HTML, fold on tag open and unfold on tag close tagOpened = true; tagClosing = (chNext == '/'); if (foldXmlAtTagOpen && !AnyOf(chNext, '/', '?', '!', '-', '%')) { levelCurrent++; } if (foldXmlAtTagOpen && chNext == '/') { levelCurrent--; } styler.ColourTo(i - 1, StateToPrint); if (chNext != '!') state = SCE_H_TAGUNKNOWN; } else if (ch == '&') { styler.ColourTo(i - 1, SCE_H_DEFAULT); state = SCE_H_ENTITY; } break; case SCE_H_SGML_DEFAULT: case SCE_H_SGML_BLOCK_DEFAULT: // if (scriptLanguage == eScriptSGMLblock) // StateToPrint = SCE_H_SGML_BLOCK_DEFAULT; if (ch == '\"') { styler.ColourTo(i - 1, StateToPrint); state = SCE_H_SGML_DOUBLESTRING; } else if (ch == '\'') { styler.ColourTo(i - 1, StateToPrint); state = SCE_H_SGML_SIMPLESTRING; } else if ((ch == '-') && (chPrev == '-')) { if (static_cast(styler.GetStartSegment()) <= (i - 2)) { styler.ColourTo(i - 2, StateToPrint); } state = SCE_H_SGML_COMMENT; } else if (IsUpperOrLowerCase(ch) && (chPrev == '%')) { styler.ColourTo(i - 2, StateToPrint); state = SCE_H_SGML_ENTITY; } else if (ch == '#') { styler.ColourTo(i - 1, StateToPrint); state = SCE_H_SGML_SPECIAL; } else if (ch == '[') { styler.ColourTo(i - 1, StateToPrint); scriptLanguage = eScriptSGMLblock; state = SCE_H_SGML_BLOCK_DEFAULT; } else if (ch == ']') { if (scriptLanguage == eScriptSGMLblock) { styler.ColourTo(i, StateToPrint); scriptLanguage = eScriptSGML; } else { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i, SCE_H_SGML_ERROR); } state = SCE_H_SGML_DEFAULT; } else if (scriptLanguage == eScriptSGMLblock) { if ((ch == '!') && (chPrev == '<')) { styler.ColourTo(i - 2, StateToPrint); styler.ColourTo(i, SCE_H_SGML_DEFAULT); state = SCE_H_SGML_COMMAND; } else if (ch == '>') { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i, SCE_H_SGML_DEFAULT); } } break; case SCE_H_SGML_COMMAND: if ((ch == '-') && (chPrev == '-')) { styler.ColourTo(i - 2, StateToPrint); state = SCE_H_SGML_COMMENT; } else if (!issgmlwordchar(ch)) { if (isWordHSGML(styler.GetStartSegment(), i - 1, keywords6, styler)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_H_SGML_1ST_PARAM; } else { state = SCE_H_SGML_ERROR; } } break; case SCE_H_SGML_1ST_PARAM: // wait for the beginning of the word if ((ch == '-') && (chPrev == '-')) { if (scriptLanguage == eScriptSGMLblock) { styler.ColourTo(i - 2, SCE_H_SGML_BLOCK_DEFAULT); } else { styler.ColourTo(i - 2, SCE_H_SGML_DEFAULT); } state = SCE_H_SGML_1ST_PARAM_COMMENT; } else if (issgmlwordchar(ch)) { if (scriptLanguage == eScriptSGMLblock) { styler.ColourTo(i - 1, SCE_H_SGML_BLOCK_DEFAULT); } else { styler.ColourTo(i - 1, SCE_H_SGML_DEFAULT); } // find the length of the word Sci_Position size = 1; while (setHTMLWord.Contains(SafeGetUnsignedCharAt(styler, i + size))) size++; styler.ColourTo(i + size - 1, StateToPrint); i += size - 1; visibleChars += size - 1; ch = SafeGetUnsignedCharAt(styler, i); if (scriptLanguage == eScriptSGMLblock) { state = SCE_H_SGML_BLOCK_DEFAULT; } else { state = SCE_H_SGML_DEFAULT; } continue; } break; case SCE_H_SGML_ERROR: if ((ch == '-') && (chPrev == '-')) { styler.ColourTo(i - 2, StateToPrint); state = SCE_H_SGML_COMMENT; } break; case SCE_H_SGML_DOUBLESTRING: if (ch == '\"') { styler.ColourTo(i, StateToPrint); state = SCE_H_SGML_DEFAULT; } break; case SCE_H_SGML_SIMPLESTRING: if (ch == '\'') { styler.ColourTo(i, StateToPrint); state = SCE_H_SGML_DEFAULT; } break; case SCE_H_SGML_COMMENT: if ((ch == '-') && (chPrev == '-')) { styler.ColourTo(i, StateToPrint); state = SCE_H_SGML_DEFAULT; } break; case SCE_H_CDATA: if ((chPrev2 == ']') && (chPrev == ']') && (ch == '>')) { styler.ColourTo(i, StateToPrint); state = SCE_H_DEFAULT; levelCurrent--; } break; case SCE_H_COMMENT: if ((scriptLanguage != eScriptComment) && (chPrev2 == '-') && (chPrev == '-') && (ch == '>' || (!isXml && ch == '!' && chNext == '>'))) { // close HTML comment with --!> // https://html.spec.whatwg.org/multipage/parsing.html#parse-error-incorrectly-closed-comment if (ch == '!') { i += 1; } styler.ColourTo(i, StateToPrint); state = SCE_H_DEFAULT; levelCurrent--; } break; case SCE_H_SGML_1ST_PARAM_COMMENT: if ((ch == '-') && (chPrev == '-')) { styler.ColourTo(i, SCE_H_SGML_COMMENT); state = SCE_H_SGML_1ST_PARAM; } break; case SCE_H_SGML_SPECIAL: if (!IsUpperCase(ch)) { styler.ColourTo(i - 1, StateToPrint); if (IsAlphaNumeric(ch)) { state = SCE_H_SGML_ERROR; } else { state = SCE_H_SGML_DEFAULT; } } break; case SCE_H_SGML_ENTITY: if (ch == ';') { styler.ColourTo(i, StateToPrint); state = SCE_H_SGML_DEFAULT; } else if (!(IsAlphaNumeric(ch)) && ch != '-' && ch != '.') { styler.ColourTo(i, SCE_H_SGML_ERROR); state = SCE_H_SGML_DEFAULT; } break; case SCE_H_ENTITY: if (ch == ';') { styler.ColourTo(i, StateToPrint); state = SCE_H_DEFAULT; } else if (!setEntity.Contains(ch)) { styler.ColourTo(i-1, SCE_H_TAGUNKNOWN); state = SCE_H_DEFAULT; if (!isLineEnd(ch)) { // Retreat one byte so the character that is invalid inside entity // may start something else like a tag. --i; continue; } } break; case SCE_H_TAGUNKNOWN: if (!setTagContinue.Contains(ch) && !((ch == '/') && (chPrev == '<'))) { int eClass = classifyTagHTML(styler.GetStartSegment(), i - 1, keywords, classifierTags, styler, tagDontFold, caseSensitive, isXml, allowScripts, nonFoldingTags, lastTag); if (eClass == SCE_H_SCRIPT || eClass == SCE_H_COMMENT) { if (!tagClosing) { inScriptType = eNonHtmlScript; scriptLanguage = eClass == SCE_H_SCRIPT ? clientScript : eScriptComment; } else { scriptLanguage = eScriptNone; } isLanguageType = false; eClass = SCE_H_TAG; } if (ch == '>') { styler.ColourTo(i, eClass); if (inScriptType == eNonHtmlScript) { state = StateForScript(scriptLanguage); } else { state = SCE_H_DEFAULT; } tagOpened = false; if (!(foldXmlAtTagOpen || tagDontFold)) { if (tagClosing) { levelCurrent--; } else { levelCurrent++; } } tagClosing = false; } else if (ch == '/' && chNext == '>') { if (eClass == SCE_H_TAGUNKNOWN) { styler.ColourTo(i + 1, SCE_H_TAGUNKNOWN); } else { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i + 1, SCE_H_TAGEND); } i++; ch = chNext; state = SCE_H_DEFAULT; tagOpened = false; if (foldXmlAtTagOpen) { levelCurrent--; } } else { if (eClass != SCE_H_TAGUNKNOWN) { if (eClass == SCE_H_SGML_DEFAULT) { state = SCE_H_SGML_DEFAULT; } else { state = SCE_H_OTHER; } } } } break; case SCE_H_ATTRIBUTE: if (!setAttributeContinue.Contains(ch)) { isLanguageType = classifyAttribHTML(inScriptType, styler.GetStartSegment(), i - 1, keywords, classifierAttributes, styler, lastTag); if (ch == '>') { styler.ColourTo(i, SCE_H_TAG); if (inScriptType == eNonHtmlScript) { state = StateForScript(scriptLanguage); } else { state = SCE_H_DEFAULT; } tagOpened = false; if (!(foldXmlAtTagOpen || tagDontFold)) { if (tagClosing) { levelCurrent--; } else { levelCurrent++; } } tagClosing = false; } else if (ch == '=') { styler.ColourTo(i, SCE_H_OTHER); state = SCE_H_VALUE; } else { state = SCE_H_OTHER; } } break; case SCE_H_OTHER: if (ch == '>') { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i, SCE_H_TAG); if (inScriptType == eNonHtmlScript) { state = StateForScript(scriptLanguage); } else { state = SCE_H_DEFAULT; } tagOpened = false; if (!(foldXmlAtTagOpen || tagDontFold)) { if (tagClosing) { levelCurrent--; } else { levelCurrent++; } } tagClosing = false; } else if (ch == '\"') { styler.ColourTo(i - 1, StateToPrint); state = SCE_H_DOUBLESTRING; } else if (ch == '\'') { styler.ColourTo(i - 1, StateToPrint); state = SCE_H_SINGLESTRING; } else if (ch == '=') { styler.ColourTo(i, StateToPrint); state = SCE_H_VALUE; } else if (ch == '/' && chNext == '>') { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i + 1, SCE_H_TAGEND); i++; ch = chNext; state = SCE_H_DEFAULT; tagOpened = false; if (foldXmlAtTagOpen) { levelCurrent--; } } else if (ch == '?' && chNext == '>') { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i + 1, SCE_H_XMLEND); i++; ch = chNext; state = SCE_H_DEFAULT; } else if (setHTMLWord.Contains(ch)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_H_ATTRIBUTE; } break; case SCE_H_DOUBLESTRING: if (ch == '\"') { if (isLanguageType) { scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); clientScript = scriptLanguage; isLanguageType = false; } styler.ColourTo(i, SCE_H_DOUBLESTRING); state = SCE_H_OTHER; } break; case SCE_H_SINGLESTRING: if (ch == '\'') { if (isLanguageType) { scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); clientScript = scriptLanguage; isLanguageType = false; } styler.ColourTo(i, SCE_H_SINGLESTRING); state = SCE_H_OTHER; } break; case SCE_H_VALUE: if (!setHTMLWord.Contains(ch)) { if (ch == '\"' && chPrev == '=') { // Should really test for being first character state = SCE_H_DOUBLESTRING; } else if (ch == '\'' && chPrev == '=') { state = SCE_H_SINGLESTRING; } else { if (IsNumberChar(styler[styler.GetStartSegment()])) { styler.ColourTo(i - 1, SCE_H_NUMBER); } else { styler.ColourTo(i - 1, StateToPrint); } if (ch == '>') { styler.ColourTo(i, SCE_H_TAG); if (inScriptType == eNonHtmlScript) { state = StateForScript(scriptLanguage); } else { state = SCE_H_DEFAULT; } tagOpened = false; if (!tagDontFold) { if (tagClosing) { levelCurrent--; } else { levelCurrent++; } } tagClosing = false; } else { state = SCE_H_OTHER; } } } break; case SCE_HJ_DEFAULT: case SCE_HJ_START: case SCE_HJ_SYMBOLS: if (IsAWordStart(ch)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_WORD; } else if (ch == '/' && chNext == '*') { styler.ColourTo(i - 1, StateToPrint); if (chNext2 == '*') state = SCE_HJ_COMMENTDOC; else state = SCE_HJ_COMMENT; if (chNext2 == '/') { // Eat the * so it isn't used for the end of the comment i++; } } else if (ch == '/' && chNext == '/') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_COMMENTLINE; } else if (ch == '/' && setOKBeforeJSRE.Contains(chPrevNonWhite)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_REGEX; } else if (ch == '\"') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_DOUBLESTRING; } else if (ch == '\'') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_SINGLESTRING; } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && styler.SafeGetCharAt(i + 3) == '-') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_COMMENTLINE; } else if ((ch == '-') && (chNext == '-') && (chNext2 == '>')) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_COMMENTLINE; i += 2; } else if (IsOperator(ch)) { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType)); state = SCE_HJ_DEFAULT; } else if ((ch == ' ') || (ch == '\t')) { if (state == SCE_HJ_START) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_DEFAULT; } } break; case SCE_HJ_WORD: if (!IsAWordChar(ch)) { classifyWordHTJS(styler.GetStartSegment(), i - 1, keywords2, classifierJavaScript, classifierJavaScriptServer, styler, inScriptType); //styler.ColourTo(i - 1, eHTJSKeyword); state = SCE_HJ_DEFAULT; if (ch == '/' && chNext == '*') { if (chNext2 == '*') state = SCE_HJ_COMMENTDOC; else state = SCE_HJ_COMMENT; } else if (ch == '/' && chNext == '/') { state = SCE_HJ_COMMENTLINE; } else if (ch == '\"') { state = SCE_HJ_DOUBLESTRING; } else if (ch == '\'') { state = SCE_HJ_SINGLESTRING; } else if ((ch == '-') && (chNext == '-') && (chNext2 == '>')) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_COMMENTLINE; i += 2; } else if (IsOperator(ch)) { styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType)); state = SCE_HJ_DEFAULT; } } break; case SCE_HJ_COMMENT: case SCE_HJ_COMMENTDOC: if (ch == '/' && chPrev == '*') { styler.ColourTo(i, StateToPrint); state = SCE_HJ_DEFAULT; ch = ' '; } break; case SCE_HJ_COMMENTLINE: if (ch == '\r' || ch == '\n') { styler.ColourTo(i - 1, statePrintForState(SCE_HJ_COMMENTLINE, inScriptType)); state = SCE_HJ_DEFAULT; ch = ' '; } break; case SCE_HJ_DOUBLESTRING: if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; } } else if (ch == '\"') { styler.ColourTo(i, statePrintForState(SCE_HJ_DOUBLESTRING, inScriptType)); state = SCE_HJ_DEFAULT; } else if (isLineEnd(ch)) { styler.ColourTo(i - 1, StateToPrint); if (chPrev != '\\' && (chPrev2 != '\\' || chPrev != '\r' || ch != '\n')) { state = SCE_HJ_STRINGEOL; } } break; case SCE_HJ_SINGLESTRING: if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; } } else if (ch == '\'') { styler.ColourTo(i, statePrintForState(SCE_HJ_SINGLESTRING, inScriptType)); state = SCE_HJ_DEFAULT; } else if (isLineEnd(ch)) { styler.ColourTo(i - 1, StateToPrint); if (chPrev != '\\' && (chPrev2 != '\\' || chPrev != '\r' || ch != '\n')) { state = SCE_HJ_STRINGEOL; } } break; case SCE_HJ_STRINGEOL: if (!isLineEnd(ch)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_DEFAULT; } else if (!isLineEnd(chNext)) { styler.ColourTo(i, StateToPrint); state = SCE_HJ_DEFAULT; } break; case SCE_HJ_REGEX: if (ch == '\r' || ch == '\n' || ch == '/') { if (ch == '/') { while (IsLowerCase(chNext)) { // gobble regex flags i++; ch = chNext; chNext = SafeGetUnsignedCharAt(styler, i + 1); } } styler.ColourTo(i, StateToPrint); state = SCE_HJ_DEFAULT; } else if (ch == '\\') { // Gobble up the quoted character if (chNext == '\\' || chNext == '/') { i++; ch = chNext; chNext = SafeGetUnsignedCharAt(styler, i + 1); } } break; case SCE_HB_DEFAULT: case SCE_HB_START: if (IsAWordStart(ch)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HB_WORD; } else if (ch == '\'') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HB_COMMENTLINE; } else if (ch == '\"') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HB_STRING; } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && styler.SafeGetCharAt(i + 3) == '-') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HB_COMMENTLINE; } else if (IsOperator(ch)) { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType)); state = SCE_HB_DEFAULT; } else if ((ch == ' ') || (ch == '\t')) { if (state == SCE_HB_START) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HB_DEFAULT; } } break; case SCE_HB_WORD: if (!IsAWordChar(ch)) { state = classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, classifierBasic, styler, inScriptType); if (state == SCE_HB_DEFAULT) { if (ch == '\"') { state = SCE_HB_STRING; } else if (ch == '\'') { state = SCE_HB_COMMENTLINE; } else if (IsOperator(ch)) { styler.ColourTo(i, statePrintForState(SCE_HB_DEFAULT, inScriptType)); state = SCE_HB_DEFAULT; } } } break; case SCE_HB_STRING: if (ch == '\"') { styler.ColourTo(i, StateToPrint); state = SCE_HB_DEFAULT; } else if (ch == '\r' || ch == '\n') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HB_STRINGEOL; } break; case SCE_HB_COMMENTLINE: if (ch == '\r' || ch == '\n') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HB_DEFAULT; } break; case SCE_HB_STRINGEOL: if (!isLineEnd(ch)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HB_DEFAULT; } else if (!isLineEnd(chNext)) { styler.ColourTo(i, StateToPrint); state = SCE_HB_DEFAULT; } break; case SCE_HP_DEFAULT: case SCE_HP_START: if (IsAWordStart(ch)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HP_WORD; } else if ((ch == '<') && (chNext == '!') && (chNext2 == '-') && styler.SafeGetCharAt(i + 3) == '-') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HP_COMMENTLINE; } else if (ch == '#') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HP_COMMENTLINE; } else if (ch == '\"') { styler.ColourTo(i - 1, StateToPrint); if (chNext == '\"' && chNext2 == '\"') { i += 2; state = SCE_HP_TRIPLEDOUBLE; ch = ' '; chPrev = ' '; chNext = SafeGetUnsignedCharAt(styler, i + 1); } else { // state = statePrintForState(SCE_HP_STRING,inScriptType); state = SCE_HP_STRING; } } else if (ch == '\'') { styler.ColourTo(i - 1, StateToPrint); if (chNext == '\'' && chNext2 == '\'') { i += 2; state = SCE_HP_TRIPLE; ch = ' '; chPrev = ' '; chNext = SafeGetUnsignedCharAt(styler, i + 1); } else { state = SCE_HP_CHARACTER; } } else if (IsOperator(ch)) { styler.ColourTo(i - 1, StateToPrint); styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType)); } else if ((ch == ' ') || (ch == '\t')) { if (state == SCE_HP_START) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HP_DEFAULT; } } break; case SCE_HP_WORD: if (!IsAWordChar(ch)) { classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako); state = SCE_HP_DEFAULT; if (ch == '#') { state = SCE_HP_COMMENTLINE; } else if (ch == '\"') { if (chNext == '\"' && chNext2 == '\"') { i += 2; state = SCE_HP_TRIPLEDOUBLE; ch = ' '; chPrev = ' '; chNext = SafeGetUnsignedCharAt(styler, i + 1); } else { state = SCE_HP_STRING; } } else if (ch == '\'') { if (chNext == '\'' && chNext2 == '\'') { i += 2; state = SCE_HP_TRIPLE; ch = ' '; chPrev = ' '; chNext = SafeGetUnsignedCharAt(styler, i + 1); } else { state = SCE_HP_CHARACTER; } } else if (IsOperator(ch)) { styler.ColourTo(i, statePrintForState(SCE_HP_OPERATOR, inScriptType)); } } break; case SCE_HP_COMMENTLINE: if (ch == '\r' || ch == '\n') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HP_DEFAULT; } break; case SCE_HP_STRING: if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; ch = chNext; chNext = SafeGetUnsignedCharAt(styler, i + 1); } } else if (ch == '\"') { styler.ColourTo(i, StateToPrint); state = SCE_HP_DEFAULT; } break; case SCE_HP_CHARACTER: if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; ch = chNext; chNext = SafeGetUnsignedCharAt(styler, i + 1); } } else if (ch == '\'') { styler.ColourTo(i, StateToPrint); state = SCE_HP_DEFAULT; } break; case SCE_HP_TRIPLE: if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'') { styler.ColourTo(i, StateToPrint); state = SCE_HP_DEFAULT; } break; case SCE_HP_TRIPLEDOUBLE: if (ch == '\"' && chPrev == '\"' && chPrev2 == '\"') { styler.ColourTo(i, StateToPrint); state = SCE_HP_DEFAULT; } break; ///////////// start - PHP state handling case SCE_HPHP_WORD: if (!IsPhpWordChar(ch)) { classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, classifierPHP, styler); if (ch == '/' && chNext == '*') { i++; state = SCE_HPHP_COMMENT; } else if (ch == '/' && chNext == '/') { i++; state = SCE_HPHP_COMMENTLINE; } else if (ch == '#' && chNext != '[') { state = SCE_HPHP_COMMENTLINE; } else if (ch == '\"') { state = SCE_HPHP_HSTRING; phpStringDelimiter = "\""; } else if (styler.Match(i, "<<<")) { bool isSimpleString = false; i = FindPhpStringDelimiter(phpStringDelimiter, i + 3, lengthDoc, styler, isSimpleString); if (!phpStringDelimiter.empty()) { state = (isSimpleString ? SCE_HPHP_SIMPLESTRING : SCE_HPHP_HSTRING); if (foldHeredoc) levelCurrent++; } } else if (ch == '\'') { state = SCE_HPHP_SIMPLESTRING; phpStringDelimiter = "\'"; } else if (ch == '$' && IsPhpWordStart(chNext)) { state = SCE_HPHP_VARIABLE; } else if (IsOperator(ch)) { state = SCE_HPHP_OPERATOR; } else { state = SCE_HPHP_DEFAULT; } } break; case SCE_HPHP_NUMBER: if (phpNumber.check(chNext, chNext2)) { styler.ColourTo(i, phpNumber.isInvalid() ? SCE_HPHP_DEFAULT : SCE_HPHP_NUMBER); state = SCE_HPHP_DEFAULT; } break; case SCE_HPHP_VARIABLE: if (!IsPhpWordChar(chNext)) { styler.ColourTo(i, SCE_HPHP_VARIABLE); state = SCE_HPHP_DEFAULT; } break; case SCE_HPHP_COMMENT: if (ch == '/' && chPrev == '*') { styler.ColourTo(i, StateToPrint); state = SCE_HPHP_DEFAULT; } break; case SCE_HPHP_COMMENTLINE: if (ch == '\r' || ch == '\n') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HPHP_DEFAULT; } break; case SCE_HPHP_HSTRING: if (ch == '\\' && ((phpStringDelimiter == "\"") || chNext == '$' || chNext == '{')) { // skip the next char i++; } else if (((ch == '{' && chNext == '$') || (ch == '$' && chNext == '{')) && IsPhpWordStart(chNext2)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HPHP_COMPLEX_VARIABLE; } else if (ch == '$' && IsPhpWordStart(chNext)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HPHP_HSTRING_VARIABLE; } else if (styler.Match(i, phpStringDelimiter.c_str())) { if (phpStringDelimiter == "\"") { styler.ColourTo(i, StateToPrint); state = SCE_HPHP_DEFAULT; } else if (lineStartVisibleChars == 1) { const int psdLength = static_cast(phpStringDelimiter.length()); if (!IsPhpWordChar(styler.SafeGetCharAt(i + psdLength))) { i += (((i + psdLength) < lengthDoc) ? psdLength : lengthDoc) - 1; styler.ColourTo(i, StateToPrint); state = SCE_HPHP_DEFAULT; if (foldHeredoc) levelCurrent--; } } } break; case SCE_HPHP_SIMPLESTRING: if (phpStringDelimiter == "\'") { if (ch == '\\') { // skip the next char i++; } else if (ch == '\'') { styler.ColourTo(i, StateToPrint); state = SCE_HPHP_DEFAULT; } } else if (lineStartVisibleChars == 1 && styler.Match(i, phpStringDelimiter.c_str())) { const int psdLength = static_cast(phpStringDelimiter.length()); if (!IsPhpWordChar(styler.SafeGetCharAt(i + psdLength))) { i += (((i + psdLength) < lengthDoc) ? psdLength : lengthDoc) - 1; styler.ColourTo(i, StateToPrint); state = SCE_HPHP_DEFAULT; if (foldHeredoc) levelCurrent--; } } break; case SCE_HPHP_HSTRING_VARIABLE: if (!IsPhpWordChar(chNext)) { styler.ColourTo(i, StateToPrint); state = SCE_HPHP_HSTRING; } break; case SCE_HPHP_COMPLEX_VARIABLE: if (ch == '}') { styler.ColourTo(i, StateToPrint); state = SCE_HPHP_HSTRING; } break; case SCE_HPHP_OPERATOR: case SCE_HPHP_DEFAULT: styler.ColourTo(i - 1, StateToPrint); if (phpNumber.init(ch, chNext, chNext2)) { if (phpNumber.isFinished()) { styler.ColourTo(i, phpNumber.isInvalid() ? SCE_HPHP_DEFAULT : SCE_HPHP_NUMBER); state = SCE_HPHP_DEFAULT; } else { state = SCE_HPHP_NUMBER; } } else if (IsAWordStart(ch)) { state = SCE_HPHP_WORD; } else if (ch == '/' && chNext == '*') { i++; state = SCE_HPHP_COMMENT; } else if (ch == '/' && chNext == '/') { i++; state = SCE_HPHP_COMMENTLINE; } else if (ch == '#' && chNext != '[') { state = SCE_HPHP_COMMENTLINE; } else if (ch == '\"') { state = SCE_HPHP_HSTRING; phpStringDelimiter = "\""; } else if (styler.Match(i, "<<<")) { bool isSimpleString = false; i = FindPhpStringDelimiter(phpStringDelimiter, i + 3, lengthDoc, styler, isSimpleString); if (!phpStringDelimiter.empty()) { state = (isSimpleString ? SCE_HPHP_SIMPLESTRING : SCE_HPHP_HSTRING); if (foldHeredoc) levelCurrent++; } } else if (ch == '\'') { state = SCE_HPHP_SIMPLESTRING; phpStringDelimiter = "\'"; } else if (ch == '$' && IsPhpWordStart(chNext)) { state = SCE_HPHP_VARIABLE; } else if (IsOperator(ch)) { state = SCE_HPHP_OPERATOR; } else if ((state == SCE_HPHP_OPERATOR) && (IsASpace(ch))) { state = SCE_HPHP_DEFAULT; } break; ///////////// end - PHP state handling } // Some of the above terminated their lexeme but since the same character starts // the same class again, only reenter if non empty segment. const bool nonEmptySegment = i >= static_cast(styler.GetStartSegment()); if (state == SCE_HB_DEFAULT) { // One of the above succeeded if ((ch == '\"') && (nonEmptySegment)) { state = SCE_HB_STRING; } else if (ch == '\'') { state = SCE_HB_COMMENTLINE; } else if (IsAWordStart(ch)) { state = SCE_HB_WORD; } else if (IsOperator(ch)) { styler.ColourTo(i, SCE_HB_DEFAULT); } } else if (state == SCE_HBA_DEFAULT) { // One of the above succeeded if ((ch == '\"') && (nonEmptySegment)) { state = SCE_HBA_STRING; } else if (ch == '\'') { state = SCE_HBA_COMMENTLINE; } else if (IsAWordStart(ch)) { state = SCE_HBA_WORD; } else if (IsOperator(ch)) { styler.ColourTo(i, SCE_HBA_DEFAULT); } } else if (state == SCE_HJ_DEFAULT) { // One of the above succeeded if (ch == '/' && chNext == '*') { if (styler.SafeGetCharAt(i + 2) == '*') state = SCE_HJ_COMMENTDOC; else state = SCE_HJ_COMMENT; } else if (ch == '/' && chNext == '/') { state = SCE_HJ_COMMENTLINE; } else if ((ch == '\"') && (nonEmptySegment)) { state = SCE_HJ_DOUBLESTRING; } else if ((ch == '\'') && (nonEmptySegment)) { state = SCE_HJ_SINGLESTRING; } else if (IsAWordStart(ch)) { state = SCE_HJ_WORD; } else if (IsOperator(ch)) { styler.ColourTo(i, statePrintForState(SCE_HJ_SYMBOLS, inScriptType)); } } } switch (state) { case SCE_HJ_WORD: classifyWordHTJS(styler.GetStartSegment(), lengthDoc - 1, keywords2, classifierJavaScript, classifierJavaScriptServer, styler, inScriptType); break; case SCE_HB_WORD: classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywords3, classifierBasic, styler, inScriptType); break; case SCE_HP_WORD: classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, classifierPython, styler, prevWord, inScriptType, isMako); break; case SCE_HPHP_WORD: classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywords5, classifierPHP, styler); break; default: StateToPrint = statePrintForState(state, inScriptType); if (static_cast(styler.GetStartSegment()) < lengthDoc) styler.ColourTo(lengthDoc - 1, StateToPrint); break; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later if (fold) { const int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } styler.Flush(); } LexerModule lmHTML(SCLEX_HTML, LexerHTML::LexerFactoryHTML, "hypertext", htmlWordListDesc); LexerModule lmXML(SCLEX_XML, LexerHTML::LexerFactoryXML, "xml", htmlWordListDesc); LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, LexerHTML::LexerFactoryPHPScript, "phpscript", phpscriptWordListDesc); ================================================ FILE: lexilla/lexers/LexHaskell.cxx ================================================ /****************************************************************** * LexHaskell.cxx * * A haskell lexer for the scintilla code control. * Some stuff "lended" from LexPython.cxx and LexCPP.cxx. * External lexer stuff inspired from the caml external lexer. * Folder copied from Python's. * * Written by Tobias Engvall - tumm at dtek dot chalmers dot se * * Several bug fixes by Krasimir Angelov - kr.angelov at gmail.com * * Improved by kudah * * TODO: * * A proper lexical folder to fold group declarations, comments, pragmas, * #ifdefs, explicit layout, lists, tuples, quasi-quotes, splces, etc, etc, * etc. * *****************************************************************/ #include #include #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.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 "OptionSet.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; // See https://github.com/ghc/ghc/blob/master/compiler/parser/Lexer.x#L1682 // Note, letter modifiers are prohibited. static int u_iswupper (int ch) { CharacterCategory c = CategoriseCharacter(ch); return c == ccLu || c == ccLt; } static int u_iswalpha (int ch) { CharacterCategory c = CategoriseCharacter(ch); return c == ccLl || c == ccLu || c == ccLt || c == ccLo; } static int u_iswalnum (int ch) { CharacterCategory c = CategoriseCharacter(ch); return c == ccLl || c == ccLu || c == ccLt || c == ccLo || c == ccNd || c == ccNo; } static int u_IsHaskellSymbol(int ch) { CharacterCategory c = CategoriseCharacter(ch); return c == ccPc || c == ccPd || c == ccPo || c == ccSm || c == ccSc || c == ccSk || c == ccSo; } static inline bool IsHaskellLetter(const int ch) { if (IsASCII(ch)) { return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); } else { return u_iswalpha(ch) != 0; } } static inline bool IsHaskellAlphaNumeric(const int ch) { if (IsASCII(ch)) { return IsAlphaNumeric(ch); } else { return u_iswalnum(ch) != 0; } } static inline bool IsHaskellUpperCase(const int ch) { if (IsASCII(ch)) { return ch >= 'A' && ch <= 'Z'; } else { return u_iswupper(ch) != 0; } } static inline bool IsAnHaskellOperatorChar(const int ch) { if (IsASCII(ch)) { return ( ch == '!' || ch == '#' || ch == '$' || ch == '%' || ch == '&' || ch == '*' || ch == '+' || ch == '-' || ch == '.' || ch == '/' || ch == ':' || ch == '<' || ch == '=' || ch == '>' || ch == '?' || ch == '@' || ch == '^' || ch == '|' || ch == '~' || ch == '\\'); } else { return u_IsHaskellSymbol(ch) != 0; } } static inline bool IsAHaskellWordStart(const int ch) { return IsHaskellLetter(ch) || ch == '_'; } static inline bool IsAHaskellWordChar(const int ch) { return ( IsHaskellAlphaNumeric(ch) || ch == '_' || ch == '\''); } static inline bool IsCommentBlockStyle(int style) { return (style >= SCE_HA_COMMENTBLOCK && style <= SCE_HA_COMMENTBLOCK3); } static inline bool IsCommentStyle(int style) { return (style >= SCE_HA_COMMENTLINE && style <= SCE_HA_COMMENTBLOCK3) || ( style == SCE_HA_LITERATE_COMMENT || style == SCE_HA_LITERATE_CODEDELIM); } // styles which do not belong to Haskell, but to external tools static inline bool IsExternalStyle(int style) { return ( style == SCE_HA_PREPROCESSOR || style == SCE_HA_LITERATE_COMMENT || style == SCE_HA_LITERATE_CODEDELIM); } static inline int CommentBlockStyleFromNestLevel(const unsigned int nestLevel) { return SCE_HA_COMMENTBLOCK + (nestLevel % 3); } // Mangled version of lexlib/Accessor.cxx IndentAmount. // Modified to treat comment blocks as whitespace // plus special case for commentline/preprocessor. static int HaskellIndentAmount(Accessor &styler, const Sci_Position line) { // Determines the indentation level of the current line // Comment blocks are treated as whitespace Sci_Position pos = styler.LineStart(line); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; char ch = styler[pos]; int style = styler.StyleAt(pos); int indent = 0; bool inPrevPrefix = line > 0; Sci_Position posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0; while (( ch == ' ' || ch == '\t' || IsCommentBlockStyle(style) || style == SCE_HA_LITERATE_CODEDELIM) && (pos < eol_pos)) { if (inPrevPrefix) { char chPrev = styler[posPrev++]; if (chPrev != ' ' && chPrev != '\t') { inPrevPrefix = false; } } if (ch == '\t') { indent = (indent / 8 + 1) * 8; } else { // Space or comment block indent++; } pos++; ch = styler[pos]; style = styler.StyleAt(pos); } indent += SC_FOLDLEVELBASE; // if completely empty line or the start of a comment or preprocessor... if ( styler.LineStart(line) == styler.Length() || ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r' || IsCommentStyle(style) || style == SCE_HA_PREPROCESSOR) return indent | SC_FOLDLEVELWHITEFLAG; else return indent; } struct OptionsHaskell { bool magicHash; bool allowQuotes; bool implicitParams; bool highlightSafe; bool cpp; bool stylingWithinPreprocessor; bool fold; bool foldComment; bool foldCompact; bool foldImports; OptionsHaskell() { magicHash = true; // Widespread use, enabled by default. allowQuotes = true; // Widespread use, enabled by default. implicitParams = false; // Fell out of favor, seldom used, disabled. highlightSafe = true; // Moderately used, doesn't hurt to enable. cpp = true; // Widespread use, enabled by default; stylingWithinPreprocessor = false; fold = false; foldComment = false; foldCompact = false; foldImports = false; } }; static const char * const haskellWordListDesc[] = { "Keywords", "FFI", "Reserved operators", 0 }; struct OptionSetHaskell : public OptionSet { OptionSetHaskell() { DefineProperty("lexer.haskell.allow.hash", &OptionsHaskell::magicHash, "Set to 0 to disallow the '#' character at the end of identifiers and " "literals with the haskell lexer " "(GHC -XMagicHash extension)"); DefineProperty("lexer.haskell.allow.quotes", &OptionsHaskell::allowQuotes, "Set to 0 to disable highlighting of Template Haskell name quotations " "and promoted constructors " "(GHC -XTemplateHaskell and -XDataKinds extensions)"); DefineProperty("lexer.haskell.allow.questionmark", &OptionsHaskell::implicitParams, "Set to 1 to allow the '?' character at the start of identifiers " "with the haskell lexer " "(GHC & Hugs -XImplicitParams extension)"); DefineProperty("lexer.haskell.import.safe", &OptionsHaskell::highlightSafe, "Set to 0 to disallow \"safe\" keyword in imports " "(GHC -XSafe, -XTrustworthy, -XUnsafe extensions)"); DefineProperty("lexer.haskell.cpp", &OptionsHaskell::cpp, "Set to 0 to disable C-preprocessor highlighting " "(-XCPP extension)"); DefineProperty("styling.within.preprocessor", &OptionsHaskell::stylingWithinPreprocessor, "For Haskell code, determines whether all preprocessor code is styled in the " "preprocessor style (0, the default) or only from the initial # to the end " "of the command word(1)." ); DefineProperty("fold", &OptionsHaskell::fold); DefineProperty("fold.comment", &OptionsHaskell::foldComment); DefineProperty("fold.compact", &OptionsHaskell::foldCompact); DefineProperty("fold.haskell.imports", &OptionsHaskell::foldImports, "Set to 1 to enable folding of import declarations"); DefineWordListSets(haskellWordListDesc); } }; class LexerHaskell : public DefaultLexer { bool literate; Sci_Position firstImportLine; int firstImportIndent; WordList keywords; WordList ffi; WordList reserved_operators; OptionsHaskell options; OptionSetHaskell osHaskell; enum HashCount { oneHash ,twoHashes ,unlimitedHashes }; enum KeywordMode { HA_MODE_DEFAULT = 0 ,HA_MODE_IMPORT1 = 1 // after "import", before "qualified" or "safe" or package name or module name. ,HA_MODE_IMPORT2 = 2 // after module name, before "as" or "hiding". ,HA_MODE_IMPORT3 = 3 // after "as", before "hiding" ,HA_MODE_MODULE = 4 // after "module", before module name. ,HA_MODE_FFI = 5 // after "foreign", before FFI keywords ,HA_MODE_TYPE = 6 // after "type" or "data", before "family" }; enum LiterateMode { LITERATE_BIRD = 0 // if '>' is the first character on the line, // color '>' as a codedelim and the rest of // the line as code. // else if "\begin{code}" is the only word on the // line except whitespace, switch to LITERATE_BLOCK // otherwise color the line as a literate comment. ,LITERATE_BLOCK = 1 // if the string "\end{code}" is encountered at column // 0 ignoring all later characters, color the line // as a codedelim and switch to LITERATE_BIRD // otherwise color the line as code. }; struct HaskellLineInfo { unsigned int nestLevel; // 22 bits ought to be enough for anybody unsigned int nonexternalStyle; // 5 bits, widen if number of styles goes // beyond 31. bool pragma; LiterateMode lmode; KeywordMode mode; HaskellLineInfo(int state) : nestLevel (state >> 10) , nonexternalStyle ((state >> 5) & 0x1F) , pragma ((state >> 4) & 0x1) , lmode (static_cast((state >> 3) & 0x1)) , mode (static_cast(state & 0x7)) {} int ToLineState() { return (nestLevel << 10) | (nonexternalStyle << 5) | (pragma << 4) | (lmode << 3) | mode; } }; inline void skipMagicHash(StyleContext &sc, const HashCount hashes) const { if (options.magicHash && sc.ch == '#') { sc.Forward(); if (hashes == twoHashes && sc.ch == '#') { sc.Forward(); } else if (hashes == unlimitedHashes) { while (sc.ch == '#') { sc.Forward(); } } } } bool LineContainsImport(const Sci_Position line, Accessor &styler) const { if (options.foldImports) { Sci_Position currentPos = styler.LineStart(line); int style = styler.StyleAt(currentPos); Sci_Position eol_pos = styler.LineStart(line + 1) - 1; while (currentPos < eol_pos) { int ch = styler[currentPos]; style = styler.StyleAt(currentPos); if (ch == ' ' || ch == '\t' || IsCommentBlockStyle(style) || style == SCE_HA_LITERATE_CODEDELIM) { currentPos++; } else { break; } } return (style == SCE_HA_KEYWORD && styler.Match(currentPos, "import")); } else { return false; } } inline int IndentAmountWithOffset(Accessor &styler, const Sci_Position line) const { const int indent = HaskellIndentAmount(styler, line); const int indentLevel = indent & SC_FOLDLEVELNUMBERMASK; return indentLevel <= ((firstImportIndent - 1) + SC_FOLDLEVELBASE) ? indent : (indentLevel + firstImportIndent) | (indent & ~SC_FOLDLEVELNUMBERMASK); } inline int IndentLevelRemoveIndentOffset(const int indentLevel) const { return indentLevel <= ((firstImportIndent - 1) + SC_FOLDLEVELBASE) ? indentLevel : indentLevel - firstImportIndent; } public: LexerHaskell(bool literate_) : DefaultLexer(literate_ ? "literatehaskell" : "haskell", literate_ ? SCLEX_LITERATEHASKELL : SCLEX_HASKELL) , literate(literate_) , firstImportLine(-1) , firstImportIndent(0) {} virtual ~LexerHaskell() {} void SCI_METHOD Release() override { delete this; } int SCI_METHOD Version() const override { return lvRelease5; } const char * SCI_METHOD PropertyNames() override { return osHaskell.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osHaskell.PropertyType(name); } const char * SCI_METHOD DescribeProperty(const char *name) override { return osHaskell.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char *key) override { return osHaskell.PropertyGet(key); } const char * SCI_METHOD DescribeWordListSets() override { return osHaskell.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return 0; } static ILexer5 *LexerFactoryHaskell() { return new LexerHaskell(false); } static ILexer5 *LexerFactoryLiterateHaskell() { return new LexerHaskell(true); } }; Sci_Position SCI_METHOD LexerHaskell::PropertySet(const char *key, const char *val) { if (osHaskell.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: wordListN = &keywords; break; case 1: wordListN = &ffi; break; case 2: wordListN = &reserved_operators; break; } Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); if (*wordListN != wlNew) { wordListN->Set(wl); firstModification = 0; } } return firstModification; } void SCI_METHOD LexerHaskell::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle ,IDocument *pAccess) { LexAccessor styler(pAccess); Sci_Position lineCurrent = styler.GetLine(startPos); HaskellLineInfo hs = HaskellLineInfo(lineCurrent ? styler.GetLineState(lineCurrent-1) : 0); // Do not leak onto next line if (initStyle == SCE_HA_STRINGEOL) initStyle = SCE_HA_DEFAULT; else if (initStyle == SCE_HA_LITERATE_CODEDELIM) initStyle = hs.nonexternalStyle; StyleContext sc(startPos, length, initStyle, styler); int base = 10; bool dot = false; bool inDashes = false; bool alreadyInTheMiddleOfOperator = false; assert(!(IsCommentBlockStyle(initStyle) && hs.nestLevel == 0)); while (sc.More()) { // Check for state end if (!IsExternalStyle(sc.state)) { hs.nonexternalStyle = sc.state; } // For lexer to work, states should unconditionally forward at least one // character. // If they don't, they should still check if they are at line end and // forward if so. // If a state forwards more than one character, it should check every time // that it is not a line end and cease forwarding otherwise. if (sc.atLineEnd) { // Remember the line state for future incremental lexing styler.SetLineState(lineCurrent, hs.ToLineState()); lineCurrent++; } // Handle line continuation generically. if (sc.ch == '\\' && (sc.chNext == '\n' || sc.chNext == '\r') && ( sc.state == SCE_HA_STRING || sc.state == SCE_HA_PREPROCESSOR)) { // Remember the line state for future incremental lexing styler.SetLineState(lineCurrent, hs.ToLineState()); lineCurrent++; sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } sc.Forward(); continue; } if (sc.atLineStart) { if (sc.state == SCE_HA_STRING || sc.state == SCE_HA_CHARACTER) { // Prevent SCE_HA_STRINGEOL from leaking back to previous line sc.SetState(sc.state); } if (literate && hs.lmode == LITERATE_BIRD) { if (!IsExternalStyle(sc.state)) { sc.SetState(SCE_HA_LITERATE_COMMENT); } } } // External // Literate if ( literate && hs.lmode == LITERATE_BIRD && sc.atLineStart && sc.ch == '>') { sc.SetState(SCE_HA_LITERATE_CODEDELIM); sc.ForwardSetState(hs.nonexternalStyle); } else if (literate && hs.lmode == LITERATE_BIRD && sc.atLineStart && ( sc.ch == ' ' || sc.ch == '\t' || sc.Match("\\begin{code}"))) { sc.SetState(sc.state); while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()) sc.Forward(); if (sc.Match("\\begin{code}")) { sc.Forward(static_cast(strlen("\\begin{code}"))); bool correct = true; while (!sc.atLineEnd && sc.More()) { if (sc.ch != ' ' && sc.ch != '\t') { correct = false; } sc.Forward(); } if (correct) { sc.ChangeState(SCE_HA_LITERATE_CODEDELIM); // color the line end hs.lmode = LITERATE_BLOCK; } } } else if (literate && hs.lmode == LITERATE_BLOCK && sc.atLineStart && sc.Match("\\end{code}")) { sc.SetState(SCE_HA_LITERATE_CODEDELIM); sc.Forward(static_cast(strlen("\\end{code}"))); while (!sc.atLineEnd && sc.More()) { sc.Forward(); } sc.SetState(SCE_HA_LITERATE_COMMENT); hs.lmode = LITERATE_BIRD; } // Preprocessor else if (sc.atLineStart && sc.ch == '#' && options.cpp && (!options.stylingWithinPreprocessor || sc.state == SCE_HA_DEFAULT)) { sc.SetState(SCE_HA_PREPROCESSOR); sc.Forward(); } // Literate else if (sc.state == SCE_HA_LITERATE_COMMENT) { sc.Forward(); } else if (sc.state == SCE_HA_LITERATE_CODEDELIM) { sc.ForwardSetState(hs.nonexternalStyle); } // Preprocessor else if (sc.state == SCE_HA_PREPROCESSOR) { if (sc.atLineEnd) { sc.SetState(options.stylingWithinPreprocessor ? SCE_HA_DEFAULT : hs.nonexternalStyle); sc.Forward(); // prevent double counting a line } else if (options.stylingWithinPreprocessor && !IsHaskellLetter(sc.ch)) { sc.SetState(SCE_HA_DEFAULT); } else { sc.Forward(); } } // Haskell // Operator else if (sc.state == SCE_HA_OPERATOR) { int style = SCE_HA_OPERATOR; if ( sc.ch == ':' && !alreadyInTheMiddleOfOperator // except "::" && !( sc.chNext == ':' && !IsAnHaskellOperatorChar(sc.GetRelative(2)))) { style = SCE_HA_CAPITAL; } alreadyInTheMiddleOfOperator = false; while (IsAnHaskellOperatorChar(sc.ch)) sc.Forward(); char s[100]; sc.GetCurrent(s, sizeof(s)); if (reserved_operators.InList(s)) style = SCE_HA_RESERVED_OPERATOR; sc.ChangeState(style); sc.SetState(SCE_HA_DEFAULT); } // String else if (sc.state == SCE_HA_STRING) { if (sc.atLineEnd) { sc.ChangeState(SCE_HA_STRINGEOL); sc.ForwardSetState(SCE_HA_DEFAULT); } else if (sc.ch == '\"') { sc.Forward(); skipMagicHash(sc, oneHash); sc.SetState(SCE_HA_DEFAULT); } else if (sc.ch == '\\') { sc.Forward(2); } else { sc.Forward(); } } // Char else if (sc.state == SCE_HA_CHARACTER) { if (sc.atLineEnd) { sc.ChangeState(SCE_HA_STRINGEOL); sc.ForwardSetState(SCE_HA_DEFAULT); } else if (sc.ch == '\'') { sc.Forward(); skipMagicHash(sc, oneHash); sc.SetState(SCE_HA_DEFAULT); } else if (sc.ch == '\\') { sc.Forward(2); } else { sc.Forward(); } } // Number else if (sc.state == SCE_HA_NUMBER) { if (sc.atLineEnd) { sc.SetState(SCE_HA_DEFAULT); sc.Forward(); // prevent double counting a line } else if (IsADigit(sc.ch, base)) { sc.Forward(); } else if (sc.ch=='.' && dot && IsADigit(sc.chNext, base)) { sc.Forward(2); dot = false; } else if ((base == 10) && (sc.ch == 'e' || sc.ch == 'E') && (IsADigit(sc.chNext) || sc.chNext == '+' || sc.chNext == '-')) { sc.Forward(); if (sc.ch == '+' || sc.ch == '-') sc.Forward(); } else { skipMagicHash(sc, twoHashes); sc.SetState(SCE_HA_DEFAULT); } } // Keyword or Identifier else if (sc.state == SCE_HA_IDENTIFIER) { int style = IsHaskellUpperCase(sc.ch) ? SCE_HA_CAPITAL : SCE_HA_IDENTIFIER; assert(IsAHaskellWordStart(sc.ch)); sc.Forward(); while (sc.More()) { if (IsAHaskellWordChar(sc.ch)) { sc.Forward(); } else if (sc.ch == '.' && style == SCE_HA_CAPITAL) { if (IsHaskellUpperCase(sc.chNext)) { sc.Forward(); style = SCE_HA_CAPITAL; } else if (IsAHaskellWordStart(sc.chNext)) { sc.Forward(); style = SCE_HA_IDENTIFIER; } else if (IsAnHaskellOperatorChar(sc.chNext)) { sc.Forward(); style = sc.ch == ':' ? SCE_HA_CAPITAL : SCE_HA_OPERATOR; while (IsAnHaskellOperatorChar(sc.ch)) sc.Forward(); break; } else { break; } } else { break; } } skipMagicHash(sc, unlimitedHashes); char s[100]; sc.GetCurrent(s, sizeof(s)); KeywordMode new_mode = HA_MODE_DEFAULT; if (keywords.InList(s)) { style = SCE_HA_KEYWORD; } else if (style == SCE_HA_CAPITAL) { if (hs.mode == HA_MODE_IMPORT1 || hs.mode == HA_MODE_IMPORT3) { style = SCE_HA_MODULE; new_mode = HA_MODE_IMPORT2; } else if (hs.mode == HA_MODE_MODULE) { style = SCE_HA_MODULE; } } else if (hs.mode == HA_MODE_IMPORT1 && strcmp(s,"qualified") == 0) { style = SCE_HA_KEYWORD; new_mode = HA_MODE_IMPORT1; } else if (options.highlightSafe && hs.mode == HA_MODE_IMPORT1 && strcmp(s,"safe") == 0) { style = SCE_HA_KEYWORD; new_mode = HA_MODE_IMPORT1; } else if (hs.mode == HA_MODE_IMPORT2) { if (strcmp(s,"as") == 0) { style = SCE_HA_KEYWORD; new_mode = HA_MODE_IMPORT3; } else if (strcmp(s,"hiding") == 0) { style = SCE_HA_KEYWORD; } } else if (hs.mode == HA_MODE_TYPE) { if (strcmp(s,"family") == 0) style = SCE_HA_KEYWORD; } if (hs.mode == HA_MODE_FFI) { if (ffi.InList(s)) { style = SCE_HA_KEYWORD; new_mode = HA_MODE_FFI; } } sc.ChangeState(style); sc.SetState(SCE_HA_DEFAULT); if (strcmp(s,"import") == 0 && hs.mode != HA_MODE_FFI) new_mode = HA_MODE_IMPORT1; else if (strcmp(s,"module") == 0) new_mode = HA_MODE_MODULE; else if (strcmp(s,"foreign") == 0) new_mode = HA_MODE_FFI; else if (strcmp(s,"type") == 0 || strcmp(s,"data") == 0) new_mode = HA_MODE_TYPE; hs.mode = new_mode; } // Comments // Oneliner else if (sc.state == SCE_HA_COMMENTLINE) { if (sc.atLineEnd) { sc.SetState(hs.pragma ? SCE_HA_PRAGMA : SCE_HA_DEFAULT); sc.Forward(); // prevent double counting a line } else if (inDashes && sc.ch != '-' && !hs.pragma) { inDashes = false; if (IsAnHaskellOperatorChar(sc.ch)) { alreadyInTheMiddleOfOperator = true; sc.ChangeState(SCE_HA_OPERATOR); } } else { sc.Forward(); } } // Nested else if (IsCommentBlockStyle(sc.state)) { if (sc.Match('{','-')) { sc.SetState(CommentBlockStyleFromNestLevel(hs.nestLevel)); sc.Forward(2); hs.nestLevel++; } else if (sc.Match('-','}')) { sc.Forward(2); assert(hs.nestLevel > 0); if (hs.nestLevel > 0) hs.nestLevel--; sc.SetState( hs.nestLevel == 0 ? (hs.pragma ? SCE_HA_PRAGMA : SCE_HA_DEFAULT) : CommentBlockStyleFromNestLevel(hs.nestLevel - 1)); } else { sc.Forward(); } } // Pragma else if (sc.state == SCE_HA_PRAGMA) { if (sc.Match("#-}")) { hs.pragma = false; sc.Forward(3); sc.SetState(SCE_HA_DEFAULT); } else if (sc.Match('-','-')) { sc.SetState(SCE_HA_COMMENTLINE); sc.Forward(2); inDashes = false; } else if (sc.Match('{','-')) { sc.SetState(CommentBlockStyleFromNestLevel(hs.nestLevel)); sc.Forward(2); hs.nestLevel = 1; } else { sc.Forward(); } } // New state? else if (sc.state == SCE_HA_DEFAULT) { // Digit if (IsADigit(sc.ch)) { hs.mode = HA_MODE_DEFAULT; sc.SetState(SCE_HA_NUMBER); if (sc.ch == '0' && (sc.chNext == 'X' || sc.chNext == 'x')) { // Match anything starting with "0x" or "0X", too sc.Forward(2); base = 16; dot = false; } else if (sc.ch == '0' && (sc.chNext == 'O' || sc.chNext == 'o')) { // Match anything starting with "0o" or "0O", too sc.Forward(2); base = 8; dot = false; } else { sc.Forward(); base = 10; dot = true; } } // Pragma else if (sc.Match("{-#")) { hs.pragma = true; sc.SetState(SCE_HA_PRAGMA); sc.Forward(3); } // Comment line else if (sc.Match('-','-')) { sc.SetState(SCE_HA_COMMENTLINE); sc.Forward(2); inDashes = true; } // Comment block else if (sc.Match('{','-')) { sc.SetState(CommentBlockStyleFromNestLevel(hs.nestLevel)); sc.Forward(2); hs.nestLevel = 1; } // String else if (sc.ch == '\"') { sc.SetState(SCE_HA_STRING); sc.Forward(); } // Character or quoted name or promoted term else if (sc.ch == '\'') { hs.mode = HA_MODE_DEFAULT; sc.SetState(SCE_HA_CHARACTER); sc.Forward(); if (options.allowQuotes) { // Quoted type ''T if (sc.ch=='\'' && IsAHaskellWordStart(sc.chNext)) { sc.Forward(); sc.ChangeState(SCE_HA_IDENTIFIER); } else if (sc.chNext != '\'') { // Quoted name 'n or promoted constructor 'N if (IsAHaskellWordStart(sc.ch)) { sc.ChangeState(SCE_HA_IDENTIFIER); // Promoted constructor operator ':~> } else if (sc.ch == ':') { alreadyInTheMiddleOfOperator = false; sc.ChangeState(SCE_HA_OPERATOR); // Promoted list or tuple '[T] } else if (sc.ch == '[' || sc.ch== '(') { sc.ChangeState(SCE_HA_OPERATOR); sc.ForwardSetState(SCE_HA_DEFAULT); } } } } // Operator starting with '?' or an implicit parameter else if (sc.ch == '?') { hs.mode = HA_MODE_DEFAULT; alreadyInTheMiddleOfOperator = false; sc.SetState(SCE_HA_OPERATOR); if ( options.implicitParams && IsAHaskellWordStart(sc.chNext) && !IsHaskellUpperCase(sc.chNext)) { sc.Forward(); sc.ChangeState(SCE_HA_IDENTIFIER); } } // Operator else if (IsAnHaskellOperatorChar(sc.ch)) { hs.mode = HA_MODE_DEFAULT; sc.SetState(SCE_HA_OPERATOR); } // Braces and punctuation else if (sc.ch == ',' || sc.ch == ';' || sc.ch == '(' || sc.ch == ')' || sc.ch == '[' || sc.ch == ']' || sc.ch == '{' || sc.ch == '}') { sc.SetState(SCE_HA_OPERATOR); sc.ForwardSetState(SCE_HA_DEFAULT); } // Keyword or Identifier else if (IsAHaskellWordStart(sc.ch)) { sc.SetState(SCE_HA_IDENTIFIER); // Something we don't care about } else { sc.Forward(); } } // This branch should never be reached. else { assert(false); sc.Forward(); } } sc.Complete(); } void SCI_METHOD LexerHaskell::Fold(Sci_PositionU startPos, Sci_Position length, int // initStyle ,IDocument *pAccess) { if (!options.fold) return; Accessor styler(pAccess, NULL); Sci_Position lineCurrent = styler.GetLine(startPos); if (lineCurrent <= firstImportLine) { firstImportLine = -1; // readjust first import position firstImportIndent = 0; } const Sci_Position maxPos = startPos + length; const Sci_Position maxLines = maxPos == styler.Length() ? styler.GetLine(maxPos) : styler.GetLine(maxPos - 1); // Requested last line const Sci_Position docLines = styler.GetLine(styler.Length()); // Available last line // Backtrack to previous non-blank line so we can determine indent level // for any white space lines // and so we can fix any preceding fold level (which is why we go back // at least one line in all cases) bool importHere = LineContainsImport(lineCurrent, styler); int indentCurrent = IndentAmountWithOffset(styler, lineCurrent); while (lineCurrent > 0) { lineCurrent--; importHere = LineContainsImport(lineCurrent, styler); indentCurrent = IndentAmountWithOffset(styler, lineCurrent); if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) break; } int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; if (importHere) { indentCurrentLevel = IndentLevelRemoveIndentOffset(indentCurrentLevel); if (firstImportLine == -1) { firstImportLine = lineCurrent; firstImportIndent = (1 + indentCurrentLevel) - SC_FOLDLEVELBASE; } if (firstImportLine != lineCurrent) { indentCurrentLevel++; } } indentCurrent = indentCurrentLevel | (indentCurrent & ~SC_FOLDLEVELNUMBERMASK); // Process all characters to end of requested range //that hangs over the end of the range. Cap processing in all cases // to end of document. while (lineCurrent <= docLines && lineCurrent <= maxLines) { // Gather info Sci_Position lineNext = lineCurrent + 1; importHere = false; int indentNext = indentCurrent; if (lineNext <= docLines) { // Information about next line is only available if not at end of document importHere = LineContainsImport(lineNext, styler); indentNext = IndentAmountWithOffset(styler, lineNext); } if (indentNext & SC_FOLDLEVELWHITEFLAG) indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel; // Skip past any blank lines for next indent level info; we skip also // comments (all comments, not just those starting in column 0) // which effectively folds them into surrounding code rather // than screwing up folding. while (lineNext < docLines && (indentNext & SC_FOLDLEVELWHITEFLAG)) { lineNext++; importHere = LineContainsImport(lineNext, styler); indentNext = IndentAmountWithOffset(styler, lineNext); } int indentNextLevel = indentNext & SC_FOLDLEVELNUMBERMASK; if (importHere) { indentNextLevel = IndentLevelRemoveIndentOffset(indentNextLevel); if (firstImportLine == -1) { firstImportLine = lineNext; firstImportIndent = (1 + indentNextLevel) - SC_FOLDLEVELBASE; } if (firstImportLine != lineNext) { indentNextLevel++; } } indentNext = indentNextLevel | (indentNext & ~SC_FOLDLEVELNUMBERMASK); const int levelBeforeComments = Maximum(indentCurrentLevel,indentNextLevel); // Now set all the indent levels on the lines we skipped // Do this from end to start. Once we encounter one line // which is indented more than the line after the end of // the comment-block, use the level of the block before Sci_Position skipLine = lineNext; int skipLevel = indentNextLevel; while (--skipLine > lineCurrent) { int skipLineIndent = IndentAmountWithOffset(styler, skipLine); if (options.foldCompact) { if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > indentNextLevel) { skipLevel = levelBeforeComments; } int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; styler.SetLevel(skipLine, skipLevel | whiteFlag); } else { if ( (skipLineIndent & SC_FOLDLEVELNUMBERMASK) > indentNextLevel && !(skipLineIndent & SC_FOLDLEVELWHITEFLAG)) { skipLevel = levelBeforeComments; } styler.SetLevel(skipLine, skipLevel); } } int lev = indentCurrent; if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) lev |= SC_FOLDLEVELHEADERFLAG; } // Set fold level for this line and move to next line styler.SetLevel(lineCurrent, options.foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG); indentCurrent = indentNext; indentCurrentLevel = indentNextLevel; lineCurrent = lineNext; } // NOTE: Cannot set level of last line here because indentCurrent doesn't have // header flag set; the loop above is crafted to take care of this case! //styler.SetLevel(lineCurrent, indentCurrent); } LexerModule lmHaskell(SCLEX_HASKELL, LexerHaskell::LexerFactoryHaskell, "haskell", haskellWordListDesc); LexerModule lmLiterateHaskell(SCLEX_LITERATEHASKELL, LexerHaskell::LexerFactoryLiterateHaskell, "literatehaskell", haskellWordListDesc); ================================================ FILE: lexilla/lexers/LexHex.cxx ================================================ // Scintilla source code edit control /** @file LexHex.cxx ** Lexers for Motorola S-Record, Intel HEX and Tektronix extended HEX. ** ** Written by Markus Heidelberg **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. /* * Motorola S-Record * =============================== * * Each record (line) is built as follows: * * field digits states * * +----------+ * | start | 1 ('S') SCE_HEX_RECSTART * +----------+ * | type | 1 SCE_HEX_RECTYPE, (SCE_HEX_RECTYPE_UNKNOWN) * +----------+ * | count | 2 SCE_HEX_BYTECOUNT, SCE_HEX_BYTECOUNT_WRONG * +----------+ * | address | 4/6/8 SCE_HEX_NOADDRESS, SCE_HEX_DATAADDRESS, SCE_HEX_RECCOUNT, SCE_HEX_STARTADDRESS, (SCE_HEX_ADDRESSFIELD_UNKNOWN) * +----------+ * | data | 0..504/502/500 SCE_HEX_DATA_ODD, SCE_HEX_DATA_EVEN, SCE_HEX_DATA_EMPTY, (SCE_HEX_DATA_UNKNOWN) * +----------+ * | checksum | 2 SCE_HEX_CHECKSUM, SCE_HEX_CHECKSUM_WRONG * +----------+ * * * Intel HEX * =============================== * * Each record (line) is built as follows: * * field digits states * * +----------+ * | start | 1 (':') SCE_HEX_RECSTART * +----------+ * | count | 2 SCE_HEX_BYTECOUNT, SCE_HEX_BYTECOUNT_WRONG * +----------+ * | address | 4 SCE_HEX_NOADDRESS, SCE_HEX_DATAADDRESS, (SCE_HEX_ADDRESSFIELD_UNKNOWN) * +----------+ * | type | 2 SCE_HEX_RECTYPE, (SCE_HEX_RECTYPE_UNKNOWN) * +----------+ * | data | 0..510 SCE_HEX_DATA_ODD, SCE_HEX_DATA_EVEN, SCE_HEX_DATA_EMPTY, SCE_HEX_EXTENDEDADDRESS, SCE_HEX_STARTADDRESS, (SCE_HEX_DATA_UNKNOWN) * +----------+ * | checksum | 2 SCE_HEX_CHECKSUM, SCE_HEX_CHECKSUM_WRONG * +----------+ * * * Folding: * * Data records (type 0x00), which follow an extended address record (type * 0x02 or 0x04), can be folded. The extended address record is the fold * point at fold level 0, the corresponding data records are set to level 1. * * Any record, which is not a data record, sets the fold level back to 0. * Any line, which is not a record (blank lines and lines starting with a * character other than ':'), leaves the fold level unchanged. * * * Tektronix extended HEX * =============================== * * Each record (line) is built as follows: * * field digits states * * +----------+ * | start | 1 ('%') SCE_HEX_RECSTART * +----------+ * | length | 2 SCE_HEX_BYTECOUNT, SCE_HEX_BYTECOUNT_WRONG * +----------+ * | type | 1 SCE_HEX_RECTYPE, (SCE_HEX_RECTYPE_UNKNOWN) * +----------+ * | checksum | 2 SCE_HEX_CHECKSUM, SCE_HEX_CHECKSUM_WRONG * +----------+ * | address | 9 SCE_HEX_DATAADDRESS, SCE_HEX_STARTADDRESS, (SCE_HEX_ADDRESSFIELD_UNKNOWN) * +----------+ * | data | 0..241 SCE_HEX_DATA_ODD, SCE_HEX_DATA_EVEN * +----------+ * * * General notes for all lexers * =============================== * * - Depending on where the helper functions are invoked, some of them have to * read beyond the current position. In case of malformed data (record too * short), it has to be ensured that this either does not have bad influence * or will be captured deliberately. * * - States in parentheses in the upper format descriptions indicate that they * should not appear in a valid hex file. * * - State SCE_HEX_GARBAGE means garbage data after the intended end of the * record, the line is too long then. This state is used in all lexers. */ #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; // prototypes for general helper functions static inline bool IsNewline(const int ch); static int GetHexaNibble(char hd); static int GetHexaChar(char hd1, char hd2); static int GetHexaChar(Sci_PositionU pos, Accessor &styler); static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb = 1); static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler); static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler); static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler); // prototypes for file format specific helper functions static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler); static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler); static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler); static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler); static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler); static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler); static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler); static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler); static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler); static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler); static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler); static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler); static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler); static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler); static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler); static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler); static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler); static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler); static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler); static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler); static inline bool IsNewline(const int ch) { return (ch == '\n' || ch == '\r'); } static int GetHexaNibble(char hd) { int hexValue = 0; if (hd >= '0' && hd <= '9') { hexValue += hd - '0'; } else if (hd >= 'A' && hd <= 'F') { hexValue += hd - 'A' + 10; } else if (hd >= 'a' && hd <= 'f') { hexValue += hd - 'a' + 10; } else { return -1; } return hexValue; } static int GetHexaChar(char hd1, char hd2) { int hexValue = 0; if (hd1 >= '0' && hd1 <= '9') { hexValue += 16 * (hd1 - '0'); } else if (hd1 >= 'A' && hd1 <= 'F') { hexValue += 16 * (hd1 - 'A' + 10); } else if (hd1 >= 'a' && hd1 <= 'f') { hexValue += 16 * (hd1 - 'a' + 10); } else { return -1; } if (hd2 >= '0' && hd2 <= '9') { hexValue += hd2 - '0'; } else if (hd2 >= 'A' && hd2 <= 'F') { hexValue += hd2 - 'A' + 10; } else if (hd2 >= 'a' && hd2 <= 'f') { hexValue += hd2 - 'a' + 10; } else { return -1; } return hexValue; } static int GetHexaChar(Sci_PositionU pos, Accessor &styler) { char highNibble, lowNibble; highNibble = styler.SafeGetCharAt(pos); lowNibble = styler.SafeGetCharAt(pos + 1); return GetHexaChar(highNibble, lowNibble); } // Forward characters, but abort (and return false) if hitting the line // end. Return true if forwarding within the line was possible. // Avoids influence on highlighting of the subsequent line if the current line // is malformed (too short). static bool ForwardWithinLine(StyleContext &sc, Sci_Position nb) { for (Sci_Position i = 0; i < nb; i++) { if (sc.atLineEnd) { // line is too short sc.SetState(SCE_HEX_DEFAULT); sc.Forward(); return false; } else { sc.Forward(); } } return true; } // Checks whether the given positions are in the same record. static bool PosInSameRecord(Sci_PositionU pos1, Sci_PositionU pos2, Accessor &styler) { return styler.GetLine(pos1) == styler.GetLine(pos2); } // Count the number of digit pairs from till end of record, ignoring // digits. // If the record is too short, a negative count may be returned. static Sci_Position CountByteCount(Sci_PositionU startPos, Sci_Position uncountedDigits, Accessor &styler) { Sci_Position cnt; Sci_PositionU pos; pos = startPos; while (!IsNewline(styler.SafeGetCharAt(pos, '\n'))) { pos++; } // number of digits in this line minus number of digits of uncounted fields cnt = static_cast(pos - startPos) - uncountedDigits; // Prepare round up if odd (digit pair incomplete), this way the byte // count is considered to be valid if the checksum is incomplete. if (cnt >= 0) { cnt++; } // digit pairs cnt /= 2; return cnt; } // Calculate the checksum of the record. // is the position of the first character of the starting digit // pair, is the number of digit pairs. static int CalcChecksum(Sci_PositionU startPos, Sci_Position cnt, bool twosCompl, Accessor &styler) { int cs = 0; for (Sci_PositionU pos = startPos; pos < startPos + cnt; pos += 2) { int val = GetHexaChar(pos, styler); if (val < 0) { return val; } // overflow does not matter cs += val; } if (twosCompl) { // low byte of two's complement return -cs & 0xFF; } else { // low byte of one's complement return ~cs & 0xFF; } } // Get the position of the record "start" field (first character in line) in // the record around position . static Sci_PositionU GetSrecRecStartPosition(Sci_PositionU pos, Accessor &styler) { while (styler.SafeGetCharAt(pos) != 'S') { pos--; } return pos; } // Get the value of the "byte count" field, it counts the number of bytes in // the subsequent fields ("address", "data" and "checksum" fields). static int GetSrecByteCount(Sci_PositionU recStartPos, Accessor &styler) { int val; val = GetHexaChar(recStartPos + 2, styler); if (val < 0) { val = 0; } return val; } // Count the number of digit pairs for the "address", "data" and "checksum" // fields in this record. Has to be equal to the "byte count" field value. // If the record is too short, a negative count may be returned. static Sci_Position CountSrecByteCount(Sci_PositionU recStartPos, Accessor &styler) { return CountByteCount(recStartPos, 4, styler); } // Get the size of the "address" field. static int GetSrecAddressFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': case '1': case '5': case '9': return 2; // 16 bit case '2': case '6': case '8': return 3; // 24 bit case '3': case '7': return 4; // 32 bit default: return 0; } } // Get the type of the "address" field content. static int GetSrecAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': return SCE_HEX_NOADDRESS; case '1': case '2': case '3': return SCE_HEX_DATAADDRESS; case '5': case '6': return SCE_HEX_RECCOUNT; case '7': case '8': case '9': return SCE_HEX_STARTADDRESS; default: // handle possible format extension in the future return SCE_HEX_ADDRESSFIELD_UNKNOWN; } } // Get the type of the "data" field content. static int GetSrecDataFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '0': case '1': case '2': case '3': return SCE_HEX_DATA_ODD; case '5': case '6': case '7': case '8': case '9': return SCE_HEX_DATA_EMPTY; default: // handle possible format extension in the future return SCE_HEX_DATA_UNKNOWN; } } // Get the required size of the "data" field. Useless for block header and // ordinary data records (type S0, S1, S2, S3), return the value calculated // from the "byte count" and "address field" size in this case. static Sci_Position GetSrecRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 1)) { case '5': case '6': case '7': case '8': case '9': return 0; default: return GetSrecByteCount(recStartPos, styler) - GetSrecAddressFieldSize(recStartPos, styler) - 1; // -1 for checksum field } } // Get the value of the "checksum" field. static int GetSrecChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; byteCount = GetSrecByteCount(recStartPos, styler); return GetHexaChar(recStartPos + 2 + byteCount * 2, styler); } // Calculate the checksum of the record. static int CalcSrecChecksum(Sci_PositionU recStartPos, Accessor &styler) { Sci_Position byteCount; byteCount = GetSrecByteCount(recStartPos, styler); // sum over "byte count", "address" and "data" fields (6..510 digits) return CalcChecksum(recStartPos + 2, byteCount * 2, false, styler); } // Get the position of the record "start" field (first character in line) in // the record around position . static Sci_PositionU GetIHexRecStartPosition(Sci_PositionU pos, Accessor &styler) { while (styler.SafeGetCharAt(pos) != ':') { pos--; } return pos; } // Get the value of the "byte count" field, it counts the number of bytes in // the "data" field. static int GetIHexByteCount(Sci_PositionU recStartPos, Accessor &styler) { int val; val = GetHexaChar(recStartPos + 1, styler); if (val < 0) { val = 0; } return val; } // Count the number of digit pairs for the "data" field in this record. Has to // be equal to the "byte count" field value. // If the record is too short, a negative count may be returned. static Sci_Position CountIHexByteCount(Sci_PositionU recStartPos, Accessor &styler) { return CountByteCount(recStartPos, 11, styler); } // Get the type of the "address" field content. static int GetIHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { if (!PosInSameRecord(recStartPos, recStartPos + 7, styler)) { // malformed (record too short) // type cannot be determined return SCE_HEX_ADDRESSFIELD_UNKNOWN; } switch (GetHexaChar(recStartPos + 7, styler)) { case 0x00: return SCE_HEX_DATAADDRESS; case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: return SCE_HEX_NOADDRESS; default: // handle possible format extension in the future return SCE_HEX_ADDRESSFIELD_UNKNOWN; } } // Get the type of the "data" field content. static int GetIHexDataFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (GetHexaChar(recStartPos + 7, styler)) { case 0x00: return SCE_HEX_DATA_ODD; case 0x01: return SCE_HEX_DATA_EMPTY; case 0x02: case 0x04: return SCE_HEX_EXTENDEDADDRESS; case 0x03: case 0x05: return SCE_HEX_STARTADDRESS; default: // handle possible format extension in the future return SCE_HEX_DATA_UNKNOWN; } } // Get the required size of the "data" field. Useless for an ordinary data // record (type 00), return the "byte count" in this case. static int GetIHexRequiredDataFieldSize(Sci_PositionU recStartPos, Accessor &styler) { switch (GetHexaChar(recStartPos + 7, styler)) { case 0x01: return 0; case 0x02: case 0x04: return 2; case 0x03: case 0x05: return 4; default: return GetIHexByteCount(recStartPos, styler); } } // Get the value of the "checksum" field. static int GetIHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; byteCount = GetIHexByteCount(recStartPos, styler); return GetHexaChar(recStartPos + 9 + byteCount * 2, styler); } // Calculate the checksum of the record. static int CalcIHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { int byteCount; byteCount = GetIHexByteCount(recStartPos, styler); // sum over "byte count", "address", "type" and "data" fields (8..518 digits) return CalcChecksum(recStartPos + 1, 8 + byteCount * 2, true, styler); } // Get the value of the "record length" field, it counts the number of digits in // the record excluding the percent. static int GetTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler) { int val = GetHexaChar(recStartPos + 1, styler); if (val < 0) val = 0; return val; } // Count the number of digits in this record. Has to // be equal to the "record length" field value. static Sci_Position CountTEHexDigitCount(Sci_PositionU recStartPos, Accessor &styler) { Sci_PositionU pos; pos = recStartPos+1; while (!IsNewline(styler.SafeGetCharAt(pos, '\n'))) { pos++; } return static_cast(pos - (recStartPos+1)); } // Get the type of the "address" field content. static int GetTEHexAddressFieldType(Sci_PositionU recStartPos, Accessor &styler) { switch (styler.SafeGetCharAt(recStartPos + 3)) { case '6': return SCE_HEX_DATAADDRESS; case '8': return SCE_HEX_STARTADDRESS; default: // handle possible format extension in the future return SCE_HEX_ADDRESSFIELD_UNKNOWN; } } // Get the value of the "checksum" field. static int GetTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { return GetHexaChar(recStartPos+4, styler); } // Calculate the checksum of the record (excluding the checksum field). static int CalcTEHexChecksum(Sci_PositionU recStartPos, Accessor &styler) { Sci_PositionU pos = recStartPos +1; Sci_PositionU length = GetTEHexDigitCount(recStartPos, styler); int cs = GetHexaNibble(styler.SafeGetCharAt(pos++));//length cs += GetHexaNibble(styler.SafeGetCharAt(pos++));//length cs += GetHexaNibble(styler.SafeGetCharAt(pos++));//type pos += 2;// jump over CS field for (; pos <= recStartPos + length; ++pos) { int val = GetHexaNibble(styler.SafeGetCharAt(pos)); if (val < 0) { return val; } // overflow does not matter cs += val; } // low byte return cs & 0xFF; } static void ColouriseSrecDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { Sci_PositionU recStartPos; Sci_Position reqByteCount; Sci_Position dataFieldSize; int byteCount, addrFieldSize, addrFieldType, dataFieldType; int cs1, cs2; switch (sc.state) { case SCE_HEX_DEFAULT: if (sc.atLineStart && sc.Match('S')) { sc.SetState(SCE_HEX_RECSTART); } ForwardWithinLine(sc); break; case SCE_HEX_RECSTART: recStartPos = sc.currentPos - 1; addrFieldType = GetSrecAddressFieldType(recStartPos, styler); if (addrFieldType == SCE_HEX_ADDRESSFIELD_UNKNOWN) { sc.SetState(SCE_HEX_RECTYPE_UNKNOWN); } else { sc.SetState(SCE_HEX_RECTYPE); } ForwardWithinLine(sc); break; case SCE_HEX_RECTYPE: case SCE_HEX_RECTYPE_UNKNOWN: recStartPos = sc.currentPos - 2; byteCount = GetSrecByteCount(recStartPos, styler); reqByteCount = GetSrecAddressFieldSize(recStartPos, styler) + GetSrecRequiredDataFieldSize(recStartPos, styler) + 1; // +1 for checksum field if (byteCount == CountSrecByteCount(recStartPos, styler) && byteCount == reqByteCount) { sc.SetState(SCE_HEX_BYTECOUNT); } else { sc.SetState(SCE_HEX_BYTECOUNT_WRONG); } ForwardWithinLine(sc, 2); break; case SCE_HEX_BYTECOUNT: case SCE_HEX_BYTECOUNT_WRONG: recStartPos = sc.currentPos - 4; addrFieldSize = GetSrecAddressFieldSize(recStartPos, styler); addrFieldType = GetSrecAddressFieldType(recStartPos, styler); sc.SetState(addrFieldType); ForwardWithinLine(sc, addrFieldSize * 2); break; case SCE_HEX_NOADDRESS: case SCE_HEX_DATAADDRESS: case SCE_HEX_RECCOUNT: case SCE_HEX_STARTADDRESS: case SCE_HEX_ADDRESSFIELD_UNKNOWN: recStartPos = GetSrecRecStartPosition(sc.currentPos, styler); dataFieldType = GetSrecDataFieldType(recStartPos, styler); // Using the required size here if possible has the effect that the // checksum is highlighted at a fixed position after this field for // specific record types, independent on the "byte count" value. dataFieldSize = GetSrecRequiredDataFieldSize(recStartPos, styler); sc.SetState(dataFieldType); if (dataFieldType == SCE_HEX_DATA_ODD) { for (int i = 0; i < dataFieldSize * 2; i++) { if ((i & 0x3) == 0) { sc.SetState(SCE_HEX_DATA_ODD); } else if ((i & 0x3) == 2) { sc.SetState(SCE_HEX_DATA_EVEN); } if (!ForwardWithinLine(sc)) { break; } } } else { ForwardWithinLine(sc, dataFieldSize * 2); } break; case SCE_HEX_DATA_ODD: case SCE_HEX_DATA_EVEN: case SCE_HEX_DATA_EMPTY: case SCE_HEX_DATA_UNKNOWN: recStartPos = GetSrecRecStartPosition(sc.currentPos, styler); cs1 = CalcSrecChecksum(recStartPos, styler); cs2 = GetSrecChecksum(recStartPos, styler); if (cs1 != cs2 || cs1 < 0 || cs2 < 0) { sc.SetState(SCE_HEX_CHECKSUM_WRONG); } else { sc.SetState(SCE_HEX_CHECKSUM); } ForwardWithinLine(sc, 2); break; case SCE_HEX_CHECKSUM: case SCE_HEX_CHECKSUM_WRONG: case SCE_HEX_GARBAGE: // record finished or line too long sc.SetState(SCE_HEX_GARBAGE); ForwardWithinLine(sc); break; default: // prevent endless loop in faulty state sc.SetState(SCE_HEX_DEFAULT); break; } } sc.Complete(); } static void ColouriseIHexDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { Sci_PositionU recStartPos; int byteCount, addrFieldType, dataFieldSize, dataFieldType; int cs1, cs2; switch (sc.state) { case SCE_HEX_DEFAULT: if (sc.atLineStart && sc.Match(':')) { sc.SetState(SCE_HEX_RECSTART); } ForwardWithinLine(sc); break; case SCE_HEX_RECSTART: recStartPos = sc.currentPos - 1; byteCount = GetIHexByteCount(recStartPos, styler); dataFieldSize = GetIHexRequiredDataFieldSize(recStartPos, styler); if (byteCount == CountIHexByteCount(recStartPos, styler) && byteCount == dataFieldSize) { sc.SetState(SCE_HEX_BYTECOUNT); } else { sc.SetState(SCE_HEX_BYTECOUNT_WRONG); } ForwardWithinLine(sc, 2); break; case SCE_HEX_BYTECOUNT: case SCE_HEX_BYTECOUNT_WRONG: recStartPos = sc.currentPos - 3; addrFieldType = GetIHexAddressFieldType(recStartPos, styler); sc.SetState(addrFieldType); ForwardWithinLine(sc, 4); break; case SCE_HEX_NOADDRESS: case SCE_HEX_DATAADDRESS: case SCE_HEX_ADDRESSFIELD_UNKNOWN: recStartPos = sc.currentPos - 7; addrFieldType = GetIHexAddressFieldType(recStartPos, styler); if (addrFieldType == SCE_HEX_ADDRESSFIELD_UNKNOWN) { sc.SetState(SCE_HEX_RECTYPE_UNKNOWN); } else { sc.SetState(SCE_HEX_RECTYPE); } ForwardWithinLine(sc, 2); break; case SCE_HEX_RECTYPE: case SCE_HEX_RECTYPE_UNKNOWN: recStartPos = sc.currentPos - 9; dataFieldType = GetIHexDataFieldType(recStartPos, styler); // Using the required size here if possible has the effect that the // checksum is highlighted at a fixed position after this field for // specific record types, independent on the "byte count" value. dataFieldSize = GetIHexRequiredDataFieldSize(recStartPos, styler); sc.SetState(dataFieldType); if (dataFieldType == SCE_HEX_DATA_ODD) { for (int i = 0; i < dataFieldSize * 2; i++) { if ((i & 0x3) == 0) { sc.SetState(SCE_HEX_DATA_ODD); } else if ((i & 0x3) == 2) { sc.SetState(SCE_HEX_DATA_EVEN); } if (!ForwardWithinLine(sc)) { break; } } } else { ForwardWithinLine(sc, dataFieldSize * 2); } break; case SCE_HEX_DATA_ODD: case SCE_HEX_DATA_EVEN: case SCE_HEX_DATA_EMPTY: case SCE_HEX_EXTENDEDADDRESS: case SCE_HEX_STARTADDRESS: case SCE_HEX_DATA_UNKNOWN: recStartPos = GetIHexRecStartPosition(sc.currentPos, styler); cs1 = CalcIHexChecksum(recStartPos, styler); cs2 = GetIHexChecksum(recStartPos, styler); if (cs1 != cs2 || cs1 < 0 || cs2 < 0) { sc.SetState(SCE_HEX_CHECKSUM_WRONG); } else { sc.SetState(SCE_HEX_CHECKSUM); } ForwardWithinLine(sc, 2); break; case SCE_HEX_CHECKSUM: case SCE_HEX_CHECKSUM_WRONG: case SCE_HEX_GARBAGE: // record finished or line too long sc.SetState(SCE_HEX_GARBAGE); ForwardWithinLine(sc); break; default: // prevent endless loop in faulty state sc.SetState(SCE_HEX_DEFAULT); break; } } sc.Complete(); } static void FoldIHexDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { Sci_PositionU endPos = startPos + length; Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent - 1); Sci_PositionU lineStartNext = styler.LineStart(lineCurrent + 1); int levelNext = SC_FOLDLEVELBASE; // default if no specific line found for (Sci_PositionU i = startPos; i < endPos; i++) { bool atEOL = i == (lineStartNext - 1); int style = styler.StyleAt(i); // search for specific lines if (style == SCE_HEX_EXTENDEDADDRESS) { // extended addres record levelNext = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; } else if (style == SCE_HEX_DATAADDRESS || (style == SCE_HEX_DEFAULT && i == (Sci_PositionU)styler.LineStart(lineCurrent))) { // data record or no record start code at all if (levelCurrent & SC_FOLDLEVELHEADERFLAG) { levelNext = SC_FOLDLEVELBASE + 1; } else { // continue level 0 or 1, no fold point levelNext = levelCurrent; } } if (atEOL || (i == endPos - 1)) { styler.SetLevel(lineCurrent, levelNext); lineCurrent++; lineStartNext = styler.LineStart(lineCurrent + 1); levelCurrent = levelNext; levelNext = SC_FOLDLEVELBASE; } } } static void ColouriseTEHexDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { StyleContext sc(startPos, length, initStyle, styler); while (sc.More()) { Sci_PositionU recStartPos; int digitCount, addrFieldType; int cs1, cs2; switch (sc.state) { case SCE_HEX_DEFAULT: if (sc.atLineStart && sc.Match('%')) { sc.SetState(SCE_HEX_RECSTART); } ForwardWithinLine(sc); break; case SCE_HEX_RECSTART: recStartPos = sc.currentPos - 1; if (GetTEHexDigitCount(recStartPos, styler) == CountTEHexDigitCount(recStartPos, styler)) { sc.SetState(SCE_HEX_BYTECOUNT); } else { sc.SetState(SCE_HEX_BYTECOUNT_WRONG); } ForwardWithinLine(sc, 2); break; case SCE_HEX_BYTECOUNT: case SCE_HEX_BYTECOUNT_WRONG: recStartPos = sc.currentPos - 3; addrFieldType = GetTEHexAddressFieldType(recStartPos, styler); if (addrFieldType == SCE_HEX_ADDRESSFIELD_UNKNOWN) { sc.SetState(SCE_HEX_RECTYPE_UNKNOWN); } else { sc.SetState(SCE_HEX_RECTYPE); } ForwardWithinLine(sc); break; case SCE_HEX_RECTYPE: case SCE_HEX_RECTYPE_UNKNOWN: recStartPos = sc.currentPos - 4; cs1 = CalcTEHexChecksum(recStartPos, styler); cs2 = GetTEHexChecksum(recStartPos, styler); if (cs1 != cs2 || cs1 < 0 || cs2 < 0) { sc.SetState(SCE_HEX_CHECKSUM_WRONG); } else { sc.SetState(SCE_HEX_CHECKSUM); } ForwardWithinLine(sc, 2); break; case SCE_HEX_CHECKSUM: case SCE_HEX_CHECKSUM_WRONG: recStartPos = sc.currentPos - 6; addrFieldType = GetTEHexAddressFieldType(recStartPos, styler); sc.SetState(addrFieldType); ForwardWithinLine(sc, 9); break; case SCE_HEX_DATAADDRESS: case SCE_HEX_STARTADDRESS: case SCE_HEX_ADDRESSFIELD_UNKNOWN: recStartPos = sc.currentPos - 15; digitCount = GetTEHexDigitCount(recStartPos, styler) - 14; sc.SetState(SCE_HEX_DATA_ODD); for (int i = 0; i < digitCount; i++) { if ((i & 0x3) == 0) { sc.SetState(SCE_HEX_DATA_ODD); } else if ((i & 0x3) == 2) { sc.SetState(SCE_HEX_DATA_EVEN); } if (!ForwardWithinLine(sc)) { break; } } break; case SCE_HEX_DATA_ODD: case SCE_HEX_DATA_EVEN: case SCE_HEX_GARBAGE: // record finished or line too long sc.SetState(SCE_HEX_GARBAGE); ForwardWithinLine(sc); break; default: // prevent endless loop in faulty state sc.SetState(SCE_HEX_DEFAULT); break; } } sc.Complete(); } LexerModule lmSrec(SCLEX_SREC, ColouriseSrecDoc, "srec", 0, NULL); LexerModule lmIHex(SCLEX_IHEX, ColouriseIHexDoc, "ihex", FoldIHexDoc, NULL); LexerModule lmTEHex(SCLEX_TEHEX, ColouriseTEHexDoc, "tehex", 0, NULL); ================================================ FILE: lexilla/lexers/LexHollywood.cxx ================================================ // Scintilla source code edit control /** @file LexHollywood.cxx ** Lexer for Hollywood ** Written by Andreas Falkenhahn, based on the BlitzBasic/PureBasic/Lua lexers ** Thanks to Nicholai Benalal ** For more information on Hollywood, see http://www.hollywood-mal.com/ ** Mail me (andreas airsoftsoftwair de) for any bugs. ** This code is subject to the same license terms as the rest of the Scintilla project: ** The License.txt file describes the conditions under which this software may be distributed. **/ #include #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; /* Bits: * 1 - whitespace * 2 - operator * 4 - identifier * 8 - decimal digit * 16 - hex digit * 32 - bin digit * 64 - letter */ static int character_classification[128] = { 0, // NUL ($0) 0, // SOH ($1) 0, // STX ($2) 0, // ETX ($3) 0, // EOT ($4) 0, // ENQ ($5) 0, // ACK ($6) 0, // BEL ($7) 0, // BS ($8) 1, // HT ($9) 1, // LF ($A) 0, // VT ($B) 0, // FF ($C) 1, // CR ($D) 0, // SO ($E) 0, // SI ($F) 0, // DLE ($10) 0, // DC1 ($11) 0, // DC2 ($12) 0, // DC3 ($13) 0, // DC4 ($14) 0, // NAK ($15) 0, // SYN ($16) 0, // ETB ($17) 0, // CAN ($18) 0, // EM ($19) 0, // SUB ($1A) 0, // ESC ($1B) 0, // FS ($1C) 0, // GS ($1D) 0, // RS ($1E) 0, // US ($1F) 1, // space ($20) 4, // ! ($21) 0, // " ($22) 0, // # ($23) 4, // $ ($24) 2, // % ($25) 2, // & ($26) 2, // ' ($27) 2, // ( ($28) 2, // ) ($29) 2, // * ($2A) 2, // + ($2B) 2, // , ($2C) 2, // - ($2D) // NB: we treat "." as an identifier although it is also an operator and a decimal digit // the reason why we treat it as an identifier is to support syntax highlighting for // plugin commands which always use a "." in their names, e.g. pdf.OpenDocument(); // we handle the decimal digit case manually below so that 3.1415 and .123 is styled correctly // the collateral damage of treating "." as an identifier is that "." is never styled // SCE_HOLLYWOOD_OPERATOR 4, // . ($2E) 2, // / ($2F) 28, // 0 ($30) 28, // 1 ($31) 28, // 2 ($32) 28, // 3 ($33) 28, // 4 ($34) 28, // 5 ($35) 28, // 6 ($36) 28, // 7 ($37) 28, // 8 ($38) 28, // 9 ($39) 2, // : ($3A) 2, // ; ($3B) 2, // < ($3C) 2, // = ($3D) 2, // > ($3E) 2, // ? ($3F) 0, // @ ($40) 84, // A ($41) 84, // B ($42) 84, // C ($43) 84, // D ($44) 84, // E ($45) 84, // F ($46) 68, // G ($47) 68, // H ($48) 68, // I ($49) 68, // J ($4A) 68, // K ($4B) 68, // L ($4C) 68, // M ($4D) 68, // N ($4E) 68, // O ($4F) 68, // P ($50) 68, // Q ($51) 68, // R ($52) 68, // S ($53) 68, // T ($54) 68, // U ($55) 68, // V ($56) 68, // W ($57) 68, // X ($58) 68, // Y ($59) 68, // Z ($5A) 2, // [ ($5B) 2, // \ ($5C) 2, // ] ($5D) 2, // ^ ($5E) 68, // _ ($5F) 2, // ` ($60) 84, // a ($61) 84, // b ($62) 84, // c ($63) 84, // d ($64) 84, // e ($65) 84, // f ($66) 68, // g ($67) 68, // h ($68) 68, // i ($69) 68, // j ($6A) 68, // k ($6B) 68, // l ($6C) 68, // m ($6D) 68, // n ($6E) 68, // o ($6F) 68, // p ($70) 68, // q ($71) 68, // r ($72) 68, // s ($73) 68, // t ($74) 68, // u ($75) 68, // v ($76) 68, // w ($77) 68, // x ($78) 68, // y ($79) 68, // z ($7A) 2, // { ($7B) 2, // | ($7C) 2, // } ($7D) 2, // ~ ($7E) 0, //  ($7F) }; static bool IsSpace(int c) { return c < 128 && (character_classification[c] & 1); } static bool IsOperator(int c) { return c < 128 && (character_classification[c] & 2); } static bool IsIdentifier(int c) { return c < 128 && (character_classification[c] & 4); } static bool IsDigit(int c) { return c < 128 && (character_classification[c] & 8); } static bool IsHexDigit(int c) { return c < 128 && (character_classification[c] & 16); } static int LowerCase(int c) { if (c >= 'A' && c <= 'Z') return 'a' + c - 'A'; return c; } static int CheckHollywoodFoldPoint(char const *token) { if (!strcmp(token, "function")) { return 1; } if (!strcmp(token, "endfunction")) { return -1; } return 0; } // An individual named option for use in an OptionSet // Options used for LexerHollywood struct OptionsHollywood { bool fold; bool foldCompact; OptionsHollywood() { fold = false; foldCompact = false; } }; static const char * const hollywoodWordListDesc[] = { "Hollywood keywords", "Hollywood standard API functions", "Hollywood plugin API functions", "Hollywood plugin methods", 0 }; struct OptionSetHollywood : public OptionSet { OptionSetHollywood(const char * const wordListDescriptions[]) { DefineProperty("fold", &OptionsHollywood::fold); DefineProperty("fold.compact", &OptionsHollywood::foldCompact); DefineWordListSets(wordListDescriptions); } }; class LexerHollywood : public DefaultLexer { int (*CheckFoldPoint)(char const *); WordList keywordlists[4]; OptionsHollywood options; OptionSetHollywood osHollywood; public: LexerHollywood(int (*CheckFoldPoint_)(char const *), const char * const wordListDescriptions[]) : DefaultLexer("hollywood", SCLEX_HOLLYWOOD), CheckFoldPoint(CheckFoldPoint_), osHollywood(wordListDescriptions) { } virtual ~LexerHollywood() { } void SCI_METHOD Release() override { delete this; } int SCI_METHOD Version() const override { return lvRelease5; } const char * SCI_METHOD PropertyNames() override { return osHollywood.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osHollywood.PropertyType(name); } const char * SCI_METHOD DescribeProperty(const char *name) override { return osHollywood.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char* key) override { return osHollywood.PropertyGet(key); } const char * SCI_METHOD DescribeWordListSets() override { return osHollywood.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return 0; } static ILexer5 *LexerFactoryHollywood() { return new LexerHollywood(CheckHollywoodFoldPoint, hollywoodWordListDesc); } }; Sci_Position SCI_METHOD LexerHollywood::PropertySet(const char *key, const char *val) { if (osHollywood.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerHollywood::WordListSet(int n, const char *wl) { WordList *wordListN = 0; switch (n) { case 0: wordListN = &keywordlists[0]; break; case 1: wordListN = &keywordlists[1]; break; case 2: wordListN = &keywordlists[2]; break; case 3: wordListN = &keywordlists[3]; break; } Sci_Position firstModification = -1; if (wordListN) { WordList wlNew; wlNew.Set(wl); if (*wordListN != wlNew) { wordListN->Set(wl); firstModification = 0; } } return firstModification; } void SCI_METHOD LexerHollywood::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); styler.StartAt(startPos); bool inString = false; StyleContext sc(startPos, length, initStyle, styler); // Can't use sc.More() here else we miss the last character for (; ; sc.Forward()) { if (sc.atLineStart) inString = false; if (sc.ch == '\"' && sc.chPrev != '\\') inString = !inString; if (sc.state == SCE_HOLLYWOOD_IDENTIFIER) { if (!IsIdentifier(sc.ch)) { char s[100]; int kstates[4] = { SCE_HOLLYWOOD_KEYWORD, SCE_HOLLYWOOD_STDAPI, SCE_HOLLYWOOD_PLUGINAPI, SCE_HOLLYWOOD_PLUGINMETHOD, }; sc.GetCurrentLowered(s, sizeof(s)); for (int i = 0; i < 4; i++) { if (keywordlists[i].InList(s)) { sc.ChangeState(kstates[i]); } } sc.SetState(SCE_HOLLYWOOD_DEFAULT); } } else if (sc.state == SCE_HOLLYWOOD_OPERATOR) { // always reset to default on operators because otherwise // comments won't be recognized in sequences like "+/* Hello*/" // --> "+/*" would be recognized as a sequence of operators // if (!IsOperator(sc.ch)) sc.SetState(SCE_HOLLYWOOD_DEFAULT); sc.SetState(SCE_HOLLYWOOD_DEFAULT); } else if (sc.state == SCE_HOLLYWOOD_PREPROCESSOR) { if (!IsIdentifier(sc.ch)) sc.SetState(SCE_HOLLYWOOD_DEFAULT); } else if (sc.state == SCE_HOLLYWOOD_CONSTANT) { if (!IsIdentifier(sc.ch)) sc.SetState(SCE_HOLLYWOOD_DEFAULT); } else if (sc.state == SCE_HOLLYWOOD_NUMBER) { if (!IsDigit(sc.ch) && sc.ch != '.') sc.SetState(SCE_HOLLYWOOD_DEFAULT); } else if (sc.state == SCE_HOLLYWOOD_HEXNUMBER) { if (!IsHexDigit(sc.ch)) sc.SetState(SCE_HOLLYWOOD_DEFAULT); } else if (sc.state == SCE_HOLLYWOOD_STRING) { if (sc.ch == '"') { sc.ForwardSetState(SCE_HOLLYWOOD_DEFAULT); } if (sc.atLineEnd) { sc.SetState(SCE_HOLLYWOOD_DEFAULT); } } else if (sc.state == SCE_HOLLYWOOD_COMMENT) { if (sc.atLineEnd) { sc.SetState(SCE_HOLLYWOOD_DEFAULT); } } else if (sc.state == SCE_HOLLYWOOD_COMMENTBLOCK) { if (sc.Match("*/") && !inString) { sc.Forward(); sc.ForwardSetState(SCE_HOLLYWOOD_DEFAULT); } } else if (sc.state == SCE_HOLLYWOOD_STRINGBLOCK) { if (sc.Match("]]") && !inString) { sc.Forward(); sc.ForwardSetState(SCE_HOLLYWOOD_DEFAULT); } } if (sc.state == SCE_HOLLYWOOD_DEFAULT) { if (sc.Match(';')) { sc.SetState(SCE_HOLLYWOOD_COMMENT); } else if (sc.Match("/*")) { sc.SetState(SCE_HOLLYWOOD_COMMENTBLOCK); sc.Forward(); } else if (sc.Match("[[")) { sc.SetState(SCE_HOLLYWOOD_STRINGBLOCK); sc.Forward(); } else if (sc.Match('"')) { sc.SetState(SCE_HOLLYWOOD_STRING); } else if (sc.Match('$')) { sc.SetState(SCE_HOLLYWOOD_HEXNUMBER); } else if (sc.Match("0x") || sc.Match("0X")) { // must be before IsDigit() because of 0x sc.SetState(SCE_HOLLYWOOD_HEXNUMBER); sc.Forward(); } else if (sc.ch == '.' && (sc.chNext >= '0' && sc.chNext <= '9')) { // ".1234" style numbers sc.SetState(SCE_HOLLYWOOD_NUMBER); sc.Forward(); } else if (IsDigit(sc.ch)) { sc.SetState(SCE_HOLLYWOOD_NUMBER); } else if (sc.Match('#')) { sc.SetState(SCE_HOLLYWOOD_CONSTANT); } else if (sc.Match('@')) { sc.SetState(SCE_HOLLYWOOD_PREPROCESSOR); } else if (IsOperator(sc.ch)) { sc.SetState(SCE_HOLLYWOOD_OPERATOR); } else if (IsIdentifier(sc.ch)) { sc.SetState(SCE_HOLLYWOOD_IDENTIFIER); } } if (!sc.More()) break; } sc.Complete(); } void SCI_METHOD LexerHollywood::Fold(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, IDocument *pAccess) { if (!options.fold) return; LexAccessor styler(pAccess); Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); int done = 0; char word[256]; int wordlen = 0; for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (!done) { if (wordlen) { // are we scanning a token already? word[wordlen] = static_cast(LowerCase(ch)); if (!IsIdentifier(ch)) { // done with token word[wordlen] = '\0'; levelCurrent += CheckFoldPoint(word); done = 1; } else if (wordlen < 255) { wordlen++; } } else { // start scanning at first non-whitespace character if (!IsSpace(ch)) { if (style != SCE_HOLLYWOOD_COMMENTBLOCK && IsIdentifier(ch)) { word[0] = static_cast(LowerCase(ch)); wordlen = 1; } else // done with this line done = 1; } } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && options.foldCompact) { lev |= SC_FOLDLEVELWHITEFLAG; } if ((levelCurrent > levelPrev) && (visibleChars > 0)) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; done = 0; wordlen = 0; } if (!IsSpace(ch)) { visibleChars++; } } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } LexerModule lmHollywood(SCLEX_HOLLYWOOD, LexerHollywood::LexerFactoryHollywood, "hollywood", hollywoodWordListDesc); ================================================ FILE: lexilla/lexers/LexIndent.cxx ================================================ // Scintilla source code edit control /** @file LexIndent.cxx ** Lexer for no language. Used for indentation-based folding of files. **/ // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static void ColouriseIndentDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { // Indent language means all style bytes are 0 so just mark the end - no need to fill in. if (length > 0) { styler.StartAt(startPos + length - 1); styler.StartSegment(startPos + length - 1); styler.ColourTo(startPos + length - 1, 0); } } static void FoldIndentDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { int visibleCharsCurrent, visibleCharsNext; int levelCurrent, levelNext; Sci_PositionU i, lineEnd; Sci_PositionU lengthDoc = startPos + length; Sci_Position lineCurrent = styler.GetLine(startPos); i = styler.LineStart(lineCurrent ); lineEnd = styler.LineStart(lineCurrent+1)-1; if(lineEnd>=lengthDoc) lineEnd = lengthDoc-1; while(styler[lineEnd]=='\n' || styler[lineEnd]=='\r') lineEnd--; for(visibleCharsCurrent=0, levelCurrent=SC_FOLDLEVELBASE; !visibleCharsCurrent && i<=lineEnd; i++){ if(isspacechar(styler[i])) levelCurrent++; else visibleCharsCurrent=1; } for(; i=lengthDoc) lineEnd = lengthDoc-1; while(styler[lineEnd]=='\n' || styler[lineEnd]=='\r') lineEnd--; for(visibleCharsNext=0, levelNext=SC_FOLDLEVELBASE; !visibleCharsNext && i<=lineEnd; i++){ if(isspacechar(styler[i])) levelNext++; else visibleCharsNext=1; } int lev = levelCurrent; if(!visibleCharsCurrent) lev |= SC_FOLDLEVELWHITEFLAG; else if(levelNext > levelCurrent) lev |= SC_FOLDLEVELHEADERFLAG; styler.SetLevel(lineCurrent, lev); levelCurrent = levelNext; visibleCharsCurrent = visibleCharsNext; } } LexerModule lmIndent(SCLEX_INDENT, ColouriseIndentDoc, "indent", FoldIndentDoc); ================================================ FILE: lexilla/lexers/LexInno.cxx ================================================ // Scintilla source code edit control /** @file LexInno.cxx ** Lexer for Inno Setup scripts. **/ // Written by Friedrich Vedder , using code from LexOthers.cxx. // Modified by Michael Heath. // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static bool innoIsBlank(int ch) { return (ch == ' ') || (ch == '\t'); } static bool innoNextNotBlankIs(Sci_Position i, Accessor &styler, char needle) { char ch; while (i < styler.Length()) { ch = styler.SafeGetCharAt(i); if (ch == needle) return true; if (!innoIsBlank(ch)) return false; i++; } return false; } static void ColouriseInnoDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) { int state = SCE_INNO_DEFAULT; char chPrev; char ch = 0; char chNext = styler[startPos]; Sci_Position lengthDoc = startPos + length; char *buffer = new char[length + 1]; Sci_Position bufferCount = 0; bool isBOL, isEOL, isWS, isBOLWS = 0; // Save line state later with bitState and bitand with bit... to get line state int bitState = 0; int const bitCode = 1, bitMessages = 2, bitCommentCurly = 4, bitCommentRound = 8; // Get keyword lists WordList §ionKeywords = *keywordLists[0]; WordList &standardKeywords = *keywordLists[1]; WordList ¶meterKeywords = *keywordLists[2]; WordList &preprocessorKeywords = *keywordLists[3]; WordList &pascalKeywords = *keywordLists[4]; WordList &userKeywords = *keywordLists[5]; // Get line state Sci_Position curLine = styler.GetLine(startPos); int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0; bool isCode = (curLineState & bitCode); bool isMessages = (curLineState & bitMessages); bool isCommentCurly = (curLineState & bitCommentCurly); bool isCommentRound = (curLineState & bitCommentRound); bool isCommentSlash = false; // Continue Pascal multline comment state if (isCommentCurly || isCommentRound) state = SCE_INNO_COMMENT_PASCAL; // Go through all provided text segment // using the hand-written state machine shown below styler.StartAt(startPos); styler.StartSegment(startPos); for (Sci_Position i = startPos; i < lengthDoc; i++) { chPrev = ch; ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); i++; continue; } isBOL = (chPrev == 0) || (chPrev == '\n') || (chPrev == '\r' && ch != '\n'); isBOLWS = (isBOL) ? 1 : (isBOLWS && (chPrev == ' ' || chPrev == '\t')); isEOL = (ch == '\n' || ch == '\r'); isWS = (ch == ' ' || ch == '\t'); if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { // Remember the line state for future incremental lexing curLine = styler.GetLine(i); bitState = 0; if (isCode) bitState |= bitCode; if (isMessages) bitState |= bitMessages; if (isCommentCurly) bitState |= bitCommentCurly; if (isCommentRound) bitState |= bitCommentRound; styler.SetLineState(curLine, bitState); } switch(state) { case SCE_INNO_DEFAULT: if (!isCode && ch == ';' && isBOLWS) { // Start of a comment state = SCE_INNO_COMMENT; styler.ColourTo(i, SCE_INNO_COMMENT); } else if (ch == '[' && isBOLWS) { // Start of a section name state = SCE_INNO_SECTION; bufferCount = 0; } else if (ch == '#' && isBOLWS) { // Start of a preprocessor directive state = SCE_INNO_PREPROC; } else if (!isCode && ch == '{' && chNext != '{' && chPrev != '{') { // Start of an inline expansion state = SCE_INNO_INLINE_EXPANSION; } else if (isCode && ch == '{') { // Start of a Pascal comment state = SCE_INNO_COMMENT_PASCAL; isCommentCurly = true; styler.ColourTo(i, SCE_INNO_COMMENT_PASCAL); } else if (isCode && (ch == '(' && chNext == '*')) { // Start of a Pascal comment state = SCE_INNO_COMMENT_PASCAL; isCommentRound = true; styler.ColourTo(i + 1, SCE_INNO_COMMENT_PASCAL); } else if (isCode && ch == '/' && chNext == '/') { // Start of C-style comment state = SCE_INNO_COMMENT_PASCAL; isCommentSlash = true; styler.ColourTo(i + 1, SCE_INNO_COMMENT_PASCAL); } else if (!isMessages && ch == '"') { // Start of a double-quote string state = SCE_INNO_STRING_DOUBLE; styler.ColourTo(i, SCE_INNO_STRING_DOUBLE); } else if (!isMessages && ch == '\'') { // Start of a single-quote string state = SCE_INNO_STRING_SINGLE; styler.ColourTo(i, SCE_INNO_STRING_SINGLE); } else if (!isMessages && IsASCII(ch) && (isalpha(ch) || (ch == '_'))) { // Start of an identifier state = SCE_INNO_IDENTIFIER; bufferCount = 0; buffer[bufferCount++] = static_cast(tolower(ch)); } else { // Style it the default style styler.ColourTo(i, SCE_INNO_DEFAULT); } break; case SCE_INNO_COMMENT: if (isEOL) { state = SCE_INNO_DEFAULT; styler.ColourTo(i - 1, SCE_INNO_COMMENT); styler.ColourTo(i, SCE_INNO_DEFAULT); } else { styler.ColourTo(i, SCE_INNO_COMMENT); } break; case SCE_INNO_IDENTIFIER: if (IsASCII(ch) && (isalnum(ch) || (ch == '_'))) { buffer[bufferCount++] = static_cast(tolower(ch)); } else { state = SCE_INNO_DEFAULT; buffer[bufferCount] = '\0'; // Check if the buffer contains a keyword if (!isCode && standardKeywords.InList(buffer) && innoNextNotBlankIs(i, styler, '=')) { styler.ColourTo(i - 1, SCE_INNO_KEYWORD); } else if (!isCode && parameterKeywords.InList(buffer) && innoNextNotBlankIs(i, styler, ':')) { styler.ColourTo(i - 1, SCE_INNO_PARAMETER); } else if (isCode && pascalKeywords.InList(buffer)) { styler.ColourTo(i - 1, SCE_INNO_KEYWORD_PASCAL); } else if (!isCode && userKeywords.InList(buffer)) { styler.ColourTo(i - 1, SCE_INNO_KEYWORD_USER); } else { styler.ColourTo(i - 1, SCE_INNO_DEFAULT); } // Push back the faulty character chNext = styler[i--]; ch = chPrev; } break; case SCE_INNO_SECTION: if (ch == ']') { state = SCE_INNO_DEFAULT; buffer[bufferCount] = '\0'; // Check if the buffer contains a section name if (sectionKeywords.InList(buffer)) { styler.ColourTo(i, SCE_INNO_SECTION); isCode = !CompareCaseInsensitive(buffer, "code"); isMessages = isCode ? false : ( !CompareCaseInsensitive(buffer, "custommessages") || !CompareCaseInsensitive(buffer, "messages")); } else { styler.ColourTo(i, SCE_INNO_DEFAULT); } } else if (IsASCII(ch) && (isalnum(ch) || (ch == '_'))) { buffer[bufferCount++] = static_cast(tolower(ch)); } else { state = SCE_INNO_DEFAULT; styler.ColourTo(i, SCE_INNO_DEFAULT); } break; case SCE_INNO_PREPROC: if (isWS || isEOL) { if (IsASCII(chPrev) && isalpha(chPrev)) { state = SCE_INNO_DEFAULT; buffer[bufferCount] = '\0'; // Check if the buffer contains a preprocessor directive if (preprocessorKeywords.InList(buffer)) { styler.ColourTo(i - 1, SCE_INNO_PREPROC); } else { styler.ColourTo(i - 1, SCE_INNO_DEFAULT); } // Push back the faulty character chNext = styler[i--]; ch = chPrev; } } else if (IsASCII(ch) && isalpha(ch)) { if (chPrev == '#' || chPrev == ' ' || chPrev == '\t') bufferCount = 0; buffer[bufferCount++] = static_cast(tolower(ch)); } break; case SCE_INNO_STRING_DOUBLE: if (ch == '"') { state = SCE_INNO_DEFAULT; styler.ColourTo(i, SCE_INNO_STRING_DOUBLE); } else if (isEOL) { state = SCE_INNO_DEFAULT; styler.ColourTo(i - 1, SCE_INNO_STRING_DOUBLE); styler.ColourTo(i, SCE_INNO_DEFAULT); } else { styler.ColourTo(i, SCE_INNO_STRING_DOUBLE); } break; case SCE_INNO_STRING_SINGLE: if (ch == '\'') { state = SCE_INNO_DEFAULT; styler.ColourTo(i, SCE_INNO_STRING_SINGLE); } else if (isEOL) { state = SCE_INNO_DEFAULT; styler.ColourTo(i - 1, SCE_INNO_STRING_SINGLE); styler.ColourTo(i, SCE_INNO_DEFAULT); } else { styler.ColourTo(i, SCE_INNO_STRING_SINGLE); } break; case SCE_INNO_INLINE_EXPANSION: if (ch == '}') { state = SCE_INNO_DEFAULT; styler.ColourTo(i, SCE_INNO_INLINE_EXPANSION); } else if (isEOL) { state = SCE_INNO_DEFAULT; styler.ColourTo(i, SCE_INNO_DEFAULT); } break; case SCE_INNO_COMMENT_PASCAL: if (isCommentSlash) { if (isEOL) { state = SCE_INNO_DEFAULT; isCommentSlash = false; styler.ColourTo(i - 1, SCE_INNO_COMMENT_PASCAL); styler.ColourTo(i, SCE_INNO_DEFAULT); } else { styler.ColourTo(i, SCE_INNO_COMMENT_PASCAL); } } else if (isCommentCurly) { if (ch == '}') { state = SCE_INNO_DEFAULT; isCommentCurly = false; } styler.ColourTo(i, SCE_INNO_COMMENT_PASCAL); } else if (isCommentRound) { if (ch == ')' && chPrev == '*') { state = SCE_INNO_DEFAULT; isCommentRound = false; } styler.ColourTo(i, SCE_INNO_COMMENT_PASCAL); } break; } } delete []buffer; } static const char * const innoWordListDesc[] = { "Sections", "Keywords", "Parameters", "Preprocessor directives", "Pascal keywords", "User defined keywords", 0 }; static void FoldInnoDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { Sci_PositionU endPos = startPos + length; char chNext = styler[startPos]; Sci_Position lineCurrent = styler.GetLine(startPos); bool sectionFlag = false; int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) : SC_FOLDLEVELBASE; int level; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler[i + 1]; bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); int style = styler.StyleAt(i); if (style == SCE_INNO_SECTION) sectionFlag = true; if (atEOL || i == endPos - 1) { if (sectionFlag) { level = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; if (level == levelPrev) styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG); } else { level = levelPrev & SC_FOLDLEVELNUMBERMASK; if (levelPrev & SC_FOLDLEVELHEADERFLAG) level++; } styler.SetLevel(lineCurrent, level); levelPrev = level; lineCurrent++; sectionFlag = false; } } } LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc); ================================================ FILE: lexilla/lexers/LexJSON.cxx ================================================ // Scintilla source code edit control /** * @file LexJSON.cxx * @date February 19, 2016 * @brief Lexer for JSON and JSON-LD formats * @author nkmathew * * The License.txt file describes the conditions under which this software may * be distributed. * */ #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; static const char *const JSONWordListDesc[] = { "JSON Keywords", "JSON-LD Keywords", 0 }; /** * Used to detect compact IRI/URLs in JSON-LD without first looking ahead for the * colon separating the prefix and suffix * * https://www.w3.org/TR/json-ld/#dfn-compact-iri */ struct CompactIRI { int colonCount; bool foundInvalidChar; CharacterSet setCompactIRI; CompactIRI() { colonCount = 0; foundInvalidChar = false; setCompactIRI = CharacterSet(CharacterSet::setAlpha, "$_-"); } void resetState() { colonCount = 0; foundInvalidChar = false; } void checkChar(int ch) { if (ch == ':') { colonCount++; } else { foundInvalidChar |= !setCompactIRI.Contains(ch); } } bool shouldHighlight() const { return !foundInvalidChar && colonCount == 1; } }; /** * Keeps track of escaped characters in strings as per: * * https://tools.ietf.org/html/rfc7159#section-7 */ struct EscapeSequence { int digitsLeft; CharacterSet setHexDigits; CharacterSet setEscapeChars; EscapeSequence() { digitsLeft = 0; setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef"); setEscapeChars = CharacterSet(CharacterSet::setNone, "\\\"tnbfru/"); } // Returns true if the following character is a valid escaped character bool newSequence(int nextChar) { digitsLeft = 0; if (nextChar == 'u') { digitsLeft = 5; } else if (!setEscapeChars.Contains(nextChar)) { return false; } return true; } bool atEscapeEnd() const { return digitsLeft <= 0; } bool isInvalidChar(int currChar) const { return !setHexDigits.Contains(currChar); } }; struct OptionsJSON { bool foldCompact; bool fold; bool allowComments; bool escapeSequence; OptionsJSON() { foldCompact = false; fold = false; allowComments = false; escapeSequence = false; } }; struct OptionSetJSON : public OptionSet { OptionSetJSON() { DefineProperty("lexer.json.escape.sequence", &OptionsJSON::escapeSequence, "Set to 1 to enable highlighting of escape sequences in strings"); DefineProperty("lexer.json.allow.comments", &OptionsJSON::allowComments, "Set to 1 to enable highlighting of line/block comments in JSON"); DefineProperty("fold.compact", &OptionsJSON::foldCompact); DefineProperty("fold", &OptionsJSON::fold); DefineWordListSets(JSONWordListDesc); } }; class LexerJSON : public DefaultLexer { OptionsJSON options; OptionSetJSON optSetJSON; EscapeSequence escapeSeq; WordList keywordsJSON; WordList keywordsJSONLD; CharacterSet setOperators; CharacterSet setURL; CharacterSet setKeywordJSONLD; CharacterSet setKeywordJSON; CompactIRI compactIRI; static bool IsNextNonWhitespace(LexAccessor &styler, Sci_Position start, char ch) { Sci_Position i = 0; while (i < 50) { i++; char curr = styler.SafeGetCharAt(start+i, '\0'); char next = styler.SafeGetCharAt(start+i+1, '\0'); bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n'); if (curr == ch) { return true; } else if (!isspacechar(curr) || atEOL) { return false; } } return false; } /** * Looks for the colon following the end quote * * Assumes property names of lengths no longer than a 100 characters. * The colon is also expected to be less than 50 spaces after the end * quote for the string to be considered a property name */ static bool AtPropertyName(LexAccessor &styler, Sci_Position start) { Sci_Position i = 0; bool escaped = false; while (i < 100) { i++; char curr = styler.SafeGetCharAt(start+i, '\0'); if (escaped) { escaped = false; continue; } escaped = curr == '\\'; if (curr == '"') { return IsNextNonWhitespace(styler, start+i, ':'); } else if (!curr) { return false; } } return false; } static bool IsNextWordInList(WordList &keywordList, CharacterSet wordSet, StyleContext &context, LexAccessor &styler) { char word[51]; Sci_Position currPos = (Sci_Position) context.currentPos; int i = 0; while (i < 50) { char ch = styler.SafeGetCharAt(currPos + i); if (!wordSet.Contains(ch)) { break; } word[i] = ch; i++; } word[i] = '\0'; return keywordList.InList(word); } public: LexerJSON() : DefaultLexer("json", SCLEX_JSON), setOperators(CharacterSet::setNone, "[{}]:,"), setURL(CharacterSet::setAlphaNum, "-._~:/?#[]@!$&'()*+,),="), setKeywordJSONLD(CharacterSet::setAlpha, ":@"), setKeywordJSON(CharacterSet::setAlpha, "$_") { } virtual ~LexerJSON() {} int SCI_METHOD Version() const override { return lvRelease5; } void SCI_METHOD Release() override { delete this; } const char *SCI_METHOD PropertyNames() override { return optSetJSON.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return optSetJSON.PropertyType(name); } const char *SCI_METHOD DescribeProperty(const char *name) override { return optSetJSON.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override { if (optSetJSON.PropertySet(&options, key, val)) { return 0; } return -1; } const char * SCI_METHOD PropertyGet(const char *key) override { return optSetJSON.PropertyGet(key); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override { WordList *wordListN = 0; switch (n) { case 0: wordListN = &keywordsJSON; break; case 1: wordListN = &keywordsJSONLD; break; } Sci_Position firstModification = -1; if (wordListN) { if (wordListN->Set(wl)) { firstModification = 0; } } return firstModification; } void *SCI_METHOD PrivateCall(int, void *) override { return 0; } static ILexer5 *LexerFactoryJSON() { return new LexerJSON; } const char *SCI_METHOD DescribeWordListSets() override { return optSetJSON.DescribeWordListSets(); } void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; }; void SCI_METHOD LexerJSON::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); StyleContext context(startPos, length, initStyle, styler); int stringStyleBefore = SCE_JSON_STRING; while (context.More()) { switch (context.state) { case SCE_JSON_BLOCKCOMMENT: if (context.Match("*/")) { context.Forward(); context.ForwardSetState(SCE_JSON_DEFAULT); } break; case SCE_JSON_LINECOMMENT: if (context.MatchLineEnd()) { context.SetState(SCE_JSON_DEFAULT); } break; case SCE_JSON_STRINGEOL: if (context.atLineStart) { context.SetState(SCE_JSON_DEFAULT); } break; case SCE_JSON_ESCAPESEQUENCE: escapeSeq.digitsLeft--; if (!escapeSeq.atEscapeEnd()) { if (escapeSeq.isInvalidChar(context.ch)) { context.SetState(SCE_JSON_ERROR); } break; } if (context.ch == '"') { context.SetState(stringStyleBefore); context.ForwardSetState(SCE_JSON_DEFAULT); } else if (context.ch == '\\') { if (!escapeSeq.newSequence(context.chNext)) { context.SetState(SCE_JSON_ERROR); } context.Forward(); } else { context.SetState(stringStyleBefore); if (context.atLineEnd) { context.ChangeState(SCE_JSON_STRINGEOL); } } break; case SCE_JSON_PROPERTYNAME: case SCE_JSON_STRING: if (context.ch == '"') { if (compactIRI.shouldHighlight()) { context.ChangeState(SCE_JSON_COMPACTIRI); context.ForwardSetState(SCE_JSON_DEFAULT); compactIRI.resetState(); } else { context.ForwardSetState(SCE_JSON_DEFAULT); } } else if (context.atLineEnd) { context.ChangeState(SCE_JSON_STRINGEOL); } else if (context.ch == '\\') { stringStyleBefore = context.state; if (options.escapeSequence) { context.SetState(SCE_JSON_ESCAPESEQUENCE); if (!escapeSeq.newSequence(context.chNext)) { context.SetState(SCE_JSON_ERROR); } } context.Forward(); } else if (context.Match("https://") || context.Match("http://") || context.Match("ssh://") || context.Match("git://") || context.Match("svn://") || context.Match("ftp://") || context.Match("mailto:")) { // Handle most common URI schemes only stringStyleBefore = context.state; context.SetState(SCE_JSON_URI); } else if (context.ch == '@') { // https://www.w3.org/TR/json-ld/#dfn-keyword if (IsNextWordInList(keywordsJSONLD, setKeywordJSONLD, context, styler)) { stringStyleBefore = context.state; context.SetState(SCE_JSON_LDKEYWORD); } } else { compactIRI.checkChar(context.ch); } break; case SCE_JSON_LDKEYWORD: case SCE_JSON_URI: if ((!setKeywordJSONLD.Contains(context.ch) && (context.state == SCE_JSON_LDKEYWORD)) || (!setURL.Contains(context.ch))) { context.SetState(stringStyleBefore); } if (context.ch == '"') { context.ForwardSetState(SCE_JSON_DEFAULT); } else if (context.atLineEnd) { context.ChangeState(SCE_JSON_STRINGEOL); } break; case SCE_JSON_OPERATOR: case SCE_JSON_NUMBER: context.SetState(SCE_JSON_DEFAULT); break; case SCE_JSON_ERROR: if (context.MatchLineEnd()) { context.SetState(SCE_JSON_DEFAULT); } break; case SCE_JSON_KEYWORD: if (!setKeywordJSON.Contains(context.ch)) { context.SetState(SCE_JSON_DEFAULT); } break; } if (context.state == SCE_JSON_DEFAULT) { if (context.ch == '"') { compactIRI.resetState(); context.SetState(SCE_JSON_STRING); Sci_Position currPos = static_cast(context.currentPos); if (AtPropertyName(styler, currPos)) { context.SetState(SCE_JSON_PROPERTYNAME); } } else if (setOperators.Contains(context.ch)) { context.SetState(SCE_JSON_OPERATOR); } else if (options.allowComments && context.Match("/*")) { context.SetState(SCE_JSON_BLOCKCOMMENT); context.Forward(); } else if (options.allowComments && context.Match("//")) { context.SetState(SCE_JSON_LINECOMMENT); } else if (setKeywordJSON.Contains(context.ch)) { if (IsNextWordInList(keywordsJSON, setKeywordJSON, context, styler)) { context.SetState(SCE_JSON_KEYWORD); } } bool numberStart = IsADigit(context.ch) && (context.chPrev == '+'|| context.chPrev == '-' || context.atLineStart || IsASpace(context.chPrev) || setOperators.Contains(context.chPrev)); bool exponentPart = tolower(context.ch) == 'e' && IsADigit(context.chPrev) && (IsADigit(context.chNext) || context.chNext == '+' || context.chNext == '-'); bool signPart = (context.ch == '-' || context.ch == '+') && ((tolower(context.chPrev) == 'e' && IsADigit(context.chNext)) || ((IsASpace(context.chPrev) || setOperators.Contains(context.chPrev)) && IsADigit(context.chNext))); bool adjacentDigit = IsADigit(context.ch) && IsADigit(context.chPrev); bool afterExponent = IsADigit(context.ch) && tolower(context.chPrev) == 'e'; bool dotPart = context.ch == '.' && IsADigit(context.chPrev) && IsADigit(context.chNext); bool afterDot = IsADigit(context.ch) && context.chPrev == '.'; if (numberStart || exponentPart || signPart || adjacentDigit || dotPart || afterExponent || afterDot) { context.SetState(SCE_JSON_NUMBER); } else if (context.state == SCE_JSON_DEFAULT && !IsASpace(context.ch)) { context.SetState(SCE_JSON_ERROR); } } context.Forward(); } context.Complete(); } void SCI_METHOD LexerJSON::Fold(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) { if (!options.fold) { return; } LexAccessor styler(pAccess); Sci_PositionU currLine = styler.GetLine(startPos); Sci_PositionU endPos = startPos + length; int currLevel = SC_FOLDLEVELBASE; if (currLine > 0) currLevel = styler.LevelAt(currLine - 1) >> 16; int nextLevel = currLevel; int visibleChars = 0; for (Sci_PositionU i = startPos; i < endPos; i++) { char curr = styler.SafeGetCharAt(i); char next = styler.SafeGetCharAt(i+1); bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n'); if (styler.StyleAt(i) == SCE_JSON_OPERATOR) { if (curr == '{' || curr == '[') { nextLevel++; } else if (curr == '}' || curr == ']') { nextLevel--; } } if (atEOL || i == (endPos-1)) { int level = currLevel | nextLevel << 16; if (!visibleChars && options.foldCompact) { level |= SC_FOLDLEVELWHITEFLAG; } else if (nextLevel > currLevel) { level |= SC_FOLDLEVELHEADERFLAG; } if (level != styler.LevelAt(currLine)) { styler.SetLevel(currLine, level); } currLine++; currLevel = nextLevel; visibleChars = 0; } if (!isspacechar(curr)) { visibleChars++; } } } LexerModule lmJSON(SCLEX_JSON, LexerJSON::LexerFactoryJSON, "json", JSONWordListDesc); ================================================ FILE: lexilla/lexers/LexJulia.cxx ================================================ // Scintilla source code edit control // Encoding: UTF-8 /** @file LexJulia.cxx ** Lexer for Julia. ** Reusing code from LexMatlab, LexPython and LexRust ** ** Written by Bertrand Lacoste ** **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #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 "OptionSet.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; static const int MAX_JULIA_IDENT_CHARS = 1023; // Options used for LexerJulia struct OptionsJulia { bool fold; bool foldComment; bool foldCompact; bool foldDocstring; bool foldSyntaxBased; bool highlightTypeannotation; bool highlightLexerror; OptionsJulia() { fold = true; foldComment = true; foldCompact = false; foldDocstring = true; foldSyntaxBased = true; highlightTypeannotation = false; highlightLexerror = false; } }; const char * const juliaWordLists[] = { "Primary keywords and identifiers", "Built in types", "Other keywords", "Built in functions", 0, }; struct OptionSetJulia : public OptionSet { OptionSetJulia() { DefineProperty("fold", &OptionsJulia::fold); DefineProperty("fold.compact", &OptionsJulia::foldCompact); DefineProperty("fold.comment", &OptionsJulia::foldComment); DefineProperty("fold.julia.docstring", &OptionsJulia::foldDocstring, "Fold multiline triple-doublequote strings, usually used to document a function or type above the definition."); DefineProperty("fold.julia.syntax.based", &OptionsJulia::foldSyntaxBased, "Set this property to 0 to disable syntax based folding."); DefineProperty("lexer.julia.highlight.typeannotation", &OptionsJulia::highlightTypeannotation, "This option enables highlighting of the type identifier after `::`."); DefineProperty("lexer.julia.highlight.lexerror", &OptionsJulia::highlightLexerror, "This option enables highlighting of syntax error int character or number definition."); DefineWordListSets(juliaWordLists); } }; LexicalClass juliaLexicalClasses[] = { // Lexer Julia SCLEX_JULIA SCE_JULIA_: 0, "SCE_JULIA_DEFAULT", "default", "White space", 1, "SCE_JULIA_COMMENT", "comment", "Comment", 2, "SCE_JULIA_NUMBER", "literal numeric", "Number", 3, "SCE_JULIA_KEYWORD1", "keyword", "Reserved keywords", 4, "SCE_JULIA_KEYWORD2", "identifier", "Builtin type names", 5, "SCE_JULIA_KEYWORD3", "identifier", "Constants", 6, "SCE_JULIA_CHAR", "literal string character", "Single quoted string", 7, "SCE_JULIA_OPERATOR", "operator", "Operator", 8, "SCE_JULIA_BRACKET", "bracket operator", "Bracket operator", 9, "SCE_JULIA_IDENTIFIER", "identifier", "Identifier", 10, "SCE_JULIA_STRING", "literal string", "Double quoted String", 11, "SCE_JULIA_SYMBOL", "literal string symbol", "Symbol", 12, "SCE_JULIA_MACRO", "macro preprocessor", "Macro", 13, "SCE_JULIA_STRINGINTERP", "literal string interpolated", "String interpolation", 14, "SCE_JULIA_DOCSTRING", "literal string documentation", "Docstring", 15, "SCE_JULIA_STRINGLITERAL", "literal string", "String literal prefix", 16, "SCE_JULIA_COMMAND", "literal string command", "Command", 17, "SCE_JULIA_COMMANDLITERAL", "literal string command", "Command literal prefix", 18, "SCE_JULIA_TYPEANNOT", "identifier type", "Type annotation identifier", 19, "SCE_JULIA_LEXERROR", "lexer error", "Lexing error", 20, "SCE_JULIA_KEYWORD4", "identifier", "Builtin function names", 21, "SCE_JULIA_TYPEOPERATOR", "operator type", "Type annotation operator", }; class LexerJulia : public DefaultLexer { WordList keywords; WordList identifiers2; WordList identifiers3; WordList identifiers4; OptionsJulia options; OptionSetJulia osJulia; public: explicit LexerJulia() : DefaultLexer("julia", SCLEX_JULIA, juliaLexicalClasses, ELEMENTS(juliaLexicalClasses)) { } virtual ~LexerJulia() { } void SCI_METHOD Release() override { delete this; } int SCI_METHOD Version() const override { return lvRelease5; } const char * SCI_METHOD PropertyNames() override { return osJulia.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osJulia.PropertyType(name); } const char * SCI_METHOD DescribeProperty(const char *name) override { return osJulia.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char * SCI_METHOD PropertyGet(const char *key) override { return osJulia.PropertyGet(key); } const char * SCI_METHOD DescribeWordListSets() override { return osJulia.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void * SCI_METHOD PrivateCall(int, void *) override { return 0; } static ILexer5 *LexerFactoryJulia() { return new LexerJulia(); } }; Sci_Position SCI_METHOD LexerJulia::PropertySet(const char *key, const char *val) { if (osJulia.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerJulia::WordListSet(int n, const char *wl) { WordList *wordListN = nullptr; switch (n) { case 0: wordListN = &keywords; break; case 1: wordListN = &identifiers2; break; case 2: wordListN = &identifiers3; break; case 3: wordListN = &identifiers4; break; } Sci_Position firstModification = -1; if (wordListN) { if (wordListN->Set(wl)) { firstModification = 0; } } return firstModification; } static inline bool IsJuliaOperator(int ch) { if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '-' || ch == '+' || ch == '=' || ch == '|' || ch == '<' || ch == '>' || ch == '/' || ch == '~' || ch == '\\' ) { return true; } return false; } // The list contains non-ascii unary operators static inline bool IsJuliaUnaryOperator (int ch) { if (ch == 0x00ac || ch == 0x221a || ch == 0x221b || ch == 0x221c || ch == 0x22c6 || ch == 0x00b1 || ch == 0x2213 ) { return true; } return false; } static inline bool IsJuliaParen (int ch) { if (ch == '(' || ch == ')' || ch == '{' || ch == '}' || ch == '[' || ch == ']' ) { return true; } return false; } // Unicode parsing from Julia source code: // https://github.com/JuliaLang/julia/blob/master/src/flisp/julia_extensions.c // keep the same function name to be easy to find again static int is_wc_cat_id_start(uint32_t wc) { const CharacterCategory cat = CategoriseCharacter((int) wc); return (cat == ccLu || cat == ccLl || cat == ccLt || cat == ccLm || cat == ccLo || cat == ccNl || cat == ccSc || // allow currency symbols // other symbols, but not arrows or replacement characters (cat == ccSo && !(wc >= 0x2190 && wc <= 0x21FF) && wc != 0xfffc && wc != 0xfffd && wc != 0x233f && // notslash wc != 0x00a6) || // broken bar // math symbol (category Sm) whitelist (wc >= 0x2140 && wc <= 0x2a1c && ((wc >= 0x2140 && wc <= 0x2144) || // ⅀, ⅁, ⅂, ⅃, ⅄ wc == 0x223f || wc == 0x22be || wc == 0x22bf || // ∿, ⊾, ⊿ wc == 0x22a4 || wc == 0x22a5 || // ⊤ ⊥ (wc >= 0x2200 && wc <= 0x2233 && (wc == 0x2202 || wc == 0x2205 || wc == 0x2206 || // ∂, ∅, ∆ wc == 0x2207 || wc == 0x220e || wc == 0x220f || // ∇, ∎, ∏ wc == 0x2200 || wc == 0x2203 || wc == 0x2204 || // ∀, ∃, ∄ wc == 0x2210 || wc == 0x2211 || // ∐, ∑ wc == 0x221e || wc == 0x221f || // ∞, ∟ wc >= 0x222b)) || // ∫, ∬, ∭, ∮, ∯, ∰, ∱, ∲, ∳ (wc >= 0x22c0 && wc <= 0x22c3) || // N-ary big ops: ⋀, ⋁, ⋂, ⋃ (wc >= 0x25F8 && wc <= 0x25ff) || // ◸, ◹, ◺, ◻, ◼, ◽, ◾, ◿ (wc >= 0x266f && (wc == 0x266f || wc == 0x27d8 || wc == 0x27d9 || // ♯, ⟘, ⟙ (wc >= 0x27c0 && wc <= 0x27c1) || // ⟀, ⟁ (wc >= 0x29b0 && wc <= 0x29b4) || // ⦰, ⦱, ⦲, ⦳, ⦴ (wc >= 0x2a00 && wc <= 0x2a06) || // ⨀, ⨁, ⨂, ⨃, ⨄, ⨅, ⨆ (wc >= 0x2a09 && wc <= 0x2a16) || // ⨉, ⨊, ⨋, ⨌, ⨍, ⨎, ⨏, ⨐, ⨑, ⨒, ⨓, ⨔, ⨕, ⨖ wc == 0x2a1b || wc == 0x2a1c)))) || // ⨛, ⨜ (wc >= 0x1d6c1 && // variants of \nabla and \partial (wc == 0x1d6c1 || wc == 0x1d6db || wc == 0x1d6fb || wc == 0x1d715 || wc == 0x1d735 || wc == 0x1d74f || wc == 0x1d76f || wc == 0x1d789 || wc == 0x1d7a9 || wc == 0x1d7c3)) || // super- and subscript +-=() (wc >= 0x207a && wc <= 0x207e) || (wc >= 0x208a && wc <= 0x208e) || // angle symbols (wc >= 0x2220 && wc <= 0x2222) || // ∠, ∡, ∢ (wc >= 0x299b && wc <= 0x29af) || // ⦛, ⦜, ⦝, ⦞, ⦟, ⦠, ⦡, ⦢, ⦣, ⦤, ⦥, ⦦, ⦧, ⦨, ⦩, ⦪, ⦫, ⦬, ⦭, ⦮, ⦯ // Other_ID_Start wc == 0x2118 || wc == 0x212E || // ℘, ℮ (wc >= 0x309B && wc <= 0x309C) || // katakana-hiragana sound marks // bold-digits and double-struck digits (wc >= 0x1D7CE && wc <= 0x1D7E1)); // 𝟎 through 𝟗 (inclusive), 𝟘 through 𝟡 (inclusive) } static inline bool IsIdentifierFirstCharacter (int ch) { if (IsASCII(ch)) { return (bool) (isalpha(ch) || ch == '_'); } if (ch < 0xA1 || ch > 0x10ffff) { return false; } return is_wc_cat_id_start((uint32_t) ch); } static inline bool IsIdentifierCharacter (int ch) { if (IsASCII(ch)) { return (bool) (isalnum(ch) || ch == '_' || ch == '!'); } if (ch < 0xA1 || ch > 0x10ffff) { return false; } if (is_wc_cat_id_start((uint32_t) ch)) { return true; } const CharacterCategory cat = CategoriseCharacter(ch); if (cat == ccMn || cat == ccMc || cat == ccNd || cat == ccPc || cat == ccSk || cat == ccMe || cat == ccNo || // primes (single, double, triple, their reverses, and quadruple) (ch >= 0x2032 && ch <= 0x2037) || (ch == 0x2057)) { return true; } return false; } // keep the same function name to be easy to find again static const uint32_t opsuffs[] = { 0x00b2, // ² 0x00b3, // ³ 0x00b9, // ¹ 0x02b0, // ʰ 0x02b2, // ʲ 0x02b3, // ʳ 0x02b7, // ʷ 0x02b8, // ʸ 0x02e1, // ˡ 0x02e2, // ˢ 0x02e3, // ˣ 0x1d2c, // ᴬ 0x1d2e, // ᴮ 0x1d30, // ᴰ 0x1d31, // ᴱ 0x1d33, // ᴳ 0x1d34, // ᴴ 0x1d35, // ᴵ 0x1d36, // ᴶ 0x1d37, // ᴷ 0x1d38, // ᴸ 0x1d39, // ᴹ 0x1d3a, // ᴺ 0x1d3c, // ᴼ 0x1d3e, // ᴾ 0x1d3f, // ᴿ 0x1d40, // ᵀ 0x1d41, // ᵁ 0x1d42, // ᵂ 0x1d43, // ᵃ 0x1d47, // ᵇ 0x1d48, // ᵈ 0x1d49, // ᵉ 0x1d4d, // ᵍ 0x1d4f, // ᵏ 0x1d50, // ᵐ 0x1d52, // ᵒ 0x1d56, // ᵖ 0x1d57, // ᵗ 0x1d58, // ᵘ 0x1d5b, // ᵛ 0x1d5d, // ᵝ 0x1d5e, // ᵞ 0x1d5f, // ᵟ 0x1d60, // ᵠ 0x1d61, // ᵡ 0x1d62, // ᵢ 0x1d63, // ᵣ 0x1d64, // ᵤ 0x1d65, // ᵥ 0x1d66, // ᵦ 0x1d67, // ᵧ 0x1d68, // ᵨ 0x1d69, // ᵩ 0x1d6a, // ᵪ 0x1d9c, // ᶜ 0x1da0, // ᶠ 0x1da5, // ᶥ 0x1da6, // ᶦ 0x1dab, // ᶫ 0x1db0, // ᶰ 0x1db8, // ᶸ 0x1dbb, // ᶻ 0x1dbf, // ᶿ 0x2032, // ′ 0x2033, // ″ 0x2034, // ‴ 0x2035, // ‵ 0x2036, // ‶ 0x2037, // ‷ 0x2057, // ⁗ 0x2070, // ⁰ 0x2071, // ⁱ 0x2074, // ⁴ 0x2075, // ⁵ 0x2076, // ⁶ 0x2077, // ⁷ 0x2078, // ⁸ 0x2079, // ⁹ 0x207a, // ⁺ 0x207b, // ⁻ 0x207c, // ⁼ 0x207d, // ⁽ 0x207e, // ⁾ 0x207f, // ⁿ 0x2080, // ₀ 0x2081, // ₁ 0x2082, // ₂ 0x2083, // ₃ 0x2084, // ₄ 0x2085, // ₅ 0x2086, // ₆ 0x2087, // ₇ 0x2088, // ₈ 0x2089, // ₉ 0x208a, // ₊ 0x208b, // ₋ 0x208c, // ₌ 0x208d, // ₍ 0x208e, // ₎ 0x2090, // ₐ 0x2091, // ₑ 0x2092, // ₒ 0x2093, // ₓ 0x2095, // ₕ 0x2096, // ₖ 0x2097, // ₗ 0x2098, // ₘ 0x2099, // ₙ 0x209a, // ₚ 0x209b, // ₛ 0x209c, // ₜ 0x2c7c, // ⱼ 0x2c7d, // ⱽ 0xa71b, // ꜛ 0xa71c, // ꜜ 0xa71d // ꜝ }; static const size_t opsuffs_len = sizeof(opsuffs) / (sizeof(uint32_t)); // keep the same function name to be easy to find again static bool jl_op_suffix_char(uint32_t wc) { if (wc < 0xA1 || wc > 0x10ffff) { return false; } const CharacterCategory cat = CategoriseCharacter((int) wc); if (cat == ccMn || cat == ccMc || cat == ccMe) { return true; } for (size_t i = 0; i < opsuffs_len; ++i) { if (wc == opsuffs[i]) { return true; } } return false; } // keep the same function name to be easy to find again static bool never_id_char(uint32_t wc) { const CharacterCategory cat = CategoriseCharacter((int) wc); return ( // spaces and control characters: (cat >= ccZs && cat <= ccCs) || // ASCII and Latin1 non-connector punctuation (wc < 0xff && cat >= ccPd && cat <= ccPo) || wc == '`' || // mathematical brackets (wc >= 0x27e6 && wc <= 0x27ef) || // angle, corner, and lenticular brackets (wc >= 0x3008 && wc <= 0x3011) || // tortoise shell, square, and more lenticular brackets (wc >= 0x3014 && wc <= 0x301b) || // fullwidth parens (wc == 0xff08 || wc == 0xff09) || // fullwidth square brackets (wc == 0xff3b || wc == 0xff3d)); } static bool IsOperatorFirstCharacter (int ch) { if (IsASCII(ch)) { if (IsJuliaOperator(ch) || ch == '!' || ch == '?' || ch == ':' || ch == ';' || ch == ',' || ch == '.' ) { return true; }else { return false; } } else if (is_wc_cat_id_start((uint32_t) ch)) { return false; } else if (IsJuliaUnaryOperator(ch) || ! never_id_char((uint32_t) ch)) { return true; } return false; } static bool IsOperatorCharacter (int ch) { if (IsOperatorFirstCharacter(ch) || (!IsASCII(ch) && jl_op_suffix_char((uint32_t) ch)) ) { return true; } return false; } static bool CheckBoundsIndexing(char *str) { if (strcmp("begin", str) == 0 || strcmp("end", str) == 0 ) { return true; } return false; } static int CheckKeywordFoldPoint(char *str) { if (strcmp ("if", str) == 0 || strcmp ("for", str) == 0 || strcmp ("while", str) == 0 || strcmp ("try", str) == 0 || strcmp ("do", str) == 0 || strcmp ("begin", str) == 0 || strcmp ("let", str) == 0 || strcmp ("baremodule", str) == 0 || strcmp ("quote", str) == 0 || strcmp ("module", str) == 0 || strcmp ("struct", str) == 0 || strcmp ("type", str) == 0 || strcmp ("macro", str) == 0 || strcmp ("function", str) == 0) { return 1; } if (strcmp("end", str) == 0) { return -1; } return 0; } static bool IsNumberExpon(int ch, int base) { if ((base == 10 && (ch == 'e' || ch == 'E' || ch == 'f')) || (base == 16 && (ch == 'p' || ch == 'P'))) { return true; } return false; } /* Scans a sequence of digits, returning true if it found any. */ static bool ScanDigits(StyleContext& sc, int base, bool allow_sep) { bool found = false; for (;;) { if (IsADigit(sc.chNext, base) || (allow_sep && sc.chNext == '_')) { found = true; sc.Forward(); } else { break; } } return found; } static inline bool ScanNHexas(StyleContext &sc, int max) { int n = 0; bool error = false; sc.Forward(); if (!IsADigit(sc.ch, 16)) { error = true; } else { while (IsADigit(sc.ch, 16) && n < max) { sc.Forward(); n++; } } return error; } static void resumeCharacter(StyleContext &sc, bool lexerror) { bool error = false; // ''' case if (sc.chPrev == '\'' && sc.ch == '\'' && sc.chNext == '\'') { sc.Forward(); sc.ForwardSetState(SCE_JULIA_DEFAULT); return; } else if (lexerror && sc.chPrev == '\'' && sc.ch == '\'') { sc.ChangeState(SCE_JULIA_LEXERROR); sc.ForwardSetState(SCE_JULIA_DEFAULT); // Escape characters } else if (sc.ch == '\\') { sc.Forward(); if (sc.ch == '\'' || sc.ch == '\\' ) { sc.Forward(); } else if (sc.ch == 'n' || sc.ch == 't' || sc.ch == 'a' || sc.ch == 'b' || sc.ch == 'e' || sc.ch == 'f' || sc.ch == 'r' || sc.ch == 'v' ) { sc.Forward(); } else if (sc.ch == 'x') { error |= ScanNHexas(sc, 2); } else if (sc.ch == 'u') { error |= ScanNHexas(sc, 4); } else if (sc.ch == 'U') { error |= ScanNHexas(sc, 8); } else if (IsADigit(sc.ch, 8)) { int n = 1; int max = 3; sc.Forward(); while (IsADigit(sc.ch, 8) && n < max) { sc.Forward(); n++; } } if (lexerror) { if (sc.ch != '\'') { error = true; while (sc.ch != '\'' && sc.ch != '\r' && sc.ch != '\n') { sc.Forward(); } } if (error) { sc.ChangeState(SCE_JULIA_LEXERROR); sc.ForwardSetState(SCE_JULIA_DEFAULT); } } } else if (lexerror) { if (sc.ch < 0x20 || sc.ch > 0x10ffff) { error = true; } else { // single character sc.Forward(); if (sc.ch != '\'') { error = true; while (sc.ch != '\'' && sc.ch != '\r' && sc.ch != '\n') { sc.Forward(); } } } if (error) { sc.ChangeState(SCE_JULIA_LEXERROR); sc.ForwardSetState(SCE_JULIA_DEFAULT); } } // closing quote if (sc.ch == '\'') { if (sc.chNext == '\'') { sc.Forward(); } else { sc.ForwardSetState(SCE_JULIA_DEFAULT); } } } static inline bool IsACharacter(StyleContext &sc) { return (sc.chPrev == '\'' && sc.chNext == '\''); } static void ScanParenInterpolation(StyleContext &sc) { // TODO: no syntax highlighting inside a string interpolation // Level of nested parenthesis int interp_level = 0; // If true, it is inside a string and parenthesis are not counted. bool allow_paren_string = false; // check for end of states for (; sc.More(); sc.Forward()) { // TODO: check corner cases for nested string interpolation // TODO: check corner cases with Command inside interpolation if ( sc.ch == '\"' && sc.chPrev != '\\') { // Toggle the string environment (parenthesis are not counted inside a string) allow_paren_string = !allow_paren_string; } else if ( !allow_paren_string ) { if ( sc.ch == '(' && !IsACharacter(sc) ) { interp_level ++; } else if ( sc.ch == ')' && !IsACharacter(sc) && interp_level > 0 ) { interp_level --; if (interp_level == 0) { // Exit interpolation return; } } } } } /* * Start parsing a number, parse the base. */ static void initNumber (StyleContext &sc, int &base, bool &with_dot) { base = 10; with_dot = false; sc.SetState(SCE_JULIA_NUMBER); if (sc.ch == '0') { if (sc.chNext == 'x') { sc.Forward(); base = 16; if (sc.chNext == '.') { sc.Forward(); with_dot = true; } } else if (sc.chNext == 'o') { sc.Forward(); base = 8; } else if (sc.chNext == 'b') { sc.Forward(); base = 2; } } else if (sc.ch == '.') { with_dot = true; } } /* * Resume parsing a String or Command, bounded by the `quote` character (\" or \`) * The `triple` argument specifies if it is a triple-quote String or Command. * Interpolation is detected (with `$`), and parsed if `allow_interp` is true. */ static void resumeStringLike(StyleContext &sc, int quote, bool triple, bool allow_interp, bool full_highlight) { int stylePrev = sc.state; bool checkcurrent = false; // Escape characters if (sc.ch == '\\') { if (sc.chNext == quote || sc.chNext == '\\' || sc.chNext == '$') { sc.Forward(); } } else if (allow_interp && sc.ch == '$') { // If the interpolation is only of a variable, do not change state if (sc.chNext == '(') { if (full_highlight) { sc.SetState(SCE_JULIA_STRINGINTERP); } else { sc.ForwardSetState(SCE_JULIA_STRINGINTERP); } ScanParenInterpolation(sc); sc.ForwardSetState(stylePrev); checkcurrent = true; } else if (full_highlight && IsIdentifierFirstCharacter(sc.chNext)) { sc.SetState(SCE_JULIA_STRINGINTERP); sc.Forward(); sc.Forward(); for (; sc.More(); sc.Forward()) { if (! IsIdentifierCharacter(sc.ch)) { break; } } sc.SetState(stylePrev); checkcurrent = true; } if (checkcurrent) { // Check that the current character is not a special char, // otherwise it will be skipped resumeStringLike(sc, quote, triple, allow_interp, full_highlight); } } else if (sc.ch == quote) { if (triple) { if (sc.chNext == quote && sc.GetRelativeCharacter(2) == quote) { // Move to the end of the triple quotes Sci_PositionU nextIndex = sc.currentPos + 2; while (nextIndex > sc.currentPos && sc.More()) { sc.Forward(); } sc.ForwardSetState(SCE_JULIA_DEFAULT); } } else { sc.ForwardSetState(SCE_JULIA_DEFAULT); } } } static void resumeCommand(StyleContext &sc, bool triple, bool allow_interp) { return resumeStringLike(sc, '`', triple, allow_interp, true); } static void resumeString(StyleContext &sc, bool triple, bool allow_interp) { return resumeStringLike(sc, '"', triple, allow_interp, true); } static void resumeNumber (StyleContext &sc, int base, bool &with_dot, bool lexerror) { if (IsNumberExpon(sc.ch, base)) { if (IsADigit(sc.chNext) || sc.chNext == '+' || sc.chNext == '-') { sc.Forward(); // Capture all digits ScanDigits(sc, 10, false); sc.Forward(); } sc.SetState(SCE_JULIA_DEFAULT); } else if (sc.ch == '.' && sc.chNext == '.') { // Interval operator `..` sc.SetState(SCE_JULIA_OPERATOR); sc.Forward(); sc.ForwardSetState(SCE_JULIA_DEFAULT); } else if (sc.ch == '.' && !with_dot) { with_dot = true; ScanDigits(sc, base, true); } else if (IsADigit(sc.ch, base) || sc.ch == '_') { ScanDigits(sc, base, true); } else if (IsADigit(sc.ch) && !IsADigit(sc.ch, base)) { if (lexerror) { sc.ChangeState(SCE_JULIA_LEXERROR); } ScanDigits(sc, 10, false); sc.ForwardSetState(SCE_JULIA_DEFAULT); } else { sc.SetState(SCE_JULIA_DEFAULT); } } static void resumeOperator (StyleContext &sc) { if (sc.chNext == ':' && (sc.ch == ':' || sc.ch == '<' || (sc.ch == '>' && (sc.chPrev != '-' && sc.chPrev != '=')))) { // Case `:a=>:b` sc.Forward(); sc.ForwardSetState(SCE_JULIA_DEFAULT); } else if (sc.ch == ':') { // Case `foo(:baz,:baz)` or `:one+:two` // Let the default case switch decide if it is a symbol sc.SetState(SCE_JULIA_DEFAULT); } else if (sc.ch == '\'') { sc.SetState(SCE_JULIA_DEFAULT); } else if ((sc.ch == '.' && sc.chPrev != '.') || IsIdentifierFirstCharacter(sc.ch) || (! (sc.chPrev == '.' && IsOperatorFirstCharacter(sc.ch)) && ! IsOperatorCharacter(sc.ch)) ) { sc.SetState(SCE_JULIA_DEFAULT); } } void SCI_METHOD LexerJulia::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { PropSetSimple props; Accessor styler(pAccess, &props); Sci_Position pos = startPos; styler.StartAt(pos); styler.StartSegment(pos); // use the line state of each line to store block/multiline states Sci_Position curLine = styler.GetLine(startPos); // Default is false for everything and 0 counters. int lineState = (curLine > 0) ? styler.GetLineState(curLine-1) : 0; bool transpose = (lineState >> 0) & 0x01; // 1 bit to know if ' is allowed to mean transpose bool istripledocstring = (lineState >> 1) & 0x01; // 1 bit to know if we are in a triple doublequotes string bool triple_backtick = (lineState >> 2) & 0x01; // 1 bit to know if we are in a triple backtick command bool israwstring = (lineState >> 3) & 0x01; // 1 bit to know if we are in a raw string int indexing_level = (int)((lineState >> 4) & 0x0F); // 4 bits of bracket nesting counter int list_comprehension = (int)((lineState >> 8) & 0x0F); // 4 bits of parenthesis nesting counter int commentDepth = (int)((lineState >> 12) & 0x0F); // 4 bits of nested comment counter // base for parsing number int base = 10; // number has a float dot ? bool with_dot = false; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { //// check for end of states switch (sc.state) { case SCE_JULIA_BRACKET: sc.SetState(SCE_JULIA_DEFAULT); break; case SCE_JULIA_OPERATOR: resumeOperator(sc); break; case SCE_JULIA_TYPEOPERATOR: sc.SetState(SCE_JULIA_DEFAULT); break; case SCE_JULIA_TYPEANNOT: if (! IsIdentifierCharacter(sc.ch)) { sc.SetState(SCE_JULIA_DEFAULT); } break; case SCE_JULIA_IDENTIFIER: // String literal if (sc.ch == '\"') { // If the string literal has a prefix, interpolation is disabled israwstring = true; sc.ChangeState(SCE_JULIA_STRINGLITERAL); sc.SetState(SCE_JULIA_DEFAULT); } else if (sc.ch == '`') { // If the string literal has a prefix, interpolation is disabled israwstring = true; sc.ChangeState(SCE_JULIA_COMMANDLITERAL); sc.SetState(SCE_JULIA_DEFAULT); // Continue if the character is an identifier character } else if (! IsIdentifierCharacter(sc.ch)) { char s[MAX_JULIA_IDENT_CHARS + 1]; sc.GetCurrent(s, sizeof(s)); // Treat the keywords differently if we are indexing or not if ( indexing_level > 0 && CheckBoundsIndexing(s)) { // Inside [], (), `begin` and `end` are numbers not block keywords sc.ChangeState(SCE_JULIA_NUMBER); transpose = false; } else { if (keywords.InList(s)) { sc.ChangeState(SCE_JULIA_KEYWORD1); transpose = false; } else if (identifiers2.InList(s)) { sc.ChangeState(SCE_JULIA_KEYWORD2); transpose = false; } else if (identifiers3.InList(s)) { sc.ChangeState(SCE_JULIA_KEYWORD3); transpose = false; } else if (identifiers4.InList(s)) { sc.ChangeState(SCE_JULIA_KEYWORD4); // These identifiers can be used for variable names also, // so transpose is not forbidden. //transpose = false; } } sc.SetState(SCE_JULIA_DEFAULT); // TODO: recognize begin-end blocks inside list comprehension // b = [(begin n%2; n*2 end) for n in 1:10] // TODO: recognize better comprehension for-if to avoid problem with code-folding // c = [(if isempty(a); missing else first(b) end) for (a, b) in zip(l1, l2)] } break; case SCE_JULIA_NUMBER: resumeNumber(sc, base, with_dot, options.highlightLexerror); break; case SCE_JULIA_CHAR: resumeCharacter(sc, options.highlightLexerror); break; case SCE_JULIA_DOCSTRING: resumeString(sc, true, !israwstring); if (sc.state == SCE_JULIA_DEFAULT && israwstring) { israwstring = false; } break; case SCE_JULIA_STRING: resumeString(sc, false, !israwstring); if (sc.state == SCE_JULIA_DEFAULT && israwstring) { israwstring = false; } break; case SCE_JULIA_COMMAND: resumeCommand(sc, triple_backtick, !israwstring); break; case SCE_JULIA_MACRO: if (IsASpace(sc.ch) || ! IsIdentifierCharacter(sc.ch)) { sc.SetState(SCE_JULIA_DEFAULT); } break; case SCE_JULIA_SYMBOL: if (! IsIdentifierCharacter(sc.ch)) { sc.SetState(SCE_JULIA_DEFAULT); } break; case SCE_JULIA_COMMENT: if( commentDepth > 0 ) { // end or start of a nested a block comment if ( sc.ch == '=' && sc.chNext == '#') { commentDepth --; sc.Forward(); if (commentDepth == 0) { sc.ForwardSetState(SCE_JULIA_DEFAULT); } } else if( sc.ch == '#' && sc.chNext == '=') { commentDepth ++; sc.Forward(); } } else { // single line comment if (sc.atLineEnd || sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_JULIA_DEFAULT); transpose = false; } } break; } // check start of a new state if (sc.state == SCE_JULIA_DEFAULT) { if (sc.ch == '#') { sc.SetState(SCE_JULIA_COMMENT); // increment depth if we are a block comment if(sc.chNext == '=') { commentDepth ++; sc.Forward(); } } else if (sc.ch == '!') { sc.SetState(SCE_JULIA_OPERATOR); transpose = false; } else if (sc.ch == '\'') { if (transpose) { sc.SetState(SCE_JULIA_OPERATOR); } else { sc.SetState(SCE_JULIA_CHAR); } } else if (sc.ch == '\"') { istripledocstring = (sc.chNext == '\"' && sc.GetRelativeCharacter(2) == '\"'); if (istripledocstring) { sc.SetState(SCE_JULIA_DOCSTRING); // Move to the end of the triple quotes Sci_PositionU nextIndex = sc.currentPos + 2; while (nextIndex > sc.currentPos && sc.More()) { sc.Forward(); } } else { sc.SetState(SCE_JULIA_STRING); } } else if (sc.ch == '`') { triple_backtick = (sc.chNext == '`' && sc.GetRelativeCharacter(2) == '`'); sc.SetState(SCE_JULIA_COMMAND); if (triple_backtick) { // Move to the end of the triple backticks Sci_PositionU nextIndex = sc.currentPos + 2; while (nextIndex > sc.currentPos && sc.More()) { sc.Forward(); } } } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { initNumber(sc, base, with_dot); } else if (IsIdentifierFirstCharacter(sc.ch)) { sc.SetState(SCE_JULIA_IDENTIFIER); transpose = true; } else if (sc.ch == '@') { sc.SetState(SCE_JULIA_MACRO); transpose = false; // Several parsing of operators, should keep the order of `if` blocks } else if ((sc.ch == ':' || sc.ch == '<' || sc.ch == '>') && sc.chNext == ':') { sc.SetState(SCE_JULIA_TYPEOPERATOR); sc.Forward(); // Highlight the next identifier, if option is set if (options.highlightTypeannotation && IsIdentifierFirstCharacter(sc.chNext)) { sc.ForwardSetState(SCE_JULIA_TYPEANNOT); } } else if (sc.ch == ':') { // TODO: improve detection of range // should be solved with begin-end parsing // `push!(arr, s1 :s2)` and `a[begin :end] if (IsIdentifierFirstCharacter(sc.chNext) && ! IsIdentifierCharacter(sc.chPrev) && sc.chPrev != ')' && sc.chPrev != ']' ) { sc.SetState(SCE_JULIA_SYMBOL); } else { sc.SetState(SCE_JULIA_OPERATOR); } } else if (IsJuliaParen(sc.ch)) { if (sc.ch == '[') { list_comprehension ++; indexing_level ++; } else if (sc.ch == ']' && (indexing_level > 0)) { list_comprehension --; indexing_level --; } else if (sc.ch == '(') { list_comprehension ++; } else if (sc.ch == ')' && (list_comprehension > 0)) { list_comprehension --; } if (sc.ch == ')' || sc.ch == ']' || sc.ch == '}') { transpose = true; } else { transpose = false; } sc.SetState(SCE_JULIA_BRACKET); } else if (IsOperatorFirstCharacter(sc.ch)) { transpose = false; sc.SetState(SCE_JULIA_OPERATOR); } else { transpose = false; } } // update the line information (used for line-by-line lexing and folding) if (sc.atLineEnd) { // set the line state to the current state curLine = styler.GetLine(sc.currentPos); lineState = ((transpose ? 1 : 0) << 0) | ((istripledocstring ? 1 : 0) << 1) | ((triple_backtick ? 1 : 0) << 2) | ((israwstring ? 1 : 0) << 3) | ((indexing_level & 0x0F) << 4) | ((list_comprehension & 0x0F) << 8) | ((commentDepth & 0x0F) << 12); styler.SetLineState(curLine, lineState); } } sc.Complete(); } void SCI_METHOD LexerJulia::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { if (!options.fold) return; LexAccessor styler(pAccess); Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; int lineState = 0; if (lineCurrent > 0) { levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; lineState = styler.GetLineState(lineCurrent-1); } // level of nested brackets int indexing_level = (int)((lineState >> 4) & 0x0F); // 4 bits of bracket nesting counter // level of nested parenthesis or brackets int list_comprehension = (int)((lineState >> 8) & 0x0F); // 4 bits of parenthesis nesting counter //int commentDepth = (int)((lineState >> 12) & 0x0F); // 4 bits of nested comment counter Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1); int levelNext = levelCurrent; char chNext = styler[startPos]; int stylePrev = styler.StyleAt(startPos - 1); int styleNext = styler.StyleAt(startPos); int style = initStyle; char word[100]; int wordlen = 0; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = i == (lineStartNext-1); // a start/end of comment block if (options.foldComment && style == SCE_JULIA_COMMENT) { // start of block comment if (ch == '#' && chNext == '=') { levelNext ++; } // end of block comment if (ch == '=' && chNext == '#' && levelNext > 0) { levelNext --; } } // Syntax based folding, accounts for list comprehension if (options.foldSyntaxBased) { // list comprehension allow `for`, `if` and `begin` without `end` if (style == SCE_JULIA_BRACKET) { if (ch == '[') { list_comprehension ++; indexing_level ++; levelNext ++; } else if (ch == ']') { list_comprehension --; indexing_level --; levelNext --; } else if (ch == '(') { list_comprehension ++; levelNext ++; } else if (ch == ')') { list_comprehension --; levelNext --; } // check non-negative if (indexing_level < 0) { indexing_level = 0; } if (list_comprehension < 0) { list_comprehension = 0; } } // keyword if (style == SCE_JULIA_KEYWORD1) { word[wordlen++] = static_cast(ch); if (wordlen == 100) { // prevent overflow word[0] = '\0'; wordlen = 1; } if (styleNext != SCE_JULIA_KEYWORD1) { word[wordlen] = '\0'; wordlen = 0; if (list_comprehension <= 0 && indexing_level <= 0) { levelNext += CheckKeywordFoldPoint(word); } } } } // Docstring if (options.foldDocstring) { if (stylePrev != SCE_JULIA_DOCSTRING && style == SCE_JULIA_DOCSTRING) { levelNext ++; } else if (style == SCE_JULIA_DOCSTRING && styleNext != SCE_JULIA_DOCSTRING) { levelNext --; } } // check non-negative level if (levelNext < 0) { levelNext = 0; } if (!IsASpace(ch)) { visibleChars++; } stylePrev = style; if (atEOL || (i == endPos-1)) { int levelUse = levelCurrent; int lev = levelUse | levelNext << 16; if (visibleChars == 0 && options.foldCompact) { lev |= SC_FOLDLEVELWHITEFLAG; } if (levelUse < levelNext) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; lineStartNext = styler.LineStart(lineCurrent+1); levelCurrent = levelNext; if (atEOL && (i == static_cast(styler.Length() - 1))) { // There is an empty line at end of file so give it same level and empty styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } visibleChars = 0; } } } LexerModule lmJulia(SCLEX_JULIA, LexerJulia::LexerFactoryJulia, "julia", juliaWordLists); ================================================ FILE: lexilla/lexers/LexKVIrc.cxx ================================================ // Scintilla source code edit control /** @file LexKVIrc.cxx ** Lexer for KVIrc script. **/ // Copyright 2013 by OmegaPhil , based in // part from LexPython Copyright 1998-2002 by Neil Hodgson // and LexCmake Copyright 2007 by Cristian Adam // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; /* KVIrc Script syntactic rules: http://www.kvirc.net/doc/doc_syntactic_rules.html */ /* Utility functions */ static inline bool IsAWordChar(int ch) { /* Keyword list includes modules, i.e. words including '.', and * alias namespaces include ':' */ return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' || ch == ':'); } static inline bool IsAWordStart(int ch) { /* Functions (start with '$') are treated separately to keywords */ return (ch < 0x80) && (isalnum(ch) || ch == '_' ); } /* Interface function called by Scintilla to request some text to be syntax highlighted */ static void ColouriseKVIrcDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { /* Fetching style context */ StyleContext sc(startPos, length, initStyle, styler); /* Accessing keywords and function-marking keywords */ WordList &keywords = *keywordlists[0]; WordList &functionKeywords = *keywordlists[1]; /* Looping for all characters - only automatically moving forward * when asked for (transitions leaving strings and keywords do this * already) */ bool next = true; for( ; sc.More(); next ? sc.Forward() : (void)0 ) { /* Resetting next */ next = true; /* Dealing with different states */ switch (sc.state) { case SCE_KVIRC_DEFAULT: /* Detecting single-line comments * Unfortunately KVIrc script allows raw '#' to be used, and appending # to an array returns * its length... * Going for a compromise where single line comments not * starting on a newline are allowed in all cases except * when they are preceeded with an opening bracket or comma * (this will probably be the most common style a valid * string-less channel name will be used with), with the * array length case included */ if ( (sc.ch == '#' && sc.atLineStart) || (sc.ch == '#' && ( sc.chPrev != '(' && sc.chPrev != ',' && sc.chPrev != ']') ) ) { sc.SetState(SCE_KVIRC_COMMENT); break; } /* Detecting multi-line comments */ if (sc.Match('/', '*')) { sc.SetState(SCE_KVIRC_COMMENTBLOCK); break; } /* Detecting strings */ if (sc.ch == '"') { sc.SetState(SCE_KVIRC_STRING); break; } /* Detecting functions */ if (sc.ch == '$') { sc.SetState(SCE_KVIRC_FUNCTION); break; } /* Detecting variables */ if (sc.ch == '%') { sc.SetState(SCE_KVIRC_VARIABLE); break; } /* Detecting numbers - isdigit is unsafe as it does not * validate, use CharacterSet.h functions */ if (IsADigit(sc.ch)) { sc.SetState(SCE_KVIRC_NUMBER); break; } /* Detecting words */ if (IsAWordStart(sc.ch) && IsAWordChar(sc.chNext)) { sc.SetState(SCE_KVIRC_WORD); sc.Forward(); break; } /* Detecting operators */ if (isoperator(sc.ch)) { sc.SetState(SCE_KVIRC_OPERATOR); break; } break; case SCE_KVIRC_COMMENT: /* Breaking out of single line comment when a newline * is introduced */ if (sc.ch == '\r' || sc.ch == '\n') { sc.SetState(SCE_KVIRC_DEFAULT); break; } break; case SCE_KVIRC_COMMENTBLOCK: /* Detecting end of multi-line comment */ if (sc.Match('*', '/')) { // Moving the current position forward two characters // so that '*/' is included in the comment sc.Forward(2); sc.SetState(SCE_KVIRC_DEFAULT); /* Comment has been exited and the current position * moved forward, yet the new current character * has yet to be defined - loop without moving * forward again */ next = false; break; } break; case SCE_KVIRC_STRING: /* Detecting end of string - closing speechmarks */ if (sc.ch == '"') { /* Allowing escaped speechmarks to pass */ if (sc.chPrev == '\\') break; /* Moving the current position forward to capture the * terminating speechmarks, and ending string */ sc.ForwardSetState(SCE_KVIRC_DEFAULT); /* String has been exited and the current position * moved forward, yet the new current character * has yet to be defined - loop without moving * forward again */ next = false; break; } /* Functions and variables are now highlighted in strings * Detecting functions */ if (sc.ch == '$') { /* Allowing escaped functions to pass */ if (sc.chPrev == '\\') break; sc.SetState(SCE_KVIRC_STRING_FUNCTION); break; } /* Detecting variables */ if (sc.ch == '%') { /* Allowing escaped variables to pass */ if (sc.chPrev == '\\') break; sc.SetState(SCE_KVIRC_STRING_VARIABLE); break; } /* Breaking out of a string when a newline is introduced */ if (sc.ch == '\r' || sc.ch == '\n') { /* Allowing escaped newlines */ if (sc.chPrev == '\\') break; sc.SetState(SCE_KVIRC_DEFAULT); break; } break; case SCE_KVIRC_FUNCTION: case SCE_KVIRC_VARIABLE: /* Detecting the end of a function/variable (word) */ if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_KVIRC_DEFAULT); /* Word has been exited yet the current character * has yet to be defined - loop without moving * forward again */ next = false; break; } break; case SCE_KVIRC_STRING_FUNCTION: case SCE_KVIRC_STRING_VARIABLE: /* A function or variable in a string * Detecting the end of a function/variable (word) */ if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_KVIRC_STRING); /* Word has been exited yet the current character * has yet to be defined - loop without moving * forward again */ next = false; break; } break; case SCE_KVIRC_NUMBER: /* Detecting the end of a number */ if (!IsADigit(sc.ch)) { sc.SetState(SCE_KVIRC_DEFAULT); /* Number has been exited yet the current character * has yet to be defined - loop without moving * forward */ next = false; break; } break; case SCE_KVIRC_OPERATOR: /* Because '%' is an operator but is also the marker for * a variable, I need to always treat operators as single * character strings and therefore redo their detection * after every character */ sc.SetState(SCE_KVIRC_DEFAULT); /* Operator has been exited yet the current character * has yet to be defined - loop without moving * forward */ next = false; break; case SCE_KVIRC_WORD: /* Detecting the end of a word */ if (!IsAWordChar(sc.ch)) { /* Checking if the word was actually a keyword - * fetching the current word, NULL-terminated like * the keyword list */ char s[100]; Sci_Position wordLen = sc.currentPos - styler.GetStartSegment(); if (wordLen > 99) wordLen = 99; /* Include '\0' in buffer */ Sci_Position i; for( i = 0; i < wordLen; ++i ) { s[i] = styler.SafeGetCharAt( styler.GetStartSegment() + i ); } s[wordLen] = '\0'; /* Actually detecting keywords and fixing the state */ if (keywords.InList(s)) { /* The SetState call actually commits the * previous keyword state */ sc.ChangeState(SCE_KVIRC_KEYWORD); } else if (functionKeywords.InList(s)) { // Detecting function keywords and fixing the state sc.ChangeState(SCE_KVIRC_FUNCTION_KEYWORD); } /* Transitioning to default and committing the previous * word state */ sc.SetState(SCE_KVIRC_DEFAULT); /* Word has been exited yet the current character * has yet to be defined - loop without moving * forward again */ next = false; break; } break; } } /* Indicating processing is complete */ sc.Complete(); } static void FoldKVIrcDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, WordList *[], Accessor &styler) { /* Based on CMake's folder */ /* Exiting if folding isnt enabled */ if ( styler.GetPropertyInt("fold") == 0 ) return; /* Obtaining current line number*/ Sci_Position currentLine = styler.GetLine(startPos); /* Obtaining starting character - indentation is done on a line basis, * not character */ Sci_PositionU safeStartPos = styler.LineStart( currentLine ); /* Initialising current level - this is defined as indentation level * in the low 12 bits, with flag bits in the upper four bits. * It looks like two indentation states are maintained in the returned * 32bit value - 'nextLevel' in the most-significant bits, 'currentLevel' * in the least-significant bits. Since the next level is the most * up to date, this must refer to the current state of indentation. * So the code bitshifts the old current level out of existence to * get at the actual current state of indentation * Based on the LexerCPP.cxx line 958 comment */ int currentLevel = SC_FOLDLEVELBASE; if (currentLine > 0) currentLevel = styler.LevelAt(currentLine - 1) >> 16; int nextLevel = currentLevel; // Looping for characters in range for (Sci_PositionU i = safeStartPos; i < startPos + length; ++i) { /* Folding occurs after syntax highlighting, meaning Scintilla * already knows where the comments are * Fetching the current state */ int state = styler.StyleAt(i) & 31; switch( styler.SafeGetCharAt(i) ) { case '{': /* Indenting only when the braces are not contained in * a comment */ if (state != SCE_KVIRC_COMMENT && state != SCE_KVIRC_COMMENTBLOCK) ++nextLevel; break; case '}': /* Outdenting only when the braces are not contained in * a comment */ if (state != SCE_KVIRC_COMMENT && state != SCE_KVIRC_COMMENTBLOCK) --nextLevel; break; case '\n': case '\r': /* Preparing indentation information to return - combining * current and next level data */ int lev = currentLevel | nextLevel << 16; /* If the next level increases the indent level, mark the * current line as a fold point - current level data is * in the least significant bits */ if (nextLevel > currentLevel ) lev |= SC_FOLDLEVELHEADERFLAG; /* Updating indentation level if needed */ if (lev != styler.LevelAt(currentLine)) styler.SetLevel(currentLine, lev); /* Updating variables */ ++currentLine; currentLevel = nextLevel; /* Dealing with problematic Windows newlines - * incrementing to avoid the extra newline breaking the * fold point */ if (styler.SafeGetCharAt(i) == '\r' && styler.SafeGetCharAt(i + 1) == '\n') ++i; break; } } /* At this point the data has ended, so presumably the end of the line? * Preparing indentation information to return - combining current * and next level data */ int lev = currentLevel | nextLevel << 16; /* If the next level increases the indent level, mark the current * line as a fold point - current level data is in the least * significant bits */ if (nextLevel > currentLevel ) lev |= SC_FOLDLEVELHEADERFLAG; /* Updating indentation level if needed */ if (lev != styler.LevelAt(currentLine)) styler.SetLevel(currentLine, lev); } /* Registering wordlists */ static const char *const kvircWordListDesc[] = { "primary", "function_keywords", 0 }; /* Registering functions and wordlists */ LexerModule lmKVIrc(SCLEX_KVIRC, ColouriseKVIrcDoc, "kvirc", FoldKVIrcDoc, kvircWordListDesc); ================================================ FILE: lexilla/lexers/LexKix.cxx ================================================ // Scintilla source code edit control /** @file LexKix.cxx ** Lexer for KIX-Scripts. **/ // Copyright 2004 by Manfred Becker // The License.txt file describes the conditions under which this software may be distributed. // Edited by Lee Wilmott (24-Jun-2014) added support for block comments #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; // Extended to accept accented characters static inline bool IsAWordChar(int ch) { return ch >= 0x80 || isalnum(ch) || ch == '_'; } static inline bool IsOperator(const int ch) { return (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '&' || ch == '|' || ch == '<' || ch == '>' || ch == '='); } static void ColouriseKixDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; // WordList &keywords4 = *keywordlists[3]; styler.StartAt(startPos); StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.state == SCE_KIX_COMMENT) { if (sc.atLineEnd) { sc.SetState(SCE_KIX_DEFAULT); } } else if (sc.state == SCE_KIX_COMMENTSTREAM) { if (sc.ch == '/' && sc.chPrev == '*') { sc.ForwardSetState(SCE_KIX_DEFAULT); } } else if (sc.state == SCE_KIX_STRING1) { // This is a doubles quotes string if (sc.ch == '\"') { sc.ForwardSetState(SCE_KIX_DEFAULT); } } else if (sc.state == SCE_KIX_STRING2) { // This is a single quote string if (sc.ch == '\'') { sc.ForwardSetState(SCE_KIX_DEFAULT); } } else if (sc.state == SCE_KIX_NUMBER) { if (!IsADigit(sc.ch)) { sc.SetState(SCE_KIX_DEFAULT); } } else if (sc.state == SCE_KIX_VAR) { if (!IsAWordChar(sc.ch)) { sc.SetState(SCE_KIX_DEFAULT); } } else if (sc.state == SCE_KIX_MACRO) { if (!IsAWordChar(sc.ch) && !IsADigit(sc.ch)) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (!keywords3.InList(&s[1])) { sc.ChangeState(SCE_KIX_DEFAULT); } sc.SetState(SCE_KIX_DEFAULT); } } else if (sc.state == SCE_KIX_OPERATOR) { if (!IsOperator(sc.ch)) { sc.SetState(SCE_KIX_DEFAULT); } } else if (sc.state == SCE_KIX_IDENTIFIER) { if (!IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrentLowered(s, sizeof(s)); if (keywords.InList(s)) { sc.ChangeState(SCE_KIX_KEYWORD); } else if (keywords2.InList(s)) { sc.ChangeState(SCE_KIX_FUNCTIONS); } sc.SetState(SCE_KIX_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_KIX_DEFAULT) { if (sc.ch == ';') { sc.SetState(SCE_KIX_COMMENT); } else if (sc.ch == '/' && sc.chNext == '*') { sc.SetState(SCE_KIX_COMMENTSTREAM); } else if (sc.ch == '\"') { sc.SetState(SCE_KIX_STRING1); } else if (sc.ch == '\'') { sc.SetState(SCE_KIX_STRING2); } else if (sc.ch == '$') { sc.SetState(SCE_KIX_VAR); } else if (sc.ch == '@') { sc.SetState(SCE_KIX_MACRO); } else if (IsADigit(sc.ch) || ((sc.ch == '.' || sc.ch == '&') && IsADigit(sc.chNext))) { sc.SetState(SCE_KIX_NUMBER); } else if (IsOperator(sc.ch)) { sc.SetState(SCE_KIX_OPERATOR); } else if (IsAWordChar(sc.ch)) { sc.SetState(SCE_KIX_IDENTIFIER); } } } sc.Complete(); } LexerModule lmKix(SCLEX_KIX, ColouriseKixDoc, "kix"); ================================================ FILE: lexilla/lexers/LexLaTeX.cxx ================================================ // Scintilla source code edit control /** @file LexLaTeX.cxx ** Lexer for LaTeX2e. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. // Modified by G. HU in 2013. Added folding, syntax highting inside math environments, and changed some minor behaviors. #include #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "PropSetSimple.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "DefaultLexer.h" #include "LexerBase.h" using namespace Scintilla; using namespace Lexilla; using namespace std; struct latexFoldSave { latexFoldSave() : structLev(0) { for (int i = 0; i < 8; ++i) openBegins[i] = 0; } latexFoldSave(const latexFoldSave &save) : structLev(save.structLev) { for (int i = 0; i < 8; ++i) openBegins[i] = save.openBegins[i]; } latexFoldSave &operator=(const latexFoldSave &save) { if (this != &save) { structLev = save.structLev; for (int i = 0; i < 8; ++i) openBegins[i] = save.openBegins[i]; } return *this; } int openBegins[8]; Sci_Position structLev; }; class LexerLaTeX : public LexerBase { private: vector modes; void setMode(Sci_Position line, int mode) { if (line >= static_cast(modes.size())) modes.resize(line + 1, 0); modes[line] = mode; } int getMode(Sci_Position line) { if (line >= 0 && line < static_cast(modes.size())) return modes[line]; return 0; } void truncModes(Sci_Position numLines) { if (static_cast(modes.size()) > numLines * 2 + 256) modes.resize(numLines + 128); } vector saves; void setSave(Sci_Position line, const latexFoldSave &save) { if (line >= static_cast(saves.size())) saves.resize(line + 1); saves[line] = save; } void getSave(Sci_Position line, latexFoldSave &save) { if (line >= 0 && line < static_cast(saves.size())) save = saves[line]; else { save.structLev = 0; for (int i = 0; i < 8; ++i) save.openBegins[i] = 0; } } void truncSaves(Sci_Position numLines) { if (static_cast(saves.size()) > numLines * 2 + 256) saves.resize(numLines + 128); } public: static ILexer5 *LexerFactoryLaTeX() { return new LexerLaTeX(); } void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; // ILexer5 methods const char * SCI_METHOD GetName() override { return "latex"; } int SCI_METHOD GetIdentifier() override { return SCLEX_LATEX; } }; static bool latexIsSpecial(int ch) { return (ch == '#') || (ch == '$') || (ch == '%') || (ch == '&') || (ch == '_') || (ch == '{') || (ch == '}') || (ch == ' '); } static bool latexIsBlank(int ch) { return (ch == ' ') || (ch == '\t'); } static bool latexIsBlankAndNL(int ch) { return (ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n'); } static bool latexIsLetter(int ch) { return IsASCII(ch) && isalpha(ch); } static bool latexIsTagValid(Sci_Position &i, Sci_Position l, Accessor &styler) { while (i < l) { if (styler.SafeGetCharAt(i) == '{') { while (i < l) { i++; if (styler.SafeGetCharAt(i) == '}') { return true; } else if (!latexIsLetter(styler.SafeGetCharAt(i)) && styler.SafeGetCharAt(i)!='*') { return false; } } } else if (!latexIsBlank(styler.SafeGetCharAt(i))) { return false; } i++; } return false; } static bool latexNextNotBlankIs(Sci_Position i, Accessor &styler, char needle) { char ch; while (i < styler.Length()) { ch = styler.SafeGetCharAt(i); if (!latexIsBlankAndNL(ch) && ch != '*') { if (ch == needle) return true; else return false; } i++; } return false; } static bool latexLastWordIs(Sci_Position start, Accessor &styler, const char *needle) { Sci_PositionU i = 0; Sci_PositionU l = static_cast(strlen(needle)); Sci_Position ini = start-l+1; char s[32]; while (i < l && i < 31) { s[i] = styler.SafeGetCharAt(ini + i); i++; } s[i] = '\0'; return (strcmp(s, needle) == 0); } static bool latexLastWordIsMathEnv(Sci_Position pos, Accessor &styler) { Sci_Position i, j; char s[32]; const char *mathEnvs[] = { "align", "alignat", "flalign", "gather", "multiline", "displaymath", "eqnarray", "equation" }; if (styler.SafeGetCharAt(pos) != '}') return false; for (i = pos - 1; i >= 0; --i) { if (styler.SafeGetCharAt(i) == '{') break; if (pos - i >= 20) return false; } if (i < 0 || i == pos - 1) return false; ++i; for (j = 0; i + j < pos; ++j) s[j] = styler.SafeGetCharAt(i + j); s[j] = '\0'; if (j == 0) return false; if (s[j - 1] == '*') s[--j] = '\0'; for (i = 0; i < static_cast(sizeof(mathEnvs) / sizeof(const char *)); ++i) if (strcmp(s, mathEnvs[i]) == 0) return true; return false; } static inline void latexStateReset(int &mode, int &state) { switch (mode) { case 1: state = SCE_L_MATH; break; case 2: state = SCE_L_MATH2; break; default: state = SCE_L_DEFAULT; break; } } // There are cases not handled correctly, like $abcd\textrm{what is $x+y$}z+w$. // But I think it's already good enough. void SCI_METHOD LexerLaTeX::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { // startPos is assumed to be the first character of a line Accessor styler(pAccess, &props); styler.StartAt(startPos); int mode = getMode(styler.GetLine(startPos) - 1); int state = initStyle; if (state == SCE_L_ERROR || state == SCE_L_SHORTCMD || state == SCE_L_SPECIAL) // should not happen latexStateReset(mode, state); char chNext = styler.SafeGetCharAt(startPos); char chVerbatimDelim = '\0'; styler.StartSegment(startPos); Sci_Position lengthDoc = startPos + length; for (Sci_Position i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); if (styler.IsLeadByte(ch)) { i++; chNext = styler.SafeGetCharAt(i + 1); continue; } if (ch == '\r' || ch == '\n') setMode(styler.GetLine(i), mode); switch (state) { case SCE_L_DEFAULT : switch (ch) { case '\\' : styler.ColourTo(i - 1, state); if (latexIsLetter(chNext)) { state = SCE_L_COMMAND; } else if (latexIsSpecial(chNext)) { styler.ColourTo(i + 1, SCE_L_SPECIAL); i++; chNext = styler.SafeGetCharAt(i + 1); } else if (chNext == '\r' || chNext == '\n') { styler.ColourTo(i, SCE_L_ERROR); } else if (IsASCII(chNext)) { styler.ColourTo(i + 1, SCE_L_SHORTCMD); if (chNext == '(') { mode = 1; state = SCE_L_MATH; } else if (chNext == '[') { mode = 2; state = SCE_L_MATH2; } i++; chNext = styler.SafeGetCharAt(i + 1); } break; case '$' : styler.ColourTo(i - 1, state); if (chNext == '$') { styler.ColourTo(i + 1, SCE_L_SHORTCMD); mode = 2; state = SCE_L_MATH2; i++; chNext = styler.SafeGetCharAt(i + 1); } else { styler.ColourTo(i, SCE_L_SHORTCMD); mode = 1; state = SCE_L_MATH; } break; case '%' : styler.ColourTo(i - 1, state); state = SCE_L_COMMENT; break; } break; // These 3 will never be reached. case SCE_L_ERROR: case SCE_L_SPECIAL: case SCE_L_SHORTCMD: break; case SCE_L_COMMAND : if (!latexIsLetter(chNext)) { styler.ColourTo(i, state); if (latexNextNotBlankIs(i + 1, styler, '[' )) { state = SCE_L_CMDOPT; } else if (latexLastWordIs(i, styler, "\\begin")) { state = SCE_L_TAG; } else if (latexLastWordIs(i, styler, "\\end")) { state = SCE_L_TAG2; } else if (latexLastWordIs(i, styler, "\\verb") && chNext != '*' && chNext != ' ') { chVerbatimDelim = chNext; state = SCE_L_VERBATIM; } else { latexStateReset(mode, state); } } break; case SCE_L_CMDOPT : if (ch == ']') { styler.ColourTo(i, state); latexStateReset(mode, state); } break; case SCE_L_TAG : if (latexIsTagValid(i, lengthDoc, styler)) { styler.ColourTo(i, state); latexStateReset(mode, state); if (latexLastWordIs(i, styler, "{verbatim}")) { state = SCE_L_VERBATIM; } else if (latexLastWordIs(i, styler, "{lstlisting}")) { state = SCE_L_VERBATIM; } else if (latexLastWordIs(i, styler, "{comment}")) { state = SCE_L_COMMENT2; } else if (latexLastWordIs(i, styler, "{math}") && mode == 0) { mode = 1; state = SCE_L_MATH; } else if (latexLastWordIsMathEnv(i, styler) && mode == 0) { mode = 2; state = SCE_L_MATH2; } } else { styler.ColourTo(i, SCE_L_ERROR); latexStateReset(mode, state); ch = styler.SafeGetCharAt(i); if (ch == '\r' || ch == '\n') setMode(styler.GetLine(i), mode); } chNext = styler.SafeGetCharAt(i+1); break; case SCE_L_TAG2 : if (latexIsTagValid(i, lengthDoc, styler)) { styler.ColourTo(i, state); latexStateReset(mode, state); } else { styler.ColourTo(i, SCE_L_ERROR); latexStateReset(mode, state); ch = styler.SafeGetCharAt(i); if (ch == '\r' || ch == '\n') setMode(styler.GetLine(i), mode); } chNext = styler.SafeGetCharAt(i+1); break; case SCE_L_MATH : switch (ch) { case '\\' : styler.ColourTo(i - 1, state); if (latexIsLetter(chNext)) { Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { if (latexLastWordIs(match, styler, "{math}")) mode = 0; } } state = SCE_L_COMMAND; } else if (latexIsSpecial(chNext)) { styler.ColourTo(i + 1, SCE_L_SPECIAL); i++; chNext = styler.SafeGetCharAt(i + 1); } else if (chNext == '\r' || chNext == '\n') { styler.ColourTo(i, SCE_L_ERROR); } else if (IsASCII(chNext)) { if (chNext == ')') { mode = 0; state = SCE_L_DEFAULT; } styler.ColourTo(i + 1, SCE_L_SHORTCMD); i++; chNext = styler.SafeGetCharAt(i + 1); } break; case '$' : styler.ColourTo(i - 1, state); styler.ColourTo(i, SCE_L_SHORTCMD); mode = 0; state = SCE_L_DEFAULT; break; case '%' : styler.ColourTo(i - 1, state); state = SCE_L_COMMENT; break; } break; case SCE_L_MATH2 : switch (ch) { case '\\' : styler.ColourTo(i - 1, state); if (latexIsLetter(chNext)) { Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { if (latexLastWordIsMathEnv(match, styler)) mode = 0; } } state = SCE_L_COMMAND; } else if (latexIsSpecial(chNext)) { styler.ColourTo(i + 1, SCE_L_SPECIAL); i++; chNext = styler.SafeGetCharAt(i + 1); } else if (chNext == '\r' || chNext == '\n') { styler.ColourTo(i, SCE_L_ERROR); } else if (IsASCII(chNext)) { if (chNext == ']') { mode = 0; state = SCE_L_DEFAULT; } styler.ColourTo(i + 1, SCE_L_SHORTCMD); i++; chNext = styler.SafeGetCharAt(i + 1); } break; case '$' : styler.ColourTo(i - 1, state); if (chNext == '$') { styler.ColourTo(i + 1, SCE_L_SHORTCMD); i++; chNext = styler.SafeGetCharAt(i + 1); mode = 0; state = SCE_L_DEFAULT; } else { // This may not be an error, e.g. \begin{equation}\text{$a$}\end{equation} styler.ColourTo(i, SCE_L_SHORTCMD); } break; case '%' : styler.ColourTo(i - 1, state); state = SCE_L_COMMENT; break; } break; case SCE_L_COMMENT : if (ch == '\r' || ch == '\n') { styler.ColourTo(i - 1, state); latexStateReset(mode, state); } break; case SCE_L_COMMENT2 : if (ch == '\\') { Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { if (latexLastWordIs(match, styler, "{comment}")) { styler.ColourTo(i - 1, state); state = SCE_L_COMMAND; } } } } break; case SCE_L_VERBATIM : if (ch == '\\') { Sci_Position match = i + 3; if (latexLastWordIs(match, styler, "\\end")) { match++; if (latexIsTagValid(match, lengthDoc, styler)) { if (latexLastWordIs(match, styler, "{verbatim}")) { styler.ColourTo(i - 1, state); state = SCE_L_COMMAND; } else if (latexLastWordIs(match, styler, "{lstlisting}")) { styler.ColourTo(i - 1, state); state = SCE_L_COMMAND; } } } } else if (chNext == chVerbatimDelim) { styler.ColourTo(i + 1, state); latexStateReset(mode, state); chVerbatimDelim = '\0'; i++; chNext = styler.SafeGetCharAt(i + 1); } else if (chVerbatimDelim != '\0' && (ch == '\n' || ch == '\r')) { styler.ColourTo(i, SCE_L_ERROR); latexStateReset(mode, state); chVerbatimDelim = '\0'; } break; } } if (lengthDoc == styler.Length()) truncModes(styler.GetLine(lengthDoc - 1)); styler.ColourTo(lengthDoc - 1, state); styler.Flush(); } static int latexFoldSaveToInt(const latexFoldSave &save) { int sum = 0; for (int i = 0; i <= save.structLev; ++i) sum += save.openBegins[i]; return ((sum + save.structLev + SC_FOLDLEVELBASE) & SC_FOLDLEVELNUMBERMASK); } // Change folding state while processing a line // Return the level before the first relevant command void SCI_METHOD LexerLaTeX::Fold(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) { const char *structWords[7] = {"part", "chapter", "section", "subsection", "subsubsection", "paragraph", "subparagraph"}; Accessor styler(pAccess, &props); Sci_PositionU endPos = startPos + length; Sci_Position curLine = styler.GetLine(startPos); latexFoldSave save; getSave(curLine - 1, save); do { char ch, buf[16]; Sci_Position i, j; int lev = -1; bool needFold = false; for (i = static_cast(startPos); i < static_cast(endPos); ++i) { ch = styler.SafeGetCharAt(i); if (ch == '\r' || ch == '\n') break; if (ch != '\\' || styler.StyleAt(i) != SCE_L_COMMAND) continue; for (j = 0; j < 15 && i + 1 < static_cast(endPos); ++j, ++i) { buf[j] = styler.SafeGetCharAt(i + 1); if (!latexIsLetter(buf[j])) break; } buf[j] = '\0'; if (strcmp(buf, "begin") == 0) { if (lev < 0) lev = latexFoldSaveToInt(save); ++save.openBegins[save.structLev]; needFold = true; } else if (strcmp(buf, "end") == 0) { while (save.structLev > 0 && save.openBegins[save.structLev] == 0) --save.structLev; if (lev < 0) lev = latexFoldSaveToInt(save); if (save.openBegins[save.structLev] > 0) --save.openBegins[save.structLev]; } else { for (j = 0; j < 7; ++j) if (strcmp(buf, structWords[j]) == 0) break; if (j >= 7) continue; save.structLev = j; // level before the command for (j = save.structLev + 1; j < 8; ++j) { save.openBegins[save.structLev] += save.openBegins[j]; save.openBegins[j] = 0; } if (lev < 0) lev = latexFoldSaveToInt(save); ++save.structLev; // level after the command needFold = true; } } if (lev < 0) lev = latexFoldSaveToInt(save); if (needFold) lev |= SC_FOLDLEVELHEADERFLAG; styler.SetLevel(curLine, lev); setSave(curLine, save); ++curLine; startPos = styler.LineStart(curLine); if (static_cast(startPos) == styler.Length()) { lev = latexFoldSaveToInt(save); styler.SetLevel(curLine, lev); setSave(curLine, save); truncSaves(curLine); } } while (startPos < endPos); styler.Flush(); } static const char *const emptyWordListDesc[] = { 0 }; LexerModule lmLatex(SCLEX_LATEX, LexerLaTeX::LexerFactoryLaTeX, "latex", emptyWordListDesc); ================================================ FILE: lexilla/lexers/LexLisp.cxx ================================================ // Scintilla source code edit control /** @file LexLisp.cxx ** Lexer for Lisp. ** Written by Alexey Yutkin. **/ // Copyright 1998-2001 by Neil Hodgson // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; #define SCE_LISP_CHARACTER 29 #define SCE_LISP_MACRO 30 #define SCE_LISP_MACRO_DISPATCH 31 static inline bool isLispoperator(char ch) { if (IsASCII(ch) && isalnum(ch)) return false; if (ch == '\'' || ch == '`' || ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == '{' || ch == '}') return true; return false; } static inline bool isLispwordstart(char ch) { return IsASCII(ch) && ch != ';' && !isspacechar(ch) && !isLispoperator(ch) && ch != '\n' && ch != '\r' && ch != '\"'; } static void classifyWordLisp(Sci_PositionU start, Sci_PositionU end, WordList &keywords, WordList &keywords_kw, Accessor &styler) { assert(end >= start); char s[100]; Sci_PositionU i; bool digit_flag = true; for (i = 0; (i < end - start + 1) && (i < 99); i++) { s[i] = styler[start + i]; s[i + 1] = '\0'; if (!isdigit(s[i]) && (s[i] != '.')) digit_flag = false; } char chAttr = SCE_LISP_IDENTIFIER; if(digit_flag) chAttr = SCE_LISP_NUMBER; else { if (keywords.InList(s)) { chAttr = SCE_LISP_KEYWORD; } else if (keywords_kw.InList(s)) { chAttr = SCE_LISP_KEYWORD_KW; } else if ((s[0] == '*' && s[i-1] == '*') || (s[0] == '+' && s[i-1] == '+')) { chAttr = SCE_LISP_SPECIAL; } } styler.ColourTo(end, chAttr); return; } static void ColouriseLispDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords_kw = *keywordlists[1]; styler.StartAt(startPos); int state = initStyle, radix = -1; char chNext = styler[startPos]; Sci_PositionU lengthDoc = startPos + length; styler.StartSegment(startPos); for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (styler.IsLeadByte(ch)) { chNext = styler.SafeGetCharAt(i + 2); i += 1; continue; } if (state == SCE_LISP_DEFAULT) { if (ch == '#') { styler.ColourTo(i - 1, state); radix = -1; state = SCE_LISP_MACRO_DISPATCH; } else if (ch == ':' && isLispwordstart(chNext)) { styler.ColourTo(i - 1, state); state = SCE_LISP_SYMBOL; } else if (isLispwordstart(ch)) { styler.ColourTo(i - 1, state); state = SCE_LISP_IDENTIFIER; } else if (ch == ';') { styler.ColourTo(i - 1, state); state = SCE_LISP_COMMENT; } else if (isLispoperator(ch) || ch=='\'') { styler.ColourTo(i - 1, state); styler.ColourTo(i, SCE_LISP_OPERATOR); if (ch=='\'' && isLispwordstart(chNext)) { state = SCE_LISP_SYMBOL; } } else if (ch == '\"') { styler.ColourTo(i - 1, state); state = SCE_LISP_STRING; } } else if (state == SCE_LISP_IDENTIFIER || state == SCE_LISP_SYMBOL) { if (!isLispwordstart(ch)) { if (state == SCE_LISP_IDENTIFIER) { classifyWordLisp(styler.GetStartSegment(), i - 1, keywords, keywords_kw, styler); } else { styler.ColourTo(i - 1, state); } state = SCE_LISP_DEFAULT; } /*else*/ if (isLispoperator(ch) || ch=='\'') { styler.ColourTo(i - 1, state); styler.ColourTo(i, SCE_LISP_OPERATOR); if (ch=='\'' && isLispwordstart(chNext)) { state = SCE_LISP_SYMBOL; } } } else if (state == SCE_LISP_MACRO_DISPATCH) { if (!(IsASCII(ch) && isdigit(ch))) { if (ch != 'r' && ch != 'R' && (i - styler.GetStartSegment()) > 1) { state = SCE_LISP_DEFAULT; } else { switch (ch) { case '|': state = SCE_LISP_MULTI_COMMENT; break; case 'o': case 'O': radix = 8; state = SCE_LISP_MACRO; break; case 'x': case 'X': radix = 16; state = SCE_LISP_MACRO; break; case 'b': case 'B': radix = 2; state = SCE_LISP_MACRO; break; case '\\': state = SCE_LISP_CHARACTER; break; case ':': case '-': case '+': state = SCE_LISP_MACRO; break; case '\'': if (isLispwordstart(chNext)) { state = SCE_LISP_SPECIAL; } else { styler.ColourTo(i - 1, SCE_LISP_DEFAULT); styler.ColourTo(i, SCE_LISP_OPERATOR); state = SCE_LISP_DEFAULT; } break; default: if (isLispoperator(ch)) { styler.ColourTo(i - 1, SCE_LISP_DEFAULT); styler.ColourTo(i, SCE_LISP_OPERATOR); } state = SCE_LISP_DEFAULT; break; } } } } else if (state == SCE_LISP_MACRO) { if (isLispwordstart(ch) && (radix == -1 || IsADigit(ch, radix))) { state = SCE_LISP_SPECIAL; } else { state = SCE_LISP_DEFAULT; } } else if (state == SCE_LISP_CHARACTER) { if (isLispoperator(ch)) { styler.ColourTo(i, SCE_LISP_SPECIAL); state = SCE_LISP_DEFAULT; } else if (isLispwordstart(ch)) { styler.ColourTo(i, SCE_LISP_SPECIAL); state = SCE_LISP_SPECIAL; } else { state = SCE_LISP_DEFAULT; } } else if (state == SCE_LISP_SPECIAL) { if (!isLispwordstart(ch) || (radix != -1 && !IsADigit(ch, radix))) { styler.ColourTo(i - 1, state); state = SCE_LISP_DEFAULT; } if (isLispoperator(ch) || ch=='\'') { styler.ColourTo(i - 1, state); styler.ColourTo(i, SCE_LISP_OPERATOR); if (ch=='\'' && isLispwordstart(chNext)) { state = SCE_LISP_SYMBOL; } } } else { if (state == SCE_LISP_COMMENT) { if (atEOL) { styler.ColourTo(i - 1, state); state = SCE_LISP_DEFAULT; } } else if (state == SCE_LISP_MULTI_COMMENT) { if (ch == '|' && chNext == '#') { i++; chNext = styler.SafeGetCharAt(i + 1); styler.ColourTo(i, state); state = SCE_LISP_DEFAULT; } } else if (state == SCE_LISP_STRING) { if (ch == '\\') { if (chNext == '\"' || chNext == '\'' || chNext == '\\') { i++; chNext = styler.SafeGetCharAt(i + 1); } } else if (ch == '\"') { styler.ColourTo(i, state); state = SCE_LISP_DEFAULT; } } } } styler.ColourTo(lengthDoc - 1, state); } static void FoldLispDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], Accessor &styler) { Sci_PositionU lengthDoc = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; int styleNext = styler.StyleAt(startPos); for (Sci_PositionU i = startPos; i < lengthDoc; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_LISP_OPERATOR) { if (ch == '(' || ch == '[' || ch == '{') { levelCurrent++; } else if (ch == ')' || ch == ']' || ch == '}') { levelCurrent--; } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0) lev |= SC_FOLDLEVELWHITEFLAG; if ((levelCurrent > levelPrev) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const lispWordListDesc[] = { "Functions and special operators", "Keywords", 0 }; LexerModule lmLISP(SCLEX_LISP, ColouriseLispDoc, "lisp", FoldLispDoc, lispWordListDesc); ================================================ FILE: lexilla/lexers/LexLout.cxx ================================================ // Scintilla source code edit control /** @file LexLout.cxx ** Lexer for the Basser Lout (>= version 3) typesetting language **/ // Copyright 2003 by Kein-Hong Man // The License.txt file describes the conditions under which this software may be distributed. #include #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" using namespace Lexilla; static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalpha(ch) || ch == '@' || ch == '_'); } static inline bool IsAnOther(const int ch) { return (ch < 0x80) && (ch == '{' || ch == '}' || ch == '!' || ch == '$' || ch == '%' || ch == '&' || ch == '\'' || ch == '(' || ch == ')' || ch == '*' || ch == '+' || ch == ',' || ch == '-' || ch == '.' || ch == '/' || ch == ':' || ch == ';' || ch == '<' || ch == '=' || ch == '>' || ch == '?' || ch == '[' || ch == ']' || ch == '^' || ch == '`' || ch == '|' || ch == '~'); } static void ColouriseLoutDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; int visibleChars = 0; int firstWordInLine = 0; int leadingAtSign = 0; StyleContext sc(startPos, length, initStyle, styler); for (; sc.More(); sc.Forward()) { if (sc.atLineStart && (sc.state == SCE_LOUT_STRING)) { // Prevent SCE_LOUT_STRINGEOL from leaking back to previous line sc.SetState(SCE_LOUT_STRING); } // Determine if the current state should terminate. if (sc.state == SCE_LOUT_COMMENT) { if (sc.atLineEnd) { sc.SetState(SCE_LOUT_DEFAULT); visibleChars = 0; } } else if (sc.state == SCE_LOUT_NUMBER) { if (!IsADigit(sc.ch) && sc.ch != '.') { sc.SetState(SCE_LOUT_DEFAULT); } } else if (sc.state == SCE_LOUT_STRING) { if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\"') { sc.ForwardSetState(SCE_LOUT_DEFAULT); } else if (sc.atLineEnd) { sc.ChangeState(SCE_LOUT_STRINGEOL); sc.ForwardSetState(SCE_LOUT_DEFAULT); visibleChars = 0; } } else if (sc.state == SCE_LOUT_IDENTIFIER) { if (!IsAWordChar(sc.ch)) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (leadingAtSign) { if (keywords.InList(s)) { sc.ChangeState(SCE_LOUT_WORD); } else { sc.ChangeState(SCE_LOUT_WORD4); } } else if (firstWordInLine && keywords3.InList(s)) { sc.ChangeState(SCE_LOUT_WORD3); } sc.SetState(SCE_LOUT_DEFAULT); } } else if (sc.state == SCE_LOUT_OPERATOR) { if (!IsAnOther(sc.ch)) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (keywords2.InList(s)) { sc.ChangeState(SCE_LOUT_WORD2); } sc.SetState(SCE_LOUT_DEFAULT); } } // Determine if a new state should be entered. if (sc.state == SCE_LOUT_DEFAULT) { if (sc.ch == '#') { sc.SetState(SCE_LOUT_COMMENT); } else if (sc.ch == '\"') { sc.SetState(SCE_LOUT_STRING); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { sc.SetState(SCE_LOUT_NUMBER); } else if (IsAWordChar(sc.ch)) { firstWordInLine = (visibleChars == 0); leadingAtSign = (sc.ch == '@'); sc.SetState(SCE_LOUT_IDENTIFIER); } else if (IsAnOther(sc.ch)) { sc.SetState(SCE_LOUT_OPERATOR); } } if (sc.atLineEnd) { // Reset states to begining of colourise so no surprises // if different sets of lines lexed. visibleChars = 0; } if (!IsASpace(sc.ch)) { visibleChars++; } } sc.Complete(); } static void FoldLoutDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { Sci_PositionU endPos = startPos + length; int visibleChars = 0; Sci_Position lineCurrent = styler.GetLine(startPos); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; char chNext = styler[startPos]; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; int styleNext = styler.StyleAt(startPos); char s[10] = ""; for (Sci_PositionU i = startPos; i < endPos; i++) { char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); int style = styleNext; styleNext = styler.StyleAt(i + 1); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); if (style == SCE_LOUT_WORD) { if (ch == '@') { for (Sci_PositionU j = 0; j < 8; j++) { if (!IsAWordChar(styler[i + j])) { break; } s[j] = styler[i + j]; s[j + 1] = '\0'; } if (strcmp(s, "@Begin") == 0) { levelCurrent++; } else if (strcmp(s, "@End") == 0) { levelCurrent--; } } } else if (style == SCE_LOUT_OPERATOR) { if (ch == '{') { levelCurrent++; } else if (ch == '}') { levelCurrent--; } } if (atEOL) { int lev = levelPrev; if (visibleChars == 0 && foldCompact) { lev |= SC_FOLDLEVELWHITEFLAG; } if ((levelCurrent > levelPrev) && (visibleChars > 0)) { lev |= SC_FOLDLEVELHEADERFLAG; } if (lev != styler.LevelAt(lineCurrent)) { styler.SetLevel(lineCurrent, lev); } lineCurrent++; levelPrev = levelCurrent; visibleChars = 0; } if (!isspacechar(ch)) visibleChars++; } // Fill in the real level of the next line, keeping the current flags as they will be filled in later int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; styler.SetLevel(lineCurrent, levelPrev | flagsNext); } static const char * const loutWordLists[] = { "Predefined identifiers", "Predefined delimiters", "Predefined keywords", 0, }; LexerModule lmLout(SCLEX_LOUT, ColouriseLoutDoc, "lout", FoldLoutDoc, loutWordLists); ================================================ FILE: lexilla/lexers/LexLua.cxx ================================================ // Scintilla source code edit control /** @file LexLua.cxx ** Lexer for Lua language. ** ** Written by Paul Winwood. ** Folder by Alexey Yutkin. ** Modified by Marcos E. Wurzius & Philippe Lhoste **/ #include #include #include #include #include #include #include #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" #include "OptionSet.h" #include "SubStyles.h" #include "DefaultLexer.h" using namespace Scintilla; using namespace Lexilla; namespace { // Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ], // return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on. // The maximum number of '=' characters allowed is 254. int LongDelimCheck(StyleContext &sc) { int sep = 1; while (sc.GetRelative(sep) == '=' && sep < 0xFF) sep++; if (sc.GetRelative(sep) == sc.ch) return sep; return 0; } const char *const luaWordListDesc[] = { "Keywords", "Basic functions", "String, (table) & math functions", "(coroutines), I/O & system facilities", "user1", "user2", "user3", "user4", nullptr }; const char styleSubable[] = { SCE_LUA_IDENTIFIER, 0 }; const LexicalClass lexicalClasses[] = { // Lexer Lua SCLEX_LUA SCE_LUA_: 0, "SCE_LUA_DEFAULT", "default", "White space: Visible only in View Whitespace mode (or if it has a back colour)", 1, "SCE_LUA_COMMENT", "comment", "Block comment (Lua 5.0)", 2, "SCE_LUA_COMMENTLINE", "comment line", "Line comment", 3, "SCE_LUA_COMMENTDOC", "comment documentation", "Doc comment", 4, "SCE_LUA_NUMBER", "literal numeric", "Number", 5, "SCE_LUA_WORD", "keyword", "Keyword", 6, "SCE_LUA_STRING", "literal string", "(Double quoted) String", 7, "SCE_LUA_CHARACTER", "literal string character", "Character (Single quoted string)", 8, "SCE_LUA_LITERALSTRING", "literal string", "Literal string", 9, "SCE_LUA_PREPROCESSOR", "preprocessor", "Preprocessor (obsolete in Lua 4.0 and up)", 10, "SCE_LUA_OPERATOR", "operator", "Operators", 11, "SCE_LUA_IDENTIFIER", "identifier", "Identifier (everything else...)", 12, "SCE_LUA_STRINGEOL", "error literal string", "End of line where string is not closed", 13, "SCE_LUA_WORD2", "identifier", "Other keywords", 14, "SCE_LUA_WORD3", "identifier", "Other keywords", 15, "SCE_LUA_WORD4", "identifier", "Other keywords", 16, "SCE_LUA_WORD5", "identifier", "Other keywords", 17, "SCE_LUA_WORD6", "identifier", "Other keywords", 18, "SCE_LUA_WORD7", "identifier", "Other keywords", 19, "SCE_LUA_WORD8", "identifier", "Other keywords", 20, "SCE_LUA_LABEL", "label", "Labels", }; // Options used for LexerLua struct OptionsLua { bool foldCompact = true; }; struct OptionSetLua : public OptionSet { OptionSetLua() { DefineProperty("fold.compact", &OptionsLua::foldCompact); DefineWordListSets(luaWordListDesc); } }; class LexerLua : public DefaultLexer { WordList keywords; WordList keywords2; WordList keywords3; WordList keywords4; WordList keywords5; WordList keywords6; WordList keywords7; WordList keywords8; OptionsLua options; OptionSetLua osLua; SubStyles subStyles{styleSubable}; public: explicit LexerLua() : DefaultLexer("lua", SCLEX_LUA, lexicalClasses, std::size(lexicalClasses)) { } ~LexerLua() override = default; void SCI_METHOD Release() noexcept override { delete this; } int SCI_METHOD Version() const noexcept override { return lvRelease5; } const char *SCI_METHOD PropertyNames() noexcept override { return osLua.PropertyNames(); } int SCI_METHOD PropertyType(const char *name) override { return osLua.PropertyType(name); } const char *SCI_METHOD DescribeProperty(const char *name) override { return osLua.DescribeProperty(name); } Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; const char *SCI_METHOD PropertyGet(const char *key) override { return osLua.PropertyGet(key); } const char *SCI_METHOD DescribeWordListSets() noexcept override { return osLua.DescribeWordListSets(); } Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override; int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override { return subStyles.Allocate(styleBase, numberStyles); } int SCI_METHOD SubStylesStart(int styleBase) override { return subStyles.Start(styleBase); } int SCI_METHOD SubStylesLength(int styleBase) override { return subStyles.Length(styleBase); } int SCI_METHOD StyleFromSubStyle(int subStyle) override { const int styleBase = subStyles.BaseStyle(subStyle); return styleBase; } int SCI_METHOD PrimaryStyleFromStyle(int style) override { return style; } void SCI_METHOD FreeSubStyles() override { subStyles.Free(); } void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override { subStyles.SetIdentifiers(style, identifiers); } int SCI_METHOD DistanceToSecondaryStyles() override { return 0; } const char *SCI_METHOD GetSubStyleBases() override { return styleSubable; } static ILexer5 *LexerFactoryLua() { return new LexerLua(); } }; Sci_Position SCI_METHOD LexerLua::PropertySet(const char *key, const char *val) { if (osLua.PropertySet(&options, key, val)) { return 0; } return -1; } Sci_Position SCI_METHOD LexerLua::WordListSet(int n, const char *wl) { WordList *wordListN = nullptr; switch (n) { case 0: wordListN = &keywords; break; case 1: wordListN = &keywords2; break; case 2: wordListN = &keywords3; break; case 3: wordListN = &keywords4; break; case 4: wordListN = &keywords5; break; case 5: wordListN = &keywords6; break; case 6: wordListN = &keywords7; break; case 7: wordListN = &keywords8; break; default: break; } Sci_Position firstModification = -1; if (wordListN) { if (wordListN->Set(wl)) { firstModification = 0; } } return firstModification; } constexpr int maskSeparator = 0xFF; constexpr int maskStringWs = 0x100; constexpr int maskDocComment = 0x200; void LexerLua::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); // Accepts accented characters const CharacterSet setWordStart(CharacterSet::setAlpha, "_", true); const CharacterSet setWord(CharacterSet::setAlphaNum, "_", true); // Not exactly following number definition (several dots are seen as OK, etc.) // but probably enough in most cases. [pP] is for hex floats. const CharacterSet setNumber(CharacterSet::setDigits, ".-+abcdefpABCDEFP"); const CharacterSet setExponent("eEpP"); const CharacterSet setLuaOperator("*/-+()={}~[];<>,.^%:#&|"); const CharacterSet setEscapeSkip("\"'\\"); const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_LUA_IDENTIFIER); Sci_Position currentLine = styler.GetLine(startPos); // Initialize long string [[ ... ]] or block comment --[[ ... ]], // if we are inside such a string. Block comment was introduced in Lua 5.0, // blocks with separators [=[ ... ]=] in Lua 5.1. // Continuation of a string (\z whitespace escaping) is controlled by stringWs. int sepCount = 0; int stringWs = 0; int lastLineDocComment = 0; if ((currentLine > 0) && AnyOf(initStyle, SCE_LUA_DEFAULT, SCE_LUA_LITERALSTRING, SCE_LUA_COMMENT, SCE_LUA_COMMENTDOC, SCE_LUA_STRING, SCE_LUA_CHARACTER)) { const int lineState = styler.GetLineState(currentLine - 1); sepCount = lineState & maskSeparator; stringWs = lineState & maskStringWs; lastLineDocComment = lineState & maskDocComment; } // results of identifier/keyword matching Sci_Position idenPos = 0; Sci_Position idenWordPos = 0; int idenStyle = SCE_LUA_IDENTIFIER; bool foundGoto = false; // Do not leak onto next line if (AnyOf(initStyle, SCE_LUA_STRINGEOL, SCE_LUA_COMMENTLINE, SCE_LUA_COMMENTDOC, SCE_LUA_PREPROCESSOR)) { initStyle = SCE_LUA_DEFAULT; } StyleContext sc(startPos, length, initStyle, styler); if (startPos == 0 && sc.ch == '#' && sc.chNext == '!') { // shbang line: "#!" is a comment only if located at the start of the script sc.SetState(SCE_LUA_COMMENTLINE); } for (; sc.More(); sc.Forward()) { if (sc.atLineEnd) { // Update the line state, so it can be seen by next line currentLine = styler.GetLine(sc.currentPos); switch (sc.state) { case SCE_LUA_DEFAULT: case SCE_LUA_LITERALSTRING: case SCE_LUA_COMMENT: case SCE_LUA_COMMENTDOC: case SCE_LUA_STRING: case SCE_LUA_CHARACTER: // Inside a literal string, block comment or string, we set the line state styler.SetLineState(currentLine, lastLineDocComment | stringWs | sepCount); break; default: // Reset the line state styler.SetLineState(currentLine, 0); break; } } if (sc.atLineStart && (sc.state == SCE_LUA_STRING)) { // Prevent SCE_LUA_STRINGEOL from leaking back to previous line sc.SetState(SCE_LUA_STRING); } // Handle string line continuation if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) && sc.ch == '\\') { if (sc.chNext == '\n' || sc.chNext == '\r') { sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); } continue; } } // Determine if the current state should terminate. if (sc.state == SCE_LUA_OPERATOR) { if (sc.ch == ':' && sc.chPrev == ':') { // ::