diff options
248 files changed, 0 insertions, 72446 deletions
diff --git a/cocoa/ScintillaFramework/Info.plist b/cocoa/ScintillaFramework/Info.plist deleted file mode 100644 index 4f88dfde2..000000000 --- a/cocoa/ScintillaFramework/Info.plist +++ /dev/null @@ -1,28 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>English</string> - <key>CFBundleExecutable</key> - <string>${EXECUTABLE_NAME}</string> - <key>CFBundleIconFile</key> - <string></string> - <key>CFBundleIdentifier</key> - <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>${PRODUCT_NAME}</string> - <key>CFBundlePackageType</key> - <string>FMWK</string> - <key>CFBundleShortVersionString</key> - <string>4.4.6</string> - <key>CFBundleSignature</key> - <string>????</string> - <key>CFBundleVersion</key> - <string>4.4.6</string> - <key>NSPrincipalClass</key> - <string></string> -</dict> -</plist> diff --git a/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj b/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj deleted file mode 100644 index 7c2da51d5..000000000 --- a/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.pbxproj +++ /dev/null @@ -1,1345 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 46; - objects = { - -/* Begin PBXBuildFile section */ - 00724A59981D34F11A3D162F /* LexCIL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 577F46B88F633198B56D088D /* LexCIL.cxx */; }; - 0ED84236A703D57578EBFD2F /* LexNim.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 47814937A6B72D2B0F065B61 /* LexNim.cxx */; }; - 1100F1EB178E393200105727 /* CaseConvert.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1100F1E6178E393200105727 /* CaseConvert.cxx */; }; - 1100F1EC178E393200105727 /* CaseConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 1100F1E7178E393200105727 /* CaseConvert.h */; }; - 1100F1ED178E393200105727 /* CaseFolder.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1100F1E8178E393200105727 /* CaseFolder.cxx */; }; - 1100F1EE178E393200105727 /* CaseFolder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1100F1E9178E393200105727 /* CaseFolder.h */; }; - 1102C31C169FB49300DC16AB /* LexLaTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1102C31B169FB49300DC16AB /* LexLaTeX.cxx */; }; - 11126B8214CD3A6200803C49 /* LexAVS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11126B8114CD3A6200803C49 /* LexAVS.cxx */; }; - 1114D6CB1602A951001DC345 /* LexPO.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1114D6CA1602A951001DC345 /* LexPO.cxx */; }; - 114B6F0D11FA7526004FB6AB /* LexAbaqus.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EBE11FA7526004FB6AB /* LexAbaqus.cxx */; }; - 114B6F0E11FA7526004FB6AB /* LexAda.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EBF11FA7526004FB6AB /* LexAda.cxx */; }; - 114B6F0F11FA7526004FB6AB /* LexAPDL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC011FA7526004FB6AB /* LexAPDL.cxx */; }; - 114B6F1011FA7526004FB6AB /* LexAsm.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC111FA7526004FB6AB /* LexAsm.cxx */; }; - 114B6F1111FA7526004FB6AB /* LexAsn1.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC211FA7526004FB6AB /* LexAsn1.cxx */; }; - 114B6F1211FA7526004FB6AB /* LexASY.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC311FA7526004FB6AB /* LexASY.cxx */; }; - 114B6F1311FA7526004FB6AB /* LexAU3.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC411FA7526004FB6AB /* LexAU3.cxx */; }; - 114B6F1411FA7526004FB6AB /* LexAVE.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC511FA7526004FB6AB /* LexAVE.cxx */; }; - 114B6F1511FA7526004FB6AB /* LexBaan.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC611FA7526004FB6AB /* LexBaan.cxx */; }; - 114B6F1611FA7526004FB6AB /* LexBash.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC711FA7526004FB6AB /* LexBash.cxx */; }; - 114B6F1711FA7526004FB6AB /* LexBasic.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC811FA7526004FB6AB /* LexBasic.cxx */; }; - 114B6F1811FA7526004FB6AB /* LexBullant.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EC911FA7526004FB6AB /* LexBullant.cxx */; }; - 114B6F1911FA7526004FB6AB /* LexCaml.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ECA11FA7526004FB6AB /* LexCaml.cxx */; }; - 114B6F1A11FA7526004FB6AB /* LexCLW.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ECB11FA7526004FB6AB /* LexCLW.cxx */; }; - 114B6F1B11FA7526004FB6AB /* LexCmake.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ECC11FA7526004FB6AB /* LexCmake.cxx */; }; - 114B6F1C11FA7526004FB6AB /* LexCOBOL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ECD11FA7526004FB6AB /* LexCOBOL.cxx */; }; - 114B6F1D11FA7526004FB6AB /* LexConf.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ECE11FA7526004FB6AB /* LexConf.cxx */; }; - 114B6F1E11FA7526004FB6AB /* LexCPP.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ECF11FA7526004FB6AB /* LexCPP.cxx */; }; - 114B6F1F11FA7526004FB6AB /* LexCrontab.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED011FA7526004FB6AB /* LexCrontab.cxx */; }; - 114B6F2011FA7526004FB6AB /* LexCsound.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED111FA7526004FB6AB /* LexCsound.cxx */; }; - 114B6F2111FA7526004FB6AB /* LexCSS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED211FA7526004FB6AB /* LexCSS.cxx */; }; - 114B6F2211FA7526004FB6AB /* LexD.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED311FA7526004FB6AB /* LexD.cxx */; }; - 114B6F2311FA7526004FB6AB /* LexEiffel.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED411FA7526004FB6AB /* LexEiffel.cxx */; }; - 114B6F2411FA7526004FB6AB /* LexErlang.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED511FA7526004FB6AB /* LexErlang.cxx */; }; - 114B6F2511FA7526004FB6AB /* LexEScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED611FA7526004FB6AB /* LexEScript.cxx */; }; - 114B6F2611FA7526004FB6AB /* LexFlagship.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED711FA7526004FB6AB /* LexFlagship.cxx */; }; - 114B6F2711FA7526004FB6AB /* LexForth.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED811FA7526004FB6AB /* LexForth.cxx */; }; - 114B6F2811FA7526004FB6AB /* LexFortran.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6ED911FA7526004FB6AB /* LexFortran.cxx */; }; - 114B6F2911FA7526004FB6AB /* LexGAP.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EDA11FA7526004FB6AB /* LexGAP.cxx */; }; - 114B6F2A11FA7526004FB6AB /* LexGui4Cli.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EDB11FA7526004FB6AB /* LexGui4Cli.cxx */; }; - 114B6F2B11FA7526004FB6AB /* LexHaskell.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EDC11FA7526004FB6AB /* LexHaskell.cxx */; }; - 114B6F2C11FA7526004FB6AB /* LexHTML.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EDD11FA7526004FB6AB /* LexHTML.cxx */; }; - 114B6F2D11FA7526004FB6AB /* LexInno.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EDE11FA7526004FB6AB /* LexInno.cxx */; }; - 114B6F2E11FA7526004FB6AB /* LexKix.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EDF11FA7526004FB6AB /* LexKix.cxx */; }; - 114B6F2F11FA7526004FB6AB /* LexLisp.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE011FA7526004FB6AB /* LexLisp.cxx */; }; - 114B6F3011FA7526004FB6AB /* LexLout.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE111FA7526004FB6AB /* LexLout.cxx */; }; - 114B6F3111FA7526004FB6AB /* LexLua.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE211FA7526004FB6AB /* LexLua.cxx */; }; - 114B6F3211FA7526004FB6AB /* LexMagik.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE311FA7526004FB6AB /* LexMagik.cxx */; }; - 114B6F3311FA7526004FB6AB /* LexMarkdown.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE411FA7526004FB6AB /* LexMarkdown.cxx */; }; - 114B6F3411FA7526004FB6AB /* LexMatlab.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE511FA7526004FB6AB /* LexMatlab.cxx */; }; - 114B6F3511FA7526004FB6AB /* LexMetapost.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE611FA7526004FB6AB /* LexMetapost.cxx */; }; - 114B6F3611FA7526004FB6AB /* LexMMIXAL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE711FA7526004FB6AB /* LexMMIXAL.cxx */; }; - 114B6F3711FA7526004FB6AB /* LexMPT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE811FA7526004FB6AB /* LexMPT.cxx */; }; - 114B6F3811FA7526004FB6AB /* LexMSSQL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EE911FA7526004FB6AB /* LexMSSQL.cxx */; }; - 114B6F3911FA7526004FB6AB /* LexMySQL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEA11FA7526004FB6AB /* LexMySQL.cxx */; }; - 114B6F3A11FA7526004FB6AB /* LexNimrod.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEB11FA7526004FB6AB /* LexNimrod.cxx */; }; - 114B6F3B11FA7526004FB6AB /* LexNsis.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEC11FA7526004FB6AB /* LexNsis.cxx */; }; - 114B6F3C11FA7526004FB6AB /* LexOpal.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EED11FA7526004FB6AB /* LexOpal.cxx */; }; - 114B6F3E11FA7526004FB6AB /* LexPascal.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEF11FA7526004FB6AB /* LexPascal.cxx */; }; - 114B6F3F11FA7526004FB6AB /* LexPB.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF011FA7526004FB6AB /* LexPB.cxx */; }; - 114B6F4011FA7526004FB6AB /* LexPerl.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF111FA7526004FB6AB /* LexPerl.cxx */; }; - 114B6F4111FA7526004FB6AB /* LexPLM.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF211FA7526004FB6AB /* LexPLM.cxx */; }; - 114B6F4211FA7526004FB6AB /* LexPOV.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF311FA7526004FB6AB /* LexPOV.cxx */; }; - 114B6F4311FA7526004FB6AB /* LexPowerPro.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF411FA7526004FB6AB /* LexPowerPro.cxx */; }; - 114B6F4411FA7526004FB6AB /* LexPowerShell.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF511FA7526004FB6AB /* LexPowerShell.cxx */; }; - 114B6F4511FA7526004FB6AB /* LexProgress.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF611FA7526004FB6AB /* LexProgress.cxx */; }; - 114B6F4611FA7526004FB6AB /* LexPS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF711FA7526004FB6AB /* LexPS.cxx */; }; - 114B6F4711FA7526004FB6AB /* LexPython.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF811FA7526004FB6AB /* LexPython.cxx */; }; - 114B6F4811FA7526004FB6AB /* LexR.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF911FA7526004FB6AB /* LexR.cxx */; }; - 114B6F4911FA7526004FB6AB /* LexRebol.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EFA11FA7526004FB6AB /* LexRebol.cxx */; }; - 114B6F4A11FA7526004FB6AB /* LexRuby.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EFB11FA7526004FB6AB /* LexRuby.cxx */; }; - 114B6F4B11FA7526004FB6AB /* LexScriptol.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EFC11FA7526004FB6AB /* LexScriptol.cxx */; }; - 114B6F4C11FA7526004FB6AB /* LexSmalltalk.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EFD11FA7526004FB6AB /* LexSmalltalk.cxx */; }; - 114B6F4D11FA7526004FB6AB /* LexSML.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EFE11FA7526004FB6AB /* LexSML.cxx */; }; - 114B6F4E11FA7526004FB6AB /* LexSorcus.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EFF11FA7526004FB6AB /* LexSorcus.cxx */; }; - 114B6F4F11FA7526004FB6AB /* LexSpecman.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0011FA7526004FB6AB /* LexSpecman.cxx */; }; - 114B6F5011FA7526004FB6AB /* LexSpice.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0111FA7526004FB6AB /* LexSpice.cxx */; }; - 114B6F5111FA7526004FB6AB /* LexSQL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0211FA7526004FB6AB /* LexSQL.cxx */; }; - 114B6F5211FA7526004FB6AB /* LexTACL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0311FA7526004FB6AB /* LexTACL.cxx */; }; - 114B6F5311FA7526004FB6AB /* LexTADS3.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0411FA7526004FB6AB /* LexTADS3.cxx */; }; - 114B6F5411FA7526004FB6AB /* LexTAL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0511FA7526004FB6AB /* LexTAL.cxx */; }; - 114B6F5511FA7526004FB6AB /* LexTCL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0611FA7526004FB6AB /* LexTCL.cxx */; }; - 114B6F5611FA7526004FB6AB /* LexTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0711FA7526004FB6AB /* LexTeX.cxx */; }; - 114B6F5711FA7526004FB6AB /* LexTxt2tags.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0811FA7526004FB6AB /* LexTxt2tags.cxx */; }; - 114B6F5811FA7526004FB6AB /* LexVB.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0911FA7526004FB6AB /* LexVB.cxx */; }; - 114B6F5911FA7526004FB6AB /* LexVerilog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0A11FA7526004FB6AB /* LexVerilog.cxx */; }; - 114B6F5A11FA7526004FB6AB /* LexVHDL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0B11FA7526004FB6AB /* LexVHDL.cxx */; }; - 114B6F5B11FA7526004FB6AB /* LexYAML.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F0C11FA7526004FB6AB /* LexYAML.cxx */; }; - 114B6F7711FA7598004FB6AB /* AutoComplete.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6011FA7597004FB6AB /* AutoComplete.cxx */; }; - 114B6F7811FA7598004FB6AB /* CallTip.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6111FA7597004FB6AB /* CallTip.cxx */; }; - 114B6F7911FA7598004FB6AB /* Catalogue.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6211FA7597004FB6AB /* Catalogue.cxx */; }; - 114B6F7A11FA7598004FB6AB /* CellBuffer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6311FA7597004FB6AB /* CellBuffer.cxx */; }; - 114B6F7B11FA7598004FB6AB /* CharClassify.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6411FA7597004FB6AB /* CharClassify.cxx */; }; - 114B6F7C11FA7598004FB6AB /* ContractionState.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6511FA7597004FB6AB /* ContractionState.cxx */; }; - 114B6F7D11FA7598004FB6AB /* Decoration.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6611FA7597004FB6AB /* Decoration.cxx */; }; - 114B6F7E11FA7598004FB6AB /* Document.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6711FA7597004FB6AB /* Document.cxx */; }; - 114B6F7F11FA7598004FB6AB /* Editor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6811FA7597004FB6AB /* Editor.cxx */; }; - 114B6F8011FA7598004FB6AB /* ExternalLexer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6911FA7598004FB6AB /* ExternalLexer.cxx */; }; - 114B6F8111FA7598004FB6AB /* Indicator.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6A11FA7598004FB6AB /* Indicator.cxx */; }; - 114B6F8211FA7598004FB6AB /* KeyMap.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6B11FA7598004FB6AB /* KeyMap.cxx */; }; - 114B6F8311FA7598004FB6AB /* LineMarker.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6C11FA7598004FB6AB /* LineMarker.cxx */; }; - 114B6F8411FA7598004FB6AB /* PerLine.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6D11FA7598004FB6AB /* PerLine.cxx */; }; - 114B6F8511FA7598004FB6AB /* PositionCache.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6E11FA7598004FB6AB /* PositionCache.cxx */; }; - 114B6F8611FA7598004FB6AB /* RESearch.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F6F11FA7598004FB6AB /* RESearch.cxx */; }; - 114B6F8711FA7598004FB6AB /* RunStyles.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F7011FA7598004FB6AB /* RunStyles.cxx */; }; - 114B6F8811FA7598004FB6AB /* ScintillaBase.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F7111FA7598004FB6AB /* ScintillaBase.cxx */; }; - 114B6F8911FA7598004FB6AB /* Selection.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F7211FA7598004FB6AB /* Selection.cxx */; }; - 114B6F8A11FA7598004FB6AB /* Style.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F7311FA7598004FB6AB /* Style.cxx */; }; - 114B6F8B11FA7598004FB6AB /* UniConversion.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F7411FA7598004FB6AB /* UniConversion.cxx */; }; - 114B6F8C11FA7598004FB6AB /* ViewStyle.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F7511FA7598004FB6AB /* ViewStyle.cxx */; }; - 114B6F8D11FA7598004FB6AB /* XPM.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F7611FA7598004FB6AB /* XPM.cxx */; }; - 114B6F9711FA75BE004FB6AB /* Accessor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F8E11FA75BE004FB6AB /* Accessor.cxx */; }; - 114B6F9811FA75BE004FB6AB /* CharacterSet.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F8F11FA75BE004FB6AB /* CharacterSet.cxx */; }; - 114B6F9911FA75BE004FB6AB /* LexerBase.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9011FA75BE004FB6AB /* LexerBase.cxx */; }; - 114B6F9A11FA75BE004FB6AB /* LexerModule.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9111FA75BE004FB6AB /* LexerModule.cxx */; }; - 114B6F9B11FA75BE004FB6AB /* LexerNoExceptions.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9211FA75BE004FB6AB /* LexerNoExceptions.cxx */; }; - 114B6F9C11FA75BE004FB6AB /* LexerSimple.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9311FA75BE004FB6AB /* LexerSimple.cxx */; }; - 114B6F9D11FA75BE004FB6AB /* PropSetSimple.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9411FA75BE004FB6AB /* PropSetSimple.cxx */; }; - 114B6F9E11FA75BE004FB6AB /* StyleContext.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9511FA75BE004FB6AB /* StyleContext.cxx */; }; - 114B6F9F11FA75BE004FB6AB /* WordList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9611FA75BE004FB6AB /* WordList.cxx */; }; - 114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA011FA75DB004FB6AB /* ILexer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 114B6FBD11FA7623004FB6AB /* AutoComplete.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA211FA7623004FB6AB /* AutoComplete.h */; }; - 114B6FBE11FA7623004FB6AB /* CallTip.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA311FA7623004FB6AB /* CallTip.h */; }; - 114B6FBF11FA7623004FB6AB /* Catalogue.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA411FA7623004FB6AB /* Catalogue.h */; }; - 114B6FC011FA7623004FB6AB /* CellBuffer.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA511FA7623004FB6AB /* CellBuffer.h */; }; - 114B6FC111FA7623004FB6AB /* CharClassify.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA611FA7623004FB6AB /* CharClassify.h */; }; - 114B6FC211FA7623004FB6AB /* ContractionState.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA711FA7623004FB6AB /* ContractionState.h */; }; - 114B6FC311FA7623004FB6AB /* Decoration.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA811FA7623004FB6AB /* Decoration.h */; }; - 114B6FC411FA7623004FB6AB /* Document.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA911FA7623004FB6AB /* Document.h */; }; - 114B6FC511FA7623004FB6AB /* Editor.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FAA11FA7623004FB6AB /* Editor.h */; }; - 114B6FC611FA7623004FB6AB /* ExternalLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FAB11FA7623004FB6AB /* ExternalLexer.h */; }; - 114B6FC711FA7623004FB6AB /* FontQuality.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FAC11FA7623004FB6AB /* FontQuality.h */; }; - 114B6FC811FA7623004FB6AB /* Indicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FAD11FA7623004FB6AB /* Indicator.h */; }; - 114B6FC911FA7623004FB6AB /* KeyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FAE11FA7623004FB6AB /* KeyMap.h */; }; - 114B6FCA11FA7623004FB6AB /* LineMarker.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FAF11FA7623004FB6AB /* LineMarker.h */; }; - 114B6FCB11FA7623004FB6AB /* Partitioning.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FB011FA7623004FB6AB /* Partitioning.h */; }; - 114B6FCC11FA7623004FB6AB /* PerLine.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FB111FA7623004FB6AB /* PerLine.h */; }; - 114B6FCD11FA7623004FB6AB /* PositionCache.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FB211FA7623004FB6AB /* PositionCache.h */; }; - 114B6FCE11FA7623004FB6AB /* RESearch.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FB311FA7623004FB6AB /* RESearch.h */; }; - 114B6FCF11FA7623004FB6AB /* RunStyles.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FB411FA7623004FB6AB /* RunStyles.h */; }; - 114B6FD011FA7623004FB6AB /* ScintillaBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FB511FA7623004FB6AB /* ScintillaBase.h */; }; - 114B6FD111FA7623004FB6AB /* Selection.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FB611FA7623004FB6AB /* Selection.h */; }; - 114B6FD211FA7623004FB6AB /* SplitVector.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FB711FA7623004FB6AB /* SplitVector.h */; }; - 114B6FD311FA7623004FB6AB /* Style.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FB811FA7623004FB6AB /* Style.h */; }; - 114B6FD511FA7623004FB6AB /* UniConversion.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FBA11FA7623004FB6AB /* UniConversion.h */; }; - 114B6FD611FA7623004FB6AB /* ViewStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FBB11FA7623004FB6AB /* ViewStyle.h */; }; - 114B6FD711FA7623004FB6AB /* XPM.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FBC11FA7623004FB6AB /* XPM.h */; }; - 114B6FE311FA7645004FB6AB /* Accessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FD811FA7645004FB6AB /* Accessor.h */; }; - 114B6FE411FA7645004FB6AB /* CharacterSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FD911FA7645004FB6AB /* CharacterSet.h */; }; - 114B6FE511FA7645004FB6AB /* LexAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FDA11FA7645004FB6AB /* LexAccessor.h */; }; - 114B6FE611FA7645004FB6AB /* LexerBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FDB11FA7645004FB6AB /* LexerBase.h */; }; - 114B6FE711FA7645004FB6AB /* LexerModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FDC11FA7645004FB6AB /* LexerModule.h */; }; - 114B6FE811FA7645004FB6AB /* LexerNoExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FDD11FA7645004FB6AB /* LexerNoExceptions.h */; }; - 114B6FE911FA7645004FB6AB /* LexerSimple.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FDE11FA7645004FB6AB /* LexerSimple.h */; }; - 114B6FEA11FA7645004FB6AB /* OptionSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FDF11FA7645004FB6AB /* OptionSet.h */; }; - 114B6FEB11FA7645004FB6AB /* PropSetSimple.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FE011FA7645004FB6AB /* PropSetSimple.h */; }; - 114B6FEC11FA7645004FB6AB /* StyleContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FE111FA7645004FB6AB /* StyleContext.h */; }; - 114B6FED11FA7645004FB6AB /* WordList.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FE211FA7645004FB6AB /* WordList.h */; }; - 1152A77315313E58000D4E1A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1152A77215313E58000D4E1A /* QuartzCore.framework */; }; - 11594BE9155B91DF0099E1FA /* LexOScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11594BE7155B91DF0099E1FA /* LexOScript.cxx */; }; - 11594BEA155B91DF0099E1FA /* LexVisualProlog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11594BE8155B91DF0099E1FA /* LexVisualProlog.cxx */; }; - 1160E0381803651C00BCEBCB /* LexRust.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1160E0371803651C00BCEBCB /* LexRust.cxx */; }; - 117ACE9114A29A1E002876F9 /* LexTCMD.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 117ACE9014A29A1E002876F9 /* LexTCMD.cxx */; }; - 119FF1BF13C9D1820007CE42 /* QuartzTextStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */; }; - 11A0A8A1148602DF0018D143 /* LexCoffeeScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */; }; - 11BB124D12FF9C1300F6BCF7 /* LexModula.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */; }; - 11BEB6A214EF189600BDE92A /* LexECL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11BEB6A114EF189600BDE92A /* LexECL.cxx */; }; - 11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */; }; - 11FBA39D17817DA00048C071 /* CharacterCategory.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FBA39B17817DA00048C071 /* CharacterCategory.cxx */; }; - 11FBA39E17817DA00048C071 /* CharacterCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 11FBA39C17817DA00048C071 /* CharacterCategory.h */; }; - 11FDAEB7174E1A9800FA161B /* LexSTTXT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FDAEB6174E1A9700FA161B /* LexSTTXT.cxx */; }; - 11FDD0E017C480D4001541B9 /* LexKVIrc.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */; }; - 11FF3FE21810EB3900E13F13 /* LexDMAP.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */; }; - 2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59D0FC168A100E85C33 /* InfoBar.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A30FC168A100E85C33 /* ScintillaView.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2744E5AC0FC168B200E85C33 /* InfoBarCommunicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5AB0FC168B200E85C33 /* InfoBarCommunicator.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2744E5B20FC168C500E85C33 /* InfoBar.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5AD0FC168C500E85C33 /* InfoBar.mm */; }; - 2744E5B30FC168C500E85C33 /* PlatCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5AE0FC168C500E85C33 /* PlatCocoa.mm */; }; - 2744E5B50FC168C500E85C33 /* ScintillaCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5B00FC168C500E85C33 /* ScintillaCocoa.mm */; }; - 2744E5B60FC168C500E85C33 /* ScintillaView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5B10FC168C500E85C33 /* ScintillaView.mm */; }; - 2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59E0FC168A100E85C33 /* PlatCocoa.h */; }; - 2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4850FC1678600E85C33 /* Platform.h */; }; - 2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4870FC1678600E85C33 /* SciLexer.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2791F3C90FC19F71009DBCF9 /* Scintilla.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4880FC1678600E85C33 /* Scintilla.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */; }; - 2791F3E30FC1A3AE009DBCF9 /* QuartzTextLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */; }; - 2791F3E40FC1A3AE009DBCF9 /* QuartzTextStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */; }; - 27FEF4540FC1B413005E115A /* info_bar_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4510FC1B413005E115A /* info_bar_bg.png */; }; - 27FEF4550FC1B413005E115A /* mac_cursor_busy.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4520FC1B413005E115A /* mac_cursor_busy.png */; }; - 27FEF4560FC1B413005E115A /* mac_cursor_flipped.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */; }; - 280056FB188DDD2C00F200AE /* SparseState.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056F8188DDD2C00F200AE /* SparseState.h */; }; - 280056FC188DDD2C00F200AE /* StringCopy.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056F9188DDD2C00F200AE /* StringCopy.h */; }; - 280056FD188DDD2C00F200AE /* SubStyles.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056FA188DDD2C00F200AE /* SubStyles.h */; }; - 28064A05190F12E100E6E47F /* LexDMIS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28064A04190F12E100E6E47F /* LexDMIS.cxx */; }; - 281225362256DD2D00AFE50C /* UniqueString.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 281225352256DD2D00AFE50C /* UniqueString.cxx */; }; - 282D4A961F53FE270082E4D3 /* ILoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 282D4A951F53FE270082E4D3 /* ILoader.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 28804B2C1EEE232E00C0D154 /* DBCS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28804B2B1EEE232E00C0D154 /* DBCS.cxx */; }; - 28A067111A36B42600B4966A /* LexHex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A067101A36B42600B4966A /* LexHex.cxx */; }; - 28A1DD51196BE0CA006EFCDD /* EditModel.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */; }; - 28A1DD52196BE0CA006EFCDD /* EditView.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */; }; - 28A1DD53196BE0CA006EFCDD /* MarginView.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD50196BE0CA006EFCDD /* MarginView.cxx */; }; - 28A1DD57196BE0ED006EFCDD /* EditModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD54196BE0ED006EFCDD /* EditModel.h */; }; - 28A1DD58196BE0ED006EFCDD /* EditView.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD55196BE0ED006EFCDD /* EditView.h */; }; - 28A1DD59196BE0ED006EFCDD /* MarginView.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD56196BE0ED006EFCDD /* MarginView.h */; }; - 28A7D6051995E47D0062D204 /* LexRegistry.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A7D6041995E47D0062D204 /* LexRegistry.cxx */; }; - 28B6470C1B54C0720009DC49 /* LexBatch.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647061B54C0720009DC49 /* LexBatch.cxx */; }; - 28B6470D1B54C0720009DC49 /* LexDiff.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647071B54C0720009DC49 /* LexDiff.cxx */; }; - 28B6470E1B54C0720009DC49 /* LexErrorList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647081B54C0720009DC49 /* LexErrorList.cxx */; }; - 28B6470F1B54C0720009DC49 /* LexMake.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647091B54C0720009DC49 /* LexMake.cxx */; }; - 28B647101B54C0720009DC49 /* LexNull.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B6470A1B54C0720009DC49 /* LexNull.cxx */; }; - 28B647111B54C0720009DC49 /* LexProps.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B6470B1B54C0720009DC49 /* LexProps.cxx */; }; - 28BC38EC1B74C6AD008BF9EB /* Sci_Position.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BC38EB1B74C6AD008BF9EB /* Sci_Position.h */; settings = {ATTRIBUTES = (Public, ); }; }; - 28BDA1221EFB8F7C00EBD3F3 /* DefaultLexer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BDA1211EFB8F7C00EBD3F3 /* DefaultLexer.cxx */; }; - 28BDA1241EFB8FB200EBD3F3 /* DefaultLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BDA1231EFB8FB200EBD3F3 /* DefaultLexer.h */; }; - 28C40CA81CB7321200B089F2 /* LexJSON.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28C40CA71CB7321200B089F2 /* LexJSON.cxx */; }; - 28D191A21DEA72C800159938 /* LexEDIFACT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28D191A11DEA72C800159938 /* LexEDIFACT.cxx */; }; - 28D516D81830FFCA0047C93D /* info_bar_bg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */; }; - 28D516D91830FFCA0047C93D /* mac_cursor_busy@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */; }; - 28D516DA1830FFCA0047C93D /* mac_cursor_flipped@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */; }; - 28FDA42119B6967B00BE27D7 /* LexBibTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */; }; - 3D994BD7A5EAC4FA5B3CFBDF /* LexMaxima.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 29B042978C1F93EF42F9E4AB /* LexMaxima.cxx */; }; - 5F804AA6B60FE695863A39FE /* LexStata.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7623427695416AB1270EE023 /* LexStata.cxx */; }; - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; }; - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; }; - F437405F9F32C7DEFCA38C11 /* LexIndent.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */; }; - FDC7442CAD70B9A67EF1639D /* LexSAS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A95147A1AB7CADB00DAFE724 /* LexSAS.cxx */; }; - AE894E1CB7328CAE5B2EF47E /* LexX12.cxx in Sources */ = {isa = PBXBuildFile; fileRef = ADA64364A443F3E3F02D294E /* LexX12.cxx */; }; - 902B40FE926FE48538B168F1 /* LexDataflex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 362E48F5A7F79598CB0B037D /* LexDataflex.cxx */; }; - 4AA242EE8F0CCEA01AB59842 /* LexHollywood.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 96884184929F317E72FC1BE8 /* LexHollywood.cxx */; }; - 513A4B43B903344E142C441E /* LexRaku.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 48484CD7A1F20D09703376E5 /* LexRaku.cxx */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 0867D69BFE84028FC02AAC07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; }; - 0867D6A5FE840307C02AAC07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; }; - 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; }; - 1100F1E6178E393200105727 /* CaseConvert.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CaseConvert.cxx; path = ../../src/CaseConvert.cxx; sourceTree = "<group>"; }; - 1100F1E7178E393200105727 /* CaseConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CaseConvert.h; path = ../../src/CaseConvert.h; sourceTree = "<group>"; }; - 1100F1E8178E393200105727 /* CaseFolder.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CaseFolder.cxx; path = ../../src/CaseFolder.cxx; sourceTree = "<group>"; }; - 1100F1E9178E393200105727 /* CaseFolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CaseFolder.h; path = ../../src/CaseFolder.h; sourceTree = "<group>"; }; - 1102C31B169FB49300DC16AB /* LexLaTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLaTeX.cxx; path = ../../lexers/LexLaTeX.cxx; sourceTree = "<group>"; }; - 11126B8114CD3A6200803C49 /* LexAVS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAVS.cxx; path = ../../lexers/LexAVS.cxx; sourceTree = "<group>"; }; - 1114D6CA1602A951001DC345 /* LexPO.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPO.cxx; path = ../../lexers/LexPO.cxx; sourceTree = "<group>"; }; - 114B6EBE11FA7526004FB6AB /* LexAbaqus.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAbaqus.cxx; path = ../../lexers/LexAbaqus.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EBF11FA7526004FB6AB /* LexAda.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAda.cxx; path = ../../lexers/LexAda.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC011FA7526004FB6AB /* LexAPDL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAPDL.cxx; path = ../../lexers/LexAPDL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC111FA7526004FB6AB /* LexAsm.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAsm.cxx; path = ../../lexers/LexAsm.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC211FA7526004FB6AB /* LexAsn1.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAsn1.cxx; path = ../../lexers/LexAsn1.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC311FA7526004FB6AB /* LexASY.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexASY.cxx; path = ../../lexers/LexASY.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC411FA7526004FB6AB /* LexAU3.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAU3.cxx; path = ../../lexers/LexAU3.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC511FA7526004FB6AB /* LexAVE.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAVE.cxx; path = ../../lexers/LexAVE.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC611FA7526004FB6AB /* LexBaan.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBaan.cxx; path = ../../lexers/LexBaan.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC711FA7526004FB6AB /* LexBash.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBash.cxx; path = ../../lexers/LexBash.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC811FA7526004FB6AB /* LexBasic.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBasic.cxx; path = ../../lexers/LexBasic.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EC911FA7526004FB6AB /* LexBullant.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBullant.cxx; path = ../../lexers/LexBullant.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ECA11FA7526004FB6AB /* LexCaml.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCaml.cxx; path = ../../lexers/LexCaml.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ECB11FA7526004FB6AB /* LexCLW.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCLW.cxx; path = ../../lexers/LexCLW.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ECC11FA7526004FB6AB /* LexCmake.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCmake.cxx; path = ../../lexers/LexCmake.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ECD11FA7526004FB6AB /* LexCOBOL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCOBOL.cxx; path = ../../lexers/LexCOBOL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ECE11FA7526004FB6AB /* LexConf.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexConf.cxx; path = ../../lexers/LexConf.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ECF11FA7526004FB6AB /* LexCPP.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCPP.cxx; path = ../../lexers/LexCPP.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED011FA7526004FB6AB /* LexCrontab.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCrontab.cxx; path = ../../lexers/LexCrontab.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED111FA7526004FB6AB /* LexCsound.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCsound.cxx; path = ../../lexers/LexCsound.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED211FA7526004FB6AB /* LexCSS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCSS.cxx; path = ../../lexers/LexCSS.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED311FA7526004FB6AB /* LexD.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexD.cxx; path = ../../lexers/LexD.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED411FA7526004FB6AB /* LexEiffel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexEiffel.cxx; path = ../../lexers/LexEiffel.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED511FA7526004FB6AB /* LexErlang.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexErlang.cxx; path = ../../lexers/LexErlang.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED611FA7526004FB6AB /* LexEScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexEScript.cxx; path = ../../lexers/LexEScript.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED711FA7526004FB6AB /* LexFlagship.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexFlagship.cxx; path = ../../lexers/LexFlagship.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED811FA7526004FB6AB /* LexForth.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexForth.cxx; path = ../../lexers/LexForth.cxx; sourceTree = SOURCE_ROOT; }; - 114B6ED911FA7526004FB6AB /* LexFortran.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexFortran.cxx; path = ../../lexers/LexFortran.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EDA11FA7526004FB6AB /* LexGAP.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexGAP.cxx; path = ../../lexers/LexGAP.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EDB11FA7526004FB6AB /* LexGui4Cli.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexGui4Cli.cxx; path = ../../lexers/LexGui4Cli.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EDC11FA7526004FB6AB /* LexHaskell.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHaskell.cxx; path = ../../lexers/LexHaskell.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EDD11FA7526004FB6AB /* LexHTML.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHTML.cxx; path = ../../lexers/LexHTML.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EDE11FA7526004FB6AB /* LexInno.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexInno.cxx; path = ../../lexers/LexInno.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EDF11FA7526004FB6AB /* LexKix.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexKix.cxx; path = ../../lexers/LexKix.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE011FA7526004FB6AB /* LexLisp.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLisp.cxx; path = ../../lexers/LexLisp.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE111FA7526004FB6AB /* LexLout.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLout.cxx; path = ../../lexers/LexLout.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE211FA7526004FB6AB /* LexLua.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLua.cxx; path = ../../lexers/LexLua.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE311FA7526004FB6AB /* LexMagik.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMagik.cxx; path = ../../lexers/LexMagik.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE411FA7526004FB6AB /* LexMarkdown.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMarkdown.cxx; path = ../../lexers/LexMarkdown.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE511FA7526004FB6AB /* LexMatlab.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMatlab.cxx; path = ../../lexers/LexMatlab.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE611FA7526004FB6AB /* LexMetapost.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMetapost.cxx; path = ../../lexers/LexMetapost.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE711FA7526004FB6AB /* LexMMIXAL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMMIXAL.cxx; path = ../../lexers/LexMMIXAL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE811FA7526004FB6AB /* LexMPT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMPT.cxx; path = ../../lexers/LexMPT.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EE911FA7526004FB6AB /* LexMSSQL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMSSQL.cxx; path = ../../lexers/LexMSSQL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EEA11FA7526004FB6AB /* LexMySQL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMySQL.cxx; path = ../../lexers/LexMySQL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EEB11FA7526004FB6AB /* LexNimrod.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNimrod.cxx; path = ../../lexers/LexNimrod.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EEC11FA7526004FB6AB /* LexNsis.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNsis.cxx; path = ../../lexers/LexNsis.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EED11FA7526004FB6AB /* LexOpal.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOpal.cxx; path = ../../lexers/LexOpal.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EEF11FA7526004FB6AB /* LexPascal.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPascal.cxx; path = ../../lexers/LexPascal.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF011FA7526004FB6AB /* LexPB.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPB.cxx; path = ../../lexers/LexPB.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF111FA7526004FB6AB /* LexPerl.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPerl.cxx; path = ../../lexers/LexPerl.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF211FA7526004FB6AB /* LexPLM.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPLM.cxx; path = ../../lexers/LexPLM.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF311FA7526004FB6AB /* LexPOV.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPOV.cxx; path = ../../lexers/LexPOV.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF411FA7526004FB6AB /* LexPowerPro.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPowerPro.cxx; path = ../../lexers/LexPowerPro.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF511FA7526004FB6AB /* LexPowerShell.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPowerShell.cxx; path = ../../lexers/LexPowerShell.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF611FA7526004FB6AB /* LexProgress.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexProgress.cxx; path = ../../lexers/LexProgress.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF711FA7526004FB6AB /* LexPS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPS.cxx; path = ../../lexers/LexPS.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF811FA7526004FB6AB /* LexPython.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPython.cxx; path = ../../lexers/LexPython.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EF911FA7526004FB6AB /* LexR.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexR.cxx; path = ../../lexers/LexR.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EFA11FA7526004FB6AB /* LexRebol.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRebol.cxx; path = ../../lexers/LexRebol.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EFB11FA7526004FB6AB /* LexRuby.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRuby.cxx; path = ../../lexers/LexRuby.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EFC11FA7526004FB6AB /* LexScriptol.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexScriptol.cxx; path = ../../lexers/LexScriptol.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EFD11FA7526004FB6AB /* LexSmalltalk.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSmalltalk.cxx; path = ../../lexers/LexSmalltalk.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EFE11FA7526004FB6AB /* LexSML.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSML.cxx; path = ../../lexers/LexSML.cxx; sourceTree = SOURCE_ROOT; }; - 114B6EFF11FA7526004FB6AB /* LexSorcus.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSorcus.cxx; path = ../../lexers/LexSorcus.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0011FA7526004FB6AB /* LexSpecman.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSpecman.cxx; path = ../../lexers/LexSpecman.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0111FA7526004FB6AB /* LexSpice.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSpice.cxx; path = ../../lexers/LexSpice.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0211FA7526004FB6AB /* LexSQL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSQL.cxx; path = ../../lexers/LexSQL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0311FA7526004FB6AB /* LexTACL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTACL.cxx; path = ../../lexers/LexTACL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0411FA7526004FB6AB /* LexTADS3.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTADS3.cxx; path = ../../lexers/LexTADS3.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0511FA7526004FB6AB /* LexTAL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTAL.cxx; path = ../../lexers/LexTAL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0611FA7526004FB6AB /* LexTCL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTCL.cxx; path = ../../lexers/LexTCL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0711FA7526004FB6AB /* LexTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTeX.cxx; path = ../../lexers/LexTeX.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0811FA7526004FB6AB /* LexTxt2tags.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTxt2tags.cxx; path = ../../lexers/LexTxt2tags.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0911FA7526004FB6AB /* LexVB.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVB.cxx; path = ../../lexers/LexVB.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0A11FA7526004FB6AB /* LexVerilog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVerilog.cxx; path = ../../lexers/LexVerilog.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0B11FA7526004FB6AB /* LexVHDL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVHDL.cxx; path = ../../lexers/LexVHDL.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F0C11FA7526004FB6AB /* LexYAML.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexYAML.cxx; path = ../../lexers/LexYAML.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6011FA7597004FB6AB /* AutoComplete.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = AutoComplete.cxx; path = ../../src/AutoComplete.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6111FA7597004FB6AB /* CallTip.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CallTip.cxx; path = ../../src/CallTip.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6211FA7597004FB6AB /* Catalogue.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Catalogue.cxx; path = ../../src/Catalogue.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6311FA7597004FB6AB /* CellBuffer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CellBuffer.cxx; path = ../../src/CellBuffer.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6411FA7597004FB6AB /* CharClassify.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharClassify.cxx; path = ../../src/CharClassify.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6511FA7597004FB6AB /* ContractionState.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ContractionState.cxx; path = ../../src/ContractionState.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6611FA7597004FB6AB /* Decoration.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Decoration.cxx; path = ../../src/Decoration.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6711FA7597004FB6AB /* Document.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Document.cxx; path = ../../src/Document.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6811FA7597004FB6AB /* Editor.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Editor.cxx; path = ../../src/Editor.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6911FA7598004FB6AB /* ExternalLexer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ExternalLexer.cxx; path = ../../src/ExternalLexer.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6A11FA7598004FB6AB /* Indicator.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Indicator.cxx; path = ../../src/Indicator.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6B11FA7598004FB6AB /* KeyMap.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = KeyMap.cxx; path = ../../src/KeyMap.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6C11FA7598004FB6AB /* LineMarker.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LineMarker.cxx; path = ../../src/LineMarker.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6D11FA7598004FB6AB /* PerLine.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PerLine.cxx; path = ../../src/PerLine.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6E11FA7598004FB6AB /* PositionCache.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PositionCache.cxx; path = ../../src/PositionCache.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F6F11FA7598004FB6AB /* RESearch.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RESearch.cxx; path = ../../src/RESearch.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F7011FA7598004FB6AB /* RunStyles.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = RunStyles.cxx; path = ../../src/RunStyles.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F7111FA7598004FB6AB /* ScintillaBase.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ScintillaBase.cxx; path = ../../src/ScintillaBase.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F7211FA7598004FB6AB /* Selection.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Selection.cxx; path = ../../src/Selection.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F7311FA7598004FB6AB /* Style.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Style.cxx; path = ../../src/Style.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F7411FA7598004FB6AB /* UniConversion.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UniConversion.cxx; path = ../../src/UniConversion.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F7511FA7598004FB6AB /* ViewStyle.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = ViewStyle.cxx; path = ../../src/ViewStyle.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F7611FA7598004FB6AB /* XPM.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = XPM.cxx; path = ../../src/XPM.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F8E11FA75BE004FB6AB /* Accessor.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Accessor.cxx; path = ../../lexlib/Accessor.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F8F11FA75BE004FB6AB /* CharacterSet.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterSet.cxx; path = ../../lexlib/CharacterSet.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F9011FA75BE004FB6AB /* LexerBase.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexerBase.cxx; path = ../../lexlib/LexerBase.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F9111FA75BE004FB6AB /* LexerModule.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexerModule.cxx; path = ../../lexlib/LexerModule.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F9211FA75BE004FB6AB /* LexerNoExceptions.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexerNoExceptions.cxx; path = ../../lexlib/LexerNoExceptions.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F9311FA75BE004FB6AB /* LexerSimple.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexerSimple.cxx; path = ../../lexlib/LexerSimple.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F9411FA75BE004FB6AB /* PropSetSimple.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PropSetSimple.cxx; path = ../../lexlib/PropSetSimple.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F9511FA75BE004FB6AB /* StyleContext.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StyleContext.cxx; path = ../../lexlib/StyleContext.cxx; sourceTree = SOURCE_ROOT; }; - 114B6F9611FA75BE004FB6AB /* WordList.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WordList.cxx; path = ../../lexlib/WordList.cxx; sourceTree = SOURCE_ROOT; }; - 114B6FA011FA75DB004FB6AB /* ILexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ILexer.h; path = ../../include/ILexer.h; sourceTree = SOURCE_ROOT; }; - 114B6FA211FA7623004FB6AB /* AutoComplete.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = AutoComplete.h; path = ../../src/AutoComplete.h; sourceTree = SOURCE_ROOT; }; - 114B6FA311FA7623004FB6AB /* CallTip.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CallTip.h; path = ../../src/CallTip.h; sourceTree = SOURCE_ROOT; }; - 114B6FA411FA7623004FB6AB /* Catalogue.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Catalogue.h; path = ../../src/Catalogue.h; sourceTree = SOURCE_ROOT; }; - 114B6FA511FA7623004FB6AB /* CellBuffer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CellBuffer.h; path = ../../src/CellBuffer.h; sourceTree = SOURCE_ROOT; }; - 114B6FA611FA7623004FB6AB /* CharClassify.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CharClassify.h; path = ../../src/CharClassify.h; sourceTree = SOURCE_ROOT; }; - 114B6FA711FA7623004FB6AB /* ContractionState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ContractionState.h; path = ../../src/ContractionState.h; sourceTree = SOURCE_ROOT; }; - 114B6FA811FA7623004FB6AB /* Decoration.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Decoration.h; path = ../../src/Decoration.h; sourceTree = SOURCE_ROOT; }; - 114B6FA911FA7623004FB6AB /* Document.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Document.h; path = ../../src/Document.h; sourceTree = SOURCE_ROOT; }; - 114B6FAA11FA7623004FB6AB /* Editor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Editor.h; path = ../../src/Editor.h; sourceTree = SOURCE_ROOT; }; - 114B6FAB11FA7623004FB6AB /* ExternalLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ExternalLexer.h; path = ../../src/ExternalLexer.h; sourceTree = SOURCE_ROOT; }; - 114B6FAC11FA7623004FB6AB /* FontQuality.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = FontQuality.h; path = ../../src/FontQuality.h; sourceTree = SOURCE_ROOT; }; - 114B6FAD11FA7623004FB6AB /* Indicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Indicator.h; path = ../../src/Indicator.h; sourceTree = SOURCE_ROOT; }; - 114B6FAE11FA7623004FB6AB /* KeyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = KeyMap.h; path = ../../src/KeyMap.h; sourceTree = SOURCE_ROOT; }; - 114B6FAF11FA7623004FB6AB /* LineMarker.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LineMarker.h; path = ../../src/LineMarker.h; sourceTree = SOURCE_ROOT; }; - 114B6FB011FA7623004FB6AB /* Partitioning.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Partitioning.h; path = ../../src/Partitioning.h; sourceTree = SOURCE_ROOT; }; - 114B6FB111FA7623004FB6AB /* PerLine.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PerLine.h; path = ../../src/PerLine.h; sourceTree = SOURCE_ROOT; }; - 114B6FB211FA7623004FB6AB /* PositionCache.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PositionCache.h; path = ../../src/PositionCache.h; sourceTree = SOURCE_ROOT; }; - 114B6FB311FA7623004FB6AB /* RESearch.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RESearch.h; path = ../../src/RESearch.h; sourceTree = SOURCE_ROOT; }; - 114B6FB411FA7623004FB6AB /* RunStyles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = RunStyles.h; path = ../../src/RunStyles.h; sourceTree = SOURCE_ROOT; }; - 114B6FB511FA7623004FB6AB /* ScintillaBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScintillaBase.h; path = ../../src/ScintillaBase.h; sourceTree = SOURCE_ROOT; }; - 114B6FB611FA7623004FB6AB /* Selection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Selection.h; path = ../../src/Selection.h; sourceTree = SOURCE_ROOT; }; - 114B6FB711FA7623004FB6AB /* SplitVector.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SplitVector.h; path = ../../src/SplitVector.h; sourceTree = SOURCE_ROOT; }; - 114B6FB811FA7623004FB6AB /* Style.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Style.h; path = ../../src/Style.h; sourceTree = SOURCE_ROOT; }; - 114B6FBA11FA7623004FB6AB /* UniConversion.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UniConversion.h; path = ../../src/UniConversion.h; sourceTree = SOURCE_ROOT; }; - 114B6FBB11FA7623004FB6AB /* ViewStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ViewStyle.h; path = ../../src/ViewStyle.h; sourceTree = SOURCE_ROOT; }; - 114B6FBC11FA7623004FB6AB /* XPM.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = XPM.h; path = ../../src/XPM.h; sourceTree = SOURCE_ROOT; }; - 114B6FD811FA7645004FB6AB /* Accessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Accessor.h; path = ../../lexlib/Accessor.h; sourceTree = SOURCE_ROOT; }; - 114B6FD911FA7645004FB6AB /* CharacterSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CharacterSet.h; path = ../../lexlib/CharacterSet.h; sourceTree = SOURCE_ROOT; }; - 114B6FDA11FA7645004FB6AB /* LexAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexAccessor.h; path = ../../lexlib/LexAccessor.h; sourceTree = SOURCE_ROOT; }; - 114B6FDB11FA7645004FB6AB /* LexerBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexerBase.h; path = ../../lexlib/LexerBase.h; sourceTree = SOURCE_ROOT; }; - 114B6FDC11FA7645004FB6AB /* LexerModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexerModule.h; path = ../../lexlib/LexerModule.h; sourceTree = SOURCE_ROOT; }; - 114B6FDD11FA7645004FB6AB /* LexerNoExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexerNoExceptions.h; path = ../../lexlib/LexerNoExceptions.h; sourceTree = SOURCE_ROOT; }; - 114B6FDE11FA7645004FB6AB /* LexerSimple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexerSimple.h; path = ../../lexlib/LexerSimple.h; sourceTree = SOURCE_ROOT; }; - 114B6FDF11FA7645004FB6AB /* OptionSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionSet.h; path = ../../lexlib/OptionSet.h; sourceTree = SOURCE_ROOT; }; - 114B6FE011FA7645004FB6AB /* PropSetSimple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PropSetSimple.h; path = ../../lexlib/PropSetSimple.h; sourceTree = SOURCE_ROOT; }; - 114B6FE111FA7645004FB6AB /* StyleContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleContext.h; path = ../../lexlib/StyleContext.h; sourceTree = SOURCE_ROOT; }; - 114B6FE211FA7645004FB6AB /* WordList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WordList.h; path = ../../lexlib/WordList.h; sourceTree = SOURCE_ROOT; }; - 1152A77215313E58000D4E1A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = ../../../../../../../../System/Library/Frameworks/QuartzCore.framework; sourceTree = "<group>"; }; - 11594BE7155B91DF0099E1FA /* LexOScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOScript.cxx; path = ../../lexers/LexOScript.cxx; sourceTree = "<group>"; }; - 11594BE8155B91DF0099E1FA /* LexVisualProlog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVisualProlog.cxx; path = ../../lexers/LexVisualProlog.cxx; sourceTree = "<group>"; }; - 1160E0371803651C00BCEBCB /* LexRust.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRust.cxx; path = ../../lexers/LexRust.cxx; sourceTree = "<group>"; }; - 117ACE9014A29A1E002876F9 /* LexTCMD.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTCMD.cxx; path = ../../lexers/LexTCMD.cxx; sourceTree = "<group>"; }; - 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuartzTextStyle.h; path = ../QuartzTextStyle.h; sourceTree = "<group>"; }; - 11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCoffeeScript.cxx; path = ../../lexers/LexCoffeeScript.cxx; sourceTree = "<group>"; }; - 11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexModula.cxx; path = ../../lexers/LexModula.cxx; sourceTree = SOURCE_ROOT; }; - 11BEB6A114EF189600BDE92A /* LexECL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexECL.cxx; path = ../../lexers/LexECL.cxx; sourceTree = "<group>"; }; - 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexA68k.cxx; path = ../../lexers/LexA68k.cxx; sourceTree = SOURCE_ROOT; }; - 11FBA39B17817DA00048C071 /* CharacterCategory.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterCategory.cxx; path = ../../lexlib/CharacterCategory.cxx; sourceTree = "<group>"; }; - 11FBA39C17817DA00048C071 /* CharacterCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CharacterCategory.h; path = ../../lexlib/CharacterCategory.h; sourceTree = "<group>"; }; - 11FDAEB6174E1A9700FA161B /* LexSTTXT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSTTXT.cxx; path = ../../lexers/LexSTTXT.cxx; sourceTree = "<group>"; }; - 11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexKVIrc.cxx; path = ../../lexers/LexKVIrc.cxx; sourceTree = "<group>"; }; - 11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMAP.cxx; path = ../../lexers/LexDMAP.cxx; sourceTree = "<group>"; }; - 2744E4850FC1678600E85C33 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Platform.h; path = ../../include/Platform.h; sourceTree = SOURCE_ROOT; }; - 2744E4870FC1678600E85C33 /* SciLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SciLexer.h; path = ../../include/SciLexer.h; sourceTree = SOURCE_ROOT; }; - 2744E4880FC1678600E85C33 /* Scintilla.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Scintilla.h; path = ../../include/Scintilla.h; sourceTree = SOURCE_ROOT; }; - 2744E59D0FC168A100E85C33 /* InfoBar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoBar.h; path = ../InfoBar.h; sourceTree = SOURCE_ROOT; }; - 2744E59E0FC168A100E85C33 /* PlatCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PlatCocoa.h; path = ../PlatCocoa.h; sourceTree = SOURCE_ROOT; }; - 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuartzTextLayout.h; path = ../QuartzTextLayout.h; sourceTree = SOURCE_ROOT; }; - 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuartzTextStyleAttribute.h; path = ../QuartzTextStyleAttribute.h; sourceTree = SOURCE_ROOT; }; - 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScintillaCocoa.h; path = ../ScintillaCocoa.h; sourceTree = "<group>"; }; - 2744E5A30FC168A100E85C33 /* ScintillaView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ScintillaView.h; path = ../ScintillaView.h; sourceTree = "<group>"; }; - 2744E5AB0FC168B200E85C33 /* InfoBarCommunicator.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = InfoBarCommunicator.h; path = ../InfoBarCommunicator.h; sourceTree = SOURCE_ROOT; }; - 2744E5AD0FC168C500E85C33 /* InfoBar.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = InfoBar.mm; path = ../InfoBar.mm; sourceTree = SOURCE_ROOT; }; - 2744E5AE0FC168C500E85C33 /* PlatCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = PlatCocoa.mm; path = ../PlatCocoa.mm; sourceTree = SOURCE_ROOT; }; - 2744E5B00FC168C500E85C33 /* ScintillaCocoa.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ScintillaCocoa.mm; path = ../ScintillaCocoa.mm; sourceTree = "<group>"; }; - 2744E5B10FC168C500E85C33 /* ScintillaView.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; name = ScintillaView.mm; path = ../ScintillaView.mm; sourceTree = "<group>"; }; - 27FEF4510FC1B413005E115A /* info_bar_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = info_bar_bg.png; sourceTree = "<group>"; }; - 27FEF4520FC1B413005E115A /* mac_cursor_busy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mac_cursor_busy.png; sourceTree = "<group>"; }; - 27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mac_cursor_flipped.png; sourceTree = "<group>"; }; - 280056F8188DDD2C00F200AE /* SparseState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SparseState.h; path = ../../lexlib/SparseState.h; sourceTree = "<group>"; }; - 280056F9188DDD2C00F200AE /* StringCopy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringCopy.h; path = ../../lexlib/StringCopy.h; sourceTree = "<group>"; }; - 280056FA188DDD2C00F200AE /* SubStyles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SubStyles.h; path = ../../lexlib/SubStyles.h; sourceTree = "<group>"; }; - 28064A04190F12E100E6E47F /* LexDMIS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMIS.cxx; path = ../../lexers/LexDMIS.cxx; sourceTree = "<group>"; }; - 281225352256DD2D00AFE50C /* UniqueString.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = UniqueString.cxx; path = ../../src/UniqueString.cxx; sourceTree = "<group>"; }; - 282D4A951F53FE270082E4D3 /* ILoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ILoader.h; path = ../../include/ILoader.h; sourceTree = "<group>"; }; - 282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexIndent.cxx; path = ../../lexers/LexIndent.cxx; sourceTree = SOURCE_ROOT; }; - 28804B2B1EEE232E00C0D154 /* DBCS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DBCS.cxx; path = ../../src/DBCS.cxx; sourceTree = "<group>"; }; - 28A067101A36B42600B4966A /* LexHex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHex.cxx; path = ../../lexers/LexHex.cxx; sourceTree = "<group>"; }; - 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditModel.cxx; path = ../../src/EditModel.cxx; sourceTree = "<group>"; }; - 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditView.cxx; path = ../../src/EditView.cxx; sourceTree = "<group>"; }; - 28A1DD50196BE0CA006EFCDD /* MarginView.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MarginView.cxx; path = ../../src/MarginView.cxx; sourceTree = "<group>"; }; - 28A1DD54196BE0ED006EFCDD /* EditModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditModel.h; path = ../../src/EditModel.h; sourceTree = "<group>"; }; - 28A1DD55196BE0ED006EFCDD /* EditView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditView.h; path = ../../src/EditView.h; sourceTree = "<group>"; }; - 28A1DD56196BE0ED006EFCDD /* MarginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MarginView.h; path = ../../src/MarginView.h; sourceTree = "<group>"; }; - 28A7D6041995E47D0062D204 /* LexRegistry.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRegistry.cxx; path = ../../lexers/LexRegistry.cxx; sourceTree = "<group>"; }; - 28B647061B54C0720009DC49 /* LexBatch.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBatch.cxx; path = ../../lexers/LexBatch.cxx; sourceTree = "<group>"; }; - 28B647071B54C0720009DC49 /* LexDiff.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDiff.cxx; path = ../../lexers/LexDiff.cxx; sourceTree = "<group>"; }; - 28B647081B54C0720009DC49 /* LexErrorList.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexErrorList.cxx; path = ../../lexers/LexErrorList.cxx; sourceTree = "<group>"; }; - 28B647091B54C0720009DC49 /* LexMake.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMake.cxx; path = ../../lexers/LexMake.cxx; sourceTree = "<group>"; }; - 28B6470A1B54C0720009DC49 /* LexNull.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNull.cxx; path = ../../lexers/LexNull.cxx; sourceTree = "<group>"; }; - 28B6470B1B54C0720009DC49 /* LexProps.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexProps.cxx; path = ../../lexers/LexProps.cxx; sourceTree = "<group>"; }; - 28BC38EB1B74C6AD008BF9EB /* Sci_Position.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sci_Position.h; path = ../../include/Sci_Position.h; sourceTree = "<group>"; }; - 28BDA1211EFB8F7C00EBD3F3 /* DefaultLexer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DefaultLexer.cxx; path = ../../lexlib/DefaultLexer.cxx; sourceTree = "<group>"; }; - 28BDA1231EFB8FB200EBD3F3 /* DefaultLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefaultLexer.h; path = ../../lexlib/DefaultLexer.h; sourceTree = "<group>"; }; - 28C40CA71CB7321200B089F2 /* LexJSON.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexJSON.cxx; path = ../../lexers/LexJSON.cxx; sourceTree = "<group>"; }; - 28D1919E1DE69FC100159938 /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; }; - 28D191A11DEA72C800159938 /* LexEDIFACT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexEDIFACT.cxx; path = ../../lexers/LexEDIFACT.cxx; sourceTree = "<group>"; }; - 28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "info_bar_bg@2x.png"; sourceTree = "<group>"; }; - 28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mac_cursor_busy@2x.png"; sourceTree = "<group>"; }; - 28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mac_cursor_flipped@2x.png"; sourceTree = "<group>"; }; - 28F2653B224C30D7000CF4A3 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; }; - 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBibTeX.cxx; path = ../../lexers/LexBibTeX.cxx; sourceTree = "<group>"; }; - 29B042978C1F93EF42F9E4AB /* LexMaxima.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMaxima.cxx; path = ../../lexers/LexMaxima.cxx; sourceTree = SOURCE_ROOT; }; - 32DBCF5E0370ADEE00C91783 /* Scintilla_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scintilla_Prefix.pch; sourceTree = "<group>"; }; - 47814937A6B72D2B0F065B61 /* LexNim.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNim.cxx; path = ../../lexers/LexNim.cxx; sourceTree = SOURCE_ROOT; }; - 577F46B88F633198B56D088D /* LexCIL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCIL.cxx; path = ../../lexers/LexCIL.cxx; sourceTree = SOURCE_ROOT; }; - 7623427695416AB1270EE023 /* LexStata.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexStata.cxx; path = ../../lexers/LexStata.cxx; sourceTree = SOURCE_ROOT; }; - 8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; - 8DC2EF5B0486A6940098B216 /* Scintilla.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Scintilla.framework; sourceTree = BUILT_PRODUCTS_DIR; }; - A95147A1AB7CADB00DAFE724 /* LexSAS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSAS.cxx; path = ../../lexers/LexSAS.cxx; sourceTree = SOURCE_ROOT; }; - D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; }; - ADA64364A443F3E3F02D294E /* LexX12.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexX12.cxx; path = ../../lexers/LexX12.cxx; sourceTree = SOURCE_ROOT; }; - 362E48F5A7F79598CB0B037D /* LexDataflex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDataflex.cxx; path = ../../lexers/LexDataflex.cxx; sourceTree = SOURCE_ROOT; }; - 96884184929F317E72FC1BE8 /* LexHollywood.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHollywood.cxx; path = ../../lexers/LexHollywood.cxx; sourceTree = SOURCE_ROOT; }; - 48484CD7A1F20D09703376E5 /* LexRaku.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRaku.cxx; path = ../../lexers/LexRaku.cxx; sourceTree = SOURCE_ROOT; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 8DC2EF560486A6940098B216 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */, - 1152A77315313E58000D4E1A /* QuartzCore.framework in Frameworks */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 034768DFFF38A50411DB9C8B /* Products */ = { - isa = PBXGroup; - children = ( - 8DC2EF5B0486A6940098B216 /* Scintilla.framework */, - ); - name = Products; - sourceTree = "<group>"; - }; - 0867D691FE84028FC02AAC07 /* Scintilla */ = { - isa = PBXGroup; - children = ( - 2744E47D0FC1674E00E85C33 /* Lexers */, - 2744E47C0FC1674100E85C33 /* Backend */, - 08FB77AEFE84172EC02AAC07 /* Classes */, - 32C88DFF0371C24200C91783 /* Other Sources */, - 089C1665FE841158C02AAC07 /* Resources */, - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */, - 034768DFFF38A50411DB9C8B /* Products */, - ); - name = Scintilla; - sourceTree = "<group>"; - }; - 0867D69AFE84028FC02AAC07 /* External Frameworks and Libraries */ = { - isa = PBXGroup; - children = ( - 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */, - 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */, - ); - name = "External Frameworks and Libraries"; - sourceTree = "<group>"; - }; - 089C1665FE841158C02AAC07 /* Resources */ = { - isa = PBXGroup; - children = ( - 27FEF4500FC1B413005E115A /* res */, - 8DC2EF5A0486A6940098B216 /* Info.plist */, - 089C1666FE841158C02AAC07 /* InfoPlist.strings */, - ); - name = Resources; - sourceTree = "<group>"; - }; - 08FB77AEFE84172EC02AAC07 /* Classes */ = { - isa = PBXGroup; - children = ( - 28D1919E1DE69FC100159938 /* module.modulemap */, - 2744E4980FC167ED00E85C33 /* Source Files */, - 2744E4970FC167E400E85C33 /* Header Files */, - ); - name = Classes; - sourceTree = "<group>"; - }; - 1058C7B0FEA5585E11CA2CBB /* Linked Frameworks */ = { - isa = PBXGroup; - children = ( - 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */, - ); - name = "Linked Frameworks"; - sourceTree = "<group>"; - }; - 1058C7B2FEA5585E11CA2CBB /* Other Frameworks */ = { - isa = PBXGroup; - children = ( - 1152A77215313E58000D4E1A /* QuartzCore.framework */, - 0867D6A5FE840307C02AAC07 /* AppKit.framework */, - D2F7E79907B2D74100F64583 /* CoreData.framework */, - 0867D69BFE84028FC02AAC07 /* Foundation.framework */, - ); - name = "Other Frameworks"; - sourceTree = "<group>"; - }; - 2744E47C0FC1674100E85C33 /* Backend */ = { - isa = PBXGroup; - children = ( - 2744E47F0FC1676400E85C33 /* Source Files */, - 2744E47E0FC1675800E85C33 /* Header Files */, - ); - name = Backend; - sourceTree = "<group>"; - }; - 2744E47D0FC1674E00E85C33 /* Lexers */ = { - isa = PBXGroup; - children = ( - 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */, - 114B6EBE11FA7526004FB6AB /* LexAbaqus.cxx */, - 114B6EBF11FA7526004FB6AB /* LexAda.cxx */, - 114B6EC011FA7526004FB6AB /* LexAPDL.cxx */, - 114B6EC111FA7526004FB6AB /* LexAsm.cxx */, - 114B6EC211FA7526004FB6AB /* LexAsn1.cxx */, - 114B6EC311FA7526004FB6AB /* LexASY.cxx */, - 114B6EC411FA7526004FB6AB /* LexAU3.cxx */, - 114B6EC511FA7526004FB6AB /* LexAVE.cxx */, - 11126B8114CD3A6200803C49 /* LexAVS.cxx */, - 114B6EC611FA7526004FB6AB /* LexBaan.cxx */, - 114B6EC711FA7526004FB6AB /* LexBash.cxx */, - 114B6EC811FA7526004FB6AB /* LexBasic.cxx */, - 28B647061B54C0720009DC49 /* LexBatch.cxx */, - 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */, - 114B6EC911FA7526004FB6AB /* LexBullant.cxx */, - 114B6ECA11FA7526004FB6AB /* LexCaml.cxx */, - 577F46B88F633198B56D088D /* LexCIL.cxx */, - 114B6ECB11FA7526004FB6AB /* LexCLW.cxx */, - 114B6ECC11FA7526004FB6AB /* LexCmake.cxx */, - 114B6ECD11FA7526004FB6AB /* LexCOBOL.cxx */, - 11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */, - 114B6ECE11FA7526004FB6AB /* LexConf.cxx */, - 114B6ECF11FA7526004FB6AB /* LexCPP.cxx */, - 114B6ED011FA7526004FB6AB /* LexCrontab.cxx */, - 114B6ED111FA7526004FB6AB /* LexCsound.cxx */, - 114B6ED211FA7526004FB6AB /* LexCSS.cxx */, - 114B6ED311FA7526004FB6AB /* LexD.cxx */, - 362E48F5A7F79598CB0B037D /* LexDataflex.cxx */, - 28B647071B54C0720009DC49 /* LexDiff.cxx */, - 11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */, - 28064A04190F12E100E6E47F /* LexDMIS.cxx */, - 11BEB6A114EF189600BDE92A /* LexECL.cxx */, - 28D191A11DEA72C800159938 /* LexEDIFACT.cxx */, - 114B6ED411FA7526004FB6AB /* LexEiffel.cxx */, - 114B6ED511FA7526004FB6AB /* LexErlang.cxx */, - 28B647081B54C0720009DC49 /* LexErrorList.cxx */, - 114B6ED611FA7526004FB6AB /* LexEScript.cxx */, - 114B6ED711FA7526004FB6AB /* LexFlagship.cxx */, - 114B6ED811FA7526004FB6AB /* LexForth.cxx */, - 114B6ED911FA7526004FB6AB /* LexFortran.cxx */, - 114B6EDA11FA7526004FB6AB /* LexGAP.cxx */, - 114B6EDB11FA7526004FB6AB /* LexGui4Cli.cxx */, - 114B6EDC11FA7526004FB6AB /* LexHaskell.cxx */, - 28A067101A36B42600B4966A /* LexHex.cxx */, - 96884184929F317E72FC1BE8 /* LexHollywood.cxx */, - 114B6EDD11FA7526004FB6AB /* LexHTML.cxx */, - 282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */, - 114B6EDE11FA7526004FB6AB /* LexInno.cxx */, - 28C40CA71CB7321200B089F2 /* LexJSON.cxx */, - 114B6EDF11FA7526004FB6AB /* LexKix.cxx */, - 11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */, - 1102C31B169FB49300DC16AB /* LexLaTeX.cxx */, - 114B6EE011FA7526004FB6AB /* LexLisp.cxx */, - 114B6EE111FA7526004FB6AB /* LexLout.cxx */, - 114B6EE211FA7526004FB6AB /* LexLua.cxx */, - 114B6EE311FA7526004FB6AB /* LexMagik.cxx */, - 28B647091B54C0720009DC49 /* LexMake.cxx */, - 114B6EE411FA7526004FB6AB /* LexMarkdown.cxx */, - 114B6EE511FA7526004FB6AB /* LexMatlab.cxx */, - 29B042978C1F93EF42F9E4AB /* LexMaxima.cxx */, - 114B6EE611FA7526004FB6AB /* LexMetapost.cxx */, - 114B6EE711FA7526004FB6AB /* LexMMIXAL.cxx */, - 11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */, - 114B6EE811FA7526004FB6AB /* LexMPT.cxx */, - 114B6EE911FA7526004FB6AB /* LexMSSQL.cxx */, - 114B6EEA11FA7526004FB6AB /* LexMySQL.cxx */, - 47814937A6B72D2B0F065B61 /* LexNim.cxx */, - 114B6EEB11FA7526004FB6AB /* LexNimrod.cxx */, - 114B6EEC11FA7526004FB6AB /* LexNsis.cxx */, - 28B6470A1B54C0720009DC49 /* LexNull.cxx */, - 114B6EED11FA7526004FB6AB /* LexOpal.cxx */, - 11594BE7155B91DF0099E1FA /* LexOScript.cxx */, - 114B6EEF11FA7526004FB6AB /* LexPascal.cxx */, - 114B6EF011FA7526004FB6AB /* LexPB.cxx */, - 114B6EF111FA7526004FB6AB /* LexPerl.cxx */, - 114B6EF211FA7526004FB6AB /* LexPLM.cxx */, - 1114D6CA1602A951001DC345 /* LexPO.cxx */, - 114B6EF311FA7526004FB6AB /* LexPOV.cxx */, - 114B6EF411FA7526004FB6AB /* LexPowerPro.cxx */, - 114B6EF511FA7526004FB6AB /* LexPowerShell.cxx */, - 114B6EF611FA7526004FB6AB /* LexProgress.cxx */, - 28B6470B1B54C0720009DC49 /* LexProps.cxx */, - 114B6EF711FA7526004FB6AB /* LexPS.cxx */, - 114B6EF811FA7526004FB6AB /* LexPython.cxx */, - 114B6EF911FA7526004FB6AB /* LexR.cxx */, - 48484CD7A1F20D09703376E5 /* LexRaku.cxx */, - 114B6EFA11FA7526004FB6AB /* LexRebol.cxx */, - 28A7D6041995E47D0062D204 /* LexRegistry.cxx */, - 114B6EFB11FA7526004FB6AB /* LexRuby.cxx */, - 1160E0371803651C00BCEBCB /* LexRust.cxx */, - A95147A1AB7CADB00DAFE724 /* LexSAS.cxx */, - 114B6EFC11FA7526004FB6AB /* LexScriptol.cxx */, - 114B6EFD11FA7526004FB6AB /* LexSmalltalk.cxx */, - 114B6EFE11FA7526004FB6AB /* LexSML.cxx */, - 114B6EFF11FA7526004FB6AB /* LexSorcus.cxx */, - 114B6F0011FA7526004FB6AB /* LexSpecman.cxx */, - 114B6F0111FA7526004FB6AB /* LexSpice.cxx */, - 114B6F0211FA7526004FB6AB /* LexSQL.cxx */, - 7623427695416AB1270EE023 /* LexStata.cxx */, - 11FDAEB6174E1A9700FA161B /* LexSTTXT.cxx */, - 114B6F0311FA7526004FB6AB /* LexTACL.cxx */, - 114B6F0411FA7526004FB6AB /* LexTADS3.cxx */, - 114B6F0511FA7526004FB6AB /* LexTAL.cxx */, - 114B6F0611FA7526004FB6AB /* LexTCL.cxx */, - 117ACE9014A29A1E002876F9 /* LexTCMD.cxx */, - 114B6F0711FA7526004FB6AB /* LexTeX.cxx */, - 114B6F0811FA7526004FB6AB /* LexTxt2tags.cxx */, - 114B6F0911FA7526004FB6AB /* LexVB.cxx */, - 114B6F0A11FA7526004FB6AB /* LexVerilog.cxx */, - 114B6F0B11FA7526004FB6AB /* LexVHDL.cxx */, - 11594BE8155B91DF0099E1FA /* LexVisualProlog.cxx */, - ADA64364A443F3E3F02D294E /* LexX12.cxx */, - 114B6F0C11FA7526004FB6AB /* LexYAML.cxx */, - ); - name = Lexers; - sourceTree = "<group>"; - }; - 2744E47E0FC1675800E85C33 /* Header Files */ = { - isa = PBXGroup; - children = ( - 114B6FD811FA7645004FB6AB /* Accessor.h */, - 114B6FA211FA7623004FB6AB /* AutoComplete.h */, - 114B6FA311FA7623004FB6AB /* CallTip.h */, - 1100F1E7178E393200105727 /* CaseConvert.h */, - 1100F1E9178E393200105727 /* CaseFolder.h */, - 114B6FA411FA7623004FB6AB /* Catalogue.h */, - 114B6FA511FA7623004FB6AB /* CellBuffer.h */, - 11FBA39C17817DA00048C071 /* CharacterCategory.h */, - 114B6FD911FA7645004FB6AB /* CharacterSet.h */, - 114B6FA611FA7623004FB6AB /* CharClassify.h */, - 114B6FA711FA7623004FB6AB /* ContractionState.h */, - 114B6FA811FA7623004FB6AB /* Decoration.h */, - 28BDA1231EFB8FB200EBD3F3 /* DefaultLexer.h */, - 114B6FA911FA7623004FB6AB /* Document.h */, - 28A1DD54196BE0ED006EFCDD /* EditModel.h */, - 114B6FAA11FA7623004FB6AB /* Editor.h */, - 28A1DD55196BE0ED006EFCDD /* EditView.h */, - 114B6FAB11FA7623004FB6AB /* ExternalLexer.h */, - 114B6FAC11FA7623004FB6AB /* FontQuality.h */, - 114B6FA011FA75DB004FB6AB /* ILexer.h */, - 282D4A951F53FE270082E4D3 /* ILoader.h */, - 114B6FAD11FA7623004FB6AB /* Indicator.h */, - 114B6FAE11FA7623004FB6AB /* KeyMap.h */, - 114B6FDA11FA7645004FB6AB /* LexAccessor.h */, - 114B6FDB11FA7645004FB6AB /* LexerBase.h */, - 114B6FDC11FA7645004FB6AB /* LexerModule.h */, - 114B6FDD11FA7645004FB6AB /* LexerNoExceptions.h */, - 114B6FDE11FA7645004FB6AB /* LexerSimple.h */, - 114B6FAF11FA7623004FB6AB /* LineMarker.h */, - 28A1DD56196BE0ED006EFCDD /* MarginView.h */, - 114B6FDF11FA7645004FB6AB /* OptionSet.h */, - 114B6FB011FA7623004FB6AB /* Partitioning.h */, - 114B6FB111FA7623004FB6AB /* PerLine.h */, - 114B6FB211FA7623004FB6AB /* PositionCache.h */, - 114B6FE011FA7645004FB6AB /* PropSetSimple.h */, - 114B6FB311FA7623004FB6AB /* RESearch.h */, - 114B6FB411FA7623004FB6AB /* RunStyles.h */, - 114B6FB511FA7623004FB6AB /* ScintillaBase.h */, - 114B6FB611FA7623004FB6AB /* Selection.h */, - 280056F8188DDD2C00F200AE /* SparseState.h */, - 114B6FB711FA7623004FB6AB /* SplitVector.h */, - 280056F9188DDD2C00F200AE /* StringCopy.h */, - 114B6FB811FA7623004FB6AB /* Style.h */, - 114B6FE111FA7645004FB6AB /* StyleContext.h */, - 280056FA188DDD2C00F200AE /* SubStyles.h */, - 114B6FBA11FA7623004FB6AB /* UniConversion.h */, - 114B6FBB11FA7623004FB6AB /* ViewStyle.h */, - 114B6FE211FA7645004FB6AB /* WordList.h */, - 114B6FBC11FA7623004FB6AB /* XPM.h */, - ); - name = "Header Files"; - sourceTree = "<group>"; - }; - 2744E47F0FC1676400E85C33 /* Source Files */ = { - isa = PBXGroup; - children = ( - 114B6F8E11FA75BE004FB6AB /* Accessor.cxx */, - 114B6F6011FA7597004FB6AB /* AutoComplete.cxx */, - 114B6F6111FA7597004FB6AB /* CallTip.cxx */, - 1100F1E6178E393200105727 /* CaseConvert.cxx */, - 1100F1E8178E393200105727 /* CaseFolder.cxx */, - 114B6F6211FA7597004FB6AB /* Catalogue.cxx */, - 114B6F6311FA7597004FB6AB /* CellBuffer.cxx */, - 11FBA39B17817DA00048C071 /* CharacterCategory.cxx */, - 114B6F8F11FA75BE004FB6AB /* CharacterSet.cxx */, - 114B6F6411FA7597004FB6AB /* CharClassify.cxx */, - 114B6F6511FA7597004FB6AB /* ContractionState.cxx */, - 28804B2B1EEE232E00C0D154 /* DBCS.cxx */, - 114B6F6611FA7597004FB6AB /* Decoration.cxx */, - 28BDA1211EFB8F7C00EBD3F3 /* DefaultLexer.cxx */, - 114B6F6711FA7597004FB6AB /* Document.cxx */, - 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */, - 114B6F6811FA7597004FB6AB /* Editor.cxx */, - 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */, - 114B6F6911FA7598004FB6AB /* ExternalLexer.cxx */, - 114B6F6A11FA7598004FB6AB /* Indicator.cxx */, - 114B6F6B11FA7598004FB6AB /* KeyMap.cxx */, - 114B6F9011FA75BE004FB6AB /* LexerBase.cxx */, - 114B6F9111FA75BE004FB6AB /* LexerModule.cxx */, - 114B6F9211FA75BE004FB6AB /* LexerNoExceptions.cxx */, - 114B6F9311FA75BE004FB6AB /* LexerSimple.cxx */, - 114B6F6C11FA7598004FB6AB /* LineMarker.cxx */, - 28A1DD50196BE0CA006EFCDD /* MarginView.cxx */, - 114B6F6D11FA7598004FB6AB /* PerLine.cxx */, - 114B6F6E11FA7598004FB6AB /* PositionCache.cxx */, - 114B6F9411FA75BE004FB6AB /* PropSetSimple.cxx */, - 114B6F6F11FA7598004FB6AB /* RESearch.cxx */, - 114B6F7011FA7598004FB6AB /* RunStyles.cxx */, - 114B6F7111FA7598004FB6AB /* ScintillaBase.cxx */, - 114B6F7211FA7598004FB6AB /* Selection.cxx */, - 114B6F7311FA7598004FB6AB /* Style.cxx */, - 114B6F9511FA75BE004FB6AB /* StyleContext.cxx */, - 114B6F7411FA7598004FB6AB /* UniConversion.cxx */, - 281225352256DD2D00AFE50C /* UniqueString.cxx */, - 114B6F7511FA7598004FB6AB /* ViewStyle.cxx */, - 114B6F9611FA75BE004FB6AB /* WordList.cxx */, - 114B6F7611FA7598004FB6AB /* XPM.cxx */, - ); - name = "Source Files"; - sourceTree = "<group>"; - }; - 2744E4970FC167E400E85C33 /* Header Files */ = { - isa = PBXGroup; - children = ( - 2744E59D0FC168A100E85C33 /* InfoBar.h */, - 2744E5AB0FC168B200E85C33 /* InfoBarCommunicator.h */, - 2744E59E0FC168A100E85C33 /* PlatCocoa.h */, - 2744E4850FC1678600E85C33 /* Platform.h */, - 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */, - 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */, - 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */, - 28BC38EB1B74C6AD008BF9EB /* Sci_Position.h */, - 2744E4870FC1678600E85C33 /* SciLexer.h */, - 2744E4880FC1678600E85C33 /* Scintilla.h */, - 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */, - 2744E5A30FC168A100E85C33 /* ScintillaView.h */, - ); - name = "Header Files"; - sourceTree = "<group>"; - }; - 2744E4980FC167ED00E85C33 /* Source Files */ = { - isa = PBXGroup; - children = ( - 2744E5AD0FC168C500E85C33 /* InfoBar.mm */, - 2744E5AE0FC168C500E85C33 /* PlatCocoa.mm */, - 2744E5B00FC168C500E85C33 /* ScintillaCocoa.mm */, - 2744E5B10FC168C500E85C33 /* ScintillaView.mm */, - ); - name = "Source Files"; - sourceTree = "<group>"; - }; - 27FEF4500FC1B413005E115A /* res */ = { - isa = PBXGroup; - children = ( - 28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */, - 28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */, - 28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */, - 27FEF4510FC1B413005E115A /* info_bar_bg.png */, - 27FEF4520FC1B413005E115A /* mac_cursor_busy.png */, - 27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */, - ); - name = res; - path = ../res; - sourceTree = SOURCE_ROOT; - }; - 32C88DFF0371C24200C91783 /* Other Sources */ = { - isa = PBXGroup; - children = ( - 32DBCF5E0370ADEE00C91783 /* Scintilla_Prefix.pch */, - ); - name = "Other Sources"; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 8DC2EF500486A6940098B216 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 28BC38EC1B74C6AD008BF9EB /* Sci_Position.h in Headers */, - 114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */, - 2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */, - 2744E5AC0FC168B200E85C33 /* InfoBarCommunicator.h in Headers */, - 2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */, - 28BDA1241EFB8FB200EBD3F3 /* DefaultLexer.h in Headers */, - 280056FB188DDD2C00F200AE /* SparseState.h in Headers */, - 2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */, - 2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */, - 2791F3E30FC1A3AE009DBCF9 /* QuartzTextLayout.h in Headers */, - 2791F3E40FC1A3AE009DBCF9 /* QuartzTextStyleAttribute.h in Headers */, - 2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */, - 2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */, - 2791F3C90FC19F71009DBCF9 /* Scintilla.h in Headers */, - 114B6FBD11FA7623004FB6AB /* AutoComplete.h in Headers */, - 114B6FBE11FA7623004FB6AB /* CallTip.h in Headers */, - 114B6FBF11FA7623004FB6AB /* Catalogue.h in Headers */, - 114B6FC011FA7623004FB6AB /* CellBuffer.h in Headers */, - 114B6FC111FA7623004FB6AB /* CharClassify.h in Headers */, - 114B6FC211FA7623004FB6AB /* ContractionState.h in Headers */, - 114B6FC311FA7623004FB6AB /* Decoration.h in Headers */, - 282D4A961F53FE270082E4D3 /* ILoader.h in Headers */, - 114B6FC411FA7623004FB6AB /* Document.h in Headers */, - 114B6FC511FA7623004FB6AB /* Editor.h in Headers */, - 114B6FC611FA7623004FB6AB /* ExternalLexer.h in Headers */, - 114B6FC711FA7623004FB6AB /* FontQuality.h in Headers */, - 28A1DD57196BE0ED006EFCDD /* EditModel.h in Headers */, - 114B6FC811FA7623004FB6AB /* Indicator.h in Headers */, - 114B6FC911FA7623004FB6AB /* KeyMap.h in Headers */, - 114B6FCA11FA7623004FB6AB /* LineMarker.h in Headers */, - 114B6FCB11FA7623004FB6AB /* Partitioning.h in Headers */, - 114B6FCC11FA7623004FB6AB /* PerLine.h in Headers */, - 114B6FCD11FA7623004FB6AB /* PositionCache.h in Headers */, - 114B6FCE11FA7623004FB6AB /* RESearch.h in Headers */, - 28A1DD58196BE0ED006EFCDD /* EditView.h in Headers */, - 114B6FCF11FA7623004FB6AB /* RunStyles.h in Headers */, - 280056FD188DDD2C00F200AE /* SubStyles.h in Headers */, - 114B6FD011FA7623004FB6AB /* ScintillaBase.h in Headers */, - 114B6FD111FA7623004FB6AB /* Selection.h in Headers */, - 114B6FD211FA7623004FB6AB /* SplitVector.h in Headers */, - 114B6FD311FA7623004FB6AB /* Style.h in Headers */, - 280056FC188DDD2C00F200AE /* StringCopy.h in Headers */, - 114B6FD511FA7623004FB6AB /* UniConversion.h in Headers */, - 114B6FD611FA7623004FB6AB /* ViewStyle.h in Headers */, - 114B6FD711FA7623004FB6AB /* XPM.h in Headers */, - 114B6FE311FA7645004FB6AB /* Accessor.h in Headers */, - 114B6FE411FA7645004FB6AB /* CharacterSet.h in Headers */, - 114B6FE511FA7645004FB6AB /* LexAccessor.h in Headers */, - 114B6FE611FA7645004FB6AB /* LexerBase.h in Headers */, - 114B6FE711FA7645004FB6AB /* LexerModule.h in Headers */, - 114B6FE811FA7645004FB6AB /* LexerNoExceptions.h in Headers */, - 114B6FE911FA7645004FB6AB /* LexerSimple.h in Headers */, - 114B6FEA11FA7645004FB6AB /* OptionSet.h in Headers */, - 28A1DD59196BE0ED006EFCDD /* MarginView.h in Headers */, - 114B6FEB11FA7645004FB6AB /* PropSetSimple.h in Headers */, - 114B6FEC11FA7645004FB6AB /* StyleContext.h in Headers */, - 114B6FED11FA7645004FB6AB /* WordList.h in Headers */, - 119FF1BF13C9D1820007CE42 /* QuartzTextStyle.h in Headers */, - 11FBA39E17817DA00048C071 /* CharacterCategory.h in Headers */, - 1100F1EC178E393200105727 /* CaseConvert.h in Headers */, - 1100F1EE178E393200105727 /* CaseFolder.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 8DC2EF4F0486A6940098B216 /* Scintilla */ = { - isa = PBXNativeTarget; - buildConfigurationList = 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Scintilla" */; - buildPhases = ( - 8DC2EF500486A6940098B216 /* Headers */, - 8DC2EF520486A6940098B216 /* Resources */, - 8DC2EF540486A6940098B216 /* Sources */, - 8DC2EF560486A6940098B216 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = Scintilla; - productInstallPath = "$(HOME)/Library/Frameworks"; - productName = Scintilla; - productReference = 8DC2EF5B0486A6940098B216 /* Scintilla.framework */; - productType = "com.apple.product-type.framework"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 0867D690FE84028FC02AAC07 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 0930; - }; - buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ScintillaFramework" */; - compatibilityVersion = "Xcode 3.2"; - developmentRegion = en; - hasScannedForEncodings = 1; - knownRegions = ( - Base, - en, - ); - mainGroup = 0867D691FE84028FC02AAC07 /* Scintilla */; - productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 8DC2EF4F0486A6940098B216 /* Scintilla */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXResourcesBuildPhase section */ - 8DC2EF520486A6940098B216 /* Resources */ = { - isa = PBXResourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */, - 27FEF4540FC1B413005E115A /* info_bar_bg.png in Resources */, - 28D516D81830FFCA0047C93D /* info_bar_bg@2x.png in Resources */, - 28D516D91830FFCA0047C93D /* mac_cursor_busy@2x.png in Resources */, - 27FEF4550FC1B413005E115A /* mac_cursor_busy.png in Resources */, - 27FEF4560FC1B413005E115A /* mac_cursor_flipped.png in Resources */, - 28D516DA1830FFCA0047C93D /* mac_cursor_flipped@2x.png in Resources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXResourcesBuildPhase section */ - -/* Begin PBXSourcesBuildPhase section */ - 8DC2EF540486A6940098B216 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 2744E5B20FC168C500E85C33 /* InfoBar.mm in Sources */, - 2744E5B30FC168C500E85C33 /* PlatCocoa.mm in Sources */, - 2744E5B50FC168C500E85C33 /* ScintillaCocoa.mm in Sources */, - 2744E5B60FC168C500E85C33 /* ScintillaView.mm in Sources */, - 28D191A21DEA72C800159938 /* LexEDIFACT.cxx in Sources */, - 28BDA1221EFB8F7C00EBD3F3 /* DefaultLexer.cxx in Sources */, - 281225362256DD2D00AFE50C /* UniqueString.cxx in Sources */, - 114B6F0D11FA7526004FB6AB /* LexAbaqus.cxx in Sources */, - 114B6F0E11FA7526004FB6AB /* LexAda.cxx in Sources */, - 28B6470C1B54C0720009DC49 /* LexBatch.cxx in Sources */, - 28B6470F1B54C0720009DC49 /* LexMake.cxx in Sources */, - 114B6F0F11FA7526004FB6AB /* LexAPDL.cxx in Sources */, - 114B6F1011FA7526004FB6AB /* LexAsm.cxx in Sources */, - 114B6F1111FA7526004FB6AB /* LexAsn1.cxx in Sources */, - 114B6F1211FA7526004FB6AB /* LexASY.cxx in Sources */, - 114B6F1311FA7526004FB6AB /* LexAU3.cxx in Sources */, - 114B6F1411FA7526004FB6AB /* LexAVE.cxx in Sources */, - 114B6F1511FA7526004FB6AB /* LexBaan.cxx in Sources */, - 114B6F1611FA7526004FB6AB /* LexBash.cxx in Sources */, - 114B6F1711FA7526004FB6AB /* LexBasic.cxx in Sources */, - 114B6F1811FA7526004FB6AB /* LexBullant.cxx in Sources */, - 114B6F1911FA7526004FB6AB /* LexCaml.cxx in Sources */, - 114B6F1A11FA7526004FB6AB /* LexCLW.cxx in Sources */, - 114B6F1B11FA7526004FB6AB /* LexCmake.cxx in Sources */, - 28C40CA81CB7321200B089F2 /* LexJSON.cxx in Sources */, - 114B6F1C11FA7526004FB6AB /* LexCOBOL.cxx in Sources */, - 114B6F1D11FA7526004FB6AB /* LexConf.cxx in Sources */, - 28B647101B54C0720009DC49 /* LexNull.cxx in Sources */, - 114B6F1E11FA7526004FB6AB /* LexCPP.cxx in Sources */, - 114B6F1F11FA7526004FB6AB /* LexCrontab.cxx in Sources */, - 28B647111B54C0720009DC49 /* LexProps.cxx in Sources */, - 114B6F2011FA7526004FB6AB /* LexCsound.cxx in Sources */, - 114B6F2111FA7526004FB6AB /* LexCSS.cxx in Sources */, - 114B6F2211FA7526004FB6AB /* LexD.cxx in Sources */, - 114B6F2311FA7526004FB6AB /* LexEiffel.cxx in Sources */, - 114B6F2411FA7526004FB6AB /* LexErlang.cxx in Sources */, - 114B6F2511FA7526004FB6AB /* LexEScript.cxx in Sources */, - 114B6F2611FA7526004FB6AB /* LexFlagship.cxx in Sources */, - 28064A05190F12E100E6E47F /* LexDMIS.cxx in Sources */, - 114B6F2711FA7526004FB6AB /* LexForth.cxx in Sources */, - 114B6F2811FA7526004FB6AB /* LexFortran.cxx in Sources */, - 28FDA42119B6967B00BE27D7 /* LexBibTeX.cxx in Sources */, - 114B6F2911FA7526004FB6AB /* LexGAP.cxx in Sources */, - 114B6F2A11FA7526004FB6AB /* LexGui4Cli.cxx in Sources */, - 114B6F2B11FA7526004FB6AB /* LexHaskell.cxx in Sources */, - 114B6F2C11FA7526004FB6AB /* LexHTML.cxx in Sources */, - 114B6F2D11FA7526004FB6AB /* LexInno.cxx in Sources */, - 114B6F2E11FA7526004FB6AB /* LexKix.cxx in Sources */, - 28A067111A36B42600B4966A /* LexHex.cxx in Sources */, - 114B6F2F11FA7526004FB6AB /* LexLisp.cxx in Sources */, - 114B6F3011FA7526004FB6AB /* LexLout.cxx in Sources */, - 114B6F3111FA7526004FB6AB /* LexLua.cxx in Sources */, - 114B6F3211FA7526004FB6AB /* LexMagik.cxx in Sources */, - 114B6F3311FA7526004FB6AB /* LexMarkdown.cxx in Sources */, - 28A1DD52196BE0CA006EFCDD /* EditView.cxx in Sources */, - 114B6F3411FA7526004FB6AB /* LexMatlab.cxx in Sources */, - 114B6F3511FA7526004FB6AB /* LexMetapost.cxx in Sources */, - 114B6F3611FA7526004FB6AB /* LexMMIXAL.cxx in Sources */, - 114B6F3711FA7526004FB6AB /* LexMPT.cxx in Sources */, - 114B6F3811FA7526004FB6AB /* LexMSSQL.cxx in Sources */, - 114B6F3911FA7526004FB6AB /* LexMySQL.cxx in Sources */, - 114B6F3A11FA7526004FB6AB /* LexNimrod.cxx in Sources */, - 114B6F3B11FA7526004FB6AB /* LexNsis.cxx in Sources */, - 28804B2C1EEE232E00C0D154 /* DBCS.cxx in Sources */, - 114B6F3C11FA7526004FB6AB /* LexOpal.cxx in Sources */, - 114B6F3E11FA7526004FB6AB /* LexPascal.cxx in Sources */, - 28B6470D1B54C0720009DC49 /* LexDiff.cxx in Sources */, - 114B6F3F11FA7526004FB6AB /* LexPB.cxx in Sources */, - 114B6F4011FA7526004FB6AB /* LexPerl.cxx in Sources */, - 114B6F4111FA7526004FB6AB /* LexPLM.cxx in Sources */, - 114B6F4211FA7526004FB6AB /* LexPOV.cxx in Sources */, - 114B6F4311FA7526004FB6AB /* LexPowerPro.cxx in Sources */, - 114B6F4411FA7526004FB6AB /* LexPowerShell.cxx in Sources */, - 114B6F4511FA7526004FB6AB /* LexProgress.cxx in Sources */, - 114B6F4611FA7526004FB6AB /* LexPS.cxx in Sources */, - 114B6F4711FA7526004FB6AB /* LexPython.cxx in Sources */, - 114B6F4811FA7526004FB6AB /* LexR.cxx in Sources */, - 114B6F4911FA7526004FB6AB /* LexRebol.cxx in Sources */, - 114B6F4A11FA7526004FB6AB /* LexRuby.cxx in Sources */, - 114B6F4B11FA7526004FB6AB /* LexScriptol.cxx in Sources */, - 114B6F4C11FA7526004FB6AB /* LexSmalltalk.cxx in Sources */, - 114B6F4D11FA7526004FB6AB /* LexSML.cxx in Sources */, - 114B6F4E11FA7526004FB6AB /* LexSorcus.cxx in Sources */, - 114B6F4F11FA7526004FB6AB /* LexSpecman.cxx in Sources */, - 114B6F5011FA7526004FB6AB /* LexSpice.cxx in Sources */, - 114B6F5111FA7526004FB6AB /* LexSQL.cxx in Sources */, - 114B6F5211FA7526004FB6AB /* LexTACL.cxx in Sources */, - 114B6F5311FA7526004FB6AB /* LexTADS3.cxx in Sources */, - 114B6F5411FA7526004FB6AB /* LexTAL.cxx in Sources */, - 114B6F5511FA7526004FB6AB /* LexTCL.cxx in Sources */, - 114B6F5611FA7526004FB6AB /* LexTeX.cxx in Sources */, - 28A1DD53196BE0CA006EFCDD /* MarginView.cxx in Sources */, - 114B6F5711FA7526004FB6AB /* LexTxt2tags.cxx in Sources */, - 114B6F5811FA7526004FB6AB /* LexVB.cxx in Sources */, - 114B6F5911FA7526004FB6AB /* LexVerilog.cxx in Sources */, - 114B6F5A11FA7526004FB6AB /* LexVHDL.cxx in Sources */, - 114B6F5B11FA7526004FB6AB /* LexYAML.cxx in Sources */, - 114B6F7711FA7598004FB6AB /* AutoComplete.cxx in Sources */, - 114B6F7811FA7598004FB6AB /* CallTip.cxx in Sources */, - 114B6F7911FA7598004FB6AB /* Catalogue.cxx in Sources */, - 114B6F7A11FA7598004FB6AB /* CellBuffer.cxx in Sources */, - 114B6F7B11FA7598004FB6AB /* CharClassify.cxx in Sources */, - 28A1DD51196BE0CA006EFCDD /* EditModel.cxx in Sources */, - 114B6F7C11FA7598004FB6AB /* ContractionState.cxx in Sources */, - 114B6F7D11FA7598004FB6AB /* Decoration.cxx in Sources */, - 114B6F7E11FA7598004FB6AB /* Document.cxx in Sources */, - 114B6F7F11FA7598004FB6AB /* Editor.cxx in Sources */, - 114B6F8011FA7598004FB6AB /* ExternalLexer.cxx in Sources */, - 114B6F8111FA7598004FB6AB /* Indicator.cxx in Sources */, - 114B6F8211FA7598004FB6AB /* KeyMap.cxx in Sources */, - 114B6F8311FA7598004FB6AB /* LineMarker.cxx in Sources */, - 114B6F8411FA7598004FB6AB /* PerLine.cxx in Sources */, - 114B6F8511FA7598004FB6AB /* PositionCache.cxx in Sources */, - 114B6F8611FA7598004FB6AB /* RESearch.cxx in Sources */, - 114B6F8711FA7598004FB6AB /* RunStyles.cxx in Sources */, - 114B6F8811FA7598004FB6AB /* ScintillaBase.cxx in Sources */, - 114B6F8911FA7598004FB6AB /* Selection.cxx in Sources */, - 114B6F8A11FA7598004FB6AB /* Style.cxx in Sources */, - 28A7D6051995E47D0062D204 /* LexRegistry.cxx in Sources */, - 28B6470E1B54C0720009DC49 /* LexErrorList.cxx in Sources */, - 114B6F8B11FA7598004FB6AB /* UniConversion.cxx in Sources */, - 114B6F8C11FA7598004FB6AB /* ViewStyle.cxx in Sources */, - 114B6F8D11FA7598004FB6AB /* XPM.cxx in Sources */, - 114B6F9711FA75BE004FB6AB /* Accessor.cxx in Sources */, - 114B6F9811FA75BE004FB6AB /* CharacterSet.cxx in Sources */, - 114B6F9911FA75BE004FB6AB /* LexerBase.cxx in Sources */, - 114B6F9A11FA75BE004FB6AB /* LexerModule.cxx in Sources */, - 114B6F9B11FA75BE004FB6AB /* LexerNoExceptions.cxx in Sources */, - 114B6F9C11FA75BE004FB6AB /* LexerSimple.cxx in Sources */, - 114B6F9D11FA75BE004FB6AB /* PropSetSimple.cxx in Sources */, - 114B6F9E11FA75BE004FB6AB /* StyleContext.cxx in Sources */, - 114B6F9F11FA75BE004FB6AB /* WordList.cxx in Sources */, - 11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */, - 11BB124D12FF9C1300F6BCF7 /* LexModula.cxx in Sources */, - 11A0A8A1148602DF0018D143 /* LexCoffeeScript.cxx in Sources */, - 117ACE9114A29A1E002876F9 /* LexTCMD.cxx in Sources */, - 11126B8214CD3A6200803C49 /* LexAVS.cxx in Sources */, - 11BEB6A214EF189600BDE92A /* LexECL.cxx in Sources */, - 11594BE9155B91DF0099E1FA /* LexOScript.cxx in Sources */, - 11594BEA155B91DF0099E1FA /* LexVisualProlog.cxx in Sources */, - 1114D6CB1602A951001DC345 /* LexPO.cxx in Sources */, - 1102C31C169FB49300DC16AB /* LexLaTeX.cxx in Sources */, - 11FDAEB7174E1A9800FA161B /* LexSTTXT.cxx in Sources */, - 11FBA39D17817DA00048C071 /* CharacterCategory.cxx in Sources */, - 1100F1EB178E393200105727 /* CaseConvert.cxx in Sources */, - 1100F1ED178E393200105727 /* CaseFolder.cxx in Sources */, - 11FDD0E017C480D4001541B9 /* LexKVIrc.cxx in Sources */, - 1160E0381803651C00BCEBCB /* LexRust.cxx in Sources */, - 11FF3FE21810EB3900E13F13 /* LexDMAP.cxx in Sources */, - F437405F9F32C7DEFCA38C11 /* LexIndent.cxx in Sources */, - 3D994BD7A5EAC4FA5B3CFBDF /* LexMaxima.cxx in Sources */, - FDC7442CAD70B9A67EF1639D /* LexSAS.cxx in Sources */, - 5F804AA6B60FE695863A39FE /* LexStata.cxx in Sources */, - 0ED84236A703D57578EBFD2F /* LexNim.cxx in Sources */, - 00724A59981D34F11A3D162F /* LexCIL.cxx in Sources */, - AE894E1CB7328CAE5B2EF47E /* LexX12.cxx in Sources */, - 902B40FE926FE48538B168F1 /* LexDataflex.cxx in Sources */, - 4AA242EE8F0CCEA01AB59842 /* LexHollywood.cxx in Sources */, - 513A4B43B903344E142C441E /* LexRaku.cxx in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin PBXVariantGroup section */ - 089C1666FE841158C02AAC07 /* InfoPlist.strings */ = { - isa = PBXVariantGroup; - children = ( - 28F2653B224C30D7000CF4A3 /* en */, - ); - name = InfoPlist.strings; - sourceTree = "<group>"; - }; -/* End PBXVariantGroup section */ - -/* Begin XCBuildConfiguration section */ - 1DEB91AE08733DA50010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - COMBINE_HIDPI_IMAGES = YES; - COPY_PHASE_STRIP = NO; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = ".bzr *.nib *.lproj *.framework *.gch (*) CVS .svn *.xcodeproj *.xcode *.pbproj *.pbxproj"; - FRAMEWORK_VERSION = A; - GCC_DYNAMIC_NO_PIC = NO; - GCC_MODEL_TUNING = G5; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Scintilla_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = SCI_LEXER; - GCC_WARN_UNINITIALIZED_AUTOS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_LABEL = YES; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.7; - MODULEMAP_FILE = module.modulemap; - PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = Scintilla; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = framework; - }; - name = Debug; - }; - 1DEB91AF08733DA50010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_OBJC_ARC = YES; - COMBINE_HIDPI_IMAGES = YES; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - DEFINES_MODULE = YES; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - FRAMEWORK_VERSION = A; - GCC_MODEL_TUNING = G5; - GCC_PRECOMPILE_PREFIX_HEADER = YES; - GCC_PREFIX_HEADER = Scintilla_Prefix.pch; - GCC_PREPROCESSOR_DEFINITIONS = ( - SCI_LEXER, - NDEBUG, - ); - GCC_WARN_UNINITIALIZED_AUTOS = NO; - GCC_WARN_UNKNOWN_PRAGMAS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_LABEL = YES; - INFOPLIST_FILE = Info.plist; - INSTALL_PATH = "@executable_path/../Frameworks"; - MACOSX_DEPLOYMENT_TARGET = 10.7; - MODULEMAP_FILE = module.modulemap; - PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}"; - PRODUCT_NAME = Scintilla; - SKIP_INSTALL = YES; - WRAPPER_EXTENSION = framework; - }; - name = Release; - }; - 1DEB91B208733DA50010E9CD /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++17"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - ../../include, - ../../src, - ../../lexlib, - ); - MACOSX_DEPLOYMENT_TARGET = 10.7; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 1DEB91B308733DA50010E9CD /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; - CLANG_CXX_LANGUAGE_STANDARD = "c++17"; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = c99; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - HEADER_SEARCH_PATHS = ( - ../../include, - ../../src, - ../../lexlib, - ); - MACOSX_DEPLOYMENT_TARGET = 10.7; - SDKROOT = macosx; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 1DEB91AD08733DA50010E9CD /* Build configuration list for PBXNativeTarget "Scintilla" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91AE08733DA50010E9CD /* Debug */, - 1DEB91AF08733DA50010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ScintillaFramework" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 1DEB91B208733DA50010E9CD /* Debug */, - 1DEB91B308733DA50010E9CD /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 0867D690FE84028FC02AAC07 /* Project object */; -} diff --git a/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index acc8e3f90..000000000 --- a/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Workspace - version = "1.0"> - <FileRef - location = "self:ScintillaFramework.xcodeproj"> - </FileRef> -</Workspace> diff --git a/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IDEDidComputeMac32BitWarning</key> - <true/> -</dict> -</plist> diff --git a/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/xcshareddata/xcschemes/Scintilla.xcscheme b/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/xcshareddata/xcschemes/Scintilla.xcscheme deleted file mode 100644 index 3f4768951..000000000 --- a/cocoa/ScintillaFramework/ScintillaFramework.xcodeproj/xcshareddata/xcschemes/Scintilla.xcscheme +++ /dev/null @@ -1,68 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Scheme - LastUpgradeVersion = "1100" - version = "1.3"> - <BuildAction - parallelizeBuildables = "YES" - buildImplicitDependencies = "YES"> - <BuildActionEntries> - <BuildActionEntry - buildForTesting = "YES" - buildForRunning = "YES" - buildForProfiling = "YES" - buildForArchiving = "YES" - buildForAnalyzing = "YES"> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "8DC2EF4F0486A6940098B216" - BuildableName = "Scintilla.framework" - BlueprintName = "Scintilla" - ReferencedContainer = "container:ScintillaFramework.xcodeproj"> - </BuildableReference> - </BuildActionEntry> - </BuildActionEntries> - </BuildAction> - <TestAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - shouldUseLaunchSchemeArgsEnv = "YES"> - <Testables> - </Testables> - </TestAction> - <LaunchAction - buildConfiguration = "Debug" - selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB" - selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB" - enableAddressSanitizer = "YES" - launchStyle = "0" - useCustomWorkingDirectory = "NO" - ignoresPersistentStateOnLaunch = "NO" - debugDocumentVersioning = "YES" - debugServiceExtension = "internal" - allowLocationSimulation = "YES"> - <MacroExpansion> - <BuildableReference - BuildableIdentifier = "primary" - BlueprintIdentifier = "8DC2EF4F0486A6940098B216" - BuildableName = "Scintilla.framework" - BlueprintName = "Scintilla" - ReferencedContainer = "container:ScintillaFramework.xcodeproj"> - </BuildableReference> - </MacroExpansion> - </LaunchAction> - <ProfileAction - buildConfiguration = "Release" - shouldUseLaunchSchemeArgsEnv = "YES" - savedToolIdentifier = "" - useCustomWorkingDirectory = "NO" - debugDocumentVersioning = "YES"> - </ProfileAction> - <AnalyzeAction - buildConfiguration = "Debug"> - </AnalyzeAction> - <ArchiveAction - buildConfiguration = "Release" - revealArchiveInOrganizer = "YES"> - </ArchiveAction> -</Scheme> diff --git a/cocoa/ScintillaFramework/Scintilla_Prefix.pch b/cocoa/ScintillaFramework/Scintilla_Prefix.pch deleted file mode 100644 index e987aa4cf..000000000 --- a/cocoa/ScintillaFramework/Scintilla_Prefix.pch +++ /dev/null @@ -1,7 +0,0 @@ -// -// Prefix header for all source files of the 'Scintilla' target in the 'Scintilla' project. -// - -#ifdef __OBJC__ - #import <Cocoa/Cocoa.h> -#endif diff --git a/cocoa/ScintillaFramework/en.lproj/InfoPlist.strings b/cocoa/ScintillaFramework/en.lproj/InfoPlist.strings Binary files differdeleted file mode 100644 index 5e45963c3..000000000 --- a/cocoa/ScintillaFramework/en.lproj/InfoPlist.strings +++ /dev/null diff --git a/cocoa/ScintillaFramework/module.modulemap b/cocoa/ScintillaFramework/module.modulemap deleted file mode 100644 index d09ce2e3b..000000000 --- a/cocoa/ScintillaFramework/module.modulemap +++ /dev/null @@ -1,10 +0,0 @@ -framework module Scintilla { - umbrella header "ScintillaView.h" - module InfoBar { - header "InfoBar.h" - } - // ILexer.h is not included as Swift doesn't yet interoperate with C++ - exclude header "ILexer.h" - export * - module * { export * } -} diff --git a/include/SciLexer.h b/include/SciLexer.h deleted file mode 100644 index d23e18e0c..000000000 --- a/include/SciLexer.h +++ /dev/null @@ -1,1963 +0,0 @@ -/* 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 <neilh@scintilla.org> - * 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_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_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_UPPER_BOUND 41 -#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_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_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_MEDIA 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_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_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_CHARACTER 13 -#define SCE_VISUALPROLOG_CHARACTER_TOO_MANY 14 -#define SCE_VISUALPROLOG_CHARACTER_ESCAPE_ERROR 15 -#define SCE_VISUALPROLOG_STRING 16 -#define SCE_VISUALPROLOG_STRING_ESCAPE 17 -#define SCE_VISUALPROLOG_STRING_ESCAPE_ERROR 18 -#define SCE_VISUALPROLOG_STRING_EOL_OPEN 19 -#define SCE_VISUALPROLOG_STRING_VERBATIM 20 -#define SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL 21 -#define SCE_VISUALPROLOG_STRING_VERBATIM_EOL 22 -#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 -/* --Autogenerated -- end of section automatically generated from Scintilla.iface */ - -#endif diff --git a/lexers/LexA68k.cxx b/lexers/LexA68k.cxx deleted file mode 100644 index 1475ad078..000000000 --- a/lexers/LexA68k.cxx +++ /dev/null @@ -1,345 +0,0 @@ -// 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 <mdemolins(a)gmail.com> -// The License.txt file describes the conditions under which this software -// may be distributed. - - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - - -// 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); diff --git a/lexers/LexAPDL.cxx b/lexers/LexAPDL.cxx deleted file mode 100644 index 447e40d58..000000000 --- a/lexers/LexAPDL.cxx +++ /dev/null @@ -1,257 +0,0 @@ -// 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 <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>(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<char>(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<char>(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<char>(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); diff --git a/lexers/LexASY.cxx b/lexers/LexASY.cxx deleted file mode 100644 index 612d24b40..000000000 --- a/lexers/LexASY.cxx +++ /dev/null @@ -1,270 +0,0 @@ -// Scintilla source code edit control -// @file LexASY.cxx -//Author: instanton (email: soft_share<at>126<dot>com) -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> - -#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 Scintilla; - -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<char>(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<eol_pos){ - char ch = styler[startpos]; - ParseASYWord(startpos,styler,buffer); - bool drawcommands = strncmp(buffer,"draw",4)==0|| - strncmp(buffer,"pair",4)==0||strncmp(buffer,"label",5)==0; - if (!drawcommands && ch!=' ') return false; - else if (drawcommands) return true; - startpos++; - } - return false; -} - -static void FoldAsyDoc(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; - bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - 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 && 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); diff --git a/lexers/LexAU3.cxx b/lexers/LexAU3.cxx deleted file mode 100644 index 417c832e0..000000000 --- a/lexers/LexAU3.cxx +++ /dev/null @@ -1,908 +0,0 @@ -// 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 <xyz.au3> 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 <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. -// Scintilla source code edit control - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<int>(strlen(s_save)); - if (tp < 99) { - s_save[tp] = static_cast<char>(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<char>(sc.ch)) || IsAOperator(static_cast<char>(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<char>(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<char>(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<char>(tolower(ch)); - } - } - } - // start the capture of the first word - if (!(FirstWordStart)) { - if (IsAWordChar(ch) || IsAWordStart(ch) || ch == ';') { - FirstWordStart = true; - szKeyword[szKeywordlen++] = static_cast<char>(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<char>(tolower(ch)); - if (strcmp(szThen,"then") == 0 ) { - ThenFoundLast = true; - } - } - else { - szThen[szThenlen++] = static_cast<char>(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); diff --git a/lexers/LexAVE.cxx b/lexers/LexAVE.cxx deleted file mode 100644 index b976734ae..000000000 --- a/lexers/LexAVE.cxx +++ /dev/null @@ -1,229 +0,0 @@ -// SciTE - Scintilla based Text Editor -/** @file LexAVE.cxx - ** Lexer for Avenue. - ** - ** Written by Alexey Yutkin <yutkin@geol.msu.ru>. - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - - -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<char>(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<char>(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<char>(tolower(chNext)); - chNext = static_cast<char>(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<char>(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); - diff --git a/lexers/LexAVS.cxx b/lexers/LexAVS.cxx deleted file mode 100644 index df5223f8d..000000000 --- a/lexers/LexAVS.cxx +++ /dev/null @@ -1,291 +0,0 @@ -// Scintilla source code edit control -/** @file LexAVS.cxx - ** Lexer for AviSynth. - **/ -// Copyright 2012 by Bruno Barbieri <brunorex@gmail.com> -// Heavily based on LexPOV by Neil Hodgson -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>(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); diff --git a/lexers/LexAbaqus.cxx b/lexers/LexAbaqus.cxx deleted file mode 100644 index 0b9bfb62a..000000000 --- a/lexers/LexAbaqus.cxx +++ /dev/null @@ -1,603 +0,0 @@ -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>(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<char>(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<char>(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); diff --git a/lexers/LexAda.cxx b/lexers/LexAda.cxx deleted file mode 100644 index 9d7f5d0f7..000000000 --- a/lexers/LexAda.cxx +++ /dev/null @@ -1,513 +0,0 @@ -// Scintilla source code edit control -/** @file LexAda.cxx - ** Lexer for Ada 95 - **/ -// Copyright 2002 by Sergey Koshcheyev <sergey.k@seznam.cz> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> - -#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 Scintilla; - -/* - * 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<char>(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<char>(sc.ch); - sc.Forward(); - } - - // Special case: exponent with sign - if ((sc.chPrev == 'e' || sc.chPrev == 'E') && - (sc.ch == '+' || sc.ch == '-')) { - number += static_cast<char>(sc.ch); - sc.Forward (); - - while (!IsSeparatorOrDelimiterCharacter(sc.ch)) { - number += static_cast<char>(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<char>(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 == '_'; -} diff --git a/lexers/LexAsm.cxx b/lexers/LexAsm.cxx deleted file mode 100644 index 4560f9751..000000000 --- a/lexers/LexAsm.cxx +++ /dev/null @@ -1,477 +0,0 @@ -// 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" <dlchnr(at)gmx(dot)net> - **/ -// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <map> -#include <set> - -#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; - -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<OptionsAsm> { - 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) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - 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()) - { - - // Prevent SCE_ASM_STRINGEOL from leaking back to previous line - if (sc.atLineStart && (sc.state == SCE_ASM_STRING)) { - sc.SetState(SCE_ASM_STRING); - } else if (sc.atLineStart && (sc.state == SCE_ASM_CHARACTER)) { - sc.SetState(SCE_ASM_CHARACTER); - } - - // 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.atLineEnd) { - sc.Forward(); - } - sc.SetState(SCE_ASM_DEFAULT); - } - } else if (sc.state == SCE_ASM_COMMENT ) { - if (sc.atLineEnd) { - 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<char>(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<Sci_PositionU>(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); - diff --git a/lexers/LexAsn1.cxx b/lexers/LexAsn1.cxx deleted file mode 100644 index 0ec2a0636..000000000 --- a/lexers/LexAsn1.cxx +++ /dev/null @@ -1,186 +0,0 @@ -// Scintilla source code edit control -/** @file LexAsn1.cxx - ** Lexer for ASN.1 - **/ -// Copyright 2004 by Herr Pfarrer rpfarrer <at> yahoo <dot> de -// Last Updated: 20/07/2004 -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> - -#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 Scintilla; - -// 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); diff --git a/lexers/LexBaan.cxx b/lexers/LexBaan.cxx deleted file mode 100644 index 80b4f40ab..000000000 --- a/lexers/LexBaan.cxx +++ /dev/null @@ -1,992 +0,0 @@ -// Scintilla source code edit control -/** @file LexBaan.cxx -** Lexer for Baan. -** Based heavily on LexCPP.cxx -**/ -// Copyright 2001- by Vamsi Potluru <vamsi@who.net> & Praveen Ambekar <ambekarpraveen@yahoo.com> -// Maintainer Email: oirfeodent@yahoo.co.in -// The License.txt file describes the conditions under which this software may be distributed. - -// C standard library -#include <stdlib.h> -#include <string.h> - -// C++ wrappers of C standard library -#include <cassert> - -// C++ standard library -#include <string> -#include <map> - -// 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; - -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<OptionsBaan> { - 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<char>(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<char>(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); diff --git a/lexers/LexBash.cxx b/lexers/LexBash.cxx deleted file mode 100644 index 07dc6c1ce..000000000 --- a/lexers/LexBash.cxx +++ /dev/null @@ -1,1086 +0,0 @@ -// Scintilla source code edit control -/** @file LexBash.cxx - ** Lexer for Bash. - **/ -// Copyright 2004-2012 by Neil Hodgson <neilh@scintilla.org> -// Adapted from LexPerl by Kein-Hong Man 2004 -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> - -#include <string> -#include <vector> -#include <map> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "StringCopy.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; - -#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 -#define BASH_CMD_BODY 0 -#define BASH_CMD_START 1 -#define BASH_CMD_WORD 2 -#define BASH_CMD_TEST 3 -#define BASH_CMD_ARITH 4 -#define BASH_CMD_DELIM 5 - -// state constants for nested delimiter pairs, used by -// SCE_SH_STRING and SCE_SH_BACKTICKS processing -#define BASH_DELIM_LITERAL 0 -#define BASH_DELIM_STRING 1 -#define BASH_DELIM_CSTRING 2 -#define BASH_DELIM_LSTRING 3 -#define BASH_DELIM_COMMAND 4 -#define BASH_DELIM_BACKTICK 5 - -#define BASH_DELIM_STACK_MAX 7 - -namespace { - -inline int translateBashDigit(int ch) { - 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; -} - -inline int getBashNumberBase(char *s) { - 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; -} - -int opposite(int ch) { - 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, 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) { - 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; -} - -struct OptionsBash { - bool fold; - bool foldComment; - bool foldCompact; - - OptionsBash() { - fold = false; - foldComment = false; - foldCompact = true; - } -}; - -const char * const bashWordListDesc[] = { - "Keywords", - 0 -}; - -struct OptionSetBash : public OptionSet<OptionsBash> { - OptionSetBash() { - DefineProperty("fold", &OptionsBash::fold); - - DefineProperty("fold.comment", &OptionsBash::foldComment); - - DefineProperty("fold.compact", &OptionsBash::foldCompact); - - DefineWordListSets(bashWordListDesc); - } -}; - -const char styleSubable[] = { SCE_SH_IDENTIFIER, SCE_SH_SCALAR, 0 }; - -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", "literal string", "Heredoc quoted string", -}; - -} - -class LexerBash : public DefaultLexer { - WordList keywords; - OptionsBash options; - OptionSetBash osBash; - enum { ssIdentifier, ssScalar }; - SubStyles subStyles; -public: - LexerBash() : - DefaultLexer("bash", SCLEX_BASH, lexicalClasses, ELEMENTS(lexicalClasses)), - subStyles(styleSubable, 0x80, 0x40, 0) { - } - virtual ~LexerBash() { - } - 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 0; - } - - 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 *LexerFactoryBash() { - return new LexerBash(); - } -}; - -Sci_Position SCI_METHOD LexerBash::PropertySet(const char *key, const char *val) { - if (osBash.PropertySet(&options, key, val)) { - return 0; - } - return -1; -} - -Sci_Position SCI_METHOD LexerBash::WordListSet(int n, const char *wl) { - WordList *wordListN = 0; - switch (n) { - case 0: - wordListN = &keywords; - 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 LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - WordList cmdDelimiter, bashStruct, bashStruct_in; - cmdDelimiter.Set("| || |& & && ; ;; ( ) { }"); - bashStruct.Set("if elif fi while until else then do done esac eval"); - bashStruct_in.Set("for case select"); - - CharacterSet setWordStart(CharacterSet::setAlpha, "_"); - // note that [+-] are often parts of identifiers in shell scripts - CharacterSet setWord(CharacterSet::setAlphaNum, "._+-"); - CharacterSet setMetaCharacter(CharacterSet::setNone, "|&;()<> \t\r\n"); - setMetaCharacter.Add(0); - CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/<?!.~@"); - CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMACahGLNn"); - CharacterSet setParam(CharacterSet::setAlphaNum, "$_"); - CharacterSet setHereDoc(CharacterSet::setAlpha, "_\\-+!%*,./:?@[]^`{}~"); - CharacterSet setHereDoc2(CharacterSet::setAlphaNum, "_-+!%*,./:=?@[]^`{}~"); - CharacterSet setLeftShift(CharacterSet::setDigits, "$"); - - class HereDocCls { // Class to manage HERE document elements - public: - int State; // 0: '<<' encountered - // 1: collect the delimiter - // 2: here doc text (lines after the delimiter) - int Quote; // the char after '<<' - bool Quoted; // true if Quote in ('\'','"','`') - bool Indent; // indented delimiter (for <<-) - int DelimiterLength; // strlen(Delimiter) - char Delimiter[HERE_DELIM_MAX]; // the Delimiter - HereDocCls() { - State = 0; - Quote = 0; - Quoted = false; - Indent = 0; - DelimiterLength = 0; - Delimiter[0] = '\0'; - } - void Append(int ch) { - Delimiter[DelimiterLength++] = static_cast<char>(ch); - Delimiter[DelimiterLength] = '\0'; - } - ~HereDocCls() { - } - }; - HereDocCls HereDoc; - - class QuoteCls { // Class to manage quote pairs (simplified vs LexPerl) - public: - int Count; - int Up, Down; - QuoteCls() { - Count = 0; - Up = '\0'; - Down = '\0'; - } - void Open(int u) { - Count++; - Up = u; - Down = opposite(Up); - } - void Start(int u) { - Count = 0; - Open(u); - } - }; - QuoteCls Quote; - - class QuoteStackCls { // Class to manage quote pairs that nest - public: - int Count; - int Up, Down; - int Style; - int Depth; // levels pushed - int CountStack[BASH_DELIM_STACK_MAX]; - int UpStack [BASH_DELIM_STACK_MAX]; - int StyleStack[BASH_DELIM_STACK_MAX]; - QuoteStackCls() { - Count = 0; - Up = '\0'; - Down = '\0'; - Style = 0; - Depth = 0; - } - void Start(int u, int s) { - Count = 1; - Up = u; - Down = opposite(Up); - Style = s; - } - void Push(int u, int s) { - if (Depth >= BASH_DELIM_STACK_MAX) - return; - CountStack[Depth] = Count; - UpStack [Depth] = Up; - StyleStack[Depth] = Style; - Depth++; - Count = 1; - Up = u; - Down = opposite(Up); - Style = s; - } - void Pop(void) { - if (Depth <= 0) - return; - Depth--; - Count = CountStack[Depth]; - Up = UpStack [Depth]; - Style = StyleStack[Depth]; - Down = opposite(Up); - } - ~QuoteStackCls() { - } - }; - QuoteStackCls QuoteStack; - - const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_SH_IDENTIFIER); - const WordClassifier &classifierScalars = subStyles.Classifier(SCE_SH_SCALAR); - - int numBase = 0; - int digit; - Sci_PositionU endPos = startPos + length; - int cmdState = BASH_CMD_START; - int testExprType = 0; - 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<Sci_PositionU>(styler.LineStart(ln))) - ln--; - for (;;) { - startPos = styler.LineStart(ln); - if (ln == 0 || styler.GetLineState(ln) == BASH_CMD_START) - break; - ln--; - } - initStyle = SCE_SH_DEFAULT; - - StyleContext sc(startPos, endPos - startPos, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - // handle line continuation, updates per-line stored state - if (sc.atLineStart) { - ln = styler.GetLine(sc.currentPos); - if (sc.state == SCE_SH_STRING - || sc.state == SCE_SH_BACKTICKS - || sc.state == SCE_SH_CHARACTER - || sc.state == SCE_SH_HERE_Q - || sc.state == SCE_SH_COMMENTLINE - || sc.state == SCE_SH_PARAM) { - // force backtrack while retaining cmdState - styler.SetLineState(ln, BASH_CMD_BODY); - } else { - if (ln > 0) { - if ((sc.GetRelative(-3) == '\\' && sc.GetRelative(-2) == '\r' && sc.chPrev == '\n') - || sc.GetRelative(-2) == '\\') { // handle '\' line continuation - // retain last line's state - } else - cmdState = BASH_CMD_START; - } - styler.SetLineState(ln, cmdState); - } - } - - // controls change of cmdState at the end of a non-whitespace element - // states BODY|TEST|ARITH persist until the end of a command segment - // state WORD persist, but ends with 'in' or 'do' construct keywords - int cmdStateNew = BASH_CMD_BODY; - if (cmdState == BASH_CMD_TEST || cmdState == BASH_CMD_ARITH || cmdState == BASH_CMD_WORD) - cmdStateNew = cmdState; - int stylePrev = sc.state; - - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_SH_OPERATOR: - sc.SetState(SCE_SH_DEFAULT); - if (cmdState == BASH_CMD_DELIM) // if command delimiter, start new command - cmdStateNew = BASH_CMD_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)) { - char s[500]; - char s2[10]; - sc.GetCurrent(s, sizeof(s)); - int identifierStyle = SCE_SH_IDENTIFIER; - int subStyle = classifierIdentifiers.ValueFor(s); - if (subStyle >= 0) { - identifierStyle = subStyle; - } - // allow keywords ending in a whitespace or command delimiter - s2[0] = static_cast<char>(sc.ch); - s2[1] = '\0'; - bool keywordEnds = IsASpace(sc.ch) || cmdDelimiter.InList(s2); - // 'in' or 'do' may be construct keywords - if (cmdState == BASH_CMD_WORD) { - if (strcmp(s, "in") == 0 && keywordEnds) - cmdStateNew = BASH_CMD_BODY; - else if (strcmp(s, "do") == 0 && keywordEnds) - cmdStateNew = BASH_CMD_START; - else - sc.ChangeState(identifierStyle); - sc.SetState(SCE_SH_DEFAULT); - break; - } - // a 'test' keyword starts a test expression - if (strcmp(s, "test") == 0) { - if (cmdState == BASH_CMD_START && keywordEnds) { - cmdStateNew = BASH_CMD_TEST; - testExprType = 0; - } else - sc.ChangeState(identifierStyle); - } - // detect bash construct keywords - else if (bashStruct.InList(s)) { - if (cmdState == BASH_CMD_START && keywordEnds) - cmdStateNew = BASH_CMD_START; - else - sc.ChangeState(identifierStyle); - } - // 'for'|'case'|'select' needs 'in'|'do' to be highlighted later - else if (bashStruct_in.InList(s)) { - if (cmdState == BASH_CMD_START && keywordEnds) - cmdStateNew = BASH_CMD_WORD; - else - sc.ChangeState(identifierStyle); - } - // disambiguate option items and file test operators - else if (s[0] == '-') { - if (cmdState != BASH_CMD_TEST) - sc.ChangeState(identifierStyle); - } - // disambiguate keywords and identifiers - else if (cmdState != BASH_CMD_START - || !(keywords.InList(s) && keywordEnds)) { - sc.ChangeState(identifierStyle); - } - sc.SetState(SCE_SH_DEFAULT); - } - break; - case SCE_SH_IDENTIFIER: - if (sc.chPrev == '\\' || !setWord.Contains(sc.ch) || - (cmdState == BASH_CMD_ARITH && !setWordStart.Contains(sc.ch))) { - char s[500]; - sc.GetCurrent(s, sizeof(s)); - int subStyle = classifierIdentifiers.ValueFor(s); - if (subStyle >= 0) { - sc.ChangeState(subStyle); - } - if (sc.chPrev == '\\') { // for escaped chars - sc.ForwardSetState(SCE_SH_DEFAULT); - } else { - sc.SetState(SCE_SH_DEFAULT); - } - } - 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); - } - sc.SetState(SCE_SH_DEFAULT); - break; - case SCE_SH_COMMENTLINE: - if (sc.atLineEnd && sc.chPrev != '\\') { - sc.SetState(SCE_SH_DEFAULT); - } - 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.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 != BASH_CMD_ARITH)) { - // an unquoted here-doc delimiter, no special handling - HereDoc.State = 1; - } else if (sc.chNext == '<') { // HERE string <<< - sc.Forward(); - sc.ForwardSetState(SCE_SH_DEFAULT); - } else if (IsASpace(sc.chNext)) { - // eat whitespace - } else if (setLeftShift.Contains(sc.chNext) || - (sc.chNext == '=' && cmdState == BASH_CMD_ARITH)) { - // left shift <<$var or <<= cases - sc.ChangeState(SCE_SH_OPERATOR); - sc.ForwardSetState(SCE_SH_DEFAULT); - } 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 == '\\') { - 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); - } - if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup - sc.SetState(SCE_SH_ERROR); - HereDoc.State = 0; - } - } - break; - case SCE_SH_HERE_Q: - // HereDoc.State == 2 - if (sc.atLineStart) { - sc.SetState(SCE_SH_HERE_Q); - int prefixws = 0; - while (sc.ch == '\t' && !sc.atLineEnd) { // tabulation prefix - sc.Forward(); - prefixws++; - } - if (prefixws > 0) - sc.SetState(SCE_SH_HERE_Q); - while (!sc.atLineEnd) { - sc.Forward(); - } - char s[HERE_DELIM_MAX]; - sc.GetCurrent(s, sizeof(s)); - if (sc.LengthCurrent() == 0) { // '' or "" delimiters - if ((prefixws == 0 || HereDoc.Indent) && - HereDoc.Quoted && HereDoc.DelimiterLength == 0) - sc.SetState(SCE_SH_DEFAULT); - break; - } - if (s[strlen(s) - 1] == '\r') - s[strlen(s) - 1] = '\0'; - if (strcmp(HereDoc.Delimiter, s) == 0) { - if ((prefixws == 0) || // indentation rule - (prefixws > 0 && HereDoc.Indent)) { - sc.SetState(SCE_SH_DEFAULT); - break; - } - } - } - break; - case SCE_SH_SCALAR: // variable names - if (!setParam.Contains(sc.ch)) { - char s[500]; - sc.GetCurrent(s, sizeof(s)); - int subStyle = classifierScalars.ValueFor(&s[1]); // skip the $ - if (subStyle >= 0) { - sc.ChangeState(subStyle); - } - if (sc.LengthCurrent() == 1) { - // Special variable: $(, $_ etc. - sc.ForwardSetState(SCE_SH_DEFAULT); - } else { - sc.SetState(SCE_SH_DEFAULT); - } - } - break; - case SCE_SH_STRING: // delimited styles, can nest - case SCE_SH_BACKTICKS: - if (sc.ch == '\\' && QuoteStack.Up != '\\') { - if (QuoteStack.Style != BASH_DELIM_LITERAL) - sc.Forward(); - } else if (sc.ch == QuoteStack.Down) { - QuoteStack.Count--; - if (QuoteStack.Count == 0) { - if (QuoteStack.Depth > 0) { - QuoteStack.Pop(); - } else - sc.ForwardSetState(SCE_SH_DEFAULT); - } - } else if (sc.ch == QuoteStack.Up) { - QuoteStack.Count++; - } else { - if (QuoteStack.Style == BASH_DELIM_STRING || - QuoteStack.Style == BASH_DELIM_LSTRING - ) { // do nesting for "string", $"locale-string" - if (sc.ch == '`') { - QuoteStack.Push(sc.ch, BASH_DELIM_BACKTICK); - } else if (sc.ch == '$' && sc.chNext == '(') { - sc.Forward(); - QuoteStack.Push(sc.ch, BASH_DELIM_COMMAND); - } - } else if (QuoteStack.Style == BASH_DELIM_COMMAND || - QuoteStack.Style == BASH_DELIM_BACKTICK - ) { // do nesting for $(command), `command` - if (sc.ch == '\'') { - QuoteStack.Push(sc.ch, BASH_DELIM_LITERAL); - } else if (sc.ch == '\"') { - QuoteStack.Push(sc.ch, BASH_DELIM_STRING); - } else if (sc.ch == '`') { - QuoteStack.Push(sc.ch, BASH_DELIM_BACKTICK); - } else if (sc.ch == '$') { - if (sc.chNext == '\'') { - sc.Forward(); - QuoteStack.Push(sc.ch, BASH_DELIM_CSTRING); - } else if (sc.chNext == '\"') { - sc.Forward(); - QuoteStack.Push(sc.ch, BASH_DELIM_LSTRING); - } else if (sc.chNext == '(') { - sc.Forward(); - QuoteStack.Push(sc.ch, BASH_DELIM_COMMAND); - } - } - } - } - break; - case SCE_SH_PARAM: // ${parameter} - if (sc.ch == '\\' && Quote.Up != '\\') { - sc.Forward(); - } else if (sc.ch == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - sc.ForwardSetState(SCE_SH_DEFAULT); - } - } else if (sc.ch == Quote.Up) { - Quote.Count++; - } - break; - case SCE_SH_CHARACTER: // singly-quoted strings - if (sc.ch == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - sc.ForwardSetState(SCE_SH_DEFAULT); - } - } - break; - } - - // Must check end of HereDoc state 1 before default state is handled - if (HereDoc.State == 1 && sc.atLineEnd) { - // 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 (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); - sc.SetState(SCE_SH_DEFAULT); - } else { - // HereDoc.Quote always == '\'' - sc.SetState(SCE_SH_HERE_Q); - } - } else if (HereDoc.DelimiterLength == 0) { - // no delimiter, illegal (but '' and "" are legal) - sc.ChangeState(SCE_SH_ERROR); - sc.SetState(SCE_SH_DEFAULT); - } else { - sc.SetState(SCE_SH_HERE_Q); - } - } - - // update cmdState about the current command segment - if (stylePrev != SCE_SH_DEFAULT && sc.state == SCE_SH_DEFAULT) { - cmdState = cmdStateNew; - } - // Determine if a new state should be entered. - if (sc.state == SCE_SH_DEFAULT) { - if (sc.ch == '\\') { - // Bash can escape any non-newline as a literal - sc.SetState(SCE_SH_IDENTIFIER); - if (sc.chNext == '\r' || sc.chNext == '\n') - sc.SetState(SCE_SH_OPERATOR); - } else if (IsADigit(sc.ch)) { - sc.SetState(SCE_SH_NUMBER); - 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; -#else - numBase = BASH_BASE_HEX; -#endif - } - } - } else if (setWordStart.Contains(sc.ch)) { - sc.SetState(SCE_SH_WORD); - } 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); - } else { - sc.SetState(SCE_SH_WORD); - } - // handle some zsh features within arithmetic expressions only - if (cmdState == BASH_CMD_ARITH) { - if (sc.chPrev == '[') { // [#8] [##8] output digit setting - sc.SetState(SCE_SH_WORD); - if (sc.chNext == '#') { - sc.Forward(); - } - } else if (sc.Match("##^") && IsUpperCase(sc.GetRelative(3))) { // ##^A - sc.SetState(SCE_SH_IDENTIFIER); - sc.Forward(3); - } else if (sc.chNext == '#' && !IsASpace(sc.GetRelative(2))) { // ##a - sc.SetState(SCE_SH_IDENTIFIER); - sc.Forward(2); - } else if (setWordStart.Contains(sc.chNext)) { // #name - sc.SetState(SCE_SH_IDENTIFIER); - } - } - } else if (sc.ch == '\"') { - sc.SetState(SCE_SH_STRING); - QuoteStack.Start(sc.ch, BASH_DELIM_STRING); - } else if (sc.ch == '\'') { - sc.SetState(SCE_SH_CHARACTER); - Quote.Start(sc.ch); - } else if (sc.ch == '`') { - sc.SetState(SCE_SH_BACKTICKS); - QuoteStack.Start(sc.ch, BASH_DELIM_BACKTICK); - } else if (sc.ch == '$') { - if (sc.Match("$((")) { - sc.SetState(SCE_SH_OPERATOR); // handle '((' later - continue; - } - sc.SetState(SCE_SH_SCALAR); - sc.Forward(); - if (sc.ch == '{') { - sc.ChangeState(SCE_SH_PARAM); - Quote.Start(sc.ch); - } else if (sc.ch == '\'') { - sc.ChangeState(SCE_SH_STRING); - QuoteStack.Start(sc.ch, BASH_DELIM_CSTRING); - } else if (sc.ch == '"') { - sc.ChangeState(SCE_SH_STRING); - QuoteStack.Start(sc.ch, BASH_DELIM_LSTRING); - } else if (sc.ch == '(') { - sc.ChangeState(SCE_SH_BACKTICKS); - QuoteStack.Start(sc.ch, BASH_DELIM_COMMAND); - } else if (sc.ch == '`') { // $` seen in a configure script, valid? - sc.ChangeState(SCE_SH_BACKTICKS); - QuoteStack.Start(sc.ch, BASH_DELIM_BACKTICK); - } else { - continue; // scalar has no delimiter pair - } - } else if (sc.Match('<', '<')) { - sc.SetState(SCE_SH_HERE_DELIM); - HereDoc.State = 0; - if (sc.GetRelative(2) == '-') { // <<- indent case - HereDoc.Indent = true; - sc.Forward(); - } else { - HereDoc.Indent = false; - } - } else if (sc.ch == '-' && // one-char file test operators - setSingleCharOp.Contains(sc.chNext) && - !setWord.Contains(sc.GetRelative(2)) && - IsASpace(sc.chPrev)) { - sc.SetState(SCE_SH_WORD); - sc.Forward(); - } else if (setBashOperator.Contains(sc.ch)) { - char s[10]; - bool isCmdDelim = false; - sc.SetState(SCE_SH_OPERATOR); - // globs have no whitespace, do not appear in arithmetic expressions - if (cmdState != BASH_CMD_ARITH && sc.ch == '(' && sc.chNext != '(') { - int i = GlobScan(sc); - if (i > 1) { - sc.SetState(SCE_SH_IDENTIFIER); - sc.Forward(i); - continue; - } - } - // handle opening delimiters for test/arithmetic expressions - ((,[[,[ - if (cmdState == BASH_CMD_START - || cmdState == BASH_CMD_BODY) { - if (sc.Match('(', '(')) { - cmdState = BASH_CMD_ARITH; - sc.Forward(); - } else if (sc.Match('[', '[') && IsASpace(sc.GetRelative(2))) { - cmdState = BASH_CMD_TEST; - testExprType = 1; - sc.Forward(); - } else if (sc.ch == '[' && IsASpace(sc.chNext)) { - cmdState = BASH_CMD_TEST; - testExprType = 2; - } - } - // special state -- for ((x;y;z)) in ... looping - if (cmdState == BASH_CMD_WORD && sc.Match('(', '(')) { - cmdState = BASH_CMD_ARITH; - sc.Forward(); - continue; - } - // handle command delimiters in command START|BODY|WORD state, also TEST if 'test' - if (cmdState == BASH_CMD_START - || cmdState == BASH_CMD_BODY - || cmdState == BASH_CMD_WORD - || (cmdState == BASH_CMD_TEST && testExprType == 0)) { - s[0] = static_cast<char>(sc.ch); - if (setBashOperator.Contains(sc.chNext)) { - s[1] = static_cast<char>(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 = BASH_CMD_DELIM; - continue; - } - } - // handle closing delimiters for test/arithmetic expressions - )),]],] - if (cmdState == BASH_CMD_ARITH && sc.Match(')', ')')) { - cmdState = BASH_CMD_BODY; - sc.Forward(); - } else if (cmdState == BASH_CMD_TEST && IsASpace(sc.chPrev)) { - if (sc.Match(']', ']') && testExprType == 1) { - sc.Forward(); - cmdState = BASH_CMD_BODY; - } else if (sc.ch == ']' && testExprType == 2) { - cmdState = BASH_CMD_BODY; - } - } - } - }// sc.state - } - sc.Complete(); - if (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, IDocument *pAccess) { - if(!options.fold) - return; - - LexAccessor styler(pAccess); - - Sci_PositionU endPos = startPos + length; - int visibleChars = 0; - int skipHereCh = 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); - char word[8] = { '\0' }; // we're not interested in long words anyway - unsigned int wordlen = 0; - 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'); - // 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--; - } - if (style == SCE_SH_WORD) { - if ((wordlen + 1) < sizeof(word)) - word[wordlen++] = ch; - if (styleNext != style) { - word[wordlen] = '\0'; - wordlen = 0; - if (strcmp(word, "if") == 0 || strcmp(word, "case") == 0 || strcmp(word, "do") == 0) { - levelCurrent++; - } else if (strcmp(word, "fi") == 0 || strcmp(word, "esac") == 0 || strcmp(word, "done") == 0) { - levelCurrent--; - } - } - } - if (style == SCE_SH_OPERATOR) { - if (ch == '{') { - levelCurrent++; - } else if (ch == '}') { - levelCurrent--; - } - } - // Here Document folding - if (style == SCE_SH_HERE_DELIM) { - if (ch == '<' && chNext == '<') { - if (styler.SafeGetCharAt(i + 2) == '<') { - skipHereCh = 1; - } else { - if (skipHereCh == 0) { - levelCurrent++; - } else { - skipHereCh = 0; - } - } - } - } else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_SH_DEFAULT) { - levelCurrent--; - } - 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 - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - -LexerModule lmBash(SCLEX_BASH, LexerBash::LexerFactoryBash, "bash", bashWordListDesc); diff --git a/lexers/LexBasic.cxx b/lexers/LexBasic.cxx deleted file mode 100644 index e9004b1a1..000000000 --- a/lexers/LexBasic.cxx +++ /dev/null @@ -1,570 +0,0 @@ -// 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" <dlchnr(at)gmx(dot)net> - **/ -// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> -// 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 <at> users <dot> sf <dot> 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <map> - -#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; - -/* 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<OptionsBasic> { - 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<char>(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<char>(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); diff --git a/lexers/LexBatch.cxx b/lexers/LexBatch.cxx deleted file mode 100644 index 857b60ce6..000000000 --- a/lexers/LexBatch.cxx +++ /dev/null @@ -1,576 +0,0 @@ -// Scintilla source code edit control -/** @file LexBatch.cxx - ** Lexer for batch files. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static bool Is0To9(char ch) { - return (ch >= '0') && (ch <= '9'); -} - -static bool IsAlphabetic(int ch) { - return IsASCII(ch) && isalpha(ch); -} - -static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { - return (styler[i] == '\n') || - ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); -} - -// Tests for BATCH Operators -static bool IsBOperator(char ch) { - return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') || - (ch == '|') || (ch == '?') || (ch == '*')|| - (ch == '&') || (ch == '(') || (ch == ')'); -} - -// Tests for BATCH Separators -static bool IsBSeparator(char ch) { - return (ch == '\\') || (ch == '.') || (ch == ';') || - (ch == '\"') || (ch == '\'') || (ch == '/'); -} - -// Tests for escape character -static bool IsEscaped(char* wordStr, Sci_PositionU pos) { - bool isQoted=false; - while (pos>0){ - pos--; - if (wordStr[pos]=='^') - isQoted=!isQoted; - else - break; - } - return isQoted; -} - -// Tests for quote character -static bool textQuoted(char *lineBuffer, Sci_PositionU endPos) { - char strBuffer[1024]; - strncpy(strBuffer, lineBuffer, endPos); - strBuffer[endPos] = '\0'; - char *pQuote; - pQuote = strchr(strBuffer, '"'); - bool CurrentStatus = false; - while (pQuote != NULL) - { - if (!IsEscaped(strBuffer, pQuote - strBuffer)) { - CurrentStatus = !CurrentStatus; - } - pQuote = strchr(pQuote + 1, '"'); - } - return CurrentStatus; -} - -static 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'; - Sci_PositionU lengthLine=linePos; - Sci_PositionU endPos=i; - Sci_PositionU offset = 0; // Line Buffer Offset - Sci_PositionU cmdLoc; // External Command / Program Location - char wordBuffer[81]; // Word Buffer - large to catch long paths - Sci_PositionU wbl; // Word Buffer Length - Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length - WordList &keywords = *keywordlists[0]; // Internal Commands - 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 - // 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 - bool sKeywordFound; // Exit Special Keyword for-loop if found - - // 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 - 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 - 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); - } - // Copy word from Line Buffer into Word Buffer - wbl = 0; - for (; offset < lengthLine && wbl < 80 && - !isspacechar(lineBuffer[offset]); wbl++, offset++) { - wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset])); - } - wordBuffer[wbl] = '\0'; - wbo = 0; - - // Check for Comment - return if found - if ((CompareCaseInsensitive(wordBuffer, "rem") == 0) && continueProcessing) { - 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 ((CompareCaseInsensitive(wordBuffer, "echo") == 0) || - (CompareCaseInsensitive(wordBuffer, "goto") == 0) || - (CompareCaseInsensitive(wordBuffer, "prompt") == 0)) { - continueProcessing = false; - } - // SET requires additional processing for the assignment operator - if (CompareCaseInsensitive(wordBuffer, "set") == 0) { - continueProcessing = false; - isNotAssigned=true; - } - // Identify External Command / Program Location for ERRORLEVEL, and EXIST - if ((CompareCaseInsensitive(wordBuffer, "errorlevel") == 0) || - (CompareCaseInsensitive(wordBuffer, "exist") == 0)) { - // 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 ((CompareCaseInsensitive(wordBuffer, "call") == 0) || - (CompareCaseInsensitive(wordBuffer, "do") == 0) || - (CompareCaseInsensitive(wordBuffer, "loadhigh") == 0) || - (CompareCaseInsensitive(wordBuffer, "lh") == 0)) { - // Reset External Command / Program Location - cmdLoc = offset; - // Skip next spaces - while ((cmdLoc < lengthLine) && - (isspacechar(lineBuffer[cmdLoc]))) { - cmdLoc++; - } - } - // 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 - sKeywordFound = false; - for (Sci_PositionU keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) { - wbo = 0; - // Copy Keyword Length from Word Buffer into Special Keyword Buffer - for (; wbo < keywordLength; wbo++) { - sKeywordBuffer[wbo] = static_cast<char>(wordBuffer[wbo]); - } - sKeywordBuffer[wbo] = '\0'; - // Check for Special Keyword in list - if ((keywords.InList(sKeywordBuffer)) && - ((IsBOperator(wordBuffer[wbo])) || - (IsBSeparator(wordBuffer[wbo])))) { - sKeywordFound = true; - // ECHO requires no further Regular Keyword Checking - if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) { - 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 (CompareCaseInsensitive(wordBuffer, "choice") == 0) { - continueProcessing = false; - } - // Check for START (and its switches) - What follows is External Command \ Program - if (CompareCaseInsensitive(wordBuffer, "start") == 0) { - // 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 (%%~...) - } 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); - } - // Colorize Expanded Argument / Variable - styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER); - // 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); - } - // 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 Paranthesis, 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 && (i<startPos + length-1)) { - if (linePos==1 || (linePos==2 && lineBuffer[1]=='\r')) // empty line on Unix and Mac or on Windows - continueProcessing=true; - else { - Sci_PositionU lineContinuationPos; - if ((linePos>2) && 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; - } - } -} - -static const char *const batchWordListDesc[] = { - "Internal Commands", - "External Commands", - 0 -}; - -LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc); diff --git a/lexers/LexBibTeX.cxx b/lexers/LexBibTeX.cxx deleted file mode 100644 index 7e4cb9fc1..000000000 --- a/lexers/LexBibTeX.cxx +++ /dev/null @@ -1,308 +0,0 @@ -// 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 <stdlib.h> -#include <string.h> - -#include <cassert> -#include <cctype> - -#include <string> -#include <algorithm> -#include <functional> - -#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 Scintilla; - -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<char>(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 - diff --git a/lexers/LexBullant.cxx b/lexers/LexBullant.cxx deleted file mode 100644 index 2386d2252..000000000 --- a/lexers/LexBullant.cxx +++ /dev/null @@ -1,231 +0,0 @@ -// SciTE - Scintilla based Text Editor -// LexBullant.cxx - lexer for Bullant - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>(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); diff --git a/lexers/LexCIL.cxx b/lexers/LexCIL.cxx deleted file mode 100644 index 4e0fdb696..000000000 --- a/lexers/LexCIL.cxx +++ /dev/null @@ -1,407 +0,0 @@ -// 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 <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <map> -#include <algorithm> - -#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; - -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<OptionsCIL> { - 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<Sci_PositionU>(styler.Length() - 1)) { - styler.SetLevel(lineCurrent, lev | SC_FOLDLEVELWHITEFLAG); - } - - visibleChars = 0; - } - } -} - -LexerModule lmCIL(SCLEX_CIL, LexerCIL::LexerFactoryCIL, "cil", cilWordListDesc);
\ No newline at end of file diff --git a/lexers/LexCLW.cxx b/lexers/LexCLW.cxx deleted file mode 100644 index fbc86e6c0..000000000 --- a/lexers/LexCLW.cxx +++ /dev/null @@ -1,680 +0,0 @@ -// Scintilla source code edit control -/** @file LexCLW.cxx - ** Lexer for Clarion. - ** 2004/12/17 Updated Lexer - **/ -// Copyright 2003-2004 by Ron Schofield <ron@schofieldcomputer.com> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// 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<char>(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<char>(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); diff --git a/lexers/LexCOBOL.cxx b/lexers/LexCOBOL.cxx deleted file mode 100644 index f0374824f..000000000 --- a/lexers/LexCOBOL.cxx +++ /dev/null @@ -1,379 +0,0 @@ -// Scintilla source code edit control -/** @file LexCOBOL.cxx - ** Lexer for COBOL - ** Based on LexPascal.cxx - ** Written by Laurent le Tynevez - ** Updated by Simon Steele <s.steele@pnotepad.org> September 2002 - ** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments) - ** Updated by Rod Falck, Aug 2006 Converted to COBOL - **/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -#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<char>(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; - - WordList& a_keywords = *keywordlists[0]; - WordList& b_keywords = *keywordlists[1]; - WordList& c_keywords = *keywordlists[2]; - - char s[100]; - s[0] = '\0'; - s[1] = '\0'; - getRange(start, end, styler, s, sizeof(s)); - - char 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; - } - } - else { - 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 == '*') { - // 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 (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, 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<Sci_PositionU>(startPos))))) { - ColourTo(styler, i, 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 (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); diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx deleted file mode 100644 index 8ef4a1bfa..000000000 --- a/lexers/LexCPP.cxx +++ /dev/null @@ -1,1785 +0,0 @@ -// 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" <dlchnr(at)gmx(dot)net> - **/ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> -#include <cstring> - -#include <utility> -#include <string> -#include <vector> -#include <map> -#include <algorithm> -#include <iterator> - -#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; - -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 IsSpaceOrTab(int ch) noexcept { - return ch == ' ' || ch == '\t'; -} - -bool OnlySpaceOrTab(const std::string &s) noexcept { - for (const char ch : s) { - if (!IsSpaceOrTab(ch)) - return false; - } - return true; -} - -std::vector<std::string> StringSplit(const std::string &text, int separator) { - std::vector<std::string> vs(text.empty() ? 0 : 1); - for (const char ch : text) { - if (ch == separator) { - vs.emplace_back(); - } else { - vs.back() += ch; - } - } - return vs; -} - -struct BracketPair { - std::vector<std::string>::iterator itBracket; - std::vector<std::string>::iterator itEndBracket; -}; - -BracketPair FindBracketPair(std::vector<std::string> &tokens) { - BracketPair bp; - std::vector<std::string>::iterator itTok = std::find(tokens.begin(), tokens.end(), "("); - bp.itBracket = tokens.end(); - bp.itEndBracket = tokens.end(); - if (itTok != tokens.end()) { - bp.itBracket = itTok; - size_t nest = 0; - while (itTok != tokens.end()) { - if (*itTok == "(") { - nest++; - } else if (*itTok == ")") { - nest--; - if (nest == 0) { - bp.itEndBracket = itTok; - return bp; - } - } - ++itTok; - } - } - bp.itBracket = tokens.end(); - return bp; -} - -void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, - int activity, const WordList &markerList, bool caseSensitive){ - if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { - constexpr Sci_PositionU lengthMarker = 50; - char marker[lengthMarker+1] = ""; - const Sci_PositionU currPos = sc.currentPos; - Sci_PositionU i = 0; - while (i < lengthMarker) { - const char ch = styler.SafeGetCharAt(currPos + i); - if (IsASpace(ch) || isoperator(ch)) { - break; - } - if (caseSensitive) - marker[i] = ch; - else - marker[i] = MakeLowerCase(ch); - i++; - } - marker[i] = '\0'; - if (markerList.InList(marker)) { - sc.SetState(SCE_C_TASKMARKER|activity); - } - } -} - -class EscapeSequence { - const CharacterSet setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef"); - const CharacterSet setOctDigits = CharacterSet(CharacterSet::setNone, "01234567"); - const CharacterSet setNoneNumeric; - const CharacterSet *escapeSetValid = nullptr; - int digitsLeft = 0; -public: - EscapeSequence() = default; - void resetEscapeState(int nextChar) { - digitsLeft = 0; - 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; - } - } - bool atEscapeEnd(int currChar) const { - 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_, const std::string &key_, const std::string &value_, bool isUndef_ = false, const std::string &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; - bool ValidLevel() const noexcept { - return level >= 0 && level < maximumNestingLevel; - } - int maskLevel() const noexcept { - if (level >= 0) { - return 1 << level; - } else { - return 1; - } - } -public: - LinePPState() noexcept { - } - bool IsActive() const noexcept { - return state == 0; - } - bool IsInactive() const noexcept { - return state != 0; - } - int ActiveState() const noexcept { - return state ? inactiveFlag : 0; - } - 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<LinePPState> vlls; -public: - LinePPState ForLine(Sci_Position line) const noexcept { - if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) { - return vlls[line]; - } else { - return LinePPState(); - } - } - void Add(Sci_Position line, LinePPState lls) { - vlls.resize(line+1); - vlls[line] = lls; - } -}; - -// An individual named option for use in an OptionSet - -// Options used for LexerCPP -struct OptionsCPP { - bool stylingWithinPreprocessor; - bool identifiersAllowDollars; - bool trackPreprocessor; - bool updatePreprocessor; - bool verbatimStringsAllowEscapes; - bool triplequotedStrings; - bool hashquotedStrings; - bool backQuotedStrings; - bool escapeSequence; - bool fold; - bool foldSyntaxBased; - bool foldComment; - bool foldCommentMultiline; - bool foldCommentExplicit; - std::string foldExplicitStart; - std::string foldExplicitEnd; - bool foldExplicitAnywhere; - bool foldPreprocessor; - bool foldPreprocessorAtElse; - bool foldCompact; - bool foldAtElse; - OptionsCPP() { - stylingWithinPreprocessor = false; - identifiersAllowDollars = true; - trackPreprocessor = true; - updatePreprocessor = true; - verbatimStringsAllowEscapes = false; - triplequotedStrings = false; - hashquotedStrings = false; - backQuotedStrings = false; - escapeSequence = false; - fold = false; - foldSyntaxBased = true; - foldComment = false; - foldCommentMultiline = true; - foldCommentExplicit = true; - foldExplicitStart = ""; - foldExplicitEnd = ""; - foldExplicitAnywhere = false; - foldPreprocessor = false; - foldPreprocessorAtElse = false; - foldCompact = false; - 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<OptionsCPP> { - 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 to 1 to enable highlighting of back-quoted raw strings ."); - - 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<int>(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<PPDefinition> ppDefineHistory; - WordList keywords; - WordList keywords2; - WordList keywords3; - WordList keywords4; - WordList ppDefinitions; - WordList markerList; - struct SymbolValue { - std::string value; - std::string arguments; - SymbolValue() noexcept = default; - SymbolValue(const std::string &value_, const std::string &arguments_) : value(value_), arguments(arguments_) { - } - SymbolValue &operator = (const std::string &value_) { - value = value_; - arguments.clear(); - return *this; - } - bool IsMacro() const noexcept { - return !arguments.empty(); - } - }; - typedef std::map<std::string, SymbolValue> SymbolTable; - SymbolTable preprocessorDefinitionsStart; - OptionsCPP options; - OptionSetCPP osCPP; - EscapeSequence escapeSeq; - SparseState<std::string> rawStringTerminators; - enum { ssIdentifier, ssDocKeyword }; - SubStyles subStyles; - std::string returnBuffer; -public: - explicit LexerCPP(bool caseSensitive_) : - caseSensitive(caseSensitive_), - setWord(CharacterSet::setAlphaNum, "._", 0x80, true), - setNegationOp(CharacterSet::setNone, "!"), - setAddOp(CharacterSet::setNone, "+-"), - setMultOp(CharacterSet::setNone, "*/%"), - setRelOp(CharacterSet::setNone, "=!<>"), - setLogicalOp(CharacterSet::setNone, "|&"), - subStyles(styleSubable, 0x80, 0x40, inactiveFlag) { - } - // 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() { - } - 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 = ""; - 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(std::vector<std::string> &tokens, const SymbolTable &preprocessorDefinitions); - std::vector<std::string> 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, "._", 0x80, 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; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - if (n == 4) { - // Rebuild preprocessorDefinitions - preprocessorDefinitionsStart.clear(); - for (int nDefinition = 0; nDefinition < ppDefinitions.Length(); nDefinition++) { - const char *cpDefinition = ppDefinitions.WordAt(nDefinition); - const char *cpEquals = strchr(cpDefinition, '='); - if (cpEquals) { - std::string name(cpDefinition, cpEquals - cpDefinition); - std::string val(cpEquals+1); - const size_t bracket = name.find('('); - const size_t bracketEnd = name.find(')'); - if ((bracket != std::string::npos) && (bracketEnd != std::string::npos)) { - // Macro - std::string args = name.substr(bracket + 1, bracketEnd - bracket - 1); - name = name.substr(0, bracket); - preprocessorDefinitionsStart[name] = SymbolValue(val, args); - } else { - preprocessorDefinitionsStart[name] = val; - } - } else { - std::string name(cpDefinition); - std::string val("1"); - preprocessorDefinitionsStart[name] = val; - } - } - } - } - } - return firstModification; -} - -void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - LexAccessor styler(pAccess); - - CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); - CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); - - CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]"); - - setWordStart = CharacterSet(CharacterSet::setAlpha, "_", 0x80, true); - - CharacterSet setInvalidRawFirst(CharacterSet::setNone, " )\\\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; - - Sci_Position lineCurrent = styler.GetLine(startPos); - 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(); - - std::vector<PPDefinition>::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<std::string> rawSTNew(lineCurrent); - - 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 != "") { - rawSTNew.Set(lineCurrent-1, rawStringTerminator); - } - } - - // Handle line continuation generically. - if (sc.ch == '\\') { - if ((sc.currentPos+1) >= lineEndNext) { - lineCurrent++; - lineEndNext = styler.LineEnd(lineCurrent); - vlls.Add(lineCurrent, preproc); - if (rawStringTerminator != "") { - 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 == '\'') - || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E' || - sc.chPrev == 'p' || sc.chPrev == 'P')))) { - 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 == '.')) { - char s[1000]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - if (keywords.InList(s)) { - lastWordWasUUID = strcmp(s, "uuid") == 0; - sc.ChangeState(SCE_C_WORD|activitySet); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_C_WORD2|activitySet); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_C_GLOBALCLASS|activitySet); - } else { - int subStyle = classifierIdentifiers.ValueFor(s); - if (subStyle >= 0) { - sc.ChangeState(subStyle|activitySet); - } - } - const bool literalString = sc.ch == '\"'; - if (literalString || sc.ch == '\'') { - size_t lenS = strlen(s); - const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext); - if (raw) - s[lenS--] = '\0'; - 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); - } - } - 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); - } - } - 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 && (sc.ch == ',' || sc.ch == '.'))) { - char s[100]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - if (!(IsASpace(sc.ch) || (sc.ch == 0))) { - sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet); - } else if (!keywords3.InList(s + 1)) { - int subStyleCDKW = classifierDocKeyWords.ValueFor(s+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) { - sc.SetState(SCE_C_ESCAPESEQUENCE|activitySet); - escapeSeq.resetEscapeState(sc.chNext); - } - 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)) { - break; - } - if (sc.ch == '"') { - sc.SetState(SCE_C_STRING|activitySet); - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '\\') { - escapeSeq.resetEscapeState(sc.chNext); - sc.Forward(); - } else { - sc.SetState(SCE_C_STRING|activitySet); - if (sc.atLineEnd) { - sc.ChangeState(SCE_C_STRINGEOL|activitySet); - } - } - 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); - rawStringTerminator = ""; - } - 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 (isoperator(sc.ch) || IsASpace(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); - } - - // 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 && 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.atLineEnd) { - sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (sc.Match("include")) { - isIncludePreprocessor = true; - } else { - if (options.trackPreprocessor) { - // 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; - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + startRest + 1, false); - bool foundDef = preprocessorDefinitions.find(restOfLine) != preprocessorDefinitions.end(); - preproc.StartSection(isIfDef == foundDef); - } else if (sc.Match("if")) { - 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.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.CurrentIfTaken()) { - // Inactive, if expression true then may become active if parent scope active - assert(sc.state == (SCE_C_PREPROCESSOR|inactiveFlag)); - // Similar to #if - 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()) { - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true); - size_t startName = 0; - while ((startName < restOfLine.length()) && IsSpaceOrTab(restOfLine[startName])) - startName++; - size_t endName = startName; - while ((endName < restOfLine.length()) && setWord.Contains(restOfLine[endName])) - endName++; - std::string key = restOfLine.substr(startName, endName-startName); - if ((endName < restOfLine.length()) && (restOfLine.at(endName) == '(')) { - // Macro - size_t endArgs = endName; - while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')')) - endArgs++; - std::string args = restOfLine.substr(endName + 1, endArgs - endName - 1); - size_t startValue = endArgs+1; - while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue])) - startValue++; - std::string value; - if (startValue < restOfLine.length()) - value = restOfLine.substr(startValue); - preprocessorDefinitions[key] = SymbolValue(value, args); - ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args)); - definitionsChanged = true; - } else { - // Value - size_t startValue = endName; - while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue])) - startValue++; - std::string value = restOfLine.substr(startValue); - if (OnlySpaceOrTab(value)) - value = "1"; // No value defaults to 1 - preprocessorDefinitions[key] = value; - ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value)); - definitionsChanged = true; - } - } - } else if (sc.Match("undef")) { - if (options.updatePreprocessor && preproc.IsActive()) { - const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, false); - std::vector<std::string> tokens = Tokenize(restOfLine); - if (tokens.size() >= 1) { - const std::string key = tokens[0]; - preprocessorDefinitions.erase(key); - ppDefineHistory.push_back(PPDefinition(lineCurrent, key, "", true)); - definitionsChanged = true; - } - } - } - } - } - } else if (isoperator(sc.ch)) { - sc.SetState(SCE_C_OPERATOR|activitySet); - } - } - - 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<Sci_PositionU>(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(std::vector<std::string> &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)<tokens.size();) { - if (tokens[i] == "defined") { - const char *val = "0"; - if (tokens[i+1] == "(") { - if (((i + 2)<tokens.size()) && (tokens[i + 2] == ")")) { - // defined() - tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3); - } else if (((i+3)<tokens.size()) && (tokens[i+3] == ")")) { - // defined(<identifier>) - 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 <identifier> - 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; (i<tokens.size()) && (iterations < maxIterations);) { - iterations++; - if (setWordStart.Contains(tokens[i][0])) { - SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i]); - if (it != preprocessorDefinitions.end()) { - // Tokenize value - std::vector<std::string> macroTokens = Tokenize(it->second.value); - if (it->second.IsMacro()) { - if ((i + 1 < tokens.size()) && (tokens.at(i + 1) == "(")) { - // Create map of argument name to value - std::vector<std::string> argumentNames = StringSplit(it->second.arguments, ','); - std::map<std::string, std::string> 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])) { - std::map<std::string, std::string>::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()) { - std::vector<std::string> 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()); - - bracketPair = FindBracketPair(tokens); - tokens.erase(bracketPair.itBracket, bracketPair.itEndBracket + 1); - - bracketPair = FindBracketPair(tokens); - } - - // Evaluate logical negations - for (size_t j=0; (j+1)<tokens.size();) { - if (setNegationOp.Contains(tokens[j][0])) { - int isTrue = atoi(tokens[j+1].c_str()); - if (tokens[j] == "!") - isTrue = !isTrue; - std::vector<std::string>::iterator itInsert = - tokens.erase(tokens.begin() + j, tokens.begin() + j + 2); - tokens.insert(itInsert, isTrue ? "1" : "0"); - } else { - j++; - } - } - - // Evaluate expressions in precedence order - enum precedence { precMult, precAdd, precRelative - , precLogical, /* end marker */ precLast }; - for (int prec = precMult; prec < precLast; prec++) { - // Looking at 3 tokens at a time so end at 2 before end - for (size_t k=0; (k+2)<tokens.size();) { - const char chOp = tokens[k+1][0]; - if ( - ((prec==precMult) && setMultOp.Contains(chOp)) || - ((prec==precAdd) && setAddOp.Contains(chOp)) || - ((prec==precRelative) && setRelOp.Contains(chOp)) || - ((prec==precLogical) && setLogicalOp.Contains(chOp)) - ) { - const int valA = atoi(tokens[k].c_str()); - const int valB = atoi(tokens[k+2].c_str()); - int result = 0; - 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 ? valB : 1); - else if (tokens[k+1] == "%") - result = valA % (valB ? valB : 1); - 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; - else if (tokens[k+1] == "!=") - result = valA != valB; - else if (tokens[k+1] == "||") - result = valA || valB; - else if (tokens[k+1] == "&&") - result = valA && valB; - std::vector<std::string>::iterator itInsert = - tokens.erase(tokens.begin() + k, tokens.begin() + k + 3); - tokens.insert(itInsert, std::to_string(result)); - } else { - k++; - } - } - } -} - -std::vector<std::string> LexerCPP::Tokenize(const std::string &expr) const { - // Break into tokens - std::vector<std::string> 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 (IsSpaceOrTab(*cp)) { - while (IsSpaceOrTab(*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) { - std::vector<std::string> tokens = Tokenize(expr); - - EvaluateTokens(tokens, preprocessorDefinitions); - - // "0" or "" -> false else true - const bool isFalse = tokens.empty() || - ((tokens.size() == 1) && ((tokens[0] == "") || tokens[0] == "0")); - return !isFalse; -} - -LexerModule lmCPP(SCLEX_CPP, LexerCPP::LexerFactoryCPP, "cpp", cppWordLists); -LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, LexerCPP::LexerFactoryCPPInsensitive, "cppnocase", cppWordLists); diff --git a/lexers/LexCSS.cxx b/lexers/LexCSS.cxx deleted file mode 100644 index c1a86f537..000000000 --- a/lexers/LexCSS.cxx +++ /dev/null @@ -1,567 +0,0 @@ -// 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 <neilh@scintilla.org> -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - - -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_MEDIA: - 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) - sc.ChangeState(SCE_CSS_MEDIA); - 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_MEDIA) || 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); diff --git a/lexers/LexCaml.cxx b/lexers/LexCaml.cxx deleted file mode 100644 index 1339b5dcc..000000000 --- a/lexers/LexCaml.cxx +++ /dev/null @@ -1,460 +0,0 @@ -// Scintilla source code edit control -/** @file LexCaml.cxx - ** Lexer for Objective Caml. - **/ -// Copyright 2005-2009 by Robert Roessler <robertr@rftp.com> -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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" - -#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 Scintilla; - -#ifdef BUILD_AS_EXTERNAL_LEXER -/* - (actually seems to work!) -*/ -#include <string> -#include "WindowAccessor.h" -#include "ExternalLexer.h" - -#undef EXT_LEXER_DECL -#define EXT_LEXER_DECL __declspec( dllexport ) __stdcall - -#if PLAT_WIN -#include <windows.h> -#endif - -static void ColouriseCamlDoc( - Sci_PositionU startPos, Sci_Position length, - int initStyle, - WordList *keywordlists[], - Accessor &styler); - -static void FoldCamlDoc( - Sci_PositionU startPos, Sci_Position length, - int initStyle, - WordList *keywordlists[], - Accessor &styler); - -static void InternalLexOrFold(int lexOrFold, Sci_PositionU startPos, Sci_Position length, - int initStyle, char *words[], WindowID window, char *props); - -static const char* LexerName = "caml"; - -#ifdef TRACE -void Platform::DebugPrintf(const char *format, ...) { - char buffer[2000]; - va_list pArguments; - va_start(pArguments, format); - vsprintf(buffer,format,pArguments); - va_end(pArguments); - Platform::DebugDisplay(buffer); -} -#else -void Platform::DebugPrintf(const char *, ...) { -} -#endif - -bool Platform::IsDBCSLeadByte(int codePage, char ch) { - return ::IsDBCSLeadByteEx(codePage, ch) != 0; -} - -long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) { - return ::SendMessage(reinterpret_cast<HWND>(w), msg, wParam, lParam); -} - -long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) { - return ::SendMessage(reinterpret_cast<HWND>(w), msg, wParam, - reinterpret_cast<LPARAM>(lParam)); -} - -void EXT_LEXER_DECL Fold(unsigned int lexer, Sci_PositionU startPos, Sci_Position length, - int initStyle, char *words[], WindowID window, char *props) -{ - // below useless evaluation(s) to supress "not used" warnings - lexer; - // build expected data structures and do the Fold - InternalLexOrFold(1, startPos, length, initStyle, words, window, props); - -} - -int EXT_LEXER_DECL GetLexerCount() -{ - return 1; // just us [Objective] Caml lexers here! -} - -void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength) -{ - // below useless evaluation(s) to supress "not used" warnings - Index; - // return as much of our lexer name as will fit (what's up with Index?) - if (buflength > 0) { - buflength--; - int n = strlen(LexerName); - if (n > buflength) - n = buflength; - memcpy(name, LexerName, n), name[n] = '\0'; - } -} - -void EXT_LEXER_DECL Lex(unsigned int lexer, Sci_PositionU startPos, Sci_Position length, - int initStyle, char *words[], WindowID window, char *props) -{ - // below useless evaluation(s) to supress "not used" warnings - lexer; - // build expected data structures and do the Lex - InternalLexOrFold(0, startPos, length, initStyle, words, window, props); -} - -static void InternalLexOrFold(int foldOrLex, Sci_PositionU startPos, Sci_Position length, - int initStyle, char *words[], WindowID window, char *props) -{ - // create and initialize a WindowAccessor (including contained PropSet) - PropSetSimple ps; - ps.SetMultiple(props); - WindowAccessor wa(window, ps); - // create and initialize WordList(s) - int nWL = 0; - for (; words[nWL]; nWL++) ; // count # of WordList PTRs needed - WordList** wl = new WordList* [nWL + 1];// alloc WordList PTRs - int i = 0; - for (; i < nWL; i++) { - wl[i] = new WordList(); // (works or THROWS bad_alloc EXCEPTION) - wl[i]->Set(words[i]); - } - wl[i] = 0; - // call our "internal" folder/lexer (... then do Flush!) - if (foldOrLex) - FoldCamlDoc(startPos, length, initStyle, wl, wa); - else - ColouriseCamlDoc(startPos, length, initStyle, wl, wa); - wa.Flush(); - // clean up before leaving - for (i = nWL - 1; i >= 0; i--) - delete wl[i]; - delete [] wl; -} - -static -#endif /* BUILD_AS_EXTERNAL_LEXER */ - -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<char>(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<int>(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(); -} - -#ifdef BUILD_AS_EXTERNAL_LEXER -static -#endif /* BUILD_AS_EXTERNAL_LEXER */ -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 -}; - -#ifndef BUILD_AS_EXTERNAL_LEXER -LexerModule lmCaml(SCLEX_CAML, ColouriseCamlDoc, "caml", FoldCamlDoc, camlWordListDesc); -#endif /* BUILD_AS_EXTERNAL_LEXER */ diff --git a/lexers/LexCmake.cxx b/lexers/LexCmake.cxx deleted file mode 100644 index e3835c5c3..000000000 --- a/lexers/LexCmake.cxx +++ /dev/null @@ -1,456 +0,0 @@ -// Scintilla source code edit control -/** @file LexCmake.cxx - ** Lexer for Cmake - **/ -// Copyright 2007 by Cristian Adam <cristian [dot] adam [at] gmx [dot] net> -// based on the NSIS lexer -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>( 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 || CompareCaseInsensitive(s, "ELSEIF") == 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<char>( styler[ start + i ] ); - lowercaseWord[i] = static_cast<char>(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); diff --git a/lexers/LexCoffeeScript.cxx b/lexers/LexCoffeeScript.cxx deleted file mode 100644 index a00162335..000000000 --- a/lexers/LexCoffeeScript.cxx +++ /dev/null @@ -1,483 +0,0 @@ -// Scintilla source code edit control -/** @file LexCoffeeScript.cxx - ** Lexer for CoffeeScript. - **/ -// Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org> -// Based on the Scintilla C++ Lexer -// Written by Eric Promislow <ericp@activestate.com> in 2011 for the Komodo IDE -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <algorithm> - -#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 Scintilla; - -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; -} - -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<char>(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 - 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); diff --git a/lexers/LexConf.cxx b/lexers/LexConf.cxx deleted file mode 100644 index 73fbe46ef..000000000 --- a/lexers/LexConf.cxx +++ /dev/null @@ -1,190 +0,0 @@ -// Scintilla source code edit control -/** @file LexConf.cxx - ** Lexer for Apache Configuration Files. - ** - ** First working version contributed by Ahmad Zawawi <ahmad.zawawi@gmail.com> 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 <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>(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<char>(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); diff --git a/lexers/LexCrontab.cxx b/lexers/LexCrontab.cxx deleted file mode 100644 index 7f6d5fb0c..000000000 --- a/lexers/LexCrontab.cxx +++ /dev/null @@ -1,224 +0,0 @@ -// 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 <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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); diff --git a/lexers/LexCsound.cxx b/lexers/LexCsound.cxx deleted file mode 100644 index 24603801e..000000000 --- a/lexers/LexCsound.cxx +++ /dev/null @@ -1,212 +0,0 @@ -// Scintilla source code edit control -/** @file LexCsound.cxx - ** Lexer for Csound (Orchestra & Score) - ** Written by Georg Ritter - <ritterfuture A T gmail D O T com> - **/ -// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>(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<char>(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); diff --git a/lexers/LexD.cxx b/lexers/LexD.cxx deleted file mode 100644 index 9381a0d07..000000000 --- a/lexers/LexD.cxx +++ /dev/null @@ -1,571 +0,0 @@ -/** @file LexD.cxx - ** Lexer for D. - ** - ** Copyright (c) 2006 by Waldemar Augustyn <waldemar@wdmsys.com> - ** Converted to lexer object and added further folding features/properties by "Udo Lechner" <dlchnr(at)gmx(dot)net> - **/ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <map> - -#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; - -/* 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<OptionsD> { - 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); - } - static ILexer5 *LexerFactoryDInsensitive() { - return new LexerD(false); - } -}; - -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<char>(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); diff --git a/lexers/LexDMAP.cxx b/lexers/LexDMAP.cxx deleted file mode 100644 index 91b10c29b..000000000 --- a/lexers/LexDMAP.cxx +++ /dev/null @@ -1,226 +0,0 @@ -// 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 <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. -/***************************************/ -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> -/***************************************/ -#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 Scintilla; - -/***********************************************/ -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<char>(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<i-lastStart+1 ); k++) { - s[k] = static_cast<char>(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); diff --git a/lexers/LexDMIS.cxx b/lexers/LexDMIS.cxx deleted file mode 100644 index 3c8da6081..000000000 --- a/lexers/LexDMIS.cxx +++ /dev/null @@ -1,358 +0,0 @@ -// Scintilla source code edit control -/** @file LexDMIS.cxx - ** Lexer for DMIS. - **/ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// Copyright 2013-2014 by Andreas Tscharner <andy@vis.ethz.ch> -// The License.txt file describes the conditions under which this software may be distributed. - - -#include <cstdlib> -#include <cassert> -#include <cstring> -#include <cctype> - -#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 Scintilla; - - -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 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, IDocument *pAccess) override; - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, 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, 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)); - 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, 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<endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i+1); - - bool atEOL = ((ch == '\r' && chNext != '\n') || (ch == '\n')); - - if (strPos >= (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); diff --git a/lexers/LexDataflex.cxx b/lexers/LexDataflex.cxx deleted file mode 100644 index 42bd39b6b..000000000 --- a/lexers/LexDataflex.cxx +++ /dev/null @@ -1,608 +0,0 @@ -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - - -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<char>(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<char>(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<int>(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<int>(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<int>(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); diff --git a/lexers/LexDiff.cxx b/lexers/LexDiff.cxx deleted file mode 100644 index dd008c5cb..000000000 --- a/lexers/LexDiff.cxx +++ /dev/null @@ -1,161 +0,0 @@ -// Scintilla source code edit control -/** @file LexDiff.cxx - ** Lexer for diff results. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { - return (styler[i] == '\n') || - ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); -} - -#define DIFF_BUFFER_START_SIZE 16 -// Note that ColouriseDiffLine analyzes only the first DIFF_BUFFER_START_SIZE -// characters of each line to classify the line. - -static void ColouriseDiffLine(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); - } -} - -static void ColouriseDiffDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - char lineBuffer[DIFF_BUFFER_START_SIZE] = ""; - styler.StartAt(startPos); - styler.StartSegment(startPos); - Sci_PositionU linePos = 0; - for (Sci_PositionU i = startPos; i < startPos + length; i++) { - if (AtEOL(styler, i)) { - if (linePos < DIFF_BUFFER_START_SIZE) { - lineBuffer[linePos] = 0; - } - ColouriseDiffLine(lineBuffer, i, styler); - linePos = 0; - } else if (linePos < DIFF_BUFFER_START_SIZE - 1) { - lineBuffer[linePos++] = styler[i]; - } else if (linePos == DIFF_BUFFER_START_SIZE - 1) { - lineBuffer[linePos++] = 0; - } - } - if (linePos > 0) { // Last line does not have ending characters - if (linePos < DIFF_BUFFER_START_SIZE) { - lineBuffer[linePos] = 0; - } - ColouriseDiffLine(lineBuffer, startPos + length - 1, styler); - } -} - -static 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; - int nextLevel; - - do { - 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<Sci_Position>(startPos)+length > curLineStart); -} - -static const char *const emptyWordListDesc[] = { - 0 -}; - -LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc); diff --git a/lexers/LexECL.cxx b/lexers/LexECL.cxx deleted file mode 100644 index 6c916bce4..000000000 --- a/lexers/LexECL.cxx +++ /dev/null @@ -1,519 +0,0 @@ -// Scintilla source code edit control -/** @file LexECL.cxx - ** Lexer for ECL. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 <string> -#include <vector> -#include <map> -#include <algorithm> - -#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 Scintilla; - -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<int>(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<char>(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<Sci_PositionU>(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); diff --git a/lexers/LexEDIFACT.cxx b/lexers/LexEDIFACT.cxx deleted file mode 100644 index 3623807a4..000000000 --- a/lexers/LexEDIFACT.cxx +++ /dev/null @@ -1,403 +0,0 @@ -// 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 <cstdlib> -#include <cassert> -#include <cstring> -#include <cctype> - -#include <string> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "LexAccessor.h" -#include "LexerModule.h" -#include "DefaultLexer.h" - -using namespace Scintilla; - -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; -} - - diff --git a/lexers/LexEScript.cxx b/lexers/LexEScript.cxx deleted file mode 100644 index 79f99aedd..000000000 --- a/lexers/LexEScript.cxx +++ /dev/null @@ -1,274 +0,0 @@ -// Scintilla source code edit control -/** @file LexEScript.cxx - ** Lexer for ESCRIPT - **/ -// Copyright 2003 by Patrizio Bekerle (patrizio@bekerle.com) - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - - -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<char>(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<char>(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); diff --git a/lexers/LexEiffel.cxx b/lexers/LexEiffel.cxx deleted file mode 100644 index d1d42a960..000000000 --- a/lexers/LexEiffel.cxx +++ /dev/null @@ -1,239 +0,0 @@ -// Scintilla source code edit control -/** @file LexEiffel.cxx - ** Lexer for Eiffel. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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); diff --git a/lexers/LexErlang.cxx b/lexers/LexErlang.cxx deleted file mode 100644 index 4ca5962c3..000000000 --- a/lexers/LexErlang.cxx +++ /dev/null @@ -1,624 +0,0 @@ -// Scintilla source code edit control -// Encoding: UTF-8 -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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.atLineEnd) { - 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.atLineEnd) { - 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.GetCurrent(cur, sizeof(cur)); - sc.ChangeState(SCE_ERLANG_MODULES); - sc.SetState(SCE_ERLANG_MODULES); - } - } - } 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); - 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<char>(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); diff --git a/lexers/LexErrorList.cxx b/lexers/LexErrorList.cxx deleted file mode 100644 index 0fc389646..000000000 --- a/lexers/LexErrorList.cxx +++ /dev/null @@ -1,409 +0,0 @@ -// 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 <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> - -#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 Scintilla; - -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 IsAlphabetic(int ch) { - 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')); -} - -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; -} - -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: - // <message> at <file> line <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 ") && - strstr(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 (strstr(lineBuffer, "warning LNK")) { - // Microsoft linker warning: - // {<object> : } warning LNK9999 - return SCE_ERR_MS; - } 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: <filename>:<line>:<message> - // Microsoft: <filename>(<line>) :<message> - // Common: <filename>(<line>): warning|error|note|remark|catastrophic|fatal - // Common: <filename>(<line>) warning|error|note|remark|catastrophic|fatal - // Microsoft: <filename>(<line>,<column>)<message> - // CTags: <identifier>\t<filename>\t<message> - // Lua 5 traceback: \t<filename>:<line>:<message> - // Lua 5.1: <exe>: <filename>:<line>:<message> - 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) { // <filename>: - state = ((ch == '-') || Is0To9(ch)) ? stGccDigit : stUnrecognized; - } else if (state == stGccDigit) { // <filename>:<line> - if (ch == ':') { - state = stGccColumn; // :9.*: is GCC - startValue = i + 1; - } else if (!Is0To9(ch)) { - state = stUnrecognized; - } - } else if (state == stGccColumn) { // <filename>:<line>:<column> - if (!Is0To9(ch)) { - state = stGcc; - if (ch == ':') - startValue = i + 1; - break; - } - } else if (state == stMsStart) { // <filename>( - state = Is0To9(ch) ? stMsDigit : stUnrecognized; - } else if (state == stMsDigit) { // <filename>(<line> - if (ch == ',') { - state = stMsDigitComma; - } else if (ch == ')') { - state = stMsBracket; - } else if ((ch != ' ') && !Is0To9(ch)) { - state = stUnrecognized; - } - } else if (state == stMsBracket) { // <filename>(<line>) - 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; - 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 && IsAlphabetic(lineBuffer[j]) && chPos < sizeof(word) - 1; j++) - word[chPos++] = lineBuffer[j]; - word[chPos] = 0; - if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") || - !CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") || - !CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) { - state = stMsVc; - } else { - state = stUnrecognized; - } - } else { - state = stUnrecognized; - } - } else if (state == stMsDigitComma) { // <filename>(<line>, - 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 - // <filename>: 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 + static_cast<int>(startSeq - linePortion), portionStyle); - } - const char *endSeq = startSeq + 2; - while (!SequenceEnd(*endSeq)) - endSeq++; - const Sci_Position endSeqPosition = startPortion + static_cast<Sci_Position>(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", 0, emptyWordListDesc); diff --git a/lexers/LexFlagship.cxx b/lexers/LexFlagship.cxx deleted file mode 100644 index 2dfb687aa..000000000 --- a/lexers/LexFlagship.cxx +++ /dev/null @@ -1,352 +0,0 @@ -// 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 <jarabal/at/gmail.com> (Harbour) -// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// 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<char>(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); diff --git a/lexers/LexForth.cxx b/lexers/LexForth.cxx deleted file mode 100644 index 80842097d..000000000 --- a/lexers/LexForth.cxx +++ /dev/null @@ -1,168 +0,0 @@ -// Scintilla source code edit control -/** @file LexForth.cxx - ** Lexer for FORTH - **/ -// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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); - - diff --git a/lexers/LexFortran.cxx b/lexers/LexFortran.cxx deleted file mode 100644 index 28298b3ed..000000000 --- a/lexers/LexFortran.cxx +++ /dev/null @@ -1,721 +0,0 @@ -// 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 <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. -/***************************************/ -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> -/***************************************/ -#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 Scintilla; - -/***********************************************/ -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<char>(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<char>(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<nComL; i++) { - if (!comLineB[i] || nComColB[i] != nComCur) { - break; - } - } - if (i == nComL) { - levelDeltaNext = -1; - } - } - else if (!comLineB[0] || nComColB[0] != nComCur) { - unsigned int i=0; - for (; i<nComL; i++) { - if (!comLineF[i] || nComColF[i] != nComCur) { - break; - } - } - if (i == nComL) { - levelDeltaNext = 1; - } - } -} -/***************************************/ -static void GetIfLineComment(Accessor &styler, bool isFixFormat, const Sci_Position line, bool &isComLine, Sci_Position &comCol) { - Sci_Position col = 0; - isComLine = false; - Sci_Position pos = styler.LineStart(line); - Sci_Position len = styler.Length(); - while(pos<len) { - char ch = styler.SafeGetCharAt(pos); - if (ch == '!' || (isFixFormat && col == 0 && (tolower(ch) == 'c' || ch == '*'))) { - isComLine = true; - comCol = col; - break; - } - else if (!IsABlank(ch) || IsALineEnd(ch)) { - break; - } - pos++; - col++; - } -} -/***************************************/ -static void StepCommentLine(Accessor &styler, bool isFixFormat, Sci_Position lineCurrent, const unsigned int nComL, - Sci_Position nComColB[], Sci_Position nComColF[], Sci_Position &nComCur, - bool comLineB[], bool comLineF[], bool &comLineCur) { - Sci_Position nLineTotal = styler.GetLine(styler.Length()-1) + 1; - if (lineCurrent >= 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<nComL; i++) { - nComColF[i] = nComColF[i+1]; - comLineF[i] = comLineF[i+1]; - } - Sci_Position chL = lineCurrent + nComL; - if (chL < nLineTotal) { - GetIfLineComment(styler, isFixFormat, chL, comLineF[nComL-1], nComColF[nComL-1]); - } - else { - comLineF[nComL-1] = false; - } -} -/***************************************/ -static void CheckBackComLines(Accessor &styler, bool isFixFormat, Sci_Position lineCurrent, const unsigned int nComL, - Sci_Position nComColB[], Sci_Position nComColF[], Sci_Position nComCur, - bool comLineB[], bool comLineF[], bool &comLineCur) { - unsigned int nLines = nComL + nComL + 1; - bool* comL = new bool[nLines]; - Sci_Position* nComCol = new Sci_Position[nLines]; - bool comL0; - Sci_Position nComCol0; - GetIfLineComment(styler, isFixFormat, lineCurrent-nComL-1, comL0, nComCol0); - for (unsigned int i=0; i<nComL; i++) { - unsigned copyTo = nComL - i - 1; - comL[copyTo] = comLineB[i]; - nComCol[copyTo] = nComColB[i]; - } - assert(nComL < nLines); - comL[nComL] = comLineCur; - nComCol[nComL] = nComCur; - for (unsigned int i=0; i<nComL; i++) { - unsigned copyTo = i + nComL + 1; - comL[copyTo] = comLineF[i]; - nComCol[copyTo] = nComColF[i]; - } - - Sci_Position lineC = lineCurrent - nComL + 1; - Sci_PositionU iStart; - if (lineC <= 0) { - lineC = 0; - iStart = nComL - lineCurrent; - } - else { - iStart = 1; - } - bool levChanged = false; - int lev = styler.LevelAt(lineC) & SC_FOLDLEVELNUMBERMASK; - - for (Sci_PositionU i=iStart; i<=nComL; i++) { - if (comL[i] && (!comL[i-1] || nComCol[i] != nComCol[i-1])) { - bool increase = true; - Sci_PositionU until = i + nComL; - for (Sci_PositionU j=i+1; j<=until; j++) { - if (!comL[j] || nComCol[j] != nComCol[i]) { - increase = false; - break; - } - } - lev = styler.LevelAt(lineC) & SC_FOLDLEVELNUMBERMASK; - if (increase) { - int levH = lev | SC_FOLDLEVELHEADERFLAG; - lev += 1; - if (levH != styler.LevelAt(lineC)) { - styler.SetLevel(lineC, levH); - } - for (Sci_Position j=lineC+1; j<=lineCurrent; j++) { - if (lev != styler.LevelAt(j)) { - styler.SetLevel(j, lev); - } - } - break; - } - else { - if (lev != styler.LevelAt(lineC)) { - styler.SetLevel(lineC, lev); - } - } - levChanged = true; - } - else if (levChanged && comL[i]) { - if (lev != styler.LevelAt(lineC)) { - styler.SetLevel(lineC, lev); - } - } - lineC++; - } - delete[] comL; - delete[] nComCol; -} -/***************************************/ -// To determine the folding level depending on keywords -static int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) { - int lev = 0; - - if ((strcmp(prevWord, "module") == 0 && strcmp(s, "subroutine") == 0) - || (strcmp(prevWord, "module") == 0 && strcmp(s, "function") == 0)) { - lev = 0; - } else if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0 - || strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0 - || strcmp(s, "selecttype") == 0 || strcmp(s, "selectcase") == 0 - || strcmp(s, "do") == 0 || strcmp(s, "enum") ==0 - || strcmp(s, "function") == 0 || strcmp(s, "interface") == 0 - || strcmp(s, "module") == 0 || strcmp(s, "program") == 0 - || strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0 - || (strcmp(s, "type") == 0 && chNextNonBlank != '(') - || strcmp(s, "critical") == 0 || strcmp(s, "submodule") == 0){ - if (strcmp(prevWord, "end") == 0) - lev = 0; - else - lev = 1; - } else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=') - || strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0 - || strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0 - || strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0 - || strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0 - || strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0 - || strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0 - || strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0 - || strcmp(s, "endwhere") == 0 || strcmp(s, "endcritical") == 0 - || (strcmp(prevWord, "module") == 0 && strcmp(s, "procedure") == 0) // Take care of the "module procedure" statement - || strcmp(s, "endsubmodule") == 0 || strcmp(s, "endteam") == 0) { - lev = -1; - } else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if - lev = 0; - } else if (strcmp(prevWord, "type") == 0 && strcmp(s, "is") == 0){ // type is - lev = -1; - } else if ((strcmp(prevWord, "end") == 0 && strcmp(s, "procedure") == 0) - || strcmp(s, "endprocedure") == 0) { - lev = 1; // level back to 0, because no folding support for "module procedure" in submodule - } else if (strcmp(prevWord, "change") == 0 && strcmp(s, "team") == 0){ // change team - lev = 1; - } - return lev; -} -/***************************************/ -// Folding the code -static void FoldFortranDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - Accessor &styler, bool isFixFormat) { - - bool foldComment = styler.GetPropertyInt("fold.comment", 1) != 0; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - Sci_PositionU endPos = startPos + length; - int visibleChars = 0; - Sci_Position lineCurrent = styler.GetLine(startPos); - bool isPrevLine; - if (lineCurrent > 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<nComL; i++) { - Sci_Position chL = lineCurrent-(i+1); - if (chL < 0) { - comLineB[i] = false; - break; - } - GetIfLineComment(styler, isFixFormat, chL, comLineB[i], nComColB[i]); - if (!comLineB[i]) { - for (unsigned int j=i+1; j<nComL; j++) { - comLineB[j] = false; - } - break; - } - } - for (unsigned int i=0; i<nComL; i++) { - Sci_Position chL = lineCurrent+i+1; - if (chL >= 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<endPos) { - j ++ ; - chNextNonBlank = styler.SafeGetCharAt(j); - if (IsALineEnd(chNextNonBlank)) { - nextEOL = true; - } - } - if (!nextEOL && j == endPos) { - nextEOL = true; - } - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - // - if (((isFixFormat && stylePrev == SCE_F_CONTINUATION) || stylePrev == SCE_F_DEFAULT - || stylePrev == SCE_F_OPERATOR) && (style == SCE_F_WORD || style == SCE_F_LABEL)) { - // Store last word and label start point. - lastStart = i; - } - /***************************************/ - if (style == SCE_F_WORD) { - if(iswordchar(ch) && !iswordchar(chNext)) { - char s[32]; - Sci_PositionU k; - for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) { - s[k] = static_cast<char>(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<endPos) { - j++; - ch1 = styler.SafeGetCharAt(j); - } - char styBrace = styler.StyleAt(j); - int depth = 1; - char chAtPos; - char styAtPos; - while (j<endPos) { - j++; - chAtPos = styler.SafeGetCharAt(j); - styAtPos = styler.StyleAt(j); - if (styAtPos == styBrace) { - if (chAtPos == chBrace) depth++; - if (chAtPos == chSeek) depth--; - if (depth == 0) break; - } - } - Sci_Position tmpLineCurrent = lineCurrent; - while (j<endPos) { - j++; - chAtPos = styler.SafeGetCharAt(j); - styAtPos = styler.StyleAt(j); - if (!IsALineEnd(chAtPos) && (styAtPos == SCE_F_COMMENT || IsABlank(chAtPos))) continue; - if (isFixFormat) { - if (!IsALineEnd(chAtPos)) { - break; - } else { - if (tmpLineCurrent < styler.GetLine(styler.Length()-1)) { - tmpLineCurrent++; - j = styler.LineStart(tmpLineCurrent); - if (styler.StyleAt(j+5) == SCE_F_CONTINUATION - && !IsABlank(styler.SafeGetCharAt(j+5)) && styler.SafeGetCharAt(j+5) != '0') { - j += 5; - continue; - } else { - levelDeltaNext++; - break; - } - } - } - } else { - if (chAtPos == '&' && styler.StyleAt(j) == SCE_F_CONTINUATION) { - j = GetContinuedPos(j+1, styler); - continue; - } else if (IsALineEnd(chAtPos)) { - levelDeltaNext++; - break; - } else { - break; - } - } - } - } - } else { - int wordLevelDelta = classifyFoldPointFortran(s, prevWord, chNextNonBlank); - levelDeltaNext += wordLevelDelta; - if (((strcmp(s, "else") == 0) && (nextEOL || chNextNonBlank == '!')) || - (strcmp(prevWord, "else") == 0 && strcmp(s, "where") == 0) || strcmp(s, "elsewhere") == 0) { - if (!isPrevLine) { - levelCurrent--; - } - levelDeltaNext++; - } else if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) { - if (!isPrevLine) { - levelCurrent--; - } - } else if ((strcmp(prevWord, "select") == 0 && strcmp(s, "case") == 0) || strcmp(s, "selectcase") == 0 || - (strcmp(prevWord, "select") == 0 && strcmp(s, "type") == 0) || strcmp(s, "selecttype") == 0) { - levelDeltaNext += 2; - } else if ((strcmp(s, "case") == 0 && chNextNonBlank == '(') || (strcmp(prevWord, "case") == 0 && strcmp(s, "default") == 0) || - (strcmp(prevWord, "type") == 0 && strcmp(s, "is") == 0) || - (strcmp(prevWord, "class") == 0 && strcmp(s, "is") == 0) || - (strcmp(prevWord, "class") == 0 && strcmp(s, "default") == 0) ) { - if (!isPrevLine) { - levelCurrent--; - } - levelDeltaNext++; - } else if ((strcmp(prevWord, "end") == 0 && strcmp(s, "select") == 0) || strcmp(s, "endselect") == 0) { - levelDeltaNext -= 2; - } - - // There are multiple forms of "do" loop. The older form with a label "do 100 i=1,10" would require matching - // labels to ensure the folding level does not decrease too far when labels are used for other purposes. - // Since this is difficult, do-label constructs are not folded. - if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) { - // Remove delta for do-label - levelDeltaNext -= wordLevelDelta; - } - } - strcpy(prevWord, s); - } - } - if (atEOL) { - if (foldComment) { - int ldNext; - CheckLevelCommentLine(nComL, nComColB, nComColF, nComCur, comLineB, comLineF, comLineCur, ldNext); - levelDeltaNext += ldNext; - } - int lev = levelCurrent; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelDeltaNext > 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); diff --git a/lexers/LexGAP.cxx b/lexers/LexGAP.cxx deleted file mode 100644 index a2eca95ab..000000000 --- a/lexers/LexGAP.cxx +++ /dev/null @@ -1,264 +0,0 @@ -// 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 <at> gmail <dot> com ) -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>(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<char>(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<char>(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); diff --git a/lexers/LexGui4Cli.cxx b/lexers/LexGui4Cli.cxx deleted file mode 100644 index 664fa4f2f..000000000 --- a/lexers/LexGui4Cli.cxx +++ /dev/null @@ -1,312 +0,0 @@ -// Scintilla source code edit control -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// @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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -#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<char>(sc->ch); - ++c; sc->Forward(); - } - buff[c] = '\0'; - char *p = buff; - while (*p) // capitalize.. - { if (islower(*p)) *p = static_cast<char>(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 - diff --git a/lexers/LexHTML.cxx b/lexers/LexHTML.cxx deleted file mode 100644 index c6042f2b6..000000000 --- a/lexers/LexHTML.cxx +++ /dev/null @@ -1,2516 +0,0 @@ -// Scintilla source code edit control -/** @file LexHTML.cxx - ** Lexer for HTML. - **/ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> -#include <string> -#include <map> -#include <set> - -#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 "DefaultLexer.h" - -using namespace Scintilla; - -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 }; - -inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_'); -} - -inline bool IsAWordStart(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); -} - -inline bool IsOperator(int 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 == '>' || ch == ',' || ch == '/' || - ch == '?' || ch == '!' || ch == '.' || ch == '~') - return true; - return false; -} - -void GetTextSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end, char *s, size_t len) { - Sci_PositionU i = 0; - for (; (i < end - start + 1) && (i < len-1); i++) { - s[i] = MakeLowerCase(styler[start + i]); - } - s[i] = '\0'; -} - -std::string GetStringSegment(Accessor &styler, Sci_PositionU start, Sci_PositionU end) { - std::string s; - Sci_PositionU i = 0; - for (; (i < end - start + 1); i++) { - s.push_back(MakeLowerCase(styler[start + i])); - } - return s; -} - -std::string GetNextWord(Accessor &styler, Sci_PositionU start) { - std::string ret; - Sci_PositionU i = 0; - for (; i < 200; i++) { // Put an upper limit to bound time taken for unexpected text. - 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; -} - -script_type segIsScriptingIndicator(Accessor &styler, Sci_PositionU start, Sci_PositionU end, script_type prevValue) { - char s[100]; - GetTextSegment(styler, start, end, s, sizeof(s)); - //Platform::DebugPrintf("Scripting indicator [%s]\n", s); - if (strstr(s, "src")) // External script - return eScriptNone; - if (strstr(s, "vbs")) - return eScriptVBS; - if (strstr(s, "pyth")) - return eScriptPython; - if (strstr(s, "javas")) - return eScriptJS; - if (strstr(s, "jscr")) - return eScriptJS; - if (strstr(s, "php")) - return eScriptPHP; - if (strstr(s, "xml")) { - const char *xml = strstr(s, "xml"); - for (const char *t=s; t<xml; t++) { - if (!IsASpace(*t)) { - return prevValue; - } - } - return eScriptXML; - } - - return prevValue; -} - -int PrintScriptingIndicatorOffset(Accessor &styler, Sci_PositionU start, Sci_PositionU end) { - int iResult = 0; - std::string s = GetStringSegment(styler, start, end); - if (0 == strncmp(s.c_str(), "php", 3)) { - iResult = 3; - } - return iResult; -} - -script_type ScriptOfState(int state) { - if ((state >= SCE_HP_START) && (state <= SCE_HP_IDENTIFIER)) { - return eScriptPython; - } else if ((state >= SCE_HB_START) && (state <= SCE_HB_STRINGEOL)) { - return eScriptVBS; - } else if ((state >= SCE_HJ_START) && (state <= SCE_HJ_REGEX)) { - return eScriptJS; - } else if ((state >= SCE_HPHP_DEFAULT) && (state <= SCE_HPHP_COMMENTLINE)) { - 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; - } -} - -int statePrintForState(int state, script_mode inScriptType) { - 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; -} - -int stateForPrintState(int StateToPrint) { - int state; - - 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; - } else { - state = StateToPrint; - } - - return state; -} - -inline bool IsNumber(Sci_PositionU start, Accessor &styler) { - return IsADigit(styler[start]) || (styler[start] == '.') || - (styler[start] == '-') || (styler[start] == '#'); -} - -inline bool isStringState(int state) { - bool bResult; - - 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 : - bResult = false; - break; - } - return bResult; -} - -inline bool stateAllowsTermination(int state) { - bool allowTermination = !isStringState(state); - if (allowTermination) { - switch (state) { - case SCE_HB_COMMENTLINE: - case SCE_HPHP_COMMENT: - case SCE_HP_COMMENTLINE: - case SCE_HPA_COMMENTLINE: - allowTermination = false; - } - } - return allowTermination; -} - -// not really well done, since it's only comments that should lex the %> and <% -inline bool isCommentASPState(int state) { - bool bResult; - - 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 : - bResult = false; - break; - } - return bResult; -} - -void classifyAttribHTML(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, Accessor &styler) { - const bool wordIsNumber = IsNumber(start, styler); - char chAttr = SCE_H_ATTRIBUTEUNKNOWN; - if (wordIsNumber) { - chAttr = SCE_H_NUMBER; - } else { - std::string s = GetStringSegment(styler, start, end); - if (keywords.InList(s.c_str())) - chAttr = SCE_H_ATTRIBUTE; - } - if ((chAttr == SCE_H_ATTRIBUTEUNKNOWN) && !keywords) - // No keywords -> all are known - chAttr = SCE_H_ATTRIBUTE; - styler.ColourTo(end, chAttr); -} - -// https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements-core-concepts -bool isHTMLCustomElement(const std::string &tag) { - // 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, Accessor &styler, bool &tagDontFold, - bool caseSensitive, bool isXml, bool allowScripts, - const std::set<std::string> &nonFoldingTags) { - std::string tag; - // 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 - char chAttr = SCE_H_TAGUNKNOWN; - if (!tag.empty() && (tag[0] == '!')) { - chAttr = SCE_H_SGML_DEFAULT; - } else if (!keywords || keywords.InList(tag.c_str())) { - chAttr = SCE_H_TAG; - } else if (!isXml && isHTMLCustomElement(tag)) { - chAttr = SCE_H_TAG; - } - 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 + 200; cPos++) { - const char ch = styler.SafeGetCharAt(cPos, '\0'); - if (ch == '\0' || ch == '>') - break; - else 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, Accessor &styler, script_mode inScriptType) { - char s[30 + 1]; - Sci_PositionU i = 0; - for (; i < end - start + 1 && i < 30; i++) { - s[i] = styler[start + i]; - } - s[i] = '\0'; - - char 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; - } - styler.ColourTo(end, statePrintForState(chAttr, inScriptType)); -} - -int classifyWordHTVB(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, Accessor &styler, script_mode inScriptType) { - char chAttr = SCE_HB_IDENTIFIER; - const bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); - if (wordIsNumber) { - chAttr = SCE_HB_NUMBER; - } else { - std::string s = GetStringSegment(styler, start, end); - if (keywords.InList(s.c_str())) { - chAttr = SCE_HB_WORD; - if (s == "rem") - chAttr = SCE_HB_COMMENTLINE; - } - } - 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, Accessor &styler, std::string &prevWord, script_mode inScriptType, bool isMako) { - const bool wordIsNumber = IsADigit(styler[start]); - std::string s; - for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) { - s.push_back(styler[start + i]); - } - char 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.c_str())) - chAttr = SCE_HP_WORD; - else if (isMako && (s == "block")) - chAttr = SCE_HP_WORD; - 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, Accessor &styler) { - char 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 { - std::string s = GetStringSegment(styler, start, end); - if (keywords.InList(s.c_str())) - chAttr = SCE_HPHP_WORD; - } - styler.ColourTo(end, chAttr); -} - -bool isWordHSGML(Sci_PositionU start, Sci_PositionU end, const WordList &keywords, Accessor &styler) { - std::string s; - for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) { - s.push_back(styler[start + i]); - } - return keywords.InList(s.c_str()); -} - -bool isWordCdata(Sci_PositionU start, Sci_PositionU end, Accessor &styler) { - std::string s; - for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) { - s.push_back(styler[start + i]); - } - return s == "[CDATA["; -} - -// Return the first state to reach when entering a scripting language -int StateForScript(script_type scriptLanguage) { - int Result; - 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 : - Result = SCE_HJ_START; - break; - } - return Result; -} - -inline bool issgmlwordchar(int ch) { - return !IsASCII(ch) || - (isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '['); -} - -inline bool IsPhpWordStart(int ch) { - return (IsASCII(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f); -} - -inline bool IsPhpWordChar(int ch) { - return IsADigit(ch) || IsPhpWordStart(ch); -} - -bool InTagState(int state) { - return state == SCE_H_TAG || state == SCE_H_TAGUNKNOWN || - state == SCE_H_SCRIPT || - state == SCE_H_ATTRIBUTE || state == SCE_H_ATTRIBUTEUNKNOWN || - state == SCE_H_NUMBER || state == SCE_H_OTHER || - state == SCE_H_DOUBLESTRING || state == SCE_H_SINGLESTRING; -} - -bool IsCommentState(const int state) { - return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT; -} - -bool IsScriptCommentState(const int state) { - return state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTLINE || state == SCE_HJA_COMMENT || - state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE; -} - -bool isLineEnd(int ch) { - return ch == '\r' || ch == '\n'; -} - -bool isMakoBlockEnd(const int ch, const int chNext, const std::string &blockType) { - if (blockType.empty()) { - return ((ch == '%') && (chNext == '>')); - } else if ((blockType == "inherit") || - (blockType == "namespace") || - (blockType == "include") || - (blockType == "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) { - if (blockType.empty()) { - return false; - } else if (blockType == "%") { - return ((ch == '%') && (chNext == '}')); - } else if (blockType == "{") { - return ((ch == '}') && (chNext == '}')); - } else { - return false; - } -} - -bool isPHPStringState(int state) { - 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) { - Sci_Position j; - const Sci_Position beginning = i - 1; - bool isValidSimpleString = 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 == '\'' && IsPhpWordStart(chNext)) { - i++; - ch = chNext; - isSimpleString = true; - } else { - return beginning; - } - } - phpStringDelimiter.push_back(ch); - i++; - for (j = i; j < lengthDoc && !isLineEnd(styler[j]); j++) { - if (!IsPhpWordChar(styler[j])) { - if (isSimpleString && (styler[j] == '\'') && isLineEnd(styler.SafeGetCharAt(j + 1))) { - isValidSimpleString = true; - j++; - break; - } else { - phpStringDelimiter.clear(); - return beginning; - } - } - phpStringDelimiter.push_back(styler[j]); - } - if (isSimpleString && !isValidSimpleString) { - 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; - OptionsHTML() noexcept { - } -}; - -const char * const htmlWordListDesc[] = { - "HTML elements and attributes", - "JavaScript keywords", - "VBScript keywords", - "Python keywords", - "PHP keywords", - "SGML and DTD keywords", - 0, -}; - -const char * const phpscriptWordListDesc[] = { - "", //Unused - "", //Unused - "", //Unused - "", //Unused - "PHP keywords", - "", //Unused - 0, -}; - -struct OptionSetHTML : public OptionSet<OptionsHTML> { - 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); - } -}; - -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 '<?'", - 13, "SCE_H_XMLEND", "identifier", "XML identifier end '?>'", - 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", "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", -}; - -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 '<?'", - 13, "SCE_H_XMLEND", "identifier", "XML identifier end '?>'", - 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 *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<std::string> nonFoldingTags; -public: - explicit LexerHTML(bool isXml_, bool isPHPScript_) : - DefaultLexer( - isXml_ ? "xml" : (isPHPScript_ ? "phpscript" : "hypertext"), - isXml_ ? SCLEX_XML : (isPHPScript_ ? SCLEX_PHPSCRIPT : SCLEX_HTML), - isXml_ ? lexicalClassesHTML : lexicalClassesXML, - isXml_ ? std::size(lexicalClassesHTML) : std::size(lexicalClassesXML)), - 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. - - 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 = 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; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - 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); - if (isPHPScript && (startPos == 0)) { - initStyle = SCE_HPHP_DEFAULT; - } - styler.StartAt(startPos); - std::string prevWord; - 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.StyleAt(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.StyleAt(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; - } - - 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<script_mode>((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<script_type>((lineState >> 4) & 0x0F); // 4 bits of script name - script_type clientScript = static_cast<script_type>((lineState >> 8) & 0x0F); // 4 bits of script name - int beforePreProc = (lineState >> 12) & 0xFF; // 8 bits of state - - 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, ".-_:!#", 0x80, true); - const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true); - const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true); - // TODO: also handle + and - (except if they're part of ++ or --) and return keywords - const CharacterSet setOKBeforeJSRE(CharacterSet::setNone, "([{=,:;!%^&*|?~"); - - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; - int 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.StyleAt(back); - if (style < SCE_HJ_DEFAULT || style > SCE_HJ_COMMENTDOC) - // includes SCE_HJ_COMMENT & SCE_HJ_COMMENTLINE - break; - } - if (style == SCE_HJ_SYMBOLS) { - chPrevNonWhite = static_cast<unsigned char>(styler.SafeGetCharAt(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<unsigned char>(styler[i]); - int chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1)); - const int chNext2 = static_cast<unsigned char>(styler.SafeGetCharAt(i + 2)); - - // Handle DBCS codepages - if (styler.IsLeadByte(static_cast<char>(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 ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != 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)) && 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 - int Findlevel = (levelCurrent & ~SC_FOLDLEVELBASE) * 8; - for (Sci_Position j = 0; Findlevel > 0; j++) { - const char chTmp = styler.SafeGetCharAt(i + j + 1); - if (chTmp == '\t') { - Findlevel -= 8; - } else if (chTmp == ' ') { - Findlevel--; - } else { - break; - } - } - - if (Findlevel > 0) { - levelCurrent -= Findlevel / 8; - if (Findlevel % 8) - 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)); - 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 || isXml ? "script" : - state == SCE_H_COMMENT ? "comment" : 0) { - Sci_Position j = i + 2; - int chr; - do { - chr = static_cast<int>(*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; - 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) && - !isStringState(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 = static_cast<unsigned char>(styler.SafeGetCharAt(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); - else - makoBlockType = GetNextWord(styler, i+2); - 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 += static_cast<int>(makoBlockType.length()); - if (keywords4.InList(makoBlockType.c_str())) - styler.ColourTo(i, SCE_HP_WORD); - else - styler.ColourTo(i, SCE_H_TAGUNKNOWN); - } - - ch = static_cast<unsigned char>(styler.SafeGetCharAt(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 = static_cast<unsigned char>(styler.SafeGetCharAt(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 = static_cast<unsigned char>(styler.SafeGetCharAt(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; - - if (chNext2 == '@') { - i += 2; // place as if it was the second next char treated - visibleChars += 2; - state = SCE_H_ASPAT; - } 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 = eScriptVBS; - styler.ColourTo(i, SCE_H_ASP); - // fold whole script - if (foldHTMLPreprocessor) - levelCurrent++; - // should be better - ch = static_cast<unsigned char>(styler.SafeGetCharAt(i)); - continue; - } - - ///////////////////////////////////// - // handle the start of SGML language (DTD) - else if (((scriptLanguage == eScriptNone) || (scriptLanguage == eScriptXML)) && - (chPrev == '<') && - (ch == '!') && - (StateToPrint != SCE_H_CDATA) && - (!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 -- - } else if (isWordCdata(i + 1, i + 7, styler)) { - state = SCE_H_CDATA; - } else { - styler.ColourTo(i, SCE_H_SGML_DEFAULT); // <! is default - scriptLanguage = eScriptSGML; - state = SCE_H_SGML_COMMAND; // wait for a pending command - } - // fold whole tag (-- when closing the tag) - if (foldHTMLPreprocessor || state == SCE_H_COMMENT || state == SCE_H_CDATA) - levelCurrent++; - continue; - } - - // handle the end of Mako Python code - else if (isMako && - ((inScriptType == eNonHtmlPreProc) || (inScriptType == eNonHtmlScriptPreProc)) && - (scriptLanguage != eScriptNone) && stateAllowsTermination(state) && - isMakoBlockEnd(ch, chNext, makoBlockType)) { - if (state == SCE_H_ASPAT) { - aspScript = segIsScriptingIndicator(styler, - styler.GetStartSegment(), i - 1, aspScript); - } - if (state == SCE_HP_WORD) { - classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako); - } else { - styler.ColourTo(i - 1, StateToPrint); - } - if ((makoBlockType != "%") && (makoBlockType != "{") && ch != '>') { - 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, 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))) && - (((ch == '%') || (ch == '?')) && (chNext == '>'))) || - ((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, styler, inScriptType); - break; - case SCE_HB_WORD: - classifyWordHTVB(styler.GetStartSegment(), i - 1, keywords3, styler, inScriptType); - break; - case SCE_HP_WORD: - classifyWordHTPy(styler.GetStartSegment(), i - 1, keywords4, styler, prevWord, inScriptType, isMako); - break; - case SCE_HPHP_WORD: - classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, 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 && !(chNext == '/' || chNext == '?' || chNext == '!' || chNext == '-' || 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<Sci_Position>(styler.GetStartSegment()) <= (i - 2)) { - styler.ColourTo(i - 2, StateToPrint); - } - state = SCE_H_SGML_COMMENT; - } else if (IsASCII(ch) && isalpha(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 - int size = 1; - while (setHTMLWord.Contains(static_cast<unsigned char>(styler.SafeGetCharAt(i + size)))) - size++; - styler.ColourTo(i + size - 1, StateToPrint); - i += size - 1; - visibleChars += size - 1; - ch = static_cast<unsigned char>(styler.SafeGetCharAt(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 == '>')) { - 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 (!(IsASCII(ch) && isupper(ch))) { - styler.ColourTo(i - 1, StateToPrint); - if (isalnum(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 (!(IsASCII(ch) && isalnum(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; - } - if (ch != '#' && !(IsASCII(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway... - && ch != '.' && ch != '-' && ch != '_' && ch != ':') { // valid in XML - if (!IsASCII(ch)) // Possibly start of a multibyte character so don't allow this byte to be in entity style - styler.ColourTo(i-1, SCE_H_TAGUNKNOWN); - else - styler.ColourTo(i, SCE_H_TAGUNKNOWN); - state = SCE_H_DEFAULT; - } - break; - case SCE_H_TAGUNKNOWN: - if (!setTagContinue.Contains(ch) && !((ch == '/') && (chPrev == '<'))) { - int eClass = classifyTagHTML(styler.GetStartSegment(), - i - 1, keywords, styler, tagDontFold, caseSensitive, isXml, allowScripts, nonFoldingTags); - if (eClass == SCE_H_SCRIPT || eClass == SCE_H_COMMENT) { - if (!tagClosing) { - inScriptType = eNonHtmlScript; - scriptLanguage = eClass == SCE_H_SCRIPT ? clientScript : eScriptComment; - } else { - scriptLanguage = eScriptNone; - } - 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)) { - if (inScriptType == eNonHtmlScript) { - const int scriptLanguagePrev = scriptLanguage; - clientScript = segIsScriptingIndicator(styler, styler.GetStartSegment(), i - 1, scriptLanguage); - scriptLanguage = clientScript; - if ((scriptLanguagePrev != scriptLanguage) && (scriptLanguage == eScriptNone)) - inScriptType = eHtml; - } - classifyAttribHTML(styler.GetStartSegment(), i - 1, keywords, styler); - 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 (inScriptType == eNonHtmlScript) { - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); - } - styler.ColourTo(i, SCE_H_DOUBLESTRING); - state = SCE_H_OTHER; - } - break; - case SCE_H_SINGLESTRING: - if (ch == '\'') { - if (inScriptType == eNonHtmlScript) { - scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment(), i, scriptLanguage); - } - 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 (IsNumber(styler.GetStartSegment(), styler)) { - 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, 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 ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_COMMENTLINE; - i += 2; - } else if (isLineEnd(ch)) { - styler.ColourTo(i - 1, StateToPrint); - 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 ((inScriptType == eNonHtmlScript) && (ch == '-') && (chNext == '-') && (chNext2 == '>')) { - styler.ColourTo(i - 1, StateToPrint); - state = SCE_HJ_COMMENTLINE; - i += 2; - } 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 (IsASCII(chNext) && islower(chNext)) { // gobble regex flags - i++; - ch = chNext; - chNext = static_cast<unsigned char>(styler.SafeGetCharAt(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 = static_cast<unsigned char>(styler.SafeGetCharAt(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, 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 = static_cast<unsigned char>(styler.SafeGetCharAt(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 = static_cast<unsigned char>(styler.SafeGetCharAt(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, 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 = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1)); - } else { - state = SCE_HP_STRING; - } - } else if (ch == '\'') { - if (chNext == '\'' && chNext2 == '\'') { - i += 2; - state = SCE_HP_TRIPLE; - ch = ' '; - chPrev = ' '; - chNext = static_cast<unsigned char>(styler.SafeGetCharAt(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 = static_cast<unsigned char>(styler.SafeGetCharAt(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 = static_cast<unsigned char>(styler.SafeGetCharAt(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 (!IsAWordChar(ch)) { - classifyWordHTPHP(styler.GetStartSegment(), i - 1, keywords5, styler); - if (ch == '/' && chNext == '*') { - i++; - state = SCE_HPHP_COMMENT; - } else if (ch == '/' && chNext == '/') { - i++; - state = SCE_HPHP_COMMENTLINE; - } else if (ch == '#') { - 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: - // recognize bases 8,10 or 16 integers OR floating-point numbers - if (!IsADigit(ch) - && strchr(".xXabcdefABCDEF", ch) == NULL - && ((ch != '-' && ch != '+') || (chPrev != 'e' && chPrev != 'E'))) { - styler.ColourTo(i - 1, SCE_HPHP_NUMBER); - if (IsOperator(ch)) - state = SCE_HPHP_OPERATOR; - else - 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 (isLineEnd(chPrev)) { - const int psdLength = static_cast<int>(phpStringDelimiter.length()); - const char chAfterPsd = styler.SafeGetCharAt(i + psdLength); - const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1); - if (isLineEnd(chAfterPsd) || - (chAfterPsd == ';' && isLineEnd(chAfterPsd2))) { - 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 (isLineEnd(chPrev) && styler.Match(i, phpStringDelimiter.c_str())) { - const int psdLength = static_cast<int>(phpStringDelimiter.length()); - const char chAfterPsd = styler.SafeGetCharAt(i + psdLength); - const char chAfterPsd2 = styler.SafeGetCharAt(i + psdLength + 1); - if (isLineEnd(chAfterPsd) || - (chAfterPsd == ';' && isLineEnd(chAfterPsd2))) { - 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 (IsADigit(ch) || (ch == '.' && IsADigit(chNext))) { - 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 == '#') { - 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<Sci_Position>(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, styler, inScriptType); - break; - case SCE_HB_WORD: - classifyWordHTVB(styler.GetStartSegment(), lengthDoc - 1, keywords3, styler, inScriptType); - break; - case SCE_HP_WORD: - classifyWordHTPy(styler.GetStartSegment(), lengthDoc - 1, keywords4, styler, prevWord, inScriptType, isMako); - break; - case SCE_HPHP_WORD: - classifyWordHTPHP(styler.GetStartSegment(), lengthDoc - 1, keywords5, styler); - break; - default: - StateToPrint = statePrintForState(state, inScriptType); - if (static_cast<Sci_Position>(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); diff --git a/lexers/LexHaskell.cxx b/lexers/LexHaskell.cxx deleted file mode 100644 index 4d4fe1dd6..000000000 --- a/lexers/LexHaskell.cxx +++ /dev/null @@ -1,1116 +0,0 @@ -/****************************************************************** - * 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 <kudahkukarek@gmail.com> - * - * TODO: - * * A proper lexical folder to fold group declarations, comments, pragmas, - * #ifdefs, explicit layout, lists, tuples, quasi-quotes, splces, etc, etc, - * etc. - * - *****************************************************************/ -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <vector> -#include <map> - -#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; - -// 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<OptionsHaskell> { - 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<LiterateMode>((state >> 3) & 0x1)) - , mode (static_cast<KeywordMode>(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<int>(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<int>(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); diff --git a/lexers/LexHex.cxx b/lexers/LexHex.cxx deleted file mode 100644 index 6e1099786..000000000 --- a/lexers/LexHex.cxx +++ /dev/null @@ -1,1045 +0,0 @@ -// 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 <neilh@scintilla.org> -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// 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 <nb> 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 <startPos> till end of record, ignoring -// <uncountedDigits> 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<Sci_Position>(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. -// <startPos> is the position of the first character of the starting digit -// pair, <cnt> 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 <pos>. -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 <pos>. -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<Sci_Position>(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); diff --git a/lexers/LexHollywood.cxx b/lexers/LexHollywood.cxx deleted file mode 100644 index 673381282..000000000 --- a/lexers/LexHollywood.cxx +++ /dev/null @@ -1,516 +0,0 @@ -// 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 <at> airsoftsoftwair <dot> 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <map> - -#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; - -/* 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<OptionsHollywood> { - 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<char>(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<char>(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); diff --git a/lexers/LexIndent.cxx b/lexers/LexIndent.cxx deleted file mode 100644 index 053bdd928..000000000 --- a/lexers/LexIndent.cxx +++ /dev/null @@ -1,71 +0,0 @@ -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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; lineCurrent++) { - i = styler.LineStart(lineCurrent+1); - lineEnd = styler.LineStart(lineCurrent+2)-1; - if(lineEnd>=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); diff --git a/lexers/LexInno.cxx b/lexers/LexInno.cxx deleted file mode 100644 index 5d01c0588..000000000 --- a/lexers/LexInno.cxx +++ /dev/null @@ -1,288 +0,0 @@ -// Scintilla source code edit control -/** @file LexInno.cxx - ** Lexer for Inno Setup scripts. - **/ -// Written by Friedrich Vedder <fvedd@t-online.de>, using code from LexOthers.cxx. -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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; - bool isCStyleComment = false; - - WordList §ionKeywords = *keywordLists[0]; - WordList &standardKeywords = *keywordLists[1]; - WordList ¶meterKeywords = *keywordLists[2]; - WordList &preprocessorKeywords = *keywordLists[3]; - WordList &pascalKeywords = *keywordLists[4]; - WordList &userKeywords = *keywordLists[5]; - - Sci_Position curLine = styler.GetLine(startPos); - int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0; - bool isCode = (curLineState == 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++) { - 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); - styler.SetLineState(curLine, (isCode ? 1 : 0)); - } - - switch(state) { - case SCE_INNO_DEFAULT: - if (!isCode && ch == ';' && isBOLWS) { - // Start of a comment - state = SCE_INNO_COMMENT; - } else if (ch == '[' && isBOLWS) { - // Start of a section name - bufferCount = 0; - state = SCE_INNO_SECTION; - } 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 == '{' || (ch == '(' && chNext == '*'))) { - // Start of a Pascal comment - state = SCE_INNO_COMMENT_PASCAL; - isCStyleComment = false; - } else if (isCode && ch == '/' && chNext == '/') { - // Apparently, C-style comments are legal, too - state = SCE_INNO_COMMENT_PASCAL; - isCStyleComment = true; - } else if (ch == '"') { - // Start of a double-quote string - state = SCE_INNO_STRING_DOUBLE; - } else if (ch == '\'') { - // Start of a single-quote string - state = SCE_INNO_STRING_SINGLE; - } else if (IsASCII(ch) && (isalpha(ch) || (ch == '_'))) { - // Start of an identifier - bufferCount = 0; - buffer[bufferCount++] = static_cast<char>(tolower(ch)); - state = SCE_INNO_IDENTIFIER; - } 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,SCE_INNO_COMMENT); - } - break; - - case SCE_INNO_IDENTIFIER: - if (IsASCII(ch) && (isalnum(ch) || (ch == '_'))) { - buffer[bufferCount++] = static_cast<char>(tolower(ch)); - } else { - state = SCE_INNO_DEFAULT; - buffer[bufferCount] = '\0'; - - // Check if the buffer contains a keyword - if (!isCode && standardKeywords.InList(buffer)) { - styler.ColourTo(i-1,SCE_INNO_KEYWORD); - } else if (!isCode && parameterKeywords.InList(buffer)) { - 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"); - } else { - styler.ColourTo(i,SCE_INNO_DEFAULT); - } - } else if (IsASCII(ch) && (isalnum(ch) || (ch == '_'))) { - buffer[bufferCount++] = static_cast<char>(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<char>(tolower(ch)); - } - break; - - case SCE_INNO_STRING_DOUBLE: - if (ch == '"' || isEOL) { - state = SCE_INNO_DEFAULT; - styler.ColourTo(i,SCE_INNO_STRING_DOUBLE); - } - break; - - case SCE_INNO_STRING_SINGLE: - if (ch == '\'' || isEOL) { - state = SCE_INNO_DEFAULT; - 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 (isCStyleComment) { - if (isEOL) { - state = SCE_INNO_DEFAULT; - styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL); - } - } else { - if (ch == '}' || (ch == ')' && chPrev == '*')) { - state = SCE_INNO_DEFAULT; - styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL); - } else if (isEOL) { - state = SCE_INNO_DEFAULT; - styler.ColourTo(i,SCE_INNO_DEFAULT); - } - } - 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); diff --git a/lexers/LexJSON.cxx b/lexers/LexJSON.cxx deleted file mode 100644 index 3712e931f..000000000 --- a/lexers/LexJSON.cxx +++ /dev/null @@ -1,502 +0,0 @@ -// 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 <cstdlib> -#include <cassert> -#include <cctype> -#include <cstdio> -#include <string> -#include <vector> -#include <map> - -#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; - -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<OptionsJSON> { - 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) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - 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.atLineEnd) { - 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_C_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.atLineEnd) { - 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<Sci_Position>(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); diff --git a/lexers/LexKVIrc.cxx b/lexers/LexKVIrc.cxx deleted file mode 100644 index 0cae2a234..000000000 --- a/lexers/LexKVIrc.cxx +++ /dev/null @@ -1,471 +0,0 @@ -// Scintilla source code edit control -/** @file LexKVIrc.cxx - ** Lexer for KVIrc script. - **/ -// Copyright 2013 by OmegaPhil <OmegaPhil+scintilla@gmail.com>, based in -// part from LexPython Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// and LexCmake Copyright 2007 by Cristian Adam <cristian [dot] adam [at] gmx [dot] net> - -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - - -/* 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 '#<channel - * name>' 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); diff --git a/lexers/LexKix.cxx b/lexers/LexKix.cxx deleted file mode 100644 index bcd68137e..000000000 --- a/lexers/LexKix.cxx +++ /dev/null @@ -1,134 +0,0 @@ -// Scintilla source code edit control -/** @file LexKix.cxx - ** Lexer for KIX-Scripts. - **/ -// Copyright 2004 by Manfred Becker <manfred@becker-trdf.de> -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// 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"); - diff --git a/lexers/LexLaTeX.cxx b/lexers/LexLaTeX.cxx deleted file mode 100644 index 6376bd7d6..000000000 --- a/lexers/LexLaTeX.cxx +++ /dev/null @@ -1,559 +0,0 @@ -// Scintilla source code edit control -/** @file LexLaTeX.cxx - ** Lexer for LaTeX2e. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> -#include <vector> - -#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 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<int> modes; - void setMode(Sci_Position line, int mode) { - if (line >= static_cast<Sci_Position>(modes.size())) modes.resize(line + 1, 0); - modes[line] = mode; - } - int getMode(Sci_Position line) { - if (line >= 0 && line < static_cast<Sci_Position>(modes.size())) return modes[line]; - return 0; - } - void truncModes(Sci_Position numLines) { - if (static_cast<Sci_Position>(modes.size()) > numLines * 2 + 256) - modes.resize(numLines + 128); - } - - vector<latexFoldSave> saves; - void setSave(Sci_Position line, const latexFoldSave &save) { - if (line >= static_cast<Sci_Position>(saves.size())) saves.resize(line + 1); - saves[line] = save; - } - void getSave(Sci_Position line, latexFoldSave &save) { - if (line >= 0 && line < static_cast<Sci_Position>(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<Sci_Position>(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<Sci_PositionU>(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<int>(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<Sci_Position>(startPos); i < static_cast<Sci_Position>(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<Sci_Position>(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<Sci_Position>(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); diff --git a/lexers/LexLisp.cxx b/lexers/LexLisp.cxx deleted file mode 100644 index 8e7586355..000000000 --- a/lexers/LexLisp.cxx +++ /dev/null @@ -1,283 +0,0 @@ -// Scintilla source code edit control -/** @file LexLisp.cxx - ** Lexer for Lisp. - ** Written by Alexey Yutkin. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -#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); diff --git a/lexers/LexLout.cxx b/lexers/LexLout.cxx deleted file mode 100644 index abba91ad1..000000000 --- a/lexers/LexLout.cxx +++ /dev/null @@ -1,213 +0,0 @@ -// Scintilla source code edit control -/** @file LexLout.cxx - ** Lexer for the Basser Lout (>= version 3) typesetting language - **/ -// Copyright 2003 by Kein-Hong Man <mkh@pl.jaring.my> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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); diff --git a/lexers/LexLua.cxx b/lexers/LexLua.cxx deleted file mode 100644 index 9e6e8a70c..000000000 --- a/lexers/LexLua.cxx +++ /dev/null @@ -1,502 +0,0 @@ -// 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 <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> - -#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" - -using namespace Scintilla; - -// 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. -static int LongDelimCheck(StyleContext &sc) { - int sep = 1; - while (sc.GetRelative(sep) == '=' && sep < 0xFF) - sep++; - if (sc.GetRelative(sep) == sc.ch) - return sep; - return 0; -} - -static void ColouriseLuaDoc( - Sci_PositionU startPos, - Sci_Position length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) { - - const WordList &keywords = *keywordlists[0]; - const WordList &keywords2 = *keywordlists[1]; - const WordList &keywords3 = *keywordlists[2]; - const WordList &keywords4 = *keywordlists[3]; - const WordList &keywords5 = *keywordlists[4]; - const WordList &keywords6 = *keywordlists[5]; - const WordList &keywords7 = *keywordlists[6]; - const WordList &keywords8 = *keywordlists[7]; - - // Accepts accented characters - CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); - CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true); - // Not exactly following number definition (several dots are seen as OK, etc.) - // but probably enough in most cases. [pP] is for hex floats. - CharacterSet setNumber(CharacterSet::setDigits, ".-+abcdefpABCDEFP"); - CharacterSet setExponent(CharacterSet::setNone, "eEpP"); - CharacterSet setLuaOperator(CharacterSet::setNone, "*/-+()={}~[];<>,.^%:#&|"); - CharacterSet setEscapeSkip(CharacterSet::setNone, "\"'\\"); - - Sci_Position currentLine = styler.GetLine(startPos); - // Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level, - // 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 nestLevel = 0; - int sepCount = 0; - int stringWs = 0; - if (initStyle == SCE_LUA_LITERALSTRING || initStyle == SCE_LUA_COMMENT || - initStyle == SCE_LUA_STRING || initStyle == SCE_LUA_CHARACTER) { - const int lineState = styler.GetLineState(currentLine - 1); - nestLevel = lineState >> 9; - sepCount = lineState & 0xFF; - stringWs = lineState & 0x100; - } - - // 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 (initStyle == SCE_LUA_STRINGEOL || initStyle == SCE_LUA_COMMENTLINE || initStyle == 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_LITERALSTRING: - case SCE_LUA_COMMENT: - case SCE_LUA_STRING: - case SCE_LUA_CHARACTER: - // Inside a literal string, block comment or string, we set the line state - styler.SetLineState(currentLine, (nestLevel << 9) | 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 == ':') { // :: <label> :: forward scan - sc.Forward(); - Sci_Position ln = 0; - while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs - ln++; - Sci_Position ws1 = ln; - if (setWordStart.Contains(sc.GetRelative(ln))) { - int c, i = 0; - char s[100]; - while (setWord.Contains(c = sc.GetRelative(ln))) { // get potential label - if (i < 90) - s[i++] = static_cast<char>(c); - ln++; - } - s[i] = '\0'; Sci_Position lbl = ln; - if (!keywords.InList(s)) { - while (IsASpaceOrTab(sc.GetRelative(ln))) // skip over spaces/tabs - ln++; - Sci_Position ws2 = ln - lbl; - if (sc.GetRelative(ln) == ':' && sc.GetRelative(ln + 1) == ':') { - // final :: found, complete valid label construct - sc.ChangeState(SCE_LUA_LABEL); - if (ws1) { - sc.SetState(SCE_LUA_DEFAULT); - sc.ForwardBytes(ws1); - } - sc.SetState(SCE_LUA_LABEL); - sc.ForwardBytes(lbl - ws1); - if (ws2) { - sc.SetState(SCE_LUA_DEFAULT); - sc.ForwardBytes(ws2); - } - sc.SetState(SCE_LUA_LABEL); - sc.ForwardBytes(2); - } - } - } - } - sc.SetState(SCE_LUA_DEFAULT); - } else if (sc.state == SCE_LUA_NUMBER) { - // We stop the number definition on non-numerical non-dot non-eEpP non-sign non-hexdigit char - if (!setNumber.Contains(sc.ch)) { - sc.SetState(SCE_LUA_DEFAULT); - } else if (sc.ch == '-' || sc.ch == '+') { - if (!setExponent.Contains(sc.chPrev)) - sc.SetState(SCE_LUA_DEFAULT); - } - } else if (sc.state == SCE_LUA_IDENTIFIER) { - idenPos--; // commit already-scanned identitier/word parts - if (idenWordPos > 0) { - idenWordPos--; - sc.ChangeState(idenStyle); - sc.ForwardBytes(idenWordPos); - idenPos -= idenWordPos; - if (idenPos > 0) { - sc.SetState(SCE_LUA_IDENTIFIER); - sc.ForwardBytes(idenPos); - } - } else { - sc.ForwardBytes(idenPos); - } - sc.SetState(SCE_LUA_DEFAULT); - if (foundGoto) { // goto <label> forward scan - while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd) - sc.Forward(); - if (setWordStart.Contains(sc.ch)) { - sc.SetState(SCE_LUA_LABEL); - sc.Forward(); - while (setWord.Contains(sc.ch)) - sc.Forward(); - char s[100]; - sc.GetCurrent(s, sizeof(s)); - if (keywords.InList(s)) // labels cannot be keywords - sc.ChangeState(SCE_LUA_WORD); - } - sc.SetState(SCE_LUA_DEFAULT); - } - } else if (sc.state == SCE_LUA_COMMENTLINE || sc.state == SCE_LUA_PREPROCESSOR) { - if (sc.atLineEnd) { - sc.ForwardSetState(SCE_LUA_DEFAULT); - } - } else if (sc.state == SCE_LUA_STRING) { - if (stringWs) { - if (!IsASpace(sc.ch)) - stringWs = 0; - } - if (sc.ch == '\\') { - if (setEscapeSkip.Contains(sc.chNext)) { - sc.Forward(); - } else if (sc.chNext == 'z') { - sc.Forward(); - stringWs = 0x100; - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_LUA_DEFAULT); - } else if (stringWs == 0 && sc.atLineEnd) { - sc.ChangeState(SCE_LUA_STRINGEOL); - sc.ForwardSetState(SCE_LUA_DEFAULT); - } - } else if (sc.state == SCE_LUA_CHARACTER) { - if (stringWs) { - if (!IsASpace(sc.ch)) - stringWs = 0; - } - if (sc.ch == '\\') { - if (setEscapeSkip.Contains(sc.chNext)) { - sc.Forward(); - } else if (sc.chNext == 'z') { - sc.Forward(); - stringWs = 0x100; - } - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_LUA_DEFAULT); - } else if (stringWs == 0 && sc.atLineEnd) { - sc.ChangeState(SCE_LUA_STRINGEOL); - sc.ForwardSetState(SCE_LUA_DEFAULT); - } - } else if (sc.state == SCE_LUA_LITERALSTRING || sc.state == SCE_LUA_COMMENT) { - if (sc.ch == '[') { - const int sep = LongDelimCheck(sc); - if (sep == 1 && sepCount == 1) { // [[-only allowed to nest - nestLevel++; - sc.Forward(); - } - } else if (sc.ch == ']') { - int sep = LongDelimCheck(sc); - if (sep == 1 && sepCount == 1) { // un-nest with ]]-only - nestLevel--; - sc.Forward(); - if (nestLevel == 0) { - sc.ForwardSetState(SCE_LUA_DEFAULT); - } - } else if (sep > 1 && sep == sepCount) { // ]=]-style delim - sc.Forward(sep); - sc.ForwardSetState(SCE_LUA_DEFAULT); - } - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_LUA_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_LUA_NUMBER); - if (sc.ch == '0' && toupper(sc.chNext) == 'X') { - sc.Forward(); - } - } else if (setWordStart.Contains(sc.ch)) { - // For matching various identifiers with dots and colons, multiple - // matches are done as identifier segments are added. Longest match is - // set to a word style. The non-matched part is in identifier style. - std::string ident; - idenPos = 0; - idenWordPos = 0; - idenStyle = SCE_LUA_IDENTIFIER; - foundGoto = false; - int cNext; - do { - int c; - const Sci_Position idenPosOld = idenPos; - std::string identSeg; - identSeg += static_cast<char>(sc.GetRelative(idenPos++)); - while (setWord.Contains(c = sc.GetRelative(idenPos))) { - identSeg += static_cast<char>(c); - idenPos++; - } - if (keywords.InList(identSeg.c_str()) && (idenPosOld > 0)) { - idenPos = idenPosOld - 1; // keywords cannot mix - ident.pop_back(); - break; - } - ident += identSeg; - const char* s = ident.c_str(); - int newStyle = SCE_LUA_IDENTIFIER; - if (keywords.InList(s)) { - newStyle = SCE_LUA_WORD; - } else if (keywords2.InList(s)) { - newStyle = SCE_LUA_WORD2; - } else if (keywords3.InList(s)) { - newStyle = SCE_LUA_WORD3; - } else if (keywords4.InList(s)) { - newStyle = SCE_LUA_WORD4; - } else if (keywords5.InList(s)) { - newStyle = SCE_LUA_WORD5; - } else if (keywords6.InList(s)) { - newStyle = SCE_LUA_WORD6; - } else if (keywords7.InList(s)) { - newStyle = SCE_LUA_WORD7; - } else if (keywords8.InList(s)) { - newStyle = SCE_LUA_WORD8; - } - if (newStyle != SCE_LUA_IDENTIFIER) { - idenStyle = newStyle; - idenWordPos = idenPos; - } - if (idenStyle == SCE_LUA_WORD) // keywords cannot mix - break; - cNext = sc.GetRelative(idenPos + 1); - if ((c == '.' || c == ':') && setWordStart.Contains(cNext)) { - ident += static_cast<char>(c); - idenPos++; - } else { - cNext = 0; - } - } while (cNext); - if ((idenStyle == SCE_LUA_WORD) && (ident.compare("goto") == 0)) { - foundGoto = true; - } - sc.SetState(SCE_LUA_IDENTIFIER); - } else if (sc.ch == '\"') { - sc.SetState(SCE_LUA_STRING); - stringWs = 0; - } else if (sc.ch == '\'') { - sc.SetState(SCE_LUA_CHARACTER); - stringWs = 0; - } else if (sc.ch == '[') { - sepCount = LongDelimCheck(sc); - if (sepCount == 0) { - sc.SetState(SCE_LUA_OPERATOR); - } else { - nestLevel = 1; - sc.SetState(SCE_LUA_LITERALSTRING); - sc.Forward(sepCount); - } - } else if (sc.Match('-', '-')) { - sc.SetState(SCE_LUA_COMMENTLINE); - if (sc.Match("--[")) { - sc.Forward(2); - sepCount = LongDelimCheck(sc); - if (sepCount > 0) { - nestLevel = 1; - sc.ChangeState(SCE_LUA_COMMENT); - sc.Forward(sepCount); - } - } else { - sc.Forward(); - } - } else if (sc.atLineStart && sc.Match('$')) { - sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code - } else if (setLuaOperator.Contains(sc.ch)) { - sc.SetState(SCE_LUA_OPERATOR); - } - } - } - - sc.Complete(); -} - -static void FoldLuaDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[], - Accessor &styler) { - const 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]; - const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - int styleNext = styler.StyleAt(startPos); - - for (Sci_PositionU i = startPos; i < lengthDoc; i++) { - const char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - const int style = styleNext; - styleNext = styler.StyleAt(i + 1); - const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (style == SCE_LUA_WORD) { - if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') { - char s[10] = ""; - for (Sci_PositionU j = 0; j < 8; j++) { - if (!iswordchar(styler[i + j])) { - break; - } - s[j] = styler[i + j]; - s[j + 1] = '\0'; - } - - if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0) || (strcmp(s, "repeat") == 0)) { - levelCurrent++; - } - if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0) || (strcmp(s, "until") == 0)) { - levelCurrent--; - } - } - } else if (style == SCE_LUA_OPERATOR) { - if (ch == '{' || ch == '(') { - levelCurrent++; - } else if (ch == '}' || ch == ')') { - levelCurrent--; - } - } else if (style == SCE_LUA_LITERALSTRING || style == SCE_LUA_COMMENT) { - 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 luaWordListDesc[] = { - "Keywords", - "Basic functions", - "String, (table) & math functions", - "(coroutines), I/O & system facilities", - "user1", - "user2", - "user3", - "user4", - 0 -}; - -namespace { - -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 -- Not used in Lua (yet?)", - 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", -}; - -} - -LexerModule lmLua(SCLEX_LUA, ColouriseLuaDoc, "lua", FoldLuaDoc, luaWordListDesc, lexicalClasses, ELEMENTS(lexicalClasses)); diff --git a/lexers/LexMMIXAL.cxx b/lexers/LexMMIXAL.cxx deleted file mode 100644 index 1e0552075..000000000 --- a/lexers/LexMMIXAL.cxx +++ /dev/null @@ -1,183 +0,0 @@ -// Scintilla source code edit control -// Encoding: UTF-8 -/** @file LexMMIXAL.cxx - ** Lexer for MMIX Assembler Language. - ** Written by Christoph Hösler <christoph.hoesler@student.uni-tuebingen.de> - ** For information about MMIX visit http://www-cs-faculty.stanford.edu/~knuth/mmix.html - **/ -// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - - -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == ':' || ch == '_'); -} - -static inline bool isMMIXALOperator(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 == ']') - return true; - return false; -} - -static void ColouriseMMIXALDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - - WordList &opcodes = *keywordlists[0]; - WordList &special_register = *keywordlists[1]; - WordList &predef_symbols = *keywordlists[2]; - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) - { - // No EOL continuation - if (sc.atLineStart) { - if (sc.ch == '@' && sc.chNext == 'i') { - sc.SetState(SCE_MMIXAL_INCLUDE); - } else { - sc.SetState(SCE_MMIXAL_LEADWS); - } - } - - // Check if first non whitespace character in line is alphanumeric - if (sc.state == SCE_MMIXAL_LEADWS && !isspace(sc.ch)) { // LEADWS - if(!IsAWordChar(sc.ch)) { - sc.SetState(SCE_MMIXAL_COMMENT); - } else { - if(sc.atLineStart) { - sc.SetState(SCE_MMIXAL_LABEL); - } else { - sc.SetState(SCE_MMIXAL_OPCODE_PRE); - } - } - } - - // Determine if the current state should terminate. - if (sc.state == SCE_MMIXAL_OPERATOR) { // OPERATOR - sc.SetState(SCE_MMIXAL_OPERANDS); - } else if (sc.state == SCE_MMIXAL_NUMBER) { // NUMBER - if (!isdigit(sc.ch)) { - if (IsAWordChar(sc.ch)) { - sc.ChangeState(SCE_MMIXAL_REF); - sc.SetState(SCE_MMIXAL_REF); - } else { - sc.SetState(SCE_MMIXAL_OPERANDS); - } - } - } else if (sc.state == SCE_MMIXAL_LABEL) { // LABEL - if (!IsAWordChar(sc.ch) ) { - sc.SetState(SCE_MMIXAL_OPCODE_PRE); - } - } else if (sc.state == SCE_MMIXAL_REF) { // REF - if (!IsAWordChar(sc.ch) ) { - char s0[100]; - sc.GetCurrent(s0, sizeof(s0)); - const char *s = s0; - if (*s == ':') { // ignore base prefix for match - ++s; - } - if (special_register.InList(s)) { - sc.ChangeState(SCE_MMIXAL_REGISTER); - } else if (predef_symbols.InList(s)) { - sc.ChangeState(SCE_MMIXAL_SYMBOL); - } - sc.SetState(SCE_MMIXAL_OPERANDS); - } - } else if (sc.state == SCE_MMIXAL_OPCODE_PRE) { // OPCODE_PRE - if (!isspace(sc.ch)) { - sc.SetState(SCE_MMIXAL_OPCODE); - } - } else if (sc.state == SCE_MMIXAL_OPCODE) { // OPCODE - if (!IsAWordChar(sc.ch) ) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - if (opcodes.InList(s)) { - sc.ChangeState(SCE_MMIXAL_OPCODE_VALID); - } else { - sc.ChangeState(SCE_MMIXAL_OPCODE_UNKNOWN); - } - sc.SetState(SCE_MMIXAL_OPCODE_POST); - } - } else if (sc.state == SCE_MMIXAL_STRING) { // STRING - if (sc.ch == '\"') { - sc.ForwardSetState(SCE_MMIXAL_OPERANDS); - } else if (sc.atLineEnd) { - sc.ForwardSetState(SCE_MMIXAL_OPERANDS); - } - } else if (sc.state == SCE_MMIXAL_CHAR) { // CHAR - if (sc.ch == '\'') { - sc.ForwardSetState(SCE_MMIXAL_OPERANDS); - } else if (sc.atLineEnd) { - sc.ForwardSetState(SCE_MMIXAL_OPERANDS); - } - } else if (sc.state == SCE_MMIXAL_REGISTER) { // REGISTER - if (!isdigit(sc.ch)) { - sc.SetState(SCE_MMIXAL_OPERANDS); - } - } else if (sc.state == SCE_MMIXAL_HEX) { // HEX - if (!isxdigit(sc.ch)) { - sc.SetState(SCE_MMIXAL_OPERANDS); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_MMIXAL_OPCODE_POST || // OPCODE_POST - sc.state == SCE_MMIXAL_OPERANDS) { // OPERANDS - if (sc.state == SCE_MMIXAL_OPERANDS && isspace(sc.ch)) { - sc.SetState(SCE_MMIXAL_COMMENT); - } else if (isdigit(sc.ch)) { - sc.SetState(SCE_MMIXAL_NUMBER); - } else if (IsAWordChar(sc.ch) || sc.Match('@')) { - sc.SetState(SCE_MMIXAL_REF); - } else if (sc.Match('\"')) { - sc.SetState(SCE_MMIXAL_STRING); - } else if (sc.Match('\'')) { - sc.SetState(SCE_MMIXAL_CHAR); - } else if (sc.Match('$')) { - sc.SetState(SCE_MMIXAL_REGISTER); - } else if (sc.Match('#')) { - sc.SetState(SCE_MMIXAL_HEX); - } else if (isMMIXALOperator(static_cast<char>(sc.ch))) { - sc.SetState(SCE_MMIXAL_OPERATOR); - } - } - } - sc.Complete(); -} - -static const char * const MMIXALWordListDesc[] = { - "Operation Codes", - "Special Register", - "Predefined Symbols", - 0 -}; - -LexerModule lmMMIXAL(SCLEX_MMIXAL, ColouriseMMIXALDoc, "mmixal", 0, MMIXALWordListDesc); - diff --git a/lexers/LexMPT.cxx b/lexers/LexMPT.cxx deleted file mode 100644 index 0f5469840..000000000 --- a/lexers/LexMPT.cxx +++ /dev/null @@ -1,191 +0,0 @@ -// Scintilla source code edit control -/** @file LexMPT.cxx - ** Lexer for MPT specific files. Based on LexOthers.cxx - ** LOT = the text log file created by the MPT application while running a test program - ** Other MPT specific files to be added later. - **/ -// Copyright 2003 by Marius Gheorghe <mgheorghe@cabletest.com> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> - -#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 Scintilla; - -static int GetLotLineState(std::string &line) { - if (line.length()) { - // Most of the time the first non-blank character in line determines that line's type - // Now finds the first non-blank character - unsigned i; // Declares counter here to make it persistent after the for loop - for (i = 0; i < line.length(); ++i) { - if (!(IsASCII(line[i]) && isspace(line[i]))) - break; - } - - // Checks if it was a blank line - if (i == line.length()) - return SCE_LOT_DEFAULT; - - switch (line[i]) { - case '*': // Fail measurement - return SCE_LOT_FAIL; - - case '+': // Header - case '|': // Header - return SCE_LOT_HEADER; - - case ':': // Set test limits - return SCE_LOT_SET; - - case '-': // Section break - return SCE_LOT_BREAK; - - default: // Any other line - // Checks for message at the end of lot file - if (line.find("PASSED") != std::string::npos) { - return SCE_LOT_PASS; - } - else if (line.find("FAILED") != std::string::npos) { - return SCE_LOT_FAIL; - } - else if (line.find("ABORTED") != std::string::npos) { - return SCE_LOT_ABORT; - } - else { - return i ? SCE_LOT_PASS : SCE_LOT_DEFAULT; - } - } - } - else { - return SCE_LOT_DEFAULT; - } -} - -static void ColourizeLotDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - styler.StartAt(startPos); - styler.StartSegment(startPos); - bool atLineStart = true;// Arms the 'at line start' flag - char chNext = styler.SafeGetCharAt(startPos); - std::string line(""); - line.reserve(256); // Lot lines are less than 256 chars long most of the time. This should avoid reallocations - - // Styles LOT document - Sci_PositionU i; // Declared here because it's used after the for loop - for (i = startPos; i < startPos + length; ++i) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - line += ch; - atLineStart = false; - - // LOT files are only used on the Win32 platform, thus EOL == CR+LF - // Searches for the end of line - if (ch == '\r' && chNext == '\n') { - line += chNext; // Gets the '\n' - ++i; // Advances past the '\n' - chNext = styler.SafeGetCharAt(i + 1); // Gets character of next line - styler.ColourTo(i, GetLotLineState(line)); - line = ""; - atLineStart = true; // Arms flag for next line - } - } - - // Last line may not have a line ending - if (!atLineStart) { - styler.ColourTo(i - 1, GetLotLineState(line)); - } -} - -// Folds an MPT LOT file: the blocks that can be folded are: -// sections (headed by a set line) -// passes (contiguous pass results within a section) -// fails (contiguous fail results within a section) -static void FoldLotDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - bool foldCompact = styler.GetPropertyInt("fold.compact", 0) != 0; - Sci_PositionU endPos = startPos + length; - int visibleChars = 0; - Sci_Position lineCurrent = styler.GetLine(startPos); - - char chNext = styler.SafeGetCharAt(startPos); - int style = SCE_LOT_DEFAULT; - int styleNext = styler.StyleAt(startPos); - int lev = SC_FOLDLEVELBASE; - - // Gets style of previous line if not at the beginning of the document - if (startPos > 1) - style = styler.StyleAt(startPos - 2); - - for (Sci_PositionU i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if (ch == '\r' && chNext == '\n') { - // TO DO: - // Should really get the state of the previous line from the styler - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 2); - - switch (style) { -/* - case SCE_LOT_SET: - lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; - break; -*/ - case SCE_LOT_FAIL: -/* - if (stylePrev != SCE_LOT_FAIL) - lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; - else - lev = SC_FOLDLEVELBASE + 1; -*/ - lev = SC_FOLDLEVELBASE; - break; - - default: - if (lineCurrent == 0 || stylePrev == SCE_LOT_FAIL) - lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; - else - lev = SC_FOLDLEVELBASE + 1; - - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - break; - } - - if (lev != styler.LevelAt(lineCurrent)) - styler.SetLevel(lineCurrent, lev); - - lineCurrent++; - visibleChars = 0; - } - - if (!isspacechar(ch)) - visibleChars++; - } - - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, lev | flagsNext); -} - -static const char * const emptyWordListDesc[] = { - 0 -}; - -LexerModule lmLot(SCLEX_LOT, ColourizeLotDoc, "lot", FoldLotDoc, emptyWordListDesc); diff --git a/lexers/LexMSSQL.cxx b/lexers/LexMSSQL.cxx deleted file mode 100644 index a06ff32c3..000000000 --- a/lexers/LexMSSQL.cxx +++ /dev/null @@ -1,352 +0,0 @@ -// Scintilla source code edit control -/** @file LexMSSQL.cxx - ** Lexer for MSSQL. - **/ -// By Filip Yaghob <fyaghob@gmail.com> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -#define KW_MSSQL_STATEMENTS 0 -#define KW_MSSQL_DATA_TYPES 1 -#define KW_MSSQL_SYSTEM_TABLES 2 -#define KW_MSSQL_GLOBAL_VARIABLES 3 -#define KW_MSSQL_FUNCTIONS 4 -#define KW_MSSQL_STORED_PROCEDURES 5 -#define KW_MSSQL_OPERATORS 6 - -static char classifyWordSQL(Sci_PositionU start, - Sci_PositionU end, - WordList *keywordlists[], - Accessor &styler, - unsigned int actualState, - unsigned int prevState) { - char s[256]; - bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.'); - - WordList &kwStatements = *keywordlists[KW_MSSQL_STATEMENTS]; - WordList &kwDataTypes = *keywordlists[KW_MSSQL_DATA_TYPES]; - WordList &kwSystemTables = *keywordlists[KW_MSSQL_SYSTEM_TABLES]; - WordList &kwGlobalVariables = *keywordlists[KW_MSSQL_GLOBAL_VARIABLES]; - WordList &kwFunctions = *keywordlists[KW_MSSQL_FUNCTIONS]; - WordList &kwStoredProcedures = *keywordlists[KW_MSSQL_STORED_PROCEDURES]; - WordList &kwOperators = *keywordlists[KW_MSSQL_OPERATORS]; - - for (Sci_PositionU i = 0; i < end - start + 1 && i < 128; i++) { - s[i] = static_cast<char>(tolower(styler[start + i])); - s[i + 1] = '\0'; - } - char chAttr = SCE_MSSQL_IDENTIFIER; - - if (actualState == SCE_MSSQL_GLOBAL_VARIABLE) { - - if (kwGlobalVariables.InList(&s[2])) - chAttr = SCE_MSSQL_GLOBAL_VARIABLE; - - } else if (wordIsNumber) { - chAttr = SCE_MSSQL_NUMBER; - - } else if (prevState == SCE_MSSQL_DEFAULT_PREF_DATATYPE) { - // Look first in datatypes - if (kwDataTypes.InList(s)) - chAttr = SCE_MSSQL_DATATYPE; - else if (kwOperators.InList(s)) - chAttr = SCE_MSSQL_OPERATOR; - else if (kwStatements.InList(s)) - chAttr = SCE_MSSQL_STATEMENT; - else if (kwSystemTables.InList(s)) - chAttr = SCE_MSSQL_SYSTABLE; - else if (kwFunctions.InList(s)) - chAttr = SCE_MSSQL_FUNCTION; - else if (kwStoredProcedures.InList(s)) - chAttr = SCE_MSSQL_STORED_PROCEDURE; - - } else { - if (kwOperators.InList(s)) - chAttr = SCE_MSSQL_OPERATOR; - else if (kwStatements.InList(s)) - chAttr = SCE_MSSQL_STATEMENT; - else if (kwSystemTables.InList(s)) - chAttr = SCE_MSSQL_SYSTABLE; - else if (kwFunctions.InList(s)) - chAttr = SCE_MSSQL_FUNCTION; - else if (kwStoredProcedures.InList(s)) - chAttr = SCE_MSSQL_STORED_PROCEDURE; - else if (kwDataTypes.InList(s)) - chAttr = SCE_MSSQL_DATATYPE; - } - - styler.ColourTo(end, chAttr); - - return chAttr; -} - -static void ColouriseMSSQLDoc(Sci_PositionU startPos, Sci_Position length, - int initStyle, WordList *keywordlists[], Accessor &styler) { - - - styler.StartAt(startPos); - - bool fold = styler.GetPropertyInt("fold") != 0; - Sci_Position lineCurrent = styler.GetLine(startPos); - int spaceFlags = 0; - - int state = initStyle; - int prevState = initStyle; - char chPrev = ' '; - char chNext = styler[startPos]; - styler.StartSegment(startPos); - Sci_PositionU lengthDoc = startPos + length; - for (Sci_PositionU i = startPos; i < lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if ((ch == '\r' && chNext != '\n') || (ch == '\n')) { - int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags); - int lev = indentCurrent; - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - // Only non whitespace lines can be headers - int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags); - if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - if (fold) { - styler.SetLevel(lineCurrent, lev); - } - } - - if (styler.IsLeadByte(ch)) { - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - // When the last char isn't part of the state (have to deal with it too)... - if ( (state == SCE_MSSQL_IDENTIFIER) || - (state == SCE_MSSQL_STORED_PROCEDURE) || - (state == SCE_MSSQL_DATATYPE) || - //~ (state == SCE_MSSQL_COLUMN_NAME) || - (state == SCE_MSSQL_FUNCTION) || - //~ (state == SCE_MSSQL_GLOBAL_VARIABLE) || - (state == SCE_MSSQL_VARIABLE)) { - if (!iswordchar(ch)) { - int stateTmp; - - if ((state == SCE_MSSQL_VARIABLE) || (state == SCE_MSSQL_COLUMN_NAME)) { - styler.ColourTo(i - 1, state); - stateTmp = state; - } else - stateTmp = classifyWordSQL(styler.GetStartSegment(), i - 1, keywordlists, styler, state, prevState); - - prevState = state; - - if (stateTmp == SCE_MSSQL_IDENTIFIER || stateTmp == SCE_MSSQL_VARIABLE) - state = SCE_MSSQL_DEFAULT_PREF_DATATYPE; - else - state = SCE_MSSQL_DEFAULT; - } - } else if (state == SCE_MSSQL_LINE_COMMENT) { - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, state); - prevState = state; - state = SCE_MSSQL_DEFAULT; - } - } else if (state == SCE_MSSQL_GLOBAL_VARIABLE) { - if ((ch != '@') && !iswordchar(ch)) { - classifyWordSQL(styler.GetStartSegment(), i - 1, keywordlists, styler, state, prevState); - prevState = state; - state = SCE_MSSQL_DEFAULT; - } - } - - // If is the default or one of the above succeeded - if (state == SCE_MSSQL_DEFAULT || state == SCE_MSSQL_DEFAULT_PREF_DATATYPE) { - if (iswordstart(ch)) { - styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT); - prevState = state; - state = SCE_MSSQL_IDENTIFIER; - } else if (ch == '/' && chNext == '*') { - styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT); - prevState = state; - state = SCE_MSSQL_COMMENT; - } else if (ch == '-' && chNext == '-') { - styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT); - prevState = state; - state = SCE_MSSQL_LINE_COMMENT; - } else if (ch == '\'') { - styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT); - prevState = state; - state = SCE_MSSQL_STRING; - } else if (ch == '"') { - styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT); - prevState = state; - state = SCE_MSSQL_COLUMN_NAME; - } else if (ch == '[') { - styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT); - prevState = state; - state = SCE_MSSQL_COLUMN_NAME_2; - } else if (isoperator(ch)) { - styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT); - styler.ColourTo(i, SCE_MSSQL_OPERATOR); - //~ style = SCE_MSSQL_DEFAULT; - prevState = state; - state = SCE_MSSQL_DEFAULT; - } else if (ch == '@') { - styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT); - prevState = state; - if (chNext == '@') { - state = SCE_MSSQL_GLOBAL_VARIABLE; -// i += 2; - } else - state = SCE_MSSQL_VARIABLE; - } - - - // When the last char is part of the state... - } else if (state == SCE_MSSQL_COMMENT) { - if (ch == '/' && chPrev == '*') { - if (((i > (styler.GetStartSegment() + 2)) || ((initStyle == SCE_MSSQL_COMMENT) && - (styler.GetStartSegment() == startPos)))) { - styler.ColourTo(i, state); - //~ state = SCE_MSSQL_COMMENT; - prevState = state; - state = SCE_MSSQL_DEFAULT; - } - } - } else if (state == SCE_MSSQL_STRING) { - if (ch == '\'') { - if ( chNext == '\'' ) { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } else { - styler.ColourTo(i, state); - prevState = state; - state = SCE_MSSQL_DEFAULT; - //i++; - } - //ch = chNext; - //chNext = styler.SafeGetCharAt(i + 1); - } - } else if (state == SCE_MSSQL_COLUMN_NAME) { - if (ch == '"') { - if (chNext == '"') { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } else { - styler.ColourTo(i, state); - prevState = state; - state = SCE_MSSQL_DEFAULT_PREF_DATATYPE; - //i++; - } - } - } else if (state == SCE_MSSQL_COLUMN_NAME_2) { - if (ch == ']') { - styler.ColourTo(i, state); - prevState = state; - state = SCE_MSSQL_DEFAULT_PREF_DATATYPE; - //i++; - } - } - - chPrev = ch; - } - styler.ColourTo(lengthDoc - 1, state); -} - -static void FoldMSSQLDoc(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_MSSQL_COMMENT); - char s[10] = ""; - 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'); - // Comment folding - if (foldComment) { - if (!inComment && (style == SCE_MSSQL_COMMENT)) - levelCurrent++; - else if (inComment && (style != SCE_MSSQL_COMMENT)) - levelCurrent--; - inComment = (style == SCE_MSSQL_COMMENT); - } - if (style == SCE_MSSQL_STATEMENT) { - // Folding between begin or case and end - if (ch == 'b' || ch == 'B' || ch == 'c' || ch == 'C' || ch == 'e' || ch == 'E') { - for (Sci_PositionU j = 0; j < 5; j++) { - if (!iswordchar(styler[i + j])) { - break; - } - s[j] = static_cast<char>(tolower(styler[i + j])); - s[j + 1] = '\0'; - } - if ((strcmp(s, "begin") == 0) || (strcmp(s, "case") == 0)) { - levelCurrent++; - } - if (strcmp(s, "end") == 0) { - 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 sqlWordListDesc[] = { - "Statements", - "Data Types", - "System tables", - "Global variables", - "Functions", - "System Stored Procedures", - "Operators", - 0, -}; - -LexerModule lmMSSQL(SCLEX_MSSQL, ColouriseMSSQLDoc, "mssql", FoldMSSQLDoc, sqlWordListDesc); diff --git a/lexers/LexMagik.cxx b/lexers/LexMagik.cxx deleted file mode 100644 index 89459d6a4..000000000 --- a/lexers/LexMagik.cxx +++ /dev/null @@ -1,446 +0,0 @@ -// Scintilla source code edit control -/** - * @file LexMagik.cxx - * Lexer for GE(r) Smallworld(tm) MagikSF - */ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -/** - * Is it a core character (C isalpha(), exclamation and question mark) - * - * \param ch The character - * \return True if ch is a character, False otherwise - */ -static inline bool IsAlphaCore(int ch) { - return (isalpha(ch) || ch == '!' || ch == '?'); -} - -/** - * Is it a character (IsAlphaCore() and underscore) - * - * \param ch The character - * \return True if ch is a character, False otherwise - */ -static inline bool IsAlpha(int ch) { - return (IsAlphaCore(ch) || ch == '_'); -} - -/** - * Is it a symbolic character (IsAlpha() and colon) - * - * \param ch The character - * \return True if ch is a character, False otherwise - */ -static inline bool IsAlphaSym(int ch) { - return (IsAlpha(ch) || ch == ':'); -} - -/** - * Is it a numerical character (IsAlpha() and 0 - 9) - * - * \param ch The character - * \return True if ch is a character, False otherwise - */ -static inline bool IsAlNum(int ch) { - return ((ch >= '0' && ch <= '9') || IsAlpha(ch)); -} - -/** - * Is it a symbolic numerical character (IsAlNum() and colon) - * - * \param ch The character - * \return True if ch is a character, False otherwise - */ -static inline bool IsAlNumSym(int ch) { - return (IsAlNum(ch) || ch == ':'); -} - -/** - * The lexer function - * - * \param startPos Where to start scanning - * \param length Where to scan to - * \param initStyle The style at the initial point, not used in this folder - * \param keywordlists The keywordslists, currently, number 5 is used - * \param styler The styler - */ -static void ColouriseMagikDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - styler.StartAt(startPos); - - WordList &keywords = *keywordlists[0]; - WordList &pragmatics = *keywordlists[1]; - WordList &containers = *keywordlists[2]; - WordList &flow = *keywordlists[3]; - WordList &characters = *keywordlists[4]; - - StyleContext sc(startPos, length, initStyle, styler); - - - for (; sc.More(); sc.Forward()) { - - repeat: - - if(sc.ch == '#') { - if (sc.chNext == '#') sc.SetState(SCE_MAGIK_HYPER_COMMENT); - else sc.SetState(SCE_MAGIK_COMMENT); - for(; sc.More() && !(sc.atLineEnd); sc.Forward()); - sc.SetState(SCE_MAGIK_DEFAULT); - goto repeat; - } - - if(sc.ch == '"') { - sc.SetState(SCE_MAGIK_STRING); - - if(sc.More()) - { - sc.Forward(); - for(; sc.More() && sc.ch != '"'; sc.Forward()); - } - - sc.ForwardSetState(SCE_MAGIK_DEFAULT); - goto repeat; - } - - // The default state - if(sc.state == SCE_MAGIK_DEFAULT) { - - // A certain keyword has been detected - if (sc.ch == '_' && ( - sc.currentPos == 0 || !IsAlNum(sc.chPrev))) { - char keyword[50]; - memset(keyword, '\0', 50); - - for( - int scanPosition = 0; - scanPosition < 50; - scanPosition++) { - char keywordChar = static_cast<char>( - tolower(styler.SafeGetCharAt( - scanPosition + - static_cast<Sci_Position>(sc.currentPos+1), ' '))); - if(IsAlpha(keywordChar)) { - keyword[scanPosition] = keywordChar; - } else { - break; - } - } - - // It is a pragma - if(pragmatics.InList(keyword)) { - sc.SetState(SCE_MAGIK_PRAGMA); - } - - // it is a normal keyword like _local, _self, etc. - else if(keywords.InList(keyword)) { - sc.SetState(SCE_MAGIK_KEYWORD); - } - - // It is a container keyword, such as _method, _proc, etc. - else if(containers.InList(keyword)) { - sc.SetState(SCE_MAGIK_CONTAINER); - } - - // It is a flow keyword, such as _for, _if, _try, etc. - else if(flow.InList(keyword)) { - sc.SetState(SCE_MAGIK_FLOW); - } - - // Interpret as unknown keyword - else { - sc.SetState(SCE_MAGIK_UNKNOWN_KEYWORD); - } - } - - // Symbolic expression - else if(sc.ch == ':' && !IsAlNum(sc.chPrev)) { - sc.SetState(SCE_MAGIK_SYMBOL); - bool firstTrip = true; - for(sc.Forward(); sc.More(); sc.Forward()) { - if(firstTrip && IsAlphaSym(sc.ch)); - else if(!firstTrip && IsAlNumSym(sc.ch)); - else if(sc.ch == '|') { - for(sc.Forward(); - sc.More() && sc.ch != '|'; - sc.Forward()); - } - else break; - - firstTrip = false; - } - sc.SetState(SCE_MAGIK_DEFAULT); - goto repeat; - } - - // Identifier (label) expression - else if(sc.ch == '@') { - sc.SetState(SCE_MAGIK_IDENTIFIER); - bool firstTrip = true; - for(sc.Forward(); sc.More(); sc.Forward()) { - if(firstTrip && IsAlphaCore(sc.ch)) { - firstTrip = false; - } - else if(!firstTrip && IsAlpha(sc.ch)); - else break; - } - sc.SetState(SCE_MAGIK_DEFAULT); - goto repeat; - } - - // Start of a character - else if(sc.ch == '%') { - sc.SetState(SCE_MAGIK_CHARACTER); - sc.Forward(); - char keyword[50]; - memset(keyword, '\0', 50); - - for( - int scanPosition = 0; - scanPosition < 50; - scanPosition++) { - char keywordChar = static_cast<char>( - tolower(styler.SafeGetCharAt( - scanPosition + - static_cast<int>(sc.currentPos), ' '))); - if(IsAlpha(keywordChar)) { - keyword[scanPosition] = keywordChar; - } else { - break; - } - } - - if(characters.InList(keyword)) { - sc.Forward(static_cast<int>(strlen(keyword))); - } else { - sc.Forward(); - } - - sc.SetState(SCE_MAGIK_DEFAULT); - goto repeat; - } - - // Operators - 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.SetState(SCE_MAGIK_OPERATOR); - } - - // Braces - else if(sc.ch == '(' || sc.ch == ')') { - sc.SetState(SCE_MAGIK_BRACE_BLOCK); - } - - // Brackets - else if(sc.ch == '{' || sc.ch == '}') { - sc.SetState(SCE_MAGIK_BRACKET_BLOCK); - } - - // Square Brackets - else if(sc.ch == '[' || sc.ch == ']') { - sc.SetState(SCE_MAGIK_SQBRACKET_BLOCK); - } - - - } - - // It is an operator - else if( - sc.state == SCE_MAGIK_OPERATOR || - sc.state == SCE_MAGIK_BRACE_BLOCK || - sc.state == SCE_MAGIK_BRACKET_BLOCK || - sc.state == SCE_MAGIK_SQBRACKET_BLOCK) { - sc.SetState(SCE_MAGIK_DEFAULT); - goto repeat; - } - - // It is the pragma state - else if(sc.state == SCE_MAGIK_PRAGMA) { - if(!IsAlpha(sc.ch)) { - sc.SetState(SCE_MAGIK_DEFAULT); - goto repeat; - } - } - - // It is the keyword state - else if( - sc.state == SCE_MAGIK_KEYWORD || - sc.state == SCE_MAGIK_CONTAINER || - sc.state == SCE_MAGIK_FLOW || - sc.state == SCE_MAGIK_UNKNOWN_KEYWORD) { - if(!IsAlpha(sc.ch)) { - sc.SetState(SCE_MAGIK_DEFAULT); - goto repeat; - } - } - } - - sc.Complete(); -} - -/** - * The word list description - */ -static const char * const magikWordListDesc[] = { - "Accessors (local, global, self, super, thisthread)", - "Pragmatic (pragma, private)", - "Containers (method, block, proc)", - "Flow (if, then, elif, else)", - "Characters (space, tab, newline, return)", - "Fold Containers (method, proc, block, if, loop)", - 0}; - -/** - * This function detects keywords which are able to have a body. Note that it - * uses the Fold Containers word description, not the containers description. It - * only works when the style at that particular position is set on Containers - * or Flow (number 3 or 4). - * - * \param keywordslist The list of keywords that are scanned, they should only - * contain the start keywords, not the end keywords - * \param keyword The actual keyword - * \return 1 if it is a folding start-keyword, -1 if it is a folding end-keyword - * 0 otherwise - */ -static inline int IsFoldingContainer(WordList &keywordslist, char * keyword) { - if( - strlen(keyword) > 3 && - keyword[0] == 'e' && keyword[1] == 'n' && keyword[2] == 'd') { - if (keywordslist.InList(keyword + 3)) { - return -1; - } - - } else { - if(keywordslist.InList(keyword)) { - return 1; - } - } - - return 0; -} - -/** - * The folding function - * - * \param startPos Where to start scanning - * \param length Where to scan to - * \param keywordslists The keywordslists, currently, number 5 is used - * \param styler The styler - */ -static void FoldMagikDoc(Sci_PositionU startPos, Sci_Position length, int, - WordList *keywordslists[], Accessor &styler) { - - bool compact = styler.GetPropertyInt("fold.compact") != 0; - - WordList &foldingElements = *keywordslists[5]; - Sci_Position endPos = startPos + length; - Sci_Position line = styler.GetLine(startPos); - int level = styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK; - int flags = styler.LevelAt(line) & ~SC_FOLDLEVELNUMBERMASK; - - for( - Sci_Position currentPos = startPos; - currentPos < endPos; - currentPos++) { - char currentState = styler.StyleAt(currentPos); - char c = styler.SafeGetCharAt(currentPos, ' '); - Sci_Position prevLine = styler.GetLine(currentPos - 1); - line = styler.GetLine(currentPos); - - // Default situation - if(prevLine < line) { - styler.SetLevel(line, (level|flags) & ~SC_FOLDLEVELHEADERFLAG); - flags = styler.LevelAt(line) & ~SC_FOLDLEVELNUMBERMASK; - } - - if( - ( - currentState == SCE_MAGIK_CONTAINER || - currentState == SCE_MAGIK_FLOW - ) && - c == '_') { - - char keyword[50]; - memset(keyword, '\0', 50); - - for( - int scanPosition = 0; - scanPosition < 50; - scanPosition++) { - char keywordChar = static_cast<char>( - tolower(styler.SafeGetCharAt( - scanPosition + - currentPos + 1, ' '))); - if(IsAlpha(keywordChar)) { - keyword[scanPosition] = keywordChar; - } else { - break; - } - } - - if(IsFoldingContainer(foldingElements, keyword) > 0) { - styler.SetLevel( - line, - styler.LevelAt(line) | SC_FOLDLEVELHEADERFLAG); - level++; - } else if(IsFoldingContainer(foldingElements, keyword) < 0) { - styler.SetLevel(line, styler.LevelAt(line)); - level--; - } - } - - if( - compact && ( - currentState == SCE_MAGIK_BRACE_BLOCK || - currentState == SCE_MAGIK_BRACKET_BLOCK || - currentState == SCE_MAGIK_SQBRACKET_BLOCK)) { - if(c == '{' || c == '[' || c == '(') { - styler.SetLevel( - line, - styler.LevelAt(line) | SC_FOLDLEVELHEADERFLAG); - level++; - } else if(c == '}' || c == ']' || c == ')') { - styler.SetLevel(line, styler.LevelAt(line)); - level--; - } - } - } - -} - -/** - * Injecting the module - */ -LexerModule lmMagikSF( - SCLEX_MAGIK, ColouriseMagikDoc, "magiksf", FoldMagikDoc, magikWordListDesc); - diff --git a/lexers/LexMake.cxx b/lexers/LexMake.cxx deleted file mode 100644 index b3dc12aa1..000000000 --- a/lexers/LexMake.cxx +++ /dev/null @@ -1,142 +0,0 @@ -// Scintilla source code edit control -/** @file LexMake.cxx - ** Lexer for make files. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { - return (styler[i] == '\n') || - ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); -} - -static void ColouriseMakeLine( - char *lineBuffer, - Sci_PositionU lengthLine, - Sci_PositionU startLine, - Sci_PositionU endPos, - Accessor &styler) { - - Sci_PositionU i = 0; - Sci_Position lastNonSpace = -1; - unsigned int state = SCE_MAKE_DEFAULT; - bool bSpecial = false; - - // check for a tab character in column 0 indicating a command - bool bCommand = false; - if ((lengthLine > 0) && (lineBuffer[0] == '\t')) - bCommand = true; - - // Skip initial spaces - while ((i < lengthLine) && isspacechar(lineBuffer[i])) { - i++; - } - if (i < lengthLine) { - if (lineBuffer[i] == '#') { // Comment - styler.ColourTo(endPos, SCE_MAKE_COMMENT); - return; - } - if (lineBuffer[i] == '!') { // Special directive - styler.ColourTo(endPos, SCE_MAKE_PREPROCESSOR); - return; - } - } - int varCount = 0; - while (i < lengthLine) { - if (((i + 1) < lengthLine) && (lineBuffer[i] == '$' && lineBuffer[i + 1] == '(')) { - styler.ColourTo(startLine + i - 1, state); - state = SCE_MAKE_IDENTIFIER; - varCount++; - } else if (state == SCE_MAKE_IDENTIFIER && lineBuffer[i] == ')') { - if (--varCount == 0) { - styler.ColourTo(startLine + i, state); - state = SCE_MAKE_DEFAULT; - } - } - - // skip identifier and target styling if this is a command line - if (!bSpecial && !bCommand) { - if (lineBuffer[i] == ':') { - if (((i + 1) < lengthLine) && (lineBuffer[i + 1] == '=')) { - // it's a ':=', so style as an identifier - if (lastNonSpace >= 0) - styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER); - styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); - styler.ColourTo(startLine + i + 1, SCE_MAKE_OPERATOR); - } else { - // We should check that no colouring was made since the beginning of the line, - // to avoid colouring stuff like /OUT:file - if (lastNonSpace >= 0) - styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_TARGET); - styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); - styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR); - } - bSpecial = true; // Only react to the first ':' of the line - state = SCE_MAKE_DEFAULT; - } else if (lineBuffer[i] == '=') { - if (lastNonSpace >= 0) - styler.ColourTo(startLine + lastNonSpace, SCE_MAKE_IDENTIFIER); - styler.ColourTo(startLine + i - 1, SCE_MAKE_DEFAULT); - styler.ColourTo(startLine + i, SCE_MAKE_OPERATOR); - bSpecial = true; // Only react to the first '=' of the line - state = SCE_MAKE_DEFAULT; - } - } - if (!isspacechar(lineBuffer[i])) { - lastNonSpace = i; - } - i++; - } - if (state == SCE_MAKE_IDENTIFIER) { - styler.ColourTo(endPos, SCE_MAKE_IDEOL); // Error, variable reference not ended - } else { - styler.ColourTo(endPos, SCE_MAKE_DEFAULT); - } -} - -static void ColouriseMakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - char lineBuffer[1024]; - styler.StartAt(startPos); - styler.StartSegment(startPos); - Sci_PositionU linePos = 0; - Sci_PositionU startLine = startPos; - for (Sci_PositionU i = startPos; i < startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { - // End of line (or of line buffer) met, colourise it - lineBuffer[linePos] = '\0'; - ColouriseMakeLine(lineBuffer, linePos, startLine, i, styler); - linePos = 0; - startLine = i + 1; - } - } - if (linePos > 0) { // Last line does not have ending characters - ColouriseMakeLine(lineBuffer, linePos, startLine, startPos + length - 1, styler); - } -} - -static const char *const emptyWordListDesc[] = { - 0 -}; - -LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc); diff --git a/lexers/LexMarkdown.cxx b/lexers/LexMarkdown.cxx deleted file mode 100644 index e3410f6ca..000000000 --- a/lexers/LexMarkdown.cxx +++ /dev/null @@ -1,419 +0,0 @@ -/****************************************************************** - * LexMarkdown.cxx - * - * A simple Markdown lexer for scintilla. - * - * Includes highlighting for some extra features from the - * Pandoc implementation; strikeout, using '#.' as a default - * ordered list item marker, and delimited code blocks. - * - * Limitations: - * - * Standard indented code blocks are not highlighted at all, - * as it would conflict with other indentation schemes. Use - * delimited code blocks for blanket highlighting of an - * entire code block. Embedded HTML is not highlighted either. - * Blanket HTML highlighting has issues, because some Markdown - * implementations allow Markdown markup inside of the HTML. Also, - * there is a following blank line issue that can't be ignored, - * explained in the next paragraph. Embedded HTML and code - * blocks would be better supported with language specific - * highlighting. - * - * The highlighting aims to accurately reflect correct syntax, - * but a few restrictions are relaxed. Delimited code blocks are - * highlighted, even if the line following the code block is not blank. - * Requiring a blank line after a block, breaks the highlighting - * in certain cases, because of the way Scintilla ends up calling - * the lexer. - * - * Written by Jon Strait - jstrait@moonloop.net - * - * The License.txt file describes the conditions under which this - * software may be distributed. - * - *****************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> - -#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 Scintilla; - -static inline bool IsNewline(const int ch) { - return (ch == '\n' || ch == '\r'); -} - -// True if can follow ch down to the end with possibly trailing whitespace -static bool FollowToLineEnd(const int ch, const int state, const Sci_PositionU endPos, StyleContext &sc) { - Sci_PositionU i = 0; - while (sc.GetRelative(++i) == ch) - ; - // Skip over whitespace - while (IsASpaceOrTab(sc.GetRelative(i)) && sc.currentPos + i < endPos) - ++i; - if (IsNewline(sc.GetRelative(i)) || sc.currentPos + i == endPos) { - sc.Forward(i); - sc.ChangeState(state); - sc.SetState(SCE_MARKDOWN_LINE_BEGIN); - return true; - } - else return false; -} - -// Set the state on text section from current to length characters, -// then set the rest until the newline to default, except for any characters matching token -static void SetStateAndZoom(const int state, const Sci_Position length, const int token, StyleContext &sc) { - sc.SetState(state); - sc.Forward(length); - sc.SetState(SCE_MARKDOWN_DEFAULT); - sc.Forward(); - bool started = false; - while (sc.More() && !IsNewline(sc.ch)) { - if (sc.ch == token && !started) { - sc.SetState(state); - started = true; - } - else if (sc.ch != token) { - sc.SetState(SCE_MARKDOWN_DEFAULT); - started = false; - } - sc.Forward(); - } - sc.SetState(SCE_MARKDOWN_LINE_BEGIN); -} - -// Does the previous line have more than spaces and tabs? -static bool HasPrevLineContent(StyleContext &sc) { - Sci_Position i = 0; - // Go back to the previous newline - while ((--i + (Sci_Position)sc.currentPos) >= 0 && !IsNewline(sc.GetRelative(i))) - ; - while ((--i + (Sci_Position)sc.currentPos) >= 0) { - if (IsNewline(sc.GetRelative(i))) - break; - if (!IsASpaceOrTab(sc.GetRelative(i))) - return true; - } - return false; -} - -static bool AtTermStart(StyleContext &sc) { - return sc.currentPos == 0 || sc.chPrev == 0 || isspacechar(sc.chPrev); -} - -static bool IsValidHrule(const Sci_PositionU endPos, StyleContext &sc) { - int count = 1; - Sci_PositionU i = 0; - for (;;) { - ++i; - int c = sc.GetRelative(i); - if (c == sc.ch) - ++count; - // hit a terminating character - else if (!IsASpaceOrTab(c) || sc.currentPos + i == endPos) { - // Are we a valid HRULE - if ((IsNewline(c) || sc.currentPos + i == endPos) && - count >= 3 && !HasPrevLineContent(sc)) { - sc.SetState(SCE_MARKDOWN_HRULE); - sc.Forward(i); - sc.SetState(SCE_MARKDOWN_LINE_BEGIN); - return true; - } - else { - sc.SetState(SCE_MARKDOWN_DEFAULT); - return false; - } - } - } -} - -static void ColorizeMarkdownDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList **, Accessor &styler) { - Sci_PositionU endPos = startPos + length; - int precharCount = 0; - bool isLinkNameDetecting = false; - // Don't advance on a new loop iteration and retry at the same position. - // Useful in the corner case of having to start at the beginning file position - // in the default state. - bool freezeCursor = false; - - StyleContext sc(startPos, length, initStyle, styler); - - while (sc.More()) { - // Skip past escaped characters - if (sc.ch == '\\') { - sc.Forward(); - continue; - } - - // A blockquotes resets the line semantics - if (sc.state == SCE_MARKDOWN_BLOCKQUOTE) - sc.SetState(SCE_MARKDOWN_LINE_BEGIN); - - // Conditional state-based actions - if (sc.state == SCE_MARKDOWN_CODE2) { - if (sc.Match("``") && sc.GetRelative(-2) != ' ') { - sc.Forward(2); - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - } - else if (sc.state == SCE_MARKDOWN_CODE) { - if (sc.ch == '`' && sc.chPrev != ' ') - sc.ForwardSetState(SCE_MARKDOWN_DEFAULT); - } - /* De-activated because it gets in the way of other valid indentation - * schemes, for example multiple paragraphs inside a list item. - // Code block - else if (sc.state == SCE_MARKDOWN_CODEBK) { - bool d = true; - if (IsNewline(sc.ch)) { - if (sc.chNext != '\t') { - for (int c = 1; c < 5; ++c) { - if (sc.GetRelative(c) != ' ') - d = false; - } - } - } - else if (sc.atLineStart) { - if (sc.ch != '\t' ) { - for (int i = 0; i < 4; ++i) { - if (sc.GetRelative(i) != ' ') - d = false; - } - } - } - if (!d) - sc.SetState(SCE_MARKDOWN_LINE_BEGIN); - } - */ - // Strong - else if (sc.state == SCE_MARKDOWN_STRONG1) { - if (sc.Match("**") && sc.chPrev != ' ') { - sc.Forward(2); - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - } - else if (sc.state == SCE_MARKDOWN_STRONG2) { - if (sc.Match("__") && sc.chPrev != ' ') { - sc.Forward(2); - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - } - // Emphasis - else if (sc.state == SCE_MARKDOWN_EM1) { - if (sc.ch == '*' && sc.chPrev != ' ') - sc.ForwardSetState(SCE_MARKDOWN_DEFAULT); - } - else if (sc.state == SCE_MARKDOWN_EM2) { - if (sc.ch == '_' && sc.chPrev != ' ') - sc.ForwardSetState(SCE_MARKDOWN_DEFAULT); - } - else if (sc.state == SCE_MARKDOWN_CODEBK) { - if (sc.atLineStart && sc.Match("~~~")) { - Sci_Position i = 1; - while (!IsNewline(sc.GetRelative(i)) && sc.currentPos + i < endPos) - i++; - sc.Forward(i); - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - } - else if (sc.state == SCE_MARKDOWN_STRIKEOUT) { - if (sc.Match("~~") && sc.chPrev != ' ') { - sc.Forward(2); - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - } - else if (sc.state == SCE_MARKDOWN_LINE_BEGIN) { - // Header - if (sc.Match("######")) - SetStateAndZoom(SCE_MARKDOWN_HEADER6, 6, '#', sc); - else if (sc.Match("#####")) - SetStateAndZoom(SCE_MARKDOWN_HEADER5, 5, '#', sc); - else if (sc.Match("####")) - SetStateAndZoom(SCE_MARKDOWN_HEADER4, 4, '#', sc); - else if (sc.Match("###")) - SetStateAndZoom(SCE_MARKDOWN_HEADER3, 3, '#', sc); - else if (sc.Match("##")) - SetStateAndZoom(SCE_MARKDOWN_HEADER2, 2, '#', sc); - else if (sc.Match("#")) { - // Catch the special case of an unordered list - if (sc.chNext == '.' && IsASpaceOrTab(sc.GetRelative(2))) { - precharCount = 0; - sc.SetState(SCE_MARKDOWN_PRECHAR); - } - else - SetStateAndZoom(SCE_MARKDOWN_HEADER1, 1, '#', sc); - } - // Code block - else if (sc.Match("~~~")) { - if (!HasPrevLineContent(sc)) - sc.SetState(SCE_MARKDOWN_CODEBK); - else - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - else if (sc.ch == '=') { - if (HasPrevLineContent(sc) && FollowToLineEnd('=', SCE_MARKDOWN_HEADER1, endPos, sc)) - ; - else - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - else if (sc.ch == '-') { - if (HasPrevLineContent(sc) && FollowToLineEnd('-', SCE_MARKDOWN_HEADER2, endPos, sc)) - ; - else { - precharCount = 0; - sc.SetState(SCE_MARKDOWN_PRECHAR); - } - } - else if (IsNewline(sc.ch)) - sc.SetState(SCE_MARKDOWN_LINE_BEGIN); - else { - precharCount = 0; - sc.SetState(SCE_MARKDOWN_PRECHAR); - } - } - - // The header lasts until the newline - else if (sc.state == SCE_MARKDOWN_HEADER1 || sc.state == SCE_MARKDOWN_HEADER2 || - sc.state == SCE_MARKDOWN_HEADER3 || sc.state == SCE_MARKDOWN_HEADER4 || - sc.state == SCE_MARKDOWN_HEADER5 || sc.state == SCE_MARKDOWN_HEADER6) { - if (IsNewline(sc.ch)) - sc.SetState(SCE_MARKDOWN_LINE_BEGIN); - } - - // New state only within the initial whitespace - if (sc.state == SCE_MARKDOWN_PRECHAR) { - // Blockquote - if (sc.ch == '>' && precharCount < 5) - sc.SetState(SCE_MARKDOWN_BLOCKQUOTE); - /* - // Begin of code block - else if (!HasPrevLineContent(sc) && (sc.chPrev == '\t' || precharCount >= 4)) - sc.SetState(SCE_MARKDOWN_CODEBK); - */ - // HRule - Total of three or more hyphens, asterisks, or underscores - // on a line by themselves - else if ((sc.ch == '-' || sc.ch == '*' || sc.ch == '_') && IsValidHrule(endPos, sc)) - ; - // Unordered list - else if ((sc.ch == '-' || sc.ch == '*' || sc.ch == '+') && IsASpaceOrTab(sc.chNext)) { - sc.SetState(SCE_MARKDOWN_ULIST_ITEM); - sc.ForwardSetState(SCE_MARKDOWN_DEFAULT); - } - // Ordered list - else if (IsADigit(sc.ch)) { - int digitCount = 0; - while (IsADigit(sc.GetRelative(++digitCount))) - ; - if (sc.GetRelative(digitCount) == '.' && - IsASpaceOrTab(sc.GetRelative(digitCount + 1))) { - sc.SetState(SCE_MARKDOWN_OLIST_ITEM); - sc.Forward(digitCount + 1); - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - } - // Alternate Ordered list - else if (sc.ch == '#' && sc.chNext == '.' && IsASpaceOrTab(sc.GetRelative(2))) { - sc.SetState(SCE_MARKDOWN_OLIST_ITEM); - sc.Forward(2); - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - else if (sc.ch != ' ' || precharCount > 2) - sc.SetState(SCE_MARKDOWN_DEFAULT); - else - ++precharCount; - } - - // Any link - if (sc.state == SCE_MARKDOWN_LINK) { - if (sc.Match("](") && sc.GetRelative(-1) != '\\') { - sc.Forward(2); - isLinkNameDetecting = true; - } - else if (sc.Match("]:") && sc.GetRelative(-1) != '\\') { - sc.Forward(2); - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - else if (!isLinkNameDetecting && sc.ch == ']' && sc.GetRelative(-1) != '\\') { - sc.Forward(); - sc.SetState(SCE_MARKDOWN_DEFAULT); - } - else if (isLinkNameDetecting && sc.ch == ')' && sc.GetRelative(-1) != '\\') { - sc.Forward(); - sc.SetState(SCE_MARKDOWN_DEFAULT); - isLinkNameDetecting = false; - } - } - - // New state anywhere in doc - if (sc.state == SCE_MARKDOWN_DEFAULT) { - if (sc.atLineStart && sc.ch == '#') { - sc.SetState(SCE_MARKDOWN_LINE_BEGIN); - freezeCursor = true; - } - // Links and Images - if (sc.Match("![")) { - sc.SetState(SCE_MARKDOWN_LINK); - sc.Forward(2); - } - else if (sc.ch == '[' && sc.GetRelative(-1) != '\\') { - sc.SetState(SCE_MARKDOWN_LINK); - sc.Forward(); - } - // Code - also a special case for alternate inside spacing - else if (sc.Match("``") && sc.GetRelative(3) != ' ' && AtTermStart(sc)) { - sc.SetState(SCE_MARKDOWN_CODE2); - sc.Forward(); - } - else if (sc.ch == '`' && sc.chNext != ' ' && AtTermStart(sc)) { - sc.SetState(SCE_MARKDOWN_CODE); - } - // Strong - else if (sc.Match("**") && sc.GetRelative(2) != ' ' && AtTermStart(sc)) { - sc.SetState(SCE_MARKDOWN_STRONG1); - sc.Forward(); - } - else if (sc.Match("__") && sc.GetRelative(2) != ' ' && AtTermStart(sc)) { - sc.SetState(SCE_MARKDOWN_STRONG2); - sc.Forward(); - } - // Emphasis - else if (sc.ch == '*' && sc.chNext != ' ' && AtTermStart(sc)) { - sc.SetState(SCE_MARKDOWN_EM1); - } - else if (sc.ch == '_' && sc.chNext != ' ' && AtTermStart(sc)) { - sc.SetState(SCE_MARKDOWN_EM2); - } - // Strikeout - else if (sc.Match("~~") && sc.GetRelative(2) != ' ' && AtTermStart(sc)) { - sc.SetState(SCE_MARKDOWN_STRIKEOUT); - sc.Forward(); - } - // Beginning of line - else if (IsNewline(sc.ch)) { - sc.SetState(SCE_MARKDOWN_LINE_BEGIN); - } - } - // Advance if not holding back the cursor for this iteration. - if (!freezeCursor) - sc.Forward(); - freezeCursor = false; - } - sc.Complete(); -} - -LexerModule lmMarkdown(SCLEX_MARKDOWN, ColorizeMarkdownDoc, "markdown"); diff --git a/lexers/LexMatlab.cxx b/lexers/LexMatlab.cxx deleted file mode 100644 index 3d08c9a33..000000000 --- a/lexers/LexMatlab.cxx +++ /dev/null @@ -1,389 +0,0 @@ -// Scintilla source code edit control -// Encoding: UTF-8 -/** @file LexMatlab.cxx - ** Lexer for Matlab. - ** Written by José Fonseca - ** - ** Changes by Christoph Dalitz 2003/12/04: - ** - added support for Octave - ** - Strings can now be included both in single or double quotes - ** - ** Changes by John Donoghue 2012/04/02 - ** - added block comment (and nested block comments) - ** - added ... displayed as a comment - ** - removed unused IsAWord functions - ** - added some comments - ** - ** Changes by John Donoghue 2014/08/01 - ** - fix allowed transpose ' after {} operator - ** - ** Changes by John Donoghue 2016/11/15 - ** - update matlab code folding - ** - ** Changes by John Donoghue 2017/01/18 - ** - update matlab block comment detection - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static bool IsMatlabCommentChar(int c) { - return (c == '%') ; -} - -static bool IsOctaveCommentChar(int c) { - return (c == '%' || c == '#') ; -} - -static inline int LowerCase(int c) { - if (c >= 'A' && c <= 'Z') - return 'a' + c - 'A'; - return c; -} - -static int CheckKeywordFoldPoint(char *str) { - if (strcmp ("if", str) == 0 || - strcmp ("for", str) == 0 || - strcmp ("switch", str) == 0 || - strcmp ("while", str) == 0 || - strcmp ("try", str) == 0 || - strcmp ("do", str) == 0 || - strcmp ("parfor", str) == 0 || - strcmp ("function", str) == 0) - return 1; - if (strncmp("end", str, 3) == 0 || - strcmp("until", str) == 0) - return -1; - return 0; -} - -static bool IsSpaceToEOL(Sci_Position startPos, Accessor &styler) { - Sci_Position line = styler.GetLine(startPos); - Sci_Position eol_pos = styler.LineStart(line + 1) - 1; - for (Sci_Position i = startPos; i < eol_pos; i++) { - char ch = styler[i]; - if(!IsASpace(ch)) return false; - } - return true; -} - -static void ColouriseMatlabOctaveDoc( - Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler, - bool (*IsCommentChar)(int), - bool ismatlab) { - - WordList &keywords = *keywordlists[0]; - - styler.StartAt(startPos); - - // boolean for when the ' is allowed to be transpose vs the start/end - // of a string - bool transpose = false; - - // count of brackets as boolean for when end could be an operator not a keyword - int allow_end_op = 0; - - // approximate position of first non space character in a line - int nonSpaceColumn = -1; - // approximate column position of the current character in a line - int column = 0; - - // use the line state of each line to store the block comment depth - Sci_Position curLine = styler.GetLine(startPos); - int commentDepth = curLine > 0 ? styler.GetLineState(curLine-1) : 0; - - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward(), column++) { - - if(sc.atLineStart) { - // set the line state to the current commentDepth - curLine = styler.GetLine(sc.currentPos); - styler.SetLineState(curLine, commentDepth); - - // reset the column to 0, nonSpace to -1 (not set) - column = 0; - nonSpaceColumn = -1; - } - - // save the column position of first non space character in a line - if((nonSpaceColumn == -1) && (! IsASpace(sc.ch))) - { - nonSpaceColumn = column; - } - - // check for end of states - if (sc.state == SCE_MATLAB_OPERATOR) { - if (sc.chPrev == '.') { - if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' || sc.ch == '^') { - sc.ForwardSetState(SCE_MATLAB_DEFAULT); - transpose = false; - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_MATLAB_DEFAULT); - transpose = true; - } else if(sc.ch == '.' && sc.chNext == '.') { - // we werent an operator, but a '...' - sc.ChangeState(SCE_MATLAB_COMMENT); - transpose = false; - } else { - sc.SetState(SCE_MATLAB_DEFAULT); - } - } else { - sc.SetState(SCE_MATLAB_DEFAULT); - } - } else if (sc.state == SCE_MATLAB_KEYWORD) { - if (!isalnum(sc.ch) && sc.ch != '_') { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - - if (keywords.InList(s)) { - if (strcmp ("end", s) == 0 && allow_end_op) { - sc.ChangeState(SCE_MATLAB_NUMBER); - } - sc.SetState(SCE_MATLAB_DEFAULT); - transpose = false; - } else { - sc.ChangeState(SCE_MATLAB_IDENTIFIER); - sc.SetState(SCE_MATLAB_DEFAULT); - transpose = true; - } - } - } else if (sc.state == SCE_MATLAB_NUMBER) { - if (!isdigit(sc.ch) && sc.ch != '.' - && !(sc.ch == 'e' || sc.ch == 'E') - && !((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E'))) { - sc.SetState(SCE_MATLAB_DEFAULT); - transpose = true; - } - } else if (sc.state == SCE_MATLAB_STRING) { - if (sc.ch == '\'') { - if (sc.chNext == '\'') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_MATLAB_DEFAULT); - } - } - } else if (sc.state == SCE_MATLAB_DOUBLEQUOTESTRING) { - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_MATLAB_DEFAULT); - } - } else if (sc.state == SCE_MATLAB_COMMAND) { - if (sc.atLineEnd) { - sc.SetState(SCE_MATLAB_DEFAULT); - transpose = false; - } - } else if (sc.state == SCE_MATLAB_COMMENT) { - // end or start of a nested a block comment? - if( IsCommentChar(sc.ch) && sc.chNext == '}' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler)) { - if(commentDepth > 0) commentDepth --; - - curLine = styler.GetLine(sc.currentPos); - styler.SetLineState(curLine, commentDepth); - sc.Forward(); - - if (commentDepth == 0) { - sc.ForwardSetState(SCE_D_DEFAULT); - transpose = false; - } - } - else if( IsCommentChar(sc.ch) && sc.chNext == '{' && nonSpaceColumn == column && IsSpaceToEOL(sc.currentPos+2, styler)) - { - commentDepth ++; - - curLine = styler.GetLine(sc.currentPos); - styler.SetLineState(curLine, commentDepth); - sc.Forward(); - transpose = false; - - } else if(commentDepth == 0) { - // single line comment - if (sc.atLineEnd || sc.ch == '\r' || sc.ch == '\n') { - sc.SetState(SCE_MATLAB_DEFAULT); - transpose = false; - } - } - } - - // check start of a new state - if (sc.state == SCE_MATLAB_DEFAULT) { - if (IsCommentChar(sc.ch)) { - // ncrement depth if we are a block comment - if(sc.chNext == '{' && nonSpaceColumn == column) { - if(IsSpaceToEOL(sc.currentPos+2, styler)) { - commentDepth ++; - } - } - curLine = styler.GetLine(sc.currentPos); - styler.SetLineState(curLine, commentDepth); - sc.SetState(SCE_MATLAB_COMMENT); - } else if (sc.ch == '!' && sc.chNext != '=' ) { - if(ismatlab) { - sc.SetState(SCE_MATLAB_COMMAND); - } else { - sc.SetState(SCE_MATLAB_OPERATOR); - } - } else if (sc.ch == '\'') { - if (transpose) { - sc.SetState(SCE_MATLAB_OPERATOR); - } else { - sc.SetState(SCE_MATLAB_STRING); - } - } else if (sc.ch == '"') { - sc.SetState(SCE_MATLAB_DOUBLEQUOTESTRING); - } else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) { - sc.SetState(SCE_MATLAB_NUMBER); - } else if (isalpha(sc.ch)) { - sc.SetState(SCE_MATLAB_KEYWORD); - } else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '@' || sc.ch == '\\') { - if (sc.ch == '(' || sc.ch == '[' || sc.ch == '{') { - allow_end_op ++; - } else if ((sc.ch == ')' || sc.ch == ']' || sc.ch == '}') && (allow_end_op > 0)) { - allow_end_op --; - } - - if (sc.ch == ')' || sc.ch == ']' || sc.ch == '}') { - transpose = true; - } else { - transpose = false; - } - sc.SetState(SCE_MATLAB_OPERATOR); - } else { - transpose = false; - } - } - } - sc.Complete(); -} - -static void ColouriseMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar, true); -} - -static void ColouriseOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar, false); -} - -static void FoldMatlabOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *[], Accessor &styler, - bool (*IsComment)(int ch)) { - - if (styler.GetPropertyInt("fold") == 0) - return; - - const bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - - 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; - 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 = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - // a line that starts with a comment - if (foldComment && style == SCE_MATLAB_COMMENT && IsComment(ch) && visibleChars == 0) { - // start/end of block comment - if (chNext == '{' && IsSpaceToEOL(i+2, styler)) - levelNext ++; - if (chNext == '}' && IsSpaceToEOL(i+2, styler)) - levelNext --; - } - // keyword - if(style == SCE_MATLAB_KEYWORD) { - word[wordlen++] = static_cast<char>(LowerCase(ch)); - if (wordlen == 100) { // prevent overflow - word[0] = '\0'; - wordlen = 1; - } - if (styleNext != SCE_MATLAB_KEYWORD) { - word[wordlen] = '\0'; - wordlen = 0; - - levelNext += CheckKeywordFoldPoint(word); - } - } - if (!IsASpace(ch)) - visibleChars++; - if (atEOL || (i == endPos-1)) { - 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); - } - lineCurrent++; - levelCurrent = levelNext; - if (atEOL && (i == static_cast<Sci_PositionU>(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; - } - } -} - -static void FoldMatlabDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar); -} - -static void FoldOctaveDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar); -} - -static const char * const matlabWordListDesc[] = { - "Keywords", - 0 -}; - -static const char * const octaveWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmMatlab(SCLEX_MATLAB, ColouriseMatlabDoc, "matlab", FoldMatlabDoc, matlabWordListDesc); - -LexerModule lmOctave(SCLEX_OCTAVE, ColouriseOctaveDoc, "octave", FoldOctaveDoc, octaveWordListDesc); diff --git a/lexers/LexMaxima.cxx b/lexers/LexMaxima.cxx deleted file mode 100644 index 4897c995e..000000000 --- a/lexers/LexMaxima.cxx +++ /dev/null @@ -1,222 +0,0 @@ -// Scintilla source code edit control -/** @file LexMaxima.cxx - ** Lexer for Maxima (http://maxima.sourceforge.net). - ** Written by Gunter Königsmann based on the lisp lexer by Alexey Yutkin and Neil Hodgson . - **/ -// Copyright 2018 by Gunter Königsmann <wxMaxima@physikbuch.de> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool isMaximaoperator(char ch) { - return (ch == '\'' || ch == '`' || ch == '(' || - ch == ')' || ch == '[' || ch == ']' || - ch == '{' || ch == '}' || ch == '!' || - ch == '*' || ch == '/' || ch == '^' || - ch == ',' || ch == ':' || ch == '+' || - ch == '-'); -} - -static void ColouriseMaximaDoc(Sci_PositionU startPos, Sci_Position length, int lastStyle, - WordList *[], - Accessor &styler) { - - styler.StartAt(startPos); - - Sci_PositionU lengthDoc = startPos + length; - styler.StartSegment(startPos); - - Sci_PositionU i = startPos; - - // If we are in the middle of a comment we go back to its start before highlighting - if(lastStyle == SCE_MAXIMA_COMMENT) - { - while((i>0) && - !((styler.SafeGetCharAt(i+1) == '*') && (styler.SafeGetCharAt(i) == '/'))) - i--; - } - - for (; i < lengthDoc; i++) { - char ch = styler.SafeGetCharAt(i); - char chNext = styler.SafeGetCharAt(i + 1); - - if (styler.IsLeadByte(ch)) - continue; - - // Handle comments. - // Comments start with /* and end with */ - if((ch == '/') && (chNext == '*')) - { - i++;i++; - - chNext = styler.SafeGetCharAt(i); - for (; i < lengthDoc; i++) - { - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - if((ch == '*') && (chNext == '/')) - { - i++; - i++; - break; - } - } - if(i > lengthDoc) - i = lengthDoc; - i--; - styler.ColourTo(i, SCE_MAXIMA_COMMENT); - continue; - } - - // Handle Operators - if(isMaximaoperator(ch)) - { - styler.ColourTo(i, SCE_MAXIMA_OPERATOR); - continue; - } - - // Handle command endings. - if((ch == '$') || (ch == ';')) - { - styler.ColourTo(i, SCE_MAXIMA_COMMANDENDING); - continue; - } - - // Handle numbers. Numbers always begin with a digit. - if(IsASCII(ch) && isdigit(ch)) - { - i++; - for (; i < lengthDoc; i++) - { - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if(ch == '.') - continue; - - // A "e" or similar can be followed by a "+" or a "-" - if(((ch == 'e') || (ch == 'b') || (ch == 'g') || (ch == 'f')) && - ((chNext == '+') || (chNext == '-'))) - { - i++; - chNext = styler.SafeGetCharAt(i + 1); - continue; - } - - if(!IsASCII(ch) || !(isdigit(ch) || islower(ch) || isupper(ch))) - { - i--; - break; - } - } - styler.ColourTo(i, SCE_MAXIMA_NUMBER); - continue; - } - - // Handle strings - if(ch == '\"') - { - i++; - for (; i < lengthDoc; i++) - { - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - if(ch == '\\') - i++; - else - { - if(ch == '\"') - break; - } - } - styler.ColourTo(i, SCE_MAXIMA_STRING); - continue; - } - - // Handle keywords. Maxima treats Non-ASCII chars as ordinary letters. - if(((!IsASCII(ch))) || isalpha(ch) || (ch == '_')) - { - char cmd[100]; - int cmdidx = 0; - memset(cmd,0,100); - cmd[cmdidx++] = ch; - i++; - for (; i < lengthDoc; i++) - { - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - if(ch == '\\') - { - if(cmdidx < 99) - cmd[cmdidx++] = ch; - i++; - if(cmdidx < 99) - cmd[cmdidx++] = ch; - continue; - } - if(isMaximaoperator(ch) || ((IsASCII(ch) && !isalpha(ch) && !isdigit(ch) && (ch != '_')))) - { - i--; - break; - } - if(cmdidx < 99) - cmd[cmdidx++] = ch; - } - - // A few known keywords - if( - (strncmp(cmd,"if",99) == 0) || - (strncmp(cmd,"then",99) == 0) || - (strncmp(cmd,"else",99) == 0) || - (strncmp(cmd,"thru",99) == 0) || - (strncmp(cmd,"for",99) == 0) || - (strncmp(cmd,"while",99) == 0) || - (strncmp(cmd,"do",99) == 0) - ) - { - styler.ColourTo(i, SCE_MAXIMA_COMMAND); - continue; - } - - // All other keywords are functions if they are followed - // by an opening parenthesis - char nextNonwhitespace = ' '; - for (Sci_PositionU o = i + 1; o < lengthDoc; o++) - { - nextNonwhitespace = styler.SafeGetCharAt(o); - if(!IsASCII(nextNonwhitespace) || !isspacechar(nextNonwhitespace)) - break; - } - if(nextNonwhitespace == '(') - { - styler.ColourTo(i, SCE_MAXIMA_COMMAND); - } - else - { - styler.ColourTo(i, SCE_MAXIMA_VARIABLE); - } - continue; - } - - styler.ColourTo(i-1, SCE_MAXIMA_UNKNOWN); - } -} - -LexerModule lmMaxima(SCLEX_MAXIMA, ColouriseMaximaDoc, "maxima", 0, 0); diff --git a/lexers/LexMetapost.cxx b/lexers/LexMetapost.cxx deleted file mode 100644 index 6be99f6cb..000000000 --- a/lexers/LexMetapost.cxx +++ /dev/null @@ -1,401 +0,0 @@ -// Scintilla source code edit control - -// @file LexMetapost.cxx - general context conformant metapost coloring scheme -// Author: Hans Hagen - PRAGMA ADE - Hasselt NL - www.pragma-ade.com -// Version: September 28, 2003 -// Modified by instanton: July 10, 2007 -// Folding based on keywordlists[] - -// Copyright: 1998-2003 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -// This lexer is derived from the one written for the texwork environment (1999++) which in -// turn is inspired on texedit (1991++) which finds its roots in wdt (1986). - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// 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 - -// Definitions in SciTEGlobal.properties: -// -// Metapost Highlighting -// -// # Default -// style.metapost.0=fore:#7F7F00 -// # Special -// style.metapost.1=fore:#007F7F -// # Group -// style.metapost.2=fore:#880000 -// # Symbol -// style.metapost.3=fore:#7F7F00 -// # Command -// style.metapost.4=fore:#008800 -// # Text -// style.metapost.5=fore:#000000 - -// lexer.tex.comment.process=0 - -// Auxiliary functions: - -static inline bool endOfLine(Accessor &styler, Sci_PositionU i) { - return - (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')) ; -} - -static inline bool isMETAPOSTcomment(int ch) { - return - (ch == '%') ; -} - -static inline bool isMETAPOSTone(int ch) { - return - (ch == '[') || (ch == ']') || (ch == '(') || (ch == ')') || - (ch == ':') || (ch == '=') || (ch == '<') || (ch == '>') || - (ch == '{') || (ch == '}') || (ch == '\'') || (ch == '\"') ; -} - -static inline bool isMETAPOSTtwo(int ch) { - return - (ch == ';') || (ch == '$') || (ch == '@') || (ch == '#'); -} - -static inline bool isMETAPOSTthree(int ch) { - return - (ch == '.') || (ch == '-') || (ch == '+') || (ch == '/') || - (ch == '*') || (ch == ',') || (ch == '|') || (ch == '`') || - (ch == '!') || (ch == '?') || (ch == '^') || (ch == '&') || - (ch == '%') ; -} - -static inline bool isMETAPOSTidentifier(int ch) { - return - ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) || - (ch == '_') ; -} - -static inline bool isMETAPOSTnumber(int ch) { - return - (ch >= '0') && (ch <= '9') ; -} - -static inline bool isMETAPOSTstring(int ch) { - return - (ch == '\"') ; -} - -static inline bool isMETAPOSTcolon(int ch) { - return - (ch == ':') ; -} - -static inline bool isMETAPOSTequal(int ch) { - return - (ch == '=') ; -} - -static int CheckMETAPOSTInterface( - Sci_PositionU startPos, - Sci_Position length, - Accessor &styler, - int defaultInterface) { - - char lineBuffer[1024] ; - Sci_PositionU linePos = 0 ; - - // some day we can make something lexer.metapost.mapping=(none,0)(metapost,1)(mp,1)(metafun,2)... - - if (styler.SafeGetCharAt(0) == '%') { - for (Sci_PositionU i = 0; i < startPos + length; i++) { - lineBuffer[linePos++] = styler.SafeGetCharAt(i) ; - if (endOfLine(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { - lineBuffer[linePos] = '\0'; - if (strstr(lineBuffer, "interface=none")) { - return 0 ; - } else if (strstr(lineBuffer, "interface=metapost") || strstr(lineBuffer, "interface=mp")) { - return 1 ; - } else if (strstr(lineBuffer, "interface=metafun")) { - return 2 ; - } else if (styler.SafeGetCharAt(1) == 'D' && strstr(lineBuffer, "%D \\module")) { - // better would be to limit the search to just one line - return 2 ; - } else { - return defaultInterface ; - } - } - } - } - - return defaultInterface ; -} - -static void ColouriseMETAPOSTDoc( - Sci_PositionU startPos, - Sci_Position length, - int, - WordList *keywordlists[], - Accessor &styler) { - - styler.StartAt(startPos) ; - styler.StartSegment(startPos) ; - - bool processComment = styler.GetPropertyInt("lexer.metapost.comment.process", 0) == 1 ; - int defaultInterface = styler.GetPropertyInt("lexer.metapost.interface.default", 1) ; - - int currentInterface = CheckMETAPOSTInterface(startPos,length,styler,defaultInterface) ; - - // 0 no keyword highlighting - // 1 metapost keyword hightlighting - // 2+ metafun keyword hightlighting - - int extraInterface = 0 ; - - if (currentInterface != 0) { - extraInterface = currentInterface ; - } - - WordList &keywords = *keywordlists[0] ; - WordList kwEmpty; - WordList &keywords2 = (extraInterface > 0) ? *keywordlists[extraInterface - 1] : kwEmpty; - - StyleContext sc(startPos, length, SCE_METAPOST_TEXT, styler) ; - - char key[100] ; - - bool inTeX = false ; - bool inComment = false ; - bool inString = false ; - bool inClause = false ; - - bool going = sc.More() ; // needed because of a fuzzy end of file state - - for (; going; sc.Forward()) { - - if (! sc.More()) { going = false ; } // we need to go one behind the end of text - - if (inClause) { - sc.SetState(SCE_METAPOST_TEXT) ; - inClause = false ; - } - - if (inComment) { - if (sc.atLineEnd) { - sc.SetState(SCE_METAPOST_TEXT) ; - inTeX = false ; - inComment = false ; - inClause = false ; - inString = false ; // not correct but we want to stimulate one-lines - } - } else if (inString) { - if (isMETAPOSTstring(sc.ch)) { - sc.SetState(SCE_METAPOST_SPECIAL) ; - sc.ForwardSetState(SCE_METAPOST_TEXT) ; - inString = false ; - } else if (sc.atLineEnd) { - sc.SetState(SCE_METAPOST_TEXT) ; - inTeX = false ; - inComment = false ; - inClause = false ; - inString = false ; // not correct but we want to stimulate one-lines - } - } else { - if ((! isMETAPOSTidentifier(sc.ch)) && (sc.LengthCurrent() > 0)) { - if (sc.state == SCE_METAPOST_COMMAND) { - sc.GetCurrent(key, sizeof(key)) ; - if ((strcmp(key,"btex") == 0) || (strcmp(key,"verbatimtex") == 0)) { - sc.ChangeState(SCE_METAPOST_GROUP) ; - inTeX = true ; - } else if (inTeX) { - if (strcmp(key,"etex") == 0) { - sc.ChangeState(SCE_METAPOST_GROUP) ; - inTeX = false ; - } else { - sc.ChangeState(SCE_METAPOST_TEXT) ; - } - } else { - if (keywords && keywords.InList(key)) { - sc.ChangeState(SCE_METAPOST_COMMAND) ; - } else if (keywords2 && keywords2.InList(key)) { - sc.ChangeState(SCE_METAPOST_EXTRA) ; - } else { - sc.ChangeState(SCE_METAPOST_TEXT) ; - } - } - } - } - if (isMETAPOSTcomment(sc.ch)) { - if (! inTeX) { - sc.SetState(SCE_METAPOST_SYMBOL) ; - sc.ForwardSetState(SCE_METAPOST_DEFAULT) ; - inComment = ! processComment ; - } else { - sc.SetState(SCE_METAPOST_TEXT) ; - } - } else if (isMETAPOSTstring(sc.ch)) { - if (! inTeX) { - sc.SetState(SCE_METAPOST_SPECIAL) ; - if (! isMETAPOSTstring(sc.chNext)) { - sc.ForwardSetState(SCE_METAPOST_TEXT) ; - } - inString = true ; - } else { - sc.SetState(SCE_METAPOST_TEXT) ; - } - } else if (isMETAPOSTcolon(sc.ch)) { - if (! inTeX) { - if (! isMETAPOSTequal(sc.chNext)) { - sc.SetState(SCE_METAPOST_COMMAND) ; - inClause = true ; - } else { - sc.SetState(SCE_METAPOST_SPECIAL) ; - } - } else { - sc.SetState(SCE_METAPOST_TEXT) ; - } - } else if (isMETAPOSTone(sc.ch)) { - if (! inTeX) { - sc.SetState(SCE_METAPOST_SPECIAL) ; - } else { - sc.SetState(SCE_METAPOST_TEXT) ; - } - } else if (isMETAPOSTtwo(sc.ch)) { - if (! inTeX) { - sc.SetState(SCE_METAPOST_GROUP) ; - } else { - sc.SetState(SCE_METAPOST_TEXT) ; - } - } else if (isMETAPOSTthree(sc.ch)) { - if (! inTeX) { - sc.SetState(SCE_METAPOST_SYMBOL) ; - } else { - sc.SetState(SCE_METAPOST_TEXT) ; - } - } else if (isMETAPOSTidentifier(sc.ch)) { - if (sc.state != SCE_METAPOST_COMMAND) { - sc.SetState(SCE_METAPOST_TEXT) ; - sc.ChangeState(SCE_METAPOST_COMMAND) ; - } - } else if (isMETAPOSTnumber(sc.ch)) { - // rather redundant since for the moment we don't handle numbers - sc.SetState(SCE_METAPOST_TEXT) ; - } else if (sc.atLineEnd) { - sc.SetState(SCE_METAPOST_TEXT) ; - inTeX = false ; - inComment = false ; - inClause = false ; - inString = false ; - } else { - sc.SetState(SCE_METAPOST_TEXT) ; - } - } - - } - - sc.Complete(); - -} - -// Hooks info the system: - -static const char * const metapostWordListDesc[] = { - "MetaPost", - "MetaFun", - 0 -} ; - -static int classifyFoldPointMetapost(const char* s,WordList *keywordlists[]) { - WordList& keywordsStart=*keywordlists[3]; - WordList& keywordsStop1=*keywordlists[4]; - - if (keywordsStart.InList(s)) {return 1;} - else if (keywordsStop1.InList(s)) {return -1;} - return 0; - -} - -static int ParseMetapostWord(Sci_PositionU pos, Accessor &styler, char *word) -{ - int length=0; - char ch=styler.SafeGetCharAt(pos); - *word=0; - - while(isMETAPOSTidentifier(ch) && isalpha(ch) && length<100){ - word[length]=ch; - length++; - ch=styler.SafeGetCharAt(pos+length); - } - word[length]=0; - return length; -} - -static void FoldMetapostDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordlists[], 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=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent=levelPrev; - char chNext=styler[startPos]; - - char buffer[100]=""; - - for (Sci_PositionU i=startPos; i < endPos; i++) { - char ch=chNext; - chNext=styler.SafeGetCharAt(i+1); - char chPrev=styler.SafeGetCharAt(i-1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - if(i==0 || chPrev == '\r' || chPrev=='\n'|| chPrev==' '|| chPrev=='(' || chPrev=='$') - { - ParseMetapostWord(i, styler, buffer); - levelCurrent += classifyFoldPointMetapost(buffer,keywordlists); - } - - 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 lmMETAPOST(SCLEX_METAPOST, ColouriseMETAPOSTDoc, "metapost", FoldMetapostDoc, metapostWordListDesc); diff --git a/lexers/LexModula.cxx b/lexers/LexModula.cxx deleted file mode 100644 index af4b8dd1b..000000000 --- a/lexers/LexModula.cxx +++ /dev/null @@ -1,741 +0,0 @@ -// -*- coding: utf-8 -*- -// Scintilla source code edit control -/** - * @file LexModula.cxx - * @author Dariusz "DKnoto" Knociński - * @date 2011/02/03 - * @brief Lexer for Modula-2/3 documents. - */ -// The License.txt file describes the conditions under which this software may -// be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -#ifdef DEBUG_LEX_MODULA -#define DEBUG_STATE( p, c )\ - fprintf( stderr, "Unknown state: currentPos = %u, char = '%c'\n", static_cast<unsigned int>(p), c ); -#else -#define DEBUG_STATE( p, c ) -#endif - -static inline bool IsDigitOfBase( unsigned ch, unsigned base ) { - if( ch < '0' || ch > 'f' ) return false; - if( base <= 10 ) { - if( ch >= ( '0' + base ) ) return false; - } else { - if( ch > '9' ) { - unsigned nb = base - 10; - if( ( ch < 'A' ) || ( ch >= ( 'A' + nb ) ) ) { - if( ( ch < 'a' ) || ( ch >= ( 'a' + nb ) ) ) { - return false; - } - } - } - } - return true; -} - -static inline unsigned IsOperator( StyleContext & sc, WordList & op ) { - int i; - char s[3]; - - s[0] = sc.ch; - s[1] = sc.chNext; - s[2] = 0; - for( i = 0; i < op.Length(); i++ ) { - if( ( strlen( op.WordAt(i) ) == 2 ) && - ( s[0] == op.WordAt(i)[0] && s[1] == op.WordAt(i)[1] ) ) { - return 2; - } - } - s[1] = 0; - for( i = 0; i < op.Length(); i++ ) { - if( ( strlen( op.WordAt(i) ) == 1 ) && - ( s[0] == op.WordAt(i)[0] ) ) { - return 1; - } - } - return 0; -} - -static inline bool IsEOL( Accessor &styler, Sci_PositionU curPos ) { - unsigned ch = styler.SafeGetCharAt( curPos ); - if( ( ch == '\r' && styler.SafeGetCharAt( curPos + 1 ) == '\n' ) || - ( ch == '\n' ) ) { - return true; - } - return false; -} - -static inline bool checkStatement( - Accessor &styler, - Sci_Position &curPos, - const char *stt, bool spaceAfter = true ) { - int len = static_cast<int>(strlen( stt )); - int i; - for( i = 0; i < len; i++ ) { - if( styler.SafeGetCharAt( curPos + i ) != stt[i] ) { - return false; - } - } - if( spaceAfter ) { - if( ! isspace( styler.SafeGetCharAt( curPos + i ) ) ) { - return false; - } - } - curPos += ( len - 1 ); - return true; -} - -static inline bool checkEndSemicolon( - Accessor &styler, - Sci_Position &curPos, Sci_Position endPos ) -{ - const char *stt = "END"; - int len = static_cast<int>(strlen( stt )); - int i; - for( i = 0; i < len; i++ ) { - if( styler.SafeGetCharAt( curPos + i ) != stt[i] ) { - return false; - } - } - while( isspace( styler.SafeGetCharAt( curPos + i ) ) ) { - i++; - if( ( curPos + i ) >= endPos ) return false; - } - if( styler.SafeGetCharAt( curPos + i ) != ';' ) { - return false; - } - curPos += ( i - 1 ); - return true; -} - -static inline bool checkKeyIdentOper( - - Accessor &styler, - Sci_Position &curPos, Sci_Position endPos, - const char *stt, const char etk ) { - Sci_Position newPos = curPos; - if( ! checkStatement( styler, newPos, stt ) ) - return false; - newPos++; - if( newPos >= endPos ) - return false; - if( ! isspace( styler.SafeGetCharAt( newPos ) ) ) - return false; - newPos++; - if( newPos >= endPos ) - return false; - while( isspace( styler.SafeGetCharAt( newPos ) ) ) { - newPos++; - if( newPos >= endPos ) - return false; - } - if( ! isalpha( styler.SafeGetCharAt( newPos ) ) ) - return false; - newPos++; - if( newPos >= endPos ) - return false; - char ch; - ch = styler.SafeGetCharAt( newPos ); - while( isalpha( ch ) || isdigit( ch ) || ch == '_' ) { - newPos++; - if( newPos >= endPos ) return false; - ch = styler.SafeGetCharAt( newPos ); - } - while( isspace( styler.SafeGetCharAt( newPos ) ) ) { - newPos++; - if( newPos >= endPos ) return false; - } - if( styler.SafeGetCharAt( newPos ) != etk ) - return false; - curPos = newPos; - return true; -} - -static void FoldModulaDoc( Sci_PositionU startPos, - Sci_Position length, - int , WordList *[], - Accessor &styler) -{ - Sci_Position curLine = styler.GetLine(startPos); - int curLevel = SC_FOLDLEVELBASE; - Sci_Position endPos = startPos + length; - if( curLine > 0 ) - curLevel = styler.LevelAt( curLine - 1 ) >> 16; - Sci_Position curPos = startPos; - int style = styler.StyleAt( curPos ); - int visChars = 0; - int nextLevel = curLevel; - - while( curPos < endPos ) { - if( ! isspace( styler.SafeGetCharAt( curPos ) ) ) visChars++; - - switch( style ) { - case SCE_MODULA_COMMENT: - if( checkStatement( styler, curPos, "(*" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "*)" ) ) - nextLevel--; - break; - - case SCE_MODULA_DOXYCOMM: - if( checkStatement( styler, curPos, "(**", false ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "*)" ) ) - nextLevel--; - break; - - case SCE_MODULA_KEYWORD: - if( checkStatement( styler, curPos, "IF" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "BEGIN" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "TRY" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "LOOP" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "FOR" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "WHILE" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "REPEAT" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "UNTIL" ) ) - nextLevel--; - else - if( checkStatement( styler, curPos, "WITH" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "CASE" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "TYPECASE" ) ) - nextLevel++; - else - if( checkStatement( styler, curPos, "LOCK" ) ) - nextLevel++; - else - if( checkKeyIdentOper( styler, curPos, endPos, "PROCEDURE", '(' ) ) - nextLevel++; - else - if( checkKeyIdentOper( styler, curPos, endPos, "END", ';' ) ) { - Sci_Position cln = curLine; - int clv_old = curLevel; - Sci_Position pos; - char ch; - int clv_new; - while( cln > 0 ) { - clv_new = styler.LevelAt( cln - 1 ) >> 16; - if( clv_new < clv_old ) { - nextLevel--; - pos = styler.LineStart( cln ); - while( ( ch = styler.SafeGetCharAt( pos ) ) != '\n' ) { - if( ch == 'P' ) { - if( styler.StyleAt(pos) == SCE_MODULA_KEYWORD ) { - if( checkKeyIdentOper( styler, pos, endPos, - "PROCEDURE", '(' ) ) { - break; - } - } - } - pos++; - } - clv_old = clv_new; - } - cln--; - } - } - else - if( checkKeyIdentOper( styler, curPos, endPos, "END", '.' ) ) - nextLevel--; - else - if( checkEndSemicolon( styler, curPos, endPos ) ) - nextLevel--; - else { - while( styler.StyleAt( curPos + 1 ) == SCE_MODULA_KEYWORD ) - curPos++; - } - break; - - default: - break; - } - - if( IsEOL( styler, curPos ) || ( curPos == endPos - 1 ) ) { - int efectiveLevel = curLevel | nextLevel << 16; - if( visChars == 0 ) - efectiveLevel |= SC_FOLDLEVELWHITEFLAG; - if( curLevel < nextLevel ) - efectiveLevel |= SC_FOLDLEVELHEADERFLAG; - if( efectiveLevel != styler.LevelAt(curLine) ) { - styler.SetLevel(curLine, efectiveLevel ); - } - curLine++; - curLevel = nextLevel; - if( IsEOL( styler, curPos ) && ( curPos == endPos - 1 ) ) { - styler.SetLevel( curLine, ( curLevel | curLevel << 16) - | SC_FOLDLEVELWHITEFLAG); - } - visChars = 0; - } - curPos++; - style = styler.StyleAt( curPos ); - } -} - -static inline bool skipWhiteSpaces( StyleContext & sc ) { - while( isspace( sc.ch ) ) { - sc.SetState( SCE_MODULA_DEFAULT ); - if( sc.More() ) - sc.Forward(); - else - return false; - } - return true; -} - -static void ColouriseModulaDoc( Sci_PositionU startPos, - Sci_Position length, - int initStyle, - WordList *wl[], - Accessor &styler ) { - WordList& keyWords = *wl[0]; - WordList& reservedWords = *wl[1]; - WordList& operators = *wl[2]; - WordList& pragmaWords = *wl[3]; - WordList& escapeCodes = *wl[4]; - WordList& doxyKeys = *wl[5]; - - const int BUFLEN = 128; - - char buf[BUFLEN]; - int i, kl; - - Sci_Position charPos = 0; - - StyleContext sc( startPos, length, initStyle, styler ); - - while( sc.More() ) { - switch( sc.state ) { - case SCE_MODULA_DEFAULT: - if( ! skipWhiteSpaces( sc ) ) break; - - if( sc.ch == '(' && sc.chNext == '*' ) { - if( sc.GetRelative(2) == '*' ) { - sc.SetState( SCE_MODULA_DOXYCOMM ); - sc.Forward(); - } else { - sc.SetState( SCE_MODULA_COMMENT ); - } - sc.Forward(); - } - else - if( isalpha( sc.ch ) ) { - if( isupper( sc.ch ) && isupper( sc.chNext ) ) { - for( i = 0; i < BUFLEN - 1; i++ ) { - buf[i] = sc.GetRelative(i); - if( !isalpha( buf[i] ) && !(buf[i] == '_') ) - break; - } - kl = i; - buf[kl] = 0; - - if( keyWords.InList( buf ) ) { - sc.SetState( SCE_MODULA_KEYWORD ); - sc.Forward( kl ); - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } - else - if( reservedWords.InList( buf ) ) { - sc.SetState( SCE_MODULA_RESERVED ); - sc.Forward( kl ); - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } else { - /** check procedure identifier */ - } - } else { - for( i = 0; i < BUFLEN - 1; i++ ) { - buf[i] = sc.GetRelative(i); - if( !isalpha( buf[i] ) && - !isdigit( buf[i] ) && - !(buf[i] == '_') ) - break; - } - kl = i; - buf[kl] = 0; - - sc.SetState( SCE_MODULA_DEFAULT ); - sc.Forward( kl ); - continue; - } - } - else - if( isdigit( sc.ch ) ) { - sc.SetState( SCE_MODULA_NUMBER ); - continue; - } - else - if( sc.ch == '\"' ) { - sc.SetState( SCE_MODULA_STRING ); - } - else - if( sc.ch == '\'' ) { - charPos = sc.currentPos; - sc.SetState( SCE_MODULA_CHAR ); - } - else - if( sc.ch == '<' && sc.chNext == '*' ) { - sc.SetState( SCE_MODULA_PRAGMA ); - sc.Forward(); - } else { - unsigned len = IsOperator( sc, operators ); - if( len > 0 ) { - sc.SetState( SCE_MODULA_OPERATOR ); - sc.Forward( len ); - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } else { - DEBUG_STATE( sc.currentPos, sc.ch ); - } - } - break; - - case SCE_MODULA_COMMENT: - if( sc.ch == '*' && sc.chNext == ')' ) { - sc.Forward( 2 ); - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } - break; - - case SCE_MODULA_DOXYCOMM: - switch( sc.ch ) { - case '*': - if( sc.chNext == ')' ) { - sc.Forward( 2 ); - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } - break; - - case '@': - if( islower( sc.chNext ) ) { - for( i = 0; i < BUFLEN - 1; i++ ) { - buf[i] = sc.GetRelative(i+1); - if( isspace( buf[i] ) ) break; - } - buf[i] = 0; - kl = i; - - if( doxyKeys.InList( buf ) ) { - sc.SetState( SCE_MODULA_DOXYKEY ); - sc.Forward( kl + 1 ); - sc.SetState( SCE_MODULA_DOXYCOMM ); - } - } - break; - - default: - break; - } - break; - - case SCE_MODULA_NUMBER: - { - buf[0] = sc.ch; - for( i = 1; i < BUFLEN - 1; i++ ) { - buf[i] = sc.GetRelative(i); - if( ! isdigit( buf[i] ) ) - break; - } - kl = i; - buf[kl] = 0; - - switch( sc.GetRelative(kl) ) { - case '_': - { - int base = atoi( buf ); - if( base < 2 || base > 16 ) { - sc.SetState( SCE_MODULA_BADSTR ); - } else { - int imax; - - kl++; - for( i = 0; i < BUFLEN - 1; i++ ) { - buf[i] = sc.GetRelative(kl+i); - if( ! IsDigitOfBase( buf[i], 16 ) ) { - break; - } - } - imax = i; - for( i = 0; i < imax; i++ ) { - if( ! IsDigitOfBase( buf[i], base ) ) { - sc.SetState( SCE_MODULA_BADSTR ); - break; - } - } - kl += imax; - } - sc.SetState( SCE_MODULA_BASENUM ); - for( i = 0; i < kl; i++ ) { - sc.Forward(); - } - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } - break; - - case '.': - if( sc.GetRelative(kl+1) == '.' ) { - kl--; - for( i = 0; i < kl; i++ ) { - sc.Forward(); - } - sc.Forward(); - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } else { - bool doNext = false; - - kl++; - - buf[0] = sc.GetRelative(kl); - if( isdigit( buf[0] ) ) { - for( i = 0;; i++ ) { - if( !isdigit(sc.GetRelative(kl+i)) ) - break; - } - kl += i; - buf[0] = sc.GetRelative(kl); - - switch( buf[0] ) - { - case 'E': - case 'e': - case 'D': - case 'd': - case 'X': - case 'x': - kl++; - buf[0] = sc.GetRelative(kl); - if( buf[0] == '-' || buf[0] == '+' ) { - kl++; - } - buf[0] = sc.GetRelative(kl); - if( isdigit( buf[0] ) ) { - for( i = 0;; i++ ) { - if( !isdigit(sc.GetRelative(kl+i)) ) { - buf[0] = sc.GetRelative(kl+i); - break; - } - } - kl += i; - doNext = true; - } else { - sc.SetState( SCE_MODULA_BADSTR ); - } - break; - - default: - doNext = true; - break; - } - } else { - sc.SetState( SCE_MODULA_BADSTR ); - } - - if( doNext ) { - if( ! isspace( buf[0] ) && - buf[0] != ')' && - buf[0] != '>' && - buf[0] != '<' && - buf[0] != '=' && - buf[0] != '#' && - buf[0] != '+' && - buf[0] != '-' && - buf[0] != '*' && - buf[0] != '/' && - buf[0] != ',' && - buf[0] != ';' - ) { - sc.SetState( SCE_MODULA_BADSTR ); - } else { - kl--; - } - } - } - sc.SetState( SCE_MODULA_FLOAT ); - for( i = 0; i < kl; i++ ) { - sc.Forward(); - } - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - break; - - default: - for( i = 0; i < kl; i++ ) { - sc.Forward(); - } - break; - } - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } - break; - - case SCE_MODULA_STRING: - if( sc.ch == '\"' ) { - sc.Forward(); - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } else { - if( sc.ch == '\\' ) { - i = 1; - if( IsDigitOfBase( sc.chNext, 8 ) ) { - for( i = 1; i < BUFLEN - 1; i++ ) { - if( ! IsDigitOfBase(sc.GetRelative(i+1), 8 ) ) - break; - } - if( i == 3 ) { - sc.SetState( SCE_MODULA_STRSPEC ); - } else { - sc.SetState( SCE_MODULA_BADSTR ); - } - } else { - buf[0] = sc.chNext; - buf[1] = 0; - - if( escapeCodes.InList( buf ) ) { - sc.SetState( SCE_MODULA_STRSPEC ); - } else { - sc.SetState( SCE_MODULA_BADSTR ); - } - } - sc.Forward(i+1); - sc.SetState( SCE_MODULA_STRING ); - continue; - } - } - break; - - case SCE_MODULA_CHAR: - if( sc.ch == '\'' ) { - sc.Forward(); - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } - else - if( ( sc.currentPos - charPos ) == 1 ) { - if( sc.ch == '\\' ) { - i = 1; - if( IsDigitOfBase( sc.chNext, 8 ) ) { - for( i = 1; i < BUFLEN - 1; i++ ) { - if( ! IsDigitOfBase(sc.GetRelative(i+1), 8 ) ) - break; - } - if( i == 3 ) { - sc.SetState( SCE_MODULA_CHARSPEC ); - } else { - sc.SetState( SCE_MODULA_BADSTR ); - } - } else { - buf[0] = sc.chNext; - buf[1] = 0; - - if( escapeCodes.InList( buf ) ) { - sc.SetState( SCE_MODULA_CHARSPEC ); - } else { - sc.SetState( SCE_MODULA_BADSTR ); - } - } - sc.Forward(i+1); - sc.SetState( SCE_MODULA_CHAR ); - continue; - } - } else { - sc.SetState( SCE_MODULA_BADSTR ); - sc.Forward(); - sc.SetState( SCE_MODULA_CHAR ); - continue; - } - break; - - case SCE_MODULA_PRAGMA: - if( sc.ch == '*' && sc.chNext == '>' ) { - sc.Forward(); - sc.Forward(); - sc.SetState( SCE_MODULA_DEFAULT ); - continue; - } - else - if( isupper( sc.ch ) && isupper( sc.chNext ) ) { - buf[0] = sc.ch; - buf[1] = sc.chNext; - for( i = 2; i < BUFLEN - 1; i++ ) { - buf[i] = sc.GetRelative(i); - if( !isupper( buf[i] ) ) - break; - } - kl = i; - buf[kl] = 0; - if( pragmaWords.InList( buf ) ) { - sc.SetState( SCE_MODULA_PRGKEY ); - sc.Forward( kl ); - sc.SetState( SCE_MODULA_PRAGMA ); - continue; - } - } - break; - - default: - break; - } - sc.Forward(); - } - sc.Complete(); -} - -static const char *const modulaWordListDesc[] = -{ - "Keywords", - "ReservedKeywords", - "Operators", - "PragmaKeyswords", - "EscapeCodes", - "DoxygeneKeywords", - 0 -}; - -LexerModule lmModula( SCLEX_MODULA, ColouriseModulaDoc, "modula", FoldModulaDoc, - modulaWordListDesc); diff --git a/lexers/LexMySQL.cxx b/lexers/LexMySQL.cxx deleted file mode 100644 index 7ba52a3e2..000000000 --- a/lexers/LexMySQL.cxx +++ /dev/null @@ -1,574 +0,0 @@ -/** - * Scintilla source code edit control - * @file LexMySQL.cxx - * Lexer for MySQL - * - * Improved by Mike Lischke <mike.lischke@oracle.com> - * Adopted from LexSQL.cxx by Anders Karlsson <anders@mysql.com> - * Original work by Neil Hodgson <neilh@scintilla.org> - * Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> - * The License.txt file describes the conditions under which this software may be distributed. - */ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool IsAWordChar(int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); -} - -static inline bool IsAWordStart(int ch) { - return (ch < 0x80) && (isalpha(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) || toupper(ch) == 'E' || - ch == '.' || ch == '-' || ch == '+'); -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Check if the current content context represent a keyword and set the context state if so. - */ -static void CheckForKeyword(StyleContext& sc, WordList* keywordlists[], int activeState) -{ - Sci_Position length = sc.LengthCurrent() + 1; // +1 for the next char - char* s = new char[length]; - sc.GetCurrentLowered(s, length); - if (keywordlists[0]->InList(s)) - sc.ChangeState(SCE_MYSQL_MAJORKEYWORD | activeState); - else - if (keywordlists[1]->InList(s)) - sc.ChangeState(SCE_MYSQL_KEYWORD | activeState); - else - if (keywordlists[2]->InList(s)) - sc.ChangeState(SCE_MYSQL_DATABASEOBJECT | activeState); - else - if (keywordlists[3]->InList(s)) - sc.ChangeState(SCE_MYSQL_FUNCTION | activeState); - else - if (keywordlists[5]->InList(s)) - sc.ChangeState(SCE_MYSQL_PROCEDUREKEYWORD | activeState); - else - if (keywordlists[6]->InList(s)) - sc.ChangeState(SCE_MYSQL_USER1 | activeState); - else - if (keywordlists[7]->InList(s)) - sc.ChangeState(SCE_MYSQL_USER2 | activeState); - else - if (keywordlists[8]->InList(s)) - sc.ChangeState(SCE_MYSQL_USER3 | activeState); - delete [] s; -} - -//-------------------------------------------------------------------------------------------------- - -#define HIDDENCOMMAND_STATE 0x40 // Offset for states within a hidden command. -#define MASKACTIVE(style) (style & ~HIDDENCOMMAND_STATE) - -static void SetDefaultState(StyleContext& sc, int activeState) -{ - if (activeState == 0) - sc.SetState(SCE_MYSQL_DEFAULT); - else - sc.SetState(SCE_MYSQL_HIDDENCOMMAND); -} - -static void ForwardDefaultState(StyleContext& sc, int activeState) -{ - if (activeState == 0) - sc.ForwardSetState(SCE_MYSQL_DEFAULT); - else - sc.ForwardSetState(SCE_MYSQL_HIDDENCOMMAND); -} - -static void ColouriseMySQLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) -{ - StyleContext sc(startPos, length, initStyle, styler, 127); - int activeState = (initStyle == SCE_MYSQL_HIDDENCOMMAND) ? HIDDENCOMMAND_STATE : initStyle & HIDDENCOMMAND_STATE; - - for (; sc.More(); sc.Forward()) - { - // Determine if the current state should terminate. - switch (MASKACTIVE(sc.state)) - { - case SCE_MYSQL_OPERATOR: - SetDefaultState(sc, activeState); - break; - case SCE_MYSQL_NUMBER: - // We stop the number definition on non-numerical non-dot non-eE non-sign char. - if (!IsANumberChar(sc.ch)) - SetDefaultState(sc, activeState); - break; - case SCE_MYSQL_IDENTIFIER: - // Switch from identifier to keyword state and open a new state for the new char. - if (!IsAWordChar(sc.ch)) - { - CheckForKeyword(sc, keywordlists, activeState); - - // Additional check for function keywords needed. - // A function name must be followed by an opening parenthesis. - if (MASKACTIVE(sc.state) == SCE_MYSQL_FUNCTION && sc.ch != '(') - { - if (activeState > 0) - sc.ChangeState(SCE_MYSQL_HIDDENCOMMAND); - else - sc.ChangeState(SCE_MYSQL_DEFAULT); - } - - SetDefaultState(sc, activeState); - } - break; - case SCE_MYSQL_VARIABLE: - if (!IsAWordChar(sc.ch)) - SetDefaultState(sc, activeState); - break; - case SCE_MYSQL_SYSTEMVARIABLE: - if (!IsAWordChar(sc.ch)) - { - Sci_Position length = sc.LengthCurrent() + 1; - char* s = new char[length]; - sc.GetCurrentLowered(s, length); - - // Check for known system variables here. - if (keywordlists[4]->InList(&s[2])) - sc.ChangeState(SCE_MYSQL_KNOWNSYSTEMVARIABLE | activeState); - delete [] s; - - SetDefaultState(sc, activeState); - } - break; - case SCE_MYSQL_QUOTEDIDENTIFIER: - if (sc.ch == '`') - { - if (sc.chNext == '`') - sc.Forward(); // Ignore it - else - ForwardDefaultState(sc, activeState); - } - break; - case SCE_MYSQL_COMMENT: - if (sc.Match('*', '/')) - { - sc.Forward(); - ForwardDefaultState(sc, activeState); - } - break; - case SCE_MYSQL_COMMENTLINE: - if (sc.atLineStart) - SetDefaultState(sc, activeState); - break; - case SCE_MYSQL_SQSTRING: - if (sc.ch == '\\') - sc.Forward(); // Escape sequence - else - if (sc.ch == '\'') - { - // End of single quoted string reached? - if (sc.chNext == '\'') - sc.Forward(); - else - ForwardDefaultState(sc, activeState); - } - break; - case SCE_MYSQL_DQSTRING: - if (sc.ch == '\\') - sc.Forward(); // Escape sequence - else - if (sc.ch == '\"') - { - // End of single quoted string reached? - if (sc.chNext == '\"') - sc.Forward(); - else - ForwardDefaultState(sc, activeState); - } - break; - case SCE_MYSQL_PLACEHOLDER: - if (sc.Match('}', '>')) - { - sc.Forward(); - ForwardDefaultState(sc, activeState); - } - break; - } - - if (sc.state == SCE_MYSQL_HIDDENCOMMAND && sc.Match('*', '/')) - { - activeState = 0; - sc.Forward(); - ForwardDefaultState(sc, activeState); - } - - // Determine if a new state should be entered. - if (sc.state == SCE_MYSQL_DEFAULT || sc.state == SCE_MYSQL_HIDDENCOMMAND) - { - switch (sc.ch) - { - case '@': - if (sc.chNext == '@') - { - sc.SetState(SCE_MYSQL_SYSTEMVARIABLE | activeState); - sc.Forward(2); // Skip past @@. - } - else - if (IsAWordStart(sc.ch)) - { - sc.SetState(SCE_MYSQL_VARIABLE | activeState); - sc.Forward(); // Skip past @. - } - else - sc.SetState(SCE_MYSQL_OPERATOR | activeState); - break; - case '`': - sc.SetState(SCE_MYSQL_QUOTEDIDENTIFIER | activeState); - break; - case '#': - sc.SetState(SCE_MYSQL_COMMENTLINE | activeState); - break; - case '\'': - sc.SetState(SCE_MYSQL_SQSTRING | activeState); - break; - case '\"': - sc.SetState(SCE_MYSQL_DQSTRING | activeState); - break; - default: - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) - sc.SetState(SCE_MYSQL_NUMBER | activeState); - else - if (IsAWordStart(sc.ch)) - sc.SetState(SCE_MYSQL_IDENTIFIER | activeState); - else - if (sc.Match('/', '*')) - { - sc.SetState(SCE_MYSQL_COMMENT | activeState); - - // Skip first char of comment introducer and check for hidden command. - // The second char is skipped by the outer loop. - sc.Forward(); - if (sc.GetRelativeCharacter(1) == '!') - { - // Version comment found. Skip * now. - sc.Forward(); - activeState = HIDDENCOMMAND_STATE; - sc.ChangeState(SCE_MYSQL_HIDDENCOMMAND); - } - } - else if (sc.Match('<', '{')) - { - sc.SetState(SCE_MYSQL_PLACEHOLDER | activeState); - } - else - if (sc.Match("--")) - { - // Special MySQL single line comment. - sc.SetState(SCE_MYSQL_COMMENTLINE | activeState); - sc.Forward(2); - - // Check the third character too. It must be a space or EOL. - if (sc.ch != ' ' && sc.ch != '\n' && sc.ch != '\r') - sc.ChangeState(SCE_MYSQL_OPERATOR | activeState); - } - else - if (isoperator(static_cast<char>(sc.ch))) - sc.SetState(SCE_MYSQL_OPERATOR | activeState); - } - } - } - - // Do a final check for keywords if we currently have an identifier, to highlight them - // also at the end of a line. - if (sc.state == SCE_MYSQL_IDENTIFIER) - { - CheckForKeyword(sc, keywordlists, activeState); - - // Additional check for function keywords needed. - // A function name must be followed by an opening parenthesis. - if (sc.state == SCE_MYSQL_FUNCTION && sc.ch != '(') - SetDefaultState(sc, activeState); - } - - sc.Complete(); -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Helper function to determine if we have a foldable comment currently. - */ -static bool IsStreamCommentStyle(int style) -{ - return MASKACTIVE(style) == SCE_MYSQL_COMMENT; -} - -//-------------------------------------------------------------------------------------------------- - -/** - * Code copied from StyleContext and modified to work here. Should go into Accessor as a - * companion to Match()... - */ -static bool MatchIgnoreCase(Accessor &styler, Sci_Position currentPos, const char *s) -{ - for (Sci_Position n = 0; *s; n++) - { - if (*s != tolower(styler.SafeGetCharAt(currentPos + n))) - return false; - s++; - } - 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. -static void FoldMySQLDoc(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; - bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0; - - 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; - - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - int activeState = (style == SCE_MYSQL_HIDDENCOMMAND) ? HIDDENCOMMAND_STATE : style & HIDDENCOMMAND_STATE; - - bool endPending = false; - bool whenPending = false; - bool elseIfPending = false; - - char nextChar = styler.SafeGetCharAt(startPos); - for (Sci_PositionU i = startPos; length > 0; i++, length--) - { - int stylePrev = style; - int lastActiveState = activeState; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - activeState = (style == SCE_MYSQL_HIDDENCOMMAND) ? HIDDENCOMMAND_STATE : style & HIDDENCOMMAND_STATE; - - char currentChar = nextChar; - nextChar = styler.SafeGetCharAt(i + 1); - bool atEOL = (currentChar == '\r' && nextChar != '\n') || (currentChar == '\n'); - - switch (MASKACTIVE(style)) - { - case SCE_MYSQL_COMMENT: - if (foldComment) - { - // Multiline comment style /* .. */ just started or is still in progress. - if (IsStreamCommentStyle(style) && !IsStreamCommentStyle(stylePrev)) - levelNext++; - } - break; - case SCE_MYSQL_COMMENTLINE: - if (foldComment) - { - // Not really a standard, but we add support for single line comments - // with special curly braces syntax as foldable comments too. - // MySQL needs -- comments to be followed by space or control char - if (styler.Match(i, "--")) - { - char chNext2 = styler.SafeGetCharAt(i + 2); - char chNext3 = styler.SafeGetCharAt(i + 3); - if (chNext2 == '{' || chNext3 == '{') - levelNext++; - else - if (chNext2 == '}' || chNext3 == '}') - levelNext--; - } - } - break; - case SCE_MYSQL_HIDDENCOMMAND: - /* - if (endPending) - { - // A conditional command is not a white space so it should end the current block - // before opening a new one. - endPending = false; - levelNext--; - if (levelNext < SC_FOLDLEVELBASE) - levelNext = SC_FOLDLEVELBASE; - } - }*/ - if (activeState != lastActiveState) - levelNext++; - break; - case SCE_MYSQL_OPERATOR: - if (endPending) - { - endPending = false; - levelNext--; - if (levelNext < SC_FOLDLEVELBASE) - levelNext = SC_FOLDLEVELBASE; - } - if (currentChar == '(') - levelNext++; - else - if (currentChar == ')') - { - levelNext--; - if (levelNext < SC_FOLDLEVELBASE) - levelNext = SC_FOLDLEVELBASE; - } - break; - case SCE_MYSQL_MAJORKEYWORD: - case SCE_MYSQL_KEYWORD: - case SCE_MYSQL_FUNCTION: - case SCE_MYSQL_PROCEDUREKEYWORD: - // Reserved and other keywords. - if (style != stylePrev) - { - // END decreases the folding level, regardless which keyword follows. - bool endFound = MatchIgnoreCase(styler, i, "end"); - if (endPending) - { - levelNext--; - if (levelNext < SC_FOLDLEVELBASE) - levelNext = SC_FOLDLEVELBASE; - } - else - if (!endFound) - { - if (MatchIgnoreCase(styler, i, "begin")) - levelNext++; - else - { - if (!foldOnlyBegin) - { - bool whileFound = MatchIgnoreCase(styler, i, "while"); - bool loopFound = MatchIgnoreCase(styler, i, "loop"); - bool repeatFound = MatchIgnoreCase(styler, i, "repeat"); - bool caseFound = MatchIgnoreCase(styler, i, "case"); - - if (whileFound || loopFound || repeatFound || caseFound) - levelNext++; - else - { - // IF alone does not increase the fold level as it is also used in non-block'ed - // code like DROP PROCEDURE blah IF EXISTS. - // Instead THEN opens the new level (if not part of an ELSEIF or WHEN (case) branch). - if (MatchIgnoreCase(styler, i, "then")) - { - if (!elseIfPending && !whenPending) - levelNext++; - else - { - elseIfPending = false; - whenPending = false; - } - } - else - { - // Neither of if/then/while/loop/repeat/case, so check for - // sub parts of IF and CASE. - if (MatchIgnoreCase(styler, i, "elseif")) - elseIfPending = true; - if (MatchIgnoreCase(styler, i, "when")) - whenPending = true; - } - } - } - } - } - - // Keep the current end state for the next round. - endPending = endFound; - } - break; - - default: - if (!isspacechar(currentChar) && endPending) - { - // END followed by a non-whitespace character (not covered by other cases like identifiers) - // also should end a folding block. Typical case: END followed by self defined delimiter. - levelNext--; - if (levelNext < SC_FOLDLEVELBASE) - levelNext = SC_FOLDLEVELBASE; - } - break; - } - - // Go up one level if we just ended a multi line comment. - if (IsStreamCommentStyle(stylePrev) && !IsStreamCommentStyle(style)) - { - levelNext--; - if (levelNext < SC_FOLDLEVELBASE) - levelNext = SC_FOLDLEVELBASE; - } - - if (activeState == 0 && lastActiveState != 0) - { - // Decrease fold level when we left a hidden command. - levelNext--; - if (levelNext < SC_FOLDLEVELBASE) - levelNext = SC_FOLDLEVELBASE; - } - - if (atEOL) - { - // Apply the new folding level to this line. - // Leave pending states as they are otherwise a line break will de-sync - // code folding and valid syntax. - 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); - - lineCurrent++; - levelCurrent = levelNext; - visibleChars = 0; - } - - if (!isspacechar(currentChar)) - visibleChars++; - } -} - -//-------------------------------------------------------------------------------------------------- - -static const char * const mysqlWordListDesc[] = { - "Major Keywords", - "Keywords", - "Database Objects", - "Functions", - "System Variables", - "Procedure keywords", - "User Keywords 1", - "User Keywords 2", - "User Keywords 3", - 0 -}; - -LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc); diff --git a/lexers/LexNim.cxx b/lexers/LexNim.cxx deleted file mode 100644 index d1b462abe..000000000 --- a/lexers/LexNim.cxx +++ /dev/null @@ -1,811 +0,0 @@ -// Scintilla source code edit control -/** @file LexNim.cxx -** Lexer for Nim -** Written by Jad Altahan (github.com/xv) -** Nim manual: https://nim-lang.org/docs/manual.html -**/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <map> -#include <algorithm> - -#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; - -namespace { - // Use an unnamed namespace to protect the functions and classes from name conflicts - -enum NumType { - Binary, - Octal, - Exponent, - Hexadecimal, - Decimal, - FormatError -}; - -int GetNumStyle(const int numType) noexcept { - if (numType == NumType::FormatError) { - return SCE_NIM_NUMERROR; - } - - return SCE_NIM_NUMBER; -} - -constexpr bool IsLetter(const int ch) noexcept { - // 97 to 122 || 65 to 90 - return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); -} - -bool IsAWordChar(const int ch) noexcept { - return ch < 0x80 && (isalnum(ch) || ch == '_' || ch == '.'); -} - -int IsNumHex(const StyleContext &sc) noexcept { - return sc.chNext == 'x' || sc.chNext == 'X'; -} - -int IsNumBinary(const StyleContext &sc) noexcept { - return sc.chNext == 'b' || sc.chNext == 'B'; -} - -int IsNumOctal(const StyleContext &sc) { - return IsADigit(sc.chNext) || sc.chNext == 'o'; -} - -constexpr bool IsNewline(const int ch) noexcept { - return (ch == '\n' || ch == '\r'); -} - -bool IsFuncName(const char *str) noexcept { - const char *identifiers[] = { - "proc", - "func", - "macro", - "method", - "template", - "iterator", - "converter" - }; - - for (const char *id : identifiers) { - if (strcmp(str, id) == 0) { - return true; - } - } - - return false; -} - -constexpr bool IsTripleLiteral(const int style) noexcept { - return style == SCE_NIM_TRIPLE || style == SCE_NIM_TRIPLEDOUBLE; -} - -constexpr bool IsLineComment(const int style) noexcept { - return style == SCE_NIM_COMMENTLINE || style == SCE_NIM_COMMENTLINEDOC; -} - -constexpr bool IsStreamComment(const int style) noexcept { - return style == SCE_NIM_COMMENT || style == SCE_NIM_COMMENTDOC; -} - -// Adopted from Accessor.cxx -int GetIndent(const Sci_Position line, Accessor &styler) { - Sci_Position startPos = styler.LineStart(line); - const Sci_Position eolPos = styler.LineStart(line + 1) - 1; - - char ch = styler[startPos]; - int style = styler.StyleAt(startPos); - - int indent = 0; - bool inPrevPrefix = line > 0; - Sci_Position posPrev = inPrevPrefix ? styler.LineStart(line - 1) : 0; - - // No fold points inside triple literals - while ((IsASpaceOrTab(ch) || IsTripleLiteral(style)) && (startPos < eolPos)) { - if (inPrevPrefix) { - const char chPrev = styler[posPrev++]; - if (chPrev != ' ' && chPrev != '\t') { - inPrevPrefix = false; - } - } - - if (ch == '\t') { - indent = (indent / 8 + 1) * 8; - } else { - indent++; - } - - startPos++; - ch = styler[startPos]; - style = styler.StyleAt(startPos); - } - - // Prevent creating fold lines for comments if indented - if (!(IsStreamComment(style) || IsLineComment(style))) - indent += SC_FOLDLEVELBASE; - - if (styler.LineStart(line) == styler.Length() - || IsASpaceOrTab(ch) - || IsNewline(ch) - || IsStreamComment(style) - || IsLineComment(style)) { - return indent | SC_FOLDLEVELWHITEFLAG; - } else { - return indent; - } -} - -int IndentAmount(const Sci_Position line, Accessor &styler) { - const int indent = GetIndent(line, styler); - const int indentLevel = indent & SC_FOLDLEVELNUMBERMASK; - return indentLevel <= SC_FOLDLEVELBASE ? indent : indentLevel | (indent & ~SC_FOLDLEVELNUMBERMASK); -} - -struct OptionsNim { - bool fold; - bool foldCompact; - bool highlightRawStrIdent; - - OptionsNim() { - fold = true; - foldCompact = true; - highlightRawStrIdent = false; - } -}; - -static const char *const nimWordListDesc[] = { - "Keywords", - nullptr -}; - -struct OptionSetNim : public OptionSet<OptionsNim> { - OptionSetNim() { - DefineProperty("lexer.nim.raw.strings.highlight.ident", &OptionsNim::highlightRawStrIdent, - "Set to 1 to enable highlighting generalized raw string identifiers. " - "Generalized raw string identifiers are anything other than r (or R)."); - - DefineProperty("fold", &OptionsNim::fold); - DefineProperty("fold.compact", &OptionsNim::foldCompact); - - DefineWordListSets(nimWordListDesc); - } -}; - -LexicalClass lexicalClasses[] = { - // Lexer Nim SCLEX_NIM SCE_NIM_: - 0, "SCE_NIM_DEFAULT", "default", "White space", - 1, "SCE_NIM_COMMENT", "comment block", "Block comment", - 2, "SCE_NIM_COMMENTDOC", "comment block doc", "Block doc comment", - 3, "SCE_NIM_COMMENTLINE", "comment line", "Line comment", - 4, "SCE_NIM_COMMENTLINEDOC", "comment doc", "Line doc comment", - 5, "SCE_NIM_NUMBER", "literal numeric", "Number", - 6, "SCE_NIM_STRING", "literal string", "String", - 7, "SCE_NIM_CHARACTER", "literal string", "Single quoted string", - 8, "SCE_NIM_WORD", "keyword", "Keyword", - 9, "SCE_NIM_TRIPLE", "literal string", "Triple quotes", - 10, "SCE_NIM_TRIPLEDOUBLE", "literal string", "Triple double quotes", - 11, "SCE_NIM_BACKTICKS", "operator definition", "Identifiers", - 12, "SCE_NIM_FUNCNAME", "identifier", "Function name definition", - 13, "SCE_NIM_STRINGEOL", "error literal string", "String is not closed", - 14, "SCE_NIM_NUMERROR", "numeric error", "Numeric format error", - 15, "SCE_NIM_OPERATOR", "operator", "Operators", - 16, "SCE_NIM_IDENTIFIER", "identifier", "Identifiers", -}; - -} - -class LexerNim : public DefaultLexer { - CharacterSet setWord; - WordList keywords; - OptionsNim options; - OptionSetNim osNim; - -public: - LexerNim() : - DefaultLexer("nim", SCLEX_NIM, lexicalClasses, ELEMENTS(lexicalClasses)), - setWord(CharacterSet::setAlphaNum, "_", 0x80, true) { } - - virtual ~LexerNim() { } - - void SCI_METHOD Release() noexcept override { - delete this; - } - - int SCI_METHOD Version() const noexcept override { - return lvRelease5; - } - - const char * SCI_METHOD PropertyNames() override { - return osNim.PropertyNames(); - } - - int SCI_METHOD PropertyType(const char *name) override { - return osNim.PropertyType(name); - } - - const char * SCI_METHOD DescribeProperty(const char *name) override { - return osNim.DescribeProperty(name); - } - - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; - - const char * SCI_METHOD PropertyGet(const char* key) override { - return osNim.PropertyGet(key); - } - - const char * SCI_METHOD DescribeWordListSets() override { - return osNim.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 PrimaryStyleFromStyle(int style) noexcept override { - return style; - } - - static ILexer5 *LexerFactoryNim() { - return new LexerNim(); - } -}; - -Sci_Position SCI_METHOD LexerNim::PropertySet(const char *key, const char *val) { - if (osNim.PropertySet(&options, key, val)) { - return 0; - } - - return -1; -} - -Sci_Position SCI_METHOD LexerNim::WordListSet(int n, const char *wl) { - WordList *wordListN = nullptr; - - switch (n) { - case 0: - wordListN = &keywords; - 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 LexerNim::Lex(Sci_PositionU startPos, Sci_Position length, - int initStyle, IDocument *pAccess) { - // No one likes a leaky string - if (initStyle == SCE_NIM_STRINGEOL) { - initStyle = SCE_NIM_DEFAULT; - } - - Accessor styler(pAccess, nullptr); - StyleContext sc(startPos, length, initStyle, styler); - - // Nim supports nested block comments! - Sci_Position lineCurrent = styler.GetLine(startPos); - int commentNestLevel = lineCurrent > 0 ? styler.GetLineState(lineCurrent - 1) : 0; - - int numType = NumType::Decimal; - int decimalCount = 0; - - bool funcNameExists = false; - bool isStylingRawString = false; - bool isStylingRawStringIdent = false; - - for (; sc.More(); sc.Forward()) { - if (sc.atLineStart) { - if (sc.state == SCE_NIM_STRING) { - sc.SetState(SCE_NIM_STRING); - } - - lineCurrent = styler.GetLine(sc.currentPos); - styler.SetLineState(lineCurrent, commentNestLevel); - } - - // Handle string line continuation - if (sc.ch == '\\' && (sc.chNext == '\n' || sc.chNext == '\r') && - (sc.state == SCE_NIM_STRING || sc.state == SCE_NIM_CHARACTER) && !isStylingRawString) { - sc.Forward(); - - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } - - continue; - } - - switch (sc.state) { - case SCE_NIM_OPERATOR: - funcNameExists = false; - sc.SetState(SCE_NIM_DEFAULT); - break; - case SCE_NIM_NUMBER: - // For a type suffix, such as 0x80'u8 - if (sc.ch == '\'') { - if (sc.chNext == 'i' || sc.chNext == 'I' || - sc.chNext == 'u' || sc.chNext == 'U' || - sc.chNext == 'f' || sc.chNext == 'F' || - sc.chNext == 'd' || sc.chNext == 'D') { - sc.Forward(2); - } - } else if (sc.ch == '.') { - if (IsADigit(sc.chNext)) { - sc.Forward(); - } else if (numType <= NumType::Exponent) { - sc.SetState(SCE_NIM_OPERATOR); - break; - } else { - decimalCount++; - - if (numType == NumType::Decimal) { - if (decimalCount <= 1 && !IsAWordChar(sc.chNext)) { - break; - } - } else if (numType == NumType::Hexadecimal) { - if (decimalCount <= 1 && IsADigit(sc.chNext, 16)) { - break; - } - - sc.SetState(SCE_NIM_OPERATOR); - break; - } - } - } else if (sc.ch == '_') { - // Accept only one underscore between digits - if (IsADigit(sc.chNext)) { - sc.Forward(); - } - } else if (numType == NumType::Decimal) { - if (sc.chPrev != '\'' && (sc.ch == 'e' || sc.ch == 'E')) { - numType = NumType::Exponent; - - if (sc.chNext == '-' || sc.chNext == '+') { - sc.Forward(); - } - - break; - } - - if (IsADigit(sc.ch)) { - break; - } - } else if (numType == NumType::Hexadecimal) { - if (IsADigit(sc.ch, 16)) { - break; - } - } else if (IsADigit(sc.ch)) { - if (numType == NumType::Exponent) { - break; - } - - if (numType == NumType::Octal) { - // Accept only 0-7 - if (sc.ch <= '7') { - break; - } - } else if (numType == NumType::Binary) { - // Accept only 0 and 1 - if (sc.ch <= '1') { - break; - } - } - - numType = NumType::FormatError; - break; - } - - sc.ChangeState(GetNumStyle(numType)); - sc.SetState(SCE_NIM_DEFAULT); - break; - case SCE_NIM_IDENTIFIER: - if (sc.ch == '.' || !IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - int style = SCE_NIM_IDENTIFIER; - - if (keywords.InList(s) && !funcNameExists) { - // Prevent styling keywords if they are sub-identifiers - const Sci_Position segStart = styler.GetStartSegment() - 1; - if (segStart < 0 || styler.SafeGetCharAt(segStart, '\0') != '.') { - style = SCE_NIM_WORD; - } - } else if (funcNameExists) { - style = SCE_NIM_FUNCNAME; - } - - sc.ChangeState(style); - sc.SetState(SCE_NIM_DEFAULT); - - if (style == SCE_NIM_WORD) { - funcNameExists = IsFuncName(s); - } else { - funcNameExists = false; - } - } - - if (IsAlphaNumeric(sc.ch) && sc.chNext == '\"') { - isStylingRawStringIdent = true; - - if (options.highlightRawStrIdent) { - if (styler.SafeGetCharAt(sc.currentPos + 2) == '\"' && - styler.SafeGetCharAt(sc.currentPos + 3) == '\"') { - sc.ChangeState(SCE_NIM_TRIPLEDOUBLE); - } else { - sc.ChangeState(SCE_NIM_STRING); - } - } - - sc.ForwardSetState(SCE_NIM_DEFAULT); - } - break; - case SCE_NIM_FUNCNAME: - if (sc.ch == '`') { - funcNameExists = false; - sc.ForwardSetState(SCE_NIM_DEFAULT); - } else if (sc.atLineEnd) { - // Prevent leaking the style to the next line if not closed - funcNameExists = false; - - sc.ChangeState(SCE_NIM_STRINGEOL); - sc.ForwardSetState(SCE_NIM_DEFAULT); - } - break; - case SCE_NIM_COMMENT: - if (sc.Match(']', '#')) { - if (commentNestLevel > 0) { - commentNestLevel--; - } - - lineCurrent = styler.GetLine(sc.currentPos); - styler.SetLineState(lineCurrent, commentNestLevel); - sc.Forward(); - - if (commentNestLevel == 0) { - sc.ForwardSetState(SCE_NIM_DEFAULT); - } - } else if (sc.Match('#', '[')) { - commentNestLevel++; - lineCurrent = styler.GetLine(sc.currentPos); - styler.SetLineState(lineCurrent, commentNestLevel); - } - break; - case SCE_NIM_COMMENTDOC: - if (sc.Match("]##")) { - if (commentNestLevel > 0) { - commentNestLevel--; - } - - lineCurrent = styler.GetLine(sc.currentPos); - styler.SetLineState(lineCurrent, commentNestLevel); - sc.Forward(2); - - if (commentNestLevel == 0) { - sc.ForwardSetState(SCE_NIM_DEFAULT); - } - } else if (sc.Match("##[")) { - commentNestLevel++; - lineCurrent = styler.GetLine(sc.currentPos); - styler.SetLineState(lineCurrent, commentNestLevel); - } - break; - case SCE_NIM_COMMENTLINE: - case SCE_NIM_COMMENTLINEDOC: - if (sc.atLineStart) { - sc.SetState(SCE_NIM_DEFAULT); - } - break; - case SCE_NIM_STRING: - if (!isStylingRawStringIdent && !isStylingRawString && sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (isStylingRawString && sc.ch == '\"' && sc.chNext == '\"') { - // Forward in situations such as r"a""bc\" so that "bc\" wouldn't be - // considered a string of its own - sc.Forward(); - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_NIM_DEFAULT); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_NIM_STRINGEOL); - sc.ForwardSetState(SCE_NIM_DEFAULT); - } - break; - case SCE_NIM_CHARACTER: - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_NIM_DEFAULT); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_NIM_STRINGEOL); - sc.ForwardSetState(SCE_NIM_DEFAULT); - } - break; - case SCE_NIM_BACKTICKS: - if (sc.ch == '`' ) { - sc.ForwardSetState(SCE_NIM_DEFAULT); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_NIM_STRINGEOL); - sc.ForwardSetState(SCE_NIM_DEFAULT); - } - break; - case SCE_NIM_TRIPLEDOUBLE: - if (sc.Match(R"(""")")) { - - // Outright forward all " after the closing """ as a triple double - // - // A valid example where this is needed is: """8 double quotes->"""""""" - // You can have as many """ at the end as you wish, as long as the actual - // closing literal is there - while (sc.ch == '"') { - sc.Forward(); - } - - sc.SetState(SCE_NIM_DEFAULT); - } - break; - case SCE_NIM_TRIPLE: - if (sc.Match("'''")) { - sc.Forward(2); - sc.ForwardSetState(SCE_NIM_DEFAULT); - } - break; - } - - if (sc.state == SCE_NIM_DEFAULT) { - // Number - if (IsADigit(sc.ch)) { - sc.SetState(SCE_NIM_NUMBER); - - numType = NumType::Decimal; - decimalCount = 0; - - if (sc.ch == '0') { - if (IsNumHex(sc)) { - numType = NumType::Hexadecimal; - } else if (IsNumBinary(sc)) { - numType = NumType::Binary; - } else if (IsNumOctal(sc)) { - numType = NumType::Octal; - } - - if (numType != NumType::Decimal) { - sc.Forward(); - } - } - } - // Raw string - else if (IsAlphaNumeric(sc.ch) && sc.chNext == '\"') { - isStylingRawString = true; - - // Triple doubles can be raw strings too. How sweet - if (styler.SafeGetCharAt(sc.currentPos + 2) == '\"' && - styler.SafeGetCharAt(sc.currentPos + 3) == '\"') { - sc.SetState(SCE_NIM_TRIPLEDOUBLE); - } else { - sc.SetState(SCE_NIM_STRING); - } - - const int rawStrStyle = options.highlightRawStrIdent ? IsLetter(sc.ch) : - (sc.ch == 'r' || sc.ch == 'R'); - - if (rawStrStyle) { - sc.Forward(); - - if (sc.state == SCE_NIM_TRIPLEDOUBLE) { - sc.Forward(2); - } - } else { - // Anything other than r/R is considered a general raw string identifier - isStylingRawStringIdent = true; - sc.SetState(SCE_NIM_IDENTIFIER); - } - } - // String and triple double literal - else if (sc.ch == '\"') { - isStylingRawString = false; - - if (sc.Match(R"(""")")) { - sc.SetState(SCE_NIM_TRIPLEDOUBLE); - - // Keep forwarding until the total opening literal count is 5 - // A valid example where this is needed is: """""<-5 double quotes""" - while (sc.ch == '"') { - sc.Forward(); - - if (sc.Match(R"(""")")) { - sc.Forward(); - break; - } - } - } else { - sc.SetState(SCE_NIM_STRING); - } - } - // Charecter and triple literal - else if (sc.ch == '\'') { - if (sc.Match("'''")) { - sc.SetState(SCE_NIM_TRIPLE); - } else { - sc.SetState(SCE_NIM_CHARACTER); - } - } - // Operator definition - else if (sc.ch == '`') { - if (funcNameExists) { - sc.SetState(SCE_NIM_FUNCNAME); - } else { - sc.SetState(SCE_NIM_BACKTICKS); - } - } - // Keyword - else if (iswordstart(sc.ch)) { - sc.SetState(SCE_NIM_IDENTIFIER); - } - // Comments - else if (sc.ch == '#') { - if (sc.Match("##[") || sc.Match("#[")) { - commentNestLevel++; - lineCurrent = styler.GetLine(sc.currentPos); - styler.SetLineState(lineCurrent, commentNestLevel); - } - - if (sc.Match("##[")) { - sc.SetState(SCE_NIM_COMMENTDOC); - sc.Forward(); - } else if (sc.Match("#[")) { - sc.SetState(SCE_NIM_COMMENT); - sc.Forward(); - } else if (sc.Match("##")) { - sc.SetState(SCE_NIM_COMMENTLINEDOC); - } else { - sc.SetState(SCE_NIM_COMMENTLINE); - } - } - // Operators - else if (strchr("()[]{}:=;-\\/&%$!+<>|^?,.*~@", sc.ch)) { - sc.SetState(SCE_NIM_OPERATOR); - } - } - - if (sc.atLineEnd) { - funcNameExists = false; - isStylingRawString = false; - isStylingRawStringIdent = false; - } - } - - sc.Complete(); -} - -void SCI_METHOD LexerNim::Fold(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) { - if (!options.fold) { - return; - } - - Accessor styler(pAccess, nullptr); - - const Sci_Position docLines = styler.GetLine(styler.Length()); - const Sci_Position maxPos = startPos + length; - const Sci_Position maxLines = styler.GetLine(maxPos == styler.Length() ? maxPos : maxPos - 1); - - Sci_Position lineCurrent = styler.GetLine(startPos); - int indentCurrent = IndentAmount(lineCurrent, styler); - - while (lineCurrent > 0) { - lineCurrent--; - indentCurrent = IndentAmount(lineCurrent, styler); - - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - break; - } - } - - int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; - indentCurrent = indentCurrentLevel | (indentCurrent & ~SC_FOLDLEVELNUMBERMASK); - - while (lineCurrent <= docLines && lineCurrent <= maxLines) { - Sci_Position lineNext = lineCurrent + 1; - int indentNext = indentCurrent; - int lev = indentCurrent; - - if (lineNext <= docLines) { - indentNext = IndentAmount(lineNext, styler); - } - - if (indentNext & SC_FOLDLEVELWHITEFLAG) { - indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel; - } - - while (lineNext < docLines && (indentNext & SC_FOLDLEVELWHITEFLAG)) { - lineNext++; - indentNext = IndentAmount(lineNext, styler); - } - - const int indentNextLevel = indentNext & SC_FOLDLEVELNUMBERMASK; - indentNext = indentNextLevel | (indentNext & ~SC_FOLDLEVELNUMBERMASK); - - const int levelBeforeComments = std::max(indentCurrentLevel, indentNextLevel); - - Sci_Position skipLine = lineNext; - int skipLevel = indentNextLevel; - - while (--skipLine > lineCurrent) { - const int skipLineIndent = IndentAmount(skipLine, styler); - - if (options.foldCompact) { - if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > indentNextLevel) { - skipLevel = levelBeforeComments; - } - - const 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); - } - } - - if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - - styler.SetLevel(lineCurrent, options.foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG); - - indentCurrent = indentNext; - indentCurrentLevel = indentNextLevel; - lineCurrent = lineNext; - } -} - -LexerModule lmNim(SCLEX_NIM, LexerNim::LexerFactoryNim, "nim", nimWordListDesc);
\ No newline at end of file diff --git a/lexers/LexNimrod.cxx b/lexers/LexNimrod.cxx deleted file mode 100644 index 5526ff843..000000000 --- a/lexers/LexNimrod.cxx +++ /dev/null @@ -1,431 +0,0 @@ -// Scintilla source code edit control -// Nimrod lexer -// (c) 2009 Andreas Rumpf -/** @file LexNimrod.cxx - ** Lexer for Nimrod. - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool IsAWordChar(int ch) { - return (ch >= 0x80) || isalnum(ch) || ch == '_'; -} - -static Sci_Position tillEndOfTripleQuote(Accessor &styler, Sci_Position pos, Sci_Position max) { - /* search for """ */ - for (;;) { - if (styler.SafeGetCharAt(pos, '\0') == '\0') return pos; - if (pos >= max) return pos; - if (styler.Match(pos, "\"\"\"")) { - return pos + 2; - } - pos++; - } -} - -#define CR 13 /* use both because Scite allows changing the line ending */ -#define LF 10 - -static bool inline isNewLine(int ch) { - return ch == CR || ch == LF; -} - -static Sci_Position scanString(Accessor &styler, Sci_Position pos, Sci_Position max, bool rawMode) { - for (;;) { - if (pos >= max) return pos; - char ch = styler.SafeGetCharAt(pos, '\0'); - if (ch == CR || ch == LF || ch == '\0') return pos; - if (ch == '"') return pos; - if (ch == '\\' && !rawMode) { - pos += 2; - } else { - pos++; - } - } -} - -static Sci_Position scanChar(Accessor &styler, Sci_Position pos, Sci_Position max) { - for (;;) { - if (pos >= max) return pos; - char ch = styler.SafeGetCharAt(pos, '\0'); - if (ch == CR || ch == LF || ch == '\0') return pos; - if (ch == '\'' && !isalnum(styler.SafeGetCharAt(pos+1, '\0')) ) - return pos; - if (ch == '\\') { - pos += 2; - } else { - pos++; - } - } -} - -static Sci_Position scanIdent(Accessor &styler, Sci_Position pos, WordList &keywords) { - char buf[100]; /* copy to lowercase and ignore underscores */ - Sci_Position i = 0; - - for (;;) { - char ch = styler.SafeGetCharAt(pos, '\0'); - if (!IsAWordChar(ch)) break; - if (ch != '_' && i < ((int)sizeof(buf))-1) { - buf[i] = static_cast<char>(tolower(ch)); - i++; - } - pos++; - } - buf[i] = '\0'; - /* look for keyword */ - if (keywords.InList(buf)) { - styler.ColourTo(pos-1, SCE_P_WORD); - } else { - styler.ColourTo(pos-1, SCE_P_IDENTIFIER); - } - return pos; -} - -static Sci_Position scanNumber(Accessor &styler, Sci_Position pos) { - char ch, ch2; - ch = styler.SafeGetCharAt(pos, '\0'); - ch2 = styler.SafeGetCharAt(pos+1, '\0'); - if (ch == '0' && (ch2 == 'b' || ch2 == 'B')) { - /* binary number: */ - pos += 2; - for (;;) { - ch = styler.SafeGetCharAt(pos, '\0'); - if (ch == '_' || (ch >= '0' && ch <= '1')) ++pos; - else break; - } - } else if (ch == '0' && - (ch2 == 'o' || ch2 == 'O' || ch2 == 'c' || ch2 == 'C')) { - /* octal number: */ - pos += 2; - for (;;) { - ch = styler.SafeGetCharAt(pos, '\0'); - if (ch == '_' || (ch >= '0' && ch <= '7')) ++pos; - else break; - } - } else if (ch == '0' && (ch2 == 'x' || ch2 == 'X')) { - /* hexadecimal number: */ - pos += 2; - for (;;) { - ch = styler.SafeGetCharAt(pos, '\0'); - if (ch == '_' || (ch >= '0' && ch <= '9') - || (ch >= 'a' && ch <= 'f') - || (ch >= 'A' && ch <= 'F')) ++pos; - else break; - } - } else { - // skip decimal part: - for (;;) { - ch = styler.SafeGetCharAt(pos, '\0'); - if (ch == '_' || (ch >= '0' && ch <= '9')) ++pos; - else break; - } - ch2 = styler.SafeGetCharAt(pos+1, '\0'); - if (ch == '.' && ch2 >= '0' && ch2 <= '9') { - ++pos; // skip '.' - for (;;) { - ch = styler.SafeGetCharAt(pos, '\0'); - if (ch == '_' || (ch >= '0' && ch <= '9')) ++pos; - else break; - } - } - if (ch == 'e' || ch == 'E') { - ++pos; - ch = styler.SafeGetCharAt(pos, '\0'); - if (ch == '-' || ch == '+') ++pos; - for (;;) { - ch = styler.SafeGetCharAt(pos, '\0'); - if (ch == '_' || (ch >= '0' && ch <= '9')) ++pos; - else break; - } - } - } - if (ch == '\'') { - /* a type suffix: */ - pos++; - for (;;) { - ch = styler.SafeGetCharAt(pos); - if ((ch >= '0' && ch <= '9') || (ch >= 'A' && ch <= 'Z') - || (ch >= 'a' && ch <= 'z') || ch == '_') ++pos; - else break; - } - } - styler.ColourTo(pos-1, SCE_P_NUMBER); - return pos; -} - -/* rewritten from scratch, because I couldn't get rid of the bugs... - (A character based approach sucks!) -*/ -static void ColouriseNimrodDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - Sci_Position pos = startPos; - Sci_Position max = startPos + length; - char ch; - WordList &keywords = *keywordlists[0]; - - styler.StartAt(startPos); - styler.StartSegment(startPos); - - switch (initStyle) { - /* check where we are: */ - case SCE_P_TRIPLEDOUBLE: - pos = tillEndOfTripleQuote(styler, pos, max); - styler.ColourTo(pos, SCE_P_TRIPLEDOUBLE); - pos++; - break; - default: /* nothing to do: */ - break; - } - while (pos < max) { - ch = styler.SafeGetCharAt(pos, '\0'); - switch (ch) { - case '\0': return; - case '#': { - bool doccomment = (styler.SafeGetCharAt(pos+1) == '#'); - while (pos < max && !isNewLine(styler.SafeGetCharAt(pos, LF))) pos++; - if (doccomment) - styler.ColourTo(pos, SCE_C_COMMENTLINEDOC); - else - styler.ColourTo(pos, SCE_P_COMMENTLINE); - } break; - case 'r': case 'R': { - if (styler.SafeGetCharAt(pos+1) == '"') { - pos = scanString(styler, pos+2, max, true); - styler.ColourTo(pos, SCE_P_STRING); - pos++; - } else { - pos = scanIdent(styler, pos, keywords); - } - } break; - case '"': - if (styler.Match(pos+1, "\"\"")) { - pos = tillEndOfTripleQuote(styler, pos+3, max); - styler.ColourTo(pos, SCE_P_TRIPLEDOUBLE); - } else { - pos = scanString(styler, pos+1, max, false); - styler.ColourTo(pos, SCE_P_STRING); - } - pos++; - break; - case '\'': - pos = scanChar(styler, pos+1, max); - styler.ColourTo(pos, SCE_P_CHARACTER); - pos++; - break; - default: // identifers, numbers, operators, whitespace - if (ch >= '0' && ch <= '9') { - pos = scanNumber(styler, pos); - } else if (IsAWordChar(ch)) { - pos = scanIdent(styler, pos, keywords); - } else if (ch == '`') { - pos++; - while (pos < max) { - ch = styler.SafeGetCharAt(pos, LF); - if (ch == '`') { - ++pos; - break; - } - if (ch == CR || ch == LF) break; - ++pos; - } - styler.ColourTo(pos, SCE_P_IDENTIFIER); - } else if (strchr("()[]{}:=;-\\/&%$!+<>|^?,.*~@", ch)) { - styler.ColourTo(pos, SCE_P_OPERATOR); - pos++; - } else { - styler.ColourTo(pos, SCE_P_DEFAULT); - pos++; - } - break; - } - } -} - -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 bool IsQuoteLine(Sci_Position line, Accessor &styler) { - int style = styler.StyleAt(styler.LineStart(line)) & 31; - return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE)); -} - - -static void FoldNimrodDoc(Sci_PositionU startPos, Sci_Position length, - int /*initStyle - unused*/, - WordList *[], Accessor &styler) { - 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 - const bool foldComment = styler.GetPropertyInt("fold.comment.nimrod") != 0; - const bool foldQuotes = styler.GetPropertyInt("fold.quotes.nimrod") != 0; - - // 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, NULL); - while (lineCurrent > 0) { - lineCurrent--; - indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); - 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_P_DEFAULT & 31; - if (lineCurrent >= 1) - prev_state = styler.StyleAt(startPos - 1) & 31; - int prevQuote = foldQuotes && ((prev_state == SCE_P_TRIPLE) || - (prev_state == SCE_P_TRIPLEDOUBLE)); - int prevComment = 0; - if (lineCurrent >= 1) - prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler); - - // Process all characters to end of requested range or end of any triple quote - // or comment that hangs over the end of the range. Cap processing in all cases - // to end of document (in case of unclosed quote or comment at end). - while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || - prevQuote || prevComment)) { - - // 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, NULL); - int style = styler.StyleAt(styler.LineStart(lineNext)) & 31; - quote = foldQuotes && ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE)); - } - const int quote_start = (quote && !prevQuote); - const int quote_continue = (quote && prevQuote); - 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 ((!quote || !prevQuote) && !comment) - 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; - } else 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 (!quote && - (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 = - Maximum(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 ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) - skipLevel = levelBeforeComments; - - int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; - - styler.SetLevel(skipLine, skipLevel | whiteFlag); - } - - // Set fold header on non-quote/non-comment line - if (!quote && !comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) { - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < - (indentNext & SC_FOLDLEVELNUMBERMASK)) - lev |= SC_FOLDLEVELHEADERFLAG; - } - - // Keep track of triple quote and block comment state of previous line - prevQuote = quote; - prevComment = comment_start || comment_continue; - - // Set fold level for this line and move to next line - styler.SetLevel(lineCurrent, lev); - 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); -} - -static const char * const nimrodWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmNimrod(SCLEX_NIMROD, ColouriseNimrodDoc, "nimrod", FoldNimrodDoc, - nimrodWordListDesc); diff --git a/lexers/LexNsis.cxx b/lexers/LexNsis.cxx deleted file mode 100644 index 3b2b8a3ad..000000000 --- a/lexers/LexNsis.cxx +++ /dev/null @@ -1,660 +0,0 @@ -// Scintilla source code edit control -/** @file LexNsis.cxx - ** Lexer for NSIS - **/ -// Copyright 2003 - 2005 by Angelo Mandato <angelo [at] spaceblue [dot] com> -// Last Updated: 03/13/2005 -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -/* -// located in SciLexer.h -#define SCLEX_NSIS 43 - -#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 -// ADDED for Scintilla v1.63 -#define SCE_NSIS_SECTIONGROUP 15 -#define SCE_NSIS_PAGEEX 16 -#define SCE_NSIS_FUNCTIONDEF 17 -#define SCE_NSIS_COMMENTBOX 18 -*/ - -static bool isNsisNumber(char ch) -{ - return (ch >= '0' && ch <= '9'); -} - -static bool isNsisChar(char ch) -{ - return (ch == '.' ) || (ch == '_' ) || isNsisNumber(ch) || (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); -} - -static bool isNsisLetter(char ch) -{ - return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z'); -} - -static bool NsisNextLineHasElse(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 found 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( cNext == '!' ) - { - if( styler.Match(firstChar, "!else") ) - return true; - } - break; - } - - return false; -} - -static int NsisCmp( const char *s1, const char *s2, bool bIgnoreCase ) -{ - if( bIgnoreCase ) - return CompareCaseInsensitive( s1, s2); - - return strcmp( s1, s2 ); -} - -static int calculateFoldNsis(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd ) -{ - int style = styler.StyleAt(end); - - // If the word is too long, it is not what we are looking for - if( end - start > 20 ) - return foldlevel; - - if( foldUtilityCmd ) - { - // Check the style at this point, if it is not valid, then return zero - if( style != SCE_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF && - style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_IFDEFINEDEF && - style != SCE_NSIS_MACRODEF && style != SCE_NSIS_SECTIONGROUP && - style != SCE_NSIS_PAGEEX ) - return foldlevel; - } - else - { - if( style != SCE_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF && - style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_SECTIONGROUP && - style != SCE_NSIS_PAGEEX ) - return foldlevel; - } - - int newFoldlevel = foldlevel; - bool bIgnoreCase = false; - if( styler.GetPropertyInt("nsis.ignorecase") == 1 ) - bIgnoreCase = true; - - char s[20]; // The key word we are looking for has atmost 13 characters - s[0] = '\0'; - for (Sci_PositionU i = 0; i < end - start + 1 && i < 19; i++) - { - s[i] = static_cast<char>( styler[ start + i ] ); - s[i + 1] = '\0'; - } - - if( s[0] == '!' ) - { - if( NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifmacrodef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifmacrondef", bIgnoreCase ) == 0 || NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!macro", bIgnoreCase ) == 0 ) - newFoldlevel++; - else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 ) - newFoldlevel--; - else if( bElse && NsisCmp(s, "!else", bIgnoreCase) == 0 ) - newFoldlevel++; - } - else - { - if( NsisCmp(s, "Section", bIgnoreCase ) == 0 || NsisCmp(s, "SectionGroup", bIgnoreCase ) == 0 || NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "SubSection", bIgnoreCase ) == 0 || NsisCmp(s, "PageEx", bIgnoreCase ) == 0 ) - newFoldlevel++; - else if( NsisCmp(s, "SectionGroupEnd", bIgnoreCase ) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase ) == 0 ) - newFoldlevel--; - } - - return newFoldlevel; -} - -static int classifyWordNsis(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler ) -{ - bool bIgnoreCase = false; - if( styler.GetPropertyInt("nsis.ignorecase") == 1 ) - bIgnoreCase = true; - - bool bUserVars = false; - if( styler.GetPropertyInt("nsis.uservars") == 1 ) - bUserVars = true; - - char s[100]; - s[0] = '\0'; - s[1] = '\0'; - - WordList &Functions = *keywordLists[0]; - WordList &Variables = *keywordLists[1]; - WordList &Lables = *keywordLists[2]; - WordList &UserDefined = *keywordLists[3]; - - for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++) - { - if( bIgnoreCase ) - s[i] = static_cast<char>( tolower(styler[ start + i ] ) ); - else - s[i] = static_cast<char>( styler[ start + i ] ); - s[i + 1] = '\0'; - } - - // Check for special words... - if( NsisCmp(s, "!macro", bIgnoreCase ) == 0 || NsisCmp(s, "!macroend", bIgnoreCase) == 0 ) // Covers !macro and !macroend - return SCE_NSIS_MACRODEF; - - if( NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 ) // Covers !ifdef, !ifndef and !endif - return SCE_NSIS_IFDEFINEDEF; - - if( NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // Covers !if and else - return SCE_NSIS_IFDEFINEDEF; - - if (NsisCmp(s, "!ifmacrodef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifmacrondef", bIgnoreCase ) == 0 ) // Covers !ifmacrodef and !ifnmacrodef - return SCE_NSIS_IFDEFINEDEF; - - if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd - return SCE_NSIS_SECTIONGROUP; - - if( NsisCmp(s, "Section", bIgnoreCase ) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase) == 0 ) // Covers Section and SectionEnd - return SCE_NSIS_SECTIONDEF; - - if( NsisCmp(s, "SubSection", bIgnoreCase) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase) == 0 ) // Covers SubSection and SubSectionEnd - return SCE_NSIS_SUBSECTIONDEF; - - if( NsisCmp(s, "PageEx", bIgnoreCase) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase) == 0 ) // Covers PageEx and PageExEnd - return SCE_NSIS_PAGEEX; - - if( NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 ) // Covers Function and FunctionEnd - return SCE_NSIS_FUNCTIONDEF; - - if ( Functions.InList(s) ) - return SCE_NSIS_FUNCTION; - - if ( Variables.InList(s) ) - return SCE_NSIS_VARIABLE; - - if ( Lables.InList(s) ) - return SCE_NSIS_LABEL; - - if( UserDefined.InList(s) ) - return SCE_NSIS_USERDEFINED; - - if( strlen(s) > 3 ) - { - if( s[1] == '{' && s[strlen(s)-1] == '}' ) - return SCE_NSIS_VARIABLE; - } - - // See if the variable is a user defined variable - if( s[0] == '$' && bUserVars ) - { - bool bHasSimpleNsisChars = true; - for (Sci_PositionU j = 1; j < end - start + 1 && j < 99; j++) - { - if( !isNsisChar( s[j] ) ) - { - bHasSimpleNsisChars = false; - break; - } - } - - if( bHasSimpleNsisChars ) - return SCE_NSIS_VARIABLE; - } - - // To check for numbers - if( isNsisNumber( s[0] ) ) - { - bool bHasSimpleNsisNumber = true; - for (Sci_PositionU j = 1; j < end - start + 1 && j < 99; j++) - { - if( !isNsisNumber( s[j] ) ) - { - bHasSimpleNsisNumber = false; - break; - } - } - - if( bHasSimpleNsisNumber ) - return SCE_NSIS_NUMBER; - } - - return SCE_NSIS_DEFAULT; -} - -static void ColouriseNsisDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) -{ - int state = SCE_NSIS_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_NSIS_DEFAULT: - if( cCurrChar == ';' || cCurrChar == '#' ) // we have a comment line - { - styler.ColourTo(i-1, state ); - state = SCE_NSIS_COMMENT; - break; - } - if( cCurrChar == '"' ) - { - styler.ColourTo(i-1, state ); - state = SCE_NSIS_STRINGDQ; - bVarInString = false; - bClassicVarInString = false; - break; - } - if( cCurrChar == '\'' ) - { - styler.ColourTo(i-1, state ); - state = SCE_NSIS_STRINGRQ; - bVarInString = false; - bClassicVarInString = false; - break; - } - if( cCurrChar == '`' ) - { - styler.ColourTo(i-1, state ); - state = SCE_NSIS_STRINGLQ; - bVarInString = false; - bClassicVarInString = false; - break; - } - - // NSIS KeyWord,Function, Variable, UserDefined: - if( cCurrChar == '$' || isNsisChar(cCurrChar) || cCurrChar == '!' ) - { - styler.ColourTo(i-1,state); - state = SCE_NSIS_FUNCTION; - - // If it is a number, we must check and set style here first... - if( isNsisNumber(cCurrChar) && (cNextChar == '\t' || cNextChar == ' ' || cNextChar == '\r' || cNextChar == '\n' ) ) - styler.ColourTo( i, SCE_NSIS_NUMBER); - - break; - } - - if( cCurrChar == '/' && cNextChar == '*' ) - { - styler.ColourTo(i-1,state); - state = SCE_NSIS_COMMENTBOX; - break; - } - - break; - case SCE_NSIS_COMMENT: - if( cNextChar == '\n' || cNextChar == '\r' ) - { - // Special case: - if( cCurrChar == '\\' ) - { - styler.ColourTo(i-2,state); - styler.ColourTo(i,SCE_NSIS_DEFAULT); - } - else - { - styler.ColourTo(i,state); - state = SCE_NSIS_DEFAULT; - } - } - break; - case SCE_NSIS_STRINGDQ: - case SCE_NSIS_STRINGLQ: - case SCE_NSIS_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_NSIS_STRINGDQ ) - { - styler.ColourTo(i,state); - state = SCE_NSIS_DEFAULT; - break; - } - - if( cCurrChar == '`' && state == SCE_NSIS_STRINGLQ ) - { - styler.ColourTo(i,state); - state = SCE_NSIS_DEFAULT; - break; - } - - if( cCurrChar == '\'' && state == SCE_NSIS_STRINGRQ ) - { - styler.ColourTo(i,state); - state = SCE_NSIS_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_NSIS_DEFAULT; - } - } - break; - - case SCE_NSIS_FUNCTION: - - // NSIS KeyWord: - if( cCurrChar == '$' ) - state = SCE_NSIS_DEFAULT; - else if( cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) ) - state = SCE_NSIS_DEFAULT; - else if( (isNsisChar(cCurrChar) && !isNsisChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' ) - { - state = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler ); - styler.ColourTo( i, state); - state = SCE_NSIS_DEFAULT; - } - else if( !isNsisChar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' ) - { - if( classifyWordNsis( styler.GetStartSegment(), i-1, keywordLists, styler) == SCE_NSIS_NUMBER ) - styler.ColourTo( i-1, SCE_NSIS_NUMBER ); - - state = SCE_NSIS_DEFAULT; - - if( cCurrChar == '"' ) - { - state = SCE_NSIS_STRINGDQ; - bVarInString = false; - bClassicVarInString = false; - } - else if( cCurrChar == '`' ) - { - state = SCE_NSIS_STRINGLQ; - bVarInString = false; - bClassicVarInString = false; - } - else if( cCurrChar == '\'' ) - { - state = SCE_NSIS_STRINGRQ; - bVarInString = false; - bClassicVarInString = false; - } - else if( cCurrChar == '#' || cCurrChar == ';' ) - { - state = SCE_NSIS_COMMENT; - } - } - break; - case SCE_NSIS_COMMENTBOX: - - if( styler.SafeGetCharAt(i-1) == '*' && cCurrChar == '/' ) - { - styler.ColourTo(i,state); - state = SCE_NSIS_DEFAULT; - } - break; - } - - if( state == SCE_NSIS_COMMENT || state == SCE_NSIS_COMMENTBOX ) - { - styler.ColourTo(i,state); - } - else if( state == SCE_NSIS_STRINGDQ || state == SCE_NSIS_STRINGLQ || state == SCE_NSIS_STRINGRQ ) - { - bool bIngoreNextDollarSign = false; - bool bUserVars = false; - if( styler.GetPropertyInt("nsis.uservars") == 1 ) - bUserVars = true; - - 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_NSIS_STRINGVAR); - bVarInString = false; - bIngoreNextDollarSign = false; - } - - // Covers "$INSTDIR and user vars like $MYVAR" - else if( bVarInString && !isNsisChar(cNextChar) ) - { - int nWordState = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler); - if( nWordState == SCE_NSIS_VARIABLE ) - styler.ColourTo( i, SCE_NSIS_STRINGVAR); - else if( bUserVars ) - styler.ColourTo( i, SCE_NSIS_STRINGVAR); - bVarInString = false; - } - // Covers "${TEST}..." - else if( bClassicVarInString && cNextChar == '}' ) - { - styler.ColourTo( i+1, SCE_NSIS_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 FoldNsisDoc(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; - bool foldUtilityCmd = styler.GetPropertyInt("nsis.foldutilcmd", 1) == 1; - bool blockComment = false; - - 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; - int style = styler.StyleAt(safeStartPos); - if( style == SCE_NSIS_COMMENTBOX ) - { - if( styler.SafeGetCharAt(safeStartPos) == '/' && styler.SafeGetCharAt(safeStartPos+1) == '*' ) - levelNext++; - blockComment = true; - } - - for (Sci_PositionU i = safeStartPos; i < startPos + length; i++) - { - char chCurr = styler.SafeGetCharAt(i); - style = styler.StyleAt(i); - if( blockComment && style != SCE_NSIS_COMMENTBOX ) - { - levelNext--; - blockComment = false; - } - else if( !blockComment && style == SCE_NSIS_COMMENTBOX ) - { - levelNext++; - blockComment = true; - } - - if( bArg1 && !blockComment) - { - if( nWordStart == -1 && (isNsisLetter(chCurr) || chCurr == '!') ) - { - nWordStart = i; - } - else if( isNsisLetter(chCurr) == false && nWordStart > -1 ) - { - int newLevel = calculateFoldNsis( nWordStart, i-1, levelNext, styler, foldAtElse, foldUtilityCmd ); - - if( newLevel == levelNext ) - { - if( foldAtElse && foldUtilityCmd ) - { - if( NsisNextLineHasElse(i, startPos + length, styler) ) - levelNext--; - } - } - else - levelNext = newLevel; - bArg1 = false; - } - } - - if( chCurr == '\n' ) - { - if( bArg1 && foldAtElse && foldUtilityCmd && !blockComment ) - { - if( NsisNextLineHasElse(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 nsisWordLists[] = { - "Functions", - "Variables", - "Lables", - "UserDefined", - 0, }; - - -LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists); - diff --git a/lexers/LexNull.cxx b/lexers/LexNull.cxx deleted file mode 100644 index 15a3a50aa..000000000 --- a/lexers/LexNull.cxx +++ /dev/null @@ -1,38 +0,0 @@ -// Scintilla source code edit control -/** @file LexNull.cxx - ** Lexer for no language. Used for plain text and unrecognized files. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static void ColouriseNullDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], - Accessor &styler) { - // Null 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); - } -} - -LexerModule lmNull(SCLEX_NULL, ColouriseNullDoc, "null"); diff --git a/lexers/LexOScript.cxx b/lexers/LexOScript.cxx deleted file mode 100644 index 3fe407063..000000000 --- a/lexers/LexOScript.cxx +++ /dev/null @@ -1,546 +0,0 @@ -// Scintilla source code edit control -/** @file LexOScript.cxx - ** Lexer for OScript sources; ocx files and/or OSpace dumps. - ** OScript is a programming language used to develop applications for the - ** Livelink server platform. - **/ -// Written by Ferdinand Prantl <prantlf@gmail.com>, inspired by the code from -// LexVB.cxx and LexPascal.cxx. The License.txt file describes the conditions -// under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// ----------------------------------------- -// Functions classifying a single character. - -// This function is generic and should be probably moved to CharSet.h where -// IsAlphaNumeric the others reside. -inline bool IsAlpha(int ch) { - return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); -} - -static inline bool IsIdentifierChar(int ch) { - // Identifiers cannot contain non-ASCII letters; a word with non-English - // language-specific characters cannot be an identifier. - return IsAlphaNumeric(ch) || ch == '_'; -} - -static inline bool IsIdentifierStart(int ch) { - // Identifiers cannot contain non-ASCII letters; a word with non-English - // language-specific characters cannot be an identifier. - return IsAlpha(ch) || ch == '_'; -} - -static inline bool IsNumberChar(int ch, int chNext) { - // Numeric constructs are not checked for lexical correctness. They are - // expected to look like +1.23-E9 but actually any bunch of the following - // characters will be styled as number. - // KNOWN PROBLEM: if you put + or - operators immediately after a number - // and the next operand starts with the letter E, the operator will not be - // recognized and it will be styled together with the preceding number. - // This should not occur; at least not often. The coding style recommends - // putting spaces around operators. - return IsADigit(ch) || toupper(ch) == 'E' || ch == '.' || - ((ch == '-' || ch == '+') && toupper(chNext) == 'E'); -} - -// This function checks for the start or a natural number without any symbols -// or operators as a prefix; the IsPrefixedNumberStart should be called -// immediately after this one to cover all possible numeric constructs. -static inline bool IsNaturalNumberStart(int ch) { - return IsADigit(ch) != 0; -} - -static inline bool IsPrefixedNumberStart(int ch, int chNext) { - // KNOWN PROBLEM: if you put + or - operators immediately before a number - // the operator will not be recognized and it will be styled together with - // the succeeding number. This should not occur; at least not often. The - // coding style recommends putting spaces around operators. - return (ch == '.' || ch == '-' || ch == '+') && IsADigit(chNext); -} - -static inline bool IsOperator(int ch) { - return strchr("%^&*()-+={}[]:;<>,/?!.~|\\", ch) != NULL; -} - -// --------------------------------------------------------------- -// Functions classifying a token currently processed in the lexer. - -// Checks if the current line starts with the preprocessor directive used -// usually to introduce documentation comments: #ifdef DOC. This method is -// supposed to be called if the line has been recognized as a preprocessor -// directive already. -static bool IsDocCommentStart(StyleContext &sc) { - // Check the line back to its start only if the end looks promising. - if (sc.LengthCurrent() == 10 && !IsAlphaNumeric(sc.ch)) { - char s[11]; - sc.GetCurrentLowered(s, sizeof(s)); - return strcmp(s, "#ifdef doc") == 0; - } - return false; -} - -// Checks if the current line starts with the preprocessor directive that -// is complementary to the #ifdef DOC start: #endif. This method is supposed -// to be called if the current state point to the documentation comment. -// QUESTIONAL ASSUMPTION: The complete #endif directive is not checked; just -// the starting #e. However, there is no other preprocessor directive with -// the same starting letter and thus this optimization should always work. -static bool IsDocCommentEnd(StyleContext &sc) { - return sc.ch == '#' && sc.chNext == 'e'; -} - -class IdentifierClassifier { - WordList &keywords; // Passed from keywords property. - WordList &constants; // Passed from keywords2 property. - WordList &operators; // Passed from keywords3 property. - WordList &types; // Passed from keywords4 property. - WordList &functions; // Passed from keywords5 property. - WordList &objects; // Passed from keywords6 property. - - IdentifierClassifier(IdentifierClassifier const&); - IdentifierClassifier& operator=(IdentifierClassifier const&); - -public: - IdentifierClassifier(WordList *keywordlists[]) : - keywords(*keywordlists[0]), constants(*keywordlists[1]), - operators(*keywordlists[2]), types(*keywordlists[3]), - functions(*keywordlists[4]), objects(*keywordlists[5]) - {} - - void ClassifyIdentifier(StyleContext &sc) { - // Opening parenthesis following an identifier makes it a possible - // function call. - // KNOWN PROBLEM: If some whitespace is inserted between the - // identifier and the parenthesis they will not be able to be - // recognized as a function call. This should not occur; at - // least not often. Such coding style would be weird. - if (sc.Match('(')) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - // Before an opening brace can be control statements and - // operators too; function call is the last option. - if (keywords.InList(s)) { - sc.ChangeState(SCE_OSCRIPT_KEYWORD); - } else if (operators.InList(s)) { - sc.ChangeState(SCE_OSCRIPT_OPERATOR); - } else if (functions.InList(s)) { - sc.ChangeState(SCE_OSCRIPT_FUNCTION); - } else { - sc.ChangeState(SCE_OSCRIPT_METHOD); - } - sc.SetState(SCE_OSCRIPT_OPERATOR); - } else { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - // A dot following an identifier means an access to an object - // member. The related object identifier can be special. - // KNOWN PROBLEM: If there is whitespace between the identifier - // and the following dot, the identifier will not be recognized - // as an object in an object member access. If it is one of the - // listed static objects it will not be styled. - if (sc.Match('.') && objects.InList(s)) { - sc.ChangeState(SCE_OSCRIPT_OBJECT); - sc.SetState(SCE_OSCRIPT_OPERATOR); - } else { - if (keywords.InList(s)) { - sc.ChangeState(SCE_OSCRIPT_KEYWORD); - } else if (constants.InList(s)) { - sc.ChangeState(SCE_OSCRIPT_CONSTANT); - } else if (operators.InList(s)) { - sc.ChangeState(SCE_OSCRIPT_OPERATOR); - } else if (types.InList(s)) { - sc.ChangeState(SCE_OSCRIPT_TYPE); - } else if (functions.InList(s)) { - sc.ChangeState(SCE_OSCRIPT_FUNCTION); - } - sc.SetState(SCE_OSCRIPT_DEFAULT); - } - } - } -}; - -// ------------------------------------------------ -// Function colourising an excerpt of OScript code. - -static void ColouriseOScriptDoc(Sci_PositionU startPos, Sci_Position length, - int initStyle, WordList *keywordlists[], - Accessor &styler) { - // I wonder how whole-line styles ended by EOLN can escape the resetting - // code in the loop below and overflow to the next line. Let us make sure - // that a new line does not start with them carried from the previous one. - // NOTE: An overflowing string is intentionally not checked; it reminds - // the developer that the string must be ended on the same line. - if (initStyle == SCE_OSCRIPT_LINE_COMMENT || - initStyle == SCE_OSCRIPT_PREPROCESSOR) { - initStyle = SCE_OSCRIPT_DEFAULT; - } - - styler.StartAt(startPos); - StyleContext sc(startPos, length, initStyle, styler); - IdentifierClassifier identifierClassifier(keywordlists); - - // It starts with true at the beginning of a line and changes to false as - // soon as the first non-whitespace character has been processed. - bool isFirstToken = true; - // It starts with true at the beginning of a line and changes to false as - // soon as the first identifier on the line is passed by. - bool isFirstIdentifier = true; - // It becomes false when #ifdef DOC (the preprocessor directive often - // used to start a documentation comment) is encountered and remain false - // until the end of the documentation block is not detected. This is done - // by checking for the complementary #endif preprocessor directive. - bool endDocComment = false; - - for (; sc.More(); sc.Forward()) { - - if (sc.atLineStart) { - isFirstToken = true; - isFirstIdentifier = true; - // Detect the current state is neither whitespace nor identifier. It - // means that no next identifier can be the first token on the line. - } else if (isFirstIdentifier && sc.state != SCE_OSCRIPT_DEFAULT && - sc.state != SCE_OSCRIPT_IDENTIFIER) { - isFirstIdentifier = false; - } - - // Check if the current state should be changed. - if (sc.state == SCE_OSCRIPT_OPERATOR) { - // Multiple-symbol operators are marked by single characters. - sc.SetState(SCE_OSCRIPT_DEFAULT); - } else if (sc.state == SCE_OSCRIPT_IDENTIFIER) { - if (!IsIdentifierChar(sc.ch)) { - // Colon after an identifier makes it a label if it is the - // first token on the line. - // KNOWN PROBLEM: If some whitespace is inserted between the - // identifier and the colon they will not be recognized as a - // label. This should not occur; at least not often. It would - // make the code structure less legible and examples in the - // Livelink documentation do not show it. - if (sc.Match(':') && isFirstIdentifier) { - sc.ChangeState(SCE_OSCRIPT_LABEL); - sc.ForwardSetState(SCE_OSCRIPT_DEFAULT); - } else { - identifierClassifier.ClassifyIdentifier(sc); - } - // Avoid a sequence of two words be mistaken for a label. A - // switch case would be an example. - isFirstIdentifier = false; - } - } else if (sc.state == SCE_OSCRIPT_GLOBAL) { - if (!IsIdentifierChar(sc.ch)) { - sc.SetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.state == SCE_OSCRIPT_PROPERTY) { - if (!IsIdentifierChar(sc.ch)) { - // Any member access introduced by the dot operator is - // initially marked as a property access. If an opening - // parenthesis is detected later it is changed to method call. - // KNOWN PROBLEM: The same as at the function call recognition - // for SCE_OSCRIPT_IDENTIFIER above. - if (sc.Match('(')) { - sc.ChangeState(SCE_OSCRIPT_METHOD); - } - sc.SetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.state == SCE_OSCRIPT_NUMBER) { - if (!IsNumberChar(sc.ch, sc.chNext)) { - sc.SetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.state == SCE_OSCRIPT_SINGLEQUOTE_STRING) { - if (sc.ch == '\'') { - // Two consequential apostrophes convert to a single one. - if (sc.chNext == '\'') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.atLineEnd) { - sc.ForwardSetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.state == SCE_OSCRIPT_DOUBLEQUOTE_STRING) { - if (sc.ch == '\"') { - // Two consequential quotation marks convert to a single one. - if (sc.chNext == '\"') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.atLineEnd) { - sc.ForwardSetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.state == SCE_OSCRIPT_BLOCK_COMMENT) { - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.state == SCE_OSCRIPT_LINE_COMMENT) { - if (sc.atLineEnd) { - sc.ForwardSetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.state == SCE_OSCRIPT_PREPROCESSOR) { - if (IsDocCommentStart(sc)) { - sc.ChangeState(SCE_OSCRIPT_DOC_COMMENT); - endDocComment = false; - } else if (sc.atLineEnd) { - sc.ForwardSetState(SCE_OSCRIPT_DEFAULT); - } - } else if (sc.state == SCE_OSCRIPT_DOC_COMMENT) { - // KNOWN PROBLEM: The first line detected that would close a - // conditional preprocessor block (#endif) the documentation - // comment block will end. (Nested #if-#endif blocks are not - // supported. Hopefully it will not occur often that a line - // within the text block would stat with #endif. - if (isFirstToken && IsDocCommentEnd(sc)) { - endDocComment = true; - } else if (sc.atLineEnd && endDocComment) { - sc.ForwardSetState(SCE_OSCRIPT_DEFAULT); - } - } - - // Check what state starts with the current character. - if (sc.state == SCE_OSCRIPT_DEFAULT) { - if (sc.Match('\'')) { - sc.SetState(SCE_OSCRIPT_SINGLEQUOTE_STRING); - } else if (sc.Match('\"')) { - sc.SetState(SCE_OSCRIPT_DOUBLEQUOTE_STRING); - } else if (sc.Match('/', '/')) { - sc.SetState(SCE_OSCRIPT_LINE_COMMENT); - sc.Forward(); - } else if (sc.Match('/', '*')) { - sc.SetState(SCE_OSCRIPT_BLOCK_COMMENT); - sc.Forward(); - } else if (isFirstToken && sc.Match('#')) { - sc.SetState(SCE_OSCRIPT_PREPROCESSOR); - } else if (sc.Match('$')) { - // Both process-global ($xxx) and thread-global ($$xxx) - // variables are handled as one global. - sc.SetState(SCE_OSCRIPT_GLOBAL); - } else if (IsNaturalNumberStart(sc.ch)) { - sc.SetState(SCE_OSCRIPT_NUMBER); - } else if (IsPrefixedNumberStart(sc.ch, sc.chNext)) { - sc.SetState(SCE_OSCRIPT_NUMBER); - sc.Forward(); - } else if (sc.Match('.') && IsIdentifierStart(sc.chNext)) { - // Every object member access is marked as a property access - // initially. The decision between property and method is made - // after parsing the identifier and looking what comes then. - // KNOWN PROBLEM: If there is whitespace between the following - // identifier and the dot, the dot will not be recognized - // as a member accessing operator. In turn, the identifier - // will not be recognizable as a property or a method too. - sc.SetState(SCE_OSCRIPT_OPERATOR); - sc.Forward(); - sc.SetState(SCE_OSCRIPT_PROPERTY); - } else if (IsIdentifierStart(sc.ch)) { - sc.SetState(SCE_OSCRIPT_IDENTIFIER); - } else if (IsOperator(sc.ch)) { - sc.SetState(SCE_OSCRIPT_OPERATOR); - } - } - - if (isFirstToken && !IsASpaceOrTab(sc.ch)) { - isFirstToken = false; - } - } - - sc.Complete(); -} - -// ------------------------------------------ -// Functions supporting OScript code folding. - -static inline bool IsBlockComment(int style) { - return style == SCE_OSCRIPT_BLOCK_COMMENT; -} - -static bool IsLineComment(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_OSCRIPT_LINE_COMMENT) { - return true; - } else if (!IsASpaceOrTab(ch)) { - return false; - } - } - return false; -} - -static inline bool IsPreprocessor(int style) { - return style == SCE_OSCRIPT_PREPROCESSOR || - style == SCE_OSCRIPT_DOC_COMMENT; -} - -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<char>(tolower(styler[start + i])); - i++; - } - s[i] = '\0'; -} - -static void GetForwardWordLowered(Sci_PositionU start, Accessor &styler, - char *s, Sci_PositionU len) { - Sci_PositionU i = 0; - while (i < len - 1 && IsAlpha(styler.SafeGetCharAt(start + i))) { - s[i] = static_cast<char>(tolower(styler.SafeGetCharAt(start + i))); - i++; - } - s[i] = '\0'; -} - -static void UpdatePreprocessorFoldLevel(int &levelCurrent, - Sci_PositionU startPos, Accessor &styler) { - char s[7]; // Size of the longest possible keyword + null. - GetForwardWordLowered(startPos, styler, s, sizeof(s)); - - if (strcmp(s, "ifdef") == 0 || - strcmp(s, "ifndef") == 0) { - levelCurrent++; - } else if (strcmp(s, "endif") == 0) { - levelCurrent--; - if (levelCurrent < SC_FOLDLEVELBASE) { - levelCurrent = SC_FOLDLEVELBASE; - } - } -} - -static void UpdateKeywordFoldLevel(int &levelCurrent, Sci_PositionU lastStart, - Sci_PositionU currentPos, Accessor &styler) { - char s[9]; - GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s)); - - if (strcmp(s, "if") == 0 || strcmp(s, "for") == 0 || - strcmp(s, "switch") == 0 || strcmp(s, "function") == 0 || - strcmp(s, "while") == 0 || strcmp(s, "repeat") == 0) { - levelCurrent++; - } else if (strcmp(s, "end") == 0 || strcmp(s, "until") == 0) { - levelCurrent--; - if (levelCurrent < SC_FOLDLEVELBASE) { - levelCurrent = SC_FOLDLEVELBASE; - } - } -} - -// ------------------------------ -// Function folding OScript code. - -static void FoldOScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *[], 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_Position 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_Position i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atLineEnd = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - if (foldComment && IsBlockComment(style)) { - if (!IsBlockComment(stylePrev)) { - levelCurrent++; - } else if (!IsBlockComment(styleNext) && !atLineEnd) { - // Comments do not end at end of line and the next character - // may not be styled. - levelCurrent--; - } - } - if (foldComment && atLineEnd && IsLineComment(lineCurrent, styler)) { - if (!IsLineComment(lineCurrent - 1, styler) && - IsLineComment(lineCurrent + 1, styler)) - levelCurrent++; - else if (IsLineComment(lineCurrent - 1, styler) && - !IsLineComment(lineCurrent+1, styler)) - levelCurrent--; - } - if (foldPreprocessor) { - if (ch == '#' && IsPreprocessor(style)) { - UpdatePreprocessorFoldLevel(levelCurrent, i + 1, styler); - } - } - - if (stylePrev != SCE_OSCRIPT_KEYWORD && style == SCE_OSCRIPT_KEYWORD) { - lastStart = i; - } - if (stylePrev == SCE_OSCRIPT_KEYWORD) { - if(IsIdentifierChar(ch) && !IsIdentifierChar(chNext)) { - UpdateKeywordFoldLevel(levelCurrent, lastStart, i, styler); - } - } - - if (!IsASpace(ch)) - visibleChars++; - - if (atLineEnd) { - int level = levelPrev; - if (visibleChars == 0 && foldCompact) - level |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - level |= SC_FOLDLEVELHEADERFLAG; - if (level != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, level); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - } - } - - // If we did not reach EOLN in the previous loop, store the 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); -} - -// -------------------------------------------- -// Declaration of the OScript lexer descriptor. - -static const char * const oscriptWordListDesc[] = { - "Keywords and reserved words", - "Literal constants", - "Literal operators", - "Built-in value and reference types", - "Built-in global functions", - "Built-in static objects", - 0 -}; - -LexerModule lmOScript(SCLEX_OSCRIPT, ColouriseOScriptDoc, "oscript", FoldOScriptDoc, oscriptWordListDesc); diff --git a/lexers/LexOpal.cxx b/lexers/LexOpal.cxx deleted file mode 100644 index c23620405..000000000 --- a/lexers/LexOpal.cxx +++ /dev/null @@ -1,523 +0,0 @@ -// Scintilla source code edit control -/** @file LexOpal.cxx - ** Lexer for OPAL (functional language similar to Haskell) - ** Written by Sebastian Pipping <webmaster@hartwork.org> - **/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -inline 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<char>( styler[ start + i ] ); - i++; - } - s[ i ] = '\0'; -} - -inline bool HandleString( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler ) -{ - char ch; - - // Wait for string to close - bool even_backslash_count = true; // Without gaps in between - cur++; // Skip initial quote - for( ; ; ) - { - if( cur >= one_too_much ) - { - styler.ColourTo( cur - 1, SCE_OPAL_STRING ); - return false; // STOP - } - - ch = styler.SafeGetCharAt( cur ); - if( ( ch == '\015' ) || ( ch == '\012' ) ) // Deny multi-line strings - { - styler.ColourTo( cur - 1, SCE_OPAL_STRING ); - styler.StartSegment( cur ); - return true; - } - else - { - if( even_backslash_count ) - { - if( ch == '"' ) - { - styler.ColourTo( cur, SCE_OPAL_STRING ); - cur++; - if( cur >= one_too_much ) - { - return false; // STOP - } - else - { - styler.StartSegment( cur ); - return true; - } - } - else if( ch == '\\' ) - { - even_backslash_count = false; - } - } - else - { - even_backslash_count = true; - } - } - - cur++; - } -} - -inline bool HandleCommentBlock( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, bool could_fail ) -{ - char ch; - - if( could_fail ) - { - cur++; - if( cur >= one_too_much ) - { - styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT ); - return false; // STOP - } - - ch = styler.SafeGetCharAt( cur ); - if( ch != '*' ) - { - styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT ); - styler.StartSegment( cur ); - return true; - } - } - - // Wait for comment close - cur++; - bool star_found = false; - for( ; ; ) - { - if( cur >= one_too_much ) - { - styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_BLOCK ); - return false; // STOP - } - - ch = styler.SafeGetCharAt( cur ); - if( star_found ) - { - if( ch == '/' ) - { - styler.ColourTo( cur, SCE_OPAL_COMMENT_BLOCK ); - cur++; - if( cur >= one_too_much ) - { - return false; // STOP - } - else - { - styler.StartSegment( cur ); - return true; - } - } - else if( ch != '*' ) - { - star_found = false; - } - } - else if( ch == '*' ) - { - star_found = true; - } - cur++; - } -} - -inline bool HandleCommentLine( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, bool could_fail ) -{ - char ch; - - if( could_fail ) - { - cur++; - if( cur >= one_too_much ) - { - styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT ); - return false; // STOP - } - - ch = styler.SafeGetCharAt( cur ); - if( ch != '-' ) - { - styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT ); - styler.StartSegment( cur ); - return true; - } - - cur++; - if( cur >= one_too_much ) - { - styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT ); - return false; // STOP - } - - ch = styler.SafeGetCharAt( cur ); - if( ( ch != ' ' ) && ( ch != '\t' ) ) - { - styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT ); - styler.StartSegment( cur ); - return true; - } - } - - // Wait for end of line - bool fifteen_found = false; - - for( ; ; ) - { - cur++; - - if( cur >= one_too_much ) - { - styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE ); - return false; // STOP - } - - ch = styler.SafeGetCharAt( cur ); - if( fifteen_found ) - { -/* - if( ch == '\012' ) - { - // One newline on Windows (015, 012) - } - else - { - // One newline on MAC (015) and another char - } -*/ - cur--; - styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE ); - styler.StartSegment( cur ); - return true; - } - else - { - if( ch == '\015' ) - { - fifteen_found = true; - } - else if( ch == '\012' ) - { - // One newline on Linux (012) - styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE ); - styler.StartSegment( cur ); - return true; - } - } - } -} - -inline bool HandlePar( Sci_PositionU & cur, Accessor & styler ) -{ - styler.ColourTo( cur, SCE_OPAL_PAR ); - - cur++; - - styler.StartSegment( cur ); - return true; -} - -inline bool HandleSpace( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler ) -{ - char ch; - - cur++; - for( ; ; ) - { - if( cur >= one_too_much ) - { - styler.ColourTo( cur - 1, SCE_OPAL_SPACE ); - return false; - } - - ch = styler.SafeGetCharAt( cur ); - switch( ch ) - { - case ' ': - case '\t': - case '\015': - case '\012': - cur++; - break; - - default: - styler.ColourTo( cur - 1, SCE_OPAL_SPACE ); - styler.StartSegment( cur ); - return true; - } - } -} - -inline bool HandleInteger( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler ) -{ - char ch; - - for( ; ; ) - { - cur++; - if( cur >= one_too_much ) - { - styler.ColourTo( cur - 1, SCE_OPAL_INTEGER ); - return false; // STOP - } - - ch = styler.SafeGetCharAt( cur ); - if( !( IsASCII( ch ) && isdigit( ch ) ) ) - { - styler.ColourTo( cur - 1, SCE_OPAL_INTEGER ); - styler.StartSegment( cur ); - return true; - } - } -} - -inline bool HandleWord( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler, WordList * keywordlists[] ) -{ - char ch; - const Sci_PositionU beg = cur; - - cur++; - for( ; ; ) - { - ch = styler.SafeGetCharAt( cur ); - if( ( ch != '_' ) && ( ch != '-' ) && - !( IsASCII( ch ) && ( islower( ch ) || isupper( ch ) || isdigit( ch ) ) ) ) break; - - cur++; - if( cur >= one_too_much ) - { - break; - } - } - - const Sci_Position ide_len = cur - beg + 1; - char * ide = new char[ ide_len ]; - getRange( beg, cur, styler, ide, ide_len ); - - WordList & keywords = *keywordlists[ 0 ]; - WordList & classwords = *keywordlists[ 1 ]; - - if( keywords.InList( ide ) ) // Keyword - { - delete [] ide; - - styler.ColourTo( cur - 1, SCE_OPAL_KEYWORD ); - if( cur >= one_too_much ) - { - return false; // STOP - } - else - { - styler.StartSegment( cur ); - return true; - } - } - else if( classwords.InList( ide ) ) // Sort - { - delete [] ide; - - styler.ColourTo( cur - 1, SCE_OPAL_SORT ); - if( cur >= one_too_much ) - { - return false; // STOP - } - else - { - styler.StartSegment( cur ); - return true; - } - } - else if( !strcmp( ide, "true" ) || !strcmp( ide, "false" ) ) // Bool const - { - delete [] ide; - - styler.ColourTo( cur - 1, SCE_OPAL_BOOL_CONST ); - if( cur >= one_too_much ) - { - return false; // STOP - } - else - { - styler.StartSegment( cur ); - return true; - } - } - else // Unknown keyword - { - delete [] ide; - - styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT ); - if( cur >= one_too_much ) - { - return false; // STOP - } - else - { - styler.StartSegment( cur ); - return true; - } - } - -} - -inline bool HandleSkip( Sci_PositionU & cur, Sci_PositionU one_too_much, Accessor & styler ) -{ - cur++; - styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT ); - if( cur >= one_too_much ) - { - return false; // STOP - } - else - { - styler.StartSegment( cur ); - return true; - } -} - -static void ColouriseOpalDoc( Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor & styler ) -{ - styler.StartAt( startPos ); - styler.StartSegment( startPos ); - - Sci_PositionU & cur = startPos; - const Sci_PositionU one_too_much = startPos + length; - - int state = initStyle; - - for( ; ; ) - { - switch( state ) - { - case SCE_OPAL_KEYWORD: - case SCE_OPAL_SORT: - if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return; - state = SCE_OPAL_DEFAULT; - break; - - case SCE_OPAL_INTEGER: - if( !HandleInteger( cur, one_too_much, styler ) ) return; - state = SCE_OPAL_DEFAULT; - break; - - case SCE_OPAL_COMMENT_BLOCK: - if( !HandleCommentBlock( cur, one_too_much, styler, false ) ) return; - state = SCE_OPAL_DEFAULT; - break; - - case SCE_OPAL_COMMENT_LINE: - if( !HandleCommentLine( cur, one_too_much, styler, false ) ) return; - state = SCE_OPAL_DEFAULT; - break; - - case SCE_OPAL_STRING: - if( !HandleString( cur, one_too_much, styler ) ) return; - state = SCE_OPAL_DEFAULT; - break; - - default: // SCE_OPAL_DEFAULT: - { - char ch = styler.SafeGetCharAt( cur ); - - switch( ch ) - { - // String - case '"': - if( !HandleString( cur, one_too_much, styler ) ) return; - break; - - // Comment block - case '/': - if( !HandleCommentBlock( cur, one_too_much, styler, true ) ) return; - break; - - // Comment line - case '-': - if( !HandleCommentLine( cur, one_too_much, styler, true ) ) return; - break; - - // Par - case '(': - case ')': - case '[': - case ']': - case '{': - case '}': - if( !HandlePar( cur, styler ) ) return; - break; - - // Whitespace - case ' ': - case '\t': - case '\015': - case '\012': - if( !HandleSpace( cur, one_too_much, styler ) ) return; - break; - - default: - { - // Integer - if( IsASCII( ch ) && isdigit( ch ) ) - { - if( !HandleInteger( cur, one_too_much, styler ) ) return; - } - - // Keyword - else if( IsASCII( ch ) && ( islower( ch ) || isupper( ch ) ) ) - { - if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return; - - } - - // Skip - else - { - if( !HandleSkip( cur, one_too_much, styler ) ) return; - } - } - } - - break; - } - } - } -} - -static const char * const opalWordListDesc[] = { - "Keywords", - "Sorts", - 0 -}; - -LexerModule lmOpal(SCLEX_OPAL, ColouriseOpalDoc, "opal", NULL, opalWordListDesc); diff --git a/lexers/LexPB.cxx b/lexers/LexPB.cxx deleted file mode 100644 index 582a5899d..000000000 --- a/lexers/LexPB.cxx +++ /dev/null @@ -1,363 +0,0 @@ -// Scintilla source code edit control -// @file LexPB.cxx -// Lexer for PowerBasic by Roland Walter, roland@rowalt.de (for PowerBasic see www.powerbasic.com) -// -// Changes: -// 17.10.2003: Toggling of subs/functions now until next sub/function - this gives better results -// 29.10.2003: 1. Bug: Toggling didn't work for subs/functions added in editor -// 2. Own colors for PB constants and Inline Assembler SCE_B_CONSTANT and SCE_B_ASM -// 3. Several smaller syntax coloring improvements and speed optimizations -// 12.07.2004: 1. Toggling for macros added -// 2. Further folding speed optimitations (for people dealing with very large listings) -// -// Necessary changes for the PB lexer in Scintilla project: -// - In SciLexer.h and Scintilla.iface: -// -// #define SCLEX_POWERBASIC 51 //ID for PowerBasic lexer -// (...) -// #define SCE_B_DEFAULT 0 //in both VB and PB lexer -// #define SCE_B_COMMENT 1 //in both VB and PB lexer -// #define SCE_B_NUMBER 2 //in both VB and PB lexer -// #define SCE_B_KEYWORD 3 //in both VB and PB lexer -// #define SCE_B_STRING 4 //in both VB and PB lexer -// #define SCE_B_PREPROCESSOR 5 //VB lexer only, not in PB lexer -// #define SCE_B_OPERATOR 6 //in both VB and PB lexer -// #define SCE_B_IDENTIFIER 7 //in both VB and PB lexer -// #define SCE_B_DATE 8 //VB lexer only, not in PB lexer -// #define SCE_B_CONSTANT 13 //PB lexer only, not in VB lexer -// #define SCE_B_ASM 14 //PB lexer only, not in VB lexer - -// - Statement added to KeyWords.cxx: 'LINK_LEXER(lmPB);' -// - Statement added to scintilla_vc6.mak: '$(DIR_O)\LexPB.obj: ...\src\LexPB.cxx $(LEX_HEADERS)' -// -// Copyright for Scintilla: 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool IsTypeCharacter(const int ch) -{ - return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$' || ch == '?'; -} - -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 bool MatchUpperCase(Accessor &styler, Sci_Position pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only) -{ - char ch; - for (Sci_Position i=0; *s; i++) - { - ch=styler.SafeGetCharAt(pos+i); - if (ch > 0x60) ch -= '\x20'; - if (*s != ch) return false; - s++; - } - return true; -} - -static void ColourisePBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,WordList *keywordlists[],Accessor &styler) { - - WordList &keywords = *keywordlists[0]; - - styler.StartAt(startPos); - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - switch (sc.state) - { - case SCE_B_OPERATOR: - { - sc.SetState(SCE_B_DEFAULT); - break; - } - case SCE_B_KEYWORD: - { - if (!IsAWordChar(sc.ch)) - { - if (!IsTypeCharacter(sc.ch)) - { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (keywords.InList(s)) - { - if (strcmp(s, "rem") == 0) - { - sc.ChangeState(SCE_B_COMMENT); - if (sc.atLineEnd) {sc.SetState(SCE_B_DEFAULT);} - } - else if (strcmp(s, "asm") == 0) - { - sc.ChangeState(SCE_B_ASM); - if (sc.atLineEnd) {sc.SetState(SCE_B_DEFAULT);} - } - else - { - sc.SetState(SCE_B_DEFAULT); - } - } - else - { - sc.ChangeState(SCE_B_IDENTIFIER); - sc.SetState(SCE_B_DEFAULT); - } - } - } - break; - } - case SCE_B_NUMBER: - { - if (!IsAWordChar(sc.ch)) {sc.SetState(SCE_B_DEFAULT);} - break; - } - case SCE_B_STRING: - { - if (sc.ch == '\"'){sc.ForwardSetState(SCE_B_DEFAULT);} - break; - } - case SCE_B_CONSTANT: - { - if (!IsAWordChar(sc.ch)) {sc.SetState(SCE_B_DEFAULT);} - break; - } - case SCE_B_COMMENT: - { - if (sc.atLineEnd) {sc.SetState(SCE_B_DEFAULT);} - break; - } - case SCE_B_ASM: - { - if (sc.atLineEnd) {sc.SetState(SCE_B_DEFAULT);} - break; - } - } //switch (sc.state) - - // Determine if a new state should be entered: - if (sc.state == SCE_B_DEFAULT) - { - if (sc.ch == '\'') {sc.SetState(SCE_B_COMMENT);} - else if (sc.ch == '\"') {sc.SetState(SCE_B_STRING);} - else if (sc.ch == '&' && tolower(sc.chNext) == 'h') {sc.SetState(SCE_B_NUMBER);} - else if (sc.ch == '&' && tolower(sc.chNext) == 'b') {sc.SetState(SCE_B_NUMBER);} - else if (sc.ch == '&' && tolower(sc.chNext) == 'o') {sc.SetState(SCE_B_NUMBER);} - else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {sc.SetState(SCE_B_NUMBER);} - else if (IsAWordStart(sc.ch)) {sc.SetState(SCE_B_KEYWORD);} - else if (sc.ch == '%') {sc.SetState(SCE_B_CONSTANT);} - else if (sc.ch == '$') {sc.SetState(SCE_B_CONSTANT);} - else if (sc.ch == '#') {sc.SetState(SCE_B_KEYWORD);} - else if (sc.ch == '!') {sc.SetState(SCE_B_ASM);} - else if (isoperator(static_cast<char>(sc.ch)) || (sc.ch == '\\')) {sc.SetState(SCE_B_OPERATOR);} - } - } //for (; sc.More(); sc.Forward()) - sc.Complete(); -} - -//The folding routine for PowerBasic toggles SUBs and FUNCTIONs only. This was exactly what I wanted, -//nothing more. I had worked with this kind of toggling for several years when I used the great good old -//GFA Basic which is dead now. After testing the feature of toggling FOR-NEXT loops, WHILE-WEND loops -//and so on too I found this is more disturbing then helping (for me). So if You think in another way -//you can (or must) write Your own toggling routine ;-) -static void FoldPBDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) -{ - // No folding enabled, no reason to continue... - if( styler.GetPropertyInt("fold") == 0 ) - return; - - 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 levelNext = levelCurrent; - char chNext = styler[startPos]; - - bool fNewLine=true; - bool fMightBeMultiLineMacro=false; - bool fBeginOfCommentFound=false; - for (Sci_PositionU i = startPos; i < endPos; i++) - { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if (fNewLine) //Begin of a new line (The Sub/Function/Macro keywords may occur at begin of line only) - { - fNewLine=false; - fBeginOfCommentFound=false; - switch (ch) - { - case ' ': //Most lines start with space - so check this first, the code is the same as for 'default:' - case '\t': //Handle tab too - { - int levelUse = levelCurrent; - int lev = levelUse | levelNext << 16; - styler.SetLevel(lineCurrent, lev); - break; - } - case 'F': - case 'f': - { - switch (chNext) - { - case 'U': - case 'u': - { - if( MatchUpperCase(styler,i,"FUNCTION") ) - { - styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG); - levelNext=SC_FOLDLEVELBASE+1; - } - break; - } - } - break; - } - case 'S': - case 's': - { - switch (chNext) - { - case 'U': - case 'u': - { - if( MatchUpperCase(styler,i,"SUB") ) - { - styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG); - levelNext=SC_FOLDLEVELBASE+1; - } - break; - } - case 'T': - case 't': - { - if( MatchUpperCase(styler,i,"STATIC FUNCTION") ) - { - styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG); - levelNext=SC_FOLDLEVELBASE+1; - } - else if( MatchUpperCase(styler,i,"STATIC SUB") ) - { - styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG); - levelNext=SC_FOLDLEVELBASE+1; - } - break; - } - } - break; - } - case 'C': - case 'c': - { - switch (chNext) - { - case 'A': - case 'a': - { - if( MatchUpperCase(styler,i,"CALLBACK FUNCTION") ) - { - styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG); - levelNext=SC_FOLDLEVELBASE+1; - } - break; - } - } - break; - } - case 'M': - case 'm': - { - switch (chNext) - { - case 'A': - case 'a': - { - if( MatchUpperCase(styler,i,"MACRO") ) - { - fMightBeMultiLineMacro=true; //Set folder level at end of line, we have to check for single line macro - } - break; - } - } - break; - } - default: - { - int levelUse = levelCurrent; - int lev = levelUse | levelNext << 16; - styler.SetLevel(lineCurrent, lev); - break; - } - } //switch (ch) - } //if( fNewLine ) - - switch (ch) - { - case '=': //To test single line macros - { - if (fBeginOfCommentFound==false) - fMightBeMultiLineMacro=false; //The found macro is a single line macro only; - break; - } - case '\'': //A comment starts - { - fBeginOfCommentFound=true; - break; - } - case '\n': - { - if (fMightBeMultiLineMacro) //The current line is the begin of a multi line macro - { - fMightBeMultiLineMacro=false; - styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG); - levelNext=SC_FOLDLEVELBASE+1; - } - lineCurrent++; - levelCurrent = levelNext; - fNewLine=true; - break; - } - case '\r': - { - if (chNext != '\n') - { - lineCurrent++; - levelCurrent = levelNext; - fNewLine=true; - } - break; - } - } //switch (ch) - } //for (Sci_PositionU i = startPos; i < endPos; i++) -} - -static const char * const pbWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmPB(SCLEX_POWERBASIC, ColourisePBDoc, "powerbasic", FoldPBDoc, pbWordListDesc); diff --git a/lexers/LexPLM.cxx b/lexers/LexPLM.cxx deleted file mode 100644 index 653242fab..000000000 --- a/lexers/LexPLM.cxx +++ /dev/null @@ -1,200 +0,0 @@ -// Copyright (c) 1990-2007, Scientific Toolworks, Inc. -// @file LexPLM.cxx -// Author: Jason Haslam -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>(tolower(styler[start + i])); - i++; - } - s[i] = '\0'; -} - -static void ColourisePlmDoc(Sci_PositionU startPos, - Sci_Position length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) -{ - Sci_PositionU endPos = startPos + length; - int state = initStyle; - - styler.StartAt(startPos); - styler.StartSegment(startPos); - - for (Sci_PositionU i = startPos; i < endPos; i++) { - char ch = styler.SafeGetCharAt(i); - char chNext = styler.SafeGetCharAt(i + 1); - - if (state == SCE_PLM_DEFAULT) { - if (ch == '/' && chNext == '*') { - styler.ColourTo(i - 1, state); - state = SCE_PLM_COMMENT; - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - state = SCE_PLM_STRING; - } else if (isdigit(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_PLM_NUMBER; - } else if (isalpha(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_PLM_IDENTIFIER; - } else if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || - ch == '=' || ch == '<' || ch == '>' || ch == ':') { - styler.ColourTo(i - 1, state); - state = SCE_PLM_OPERATOR; - } else if (ch == '$') { - styler.ColourTo(i - 1, state); - state = SCE_PLM_CONTROL; - } - } else if (state == SCE_PLM_COMMENT) { - if (ch == '*' && chNext == '/') { - i++; - styler.ColourTo(i, state); - state = SCE_PLM_DEFAULT; - } - } else if (state == SCE_PLM_STRING) { - if (ch == '\'') { - if (chNext == '\'') { - i++; - } else { - styler.ColourTo(i, state); - state = SCE_PLM_DEFAULT; - } - } - } else if (state == SCE_PLM_NUMBER) { - if (!isdigit(ch) && !isalpha(ch) && ch != '$') { - i--; - styler.ColourTo(i, state); - state = SCE_PLM_DEFAULT; - } - } else if (state == SCE_PLM_IDENTIFIER) { - if (!isdigit(ch) && !isalpha(ch) && ch != '$') { - // Get the entire identifier. - char word[1024]; - Sci_Position segmentStart = styler.GetStartSegment(); - GetRange(segmentStart, i - 1, styler, word, sizeof(word)); - - i--; - if (keywordlists[0]->InList(word)) - styler.ColourTo(i, SCE_PLM_KEYWORD); - else - styler.ColourTo(i, state); - state = SCE_PLM_DEFAULT; - } - } else if (state == SCE_PLM_OPERATOR) { - if (ch != '=' && ch != '>') { - i--; - styler.ColourTo(i, state); - state = SCE_PLM_DEFAULT; - } - } else if (state == SCE_PLM_CONTROL) { - if (ch == '\r' || ch == '\n') { - styler.ColourTo(i - 1, state); - state = SCE_PLM_DEFAULT; - } - } - } - styler.ColourTo(endPos - 1, state); -} - -static void FoldPlmDoc(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; - Sci_Position startKeyword = 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_PLM_KEYWORD && style == SCE_PLM_KEYWORD) - startKeyword = i; - - if (style == SCE_PLM_KEYWORD && styleNext != SCE_PLM_KEYWORD) { - char word[1024]; - GetRange(startKeyword, i, styler, word, sizeof(word)); - - if (strcmp(word, "procedure") == 0 || strcmp(word, "do") == 0) - levelCurrent++; - else if (strcmp(word, "end") == 0) - levelCurrent--; - } - - if (foldComment) { - if (stylePrev != SCE_PLM_COMMENT && style == SCE_PLM_COMMENT) - levelCurrent++; - else if (stylePrev == SCE_PLM_COMMENT && style != SCE_PLM_COMMENT) - 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++; - } - - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - -static const char *const plmWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmPLM(SCLEX_PLM, ColourisePlmDoc, "PL/M", FoldPlmDoc, plmWordListDesc); diff --git a/lexers/LexPO.cxx b/lexers/LexPO.cxx deleted file mode 100644 index 875c334f8..000000000 --- a/lexers/LexPO.cxx +++ /dev/null @@ -1,211 +0,0 @@ -// Scintilla source code edit control -/** @file LexPO.cxx - ** Lexer for GetText Translation (PO) files. - **/ -// Copyright 2012 by Colomban Wendling <ban@herbesfolles.org> -// The License.txt file describes the conditions under which this software may be distributed. - -// see https://www.gnu.org/software/gettext/manual/gettext.html#PO-Files for the syntax reference -// some details are taken from the GNU msgfmt behavior (like that indent is allows in front of lines) - -// TODO: -// * add keywords for flags (fuzzy, c-format, ...) -// * highlight formats inside c-format strings (%s, %d, etc.) -// * style for previous untranslated string? ("#|" comment) - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static void ColourisePODoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], Accessor &styler) { - StyleContext sc(startPos, length, initStyle, styler); - bool escaped = false; - Sci_Position curLine = styler.GetLine(startPos); - // the line state holds the last state on or before the line that isn't the default style - int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : SCE_PO_DEFAULT; - - for (; sc.More(); sc.Forward()) { - // whether we should leave a state - switch (sc.state) { - case SCE_PO_COMMENT: - case SCE_PO_PROGRAMMER_COMMENT: - case SCE_PO_REFERENCE: - case SCE_PO_FLAGS: - case SCE_PO_FUZZY: - if (sc.atLineEnd) - sc.SetState(SCE_PO_DEFAULT); - else if (sc.state == SCE_PO_FLAGS && sc.Match("fuzzy")) - // here we behave like the previous parser, but this should probably be highlighted - // on its own like a keyword rather than changing the whole flags style - sc.ChangeState(SCE_PO_FUZZY); - break; - - case SCE_PO_MSGCTXT: - case SCE_PO_MSGID: - case SCE_PO_MSGSTR: - if (isspacechar(sc.ch)) - sc.SetState(SCE_PO_DEFAULT); - break; - - case SCE_PO_ERROR: - if (sc.atLineEnd) - sc.SetState(SCE_PO_DEFAULT); - break; - - case SCE_PO_MSGCTXT_TEXT: - case SCE_PO_MSGID_TEXT: - case SCE_PO_MSGSTR_TEXT: - if (sc.atLineEnd) { // invalid inside a string - if (sc.state == SCE_PO_MSGCTXT_TEXT) - sc.ChangeState(SCE_PO_MSGCTXT_TEXT_EOL); - else if (sc.state == SCE_PO_MSGID_TEXT) - sc.ChangeState(SCE_PO_MSGID_TEXT_EOL); - else if (sc.state == SCE_PO_MSGSTR_TEXT) - sc.ChangeState(SCE_PO_MSGSTR_TEXT_EOL); - sc.SetState(SCE_PO_DEFAULT); - escaped = false; - } else { - if (escaped) - escaped = false; - else if (sc.ch == '\\') - escaped = true; - else if (sc.ch == '"') - sc.ForwardSetState(SCE_PO_DEFAULT); - } - break; - } - - // whether we should enter a new state - if (sc.state == SCE_PO_DEFAULT) { - // forward to the first non-white character on the line - bool atLineStart = sc.atLineStart; - if (atLineStart) { - // reset line state if it is set to comment state so empty lines don't get - // comment line state, and the folding code folds comments separately, - // and anyway the styling don't use line state for comments - if (curLineState == SCE_PO_COMMENT) - curLineState = SCE_PO_DEFAULT; - - while (sc.More() && ! sc.atLineEnd && isspacechar(sc.ch)) - sc.Forward(); - } - - if (atLineStart && sc.ch == '#') { - if (sc.chNext == '.') - sc.SetState(SCE_PO_PROGRAMMER_COMMENT); - else if (sc.chNext == ':') - sc.SetState(SCE_PO_REFERENCE); - else if (sc.chNext == ',') - sc.SetState(SCE_PO_FLAGS); - else - sc.SetState(SCE_PO_COMMENT); - } else if (atLineStart && sc.Match("msgid")) { // includes msgid_plural - sc.SetState(SCE_PO_MSGID); - } else if (atLineStart && sc.Match("msgstr")) { // includes [] suffixes - sc.SetState(SCE_PO_MSGSTR); - } else if (atLineStart && sc.Match("msgctxt")) { - sc.SetState(SCE_PO_MSGCTXT); - } else if (sc.ch == '"') { - if (curLineState == SCE_PO_MSGCTXT || curLineState == SCE_PO_MSGCTXT_TEXT) - sc.SetState(SCE_PO_MSGCTXT_TEXT); - else if (curLineState == SCE_PO_MSGID || curLineState == SCE_PO_MSGID_TEXT) - sc.SetState(SCE_PO_MSGID_TEXT); - else if (curLineState == SCE_PO_MSGSTR || curLineState == SCE_PO_MSGSTR_TEXT) - sc.SetState(SCE_PO_MSGSTR_TEXT); - else - sc.SetState(SCE_PO_ERROR); - } else if (! isspacechar(sc.ch)) - sc.SetState(SCE_PO_ERROR); - - if (sc.state != SCE_PO_DEFAULT) - curLineState = sc.state; - } - - if (sc.atLineEnd) { - // Update the line state, so it can be seen by next line - curLine = styler.GetLine(sc.currentPos); - styler.SetLineState(curLine, curLineState); - } - } - sc.Complete(); -} - -static int FindNextNonEmptyLineState(Sci_PositionU startPos, Accessor &styler) { - Sci_PositionU length = styler.Length(); - for (Sci_PositionU i = startPos; i < length; i++) { - if (! isspacechar(styler[i])) { - return styler.GetLineState(styler.GetLine(i)); - } - } - return 0; -} - -static void FoldPODoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - if (! styler.GetPropertyInt("fold")) - return; - bool foldCompact = styler.GetPropertyInt("fold.compact") != 0; - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - - Sci_PositionU endPos = startPos + length; - Sci_Position curLine = styler.GetLine(startPos); - int lineState = styler.GetLineState(curLine); - int nextLineState; - int level = styler.LevelAt(curLine) & SC_FOLDLEVELNUMBERMASK; - int nextLevel; - int visible = 0; - int chNext = styler[startPos]; - - for (Sci_PositionU i = startPos; i < endPos; i++) { - int ch = chNext; - chNext = styler.SafeGetCharAt(i+1); - - if (! isspacechar(ch)) { - visible++; - } else if ((ch == '\r' && chNext != '\n') || ch == '\n' || i+1 >= endPos) { - int lvl = level; - Sci_Position nextLine = curLine + 1; - - nextLineState = styler.GetLineState(nextLine); - if ((lineState != SCE_PO_COMMENT || foldComment) && - nextLineState == lineState && - FindNextNonEmptyLineState(i, styler) == lineState) - nextLevel = SC_FOLDLEVELBASE + 1; - else - nextLevel = SC_FOLDLEVELBASE; - - if (nextLevel > level) - lvl |= SC_FOLDLEVELHEADERFLAG; - if (visible == 0 && foldCompact) - lvl |= SC_FOLDLEVELWHITEFLAG; - - styler.SetLevel(curLine, lvl); - - lineState = nextLineState; - curLine = nextLine; - level = nextLevel; - visible = 0; - } - } -} - -static const char *const poWordListDesc[] = { - 0 -}; - -LexerModule lmPO(SCLEX_PO, ColourisePODoc, "po", FoldPODoc, poWordListDesc); diff --git a/lexers/LexPOV.cxx b/lexers/LexPOV.cxx deleted file mode 100644 index 40d0d2e9d..000000000 --- a/lexers/LexPOV.cxx +++ /dev/null @@ -1,317 +0,0 @@ -// Scintilla source code edit control -/** @file LexPOV.cxx - ** Lexer for POV-Ray SDL (Persistance of Vision Raytracer, Scene Description Language). - ** Written by Philippe Lhoste but this is mostly a derivative of LexCPP... - **/ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -// Some points that distinguish from a simple C lexer: -// Identifiers start only by a character. -// No line continuation character. -// Strings are limited to 256 characters. -// Directives are similar to preprocessor commands, -// but we match directive keywords and colorize incorrect ones. -// Block comments can be nested (code stolen from my code in LexLua). - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool IsAWordChar(int ch) { - return ch < 0x80 && (isalnum(ch) || ch == '_'); -} - -static inline bool IsAWordStart(int ch) { - return ch < 0x80 && isalpha(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) || toupper(ch) == 'E' || - ch == '.' || ch == '-' || ch == '+'); -} - -static void ColourisePovDoc( - 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]; - WordList &keywords5 = *keywordlists[4]; - WordList &keywords6 = *keywordlists[5]; - WordList &keywords7 = *keywordlists[6]; - WordList &keywords8 = *keywordlists[7]; - - 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_POV_COMMENT) { - blockCommentLevel = styler.GetLineState(currentLine - 1); - } - - // Do not leak onto next line - if (initStyle == SCE_POV_STRINGEOL || initStyle == SCE_POV_COMMENTLINE) { - initStyle = SCE_POV_DEFAULT; - } - - short stringLen = 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 - currentLine = styler.GetLine(sc.currentPos); - if (sc.state == SCE_POV_COMMENT) { - // Inside a block comment, we set the line state - styler.SetLineState(currentLine, blockCommentLevel); - } else { - // Reset the line state - styler.SetLineState(currentLine, 0); - } - } - - if (sc.atLineStart && (sc.state == SCE_POV_STRING)) { - // Prevent SCE_POV_STRINGEOL from leaking back to previous line - sc.SetState(SCE_POV_STRING); - } - - // Determine if the current state should terminate. - if (sc.state == SCE_POV_OPERATOR) { - sc.SetState(SCE_POV_DEFAULT); - } else if (sc.state == SCE_POV_NUMBER) { - // We stop the number definition on non-numerical non-dot non-eE non-sign char - if (!IsANumberChar(sc.ch)) { - sc.SetState(SCE_POV_DEFAULT); - } - } else if (sc.state == SCE_POV_IDENTIFIER) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - if (keywords2.InList(s)) { - sc.ChangeState(SCE_POV_WORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_POV_WORD3); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_POV_WORD4); - } else if (keywords5.InList(s)) { - sc.ChangeState(SCE_POV_WORD5); - } else if (keywords6.InList(s)) { - sc.ChangeState(SCE_POV_WORD6); - } else if (keywords7.InList(s)) { - sc.ChangeState(SCE_POV_WORD7); - } else if (keywords8.InList(s)) { - sc.ChangeState(SCE_POV_WORD8); - } - sc.SetState(SCE_POV_DEFAULT); - } - } else if (sc.state == SCE_POV_DIRECTIVE) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - char *p; - sc.GetCurrent(s, sizeof(s)); - p = s; - // Skip # and whitespace between # and directive word - do { - p++; - } while ((*p == ' ' || *p == '\t') && *p != '\0'); - if (!keywords1.InList(p)) { - sc.ChangeState(SCE_POV_BADDIRECTIVE); - } - sc.SetState(SCE_POV_DEFAULT); - } - } else if (sc.state == SCE_POV_COMMENT) { - if (sc.Match('/', '*')) { - blockCommentLevel++; - sc.Forward(); - } else if (sc.Match('*', '/') && blockCommentLevel > 0) { - blockCommentLevel--; - sc.Forward(); - if (blockCommentLevel == 0) { - sc.ForwardSetState(SCE_POV_DEFAULT); - } - } - } else if (sc.state == SCE_POV_COMMENTLINE) { - if (sc.atLineEnd) { - sc.ForwardSetState(SCE_POV_DEFAULT); - } - } else if (sc.state == SCE_POV_STRING) { - if (sc.ch == '\\') { - stringLen++; - if (strchr("abfnrtuv0'\"", sc.chNext)) { - // Compound characters are counted as one. - // Note: for Unicode chars \u, we shouldn't count the next 4 digits... - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_POV_DEFAULT); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_POV_STRINGEOL); - sc.ForwardSetState(SCE_POV_DEFAULT); - } else { - stringLen++; - } - if (stringLen > 256) { - // Strings are limited to 256 chars - sc.SetState(SCE_POV_STRINGEOL); - } - } else if (sc.state == SCE_POV_STRINGEOL) { - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_C_DEFAULT); - } else if (sc.atLineEnd) { - sc.ForwardSetState(SCE_POV_DEFAULT); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_POV_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_POV_NUMBER); - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_POV_IDENTIFIER); - } else if (sc.Match('/', '*')) { - blockCommentLevel = 1; - sc.SetState(SCE_POV_COMMENT); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('/', '/')) { - sc.SetState(SCE_POV_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_POV_STRING); - stringLen = 0; - } else if (sc.ch == '#') { - sc.SetState(SCE_POV_DIRECTIVE); - // Skip whitespace between # and directive word - do { - sc.Forward(); - } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); - if (sc.atLineEnd) { - sc.SetState(SCE_POV_DEFAULT); - } - } else if (isoperator(static_cast<char>(sc.ch))) { - sc.SetState(SCE_POV_OPERATOR); - } - } - } - sc.Complete(); -} - -static void FoldPovDoc( - Sci_PositionU startPos, - Sci_Position length, - int initStyle, - WordList *[], - Accessor &styler) { - - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - bool foldDirective = styler.GetPropertyInt("fold.directive") != 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_POV_COMMENT)) { - if (stylePrev != SCE_POV_COMMENT) { - levelCurrent++; - } else if ((styleNext != SCE_POV_COMMENT) && !atEOL) { - // Comments don't end at end of line and the next character may be unstyled. - levelCurrent--; - } - } - if (foldComment && (style == SCE_POV_COMMENTLINE)) { - if ((ch == '/') && (chNext == '/')) { - char chNext2 = styler.SafeGetCharAt(i + 2); - if (chNext2 == '{') { - levelCurrent++; - } else if (chNext2 == '}') { - levelCurrent--; - } - } - } - if (foldDirective && (style == SCE_POV_DIRECTIVE)) { - if (ch == '#') { - Sci_PositionU j=i+1; - while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { - j++; - } - } - } - if (style == SCE_POV_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 povWordLists[] = { - "Language directives", - "Objects & CSG & Appearance", - "Types & Modifiers & Items", - "Predefined Identifiers", - "Predefined Functions", - "User defined 1", - "User defined 2", - "User defined 3", - 0, -}; - -LexerModule lmPOV(SCLEX_POV, ColourisePovDoc, "pov", FoldPovDoc, povWordLists); diff --git a/lexers/LexPS.cxx b/lexers/LexPS.cxx deleted file mode 100644 index b7158e9bb..000000000 --- a/lexers/LexPS.cxx +++ /dev/null @@ -1,331 +0,0 @@ -// Scintilla source code edit control -/** @file LexPS.cxx - ** Lexer for PostScript - ** - ** Written by Nigel Hathaway <nigel@bprj.co.uk>. - ** The License.txt file describes the conditions under which this software may be distributed. - **/ - -// Previous releases of this lexer included support for marking token starts with -// a style byte indicator. This was used by the wxGhostscript IDE/debugger. -// Style byte indicators were removed in version 3.4.3. -// Anyone wanting to restore this functionality for wxGhostscript using 'modern' -// indicators can examine the earlier source in the Mercurial repository. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool IsASelfDelimitingChar(const int ch) { - return (ch == '[' || ch == ']' || ch == '{' || ch == '}' || - ch == '/' || ch == '<' || ch == '>' || - ch == '(' || ch == ')' || ch == '%'); -} - -static inline bool IsAWhitespaceChar(const int ch) { - return (ch == ' ' || ch == '\t' || ch == '\r' || - ch == '\n' || ch == '\f' || ch == '\0'); -} - -static bool IsABaseNDigit(const int ch, const int base) { - int maxdig = '9'; - int letterext = -1; - - if (base <= 10) - maxdig = '0' + base - 1; - else - letterext = base - 11; - - return ((ch >= '0' && ch <= maxdig) || - (ch >= 'A' && ch <= ('A' + letterext)) || - (ch >= 'a' && ch <= ('a' + letterext))); -} - -static inline bool IsABase85Char(const int ch) { - return ((ch >= '!' && ch <= 'u') || ch == 'z'); -} - -static void ColourisePSDoc( - 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]; - WordList &keywords5 = *keywordlists[4]; - - StyleContext sc(startPos, length, initStyle, styler); - - int pslevel = styler.GetPropertyInt("ps.level", 3); - Sci_Position lineCurrent = styler.GetLine(startPos); - int nestTextCurrent = 0; - if (lineCurrent > 0 && initStyle == SCE_PS_TEXT) - nestTextCurrent = styler.GetLineState(lineCurrent - 1); - int numRadix = 0; - bool numHasPoint = false; - bool numHasExponent = false; - bool numHasSign = false; - - for (; sc.More(); sc.Forward()) { - if (sc.atLineStart) - lineCurrent = styler.GetLine(sc.currentPos); - - // Determine if the current state should terminate. - if (sc.state == SCE_PS_COMMENT || sc.state == SCE_PS_DSC_VALUE) { - if (sc.atLineEnd) { - sc.SetState(SCE_C_DEFAULT); - } - } else if (sc.state == SCE_PS_DSC_COMMENT) { - if (sc.ch == ':') { - sc.Forward(); - if (!sc.atLineEnd) - sc.SetState(SCE_PS_DSC_VALUE); - else - sc.SetState(SCE_C_DEFAULT); - } else if (sc.atLineEnd) { - sc.SetState(SCE_C_DEFAULT); - } else if (IsAWhitespaceChar(sc.ch) && sc.ch != '\r') { - sc.ChangeState(SCE_PS_COMMENT); - } - } else if (sc.state == SCE_PS_NUMBER) { - if (IsASelfDelimitingChar(sc.ch) || IsAWhitespaceChar(sc.ch)) { - if ((sc.chPrev == '+' || sc.chPrev == '-' || - sc.chPrev == 'E' || sc.chPrev == 'e') && numRadix == 0) - sc.ChangeState(SCE_PS_NAME); - sc.SetState(SCE_C_DEFAULT); - } else if (sc.ch == '#') { - if (numHasPoint || numHasExponent || numHasSign || numRadix != 0) { - sc.ChangeState(SCE_PS_NAME); - } else { - char szradix[5]; - sc.GetCurrent(szradix, 4); - numRadix = atoi(szradix); - if (numRadix < 2 || numRadix > 36) - sc.ChangeState(SCE_PS_NAME); - } - } else if ((sc.ch == 'E' || sc.ch == 'e') && numRadix == 0) { - if (numHasExponent) { - sc.ChangeState(SCE_PS_NAME); - } else { - numHasExponent = true; - if (sc.chNext == '+' || sc.chNext == '-') - sc.Forward(); - } - } else if (sc.ch == '.') { - if (numHasPoint || numHasExponent || numRadix != 0) { - sc.ChangeState(SCE_PS_NAME); - } else { - numHasPoint = true; - } - } else if (numRadix == 0) { - if (!IsABaseNDigit(sc.ch, 10)) - sc.ChangeState(SCE_PS_NAME); - } else { - if (!IsABaseNDigit(sc.ch, numRadix)) - sc.ChangeState(SCE_PS_NAME); - } - } else if (sc.state == SCE_PS_NAME || sc.state == SCE_PS_KEYWORD) { - if (IsASelfDelimitingChar(sc.ch) || IsAWhitespaceChar(sc.ch)) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - if ((pslevel >= 1 && keywords1.InList(s)) || - (pslevel >= 2 && keywords2.InList(s)) || - (pslevel >= 3 && keywords3.InList(s)) || - keywords4.InList(s) || keywords5.InList(s)) { - sc.ChangeState(SCE_PS_KEYWORD); - } - sc.SetState(SCE_C_DEFAULT); - } - } else if (sc.state == SCE_PS_LITERAL || sc.state == SCE_PS_IMMEVAL) { - if (IsASelfDelimitingChar(sc.ch) || IsAWhitespaceChar(sc.ch)) - sc.SetState(SCE_C_DEFAULT); - } else if (sc.state == SCE_PS_PAREN_ARRAY || sc.state == SCE_PS_PAREN_DICT || - sc.state == SCE_PS_PAREN_PROC) { - sc.SetState(SCE_C_DEFAULT); - } else if (sc.state == SCE_PS_TEXT) { - if (sc.ch == '(') { - nestTextCurrent++; - } else if (sc.ch == ')') { - if (--nestTextCurrent == 0) - sc.ForwardSetState(SCE_PS_DEFAULT); - } else if (sc.ch == '\\') { - sc.Forward(); - } - } else if (sc.state == SCE_PS_HEXSTRING) { - if (sc.ch == '>') { - sc.ForwardSetState(SCE_PS_DEFAULT); - } else if (!IsABaseNDigit(sc.ch, 16) && !IsAWhitespaceChar(sc.ch)) { - sc.SetState(SCE_PS_HEXSTRING); - styler.ColourTo(sc.currentPos, SCE_PS_BADSTRINGCHAR); - } - } else if (sc.state == SCE_PS_BASE85STRING) { - if (sc.Match('~', '>')) { - sc.Forward(); - sc.ForwardSetState(SCE_PS_DEFAULT); - } else if (!IsABase85Char(sc.ch) && !IsAWhitespaceChar(sc.ch)) { - sc.SetState(SCE_PS_BASE85STRING); - styler.ColourTo(sc.currentPos, SCE_PS_BADSTRINGCHAR); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_C_DEFAULT) { - - if (sc.ch == '[' || sc.ch == ']') { - sc.SetState(SCE_PS_PAREN_ARRAY); - } else if (sc.ch == '{' || sc.ch == '}') { - sc.SetState(SCE_PS_PAREN_PROC); - } else if (sc.ch == '/') { - if (sc.chNext == '/') { - sc.SetState(SCE_PS_IMMEVAL); - sc.Forward(); - } else { - sc.SetState(SCE_PS_LITERAL); - } - } else if (sc.ch == '<') { - if (sc.chNext == '<') { - sc.SetState(SCE_PS_PAREN_DICT); - sc.Forward(); - } else if (sc.chNext == '~') { - sc.SetState(SCE_PS_BASE85STRING); - sc.Forward(); - } else { - sc.SetState(SCE_PS_HEXSTRING); - } - } else if (sc.ch == '>' && sc.chNext == '>') { - sc.SetState(SCE_PS_PAREN_DICT); - sc.Forward(); - } else if (sc.ch == '>' || sc.ch == ')') { - sc.SetState(SCE_C_DEFAULT); - styler.ColourTo(sc.currentPos, SCE_PS_BADSTRINGCHAR); - } else if (sc.ch == '(') { - sc.SetState(SCE_PS_TEXT); - nestTextCurrent = 1; - } else if (sc.ch == '%') { - if (sc.chNext == '%' && sc.atLineStart) { - sc.SetState(SCE_PS_DSC_COMMENT); - sc.Forward(); - if (sc.chNext == '+') { - sc.Forward(); - sc.ForwardSetState(SCE_PS_DSC_VALUE); - } - } else { - sc.SetState(SCE_PS_COMMENT); - } - } else if ((sc.ch == '+' || sc.ch == '-' || sc.ch == '.') && - IsABaseNDigit(sc.chNext, 10)) { - sc.SetState(SCE_PS_NUMBER); - numRadix = 0; - numHasPoint = (sc.ch == '.'); - numHasExponent = false; - numHasSign = (sc.ch == '+' || sc.ch == '-'); - } else if ((sc.ch == '+' || sc.ch == '-') && sc.chNext == '.' && - IsABaseNDigit(sc.GetRelative(2), 10)) { - sc.SetState(SCE_PS_NUMBER); - numRadix = 0; - numHasPoint = false; - numHasExponent = false; - numHasSign = true; - } else if (IsABaseNDigit(sc.ch, 10)) { - sc.SetState(SCE_PS_NUMBER); - numRadix = 0; - numHasPoint = false; - numHasExponent = false; - numHasSign = false; - } else if (!IsAWhitespaceChar(sc.ch)) { - sc.SetState(SCE_PS_NAME); - } - } - - if (sc.atLineEnd) - styler.SetLineState(lineCurrent, nestTextCurrent); - } - - sc.Complete(); -} - -static void FoldPSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], - Accessor &styler) { - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - 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); - 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'); //mac?? - if ((style & 31) == SCE_PS_PAREN_PROC) { - if (ch == '{') { - // Measure the minimum before a '{' to allow - // folding on "} {" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (ch == '}') { - 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 (!isspacechar(ch)) - visibleChars++; - } -} - -static const char * const psWordListDesc[] = { - "PS Level 1 operators", - "PS Level 2 operators", - "PS Level 3 operators", - "RIP-specific operators", - "User-defined operators", - 0 -}; - -LexerModule lmPS(SCLEX_PS, ColourisePSDoc, "ps", FoldPSDoc, psWordListDesc); diff --git a/lexers/LexPascal.cxx b/lexers/LexPascal.cxx deleted file mode 100644 index 426b3c3f3..000000000 --- a/lexers/LexPascal.cxx +++ /dev/null @@ -1,613 +0,0 @@ -// Scintilla source code edit control -/** @file LexPascal.cxx - ** Lexer for Pascal. - ** Written by Laurent le Tynevez - ** Updated by Simon Steele <s.steele@pnotepad.org> September 2002 - ** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments) - ** Completely rewritten by Marko Njezic <sf@maxempire.com> October 2008 - **/ - -/* - -A few words about features of the new completely rewritten LexPascal... - -Generally speaking LexPascal tries to support all available Delphi features (up -to Delphi XE4 at this time). - -~ HIGHLIGHTING: - -If you enable "lexer.pascal.smart.highlighting" property, some keywords will -only be highlighted in appropriate context. As implemented those are keywords -related to property and DLL exports declarations (similar to how Delphi IDE -works). - -For example, keywords "read" and "write" will only be highlighted if they are in -property declaration: - -property MyProperty: boolean read FMyProperty write FMyProperty; - -~ 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: IF / IFEND; IFDEF, IFNDEF, IFOPT / ENDIF and REGION / ENDREGION -blocks), including nesting of preprocessor blocks up to 255 levels -- Folding of code blocks on appropriate keywords (the following code blocks are -supported: "begin, asm, record, try, case / end" blocks, class & object -declarations and interface declarations) - -Remarks: - -- Folding of code blocks tries to handle all special cases in which folding -should not occur. As implemented those are: - -1. Structure "record case / end" (there's only one "end" statement and "case" is -ignored as fold point) -2. Forward class declarations ("type TMyClass = class;") and object method -declarations ("TNotifyEvent = procedure(Sender: TObject) of object;") are -ignored as fold points -3. Simplified complete class declarations ("type TMyClass = class(TObject);") -are ignored as fold points -4. Every other situation when class keyword doesn't actually start class -declaration ("class procedure", "class function", "class of", "class var", -"class property" and "class operator") -5. Forward (disp)interface declarations ("type IMyInterface = interface;") are -ignored as fold points - -- Folding of code blocks inside preprocessor blocks is disabled (any comments -inside them will be folded fine) because there is no guarantee that complete -code block will be contained inside folded preprocessor block in which case -folded code block could end prematurely at the end of preprocessor block if -there is no closing statement inside. This was done in order to properly process -document that may contain something like this: - -type -{$IFDEF UNICODE} - TMyClass = class(UnicodeAncestor) -{$ELSE} - TMyClass = class(AnsiAncestor) -{$ENDIF} - private - ... - public - ... - published - ... -end; - -If class declarations were folded, then the second class declaration would end -at "$ENDIF" statement, first class statement would end at "end;" statement and -preprocessor "$IFDEF" block would go all the way to the end of document. -However, having in mind all this, if you want to enable folding of code blocks -inside preprocessor blocks, you can disable folding of preprocessor blocks by -changing "fold.preprocessor" property, in which case everything inside them -would be folded. - -~ KEYWORDS: - -The list of keywords that can be used in pascal.properties file (up to Delphi -XE4): - -- Keywords: absolute abstract and array as asm assembler automated begin case -cdecl class const constructor delayed deprecated destructor dispid dispinterface -div do downto dynamic else end except experimental export exports external far -file final finalization finally for forward function goto helper if -implementation in inherited initialization inline interface is label library -message mod near nil not object of on operator or out overload override packed -pascal platform private procedure program property protected public published -raise record reference register reintroduce repeat resourcestring safecall -sealed set shl shr static stdcall strict string then threadvar to try type unit -unsafe until uses var varargs virtual while winapi with xor - -- Keywords related to the "smart highlithing" feature: add default implements -index name nodefault read readonly remove stored write writeonly - -- Keywords related to Delphi packages (in addition to all above): package -contains requires - -*/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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<char>(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<char>(tolower(styler.SafeGetCharAt(start + i))); - i++; - } - s[i] = '\0'; - -} - -enum { - stateInAsm = 0x1000, - stateInProperty = 0x2000, - stateInExport = 0x4000, - stateFoldInPreprocessor = 0x0100, - stateFoldInRecord = 0x0200, - stateFoldInPreprocessorLevelMask = 0x00FF, - stateFoldMaskAll = 0x0FFF -}; - -static void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int &curLineState, bool bSmartHighlighting) { - WordList& keywords = *keywordlists[0]; - - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (keywords.InList(s)) { - if (curLineState & stateInAsm) { - if (strcmp(s, "end") == 0 && sc.GetRelative(-4) != '@') { - curLineState &= ~stateInAsm; - sc.ChangeState(SCE_PAS_WORD); - } else { - sc.ChangeState(SCE_PAS_ASM); - } - } else { - bool ignoreKeyword = false; - if (strcmp(s, "asm") == 0) { - curLineState |= stateInAsm; - } else if (bSmartHighlighting) { - if (strcmp(s, "property") == 0) { - curLineState |= stateInProperty; - } else if (strcmp(s, "exports") == 0) { - curLineState |= stateInExport; - } else if (!(curLineState & (stateInProperty | stateInExport)) && strcmp(s, "index") == 0) { - ignoreKeyword = true; - } else if (!(curLineState & stateInExport) && strcmp(s, "name") == 0) { - ignoreKeyword = true; - } else if (!(curLineState & stateInProperty) && - (strcmp(s, "read") == 0 || strcmp(s, "write") == 0 || - strcmp(s, "default") == 0 || strcmp(s, "nodefault") == 0 || - strcmp(s, "stored") == 0 || strcmp(s, "implements") == 0 || - strcmp(s, "readonly") == 0 || strcmp(s, "writeonly") == 0 || - strcmp(s, "add") == 0 || strcmp(s, "remove") == 0)) { - ignoreKeyword = true; - } - } - if (!ignoreKeyword) { - sc.ChangeState(SCE_PAS_WORD); - } - } - } else if (curLineState & stateInAsm) { - sc.ChangeState(SCE_PAS_ASM); - } - sc.SetState(SCE_PAS_DEFAULT); -} - -static void ColourisePascalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - bool bSmartHighlighting = styler.GetPropertyInt("lexer.pascal.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_PAS_NUMBER: - if (!setNumber.Contains(sc.ch) || (sc.ch == '.' && sc.chNext == '.')) { - sc.SetState(SCE_PAS_DEFAULT); - } else if (sc.ch == '-' || sc.ch == '+') { - if (sc.chPrev != 'E' && sc.chPrev != 'e') { - sc.SetState(SCE_PAS_DEFAULT); - } - } - break; - case SCE_PAS_IDENTIFIER: - if (!setWord.Contains(sc.ch)) { - ClassifyPascalWord(keywordlists, sc, curLineState, bSmartHighlighting); - } - break; - case SCE_PAS_HEXNUMBER: - if (!setHexNumber.Contains(sc.ch)) { - sc.SetState(SCE_PAS_DEFAULT); - } - break; - case SCE_PAS_COMMENT: - case SCE_PAS_PREPROCESSOR: - if (sc.ch == '}') { - sc.ForwardSetState(SCE_PAS_DEFAULT); - } - break; - case SCE_PAS_COMMENT2: - case SCE_PAS_PREPROCESSOR2: - if (sc.Match('*', ')')) { - sc.Forward(); - sc.ForwardSetState(SCE_PAS_DEFAULT); - } - break; - case SCE_PAS_COMMENTLINE: - if (sc.atLineStart) { - sc.SetState(SCE_PAS_DEFAULT); - } - break; - case SCE_PAS_STRING: - if (sc.atLineEnd) { - sc.ChangeState(SCE_PAS_STRINGEOL); - } else if (sc.ch == '\'' && sc.chNext == '\'') { - sc.Forward(); - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_PAS_DEFAULT); - } - break; - case SCE_PAS_STRINGEOL: - if (sc.atLineStart) { - sc.SetState(SCE_PAS_DEFAULT); - } - break; - case SCE_PAS_CHARACTER: - if (!setHexNumber.Contains(sc.ch) && sc.ch != '$') { - sc.SetState(SCE_PAS_DEFAULT); - } - break; - case SCE_PAS_OPERATOR: - if (bSmartHighlighting && sc.chPrev == ';') { - curLineState &= ~(stateInProperty | stateInExport); - } - sc.SetState(SCE_PAS_DEFAULT); - break; - case SCE_PAS_ASM: - sc.SetState(SCE_PAS_DEFAULT); - break; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_PAS_DEFAULT) { - if (IsADigit(sc.ch) && !(curLineState & stateInAsm)) { - sc.SetState(SCE_PAS_NUMBER); - } else if (setWordStart.Contains(sc.ch)) { - sc.SetState(SCE_PAS_IDENTIFIER); - } else if (sc.ch == '$' && !(curLineState & stateInAsm)) { - sc.SetState(SCE_PAS_HEXNUMBER); - } else if (sc.Match('{', '$')) { - sc.SetState(SCE_PAS_PREPROCESSOR); - } else if (sc.ch == '{') { - sc.SetState(SCE_PAS_COMMENT); - } else if (sc.Match("(*$")) { - sc.SetState(SCE_PAS_PREPROCESSOR2); - } else if (sc.Match('(', '*')) { - sc.SetState(SCE_PAS_COMMENT2); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('/', '/')) { - sc.SetState(SCE_PAS_COMMENTLINE); - } else if (sc.ch == '\'') { - sc.SetState(SCE_PAS_STRING); - } else if (sc.ch == '#') { - sc.SetState(SCE_PAS_CHARACTER); - } else if (setOperator.Contains(sc.ch) && !(curLineState & stateInAsm)) { - sc.SetState(SCE_PAS_OPERATOR); - } else if (curLineState & stateInAsm) { - sc.SetState(SCE_PAS_ASM); - } - } - } - - if (sc.state == SCE_PAS_IDENTIFIER && setWord.Contains(sc.chPrev)) { - ClassifyPascalWord(keywordlists, sc, curLineState, bSmartHighlighting); - } - - sc.Complete(); -} - -static bool IsStreamCommentStyle(int style) { - return style == SCE_PAS_COMMENT || style == SCE_PAS_COMMENT2; -} - -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_PAS_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 void ClassifyPascalPreprocessorFoldPoint(int &levelCurrent, int &lineFoldStateCurrent, - Sci_PositionU startPos, Accessor &styler) { - CharacterSet setWord(CharacterSet::setAlpha); - - char s[11]; // Size of the longest possible keyword + one additional character + null - GetForwardRangeLowered(startPos, setWord, styler, s, sizeof(s)); - - unsigned int nestLevel = GetFoldInPreprocessorLevelFlag(lineFoldStateCurrent); - - if (strcmp(s, "if") == 0 || - strcmp(s, "ifdef") == 0 || - strcmp(s, "ifndef") == 0 || - strcmp(s, "ifopt") == 0 || - strcmp(s, "region") == 0) { - nestLevel++; - SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel); - lineFoldStateCurrent |= stateFoldInPreprocessor; - levelCurrent++; - } else if (strcmp(s, "endif") == 0 || - strcmp(s, "ifend") == 0 || - strcmp(s, "endregion") == 0) { - nestLevel--; - SetFoldInPreprocessorLevelFlag(lineFoldStateCurrent, nestLevel); - if (nestLevel == 0) { - lineFoldStateCurrent &= ~stateFoldInPreprocessor; - } - levelCurrent--; - if (levelCurrent < SC_FOLDLEVELBASE) { - levelCurrent = SC_FOLDLEVELBASE; - } - } -} - -static Sci_PositionU SkipWhiteSpace(Sci_PositionU currentPos, Sci_PositionU endPos, - Accessor &styler, bool includeChars = false) { - CharacterSet setWord(CharacterSet::setAlphaNum, "_"); - Sci_PositionU j = currentPos + 1; - char ch = styler.SafeGetCharAt(j); - while ((j < endPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' || - IsStreamCommentStyle(styler.StyleAt(j)) || (includeChars && setWord.Contains(ch)))) { - j++; - ch = styler.SafeGetCharAt(j); - } - return j; -} - -static void ClassifyPascalWordFoldPoint(int &levelCurrent, int &lineFoldStateCurrent, - Sci_Position startPos, Sci_PositionU endPos, - Sci_PositionU lastStart, Sci_PositionU currentPos, Accessor &styler) { - char s[100]; - GetRangeLowered(lastStart, currentPos, styler, s, sizeof(s)); - - if (strcmp(s, "record") == 0) { - lineFoldStateCurrent |= stateFoldInRecord; - levelCurrent++; - } else if (strcmp(s, "begin") == 0 || - strcmp(s, "asm") == 0 || - strcmp(s, "try") == 0 || - (strcmp(s, "case") == 0 && !(lineFoldStateCurrent & stateFoldInRecord))) { - levelCurrent++; - } else if (strcmp(s, "class") == 0 || strcmp(s, "object") == 0) { - // "class" & "object" keywords require special handling... - bool ignoreKeyword = false; - Sci_PositionU j = SkipWhiteSpace(currentPos, endPos, styler); - if (j < endPos) { - CharacterSet setWordStart(CharacterSet::setAlpha, "_"); - CharacterSet setWord(CharacterSet::setAlphaNum, "_"); - - if (styler.SafeGetCharAt(j) == ';') { - // Handle forward class declarations ("type TMyClass = class;") - // and object method declarations ("TNotifyEvent = procedure(Sender: TObject) of object;") - ignoreKeyword = true; - } else if (strcmp(s, "class") == 0) { - // "class" keyword has a few more special cases... - if (styler.SafeGetCharAt(j) == '(') { - // Handle simplified complete class declarations ("type TMyClass = class(TObject);") - j = SkipWhiteSpace(j, endPos, styler, true); - if (j < endPos && styler.SafeGetCharAt(j) == ')') { - j = SkipWhiteSpace(j, endPos, styler); - if (j < endPos && styler.SafeGetCharAt(j) == ';') { - ignoreKeyword = true; - } - } - } else if (setWordStart.Contains(styler.SafeGetCharAt(j))) { - char s2[11]; // Size of the longest possible keyword + one additional character + null - GetForwardRangeLowered(j, setWord, styler, s2, sizeof(s2)); - - if (strcmp(s2, "procedure") == 0 || - strcmp(s2, "function") == 0 || - strcmp(s2, "of") == 0 || - strcmp(s2, "var") == 0 || - strcmp(s2, "property") == 0 || - strcmp(s2, "operator") == 0) { - ignoreKeyword = true; - } - } - } - } - if (!ignoreKeyword) { - levelCurrent++; - } - } else if (strcmp(s, "interface") == 0) { - // "interface" keyword requires special handling... - bool ignoreKeyword = true; - Sci_Position j = lastStart - 1; - char ch = styler.SafeGetCharAt(j); - while ((j >= startPos) && (IsASpaceOrTab(ch) || ch == '\r' || ch == '\n' || - IsStreamCommentStyle(styler.StyleAt(j)))) { - j--; - ch = styler.SafeGetCharAt(j); - } - if (j >= startPos && styler.SafeGetCharAt(j) == '=') { - ignoreKeyword = false; - } - if (!ignoreKeyword) { - Sci_PositionU k = SkipWhiteSpace(currentPos, endPos, styler); - if (k < endPos && styler.SafeGetCharAt(k) == ';') { - // Handle forward interface declarations ("type IMyInterface = interface;") - ignoreKeyword = true; - } - } - if (!ignoreKeyword) { - levelCurrent++; - } - } else if (strcmp(s, "dispinterface") == 0) { - // "dispinterface" keyword requires special handling... - bool ignoreKeyword = false; - Sci_PositionU j = SkipWhiteSpace(currentPos, endPos, styler); - if (j < endPos && styler.SafeGetCharAt(j) == ';') { - // Handle forward dispinterface declarations ("type IMyInterface = dispinterface;") - ignoreKeyword = true; - } - if (!ignoreKeyword) { - levelCurrent++; - } - } else if (strcmp(s, "end") == 0) { - lineFoldStateCurrent &= ~stateFoldInRecord; - levelCurrent--; - if (levelCurrent < SC_FOLDLEVELBASE) { - levelCurrent = SC_FOLDLEVELBASE; - } - } -} - -static void FoldPascalDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], - 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; - - 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) && !atEOL) { - // Comments don't end at end of line and the next character may be unstyled. - 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_PAS_PREPROCESSOR && ch == '{' && chNext == '$') { - ClassifyPascalPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 2, styler); - } else if (style == SCE_PAS_PREPROCESSOR2 && ch == '(' && chNext == '*' - && styler.SafeGetCharAt(i + 2) == '$') { - ClassifyPascalPreprocessorFoldPoint(levelCurrent, lineFoldStateCurrent, i + 3, styler); - } - } - - if (stylePrev != SCE_PAS_WORD && style == SCE_PAS_WORD) - { - // Store last word start point. - lastStart = i; - } - if (stylePrev == SCE_PAS_WORD && !(lineFoldStateCurrent & stateFoldInPreprocessor)) { - if(setWord.Contains(ch) && !setWord.Contains(chNext)) { - ClassifyPascalWordFoldPoint(levelCurrent, lineFoldStateCurrent, startPos, endPos, lastStart, i, 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 pascalWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmPascal(SCLEX_PASCAL, ColourisePascalDoc, "pascal", FoldPascalDoc, pascalWordListDesc); diff --git a/lexers/LexPerl.cxx b/lexers/LexPerl.cxx deleted file mode 100644 index 705463991..000000000 --- a/lexers/LexPerl.cxx +++ /dev/null @@ -1,1848 +0,0 @@ -// Scintilla source code edit control -/** @file LexPerl.cxx - ** Lexer for Perl. - ** Converted to lexer object by "Udo Lechner" <dlchnr(at)gmx(dot)net> - **/ -// Copyright 1998-2008 by Neil Hodgson <neilh@scintilla.org> -// Lexical analysis fixes by Kein-Hong Man <mkh@pl.jaring.my> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <map> - -#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; - -// Info for HERE document handling from perldata.pod (reformatted): -// ---------------------------------------------------------------- -// A line-oriented form of quoting is based on the shell ``here-doc'' syntax. -// Following a << you specify a string to terminate the quoted material, and -// all lines following the current line down to the terminating string are -// the value of the item. -// Prefixing the terminating string with a "~" specifies that you want to -// use "Indented Here-docs" (see below). -// * The terminating string may be either an identifier (a word), or some -// quoted text. -// * If quoted, the type of quotes you use determines the treatment of the -// text, just as in regular quoting. -// * An unquoted identifier works like double quotes. -// * There must be no space between the << and the identifier. -// (If you put a space it will be treated as a null identifier, -// which is valid, and matches the first empty line.) -// (This is deprecated, -w warns of this syntax) -// * The terminating string must appear by itself (unquoted and -// with no surrounding whitespace) on the terminating line. -// -// Indented Here-docs -// ------------------ -// The here-doc modifier "~" allows you to indent your here-docs to -// make the code more readable. -// The delimiter is used to determine the exact whitespace to remove -// from the beginning of each line. All lines must have at least the -// same starting whitespace (except lines only containing a newline) -// or perl will croak. Tabs and spaces can be mixed, but are matched -// exactly. One tab will not be equal to 8 spaces! -// Additional beginning whitespace (beyond what preceded the -// delimiter) will be preserved. - -#define HERE_DELIM_MAX 256 // maximum length of HERE doc delimiter - -#define PERLNUM_BINARY 1 // order is significant: 1-3 cannot have a dot -#define PERLNUM_OCTAL 2 -#define PERLNUM_FLOAT_EXP 3 // exponent part only -#define PERLNUM_HEX 4 // may be a hex float -#define PERLNUM_DECIMAL 5 // 1-5 are numbers; 6-7 are strings -#define PERLNUM_VECTOR 6 -#define PERLNUM_V_VECTOR 7 -#define PERLNUM_BAD 8 - -#define BACK_NONE 0 // lookback state for bareword disambiguation: -#define BACK_OPERATOR 1 // whitespace/comments are insignificant -#define BACK_KEYWORD 2 // operators/keywords are needed for disambiguation - -#define SUB_BEGIN 0 // states for subroutine prototype scan: -#define SUB_HAS_PROTO 1 // only 'prototype' attribute allows prototypes -#define SUB_HAS_ATTRIB 2 // other attributes can exist leftward -#define SUB_HAS_MODULE 3 // sub name can have a ::identifier part -#define SUB_HAS_SUB 4 // 'sub' keyword - -// all interpolated styles are different from their parent styles by a constant difference -// we also assume SCE_PL_STRING_VAR is the interpolated style with the smallest value -#define INTERPOLATE_SHIFT (SCE_PL_STRING_VAR - SCE_PL_STRING) - -static bool isPerlKeyword(Sci_PositionU start, Sci_PositionU end, WordList &keywords, LexAccessor &styler) { - // old-style keyword matcher; needed because GetCurrent() needs - // current segment to be committed, but we may abandon early... - char s[100]; - Sci_PositionU i, len = end - start; - if (len > 30) { len = 30; } - for (i = 0; i < len; i++, start++) s[i] = styler[start]; - s[i] = '\0'; - return keywords.InList(s); -} - -static int disambiguateBareword(LexAccessor &styler, Sci_PositionU bk, Sci_PositionU fw, - int backFlag, Sci_PositionU backPos, Sci_PositionU endPos) { - // identifiers are recognized by Perl as barewords under some - // conditions, the following attempts to do the disambiguation - // by looking backward and forward; result in 2 LSB - int result = 0; - bool moreback = false; // true if passed newline/comments - bool brace = false; // true if opening brace found - // if BACK_NONE, neither operator nor keyword, so skip test - if (backFlag == BACK_NONE) - return result; - // first look backwards past whitespace/comments to set EOL flag - // (some disambiguation patterns must be on a single line) - if (backPos <= static_cast<Sci_PositionU>(styler.LineStart(styler.GetLine(bk)))) - moreback = true; - // look backwards at last significant lexed item for disambiguation - bk = backPos - 1; - int ch = static_cast<unsigned char>(styler.SafeGetCharAt(bk)); - if (ch == '{' && !moreback) { - // {bareword: possible variable spec - brace = true; - } else if ((ch == '&' && styler.SafeGetCharAt(bk - 1) != '&') - // &bareword: subroutine call - || styler.Match(bk - 1, "->") - // ->bareword: part of variable spec - || styler.Match(bk - 1, "::") - // ::bareword: part of module spec - || styler.Match(bk - 2, "sub")) { - // sub bareword: subroutine declaration - // (implied BACK_KEYWORD, no keywords end in 'sub'!) - result |= 1; - } - // next, scan forward after word past tab/spaces only; - // if ch isn't one of '[{(,' we can skip the test - if ((ch == '{' || ch == '(' || ch == '['|| ch == ',') - && fw < endPos) { - while (IsASpaceOrTab(ch = static_cast<unsigned char>(styler.SafeGetCharAt(fw))) - && fw < endPos) { - fw++; - } - if ((ch == '}' && brace) - // {bareword}: variable spec - || styler.Match(fw, "=>")) { - // [{(, bareword=>: hash literal - result |= 2; - } - } - return result; -} - -static void skipWhitespaceComment(LexAccessor &styler, Sci_PositionU &p) { - // when backtracking, we need to skip whitespace and comments - while (p > 0) { - const int style = styler.StyleAt(p); - if (style != SCE_PL_DEFAULT && style != SCE_PL_COMMENTLINE) - break; - p--; - } -} - -static int findPrevLexeme(LexAccessor &styler, Sci_PositionU &bk, int &style) { - // scan backward past whitespace and comments to find a lexeme - skipWhitespaceComment(styler, bk); - if (bk == 0) - return 0; - int sz = 1; - style = styler.StyleAt(bk); - while (bk > 0) { // find extent of lexeme - if (styler.StyleAt(bk - 1) == style) { - bk--; sz++; - } else - break; - } - return sz; -} - -static int styleBeforeBracePair(LexAccessor &styler, Sci_PositionU bk) { - // backtrack to find open '{' corresponding to a '}', balanced - // return significant style to be tested for '/' disambiguation - int braceCount = 1; - if (bk == 0) - return SCE_PL_DEFAULT; - while (--bk > 0) { - if (styler.StyleAt(bk) == SCE_PL_OPERATOR) { - int bkch = static_cast<unsigned char>(styler.SafeGetCharAt(bk)); - if (bkch == ';') { // early out - break; - } else if (bkch == '}') { - braceCount++; - } else if (bkch == '{') { - if (--braceCount == 0) break; - } - } - } - if (bk > 0 && braceCount == 0) { - // balanced { found, bk > 0, skip more whitespace/comments - bk--; - skipWhitespaceComment(styler, bk); - return styler.StyleAt(bk); - } - return SCE_PL_DEFAULT; -} - -static int styleCheckIdentifier(LexAccessor &styler, Sci_PositionU bk) { - // backtrack to classify sub-styles of identifier under test - // return sub-style to be tested for '/' disambiguation - if (styler.SafeGetCharAt(bk) == '>') // inputsymbol, like <foo> - return 1; - // backtrack to check for possible "->" or "::" before identifier - while (bk > 0 && styler.StyleAt(bk) == SCE_PL_IDENTIFIER) { - bk--; - } - while (bk > 0) { - int bkstyle = styler.StyleAt(bk); - if (bkstyle == SCE_PL_DEFAULT - || bkstyle == SCE_PL_COMMENTLINE) { - // skip whitespace, comments - } else if (bkstyle == SCE_PL_OPERATOR) { - // test for "->" and "::" - if (styler.Match(bk - 1, "->") || styler.Match(bk - 1, "::")) - return 2; - } else - return 3; // bare identifier - bk--; - } - return 0; -} - -static int podLineScan(LexAccessor &styler, Sci_PositionU &pos, Sci_PositionU endPos) { - // forward scan the current line to classify line for POD style - int state = -1; - while (pos < endPos) { - int ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos)); - if (ch == '\n' || ch == '\r') { - if (ch == '\r' && styler.SafeGetCharAt(pos + 1) == '\n') pos++; - break; - } - if (IsASpaceOrTab(ch)) { // whitespace, take note - if (state == -1) - state = SCE_PL_DEFAULT; - } else if (state == SCE_PL_DEFAULT) { // verbatim POD line - state = SCE_PL_POD_VERB; - } else if (state != SCE_PL_POD_VERB) { // regular POD line - state = SCE_PL_POD; - } - pos++; - } - if (state == -1) - state = SCE_PL_DEFAULT; - return state; -} - -static bool styleCheckSubPrototype(LexAccessor &styler, Sci_PositionU bk) { - // backtrack to identify if we're starting a subroutine prototype - // we also need to ignore whitespace/comments, format is like: - // sub abc::pqr :const :prototype(...) - // lexemes are tested in pairs, e.g. '::'+'pqr', ':'+'const', etc. - // and a state machine generates legal subroutine syntax matches - styler.Flush(); - int state = SUB_BEGIN; - do { - // find two lexemes, lexeme 2 follows lexeme 1 - int style2 = SCE_PL_DEFAULT; - Sci_PositionU pos2 = bk; - int len2 = findPrevLexeme(styler, pos2, style2); - int style1 = SCE_PL_DEFAULT; - Sci_PositionU pos1 = pos2; - if (pos1 > 0) pos1--; - int len1 = findPrevLexeme(styler, pos1, style1); - if (len1 == 0 || len2 == 0) // lexeme pair must exist - break; - - // match parts of syntax, if invalid subroutine syntax, break off - if (style1 == SCE_PL_OPERATOR && len1 == 1 && - styler.SafeGetCharAt(pos1) == ':') { // ':' - if (style2 == SCE_PL_IDENTIFIER || style2 == SCE_PL_WORD) { - if (len2 == 9 && styler.Match(pos2, "prototype")) { // ':' 'prototype' - if (state == SUB_BEGIN) { - state = SUB_HAS_PROTO; - } else - break; - } else { // ':' <attribute> - if (state == SUB_HAS_PROTO || state == SUB_HAS_ATTRIB) { - state = SUB_HAS_ATTRIB; - } else - break; - } - } else - break; - } else if (style1 == SCE_PL_OPERATOR && len1 == 2 && - styler.Match(pos1, "::")) { // '::' - if (style2 == SCE_PL_IDENTIFIER) { // '::' <identifier> - state = SUB_HAS_MODULE; - } else - break; - } else if (style1 == SCE_PL_WORD && len1 == 3 && - styler.Match(pos1, "sub")) { // 'sub' - if (style2 == SCE_PL_IDENTIFIER) { // 'sub' <identifier> - state = SUB_HAS_SUB; - } else - break; - } else - break; - bk = pos1; // set position for finding next lexeme pair - if (bk > 0) bk--; - } while (state != SUB_HAS_SUB); - return (state == SUB_HAS_SUB); -} - -static int actualNumStyle(int numberStyle) { - if (numberStyle == PERLNUM_VECTOR || numberStyle == PERLNUM_V_VECTOR) { - return SCE_PL_STRING; - } else if (numberStyle == PERLNUM_BAD) { - return SCE_PL_ERROR; - } - return SCE_PL_NUMBER; -} - -static int opposite(int ch) { - if (ch == '(') return ')'; - if (ch == '[') return ']'; - if (ch == '{') return '}'; - if (ch == '<') return '>'; - return ch; -} - -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_PL_COMMENTLINE) - return true; - else if (!IsASpaceOrTab(ch)) - return false; - } - return false; -} - -static bool IsPackageLine(Sci_Position line, LexAccessor &styler) { - Sci_Position pos = styler.LineStart(line); - int style = styler.StyleAt(pos); - if (style == SCE_PL_WORD && styler.Match(pos, "package")) { - return true; - } - return false; -} - -static int PodHeadingLevel(Sci_Position pos, LexAccessor &styler) { - int lvl = static_cast<unsigned char>(styler.SafeGetCharAt(pos + 5)); - if (lvl >= '1' && lvl <= '4') { - return lvl - '0'; - } - return 0; -} - -// An individual named option for use in an OptionSet - -// Options used for LexerPerl -struct OptionsPerl { - bool fold; - bool foldComment; - bool foldCompact; - // Custom folding of POD and packages - bool foldPOD; // fold.perl.pod - // Enable folding Pod blocks when using the Perl lexer. - bool foldPackage; // fold.perl.package - // Enable folding packages when using the Perl lexer. - - bool foldCommentExplicit; - - bool foldAtElse; - - OptionsPerl() { - fold = false; - foldComment = false; - foldCompact = true; - foldPOD = true; - foldPackage = true; - foldCommentExplicit = true; - foldAtElse = false; - } -}; - -static const char *const perlWordListDesc[] = { - "Keywords", - 0 -}; - -struct OptionSetPerl : public OptionSet<OptionsPerl> { - OptionSetPerl() { - DefineProperty("fold", &OptionsPerl::fold); - - DefineProperty("fold.comment", &OptionsPerl::foldComment); - - DefineProperty("fold.compact", &OptionsPerl::foldCompact); - - DefineProperty("fold.perl.pod", &OptionsPerl::foldPOD, - "Set to 0 to disable folding Pod blocks when using the Perl lexer."); - - DefineProperty("fold.perl.package", &OptionsPerl::foldPackage, - "Set to 0 to disable folding packages when using the Perl lexer."); - - DefineProperty("fold.perl.comment.explicit", &OptionsPerl::foldCommentExplicit, - "Set to 0 to disable explicit folding."); - - DefineProperty("fold.perl.at.else", &OptionsPerl::foldAtElse, - "This option enables Perl folding on a \"} else {\" line of an if statement."); - - DefineWordListSets(perlWordListDesc); - } -}; - -class LexerPerl : public DefaultLexer { - CharacterSet setWordStart; - CharacterSet setWord; - CharacterSet setSpecialVar; - CharacterSet setControlVar; - WordList keywords; - OptionsPerl options; - OptionSetPerl osPerl; -public: - LexerPerl() : - DefaultLexer("perl", SCLEX_PERL), - setWordStart(CharacterSet::setAlpha, "_", 0x80, true), - setWord(CharacterSet::setAlphaNum, "_", 0x80, true), - setSpecialVar(CharacterSet::setNone, "\"$;<>&`'+,./\\%:=~!?@[]"), - setControlVar(CharacterSet::setNone, "ACDEFHILMNOPRSTVWX") { - } - virtual ~LexerPerl() { - } - void SCI_METHOD Release() override { - delete this; - } - int SCI_METHOD Version() const override { - return lvRelease5; - } - const char *SCI_METHOD PropertyNames() override { - return osPerl.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) override { - return osPerl.PropertyType(name); - } - const char *SCI_METHOD DescribeProperty(const char *name) override { - return osPerl.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; - const char * SCI_METHOD PropertyGet(const char *key) override { - return osPerl.PropertyGet(key); - } - const char *SCI_METHOD DescribeWordListSets() override { - return osPerl.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 *LexerFactoryPerl() { - return new LexerPerl(); - } - int InputSymbolScan(StyleContext &sc); - void InterpolateSegment(StyleContext &sc, int maxSeg, bool isPattern=false); -}; - -Sci_Position SCI_METHOD LexerPerl::PropertySet(const char *key, const char *val) { - if (osPerl.PropertySet(&options, key, val)) { - return 0; - } - return -1; -} - -Sci_Position SCI_METHOD LexerPerl::WordListSet(int n, const char *wl) { - WordList *wordListN = 0; - switch (n) { - case 0: - wordListN = &keywords; - break; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - } - } - return firstModification; -} - -int LexerPerl::InputSymbolScan(StyleContext &sc) { - // forward scan for matching > on same line; file handles - int c, sLen = 0; - while ((c = sc.GetRelativeCharacter(++sLen)) != 0) { - if (c == '\r' || c == '\n') { - return 0; - } else if (c == '>') { - if (sc.Match("<=>")) // '<=>' case - return 0; - return sLen; - } - } - return 0; -} - -void LexerPerl::InterpolateSegment(StyleContext &sc, int maxSeg, bool isPattern) { - // interpolate a segment (with no active backslashes or delimiters within) - // switch in or out of an interpolation style or continue current style - // commit variable patterns if found, trim segment, repeat until done - while (maxSeg > 0) { - bool isVar = false; - int sLen = 0; - if ((maxSeg > 1) && (sc.ch == '$' || sc.ch == '@')) { - // $#[$]*word [$@][$]*word (where word or {word} is always present) - bool braces = false; - sLen = 1; - if (sc.ch == '$' && sc.chNext == '#') { // starts with $# - sLen++; - } - while ((maxSeg > sLen) && (sc.GetRelativeCharacter(sLen) == '$')) // >0 $ dereference within - sLen++; - if ((maxSeg > sLen) && (sc.GetRelativeCharacter(sLen) == '{')) { // { start for {word} - sLen++; - braces = true; - } - if (maxSeg > sLen) { - int c = sc.GetRelativeCharacter(sLen); - if (setWordStart.Contains(c)) { // word (various) - sLen++; - isVar = true; - while (maxSeg > sLen) { - if (!setWord.Contains(sc.GetRelativeCharacter(sLen))) - break; - sLen++; - } - } else if (braces && IsADigit(c) && (sLen == 2)) { // digit for ${digit} - sLen++; - isVar = true; - } - } - if (braces) { - if ((maxSeg > sLen) && (sc.GetRelativeCharacter(sLen) == '}')) { // } end for {word} - sLen++; - } else - isVar = false; - } - } - if (!isVar && (maxSeg > 1)) { // $- or @-specific variable patterns - int c = sc.chNext; - if (sc.ch == '$') { - sLen = 1; - if (IsADigit(c)) { // $[0-9] and slurp trailing digits - sLen++; - isVar = true; - while ((maxSeg > sLen) && IsADigit(sc.GetRelativeCharacter(sLen))) - sLen++; - } else if (setSpecialVar.Contains(c)) { // $ special variables - sLen++; - isVar = true; - } else if (!isPattern && ((c == '(') || (c == ')') || (c == '|'))) { // $ additional - sLen++; - isVar = true; - } else if (c == '^') { // $^A control-char style - sLen++; - if ((maxSeg > sLen) && setControlVar.Contains(sc.GetRelativeCharacter(sLen))) { - sLen++; - isVar = true; - } - } - } else if (sc.ch == '@') { - sLen = 1; - if (!isPattern && ((c == '+') || (c == '-'))) { // @ specials non-pattern - sLen++; - isVar = true; - } - } - } - if (isVar) { // commit as interpolated variable or normal character - if (sc.state < SCE_PL_STRING_VAR) - sc.SetState(sc.state + INTERPOLATE_SHIFT); - sc.Forward(sLen); - maxSeg -= sLen; - } else { - if (sc.state >= SCE_PL_STRING_VAR) - sc.SetState(sc.state - INTERPOLATE_SHIFT); - sc.Forward(); - maxSeg--; - } - } - if (sc.state >= SCE_PL_STRING_VAR) - sc.SetState(sc.state - INTERPOLATE_SHIFT); -} - -void SCI_METHOD LexerPerl::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - LexAccessor styler(pAccess); - - // keywords that forces /PATTERN/ at all times; should track vim's behaviour - WordList reWords; - reWords.Set("elsif if split while"); - - // charset classes - CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMAC"); - // lexing of "%*</" operators is non-trivial; these are missing in the set below - CharacterSet setPerlOperator(CharacterSet::setNone, "^&\\()-+=|{}[]:;>,?!.~"); - CharacterSet setQDelim(CharacterSet::setNone, "qrwx"); - CharacterSet setModifiers(CharacterSet::setAlpha); - CharacterSet setPreferRE(CharacterSet::setNone, "*/<%"); - // setArray and setHash also accepts chars for special vars like $_, - // which are then truncated when the next char does not match setVar - CharacterSet setVar(CharacterSet::setAlphaNum, "#$_'", 0x80, true); - CharacterSet setArray(CharacterSet::setAlpha, "#$_+-", 0x80, true); - CharacterSet setHash(CharacterSet::setAlpha, "#$_!^+-", 0x80, true); - CharacterSet &setPOD = setModifiers; - CharacterSet setNonHereDoc(CharacterSet::setDigits, "=$@"); - CharacterSet setHereDocDelim(CharacterSet::setAlphaNum, "_"); - CharacterSet setSubPrototype(CharacterSet::setNone, "\\[$@%&*+];_ \t"); - CharacterSet setRepetition(CharacterSet::setDigits, ")\"'"); - // for format identifiers - CharacterSet setFormatStart(CharacterSet::setAlpha, "_="); - CharacterSet &setFormat = setHereDocDelim; - - // Lexer for perl often has to backtrack to start of current style to determine - // which characters are being used as quotes, how deeply nested is the - // start position and what the termination string is for HERE documents. - - class HereDocCls { // Class to manage HERE doc sequence - public: - int State; - // 0: '<<' encountered - // 1: collect the delimiter - // 2: here doc text (lines after the delimiter) - int Quote; // the char after '<<' - bool Quoted; // true if Quote in ('\'','"','`') - bool StripIndent; // true if '<<~' requested to strip leading whitespace - int DelimiterLength; // strlen(Delimiter) - char Delimiter[HERE_DELIM_MAX]; // the Delimiter - HereDocCls() { - State = 0; - Quote = 0; - Quoted = false; - StripIndent = false; - DelimiterLength = 0; - Delimiter[0] = '\0'; - } - void Append(int ch) { - Delimiter[DelimiterLength++] = static_cast<char>(ch); - Delimiter[DelimiterLength] = '\0'; - } - ~HereDocCls() { - } - }; - HereDocCls HereDoc; // TODO: FIFO for stacked here-docs - - class QuoteCls { // Class to manage quote pairs - public: - int Rep; - int Count; - int Up, Down; - QuoteCls() { - New(1); - } - void New(int r = 1) { - Rep = r; - Count = 0; - Up = '\0'; - Down = '\0'; - } - void Open(int u) { - Count++; - Up = u; - Down = opposite(Up); - } - }; - QuoteCls Quote; - - // additional state for number lexing - int numState = PERLNUM_DECIMAL; - int dotCount = 0; - - Sci_PositionU endPos = startPos + length; - - // Backtrack to beginning of style if required... - // If in a long distance lexical state, backtrack to find quote characters. - // Includes strings (may be multi-line), numbers (additional state), format - // bodies, as well as POD sections. - if (initStyle == SCE_PL_HERE_Q - || initStyle == SCE_PL_HERE_QQ - || initStyle == SCE_PL_HERE_QX - || initStyle == SCE_PL_FORMAT - || initStyle == SCE_PL_HERE_QQ_VAR - || initStyle == SCE_PL_HERE_QX_VAR - ) { - // backtrack through multiple styles to reach the delimiter start - int delim = (initStyle == SCE_PL_FORMAT) ? SCE_PL_FORMAT_IDENT:SCE_PL_HERE_DELIM; - while ((startPos > 1) && (styler.StyleAt(startPos) != delim)) { - startPos--; - } - startPos = styler.LineStart(styler.GetLine(startPos)); - initStyle = styler.StyleAt(startPos - 1); - } - if (initStyle == SCE_PL_STRING - || initStyle == SCE_PL_STRING_QQ - || initStyle == SCE_PL_BACKTICKS - || initStyle == SCE_PL_STRING_QX - || initStyle == SCE_PL_REGEX - || initStyle == SCE_PL_STRING_QR - || initStyle == SCE_PL_REGSUBST - || initStyle == SCE_PL_STRING_VAR - || initStyle == SCE_PL_STRING_QQ_VAR - || initStyle == SCE_PL_BACKTICKS_VAR - || initStyle == SCE_PL_STRING_QX_VAR - || initStyle == SCE_PL_REGEX_VAR - || initStyle == SCE_PL_STRING_QR_VAR - || initStyle == SCE_PL_REGSUBST_VAR - ) { - // for interpolation, must backtrack through a mix of two different styles - int otherStyle = (initStyle >= SCE_PL_STRING_VAR) ? - initStyle - INTERPOLATE_SHIFT : initStyle + INTERPOLATE_SHIFT; - while (startPos > 1) { - int st = styler.StyleAt(startPos - 1); - if ((st != initStyle) && (st != otherStyle)) - break; - startPos--; - } - initStyle = SCE_PL_DEFAULT; - } else if (initStyle == SCE_PL_STRING_Q - || initStyle == SCE_PL_STRING_QW - || initStyle == SCE_PL_XLAT - || initStyle == SCE_PL_CHARACTER - || initStyle == SCE_PL_NUMBER - || initStyle == SCE_PL_IDENTIFIER - || initStyle == SCE_PL_ERROR - || initStyle == SCE_PL_SUB_PROTOTYPE - ) { - while ((startPos > 1) && (styler.StyleAt(startPos - 1) == initStyle)) { - startPos--; - } - initStyle = SCE_PL_DEFAULT; - } else if (initStyle == SCE_PL_POD - || initStyle == SCE_PL_POD_VERB - ) { - // POD backtracking finds preceding blank lines and goes back past them - Sci_Position ln = styler.GetLine(startPos); - if (ln > 0) { - initStyle = styler.StyleAt(styler.LineStart(--ln)); - if (initStyle == SCE_PL_POD || initStyle == SCE_PL_POD_VERB) { - while (ln > 0 && styler.GetLineState(ln) == SCE_PL_DEFAULT) - ln--; - } - startPos = styler.LineStart(++ln); - initStyle = styler.StyleAt(startPos - 1); - } else { - startPos = 0; - initStyle = SCE_PL_DEFAULT; - } - } - - // backFlag, backPos are additional state to aid identifier corner cases. - // Look backwards past whitespace and comments in order to detect either - // operator or keyword. Later updated as we go along. - int backFlag = BACK_NONE; - Sci_PositionU backPos = startPos; - if (backPos > 0) { - backPos--; - skipWhitespaceComment(styler, backPos); - if (styler.StyleAt(backPos) == SCE_PL_OPERATOR) - backFlag = BACK_OPERATOR; - else if (styler.StyleAt(backPos) == SCE_PL_WORD) - backFlag = BACK_KEYWORD; - backPos++; - } - - StyleContext sc(startPos, endPos - startPos, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_PL_OPERATOR: - sc.SetState(SCE_PL_DEFAULT); - backFlag = BACK_OPERATOR; - backPos = sc.currentPos; - break; - case SCE_PL_IDENTIFIER: // identifier, bareword, inputsymbol - if ((!setWord.Contains(sc.ch) && sc.ch != '\'') - || sc.Match('.', '.') - || sc.chPrev == '>') { // end of inputsymbol - sc.SetState(SCE_PL_DEFAULT); - } - break; - case SCE_PL_WORD: // keyword, plus special cases - if (!setWord.Contains(sc.ch)) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - if ((strcmp(s, "__DATA__") == 0) || (strcmp(s, "__END__") == 0)) { - sc.ChangeState(SCE_PL_DATASECTION); - } else { - if ((strcmp(s, "format") == 0)) { - sc.SetState(SCE_PL_FORMAT_IDENT); - HereDoc.State = 0; - } else { - sc.SetState(SCE_PL_DEFAULT); - } - backFlag = BACK_KEYWORD; - backPos = sc.currentPos; - } - } - break; - case SCE_PL_SCALAR: - case SCE_PL_ARRAY: - case SCE_PL_HASH: - case SCE_PL_SYMBOLTABLE: - if (sc.Match(':', ':')) { // skip :: - sc.Forward(); - } else if (!setVar.Contains(sc.ch)) { - if (sc.LengthCurrent() == 1) { - // Special variable: $(, $_ etc. - sc.Forward(); - } - sc.SetState(SCE_PL_DEFAULT); - } - break; - case SCE_PL_NUMBER: - // if no early break, number style is terminated at "(go through)" - if (sc.ch == '.') { - if (sc.chNext == '.') { - // double dot is always an operator (go through) - } else if (numState <= PERLNUM_FLOAT_EXP) { - // non-decimal number or float exponent, consume next dot - sc.SetState(SCE_PL_OPERATOR); - break; - } else { // decimal or vectors allows dots - dotCount++; - if (numState == PERLNUM_DECIMAL) { - if (dotCount <= 1) // number with one dot in it - break; - if (IsADigit(sc.chNext)) { // really a vector - numState = PERLNUM_VECTOR; - break; - } - // number then dot (go through) - } else if (numState == PERLNUM_HEX) { - if (dotCount <= 1 && IsADigit(sc.chNext, 16)) { - break; // hex with one dot is a hex float - } else { - sc.SetState(SCE_PL_OPERATOR); - break; - } - // hex then dot (go through) - } else if (IsADigit(sc.chNext)) // vectors - break; - // vector then dot (go through) - } - } else if (sc.ch == '_') { - // permissive underscoring for number and vector literals - break; - } else if (numState == PERLNUM_DECIMAL) { - if (sc.ch == 'E' || sc.ch == 'e') { // exponent, sign - numState = PERLNUM_FLOAT_EXP; - if (sc.chNext == '+' || sc.chNext == '-') { - sc.Forward(); - } - break; - } else if (IsADigit(sc.ch)) - break; - // number then word (go through) - } else if (numState == PERLNUM_HEX) { - if (sc.ch == 'P' || sc.ch == 'p') { // hex float exponent, sign - numState = PERLNUM_FLOAT_EXP; - if (sc.chNext == '+' || sc.chNext == '-') { - sc.Forward(); - } - break; - } else if (IsADigit(sc.ch, 16)) - break; - // hex or hex float then word (go through) - } else if (numState == PERLNUM_VECTOR || numState == PERLNUM_V_VECTOR) { - if (IsADigit(sc.ch)) // vector - break; - if (setWord.Contains(sc.ch) && dotCount == 0) { // change to word - sc.ChangeState(SCE_PL_IDENTIFIER); - break; - } - // vector then word (go through) - } else if (IsADigit(sc.ch)) { - if (numState == PERLNUM_FLOAT_EXP) { - break; - } else if (numState == PERLNUM_OCTAL) { - if (sc.ch <= '7') break; - } else if (numState == PERLNUM_BINARY) { - if (sc.ch <= '1') break; - } - // mark invalid octal, binary numbers (go through) - numState = PERLNUM_BAD; - break; - } - // complete current number or vector - sc.ChangeState(actualNumStyle(numState)); - sc.SetState(SCE_PL_DEFAULT); - break; - case SCE_PL_COMMENTLINE: - if (sc.atLineStart) { - sc.SetState(SCE_PL_DEFAULT); - } - break; - case SCE_PL_HERE_DELIM: - if (HereDoc.State == 0) { // '<<' encountered - int delim_ch = sc.chNext; - Sci_Position ws_skip = 0; - HereDoc.State = 1; // pre-init HERE doc class - HereDoc.Quote = sc.chNext; - HereDoc.Quoted = false; - HereDoc.StripIndent = false; - HereDoc.DelimiterLength = 0; - HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; - if (delim_ch == '~') { // was actually '<<~' - sc.Forward(); - HereDoc.StripIndent = true; - HereDoc.Quote = delim_ch = sc.chNext; - } - if (IsASpaceOrTab(delim_ch)) { - // skip whitespace; legal only for quoted delimiters - Sci_PositionU i = sc.currentPos + 1; - while ((i < endPos) && IsASpaceOrTab(delim_ch)) { - i++; - delim_ch = static_cast<unsigned char>(styler.SafeGetCharAt(i)); - } - ws_skip = i - sc.currentPos - 1; - } - if (delim_ch == '\'' || delim_ch == '"' || delim_ch == '`') { - // a quoted here-doc delimiter; skip any whitespace - sc.Forward(ws_skip + 1); - HereDoc.Quote = delim_ch; - HereDoc.Quoted = true; - } else if ((ws_skip == 0 && setNonHereDoc.Contains(sc.chNext)) - || ws_skip > 0) { - // left shift << or <<= operator cases - // restore position if operator - sc.ChangeState(SCE_PL_OPERATOR); - sc.ForwardSetState(SCE_PL_DEFAULT); - backFlag = BACK_OPERATOR; - backPos = sc.currentPos; - HereDoc.State = 0; - } else { - // specially handle initial '\' for identifier - if (ws_skip == 0 && HereDoc.Quote == '\\') - sc.Forward(); - // an unquoted here-doc delimiter, no special handling - // (cannot be prefixed by spaces/tabs), or - // symbols terminates; deprecated zero-length delimiter - } - } else if (HereDoc.State == 1) { // collect the delimiter - backFlag = BACK_NONE; - if (HereDoc.Quoted) { // a quoted here-doc delimiter - if (sc.ch == HereDoc.Quote) { // closing quote => end of delimiter - sc.ForwardSetState(SCE_PL_DEFAULT); - } else if (!sc.atLineEnd) { - if (sc.Match('\\', static_cast<char>(HereDoc.Quote))) { // escaped quote - sc.Forward(); - } - if (sc.ch != '\r') { // skip CR if CRLF - int i = 0; // else append char, possibly an extended char - while (i < sc.width) { - HereDoc.Append(static_cast<unsigned char>(styler.SafeGetCharAt(sc.currentPos + i))); - i++; - } - } - } - } else { // an unquoted here-doc delimiter, no extended charsets - if (setHereDocDelim.Contains(sc.ch)) { - HereDoc.Append(sc.ch); - } else { - sc.SetState(SCE_PL_DEFAULT); - } - } - if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { - sc.SetState(SCE_PL_ERROR); - HereDoc.State = 0; - } - } - break; - case SCE_PL_HERE_Q: - case SCE_PL_HERE_QQ: - case SCE_PL_HERE_QX: - // also implies HereDoc.State == 2 - sc.Complete(); - if (HereDoc.StripIndent) { - // skip whitespace - while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd) - sc.Forward(); - } - if (HereDoc.DelimiterLength == 0 || sc.Match(HereDoc.Delimiter)) { - int c = sc.GetRelative(HereDoc.DelimiterLength); - if (c == '\r' || c == '\n') { // peek first, do not consume match - sc.ForwardBytes(HereDoc.DelimiterLength); - sc.SetState(SCE_PL_DEFAULT); - backFlag = BACK_NONE; - HereDoc.State = 0; - if (!sc.atLineEnd) - sc.Forward(); - break; - } - } - if (sc.state == SCE_PL_HERE_Q) { // \EOF and 'EOF' non-interpolated - while (!sc.atLineEnd) - sc.Forward(); - break; - } - while (!sc.atLineEnd) { // "EOF" and `EOF` interpolated - int c, sLen = 0, endType = 0; - while ((c = sc.GetRelativeCharacter(sLen)) != 0) { - // scan to break string into segments - if (c == '\\') { - endType = 1; break; - } else if (c == '\r' || c == '\n') { - endType = 2; break; - } - sLen++; - } - if (sLen > 0) // process non-empty segments - InterpolateSegment(sc, sLen); - if (endType == 1) { - sc.Forward(); - // \ at end-of-line does not appear to have any effect, skip - if (sc.ch != '\r' && sc.ch != '\n') - sc.Forward(); - } else if (endType == 2) { - if (!sc.atLineEnd) - sc.Forward(); - } - } - break; - case SCE_PL_POD: - case SCE_PL_POD_VERB: { - Sci_PositionU fw = sc.currentPos; - Sci_Position ln = styler.GetLine(fw); - if (sc.atLineStart && sc.Match("=cut")) { // end of POD - sc.SetState(SCE_PL_POD); - sc.Forward(4); - sc.SetState(SCE_PL_DEFAULT); - styler.SetLineState(ln, SCE_PL_POD); - break; - } - int pod = podLineScan(styler, fw, endPos); // classify POD line - styler.SetLineState(ln, pod); - if (pod == SCE_PL_DEFAULT) { - if (sc.state == SCE_PL_POD_VERB) { - Sci_PositionU fw2 = fw; - while (fw2 < (endPos - 1) && pod == SCE_PL_DEFAULT) { - fw = fw2++; // penultimate line (last blank line) - pod = podLineScan(styler, fw2, endPos); - styler.SetLineState(styler.GetLine(fw2), pod); - } - if (pod == SCE_PL_POD) { // truncate verbatim POD early - sc.SetState(SCE_PL_POD); - } else - fw = fw2; - } - } else { - if (pod == SCE_PL_POD_VERB // still part of current paragraph - && (styler.GetLineState(ln - 1) == SCE_PL_POD)) { - pod = SCE_PL_POD; - styler.SetLineState(ln, pod); - } else if (pod == SCE_PL_POD - && (styler.GetLineState(ln - 1) == SCE_PL_POD_VERB)) { - pod = SCE_PL_POD_VERB; - styler.SetLineState(ln, pod); - } - sc.SetState(pod); - } - sc.ForwardBytes(fw - sc.currentPos); // commit style - } - break; - case SCE_PL_REGEX: - case SCE_PL_STRING_QR: - if (Quote.Rep <= 0) { - if (!setModifiers.Contains(sc.ch)) - sc.SetState(SCE_PL_DEFAULT); - } else if (!Quote.Up && !IsASpace(sc.ch)) { - Quote.Open(sc.ch); - } else { - int c, sLen = 0, endType = 0; - while ((c = sc.GetRelativeCharacter(sLen)) != 0) { - // scan to break string into segments - if (IsASpace(c)) { - break; - } else if (c == '\\' && Quote.Up != '\\') { - endType = 1; break; - } else if (c == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - Quote.Rep--; - break; - } - } else if (c == Quote.Up) - Quote.Count++; - sLen++; - } - if (sLen > 0) { // process non-empty segments - if (Quote.Up != '\'') { - InterpolateSegment(sc, sLen, true); - } else // non-interpolated path - sc.Forward(sLen); - } - if (endType == 1) - sc.Forward(); - } - break; - case SCE_PL_REGSUBST: - case SCE_PL_XLAT: - if (Quote.Rep <= 0) { - if (!setModifiers.Contains(sc.ch)) - sc.SetState(SCE_PL_DEFAULT); - } else if (!Quote.Up && !IsASpace(sc.ch)) { - Quote.Open(sc.ch); - } else { - int c, sLen = 0, endType = 0; - bool isPattern = (Quote.Rep == 2); - while ((c = sc.GetRelativeCharacter(sLen)) != 0) { - // scan to break string into segments - if (c == '\\' && Quote.Up != '\\') { - endType = 2; break; - } else if (Quote.Count == 0 && Quote.Rep == 1) { - // We matched something like s(...) or tr{...}, Perl 5.10 - // appears to allow almost any character for use as the - // next delimiters. Whitespace and comments are accepted in - // between, but we'll limit to whitespace here. - // For '#', if no whitespace in between, it's a delimiter. - if (IsASpace(c)) { - // Keep going - } else if (c == '#' && IsASpaceOrTab(sc.GetRelativeCharacter(sLen - 1))) { - endType = 3; - } else - Quote.Open(c); - break; - } else if (c == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - Quote.Rep--; - endType = 1; - } - if (Quote.Up == Quote.Down) - Quote.Count++; - if (endType == 1) - break; - } else if (c == Quote.Up) { - Quote.Count++; - } else if (IsASpace(c)) - break; - sLen++; - } - if (sLen > 0) { // process non-empty segments - if (sc.state == SCE_PL_REGSUBST && Quote.Up != '\'') { - InterpolateSegment(sc, sLen, isPattern); - } else // non-interpolated path - sc.Forward(sLen); - } - if (endType == 2) { - sc.Forward(); - } else if (endType == 3) - sc.SetState(SCE_PL_DEFAULT); - } - break; - case SCE_PL_STRING_Q: - case SCE_PL_STRING_QQ: - case SCE_PL_STRING_QX: - case SCE_PL_STRING_QW: - case SCE_PL_STRING: - case SCE_PL_CHARACTER: - case SCE_PL_BACKTICKS: - if (!Quote.Down && !IsASpace(sc.ch)) { - Quote.Open(sc.ch); - } else { - int c, sLen = 0, endType = 0; - while ((c = sc.GetRelativeCharacter(sLen)) != 0) { - // scan to break string into segments - if (IsASpace(c)) { - break; - } else if (c == '\\' && Quote.Up != '\\') { - endType = 2; break; - } else if (c == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - endType = 3; break; - } - } else if (c == Quote.Up) - Quote.Count++; - sLen++; - } - if (sLen > 0) { // process non-empty segments - switch (sc.state) { - case SCE_PL_STRING: - case SCE_PL_STRING_QQ: - case SCE_PL_BACKTICKS: - InterpolateSegment(sc, sLen); - break; - case SCE_PL_STRING_QX: - if (Quote.Up != '\'') { - InterpolateSegment(sc, sLen); - break; - } - // (continued for ' delim) - // Falls through. - default: // non-interpolated path - sc.Forward(sLen); - } - } - if (endType == 2) { - sc.Forward(); - } else if (endType == 3) - sc.ForwardSetState(SCE_PL_DEFAULT); - } - break; - case SCE_PL_SUB_PROTOTYPE: { - int i = 0; - // forward scan; must all be valid proto characters - while (setSubPrototype.Contains(sc.GetRelative(i))) - i++; - if (sc.GetRelative(i) == ')') { // valid sub prototype - sc.ForwardBytes(i); - sc.ForwardSetState(SCE_PL_DEFAULT); - } else { - // abandon prototype, restart from '(' - sc.ChangeState(SCE_PL_OPERATOR); - sc.SetState(SCE_PL_DEFAULT); - } - } - break; - case SCE_PL_FORMAT: { - sc.Complete(); - if (sc.Match('.')) { - sc.Forward(); - if (sc.atLineEnd || ((sc.ch == '\r' && sc.chNext == '\n'))) - sc.SetState(SCE_PL_DEFAULT); - } - while (!sc.atLineEnd) - sc.Forward(); - } - break; - case SCE_PL_ERROR: - break; - } - // Needed for specific continuation styles (one follows the other) - switch (sc.state) { - // continued from SCE_PL_WORD - case SCE_PL_FORMAT_IDENT: - // occupies HereDoc state 3 to avoid clashing with HERE docs - if (IsASpaceOrTab(sc.ch)) { // skip whitespace - sc.ChangeState(SCE_PL_DEFAULT); - while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd) - sc.Forward(); - sc.SetState(SCE_PL_FORMAT_IDENT); - } - if (setFormatStart.Contains(sc.ch)) { // identifier or '=' - if (sc.ch != '=') { - do { - sc.Forward(); - } while (setFormat.Contains(sc.ch)); - } - while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd) - sc.Forward(); - if (sc.ch == '=') { - sc.ForwardSetState(SCE_PL_DEFAULT); - HereDoc.State = 3; - } else { - // invalid identifier; inexact fallback, but hey - sc.ChangeState(SCE_PL_IDENTIFIER); - sc.SetState(SCE_PL_DEFAULT); - } - } else { - sc.ChangeState(SCE_PL_DEFAULT); // invalid identifier - } - backFlag = BACK_NONE; - break; - } - - // Must check end of HereDoc states here before default state is handled - if (HereDoc.State == 1 && sc.atLineEnd) { - // 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 - int st_new = SCE_PL_HERE_QQ; - HereDoc.State = 2; - if (HereDoc.Quoted) { - if (sc.state == SCE_PL_HERE_DELIM) { - // Missing quote at end of string! We are stricter than perl. - // Colour here-doc anyway while marking this bit as an error. - sc.ChangeState(SCE_PL_ERROR); - } - switch (HereDoc.Quote) { - case '\'': - st_new = SCE_PL_HERE_Q; - break; - case '"' : - st_new = SCE_PL_HERE_QQ; - break; - case '`' : - st_new = SCE_PL_HERE_QX; - break; - } - } else { - if (HereDoc.Quote == '\\') - st_new = SCE_PL_HERE_Q; - } - sc.SetState(st_new); - } - if (HereDoc.State == 3 && sc.atLineEnd) { - // Start of format body. - HereDoc.State = 0; - sc.SetState(SCE_PL_FORMAT); - } - - // Determine if a new state should be entered. - if (sc.state == SCE_PL_DEFAULT) { - if (IsADigit(sc.ch) || - (IsADigit(sc.chNext) && (sc.ch == '.' || sc.ch == 'v'))) { - sc.SetState(SCE_PL_NUMBER); - backFlag = BACK_NONE; - numState = PERLNUM_DECIMAL; - dotCount = 0; - if (sc.ch == '0') { // hex,bin,octal - if (sc.chNext == 'x' || sc.chNext == 'X') { - numState = PERLNUM_HEX; - } else if (sc.chNext == 'b' || sc.chNext == 'B') { - numState = PERLNUM_BINARY; - } else if (IsADigit(sc.chNext)) { - numState = PERLNUM_OCTAL; - } - if (numState != PERLNUM_DECIMAL) { - sc.Forward(); - } - } else if (sc.ch == 'v') { // vector - numState = PERLNUM_V_VECTOR; - } - } else if (setWord.Contains(sc.ch)) { - // if immediately prefixed by '::', always a bareword - sc.SetState(SCE_PL_WORD); - if (sc.chPrev == ':' && sc.GetRelative(-2) == ':') { - sc.ChangeState(SCE_PL_IDENTIFIER); - } - Sci_PositionU bk = sc.currentPos; - Sci_PositionU fw = sc.currentPos + 1; - // first check for possible quote-like delimiter - if (sc.ch == 's' && !setWord.Contains(sc.chNext)) { - sc.ChangeState(SCE_PL_REGSUBST); - Quote.New(2); - } else if (sc.ch == 'm' && !setWord.Contains(sc.chNext)) { - sc.ChangeState(SCE_PL_REGEX); - Quote.New(); - } else if (sc.ch == 'q' && !setWord.Contains(sc.chNext)) { - sc.ChangeState(SCE_PL_STRING_Q); - Quote.New(); - } else if (sc.ch == 'y' && !setWord.Contains(sc.chNext)) { - sc.ChangeState(SCE_PL_XLAT); - Quote.New(2); - } else if (sc.Match('t', 'r') && !setWord.Contains(sc.GetRelative(2))) { - sc.ChangeState(SCE_PL_XLAT); - Quote.New(2); - sc.Forward(); - fw++; - } else if (sc.ch == 'q' && setQDelim.Contains(sc.chNext) - && !setWord.Contains(sc.GetRelative(2))) { - if (sc.chNext == 'q') sc.ChangeState(SCE_PL_STRING_QQ); - else if (sc.chNext == 'x') sc.ChangeState(SCE_PL_STRING_QX); - else if (sc.chNext == 'r') sc.ChangeState(SCE_PL_STRING_QR); - else sc.ChangeState(SCE_PL_STRING_QW); // sc.chNext == 'w' - Quote.New(); - sc.Forward(); - fw++; - } else if (sc.ch == 'x' && (sc.chNext == '=' || // repetition - !setWord.Contains(sc.chNext) || - (setRepetition.Contains(sc.chPrev) && IsADigit(sc.chNext)))) { - sc.ChangeState(SCE_PL_OPERATOR); - } - // if potentially a keyword, scan forward and grab word, then check - // if it's really one; if yes, disambiguation test is performed - // otherwise it is always a bareword and we skip a lot of scanning - if (sc.state == SCE_PL_WORD) { - while (setWord.Contains(static_cast<unsigned char>(styler.SafeGetCharAt(fw)))) - fw++; - if (!isPerlKeyword(styler.GetStartSegment(), fw, keywords, styler)) { - sc.ChangeState(SCE_PL_IDENTIFIER); - } - } - // if already SCE_PL_IDENTIFIER, then no ambiguity, skip this - // for quote-like delimiters/keywords, attempt to disambiguate - // to select for bareword, change state -> SCE_PL_IDENTIFIER - if (sc.state != SCE_PL_IDENTIFIER && bk > 0) { - if (disambiguateBareword(styler, bk, fw, backFlag, backPos, endPos)) - sc.ChangeState(SCE_PL_IDENTIFIER); - } - backFlag = BACK_NONE; - } else if (sc.ch == '#') { - sc.SetState(SCE_PL_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_PL_STRING); - Quote.New(); - Quote.Open(sc.ch); - backFlag = BACK_NONE; - } else if (sc.ch == '\'') { - if (sc.chPrev == '&' && setWordStart.Contains(sc.chNext)) { - // Archaic call - sc.SetState(SCE_PL_IDENTIFIER); - } else { - sc.SetState(SCE_PL_CHARACTER); - Quote.New(); - Quote.Open(sc.ch); - } - backFlag = BACK_NONE; - } else if (sc.ch == '`') { - sc.SetState(SCE_PL_BACKTICKS); - Quote.New(); - Quote.Open(sc.ch); - backFlag = BACK_NONE; - } else if (sc.ch == '$') { - sc.SetState(SCE_PL_SCALAR); - if (sc.chNext == '{') { - sc.ForwardSetState(SCE_PL_OPERATOR); - } else if (IsASpace(sc.chNext)) { - sc.ForwardSetState(SCE_PL_DEFAULT); - } else { - sc.Forward(); - if (sc.Match('`', '`') || sc.Match(':', ':')) { - sc.Forward(); - } - } - backFlag = BACK_NONE; - } else if (sc.ch == '@') { - sc.SetState(SCE_PL_ARRAY); - if (setArray.Contains(sc.chNext)) { - // no special treatment - } else if (sc.chNext == ':' && sc.GetRelative(2) == ':') { - sc.ForwardBytes(2); - } else if (sc.chNext == '{' || sc.chNext == '[') { - sc.ForwardSetState(SCE_PL_OPERATOR); - } else { - sc.ChangeState(SCE_PL_OPERATOR); - } - backFlag = BACK_NONE; - } else if (setPreferRE.Contains(sc.ch)) { - // Explicit backward peeking to set a consistent preferRE for - // any slash found, so no longer need to track preferRE state. - // Find first previous significant lexed element and interpret. - // A few symbols shares this code for disambiguation. - bool preferRE = false; - bool isHereDoc = sc.Match('<', '<'); - bool hereDocSpace = false; // for: SCALAR [whitespace] '<<' - Sci_PositionU bk = (sc.currentPos > 0) ? sc.currentPos - 1: 0; - sc.Complete(); - styler.Flush(); - if (styler.StyleAt(bk) == SCE_PL_DEFAULT) - hereDocSpace = true; - skipWhitespaceComment(styler, bk); - if (bk == 0) { - // avoid backward scanning breakage - preferRE = true; - } else { - int bkstyle = styler.StyleAt(bk); - int bkch = static_cast<unsigned char>(styler.SafeGetCharAt(bk)); - switch (bkstyle) { - case SCE_PL_OPERATOR: - preferRE = true; - if (bkch == ')' || bkch == ']') { - preferRE = false; - } else if (bkch == '}') { - // backtrack by counting balanced brace pairs - // needed to test for variables like ${}, @{} etc. - bkstyle = styleBeforeBracePair(styler, bk); - if (bkstyle == SCE_PL_SCALAR - || bkstyle == SCE_PL_ARRAY - || bkstyle == SCE_PL_HASH - || bkstyle == SCE_PL_SYMBOLTABLE - || bkstyle == SCE_PL_OPERATOR) { - preferRE = false; - } - } else if (bkch == '+' || bkch == '-') { - if (bkch == static_cast<unsigned char>(styler.SafeGetCharAt(bk - 1)) - && bkch != static_cast<unsigned char>(styler.SafeGetCharAt(bk - 2))) - // exceptions for operators: unary suffixes ++, -- - preferRE = false; - } - break; - case SCE_PL_IDENTIFIER: - preferRE = true; - bkstyle = styleCheckIdentifier(styler, bk); - if ((bkstyle == 1) || (bkstyle == 2)) { - // inputsymbol or var with "->" or "::" before identifier - preferRE = false; - } else if (bkstyle == 3) { - // bare identifier, test cases follows: - if (sc.ch == '/') { - // if '/', /PATTERN/ unless digit/space immediately after '/' - // if '//', always expect defined-or operator to follow identifier - if (IsASpace(sc.chNext) || IsADigit(sc.chNext) || sc.chNext == '/') - preferRE = false; - } else if (sc.ch == '*' || sc.ch == '%') { - if (IsASpace(sc.chNext) || IsADigit(sc.chNext) || sc.Match('*', '*')) - preferRE = false; - } else if (sc.ch == '<') { - if (IsASpace(sc.chNext) || sc.chNext == '=') - preferRE = false; - } - } - break; - case SCE_PL_SCALAR: // for $var<< case: - if (isHereDoc && hereDocSpace) // if SCALAR whitespace '<<', *always* a HERE doc - preferRE = true; - break; - case SCE_PL_WORD: - preferRE = true; - // for HERE docs, always true - if (sc.ch == '/') { - // adopt heuristics similar to vim-style rules: - // keywords always forced as /PATTERN/: split, if, elsif, while - // everything else /PATTERN/ unless digit/space immediately after '/' - // for '//', defined-or favoured unless special keywords - Sci_PositionU bkend = bk + 1; - while (bk > 0 && styler.StyleAt(bk - 1) == SCE_PL_WORD) { - bk--; - } - if (isPerlKeyword(bk, bkend, reWords, styler)) - break; - if (IsASpace(sc.chNext) || IsADigit(sc.chNext) || sc.chNext == '/') - preferRE = false; - } else if (sc.ch == '*' || sc.ch == '%') { - if (IsASpace(sc.chNext) || IsADigit(sc.chNext) || sc.Match('*', '*')) - preferRE = false; - } else if (sc.ch == '<') { - if (IsASpace(sc.chNext) || sc.chNext == '=') - preferRE = false; - } - break; - - // other styles uses the default, preferRE=false - case SCE_PL_POD: - case SCE_PL_HERE_Q: - case SCE_PL_HERE_QQ: - case SCE_PL_HERE_QX: - preferRE = true; - break; - } - } - backFlag = BACK_NONE; - if (isHereDoc) { // handle '<<', HERE doc - if (sc.Match("<<>>")) { // double-diamond operator (5.22) - sc.SetState(SCE_PL_OPERATOR); - sc.Forward(3); - } else if (preferRE) { - sc.SetState(SCE_PL_HERE_DELIM); - HereDoc.State = 0; - } else { // << operator - sc.SetState(SCE_PL_OPERATOR); - sc.Forward(); - } - } else if (sc.ch == '*') { // handle '*', typeglob - if (preferRE) { - sc.SetState(SCE_PL_SYMBOLTABLE); - if (sc.chNext == ':' && sc.GetRelative(2) == ':') { - sc.ForwardBytes(2); - } else if (sc.chNext == '{') { - sc.ForwardSetState(SCE_PL_OPERATOR); - } else { - sc.Forward(); - } - } else { - sc.SetState(SCE_PL_OPERATOR); - if (sc.chNext == '*') // exponentiation - sc.Forward(); - } - } else if (sc.ch == '%') { // handle '%', hash - if (preferRE) { - sc.SetState(SCE_PL_HASH); - if (setHash.Contains(sc.chNext)) { - sc.Forward(); - } else if (sc.chNext == ':' && sc.GetRelative(2) == ':') { - sc.ForwardBytes(2); - } else if (sc.chNext == '{') { - sc.ForwardSetState(SCE_PL_OPERATOR); - } else { - sc.ChangeState(SCE_PL_OPERATOR); - } - } else { - sc.SetState(SCE_PL_OPERATOR); - } - } else if (sc.ch == '<') { // handle '<', inputsymbol - if (preferRE) { - // forward scan - int i = InputSymbolScan(sc); - if (i > 0) { - sc.SetState(SCE_PL_IDENTIFIER); - sc.Forward(i); - } else { - sc.SetState(SCE_PL_OPERATOR); - } - } else { - sc.SetState(SCE_PL_OPERATOR); - } - } else { // handle '/', regexp - if (preferRE) { - sc.SetState(SCE_PL_REGEX); - Quote.New(); - Quote.Open(sc.ch); - } else { // / and // operators - sc.SetState(SCE_PL_OPERATOR); - if (sc.chNext == '/') { - sc.Forward(); - } - } - } - } else if (sc.ch == '=' // POD - && setPOD.Contains(sc.chNext) - && sc.atLineStart) { - sc.SetState(SCE_PL_POD); - backFlag = BACK_NONE; - } else if (sc.ch == '-' && setWordStart.Contains(sc.chNext)) { // extended '-' cases - Sci_PositionU bk = sc.currentPos; - Sci_PositionU fw = 2; - if (setSingleCharOp.Contains(sc.chNext) && // file test operators - !setWord.Contains(sc.GetRelative(2))) { - sc.SetState(SCE_PL_WORD); - } else { - // nominally a minus and bareword; find extent of bareword - while (setWord.Contains(sc.GetRelative(fw))) - fw++; - sc.SetState(SCE_PL_OPERATOR); - } - // force to bareword for hash key => or {variable literal} cases - if (disambiguateBareword(styler, bk, bk + fw, backFlag, backPos, endPos) & 2) { - sc.ChangeState(SCE_PL_IDENTIFIER); - } - backFlag = BACK_NONE; - } else if (sc.ch == '(' && sc.currentPos > 0) { // '(' or subroutine prototype - sc.Complete(); - if (styleCheckSubPrototype(styler, sc.currentPos - 1)) { - sc.SetState(SCE_PL_SUB_PROTOTYPE); - backFlag = BACK_NONE; - } else { - sc.SetState(SCE_PL_OPERATOR); - } - } else if (setPerlOperator.Contains(sc.ch)) { // operators - sc.SetState(SCE_PL_OPERATOR); - if (sc.Match('.', '.')) { // .. and ... - sc.Forward(); - if (sc.chNext == '.') sc.Forward(); - } - } else if (sc.ch == 4 || sc.ch == 26) { // ^D and ^Z ends valid perl source - sc.SetState(SCE_PL_DATASECTION); - } else { - // keep colouring defaults - sc.Complete(); - } - } - } - sc.Complete(); - if (sc.state == SCE_PL_HERE_Q - || sc.state == SCE_PL_HERE_QQ - || sc.state == SCE_PL_HERE_QX - || sc.state == SCE_PL_FORMAT) { - styler.ChangeLexerState(sc.currentPos, styler.Length()); - } - sc.Complete(); -} - -#define PERL_HEADFOLD_SHIFT 4 -#define PERL_HEADFOLD_MASK 0xF0 - -void SCI_METHOD LexerPerl::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); - - // 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]; - char chPrev = styler.SafeGetCharAt(startPos - 1); - int styleNext = styler.StyleAt(startPos); - // Used at end of line to determine if the line was a package definition - bool isPackageLine = false; - int podHeading = 0; - for (Sci_PositionU i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int style = styleNext; - styleNext = styler.StyleAt(i + 1); - int stylePrevCh = (i) ? styler.StyleAt(i - 1):SCE_PL_DEFAULT; - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - bool atLineStart = ((chPrev == '\r') || (chPrev == '\n')) || i == 0; - // 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--; - } - // {} [] block folding - if (style == SCE_PL_OPERATOR) { - if (ch == '{') { - if (options.foldAtElse && levelCurrent < levelPrev) - --levelPrev; - levelCurrent++; - } else if (ch == '}') { - levelCurrent--; - } - if (ch == '[') { - if (options.foldAtElse && levelCurrent < levelPrev) - --levelPrev; - levelCurrent++; - } else if (ch == ']') { - levelCurrent--; - } - } else if (style == SCE_PL_STRING_QW) { - // qw - if (stylePrevCh != style) - levelCurrent++; - else if (styleNext != style) - levelCurrent--; - } - // POD folding - if (options.foldPOD && atLineStart) { - if (style == SCE_PL_POD) { - if (stylePrevCh != SCE_PL_POD && stylePrevCh != SCE_PL_POD_VERB) - levelCurrent++; - else if (styler.Match(i, "=cut")) - levelCurrent = (levelCurrent & ~PERL_HEADFOLD_MASK) - 1; - else if (styler.Match(i, "=head")) - podHeading = PodHeadingLevel(i, styler); - } else if (style == SCE_PL_DATASECTION) { - if (ch == '=' && IsASCII(chNext) && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE) - levelCurrent++; - else if (styler.Match(i, "=cut") && levelCurrent > SC_FOLDLEVELBASE) - levelCurrent = (levelCurrent & ~PERL_HEADFOLD_MASK) - 1; - else if (styler.Match(i, "=head")) - podHeading = PodHeadingLevel(i, styler); - // if package used or unclosed brace, level > SC_FOLDLEVELBASE! - // reset needed as level test is vs. SC_FOLDLEVELBASE - else if (stylePrevCh != SCE_PL_DATASECTION) - levelCurrent = SC_FOLDLEVELBASE; - } - } - // package folding - if (options.foldPackage && atLineStart) { - if (IsPackageLine(lineCurrent, styler) - && !IsPackageLine(lineCurrent + 1, styler)) - isPackageLine = true; - } - - //heredoc folding - switch (style) { - case SCE_PL_HERE_QQ : - case SCE_PL_HERE_Q : - case SCE_PL_HERE_QX : - switch (stylePrevCh) { - case SCE_PL_HERE_QQ : - case SCE_PL_HERE_Q : - case SCE_PL_HERE_QX : - //do nothing; - break; - default : - levelCurrent++; - break; - } - break; - default: - switch (stylePrevCh) { - case SCE_PL_HERE_QQ : - case SCE_PL_HERE_Q : - case SCE_PL_HERE_QX : - levelCurrent--; - break; - default : - //do nothing; - break; - } - break; - } - - //explicit folding - if (options.foldCommentExplicit && style == SCE_PL_COMMENTLINE && ch == '#') { - if (chNext == '{') { - levelCurrent++; - } else if (levelCurrent > SC_FOLDLEVELBASE && chNext == '}') { - levelCurrent--; - } - } - - if (atEOL) { - int lev = levelPrev; - // POD headings occupy bits 7-4, leaving some breathing room for - // non-standard practice -- POD sections stuck in blocks, etc. - if (podHeading > 0) { - levelCurrent = (lev & ~PERL_HEADFOLD_MASK) | (podHeading << PERL_HEADFOLD_SHIFT); - lev = levelCurrent - 1; - lev |= SC_FOLDLEVELHEADERFLAG; - podHeading = 0; - } - // Check if line was a package declaration - // because packages need "special" treatment - if (isPackageLine) { - lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; - levelCurrent = SC_FOLDLEVELBASE + 1; - isPackageLine = false; - } - 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++; - chPrev = ch; - } - // 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 lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc); diff --git a/lexers/LexPowerPro.cxx b/lexers/LexPowerPro.cxx deleted file mode 100644 index 34debff24..000000000 --- a/lexers/LexPowerPro.cxx +++ /dev/null @@ -1,628 +0,0 @@ -// Scintilla source code edit control -// @file LexPowerPro.cxx -// PowerPro utility, written by Bruce Switzer, is available from http://powerpro.webeddie.com -// PowerPro lexer is written by Christopher Bean (cbean@cb-software.net) -// -// Lexer code heavily borrowed from: -// LexAU3.cxx by Jos van der Zande -// LexCPP.cxx by Neil Hodgson -// LexVB.cxx by Neil Hodgson -// -// Changes: -// 2008-10-25 - Initial release -// 2008-10-26 - Changed how <name> is hilighted in 'function <name>' so that -// local isFunction = "" and local functions = "" don't get falsely highlighted -// 2008-12-14 - Added bounds checking for szFirstWord and szDo -// - Replaced SetOfCharacters with CharacterSet -// - Made sure that CharacterSet::Contains is passed only positive values -// - Made sure that the return value of Accessor::SafeGetCharAt is positive before -// passing to functions that require positive values like isspacechar() -// - Removed unused visibleChars processing from ColourisePowerProDoc() -// - Fixed bug with folding logic where line continuations didn't end where -// they were supposed to -// - Moved all helper functions to the top of the file -// 2010-06-03 - Added onlySpaces variable to allow the @function and ;comment styles to be indented -// - Modified HasFunction function to be a bit more robust -// - Renamed HasFunction function to IsFunction -// - Cleanup -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <string.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool IsStreamCommentStyle(int style) { - return style == SCE_POWERPRO_COMMENTBLOCK; -} - -static inline bool IsLineEndChar(unsigned char ch) { - return ch == 0x0a //LF - || ch == 0x0c //FF - || ch == 0x0d; //CR -} - -static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler) -{ - Sci_Position startPos = styler.LineStart(szLine); - Sci_Position endPos = styler.LineStart(szLine + 1) - 2; - while (startPos < endPos) - { - char stylech = styler.StyleAt(startPos); - if (!(stylech == SCE_POWERPRO_COMMENTBLOCK)) { - char ch = styler.SafeGetCharAt(endPos); - char chPrev = styler.SafeGetCharAt(endPos - 1); - char chPrevPrev = styler.SafeGetCharAt(endPos - 2); - if (ch > 0 && chPrev > 0 && chPrevPrev > 0 && !isspacechar(ch) && !isspacechar(chPrev) && !isspacechar(chPrevPrev) ) - return (chPrevPrev == ';' && chPrev == ';' && ch == '+'); - } - endPos--; // skip to next char - } - return false; -} - -// 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_Position szLine, Accessor &styler) -{ - Sci_Position startPos = styler.LineStart(szLine); - Sci_Position endPos = styler.LineStart(szLine + 1) - 1; - char ch = styler.SafeGetCharAt(startPos); - - while (ch > 0 && isspacechar(ch) && startPos < endPos) - { - startPos++; // skip to next char - ch = styler.SafeGetCharAt(startPos); - } - return styler.StyleAt(startPos); -} - -//returns true if there is a function to highlight -//used to highlight <name> in 'function <name>' -//note: -// sample line (without quotes): "\tfunction asdf() -// currentPos will be the position of 'a' -static bool IsFunction(Accessor &styler, Sci_PositionU currentPos) { - - const char function[10] = "function "; //10 includes \0 - unsigned int numberOfCharacters = sizeof(function) - 1; - Sci_PositionU position = currentPos - numberOfCharacters; - - //compare each character with the letters in the function array - //return false if ALL don't match - for (Sci_PositionU i = 0; i < numberOfCharacters; i++) { - char c = styler.SafeGetCharAt(position++); - if (c != function[i]) - return false; - } - - //make sure that there are only spaces (or tabs) between the beginning - //of the line and the function declaration - position = currentPos - numberOfCharacters - 1; //-1 to move to char before 'function' - for (Sci_PositionU j = 0; j < 16; j++) { //check up to 16 preceeding characters - char c = styler.SafeGetCharAt(position--, '\0'); //if can't read char, return NUL (past beginning of document) - if (c <= 0) //reached beginning of document - return true; - if (c > 0 && IsLineEndChar(c)) - return true; - else if (c > 0 && !IsASpaceOrTab(c)) - return false; - } - - //fall-through - return false; -} - -static void ColourisePowerProDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler, bool caseSensitive) { - - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - WordList &keywords4 = *keywordlists[3]; - - //define the character sets - CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true); - CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); - - StyleContext sc(startPos, length, initStyle, styler); - char s_save[100]; //for last line highlighting - - //are there only spaces between the first letter of the line and the beginning of the line - bool onlySpaces = true; - - for (; sc.More(); sc.Forward()) { - - // save the total current word for eof processing - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - - if ((sc.ch > 0) && setWord.Contains(sc.ch)) - { - strcpy(s_save,s); - int tp = static_cast<int>(strlen(s_save)); - if (tp < 99) { - s_save[tp] = static_cast<char>(tolower(sc.ch)); - s_save[tp+1] = '\0'; - } - } - - if (sc.atLineStart) { - if (sc.state == SCE_POWERPRO_DOUBLEQUOTEDSTRING) { - // Prevent SCE_POWERPRO_STRINGEOL from leaking back to previous line which - // ends with a line continuation by locking in the state upto this position. - sc.SetState(SCE_POWERPRO_DOUBLEQUOTEDSTRING); - } - } - - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_POWERPRO_OPERATOR: - sc.SetState(SCE_POWERPRO_DEFAULT); - break; - - case SCE_POWERPRO_NUMBER: - - if (!IsADigit(sc.ch)) - sc.SetState(SCE_POWERPRO_DEFAULT); - - break; - - case SCE_POWERPRO_IDENTIFIER: - //if ((sc.ch > 0) && !setWord.Contains(sc.ch) || (sc.ch == '.')) { // use this line if don't want to match keywords with . in them. ie: win.debug will match both win and debug so win debug will also be colorized - if ((sc.ch > 0) && !setWord.Contains(sc.ch)){ // || (sc.ch == '.')) { // use this line if you want to match keywords with a . ie: win.debug will only match win.debug neither win nor debug will be colorized separately - char s[1000]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - - if (keywords.InList(s)) { - sc.ChangeState(SCE_POWERPRO_WORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_POWERPRO_WORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_POWERPRO_WORD3); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_POWERPRO_WORD4); - } - sc.SetState(SCE_POWERPRO_DEFAULT); - } - break; - - case SCE_POWERPRO_LINECONTINUE: - if (sc.atLineStart) { - sc.SetState(SCE_POWERPRO_DEFAULT); - } else if (sc.Match('/', '*') || sc.Match('/', '/')) { - sc.SetState(SCE_POWERPRO_DEFAULT); - } - break; - - case SCE_POWERPRO_COMMENTBLOCK: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_POWERPRO_DEFAULT); - } - break; - - case SCE_POWERPRO_COMMENTLINE: - if (sc.atLineStart) { - sc.SetState(SCE_POWERPRO_DEFAULT); - } - break; - - case SCE_POWERPRO_DOUBLEQUOTEDSTRING: - if (sc.atLineEnd) { - sc.ChangeState(SCE_POWERPRO_STRINGEOL); - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_POWERPRO_DEFAULT); - } - break; - - case SCE_POWERPRO_SINGLEQUOTEDSTRING: - if (sc.atLineEnd) { - sc.ChangeState(SCE_POWERPRO_STRINGEOL); - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_POWERPRO_DEFAULT); - } - break; - - case SCE_POWERPRO_STRINGEOL: - if (sc.atLineStart) { - sc.SetState(SCE_POWERPRO_DEFAULT); - } - break; - - case SCE_POWERPRO_VERBATIM: - if (sc.ch == '\"') { - if (sc.chNext == '\"') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_POWERPRO_DEFAULT); - } - } - break; - - case SCE_POWERPRO_ALTQUOTE: - if (sc.ch == '#') { - if (sc.chNext == '#') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_POWERPRO_DEFAULT); - } - } - break; - - case SCE_POWERPRO_FUNCTION: - if (isspacechar(sc.ch) || sc.ch == '(') { - sc.SetState(SCE_POWERPRO_DEFAULT); - } - break; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_POWERPRO_DEFAULT) { - if (sc.Match('?', '\"')) { - sc.SetState(SCE_POWERPRO_VERBATIM); - sc.Forward(); - } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_POWERPRO_NUMBER); - }else if (sc.Match('?','#')) { - if (sc.ch == '?' && sc.chNext == '#') { - sc.SetState(SCE_POWERPRO_ALTQUOTE); - sc.Forward(); - } - } else if (IsFunction(styler, sc.currentPos)) { //highlight <name> in 'function <name>' - sc.SetState(SCE_POWERPRO_FUNCTION); - } else if (onlySpaces && sc.ch == '@') { //alternate function definition [label] - sc.SetState(SCE_POWERPRO_FUNCTION); - } else if ((sc.ch > 0) && (setWordStart.Contains(sc.ch) || (sc.ch == '?'))) { - sc.SetState(SCE_POWERPRO_IDENTIFIER); - } else if (sc.Match(";;+")) { - sc.SetState(SCE_POWERPRO_LINECONTINUE); - } else if (sc.Match('/', '*')) { - sc.SetState(SCE_POWERPRO_COMMENTBLOCK); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('/', '/')) { - sc.SetState(SCE_POWERPRO_COMMENTLINE); - } else if (onlySpaces && sc.ch == ';') { //legacy comment that can only have blank space in front of it - sc.SetState(SCE_POWERPRO_COMMENTLINE); - } else if (sc.Match(";;")) { - sc.SetState(SCE_POWERPRO_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_POWERPRO_DOUBLEQUOTEDSTRING); - } else if (sc.ch == '\'') { - sc.SetState(SCE_POWERPRO_SINGLEQUOTEDSTRING); - } else if (isoperator(static_cast<char>(sc.ch))) { - sc.SetState(SCE_POWERPRO_OPERATOR); - } - } - - //maintain a record of whether or not all the preceding characters on - //a line are space characters - if (onlySpaces && !IsASpaceOrTab(sc.ch)) - onlySpaces = false; - - //reset when starting a new line - if (sc.atLineEnd) - onlySpaces = true; - } - - //************************************* - // Colourize the last word correctly - //************************************* - if (sc.state == SCE_POWERPRO_IDENTIFIER) - { - if (keywords.InList(s_save)) { - sc.ChangeState(SCE_POWERPRO_WORD); - sc.SetState(SCE_POWERPRO_DEFAULT); - } - else if (keywords2.InList(s_save)) { - sc.ChangeState(SCE_POWERPRO_WORD2); - sc.SetState(SCE_POWERPRO_DEFAULT); - } - else if (keywords3.InList(s_save)) { - sc.ChangeState(SCE_POWERPRO_WORD3); - sc.SetState(SCE_POWERPRO_DEFAULT); - } - else if (keywords4.InList(s_save)) { - sc.ChangeState(SCE_POWERPRO_WORD4); - sc.SetState(SCE_POWERPRO_DEFAULT); - } - else { - sc.SetState(SCE_POWERPRO_DEFAULT); - } - } - sc.Complete(); -} - -static void FoldPowerProDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) -{ - //define the character sets - CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true); - CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); - - //used to tell if we're recursively folding the whole document, or just a small piece (ie: if statement or 1 function) - bool isFoldingAll = true; - - Sci_Position endPos = startPos + length; - Sci_Position lastLine = styler.GetLine(styler.Length()); //used to help fold the last line correctly - - // 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 = true; - - // Backtrack to previous line in case need to fix its fold status - Sci_Position lineCurrent = styler.GetLine(startPos); - if (startPos > 0) { - isFoldingAll = false; - 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 isFirstWordStarted = false; - bool isFirstWordEnded = false; - - const unsigned int FIRST_WORD_MAX_LEN = 10; - char szFirstWord[FIRST_WORD_MAX_LEN] = ""; - unsigned int firstWordLen = 0; - - char szDo[3]=""; - int szDolen = 0; - bool isDoLastWord = false; - - // var for indentlevel - int levelCurrent = SC_FOLDLEVELBASE; - if (lineCurrent > 0) - levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; - int levelNext = levelCurrent; - - int visibleChars = 0; - int functionCount = 0; - - char chNext = styler.SafeGetCharAt(startPos); - char chPrev = '\0'; - char chPrevPrev = '\0'; - char chPrevPrevPrev = '\0'; - - for (Sci_Position i = startPos; i < endPos; i++) { - - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - - if ((ch > 0) && setWord.Contains(ch)) - visibleChars++; - - // get the syle for the current character neede to check in comment - int stylech = styler.StyleAt(i); - - // start the capture of the first word - if (!isFirstWordStarted && (ch > 0)) { - if (setWord.Contains(ch) || setWordStart.Contains(ch) || ch == ';' || ch == '/') { - isFirstWordStarted = true; - if (firstWordLen < FIRST_WORD_MAX_LEN - 1) { - szFirstWord[firstWordLen++] = static_cast<char>(tolower(ch)); - szFirstWord[firstWordLen] = '\0'; - } - } - } // continue capture of the first word on the line - else if (isFirstWordStarted && !isFirstWordEnded && (ch > 0)) { - if (!setWord.Contains(ch)) { - isFirstWordEnded = true; - } - else if (firstWordLen < (FIRST_WORD_MAX_LEN - 1)) { - szFirstWord[firstWordLen++] = static_cast<char>(tolower(ch)); - szFirstWord[firstWordLen] = '\0'; - } - } - - if (stylech != SCE_POWERPRO_COMMENTLINE) { - - //reset isDoLastWord if we find a character(ignoring spaces) after 'do' - if (isDoLastWord && (ch > 0) && setWord.Contains(ch)) - isDoLastWord = false; - - // --find out if the word "do" is the last on a "if" line-- - // collect each letter and put it into a buffer 2 chars long - // if we end up with "do" in the buffer when we reach the end of - // the line, "do" was the last word on the line - if ((ch > 0) && isFirstWordEnded && strcmp(szFirstWord, "if") == 0) { - if (szDolen == 2) { - szDo[0] = szDo[1]; - szDo[1] = static_cast<char>(tolower(ch)); - szDo[2] = '\0'; - - if (strcmp(szDo, "do") == 0) - isDoLastWord = true; - - } else if (szDolen < 2) { - szDo[szDolen++] = static_cast<char>(tolower(ch)); - szDo[szDolen] = '\0'; - } - } - } - - // End of Line found so process the information - if ((ch == '\r' && chNext != '\n') // \r\n - || ch == '\n' // \n - || i == endPos) { // end of selection - - // ************************** - // 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 (firstWordLen > 0 - && chPrev != '+' && chPrevPrev != ';' && chPrevPrevPrev !=';' - && (!IsStreamCommentStyle(style) || foldInComment) ) { - - // only fold "if" last keyword is "then" (else its a one line if) - if (strcmp(szFirstWord, "if") == 0 && isDoLastWord) - levelNext++; - - // create new fold for these words - if (strcmp(szFirstWord, "for") == 0) - levelNext++; - - //handle folding for functions/labels - //Note: Functions and labels don't have an explicit end like [end function] - // 1. functions/labels end at the start of another function - // 2. functions/labels end at the end of the file - if ((strcmp(szFirstWord, "function") == 0) || (firstWordLen > 0 && szFirstWord[0] == '@')) { - if (isFoldingAll) { //if we're folding the whole document (recursivly by lua script) - - if (functionCount > 0) { - levelCurrent--; - } else { - levelNext++; - } - functionCount++; - - } else { //if just folding a small piece (by clicking on the minus sign next to the word) - levelCurrent--; - } - } - - // end the fold for these words before the current line - if (strcmp(szFirstWord, "endif") == 0 || strcmp(szFirstWord, "endfor") == 0) { - levelNext--; - levelCurrent--; - } - - // end the fold for these words before the current line and Start new fold - if (strcmp(szFirstWord, "else") == 0 || strcmp(szFirstWord, "elseif") == 0 ) - levelCurrent--; - - } - // Preprocessor and Comment folding - int styleNext = GetStyleFirstWord(lineCurrent + 1,styler); - - // ********************************* - // 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_POWERPRO_COMMENTLINE - && stylePrev == SCE_POWERPRO_COMMENTLINE - && style == SCE_POWERPRO_COMMENTLINE) { - levelNext--; - } // fold till the one but last line for Blockcomment lines - else if (IsStreamCommentStyle(stylePrev) - && styleNext != SCE_POWERPRO_COMMENTBLOCK - && style == SCE_POWERPRO_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 characters are ;;+ then don't reset since the line continues on the next line. - if (chPrev != '+' && chPrevPrev != ';' && chPrevPrevPrev != ';') { - firstWordLen = 0; - szDolen = 0; - isFirstWordStarted = false; - isFirstWordEnded = false; - isDoLastWord = false; - - //blank out first word - for (unsigned int i = 0; i < FIRST_WORD_MAX_LEN; i++) - szFirstWord[i] = '\0'; - } - } - - // save the last processed characters - if ((ch > 0) && !isspacechar(ch)) { - chPrevPrevPrev = chPrevPrev; - chPrevPrev = chPrev; - chPrev = ch; - } - } - - //close folds on the last line - without this a 'phantom' - //fold can appear when an open fold is on the last line - //this can occur because functions and labels don't have an explicit end - if (lineCurrent >= lastLine) { - int lev = 0; - lev |= SC_FOLDLEVELWHITEFLAG; - styler.SetLevel(lineCurrent, lev); - } - -} - -static const char * const powerProWordLists[] = { - "Keyword list 1", - "Keyword list 2", - "Keyword list 3", - "Keyword list 4", - 0, - }; - -static void ColourisePowerProDocWrapper(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - ColourisePowerProDoc(startPos, length, initStyle, keywordlists, styler, false); -} - -LexerModule lmPowerPro(SCLEX_POWERPRO, ColourisePowerProDocWrapper, "powerpro", FoldPowerProDoc, powerProWordLists); - - diff --git a/lexers/LexPowerShell.cxx b/lexers/LexPowerShell.cxx deleted file mode 100644 index 9969df35d..000000000 --- a/lexers/LexPowerShell.cxx +++ /dev/null @@ -1,252 +0,0 @@ -// Scintilla source code edit control -/** @file LexPowerShell.cxx - ** Lexer for PowerShell scripts. - **/ -// Copyright 2008 by Tim Gerundt <tim@gerundt.de> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// Extended to accept accented characters -static inline bool IsAWordChar(int ch) { - return ch >= 0x80 || isalnum(ch) || ch == '-' || ch == '_'; -} - -static void ColourisePowerShellDoc(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]; - - styler.StartAt(startPos); - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - if (sc.state == SCE_POWERSHELL_COMMENT) { - if (sc.atLineEnd) { - sc.SetState(SCE_POWERSHELL_DEFAULT); - } - } else if (sc.state == SCE_POWERSHELL_COMMENTSTREAM) { - if (sc.atLineStart) { - while (IsASpaceOrTab(sc.ch)) { - sc.Forward(); - } - if (sc.ch == '.' && IsAWordChar(sc.chNext)) { - sc.SetState(SCE_POWERSHELL_COMMENTDOCKEYWORD); - } - } - if (sc.ch == '>' && sc.chPrev == '#') { - sc.ForwardSetState(SCE_POWERSHELL_DEFAULT); - } - } else if (sc.state == SCE_POWERSHELL_COMMENTDOCKEYWORD) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (!keywords6.InList(s + 1)) { - sc.ChangeState(SCE_POWERSHELL_COMMENTSTREAM); - } - sc.SetState(SCE_POWERSHELL_COMMENTSTREAM); - } - } else if (sc.state == SCE_POWERSHELL_STRING) { - // This is a doubles quotes string - if (sc.ch == '\"') { - sc.ForwardSetState(SCE_POWERSHELL_DEFAULT); - } else if (sc.ch == '`') { - sc.Forward(); // skip next escaped character - } - } else if (sc.state == SCE_POWERSHELL_CHARACTER) { - // This is a single quote string - if (sc.ch == '\'') { - sc.ForwardSetState(SCE_POWERSHELL_DEFAULT); - } else if (sc.ch == '`') { - sc.Forward(); // skip next escaped character - } - } else if (sc.state == SCE_POWERSHELL_HERE_STRING) { - // This is a doubles quotes here-string - if (sc.atLineStart && sc.ch == '\"' && sc.chNext == '@') { - sc.Forward(2); - sc.SetState(SCE_POWERSHELL_DEFAULT); - } - } else if (sc.state == SCE_POWERSHELL_HERE_CHARACTER) { - // This is a single quote here-string - if (sc.atLineStart && sc.ch == '\'' && sc.chNext == '@') { - sc.Forward(2); - sc.SetState(SCE_POWERSHELL_DEFAULT); - } - } else if (sc.state == SCE_POWERSHELL_NUMBER) { - if (!IsADigit(sc.ch)) { - sc.SetState(SCE_POWERSHELL_DEFAULT); - } - } else if (sc.state == SCE_POWERSHELL_VARIABLE) { - if (!IsAWordChar(sc.ch)) { - sc.SetState(SCE_POWERSHELL_DEFAULT); - } - } else if (sc.state == SCE_POWERSHELL_OPERATOR) { - if (!isoperator(static_cast<char>(sc.ch))) { - sc.SetState(SCE_POWERSHELL_DEFAULT); - } - } else if (sc.state == SCE_POWERSHELL_IDENTIFIER) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - - if (keywords.InList(s)) { - sc.ChangeState(SCE_POWERSHELL_KEYWORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_POWERSHELL_CMDLET); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_POWERSHELL_ALIAS); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_POWERSHELL_FUNCTION); - } else if (keywords5.InList(s)) { - sc.ChangeState(SCE_POWERSHELL_USER1); - } - sc.SetState(SCE_POWERSHELL_DEFAULT); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_POWERSHELL_DEFAULT) { - if (sc.ch == '#') { - sc.SetState(SCE_POWERSHELL_COMMENT); - } else if (sc.ch == '<' && sc.chNext == '#') { - sc.SetState(SCE_POWERSHELL_COMMENTSTREAM); - } else if (sc.ch == '\"') { - sc.SetState(SCE_POWERSHELL_STRING); - } else if (sc.ch == '\'') { - sc.SetState(SCE_POWERSHELL_CHARACTER); - } else if (sc.ch == '@' && sc.chNext == '\"') { - sc.SetState(SCE_POWERSHELL_HERE_STRING); - } else if (sc.ch == '@' && sc.chNext == '\'') { - sc.SetState(SCE_POWERSHELL_HERE_CHARACTER); - } else if (sc.ch == '$') { - sc.SetState(SCE_POWERSHELL_VARIABLE); - } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_POWERSHELL_NUMBER); - } else if (isoperator(static_cast<char>(sc.ch))) { - sc.SetState(SCE_POWERSHELL_OPERATOR); - } else if (IsAWordChar(sc.ch)) { - sc.SetState(SCE_POWERSHELL_IDENTIFIER); - } else if (sc.ch == '`') { - sc.Forward(); // skip next escaped character - } - } - } - 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 {". -static void FoldPowerShellDoc(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; - bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - 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 (style == SCE_POWERSHELL_OPERATOR) { - if (ch == '{') { - // Measure the minimum before a '{' to allow - // folding on "} else {" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (ch == '}') { - levelNext--; - } - } else if (foldComment && style == SCE_POWERSHELL_COMMENTSTREAM) { - if (stylePrev != SCE_POWERSHELL_COMMENTSTREAM && stylePrev != SCE_POWERSHELL_COMMENTDOCKEYWORD) { - levelNext++; - } else if (styleNext != SCE_POWERSHELL_COMMENTSTREAM && styleNext != SCE_POWERSHELL_COMMENTDOCKEYWORD) { - levelNext--; - } - } else if (foldComment && style == SCE_POWERSHELL_COMMENT) { - if (ch == '#') { - Sci_PositionU j = i + 1; - while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { - j++; - } - if (styler.Match(j, "region")) { - levelNext++; - } else if (styler.Match(j, "endregion")) { - levelNext--; - } - } - } - if (!IsASpace(ch)) - visibleChars++; - 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; - visibleChars = 0; - } - } -} - -static const char *const powershellWordLists[] = { - "Commands", - "Cmdlets", - "Aliases", - "Functions", - "User1", - "DocComment", - 0 -}; - -LexerModule lmPowerShell(SCLEX_POWERSHELL, ColourisePowerShellDoc, "powershell", FoldPowerShellDoc, powershellWordLists); - diff --git a/lexers/LexProgress.cxx b/lexers/LexProgress.cxx deleted file mode 100644 index 2a545b6ec..000000000 --- a/lexers/LexProgress.cxx +++ /dev/null @@ -1,568 +0,0 @@ -// Scintilla source code edit control -/** @file LexProgress.cxx - ** Lexer for Progress 4GL. - ** Based on LexCPP.cxx of Neil Hodgson <neilh@scintilla.org> - **/ -// Copyright 2006-2016 by Yuval Papish <Yuval@YuvCom.com> -// The License.txt file describes the conditions under which this software may be distributed. - -/** TODO: - -SpeedScript support in html lexer -Differentiate between labels and variables - Option 1: By symbols table - Option 2: As a single unidentified symbol in a sytactical line - -**/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <vector> -#include <map> -#include <algorithm> - -#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 "SparseState.h" -#include "DefaultLexer.h" - -using namespace Scintilla; - -namespace { - // Use an unnamed namespace to protect the functions and classes from name conflicts - - bool IsSpaceEquiv(int state) { - return (state == SCE_ABL_COMMENT || - state == SCE_ABL_LINECOMMENT || - state == SCE_ABL_DEFAULT); - } - - void highlightTaskMarker(StyleContext &sc, LexAccessor &styler, WordList &markerList){ - if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) { - const int lengthMarker = 50; - char marker[lengthMarker+1]; - Sci_Position currPos = (Sci_Position) sc.currentPos; - Sci_Position i = 0; - while (i < lengthMarker) { - char ch = styler.SafeGetCharAt(currPos + i); - if (IsASpace(ch) || isoperator(ch)) { - break; - } - marker[i] = ch; - i++; - } - marker[i] = '\0'; - if (markerList.InListAbbreviated (marker,'(')) { - sc.SetState(SCE_ABL_TASKMARKER); - } - } - } - - bool IsStreamCommentStyle(int style) { - return style == SCE_ABL_COMMENT; - // style == SCE_ABL_LINECOMMENT; Only block comments are used for folding - } - - // Options used for LexerABL - struct OptionsABL { - bool fold; - bool foldSyntaxBased; - bool foldComment; - bool foldCommentMultiline; - bool foldCompact; - OptionsABL() { - fold = false; - foldSyntaxBased = true; - foldComment = true; - foldCommentMultiline = true; - foldCompact = false; - } - }; - - const char *const ablWordLists[] = { - "Primary keywords and identifiers", - "Keywords that opens a block, only when used to begin a syntactic line", - "Keywords that opens a block anywhere in a syntactic line", - "Task Marker", /* "END MODIFY START TODO" */ - 0, - }; - - struct OptionSetABL : public OptionSet<OptionsABL> { - OptionSetABL() { - DefineProperty("fold", &OptionsABL::fold); - - DefineProperty("fold.abl.syntax.based", &OptionsABL::foldSyntaxBased, - "Set this property to 0 to disable syntax based folding."); - - DefineProperty("fold.comment", &OptionsABL::foldComment, - "This option enables folding multi-line comments and explicit fold points when using the ABL lexer. "); - - DefineProperty("fold.abl.comment.multiline", &OptionsABL::foldCommentMultiline, - "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); - - DefineProperty("fold.compact", &OptionsABL::foldCompact); - - DefineWordListSets(ablWordLists); - } - }; -} - -class LexerABL : public DefaultLexer { - CharacterSet setWord; - CharacterSet setNegationOp; - CharacterSet setArithmethicOp; - CharacterSet setRelOp; - CharacterSet setLogicalOp; - CharacterSet setWordStart; - WordList keywords1; // regular keywords - WordList keywords2; // block opening keywords, only when isSentenceStart - WordList keywords3; // block opening keywords - WordList keywords4; // Task Marker - OptionsABL options; - OptionSetABL osABL; -public: - LexerABL() : - DefaultLexer("abl", SCLEX_PROGRESS), - setWord(CharacterSet::setAlphaNum, "_", 0x80, true), - setNegationOp(CharacterSet::setNone, "!"), - setArithmethicOp(CharacterSet::setNone, "+-/*%"), - setRelOp(CharacterSet::setNone, "=!<>"), - setLogicalOp(CharacterSet::setNone, "|&"){ - } - virtual ~LexerABL() { - } - void SCI_METHOD Release() override { - delete this; - } - int SCI_METHOD Version() const override { - return lvRelease5; - } - const char * SCI_METHOD PropertyNames() override { - return osABL.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) override { - return osABL.PropertyType(name); - } - const char * SCI_METHOD DescribeProperty(const char *name) override { - return osABL.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override ; - const char * SCI_METHOD PropertyGet(const char *key) override { - return osABL.PropertyGet(key); - } - - const char * SCI_METHOD DescribeWordListSets() override { - return osABL.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_DEFAULT; - } - static ILexer5 *LexerFactoryABL() { - return new LexerABL(); - } -}; - -Sci_Position SCI_METHOD LexerABL::PropertySet(const char *key, const char *val) { - if (osABL.PropertySet(&options, key, val)) { - return 0; - } - return -1; -} - -Sci_Position SCI_METHOD LexerABL::WordListSet(int n, const char *wl) { - WordList *wordListN = 0; - switch (n) { - case 0: - wordListN = &keywords1; - break; - case 1: - wordListN = &keywords2; - break; - case 2: - wordListN = &keywords3; - break; - case 3: - wordListN = &keywords4; - 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 LexerABL::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - LexAccessor styler(pAccess); - - setWordStart = CharacterSet(CharacterSet::setAlpha, "_", 0x80, true); - - int visibleChars = 0; - int visibleChars1 = 0; - int styleBeforeTaskMarker = SCE_ABL_DEFAULT; - bool continuationLine = false; - int commentNestingLevel = 0; - bool isSentenceStart = true; - bool possibleOOLChange = false; - - Sci_Position lineCurrent = styler.GetLine(startPos); - if (initStyle == SCE_ABL_PREPROCESSOR) { - // Set continuationLine if last character of previous line is '~' - if (lineCurrent > 0) { - Sci_Position endLinePrevious = styler.LineEnd(lineCurrent-1); - if (endLinePrevious > 0) { - continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '~'; - } - } - } - - // Look back to set variables that are actually invisible secondary states. The reason to avoid formal states is to cut down on state's bits - if (startPos > 0) { - Sci_Position back = startPos; - bool checkCommentNestingLevel = (initStyle == SCE_ABL_COMMENT); - bool checkIsSentenceStart = (initStyle == SCE_ABL_DEFAULT || initStyle == SCE_ABL_IDENTIFIER); - char ch; - char st; - char chPrev; - char chPrev_1; - char chPrev_2; - char chPrev_3; - - while (back >= 0 && (checkCommentNestingLevel || checkIsSentenceStart)) { - ch = styler.SafeGetCharAt(back); - styler.Flush(); // looking at styles so need to flush - st = styler.StyleAt(back); - - chPrev = styler.SafeGetCharAt(back-1); - // isSentenceStart is a non-visible state, used to identify where statements and preprocessor declerations can start - if (checkIsSentenceStart && st != SCE_ABL_COMMENT && st != SCE_ABL_LINECOMMENT && st != SCE_ABL_CHARACTER && st != SCE_ABL_STRING ) { - chPrev_1 = styler.SafeGetCharAt(back-2); - chPrev_2 = styler.SafeGetCharAt(back-3); - chPrev_3 = styler.SafeGetCharAt(back-4); - if ((chPrev == '.' || chPrev == ':' || chPrev == '}' || - (chPrev_3 == 'e' && chPrev_2 == 'l' && chPrev_1 == 's' && chPrev == 'e') || - (chPrev_3 == 't' && chPrev_2 == 'h' && chPrev_1 == 'e' && chPrev == 'n')) && - (IsASpace(ch) || (ch == '/' && styler.SafeGetCharAt(back+1) == '*')) - ) { - checkIsSentenceStart = false; - isSentenceStart = true; - } - else if (IsASpace(chPrev) && ch == '{') { - checkIsSentenceStart = false; - isSentenceStart = false; - } - } - - // commentNestingLevel is a non-visible state, used to identify the nesting level of a comment - if (checkCommentNestingLevel) { - if (chPrev == '/' && ch == '*') { - commentNestingLevel++; - // eat the '/' so we don't miscount a */ if we see /*/* - --back; - } - if (chPrev == '*' && ch == '/') { - commentNestingLevel--; - // eat the '*' so we don't miscount a /* if we see */*/ - --back; - } - } - --back; - } - } - - StyleContext sc(startPos, length, initStyle, styler, static_cast<unsigned char>(0xff)); - Sci_Position lineEndNext = styler.LineEnd(lineCurrent); - - for (; sc.More();) { - if (sc.atLineStart) { - visibleChars = 0; - visibleChars1 = 0; - } - if (sc.atLineEnd) { - lineCurrent++; - lineEndNext = styler.LineEnd(lineCurrent); - } - // Handle line continuation generically. - if (sc.ch == '~') { - if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) { - lineCurrent++; - lineEndNext = styler.LineEnd(lineCurrent); - sc.Forward(); - if (sc.ch == '\r' && sc.chNext == '\n') { - sc.Forward(); - } - continuationLine = true; - sc.Forward(); - continue; - } - } - - const bool atLineEndBeforeSwitch = sc.atLineEnd; - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_ABL_OPERATOR: - sc.SetState(SCE_ABL_DEFAULT); - break; - case SCE_ABL_NUMBER: - // We accept almost anything because of hex. and maybe number suffixes and scientific notations in the future - if (!(setWord.Contains(sc.ch) - || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E' || - sc.chPrev == 'p' || sc.chPrev == 'P')))) { - sc.SetState(SCE_ABL_DEFAULT); - } - break; - case SCE_ABL_IDENTIFIER: - if (sc.atLineStart || sc.atLineEnd || (!setWord.Contains(sc.ch) && sc.ch != '-')) { - char s[1000]; - sc.GetCurrentLowered(s, sizeof(s)); - bool isLastWordEnd = (s[0] == 'e' && s[1] =='n' && s[2] == 'd' && !IsAlphaNumeric(s[3]) && s[3] != '-'); // helps to identify "end trigger" phrase - if ((isSentenceStart && keywords2.InListAbbreviated (s,'(')) || (!isLastWordEnd && keywords3.InListAbbreviated (s,'('))) { - sc.ChangeState(SCE_ABL_BLOCK); - isSentenceStart = false; - } - else if (keywords1.InListAbbreviated (s,'(')) { - if (isLastWordEnd || - (s[0] == 'f' && s[1] =='o' && s[2] == 'r' && s[3] == 'w' && s[4] =='a' && s[5] == 'r' && s[6] == 'd'&& !IsAlphaNumeric(s[7]))) { - sc.ChangeState(SCE_ABL_END); - isSentenceStart = false; - } - else if ((s[0] == 'e' && s[1] =='l' && s[2] == 's' && s[3] == 'e') || - (s[0] == 't' && s[1] =='h' && s[2] == 'e' && s[3] == 'n')) { - sc.ChangeState(SCE_ABL_WORD); - isSentenceStart = true; - } - else { - sc.ChangeState(SCE_ABL_WORD); - isSentenceStart = false; - } - } - sc.SetState(SCE_ABL_DEFAULT); - } - break; - case SCE_ABL_PREPROCESSOR: - if (sc.atLineStart && !continuationLine) { - sc.SetState(SCE_ABL_DEFAULT); - // Force Scintilla to acknowledge changed stated even though this change might happen outside of the current line - possibleOOLChange = true; - isSentenceStart = true; - } - break; - case SCE_ABL_LINECOMMENT: - if (sc.atLineStart && !continuationLine) { - sc.SetState(SCE_ABL_DEFAULT); - isSentenceStart = true; - } else { - styleBeforeTaskMarker = SCE_ABL_LINECOMMENT; - highlightTaskMarker(sc, styler, keywords4); - } - break; - case SCE_ABL_TASKMARKER: - if (isoperator(sc.ch) || IsASpace(sc.ch)) { - sc.SetState(styleBeforeTaskMarker); - styleBeforeTaskMarker = SCE_ABL_DEFAULT; - } - // fall through - case SCE_ABL_COMMENT: - if (sc.Match('*', '/')) { - sc.Forward(); - commentNestingLevel--; - if (commentNestingLevel == 0) { - sc.ForwardSetState(SCE_ABL_DEFAULT); - possibleOOLChange = true; - } - } else if (sc.Match('/', '*')) { - commentNestingLevel++; - sc.Forward(); - } - if (commentNestingLevel > 0) { - styleBeforeTaskMarker = SCE_ABL_COMMENT; - possibleOOLChange = true; - highlightTaskMarker(sc, styler, keywords4); - } - break; - case SCE_ABL_STRING: - if (sc.ch == '~') { - sc.Forward(); // Skip a character after a tilde - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_ABL_DEFAULT); - } - break; - case SCE_ABL_CHARACTER: - if (sc.ch == '~') { - sc.Forward(); // Skip a character after a tilde - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_ABL_DEFAULT); - } - break; - } - - if (sc.atLineEnd && !atLineEndBeforeSwitch) { - // State exit processing consumed characters up to end of line. - lineCurrent++; - lineEndNext = styler.LineEnd(lineCurrent); - } - - // Determine if a new state should be entered. - if (sc.state == SCE_ABL_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_ABL_NUMBER); - isSentenceStart = false; - } else if (!sc.atLineEnd && (setWordStart.Contains(sc.ch)) && sc.chPrev != '&') { - sc.SetState(SCE_ABL_IDENTIFIER); - } else if (sc.Match('/', '*')) { - if (sc.chPrev == '.' || sc.chPrev == ':' || sc.chPrev == '}') { - isSentenceStart = true; - } - sc.SetState(SCE_ABL_COMMENT); - possibleOOLChange = true; - commentNestingLevel++; - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.ch == '\"') { - sc.SetState(SCE_ABL_STRING); - isSentenceStart = false; - } else if (sc.ch == '\'') { - sc.SetState(SCE_ABL_CHARACTER); - isSentenceStart = false; - } else if (sc.ch == '&' && visibleChars1 == 0 && isSentenceStart) { - // Preprocessor commands are alone on their line - sc.SetState(SCE_ABL_PREPROCESSOR); - // Force Scintilla to acknowledge changed stated even though this change might happen outside of the current line - possibleOOLChange = true; - // Skip whitespace between & and preprocessor word - do { - sc.Forward(); - } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); - if (sc.atLineEnd) { - sc.SetState(SCE_ABL_DEFAULT); - } - } else if (sc.Match('/','/') && (IsASpace(sc.chPrev) || isSentenceStart)) { - // Line comments are valid after a white space or EOL - sc.SetState(SCE_ABL_LINECOMMENT); - // Skip whitespace between // and preprocessor word - do { - sc.Forward(); - } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); - if (sc.atLineEnd) { - sc.SetState(SCE_ABL_DEFAULT); - } - } else if (isoperator(sc.ch)) { - sc.SetState(SCE_ABL_OPERATOR); - /* This code allows highlight of handles. Alas, it would cause the phrase "last-event:function" - to be recognized as a BlockBegin */ - isSentenceStart = false; - } - else if ((sc.chPrev == '.' || sc.chPrev == ':' || sc.chPrev == '}') && (IsASpace(sc.ch))) { - isSentenceStart = true; - } - } - if (!IsASpace(sc.ch)) { - visibleChars1++; - } - if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) { - visibleChars++; - } - continuationLine = false; - sc.Forward(); - } - if (possibleOOLChange) - 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 LexerABL::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; - Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1); - int levelNext = levelCurrent; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - for (Sci_PositionU i = startPos; i < endPos; i++) { - chNext = static_cast<char>(tolower(chNext)); // check tolower - char ch = chNext; - chNext = styler.SafeGetCharAt(i+1); - int stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i+1); - bool atEOL = i == (lineStartNext-1); - 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.foldSyntaxBased) { - if (style == SCE_ABL_BLOCK && !IsAlphaNumeric(chNext)) { - levelNext++; - } - else if (style == SCE_ABL_END && (ch == 'e' || ch == 'f')) { - 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++; - lineStartNext = styler.LineStart(lineCurrent+1); - levelCurrent = levelNext; - if (atEOL && (i == static_cast<Sci_PositionU>(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 lmProgress(SCLEX_PROGRESS, LexerABL::LexerFactoryABL, "abl", ablWordLists); diff --git a/lexers/LexProps.cxx b/lexers/LexProps.cxx deleted file mode 100644 index 328033dd5..000000000 --- a/lexers/LexProps.cxx +++ /dev/null @@ -1,187 +0,0 @@ -// Scintilla source code edit control -/** @file LexProps.cxx - ** Lexer for properties files. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> - -#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 Scintilla; - -static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { - return (styler[i] == '\n') || - ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); -} - -static inline bool isassignchar(unsigned char ch) { - return (ch == '=') || (ch == ':'); -} - -static void ColourisePropsLine( - const char *lineBuffer, - Sci_PositionU lengthLine, - Sci_PositionU startLine, - Sci_PositionU endPos, - Accessor &styler, - bool allowInitialSpaces) { - - Sci_PositionU i = 0; - if (allowInitialSpaces) { - while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces - i++; - } else { - if (isspacechar(lineBuffer[i])) // don't allow initial spaces - i = lengthLine; - } - - if (i < lengthLine) { - if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') { - styler.ColourTo(endPos, SCE_PROPS_COMMENT); - } else if (lineBuffer[i] == '[') { - styler.ColourTo(endPos, SCE_PROPS_SECTION); - } else if (lineBuffer[i] == '@') { - styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL); - if (isassignchar(lineBuffer[i++])) - styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT); - styler.ColourTo(endPos, SCE_PROPS_DEFAULT); - } else { - // Search for the '=' character - while ((i < lengthLine) && !isassignchar(lineBuffer[i])) - i++; - if ((i < lengthLine) && isassignchar(lineBuffer[i])) { - styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY); - styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT); - styler.ColourTo(endPos, SCE_PROPS_DEFAULT); - } else { - styler.ColourTo(endPos, SCE_PROPS_DEFAULT); - } - } - } else { - styler.ColourTo(endPos, SCE_PROPS_DEFAULT); - } -} - -static void ColourisePropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - std::string lineBuffer; - styler.StartAt(startPos); - styler.StartSegment(startPos); - Sci_PositionU startLine = startPos; - - // property lexer.props.allow.initial.spaces - // For properties files, set to 0 to style all lines that start with whitespace in the default style. - // This is not suitable for SciTE .properties files which use indentation for flow control but - // can be used for RFC2822 text where indentation is used for continuation lines. - const bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0; - - for (Sci_PositionU i = startPos; i < startPos + length; i++) { - lineBuffer.push_back(styler[i]); - if (AtEOL(styler, i)) { - // End of line (or of line buffer) met, colourise it - ColourisePropsLine(lineBuffer.c_str(), lineBuffer.length(), startLine, i, styler, allowInitialSpaces); - lineBuffer.clear(); - startLine = i + 1; - } - } - if (lineBuffer.length() > 0) { // Last line does not have ending characters - ColourisePropsLine(lineBuffer.c_str(), lineBuffer.length(), startLine, startPos + length - 1, styler, allowInitialSpaces); - } -} - -// adaption by ksc, using the "} else {" trick of 1.53 -// 030721 -static void FoldPropsDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) { - const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - - const 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; - int lev; - - for (Sci_PositionU i = startPos; i < endPos; i++) { - const char ch = chNext; - chNext = styler[i+1]; - - const int style = styleNext; - styleNext = styler.StyleAt(i + 1); - const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - if (style == SCE_PROPS_SECTION) { - headerPoint = true; - } - - if (atEOL) { - lev = SC_FOLDLEVELBASE; - - if (lineCurrent > 0) { - const int levelPrevious = styler.LevelAt(lineCurrent - 1); - - if (levelPrevious & SC_FOLDLEVELHEADERFLAG) { - lev = SC_FOLDLEVELBASE + 1; - } else { - lev = levelPrevious & SC_FOLDLEVELNUMBERMASK; - } - } - - if (headerPoint) { - lev = SC_FOLDLEVELBASE; - } - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - - if (headerPoint) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - - lineCurrent++; - visibleChars = 0; - headerPoint = false; - } - if (!isspacechar(ch)) - visibleChars++; - } - - if (lineCurrent > 0) { - const int levelPrevious = styler.LevelAt(lineCurrent - 1); - if (levelPrevious & SC_FOLDLEVELHEADERFLAG) { - lev = SC_FOLDLEVELBASE + 1; - } else { - lev = levelPrevious & SC_FOLDLEVELNUMBERMASK; - } - } else { - lev = SC_FOLDLEVELBASE; - } - int flagsNext = styler.LevelAt(lineCurrent); - styler.SetLevel(lineCurrent, lev | (flagsNext & ~SC_FOLDLEVELNUMBERMASK)); -} - -static const char *const emptyWordListDesc[] = { - 0 -}; - -LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc); diff --git a/lexers/LexPython.cxx b/lexers/LexPython.cxx deleted file mode 100644 index d5ec1d558..000000000 --- a/lexers/LexPython.cxx +++ /dev/null @@ -1,984 +0,0 @@ -// Scintilla source code edit control -/** @file LexPython.cxx - ** Lexer for Python. - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> -#include <cstring> - -#include <string> -#include <vector> -#include <map> -#include <algorithm> - -#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; - -namespace { -// Use an unnamed namespace to protect the functions and classes from name conflicts - -/* Notes on f-strings: f-strings are strings prefixed with f (e.g. f'') that may - have arbitrary expressions in {}. The tokens in the expressions are lexed as if - they were outside of any string. Expressions may contain { and } characters as - long as there is a closing } for every {, may be 2+ lines in a triple quoted - string, and may have a formatting specifier following a ! or :, but both ! - and : are valid inside of a bracketed expression and != is a valid - expression token even outside of a bracketed expression. - - When in an f-string expression, the lexer keeps track of the state value of - the f-string and the nesting count for the expression (# of [, (, { seen - # of - }, ), ] seen). f-strings may be nested (e.g. f'{ a + f"{1+2}"') so a stack of - states and nesting counts is kept. If a f-string expression continues beyond - the end of a line, this stack is saved in a std::map that maps a line number to - the stack at the end of that line. std::vector is used for the stack. - - The PEP for f-strings is at https://www.python.org/dev/peps/pep-0498/ -*/ -struct SingleFStringExpState { - int state; - int nestingCount; -}; - -/* kwCDef, kwCTypeName only used for Cython */ -enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName, kwCPDef }; - -enum literalsAllowed { litNone = 0, litU = 1, litB = 2, litF = 4 }; - -constexpr int indicatorWhitespace = 1; - -bool IsPyComment(Accessor &styler, Sci_Position pos, Sci_Position len) { - return len > 0 && styler[pos] == '#'; -} - -bool IsPyStringTypeChar(int ch, literalsAllowed allowed) noexcept { - return - ((allowed & litB) && (ch == 'b' || ch == 'B')) || - ((allowed & litU) && (ch == 'u' || ch == 'U')) || - ((allowed & litF) && (ch == 'f' || ch == 'F')); -} - -bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) noexcept { - if (ch == '\'' || ch == '"') - return true; - if (IsPyStringTypeChar(ch, allowed)) { - if (chNext == '"' || chNext == '\'') - return true; - if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\'')) - return true; - } - if ((ch == 'r' || ch == 'R') && (chNext == '"' || chNext == '\'')) - return true; - - return false; -} - -bool IsPyFStringState(int st) noexcept { - return ((st == SCE_P_FCHARACTER) || (st == SCE_P_FSTRING) || - (st == SCE_P_FTRIPLE) || (st == SCE_P_FTRIPLEDOUBLE)); -} - -bool IsPySingleQuoteStringState(int st) noexcept { - return ((st == SCE_P_CHARACTER) || (st == SCE_P_STRING) || - (st == SCE_P_FCHARACTER) || (st == SCE_P_FSTRING)); -} - -bool IsPyTripleQuoteStringState(int st) noexcept { - return ((st == SCE_P_TRIPLE) || (st == SCE_P_TRIPLEDOUBLE) || - (st == SCE_P_FTRIPLE) || (st == SCE_P_FTRIPLEDOUBLE)); -} - -char GetPyStringQuoteChar(int st) noexcept { - if ((st == SCE_P_CHARACTER) || (st == SCE_P_FCHARACTER) || - (st == SCE_P_TRIPLE) || (st == SCE_P_FTRIPLE)) - return '\''; - if ((st == SCE_P_STRING) || (st == SCE_P_FSTRING) || - (st == SCE_P_TRIPLEDOUBLE) || (st == SCE_P_FTRIPLEDOUBLE)) - return '"'; - - return '\0'; -} - -void PushStateToStack(int state, std::vector<SingleFStringExpState> &stack, SingleFStringExpState *¤tFStringExp) { - SingleFStringExpState single = {state, 0}; - stack.push_back(single); - - currentFStringExp = &stack.back(); -} - -int PopFromStateStack(std::vector<SingleFStringExpState> &stack, SingleFStringExpState *¤tFStringExp) noexcept { - int state = 0; - - if (!stack.empty()) { - state = stack.back().state; - stack.pop_back(); - } - - if (stack.empty()) { - currentFStringExp = nullptr; - } else { - currentFStringExp = &stack.back(); - } - - return state; -} - -/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */ -int GetPyStringState(Accessor &styler, Sci_Position i, Sci_PositionU *nextIndex, literalsAllowed allowed) { - char ch = styler.SafeGetCharAt(i); - char chNext = styler.SafeGetCharAt(i + 1); - const int firstIsF = (ch == 'f' || ch == 'F'); - - // Advance beyond r, u, or ur prefix (or r, b, or br in Python 2.7+ and r, f, or fr in Python 3.6+), but bail if there are any unexpected chars - if (ch == 'r' || ch == 'R') { - i++; - ch = styler.SafeGetCharAt(i); - chNext = styler.SafeGetCharAt(i + 1); - } else if (IsPyStringTypeChar(ch, allowed)) { - if (chNext == 'r' || chNext == 'R') - i += 2; - else - i += 1; - ch = styler.SafeGetCharAt(i); - chNext = styler.SafeGetCharAt(i + 1); - } - - if (ch != '"' && ch != '\'') { - *nextIndex = i + 1; - return SCE_P_DEFAULT; - } - - if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) { - *nextIndex = i + 3; - - if (ch == '"') - return (firstIsF ? SCE_P_FTRIPLEDOUBLE : SCE_P_TRIPLEDOUBLE); - else - return (firstIsF ? SCE_P_FTRIPLE : SCE_P_TRIPLE); - } else { - *nextIndex = i + 1; - - if (ch == '"') - return (firstIsF ? SCE_P_FSTRING : SCE_P_STRING); - else - return (firstIsF ? SCE_P_FCHARACTER : SCE_P_CHARACTER); - } -} - -inline bool IsAWordChar(int ch, bool unicodeIdentifiers) { - if (IsASCII(ch)) - return (IsAlphaNumeric(ch) || ch == '.' || ch == '_'); - - if (!unicodeIdentifiers) - return false; - - // Python uses the XID_Continue set from Unicode data - return IsXidContinue(ch); -} - -inline bool IsAWordStart(int ch, bool unicodeIdentifiers) { - if (IsASCII(ch)) - return (IsUpperOrLowerCase(ch) || ch == '_'); - - if (!unicodeIdentifiers) - return false; - - // Python uses the XID_Start set from Unicode data - 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 LexerPython -struct OptionsPython { - int whingeLevel; - bool base2or8Literals; - bool stringsU; - bool stringsB; - bool stringsF; - bool stringsOverNewline; - bool keywords2NoSubIdentifiers; - bool fold; - bool foldQuotes; - bool foldCompact; - bool unicodeIdentifiers; - - OptionsPython() { - whingeLevel = 0; - base2or8Literals = true; - stringsU = true; - stringsB = true; - stringsF = true; - stringsOverNewline = false; - keywords2NoSubIdentifiers = false; - fold = false; - foldQuotes = false; - foldCompact = false; - unicodeIdentifiers = true; - } - - literalsAllowed AllowedLiterals() const noexcept { - literalsAllowed allowedLiterals = stringsU ? litU : litNone; - if (stringsB) - allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB); - if (stringsF) - allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litF); - return allowedLiterals; - } -}; - -const char *const pythonWordListDesc[] = { - "Keywords", - "Highlighted identifiers", - nullptr -}; - -struct OptionSetPython : public OptionSet<OptionsPython> { - OptionSetPython() { - DefineProperty("tab.timmy.whinge.level", &OptionsPython::whingeLevel, - "For Python 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.python.literals.binary", &OptionsPython::base2or8Literals, - "Set to 0 to not recognise Python 3 binary and octal literals: 0b1011 0o712."); - - DefineProperty("lexer.python.strings.u", &OptionsPython::stringsU, - "Set to 0 to not recognise Python Unicode literals u\"x\" as used before Python 3."); - - DefineProperty("lexer.python.strings.b", &OptionsPython::stringsB, - "Set to 0 to not recognise Python 3 bytes literals b\"x\"."); - - DefineProperty("lexer.python.strings.f", &OptionsPython::stringsF, - "Set to 0 to not recognise Python 3.6 f-string literals f\"var={var}\"."); - - DefineProperty("lexer.python.strings.over.newline", &OptionsPython::stringsOverNewline, - "Set to 1 to allow strings to span newline characters."); - - DefineProperty("lexer.python.keywords2.no.sub.identifiers", &OptionsPython::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", &OptionsPython::fold); - - DefineProperty("fold.quotes.python", &OptionsPython::foldQuotes, - "This option enables folding multi-line quoted strings when using the Python lexer."); - - DefineProperty("fold.compact", &OptionsPython::foldCompact); - - DefineProperty("lexer.python.unicode.identifiers", &OptionsPython::unicodeIdentifiers, - "Set to 0 to not recognise Python 3 Unicode identifiers."); - - DefineWordListSets(pythonWordListDesc); - } -}; - -const char styleSubable[] = { SCE_P_IDENTIFIER, 0 }; - -LexicalClass lexicalClasses[] = { - // Lexer Python SCLEX_PYTHON SCE_P_: - 0, "SCE_P_DEFAULT", "default", "White space", - 1, "SCE_P_COMMENTLINE", "comment line", "Comment", - 2, "SCE_P_NUMBER", "literal numeric", "Number", - 3, "SCE_P_STRING", "literal string", "String", - 4, "SCE_P_CHARACTER", "literal string", "Single quoted string", - 5, "SCE_P_WORD", "keyword", "Keyword", - 6, "SCE_P_TRIPLE", "literal string", "Triple quotes", - 7, "SCE_P_TRIPLEDOUBLE", "literal string", "Triple double quotes", - 8, "SCE_P_CLASSNAME", "identifier", "Class name definition", - 9, "SCE_P_DEFNAME", "identifier", "Function or method name definition", - 10, "SCE_P_OPERATOR", "operator", "Operators", - 11, "SCE_P_IDENTIFIER", "identifier", "Identifiers", - 12, "SCE_P_COMMENTBLOCK", "comment", "Comment-blocks", - 13, "SCE_P_STRINGEOL", "error literal string", "End of line where string is not closed", - 14, "SCE_P_WORD2", "identifier", "Highlighted identifiers", - 15, "SCE_P_DECORATOR", "preprocessor", "Decorators", - 16, "SCE_P_FSTRING", "literal string interpolated", "F-String", - 17, "SCE_P_FCHARACTER", "literal string interpolated", "Single quoted f-string", - 18, "SCE_P_FTRIPLE", "literal string interpolated", "Triple quoted f-string", - 19, "SCE_P_FTRIPLEDOUBLE", "literal string interpolated", "Triple double quoted f-string", -}; - -} - -class LexerPython : public DefaultLexer { - WordList keywords; - WordList keywords2; - OptionsPython options; - OptionSetPython osPython; - enum { ssIdentifier }; - SubStyles subStyles; - std::map<Sci_Position, std::vector<SingleFStringExpState> > ftripleStateAtEol; -public: - explicit LexerPython() : - DefaultLexer("python", SCLEX_PYTHON, lexicalClasses, ELEMENTS(lexicalClasses)), - subStyles(styleSubable, 0x80, 0x40, 0) { - } - ~LexerPython() override { - } - void SCI_METHOD Release() override { - delete this; - } - int SCI_METHOD Version() const override { - return lvRelease5; - } - const char *SCI_METHOD PropertyNames() override { - return osPython.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) override { - return osPython.PropertyType(name); - } - const char *SCI_METHOD DescribeProperty(const char *name) override { - return osPython.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; - const char * SCI_METHOD PropertyGet(const char *key) override { - return osPython.PropertyGet(key); - } - const char *SCI_METHOD DescribeWordListSets() override { - return osPython.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 *LexerFactoryPython() { - return new LexerPython(); - } - -private: - void ProcessLineEnd(StyleContext &sc, std::vector<SingleFStringExpState> &fstringStateStack, SingleFStringExpState *¤tFStringExp, bool &inContinuedString); -}; - -Sci_Position SCI_METHOD LexerPython::PropertySet(const char *key, const char *val) { - if (osPython.PropertySet(&options, key, val)) { - return 0; - } - return -1; -} - -Sci_Position SCI_METHOD LexerPython::WordListSet(int n, const char *wl) { - WordList *wordListN = nullptr; - switch (n) { - case 0: - wordListN = &keywords; - break; - case 1: - wordListN = &keywords2; - break; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - } - } - return firstModification; -} - -void LexerPython::ProcessLineEnd(StyleContext &sc, std::vector<SingleFStringExpState> &fstringStateStack, SingleFStringExpState *¤tFStringExp, bool &inContinuedString) { - long deepestSingleStateIndex = -1; - unsigned long i; - - // Find the deepest single quote state because that string will end; no \ continuation in f-string - for (i = 0; i < fstringStateStack.size(); i++) { - if (IsPySingleQuoteStringState(fstringStateStack[i].state)) { - deepestSingleStateIndex = i; - break; - } - } - - if (deepestSingleStateIndex != -1) { - sc.SetState(fstringStateStack[deepestSingleStateIndex].state); - while (fstringStateStack.size() > static_cast<unsigned long>(deepestSingleStateIndex)) { - PopFromStateStack(fstringStateStack, currentFStringExp); - } - } - if (!fstringStateStack.empty()) { - std::pair<Sci_Position, std::vector<SingleFStringExpState> > val; - val.first = sc.currentLine; - val.second = fstringStateStack; - - ftripleStateAtEol.insert(val); - } - - if ((sc.state == SCE_P_DEFAULT) - || IsPyTripleQuoteStringState(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 (IsPySingleQuoteStringState(sc.state)) { - if (inContinuedString || options.stringsOverNewline) { - inContinuedString = false; - } else { - sc.ChangeState(SCE_P_STRINGEOL); - sc.ForwardSetState(SCE_P_DEFAULT); - } - } -} - -void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - Accessor styler(pAccess, nullptr); - - // Track whether in f-string expression; vector is used for a stack to - // handle nested f-strings such as f"""{f'''{f"{f'{1}'}"}'''}""" - std::vector<SingleFStringExpState> fstringStateStack; - SingleFStringExpState *currentFStringExp = 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_P_STRING - || eolStyle == SCE_P_CHARACTER - || eolStyle == SCE_P_STRINGEOL) { - lineCurrent -= 1; - } else { - break; - } - } - startPos = styler.LineStart(lineCurrent); - } - initStyle = startPos == 0 ? SCE_P_DEFAULT : styler.StyleAt(startPos - 1); - } - - const literalsAllowed allowedLiterals = options.AllowedLiterals(); - - initStyle = initStyle & 31; - if (initStyle == SCE_P_STRINGEOL) { - initStyle = SCE_P_DEFAULT; - } - - // Set up fstate stack from last line and remove any subsequent ftriple at eol states - std::map<Sci_Position, std::vector<SingleFStringExpState> >::iterator it; - it = ftripleStateAtEol.find(lineCurrent - 1); - if (it != ftripleStateAtEol.end() && !it->second.empty()) { - fstringStateStack = it->second; - currentFStringExp = &fstringStateStack.back(); - } - it = ftripleStateAtEol.lower_bound(lineCurrent); - if (it != ftripleStateAtEol.end()) { - ftripleStateAtEol.erase(it, ftripleStateAtEol.end()); - } - - kwType kwLast = kwOther; - int spaceFlags = 0; - styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); - bool base_n_number = false; - - const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_P_IDENTIFIER); - - StyleContext sc(startPos, endPos - startPos, initStyle, styler); - - bool indentGood = true; - Sci_Position startIndicator = sc.currentPos; - bool inContinuedString = false; - - for (; sc.More(); sc.Forward()) { - - if (sc.atLineStart) { - styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); - 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) { - ProcessLineEnd(sc, fstringStateStack, currentFStringExp, inContinuedString); - lineCurrent++; - if (!sc.More()) - break; - } - - bool needEOLCheck = false; - - - if (sc.state == SCE_P_OPERATOR) { - kwLast = kwOther; - sc.SetState(SCE_P_DEFAULT); - } else if (sc.state == SCE_P_NUMBER) { - if (!IsAWordChar(sc.ch, false) && - !(!base_n_number && ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { - sc.SetState(SCE_P_DEFAULT); - } - } else if (sc.state == SCE_P_IDENTIFIER) { - if ((sc.ch == '.') || (!IsAWordChar(sc.ch, options.unicodeIdentifiers))) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - int style = SCE_P_IDENTIFIER; - if ((kwLast == kwImport) && (strcmp(s, "as") == 0)) { - style = SCE_P_WORD; - } else if (keywords.InList(s)) { - style = SCE_P_WORD; - } else if (kwLast == kwClass) { - style = SCE_P_CLASSNAME; - } else if (kwLast == kwDef) { - style = SCE_P_DEFNAME; - } else if (kwLast == kwCDef || kwLast == kwCPDef) { - Sci_Position pos = sc.currentPos; - unsigned char ch = styler.SafeGetCharAt(pos, '\0'); - while (ch != '\0') { - if (ch == '(') { - style = SCE_P_DEFNAME; - break; - } else if (ch == ':') { - style = SCE_P_CLASSNAME; - break; - } else if (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') { - pos++; - ch = styler.SafeGetCharAt(pos, '\0'); - } else { - break; - } - } - } 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_P_WORD2; - } else { - style = SCE_P_WORD2; - } - } else { - int subStyle = classifierIdentifiers.ValueFor(s); - if (subStyle >= 0) { - style = subStyle; - } - } - sc.ChangeState(style); - sc.SetState(SCE_P_DEFAULT); - if (style == SCE_P_WORD) { - if (0 == strcmp(s, "class")) - kwLast = kwClass; - else if (0 == strcmp(s, "def")) - kwLast = kwDef; - else if (0 == strcmp(s, "import")) - kwLast = kwImport; - else if (0 == strcmp(s, "cdef")) - kwLast = kwCDef; - else if (0 == strcmp(s, "cpdef")) - kwLast = kwCPDef; - else if (0 == strcmp(s, "cimport")) - kwLast = kwImport; - else if (kwLast != kwCDef && kwLast != kwCPDef) - kwLast = kwOther; - } else if (kwLast != kwCDef && kwLast != kwCPDef) { - kwLast = kwOther; - } - } - } else if ((sc.state == SCE_P_COMMENTLINE) || (sc.state == SCE_P_COMMENTBLOCK)) { - if (sc.ch == '\r' || sc.ch == '\n') { - sc.SetState(SCE_P_DEFAULT); - } - } else if (sc.state == SCE_P_DECORATOR) { - if (!IsAWordStart(sc.ch, options.unicodeIdentifiers)) { - sc.SetState(SCE_P_DEFAULT); - } - } else if (IsPySingleQuoteStringState(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 == GetPyStringQuoteChar(sc.state)) { - sc.ForwardSetState(SCE_P_DEFAULT); - needEOLCheck = true; - } - } else if ((sc.state == SCE_P_TRIPLE) || (sc.state == SCE_P_FTRIPLE)) { - if (sc.ch == '\\') { - sc.Forward(); - } else if (sc.Match(R"(''')")) { - sc.Forward(); - sc.Forward(); - sc.ForwardSetState(SCE_P_DEFAULT); - needEOLCheck = true; - } - } else if ((sc.state == SCE_P_TRIPLEDOUBLE) || (sc.state == SCE_P_FTRIPLEDOUBLE)) { - if (sc.ch == '\\') { - sc.Forward(); - } else if (sc.Match(R"(""")")) { - sc.Forward(); - sc.Forward(); - sc.ForwardSetState(SCE_P_DEFAULT); - needEOLCheck = true; - } - } - - // Note if used and not if else because string states also match - // some of the above clauses - if (IsPyFStringState(sc.state) && sc.ch == '{') { - if (sc.chNext == '{') { - sc.Forward(); - } else { - PushStateToStack(sc.state, fstringStateStack, currentFStringExp); - sc.ForwardSetState(SCE_P_DEFAULT); - } - needEOLCheck = true; - } - - // If in an f-string expression, check for the ending quote(s) - // and end f-string to handle syntactically incorrect cases like - // f'{' and f"""{""" - if (!fstringStateStack.empty() && (sc.ch == '\'' || sc.ch == '"')) { - long matching_stack_i = -1; - for (unsigned long stack_i = 0; stack_i < fstringStateStack.size() && matching_stack_i == -1; stack_i++) { - const int stack_state = fstringStateStack[stack_i].state; - const char quote = GetPyStringQuoteChar(stack_state); - if (sc.ch == quote) { - if (IsPySingleQuoteStringState(stack_state)) { - matching_stack_i = stack_i; - } else if (quote == '"' ? sc.Match(R"(""")") : sc.Match("'''")) { - matching_stack_i = stack_i; - } - } - } - - if (matching_stack_i != -1) { - sc.SetState(fstringStateStack[matching_stack_i].state); - if (IsPyTripleQuoteStringState(fstringStateStack[matching_stack_i].state)) { - sc.Forward(); - sc.Forward(); - } - sc.ForwardSetState(SCE_P_DEFAULT); - needEOLCheck = true; - - while (fstringStateStack.size() > static_cast<unsigned long>(matching_stack_i)) { - PopFromStateStack(fstringStateStack, currentFStringExp); - } - } - } - // End of code to find the end of a state - - if (!indentGood && !IsASpaceOrTab(sc.ch)) { - styler.IndicatorFill(startIndicator, sc.currentPos, indicatorWhitespace, 1); - startIndicator = sc.currentPos; - indentGood = true; - } - - // One cdef or cpdef line, clear kwLast only at end of line - if ((kwLast == kwCDef || kwLast == kwCPDef) && sc.atLineEnd) { - kwLast = kwOther; - } - - // State exit code may have moved on to end of line - if (needEOLCheck && sc.atLineEnd) { - ProcessLineEnd(sc, fstringStateStack, currentFStringExp, inContinuedString); - lineCurrent++; - styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); - if (!sc.More()) - break; - } - - // If in f-string expression, check for }, :, ! to resume f-string state or update nesting count - if (currentFStringExp && !IsPySingleQuoteStringState(sc.state) && !IsPyTripleQuoteStringState(sc.state)) { - if (currentFStringExp->nestingCount == 0 && (sc.ch == '}' || sc.ch == ':' || (sc.ch == '!' && sc.chNext != '='))) { - sc.SetState(PopFromStateStack(fstringStateStack, currentFStringExp)); - } else { - if (sc.ch == '{' || sc.ch == '[' || sc.ch == '(') { - currentFStringExp->nestingCount++; - } else if (sc.ch == '}' || sc.ch == ']' || sc.ch == ')') { - currentFStringExp->nestingCount--; - } - } - } - - // Check for a new state starting character - if (sc.state == SCE_P_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_P_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_P_NUMBER); - } else { - sc.SetState(SCE_P_NUMBER); - sc.ForwardSetState(SCE_P_IDENTIFIER); - } - } else { - base_n_number = false; - sc.SetState(SCE_P_NUMBER); - } - } else if (isoperator(sc.ch) || sc.ch == '`') { - sc.SetState(SCE_P_OPERATOR); - } else if (sc.ch == '#') { - sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE); - } else if (sc.ch == '@') { - if (IsFirstNonWhitespace(sc.currentPos, styler)) - sc.SetState(SCE_P_DECORATOR); - else - sc.SetState(SCE_P_OPERATOR); - } else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2), allowedLiterals)) { - Sci_PositionU nextIndex = 0; - sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex, allowedLiterals)); - while (nextIndex > (sc.currentPos + 1) && sc.More()) { - sc.Forward(); - } - } else if (IsAWordStart(sc.ch, options.unicodeIdentifiers)) { - sc.SetState(SCE_P_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 IsPyTripleQuoteStringState(style); -} - - -void SCI_METHOD LexerPython::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_P_DEFAULT & 31; - if (lineCurrent >= 1) - prev_state = styler.StyleAt(startPos - 1) & 31; - int prevQuote = options.foldQuotes && IsPyTripleQuoteStringState(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 && IsPyTripleQuoteStringState(style); - } - const int quote_start = (quote && !prevQuote); - const int 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) || - (lineNext <= docLines && 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 lmPython(SCLEX_PYTHON, LexerPython::LexerFactoryPython, "python", - pythonWordListDesc); diff --git a/lexers/LexR.cxx b/lexers/LexR.cxx deleted file mode 100644 index a3821fa3c..000000000 --- a/lexers/LexR.cxx +++ /dev/null @@ -1,214 +0,0 @@ -// Scintilla source code edit control -/** @file LexR.cxx - ** Lexer for R, S, SPlus Statistics Program (Heavily derived from CPP Lexer). - ** - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -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 inline bool IsAnOperator(const int 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 == '}' || ch == '{' || ch == '[' || - ch == ']') - return true; - return false; -} - -static void ColouriseRDoc(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_R_INFIXEOL) - initStyle = SCE_R_DEFAULT; - - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - if (sc.atLineStart && (sc.state == SCE_R_STRING)) { - // Prevent SCE_R_STRINGEOL from leaking back to previous line - sc.SetState(SCE_R_STRING); - } - - // Determine if the current state should terminate. - if (sc.state == SCE_R_OPERATOR) { - sc.SetState(SCE_R_DEFAULT); - } else if (sc.state == SCE_R_NUMBER) { - if (!IsADigit(sc.ch) && !(sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_R_DEFAULT); - } - } else if (sc.state == SCE_R_IDENTIFIER) { - if (!IsAWordChar(sc.ch)) { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_R_KWORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_R_BASEKWORD); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_R_OTHERKWORD); - } - sc.SetState(SCE_R_DEFAULT); - } - } else if (sc.state == SCE_R_COMMENT) { - if (sc.ch == '\r' || sc.ch == '\n') { - sc.SetState(SCE_R_DEFAULT); - } - } else if (sc.state == SCE_R_STRING) { - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_R_DEFAULT); - } - } else if (sc.state == SCE_R_INFIX) { - if (sc.ch == '%') { - sc.ForwardSetState(SCE_R_DEFAULT); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_R_INFIXEOL); - sc.ForwardSetState(SCE_R_DEFAULT); - } - }else if (sc.state == SCE_R_STRING2) { - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_R_DEFAULT); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_R_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_R_NUMBER); - } else if (IsAWordStart(sc.ch) ) { - sc.SetState(SCE_R_IDENTIFIER); - } else if (sc.Match('#')) { - sc.SetState(SCE_R_COMMENT); - } else if (sc.ch == '\"') { - sc.SetState(SCE_R_STRING); - } else if (sc.ch == '%') { - sc.SetState(SCE_R_INFIX); - } else if (sc.ch == '\'') { - sc.SetState(SCE_R_STRING2); - } else if (IsAnOperator(sc.ch)) { - sc.SetState(SCE_R_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 {". -static void FoldRDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], - Accessor &styler) { - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - 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); - 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_R_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) { - 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 (!isspacechar(ch)) - visibleChars++; - } -} - - -static const char * const RWordLists[] = { - "Language Keywords", - "Base / Default package function", - "Other Package Functions", - "Unused", - "Unused", - 0, - }; - - - -LexerModule lmR(SCLEX_R, ColouriseRDoc, "r", FoldRDoc, RWordLists); diff --git a/lexers/LexRaku.cxx b/lexers/LexRaku.cxx deleted file mode 100644 index 17fff5e94..000000000 --- a/lexers/LexRaku.cxx +++ /dev/null @@ -1,1605 +0,0 @@ -/** @file LexRaku.cxx - ** Lexer for Raku - ** - ** Copyright (c) 2019 Mark Reay <mark@reay.net.au> - **/ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -/* - * Raku (Perl6) Lexer for Scintilla - * --------------------------------- - * --------------------------------- - * 06-Dec-2019: More Unicode support: - * - Added a full scope of allowed numbers and letters - * 29-Nov-2019: More highlighting / implemented basic folding: - * - Operators (blanket cover, no sequence checking) - * - Class / Grammar name highlighting - * - Folding: - * - Comments: line / multi-line - * - POD sections - * - Code blocks {} - * 26-Nov-2019: Basic syntax highlighting covering the following: - * - Comments, both line and embedded (multi-line) - * - POD, no inline highlighting as yet... - * - Heredoc block string, with variable highlighting (with qq) - * - Strings, with variable highlighting (with ") - * - Q Language, including adverbs (also basic q and qq) - * - Regex, including adverbs - * - Numbers - * - Bareword / identifiers - * - Types - * - Variables: mu, positional, associative, callable - * TODO: - * - POD inline - * - Better operator sequence coverage - */ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <vector> -#include <map> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "WordList.h" -#include "LexAccessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" -#include "CharacterCategory.h" -#include "LexerModule.h" -#include "OptionSet.h" -#include "DefaultLexer.h" - -using namespace Scintilla; - -namespace { // anonymous namespace to isolate any name clashes -/*----------------------------------------------------------------------------* - * --- DEFINITIONS: OPTIONS / CONSTANTS --- - *----------------------------------------------------------------------------*/ - -// Number types -#define RAKUNUM_BINARY 1 // order is significant: 1-3 cannot have a dot -#define RAKUNUM_OCTAL 2 -#define RAKUNUM_FLOAT_EXP 3 // exponent part only -#define RAKUNUM_HEX 4 // may be a hex float -#define RAKUNUM_DECIMAL 5 // 1-5 are numbers; 6-7 are strings -#define RAKUNUM_VECTOR 6 -#define RAKUNUM_V_VECTOR 7 -#define RAKUNUM_VERSION 8 // can contain multiple '.'s -#define RAKUNUM_BAD 9 - -// Regex / Q string types -#define RAKUTYPE_REGEX_NORM 0 // 0 char ident -#define RAKUTYPE_REGEX_S 1 // order is significant: -#define RAKUTYPE_REGEX_M 2 // 1 char ident -#define RAKUTYPE_REGEX_Y 3 // 1 char ident -#define RAKUTYPE_REGEX 4 // > RAKUTYPE_REGEX == 2 char identifiers -#define RAKUTYPE_REGEX_RX 5 // 2 char ident -#define RAKUTYPE_REGEX_TR 6 // 2 char ident -#define RAKUTYPE_QLANG 7 // < RAKUTYPE_QLANG == RAKUTYPE_REGEX_? -#define RAKUTYPE_STR_WQ 8 // 0 char ident < word quote > -#define RAKUTYPE_STR_Q 9 // 1 char ident -#define RAKUTYPE_STR_QX 10 // 2 char ident -#define RAKUTYPE_STR_QW 11 // 2 char ident -#define RAKUTYPE_STR_QQ 12 // 2 char ident -#define RAKUTYPE_STR_QQX 13 // 3 char ident -#define RAKUTYPE_STR_QQW 14 // 3 char ident -#define RAKUTYPE_STR_QQWW 15 // 4 char ident - -// Delimiter types -#define RAKUDELIM_BRACKET 0 // bracket: regex, Q language -#define RAKUDELIM_QUOTE 1 // quote: normal string - -// rakuWordLists: keywords as defined in config -const char *const rakuWordLists[] = { - "Keywords and identifiers", - "Functions", - "Types basic", - "Types composite", - "Types domain-specific", - "Types exception", - "Adverbs", - nullptr, -}; - -// Options and defaults -struct OptionsRaku { - bool fold; - bool foldCompact; - bool foldComment; - bool foldCommentMultiline; - bool foldCommentPOD; - OptionsRaku() { - fold = true; - foldCompact = false; - foldComment = true; - foldCommentMultiline = true; - foldCommentPOD = true; - } -}; - -// init options and words -struct OptionSetRaku : public OptionSet<OptionsRaku> { - OptionSetRaku() { - DefineProperty("fold", &OptionsRaku::fold); - DefineProperty("fold.comment", &OptionsRaku::foldComment); - DefineProperty("fold.compact", &OptionsRaku::foldCompact); - - DefineProperty("fold.raku.comment.multiline", &OptionsRaku::foldCommentMultiline, - "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); - DefineProperty("fold.raku.comment.pod", &OptionsRaku::foldCommentPOD, - "Set this property to 0 to disable folding POD comments when fold.comment=1."); - - // init word lists - DefineWordListSets(rakuWordLists); - } -}; - -// Delimiter pair -struct DelimPair { - int opener; // opener char - int closer[2]; // closer chars - bool interpol; // can variables be interpolated? - short count; // delimiter char count - DelimPair() { - opener = 0; - closer[0] = 0; - closer[1] = 0; - interpol = false; - count = 0; - } - bool isCloser(int ch) const { - return ch == closer[0] || ch == closer[1]; - } -}; - -/*----------------------------------------------------------------------------* - * --- FUNCTIONS --- - *----------------------------------------------------------------------------*/ - -/* - * IsANewLine - * - returns true if this is a new line char - */ -constexpr bool IsANewLine(int ch) noexcept { - return ch == '\r' || ch == '\n'; -} - -/* - * IsAWhitespace - * - returns true if this is a whitespace (or newline) char - */ -bool IsAWhitespace(int ch) noexcept { - return IsASpaceOrTab(ch) || IsANewLine(ch); -} - -/* - * IsAlphabet - * - returns true if this is an alphabetical char - */ -constexpr bool IsAlphabet(int ch) noexcept { - return (ch >= 'a' && ch <= 'z') || (ch >= 'A' && ch <= 'Z'); -} - -/* - * IsCommentLine - * - returns true if this is a comment line - * - tests: SCE_RAKU_COMMENTLINE or SCE_RAKU_COMMENTEMBED - * modified from: LexPerl.cxx - */ -bool IsCommentLine(Sci_Position line, LexAccessor &styler, int type = SCE_RAKU_COMMENTLINE) { - 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 (type == SCE_RAKU_COMMENTEMBED) { - if (i == (eol_pos - 1) && style == type) - return true; - } else { // make sure the line is NOT a SCE_RAKU_COMMENTEMBED - if (ch == '#' && style == type && styler[i+1] != '`' ) - return true; - else if (!IsASpaceOrTab(ch)) - return false; - } - } - return false; -} - -/* - * GetBracketCloseChar - * - returns the end bracket char: opposite of start - * - see: http://www.unicode.org/Public/5.1.0/ucd/BidiMirroring.txt (first section) - * - Categories are general matches for valid BiDi types - * - Most closer chars are opener + 1 - */ -int GetBracketCloseChar(const int ch) noexcept { - const CharacterCategory cc = CategoriseCharacter(ch); - switch (cc) { - case ccSm: - switch (ch) { - case 0x3C: return 0x3E; // LESS-THAN SIGN - case 0x2208: return 0x220B; // ELEMENT OF - case 0x2209: return 0x220C; // NOT AN ELEMENT OF - case 0x220A: return 0x220D; // SMALL ELEMENT OF - case 0x2215: return 0x29F5; // DIVISION SLASH - case 0x2243: return 0x22CD; // ASYMPTOTICALLY EQUAL TO - case 0x2298: return 0x29B8; // CIRCLED DIVISION SLASH - case 0x22A6: return 0x2ADE; // ASSERTION - case 0x22A8: return 0x2AE4; // TRUE - case 0x22A9: return 0x2AE3; // FORCES - case 0x22AB: return 0x2AE5; // DOUBLE VERTICAL BAR DOUBLE RIGHT TURNSTILE - case 0x22F2: return 0x22FA; // ELEMENT OF WITH LONG HORIZONTAL STROKE - case 0x22F3: return 0x22FB; // ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE - case 0x22F4: return 0x22FC; // SMALL ELEMENT OF WITH VERTICAL BAR AT END OF HORIZONTAL STROKE - case 0x22F6: return 0x22FD; // ELEMENT OF WITH OVERBAR - case 0x22F7: return 0x22FE; // SMALL ELEMENT OF WITH OVERBAR - case 0xFF1C: return 0xFF1E; // FULLWIDTH LESS-THAN SIGN - } - break; - case ccPs: - switch (ch) { - case 0x5B: return 0x5D; // LEFT SQUARE BRACKET - case 0x7B: return 0x7D; // LEFT CURLY BRACKET - case 0x298D: return 0x2990; // LEFT SQUARE BRACKET WITH TICK IN TOP CORNER - case 0x298F: return 0x298E; // LEFT SQUARE BRACKET WITH TICK IN BOTTOM CORNER - case 0xFF3B: return 0xFF3D; // FULLWIDTH LEFT SQUARE BRACKET - case 0xFF5B: return 0xFF5D; // FULLWIDTH LEFT CURLY BRACKET - } - break; - case ccPi: - break; - default: return 0; - } - return ch + 1; -} - -/* - * IsValidQuoteOpener - * - - */ -bool IsValidQuoteOpener(const int ch, DelimPair &dp, int type = RAKUDELIM_BRACKET) noexcept { - dp.closer[0] = 0; - dp.closer[1] = 0; - dp.interpol = true; - if (type == RAKUDELIM_QUOTE) { - switch (ch) { - // Opener Closer Description - case '\'': dp.closer[0] = '\''; // APOSTROPHE - dp.interpol = false; - break; - case '"': dp.closer[0] = '"'; // QUOTATION MARK - break; - case 0x2018: dp.closer[0] = 0x2019; // LEFT SINGLE QUOTATION MARK - dp.interpol = false; - break; - case 0x201C: dp.closer[0] = 0x201D; // LEFT DOUBLE QUOTATION MARK - break; - case 0x201D: dp.closer[0] = 0x201C; // RIGHT DOUBLE QUOTATION MARK - break; - case 0x201E: dp.closer[0] = 0x201C; // DOUBLE LOW-9 QUOTATION MARK - dp.closer[1] = 0x201D; - break; - case 0xFF62: dp.closer[0] = 0xFF63; // HALFWIDTH LEFT CORNER BRACKET - dp.interpol = false; - break; - default: return false; - } - } else if (type == RAKUDELIM_BRACKET) { - dp.closer[0] = GetBracketCloseChar(ch); - } - dp.opener = ch; - dp.count = 1; - return dp.closer[0] > 0; -} - -/* - * IsBracketOpenChar - * - true if this is a valid start bracket character - */ -bool IsBracketOpenChar(int ch) noexcept { - return GetBracketCloseChar(ch) > 0; -} - -/* - * IsValidRegOrQAdjacent - * - returns true if ch is a valid character to put directly after Q / q - * * ref: Q Language: https://docs.raku.org/language/quoting - */ -bool IsValidRegOrQAdjacent(int ch) noexcept { - return !(IsAlphaNumeric(ch) || ch == '_' || ch == '(' || ch == ')' || ch == '\'' ); -} - -/* - * IsValidRegOrQPrecede - * - returns true if ch is a valid preceeding character to put directly before Q / q - * * ref: Q Language: https://docs.raku.org/language/quoting - */ -bool IsValidRegOrQPrecede(int ch) noexcept { - return !(IsAlphaNumeric(ch) || ch == '_'); -} - -/* - * MatchCharInRange - * - returns true if the mach character is found in range (of length) - * - ignoreDelim (default false) - */ -bool MatchCharInRange(StyleContext &sc, const Sci_Position length, - const int match, bool ignoreDelim = false) { - Sci_Position len = 0; - int chPrev = sc.chPrev; - while (++len < length) { - const int ch = sc.GetRelativeCharacter(len); - if (ch == match && (ignoreDelim || chPrev != '\\')) - return true; - } - return false; -} - -/* - * PrevNonWhitespaceChar - * - returns the last non-whitespace char - */ -int PrevNonWhitespaceChar(StyleContext &sc) { - Sci_Position rel = 0; - Sci_Position max_back = 0 - sc.currentPos; - while (--rel > max_back) { - const int ch = sc.GetRelativeCharacter(rel); - if (!IsAWhitespace(ch)) - return ch; - } - return 0; // no matching char -} - -/* - * IsQLangStartAtScPos - * - returns true if this is a valid Q Language sc position - * - ref: https://docs.raku.org/language/quoting - * - Q :adverb :adverb //; - * - q,qx,qw,qq,qqx,qqw,qqww :adverb /:adverb /; - */ -bool IsQLangStartAtScPos(StyleContext &sc, int &type, const Sci_Position length) { - const bool valid_adj = IsValidRegOrQAdjacent(sc.chNext); - const int chFw2 = sc.GetRelativeCharacter(2); - const int chFw3 = sc.GetRelativeCharacter(3); - type = -1; - if (IsValidRegOrQPrecede(sc.chPrev)) { - if (sc.ch == 'Q' && valid_adj) { - type = RAKUTYPE_QLANG; - } else if (sc.ch == 'q') { - switch (sc.chNext) { - case 'x': - type = RAKUTYPE_STR_QX; - break; - case 'w': - type = RAKUTYPE_STR_QW; - break; - case 'q': - if (chFw2 == 'x') { - type = RAKUTYPE_STR_QQX; - } else if (chFw2 == 'w') { - if (chFw3 == 'w') { - type = RAKUTYPE_STR_QQWW; - } else { - type = RAKUTYPE_STR_QQW; - } - } else { - type = RAKUTYPE_STR_QQ; - } - break; - default: - type = RAKUTYPE_STR_Q; - } - } else if (sc.ch == '<' && MatchCharInRange(sc, length, '>')) { - type = RAKUTYPE_STR_WQ; // < word quote > - } - } - return type >= 0; -} - -/* - * IsRegexStartAtScPos - * - returns true if this is a valid Regex sc position - * - ref: https://docs.raku.org/language/regexes - * - Regex: (rx/s/m/tr/y) :adverb /:adverb /; - * - regex R :adverb //; - * - /:adverb /; - */ -bool IsRegexStartAtScPos(StyleContext &sc, int &type, CharacterSet &set) { - const bool valid_adj = IsValidRegOrQAdjacent(sc.chNext); - type = -1; - if (IsValidRegOrQPrecede(sc.chPrev)) { - switch (sc.ch) { - case 'r': - if (sc.chNext == 'x') - type = RAKUTYPE_REGEX_RX; - break; - case 't': - case 'T': - if (sc.chNext == 'r' || sc.chNext == 'R') - type = RAKUTYPE_REGEX_TR; - break; - case 'm': - if (valid_adj) - type = RAKUTYPE_REGEX_M; - break; - case 's': - case 'S': - if (valid_adj) - type = RAKUTYPE_REGEX_S; - break; - case 'y': - if (valid_adj) - type = RAKUTYPE_REGEX_Y; - break; - case '/': - if (set.Contains(PrevNonWhitespaceChar(sc))) - type = RAKUTYPE_REGEX_NORM; - } - } - return type >= 0; -} - -/* - * IsValidIdentPrecede - * - returns if ch is a valid preceeding char to put directly before an identifier - */ -bool IsValidIdentPrecede(int ch) noexcept { - return !(IsAlphaNumeric(ch) || ch == '_' || ch == '@' || ch == '$' || ch == '%'); -} - -/* - * IsValidDelimiter - * - returns if ch is a valid delimiter (most chars are valid) - * * ref: Q Language: https://docs.raku.org/language/quoting - */ -bool IsValidDelimiter(int ch) noexcept { - return !(IsAlphaNumeric(ch) || ch == ':'); -} - -/* - * GetDelimiterCloseChar - * - returns the corrisponding close char for a given delimiter (could be the same char) - */ -int GetDelimiterCloseChar(int ch) noexcept { - int ch_end = GetBracketCloseChar(ch); - if (ch_end == 0 && IsValidDelimiter(ch)) { - ch_end = ch; - } - return ch_end; -} - -/* - * GetRepeatCharCount - * - returns the occurence count of match - */ -Sci_Position GetRepeatCharCount(StyleContext &sc, int chMatch, Sci_Position length) { - Sci_Position cnt = 0; - while (cnt < length) { - if (sc.GetRelativeCharacter(cnt) != chMatch) { - break; - } - cnt++; - } - return cnt; -} - -/* - * LengthToDelimiter - * - returns the length until the end of a delimited string section - * - Ignores nested delimiters (if opener != closer) - * - no trailing char after last closer (default false) - */ -Sci_Position LengthToDelimiter(StyleContext &sc, const DelimPair &dp, - Sci_Position length, bool noTrailing = false) { - short cnt_open = 0; // count open bracket - short cnt_close = 0; // count close bracket - Sci_Position len = 0; // count characters - int chOpener = dp.opener; // look for nested opener / closer - if (dp.opener == dp.closer[0]) - chOpener = 0; // no opening delimiter (no nesting possible) - - while (len < length) { - const int chPrev = sc.GetRelativeCharacter(len - 1); - const int ch = sc.GetRelativeCharacter(len); - const int chNext = sc.GetRelativeCharacter(len+1); - - if (cnt_open == 0 && cnt_close == dp.count) { - return len; // end condition has been met - } else { - if (chPrev != '\\' && ch == chOpener) { // ignore escape sequence - cnt_open++; // open nested bracket - } else if (chPrev != '\\' && dp.isCloser(ch)) { // ignore escape sequence - if ( cnt_open > 0 ) { - cnt_open--; // close nested bracket - } else if (dp.count > 1 && cnt_close < (dp.count - 1)) { - if (cnt_close > 1) { - if (dp.isCloser(chPrev)) { - cnt_close++; - } else { // reset if previous char was not close - cnt_close = 0; - } - } else { - cnt_close++; - } - } else if (!noTrailing || (IsAWhitespace(chNext))) { - cnt_close++; // found last close - if (cnt_close > 1 && !dp.isCloser(chPrev)) { - cnt_close = 0; // reset if previous char was not close - } - } else { - cnt_close = 0; // non handled close: reset - } - } else if (IsANewLine(ch)) { - cnt_open = 0; // reset after each line - cnt_close = 0; - } - } - len++; - } - return -1; // end condition has NOT been met -} - -/* - * LengthToEndHeredoc - * - returns the length until the end of a heredoc section - * - delimiter string MUST begin on a new line - */ -Sci_Position LengthToEndHeredoc(const StyleContext &sc, LexAccessor &styler, - const Sci_Position length, const char *delim) { - bool on_new_ln = false; - int i = 0; // str index - for (int n = 0; n < length; n++) { - const char ch = styler.SafeGetCharAt(sc.currentPos + n, 0); - if (on_new_ln) { - if (delim[i] == '\0') - return n; // at end of str, match found! - if (ch != delim[i++]) - i = 0; // no char match, reset 'i'ndex - } - if (i == 0) // detect new line - on_new_ln = IsANewLine(ch); - } - return -1; // no match found -} - -/* - * LengthToNextChar - * - returns the length until the next character - */ -Sci_Position LengthToNextChar(StyleContext &sc, const Sci_Position length) { - Sci_Position len = 0; - while (++len < length) { - const int ch = sc.GetRelativeCharacter(len); - if (!IsASpaceOrTab(ch) && !IsANewLine(ch)) { - break; - } - } - return len; -} - -/* - * GetRelativeString - * - gets a relitive string and sets it in &str - * - resets string before seting - */ -void GetRelativeString(StyleContext &sc, Sci_Position offset, Sci_Position length, - std::string &str) { - Sci_Position pos = offset; - str.clear(); - while (pos < length) { - str += sc.GetRelativeCharacter(pos++); - } -} - -} // end anonymous namespace - -/*----------------------------------------------------------------------------* - * --- class: LexerRaku --- - *----------------------------------------------------------------------------*/ -//class LexerRaku : public ILexerWithMetaData { -class LexerRaku : public DefaultLexer { - CharacterSet setWord; - CharacterSet setSigil; - CharacterSet setTwigil; - CharacterSet setOperator; - CharacterSet setSpecialVar; - WordList regexIdent; // identifiers that specify a regex - OptionsRaku options; // Options from config - OptionSetRaku osRaku; - WordList keywords; // Word Lists from config - WordList functions; - WordList typesBasic; - WordList typesComposite; - WordList typesDomainSpecific; - WordList typesExceptions; - WordList adverbs; - -public: - // Defined as explicit, so that constructor can not be copied - explicit LexerRaku() : - DefaultLexer("raku", SCLEX_RAKU), - setWord(CharacterSet::setAlphaNum, "-_", 0x80), - setSigil(CharacterSet::setNone, "$&%@"), - setTwigil(CharacterSet::setNone, "!*.:<=?^~"), - setOperator(CharacterSet::setNone, "^&\\()-+=|{}[]:;<>,?!.~"), - setSpecialVar(CharacterSet::setNone, "_/!") { - regexIdent.Set("regex rule token"); - } - // Deleted so LexerRaku objects can not be copied. - LexerRaku(const LexerRaku &) = delete; - LexerRaku(LexerRaku &&) = delete; - void operator=(const LexerRaku &) = delete; - void operator=(LexerRaku &&) = delete; - virtual ~LexerRaku() { - } - void SCI_METHOD Release() noexcept override { - delete this; - } - int SCI_METHOD Version() const noexcept override { - return lvRelease5; - } - const char *SCI_METHOD PropertyNames() override { - return osRaku.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) override { - return osRaku.PropertyType(name); - } - const char *SCI_METHOD DescribeProperty(const char *name) override { - return osRaku.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; - const char *SCI_METHOD PropertyGet(const char *key) override { - return osRaku.PropertyGet(key); - } - const char *SCI_METHOD DescribeWordListSets() override { - return osRaku.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; - - static ILexer5 *LexerFactoryRaku() { - return new LexerRaku(); - } - -protected: - bool IsOperatorChar(const int ch); - bool IsWordChar(const int ch, bool allowNumber = true); - bool IsWordStartChar(const int ch); - bool IsNumberChar(const int ch, int base = 10); - bool ProcessRegexTwinCapture(StyleContext &sc, const Sci_Position length, - int &type, const DelimPair &dp); - void ProcessStringVars(StyleContext &sc, const Sci_Position length, const int varState); - bool ProcessValidRegQlangStart(StyleContext &sc, Sci_Position length, const int type, - WordList &wordsAdverbs, DelimPair &dp); - Sci_Position LengthToNonWordChar(StyleContext &sc, Sci_Position length, - char *s, const int size, Sci_Position offset = 0); -}; - -/*----------------------------------------------------------------------------* - * --- METHODS: LexerRaku --- - *----------------------------------------------------------------------------*/ - -/* - * LexerRaku::IsOperatorChar - * - Test for both ASCII and Unicode operators - * see: https://docs.raku.org/language/unicode_entry - */ -bool LexerRaku::IsOperatorChar(const int ch) { - if (ch > 0x7F) { - switch (ch) { - // Unicode ASCII Equiv. - case 0x2208: // (elem) - case 0x2209: // !(elem) - case 0x220B: // (cont) - case 0x220C: // !(cont) - case 0x2216: // (-) - case 0x2229: // (&) - case 0x222A: // (|) - case 0x2282: // (<) - case 0x2283: // (>) - case 0x2284: // !(<) - case 0x2285: // !(>) - case 0x2286: // (<=) - case 0x2287: // (>=) - case 0x2288: // !(<=) - case 0x2289: // !(>=) - case 0x228D: // (.) - case 0x228E: // (+) - case 0x2296: // (^) - return true; - } - } - return setOperator.Contains(ch); -} - -/* - * LexerRaku::IsWordChar - * - Test for both ASCII and Unicode identifier characters - * see: https://docs.raku.org/language/unicode_ascii - * also: ftp://ftp.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt - * FIXME: *still* may not contain all valid characters - */ -bool LexerRaku::IsWordChar(const int ch, bool allowNumber) { - // Unicode numbers should not apear in word identifiers - if (ch > 0x7F) { - const CharacterCategory cc = CategoriseCharacter(ch); - switch (cc) { - // Letters - case ccLu: - case ccLl: - case ccLt: - case ccLm: - case ccLo: - return true; - default: - return false; - } - } else if (allowNumber && IsADigit(ch)) { - return true; // an ASCII number type - } - return setWord.Contains(ch); -} - -/* - * LexerRaku::IsWordStartChar - * - Test for both ASCII and Unicode identifier "start / first" characters - */ -bool LexerRaku::IsWordStartChar(const int ch) { - return ch != '-' && IsWordChar(ch, false); // no numbers allowed -} - -/* - * LexerRaku::IsNumberChar - * - Test for both ASCII and Unicode identifier number characters - * see: https://docs.raku.org/language/unicode_ascii - * also: ftp://ftp.unicode.org/Public/UCD/latest/ucd/UnicodeData.txt - * FILTERED by Unicode letters that are NUMBER - * and NOT PARENTHESIZED or CIRCLED - * FIXME: *still* may not contain all valid number characters - */ -bool LexerRaku::IsNumberChar(const int ch, int base) { - if (ch > 0x7F) { - const CharacterCategory cc = CategoriseCharacter(ch); - switch (cc) { - // Numbers - case ccNd: - case ccNl: - case ccNo: - return true; - default: - return false; - } - } - return IsADigit(ch, base); -} - -/* - * LexerRaku::PropertySet - * - - */ -Sci_Position SCI_METHOD LexerRaku::PropertySet(const char *key, const char *val) { - if (osRaku.PropertySet(&options, key, val)) - return 0; - return -1; -} - -/* - * LexerRaku::WordListSet - * - - */ -Sci_Position SCI_METHOD LexerRaku::WordListSet(int n, const char *wl) { - WordList *wordListN = nullptr; - switch (n) { - case 0: - wordListN = &keywords; - break; - case 1: - wordListN = &functions; - break; - case 2: - wordListN = &typesBasic; - break; - case 3: - wordListN = &typesComposite; - break; - case 4: - wordListN = &typesDomainSpecific; - break; - case 5: - wordListN = &typesExceptions; - break; - case 6: - wordListN = &adverbs; - break; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - } - } - return firstModification; -} - -/* - * LexerRaku::ProcessRegexTwinCapture - * - processes the transition between a regex pair (two sets of delimiters) - * - moves to first new delimiter, if a bracket - * - returns true when valid delimiter start found (if bracket) - */ -bool LexerRaku::ProcessRegexTwinCapture(StyleContext &sc, const Sci_Position length, - int &type, const DelimPair &dp) { - - if (type == RAKUTYPE_REGEX_S || type == RAKUTYPE_REGEX_TR || type == RAKUTYPE_REGEX_Y) { - type = -1; // clear type - - // move past chRegQClose if it was the previous char - if (dp.isCloser(sc.chPrev)) - sc.Forward(); - - // no processing needed for non-bracket - if (dp.isCloser(dp.opener)) - return true; - - // move to next opening bracket - const Sci_Position len = LengthToNextChar(sc, length); - if (sc.GetRelativeCharacter(len) == dp.opener) { - sc.Forward(len); - return true; - } - } - return false; -} - -/* - * LexerRaku::ProcessStringVars - * - processes a string and highlights any valid variables - */ -void LexerRaku::ProcessStringVars(StyleContext &sc, const Sci_Position length, const int varState) { - const int state = sc.state; - for (Sci_Position pos = 0; pos < length; pos++) { - if (sc.state == varState && !IsWordChar(sc.ch)) { - sc.SetState(state); - } else if (sc.chPrev != '\\' - && (sc.ch == '$' || sc.ch == '@') - && IsWordStartChar(sc.chNext)) { - sc.SetState(varState); - } - sc.Forward(); // Next character - } -} -/* - * LexerRaku::ProcessValidRegQlangStart - * - processes a section of the document range from after a Regex / Q delimiter - * - returns true on success - * - sets: adverbs, chOpen, chClose, chCount - * ref: https://docs.raku.org/language/regexes - */ -bool LexerRaku::ProcessValidRegQlangStart(StyleContext &sc, Sci_Position length, const int type, - WordList &wordsAdverbs, DelimPair &dp) { - Sci_Position startPos = sc.currentPos; - Sci_Position startLen = length; - const int target_state = sc.state; - int state = SCE_RAKU_DEFAULT; - std::string str; - - // find our opening delimiter (and occurrences) / save any adverbs - dp.opener = 0; // adverbs can be after the first delimiter - bool got_all_adverbs = false; // in Regex statements - bool got_ident = false; // regex can have an identifier: 'regex R' - sc.SetState(state); // set state default to avoid pre-highlights - while ((dp.opener == 0 || !got_all_adverbs) && sc.More()) { - - // move to the next non-space character - const bool was_space = IsAWhitespace(sc.ch); - if (!got_all_adverbs && was_space) { - sc.Forward(LengthToNextChar(sc, length)); - } - length = startLen - (sc.currentPos - startPos); // update length remaining - - // parse / eat an identifier (if type == RAKUTYPE_REGEX) - if (dp.opener == 0 && !got_ident && type == RAKUTYPE_REGEX && IsAlphabet(sc.ch)) { - - // eat identifier / account for special adverb :sym<name> - bool got_sym = false; - while (sc.More()) { - sc.SetState(SCE_RAKU_IDENTIFIER); - while (sc.More() && (IsAlphaNumeric(sc.chNext) - || sc.chNext == '_' || sc.chNext == '-')) { - sc.Forward(); - } - sc.Forward(); - if (got_sym && sc.ch == '>') { - sc.SetState(SCE_RAKU_OPERATOR); // '>' - sc.Forward(); - break; - } else if (type == RAKUTYPE_REGEX && sc.Match(":sym<")) { - sc.SetState(SCE_RAKU_ADVERB); // ':sym' - sc.Forward(4); - sc.SetState(SCE_RAKU_OPERATOR); // '<' - sc.Forward(); - got_sym = true; - } else { - break; - } - } - sc.SetState(state); - got_ident = true; - } - - // parse / save an adverb: RAKUTYPE_REGEX only has adverbs after delim - // >= RAKUTYPE_QLANG only has adverbs before delim - else if (!got_all_adverbs && sc.ch == ':' && (!(dp.opener == 0 && got_ident) - && !(dp.opener > 0 && type >= RAKUTYPE_QLANG))) { - sc.SetState(SCE_RAKU_ADVERB); - while (IsAlphaNumeric(sc.chNext) && sc.More()) { - sc.Forward(); - str += sc.ch; - } - str += ' '; - sc.Forward(); - sc.SetState(state); - } - - // find starting delimiter - else if (dp.opener == 0 && (was_space || IsValidRegOrQAdjacent(sc.ch)) - && IsValidDelimiter(sc.ch)) { // make sure the delimiter is legal (most are) - sc.SetState((state = target_state));// start state here... - dp.opener = sc.ch; // this is our delimiter, get count - if (type < RAKUTYPE_QLANG) // type is Regex - dp.count = 1; // has only one delimiter - else - dp.count = GetRepeatCharCount(sc, dp.opener, length); - sc.Forward(dp.count); - } - - // we must have all the adverbs by now... - else { - if (got_all_adverbs) - break; // prevent infinite loop: occurs on missing open char - got_all_adverbs = true; - } - } - - // set word list / find a valid closing delimiter (or bomb!) - wordsAdverbs.Set(str.c_str()); - dp.closer[0] = GetDelimiterCloseChar(dp.opener); - dp.closer[1] = 0; // no other closer char - return dp.closer[0] > 0; -} - -/* - * LexerRaku::LengthToNonWordChar - * - returns the length until the next non "word" character: AlphaNum + '_' - * - also sets all the parsed chars in 's' - */ -Sci_Position LexerRaku::LengthToNonWordChar(StyleContext &sc, Sci_Position length, - char *s, const int size, Sci_Position offset) { - Sci_Position len = 0; - Sci_Position max_length = size < length ? size : length; - while (len <= max_length) { - const int ch = sc.GetRelativeCharacter(len + offset); - if (!IsWordChar(ch)) { - s[len] = '\0'; - break; - } - s[len] = ch; - len++; - } - s[len + 1] = '\0'; - return len; -} - -/* - * LexerRaku::Lex - * - Main lexer method - */ -void SCI_METHOD LexerRaku::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - LexAccessor styler(pAccess); - DelimPair dpEmbeded; // delimiter pair: embeded comments - DelimPair dpString; // delimiter pair: string - DelimPair dpRegQ; // delimiter pair: Regex / Q Lang - std::string hereDelim; // heredoc delimiter (if in heredoc) - int hereState = 0; // heredoc state to use (Q / QQ) - int numState = 0; // number state / type - short cntDecimal = 0; // number decinal count - std::string wordLast; // last word seen - std::string identLast; // last identifier seen - std::string adverbLast; // last (single) adverb seen - WordList lastAdverbs; // last adverbs seen - Sci_Position len; // temp length value - char s[100]; // temp char string - int typeDetect; // temp type detected (for regex and Q lang) - Sci_Position lengthToEnd; // length until the end of range - - // Backtrack to last SCE_RAKU_DEFAULT or 0 - Sci_PositionU newStartPos = startPos; - if (initStyle != SCE_RAKU_DEFAULT) { - while (newStartPos > 0) { - newStartPos--; - if (styler.StyleAt(newStartPos) == SCE_RAKU_DEFAULT) - break; - } - } - - // Backtrack to start of line before SCE_RAKU_HEREDOC_Q? - if (initStyle == SCE_RAKU_HEREDOC_Q || initStyle == SCE_RAKU_HEREDOC_QQ) { - while (newStartPos > 0) { - if (IsANewLine(styler.SafeGetCharAt(newStartPos - 1))) - break; // Stop if previous char is a new line - newStartPos--; - } - } - - // Re-calculate (any) changed startPos, length and initStyle state - if (newStartPos < startPos) { - initStyle = SCE_RAKU_DEFAULT; - length += startPos - newStartPos; - startPos = newStartPos; - } - - // init StyleContext - StyleContext sc(startPos, length, initStyle, styler); - - // StyleContext Loop - for (; sc.More(); sc.Forward()) { - lengthToEnd = (length - (sc.currentPos - startPos)); // end of range - - /* *** Determine if the current state should terminate ************** * - * Everything within the 'switch' statement processes characters up - * until the end of a syntax highlight section / state. - * ****************************************************************** */ - switch (sc.state) { - case SCE_RAKU_OPERATOR: - sc.SetState(SCE_RAKU_DEFAULT); - break; // FIXME: better valid operator sequences needed? - case SCE_RAKU_COMMENTLINE: - if (IsANewLine(sc.ch)) { - sc.SetState(SCE_RAKU_DEFAULT); - } - break; - case SCE_RAKU_COMMENTEMBED: - if ((len = LengthToDelimiter(sc, dpEmbeded, lengthToEnd)) >= 0) { - sc.Forward(len); // Move to end delimiter - sc.SetState(SCE_RAKU_DEFAULT); - } else { - sc.Forward(lengthToEnd); // no end delimiter found - } - break; - case SCE_RAKU_POD: - if (sc.atLineStart && sc.Match("=end pod")) { - sc.Forward(8); - sc.SetState(SCE_RAKU_DEFAULT); - } - break; - case SCE_RAKU_STRING: - - // Process the string for variables: move to end delimiter - if ((len = LengthToDelimiter(sc, dpString, lengthToEnd)) >= 0) { - if (dpString.interpol) { - ProcessStringVars(sc, len, SCE_RAKU_STRING_VAR); - } else { - sc.Forward(len); - } - sc.SetState(SCE_RAKU_DEFAULT); - } else { - sc.Forward(lengthToEnd); // no end delimiter found - } - break; - case SCE_RAKU_STRING_Q: - case SCE_RAKU_STRING_QQ: - case SCE_RAKU_STRING_Q_LANG: - - // No string: previous char was the delimiter - if (dpRegQ.count == 1 && dpRegQ.isCloser(sc.chPrev)) { - sc.SetState(SCE_RAKU_DEFAULT); - } - - // Process the string for variables: move to end delimiter - else if ((len = LengthToDelimiter(sc, dpRegQ, lengthToEnd)) >= 0) { - - // set (any) heredoc delimiter string - if (lastAdverbs.InList("to")) { - GetRelativeString(sc, -1, len - dpRegQ.count, hereDelim); - hereState = SCE_RAKU_HEREDOC_Q; // default heredoc state - } - - // select variable identifiers - if (sc.state == SCE_RAKU_STRING_QQ || lastAdverbs.InList("qq")) { - ProcessStringVars(sc, len, SCE_RAKU_STRING_VAR); - hereState = SCE_RAKU_HEREDOC_QQ; // potential heredoc state - } else { - sc.Forward(len); - } - sc.SetState(SCE_RAKU_DEFAULT); - } else { - sc.Forward(lengthToEnd); // no end delimiter found - } - break; - case SCE_RAKU_HEREDOC_Q: - case SCE_RAKU_HEREDOC_QQ: - if ((len = LengthToEndHeredoc(sc, styler, lengthToEnd, hereDelim.c_str())) >= 0) { - // select variable identifiers - if (sc.state == SCE_RAKU_HEREDOC_QQ) { - ProcessStringVars(sc, len, SCE_RAKU_STRING_VAR); - } else { - sc.Forward(len); - } - sc.SetState(SCE_RAKU_DEFAULT); - } else { - sc.Forward(lengthToEnd); // no end delimiter found - } - hereDelim.clear(); // clear heredoc delimiter - break; - case SCE_RAKU_REGEX: - // account for typeDetect = RAKUTYPE_REGEX_S/TR/Y - while (sc.state == SCE_RAKU_REGEX) { - - // No string: previous char was the delimiter - if (dpRegQ.count == 1 && dpRegQ.isCloser(sc.chPrev)) { - if (ProcessRegexTwinCapture(sc, lengthToEnd, typeDetect, dpRegQ)) - continue; - sc.SetState(SCE_RAKU_DEFAULT); - break; - } - - // Process the string for variables: move to end delimiter - else if ((len = LengthToDelimiter(sc, dpRegQ, lengthToEnd)) >= 0) { - ProcessStringVars(sc, len, SCE_RAKU_REGEX_VAR); - if (ProcessRegexTwinCapture(sc, lengthToEnd, typeDetect, dpRegQ)) - continue; - sc.SetState(SCE_RAKU_DEFAULT); - break; - } else { - sc.Forward(lengthToEnd); // no end delimiter found - break; - } - } - break; - case SCE_RAKU_NUMBER: - if (sc.ch == '.') { - if (sc.chNext == '.') { // '..' is an operator - sc.SetState(SCE_RAKU_OPERATOR); - sc.Forward(); - if (sc.chNext == '.') // '...' is also an operator - sc.Forward(); - break; - } else if (numState > RAKUNUM_FLOAT_EXP - && (cntDecimal < 1 || numState == RAKUNUM_VERSION)) { - cntDecimal++; - sc.Forward(); - } else { - sc.SetState(SCE_RAKU_DEFAULT); - break; // too many decinal places - } - } - switch (numState) { - case RAKUNUM_BINARY: - if (!IsNumberChar(sc.ch, 2)) - sc.SetState(SCE_RAKU_DEFAULT); - break; - case RAKUNUM_OCTAL: - if (!IsNumberChar(sc.ch, 8)) - sc.SetState(SCE_RAKU_DEFAULT); - break; - case RAKUNUM_HEX: - if (!IsNumberChar(sc.ch, 16)) - sc.SetState(SCE_RAKU_DEFAULT); - break; - case RAKUNUM_DECIMAL: - case RAKUNUM_VERSION: - if (!IsNumberChar(sc.ch)) - sc.SetState(SCE_RAKU_DEFAULT); - } - break; - case SCE_RAKU_WORD: - case SCE_RAKU_FUNCTION: - case SCE_RAKU_TYPEDEF: - case SCE_RAKU_ADVERB: - sc.SetState(SCE_RAKU_DEFAULT); - break; - case SCE_RAKU_MU: - case SCE_RAKU_POSITIONAL: - case SCE_RAKU_ASSOCIATIVE: - case SCE_RAKU_CALLABLE: - case SCE_RAKU_IDENTIFIER: - case SCE_RAKU_GRAMMAR: - case SCE_RAKU_CLASS: - sc.SetState(SCE_RAKU_DEFAULT); - break; - } - - /* *** Determine if a new state should be entered ******************* * - * Everything below here identifies the beginning of a state, all or part - * of the characters within this state are processed here, the rest are - * completed above in the terminate state section. - * ****************************************************************** */ - if (sc.state == SCE_RAKU_DEFAULT) { - - // --- Single line comment - if (sc.ch == '#') { - sc.SetState(SCE_RAKU_COMMENTLINE); - } - - // --- POD block - else if (sc.atLineStart && sc.Match("=begin pod")) { - sc.SetState(SCE_RAKU_POD); - sc.Forward(10); - } - - // --- String (normal) - else if (sc.chPrev != '\\' && (IsValidQuoteOpener(sc.ch, dpString, RAKUDELIM_QUOTE))) { - sc.SetState(SCE_RAKU_STRING); - } - - // --- String (Q Language) ---------------------------------------- - // - https://docs.raku.org/language/quoting - // - Q :adverb :adverb //; - // - q,qx,qw,qq,qqx,qqw,qqww :adverb :adverb //; - else if (IsQLangStartAtScPos(sc, typeDetect, lengthToEnd)) { - int state = SCE_RAKU_STRING_Q_LANG; - Sci_Position forward = 1; // single char ident (default) - if (typeDetect > RAKUTYPE_QLANG) { - state = SCE_RAKU_STRING_Q; - if (typeDetect == RAKUTYPE_STR_WQ) - forward = 0; // no char ident - } - if (typeDetect > RAKUTYPE_STR_Q) { - if (typeDetect == RAKUTYPE_STR_QQ) - state = SCE_RAKU_STRING_QQ; - forward++; // two char ident - } - if (typeDetect > RAKUTYPE_STR_QQ) - forward++; // three char ident - if (typeDetect == RAKUTYPE_STR_QQWW) - forward++; // four char ident - - // Proceed: check for a valid character after statement - if (IsValidRegOrQAdjacent(sc.GetRelative(forward)) || typeDetect == RAKUTYPE_QLANG) { - sc.SetState(state); - sc.Forward(forward); - lastAdverbs.Clear(); - - // Process: adverbs / opening delimiter / adverbs after delim - if (ProcessValidRegQlangStart(sc, lengthToEnd, typeDetect, - lastAdverbs, dpRegQ)) - sc.SetState(state); - } - } - - // --- Regex (rx/s/m/tr/y) ---------------------------------------- - // - https://docs.raku.org/language/regexes - else if ((IsRegexStartAtScPos(sc, typeDetect, setOperator) || regexIdent.InList(wordLast.c_str()))) { - if (typeDetect == -1) { // must be a regex identifier word - wordLast.clear(); - typeDetect = RAKUTYPE_REGEX; - } - Sci_Position forward = 0; // no ident (RAKUTYPE_REGEX, RAKUTYPE_REGEX_NORM) - if (typeDetect > 0 && typeDetect != RAKUTYPE_REGEX) - forward++; // single char ident - if (typeDetect > RAKUTYPE_REGEX) - forward++; // two char ident - - // Proceed: check for a valid character after statement - if (IsValidRegOrQAdjacent(sc.GetRelative(forward)) || typeDetect == RAKUTYPE_REGEX_NORM) { - sc.SetState(SCE_RAKU_REGEX); - sc.Forward(forward); - lastAdverbs.Clear(); - - // Process: adverbs / opening delimiter / adverbs after delim - if (ProcessValidRegQlangStart(sc, lengthToEnd, typeDetect, - lastAdverbs, dpRegQ)) - sc.SetState(SCE_RAKU_REGEX); - } - } - - // --- Numbers ---------------------------------------------------- - else if (IsValidIdentPrecede(sc.chPrev) && (IsNumberChar(sc.ch) - || (sc.ch == 'v' && IsNumberChar(sc.chNext) && wordLast == "use"))) { - numState = RAKUNUM_DECIMAL; // default: decimal (base 10) - cntDecimal = 0; - sc.SetState(SCE_RAKU_NUMBER); - if (sc.ch == 'v') // forward past 'v' - sc.Forward(); - if (wordLast == "use") { // package version number - numState = RAKUNUM_VERSION; - } else if (sc.ch == '0') { // other type of number - switch (sc.chNext) { - case 'b': // binary (base 2) - numState = RAKUNUM_BINARY; - break; - case 'o': // octal (base 8) - numState = RAKUNUM_OCTAL; - break; - case 'x': // hexadecimal (base 16) - numState = RAKUNUM_HEX; - } - if (numState != RAKUNUM_DECIMAL) - sc.Forward(); // forward to number type char - } - } - - // --- Keywords / functions / types / barewords ------------------- - else if ((sc.currentPos == 0 || sc.atLineStart || IsValidIdentPrecede(sc.chPrev)) - && IsWordStartChar(sc.ch)) { - len = LengthToNonWordChar(sc, lengthToEnd, s, sizeof(s)); - if (keywords.InList(s)) { - sc.SetState(SCE_RAKU_WORD); // Keywords - } else if(functions.InList(s)) { - sc.SetState(SCE_RAKU_FUNCTION); // Functions - } else if(typesBasic.InList(s)) { - sc.SetState(SCE_RAKU_TYPEDEF); // Types (basic) - } else if(typesComposite.InList(s)) { - sc.SetState(SCE_RAKU_TYPEDEF); // Types (composite) - } else if(typesDomainSpecific.InList(s)) { - sc.SetState(SCE_RAKU_TYPEDEF); // Types (domain-specific) - } else if(typesExceptions.InList(s)) { - sc.SetState(SCE_RAKU_TYPEDEF); // Types (exceptions) - } else { - if (wordLast == "class") - sc.SetState(SCE_RAKU_CLASS); // a Class ident - else if (wordLast == "grammar") - sc.SetState(SCE_RAKU_GRAMMAR); // a Grammar ident - else - sc.SetState(SCE_RAKU_IDENTIFIER); // Bareword - identLast = s; // save identifier - } - if (adverbLast == "sym") { // special adverb ":sym" - sc.SetState(SCE_RAKU_IDENTIFIER); // treat as identifier - identLast = s; // save identifier - } - if (sc.state != SCE_RAKU_IDENTIFIER) - wordLast = s; // save word - sc.Forward(len - 1); // ...forward past word - } - - // --- Adverbs ---------------------------------------------------- - else if (sc.ch == ':' && IsWordStartChar(sc.chNext)) { - len = LengthToNonWordChar(sc, lengthToEnd, s, sizeof(s), 1); - if (adverbs.InList(s)) { - sc.SetState(SCE_RAKU_ADVERB); // Adverbs (begin with ':') - adverbLast = s; // save word - sc.Forward(len); // ...forward past word (less offset: 1) - } - } - - // --- Identifiers: $mu / @positional / %associative / &callable -- - // see: https://docs.raku.org/language/variables - else if (setSigil.Contains(sc.ch) && (setTwigil.Contains(sc.chNext) - || setSpecialVar.Contains(sc.chNext) - || IsWordStartChar(sc.chNext))) { - - // State based on sigil - switch (sc.ch) { - case '$': sc.SetState(SCE_RAKU_MU); - break; - case '@': sc.SetState(SCE_RAKU_POSITIONAL); - break; - case '%': sc.SetState(SCE_RAKU_ASSOCIATIVE); - break; - case '&': sc.SetState(SCE_RAKU_CALLABLE); - } - const int state = sc.state; - sc.Forward(); - char ch_delim = 0; - if (setSpecialVar.Contains(sc.ch) - && !setWord.Contains(sc.chNext)) { // Process Special Var - ch_delim = -1; - } else if (setTwigil.Contains(sc.ch)) { // Process Twigil - sc.SetState(SCE_RAKU_OPERATOR); - if (sc.ch == '<' && setWord.Contains(sc.chNext)) - ch_delim = '>'; - sc.Forward(); - sc.SetState(state); - } - - // Process (any) identifier - if (ch_delim >= 0) { - sc.Forward(LengthToNonWordChar(sc, lengthToEnd, s, sizeof(s)) - 1); - if (ch_delim > 0 && sc.chNext == ch_delim) { - sc.Forward(); - sc.SetState(SCE_RAKU_OPERATOR); - } - identLast = s; // save identifier - } - } - - // --- Operators -------------------------------------------------- - else if (IsOperatorChar(sc.ch)) { - // FIXME: better valid operator sequences needed? - sc.SetState(SCE_RAKU_OPERATOR); - } - - // --- Heredoc: begin --------------------------------------------- - else if (!hereDelim.empty() && sc.atLineEnd) { - if (IsANewLine(sc.ch)) - sc.Forward(); // skip a possible CRLF situation - sc.SetState(hereState); - } - - // Reset words: on operator simi-colon OR '}' (end of statement) - if (sc.state == SCE_RAKU_OPERATOR && (sc.ch == ';' || sc.ch == '}')) { - wordLast.clear(); - identLast.clear(); - adverbLast.clear(); - } - } - - /* *** Determine if an "embedded comment" is to be entered ********** * - * This type of embedded comment section, or multi-line comment comes - * after a normal comment has begun... e.g: #`[ ... ] - * ****************************************************************** */ - else if (sc.state == SCE_RAKU_COMMENTLINE && sc.chPrev == '#' && sc.ch == '`') { - if (IsBracketOpenChar(sc.chNext)) { - sc.Forward(); // Condition met for "embedded comment" - dpEmbeded.opener = sc.ch; - - // Find the opposite (termination) closeing bracket (if any) - dpEmbeded.closer[0] = GetBracketCloseChar(dpEmbeded.opener); - if (dpEmbeded.closer[0] > 0) { // Enter "embedded comment" - - // Find multiple opening character occurence - dpEmbeded.count = GetRepeatCharCount(sc, dpEmbeded.opener, lengthToEnd); - sc.SetState(SCE_RAKU_COMMENTEMBED); - sc.Forward(dpEmbeded.count - 1); // incremented in the next loop - } - } - } - } - - // And we're done... - sc.Complete(); -} - -/* - * LexerRaku::Lex - * - Main fold method - * NOTE: although Raku uses and supports UNICODE characters, we're only looking - * at normal chars here, using 'SafeGetCharAt' - for folding purposes - * that is all we need. - */ -#define RAKU_HEADFOLD_SHIFT 4 -#define RAKU_HEADFOLD_MASK 0xF0 -void SCI_METHOD LexerRaku::Fold(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, IDocument *pAccess) { - - // init LexAccessor / return if fold option is off - if (!options.fold) return; - LexAccessor styler(pAccess); - - // init char and line positions - const Sci_PositionU endPos = startPos + length; - Sci_Position lineCurrent = styler.GetLine(startPos); - - // Backtrack to last SCE_RAKU_DEFAULT line - if (startPos > 0 && lineCurrent > 0) { - while (lineCurrent > 0 && styler.StyleAt(startPos) != SCE_RAKU_DEFAULT) { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); - } - lineCurrent = styler.GetLine(startPos); - } - Sci_PositionU lineStart = startPos; - Sci_PositionU lineStartNext = styler.LineStart(lineCurrent + 1); - - // init line folding level - int levelPrev = SC_FOLDLEVELBASE; - if (lineCurrent > 0) - levelPrev = styler.LevelAt(lineCurrent - 1) >> 16; - int levelCurrent = levelPrev; - - // init char and style variables - char chNext = styler[startPos]; - int stylePrev = styler.StyleAt(startPos - 1); - int styleNext = styler.StyleAt(startPos); - int styleNextStartLine = styler.StyleAt(lineStartNext); - int visibleChars = 0; - bool wasCommentMulti = false; - - // main loop - for (Sci_PositionU i = startPos; i < endPos; i++) { - - // next char, style and flags - const char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - const int style = styleNext; - styleNext = styler.StyleAt(i + 1); - const bool atEOL = i == (lineStartNext - 1); - const bool atLineStart = i == lineStart; - - // --- Comments / Multi-line / POD ------------------------------------ - if (options.foldComment) { - - // Multi-line - if (options.foldCommentMultiline) { - if (style == SCE_RAKU_COMMENTLINE && atLineStart && ch == '#' && chNext == '`' - && styleNextStartLine == SCE_RAKU_COMMENTEMBED) { - levelCurrent++; - wasCommentMulti = true; // don't confuse line comments - } else if (style == SCE_RAKU_COMMENTEMBED && atLineStart - && styleNextStartLine != SCE_RAKU_COMMENTEMBED) { - levelCurrent--; - } - } - - // Line comments - if (!wasCommentMulti && atEOL && stylePrev == SCE_RAKU_COMMENTLINE - && IsCommentLine(lineCurrent, styler)) { - if (!IsCommentLine(lineCurrent - 1, styler) - && IsCommentLine(lineCurrent + 1, styler)) - levelCurrent++; - else if (IsCommentLine(lineCurrent - 1, styler) - && !IsCommentLine(lineCurrent + 1, styler)) - levelCurrent--; - } - - // POD - if (options.foldCommentPOD && atLineStart && style == SCE_RAKU_POD) { - if (styler.Match(i, "=begin")) - levelCurrent++; - else if (styler.Match(i, "=end")) - levelCurrent--; - } - } - - // --- Code block ----------------------------------------------------- - if (style == SCE_RAKU_OPERATOR) { - if (ch == '{') { - if (levelCurrent < levelPrev) levelPrev--; - levelCurrent++; - } else if (ch == '}') { - levelCurrent--; - } - } - - // --- at end of line / range / apply fold ---------------------------- - if (atEOL) { - int level = levelPrev; - - // set level flags - level |= levelCurrent << 16; - if (visibleChars == 0 && options.foldCompact) - level |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - level |= SC_FOLDLEVELHEADERFLAG; - if (level != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, level); - } - lineCurrent++; - lineStart = lineStartNext; - lineStartNext = styler.LineStart(lineCurrent + 1); - styleNextStartLine = styler.StyleAt(lineStartNext); - levelPrev = levelCurrent; - visibleChars = 0; - wasCommentMulti = false; - } - - // increment visibleChars / set previous char - if (!isspacechar(ch)) - visibleChars++; - stylePrev = style; - } - - // Done: set real level of the next line - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); -} - -/*----------------------------------------------------------------------------* - * --- Scintilla: LexerModule --- - *----------------------------------------------------------------------------*/ - -LexerModule lmRaku(SCLEX_RAKU, LexerRaku::LexerFactoryRaku, "raku", rakuWordLists); diff --git a/lexers/LexRebol.cxx b/lexers/LexRebol.cxx deleted file mode 100644 index d4973c0c8..000000000 --- a/lexers/LexRebol.cxx +++ /dev/null @@ -1,323 +0,0 @@ -// Scintilla source code edit control -/** @file LexRebol.cxx - ** Lexer for REBOL. - ** Written by Pascal Hurni, inspired from LexLua by Paul Winwood & Marcos E. Wurzius & Philippe Lhoste - ** - ** History: - ** 2005-04-07 First release. - ** 2005-04-10 Closing parens and brackets go now in default style - ** String and comment nesting should be more safe - **/ -// Copyright 2005 by Pascal Hurni <pascal_hurni@fastmail.fm> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool IsAWordChar(const int ch) { - return (isalnum(ch) || ch == '?' || ch == '!' || ch == '.' || ch == '\'' || ch == '+' || ch == '-' || ch == '*' || ch == '&' || ch == '|' || ch == '=' || ch == '_' || ch == '~'); -} - -static inline bool IsAWordStart(const int ch, const int ch2) { - return ((ch == '+' || ch == '-' || ch == '.') && !isdigit(ch2)) || - (isalpha(ch) || ch == '?' || ch == '!' || ch == '\'' || ch == '*' || ch == '&' || ch == '|' || ch == '=' || ch == '_' || ch == '~'); -} - -static inline bool IsAnOperator(const int ch, const int ch2, const int ch3) { - // One char operators - if (IsASpaceOrTab(ch2)) { - return ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '<' || ch == '>' || ch == '=' || ch == '?'; - } - - // Two char operators - if (IsASpaceOrTab(ch3)) { - return (ch == '*' && ch2 == '*') || - (ch == '/' && ch2 == '/') || - (ch == '<' && (ch2 == '=' || ch2 == '>')) || - (ch == '>' && ch2 == '=') || - (ch == '=' && (ch2 == '=' || ch2 == '?')) || - (ch == '?' && ch2 == '?'); - } - - return false; -} - -static inline bool IsBinaryStart(const int ch, const int ch2, const int ch3, const int ch4) { - return (ch == '#' && ch2 == '{') || - (IsADigit(ch) && ch2 == '#' && ch3 == '{' ) || - (IsADigit(ch) && IsADigit(ch2) && ch3 == '#' && ch4 == '{' ); -} - - -static void ColouriseRebolDoc(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]; - - Sci_Position currentLine = styler.GetLine(startPos); - // Initialize the braced string {.. { ... } ..} nesting level, if we are inside such a string. - int stringLevel = 0; - if (initStyle == SCE_REBOL_BRACEDSTRING || initStyle == SCE_REBOL_COMMENTBLOCK) { - stringLevel = styler.GetLineState(currentLine - 1); - } - - bool blockComment = initStyle == SCE_REBOL_COMMENTBLOCK; - int dotCount = 0; - - // Do not leak onto next line - if (initStyle == SCE_REBOL_COMMENTLINE) { - initStyle = SCE_REBOL_DEFAULT; - } - - StyleContext sc(startPos, length, initStyle, styler); - if (startPos == 0) { - sc.SetState(SCE_REBOL_PREFACE); - } - for (; sc.More(); sc.Forward()) { - - //--- What to do at line end ? - if (sc.atLineEnd) { - // Can be either inside a {} string or simply at eol - if (sc.state != SCE_REBOL_BRACEDSTRING && sc.state != SCE_REBOL_COMMENTBLOCK && - sc.state != SCE_REBOL_BINARY && sc.state != SCE_REBOL_PREFACE) - sc.SetState(SCE_REBOL_DEFAULT); - - // Update the line state, so it can be seen by next line - currentLine = styler.GetLine(sc.currentPos); - switch (sc.state) { - case SCE_REBOL_BRACEDSTRING: - case SCE_REBOL_COMMENTBLOCK: - // Inside a braced string, we set the line state - styler.SetLineState(currentLine, stringLevel); - break; - default: - // Reset the line state - styler.SetLineState(currentLine, 0); - break; - } - - // continue with next char - continue; - } - - //--- What to do on white-space ? - if (IsASpaceOrTab(sc.ch)) - { - // Return to default if any of these states - if (sc.state == SCE_REBOL_OPERATOR || sc.state == SCE_REBOL_CHARACTER || - sc.state == SCE_REBOL_NUMBER || sc.state == SCE_REBOL_PAIR || - sc.state == SCE_REBOL_TUPLE || sc.state == SCE_REBOL_FILE || - sc.state == SCE_REBOL_DATE || sc.state == SCE_REBOL_TIME || - sc.state == SCE_REBOL_MONEY || sc.state == SCE_REBOL_ISSUE || - sc.state == SCE_REBOL_URL || sc.state == SCE_REBOL_EMAIL) { - sc.SetState(SCE_REBOL_DEFAULT); - } - } - - //--- Specialize state ? - // URL, Email look like identifier - if (sc.state == SCE_REBOL_IDENTIFIER) - { - if (sc.ch == ':' && !IsASpace(sc.chNext)) { - sc.ChangeState(SCE_REBOL_URL); - } else if (sc.ch == '@') { - sc.ChangeState(SCE_REBOL_EMAIL); - } else if (sc.ch == '$') { - sc.ChangeState(SCE_REBOL_MONEY); - } - } - // Words look like identifiers - if (sc.state == SCE_REBOL_IDENTIFIER || (sc.state >= SCE_REBOL_WORD && sc.state <= SCE_REBOL_WORD8)) { - // Keywords ? - if (!IsAWordChar(sc.ch) || sc.Match('/')) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - blockComment = strcmp(s, "comment") == 0; - if (keywords8.InList(s)) { - sc.ChangeState(SCE_REBOL_WORD8); - } else if (keywords7.InList(s)) { - sc.ChangeState(SCE_REBOL_WORD7); - } else if (keywords6.InList(s)) { - sc.ChangeState(SCE_REBOL_WORD6); - } else if (keywords5.InList(s)) { - sc.ChangeState(SCE_REBOL_WORD5); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_REBOL_WORD4); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_REBOL_WORD3); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_REBOL_WORD2); - } else if (keywords.InList(s)) { - sc.ChangeState(SCE_REBOL_WORD); - } - // Keep same style if there are refinements - if (!sc.Match('/')) { - sc.SetState(SCE_REBOL_DEFAULT); - } - } - // special numbers - } else if (sc.state == SCE_REBOL_NUMBER) { - switch (sc.ch) { - case 'x': sc.ChangeState(SCE_REBOL_PAIR); - break; - case ':': sc.ChangeState(SCE_REBOL_TIME); - break; - case '-': - case '/': sc.ChangeState(SCE_REBOL_DATE); - break; - case '.': if (++dotCount >= 2) sc.ChangeState(SCE_REBOL_TUPLE); - break; - } - } - - //--- Determine if the current state should terminate - if (sc.state == SCE_REBOL_QUOTEDSTRING || sc.state == SCE_REBOL_CHARACTER) { - if (sc.ch == '^' && sc.chNext == '\"') { - sc.Forward(); - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_REBOL_DEFAULT); - } - } else if (sc.state == SCE_REBOL_BRACEDSTRING || sc.state == SCE_REBOL_COMMENTBLOCK) { - if (sc.ch == '}') { - if (--stringLevel == 0) { - sc.ForwardSetState(SCE_REBOL_DEFAULT); - } - } else if (sc.ch == '{') { - stringLevel++; - } - } else if (sc.state == SCE_REBOL_BINARY) { - if (sc.ch == '}') { - sc.ForwardSetState(SCE_REBOL_DEFAULT); - } - } else if (sc.state == SCE_REBOL_TAG) { - if (sc.ch == '>') { - sc.ForwardSetState(SCE_REBOL_DEFAULT); - } - } else if (sc.state == SCE_REBOL_PREFACE) { - if (sc.MatchIgnoreCase("rebol")) - { - int i; - for (i=5; IsASpaceOrTab(styler.SafeGetCharAt(sc.currentPos+i, 0)); i++); - if (sc.GetRelative(i) == '[') - sc.SetState(SCE_REBOL_DEFAULT); - } - } - - //--- Parens and bracket changes to default style when the current is a number - if (sc.state == SCE_REBOL_NUMBER || sc.state == SCE_REBOL_PAIR || sc.state == SCE_REBOL_TUPLE || - sc.state == SCE_REBOL_MONEY || sc.state == SCE_REBOL_ISSUE || sc.state == SCE_REBOL_EMAIL || - sc.state == SCE_REBOL_URL || sc.state == SCE_REBOL_DATE || sc.state == SCE_REBOL_TIME) { - if (sc.ch == '(' || sc.ch == '[' || sc.ch == ')' || sc.ch == ']') { - sc.SetState(SCE_REBOL_DEFAULT); - } - } - - //--- Determine if a new state should be entered. - if (sc.state == SCE_REBOL_DEFAULT) { - if (IsAnOperator(sc.ch, sc.chNext, sc.GetRelative(2))) { - sc.SetState(SCE_REBOL_OPERATOR); - } else if (IsBinaryStart(sc.ch, sc.chNext, sc.GetRelative(2), sc.GetRelative(3))) { - sc.SetState(SCE_REBOL_BINARY); - } else if (IsAWordStart(sc.ch, sc.chNext)) { - sc.SetState(SCE_REBOL_IDENTIFIER); - } else if (IsADigit(sc.ch) || sc.ch == '+' || sc.ch == '-' || /*Decimal*/ sc.ch == '.' || sc.ch == ',') { - dotCount = 0; - sc.SetState(SCE_REBOL_NUMBER); - } else if (sc.ch == '\"') { - sc.SetState(SCE_REBOL_QUOTEDSTRING); - } else if (sc.ch == '{') { - sc.SetState(blockComment ? SCE_REBOL_COMMENTBLOCK : SCE_REBOL_BRACEDSTRING); - ++stringLevel; - } else if (sc.ch == ';') { - sc.SetState(SCE_REBOL_COMMENTLINE); - } else if (sc.ch == '$') { - sc.SetState(SCE_REBOL_MONEY); - } else if (sc.ch == '%') { - sc.SetState(SCE_REBOL_FILE); - } else if (sc.ch == '<') { - sc.SetState(SCE_REBOL_TAG); - } else if (sc.ch == '#' && sc.chNext == '"') { - sc.SetState(SCE_REBOL_CHARACTER); - sc.Forward(); - } else if (sc.ch == '#' && sc.chNext != '"' && sc.chNext != '{' ) { - sc.SetState(SCE_REBOL_ISSUE); - } - } - } - sc.Complete(); -} - - -static void FoldRebolDoc(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_REBOL_DEFAULT) { - if (ch == '[') { - levelCurrent++; - } else if (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 rebolWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmREBOL(SCLEX_REBOL, ColouriseRebolDoc, "rebol", FoldRebolDoc, rebolWordListDesc); - diff --git a/lexers/LexRegistry.cxx b/lexers/LexRegistry.cxx deleted file mode 100644 index acdaccebe..000000000 --- a/lexers/LexRegistry.cxx +++ /dev/null @@ -1,419 +0,0 @@ -// Scintilla source code edit control -/** - * @file LexRegistry.cxx - * @date July 26 2014 - * @brief Lexer for Windows registration files(.reg) - * @author nkmathew - * - * The License.txt file describes the conditions under which this software may be - * distributed. - * - */ - -#include <cstdlib> -#include <cassert> -#include <cctype> -#include <cstdio> -#include <string> -#include <vector> -#include <map> - -#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; - -static const char *const RegistryWordListDesc[] = { - 0 -}; - -struct OptionsRegistry { - bool foldCompact; - bool fold; - OptionsRegistry() { - foldCompact = false; - fold = false; - } -}; - -struct OptionSetRegistry : public OptionSet<OptionsRegistry> { - OptionSetRegistry() { - DefineProperty("fold.compact", &OptionsRegistry::foldCompact); - DefineProperty("fold", &OptionsRegistry::fold); - DefineWordListSets(RegistryWordListDesc); - } -}; - -class LexerRegistry : public DefaultLexer { - OptionsRegistry options; - OptionSetRegistry optSetRegistry; - - static bool IsStringState(int state) { - return (state == SCE_REG_VALUENAME || state == SCE_REG_STRING); - } - - static bool IsKeyPathState(int state) { - return (state == SCE_REG_ADDEDKEY || state == SCE_REG_DELETEDKEY); - } - - static bool AtValueType(LexAccessor &styler, Sci_Position start) { - Sci_Position i = 0; - while (i < 10) { - i++; - char curr = styler.SafeGetCharAt(start+i, '\0'); - if (curr == ':') { - return true; - } else if (!curr) { - return false; - } - } - return false; - } - - static bool IsNextNonWhitespace(LexAccessor &styler, Sci_Position start, char ch) { - Sci_Position i = 0; - while (i < 100) { - 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 equal sign at the end of the string - static bool AtValueName(LexAccessor &styler, Sci_Position start) { - bool atEOL = false; - Sci_Position i = 0; - bool escaped = false; - while (!atEOL) { - i++; - char curr = styler.SafeGetCharAt(start+i, '\0'); - char next = styler.SafeGetCharAt(start+i+1, '\0'); - atEOL = (curr == '\r' && next != '\n') || (curr == '\n'); - if (escaped) { - escaped = false; - continue; - } - escaped = curr == '\\'; - if (curr == '"') { - return IsNextNonWhitespace(styler, start+i, '='); - } else if (!curr) { - return false; - } - } - return false; - } - - static bool AtKeyPathEnd(LexAccessor &styler, Sci_Position start) { - bool atEOL = false; - Sci_Position i = 0; - while (!atEOL) { - i++; - char curr = styler.SafeGetCharAt(start+i, '\0'); - char next = styler.SafeGetCharAt(start+i+1, '\0'); - atEOL = (curr == '\r' && next != '\n') || (curr == '\n'); - if (curr == ']' || !curr) { - // There's still at least one or more square brackets ahead - return false; - } - } - return true; - } - - static bool AtGUID(LexAccessor &styler, Sci_Position start) { - int count = 8; - int portion = 0; - int offset = 1; - char digit = '\0'; - while (portion < 5) { - int i = 0; - while (i < count) { - digit = styler.SafeGetCharAt(start+offset); - if (!(isxdigit(digit) || digit == '-')) { - return false; - } - offset++; - i++; - } - portion++; - count = (portion == 4) ? 13 : 5; - } - digit = styler.SafeGetCharAt(start+offset); - if (digit == '}') { - return true; - } else { - return false; - } - } - -public: - LexerRegistry() : DefaultLexer("registry", SCLEX_REGISTRY) {} - virtual ~LexerRegistry() {} - int SCI_METHOD Version() const override { - return lvRelease5; - } - void SCI_METHOD Release() override { - delete this; - } - const char *SCI_METHOD PropertyNames() override { - return optSetRegistry.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) override { - return optSetRegistry.PropertyType(name); - } - const char *SCI_METHOD DescribeProperty(const char *name) override { - return optSetRegistry.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override { - if (optSetRegistry.PropertySet(&options, key, val)) { - return 0; - } - return -1; - } - const char * SCI_METHOD PropertyGet(const char *key) override { - return optSetRegistry.PropertyGet(key); - } - - Sci_Position SCI_METHOD WordListSet(int, const char *) override { - return -1; - } - void *SCI_METHOD PrivateCall(int, void *) override { - return 0; - } - static ILexer5 *LexerFactoryRegistry() { - return new LexerRegistry; - } - const char *SCI_METHOD DescribeWordListSets() override { - return optSetRegistry.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 LexerRegistry::Lex(Sci_PositionU startPos, - Sci_Position length, - int initStyle, - IDocument *pAccess) { - int beforeGUID = SCE_REG_DEFAULT; - int beforeEscape = SCE_REG_DEFAULT; - CharacterSet setOperators = CharacterSet(CharacterSet::setNone, "-,.=:\\@()"); - LexAccessor styler(pAccess); - StyleContext context(startPos, length, initStyle, styler); - bool highlight = true; - bool afterEqualSign = false; - while (context.More()) { - if (context.atLineStart) { - Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); - bool continued = styler[currPos-3] == '\\'; - highlight = continued ? true : false; - } - switch (context.state) { - case SCE_REG_COMMENT: - if (context.atLineEnd) { - context.SetState(SCE_REG_DEFAULT); - } - break; - case SCE_REG_VALUENAME: - case SCE_REG_STRING: { - Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); - if (context.ch == '"') { - context.ForwardSetState(SCE_REG_DEFAULT); - } else if (context.ch == '\\') { - beforeEscape = context.state; - context.SetState(SCE_REG_ESCAPED); - context.Forward(); - } else if (context.ch == '{') { - if (AtGUID(styler, currPos)) { - beforeGUID = context.state; - context.SetState(SCE_REG_STRING_GUID); - } - } - if (context.state == SCE_REG_STRING && - context.ch == '%' && - (isdigit(context.chNext) || context.chNext == '*')) { - context.SetState(SCE_REG_PARAMETER); - } - } - break; - case SCE_REG_PARAMETER: - context.ForwardSetState(SCE_REG_STRING); - if (context.ch == '"') { - context.ForwardSetState(SCE_REG_DEFAULT); - } - break; - case SCE_REG_VALUETYPE: - if (context.ch == ':') { - context.SetState(SCE_REG_DEFAULT); - afterEqualSign = false; - } - break; - case SCE_REG_HEXDIGIT: - case SCE_REG_OPERATOR: - context.SetState(SCE_REG_DEFAULT); - break; - case SCE_REG_DELETEDKEY: - case SCE_REG_ADDEDKEY: { - Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); - if (context.ch == ']' && AtKeyPathEnd(styler, currPos)) { - context.ForwardSetState(SCE_REG_DEFAULT); - } else if (context.ch == '{') { - if (AtGUID(styler, currPos)) { - beforeGUID = context.state; - context.SetState(SCE_REG_KEYPATH_GUID); - } - } - } - break; - case SCE_REG_ESCAPED: - if (context.ch == '"') { - context.SetState(beforeEscape); - context.ForwardSetState(SCE_REG_DEFAULT); - } else if (context.ch == '\\') { - context.Forward(); - } else { - context.SetState(beforeEscape); - beforeEscape = SCE_REG_DEFAULT; - } - break; - case SCE_REG_STRING_GUID: - case SCE_REG_KEYPATH_GUID: { - if (context.ch == '}') { - context.ForwardSetState(beforeGUID); - beforeGUID = SCE_REG_DEFAULT; - } - Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); - if (context.ch == '"' && IsStringState(context.state)) { - context.ForwardSetState(SCE_REG_DEFAULT); - } else if (context.ch == ']' && - AtKeyPathEnd(styler, currPos) && - IsKeyPathState(context.state)) { - context.ForwardSetState(SCE_REG_DEFAULT); - } else if (context.ch == '\\' && IsStringState(context.state)) { - beforeEscape = context.state; - context.SetState(SCE_REG_ESCAPED); - context.Forward(); - } - } - break; - } - // Determine if a new state should be entered. - if (context.state == SCE_REG_DEFAULT) { - Sci_Position currPos = static_cast<Sci_Position>(context.currentPos); - if (context.ch == ';') { - context.SetState(SCE_REG_COMMENT); - } else if (context.ch == '"') { - if (AtValueName(styler, currPos)) { - context.SetState(SCE_REG_VALUENAME); - } else { - context.SetState(SCE_REG_STRING); - } - } else if (context.ch == '[') { - if (IsNextNonWhitespace(styler, currPos, '-')) { - context.SetState(SCE_REG_DELETEDKEY); - } else { - context.SetState(SCE_REG_ADDEDKEY); - } - } else if (context.ch == '=') { - afterEqualSign = true; - highlight = true; - } else if (afterEqualSign) { - bool wordStart = isalpha(context.ch) && !isalpha(context.chPrev); - if (wordStart && AtValueType(styler, currPos)) { - context.SetState(SCE_REG_VALUETYPE); - } - } else if (isxdigit(context.ch) && highlight) { - context.SetState(SCE_REG_HEXDIGIT); - } - highlight = (context.ch == '@') ? true : highlight; - if (setOperators.Contains(context.ch) && highlight) { - context.SetState(SCE_REG_OPERATOR); - } - } - context.Forward(); - } - context.Complete(); -} - -// Folding similar to that of FoldPropsDoc in LexOthers -void SCI_METHOD LexerRegistry::Fold(Sci_PositionU startPos, - Sci_Position length, - int, - IDocument *pAccess) { - if (!options.fold) { - return; - } - LexAccessor styler(pAccess); - Sci_Position currLine = styler.GetLine(startPos); - int visibleChars = 0; - Sci_PositionU endPos = startPos + length; - bool atKeyPath = false; - for (Sci_PositionU i = startPos; i < endPos; i++) { - atKeyPath = IsKeyPathState(styler.StyleAt(i)) ? true : atKeyPath; - char curr = styler.SafeGetCharAt(i); - char next = styler.SafeGetCharAt(i+1); - bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n'); - if (atEOL || i == (endPos-1)) { - int level = SC_FOLDLEVELBASE; - if (currLine > 0) { - int prevLevel = styler.LevelAt(currLine-1); - if (prevLevel & SC_FOLDLEVELHEADERFLAG) { - level += 1; - } else { - level = prevLevel; - } - } - if (!visibleChars && options.foldCompact) { - level |= SC_FOLDLEVELWHITEFLAG; - } else if (atKeyPath) { - level = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG; - } - if (level != styler.LevelAt(currLine)) { - styler.SetLevel(currLine, level); - } - currLine++; - visibleChars = 0; - atKeyPath = false; - } - if (!isspacechar(curr)) { - visibleChars++; - } - } - - // Make the folding reach the last line in the file - int level = SC_FOLDLEVELBASE; - if (currLine > 0) { - int prevLevel = styler.LevelAt(currLine-1); - if (prevLevel & SC_FOLDLEVELHEADERFLAG) { - level += 1; - } else { - level = prevLevel; - } - } - styler.SetLevel(currLine, level); -} - -LexerModule lmRegistry(SCLEX_REGISTRY, - LexerRegistry::LexerFactoryRegistry, - "registry", - RegistryWordListDesc); - diff --git a/lexers/LexRuby.cxx b/lexers/LexRuby.cxx deleted file mode 100644 index 6f7c34404..000000000 --- a/lexers/LexRuby.cxx +++ /dev/null @@ -1,1879 +0,0 @@ -// Scintilla source code edit control -/** @file LexRuby.cxx - ** Lexer for Ruby. - **/ -// Copyright 2001- by Clemens Wyss <wys@helbling.ch> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -//XXX Identical to Perl, put in common area -static inline bool isEOLChar(char ch) { - return (ch == '\r') || (ch == '\n'); -} - -#define isSafeASCII(ch) ((unsigned int)(ch) <= 127) -// This one's redundant, but makes for more readable code -#define isHighBitChar(ch) ((unsigned int)(ch) > 127) - -static inline bool isSafeAlpha(char ch) { - return (isSafeASCII(ch) && isalpha(ch)) || ch == '_'; -} - -static inline bool isSafeAlnum(char ch) { - return (isSafeASCII(ch) && isalnum(ch)) || ch == '_'; -} - -static inline bool isSafeAlnumOrHigh(char ch) { - return isHighBitChar(ch) || isalnum(ch) || ch == '_'; -} - -static inline bool isSafeDigit(char ch) { - return isSafeASCII(ch) && isdigit(ch); -} - -static inline bool isSafeWordcharOrHigh(char ch) { - // Error: scintilla's KeyWords.h includes '.' as a word-char - // we want to separate things that can take methods from the - // methods. - return isHighBitChar(ch) || isalnum(ch) || ch == '_'; -} - -static bool inline iswhitespace(char ch) { - return ch == ' ' || ch == '\t'; -} - -#define MAX_KEYWORD_LENGTH 200 - -#define STYLE_MASK 63 -#define actual_style(style) (style & STYLE_MASK) - -static bool followsDot(Sci_PositionU pos, Accessor &styler) { - styler.Flush(); - for (; pos >= 1; --pos) { - int style = actual_style(styler.StyleAt(pos)); - char ch; - switch (style) { - case SCE_RB_DEFAULT: - ch = styler[pos]; - if (ch == ' ' || ch == '\t') { - //continue - } else { - return false; - } - break; - - case SCE_RB_OPERATOR: - return styler[pos] == '.'; - - default: - return false; - } - } - return false; -} - -// Forward declarations -static bool keywordIsAmbiguous(const char *prevWord); -static bool keywordDoStartsLoop(Sci_Position pos, - Accessor &styler); -static bool keywordIsModifier(const char *word, - Sci_Position pos, - Accessor &styler); - -static int ClassifyWordRb(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord) { - char s[MAX_KEYWORD_LENGTH]; - Sci_PositionU i, j; - Sci_PositionU lim = end - start + 1; // num chars to copy - if (lim >= MAX_KEYWORD_LENGTH) { - lim = MAX_KEYWORD_LENGTH - 1; - } - for (i = start, j = 0; j < lim; i++, j++) { - s[j] = styler[i]; - } - s[j] = '\0'; - int chAttr; - if (0 == strcmp(prevWord, "class")) - chAttr = SCE_RB_CLASSNAME; - else if (0 == strcmp(prevWord, "module")) - chAttr = SCE_RB_MODULE_NAME; - else if (0 == strcmp(prevWord, "def")) - chAttr = SCE_RB_DEFNAME; - else if (keywords.InList(s) && ((start == 0) || !followsDot(start - 1, styler))) { - if (keywordIsAmbiguous(s) - && keywordIsModifier(s, start, styler)) { - - // Demoted keywords are colored as keywords, - // but do not affect changes in indentation. - // - // Consider the word 'if': - // 1. <<if test ...>> : normal - // 2. <<stmt if test>> : demoted - // 3. <<lhs = if ...>> : normal: start a new indent level - // 4. <<obj.if = 10>> : color as identifer, since it follows '.' - - chAttr = SCE_RB_WORD_DEMOTED; - } else { - chAttr = SCE_RB_WORD; - } - } else - chAttr = SCE_RB_IDENTIFIER; - styler.ColourTo(end, chAttr); - if (chAttr == SCE_RB_WORD) { - strcpy(prevWord, s); - } else { - prevWord[0] = 0; - } - return chAttr; -} - - -//XXX Identical to Perl, put in common area -static bool isMatch(Accessor &styler, Sci_Position lengthDoc, Sci_Position pos, const char *val) { - if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) { - return false; - } - while (*val) { - if (*val != styler[pos++]) { - return false; - } - val++; - } - return true; -} - -// Do Ruby better -- find the end of the line, work back, -// and then check for leading white space - -// Precondition: the here-doc target can be indented -static bool lookingAtHereDocDelim(Accessor &styler, - Sci_Position pos, - Sci_Position lengthDoc, - const char *HereDocDelim) -{ - if (!isMatch(styler, lengthDoc, pos, HereDocDelim)) { - return false; - } - while (--pos > 0) { - char ch = styler[pos]; - if (isEOLChar(ch)) { - return true; - } else if (ch != ' ' && ch != '\t') { - return false; - } - } - return false; -} - -//XXX Identical to Perl, put in common area -static char opposite(char ch) { - if (ch == '(') - return ')'; - if (ch == '[') - return ']'; - if (ch == '{') - return '}'; - if (ch == '<') - return '>'; - return ch; -} - -// Null transitions when we see we've reached the end -// and need to relex the curr char. - -static void redo_char(Sci_Position &i, char &ch, char &chNext, char &chNext2, - int &state) { - i--; - chNext2 = chNext; - chNext = ch; - state = SCE_RB_DEFAULT; -} - -static void advance_char(Sci_Position &i, char &ch, char &chNext, char &chNext2) { - i++; - ch = chNext; - chNext = chNext2; -} - -// precondition: startPos points to one after the EOL char -static bool currLineContainsHereDelims(Sci_Position &startPos, - Accessor &styler) { - if (startPos <= 1) - return false; - - Sci_Position pos; - for (pos = startPos - 1; pos > 0; pos--) { - char ch = styler.SafeGetCharAt(pos); - if (isEOLChar(ch)) { - // Leave the pointers where they are -- there are no - // here doc delims on the current line, even if - // the EOL isn't default style - - return false; - } else { - styler.Flush(); - if (actual_style(styler.StyleAt(pos)) == SCE_RB_HERE_DELIM) { - break; - } - } - } - if (pos == 0) { - return false; - } - // Update the pointers so we don't have to re-analyze the string - startPos = pos; - return true; -} - -// This class is used by the enter and exit methods, so it needs -// to be hoisted out of the function. - -class QuoteCls { -public: - int Count; - char Up; - char Down; - QuoteCls() { - New(); - } - void New() { - Count = 0; - Up = '\0'; - Down = '\0'; - } - void Open(char u) { - Count++; - Up = u; - Down = opposite(Up); - } - QuoteCls(const QuoteCls &q) { - // copy constructor -- use this for copying in - Count = q.Count; - Up = q.Up; - Down = q.Down; - } - QuoteCls &operator=(const QuoteCls &q) { // assignment constructor - if (this != &q) { - Count = q.Count; - Up = q.Up; - Down = q.Down; - } - return *this; - } - -}; - - -static void enterInnerExpression(int *p_inner_string_types, - int *p_inner_expn_brace_counts, - QuoteCls *p_inner_quotes, - int &inner_string_count, - int &state, - int &brace_counts, - QuoteCls curr_quote - ) { - p_inner_string_types[inner_string_count] = state; - state = SCE_RB_DEFAULT; - p_inner_expn_brace_counts[inner_string_count] = brace_counts; - brace_counts = 0; - p_inner_quotes[inner_string_count] = curr_quote; - ++inner_string_count; -} - -static void exitInnerExpression(int *p_inner_string_types, - int *p_inner_expn_brace_counts, - QuoteCls *p_inner_quotes, - int &inner_string_count, - int &state, - int &brace_counts, - QuoteCls &curr_quote - ) { - --inner_string_count; - state = p_inner_string_types[inner_string_count]; - brace_counts = p_inner_expn_brace_counts[inner_string_count]; - curr_quote = p_inner_quotes[inner_string_count]; -} - -static bool isEmptyLine(Sci_Position pos, - Accessor &styler) { - int spaceFlags = 0; - Sci_Position lineCurrent = styler.GetLine(pos); - int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL); - return (indentCurrent & SC_FOLDLEVELWHITEFLAG) != 0; -} - -static bool RE_CanFollowKeyword(const char *keyword) { - if (!strcmp(keyword, "and") - || !strcmp(keyword, "begin") - || !strcmp(keyword, "break") - || !strcmp(keyword, "case") - || !strcmp(keyword, "do") - || !strcmp(keyword, "else") - || !strcmp(keyword, "elsif") - || !strcmp(keyword, "if") - || !strcmp(keyword, "next") - || !strcmp(keyword, "return") - || !strcmp(keyword, "when") - || !strcmp(keyword, "unless") - || !strcmp(keyword, "until") - || !strcmp(keyword, "not") - || !strcmp(keyword, "or")) { - return true; - } - return false; -} - -// Look at chars up to but not including endPos -// Don't look at styles in case we're looking forward - -static Sci_Position skipWhitespace(Sci_Position startPos, - Sci_Position endPos, - Accessor &styler) { - for (Sci_Position i = startPos; i < endPos; i++) { - if (!iswhitespace(styler[i])) { - return i; - } - } - return endPos; -} - -// This routine looks for false positives like -// undef foo, << -// There aren't too many. -// -// iPrev points to the start of << - -static bool sureThisIsHeredoc(Sci_Position iPrev, - Accessor &styler, - char *prevWord) { - - // Not so fast, since Ruby's so dynamic. Check the context - // to make sure we're OK. - int prevStyle; - Sci_Position lineStart = styler.GetLine(iPrev); - Sci_Position lineStartPosn = styler.LineStart(lineStart); - styler.Flush(); - - // Find the first word after some whitespace - Sci_Position firstWordPosn = skipWhitespace(lineStartPosn, iPrev, styler); - if (firstWordPosn >= iPrev) { - // Have something like {^ <<} - //XXX Look at the first previous non-comment non-white line - // to establish the context. Not too likely though. - return true; - } else { - switch (prevStyle = styler.StyleAt(firstWordPosn)) { - case SCE_RB_WORD: - case SCE_RB_WORD_DEMOTED: - case SCE_RB_IDENTIFIER: - break; - default: - return true; - } - } - Sci_Position firstWordEndPosn = firstWordPosn; - char *dst = prevWord; - for (;;) { - if (firstWordEndPosn >= iPrev || - styler.StyleAt(firstWordEndPosn) != prevStyle) { - *dst = 0; - break; - } - *dst++ = styler[firstWordEndPosn]; - firstWordEndPosn += 1; - } - //XXX Write a style-aware thing to regex scintilla buffer objects - if (!strcmp(prevWord, "undef") - || !strcmp(prevWord, "def") - || !strcmp(prevWord, "alias")) { - // These keywords are what we were looking for - return false; - } - return true; -} - -// Routine that saves us from allocating a buffer for the here-doc target -// targetEndPos points one past the end of the current target -static bool haveTargetMatch(Sci_Position currPos, - Sci_Position lengthDoc, - Sci_Position targetStartPos, - Sci_Position targetEndPos, - Accessor &styler) { - if (lengthDoc - currPos < targetEndPos - targetStartPos) { - return false; - } - Sci_Position i, j; - for (i = targetStartPos, j = currPos; - i < targetEndPos && j < lengthDoc; - i++, j++) { - if (styler[i] != styler[j]) { - return false; - } - } - return true; -} - -// Finds the start position of the expression containing @p pos -// @p min_pos should be a known expression start, e.g. the start of the line -static Sci_Position findExpressionStart(Sci_Position pos, - Sci_Position min_pos, - Accessor &styler) { - int depth = 0; - for (; pos > min_pos; pos -= 1) { - int style = styler.StyleAt(pos - 1); - if (style == SCE_RB_OPERATOR) { - int ch = styler[pos - 1]; - if (ch == '}' || ch == ')' || ch == ']') { - depth += 1; - } else if (ch == '{' || ch == '(' || ch == '[') { - if (depth == 0) { - break; - } else { - depth -= 1; - } - } else if (ch == ';' && depth == 0) { - break; - } - } - } - return pos; -} - -// We need a check because the form -// [identifier] <<[target] -// is ambiguous. The Ruby lexer/parser resolves it by -// looking to see if [identifier] names a variable or a -// function. If it's the first, it's the start of a here-doc. -// If it's a var, it's an operator. This lexer doesn't -// maintain a symbol table, so it looks ahead to see what's -// going on, in cases where we have -// ^[white-space]*[identifier([.|::]identifier)*][white-space]*<<[target] -// -// If there's no occurrence of [target] on a line, assume we don't. - -// return true == yes, we have no heredocs - -static bool sureThisIsNotHeredoc(Sci_Position lt2StartPos, - Accessor &styler) { - int prevStyle; - // Use full document, not just part we're styling - Sci_Position lengthDoc = styler.Length(); - Sci_Position lineStart = styler.GetLine(lt2StartPos); - Sci_Position lineStartPosn = styler.LineStart(lineStart); - styler.Flush(); - const bool definitely_not_a_here_doc = true; - const bool looks_like_a_here_doc = false; - - // find the expression start rather than the line start - Sci_Position exprStartPosn = findExpressionStart(lt2StartPos, lineStartPosn, styler); - - // Find the first word after some whitespace - Sci_Position firstWordPosn = skipWhitespace(exprStartPosn, lt2StartPos, styler); - if (firstWordPosn >= lt2StartPos) { - return definitely_not_a_here_doc; - } - prevStyle = styler.StyleAt(firstWordPosn); - // If we have '<<' following a keyword, it's not a heredoc - if (prevStyle != SCE_RB_IDENTIFIER - && prevStyle != SCE_RB_SYMBOL - && prevStyle != SCE_RB_INSTANCE_VAR - && prevStyle != SCE_RB_CLASS_VAR) { - return definitely_not_a_here_doc; - } - int newStyle = prevStyle; - // Some compilers incorrectly warn about uninit newStyle - for (firstWordPosn += 1; firstWordPosn <= lt2StartPos; firstWordPosn += 1) { - // Inner loop looks at the name - for (; firstWordPosn <= lt2StartPos; firstWordPosn += 1) { - newStyle = styler.StyleAt(firstWordPosn); - if (newStyle != prevStyle) { - break; - } - } - // Do we have '::' or '.'? - if (firstWordPosn < lt2StartPos && newStyle == SCE_RB_OPERATOR) { - char ch = styler[firstWordPosn]; - if (ch == '.') { - // yes - } else if (ch == ':') { - if (styler.StyleAt(++firstWordPosn) != SCE_RB_OPERATOR) { - return definitely_not_a_here_doc; - } else if (styler[firstWordPosn] != ':') { - return definitely_not_a_here_doc; - } - } else { - break; - } - } else { - break; - } - // on second and next passes, only identifiers may appear since - // class and instance variable are private - prevStyle = SCE_RB_IDENTIFIER; - } - // Skip next batch of white-space - firstWordPosn = skipWhitespace(firstWordPosn, lt2StartPos, styler); - // possible symbol for an implicit hash argument - if (firstWordPosn < lt2StartPos && styler.StyleAt(firstWordPosn) == SCE_RB_SYMBOL) { - for (; firstWordPosn <= lt2StartPos; firstWordPosn += 1) { - if (styler.StyleAt(firstWordPosn) != SCE_RB_SYMBOL) { - break; - } - } - // Skip next batch of white-space - firstWordPosn = skipWhitespace(firstWordPosn, lt2StartPos, styler); - } - if (firstWordPosn != lt2StartPos) { - // Have [[^ws[identifier]ws[*something_else*]ws<< - return definitely_not_a_here_doc; - } - // OK, now 'j' will point to the current spot moving ahead - Sci_Position j = firstWordPosn + 1; - if (styler.StyleAt(j) != SCE_RB_OPERATOR || styler[j] != '<') { - // This shouldn't happen - return definitely_not_a_here_doc; - } - Sci_Position nextLineStartPosn = styler.LineStart(lineStart + 1); - if (nextLineStartPosn >= lengthDoc) { - return definitely_not_a_here_doc; - } - j = skipWhitespace(j + 1, nextLineStartPosn, styler); - if (j >= lengthDoc) { - return definitely_not_a_here_doc; - } - bool allow_indent; - Sci_Position target_start, target_end; - // From this point on no more styling, since we're looking ahead - if (styler[j] == '-' || styler[j] == '~') { - allow_indent = true; - j++; - } else { - allow_indent = false; - } - - // Allow for quoted targets. - char target_quote = 0; - switch (styler[j]) { - case '\'': - case '"': - case '`': - target_quote = styler[j]; - j += 1; - } - - if (isSafeAlnum(styler[j])) { - // Init target_end because some compilers think it won't - // be initialized by the time it's used - target_start = target_end = j; - j++; - } else { - return definitely_not_a_here_doc; - } - for (; j < lengthDoc; j++) { - if (!isSafeAlnum(styler[j])) { - if (target_quote && styler[j] != target_quote) { - // unquoted end - return definitely_not_a_here_doc; - } - - // And for now make sure that it's a newline - // don't handle arbitrary expressions yet - - target_end = j; - if (target_quote) { - // Now we can move to the character after the string delimiter. - j += 1; - } - j = skipWhitespace(j, lengthDoc, styler); - if (j >= lengthDoc) { - return definitely_not_a_here_doc; - } else { - char ch = styler[j]; - if (ch == '#' || isEOLChar(ch)) { - // This is OK, so break and continue; - break; - } else { - return definitely_not_a_here_doc; - } - } - } - } - - // Just look at the start of each line - Sci_Position last_line = styler.GetLine(lengthDoc - 1); - // But don't go too far - if (last_line > lineStart + 50) { - last_line = lineStart + 50; - } - for (Sci_Position line_num = lineStart + 1; line_num <= last_line; line_num++) { - if (allow_indent) { - j = skipWhitespace(styler.LineStart(line_num), lengthDoc, styler); - } else { - j = styler.LineStart(line_num); - } - // target_end is one past the end - if (haveTargetMatch(j, lengthDoc, target_start, target_end, styler)) { - // We got it - return looks_like_a_here_doc; - } - } - return definitely_not_a_here_doc; -} - -//todo: if we aren't looking at a stdio character, -// move to the start of the first line that is not in a -// multi-line construct - -static void synchronizeDocStart(Sci_PositionU &startPos, - Sci_Position &length, - int &initStyle, - Accessor &styler, - bool skipWhiteSpace=false) { - - styler.Flush(); - int style = actual_style(styler.StyleAt(startPos)); - switch (style) { - case SCE_RB_STDIN: - case SCE_RB_STDOUT: - case SCE_RB_STDERR: - // Don't do anything else with these. - return; - } - - Sci_Position pos = startPos; - // Quick way to characterize each line - Sci_Position lineStart; - for (lineStart = styler.GetLine(pos); lineStart > 0; lineStart--) { - // Now look at the style before the previous line's EOL - pos = styler.LineStart(lineStart) - 1; - if (pos <= 10) { - lineStart = 0; - break; - } - char ch = styler.SafeGetCharAt(pos); - char chPrev = styler.SafeGetCharAt(pos - 1); - if (ch == '\n' && chPrev == '\r') { - pos--; - } - if (styler.SafeGetCharAt(pos - 1) == '\\') { - // Continuation line -- keep going - } else if (actual_style(styler.StyleAt(pos)) != SCE_RB_DEFAULT) { - // Part of multi-line construct -- keep going - } else if (currLineContainsHereDelims(pos, styler)) { - // Keep going, with pos and length now pointing - // at the end of the here-doc delimiter - } else if (skipWhiteSpace && isEmptyLine(pos, styler)) { - // Keep going - } else { - break; - } - } - pos = styler.LineStart(lineStart); - length += (startPos - pos); - startPos = pos; - initStyle = SCE_RB_DEFAULT; -} - -static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - - // Lexer for Ruby often has to backtrack to start of current style to determine - // which characters are being used as quotes, how deeply nested is the - // start position and what the termination string is for here documents - - WordList &keywords = *keywordlists[0]; - - class HereDocCls { - public: - int State; - // States - // 0: '<<' encountered - // 1: collect the delimiter - // 1b: text between the end of the delimiter and the EOL - // 2: here doc text (lines after the delimiter) - char Quote; // the char after '<<' - bool Quoted; // true if Quote in ('\'','"','`') - int DelimiterLength; // strlen(Delimiter) - char Delimiter[256]; // the Delimiter, limit of 256: from Perl - bool CanBeIndented; - HereDocCls() { - State = 0; - DelimiterLength = 0; - Delimiter[0] = '\0'; - CanBeIndented = false; - } - }; - HereDocCls HereDoc; - - QuoteCls Quote; - - int numDots = 0; // For numbers -- - // Don't start lexing in the middle of a num - - synchronizeDocStart(startPos, length, initStyle, styler, // ref args - false); - - bool preferRE = true; - int state = initStyle; - Sci_Position lengthDoc = startPos + length; - - char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero - prevWord[0] = '\0'; - if (length == 0) - return; - - char chPrev = styler.SafeGetCharAt(startPos - 1); - char chNext = styler.SafeGetCharAt(startPos); - bool is_real_number = true; // Differentiate between constants and ?-sequences. - styler.StartAt(startPos); - styler.StartSegment(startPos); - - static int q_states[] = {SCE_RB_STRING_Q, - SCE_RB_STRING_QQ, - SCE_RB_STRING_QR, - SCE_RB_STRING_QW, - SCE_RB_STRING_QW, - SCE_RB_STRING_QX - }; - static const char *q_chars = "qQrwWx"; - - // In most cases a value of 2 should be ample for the code in the - // Ruby library, and the code the user is likely to enter. - // For example, - // fu_output_message "mkdir #{options[:mode] ? ('-m %03o ' % options[:mode]) : ''}#{list.join ' '}" - // if options[:verbose] - // from fileutils.rb nests to a level of 2 - // If the user actually hits a 6th occurrence of '#{' in a double-quoted - // string (including regex'es, %Q, %<sym>, %w, and other strings - // that interpolate), 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. - - // If anyone runs into this problem, I recommend raising this - // value slightly higher to replacing the fixed array with a linked - // list. Keep in mind this code will be called every time the lexer - // is invoked. - -#define INNER_STRINGS_MAX_COUNT 5 - // These vars track our instances of "...#{,,,%Q<..#{,,,}...>,,,}..." - 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]; - QuoteCls inner_quotes[INNER_STRINGS_MAX_COUNT]; - int inner_string_count = 0; - int brace_counts = 0; // Number of #{ ... } things within an expression - - Sci_Position i; - for (i = 0; i < INNER_STRINGS_MAX_COUNT; i++) { - inner_string_types[i] = 0; - inner_expn_brace_counts[i] = 0; - } - for (i = startPos; i < lengthDoc; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - char chNext2 = styler.SafeGetCharAt(i + 2); - - if (styler.IsLeadByte(ch)) { - chNext = chNext2; - chPrev = ' '; - i += 1; - continue; - } - - // skip on DOS/Windows - //No, don't, because some things will get tagged on, - // so we won't recognize keywords, for example -#if 0 - if (ch == '\r' && chNext == '\n') { - continue; - } -#endif - - if (HereDoc.State == 1 && isEOLChar(ch)) { - // Begin of here-doc (the line after the here-doc delimiter): - HereDoc.State = 2; - styler.ColourTo(i-1, state); - // Don't check for a missing quote, just jump into - // the here-doc state - state = SCE_RB_HERE_Q; - } - - // Regular transitions - if (state == SCE_RB_DEFAULT) { - if (isSafeDigit(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_RB_NUMBER; - is_real_number = true; - numDots = 0; - } else if (isHighBitChar(ch) || iswordstart(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_RB_WORD; - } else if (ch == '#') { - styler.ColourTo(i - 1, state); - state = SCE_RB_COMMENTLINE; - } else if (ch == '=') { - // =begin indicates the start of a comment (doc) block - if ((i == 0 || isEOLChar(chPrev)) - && chNext == 'b' - && styler.SafeGetCharAt(i + 2) == 'e' - && styler.SafeGetCharAt(i + 3) == 'g' - && styler.SafeGetCharAt(i + 4) == 'i' - && styler.SafeGetCharAt(i + 5) == 'n' - && !isSafeWordcharOrHigh(styler.SafeGetCharAt(i + 6))) { - styler.ColourTo(i - 1, state); - state = SCE_RB_POD; - } else { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_RB_OPERATOR); - preferRE = true; - } - } else if (ch == '"') { - styler.ColourTo(i - 1, state); - state = SCE_RB_STRING; - Quote.New(); - Quote.Open(ch); - } else if (ch == '\'') { - styler.ColourTo(i - 1, state); - state = SCE_RB_CHARACTER; - Quote.New(); - Quote.Open(ch); - } else if (ch == '`') { - styler.ColourTo(i - 1, state); - state = SCE_RB_BACKTICKS; - Quote.New(); - Quote.Open(ch); - } else if (ch == '@') { - // Instance or class var - styler.ColourTo(i - 1, state); - if (chNext == '@') { - state = SCE_RB_CLASS_VAR; - advance_char(i, ch, chNext, chNext2); // pass by ref - } else { - state = SCE_RB_INSTANCE_VAR; - } - } else if (ch == '$') { - // Check for a builtin global - styler.ColourTo(i - 1, state); - // Recognize it bit by bit - state = SCE_RB_GLOBAL; - } else if (ch == '/' && preferRE) { - // Ambigous operator - styler.ColourTo(i - 1, state); - state = SCE_RB_REGEX; - Quote.New(); - Quote.Open(ch); - } else if (ch == '<' && chNext == '<' && chNext2 != '=') { - - // Recognise the '<<' symbol - either a here document or a binary op - styler.ColourTo(i - 1, state); - i++; - chNext = chNext2; - styler.ColourTo(i, SCE_RB_OPERATOR); - - if (!(strchr("\"\'`_-~", chNext2) || isSafeAlpha(chNext2))) { - // It's definitely not a here-doc, - // based on Ruby's lexer/parser in the - // heredoc_identifier routine. - // Nothing else to do. - } else if (preferRE) { - if (sureThisIsHeredoc(i - 1, styler, prevWord)) { - state = SCE_RB_HERE_DELIM; - HereDoc.State = 0; - } - // else leave it in default state - } else { - if (sureThisIsNotHeredoc(i - 1, styler)) { - // leave state as default - // We don't have all the heuristics Perl has for indications - // of a here-doc, because '<<' is overloadable and used - // for so many other classes. - } else { - state = SCE_RB_HERE_DELIM; - HereDoc.State = 0; - } - } - preferRE = (state != SCE_RB_HERE_DELIM); - } else if (ch == ':') { - styler.ColourTo(i - 1, state); - if (chNext == ':') { - // Mark "::" as an operator, not symbol start - styler.ColourTo(i + 1, SCE_RB_OPERATOR); - advance_char(i, ch, chNext, chNext2); // pass by ref - state = SCE_RB_DEFAULT; - preferRE = false; - } else if (isSafeWordcharOrHigh(chNext)) { - state = SCE_RB_SYMBOL; - } else if ((chNext == '@' || chNext == '$') && - isSafeWordcharOrHigh(chNext2)) { - // instance and global variable followed by an identifier - advance_char(i, ch, chNext, chNext2); - state = SCE_RB_SYMBOL; - } else if (((chNext == '@' && chNext2 == '@') || - (chNext == '$' && chNext2 == '-')) && - isSafeWordcharOrHigh(styler.SafeGetCharAt(i+3))) { - // class variables and special global variable "$-IDENTCHAR" - state = SCE_RB_SYMBOL; - // $-IDENTCHAR doesn't continue past the IDENTCHAR - if (chNext == '$') { - styler.ColourTo(i+3, SCE_RB_SYMBOL); - state = SCE_RB_DEFAULT; - } - i += 3; - ch = styler.SafeGetCharAt(i); - chNext = styler.SafeGetCharAt(i+1); - } else if (chNext == '$' && strchr("_~*$?!@/\\;,.=:<>\"&`'+", chNext2)) { - // single-character special global variables - i += 2; - ch = chNext2; - chNext = styler.SafeGetCharAt(i+1); - styler.ColourTo(i, SCE_RB_SYMBOL); - state = SCE_RB_DEFAULT; - } else if (strchr("[*!~+-*/%=<>&^|", chNext)) { - // Do the operator analysis in-line, looking ahead - // Based on the table in pickaxe 2nd ed., page 339 - bool doColoring = true; - switch (chNext) { - case '[': - if (chNext2 == ']') { - char ch_tmp = styler.SafeGetCharAt(i + 3); - if (ch_tmp == '=') { - i += 3; - ch = ch_tmp; - chNext = styler.SafeGetCharAt(i + 1); - } else { - i += 2; - ch = chNext2; - chNext = ch_tmp; - } - } else { - doColoring = false; - } - break; - - case '*': - if (chNext2 == '*') { - i += 2; - ch = chNext2; - chNext = styler.SafeGetCharAt(i + 1); - } else { - advance_char(i, ch, chNext, chNext2); - } - break; - - case '!': - if (chNext2 == '=' || chNext2 == '~') { - i += 2; - ch = chNext2; - chNext = styler.SafeGetCharAt(i + 1); - } else { - advance_char(i, ch, chNext, chNext2); - } - break; - - case '<': - if (chNext2 == '<') { - i += 2; - ch = chNext2; - chNext = styler.SafeGetCharAt(i + 1); - } else if (chNext2 == '=') { - char ch_tmp = styler.SafeGetCharAt(i + 3); - if (ch_tmp == '>') { // <=> operator - i += 3; - ch = ch_tmp; - chNext = styler.SafeGetCharAt(i + 1); - } else { - i += 2; - ch = chNext2; - chNext = ch_tmp; - } - } else { - advance_char(i, ch, chNext, chNext2); - } - break; - - default: - // Simple one-character operators - advance_char(i, ch, chNext, chNext2); - break; - } - if (doColoring) { - styler.ColourTo(i, SCE_RB_SYMBOL); - state = SCE_RB_DEFAULT; - } - } else if (!preferRE) { - // Don't color symbol strings (yet) - // Just color the ":" and color rest as string - styler.ColourTo(i, SCE_RB_SYMBOL); - state = SCE_RB_DEFAULT; - } else { - styler.ColourTo(i, SCE_RB_OPERATOR); - state = SCE_RB_DEFAULT; - preferRE = true; - } - } else if (ch == '%') { - styler.ColourTo(i - 1, state); - bool have_string = false; - if (strchr(q_chars, chNext) && !isSafeWordcharOrHigh(chNext2)) { - Quote.New(); - const char *hit = strchr(q_chars, chNext); - if (hit != NULL) { - state = q_states[hit - q_chars]; - Quote.Open(chNext2); - i += 2; - ch = chNext2; - chNext = styler.SafeGetCharAt(i + 1); - have_string = true; - } - } else if (preferRE && !isSafeWordcharOrHigh(chNext)) { - // Ruby doesn't allow high bit chars here, - // but the editor host might - Quote.New(); - state = SCE_RB_STRING_QQ; - Quote.Open(chNext); - advance_char(i, ch, chNext, chNext2); // pass by ref - have_string = true; - } else if (!isSafeWordcharOrHigh(chNext) && !iswhitespace(chNext) && !isEOLChar(chNext)) { - // Ruby doesn't allow high bit chars here, - // but the editor host might - Quote.New(); - state = SCE_RB_STRING_QQ; - Quote.Open(chNext); - advance_char(i, ch, chNext, chNext2); // pass by ref - have_string = true; - } - if (!have_string) { - styler.ColourTo(i, SCE_RB_OPERATOR); - // stay in default - preferRE = true; - } - } else if (ch == '?') { - styler.ColourTo(i - 1, state); - if (iswhitespace(chNext) || chNext == '\n' || chNext == '\r') { - styler.ColourTo(i, SCE_RB_OPERATOR); - } else { - // It's the start of a character code escape sequence - // Color it as a number. - state = SCE_RB_NUMBER; - is_real_number = false; - } - } else if (isoperator(ch) || ch == '.') { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_RB_OPERATOR); - // If we're ending an expression or block, - // assume it ends an object, and the ambivalent - // constructs are binary operators - // - // So if we don't have one of these chars, - // we aren't ending an object exp'n, and ops - // like : << / are unary operators. - - if (ch == '{') { - ++brace_counts; - preferRE = true; - } else if (ch == '}' && --brace_counts < 0 - && inner_string_count > 0) { - styler.ColourTo(i, SCE_RB_OPERATOR); - exitInnerExpression(inner_string_types, - inner_expn_brace_counts, - inner_quotes, - inner_string_count, - state, brace_counts, Quote); - } else { - preferRE = (strchr(")}].", ch) == NULL); - } - // Stay in default state - } else if (isEOLChar(ch)) { - // Make sure it's a true line-end, with no backslash - if ((ch == '\r' || (ch == '\n' && chPrev != '\r')) - && chPrev != '\\') { - // Assume we've hit the end of the statement. - preferRE = true; - } - } - } else if (state == SCE_RB_WORD) { - if (ch == '.' || !isSafeWordcharOrHigh(ch)) { - // Words include x? in all contexts, - // and <letters>= after either 'def' or a dot - // Move along until a complete word is on our left - - // Default accessor treats '.' as word-chars, - // but we don't for now. - - if (ch == '=' - && isSafeWordcharOrHigh(chPrev) - && (chNext == '(' - || strchr(" \t\n\r", chNext) != NULL) - && (!strcmp(prevWord, "def") - || followsDot(styler.GetStartSegment(), styler))) { - // <name>= is a name only when being def'd -- Get it the next time - // This means that <name>=<name> is always lexed as - // <name>, (op, =), <name> - } else if (ch == ':' - && isSafeWordcharOrHigh(chPrev) - && strchr(" \t\n\r", chNext) != NULL) { - state = SCE_RB_SYMBOL; - } else if ((ch == '?' || ch == '!') - && isSafeWordcharOrHigh(chPrev) - && !isSafeWordcharOrHigh(chNext)) { - // <name>? is a name -- Get it the next time - // But <name>?<name> is always lexed as - // <name>, (op, ?), <name> - // Same with <name>! to indicate a method that - // modifies its target - } else if (isEOLChar(ch) - && isMatch(styler, lengthDoc, i - 7, "__END__")) { - styler.ColourTo(i, SCE_RB_DATASECTION); - state = SCE_RB_DATASECTION; - // No need to handle this state -- we'll just move to the end - preferRE = false; - } else { - Sci_Position wordStartPos = styler.GetStartSegment(); - int word_style = ClassifyWordRb(wordStartPos, i - 1, keywords, styler, prevWord); - switch (word_style) { - case SCE_RB_WORD: - preferRE = RE_CanFollowKeyword(prevWord); - break; - - case SCE_RB_WORD_DEMOTED: - preferRE = true; - break; - - case SCE_RB_IDENTIFIER: - if (isMatch(styler, lengthDoc, wordStartPos, "print")) { - preferRE = true; - } else if (isEOLChar(ch)) { - preferRE = true; - } else { - preferRE = false; - } - break; - default: - preferRE = false; - } - if (ch == '.') { - // We might be redefining an operator-method - preferRE = false; - } - // And if it's the first - redo_char(i, ch, chNext, chNext2, state); // pass by ref - } - } - } else if (state == SCE_RB_NUMBER) { - if (!is_real_number) { - if (ch != '\\') { - styler.ColourTo(i, state); - state = SCE_RB_DEFAULT; - preferRE = false; - } else if (strchr("\\ntrfvaebs", chNext)) { - // Terminal escape sequence -- handle it next time - // Nothing more to do this time through the loop - } else if (chNext == 'C' || chNext == 'M') { - if (chNext2 != '-') { - // \C or \M ends the sequence -- handle it next time - } else { - // Move from abc?\C-x - // ^ - // to - // ^ - i += 2; - ch = chNext2; - chNext = styler.SafeGetCharAt(i + 1); - } - } else if (chNext == 'c') { - // Stay here, \c is a combining sequence - advance_char(i, ch, chNext, chNext2); // pass by ref - } else { - // ?\x, including ?\\ is final. - styler.ColourTo(i + 1, state); - state = SCE_RB_DEFAULT; - preferRE = false; - advance_char(i, ch, chNext, chNext2); - } - } else if (isSafeAlnumOrHigh(ch) || ch == '_') { - // Keep going - } else if (ch == '.' && chNext == '.') { - ++numDots; - styler.ColourTo(i - 1, state); - redo_char(i, ch, chNext, chNext2, state); // pass by ref - } else if (ch == '.' && ++numDots == 1) { - // Keep going - } else { - styler.ColourTo(i - 1, state); - redo_char(i, ch, chNext, chNext2, state); // pass by ref - preferRE = false; - } - } else if (state == SCE_RB_COMMENTLINE) { - if (isEOLChar(ch)) { - styler.ColourTo(i - 1, state); - state = SCE_RB_DEFAULT; - // Use whatever setting we had going into the comment - } - } else if (state == SCE_RB_HERE_DELIM) { - // See the comment for SCE_RB_HERE_DELIM in LexPerl.cxx - // Slightly different: if we find an immediate '-', - // the target can appear indented. - - if (HereDoc.State == 0) { // '<<' encountered - HereDoc.State = 1; - HereDoc.DelimiterLength = 0; - if (ch == '-' || ch == '~') { - HereDoc.CanBeIndented = true; - advance_char(i, ch, chNext, chNext2); // pass by ref - } else { - HereDoc.CanBeIndented = false; - } - if (isEOLChar(ch)) { - // Bail out of doing a here doc if there's no target - state = SCE_RB_DEFAULT; - preferRE = false; - } else { - HereDoc.Quote = ch; - - if (ch == '\'' || ch == '"' || ch == '`') { - HereDoc.Quoted = true; - HereDoc.Delimiter[0] = '\0'; - } else { - HereDoc.Quoted = false; - HereDoc.Delimiter[0] = ch; - HereDoc.Delimiter[1] = '\0'; - HereDoc.DelimiterLength = 1; - } - } - } else if (HereDoc.State == 1) { // collect the delimiter - if (isEOLChar(ch)) { - // End the quote now, and go back for more - styler.ColourTo(i - 1, state); - state = SCE_RB_DEFAULT; - i--; - chNext = ch; - preferRE = false; - } else if (HereDoc.Quoted) { - if (ch == HereDoc.Quote) { // closing quote => end of delimiter - styler.ColourTo(i, state); - state = SCE_RB_DEFAULT; - preferRE = false; - } else { - if (ch == '\\' && !isEOLChar(chNext)) { - advance_char(i, ch, chNext, chNext2); - } - HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; - HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; - } - } else { // an unquoted here-doc delimiter - if (isSafeAlnumOrHigh(ch) || ch == '_') { - HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; - HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; - } else { - styler.ColourTo(i - 1, state); - redo_char(i, ch, chNext, chNext2, state); - preferRE = false; - } - } - if (HereDoc.DelimiterLength >= static_cast<int>(sizeof(HereDoc.Delimiter)) - 1) { - styler.ColourTo(i - 1, state); - state = SCE_RB_ERROR; - preferRE = false; - } - } - } else if (state == SCE_RB_HERE_Q) { - // Not needed: HereDoc.State == 2 - // Indentable here docs: look backwards - // Non-indentable: look forwards, like in Perl - // - // Why: so we can quickly resolve things like <<-" abc" - - if (!HereDoc.CanBeIndented) { - if (isEOLChar(chPrev) - && isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) { - styler.ColourTo(i - 1, state); - i += HereDoc.DelimiterLength - 1; - chNext = styler.SafeGetCharAt(i + 1); - if (isEOLChar(chNext)) { - styler.ColourTo(i, SCE_RB_HERE_DELIM); - state = SCE_RB_DEFAULT; - HereDoc.State = 0; - preferRE = false; - } - // Otherwise we skipped through the here doc faster. - } - } else if (isEOLChar(chNext) - && lookingAtHereDocDelim(styler, - i - HereDoc.DelimiterLength + 1, - lengthDoc, - HereDoc.Delimiter)) { - styler.ColourTo(i - 1 - HereDoc.DelimiterLength, state); - styler.ColourTo(i, SCE_RB_HERE_DELIM); - state = SCE_RB_DEFAULT; - preferRE = false; - HereDoc.State = 0; - } - } else if (state == SCE_RB_CLASS_VAR - || state == SCE_RB_INSTANCE_VAR - || state == SCE_RB_SYMBOL) { - if (state == SCE_RB_SYMBOL && - // FIDs suffices '?' and '!' - (((ch == '!' || ch == '?') && chNext != '=') || - // identifier suffix '=' - (ch == '=' && (chNext != '~' && chNext != '>' && - (chNext != '=' || chNext2 == '>'))))) { - styler.ColourTo(i, state); - state = SCE_RB_DEFAULT; - preferRE = false; - } else if (!isSafeWordcharOrHigh(ch)) { - styler.ColourTo(i - 1, state); - redo_char(i, ch, chNext, chNext2, state); // pass by ref - preferRE = false; - } - } else if (state == SCE_RB_GLOBAL) { - if (!isSafeWordcharOrHigh(ch)) { - // handle special globals here as well - if (chPrev == '$') { - if (ch == '-') { - // Include the next char, like $-a - advance_char(i, ch, chNext, chNext2); - } - styler.ColourTo(i, state); - state = SCE_RB_DEFAULT; - } else { - styler.ColourTo(i - 1, state); - redo_char(i, ch, chNext, chNext2, state); // pass by ref - } - preferRE = false; - } - } else if (state == SCE_RB_POD) { - // PODs end with ^=end\s, -- any whitespace can follow =end - if (strchr(" \t\n\r", ch) != NULL - && i > 5 - && isEOLChar(styler[i - 5]) - && isMatch(styler, lengthDoc, i - 4, "=end")) { - styler.ColourTo(i - 1, state); - state = SCE_RB_DEFAULT; - preferRE = false; - } - } else if (state == SCE_RB_REGEX || state == SCE_RB_STRING_QR) { - if (ch == '\\' && Quote.Up != '\\') { - // Skip one - advance_char(i, ch, chNext, chNext2); - } else if (ch == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - // Include the options - while (isSafeAlpha(chNext)) { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - styler.ColourTo(i, state); - state = SCE_RB_DEFAULT; - preferRE = false; - } - } else if (ch == Quote.Up) { - // Only if close quoter != open quoter - Quote.Count++; - - } else if (ch == '#') { - if (chNext == '{' - && inner_string_count < INNER_STRINGS_MAX_COUNT) { - // process #{ ... } - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_RB_OPERATOR); - enterInnerExpression(inner_string_types, - inner_expn_brace_counts, - inner_quotes, - inner_string_count, - state, - brace_counts, - Quote); - preferRE = true; - // Skip one - advance_char(i, ch, chNext, chNext2); - } else { - //todo: distinguish comments from pound chars - // for now, handle as comment - styler.ColourTo(i - 1, state); - bool inEscape = false; - while (++i < lengthDoc) { - ch = styler.SafeGetCharAt(i); - if (ch == '\\') { - inEscape = true; - } else if (isEOLChar(ch)) { - // Comment inside a regex - styler.ColourTo(i - 1, SCE_RB_COMMENTLINE); - break; - } else if (inEscape) { - inEscape = false; // don't look at char - } else if (ch == Quote.Down) { - // Have the regular handler deal with this - // to get trailing modifiers. - i--; - ch = styler[i]; - break; - } - } - chNext = styler.SafeGetCharAt(i + 1); - } - } - // Quotes of all kinds... - } else if (state == SCE_RB_STRING_Q || state == SCE_RB_STRING_QQ || - state == SCE_RB_STRING_QX || state == SCE_RB_STRING_QW || - state == SCE_RB_STRING || state == SCE_RB_CHARACTER || - state == SCE_RB_BACKTICKS) { - if (!Quote.Down && !isspacechar(ch)) { - Quote.Open(ch); - } else if (ch == '\\' && Quote.Up != '\\') { - //Riddle me this: Is it safe to skip *every* escaped char? - advance_char(i, ch, chNext, chNext2); - } else if (ch == Quote.Down) { - Quote.Count--; - if (Quote.Count == 0) { - styler.ColourTo(i, state); - state = SCE_RB_DEFAULT; - preferRE = false; - } - } else if (ch == Quote.Up) { - Quote.Count++; - } else if (ch == '#' && chNext == '{' - && inner_string_count < INNER_STRINGS_MAX_COUNT - && state != SCE_RB_CHARACTER - && state != SCE_RB_STRING_Q) { - // process #{ ... } - styler.ColourTo(i - 1, state); - styler.ColourTo(i + 1, SCE_RB_OPERATOR); - enterInnerExpression(inner_string_types, - inner_expn_brace_counts, - inner_quotes, - inner_string_count, - state, - brace_counts, - Quote); - preferRE = true; - // Skip one - advance_char(i, ch, chNext, chNext2); - } - } - - if (state == SCE_RB_ERROR) { - break; - } - chPrev = ch; - } - if (state == SCE_RB_WORD) { - // We've ended on a word, possibly at EOF, and need to - // classify it. - (void) ClassifyWordRb(styler.GetStartSegment(), lengthDoc - 1, keywords, styler, prevWord); - } else { - styler.ColourTo(lengthDoc - 1, state); - } -} - -// Helper functions for folding, disambiguation keywords -// Assert that there are no high-bit chars - -static void getPrevWord(Sci_Position pos, - char *prevWord, - Accessor &styler, - int word_state) -{ - Sci_Position i; - styler.Flush(); - for (i = pos - 1; i > 0; i--) { - if (actual_style(styler.StyleAt(i)) != word_state) { - i++; - break; - } - } - if (i < pos - MAX_KEYWORD_LENGTH) // overflow - i = pos - MAX_KEYWORD_LENGTH; - char *dst = prevWord; - for (; i <= pos; i++) { - *dst++ = styler[i]; - } - *dst = 0; -} - -static bool keywordIsAmbiguous(const char *prevWord) -{ - // Order from most likely used to least likely - // Lots of ways to do a loop in Ruby besides 'while/until' - if (!strcmp(prevWord, "if") - || !strcmp(prevWord, "do") - || !strcmp(prevWord, "while") - || !strcmp(prevWord, "unless") - || !strcmp(prevWord, "until") - || !strcmp(prevWord, "for")) { - return true; - } else { - return false; - } -} - -// Demote keywords in the following conditions: -// if, while, unless, until modify a statement -// do after a while or until, as a noise word (like then after if) - -static bool keywordIsModifier(const char *word, - Sci_Position pos, - Accessor &styler) -{ - if (word[0] == 'd' && word[1] == 'o' && !word[2]) { - return keywordDoStartsLoop(pos, styler); - } - char ch, chPrev, chPrev2; - int style = SCE_RB_DEFAULT; - Sci_Position lineStart = styler.GetLine(pos); - Sci_Position lineStartPosn = styler.LineStart(lineStart); - // We want to step backwards until we don't care about the current - // position. But first move lineStartPosn back behind any - // continuations immediately above word. - while (lineStartPosn > 0) { - ch = styler[lineStartPosn-1]; - if (ch == '\n' || ch == '\r') { - chPrev = styler.SafeGetCharAt(lineStartPosn-2); - chPrev2 = styler.SafeGetCharAt(lineStartPosn-3); - lineStart = styler.GetLine(lineStartPosn-1); - // If we find a continuation line, include it in our analysis. - if (chPrev == '\\') { - lineStartPosn = styler.LineStart(lineStart); - } else if (ch == '\n' && chPrev == '\r' && chPrev2 == '\\') { - lineStartPosn = styler.LineStart(lineStart); - } else { - break; - } - } else { - break; - } - } - - styler.Flush(); - while (--pos >= lineStartPosn) { - style = actual_style(styler.StyleAt(pos)); - if (style == SCE_RB_DEFAULT) { - if (iswhitespace(ch = styler[pos])) { - //continue - } else if (ch == '\r' || ch == '\n') { - // Scintilla's LineStart() and GetLine() routines aren't - // platform-independent, so if we have text prepared with - // a different system we can't rely on it. - - // Also, lineStartPosn may have been moved to more than one - // line above word's line while pushing past continuations. - chPrev = styler.SafeGetCharAt(pos - 1); - chPrev2 = styler.SafeGetCharAt(pos - 2); - if (chPrev == '\\') { - pos-=1; // gloss over the "\\" - //continue - } else if (ch == '\n' && chPrev == '\r' && chPrev2 == '\\') { - pos-=2; // gloss over the "\\\r" - //continue - } else { - return false; - } - } - } else { - break; - } - } - if (pos < lineStartPosn) { - return false; - } - // First things where the action is unambiguous - switch (style) { - case SCE_RB_DEFAULT: - case SCE_RB_COMMENTLINE: - case SCE_RB_POD: - case SCE_RB_CLASSNAME: - case SCE_RB_DEFNAME: - case SCE_RB_MODULE_NAME: - return false; - case SCE_RB_OPERATOR: - break; - case SCE_RB_WORD: - // Watch out for uses of 'else if' - //XXX: Make a list of other keywords where 'if' isn't a modifier - // and can appear legitimately - // Formulate this to avoid warnings from most compilers - if (strcmp(word, "if") == 0) { - char prevWord[MAX_KEYWORD_LENGTH + 1]; - getPrevWord(pos, prevWord, styler, SCE_RB_WORD); - return strcmp(prevWord, "else") != 0; - } - return true; - default: - return true; - } - // Assume that if the keyword follows an operator, - // usually it's a block assignment, like - // a << if x then y else z - - ch = styler[pos]; - switch (ch) { - case ')': - case ']': - case '}': - return true; - default: - return false; - } -} - -#define WHILE_BACKWARDS "elihw" -#define UNTIL_BACKWARDS "litnu" -#define FOR_BACKWARDS "rof" - -// Nothing fancy -- look to see if we follow a while/until somewhere -// on the current line - -static bool keywordDoStartsLoop(Sci_Position pos, - Accessor &styler) -{ - char ch; - int style; - Sci_Position lineStart = styler.GetLine(pos); - Sci_Position lineStartPosn = styler.LineStart(lineStart); - styler.Flush(); - while (--pos >= lineStartPosn) { - style = actual_style(styler.StyleAt(pos)); - if (style == SCE_RB_DEFAULT) { - if ((ch = styler[pos]) == '\r' || ch == '\n') { - // Scintilla's LineStart() and GetLine() routines aren't - // platform-independent, so if we have text prepared with - // a different system we can't rely on it. - return false; - } - } else if (style == SCE_RB_WORD) { - // Check for while or until, but write the word in backwards - char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero - char *dst = prevWord; - int wordLen = 0; - Sci_Position start_word; - for (start_word = pos; - start_word >= lineStartPosn && actual_style(styler.StyleAt(start_word)) == SCE_RB_WORD; - start_word--) { - if (++wordLen < MAX_KEYWORD_LENGTH) { - *dst++ = styler[start_word]; - } - } - *dst = 0; - // Did we see our keyword? - if (!strcmp(prevWord, WHILE_BACKWARDS) - || !strcmp(prevWord, UNTIL_BACKWARDS) - || !strcmp(prevWord, FOR_BACKWARDS)) { - return true; - } - // We can move pos to the beginning of the keyword, and then - // accept another decrement, as we can never have two contiguous - // keywords: - // word1 word2 - // ^ - // <- move to start_word - // ^ - // <- loop decrement - // ^ # pointing to end of word1 is fine - pos = start_word; - } - } - return false; -} - -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; -} - -/* - * Folding Ruby - * - * The language is quite complex to analyze without a full parse. - * For example, this line shouldn't affect fold level: - * - * print "hello" if feeling_friendly? - * - * Neither should this: - * - * print "hello" \ - * if feeling_friendly? - * - * - * But this should: - * - * if feeling_friendly? #++ - * print "hello" \ - * print "goodbye" - * end #-- - * - * So we cheat, by actually looking at the existing indentation - * levels for each line, and just echoing it back. Like Python. - * Then if we get better at it, we'll take braces into consideration, - * which always affect folding levels. - - * How the keywords should work: - * No effect: - * __FILE__ __LINE__ BEGIN END alias and - * defined? false in nil not or self super then - * true undef - - * Always increment: - * begin class def do for module when { - * - * Always decrement: - * end } - * - * Increment if these start a statement - * if unless until while -- do nothing if they're modifiers - - * These end a block if there's no modifier, but don't bother - * break next redo retry return yield - * - * These temporarily de-indent, but re-indent - * case else elsif ensure rescue - * - * This means that the folder reflects indentation rather - * than setting it. The language-service updates indentation - * when users type return and finishes entering de-denters. - * - * Later offer to fold POD, here-docs, strings, and blocks of comments - */ - -static void FoldRbDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *[], Accessor &styler) { - const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - - synchronizeDocStart(startPos, length, initStyle, styler, // ref args - false); - Sci_PositionU endPos = startPos + length; - int visibleChars = 0; - Sci_Position lineCurrent = styler.GetLine(startPos); - int levelPrev = startPos == 0 ? 0 : (styler.LevelAt(lineCurrent) - & SC_FOLDLEVELNUMBERMASK - & ~SC_FOLDLEVELBASE); - int levelCurrent = levelPrev; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int stylePrev = startPos <= 1 ? SCE_RB_DEFAULT : styler.StyleAt(startPos - 1); - bool buffer_ends_with_eol = false; - 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'); - - /*Mutiline comment patch*/ - 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 (style == SCE_RB_COMMENTLINE) { - if (foldComment && stylePrev != SCE_RB_COMMENTLINE) { - if (chNext == '{') { - levelCurrent++; - } else if (chNext == '}' && levelCurrent > 0) { - levelCurrent--; - } - } - } else if (style == SCE_RB_OPERATOR) { - if (strchr("[{(", ch)) { - levelCurrent++; - } else if (strchr(")}]", ch)) { - // Don't decrement below 0 - if (levelCurrent > 0) - levelCurrent--; - } - } else if (style == SCE_RB_WORD && styleNext != SCE_RB_WORD) { - // Look at the keyword on the left and decide what to do - char prevWord[MAX_KEYWORD_LENGTH + 1]; // 1 byte for zero - prevWord[0] = 0; - getPrevWord(i, prevWord, styler, SCE_RB_WORD); - if (!strcmp(prevWord, "end")) { - // Don't decrement below 0 - if (levelCurrent > 0) - levelCurrent--; - } else if (!strcmp(prevWord, "if") - || !strcmp(prevWord, "def") - || !strcmp(prevWord, "class") - || !strcmp(prevWord, "module") - || !strcmp(prevWord, "begin") - || !strcmp(prevWord, "case") - || !strcmp(prevWord, "do") - || !strcmp(prevWord, "while") - || !strcmp(prevWord, "unless") - || !strcmp(prevWord, "until") - || !strcmp(prevWord, "for") - ) { - levelCurrent++; - } - } else if (style == SCE_RB_HERE_DELIM) { - if (styler.SafeGetCharAt(i-2) == '<' && styler.SafeGetCharAt(i-1) == '<') { - levelCurrent++; - } else if (styleNext == SCE_RB_DEFAULT) { - levelCurrent--; - } - } - if (atEOL) { - int lev = levelPrev; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - styler.SetLevel(lineCurrent, lev|SC_FOLDLEVELBASE); - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - buffer_ends_with_eol = true; - } else if (!isspacechar(ch)) { - visibleChars++; - buffer_ends_with_eol = false; - } - stylePrev = style; - } - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - if (!buffer_ends_with_eol) { - lineCurrent++; - int new_lev = levelCurrent; - if (visibleChars == 0 && foldCompact) - new_lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev) && (visibleChars > 0)) - new_lev |= SC_FOLDLEVELHEADERFLAG; - levelCurrent = new_lev; - } - styler.SetLevel(lineCurrent, levelCurrent|SC_FOLDLEVELBASE); -} - -static const char *const rubyWordListDesc[] = { - "Keywords", - 0 -}; - -LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc); diff --git a/lexers/LexRust.cxx b/lexers/LexRust.cxx deleted file mode 100644 index 439d2d3b0..000000000 --- a/lexers/LexRust.cxx +++ /dev/null @@ -1,844 +0,0 @@ -/** @file LexRust.cxx - ** Lexer for Rust. - ** - ** Copyright (c) 2013 by SiegeLord <slabode@aim.com> - ** Converted to lexer object and added further folding features/properties by "Udo Lechner" <dlchnr(at)gmx(dot)net> - **/ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <map> - -#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" -#include "DefaultLexer.h" - -using namespace Scintilla; - -static const int NUM_RUST_KEYWORD_LISTS = 7; -static const int MAX_RUST_IDENT_CHARS = 1023; - -static bool IsStreamCommentStyle(int style) { - return style == SCE_RUST_COMMENTBLOCK || - style == SCE_RUST_COMMENTBLOCKDOC; -} - -// Options used for LexerRust -struct OptionsRust { - bool fold; - bool foldSyntaxBased; - bool foldComment; - bool foldCommentMultiline; - bool foldCommentExplicit; - std::string foldExplicitStart; - std::string foldExplicitEnd; - bool foldExplicitAnywhere; - bool foldCompact; - int foldAtElseInt; - bool foldAtElse; - OptionsRust() { - fold = false; - foldSyntaxBased = true; - foldComment = false; - foldCommentMultiline = true; - foldCommentExplicit = true; - foldExplicitStart = ""; - foldExplicitEnd = ""; - foldExplicitAnywhere = false; - foldCompact = true; - foldAtElseInt = -1; - foldAtElse = false; - } -}; - -static const char * const rustWordLists[NUM_RUST_KEYWORD_LISTS + 1] = { - "Primary keywords and identifiers", - "Built in types", - "Other keywords", - "Keywords 4", - "Keywords 5", - "Keywords 6", - "Keywords 7", - 0, - }; - -struct OptionSetRust : public OptionSet<OptionsRust> { - OptionSetRust() { - DefineProperty("fold", &OptionsRust::fold); - - DefineProperty("fold.comment", &OptionsRust::foldComment); - - DefineProperty("fold.compact", &OptionsRust::foldCompact); - - DefineProperty("fold.at.else", &OptionsRust::foldAtElse); - - DefineProperty("fold.rust.syntax.based", &OptionsRust::foldSyntaxBased, - "Set this property to 0 to disable syntax based folding."); - - DefineProperty("fold.rust.comment.multiline", &OptionsRust::foldCommentMultiline, - "Set this property to 0 to disable folding multi-line comments when fold.comment=1."); - - DefineProperty("fold.rust.comment.explicit", &OptionsRust::foldCommentExplicit, - "Set this property to 0 to disable folding explicit fold points when fold.comment=1."); - - DefineProperty("fold.rust.explicit.start", &OptionsRust::foldExplicitStart, - "The string to use for explicit fold start points, replacing the standard //{."); - - DefineProperty("fold.rust.explicit.end", &OptionsRust::foldExplicitEnd, - "The string to use for explicit fold end points, replacing the standard //}."); - - DefineProperty("fold.rust.explicit.anywhere", &OptionsRust::foldExplicitAnywhere, - "Set this property to 1 to enable explicit fold points anywhere, not just in line comments."); - - DefineProperty("lexer.rust.fold.at.else", &OptionsRust::foldAtElseInt, - "This option enables Rust folding on a \"} else {\" line of an if statement."); - - DefineWordListSets(rustWordLists); - } -}; - -class LexerRust : public DefaultLexer { - WordList keywords[NUM_RUST_KEYWORD_LISTS]; - OptionsRust options; - OptionSetRust osRust; -public: - LexerRust() : DefaultLexer("rust", SCLEX_RUST) { - } - virtual ~LexerRust() { - } - void SCI_METHOD Release() override { - delete this; - } - int SCI_METHOD Version() const override { - return lvRelease5; - } - const char * SCI_METHOD PropertyNames() override { - return osRust.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) override { - return osRust.PropertyType(name); - } - const char * SCI_METHOD DescribeProperty(const char *name) override { - return osRust.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; - const char * SCI_METHOD PropertyGet(const char *key) override { - return osRust.PropertyGet(key); - } - const char * SCI_METHOD DescribeWordListSets() override { - return osRust.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 *LexerFactoryRust() { - return new LexerRust(); - } -}; - -Sci_Position SCI_METHOD LexerRust::PropertySet(const char *key, const char *val) { - if (osRust.PropertySet(&options, key, val)) { - return 0; - } - return -1; -} - -Sci_Position SCI_METHOD LexerRust::WordListSet(int n, const char *wl) { - Sci_Position firstModification = -1; - if (n < NUM_RUST_KEYWORD_LISTS) { - WordList *wordListN = &keywords[n]; - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - } - } - return firstModification; -} - -static bool IsWhitespace(int c) { - return c == ' ' || c == '\t' || c == '\r' || c == '\n'; -} - -/* This isn't quite right for Unicode identifiers */ -static bool IsIdentifierStart(int ch) { - return (IsASCII(ch) && (isalpha(ch) || ch == '_')) || !IsASCII(ch); -} - -/* This isn't quite right for Unicode identifiers */ -static bool IsIdentifierContinue(int ch) { - return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch); -} - -static void ScanWhitespace(Accessor& styler, Sci_Position& pos, Sci_Position max) { - while (IsWhitespace(styler.SafeGetCharAt(pos, '\0')) && pos < max) { - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), 0); - pos++; - } - styler.ColourTo(pos-1, SCE_RUST_DEFAULT); -} - -static void GrabString(char* s, Accessor& styler, Sci_Position start, Sci_Position len) { - for (Sci_Position ii = 0; ii < len; ii++) - s[ii] = styler[ii + start]; - s[len] = '\0'; -} - -static void ScanIdentifier(Accessor& styler, Sci_Position& pos, WordList *keywords) { - Sci_Position start = pos; - while (IsIdentifierContinue(styler.SafeGetCharAt(pos, '\0'))) - pos++; - - if (styler.SafeGetCharAt(pos, '\0') == '!') { - pos++; - styler.ColourTo(pos - 1, SCE_RUST_MACRO); - } else { - char s[MAX_RUST_IDENT_CHARS + 1]; - Sci_Position len = pos - start; - len = len > MAX_RUST_IDENT_CHARS ? MAX_RUST_IDENT_CHARS : len; - GrabString(s, styler, start, len); - bool keyword = false; - for (int ii = 0; ii < NUM_RUST_KEYWORD_LISTS; ii++) { - if (keywords[ii].InList(s)) { - styler.ColourTo(pos - 1, SCE_RUST_WORD + ii); - keyword = true; - break; - } - } - if (!keyword) { - styler.ColourTo(pos - 1, SCE_RUST_IDENTIFIER); - } - } -} - -/* Scans a sequence of digits, returning true if it found any. */ -static bool ScanDigits(Accessor& styler, Sci_Position& pos, int base) { - Sci_Position old_pos = pos; - for (;;) { - int c = styler.SafeGetCharAt(pos, '\0'); - if (IsADigit(c, base) || c == '_') - pos++; - else - break; - } - return old_pos != pos; -} - -/* Scans an integer and floating point literals. */ -static void ScanNumber(Accessor& styler, Sci_Position& pos) { - int base = 10; - int c = styler.SafeGetCharAt(pos, '\0'); - int n = styler.SafeGetCharAt(pos + 1, '\0'); - bool error = false; - /* Scan the prefix, thus determining the base. - * 10 is default if there's no prefix. */ - if (c == '0' && n == 'x') { - pos += 2; - base = 16; - } else if (c == '0' && n == 'b') { - pos += 2; - base = 2; - } else if (c == '0' && n == 'o') { - pos += 2; - base = 8; - } - - /* Scan initial digits. The literal is malformed if there are none. */ - error |= !ScanDigits(styler, pos, base); - /* See if there's an integer suffix. We mimic the Rust's lexer - * and munch it even if there was an error above. */ - c = styler.SafeGetCharAt(pos, '\0'); - if (c == 'u' || c == 'i') { - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - n = styler.SafeGetCharAt(pos + 1, '\0'); - if (c == '8') { - pos++; - } else if (c == '1' && n == '6') { - pos += 2; - } else if (c == '3' && n == '2') { - pos += 2; - } else if (c == '6' && n == '4') { - pos += 2; - } else if (styler.Match(pos, "size")) { - pos += 4; - } else { - error = true; - } - /* See if it's a floating point literal. These literals have to be base 10. - */ - } else if (!error) { - /* If there's a period, it's a floating point literal unless it's - * followed by an identifier (meaning this is a method call, e.g. - * `1.foo()`) or another period, in which case it's a range (e.g. 1..2) - */ - n = styler.SafeGetCharAt(pos + 1, '\0'); - if (c == '.' && !(IsIdentifierStart(n) || n == '.')) { - error |= base != 10; - pos++; - /* It's ok to have no digits after the period. */ - ScanDigits(styler, pos, 10); - } - - /* Look for the exponentiation. */ - c = styler.SafeGetCharAt(pos, '\0'); - if (c == 'e' || c == 'E') { - error |= base != 10; - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - if (c == '-' || c == '+') - pos++; - /* It is invalid to have no digits in the exponent. */ - error |= !ScanDigits(styler, pos, 10); - } - - /* Scan the floating point suffix. */ - c = styler.SafeGetCharAt(pos, '\0'); - if (c == 'f') { - error |= base != 10; - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - n = styler.SafeGetCharAt(pos + 1, '\0'); - if (c == '3' && n == '2') { - pos += 2; - } else if (c == '6' && n == '4') { - pos += 2; - } else { - error = true; - } - } - } - - if (error) - styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); - else - styler.ColourTo(pos - 1, SCE_RUST_NUMBER); -} - -static bool IsOneCharOperator(int c) { - return c == ';' || c == ',' || c == '(' || c == ')' - || c == '{' || c == '}' || c == '[' || c == ']' - || c == '@' || c == '#' || c == '~' || c == '+' - || c == '*' || c == '/' || c == '^' || c == '%' - || c == '.' || c == ':' || c == '!' || c == '<' - || c == '>' || c == '=' || c == '-' || c == '&' - || c == '|' || c == '$' || c == '?'; -} - -static bool IsTwoCharOperator(int c, int n) { - return (c == '.' && n == '.') || (c == ':' && n == ':') - || (c == '!' && n == '=') || (c == '<' && n == '<') - || (c == '<' && n == '=') || (c == '>' && n == '>') - || (c == '>' && n == '=') || (c == '=' && n == '=') - || (c == '=' && n == '>') || (c == '-' && n == '>') - || (c == '&' && n == '&') || (c == '|' && n == '|') - || (c == '-' && n == '=') || (c == '&' && n == '=') - || (c == '|' && n == '=') || (c == '+' && n == '=') - || (c == '*' && n == '=') || (c == '/' && n == '=') - || (c == '^' && n == '=') || (c == '%' && n == '='); -} - -static bool IsThreeCharOperator(int c, int n, int n2) { - return (c == '<' && n == '<' && n2 == '=') - || (c == '>' && n == '>' && n2 == '='); -} - -static bool IsValidCharacterEscape(int c) { - return c == 'n' || c == 'r' || c == 't' || c == '\\' - || c == '\'' || c == '"' || c == '0'; -} - -static bool IsValidStringEscape(int c) { - return IsValidCharacterEscape(c) || c == '\n' || c == '\r'; -} - -static bool ScanNumericEscape(Accessor &styler, Sci_Position& pos, Sci_Position num_digits, bool stop_asap) { - for (;;) { - int c = styler.SafeGetCharAt(pos, '\0'); - if (!IsADigit(c, 16)) - break; - num_digits--; - pos++; - if (num_digits == 0 && stop_asap) - return true; - } - if (num_digits == 0) { - return true; - } else { - return false; - } -} - -/* This is overly permissive for character literals in order to accept UTF-8 encoded - * character literals. */ -static void ScanCharacterLiteralOrLifetime(Accessor &styler, Sci_Position& pos, bool ascii_only) { - pos++; - int c = styler.SafeGetCharAt(pos, '\0'); - int n = styler.SafeGetCharAt(pos + 1, '\0'); - bool done = false; - bool valid_lifetime = !ascii_only && IsIdentifierStart(c); - bool valid_char = true; - bool first = true; - while (!done) { - switch (c) { - case '\\': - done = true; - if (IsValidCharacterEscape(n)) { - pos += 2; - } else if (n == 'x') { - pos += 2; - valid_char = ScanNumericEscape(styler, pos, 2, false); - } else if (n == 'u' && !ascii_only) { - pos += 2; - if (styler.SafeGetCharAt(pos, '\0') != '{') { - // old-style - valid_char = ScanNumericEscape(styler, pos, 4, false); - } else { - int n_digits = 0; - while (IsADigit(styler.SafeGetCharAt(++pos, '\0'), 16) && n_digits++ < 6) { - } - if (n_digits > 0 && styler.SafeGetCharAt(pos, '\0') == '}') - pos++; - else - valid_char = false; - } - } else if (n == 'U' && !ascii_only) { - pos += 2; - valid_char = ScanNumericEscape(styler, pos, 8, false); - } else { - valid_char = false; - } - break; - case '\'': - valid_char = !first; - done = true; - break; - case '\t': - case '\n': - case '\r': - case '\0': - valid_char = false; - done = true; - break; - default: - if (ascii_only && !IsASCII((char)c)) { - done = true; - valid_char = false; - } else if (!IsIdentifierContinue(c) && !first) { - done = true; - } else { - pos++; - } - break; - } - c = styler.SafeGetCharAt(pos, '\0'); - n = styler.SafeGetCharAt(pos + 1, '\0'); - - first = false; - } - if (styler.SafeGetCharAt(pos, '\0') == '\'') { - valid_lifetime = false; - } else { - valid_char = false; - } - if (valid_lifetime) { - styler.ColourTo(pos - 1, SCE_RUST_LIFETIME); - } else if (valid_char) { - pos++; - styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTECHARACTER : SCE_RUST_CHARACTER); - } else { - styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); - } -} - -enum CommentState { - UnknownComment, - DocComment, - NotDocComment -}; - -/* - * The rule for block-doc comments is as follows: /xxN and /x! (where x is an asterisk, N is a non-asterisk) start doc comments. - * Otherwise it's a regular comment. - */ -static void ResumeBlockComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state, int level) { - int c = styler.SafeGetCharAt(pos, '\0'); - bool maybe_doc_comment = false; - if (c == '*') { - int n = styler.SafeGetCharAt(pos + 1, '\0'); - if (n != '*' && n != '/') { - maybe_doc_comment = true; - } - } else if (c == '!') { - maybe_doc_comment = true; - } - - for (;;) { - int n = styler.SafeGetCharAt(pos + 1, '\0'); - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), level); - if (c == '*') { - pos++; - if (n == '/') { - pos++; - level--; - if (level == 0) { - styler.SetLineState(styler.GetLine(pos), 0); - if (state == DocComment || (state == UnknownComment && maybe_doc_comment)) - styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCKDOC); - else - styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCK); - break; - } - } - } else if (c == '/') { - pos++; - if (n == '*') { - pos++; - level++; - } - } - else { - pos++; - } - if (pos >= max) { - if (state == DocComment || (state == UnknownComment && maybe_doc_comment)) - styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCKDOC); - else - styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCK); - break; - } - c = styler.SafeGetCharAt(pos, '\0'); - } -} - -/* - * The rule for line-doc comments is as follows... ///N and //! (where N is a non slash) start doc comments. - * Otherwise it's a normal line comment. - */ -static void ResumeLineComment(Accessor &styler, Sci_Position& pos, Sci_Position max, CommentState state) { - bool maybe_doc_comment = false; - int c = styler.SafeGetCharAt(pos, '\0'); - if (c == '/') { - if (pos < max) { - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - if (c != '/') { - maybe_doc_comment = true; - } - } - } else if (c == '!') { - maybe_doc_comment = true; - } - - while (pos < max && c != '\n') { - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), 0); - pos++; - c = styler.SafeGetCharAt(pos, '\0'); - } - - if (state == DocComment || (state == UnknownComment && maybe_doc_comment)) - styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINEDOC); - else - styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINE); -} - -static void ScanComments(Accessor &styler, Sci_Position& pos, Sci_Position max) { - pos++; - int c = styler.SafeGetCharAt(pos, '\0'); - pos++; - if (c == '/') - ResumeLineComment(styler, pos, max, UnknownComment); - else if (c == '*') - ResumeBlockComment(styler, pos, max, UnknownComment, 1); -} - -static void ResumeString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) { - int c = styler.SafeGetCharAt(pos, '\0'); - bool error = false; - while (c != '"' && !error) { - if (pos >= max) { - error = true; - break; - } - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), 0); - if (c == '\\') { - int n = styler.SafeGetCharAt(pos + 1, '\0'); - if (IsValidStringEscape(n)) { - pos += 2; - } else if (n == 'x') { - pos += 2; - error = !ScanNumericEscape(styler, pos, 2, true); - } else if (n == 'u' && !ascii_only) { - pos += 2; - if (styler.SafeGetCharAt(pos, '\0') != '{') { - // old-style - error = !ScanNumericEscape(styler, pos, 4, true); - } else { - int n_digits = 0; - while (IsADigit(styler.SafeGetCharAt(++pos, '\0'), 16) && n_digits++ < 6) { - } - if (n_digits > 0 && styler.SafeGetCharAt(pos, '\0') == '}') - pos++; - else - error = true; - } - } else if (n == 'U' && !ascii_only) { - pos += 2; - error = !ScanNumericEscape(styler, pos, 8, true); - } else { - pos += 1; - error = true; - } - } else { - if (ascii_only && !IsASCII((char)c)) - error = true; - else - pos++; - } - c = styler.SafeGetCharAt(pos, '\0'); - } - if (!error) - pos++; - styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRING : SCE_RUST_STRING); -} - -static void ResumeRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, int num_hashes, bool ascii_only) { - for (;;) { - if (pos == styler.LineEnd(styler.GetLine(pos))) - styler.SetLineState(styler.GetLine(pos), num_hashes); - - int c = styler.SafeGetCharAt(pos, '\0'); - if (c == '"') { - pos++; - int trailing_num_hashes = 0; - while (styler.SafeGetCharAt(pos, '\0') == '#' && trailing_num_hashes < num_hashes) { - trailing_num_hashes++; - pos++; - } - if (trailing_num_hashes == num_hashes) { - styler.SetLineState(styler.GetLine(pos), 0); - break; - } - } else if (pos >= max) { - break; - } else { - if (ascii_only && !IsASCII((char)c)) - break; - pos++; - } - } - styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRINGR : SCE_RUST_STRINGR); -} - -static void ScanRawString(Accessor &styler, Sci_Position& pos, Sci_Position max, bool ascii_only) { - pos++; - int num_hashes = 0; - while (styler.SafeGetCharAt(pos, '\0') == '#') { - num_hashes++; - pos++; - } - if (styler.SafeGetCharAt(pos, '\0') != '"') { - styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); - } else { - pos++; - ResumeRawString(styler, pos, max, num_hashes, ascii_only); - } -} - -void SCI_METHOD LexerRust::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - PropSetSimple props; - Accessor styler(pAccess, &props); - Sci_Position pos = startPos; - Sci_Position max = pos + length; - - styler.StartAt(pos); - styler.StartSegment(pos); - - if (initStyle == SCE_RUST_COMMENTBLOCK || initStyle == SCE_RUST_COMMENTBLOCKDOC) { - ResumeBlockComment(styler, pos, max, initStyle == SCE_RUST_COMMENTBLOCKDOC ? DocComment : NotDocComment, styler.GetLineState(styler.GetLine(pos) - 1)); - } else if (initStyle == SCE_RUST_COMMENTLINE || initStyle == SCE_RUST_COMMENTLINEDOC) { - ResumeLineComment(styler, pos, max, initStyle == SCE_RUST_COMMENTLINEDOC ? DocComment : NotDocComment); - } else if (initStyle == SCE_RUST_STRING) { - ResumeString(styler, pos, max, false); - } else if (initStyle == SCE_RUST_BYTESTRING) { - ResumeString(styler, pos, max, true); - } else if (initStyle == SCE_RUST_STRINGR) { - ResumeRawString(styler, pos, max, styler.GetLineState(styler.GetLine(pos) - 1), false); - } else if (initStyle == SCE_RUST_BYTESTRINGR) { - ResumeRawString(styler, pos, max, styler.GetLineState(styler.GetLine(pos) - 1), true); - } - - while (pos < max) { - int c = styler.SafeGetCharAt(pos, '\0'); - int n = styler.SafeGetCharAt(pos + 1, '\0'); - int n2 = styler.SafeGetCharAt(pos + 2, '\0'); - - if (pos == 0 && c == '#' && n == '!' && n2 != '[') { - pos += 2; - ResumeLineComment(styler, pos, max, NotDocComment); - } else if (IsWhitespace(c)) { - ScanWhitespace(styler, pos, max); - } else if (c == '/' && (n == '/' || n == '*')) { - ScanComments(styler, pos, max); - } else if (c == 'r' && (n == '#' || n == '"')) { - ScanRawString(styler, pos, max, false); - } else if (c == 'b' && n == 'r' && (n2 == '#' || n2 == '"')) { - pos++; - ScanRawString(styler, pos, max, true); - } else if (c == 'b' && n == '"') { - pos += 2; - ResumeString(styler, pos, max, true); - } else if (c == 'b' && n == '\'') { - pos++; - ScanCharacterLiteralOrLifetime(styler, pos, true); - } else if (IsIdentifierStart(c)) { - ScanIdentifier(styler, pos, keywords); - } else if (IsADigit(c)) { - ScanNumber(styler, pos); - } else if (IsThreeCharOperator(c, n, n2)) { - pos += 3; - styler.ColourTo(pos - 1, SCE_RUST_OPERATOR); - } else if (IsTwoCharOperator(c, n)) { - pos += 2; - styler.ColourTo(pos - 1, SCE_RUST_OPERATOR); - } else if (IsOneCharOperator(c)) { - pos++; - styler.ColourTo(pos - 1, SCE_RUST_OPERATOR); - } else if (c == '\'') { - ScanCharacterLiteralOrLifetime(styler, pos, false); - } else if (c == '"') { - pos++; - ResumeString(styler, pos, max, false); - } else { - pos++; - styler.ColourTo(pos - 1, SCE_RUST_LEXERROR); - } - } - styler.ColourTo(pos - 1, SCE_RUST_DEFAULT); - styler.Flush(); -} - -void SCI_METHOD LexerRust::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; - 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 = styler.StyleAt(startPos); - int style = initStyle; - 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 = i == (lineStartNext-1); - if ((style == SCE_RUST_COMMENTLINE) || (style == SCE_RUST_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_RUST_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_RUST_OPERATOR)) { - if (ch == '{') { - // Measure the minimum before a '{' to allow - // folding on "} else {" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (ch == '}') { - levelNext--; - } - } - if (!IsASpace(ch)) - visibleChars++; - if (atEOL || (i == endPos-1)) { - int levelUse = levelCurrent; - if (options.foldSyntaxBased && options.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++; - lineStartNext = styler.LineStart(lineCurrent+1); - levelCurrent = levelNext; - levelMinCurrent = levelCurrent; - if (atEOL && (i == static_cast<Sci_PositionU>(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; - } - } -} - -LexerModule lmRust(SCLEX_RUST, LexerRust::LexerFactoryRust, "rust", rustWordLists); diff --git a/lexers/LexSAS.cxx b/lexers/LexSAS.cxx deleted file mode 100644 index 29feba82d..000000000 --- a/lexers/LexSAS.cxx +++ /dev/null @@ -1,220 +0,0 @@ -// Scintilla source code edit control -/** @file LexSAS.cxx - ** Lexer for SAS - **/ -// Author: Luke Rasmussen (luke.rasmussen@gmail.com) -// -// The License.txt file describes the conditions under which this software may -// be distributed. -// -// Developed as part of the StatTag project at Northwestern University Feinberg -// School of Medicine with funding from Northwestern University Clinical and -// Translational Sciences Institute through CTSA grant UL1TR001422. This work -// has not been reviewed or endorsed by NCATS or the NIH. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static void ColouriseSASDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - - WordList &keywords = *keywordlists[0]; - WordList &blockKeywords = *keywordlists[1]; - WordList &functionKeywords = *keywordlists[2]; - WordList &statements = *keywordlists[3]; - - CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); - CharacterSet setMacroStart(CharacterSet::setNone, "%"); - CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); - CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); - - StyleContext sc(startPos, length, initStyle, styler); - bool lineHasNonCommentChar = false; - for (; sc.More(); sc.Forward()) { - if (sc.atLineStart) { - lineHasNonCommentChar = false; - } - - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_SAS_OPERATOR: - sc.SetState(SCE_SAS_DEFAULT); - break; - case SCE_SAS_NUMBER: - // We accept almost anything because of hex. and number suffixes - if (!setWord.Contains(sc.ch)) { - sc.SetState(SCE_SAS_DEFAULT); - } - break; - case SCE_SAS_MACRO: - if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { - char s[1000]; - sc.GetCurrentLowered(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_SAS_MACRO_KEYWORD); - } - else if (blockKeywords.InList(s)) { - sc.ChangeState(SCE_SAS_BLOCK_KEYWORD); - } - else if (functionKeywords.InList(s)) { - sc.ChangeState(SCE_SAS_MACRO_FUNCTION); - } - sc.SetState(SCE_SAS_DEFAULT); - } - break; - case SCE_SAS_IDENTIFIER: - if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { - char s[1000]; - sc.GetCurrentLowered(s, sizeof(s)); - if (statements.InList(s)) { - sc.ChangeState(SCE_SAS_STATEMENT); - } - else if(blockKeywords.InList(s)) { - sc.ChangeState(SCE_SAS_BLOCK_KEYWORD); - } - sc.SetState(SCE_SAS_DEFAULT); - } - break; - case SCE_SAS_COMMENTBLOCK: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_SAS_DEFAULT); - } - break; - case SCE_SAS_COMMENT: - case SCE_SAS_COMMENTLINE: - if (sc.Match(';')) { - sc.Forward(); - sc.SetState(SCE_SAS_DEFAULT); - } - break; - case SCE_SAS_STRING: - if (sc.ch == '\"') { - sc.ForwardSetState(SCE_SAS_DEFAULT); - } - break; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_SAS_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - lineHasNonCommentChar = true; - sc.SetState(SCE_SAS_NUMBER); - } - else if (setWordStart.Contains(sc.ch)) { - lineHasNonCommentChar = true; - sc.SetState(SCE_SAS_IDENTIFIER); - } - else if (sc.Match('*') && !lineHasNonCommentChar) { - sc.SetState(SCE_SAS_COMMENT); - } - else if (sc.Match('/', '*')) { - sc.SetState(SCE_SAS_COMMENTBLOCK); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } - else if (sc.Match('/', '/')) { - sc.SetState(SCE_SAS_COMMENTLINE); - } - else if (sc.ch == '\"') { - lineHasNonCommentChar = true; - sc.SetState(SCE_SAS_STRING); - } - else if (setMacroStart.Contains(sc.ch)) { - lineHasNonCommentChar = true; - sc.SetState(SCE_SAS_MACRO); - } - else if (isoperator(static_cast<char>(sc.ch))) { - lineHasNonCommentChar = true; - sc.SetState(SCE_SAS_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 {". -static void FoldSASDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], - Accessor &styler) { - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - 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); - 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_R_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) { - 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 (!isspacechar(ch)) - visibleChars++; - } -} - - -static const char * const SASWordLists[] = { - "Language Keywords", - "Macro Keywords", - "Types", - 0, -}; - -LexerModule lmSAS(SCLEX_SAS, ColouriseSASDoc, "sas", FoldSASDoc, SASWordLists); diff --git a/lexers/LexSML.cxx b/lexers/LexSML.cxx deleted file mode 100644 index ed67300d2..000000000 --- a/lexers/LexSML.cxx +++ /dev/null @@ -1,226 +0,0 @@ -// Scintilla source code edit control -/** @file LexSML.cxx - ** Lexer for SML. - **/ -// Copyright 2009 by James Moffatt and Yuzhou Xin -// Modified from LexCaml.cxx by Robert Roessler <robertr@rftp.com> Copyright 2005 -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 - -inline int issml(int c) {return isalnum(c) || c == '_';} -inline int issmlf(int c) {return isalpha(c) || c == '_';} -inline int issmld(int c) {return isdigit(c) || c == '_';} - - -using namespace Scintilla; - -static void ColouriseSMLDoc( - Sci_PositionU startPos, Sci_Position length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) -{ - StyleContext sc(startPos, length, initStyle, styler); - int nesting = 0; - if (sc.state < SCE_SML_STRING) - sc.state = SCE_SML_DEFAULT; - if (sc.state >= SCE_SML_COMMENT) - nesting = (sc.state & 0x0f) - SCE_SML_COMMENT; - - Sci_PositionU chToken = 0; - int chBase = 0, chLit = 0; - WordList& keywords = *keywordlists[0]; - WordList& keywords2 = *keywordlists[1]; - WordList& keywords3 = *keywordlists[2]; - const int useMagic = styler.GetPropertyInt("lexer.caml.magic", 0); - - while (sc.More()) { - int state2 = -1; - Sci_Position chColor = sc.currentPos - 1; - bool advance = true; - - switch (sc.state & 0x0f) { - case SCE_SML_DEFAULT: - chToken = sc.currentPos; - if (issmlf(sc.ch)) - state2 = SCE_SML_IDENTIFIER; - else if (sc.Match('`') && issmlf(sc.chNext)) - state2 = SCE_SML_TAGNAME; - else if (sc.Match('#')&&isdigit(sc.chNext)) - state2 = SCE_SML_LINENUM; - else if (sc.Match('#','\"')){ - state2 = SCE_SML_CHAR,chLit = 0; - sc.Forward(); - - } - else if (isdigit(sc.ch)) { - state2 = SCE_SML_NUMBER, chBase = 10; - if (sc.Match('0') && strchr("xX", sc.chNext)) - chBase = 16, sc.Forward();} - else if (sc.Match('\"')&&sc.chPrev!='#') - state2 = SCE_SML_STRING; - else if (sc.Match('(', '*')){ - state2 = SCE_SML_COMMENT, - sc.ch = ' ', - sc.Forward();} - else if (strchr("!~" - "=<>@^+-*/" - "()[];,:.#", sc.ch)) - state2 = SCE_SML_OPERATOR; - break; - - case SCE_SML_IDENTIFIER: - if (!(issml(sc.ch) || sc.Match('\''))) { - const Sci_Position n = sc.currentPos - chToken; - if (n < 24) { - char t[24]; - for (Sci_Position i = -n; i < 0; i++) - t[n + i] = static_cast<char>(sc.GetRelative(i)); - t[n] = '\0'; - if ((n == 1 && sc.chPrev == '_') || keywords.InList(t)) - sc.ChangeState(SCE_SML_KEYWORD); - else if (keywords2.InList(t)) - sc.ChangeState(SCE_SML_KEYWORD2); - else if (keywords3.InList(t)) - sc.ChangeState(SCE_SML_KEYWORD3); - } - state2 = SCE_SML_DEFAULT, advance = false; - } - break; - - case SCE_SML_TAGNAME: - if (!(issml(sc.ch) || sc.Match('\''))) - state2 = SCE_SML_DEFAULT, advance = false; - break; - - case SCE_SML_LINENUM: - if (!isdigit(sc.ch)) - state2 = SCE_SML_DEFAULT, advance = false; - break; - - case SCE_SML_OPERATOR: { - const char* o = 0; - if (issml(sc.ch) || isspace(sc.ch) - || (o = strchr(")]};,\'\"`#", sc.ch),o) - || !strchr("!$%&*+-./:<=>?@^|~", sc.ch)) { - if (o && strchr(")]};,", sc.ch)) { - if ((sc.Match(')') && sc.chPrev == '(') - || (sc.Match(']') && sc.chPrev == '[')) - sc.ChangeState(SCE_SML_KEYWORD); - chColor++; - } else - advance = false; - state2 = SCE_SML_DEFAULT; - } - break; - } - - case SCE_SML_NUMBER: - if (issmld(sc.ch) || IsADigit(sc.ch, chBase)) - break; - if ((sc.Match('l') || sc.Match('L') || sc.Match('n')) - && (issmld(sc.chPrev) || IsADigit(sc.chPrev, chBase))) - break; - if (chBase == 10) { - if (sc.Match('.') && issmld(sc.chPrev)) - break; - if ((sc.Match('e') || sc.Match('E')) - && (issmld(sc.chPrev) || sc.chPrev == '.')) - break; - if ((sc.Match('+') || sc.Match('-')) - && (sc.chPrev == 'e' || sc.chPrev == 'E')) - break; - } - state2 = SCE_SML_DEFAULT, advance = false; - break; - - case SCE_SML_CHAR: - if (sc.Match('\\')) { - chLit = 1; - if (sc.chPrev == '\\') - sc.ch = ' '; - } else if ((sc.Match('\"') && sc.chPrev != '\\') || sc.atLineEnd) { - state2 = SCE_SML_DEFAULT; - chLit = 1; - if (sc.Match('\"')) - chColor++; - else - sc.ChangeState(SCE_SML_IDENTIFIER); - } else if (chLit < 1 && sc.currentPos - chToken >= 3) - sc.ChangeState(SCE_SML_IDENTIFIER), advance = false; - break; - - case SCE_SML_STRING: - if (sc.Match('\\') && sc.chPrev == '\\') - sc.ch = ' '; - else if (sc.Match('\"') && sc.chPrev != '\\') - state2 = SCE_SML_DEFAULT, chColor++; - break; - - case SCE_SML_COMMENT: - case SCE_SML_COMMENT1: - case SCE_SML_COMMENT2: - case SCE_SML_COMMENT3: - if (sc.Match('(', '*')) - state2 = sc.state + 1, chToken = sc.currentPos, - sc.ch = ' ', - sc.Forward(), nesting++; - else if (sc.Match(')') && sc.chPrev == '*') { - if (nesting) - state2 = (sc.state & 0x0f) - 1, chToken = 0, nesting--; - else - state2 = SCE_SML_DEFAULT; - chColor++; - } else if (useMagic && sc.currentPos - chToken == 4 - && sc.Match('c') && sc.chPrev == 'r' && sc.GetRelative(-2) == '@') - sc.state |= 0x10; - break; - } - - if (state2 >= 0) - styler.ColourTo(chColor, sc.state), sc.ChangeState(state2); - if (advance) - sc.Forward(); - } - - sc.Complete(); -} - -static void FoldSMLDoc( - Sci_PositionU, Sci_Position, - int, - WordList *[], - Accessor &) -{ -} - -static const char * const SMLWordListDesc[] = { - "Keywords", - "Keywords2", - "Keywords3", - 0 -}; - -LexerModule lmSML(SCLEX_SML, ColouriseSMLDoc, "SML", FoldSMLDoc, SMLWordListDesc); - diff --git a/lexers/LexSQL.cxx b/lexers/LexSQL.cxx deleted file mode 100644 index d45dc2098..000000000 --- a/lexers/LexSQL.cxx +++ /dev/null @@ -1,970 +0,0 @@ -//-*- coding: utf-8 -*- -// Scintilla source code edit control -/** @file LexSQL.cxx - ** Lexer for SQL, including PL/SQL and SQL*Plus. - ** Improved by Jérôme LAFORGE <jerome.laforge_AT_gmail_DOT_com> from 2010 to 2012. - **/ -// Copyright 1998-2012 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <vector> -#include <map> -#include <algorithm> - -#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 "SparseState.h" -#include "DefaultLexer.h" - -using namespace Scintilla; - -static inline bool IsAWordChar(int ch, bool sqlAllowDottedWord) { - if (!sqlAllowDottedWord) - return (ch < 0x80) && (isalnum(ch) || ch == '_'); - else - return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); -} - -static inline bool IsAWordStart(int ch) { - return (ch < 0x80) && (isalpha(ch) || ch == '_'); -} - -static inline bool IsADoxygenChar(int ch) { - return (islower(ch) || ch == '$' || ch == '@' || - ch == '\\' || ch == '&' || ch == '<' || - ch == '>' || ch == '#' || ch == '{' || - ch == '}' || ch == '[' || ch == ']'); -} - -static inline bool IsANumberChar(int ch, int chPrev) { - // Not exactly following number definition (several dots are seen as OK, etc.) - // but probably enough in most cases. - return (ch < 0x80) && - (isdigit(ch) || toupper(ch) == 'E' || - ch == '.' || ((ch == '-' || ch == '+') && chPrev < 0x80 && toupper(chPrev) == 'E')); -} - -typedef unsigned int sql_state_t; - -class SQLStates { -public : - void Set(Sci_Position lineNumber, unsigned short int sqlStatesLine) { - sqlStatement.Set(lineNumber, sqlStatesLine); - } - - sql_state_t IgnoreWhen (sql_state_t sqlStatesLine, bool enable) { - if (enable) - sqlStatesLine |= MASK_IGNORE_WHEN; - else - sqlStatesLine &= ~MASK_IGNORE_WHEN; - - return sqlStatesLine; - } - - sql_state_t IntoCondition (sql_state_t sqlStatesLine, bool enable) { - if (enable) - sqlStatesLine |= MASK_INTO_CONDITION; - else - sqlStatesLine &= ~MASK_INTO_CONDITION; - - return sqlStatesLine; - } - - sql_state_t IntoExceptionBlock (sql_state_t sqlStatesLine, bool enable) { - if (enable) - sqlStatesLine |= MASK_INTO_EXCEPTION; - else - sqlStatesLine &= ~MASK_INTO_EXCEPTION; - - return sqlStatesLine; - } - - sql_state_t IntoDeclareBlock (sql_state_t sqlStatesLine, bool enable) { - if (enable) - sqlStatesLine |= MASK_INTO_DECLARE; - else - sqlStatesLine &= ~MASK_INTO_DECLARE; - - return sqlStatesLine; - } - - sql_state_t IntoMergeStatement (sql_state_t sqlStatesLine, bool enable) { - if (enable) - sqlStatesLine |= MASK_MERGE_STATEMENT; - else - sqlStatesLine &= ~MASK_MERGE_STATEMENT; - - return sqlStatesLine; - } - - sql_state_t CaseMergeWithoutWhenFound (sql_state_t sqlStatesLine, bool found) { - if (found) - sqlStatesLine |= MASK_CASE_MERGE_WITHOUT_WHEN_FOUND; - else - sqlStatesLine &= ~MASK_CASE_MERGE_WITHOUT_WHEN_FOUND; - - return sqlStatesLine; - } - sql_state_t IntoSelectStatementOrAssignment (sql_state_t sqlStatesLine, bool found) { - if (found) - sqlStatesLine |= MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT; - else - sqlStatesLine &= ~MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT; - return sqlStatesLine; - } - - sql_state_t BeginCaseBlock (sql_state_t sqlStatesLine) { - if ((sqlStatesLine & MASK_NESTED_CASES) < MASK_NESTED_CASES) { - sqlStatesLine++; - } - return sqlStatesLine; - } - - sql_state_t EndCaseBlock (sql_state_t sqlStatesLine) { - if ((sqlStatesLine & MASK_NESTED_CASES) > 0) { - sqlStatesLine--; - } - return sqlStatesLine; - } - - sql_state_t IntoCreateStatement (sql_state_t sqlStatesLine, bool enable) { - if (enable) - sqlStatesLine |= MASK_INTO_CREATE; - else - sqlStatesLine &= ~MASK_INTO_CREATE; - - return sqlStatesLine; - } - - sql_state_t IntoCreateViewStatement (sql_state_t sqlStatesLine, bool enable) { - if (enable) - sqlStatesLine |= MASK_INTO_CREATE_VIEW; - else - sqlStatesLine &= ~MASK_INTO_CREATE_VIEW; - - return sqlStatesLine; - } - - sql_state_t IntoCreateViewAsStatement (sql_state_t sqlStatesLine, bool enable) { - if (enable) - sqlStatesLine |= MASK_INTO_CREATE_VIEW_AS_STATEMENT; - else - sqlStatesLine &= ~MASK_INTO_CREATE_VIEW_AS_STATEMENT; - - return sqlStatesLine; - } - - bool IsIgnoreWhen (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_IGNORE_WHEN) != 0; - } - - bool IsIntoCondition (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_INTO_CONDITION) != 0; - } - - bool IsIntoCaseBlock (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_NESTED_CASES) != 0; - } - - bool IsIntoExceptionBlock (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_INTO_EXCEPTION) != 0; - } - bool IsIntoSelectStatementOrAssignment (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT) != 0; - } - bool IsCaseMergeWithoutWhenFound (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_CASE_MERGE_WITHOUT_WHEN_FOUND) != 0; - } - - bool IsIntoDeclareBlock (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_INTO_DECLARE) != 0; - } - - bool IsIntoMergeStatement (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_MERGE_STATEMENT) != 0; - } - - bool IsIntoCreateStatement (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_INTO_CREATE) != 0; - } - - bool IsIntoCreateViewStatement (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_INTO_CREATE_VIEW) != 0; - } - - bool IsIntoCreateViewAsStatement (sql_state_t sqlStatesLine) { - return (sqlStatesLine & MASK_INTO_CREATE_VIEW_AS_STATEMENT) != 0; - } - - sql_state_t ForLine(Sci_Position lineNumber) { - return sqlStatement.ValueAt(lineNumber); - } - - SQLStates() {} - -private : - SparseState <sql_state_t> sqlStatement; - enum { - MASK_NESTED_CASES = 0x0001FF, - MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT = 0x000200, - MASK_CASE_MERGE_WITHOUT_WHEN_FOUND = 0x000400, - MASK_MERGE_STATEMENT = 0x000800, - MASK_INTO_DECLARE = 0x001000, - MASK_INTO_EXCEPTION = 0x002000, - MASK_INTO_CONDITION = 0x004000, - MASK_IGNORE_WHEN = 0x008000, - MASK_INTO_CREATE = 0x010000, - MASK_INTO_CREATE_VIEW = 0x020000, - MASK_INTO_CREATE_VIEW_AS_STATEMENT = 0x040000 - }; -}; - -// Options used for LexerSQL -struct OptionsSQL { - bool fold; - bool foldAtElse; - bool foldComment; - bool foldCompact; - bool foldOnlyBegin; - bool sqlBackticksIdentifier; - bool sqlNumbersignComment; - bool sqlBackslashEscapes; - bool sqlAllowDottedWord; - OptionsSQL() { - fold = false; - foldAtElse = false; - foldComment = false; - foldCompact = false; - foldOnlyBegin = false; - sqlBackticksIdentifier = false; - sqlNumbersignComment = false; - sqlBackslashEscapes = false; - sqlAllowDottedWord = false; - } -}; - -static const char * const sqlWordListDesc[] = { - "Keywords", - "Database Objects", - "PLDoc", - "SQL*Plus", - "User Keywords 1", - "User Keywords 2", - "User Keywords 3", - "User Keywords 4", - 0 -}; - -struct OptionSetSQL : public OptionSet<OptionsSQL> { - OptionSetSQL() { - DefineProperty("fold", &OptionsSQL::fold); - - DefineProperty("fold.sql.at.else", &OptionsSQL::foldAtElse, - "This option enables SQL folding on a \"ELSE\" and \"ELSIF\" line of an IF statement."); - - DefineProperty("fold.comment", &OptionsSQL::foldComment); - - DefineProperty("fold.compact", &OptionsSQL::foldCompact); - - DefineProperty("fold.sql.only.begin", &OptionsSQL::foldOnlyBegin); - - DefineProperty("lexer.sql.backticks.identifier", &OptionsSQL::sqlBackticksIdentifier); - - DefineProperty("lexer.sql.numbersign.comment", &OptionsSQL::sqlNumbersignComment, - "If \"lexer.sql.numbersign.comment\" property is set to 0 a line beginning with '#' will not be a comment."); - - DefineProperty("sql.backslash.escapes", &OptionsSQL::sqlBackslashEscapes, - "Enables backslash as an escape character in SQL."); - - DefineProperty("lexer.sql.allow.dotted.word", &OptionsSQL::sqlAllowDottedWord, - "Set to 1 to colourise recognized words with dots " - "(recommended for Oracle PL/SQL objects)."); - - DefineWordListSets(sqlWordListDesc); - } -}; - -class LexerSQL : public DefaultLexer { -public : - LexerSQL() : DefaultLexer("sql", SCLEX_SQL) {} - - virtual ~LexerSQL() {} - - int SCI_METHOD Version () const override { - return lvRelease5; - } - - void SCI_METHOD Release() override { - delete this; - } - - const char * SCI_METHOD PropertyNames() override { - return osSQL.PropertyNames(); - } - - int SCI_METHOD PropertyType(const char *name) override { - return osSQL.PropertyType(name); - } - - const char * SCI_METHOD DescribeProperty(const char *name) override { - return osSQL.DescribeProperty(name); - } - - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override { - if (osSQL.PropertySet(&options, key, val)) { - return 0; - } - return -1; - } - - const char * SCI_METHOD PropertyGet(const char *key) override { - return osSQL.PropertyGet(key); - } - - const char * SCI_METHOD DescribeWordListSets() override { - return osSQL.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 *LexerFactorySQL() { - return new LexerSQL(); - } -private: - bool IsStreamCommentStyle(int style) { - return style == SCE_SQL_COMMENT || - style == SCE_SQL_COMMENTDOC || - style == SCE_SQL_COMMENTDOCKEYWORD || - style == SCE_SQL_COMMENTDOCKEYWORDERROR; - } - - bool IsCommentStyle (int style) { - switch (style) { - case SCE_SQL_COMMENT : - case SCE_SQL_COMMENTDOC : - case SCE_SQL_COMMENTLINE : - case SCE_SQL_COMMENTLINEDOC : - case SCE_SQL_COMMENTDOCKEYWORD : - case SCE_SQL_COMMENTDOCKEYWORDERROR : - return true; - default : - return false; - } - } - - 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 + 1 < eol_pos; i++) { - int style = styler.StyleAt(i); - // MySQL needs -- comments to be followed by space or control char - if (style == SCE_SQL_COMMENTLINE && styler.Match(i, "--")) - return true; - else if (!IsASpaceOrTab(styler[i])) - return false; - } - return false; - } - - OptionsSQL options; - OptionSetSQL osSQL; - SQLStates sqlStates; - - WordList keywords1; - WordList keywords2; - WordList kw_pldoc; - WordList kw_sqlplus; - WordList kw_user1; - WordList kw_user2; - WordList kw_user3; - WordList kw_user4; -}; - -Sci_Position SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) { - WordList *wordListN = 0; - switch (n) { - case 0: - wordListN = &keywords1; - break; - case 1: - wordListN = &keywords2; - break; - case 2: - wordListN = &kw_pldoc; - break; - case 3: - wordListN = &kw_sqlplus; - break; - case 4: - wordListN = &kw_user1; - break; - case 5: - wordListN = &kw_user2; - break; - case 6: - wordListN = &kw_user3; - break; - case 7: - wordListN = &kw_user4; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - } - } - return firstModification; -} - -void SCI_METHOD LexerSQL::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - LexAccessor styler(pAccess); - StyleContext sc(startPos, length, initStyle, styler); - int styleBeforeDCKeyword = SCE_SQL_DEFAULT; - - for (; sc.More(); sc.Forward()) { - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_SQL_OPERATOR: - sc.SetState(SCE_SQL_DEFAULT); - break; - case SCE_SQL_NUMBER: - // We stop the number definition on non-numerical non-dot non-eE non-sign char - if (!IsANumberChar(sc.ch, sc.chPrev)) { - sc.SetState(SCE_SQL_DEFAULT); - } - break; - case SCE_SQL_IDENTIFIER: - if (!IsAWordChar(sc.ch, options.sqlAllowDottedWord)) { - int nextState = SCE_SQL_DEFAULT; - char s[1000]; - sc.GetCurrentLowered(s, sizeof(s)); - if (keywords1.InList(s)) { - sc.ChangeState(SCE_SQL_WORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_SQL_WORD2); - } else if (kw_sqlplus.InListAbbreviated(s, '~')) { - sc.ChangeState(SCE_SQL_SQLPLUS); - if (strncmp(s, "rem", 3) == 0) { - nextState = SCE_SQL_SQLPLUS_COMMENT; - } else if (strncmp(s, "pro", 3) == 0) { - nextState = SCE_SQL_SQLPLUS_PROMPT; - } - } else if (kw_user1.InList(s)) { - sc.ChangeState(SCE_SQL_USER1); - } else if (kw_user2.InList(s)) { - sc.ChangeState(SCE_SQL_USER2); - } else if (kw_user3.InList(s)) { - sc.ChangeState(SCE_SQL_USER3); - } else if (kw_user4.InList(s)) { - sc.ChangeState(SCE_SQL_USER4); - } - sc.SetState(nextState); - } - break; - case SCE_SQL_QUOTEDIDENTIFIER: - if (sc.ch == 0x60) { - if (sc.chNext == 0x60) { - sc.Forward(); // Ignore it - } else { - sc.ForwardSetState(SCE_SQL_DEFAULT); - } - } - break; - case SCE_SQL_COMMENT: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_SQL_DEFAULT); - } - break; - case SCE_SQL_COMMENTDOC: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_SQL_DEFAULT); - } else if (sc.ch == '@' || sc.ch == '\\') { // 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_SQL_COMMENTDOC; - sc.SetState(SCE_SQL_COMMENTDOCKEYWORD); - } - } - break; - case SCE_SQL_COMMENTLINE: - case SCE_SQL_COMMENTLINEDOC: - case SCE_SQL_SQLPLUS_COMMENT: - case SCE_SQL_SQLPLUS_PROMPT: - if (sc.atLineStart) { - sc.SetState(SCE_SQL_DEFAULT); - } - break; - case SCE_SQL_COMMENTDOCKEYWORD: - if ((styleBeforeDCKeyword == SCE_SQL_COMMENTDOC) && sc.Match('*', '/')) { - sc.ChangeState(SCE_SQL_COMMENTDOCKEYWORDERROR); - sc.Forward(); - sc.ForwardSetState(SCE_SQL_DEFAULT); - } else if (!IsADoxygenChar(sc.ch)) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (!isspace(sc.ch) || !kw_pldoc.InList(s + 1)) { - sc.ChangeState(SCE_SQL_COMMENTDOCKEYWORDERROR); - } - sc.SetState(styleBeforeDCKeyword); - } - break; - case SCE_SQL_CHARACTER: - if (options.sqlBackslashEscapes && sc.ch == '\\') { - sc.Forward(); - } else if (sc.ch == '\'') { - if (sc.chNext == '\'') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_SQL_DEFAULT); - } - } - break; - case SCE_SQL_STRING: - if (options.sqlBackslashEscapes && sc.ch == '\\') { - // Escape sequence - sc.Forward(); - } else if (sc.ch == '\"') { - if (sc.chNext == '\"') { - sc.Forward(); - } else { - sc.ForwardSetState(SCE_SQL_DEFAULT); - } - } - break; - case SCE_SQL_QOPERATOR: - // Locate the unique Q operator character - sc.Complete(); - char qOperator = 0x00; - for (Sci_Position styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) { - if (styler.StyleAt(styleStartPos - 1) != SCE_SQL_QOPERATOR) { - qOperator = styler.SafeGetCharAt(styleStartPos + 2); - break; - } - } - - char qComplement = 0x00; - - if (qOperator == '<') { - qComplement = '>'; - } else if (qOperator == '(') { - qComplement = ')'; - } else if (qOperator == '{') { - qComplement = '}'; - } else if (qOperator == '[') { - qComplement = ']'; - } else { - qComplement = qOperator; - } - - if (sc.Match(qComplement, '\'')) { - sc.Forward(); - sc.ForwardSetState(SCE_SQL_DEFAULT); - } - break; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_SQL_DEFAULT) { - if (sc.Match('q', '\'') || sc.Match('Q', '\'')) { - sc.SetState(SCE_SQL_QOPERATOR); - sc.Forward(); - } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) || - ((sc.ch == '-' || sc.ch == '+') && IsADigit(sc.chNext) && !IsADigit(sc.chPrev))) { - sc.SetState(SCE_SQL_NUMBER); - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_SQL_IDENTIFIER); - } else if (sc.ch == 0x60 && options.sqlBackticksIdentifier) { - sc.SetState(SCE_SQL_QUOTEDIDENTIFIER); - } else if (sc.Match('/', '*')) { - if (sc.Match("/**") || sc.Match("/*!")) { // Support of Doxygen doc. style - sc.SetState(SCE_SQL_COMMENTDOC); - } else { - sc.SetState(SCE_SQL_COMMENT); - } - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('-', '-')) { - // MySQL requires a space or control char after -- - // http://dev.mysql.com/doc/mysql/en/ansi-diff-comments.html - // Perhaps we should enforce that with proper property: - //~ } else if (sc.Match("-- ")) { - sc.SetState(SCE_SQL_COMMENTLINE); - } else if (sc.ch == '#' && options.sqlNumbersignComment) { - sc.SetState(SCE_SQL_COMMENTLINEDOC); - } else if (sc.ch == '\'') { - sc.SetState(SCE_SQL_CHARACTER); - } else if (sc.ch == '\"') { - sc.SetState(SCE_SQL_STRING); - } else if (isoperator(static_cast<char>(sc.ch))) { - sc.SetState(SCE_SQL_OPERATOR); - } - } - } - sc.Complete(); -} - -void SCI_METHOD LexerSQL::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) { - // Backtrack to previous line in case need to fix its fold status for folding block of single-line comments (i.e. '--'). - Sci_Position lastNLPos = -1; - // And keep going back until we find an operator ';' followed - // by white-space and/or comments. This will improve folding. - while (--startPos > 0) { - char ch = styler[startPos]; - if (ch == '\n' || (ch == '\r' && styler[startPos + 1] != '\n')) { - lastNLPos = startPos; - } else if (ch == ';' && - styler.StyleAt(startPos) == SCE_SQL_OPERATOR) { - bool isAllClear = true; - for (Sci_Position tempPos = startPos + 1; - tempPos < lastNLPos; - ++tempPos) { - int tempStyle = styler.StyleAt(tempPos); - if (!IsCommentStyle(tempStyle) - && tempStyle != SCE_SQL_DEFAULT) { - isAllClear = false; - break; - } - } - if (isAllClear) { - startPos = lastNLPos + 1; - break; - } - } - } - lineCurrent = styler.GetLine(startPos); - if (lineCurrent > 0) - levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16; - } - // And because folding ends at ';', keep going until we find one - // Otherwise if create ... view ... as is split over multiple - // lines the folding won't always update immediately. - Sci_PositionU docLength = styler.Length(); - for (; endPos < docLength; ++endPos) { - if (styler.SafeGetCharAt(endPos) == ';') { - break; - } - } - - int levelNext = levelCurrent; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - bool endFound = false; - bool isUnfoldingIgnored = false; - // this statementFound flag avoids to fold when the statement is on only one line by ignoring ELSE or ELSIF - // eg. "IF condition1 THEN ... ELSIF condition2 THEN ... ELSE ... END IF;" - bool statementFound = false; - sql_state_t sqlStatesCurrentLine = 0; - if (!options.foldOnlyBegin) { - sqlStatesCurrentLine = sqlStates.ForLine(lineCurrent); - } - 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 (atEOL || (!IsCommentStyle(style) && ch == ';')) { - if (endFound) { - //Maybe this is the end of "EXCEPTION" BLOCK (eg. "BEGIN ... EXCEPTION ... END;") - sqlStatesCurrentLine = sqlStates.IntoExceptionBlock(sqlStatesCurrentLine, false); - } - // set endFound and isUnfoldingIgnored to false if EOL is reached or ';' is found - endFound = false; - isUnfoldingIgnored = false; - } - if ((!IsCommentStyle(style) && ch == ';')) { - if (sqlStates.IsIntoMergeStatement(sqlStatesCurrentLine)) { - // This is the end of "MERGE" statement. - if (!sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) - levelNext--; - sqlStatesCurrentLine = sqlStates.IntoMergeStatement(sqlStatesCurrentLine, false); - levelNext--; - } - if (sqlStates.IsIntoSelectStatementOrAssignment(sqlStatesCurrentLine)) - sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, false); - if (sqlStates.IsIntoCreateStatement(sqlStatesCurrentLine)) { - if (sqlStates.IsIntoCreateViewStatement(sqlStatesCurrentLine)) { - if (sqlStates.IsIntoCreateViewAsStatement(sqlStatesCurrentLine)) { - levelNext--; - sqlStatesCurrentLine = sqlStates.IntoCreateViewAsStatement(sqlStatesCurrentLine, false); - } - sqlStatesCurrentLine = sqlStates.IntoCreateViewStatement(sqlStatesCurrentLine, false); - } - sqlStatesCurrentLine = sqlStates.IntoCreateStatement(sqlStatesCurrentLine, false); - } - } - if (ch == ':' && chNext == '=' && !IsCommentStyle(style)) - sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, true); - - if (options.foldComment && 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 && (style == SCE_SQL_COMMENTLINE)) { - // MySQL needs -- comments to be followed by space or control char - if ((ch == '-') && (chNext == '-')) { - char chNext2 = styler.SafeGetCharAt(i + 2); - char chNext3 = styler.SafeGetCharAt(i + 3); - if (chNext2 == '{' || chNext3 == '{') { - levelNext++; - } else if (chNext2 == '}' || chNext3 == '}') { - levelNext--; - } - } - } - // Fold block of single-line comments (i.e. '--'). - if (options.foldComment && atEOL && IsCommentLine(lineCurrent, styler)) { - if (!IsCommentLine(lineCurrent - 1, styler) && IsCommentLine(lineCurrent + 1, styler)) - levelNext++; - else if (IsCommentLine(lineCurrent - 1, styler) && !IsCommentLine(lineCurrent + 1, styler)) - levelNext--; - } - if (style == SCE_SQL_OPERATOR) { - if (ch == '(') { - if (levelCurrent > levelNext) - levelCurrent--; - levelNext++; - } else if (ch == ')') { - levelNext--; - } else if ((!options.foldOnlyBegin) && ch == ';') { - sqlStatesCurrentLine = sqlStates.IgnoreWhen(sqlStatesCurrentLine, false); - } - } - // If new keyword (cannot trigger on elseif or nullif, does less tests) - if (style == SCE_SQL_WORD && stylePrev != SCE_SQL_WORD) { - const int MAX_KW_LEN = 9; // Maximum length of folding keywords - char s[MAX_KW_LEN + 2]; - unsigned int j = 0; - for (; j < MAX_KW_LEN + 1; j++) { - if (!iswordchar(styler[i + j])) { - break; - } - s[j] = static_cast<char>(tolower(styler[i + j])); - } - if (j == MAX_KW_LEN + 1) { - // Keyword too long, don't test it - s[0] = '\0'; - } else { - s[j] = '\0'; - } - if (!options.foldOnlyBegin && - strcmp(s, "select") == 0) { - sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, true); - } else if (strcmp(s, "if") == 0) { - if (endFound) { - endFound = false; - if (options.foldOnlyBegin && !isUnfoldingIgnored) { - // this end isn't for begin block, but for if block ("end if;") - // so ignore previous "end" by increment levelNext. - levelNext++; - } - } else { - if (!options.foldOnlyBegin) - sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, true); - if (levelCurrent > levelNext) { - // doesn't include this line into the folding block - // because doesn't hide IF (eg "END; IF") - levelCurrent = levelNext; - } - } - } else if (!options.foldOnlyBegin && - strcmp(s, "then") == 0 && - sqlStates.IsIntoCondition(sqlStatesCurrentLine)) { - sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, false); - if (!options.foldOnlyBegin) { - if (levelCurrent > levelNext) { - levelCurrent = levelNext; - } - if (!statementFound) - levelNext++; - - statementFound = true; - } else if (levelCurrent > levelNext) { - // doesn't include this line into the folding block - // because doesn't hide LOOP or CASE (eg "END; LOOP" or "END; CASE") - levelCurrent = levelNext; - } - } else if (strcmp(s, "loop") == 0 || - strcmp(s, "case") == 0) { - if (endFound) { - endFound = false; - if (options.foldOnlyBegin && !isUnfoldingIgnored) { - // this end isn't for begin block, but for loop block ("end loop;") or case block ("end case;") - // so ignore previous "end" by increment levelNext. - levelNext++; - } - if ((!options.foldOnlyBegin) && strcmp(s, "case") == 0) { - sqlStatesCurrentLine = sqlStates.EndCaseBlock(sqlStatesCurrentLine); - if (!sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) - levelNext--; //again for the "end case;" and block when - } - } else if (!options.foldOnlyBegin) { - if (strcmp(s, "case") == 0) { - sqlStatesCurrentLine = sqlStates.BeginCaseBlock(sqlStatesCurrentLine); - sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, true); - } - - if (levelCurrent > levelNext) - levelCurrent = levelNext; - - if (!statementFound) - levelNext++; - - statementFound = true; - } else if (levelCurrent > levelNext) { - // doesn't include this line into the folding block - // because doesn't hide LOOP or CASE (eg "END; LOOP" or "END; CASE") - levelCurrent = levelNext; - } - } else if ((!options.foldOnlyBegin) && ( - // folding for ELSE and ELSIF block only if foldAtElse is set - // and IF or CASE aren't on only one line with ELSE or ELSIF (with flag statementFound) - options.foldAtElse && !statementFound) && strcmp(s, "elsif") == 0) { - sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, true); - levelCurrent--; - levelNext--; - } else if ((!options.foldOnlyBegin) && ( - // folding for ELSE and ELSIF block only if foldAtElse is set - // and IF or CASE aren't on only one line with ELSE or ELSIF (with flag statementFound) - options.foldAtElse && !statementFound) && strcmp(s, "else") == 0) { - // prevent also ELSE is on the same line (eg. "ELSE ... END IF;") - statementFound = true; - if (sqlStates.IsIntoCaseBlock(sqlStatesCurrentLine) && sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) { - sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, false); - levelNext++; - } else { - // we are in same case "} ELSE {" in C language - levelCurrent--; - } - } else if (strcmp(s, "begin") == 0) { - levelNext++; - sqlStatesCurrentLine = sqlStates.IntoDeclareBlock(sqlStatesCurrentLine, false); - } else if ((strcmp(s, "end") == 0) || - // SQL Anywhere permits IF ... ELSE ... ENDIF - // will only be active if "endif" appears in the - // keyword list. - (strcmp(s, "endif") == 0)) { - endFound = true; - levelNext--; - if (sqlStates.IsIntoSelectStatementOrAssignment(sqlStatesCurrentLine) && !sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) - levelNext--; - if (levelNext < SC_FOLDLEVELBASE) { - levelNext = SC_FOLDLEVELBASE; - isUnfoldingIgnored = true; - } - } else if ((!options.foldOnlyBegin) && - strcmp(s, "when") == 0 && - !sqlStates.IsIgnoreWhen(sqlStatesCurrentLine) && - !sqlStates.IsIntoExceptionBlock(sqlStatesCurrentLine) && ( - sqlStates.IsIntoCaseBlock(sqlStatesCurrentLine) || - sqlStates.IsIntoMergeStatement(sqlStatesCurrentLine) - ) - ) { - sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, true); - - // Don't foldind when CASE and WHEN are on the same line (with flag statementFound) (eg. "CASE selector WHEN expression1 THEN sequence_of_statements1;\n") - // and same way for MERGE statement. - if (!statementFound) { - if (!sqlStates.IsCaseMergeWithoutWhenFound(sqlStatesCurrentLine)) { - levelCurrent--; - levelNext--; - } - sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, false); - } - } else if ((!options.foldOnlyBegin) && strcmp(s, "exit") == 0) { - sqlStatesCurrentLine = sqlStates.IgnoreWhen(sqlStatesCurrentLine, true); - } else if ((!options.foldOnlyBegin) && !sqlStates.IsIntoDeclareBlock(sqlStatesCurrentLine) && strcmp(s, "exception") == 0) { - sqlStatesCurrentLine = sqlStates.IntoExceptionBlock(sqlStatesCurrentLine, true); - } else if ((!options.foldOnlyBegin) && - (strcmp(s, "declare") == 0 || - strcmp(s, "function") == 0 || - strcmp(s, "procedure") == 0 || - strcmp(s, "package") == 0)) { - sqlStatesCurrentLine = sqlStates.IntoDeclareBlock(sqlStatesCurrentLine, true); - } else if ((!options.foldOnlyBegin) && - strcmp(s, "merge") == 0) { - sqlStatesCurrentLine = sqlStates.IntoMergeStatement(sqlStatesCurrentLine, true); - sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, true); - levelNext++; - statementFound = true; - } else if ((!options.foldOnlyBegin) && - strcmp(s, "create") == 0) { - sqlStatesCurrentLine = sqlStates.IntoCreateStatement(sqlStatesCurrentLine, true); - } else if ((!options.foldOnlyBegin) && - strcmp(s, "view") == 0 && - sqlStates.IsIntoCreateStatement(sqlStatesCurrentLine)) { - sqlStatesCurrentLine = sqlStates.IntoCreateViewStatement(sqlStatesCurrentLine, true); - } else if ((!options.foldOnlyBegin) && - strcmp(s, "as") == 0 && - sqlStates.IsIntoCreateViewStatement(sqlStatesCurrentLine) && - ! sqlStates.IsIntoCreateViewAsStatement(sqlStatesCurrentLine)) { - sqlStatesCurrentLine = sqlStates.IntoCreateViewAsStatement(sqlStatesCurrentLine, true); - levelNext++; - } - } - if (atEOL) { - 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; - visibleChars = 0; - statementFound = false; - if (!options.foldOnlyBegin) - sqlStates.Set(lineCurrent, sqlStatesCurrentLine); - } - if (!isspacechar(ch)) { - visibleChars++; - } - } -} - -LexerModule lmSQL(SCLEX_SQL, LexerSQL::LexerFactorySQL, "sql", sqlWordListDesc); diff --git a/lexers/LexSTTXT.cxx b/lexers/LexSTTXT.cxx deleted file mode 100644 index dd2fe5465..000000000 --- a/lexers/LexSTTXT.cxx +++ /dev/null @@ -1,404 +0,0 @@ -// Scintilla source code edit control -/** @file LexSTTXT.cxx - ** Lexer for Structured Text language. - ** Written by Pavel Bulochkin - **/ -// The License.txt file describes the conditions under which this software may be distributed. - - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static void ClassifySTTXTWord(WordList *keywordlists[], StyleContext &sc) -{ - char s[256] = { 0 }; - sc.GetCurrentLowered(s, sizeof(s)); - - if ((*keywordlists[0]).InList(s)) { - sc.ChangeState(SCE_STTXT_KEYWORD); - } - - else if ((*keywordlists[1]).InList(s)) { - sc.ChangeState(SCE_STTXT_TYPE); - } - - else if ((*keywordlists[2]).InList(s)) { - sc.ChangeState(SCE_STTXT_FUNCTION); - } - - else if ((*keywordlists[3]).InList(s)) { - sc.ChangeState(SCE_STTXT_FB); - } - - else if ((*keywordlists[4]).InList(s)) { - sc.ChangeState(SCE_STTXT_VARS); - } - - else if ((*keywordlists[5]).InList(s)) { - sc.ChangeState(SCE_STTXT_PRAGMAS); - } - - sc.SetState(SCE_STTXT_DEFAULT); -} - -static void ColouriseSTTXTDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) -{ - StyleContext sc(startPos, length, initStyle, styler); - - CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true); - CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); - CharacterSet setNumber(CharacterSet::setDigits, "_.eE"); - CharacterSet setHexNumber(CharacterSet::setDigits, "_abcdefABCDEF"); - CharacterSet setOperator(CharacterSet::setNone,",.+-*/:;<=>[]()%&"); - CharacterSet setDataTime(CharacterSet::setDigits,"_.-:dmshDMSH"); - - for ( ; sc.More() ; sc.Forward()) - { - if(sc.atLineStart && sc.state != SCE_STTXT_COMMENT) - sc.SetState(SCE_STTXT_DEFAULT); - - switch(sc.state) - { - case SCE_STTXT_NUMBER: { - if(!setNumber.Contains(sc.ch)) - sc.SetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_HEXNUMBER: { - if (setHexNumber.Contains(sc.ch)) - continue; - else if(setDataTime.Contains(sc.ch)) - sc.ChangeState(SCE_STTXT_DATETIME); - else if(setWord.Contains(sc.ch)) - sc.ChangeState(SCE_STTXT_DEFAULT); - else - sc.SetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_DATETIME: { - if (setDataTime.Contains(sc.ch)) - continue; - else if(setWord.Contains(sc.ch)) - sc.ChangeState(SCE_STTXT_DEFAULT); - else - sc.SetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_OPERATOR: { - sc.SetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_PRAGMA: { - if (sc.ch == '}') - sc.ForwardSetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_COMMENTLINE: { - if (sc.atLineStart) - sc.SetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_COMMENT: { - if(sc.Match('*',')')) - { - sc.Forward(); - sc.ForwardSetState(SCE_STTXT_DEFAULT); - } - break; - } - case SCE_STTXT_STRING1: { - if(sc.atLineEnd) - sc.SetState(SCE_STTXT_STRINGEOL); - else if(sc.ch == '\'' && sc.chPrev != '$') - sc.ForwardSetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_STRING2: { - if (sc.atLineEnd) - sc.SetState(SCE_STTXT_STRINGEOL); - else if(sc.ch == '\"' && sc.chPrev != '$') - sc.ForwardSetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_STRINGEOL: { - if(sc.atLineStart) - sc.SetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_CHARACTER: { - if(setHexNumber.Contains(sc.ch)) - sc.SetState(SCE_STTXT_HEXNUMBER); - else if(setDataTime.Contains(sc.ch)) - sc.SetState(SCE_STTXT_DATETIME); - else sc.SetState(SCE_STTXT_DEFAULT); - break; - } - case SCE_STTXT_IDENTIFIER: { - if(!setWord.Contains(sc.ch)) - ClassifySTTXTWord(keywordlists, sc); - break; - } - } - - if(sc.state == SCE_STTXT_DEFAULT) - { - if(IsADigit(sc.ch)) - sc.SetState(SCE_STTXT_NUMBER); - else if (setWordStart.Contains(sc.ch)) - sc.SetState(SCE_STTXT_IDENTIFIER); - else if (sc.Match('/', '/')) - sc.SetState(SCE_STTXT_COMMENTLINE); - else if(sc.Match('(', '*')) - sc.SetState(SCE_STTXT_COMMENT); - else if (sc.ch == '{') - sc.SetState(SCE_STTXT_PRAGMA); - else if (sc.ch == '\'') - sc.SetState(SCE_STTXT_STRING1); - else if (sc.ch == '\"') - sc.SetState(SCE_STTXT_STRING2); - else if(sc.ch == '#') - sc.SetState(SCE_STTXT_CHARACTER); - else if (setOperator.Contains(sc.ch)) - sc.SetState(SCE_STTXT_OPERATOR); - } - } - - if (sc.state == SCE_STTXT_IDENTIFIER && setWord.Contains(sc.chPrev)) - ClassifySTTXTWord(keywordlists, sc); - - sc.Complete(); -} - -static const char * const STTXTWordListDesc[] = { - "Keywords", - "Types", - "Functions", - "FB", - "Local_Var", - "Local_Pragma", - 0 -}; - -static bool IsCommentLine(Sci_Position line, Accessor &styler, bool type) -{ - 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(type) { - if (ch == '/' && chNext == '/' && style == SCE_STTXT_COMMENTLINE) - return true; - } - else if (ch == '(' && chNext == '*' && style == SCE_STTXT_COMMENT) - break; - - if (!IsASpaceOrTab(ch)) - return false; - } - - for (Sci_Position i = eolPos-2; i>pos; i--) - { - char ch = styler[i]; - char chPrev = styler.SafeGetCharAt(i-1); - int style = styler.StyleAt(i); - - if(ch == ')' && chPrev == '*' && style == SCE_STTXT_COMMENT) - return true; - if(!IsASpaceOrTab(ch)) - return false; - } - - return false; -} - -static bool IsPragmaLine(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]; - int style = styler.StyleAt(i); - - if(ch == '{' && style == SCE_STTXT_PRAGMA) - return true; - else if (!IsASpaceOrTab(ch)) - return false; - } - return false; -} - -static void GetRangeUpper(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<char>(toupper(styler[start + i])); - i++; - } - s[i] = '\0'; -} - -static void ClassifySTTXTWordFoldPoint(int &levelCurrent,Sci_PositionU lastStart, - Sci_PositionU currentPos, Accessor &styler) -{ - char s[256]; - GetRangeUpper(lastStart, currentPos, styler, s, sizeof(s)); - - // See Table C.2 - Keywords - if (!strcmp(s, "ACTION") || - !strcmp(s, "CASE") || - !strcmp(s, "CONFIGURATION") || - !strcmp(s, "FOR") || - !strcmp(s, "FUNCTION") || - !strcmp(s, "FUNCTION_BLOCK") || - !strcmp(s, "IF") || - !strcmp(s, "INITIAL_STEP") || - !strcmp(s, "REPEAT") || - !strcmp(s, "RESOURCE") || - !strcmp(s, "STEP") || - !strcmp(s, "STRUCT") || - !strcmp(s, "TRANSITION") || - !strcmp(s, "TYPE") || - !strcmp(s, "VAR") || - !strcmp(s, "VAR_INPUT") || - !strcmp(s, "VAR_OUTPUT") || - !strcmp(s, "VAR_IN_OUT") || - !strcmp(s, "VAR_TEMP") || - !strcmp(s, "VAR_EXTERNAL") || - !strcmp(s, "VAR_ACCESS") || - !strcmp(s, "VAR_CONFIG") || - !strcmp(s, "VAR_GLOBAL") || - !strcmp(s, "WHILE")) - { - levelCurrent++; - } - else if (!strcmp(s, "END_ACTION") || - !strcmp(s, "END_CASE") || - !strcmp(s, "END_CONFIGURATION") || - !strcmp(s, "END_FOR") || - !strcmp(s, "END_FUNCTION") || - !strcmp(s, "END_FUNCTION_BLOCK") || - !strcmp(s, "END_IF") || - !strcmp(s, "END_REPEAT") || - !strcmp(s, "END_RESOURCE") || - !strcmp(s, "END_STEP") || - !strcmp(s, "END_STRUCT") || - !strcmp(s, "END_TRANSITION") || - !strcmp(s, "END_TYPE") || - !strcmp(s, "END_VAR") || - !strcmp(s, "END_WHILE")) - { - levelCurrent--; - if (levelCurrent < SC_FOLDLEVELBASE) { - levelCurrent = SC_FOLDLEVELBASE; - } - } -} - -static void FoldSTTXTDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[],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; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - 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 && style == SCE_STTXT_COMMENT) { - if(stylePrev != SCE_STTXT_COMMENT) - levelCurrent++; - else if(styleNext != SCE_STTXT_COMMENT && !atEOL) - levelCurrent--; - } - if ( foldComment && atEOL && ( IsCommentLine(lineCurrent, styler,false) - || IsCommentLine(lineCurrent,styler,true))) { - if(!IsCommentLine(lineCurrent-1, styler,true) && IsCommentLine(lineCurrent+1, styler,true)) - levelCurrent++; - if (IsCommentLine(lineCurrent-1, styler,true) && !IsCommentLine(lineCurrent+1, styler,true)) - levelCurrent--; - if (!IsCommentLine(lineCurrent-1, styler,false) && IsCommentLine(lineCurrent+1, styler,false)) - levelCurrent++; - if (IsCommentLine(lineCurrent-1, styler,false) && !IsCommentLine(lineCurrent+1, styler,false)) - levelCurrent--; - } - if(foldPreprocessor && atEOL && IsPragmaLine(lineCurrent, styler)) { - if(!IsPragmaLine(lineCurrent-1, styler) && IsPragmaLine(lineCurrent+1, styler )) - levelCurrent++; - else if(IsPragmaLine(lineCurrent-1, styler) && !IsPragmaLine(lineCurrent+1, styler)) - levelCurrent--; - } - if (stylePrev != SCE_STTXT_KEYWORD && style == SCE_STTXT_KEYWORD) { - lastStart = i; - } - if(stylePrev == SCE_STTXT_KEYWORD) { - if(setWord.Contains(ch) && !setWord.Contains(chNext)) - ClassifySTTXTWordFoldPoint(levelCurrent,lastStart, i, 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); - - 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); - } -} - -LexerModule lmSTTXT(SCLEX_STTXT, ColouriseSTTXTDoc, "fcST", FoldSTTXTDoc, STTXTWordListDesc); diff --git a/lexers/LexScriptol.cxx b/lexers/LexScriptol.cxx deleted file mode 100644 index f82027aa3..000000000 --- a/lexers/LexScriptol.cxx +++ /dev/null @@ -1,379 +0,0 @@ -// Scintilla source code edit control -/** @file LexScriptol.cxx - ** Lexer for Scriptol. - **/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static void ClassifyWordSol(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler, char *prevWord) -{ - char s[100] = ""; - bool wordIsNumber = isdigit(styler[start]) != 0; - for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) - { - s[i] = styler[start + i]; - s[i + 1] = '\0'; - } - char chAttr = SCE_SCRIPTOL_IDENTIFIER; - if (0 == strcmp(prevWord, "class")) chAttr = SCE_SCRIPTOL_CLASSNAME; - else if (wordIsNumber) chAttr = SCE_SCRIPTOL_NUMBER; - else if (keywords.InList(s)) chAttr = SCE_SCRIPTOL_KEYWORD; - else for (Sci_PositionU i = 0; i < end - start + 1; i++) // test dotted idents - { - if (styler[start + i] == '.') - { - styler.ColourTo(start + i - 1, chAttr); - styler.ColourTo(start + i, SCE_SCRIPTOL_OPERATOR); - } - } - styler.ColourTo(end, chAttr); - strcpy(prevWord, s); -} - -static bool IsSolComment(Accessor &styler, Sci_Position pos, Sci_Position len) -{ - if(len > 0) - { - char c = styler[pos]; - if(c == '`') return true; - if(len > 1) - { - if(c == '/') - { - c = styler[pos + 1]; - if(c == '/') return true; - if(c == '*') return true; - } - } - } - return false; -} - -static bool IsSolStringStart(char ch) -{ - if (ch == '\'' || ch == '"') return true; - return false; -} - -static bool IsSolWordStart(char ch) -{ - return (iswordchar(ch) && !IsSolStringStart(ch)); -} - - -static int GetSolStringState(Accessor &styler, Sci_Position i, Sci_Position *nextIndex) -{ - char ch = styler.SafeGetCharAt(i); - char chNext = styler.SafeGetCharAt(i + 1); - - if (ch != '\"' && ch != '\'') - { - *nextIndex = i + 1; - return SCE_SCRIPTOL_DEFAULT; - } - // ch is either single or double quotes in string - // code below seem non-sense but is here for future extensions - if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) - { - *nextIndex = i + 3; - if(ch == '\"') return SCE_SCRIPTOL_TRIPLE; - if(ch == '\'') return SCE_SCRIPTOL_TRIPLE; - return SCE_SCRIPTOL_STRING; - } - else - { - *nextIndex = i + 1; - if (ch == '"') return SCE_SCRIPTOL_STRING; - else return SCE_SCRIPTOL_STRING; - } -} - - -static void ColouriseSolDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) - { - - Sci_Position lengthDoc = startPos + length; - char stringType = '\"'; - - if (startPos > 0) - { - Sci_Position lineCurrent = styler.GetLine(startPos); - if (lineCurrent > 0) - { - startPos = styler.LineStart(lineCurrent-1); - if (startPos == 0) initStyle = SCE_SCRIPTOL_DEFAULT; - else initStyle = styler.StyleAt(startPos-1); - } - } - - styler.StartAt(startPos); - - WordList &keywords = *keywordlists[0]; - - char prevWord[200]; - prevWord[0] = '\0'; - if (length == 0) return; - - int state = initStyle & 31; - - Sci_Position nextIndex = 0; - char chPrev = ' '; - char chPrev2 = ' '; - char chNext = styler[startPos]; - styler.StartSegment(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)) - { - if ((state == SCE_SCRIPTOL_DEFAULT) || - (state == SCE_SCRIPTOL_TRIPLE) || - (state == SCE_SCRIPTOL_COMMENTBLOCK)) - { - styler.ColourTo(i, state); - } - } - - if (styler.IsLeadByte(ch)) - { - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - chPrev2 = ' '; - i += 1; - continue; - } - - if (state == SCE_SCRIPTOL_STRINGEOL) - { - if (ch != '\r' && ch != '\n') - { - styler.ColourTo(i - 1, state); - state = SCE_SCRIPTOL_DEFAULT; - } - } - - if (state == SCE_SCRIPTOL_DEFAULT) - { - if (IsSolWordStart(ch)) - { - styler.ColourTo(i - 1, state); - state = SCE_SCRIPTOL_KEYWORD; - } - else if (ch == '`') - { - styler.ColourTo(i - 1, state); - state = SCE_SCRIPTOL_COMMENTLINE; - } - else if (ch == '/') - { - styler.ColourTo(i - 1, state); - if(chNext == '/') state = SCE_SCRIPTOL_CSTYLE; - if(chNext == '*') state = SCE_SCRIPTOL_COMMENTBLOCK; - } - - else if (IsSolStringStart(ch)) - { - styler.ColourTo(i - 1, state); - state = GetSolStringState(styler, i, &nextIndex); - if(state == SCE_SCRIPTOL_STRING) - { - stringType = ch; - } - if (nextIndex != i + 1) - { - i = nextIndex - 1; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } - } - else if (isoperator(ch)) - { - styler.ColourTo(i - 1, state); - styler.ColourTo(i, SCE_SCRIPTOL_OPERATOR); - } - } - else if (state == SCE_SCRIPTOL_KEYWORD) - { - if (!iswordchar(ch)) - { - ClassifyWordSol(styler.GetStartSegment(), i - 1, keywords, styler, prevWord); - state = SCE_SCRIPTOL_DEFAULT; - if (ch == '`') - { - state = chNext == '`' ? SCE_SCRIPTOL_PERSISTENT : SCE_SCRIPTOL_COMMENTLINE; - } - else if (IsSolStringStart(ch)) - { - styler.ColourTo(i - 1, state); - state = GetSolStringState(styler, i, &nextIndex); - if (nextIndex != i + 1) - { - i = nextIndex - 1; - ch = ' '; - chPrev = ' '; - chNext = styler.SafeGetCharAt(i + 1); - } - } - else if (isoperator(ch)) - { - styler.ColourTo(i, SCE_SCRIPTOL_OPERATOR); - } - } - } - else - { - if (state == SCE_SCRIPTOL_COMMENTLINE || - state == SCE_SCRIPTOL_PERSISTENT || - state == SCE_SCRIPTOL_CSTYLE) - { - if (ch == '\r' || ch == '\n') - { - styler.ColourTo(i - 1, state); - state = SCE_SCRIPTOL_DEFAULT; - } - } - else if(state == SCE_SCRIPTOL_COMMENTBLOCK) - { - if(chPrev == '*' && ch == '/') - { - styler.ColourTo(i, state); - state = SCE_SCRIPTOL_DEFAULT; - } - } - else if ((state == SCE_SCRIPTOL_STRING) || - (state == SCE_SCRIPTOL_CHARACTER)) - { - if ((ch == '\r' || ch == '\n') && (chPrev != '\\')) - { - styler.ColourTo(i - 1, state); - state = SCE_SCRIPTOL_STRINGEOL; - } - else if (ch == '\\') - { - if (chNext == '\"' || chNext == '\'' || chNext == '\\') - { - i++; - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - } - } - else if ((ch == '\"') || (ch == '\'')) - { - // must match the entered quote type - if(ch == stringType) - { - styler.ColourTo(i, state); - state = SCE_SCRIPTOL_DEFAULT; - } - } - } - else if (state == SCE_SCRIPTOL_TRIPLE) - { - if ((ch == '\'' && chPrev == '\'' && chPrev2 == '\'') || - (ch == '\"' && chPrev == '\"' && chPrev2 == '\"')) - { - styler.ColourTo(i, state); - state = SCE_SCRIPTOL_DEFAULT; - } - } - - } - chPrev2 = chPrev; - chPrev = ch; - } - if (state == SCE_SCRIPTOL_KEYWORD) - { - ClassifyWordSol(styler.GetStartSegment(), - lengthDoc-1, keywords, styler, prevWord); - } - else - { - styler.ColourTo(lengthDoc-1, state); - } -} - -static void FoldSolDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *[], Accessor &styler) - { - Sci_Position lengthDoc = startPos + length; - - Sci_Position lineCurrent = styler.GetLine(startPos); - if (startPos > 0) - { - if (lineCurrent > 0) - { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); - if (startPos == 0) - initStyle = SCE_SCRIPTOL_DEFAULT; - else - initStyle = styler.StyleAt(startPos-1); - } - } - int state = initStyle & 31; - int spaceFlags = 0; - int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsSolComment); - if (state == SCE_SCRIPTOL_TRIPLE) - indentCurrent |= SC_FOLDLEVELWHITEFLAG; - char chNext = styler[startPos]; - for (Sci_Position i = startPos; i < lengthDoc; i++) - { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int style = styler.StyleAt(i) & 31; - - if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc)) - { - int lev = indentCurrent; - int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsSolComment); - if (style == SCE_SCRIPTOL_TRIPLE) - indentNext |= SC_FOLDLEVELWHITEFLAG; - 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, IsSolComment); - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) - { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - } - indentCurrent = indentNext; - styler.SetLevel(lineCurrent, lev); - lineCurrent++; - } - } -} - -LexerModule lmScriptol(SCLEX_SCRIPTOL, ColouriseSolDoc, "scriptol", FoldSolDoc); diff --git a/lexers/LexSmalltalk.cxx b/lexers/LexSmalltalk.cxx deleted file mode 100644 index bd146d59c..000000000 --- a/lexers/LexSmalltalk.cxx +++ /dev/null @@ -1,324 +0,0 @@ -// Scintilla source code edit control -/** @file LexSmalltalk.cxx - ** Lexer for Smalltalk language. - ** Written by Sergey Philippov, sphilippov-at-gmail-dot-com - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -/* -| lexTable classificationBlock charClasses | -charClasses := #(#DecDigit #Letter #Special #Upper #BinSel). -lexTable := ByteArray new: 128. -classificationBlock := [ :charClass :chars | - | flag | - flag := 1 bitShift: (charClasses indexOf: charClass) - 1. - chars do: [ :char | lexTable at: char codePoint + 1 put: ((lexTable at: char codePoint + 1) bitOr: flag)]]. - -classificationBlock - value: #DecDigit value: '0123456789'; - value: #Letter value: '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ'; - value: #Special value: '()[]{};.^:'; - value: #BinSel value: '~@%&*-+=|\/,<>?!'; - value: #Upper value: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'. - -((String new: 500) streamContents: [ :stream | - stream crLf; nextPutAll: 'static int ClassificationTable[256] = {'. - lexTable keysAndValuesDo: [ :index :value | - ((index - 1) rem: 16) == 0 ifTrue: [ - stream crLf; tab] - ifFalse: [ - stream space]. - stream print: value. - index ~= 256 ifTrue: [ - stream nextPut: $,]]. - stream crLf; nextPutAll: '};'; crLf. - - charClasses keysAndValuesDo: [ :index :name | - stream - crLf; - nextPutAll: ( - ('static inline bool is<1s>(int ch) {return (ch > 0) && (ch %< 0x80) && ((ClassificationTable[ch] & <2p>) != 0);}') - expandMacrosWith: name with: (1 bitShift: (index - 1))) - ]]) edit -*/ - -// autogenerated {{{{ - -static int ClassificationTable[256] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 16, 0, 0, 0, 16, 16, 0, 4, 4, 16, 16, 16, 16, 4, 16, - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 16, 16, 16, 16, - 16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, - 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 4, 16, 4, 4, 2, - 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 16, 4, 16, 0, -}; - -static inline bool isDecDigit(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 1) != 0);} -static inline bool isLetter(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 2) != 0);} -static inline bool isSpecial(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 4) != 0);} -static inline bool isUpper(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 8) != 0);} -static inline bool isBinSel(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 16) != 0);} -// autogenerated }}}} - -static inline bool isAlphaNumeric(int ch) { - return isDecDigit(ch) || isLetter(ch); -} - -static inline bool isDigitOfRadix(int ch, int radix) -{ - if (isDecDigit(ch)) - return (ch - '0') < radix; - else if (!isUpper(ch)) - return false; - else - return (ch - 'A' + 10) < radix; -} - -static inline void skipComment(StyleContext& sc) -{ - while (sc.More() && sc.ch != '\"') - sc.Forward(); -} - -static inline void skipString(StyleContext& sc) -{ - while (sc.More()) { - if (sc.ch == '\'') { - if (sc.chNext != '\'') - return; - sc.Forward(); - } - sc.Forward(); - } -} - -static void handleHash(StyleContext& sc) -{ - if (isSpecial(sc.chNext)) { - sc.SetState(SCE_ST_SPECIAL); - return; - } - - sc.SetState(SCE_ST_SYMBOL); - sc.Forward(); - if (sc.ch == '\'') { - sc.Forward(); - skipString(sc); - } - else { - if (isLetter(sc.ch)) { - while (isAlphaNumeric(sc.chNext) || sc.chNext == ':') - sc.Forward(); - } - else if (isBinSel(sc.ch)) { - while (isBinSel(sc.chNext)) - sc.Forward(); - } - } -} - -static inline void handleSpecial(StyleContext& sc) -{ - if (sc.ch == ':' && sc.chNext == '=') { - sc.SetState(SCE_ST_ASSIGN); - sc.Forward(); - } - else { - if (sc.ch == '^') - sc.SetState(SCE_ST_RETURN); - else - sc.SetState(SCE_ST_SPECIAL); - } -} - -static inline void skipInt(StyleContext& sc, int radix) -{ - while (isDigitOfRadix(sc.chNext, radix)) - sc.Forward(); -} - -static void handleNumeric(StyleContext& sc) -{ - char num[256]; - int nl; - int radix; - - sc.SetState(SCE_ST_NUMBER); - num[0] = static_cast<char>(sc.ch); - nl = 1; - while (isDecDigit(sc.chNext)) { - num[nl++] = static_cast<char>(sc.chNext); - sc.Forward(); - if (nl+1 == sizeof(num)/sizeof(num[0])) // overrun check - break; - } - if (sc.chNext == 'r') { - num[nl] = 0; - if (num[0] == '-') - radix = atoi(num + 1); - else - radix = atoi(num); - sc.Forward(); - if (sc.chNext == '-') - sc.Forward(); - skipInt(sc, radix); - } - else - radix = 10; - if (sc.chNext != '.' || !isDigitOfRadix(sc.GetRelative(2), radix)) - return; - sc.Forward(); - skipInt(sc, radix); - if (sc.chNext == 's') { - // ScaledDecimal - sc.Forward(); - while (isDecDigit(sc.chNext)) - sc.Forward(); - return; - } - else if (sc.chNext != 'e' && sc.chNext != 'd' && sc.chNext != 'q') - return; - sc.Forward(); - if (sc.chNext == '+' || sc.chNext == '-') - sc.Forward(); - skipInt(sc, radix); -} - -static inline void handleBinSel(StyleContext& sc) -{ - sc.SetState(SCE_ST_BINARY); - while (isBinSel(sc.chNext)) - sc.Forward(); -} - -static void handleLetter(StyleContext& sc, WordList* specialSelectorList) -{ - char ident[256]; - int il; - int state; - bool doubleColonPresent; - - sc.SetState(SCE_ST_DEFAULT); - - ident[0] = static_cast<char>(sc.ch); - il = 1; - while (isAlphaNumeric(sc.chNext)) { - ident[il++] = static_cast<char>(sc.chNext); - sc.Forward(); - if (il+2 == sizeof(ident)/sizeof(ident[0])) // overrun check - break; - } - - if (sc.chNext == ':') { - doubleColonPresent = true; - ident[il++] = ':'; - sc.Forward(); - } - else - doubleColonPresent = false; - ident[il] = 0; - - if (specialSelectorList->InList(ident)) - state = SCE_ST_SPEC_SEL; - else if (doubleColonPresent) - state = SCE_ST_KWSEND; - else if (isUpper(ident[0])) - state = SCE_ST_GLOBAL; - else { - if (!strcmp(ident, "self")) - state = SCE_ST_SELF; - else if (!strcmp(ident, "super")) - state = SCE_ST_SUPER; - else if (!strcmp(ident, "nil")) - state = SCE_ST_NIL; - else if (!strcmp(ident, "true") || !strcmp(ident, "false")) - state = SCE_ST_BOOL; - else - state = SCE_ST_DEFAULT; - } - - sc.ChangeState(state); -} - -static void colorizeSmalltalkDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *wordLists[], Accessor &styler) -{ - StyleContext sc(startPos, length, initStyle, styler); - - if (initStyle == SCE_ST_COMMENT) { - skipComment(sc); - if (sc.More()) - sc.Forward(); - } - else if (initStyle == SCE_ST_STRING) { - skipString(sc); - if (sc.More()) - sc.Forward(); - } - - for (; sc.More(); sc.Forward()) { - int ch; - - ch = sc.ch; - if (ch == '\"') { - sc.SetState(SCE_ST_COMMENT); - sc.Forward(); - skipComment(sc); - } - else if (ch == '\'') { - sc.SetState(SCE_ST_STRING); - sc.Forward(); - skipString(sc); - } - else if (ch == '#') - handleHash(sc); - else if (ch == '$') { - sc.SetState(SCE_ST_CHARACTER); - sc.Forward(); - } - else if (isSpecial(ch)) - handleSpecial(sc); - else if (isDecDigit(ch)) - handleNumeric(sc); - else if (isLetter(ch)) - handleLetter(sc, wordLists[0]); - else if (isBinSel(ch)) { - if (ch == '-' && isDecDigit(sc.chNext)) - handleNumeric(sc); - else - handleBinSel(sc); - } - else - sc.SetState(SCE_ST_DEFAULT); - } - sc.Complete(); -} - -static const char* const smalltalkWordListDesc[] = { - "Special selectors", - 0 -}; - -LexerModule lmSmalltalk(SCLEX_SMALLTALK, colorizeSmalltalkDoc, "smalltalk", NULL, smalltalkWordListDesc); diff --git a/lexers/LexSorcus.cxx b/lexers/LexSorcus.cxx deleted file mode 100644 index 66669dc8c..000000000 --- a/lexers/LexSorcus.cxx +++ /dev/null @@ -1,206 +0,0 @@ -// Scintilla source code edit control -/** @file LexSorcus.cxx -** Lexer for SORCUS installation files -** Written by Eugen Bitter and Christoph Baumann at SORCUS Computer, Heidelberg Germany -** Based on the ASM Lexer by The Black Horus -**/ - -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - - -//each character a..z and A..Z + '_' can be part of a keyword -//additionally numbers that follow 'M' can be contained in a keyword -static inline bool IsSWordStart(const int ch, const int prev_ch) -{ - if (isalpha(ch) || (ch == '_') || ((isdigit(ch)) && (prev_ch == 'M'))) - return true; - - return false; -} - - -//only digits that are not preceded by 'M' count as a number -static inline bool IsSorcusNumber(const int ch, const int prev_ch) -{ - if ((isdigit(ch)) && (prev_ch != 'M')) - return true; - - return false; -} - - -//only = is a valid operator -static inline bool IsSorcusOperator(const int ch) -{ - if (ch == '=') - return true; - - return false; -} - - -static void ColouriseSorcusDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) -{ - - WordList &Command = *keywordlists[0]; - WordList &Parameter = *keywordlists[1]; - WordList &Constant = *keywordlists[2]; - - // Do not leak onto next line - if (initStyle == SCE_SORCUS_STRINGEOL) - initStyle = SCE_SORCUS_DEFAULT; - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) - { - - // Prevent SCE_SORCUS_STRINGEOL from leaking back to previous line - if (sc.atLineStart && (sc.state == SCE_SORCUS_STRING)) - { - sc.SetState(SCE_SORCUS_STRING); - } - - // Determine if the current state should terminate. - if (sc.state == SCE_SORCUS_OPERATOR) - { - if (!IsSorcusOperator(sc.ch)) - { - sc.SetState(SCE_SORCUS_DEFAULT); - } - } - else if(sc.state == SCE_SORCUS_NUMBER) - { - if(!IsSorcusNumber(sc.ch, sc.chPrev)) - { - sc.SetState(SCE_SORCUS_DEFAULT); - } - } - else if (sc.state == SCE_SORCUS_IDENTIFIER) - { - if (!IsSWordStart(sc.ch, sc.chPrev)) - { - char s[100]; - - sc.GetCurrent(s, sizeof(s)); - - if (Command.InList(s)) - { - sc.ChangeState(SCE_SORCUS_COMMAND); - } - else if (Parameter.InList(s)) - { - sc.ChangeState(SCE_SORCUS_PARAMETER); - } - else if (Constant.InList(s)) - { - sc.ChangeState(SCE_SORCUS_CONSTANT); - } - - sc.SetState(SCE_SORCUS_DEFAULT); - } - } - else if (sc.state == SCE_SORCUS_COMMENTLINE ) - { - if (sc.atLineEnd) - { - sc.SetState(SCE_SORCUS_DEFAULT); - } - } - else if (sc.state == SCE_SORCUS_STRING) - { - if (sc.ch == '\"') - { - sc.ForwardSetState(SCE_SORCUS_DEFAULT); - } - else if (sc.atLineEnd) - { - sc.ChangeState(SCE_SORCUS_STRINGEOL); - sc.ForwardSetState(SCE_SORCUS_DEFAULT); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_SORCUS_DEFAULT) - { - if ((sc.ch == ';') || (sc.ch == '\'')) - { - sc.SetState(SCE_SORCUS_COMMENTLINE); - } - else if (IsSWordStart(sc.ch, sc.chPrev)) - { - sc.SetState(SCE_SORCUS_IDENTIFIER); - } - else if (sc.ch == '\"') - { - sc.SetState(SCE_SORCUS_STRING); - } - else if (IsSorcusOperator(sc.ch)) - { - sc.SetState(SCE_SORCUS_OPERATOR); - } - else if (IsSorcusNumber(sc.ch, sc.chPrev)) - { - sc.SetState(SCE_SORCUS_NUMBER); - } - } - - } - sc.Complete(); -} - - -static const char* const SorcusWordListDesc[] = {"Command","Parameter", "Constant", 0}; - -LexerModule lmSorc(SCLEX_SORCUS, ColouriseSorcusDoc, "sorcins", 0, SorcusWordListDesc); - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/lexers/LexSpecman.cxx b/lexers/LexSpecman.cxx deleted file mode 100644 index 5a4c9105f..000000000 --- a/lexers/LexSpecman.cxx +++ /dev/null @@ -1,290 +0,0 @@ -// Scintilla source code edit control -/** @file LexSpecman.cxx - ** Lexer for Specman E language. - ** Written by Avi Yegudin, based on C++ lexer by Neil Hodgson - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\''); -} - -static inline bool IsANumberChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '\''); -} - -static inline bool IsAWordStart(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '`'); -} - -static void ColouriseSpecmanDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler, bool caseSensitive) { - - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - WordList &keywords4 = *keywordlists[3]; - - // Do not leak onto next line - if (initStyle == SCE_SN_STRINGEOL) - initStyle = SCE_SN_CODE; - - int visibleChars = 0; - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - if (sc.atLineStart && (sc.state == SCE_SN_STRING)) { - // Prevent SCE_SN_STRINGEOL from leaking back to previous line - sc.SetState(SCE_SN_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_SN_OPERATOR) { - sc.SetState(SCE_SN_CODE); - } else if (sc.state == SCE_SN_NUMBER) { - if (!IsANumberChar(sc.ch)) { - sc.SetState(SCE_SN_CODE); - } - } else if (sc.state == SCE_SN_IDENTIFIER) { - if (!IsAWordChar(sc.ch) || (sc.ch == '.')) { - char s[100]; - if (caseSensitive) { - sc.GetCurrent(s, sizeof(s)); - } else { - sc.GetCurrentLowered(s, sizeof(s)); - } - if (keywords.InList(s)) { - sc.ChangeState(SCE_SN_WORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_SN_WORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_SN_WORD3); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_SN_USER); - } - sc.SetState(SCE_SN_CODE); - } - } else if (sc.state == SCE_SN_PREPROCESSOR) { - if (IsASpace(sc.ch)) { - sc.SetState(SCE_SN_CODE); - } - } else if (sc.state == SCE_SN_DEFAULT) { - if (sc.Match('<', '\'')) { - sc.Forward(); - sc.ForwardSetState(SCE_SN_CODE); - } - } else if (sc.state == SCE_SN_COMMENTLINE || sc.state == SCE_SN_COMMENTLINEBANG) { - if (sc.atLineEnd) { - sc.SetState(SCE_SN_CODE); - visibleChars = 0; - } - } else if (sc.state == SCE_SN_STRING) { - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_SN_CODE); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_SN_STRINGEOL); - sc.ForwardSetState(SCE_SN_CODE); - visibleChars = 0; - } - } else if (sc.state == SCE_SN_SIGNAL) { - if (sc.atLineEnd) { - sc.ChangeState(SCE_SN_STRINGEOL); - sc.ForwardSetState(SCE_SN_CODE); - visibleChars = 0; - } else if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_SN_CODE); - } - } else if (sc.state == SCE_SN_REGEXTAG) { - if (!IsADigit(sc.ch)) { - sc.SetState(SCE_SN_CODE); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_SN_CODE) { - if (sc.ch == '$' && IsADigit(sc.chNext)) { - sc.SetState(SCE_SN_REGEXTAG); - sc.Forward(); - } else if (IsADigit(sc.ch)) { - sc.SetState(SCE_SN_NUMBER); - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_SN_IDENTIFIER); - } else if (sc.Match('\'', '>')) { - sc.SetState(SCE_SN_DEFAULT); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('/', '/')) { - if (sc.Match("//!")) // Nice to have a different comment style - sc.SetState(SCE_SN_COMMENTLINEBANG); - else - sc.SetState(SCE_SN_COMMENTLINE); - } else if (sc.Match('-', '-')) { - if (sc.Match("--!")) // Nice to have a different comment style - sc.SetState(SCE_SN_COMMENTLINEBANG); - else - sc.SetState(SCE_SN_COMMENTLINE); - } else if (sc.ch == '\"') { - sc.SetState(SCE_SN_STRING); - } else if (sc.ch == '\'') { - sc.SetState(SCE_SN_SIGNAL); - } else if (sc.ch == '#' && visibleChars == 0) { - // Preprocessor commands are alone on their line - sc.SetState(SCE_SN_PREPROCESSOR); - // Skip whitespace between # and preprocessor word - do { - sc.Forward(); - } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); - if (sc.atLineEnd) { - sc.SetState(SCE_SN_CODE); - } - } else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '@') { - sc.SetState(SCE_SN_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(); -} - -// 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 FoldNoBoxSpecmanDoc(Sci_PositionU startPos, Sci_Position length, int, - Accessor &styler) { - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - 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; - 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_SN_COMMENTLINE)) { - if (((ch == '/') && (chNext == '/')) || - ((ch == '-') && (chNext == '-'))) { - char chNext2 = styler.SafeGetCharAt(i + 2); - if (chNext2 == '{') { - levelNext++; - } else if (chNext2 == '}') { - levelNext--; - } - } - } - if (style == SCE_SN_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) { - 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 (!isspacechar(ch)) - visibleChars++; - } -} - -static void FoldSpecmanDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], - Accessor &styler) { - FoldNoBoxSpecmanDoc(startPos, length, initStyle, styler); -} - -static const char * const specmanWordLists[] = { - "Primary keywords and identifiers", - "Secondary keywords and identifiers", - "Sequence keywords and identifiers", - "User defined keywords and identifiers", - "Unused", - 0, - }; - -static void ColouriseSpecmanDocSensitive(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - ColouriseSpecmanDoc(startPos, length, initStyle, keywordlists, styler, true); -} - - -LexerModule lmSpecman(SCLEX_SPECMAN, ColouriseSpecmanDocSensitive, "specman", FoldSpecmanDoc, specmanWordLists); diff --git a/lexers/LexSpice.cxx b/lexers/LexSpice.cxx deleted file mode 100644 index 9c21da308..000000000 --- a/lexers/LexSpice.cxx +++ /dev/null @@ -1,204 +0,0 @@ -// Scintilla source code edit control -/** @file LexSpice.cxx - ** Lexer for Spice - **/ -// Copyright 2006 by Fabien Proriol -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> - -#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 Scintilla; - -/* - * Interface - */ - -static void ColouriseDocument( - Sci_PositionU startPos, - Sci_Position length, - int initStyle, - WordList *keywordlists[], - Accessor &styler); - -static const char * const spiceWordListDesc[] = { - "Keywords", // SPICE command - "Keywords2", // SPICE functions - "Keywords3", // SPICE params - 0 -}; - -LexerModule lmSpice(SCLEX_SPICE, ColouriseDocument, "spice", NULL, spiceWordListDesc); - -/* - * Implementation - */ - -static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute); -static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute); - -static inline bool IsDelimiterCharacter(int ch); -static inline bool IsSeparatorOrDelimiterCharacter(int ch); - -static void ColouriseComment(StyleContext& sc, bool&) { - sc.SetState(SCE_SPICE_COMMENTLINE); - while (!sc.atLineEnd) { - sc.Forward(); - } -} - -static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) { - apostropheStartsAttribute = sc.Match (')'); - sc.SetState(SCE_SPICE_DELIMITER); - sc.ForwardSetState(SCE_SPICE_DEFAULT); -} - -static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) { - apostropheStartsAttribute = true; - std::string number; - sc.SetState(SCE_SPICE_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<char>(sc.ch); - sc.Forward(); - } - // Special case: exponent with sign - if ((sc.chPrev == 'e' || sc.chPrev == 'E') && - (sc.ch == '+' || sc.ch == '-')) { - number += static_cast<char>(sc.ch); - sc.Forward (); - while (!IsSeparatorOrDelimiterCharacter(sc.ch)) { - number += static_cast<char>(sc.ch); - sc.Forward(); - } - } - sc.SetState(SCE_SPICE_DEFAULT); -} - -static void ColouriseWhiteSpace(StyleContext& sc, bool& ) { - sc.SetState(SCE_SPICE_DEFAULT); - sc.ForwardSetState(SCE_SPICE_DEFAULT); -} - -static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute) { - apostropheStartsAttribute = true; - sc.SetState(SCE_SPICE_IDENTIFIER); - std::string word; - while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { - word += static_cast<char>(tolower(sc.ch)); - sc.Forward(); - } - if (keywords.InList(word.c_str())) { - sc.ChangeState(SCE_SPICE_KEYWORD); - if (word != "all") { - apostropheStartsAttribute = false; - } - } - else if (keywords2.InList(word.c_str())) { - sc.ChangeState(SCE_SPICE_KEYWORD2); - if (word != "all") { - apostropheStartsAttribute = false; - } - } - else if (keywords3.InList(word.c_str())) { - sc.ChangeState(SCE_SPICE_KEYWORD3); - if (word != "all") { - apostropheStartsAttribute = false; - } - } - sc.SetState(SCE_SPICE_DEFAULT); -} - -// -// ColouriseDocument -// -static void ColouriseDocument( - Sci_PositionU startPos, - Sci_Position length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) { - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - 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_SPICE_DEFAULT); - } - // Comments - if ((sc.Match('*') && sc.atLineStart) || sc.Match('*','~')) { - ColouriseComment(sc, 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, keywords2, keywords3, 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); -} diff --git a/lexers/LexStata.cxx b/lexers/LexStata.cxx deleted file mode 100644 index 78410c627..000000000 --- a/lexers/LexStata.cxx +++ /dev/null @@ -1,203 +0,0 @@ -// Scintilla source code edit control -/** @file LexStata.cxx - ** Lexer for Stata - **/ -// Author: Luke Rasmussen (luke.rasmussen@gmail.com) -// -// The License.txt file describes the conditions under which this software may -// be distributed. -// -// Developed as part of the StatTag project at Northwestern University Feinberg -// School of Medicine with funding from Northwestern University Clinical and -// Translational Sciences Institute through CTSA grant UL1TR001422. This work -// has not been reviewed or endorsed by NCATS or the NIH. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static void ColouriseStataDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], - Accessor &styler) { - - WordList &keywords = *keywordlists[0]; - WordList &types = *keywordlists[1]; - - CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); - CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); - CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); - - StyleContext sc(startPos, length, initStyle, styler); - bool lineHasNonCommentChar = false; - for (; sc.More(); sc.Forward()) { - if (sc.atLineStart) { - lineHasNonCommentChar = false; - } - - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_STATA_OPERATOR: - sc.SetState(SCE_STATA_DEFAULT); - break; - case SCE_STATA_NUMBER: - // We accept almost anything because of hex. and number suffixes - if (!setWord.Contains(sc.ch)) { - sc.SetState(SCE_STATA_DEFAULT); - } - break; - case SCE_STATA_IDENTIFIER: - if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { - char s[1000]; - sc.GetCurrent(s, sizeof(s)); - if (keywords.InList(s)) { - sc.ChangeState(SCE_STATA_WORD); - } - else if (types.InList(s)) { - sc.ChangeState(SCE_STATA_TYPE); - } - sc.SetState(SCE_STATA_DEFAULT); - } - break; - case SCE_STATA_COMMENTBLOCK: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_STATA_DEFAULT); - } - break; - case SCE_STATA_COMMENT: - case SCE_STATA_COMMENTLINE: - if (sc.atLineStart) { - sc.SetState(SCE_STATA_DEFAULT); - } - break; - case SCE_STATA_STRING: - if (sc.ch == '\\') { - // Per Stata documentation, the following characters are the only ones that can - // be escaped (not our typical set of quotes, etc.): - // https://www.stata.com/support/faqs/programming/backslashes-and-macros/ - if (sc.chNext == '$' || sc.chNext == '`' || sc.chNext == '\\') { - sc.Forward(); - } - } - else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_STATA_DEFAULT); - } - break; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_STATA_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - lineHasNonCommentChar = true; - sc.SetState(SCE_STATA_NUMBER); - } - else if (setWordStart.Contains(sc.ch)) { - lineHasNonCommentChar = true; - sc.SetState(SCE_STATA_IDENTIFIER); - } - else if (sc.Match('*') && !lineHasNonCommentChar) { - sc.SetState(SCE_STATA_COMMENT); - } - else if (sc.Match('/', '*')) { - sc.SetState(SCE_STATA_COMMENTBLOCK); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } - else if (sc.Match('/', '/')) { - sc.SetState(SCE_STATA_COMMENTLINE); - } - else if (sc.ch == '\"') { - lineHasNonCommentChar = true; - sc.SetState(SCE_STATA_STRING); - } - else if (isoperator(sc.ch)) { - lineHasNonCommentChar = true; - sc.SetState(SCE_STATA_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 {". -static void FoldStataDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], - Accessor &styler) { - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; - 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); - 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_R_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) { - 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 (!isspacechar(ch)) - visibleChars++; - } -} - - -static const char * const StataWordLists[] = { - "Language Keywords", - "Types", - 0, -}; - -LexerModule lmStata(SCLEX_STATA, ColouriseStataDoc, "stata", FoldStataDoc, StataWordLists); diff --git a/lexers/LexTACL.cxx b/lexers/LexTACL.cxx deleted file mode 100644 index 56cd96b01..000000000 --- a/lexers/LexTACL.cxx +++ /dev/null @@ -1,398 +0,0 @@ -// Scintilla source code edit control -/** @file LexTACL.cxx - ** Lexer for TACL - ** Based on LexPascal.cxx - ** Written by Laurent le Tynevez - ** Updated by Simon Steele <s.steele@pnotepad.org> September 2002 - ** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments) - ** Updated by Rod Falck, Aug 2006 Converted to TACL - **/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -inline bool isTACLoperator(char ch) - { - return ch == '\'' || isoperator(ch); - } - -inline bool isTACLwordchar(char ch) - { - return ch == '#' || ch == '^' || ch == '|' || ch == '_' || iswordchar(ch); - } - -inline bool isTACLwordstart(char ch) - { - return ch == '#' || ch == '|' || ch == '_' || iswordstart(ch); - } - -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<char>(tolower(styler[start + i])); - i++; - } - s[i] = '\0'; -} - -static bool IsStreamCommentStyle(int style) { - return style == SCE_C_COMMENT || - style == SCE_C_COMMENTDOC || - style == SCE_C_COMMENTDOCKEYWORD || - style == SCE_C_COMMENTDOCKEYWORDERROR; -} - -static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr, bool bInAsm) { - if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) { - styler.ColourTo(end, SCE_C_REGEX); - } else - styler.ColourTo(end, attr); -} - -// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm" -static int classifyWordTACL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) { - int ret = 0; - - WordList& keywords = *keywordlists[0]; - WordList& builtins = *keywordlists[1]; - WordList& commands = *keywordlists[2]; - - char s[100]; - getRange(start, end, styler, s, sizeof(s)); - - char chAttr = SCE_C_IDENTIFIER; - if (isdigit(s[0]) || (s[0] == '.')) { - chAttr = SCE_C_NUMBER; - } - else { - if (s[0] == '#' || keywords.InList(s)) { - chAttr = SCE_C_WORD; - - if (strcmp(s, "asm") == 0) { - ret = 2; - } - else if (strcmp(s, "end") == 0) { - ret = -1; - } - } - else if (s[0] == '|' || builtins.InList(s)) { - chAttr = SCE_C_WORD2; - } - else if (commands.InList(s)) { - chAttr = SCE_C_UUID; - } - else if (strcmp(s, "comment") == 0) { - chAttr = SCE_C_COMMENTLINE; - ret = 3; - } - } - ColourTo(styler, end, chAttr, (bInAsm && ret != -1)); - return ret; -} - -static int classifyFoldPointTACL(const char* s) { - int lev = 0; - if (s[0] == '[') - lev=1; - else if (s[0] == ']') - lev=-1; - return lev; -} - -static void ColouriseTACLDoc(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; - - bool bInClassDefinition; - - Sci_Position currentLine = styler.GetLine(startPos); - if (currentLine > 0) { - styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); - bInClassDefinition = (styler.GetLineState(currentLine) == 1); - } else { - styler.SetLineState(currentLine, 0); - bInClassDefinition = false; - } - - bool bInAsm = (state == SCE_C_REGEX); - if (bInAsm) - state = SCE_C_DEFAULT; - - styler.StartSegment(startPos); - int visibleChars = 0; - Sci_PositionU i; - for (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 - if (state == SCE_C_CHARACTER) { - ColourTo(styler, i, state, bInAsm); - state = SCE_C_DEFAULT; - } - visibleChars = 0; - currentLine++; - styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0)); - } - - if (styler.IsLeadByte(ch)) { - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - if (state == SCE_C_DEFAULT) { - if (isTACLwordstart(ch)) { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_IDENTIFIER; - } else if (ch == '{') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_COMMENT; - } else if (ch == '{' && chNext == '*') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_COMMENTDOC; - } else if (ch == '=' && chNext == '=') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_COMMENTLINE; - } else if (ch == '"') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_STRING; - } else if (ch == '?' && visibleChars == 0) { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_PREPROCESSOR; - } else if (isTACLoperator(ch)) { - ColourTo(styler, i-1, state, bInAsm); - ColourTo(styler, i, SCE_C_OPERATOR, bInAsm); - } - } else if (state == SCE_C_IDENTIFIER) { - if (!isTACLwordchar(ch)) { - int lStateChange = classifyWordTACL(styler.GetStartSegment(), i - 1, keywordlists, styler, bInAsm); - - if(lStateChange == 1) { - styler.SetLineState(currentLine, 1); - bInClassDefinition = true; - } else if(lStateChange == 2) { - bInAsm = true; - } else if(lStateChange == -1) { - styler.SetLineState(currentLine, 0); - bInClassDefinition = false; - bInAsm = false; - } - - if (lStateChange == 3) { - state = SCE_C_COMMENTLINE; - } - else { - state = SCE_C_DEFAULT; - chNext = styler.SafeGetCharAt(i + 1); - if (ch == '{') { - state = SCE_C_COMMENT; - } else if (ch == '{' && chNext == '*') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_COMMENTDOC; - } else if (ch == '=' && chNext == '=') { - state = SCE_C_COMMENTLINE; - } else if (ch == '"') { - state = SCE_C_STRING; - } else if (isTACLoperator(ch)) { - ColourTo(styler, i, SCE_C_OPERATOR, bInAsm); - } - } - } - } else { - if (state == SCE_C_PREPROCESSOR) { - if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_DEFAULT; - } - } else if (state == SCE_C_COMMENT) { - if (ch == '}' || (ch == '\r' || ch == '\n') ) { - ColourTo(styler, i, state, bInAsm); - state = SCE_C_DEFAULT; - } - } else if (state == SCE_C_COMMENTDOC) { - if (ch == '}' || (ch == '\r' || ch == '\n')) { - if (((i > styler.GetStartSegment() + 2) || ( - (initStyle == SCE_C_COMMENTDOC) && - (styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) { - ColourTo(styler, i, state, bInAsm); - state = SCE_C_DEFAULT; - } - } - } else if (state == SCE_C_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_DEFAULT; - } - } else if (state == SCE_C_STRING) { - if (ch == '"' || ch == '\r' || ch == '\n') { - ColourTo(styler, i, state, bInAsm); - state = SCE_C_DEFAULT; - } - } - } - if (!isspacechar(ch)) - visibleChars++; - chPrev = ch; - } - - // Process to end of document - if (state == SCE_C_IDENTIFIER) { - classifyWordTACL(styler.GetStartSegment(), i - 1, keywordlists, styler, bInAsm); - } - else - ColourTo(styler, lengthDoc - 1, state, bInAsm); -} - -static void FoldTACLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], - 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; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - bool section = false; - - 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_C_DEFAULT && (style == SCE_C_WORD || style == SCE_C_PREPROCESSOR)) - { - // Store last word start point. - lastStart = i; - } - - if (stylePrev == SCE_C_WORD || stylePrev == SCE_C_PREPROCESSOR) { - if(isTACLwordchar(ch) && !isTACLwordchar(chNext)) { - char s[100]; - getRange(lastStart, i, styler, s, sizeof(s)); - if (stylePrev == SCE_C_PREPROCESSOR && strcmp(s, "?section") == 0) - { - section = true; - levelCurrent = 1; - levelPrev = 0; - } - else if (stylePrev == SCE_C_WORD) - levelCurrent += classifyFoldPointTACL(s); - } - } - - if (style == SCE_C_OPERATOR) { - if (ch == '[') { - levelCurrent++; - } else if (ch == ']') { - levelCurrent--; - } - } - if (foldComment && (style == SCE_C_COMMENTLINE)) { - if ((ch == '/') && (chNext == '/')) { - char chNext2 = styler.SafeGetCharAt(i + 2); - if (chNext2 == '{') { - levelCurrent++; - } else if (chNext2 == '}') { - levelCurrent--; - } - } - } - - if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { - if (ch == '{' && chNext == '$') { - Sci_PositionU j=i+2; // skip {$ - while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { - j++; - } - if (styler.Match(j, "region") || styler.Match(j, "if")) { - levelCurrent++; - } else if (styler.Match(j, "end")) { - levelCurrent--; - } - } - } - - 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 (atEOL) { - int lev = levelPrev | SC_FOLDLEVELBASE; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev || section) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - section = 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 TACLWordListDesc[] = { - "Builtins", - "Labels", - "Commands", - 0 -}; - -LexerModule lmTACL(SCLEX_TACL, ColouriseTACLDoc, "TACL", FoldTACLDoc, TACLWordListDesc); diff --git a/lexers/LexTADS3.cxx b/lexers/LexTADS3.cxx deleted file mode 100644 index e2aecbf55..000000000 --- a/lexers/LexTADS3.cxx +++ /dev/null @@ -1,901 +0,0 @@ -// Scintilla source code edit control -/** @file LexTADS3.cxx - ** Lexer for TADS3. - **/ -// Copyright 1998-2006 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -/* - * TADS3 is a language designed by Michael J. Roberts for the writing of text - * based games. TADS comes from Text Adventure Development System. It has good - * support for the processing and outputting of formatted text and much of a - * TADS program listing consists of strings. - * - * TADS has two types of strings, those enclosed in single quotes (') and those - * enclosed in double quotes ("). These strings have different symantics and - * can be given different highlighting if desired. - * - * There can be embedded within both types of strings html tags - * ( <tag key=value> ), library directives ( <.directive> ), and message - * parameters ( {The doctor's/his} ). - * - * Double quoted strings can also contain interpolated expressions - * ( << rug.moved ? ' and a hole in the floor. ' : nil >> ). These expressions - * may themselves contain single or double quoted strings, although the double - * quoted strings may not contain interpolated expressions. - * - * These embedded constructs influence the output and formatting and are an - * important part of a program and require highlighting. - * - * LINKS - * http://www.tads.org/ - */ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static const int T3_SINGLE_QUOTE = 1; -static const int T3_INT_EXPRESSION = 2; -static const int T3_INT_EXPRESSION_IN_TAG = 4; -static const int T3_HTML_SQUOTE = 8; - -static inline bool IsEOL(const int ch, const int chNext) { - return (ch == '\r' && chNext != '\n') || (ch == '\n'); -} - -/* - * Test the current character to see if it's the START of an EOL sequence; - * if so, skip ahead to the last character of the sequence and return true, - * and if not just return false. There are a few places where we want to - * check to see if a newline sequence occurs at a particular point, but - * where a caller expects a subroutine to stop only upon reaching the END - * of a newline sequence (in particular, CR-LF on Windows). That's why - * IsEOL() above only returns true on CR if the CR isn't followed by an LF - * - it doesn't want to admit that there's a newline until reaching the END - * of the sequence. We meet both needs by saying that there's a newline - * when we see the CR in a CR-LF, but skipping the CR before returning so - * that the caller's caller will see that we've stopped at the LF. - */ -static inline bool IsEOLSkip(StyleContext &sc) -{ - /* test for CR-LF */ - if (sc.ch == '\r' && sc.chNext == '\n') - { - /* got CR-LF - skip the CR and indicate that we're at a newline */ - sc.Forward(); - return true; - } - - /* - * in other cases, we have at most a 1-character newline, so do the - * normal IsEOL test - */ - return IsEOL(sc.ch, sc.chNext); -} - -static inline bool IsATADS3Operator(const int ch) { - return 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(const int ch) { - return isalnum(ch) || ch == '_'; -} - -static inline bool IsAWordStart(const int ch) { - return isalpha(ch) || ch == '_'; -} - -static inline bool IsAHexDigit(const int ch) { - int lch = tolower(ch); - return isdigit(lch) || lch == 'a' || lch == 'b' || lch == 'c' - || lch == 'd' || lch == 'e' || lch == 'f'; -} - -static inline bool IsAnHTMLChar(int ch) { - return isalnum(ch) || ch == '-' || ch == '_' || ch == '.'; -} - -static inline bool IsADirectiveChar(int ch) { - return isalnum(ch) || isspace(ch) || ch == '-' || ch == '/'; -} - -static inline bool IsANumberStart(StyleContext &sc) { - return isdigit(sc.ch) - || (!isdigit(sc.chPrev) && sc.ch == '.' && isdigit(sc.chNext)); -} - -inline static void ColouriseTADS3Operator(StyleContext &sc) { - int initState = sc.state; - int c = sc.ch; - sc.SetState(c == '{' || c == '}' ? SCE_T3_BRACE : SCE_T3_OPERATOR); - sc.ForwardSetState(initState); -} - -static void ColouriseTADSHTMLString(StyleContext &sc, int &lineState) { - int endState = sc.state; - int chQuote = sc.ch; - int chString = (lineState & T3_SINGLE_QUOTE) ? '\'' : '"'; - if (endState == SCE_T3_HTML_STRING) { - if (lineState&T3_SINGLE_QUOTE) { - endState = SCE_T3_S_STRING; - chString = '\''; - } else if (lineState&T3_INT_EXPRESSION) { - endState = SCE_T3_X_STRING; - chString = '"'; - } else { - endState = SCE_T3_HTML_DEFAULT; - chString = '"'; - } - chQuote = (lineState & T3_HTML_SQUOTE) ? '\'' : '"'; - } else { - sc.SetState(SCE_T3_HTML_STRING); - sc.Forward(); - } - if (chQuote == '"') - lineState &= ~T3_HTML_SQUOTE; - else - lineState |= T3_HTML_SQUOTE; - - while (sc.More()) { - if (IsEOL(sc.ch, sc.chNext)) { - return; - } - if (sc.ch == chQuote) { - sc.ForwardSetState(endState); - return; - } - if (sc.Match('\\', static_cast<char>(chQuote))) { - sc.Forward(2); - sc.SetState(endState); - return; - } - if (sc.ch == chString) { - sc.SetState(SCE_T3_DEFAULT); - return; - } - - if (sc.Match('<', '<')) { - lineState |= T3_INT_EXPRESSION | T3_INT_EXPRESSION_IN_TAG; - sc.SetState(SCE_T3_X_DEFAULT); - sc.Forward(2); - return; - } - - if (sc.Match('\\', static_cast<char>(chQuote)) - || sc.Match('\\', static_cast<char>(chString)) - || sc.Match('\\', '\\')) { - sc.Forward(2); - } else { - sc.Forward(); - } - } -} - -static void ColouriseTADS3HTMLTagStart(StyleContext &sc) { - sc.SetState(SCE_T3_HTML_TAG); - sc.Forward(); - if (sc.ch == '/') { - sc.Forward(); - } - while (IsAnHTMLChar(sc.ch)) { - sc.Forward(); - } -} - -static void ColouriseTADS3HTMLTag(StyleContext &sc, int &lineState) { - int endState = sc.state; - int chQuote = '"'; - int chString = '\''; - switch (endState) { - case SCE_T3_S_STRING: - ColouriseTADS3HTMLTagStart(sc); - sc.SetState(SCE_T3_HTML_DEFAULT); - chQuote = '\''; - chString = '"'; - break; - case SCE_T3_D_STRING: - case SCE_T3_X_STRING: - ColouriseTADS3HTMLTagStart(sc); - sc.SetState(SCE_T3_HTML_DEFAULT); - break; - case SCE_T3_HTML_DEFAULT: - if (lineState&T3_SINGLE_QUOTE) { - endState = SCE_T3_S_STRING; - chQuote = '\''; - chString = '"'; - } else if (lineState&T3_INT_EXPRESSION) { - endState = SCE_T3_X_STRING; - } else { - endState = SCE_T3_D_STRING; - } - break; - } - - while (sc.More()) { - if (IsEOL(sc.ch, sc.chNext)) { - return; - } - if (sc.Match('/', '>')) { - sc.SetState(SCE_T3_HTML_TAG); - sc.Forward(2); - sc.SetState(endState); - return; - } - if (sc.ch == '>') { - sc.SetState(SCE_T3_HTML_TAG); - sc.ForwardSetState(endState); - return; - } - if (sc.ch == chQuote) { - sc.SetState(endState); - return; - } - if (sc.Match('\\', static_cast<char>(chQuote))) { - sc.Forward(); - ColouriseTADSHTMLString(sc, lineState); - if (sc.state == SCE_T3_X_DEFAULT) - break; - } else if (sc.ch == chString) { - ColouriseTADSHTMLString(sc, lineState); - } else if (sc.ch == '=') { - ColouriseTADS3Operator(sc); - } else { - sc.Forward(); - } - } -} - -static void ColouriseTADS3Keyword(StyleContext &sc, - WordList *keywordlists[], Sci_PositionU endPos) { - char s[250]; - WordList &keywords = *keywordlists[0]; - WordList &userwords1 = *keywordlists[1]; - WordList &userwords2 = *keywordlists[2]; - WordList &userwords3 = *keywordlists[3]; - int initState = sc.state; - sc.SetState(SCE_T3_IDENTIFIER); - while (sc.More() && (IsAWordChar(sc.ch))) { - sc.Forward(); - } - sc.GetCurrent(s, sizeof(s)); - if ( strcmp(s, "is") == 0 || strcmp(s, "not") == 0) { - // have to find if "in" is next - Sci_Position n = 1; - while (n + sc.currentPos < endPos && IsASpaceOrTab(sc.GetRelative(n))) - n++; - if (sc.GetRelative(n) == 'i' && sc.GetRelative(n+1) == 'n') { - sc.Forward(n+2); - sc.ChangeState(SCE_T3_KEYWORD); - } - } else if (keywords.InList(s)) { - sc.ChangeState(SCE_T3_KEYWORD); - } else if (userwords3.InList(s)) { - sc.ChangeState(SCE_T3_USER3); - } else if (userwords2.InList(s)) { - sc.ChangeState(SCE_T3_USER2); - } else if (userwords1.InList(s)) { - sc.ChangeState(SCE_T3_USER1); - } - sc.SetState(initState); -} - -static void ColouriseTADS3MsgParam(StyleContext &sc, int &lineState) { - int endState = sc.state; - int chQuote = '"'; - switch (endState) { - case SCE_T3_S_STRING: - sc.SetState(SCE_T3_MSG_PARAM); - sc.Forward(); - chQuote = '\''; - break; - case SCE_T3_D_STRING: - case SCE_T3_X_STRING: - sc.SetState(SCE_T3_MSG_PARAM); - sc.Forward(); - break; - case SCE_T3_MSG_PARAM: - if (lineState&T3_SINGLE_QUOTE) { - endState = SCE_T3_S_STRING; - chQuote = '\''; - } else if (lineState&T3_INT_EXPRESSION) { - endState = SCE_T3_X_STRING; - } else { - endState = SCE_T3_D_STRING; - } - break; - } - while (sc.More() && sc.ch != '}' && sc.ch != chQuote) { - if (IsEOL(sc.ch, sc.chNext)) { - return; - } - if (sc.ch == '\\') { - sc.Forward(); - } - sc.Forward(); - } - if (sc.ch == chQuote) { - sc.SetState(endState); - } else { - sc.ForwardSetState(endState); - } -} - -static void ColouriseTADS3LibDirective(StyleContext &sc, int &lineState) { - int initState = sc.state; - int chQuote = '"'; - switch (initState) { - case SCE_T3_S_STRING: - sc.SetState(SCE_T3_LIB_DIRECTIVE); - sc.Forward(2); - chQuote = '\''; - break; - case SCE_T3_D_STRING: - sc.SetState(SCE_T3_LIB_DIRECTIVE); - sc.Forward(2); - break; - case SCE_T3_LIB_DIRECTIVE: - if (lineState&T3_SINGLE_QUOTE) { - initState = SCE_T3_S_STRING; - chQuote = '\''; - } else { - initState = SCE_T3_D_STRING; - } - break; - } - while (sc.More() && IsADirectiveChar(sc.ch)) { - if (IsEOL(sc.ch, sc.chNext)) { - return; - } - sc.Forward(); - }; - if (sc.ch == '>' || !sc.More()) { - sc.ForwardSetState(initState); - } else if (sc.ch == chQuote) { - sc.SetState(initState); - } else { - sc.ChangeState(initState); - sc.Forward(); - } -} - -static void ColouriseTADS3String(StyleContext &sc, int &lineState) { - int chQuote = sc.ch; - int endState = sc.state; - switch (sc.state) { - case SCE_T3_DEFAULT: - case SCE_T3_X_DEFAULT: - if (chQuote == '"') { - if (sc.state == SCE_T3_DEFAULT) { - sc.SetState(SCE_T3_D_STRING); - } else { - sc.SetState(SCE_T3_X_STRING); - } - lineState &= ~T3_SINGLE_QUOTE; - } else { - sc.SetState(SCE_T3_S_STRING); - lineState |= T3_SINGLE_QUOTE; - } - sc.Forward(); - break; - case SCE_T3_S_STRING: - chQuote = '\''; - endState = lineState&T3_INT_EXPRESSION ? - SCE_T3_X_DEFAULT : SCE_T3_DEFAULT; - break; - case SCE_T3_D_STRING: - chQuote = '"'; - endState = SCE_T3_DEFAULT; - break; - case SCE_T3_X_STRING: - chQuote = '"'; - endState = SCE_T3_X_DEFAULT; - break; - } - while (sc.More()) { - if (IsEOL(sc.ch, sc.chNext)) { - return; - } - if (sc.ch == chQuote) { - sc.ForwardSetState(endState); - return; - } - if (sc.state == SCE_T3_D_STRING && sc.Match('<', '<')) { - lineState |= T3_INT_EXPRESSION; - sc.SetState(SCE_T3_X_DEFAULT); - sc.Forward(2); - return; - } - if (sc.Match('\\', static_cast<char>(chQuote)) - || sc.Match('\\', '\\')) { - sc.Forward(2); - } else if (sc.ch == '{') { - ColouriseTADS3MsgParam(sc, lineState); - } else if (sc.Match('<', '.')) { - ColouriseTADS3LibDirective(sc, lineState); - } else if (sc.ch == '<') { - ColouriseTADS3HTMLTag(sc, lineState); - if (sc.state == SCE_T3_X_DEFAULT) - return; - } else { - sc.Forward(); - } - } -} - -static void ColouriseTADS3Comment(StyleContext &sc, int endState) { - sc.SetState(SCE_T3_BLOCK_COMMENT); - while (sc.More()) { - if (IsEOL(sc.ch, sc.chNext)) { - return; - } - if (sc.Match('*', '/')) { - sc.Forward(2); - sc.SetState(endState); - return; - } - sc.Forward(); - } -} - -static void ColouriseToEndOfLine(StyleContext &sc, int initState, int endState) { - sc.SetState(initState); - while (sc.More()) { - if (sc.ch == '\\') { - sc.Forward(); - if (IsEOLSkip(sc)) { - return; - } - } - if (IsEOL(sc.ch, sc.chNext)) { - sc.SetState(endState); - return; - } - sc.Forward(); - } -} - -static void ColouriseTADS3Number(StyleContext &sc) { - int endState = sc.state; - bool inHexNumber = false; - bool seenE = false; - bool seenDot = sc.ch == '.'; - sc.SetState(SCE_T3_NUMBER); - if (sc.More()) { - sc.Forward(); - } - if (sc.chPrev == '0' && tolower(sc.ch) == 'x') { - inHexNumber = true; - sc.Forward(); - } - while (sc.More()) { - if (inHexNumber) { - if (!IsAHexDigit(sc.ch)) { - break; - } - } else if (!isdigit(sc.ch)) { - if (!seenE && tolower(sc.ch) == 'e') { - seenE = true; - seenDot = true; - if (sc.chNext == '+' || sc.chNext == '-') { - sc.Forward(); - } - } else if (!seenDot && sc.ch == '.') { - seenDot = true; - } else { - break; - } - } - sc.Forward(); - } - sc.SetState(endState); -} - -static void ColouriseTADS3Doc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - int visibleChars = 0; - int bracketLevel = 0; - int lineState = 0; - Sci_PositionU endPos = startPos + length; - Sci_Position lineCurrent = styler.GetLine(startPos); - if (lineCurrent > 0) { - lineState = styler.GetLineState(lineCurrent-1); - } - StyleContext sc(startPos, length, initStyle, styler); - - while (sc.More()) { - - if (IsEOL(sc.ch, sc.chNext)) { - styler.SetLineState(lineCurrent, lineState); - lineCurrent++; - visibleChars = 0; - sc.Forward(); - if (sc.ch == '\n') { - sc.Forward(); - } - } - - switch(sc.state) { - case SCE_T3_PREPROCESSOR: - case SCE_T3_LINE_COMMENT: - ColouriseToEndOfLine(sc, sc.state, lineState&T3_INT_EXPRESSION ? - SCE_T3_X_DEFAULT : SCE_T3_DEFAULT); - break; - case SCE_T3_S_STRING: - case SCE_T3_D_STRING: - case SCE_T3_X_STRING: - ColouriseTADS3String(sc, lineState); - visibleChars++; - break; - case SCE_T3_MSG_PARAM: - ColouriseTADS3MsgParam(sc, lineState); - break; - case SCE_T3_LIB_DIRECTIVE: - ColouriseTADS3LibDirective(sc, lineState); - break; - case SCE_T3_HTML_DEFAULT: - ColouriseTADS3HTMLTag(sc, lineState); - break; - case SCE_T3_HTML_STRING: - ColouriseTADSHTMLString(sc, lineState); - break; - case SCE_T3_BLOCK_COMMENT: - ColouriseTADS3Comment(sc, lineState&T3_INT_EXPRESSION ? - SCE_T3_X_DEFAULT : SCE_T3_DEFAULT); - break; - case SCE_T3_DEFAULT: - case SCE_T3_X_DEFAULT: - if (IsASpaceOrTab(sc.ch)) { - sc.Forward(); - } else if (sc.ch == '#' && visibleChars == 0) { - ColouriseToEndOfLine(sc, SCE_T3_PREPROCESSOR, sc.state); - } else if (sc.Match('/', '*')) { - ColouriseTADS3Comment(sc, sc.state); - visibleChars++; - } else if (sc.Match('/', '/')) { - ColouriseToEndOfLine(sc, SCE_T3_LINE_COMMENT, sc.state); - } else if (sc.ch == '"') { - bracketLevel = 0; - ColouriseTADS3String(sc, lineState); - visibleChars++; - } else if (sc.ch == '\'') { - ColouriseTADS3String(sc, lineState); - visibleChars++; - } else if (sc.state == SCE_T3_X_DEFAULT && bracketLevel == 0 - && sc.Match('>', '>')) { - sc.Forward(2); - sc.SetState(SCE_T3_D_STRING); - if (lineState & T3_INT_EXPRESSION_IN_TAG) - sc.SetState(SCE_T3_HTML_STRING); - lineState &= ~(T3_SINGLE_QUOTE|T3_INT_EXPRESSION - |T3_INT_EXPRESSION_IN_TAG); - } else if (IsATADS3Operator(sc.ch)) { - if (sc.state == SCE_T3_X_DEFAULT) { - if (sc.ch == '(') { - bracketLevel++; - } else if (sc.ch == ')' && bracketLevel > 0) { - bracketLevel--; - } - } - ColouriseTADS3Operator(sc); - visibleChars++; - } else if (IsANumberStart(sc)) { - ColouriseTADS3Number(sc); - visibleChars++; - } else if (IsAWordStart(sc.ch)) { - ColouriseTADS3Keyword(sc, keywordlists, endPos); - visibleChars++; - } else if (sc.Match("...")) { - sc.SetState(SCE_T3_IDENTIFIER); - sc.Forward(3); - sc.SetState(SCE_T3_DEFAULT); - } else { - sc.Forward(); - visibleChars++; - } - break; - default: - sc.SetState(SCE_T3_DEFAULT); - sc.Forward(); - } - } - sc.Complete(); -} - -/* - TADS3 has two styles of top level block (TLB). Eg - - // default style - silverKey : Key 'small silver key' 'small silver key' - "A small key glints in the sunlight. " - ; - - and - - silverKey : Key { - 'small silver key' - 'small silver key' - "A small key glints in the sunlight. " - } - - Some constructs mandate one or the other, but usually the author has may choose - either. - - T3_SEENSTART is used to indicate that a braceless TLB has been (potentially) - seen and is also used to match the closing ';' of the default style. - - T3_EXPECTINGIDENTIFIER and T3_EXPECTINGPUNCTUATION are used to keep track of - what characters may be seen without incrementing the block level. The general - pattern is identifier <punc> identifier, acceptable punctuation characters - are ':', ',', '(' and ')'. No attempt is made to ensure that punctuation - characters are syntactically correct, eg parentheses match. A ')' always - signifies the start of a block. We just need to check if it is followed by a - '{', in which case we let the brace handling code handle the folding level. - - expectingIdentifier == false && expectingIdentifier == false - Before the start of a TLB. - - expectingIdentifier == true && expectingIdentifier == true - Currently in an identifier. Will accept identifier or punctuation. - - expectingIdentifier == true && expectingIdentifier == false - Just seen a punctuation character & now waiting for an identifier to start. - - expectingIdentifier == false && expectingIdentifier == truee - We were in an identifier and have seen space. Now waiting to see a punctuation - character - - Space, comments & preprocessor directives are always acceptable and are - equivalent. -*/ - -static const int T3_SEENSTART = 1 << 12; -static const int T3_EXPECTINGIDENTIFIER = 1 << 13; -static const int T3_EXPECTINGPUNCTUATION = 1 << 14; - -static inline bool IsStringTransition(int s1, int s2) { - return s1 != s2 - && (s1 == SCE_T3_S_STRING || s1 == SCE_T3_X_STRING - || (s1 == SCE_T3_D_STRING && s2 != SCE_T3_X_DEFAULT)) - && s2 != SCE_T3_LIB_DIRECTIVE - && s2 != SCE_T3_MSG_PARAM - && s2 != SCE_T3_HTML_TAG - && s2 != SCE_T3_HTML_STRING; -} - -static inline bool IsATADS3Punctuation(const int ch) { - return ch == ':' || ch == ',' || ch == '(' || ch == ')'; -} - -static inline bool IsAnIdentifier(const int style) { - return style == SCE_T3_IDENTIFIER - || style == SCE_T3_USER1 - || style == SCE_T3_USER2 - || style == SCE_T3_USER3; -} - -static inline bool IsAnOperator(const int style) { - return style == SCE_T3_OPERATOR || style == SCE_T3_BRACE; -} - -static inline bool IsSpaceEquivalent(const int ch, const int style) { - return isspace(ch) - || style == SCE_T3_BLOCK_COMMENT - || style == SCE_T3_LINE_COMMENT - || style == SCE_T3_PREPROCESSOR; -} - -static char peekAhead(Sci_PositionU startPos, Sci_PositionU endPos, - Accessor &styler) { - for (Sci_PositionU i = startPos; i < endPos; i++) { - int style = styler.StyleAt(i); - char ch = styler[i]; - if (!IsSpaceEquivalent(ch, style)) { - if (IsAnIdentifier(style)) { - return 'a'; - } - if (IsATADS3Punctuation(ch)) { - return ':'; - } - if (ch == '{') { - return '{'; - } - return '*'; - } - } - return ' '; -} - -static void FoldTADS3Doc(Sci_PositionU startPos, Sci_Position length, int initStyle, - 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) >> 16; - int seenStart = levelCurrent & T3_SEENSTART; - int expectingIdentifier = levelCurrent & T3_EXPECTINGIDENTIFIER; - int expectingPunctuation = levelCurrent & T3_EXPECTINGPUNCTUATION; - levelCurrent &= SC_FOLDLEVELNUMBERMASK; - int levelMinCurrent = levelCurrent; - int levelNext = levelCurrent; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - char ch = chNext; - int stylePrev = style; - bool redo = false; - for (Sci_PositionU i = startPos; i < endPos; i++) { - if (redo) { - redo = false; - i--; - } else { - ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - stylePrev = style; - style = styleNext; - styleNext = styler.StyleAt(i + 1); - } - bool atEOL = IsEOL(ch, chNext); - - if (levelNext == SC_FOLDLEVELBASE) { - if (IsSpaceEquivalent(ch, style)) { - if (expectingPunctuation) { - expectingIdentifier = 0; - } - if (style == SCE_T3_BLOCK_COMMENT) { - levelNext++; - } - } else if (ch == '{') { - levelNext++; - seenStart = 0; - } else if (ch == '\'' || ch == '"' || ch == '[') { - levelNext++; - if (seenStart) { - redo = true; - } - } else if (ch == ';') { - seenStart = 0; - expectingIdentifier = 0; - expectingPunctuation = 0; - } else if (expectingIdentifier && expectingPunctuation) { - if (IsATADS3Punctuation(ch)) { - if (ch == ')' && peekAhead(i+1, endPos, styler) != '{') { - levelNext++; - } else { - expectingPunctuation = 0; - } - } else if (!IsAnIdentifier(style)) { - levelNext++; - } - } else if (expectingIdentifier && !expectingPunctuation) { - if (!IsAnIdentifier(style)) { - levelNext++; - } else { - expectingPunctuation = T3_EXPECTINGPUNCTUATION; - } - } else if (!expectingIdentifier && expectingPunctuation) { - if (!IsATADS3Punctuation(ch)) { - levelNext++; - } else { - if (ch == ')' && peekAhead(i+1, endPos, styler) != '{') { - levelNext++; - } else { - expectingIdentifier = T3_EXPECTINGIDENTIFIER; - expectingPunctuation = 0; - } - } - } else if (!expectingIdentifier && !expectingPunctuation) { - if (IsAnIdentifier(style)) { - seenStart = T3_SEENSTART; - expectingIdentifier = T3_EXPECTINGIDENTIFIER; - expectingPunctuation = T3_EXPECTINGPUNCTUATION; - } - } - - if (levelNext != SC_FOLDLEVELBASE && style != SCE_T3_BLOCK_COMMENT) { - expectingIdentifier = 0; - expectingPunctuation = 0; - } - - } else if (levelNext == SC_FOLDLEVELBASE+1 && seenStart - && ch == ';' && IsAnOperator(style)) { - levelNext--; - seenStart = 0; - } else if (style == SCE_T3_BLOCK_COMMENT) { - if (stylePrev != SCE_T3_BLOCK_COMMENT) { - levelNext++; - } else if (styleNext != SCE_T3_BLOCK_COMMENT && !atEOL) { - // Comments don't end at end of line and the next character may be unstyled. - levelNext--; - } - } else if (ch == '\'' || ch == '"') { - if (IsStringTransition(style, stylePrev)) { - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (IsStringTransition(style, styleNext)) { - levelNext--; - } - } else if (IsAnOperator(style)) { - if (ch == '{' || ch == '[') { - // Measure the minimum before a '{' to allow - // folding on "} else {" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (ch == '}' || ch == ']') { - levelNext--; - } - } - - if (atEOL) { - if (seenStart && levelNext == SC_FOLDLEVELBASE) { - switch (peekAhead(i+1, endPos, styler)) { - case ' ': - case '{': - break; - case '*': - levelNext++; - break; - case 'a': - if (expectingPunctuation) { - levelNext++; - } - break; - case ':': - if (expectingIdentifier) { - levelNext++; - } - break; - } - if (levelNext != SC_FOLDLEVELBASE) { - expectingIdentifier = 0; - expectingPunctuation = 0; - } - } - int lev = levelMinCurrent | (levelNext | expectingIdentifier - | expectingPunctuation | seenStart) << 16; - if (levelMinCurrent < levelNext) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelCurrent = levelNext; - levelMinCurrent = levelCurrent; - } - } -} - -static const char * const tads3WordList[] = { - "TADS3 Keywords", - "User defined 1", - "User defined 2", - "User defined 3", - 0 -}; - -LexerModule lmTADS3(SCLEX_TADS3, ColouriseTADS3Doc, "tads3", FoldTADS3Doc, tads3WordList); diff --git a/lexers/LexTAL.cxx b/lexers/LexTAL.cxx deleted file mode 100644 index 8d1f057a6..000000000 --- a/lexers/LexTAL.cxx +++ /dev/null @@ -1,397 +0,0 @@ -// Scintilla source code edit control -/** @file LexTAL.cxx - ** Lexer for TAL - ** Based on LexPascal.cxx - ** Written by Laurent le Tynevez - ** Updated by Simon Steele <s.steele@pnotepad.org> September 2002 - ** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments) - ** Updated by Rod Falck, Aug 2006 Converted to TAL - **/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -inline bool isTALoperator(char ch) - { - return ch == '\'' || ch == '@' || ch == '#' || isoperator(ch); - } - -inline bool isTALwordchar(char ch) - { - return ch == '$' || ch == '^' || iswordchar(ch); - } - -inline bool isTALwordstart(char ch) - { - return ch == '$' || ch == '^' || iswordstart(ch); - } - -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<char>(tolower(styler[start + i])); - i++; - } - s[i] = '\0'; -} - -static bool IsStreamCommentStyle(int style) { - return style == SCE_C_COMMENT || - style == SCE_C_COMMENTDOC || - style == SCE_C_COMMENTDOCKEYWORD || - style == SCE_C_COMMENTDOCKEYWORDERROR; -} - -static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr, bool bInAsm) { - if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) { - styler.ColourTo(end, SCE_C_REGEX); - } else - styler.ColourTo(end, attr); -} - -// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm" -static int classifyWordTAL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInAsm) { - int ret = 0; - - WordList& keywords = *keywordlists[0]; - WordList& builtins = *keywordlists[1]; - WordList& nonreserved_keywords = *keywordlists[2]; - - char s[100]; - getRange(start, end, styler, s, sizeof(s)); - - 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, "asm") == 0) { - ret = 2; - } - else if (strcmp(s, "end") == 0) { - ret = -1; - } - } - else if (s[0] == '$' || builtins.InList(s)) { - chAttr = SCE_C_WORD2; - } - else if (nonreserved_keywords.InList(s)) { - chAttr = SCE_C_UUID; - } - } - ColourTo(styler, end, chAttr, (bInAsm && ret != -1)); - return ret; -} - -static int classifyFoldPointTAL(const char* s) { - int lev = 0; - if (!(isdigit(s[0]) || (s[0] == '.'))) { - if (strcmp(s, "begin") == 0 || - strcmp(s, "block") == 0) { - lev=1; - } else if (strcmp(s, "end") == 0) { - lev=-1; - } - } - return lev; -} - -static void ColouriseTALDoc(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; - - bool bInClassDefinition; - - Sci_Position currentLine = styler.GetLine(startPos); - if (currentLine > 0) { - styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); - bInClassDefinition = (styler.GetLineState(currentLine) == 1); - } else { - styler.SetLineState(currentLine, 0); - bInClassDefinition = false; - } - - bool bInAsm = (state == SCE_C_REGEX); - if (bInAsm) - state = SCE_C_DEFAULT; - - styler.StartSegment(startPos); - int visibleChars = 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 - if (state == SCE_C_CHARACTER) { - ColourTo(styler, i, state, bInAsm); - state = SCE_C_DEFAULT; - } - visibleChars = 0; - currentLine++; - styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0)); - } - - if (styler.IsLeadByte(ch)) { - chNext = styler.SafeGetCharAt(i + 2); - chPrev = ' '; - i += 1; - continue; - } - - if (state == SCE_C_DEFAULT) { - if (isTALwordstart(ch)) { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_IDENTIFIER; - } else if (ch == '!' && chNext != '*') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_COMMENT; - } else if (ch == '!' && chNext == '*') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_COMMENTDOC; - } else if (ch == '-' && chNext == '-') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_COMMENTLINE; - } else if (ch == '"') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_STRING; - } else if (ch == '?' && visibleChars == 0) { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_PREPROCESSOR; - } else if (isTALoperator(ch)) { - ColourTo(styler, i-1, state, bInAsm); - ColourTo(styler, i, SCE_C_OPERATOR, bInAsm); - } - } else if (state == SCE_C_IDENTIFIER) { - if (!isTALwordchar(ch)) { - int lStateChange = classifyWordTAL(styler.GetStartSegment(), i - 1, keywordlists, styler, bInAsm); - - if(lStateChange == 1) { - styler.SetLineState(currentLine, 1); - bInClassDefinition = true; - } else if(lStateChange == 2) { - bInAsm = true; - } else if(lStateChange == -1) { - styler.SetLineState(currentLine, 0); - bInClassDefinition = false; - bInAsm = false; - } - - state = SCE_C_DEFAULT; - chNext = styler.SafeGetCharAt(i + 1); - if (ch == '!' && chNext != '*') { - state = SCE_C_COMMENT; - } else if (ch == '!' && chNext == '*') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_COMMENTDOC; - } else if (ch == '-' && chNext == '-') { - state = SCE_C_COMMENTLINE; - } else if (ch == '"') { - state = SCE_C_STRING; - } else if (isTALoperator(ch)) { - ColourTo(styler, i, SCE_C_OPERATOR, bInAsm); - } - } - } else { - if (state == SCE_C_PREPROCESSOR) { - if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_DEFAULT; - } - } else if (state == SCE_C_COMMENT) { - if (ch == '!' || (ch == '\r' || ch == '\n') ) { - ColourTo(styler, i, state, bInAsm); - state = SCE_C_DEFAULT; - } - } else if (state == SCE_C_COMMENTDOC) { - if (ch == '!' || (ch == '\r' || ch == '\n')) { - if (((i > styler.GetStartSegment() + 2) || ( - (initStyle == SCE_C_COMMENTDOC) && - (styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) { - ColourTo(styler, i, state, bInAsm); - state = SCE_C_DEFAULT; - } - } - } else if (state == SCE_C_COMMENTLINE) { - if (ch == '\r' || ch == '\n') { - ColourTo(styler, i-1, state, bInAsm); - state = SCE_C_DEFAULT; - } - } else if (state == SCE_C_STRING) { - if (ch == '"') { - ColourTo(styler, i, state, bInAsm); - state = SCE_C_DEFAULT; - } - } - } - if (!isspacechar(ch)) - visibleChars++; - chPrev = ch; - } - ColourTo(styler, lengthDoc - 1, state, bInAsm); -} - -static void FoldTALDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], - 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; - char chNext = styler[startPos]; - int styleNext = styler.StyleAt(startPos); - int style = initStyle; - bool was_end = false; - bool section = false; - - 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_C_DEFAULT && (style == SCE_C_WORD || style == SCE_C_UUID || style == SCE_C_PREPROCESSOR)) - { - // Store last word start point. - lastStart = i; - } - - if (stylePrev == SCE_C_WORD || style == SCE_C_UUID || stylePrev == SCE_C_PREPROCESSOR) { - if(isTALwordchar(ch) && !isTALwordchar(chNext)) { - char s[100]; - getRange(lastStart, i, styler, s, sizeof(s)); - if (stylePrev == SCE_C_PREPROCESSOR && strcmp(s, "?section") == 0) - { - section = true; - levelCurrent = 1; - levelPrev = 0; - } - else if (stylePrev == SCE_C_WORD || stylePrev == SCE_C_UUID) - { - if (strcmp(s, "block") == 0) - { - // block keyword is ignored immediately after end keyword - if (!was_end) - levelCurrent++; - } - else - levelCurrent += classifyFoldPointTAL(s); - if (strcmp(s, "end") == 0) - { - was_end = true; - } - else - { - was_end = false; - } - } - } - } - - if (foldComment && (style == SCE_C_COMMENTLINE)) { - if ((ch == '/') && (chNext == '/')) { - char chNext2 = styler.SafeGetCharAt(i + 2); - if (chNext2 == '{') { - levelCurrent++; - } else if (chNext2 == '}') { - levelCurrent--; - } - } - } - - if (foldPreprocessor && (style == SCE_C_PREPROCESSOR)) { - if (ch == '{' && chNext == '$') { - Sci_PositionU j=i+2; // skip {$ - while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { - j++; - } - if (styler.Match(j, "region") || styler.Match(j, "if")) { - levelCurrent++; - } else if (styler.Match(j, "end")) { - levelCurrent--; - } - } - } - - 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 (atEOL) { - int lev = levelPrev | SC_FOLDLEVELBASE; - if (visibleChars == 0 && foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if ((levelCurrent > levelPrev || section) && (visibleChars > 0)) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelPrev = levelCurrent; - visibleChars = 0; - section = 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 TALWordListDesc[] = { - "Keywords", - "Builtins", - 0 -}; - -LexerModule lmTAL(SCLEX_TAL, ColouriseTALDoc, "TAL", FoldTALDoc, TALWordListDesc); diff --git a/lexers/LexTCL.cxx b/lexers/LexTCL.cxx deleted file mode 100644 index 5c73fb52e..000000000 --- a/lexers/LexTCL.cxx +++ /dev/null @@ -1,371 +0,0 @@ -// Scintilla source code edit control -/** @file LexTCL.cxx - ** Lexer for TCL language. - **/ -// Copyright 1998-2001 by Andre Arpin <arpin@kingston.net> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// Extended to accept accented characters -static inline bool IsAWordChar(int ch) { - return ch >= 0x80 || - (isalnum(ch) || ch == '_' || ch ==':' || ch=='.'); // : name space separator -} - -static inline bool IsAWordStart(int ch) { - return ch >= 0x80 || (ch ==':' || isalpha(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) && - (IsADigit(ch, 0x10) || toupper(ch) == 'E' || - ch == '.' || ch == '-' || ch == '+'); -} - -static void ColouriseTCLDoc(Sci_PositionU startPos, Sci_Position length, int , WordList *keywordlists[], Accessor &styler) { -#define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT) - const bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool commentLevel = false; - bool subBrace = false; // substitution begin with a brace ${.....} - enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf, - LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32 - } lineState = LS_DEFAULT; - bool prevSlash = false; - int currentLevel = 0; - bool expected = 0; - bool subParen = 0; - - Sci_Position currentLine = styler.GetLine(startPos); - if (currentLine > 0) - currentLine--; - length += startPos - styler.LineStart(currentLine); - // make sure lines overlap - startPos = styler.LineStart(currentLine); - - 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]; - WordList &keywords9 = *keywordlists[8]; - - if (currentLine > 0) { - int ls = styler.GetLineState(currentLine - 1); - lineState = tLineState(ls & LS_MASK_STATE); - expected = LS_COMMAND_EXPECTED == tLineState(ls & LS_COMMAND_EXPECTED); - subBrace = LS_BRACE_ONLY == tLineState(ls & LS_BRACE_ONLY); - currentLevel = styler.LevelAt(currentLine - 1) >> 17; - commentLevel = (styler.LevelAt(currentLine - 1) >> 16) & 1; - } else - styler.SetLevel(0, SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG); - bool visibleChars = false; - - int previousLevel = currentLevel; - StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler); - for (; ; sc.Forward()) { -next: - if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac - continue; - bool atEnd = !sc.More(); // make sure we coloured the last word - if (lineState != LS_DEFAULT) { - sc.SetState(SCE_TCL_DEFAULT); - if (lineState == LS_OPEN_COMMENT) - sc.SetState(SCE_TCL_COMMENTLINE); - else if (lineState == LS_OPEN_DOUBLE_QUOTE) - sc.SetState(SCE_TCL_IN_QUOTE); - else if (lineState == LS_COMMENT_BOX && (sc.ch == '#' || (sc.ch == ' ' && sc.chNext=='#'))) - sc.SetState(SCE_TCL_COMMENT_BOX); - lineState = LS_DEFAULT; - } - if (subBrace) { // ${ overrides every thing even \ except } - if (sc.ch == '}') { - subBrace = false; - sc.SetState(SCE_TCL_OPERATOR); - sc.ForwardSetState(SCE_TCL_DEFAULT); - goto next; - } else - sc.SetState(SCE_TCL_SUB_BRACE); - if (!sc.atLineEnd) - continue; - } else if (sc.state == SCE_TCL_DEFAULT || sc.state ==SCE_TCL_OPERATOR) { - expected &= isspacechar(static_cast<unsigned char>(sc.ch)) || IsAWordStart(sc.ch) || sc.ch =='#'; - } else if (sc.state == SCE_TCL_SUBSTITUTION) { - switch (sc.ch) { - case '(': - subParen=true; - sc.SetState(SCE_TCL_OPERATOR); - sc.ForwardSetState(SCE_TCL_SUBSTITUTION); - continue; - case ')': - sc.SetState(SCE_TCL_OPERATOR); - subParen=false; - continue; - case '$': - continue; - case ',': - sc.SetState(SCE_TCL_OPERATOR); - if (subParen) { - sc.ForwardSetState(SCE_TCL_SUBSTITUTION); - goto next; // Already forwarded so avoid loop's Forward() - } - continue; - default : - // maybe spaces should be allowed ??? - if (!IsAWordChar(sc.ch)) { // probably the code is wrong - sc.SetState(SCE_TCL_DEFAULT); - subParen = 0; - } - break; - } - } else if (isComment(sc.state)) { - } else if (!IsAWordChar(sc.ch)) { - if ((sc.state == SCE_TCL_IDENTIFIER && expected) || sc.state == SCE_TCL_MODIFIER) { - char w[100]; - char *s=w; - sc.GetCurrent(w, sizeof(w)); - if (w[strlen(w)-1]=='\r') - w[strlen(w)-1]=0; - while (*s == ':') // ignore leading : like in ::set a 10 - ++s; - bool quote = sc.state == SCE_TCL_IN_QUOTE; - if (commentLevel || expected) { - if (keywords.InList(s)) { - sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD3); - } else if (keywords4.InList(s)) { - sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD4); - } else if (sc.GetRelative(-static_cast<int>(strlen(s))-1) == '{' && - keywords5.InList(s) && sc.ch == '}') { // {keyword} exactly no spaces - sc.ChangeState(SCE_TCL_EXPAND); - } - if (keywords6.InList(s)) { - sc.ChangeState(SCE_TCL_WORD5); - } else if (keywords7.InList(s)) { - sc.ChangeState(SCE_TCL_WORD6); - } else if (keywords8.InList(s)) { - sc.ChangeState(SCE_TCL_WORD7); - } else if (keywords9.InList(s)) { - sc.ChangeState(SCE_TCL_WORD8); - } - } - expected = false; - sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT); - } else if (sc.state == SCE_TCL_MODIFIER || sc.state == SCE_TCL_IDENTIFIER) { - sc.SetState(SCE_TCL_DEFAULT); - } - } - if (atEnd) - break; - if (sc.atLineEnd) { - lineState = LS_DEFAULT; - currentLine = styler.GetLine(sc.currentPos); - if (foldComment && sc.state!=SCE_TCL_COMMENT && isComment(sc.state)) { - if (currentLevel == 0) { - ++currentLevel; - commentLevel = true; - } - } else { - if (visibleChars && commentLevel) { - --currentLevel; - --previousLevel; - commentLevel = false; - } - } - int flag = 0; - if (!visibleChars && foldCompact) - flag = SC_FOLDLEVELWHITEFLAG; - if (currentLevel > previousLevel) - flag = SC_FOLDLEVELHEADERFLAG; - styler.SetLevel(currentLine, flag + previousLevel + SC_FOLDLEVELBASE + (currentLevel << 17) + (commentLevel << 16)); - - // Update the line state, so it can be seen by next line - if (sc.state == SCE_TCL_IN_QUOTE) { - lineState = LS_OPEN_DOUBLE_QUOTE; - } else { - if (prevSlash) { - if (isComment(sc.state)) - lineState = LS_OPEN_COMMENT; - } else if (sc.state == SCE_TCL_COMMENT_BOX) - lineState = LS_COMMENT_BOX; - } - styler.SetLineState(currentLine, - (subBrace ? LS_BRACE_ONLY : 0) | - (expected ? LS_COMMAND_EXPECTED : 0) | lineState); - if (lineState == LS_COMMENT_BOX) - sc.ForwardSetState(SCE_TCL_COMMENT_BOX); - else if (lineState == LS_OPEN_DOUBLE_QUOTE) - sc.ForwardSetState(SCE_TCL_IN_QUOTE); - else - sc.ForwardSetState(SCE_TCL_DEFAULT); - prevSlash = false; - previousLevel = currentLevel; - goto next; - } - - if (prevSlash) { - prevSlash = false; - if (sc.ch == '#' && IsANumberChar(sc.chNext)) - sc.ForwardSetState(SCE_TCL_NUMBER); - continue; - } - prevSlash = sc.ch == '\\'; - if (isComment(sc.state)) - continue; - if (sc.atLineStart) { - visibleChars = false; - if (sc.state!=SCE_TCL_IN_QUOTE && !isComment(sc.state)) - { - sc.SetState(SCE_TCL_DEFAULT); - expected = IsAWordStart(sc.ch)|| isspacechar(static_cast<unsigned char>(sc.ch)); - } - } - - switch (sc.state) { - case SCE_TCL_NUMBER: - if (!IsANumberChar(sc.ch)) - sc.SetState(SCE_TCL_DEFAULT); - break; - case SCE_TCL_IN_QUOTE: - if (sc.ch == '"') { - sc.ForwardSetState(SCE_TCL_DEFAULT); - visibleChars = true; // necessary if a " is the first and only character on a line - goto next; - } else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$') { - sc.SetState(SCE_TCL_OPERATOR); - expected = sc.ch == '['; - sc.ForwardSetState(SCE_TCL_IN_QUOTE); - goto next; - } - continue; - case SCE_TCL_OPERATOR: - sc.SetState(SCE_TCL_DEFAULT); - break; - } - - if (sc.ch == '#') { - if (visibleChars) { - if (sc.state != SCE_TCL_IN_QUOTE && expected) - sc.SetState(SCE_TCL_COMMENT); - } else { - sc.SetState(SCE_TCL_COMMENTLINE); - if (sc.chNext == '~') - sc.SetState(SCE_TCL_BLOCK_COMMENT); - if (sc.atLineStart && (sc.chNext == '#' || sc.chNext == '-')) - sc.SetState(SCE_TCL_COMMENT_BOX); - } - } - - if (!isspacechar(static_cast<unsigned char>(sc.ch))) { - visibleChars = true; - } - - if (sc.ch == '\\') { - prevSlash = true; - continue; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_TCL_DEFAULT) { - if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_TCL_IDENTIFIER); - } else if (IsADigit(sc.ch) && !IsAWordChar(sc.chPrev)) { - sc.SetState(SCE_TCL_NUMBER); - } else { - switch (sc.ch) { - case '\"': - sc.SetState(SCE_TCL_IN_QUOTE); - break; - case '{': - sc.SetState(SCE_TCL_OPERATOR); - expected = true; - ++currentLevel; - break; - case '}': - sc.SetState(SCE_TCL_OPERATOR); - expected = true; - --currentLevel; - break; - case '[': - expected = true; - // Falls through. - case ']': - case '(': - case ')': - sc.SetState(SCE_TCL_OPERATOR); - break; - case ';': - expected = true; - break; - case '$': - subParen = 0; - if (sc.chNext != '{') { - sc.SetState(SCE_TCL_SUBSTITUTION); - } else { - sc.SetState(SCE_TCL_OPERATOR); // $ - sc.Forward(); // { - sc.ForwardSetState(SCE_TCL_SUB_BRACE); - subBrace = true; - } - break; - case '#': - if ((isspacechar(static_cast<unsigned char>(sc.chPrev))|| - isoperator(static_cast<char>(sc.chPrev))) && IsADigit(sc.chNext,0x10)) - sc.SetState(SCE_TCL_NUMBER); - break; - case '-': - sc.SetState(IsADigit(sc.chNext)? SCE_TCL_NUMBER: SCE_TCL_MODIFIER); - break; - default: - if (isoperator(static_cast<char>(sc.ch))) { - sc.SetState(SCE_TCL_OPERATOR); - } - } - } - } - } - sc.Complete(); -} - -static const char *const tclWordListDesc[] = { - "TCL Keywords", - "TK Keywords", - "iTCL Keywords", - "tkCommands", - "expand", - "user1", - "user2", - "user3", - "user4", - 0 -}; - -// this code supports folding in the colourizer -LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc); diff --git a/lexers/LexTCMD.cxx b/lexers/LexTCMD.cxx deleted file mode 100644 index 8050dddea..000000000 --- a/lexers/LexTCMD.cxx +++ /dev/null @@ -1,504 +0,0 @@ -// Scintilla\ source code edit control -/** @file LexTCMD.cxx - ** Lexer for Take Command / TCC batch scripts (.bat, .btm, .cmd). - **/ -// Written by Rex Conn (rconn [at] jpsoft [dot] com) -// based on the CMD lexer -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - - -static bool IsAlphabetic(int ch) { - return IsASCII(ch) && isalpha(ch); -} - -static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { - return (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); -} - -// Tests for BATCH Operators -static bool IsBOperator(char ch) { - return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') || (ch == '|') || (ch == '&') || (ch == '!') || (ch == '?') || (ch == '*') || (ch == '(') || (ch == ')'); -} - -// Tests for BATCH Separators -static bool IsBSeparator(char ch) { - return (ch == '\\') || (ch == '.') || (ch == ';') || (ch == ' ') || (ch == '\t') || (ch == '[') || (ch == ']') || (ch == '\"') || (ch == '\'') || (ch == '/'); -} - -// Find length of CMD FOR variable with modifier (%~...) or return 0 -static unsigned int GetBatchVarLen( char *wordBuffer ) -{ - int nLength = 0; - if ( wordBuffer[0] == '%' ) { - - if ( wordBuffer[1] == '~' ) - nLength = 2; - else if (( wordBuffer[1] == '%' ) && ( wordBuffer[2] == '~' )) - nLength++; - else - return 0; - - for ( ; ( wordBuffer[nLength] ); nLength++ ) { - - switch ( toupper(wordBuffer[nLength]) ) { - case 'A': - // file attributes - case 'D': - // drive letter only - case 'F': - // fully qualified path name - case 'N': - // filename only - case 'P': - // path only - case 'S': - // short name - case 'T': - // date / time of file - case 'X': - // file extension only - case 'Z': - // file size - break; - default: - return nLength; - } - } - } - - return nLength; -} - - -static void ColouriseTCMDLine( char *lineBuffer, Sci_PositionU lengthLine, Sci_PositionU startLine, Sci_PositionU endPos, WordList *keywordlists[], Accessor &styler) -{ - Sci_PositionU offset = 0; // Line Buffer Offset - char wordBuffer[260]; // Word Buffer - large to catch long paths - Sci_PositionU wbl; // Word Buffer Length - Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length - WordList &keywords = *keywordlists[0]; // Internal Commands -// WordList &keywords2 = *keywordlists[1]; // Aliases (optional) - bool isDelayedExpansion = 1; // !var! - - bool continueProcessing = true; // Used to toggle Regular Keyword Checking - // Special Keywords are those that allow certain characters without whitespace after the command - // Examples are: cd. cd\ echo: echo. path= - bool inString = false; // Used for processing while "" - // Special Keyword Buffer used to determine if the first n characters is a Keyword - char sKeywordBuffer[260] = ""; // Special Keyword Buffer - bool sKeywordFound; // Exit Special Keyword for-loop if found - - // Skip leading whitespace - while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { - offset++; - } - // Colorize Default Text - styler.ColourTo(startLine + offset - 1, SCE_TCMD_DEFAULT); - - if ( offset >= lengthLine ) - return; - - // Check for Fake Label (Comment) or Real Label - return if found - if (lineBuffer[offset] == ':') { - if (lineBuffer[offset + 1] == ':') { - // Colorize Fake Label (Comment) - :: is the same as REM - styler.ColourTo(endPos, SCE_TCMD_COMMENT); - } else { - // Colorize Real Label - styler.ColourTo(endPos, SCE_TCMD_LABEL); - } - return; - - // Check for Comment - return if found - } else if (( CompareNCaseInsensitive(lineBuffer+offset, "rem", 3) == 0 ) && (( lineBuffer[offset+3] == 0 ) || ( isspace(lineBuffer[offset+3] )))) { - styler.ColourTo(endPos, SCE_TCMD_COMMENT); - return; - - // 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_TCMD_WORD); - return; - } - - // Check for Hide Command (@ECHO OFF/ON) - if (lineBuffer[offset] == '@') { - styler.ColourTo(startLine + offset, SCE_TCMD_HIDE); - offset++; - } - // Skip whitespace - 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) { - if (offset > startLine) { - // Colorize Default Text - styler.ColourTo(startLine + offset - 1, SCE_TCMD_DEFAULT); - } - // Copy word from Line Buffer into Word Buffer - wbl = 0; - for (; offset < lengthLine && ( wbl < 260 ) && !isspacechar(lineBuffer[offset]); wbl++, offset++) { - wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset])); - } - wordBuffer[wbl] = '\0'; - wbo = 0; - - // Check for Separator - if (IsBSeparator(wordBuffer[0])) { - - // Reset Offset to re-process remainder of word - offset -= (wbl - 1); - // Colorize Default Text - styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT); - - if (wordBuffer[0] == '"') - inString = !inString; - - // Check for Regular expression - } else if (( wordBuffer[0] == ':' ) && ( wordBuffer[1] == ':' ) && (continueProcessing)) { - - // Colorize Regular exoressuin - styler.ColourTo(startLine + offset - 1, SCE_TCMD_DEFAULT); - // No need to Reset Offset - - // Check for Labels in text (... :label) - } else if (wordBuffer[0] == ':' && isspacechar(lineBuffer[offset - wbl - 1])) { - // Colorize Default Text - styler.ColourTo(startLine + offset - 1 - wbl, SCE_TCMD_DEFAULT); - // Colorize Label - styler.ColourTo(startLine + offset - 1, SCE_TCMD_CLABEL); - // No need to Reset Offset - // Check for delayed expansion Variable (!x...!) - } else if (isDelayedExpansion && wordBuffer[0] == '!') { - // Colorize Default Text - styler.ColourTo(startLine + offset - 1 - wbl, SCE_TCMD_DEFAULT); - wbo++; - // Search to end of word for second ! - while ((wbo < wbl) && (wordBuffer[wbo] != '!') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { - wbo++; - } - if (wordBuffer[wbo] == '!') { - wbo++; - // Colorize Environment Variable - styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_TCMD_EXPANSION); - } else { - wbo = 1; - // Colorize Symbol - styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_TCMD_DEFAULT); - } - - // Reset Offset to re-process remainder of word - offset -= (wbl - wbo); - - // Check for Regular Keyword in list - } else if ((keywords.InList(wordBuffer)) && (!inString) && (continueProcessing)) { - - // ECHO, PATH, and PROMPT require no further Regular Keyword Checking - if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) || - (CompareCaseInsensitive(sKeywordBuffer, "echos") == 0) || - (CompareCaseInsensitive(sKeywordBuffer, "echoerr") == 0) || - (CompareCaseInsensitive(sKeywordBuffer, "echoserr") == 0) || - (CompareCaseInsensitive(wordBuffer, "path") == 0) || - (CompareCaseInsensitive(wordBuffer, "prompt") == 0)) { - continueProcessing = false; - } - - // Colorize Regular keyword - styler.ColourTo(startLine + offset - 1, SCE_TCMD_WORD); - // No need to Reset Offset - - } else if ((wordBuffer[0] != '%') && (wordBuffer[0] != '!') && (!IsBOperator(wordBuffer[0])) && (!inString) && (continueProcessing)) { - - // a few commands accept "illegal" syntax -- cd\, echo., etc. - sscanf( wordBuffer, "%[^.<>|&=\\/]", sKeywordBuffer ); - sKeywordFound = false; - - if ((CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) || - (CompareCaseInsensitive(sKeywordBuffer, "echos") == 0) || - (CompareCaseInsensitive(sKeywordBuffer, "echoerr") == 0) || - (CompareCaseInsensitive(sKeywordBuffer, "echoserr") == 0) || - (CompareCaseInsensitive(sKeywordBuffer, "cd") == 0) || - (CompareCaseInsensitive(sKeywordBuffer, "path") == 0) || - (CompareCaseInsensitive(sKeywordBuffer, "prompt") == 0)) { - - // no further Regular Keyword Checking - continueProcessing = false; - sKeywordFound = true; - wbo = (Sci_PositionU)strlen( sKeywordBuffer ); - - // Colorize Special Keyword as Regular Keyword - styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_TCMD_WORD); - // Reset Offset to re-process remainder of word - offset -= (wbl - wbo); - } - - // Check for Default Text - if (!sKeywordFound) { - wbo = 0; - // Read up to %, Operator or Separator - while ((wbo < wbl) && (wordBuffer[wbo] != '%') && (!isDelayedExpansion || wordBuffer[wbo] != '!') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { - wbo++; - } - // Colorize Default Text - styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_TCMD_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] == '%') { - unsigned int varlen; - unsigned int n = 1; - // Colorize Default Text - styler.ColourTo(startLine + offset - 1 - wbl, SCE_TCMD_DEFAULT); - wbo++; - - // check for %[nn] syntax - if ( wordBuffer[1] == '[' ) { - n++; - while ((n < wbl) && (wordBuffer[n] != ']')) { - n++; - } - if ( wordBuffer[n] == ']' ) - n++; - goto ColorizeArg; - } - - // Search to end of word for second % or to the first terminator (can be a long path) - while ((wbo < wbl) && (wordBuffer[wbo] != '%') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { - wbo++; - } - - // Check for Argument (%n) or (%*) - if (((isdigit(wordBuffer[1])) || (wordBuffer[1] == '*')) && (wordBuffer[wbo] != '%')) { - while (( wordBuffer[n] ) && ( strchr( "%0123456789*#$", wordBuffer[n] ) != NULL )) - n++; -ColorizeArg: - // Colorize Argument - styler.ColourTo(startLine + offset - 1 - (wbl - n), SCE_TCMD_IDENTIFIER); - // Reset Offset to re-process remainder of word - offset -= (wbl - n); - - // Check for Variable with modifiers (%~...) - } else if ((varlen = GetBatchVarLen(wordBuffer)) != 0) { - - // Colorize Variable - styler.ColourTo(startLine + offset - 1 - (wbl - varlen), SCE_TCMD_IDENTIFIER); - // Reset Offset to re-process remainder of word - offset -= (wbl - varlen); - - // Check for Environment Variable (%x...%) - } else if (( wordBuffer[1] ) && ( wordBuffer[1] != '%')) { - if ( wordBuffer[wbo] == '%' ) - wbo++; - - // Colorize Environment Variable - styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_TCMD_ENVIRONMENT); - // 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]))) { - - n = 2; - while (( wordBuffer[n] ) && (!IsBOperator(wordBuffer[n])) && (!IsBSeparator(wordBuffer[n]))) - n++; - - // Colorize Local Variable - styler.ColourTo(startLine + offset - 1 - (wbl - n), SCE_TCMD_IDENTIFIER); - // Reset Offset to re-process remainder of word - offset -= (wbl - n); - - // Check for %% - } else if ((wbl > 1) && (wordBuffer[1] == '%')) { - - // Colorize Symbols - styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_TCMD_DEFAULT); - // Reset Offset to re-process remainder of word - offset -= (wbl - 2); - } else { - - // Colorize Symbol - styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_TCMD_DEFAULT); - // Reset Offset to re-process remainder of word - offset -= (wbl - 1); - } - - // Check for Operator - } else if (IsBOperator(wordBuffer[0])) { - // Colorize Default Text - styler.ColourTo(startLine + offset - 1 - wbl, SCE_TCMD_DEFAULT); - - // Check for Pipe, compound, or conditional Operator - if ((wordBuffer[0] == '|') || (wordBuffer[0] == '&')) { - - // Colorize Pipe Operator - styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_TCMD_OPERATOR); - // Reset Offset to re-process remainder of word - offset -= (wbl - 1); - continueProcessing = true; - - // Check for Other Operator - } else { - // Check for > Operator - if ((wordBuffer[0] == '>') || (wordBuffer[0] == '<')) { - // Turn Keyword and External Command / Program checking back on - continueProcessing = true; - } - // Colorize Other Operator - if (!inString || !(wordBuffer[0] == '(' || wordBuffer[0] == ')')) - styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_TCMD_OPERATOR); - // Reset Offset to re-process remainder of word - offset -= (wbl - 1); - } - - // Check for Default Text - } else { - // Read up to %, Operator or Separator - while ((wbo < wbl) && (wordBuffer[wbo] != '%') && (!isDelayedExpansion || wordBuffer[wbo] != '!') && (!IsBOperator(wordBuffer[wbo])) && (!IsBSeparator(wordBuffer[wbo]))) { - wbo++; - } - // Colorize Default Text - styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_TCMD_DEFAULT); - // Reset Offset to re-process remainder of word - offset -= (wbl - wbo); - } - - // Skip whitespace - 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_TCMD_DEFAULT); -} - -static void ColouriseTCMDDoc( Sci_PositionU startPos, Sci_Position length, int /*initStyle*/, WordList *keywordlists[], Accessor &styler ) -{ - char lineBuffer[16384]; - - styler.StartAt(startPos); - styler.StartSegment(startPos); - Sci_PositionU linePos = 0; - Sci_PositionU startLine = startPos; - for (Sci_PositionU i = startPos; i < startPos + length; i++) { - lineBuffer[linePos++] = styler[i]; - if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { - // End of line (or of line buffer) met, colourise it - lineBuffer[linePos] = '\0'; - ColouriseTCMDLine(lineBuffer, linePos, startLine, i, keywordlists, styler); - linePos = 0; - startLine = i + 1; - } - } - if (linePos > 0) { // Last line does not have ending characters - lineBuffer[linePos] = '\0'; - ColouriseTCMDLine(lineBuffer, linePos, startLine, startPos + length - 1, keywordlists, styler); - } -} - -// Convert string to upper case -static void StrUpr(char *s) { - while (*s) { - *s = MakeUpperCase(*s); - s++; - } -} - -// Folding support (for DO, IFF, SWITCH, TEXT, and command groups) -static void FoldTCMDDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) -{ - Sci_Position line = styler.GetLine(startPos); - int level = styler.LevelAt(line); - int levelIndent = 0; - Sci_PositionU endPos = startPos + length; - char s[16] = ""; - - char chPrev = styler.SafeGetCharAt(startPos - 1); - - // Scan for ( and ) - for (Sci_PositionU i = startPos; i < endPos; i++) { - - int c = styler.SafeGetCharAt(i, '\n'); - int style = styler.StyleAt(i); - bool bLineStart = ((chPrev == '\r') || (chPrev == '\n')) || i == 0; - - if (style == SCE_TCMD_OPERATOR) { - // CheckFoldPoint - if (c == '(') { - levelIndent += 1; - } else if (c == ')') { - levelIndent -= 1; - } - } - - if (( bLineStart ) && ( style == SCE_TCMD_WORD )) { - for (Sci_PositionU j = 0; j < 10; j++) { - if (!iswordchar(styler[i + j])) { - break; - } - s[j] = styler[i + j]; - s[j + 1] = '\0'; - } - - StrUpr( s ); - if ((strcmp(s, "DO") == 0) || (strcmp(s, "IFF") == 0) || (strcmp(s, "SWITCH") == 0) || (strcmp(s, "TEXT") == 0)) { - levelIndent++; - } else if ((strcmp(s, "ENDDO") == 0) || (strcmp(s, "ENDIFF") == 0) || (strcmp(s, "ENDSWITCH") == 0) || (strcmp(s, "ENDTEXT") == 0)) { - levelIndent--; - } - } - - if (c == '\n') { // line end - if (levelIndent > 0) { - level |= SC_FOLDLEVELHEADERFLAG; - } - if (level != styler.LevelAt(line)) - styler.SetLevel(line, level); - level += levelIndent; - if ((level & SC_FOLDLEVELNUMBERMASK) < SC_FOLDLEVELBASE) - level = SC_FOLDLEVELBASE; - line++; - // reset state - levelIndent = 0; - level &= ~SC_FOLDLEVELHEADERFLAG; - level &= ~SC_FOLDLEVELWHITEFLAG; - } - - chPrev = c; - } -} - -static const char *const tcmdWordListDesc[] = { - "Internal Commands", - "Aliases", - 0 -}; - -LexerModule lmTCMD(SCLEX_TCMD, ColouriseTCMDDoc, "tcmd", FoldTCMDDoc, tcmdWordListDesc); diff --git a/lexers/LexTeX.cxx b/lexers/LexTeX.cxx deleted file mode 100644 index adb14a096..000000000 --- a/lexers/LexTeX.cxx +++ /dev/null @@ -1,495 +0,0 @@ -// Scintilla source code edit control - -// @file LexTeX.cxx - general context conformant tex coloring scheme -// Author: Hans Hagen - PRAGMA ADE - Hasselt NL - www.pragma-ade.com -// Version: September 28, 2003 - -// Copyright: 1998-2003 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -// This lexer is derived from the one written for the texwork environment (1999++) which in -// turn is inspired on texedit (1991++) which finds its roots in wdt (1986). - -// If you run into strange boundary cases, just tell me and I'll look into it. - - -// TeX Folding code added by instanton (soft_share@126.com) with borrowed code from VisualTeX source by Alex Romanenko. -// Version: June 22, 2007 - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// 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 - -// Definitions in SciTEGlobal.properties: -// -// TeX Highlighting -// -// # Default -// style.tex.0=fore:#7F7F00 -// # Special -// style.tex.1=fore:#007F7F -// # Group -// style.tex.2=fore:#880000 -// # Symbol -// style.tex.3=fore:#7F7F00 -// # Command -// style.tex.4=fore:#008800 -// # Text -// style.tex.5=fore:#000000 - -// lexer.tex.interface.default=0 -// lexer.tex.comment.process=0 - -// todo: lexer.tex.auto.if - -// Auxiliary functions: - -static inline bool endOfLine(Accessor &styler, Sci_PositionU i) { - return - (styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')) ; -} - -static inline bool isTeXzero(int ch) { - return - (ch == '%') ; -} - -static inline bool isTeXone(int ch) { - return - (ch == '[') || (ch == ']') || (ch == '=') || (ch == '#') || - (ch == '(') || (ch == ')') || (ch == '<') || (ch == '>') || - (ch == '"') ; -} - -static inline bool isTeXtwo(int ch) { - return - (ch == '{') || (ch == '}') || (ch == '$') ; -} - -static inline bool isTeXthree(int ch) { - return - (ch == '~') || (ch == '^') || (ch == '_') || (ch == '&') || - (ch == '-') || (ch == '+') || (ch == '\"') || (ch == '`') || - (ch == '/') || (ch == '|') || (ch == '%') ; -} - -static inline bool isTeXfour(int ch) { - return - (ch == '\\') ; -} - -static inline bool isTeXfive(int ch) { - return - ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) || - (ch == '@') || (ch == '!') || (ch == '?') ; -} - -static inline bool isTeXsix(int ch) { - return - (ch == ' ') ; -} - -static inline bool isTeXseven(int ch) { - return - (ch == '^') ; -} - -// Interface determination - -static int CheckTeXInterface( - Sci_PositionU startPos, - Sci_Position length, - Accessor &styler, - int defaultInterface) { - - char lineBuffer[1024] ; - Sci_PositionU linePos = 0 ; - - // some day we can make something lexer.tex.mapping=(all,0)(nl,1)(en,2)... - - if (styler.SafeGetCharAt(0) == '%') { - for (Sci_PositionU i = 0; i < startPos + length; i++) { - lineBuffer[linePos++] = styler.SafeGetCharAt(i) ; - if (endOfLine(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { - lineBuffer[linePos] = '\0'; - if (strstr(lineBuffer, "interface=all")) { - return 0 ; - } else if (strstr(lineBuffer, "interface=tex")) { - return 1 ; - } else if (strstr(lineBuffer, "interface=nl")) { - return 2 ; - } else if (strstr(lineBuffer, "interface=en")) { - return 3 ; - } else if (strstr(lineBuffer, "interface=de")) { - return 4 ; - } else if (strstr(lineBuffer, "interface=cz")) { - return 5 ; - } else if (strstr(lineBuffer, "interface=it")) { - return 6 ; - } else if (strstr(lineBuffer, "interface=ro")) { - return 7 ; - } else if (strstr(lineBuffer, "interface=latex")) { - // we will move latex cum suis up to 91+ when more keyword lists are supported - return 8 ; - } else if (styler.SafeGetCharAt(1) == 'D' && strstr(lineBuffer, "%D \\module")) { - // better would be to limit the search to just one line - return 3 ; - } else { - return defaultInterface ; - } - } - } - } - - return defaultInterface ; -} - -static void ColouriseTeXDoc( - Sci_PositionU startPos, - Sci_Position length, - int, - WordList *keywordlists[], - Accessor &styler) { - - styler.StartAt(startPos) ; - styler.StartSegment(startPos) ; - - bool processComment = styler.GetPropertyInt("lexer.tex.comment.process", 0) == 1 ; - bool useKeywords = styler.GetPropertyInt("lexer.tex.use.keywords", 1) == 1 ; - bool autoIf = styler.GetPropertyInt("lexer.tex.auto.if", 1) == 1 ; - int defaultInterface = styler.GetPropertyInt("lexer.tex.interface.default", 1) ; - - char key[100] ; - int k ; - bool newifDone = false ; - bool inComment = false ; - - int currentInterface = CheckTeXInterface(startPos,length,styler,defaultInterface) ; - - if (currentInterface == 0) { - useKeywords = false ; - currentInterface = 1 ; - } - - WordList &keywords = *keywordlists[currentInterface-1] ; - - StyleContext sc(startPos, length, SCE_TEX_TEXT, styler); - - bool going = sc.More() ; // needed because of a fuzzy end of file state - - for (; going; sc.Forward()) { - - if (! sc.More()) { going = false ; } // we need to go one behind the end of text - - if (inComment) { - if (sc.atLineEnd) { - sc.SetState(SCE_TEX_TEXT) ; - newifDone = false ; - inComment = false ; - } - } else { - if (! isTeXfive(sc.ch)) { - if (sc.state == SCE_TEX_COMMAND) { - if (sc.LengthCurrent() == 1) { // \<noncstoken> - if (isTeXseven(sc.ch) && isTeXseven(sc.chNext)) { - sc.Forward(2) ; // \^^ and \^^<token> - } - sc.ForwardSetState(SCE_TEX_TEXT) ; - } else { - sc.GetCurrent(key, sizeof(key)-1) ; - k = static_cast<int>(strlen(key)) ; - memmove(key,key+1,k) ; // shift left over escape token - key[k] = '\0' ; - k-- ; - if (! keywords || ! useKeywords) { - sc.SetState(SCE_TEX_COMMAND) ; - newifDone = false ; - } else if (k == 1) { //\<cstoken> - sc.SetState(SCE_TEX_COMMAND) ; - newifDone = false ; - } else if (keywords.InList(key)) { - sc.SetState(SCE_TEX_COMMAND) ; - newifDone = autoIf && (strcmp(key,"newif") == 0) ; - } else if (autoIf && ! newifDone && (key[0] == 'i') && (key[1] == 'f') && keywords.InList("if")) { - sc.SetState(SCE_TEX_COMMAND) ; - } else { - sc.ChangeState(SCE_TEX_TEXT) ; - sc.SetState(SCE_TEX_TEXT) ; - newifDone = false ; - } - } - } - if (isTeXzero(sc.ch)) { - sc.SetState(SCE_TEX_SYMBOL); - - if (!endOfLine(styler,sc.currentPos + 1)) - sc.ForwardSetState(SCE_TEX_DEFAULT) ; - - inComment = ! processComment ; - newifDone = false ; - } else if (isTeXseven(sc.ch) && isTeXseven(sc.chNext)) { - sc.SetState(SCE_TEX_TEXT) ; - sc.ForwardSetState(SCE_TEX_TEXT) ; - } else if (isTeXone(sc.ch)) { - sc.SetState(SCE_TEX_SPECIAL) ; - newifDone = false ; - } else if (isTeXtwo(sc.ch)) { - sc.SetState(SCE_TEX_GROUP) ; - newifDone = false ; - } else if (isTeXthree(sc.ch)) { - sc.SetState(SCE_TEX_SYMBOL) ; - newifDone = false ; - } else if (isTeXfour(sc.ch)) { - sc.SetState(SCE_TEX_COMMAND) ; - } else if (isTeXsix(sc.ch)) { - sc.SetState(SCE_TEX_TEXT) ; - } else if (sc.atLineEnd) { - sc.SetState(SCE_TEX_TEXT) ; - newifDone = false ; - inComment = false ; - } else { - sc.SetState(SCE_TEX_TEXT) ; - } - } else if (sc.state != SCE_TEX_COMMAND) { - sc.SetState(SCE_TEX_TEXT) ; - } - } - } - sc.ChangeState(SCE_TEX_TEXT) ; - sc.Complete(); - -} - - -static inline bool isNumber(int ch) { - return - (ch == '0') || (ch == '1') || (ch == '2') || - (ch == '3') || (ch == '4') || (ch == '5') || - (ch == '6') || (ch == '7') || (ch == '8') || (ch == '9'); -} - -static inline bool isWordChar(int ch) { - return ((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')); -} - -static Sci_Position ParseTeXCommand(Sci_PositionU pos, Accessor &styler, char *command) -{ - Sci_Position length=0; - char ch=styler.SafeGetCharAt(pos+1); - - if(ch==',' || ch==':' || ch==';' || ch=='%'){ - command[0]=ch; - command[1]=0; - return 1; - } - - // find end - while(isWordChar(ch) && !isNumber(ch) && ch!='_' && ch!='.' && length<100){ - command[length]=ch; - length++; - ch=styler.SafeGetCharAt(pos+length+1); - } - - command[length]='\0'; - if(!length) return 0; - return length+1; -} - -static int classifyFoldPointTeXPaired(const char* s) { - int lev=0; - if (!(isdigit(s[0]) || (s[0] == '.'))){ - if (strcmp(s, "begin")==0||strcmp(s,"FoldStart")==0|| - strcmp(s,"abstract")==0||strcmp(s,"unprotect")==0|| - strcmp(s,"title")==0||strncmp(s,"start",5)==0||strncmp(s,"Start",5)==0|| - strcmp(s,"documentclass")==0||strncmp(s,"if",2)==0 - ) - lev=1; - if (strcmp(s, "end")==0||strcmp(s,"FoldStop")==0|| - strcmp(s,"maketitle")==0||strcmp(s,"protect")==0|| - strncmp(s,"stop",4)==0||strncmp(s,"Stop",4)==0|| - strcmp(s,"fi")==0 - ) - lev=-1; - } - return lev; -} - -static int classifyFoldPointTeXUnpaired(const char* s) { - int lev=0; - if (!(isdigit(s[0]) || (s[0] == '.'))){ - if (strcmp(s,"part")==0|| - strcmp(s,"chapter")==0|| - strcmp(s,"section")==0|| - strcmp(s,"subsection")==0|| - strcmp(s,"subsubsection")==0|| - strcmp(s,"CJKfamily")==0|| - strcmp(s,"appendix")==0|| - strcmp(s,"Topic")==0||strcmp(s,"topic")==0|| - strcmp(s,"subject")==0||strcmp(s,"subsubject")==0|| - strcmp(s,"def")==0||strcmp(s,"gdef")==0||strcmp(s,"edef")==0|| - strcmp(s,"xdef")==0||strcmp(s,"framed")==0|| - strcmp(s,"frame")==0|| - strcmp(s,"foilhead")==0||strcmp(s,"overlays")==0||strcmp(s,"slide")==0 - ){ - lev=1; - } - } - return lev; -} - -static bool IsTeXCommentLine(Sci_Position line, Accessor &styler) { - Sci_Position pos = styler.LineStart(line); - Sci_Position eol_pos = styler.LineStart(line + 1) - 1; - - Sci_Position startpos = pos; - - while (startpos<eol_pos){ - char ch = styler[startpos]; - if (ch!='%' && ch!=' ') return false; - else if (ch=='%') return true; - startpos++; - } - - return false; -} - -// FoldTeXDoc: borrowed from VisualTeX with modifications - -static void FoldTexDoc(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=styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent=levelPrev; - char chNext=styler[startPos]; - char buffer[100]=""; - - for (Sci_PositionU i=startPos; i < endPos; i++) { - char ch=chNext; - chNext=styler.SafeGetCharAt(i+1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - if(ch=='\\') { - ParseTeXCommand(i, styler, buffer); - levelCurrent += classifyFoldPointTeXPaired(buffer)+classifyFoldPointTeXUnpaired(buffer); - } - - if (levelCurrent > SC_FOLDLEVELBASE && ((ch == '\r' || ch=='\n') && (chNext == '\\'))) { - ParseTeXCommand(i+1, styler, buffer); - levelCurrent -= classifyFoldPointTeXUnpaired(buffer); - } - - char chNext2; - char chNext3; - char chNext4; - char chNext5; - chNext2=styler.SafeGetCharAt(i+2); - chNext3=styler.SafeGetCharAt(i+3); - chNext4=styler.SafeGetCharAt(i+4); - chNext5=styler.SafeGetCharAt(i+5); - - bool atEOfold = (ch == '%') && - (chNext == '%') && (chNext2=='}') && - (chNext3=='}')&& (chNext4=='-')&& (chNext5=='-'); - - bool atBOfold = (ch == '%') && - (chNext == '%') && (chNext2=='-') && - (chNext3=='-')&& (chNext4=='{')&& (chNext5=='{'); - - if(atBOfold){ - levelCurrent+=1; - } - - if(atEOfold){ - levelCurrent-=1; - } - - if(ch=='\\' && chNext=='['){ - levelCurrent+=1; - } - - if(ch=='\\' && chNext==']'){ - levelCurrent-=1; - } - - bool foldComment = styler.GetPropertyInt("fold.comment") != 0; - - if (foldComment && atEOL && IsTeXCommentLine(lineCurrent, styler)) - { - if (lineCurrent==0 && IsTeXCommentLine(lineCurrent + 1, styler) - ) - levelCurrent++; - else if (lineCurrent!=0 && !IsTeXCommentLine(lineCurrent - 1, styler) - && IsTeXCommentLine(lineCurrent + 1, styler) - ) - levelCurrent++; - else if (lineCurrent!=0 && IsTeXCommentLine(lineCurrent - 1, styler) && - !IsTeXCommentLine(lineCurrent+1, styler)) - 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 texWordListDesc[] = { - "TeX, eTeX, pdfTeX, Omega", - "ConTeXt Dutch", - "ConTeXt English", - "ConTeXt German", - "ConTeXt Czech", - "ConTeXt Italian", - "ConTeXt Romanian", - 0, -} ; - -LexerModule lmTeX(SCLEX_TEX, ColouriseTeXDoc, "tex", FoldTexDoc, texWordListDesc); diff --git a/lexers/LexTxt2tags.cxx b/lexers/LexTxt2tags.cxx deleted file mode 100644 index 6d1a954e0..000000000 --- a/lexers/LexTxt2tags.cxx +++ /dev/null @@ -1,478 +0,0 @@ -/****************************************************************** - * LexTxt2tags.cxx - * - * A simple Txt2tags lexer for scintilla. - * - * - * Adapted by Eric Forgeot - * Based on the LexMarkdown.cxx by Jon Strait - jstrait@moonloop.net - * - * What could be improved: - * - Verbatim lines could be like for raw lines : when there is no space between the ``` and the following text, the first letter should be colored so the user would understand there must be a space for a valid tag. - * - marks such as bold, italic, strikeout, underline should begin to be highlighted only when they are closed and valid. - * - verbatim and raw area should be highlighted too. - * - * The License.txt file describes the conditions under which this - * software may be distributed. - * - *****************************************************************/ - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> - -#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 Scintilla; - - - -static inline bool IsNewline(const int ch) { - return (ch == '\n' || ch == '\r'); -} - -// True if can follow ch down to the end with possibly trailing whitespace -static bool FollowToLineEnd(const int ch, const int state, const Sci_PositionU endPos, StyleContext &sc) { - Sci_PositionU i = 0; - while (sc.GetRelative(++i) == ch) - ; - // Skip over whitespace - while (IsASpaceOrTab(sc.GetRelative(i)) && sc.currentPos + i < endPos) - ++i; - if (IsNewline(sc.GetRelative(i)) || sc.currentPos + i == endPos) { - sc.Forward(i); - sc.ChangeState(state); - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - return true; - } - else return false; -} - -// Does the previous line have more than spaces and tabs? -static bool HasPrevLineContent(StyleContext &sc) { - Sci_Position i = 0; - // Go back to the previous newline - while ((--i + sc.currentPos) && !IsNewline(sc.GetRelative(i))) - ; - while (--i + sc.currentPos) { - if (IsNewline(sc.GetRelative(i))) - break; - if (!IsASpaceOrTab(sc.GetRelative(i))) - return true; - } - return false; -} - -// Separator line -static bool IsValidHrule(const Sci_PositionU endPos, StyleContext &sc) { - int count = 1; - Sci_PositionU i = 0; - for (;;) { - ++i; - int c = sc.GetRelative(i); - if (c == sc.ch) - ++count; - // hit a terminating character - else if (!IsASpaceOrTab(c) || sc.currentPos + i == endPos) { - // Are we a valid HRULE - if ((IsNewline(c) || sc.currentPos + i == endPos) && - count >= 20 && !HasPrevLineContent(sc)) { - sc.SetState(SCE_TXT2TAGS_HRULE); - sc.Forward(i); - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - return true; - } - else { - sc.SetState(SCE_TXT2TAGS_DEFAULT); - return false; - } - } - } -} - -static void ColorizeTxt2tagsDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList **, Accessor &styler) { - Sci_PositionU endPos = startPos + length; - int precharCount = 0; - // Don't advance on a new loop iteration and retry at the same position. - // Useful in the corner case of having to start at the beginning file position - // in the default state. - bool freezeCursor = false; - - StyleContext sc(startPos, length, initStyle, styler); - - while (sc.More()) { - // Skip past escaped characters - if (sc.ch == '\\') { - sc.Forward(); - continue; - } - - // A blockquotes resets the line semantics - if (sc.state == SCE_TXT2TAGS_BLOCKQUOTE){ - sc.Forward(2); - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - } - // An option colors the whole line - if (sc.state == SCE_TXT2TAGS_OPTION){ - FollowToLineEnd('%', SCE_TXT2TAGS_OPTION, endPos, sc); - } - if (sc.state == SCE_TXT2TAGS_POSTPROC){ - FollowToLineEnd('%', SCE_TXT2TAGS_POSTPROC, endPos, sc); - } - if (sc.state == SCE_TXT2TAGS_PREPROC){ - FollowToLineEnd('%', SCE_TXT2TAGS_PREPROC, endPos, sc); - } - // A comment colors the whole line - if (sc.state == SCE_TXT2TAGS_COMMENT){ - FollowToLineEnd('%', SCE_TXT2TAGS_COMMENT, endPos, sc); - } - // Conditional state-based actions - if (sc.state == SCE_TXT2TAGS_CODE2) { - if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - if (sc.Match("``") && sc.GetRelative(-2) != ' ') { - sc.Forward(2); - sc.SetState(SCE_TXT2TAGS_DEFAULT); - } - } - // Table - else if (sc.state == SCE_TXT2TAGS_CODE) { - if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - if (sc.ch == '|' && sc.chPrev != ' ') - sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT); - } - // Strong - else if (sc.state == SCE_TXT2TAGS_STRONG1) { - if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - if (sc.Match("**") && sc.chPrev != ' ') { - sc.Forward(2); - sc.SetState(SCE_TXT2TAGS_DEFAULT); - } - } - // Emphasis - else if (sc.state == SCE_TXT2TAGS_EM1) { - if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - if (sc.Match("//") && sc.chPrev != ' ') { - sc.Forward(2); - sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT); - } - } - // Underline - else if (sc.state == SCE_TXT2TAGS_EM2) { - if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - if (sc.Match("__") && sc.chPrev != ' ') { - sc.Forward(2); - sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT); - } - } - // codeblock - else if (sc.state == SCE_TXT2TAGS_CODEBK) { - if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - if (sc.atLineStart && sc.Match("```")) { - Sci_Position i = 1; - while (!IsNewline(sc.GetRelative(i)) && sc.currentPos + i < endPos) - i++; - sc.Forward(i); - sc.SetState(SCE_TXT2TAGS_DEFAULT); - } - } - // strikeout - else if (sc.state == SCE_TXT2TAGS_STRIKEOUT) { - if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - if (sc.Match("--") && sc.chPrev != ' ') { - sc.Forward(2); - sc.SetState(SCE_TXT2TAGS_DEFAULT); - } - } - // Headers - else if (sc.state == SCE_TXT2TAGS_LINE_BEGIN) { - if (sc.Match("======")) - { - sc.SetState(SCE_TXT2TAGS_HEADER6); - sc.Forward(); - } - else if (sc.Match("=====")) - { - sc.SetState(SCE_TXT2TAGS_HEADER5); - sc.Forward(); - } - else if (sc.Match("====")) - { - sc.SetState(SCE_TXT2TAGS_HEADER4); - sc.Forward(); - } - else if (sc.Match("===")) - { - sc.SetState(SCE_TXT2TAGS_HEADER3); - sc.Forward(); - } - //SetStateAndZoom(SCE_TXT2TAGS_HEADER3, 3, '=', sc); - else if (sc.Match("==")) { - sc.SetState(SCE_TXT2TAGS_HEADER2); - sc.Forward(); - } - //SetStateAndZoom(SCE_TXT2TAGS_HEADER2, 2, '=', sc); - else if (sc.Match("=")) { - // Catch the special case of an unordered list - if (sc.chNext == '.' && IsASpaceOrTab(sc.GetRelative(2))) { - precharCount = 0; - sc.SetState(SCE_TXT2TAGS_PRECHAR); - } - else - { - sc.SetState(SCE_TXT2TAGS_HEADER1); - sc.Forward(); - } - //SetStateAndZoom(SCE_TXT2TAGS_HEADER1, 1, '=', sc); - } - - // Numbered title - else if (sc.Match("++++++")) - { - sc.SetState(SCE_TXT2TAGS_HEADER6); - sc.Forward(); - } - else if (sc.Match("+++++")) - { - sc.SetState(SCE_TXT2TAGS_HEADER5); - sc.Forward(); - } - else if (sc.Match("++++")) - { - sc.SetState(SCE_TXT2TAGS_HEADER4); - sc.Forward(); - } - else if (sc.Match("+++")) - { - sc.SetState(SCE_TXT2TAGS_HEADER3); - sc.Forward(); - } - //SetStateAndZoom(SCE_TXT2TAGS_HEADER3, 3, '+', sc); - else if (sc.Match("++")) { - sc.SetState(SCE_TXT2TAGS_HEADER2); - sc.Forward(); - } - //SetStateAndZoom(SCE_TXT2TAGS_HEADER2, 2, '+', sc); - else if (sc.Match("+")) { - // Catch the special case of an unordered list - if (sc.chNext == ' ' && IsASpaceOrTab(sc.GetRelative(1))) { - // if (IsNewline(sc.ch)) { - //precharCount = 0; - // sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - //sc.SetState(SCE_TXT2TAGS_PRECHAR); - // } - // else { - // precharCount = 0; - sc.SetState(SCE_TXT2TAGS_OLIST_ITEM); - sc.Forward(2); - sc.SetState(SCE_TXT2TAGS_DEFAULT); - // sc.SetState(SCE_TXT2TAGS_PRECHAR); - // } - } - else - { - sc.SetState(SCE_TXT2TAGS_HEADER1); - sc.Forward(); - } - } - - - // Codeblock - else if (sc.Match("```")) { - if (!HasPrevLineContent(sc)) - // if (!FollowToLineEnd(sc)) - sc.SetState(SCE_TXT2TAGS_CODEBK); - else - sc.SetState(SCE_TXT2TAGS_DEFAULT); - } - - // Preproc - else if (sc.Match("%!preproc")) { - sc.SetState(SCE_TXT2TAGS_PREPROC); - } - // Postproc - else if (sc.Match("%!postproc")) { - sc.SetState(SCE_TXT2TAGS_POSTPROC); - } - // Option - else if (sc.Match("%!")) { - sc.SetState(SCE_TXT2TAGS_OPTION); - } - - // Comment - else if (sc.ch == '%') { - sc.SetState(SCE_TXT2TAGS_COMMENT); - } - // list - else if (sc.ch == '-') { - precharCount = 0; - sc.SetState(SCE_TXT2TAGS_PRECHAR); - } - // def list - else if (sc.ch == ':') { - precharCount = 0; - sc.SetState(SCE_TXT2TAGS_OLIST_ITEM); - sc.Forward(1); - sc.SetState(SCE_TXT2TAGS_PRECHAR); - } - else if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - else { - precharCount = 0; - sc.SetState(SCE_TXT2TAGS_PRECHAR); - } - } - - // The header lasts until the newline - else if (sc.state == SCE_TXT2TAGS_HEADER1 || sc.state == SCE_TXT2TAGS_HEADER2 || - sc.state == SCE_TXT2TAGS_HEADER3 || sc.state == SCE_TXT2TAGS_HEADER4 || - sc.state == SCE_TXT2TAGS_HEADER5 || sc.state == SCE_TXT2TAGS_HEADER6) { - if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - } - - // New state only within the initial whitespace - if (sc.state == SCE_TXT2TAGS_PRECHAR) { - // Blockquote - if (sc.Match("\"\"\"") && precharCount < 5){ - - sc.SetState(SCE_TXT2TAGS_BLOCKQUOTE); - sc.Forward(1); - } - /* - // Begin of code block - else if (!HasPrevLineContent(sc) && (sc.chPrev == '\t' || precharCount >= 4)) - sc.SetState(SCE_TXT2TAGS_CODEBK); - */ - // HRule - Total of 20 or more hyphens, asterisks, or underscores - // on a line by themselves - else if ((sc.ch == '-' ) && IsValidHrule(endPos, sc)) - ; - // Unordered list - else if ((sc.ch == '-') && IsASpaceOrTab(sc.chNext)) { - sc.SetState(SCE_TXT2TAGS_ULIST_ITEM); - sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT); - } - // Ordered list - else if (IsADigit(sc.ch)) { - Sci_Position digitCount = 0; - while (IsADigit(sc.GetRelative(++digitCount))) - ; - if (sc.GetRelative(digitCount) == '.' && - IsASpaceOrTab(sc.GetRelative(digitCount + 1))) { - sc.SetState(SCE_TXT2TAGS_OLIST_ITEM); - sc.Forward(digitCount + 1); - sc.SetState(SCE_TXT2TAGS_DEFAULT); - } - } - // Alternate Ordered list - else if (sc.ch == '+' && sc.chNext == ' ' && IsASpaceOrTab(sc.GetRelative(2))) { - // sc.SetState(SCE_TXT2TAGS_OLIST_ITEM); - // sc.Forward(2); - // sc.SetState(SCE_TXT2TAGS_DEFAULT); - } - else if (sc.ch != ' ' || precharCount > 2) - sc.SetState(SCE_TXT2TAGS_DEFAULT); - else - ++precharCount; - } - - // New state anywhere in doc - if (sc.state == SCE_TXT2TAGS_DEFAULT) { - // if (sc.atLineStart && sc.ch == '#') { - // sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - // freezeCursor = true; - // } - // Links and Images - if (sc.Match("![") || sc.ch == '[') { - Sci_Position i = 0, j = 0, k = 0; - Sci_Position len = endPos - sc.currentPos; - while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\')) - ; - if (sc.GetRelative(i) == ']') { - j = i; - if (sc.GetRelative(++i) == '(') { - while (i < len && (sc.GetRelative(++i) != '(' || sc.GetRelative(i - 1) == '\\')) - ; - if (sc.GetRelative(i) == '(') - k = i; - } - - else if (sc.GetRelative(i) == '[' || sc.GetRelative(++i) == '[') { - while (i < len && (sc.GetRelative(++i) != ']' || sc.GetRelative(i - 1) == '\\')) - ; - if (sc.GetRelative(i) == ']') - k = i; - } - } - // At least a link text - if (j) { - sc.SetState(SCE_TXT2TAGS_LINK); - sc.Forward(j); - // Also has a URL or reference portion - if (k) - sc.Forward(k - j); - sc.ForwardSetState(SCE_TXT2TAGS_DEFAULT); - } - } - // Code - also a special case for alternate inside spacing - if (sc.Match("``") && sc.GetRelative(3) != ' ') { - sc.SetState(SCE_TXT2TAGS_CODE2); - sc.Forward(); - } - else if (sc.ch == '|' && sc.GetRelative(3) != ' ') { - sc.SetState(SCE_TXT2TAGS_CODE); - } - // Strong - else if (sc.Match("**") && sc.GetRelative(2) != ' ') { - sc.SetState(SCE_TXT2TAGS_STRONG1); - sc.Forward(); - } - // Emphasis - else if (sc.Match("//") && sc.GetRelative(2) != ' ') { - sc.SetState(SCE_TXT2TAGS_EM1); - sc.Forward(); - } - else if (sc.Match("__") && sc.GetRelative(2) != ' ') { - sc.SetState(SCE_TXT2TAGS_EM2); - sc.Forward(); - } - // Strikeout - else if (sc.Match("--") && sc.GetRelative(2) != ' ') { - sc.SetState(SCE_TXT2TAGS_STRIKEOUT); - sc.Forward(); - } - - // Beginning of line - else if (IsNewline(sc.ch)) - sc.SetState(SCE_TXT2TAGS_LINE_BEGIN); - } - // Advance if not holding back the cursor for this iteration. - if (!freezeCursor) - sc.Forward(); - freezeCursor = false; - } - sc.Complete(); -} - -LexerModule lmTxt2tags(SCLEX_TXT2TAGS, ColorizeTxt2tagsDoc, "txt2tags"); - - diff --git a/lexers/LexVB.cxx b/lexers/LexVB.cxx deleted file mode 100644 index ceac8d2fe..000000000 --- a/lexers/LexVB.cxx +++ /dev/null @@ -1,321 +0,0 @@ -// Scintilla source code edit control -/** @file LexVB.cxx - ** Lexer for Visual Basic and VBScript. - **/ -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -// Internal state, highlighted as number -#define SCE_B_FILENUMBER SCE_B_DEFAULT+100 - - -static bool IsVBComment(Accessor &styler, Sci_Position pos, Sci_Position len) { - return len > 0 && styler[pos] == '\''; -} - -static inline bool IsTypeCharacter(int ch) { - return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$'; -} - -// Extended to accept accented characters -static inline bool IsAWordChar(int ch) { - return ch >= 0x80 || - (isalnum(ch) || ch == '.' || ch == '_'); -} - -static inline bool IsAWordStart(int ch) { - return ch >= 0x80 || - (isalpha(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) || toupper(ch) == 'E' || - ch == '.' || ch == '-' || ch == '+' || ch == '_'); -} - -static void ColouriseVBDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler, bool vbScriptSyntax) { - - WordList &keywords = *keywordlists[0]; - WordList &keywords2 = *keywordlists[1]; - WordList &keywords3 = *keywordlists[2]; - WordList &keywords4 = *keywordlists[3]; - - styler.StartAt(startPos); - - int visibleChars = 0; - int fileNbDigits = 0; - - // Do not leak onto next line - if (initStyle == SCE_B_STRINGEOL || initStyle == SCE_B_COMMENT || initStyle == SCE_B_PREPROCESSOR) { - initStyle = SCE_B_DEFAULT; - } - - StyleContext sc(startPos, length, initStyle, styler); - - for (; sc.More(); sc.Forward()) { - - if (sc.state == SCE_B_OPERATOR) { - sc.SetState(SCE_B_DEFAULT); - } else if (sc.state == SCE_B_IDENTIFIER) { - if (!IsAWordChar(sc.ch)) { - // In Basic (except VBScript), a variable name or a function name - // can end with a special character indicating the type of the value - // held or returned. - bool skipType = false; - if (!vbScriptSyntax && IsTypeCharacter(sc.ch)) { - sc.Forward(); // Skip it - skipType = true; - } - if (sc.ch == ']') { - sc.Forward(); - } - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (skipType) { - s[strlen(s) - 1] = '\0'; - } - if (strcmp(s, "rem") == 0) { - sc.ChangeState(SCE_B_COMMENT); - } else { - if (keywords.InList(s)) { - sc.ChangeState(SCE_B_KEYWORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_B_KEYWORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_B_KEYWORD3); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_B_KEYWORD4); - } // Else, it is really an identifier... - sc.SetState(SCE_B_DEFAULT); - } - } - } else if (sc.state == SCE_B_NUMBER) { - // We stop the number definition on non-numerical non-dot non-eE non-sign char - // Also accepts A-F for hex. numbers - if (!IsANumberChar(sc.ch) && !(tolower(sc.ch) >= 'a' && tolower(sc.ch) <= 'f')) { - sc.SetState(SCE_B_DEFAULT); - } - } else if (sc.state == SCE_B_STRING) { - // VB doubles quotes to preserve them, so just end this string - // state now as a following quote will start again - if (sc.ch == '\"') { - if (sc.chNext == '\"') { - sc.Forward(); - } else { - if (tolower(sc.chNext) == 'c') { - sc.Forward(); - } - sc.ForwardSetState(SCE_B_DEFAULT); - } - } else if (sc.atLineEnd) { - visibleChars = 0; - sc.ChangeState(SCE_B_STRINGEOL); - sc.ForwardSetState(SCE_B_DEFAULT); - } - } else if (sc.state == SCE_B_COMMENT) { - if (sc.atLineEnd) { - visibleChars = 0; - sc.ForwardSetState(SCE_B_DEFAULT); - } - } else if (sc.state == SCE_B_PREPROCESSOR) { - if (sc.atLineEnd) { - visibleChars = 0; - sc.ForwardSetState(SCE_B_DEFAULT); - } - } else if (sc.state == SCE_B_FILENUMBER) { - if (IsADigit(sc.ch)) { - fileNbDigits++; - if (fileNbDigits > 3) { - sc.ChangeState(SCE_B_DATE); - } - } else if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ',') { - // Regular uses: Close #1; Put #1, ...; Get #1, ... etc. - // Too bad if date is format #27, Oct, 2003# or something like that... - // Use regular number state - sc.ChangeState(SCE_B_NUMBER); - sc.SetState(SCE_B_DEFAULT); - } else if (sc.ch == '#') { - sc.ChangeState(SCE_B_DATE); - sc.ForwardSetState(SCE_B_DEFAULT); - } else { - sc.ChangeState(SCE_B_DATE); - } - if (sc.state != SCE_B_FILENUMBER) { - fileNbDigits = 0; - } - } else if (sc.state == SCE_B_DATE) { - if (sc.atLineEnd) { - visibleChars = 0; - sc.ChangeState(SCE_B_STRINGEOL); - sc.ForwardSetState(SCE_B_DEFAULT); - } else if (sc.ch == '#') { - sc.ForwardSetState(SCE_B_DEFAULT); - } - } - - if (sc.state == SCE_B_DEFAULT) { - if (sc.ch == '\'') { - sc.SetState(SCE_B_COMMENT); - } else if (sc.ch == '\"') { - sc.SetState(SCE_B_STRING); - } else if (sc.ch == '#' && visibleChars == 0) { - // Preprocessor commands are alone on their line - sc.SetState(SCE_B_PREPROCESSOR); - } else if (sc.ch == '#') { - // It can be a date literal, ending with #, or a file number, from 1 to 511 - // The date literal depends on the locale, so anything can go between #'s. - // Can be #January 1, 1993# or #1 Jan 93# or #05/11/2003#, etc. - // So we set the FILENUMBER state, and switch to DATE if it isn't a file number - sc.SetState(SCE_B_FILENUMBER); - } else if (sc.ch == '&' && tolower(sc.chNext) == 'h') { - // Hexadecimal number - sc.SetState(SCE_B_NUMBER); - sc.Forward(); - } else if (sc.ch == '&' && tolower(sc.chNext) == 'o') { - // Octal number - sc.SetState(SCE_B_NUMBER); - sc.Forward(); - } else if (sc.ch == '&' && tolower(sc.chNext) == 'b') { - // Binary number - sc.SetState(SCE_B_NUMBER); - sc.Forward(); - } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_B_NUMBER); - } else if (IsAWordStart(sc.ch) || (sc.ch == '[')) { - sc.SetState(SCE_B_IDENTIFIER); - } else if (isoperator(static_cast<char>(sc.ch)) || (sc.ch == '\\')) { // Integer division - sc.SetState(SCE_B_OPERATOR); - } - } - - if (sc.atLineEnd) { - visibleChars = 0; - } - if (!IsASpace(sc.ch)) { - visibleChars++; - } - } - - if (sc.state == SCE_B_IDENTIFIER && !IsAWordChar(sc.ch)) { - // In Basic (except VBScript), a variable name or a function name - // can end with a special character indicating the type of the value - // held or returned. - bool skipType = false; - if (!vbScriptSyntax && IsTypeCharacter(sc.ch)) { - sc.Forward(); // Skip it - skipType = true; - } - if (sc.ch == ']') { - sc.Forward(); - } - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (skipType) { - s[strlen(s) - 1] = '\0'; - } - if (strcmp(s, "rem") == 0) { - sc.ChangeState(SCE_B_COMMENT); - } else { - if (keywords.InList(s)) { - sc.ChangeState(SCE_B_KEYWORD); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_B_KEYWORD2); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_B_KEYWORD3); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_B_KEYWORD4); - } // Else, it is really an identifier... - sc.SetState(SCE_B_DEFAULT); - } - } - - sc.Complete(); -} - -static void FoldVBDoc(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) { - if (lineCurrent > 0) { - lineCurrent--; - startPos = styler.LineStart(lineCurrent); - } - } - int spaceFlags = 0; - int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsVBComment); - 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)) { - int lev = indentCurrent; - int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsVBComment); - 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, IsVBComment); - if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) { - lev |= SC_FOLDLEVELHEADERFLAG; - } - } - } - indentCurrent = indentNext; - styler.SetLevel(lineCurrent, lev); - lineCurrent++; - } - } -} - -static void ColouriseVBNetDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - ColouriseVBDoc(startPos, length, initStyle, keywordlists, styler, false); -} - -static void ColouriseVBScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, - WordList *keywordlists[], Accessor &styler) { - ColouriseVBDoc(startPos, length, initStyle, keywordlists, styler, true); -} - -static const char * const vbWordListDesc[] = { - "Keywords", - "user1", - "user2", - "user3", - 0 -}; - -LexerModule lmVB(SCLEX_VB, ColouriseVBNetDoc, "vb", FoldVBDoc, vbWordListDesc); -LexerModule lmVBScript(SCLEX_VBSCRIPT, ColouriseVBScriptDoc, "vbscript", FoldVBDoc, vbWordListDesc); - diff --git a/lexers/LexVHDL.cxx b/lexers/LexVHDL.cxx deleted file mode 100644 index a1426c815..000000000 --- a/lexers/LexVHDL.cxx +++ /dev/null @@ -1,585 +0,0 @@ -// Scintilla source code edit control -/** @file LexVHDL.cxx - ** Lexer for VHDL - ** Written by Phil Reid, - ** Based on: - ** - The Verilog Lexer by Avi Yegudin - ** - The Fortran Lexer by Chuan-jian Shen - ** - The C++ lexer by Neil Hodgson - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static void ColouriseVHDLDoc( - Sci_PositionU startPos, - Sci_Position length, - int initStyle, - WordList *keywordlists[], - Accessor &styler); - - -/***************************************/ -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 inline bool IsABlank(unsigned int ch) { - return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ; -} - -/***************************************/ -static void ColouriseVHDLDoc( - Sci_PositionU startPos, - Sci_Position length, - int initStyle, - WordList *keywordlists[], - Accessor &styler) -{ - WordList &Keywords = *keywordlists[0]; - WordList &Operators = *keywordlists[1]; - WordList &Attributes = *keywordlists[2]; - WordList &Functions = *keywordlists[3]; - WordList &Packages = *keywordlists[4]; - WordList &Types = *keywordlists[5]; - WordList &User = *keywordlists[6]; - - StyleContext sc(startPos, length, initStyle, styler); - bool isExtendedId = false; // true when parsing an extended identifier - - while (sc.More()) - { - bool advance = true; - - // Determine if the current state should terminate. - if (sc.state == SCE_VHDL_OPERATOR) { - sc.SetState(SCE_VHDL_DEFAULT); - } else if (sc.state == SCE_VHDL_NUMBER) { - if (!IsAWordChar(sc.ch) && (sc.ch != '#')) { - sc.SetState(SCE_VHDL_DEFAULT); - } - } else if (sc.state == SCE_VHDL_IDENTIFIER) { - if (!isExtendedId && (!IsAWordChar(sc.ch) || (sc.ch == '.'))) { - char s[100]; - sc.GetCurrentLowered(s, sizeof(s)); - if (Keywords.InList(s)) { - sc.ChangeState(SCE_VHDL_KEYWORD); - } else if (Operators.InList(s)) { - sc.ChangeState(SCE_VHDL_STDOPERATOR); - } else if (Attributes.InList(s)) { - sc.ChangeState(SCE_VHDL_ATTRIBUTE); - } else if (Functions.InList(s)) { - sc.ChangeState(SCE_VHDL_STDFUNCTION); - } else if (Packages.InList(s)) { - sc.ChangeState(SCE_VHDL_STDPACKAGE); - } else if (Types.InList(s)) { - sc.ChangeState(SCE_VHDL_STDTYPE); - } else if (User.InList(s)) { - sc.ChangeState(SCE_VHDL_USERWORD); - } - sc.SetState(SCE_VHDL_DEFAULT); - } else if (isExtendedId && ((sc.ch == '\\') || sc.atLineEnd)) { - // extended identifiers are terminated by backslash, check for end of line in case we have invalid syntax - isExtendedId = false; - sc.ForwardSetState(SCE_VHDL_DEFAULT); - advance = false; - } - } else if (sc.state == SCE_VHDL_COMMENT || sc.state == SCE_VHDL_COMMENTLINEBANG) { - if (sc.atLineEnd) { - sc.SetState(SCE_VHDL_DEFAULT); - } - } else if (sc.state == SCE_VHDL_STRING) { - if (sc.ch == '"') { - advance = false; - sc.Forward(); - if (sc.ch == '"') - sc.Forward(); - else - sc.SetState(SCE_VHDL_DEFAULT); - } else if (sc.atLineEnd) { - advance = false; - sc.ChangeState(SCE_VHDL_STRINGEOL); - sc.ForwardSetState(SCE_VHDL_DEFAULT); - } - } else if (sc.state == SCE_VHDL_BLOCK_COMMENT){ - if(sc.ch == '*' && sc.chNext == '/'){ - advance = false; - sc.Forward(); - sc.ForwardSetState(SCE_VHDL_DEFAULT); - } - } - - // Determine if a new state should be entered. - if (sc.state == SCE_VHDL_DEFAULT) { - if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_VHDL_NUMBER); - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_VHDL_IDENTIFIER); - } else if (sc.Match('-', '-')) { - if (sc.Match("--!")) // Nice to have a different comment style - sc.SetState(SCE_VHDL_COMMENTLINEBANG); - else - sc.SetState(SCE_VHDL_COMMENT); - } else if (sc.Match('/', '*')){ - sc.SetState(SCE_VHDL_BLOCK_COMMENT); - } else if (sc.ch == '"') { - sc.SetState(SCE_VHDL_STRING); - } else if (sc.ch == '\'') { - if (sc.GetRelative(2) == '\''){ - if (sc.chNext != '(' || sc.GetRelative(4) != '\''){ - // Can only be a character literal - sc.SetState(SCE_VHDL_STRING); - sc.Forward(); - sc.Forward(); - sc.ForwardSetState(SCE_VHDL_DEFAULT); - advance = false; - } // else can be a tick or a character literal, need more context, eg.: identifier'('x') - } // else can only be a tick - } else if (sc.ch == '\\') { - isExtendedId = true; - sc.SetState(SCE_VHDL_IDENTIFIER); - } else if (isoperator(static_cast<char>(sc.ch))) { - sc.SetState(SCE_VHDL_OPERATOR); - } - } - - if (advance) - 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]; - char chNext = styler[i+1]; - if ((ch == '-') && (chNext == '-')) - return true; - else if (ch != ' ' && ch != '\t') - return false; - } - return false; -} -static bool IsCommentBlockStart(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]; - char chNext = styler[i+1]; - char style = styler.StyleAt(i); - if ((style == SCE_VHDL_BLOCK_COMMENT) && (ch == '/') && (chNext == '*')) - return true; - } - return false; -} - -static bool IsCommentBlockEnd(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]; - char chNext = styler[i+1]; - char style = styler.StyleAt(i); - if ((style == SCE_VHDL_BLOCK_COMMENT) && (ch == '*') && (chNext == '/')) - return true; - } - return false; -} - -static bool IsCommentStyle(char style) -{ - return style == SCE_VHDL_BLOCK_COMMENT || style == SCE_VHDL_COMMENT || style == SCE_VHDL_COMMENTLINEBANG; -} - -//============================================================================= -// Folding the code -static void FoldNoBoxVHDLDoc( - Sci_PositionU startPos, - Sci_Position length, - int, - Accessor &styler) -{ - // Decided it would be smarter to have the lexer have all keywords included. Therefore I - // don't check if the style for the keywords that I use to adjust the levels. - char words[] = - "architecture begin block case component else elsif end entity generate loop package process record then " - "procedure protected function when units"; - WordList keywords; - keywords.Set(words); - - bool foldComment = styler.GetPropertyInt("fold.comment", 1) != 0; - bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; - bool foldAtElse = styler.GetPropertyInt("fold.at.else", 1) != 0; - bool foldAtBegin = styler.GetPropertyInt("fold.at.Begin", 1) != 0; - bool foldAtParenthese = styler.GetPropertyInt("fold.at.Parenthese", 1) != 0; - //bool foldAtWhen = styler.GetPropertyInt("fold.at.When", 1) != 0; //< fold at when in case statements - - int visibleChars = 0; - 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 levelMinCurrent = levelCurrent; - int levelMinCurrentElse = levelCurrent; ///< Used for folding at 'else' - int levelMinCurrentBegin = levelCurrent; ///< Used for folding at 'begin' - int levelNext = levelCurrent; - - /***************************************/ - Sci_Position lastStart = 0; - char prevWord[32] = ""; - - /***************************************/ - // Find prev word - // The logic for going up or down a level depends on a the previous keyword - // This code could be cleaned up. - Sci_Position end = 0; - Sci_PositionU j; - for(j = startPos; j>0; j--) - { - char ch = styler.SafeGetCharAt(j); - char chPrev = styler.SafeGetCharAt(j-1); - int style = styler.StyleAt(j); - int stylePrev = styler.StyleAt(j-1); - if ((!IsCommentStyle(style)) && (stylePrev != SCE_VHDL_STRING)) - { - if(IsAWordChar(chPrev) && !IsAWordChar(ch)) - { - end = j-1; - } - } - if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING)) - { - if(!IsAWordChar(chPrev) && IsAWordStart(ch) && (end != 0)) - { - char s[32]; - Sci_PositionU k; - for(k=0; (k<31 ) && (k<end-j+1 ); k++) { - s[k] = static_cast<char>(tolower(styler[j+k])); - } - s[k] = '\0'; - - if(keywords.InList(s)) { - strcpy(prevWord, s); - break; - } - } - } - } - for(j=j+static_cast<Sci_PositionU>(strlen(prevWord)); j<endPos; j++) - { - char ch = styler.SafeGetCharAt(j); - int style = styler.StyleAt(j); - if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING)) - { - if((ch == ';') && (strcmp(prevWord, "end") == 0)) - { - strcpy(prevWord, ";"); - } - } - } - - char chNext = styler[startPos]; - char chPrev = '\0'; - char chNextNonBlank; - int styleNext = styler.StyleAt(startPos); - //Platform::DebugPrintf("Line[%04d] Prev[%20s] ************************* Level[%x]\n", lineCurrent+1, prevWord, levelCurrent); - - /***************************************/ - for (Sci_PositionU i = startPos; i < endPos; i++) - { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - chPrev = styler.SafeGetCharAt(i - 1); - chNextNonBlank = chNext; - Sci_PositionU j = i+1; - while(IsABlank(chNextNonBlank) && j<endPos) - { - j ++ ; - chNextNonBlank = styler.SafeGetCharAt(j); - } - int style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - - if (foldComment && atEOL) - { - if(IsCommentLine(lineCurrent, styler)) - { - if(!IsCommentLine(lineCurrent-1, styler) && IsCommentLine(lineCurrent+1, styler)) - { - levelNext++; - } - else if(IsCommentLine(lineCurrent-1, styler) && !IsCommentLine(lineCurrent+1, styler)) - { - levelNext--; - } - } - else - { - if (IsCommentBlockStart(lineCurrent, styler) && !IsCommentBlockEnd(lineCurrent, styler)) - { - levelNext++; - } - else if (IsCommentBlockEnd(lineCurrent, styler) && !IsCommentBlockStart(lineCurrent, styler)) - { - levelNext--; - } - } - } - - if ((style == SCE_VHDL_OPERATOR) && foldAtParenthese) - { - if(ch == '(') { - levelNext++; - } else if (ch == ')') { - levelNext--; - } - } - - if ((!IsCommentStyle(style)) && (style != SCE_VHDL_STRING)) - { - if((ch == ';') && (strcmp(prevWord, "end") == 0)) - { - strcpy(prevWord, ";"); - } - - if(!IsAWordChar(chPrev) && IsAWordStart(ch)) - { - lastStart = i; - } - - if(IsAWordChar(ch) && !IsAWordChar(chNext)) { - char s[32]; - Sci_PositionU k; - for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) { - s[k] = static_cast<char>(tolower(styler[lastStart+k])); - } - s[k] = '\0'; - - if(keywords.InList(s)) - { - if ( - strcmp(s, "architecture") == 0 || - strcmp(s, "case") == 0 || - strcmp(s, "generate") == 0 || - strcmp(s, "block") == 0 || - strcmp(s, "loop") == 0 || - strcmp(s, "package") ==0 || - strcmp(s, "process") == 0 || - strcmp(s, "protected") == 0 || - strcmp(s, "record") == 0 || - strcmp(s, "then") == 0 || - strcmp(s, "units") == 0) - { - if (strcmp(prevWord, "end") != 0) - { - if (levelMinCurrentElse > levelNext) { - levelMinCurrentElse = levelNext; - } - levelNext++; - } - } else if ( - strcmp(s, "component") == 0 || - strcmp(s, "entity") == 0 || - strcmp(s, "configuration") == 0 ) - { - if (strcmp(prevWord, "end") != 0) - { // check for instantiated unit by backward searching for the colon. - Sci_PositionU pos = lastStart; - char chAtPos=0, styleAtPos; - do{// skip white spaces - if(!pos) - break; - pos--; - styleAtPos = styler.StyleAt(pos); - chAtPos = styler.SafeGetCharAt(pos); - }while(pos && - (chAtPos == ' ' || chAtPos == '\t' || - chAtPos == '\n' || chAtPos == '\r' || - IsCommentStyle(styleAtPos))); - - // check for a colon (':') before the instantiated units "entity", "component" or "configuration". Don't fold thereafter. - if (chAtPos != ':') - { - if (levelMinCurrentElse > levelNext) { - levelMinCurrentElse = levelNext; - } - levelNext++; - } - } - } else if ( - strcmp(s, "procedure") == 0 || - strcmp(s, "function") == 0) - { - if (strcmp(prevWord, "end") != 0) // check for "end procedure" etc. - { // This code checks to see if the procedure / function is a definition within a "package" - // rather than the actual code in the body. - int BracketLevel = 0; - for(Sci_Position pos=i+1; pos<styler.Length(); pos++) - { - int styleAtPos = styler.StyleAt(pos); - char chAtPos = styler.SafeGetCharAt(pos); - if(chAtPos == '(') BracketLevel++; - if(chAtPos == ')') BracketLevel--; - if( - (BracketLevel == 0) && - (!IsCommentStyle(styleAtPos)) && - (styleAtPos != SCE_VHDL_STRING) && - !iswordchar(styler.SafeGetCharAt(pos-1)) && - (chAtPos|' ')=='i' && (styler.SafeGetCharAt(pos+1)|' ')=='s' && - !iswordchar(styler.SafeGetCharAt(pos+2))) - { - if (levelMinCurrentElse > levelNext) { - levelMinCurrentElse = levelNext; - } - levelNext++; - break; - } - if((BracketLevel == 0) && (chAtPos == ';')) - { - break; - } - } - } - - } else if (strcmp(s, "end") == 0) { - levelNext--; - } else if(strcmp(s, "elsif") == 0) { // elsif is followed by then so folding occurs correctly - levelNext--; - } else if (strcmp(s, "else") == 0) { - if(strcmp(prevWord, "when") != 0) // ignore a <= x when y else z; - { - levelMinCurrentElse = levelNext - 1; // VHDL else is all on its own so just dec. the min level - } - } else if( - ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "architecture") == 0)) || - ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "function") == 0)) || - ((strcmp(s, "begin") == 0) && (strcmp(prevWord, "procedure") == 0))) - { - levelMinCurrentBegin = levelNext - 1; - } - //Platform::DebugPrintf("Line[%04d] Prev[%20s] Cur[%20s] Level[%x]\n", lineCurrent+1, prevWord, s, levelCurrent); - strcpy(prevWord, s); - } - } - } - if (atEOL) { - int levelUse = levelCurrent; - - if (foldAtElse && (levelMinCurrentElse < levelUse)) { - levelUse = levelMinCurrentElse; - } - if (foldAtBegin && (levelMinCurrentBegin < levelUse)) { - levelUse = levelMinCurrentBegin; - } - 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); - } - //Platform::DebugPrintf("Line[%04d] ---------------------------------------------------- Level[%x]\n", lineCurrent+1, levelCurrent); - lineCurrent++; - levelCurrent = levelNext; - //levelMinCurrent = levelCurrent; - levelMinCurrentElse = levelCurrent; - levelMinCurrentBegin = levelCurrent; - visibleChars = 0; - } - /***************************************/ - if (!isspacechar(ch)) visibleChars++; - } - - /***************************************/ -// Platform::DebugPrintf("Line[%04d] ---------------------------------------------------- Level[%x]\n", lineCurrent+1, levelCurrent); -} - -//============================================================================= -static void FoldVHDLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *[], - Accessor &styler) { - FoldNoBoxVHDLDoc(startPos, length, initStyle, styler); -} - -//============================================================================= -static const char * const VHDLWordLists[] = { - "Keywords", - "Operators", - "Attributes", - "Standard Functions", - "Standard Packages", - "Standard Types", - "User Words", - 0, - }; - - -LexerModule lmVHDL(SCLEX_VHDL, ColouriseVHDLDoc, "vhdl", FoldVHDLDoc, VHDLWordLists); - - -// Keyword: -// access after alias all architecture array assert attribute begin block body buffer bus case component -// configuration constant disconnect downto else elsif end entity exit file for function generate generic -// group guarded if impure in inertial inout is label library linkage literal loop map new next null of -// on open others out package port postponed procedure process pure range record register reject report -// return select severity shared signal subtype then to transport type unaffected units until use variable -// wait when while with -// -// Operators: -// abs and mod nand nor not or rem rol ror sla sll sra srl xnor xor -// -// Attributes: -// left right low high ascending image value pos val succ pred leftof rightof base range reverse_range -// length delayed stable quiet transaction event active last_event last_active last_value driving -// driving_value simple_name path_name instance_name -// -// Std Functions: -// now readline read writeline write endfile resolved to_bit to_bitvector to_stdulogic to_stdlogicvector -// to_stdulogicvector to_x01 to_x01z to_UX01 rising_edge falling_edge is_x shift_left shift_right rotate_left -// rotate_right resize to_integer to_unsigned to_signed std_match to_01 -// -// Std Packages: -// std ieee work standard textio std_logic_1164 std_logic_arith std_logic_misc std_logic_signed -// std_logic_textio std_logic_unsigned numeric_bit numeric_std math_complex math_real vital_primitives -// vital_timing -// -// Std Types: -// boolean bit character severity_level integer real time delay_length natural positive string bit_vector -// file_open_kind file_open_status line text side width std_ulogic std_ulogic_vector std_logic -// std_logic_vector X01 X01Z UX01 UX01Z unsigned signed -// - diff --git a/lexers/LexVerilog.cxx b/lexers/LexVerilog.cxx deleted file mode 100644 index ac5859e93..000000000 --- a/lexers/LexVerilog.cxx +++ /dev/null @@ -1,1081 +0,0 @@ -// Scintilla source code edit control -/** @file LexVerilog.cxx - ** Lexer for Verilog. - ** Written by Avi Yegudin, based on C++ lexer by Neil Hodgson - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#include <string> -#include <vector> -#include <map> -#include <algorithm> - -#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; - -namespace { - // Use an unnamed namespace to protect the functions and classes from name conflicts - -struct PPDefinition { - Sci_Position line; - std::string key; - std::string value; - bool isUndef; - std::string arguments; - PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") : - line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) { - } -}; - -class LinePPState { - int state; - int ifTaken; - int level; - bool ValidLevel() const { - return level >= 0 && level < 32; - } - int maskLevel() const { - if (level >= 0) { - return 1 << level; - } else { - return 1; - } - } -public: - LinePPState() : state(0), ifTaken(0), level(-1) { - } - bool IsInactive() const { - return state != 0; - } - bool CurrentIfTaken() const { - return (ifTaken & maskLevel()) != 0; - } - void StartSection(bool on) { - level++; - if (ValidLevel()) { - if (on) { - state &= ~maskLevel(); - ifTaken |= maskLevel(); - } else { - state |= maskLevel(); - ifTaken &= ~maskLevel(); - } - } - } - void EndSection() { - if (ValidLevel()) { - state &= ~maskLevel(); - ifTaken &= ~maskLevel(); - } - level--; - } - void InvertCurrentLevel() { - 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<LinePPState> vlls; -public: - LinePPState ForLine(Sci_Position line) const { - if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) { - return vlls[line]; - } else { - return LinePPState(); - } - } - void Add(Sci_Position line, LinePPState lls) { - vlls.resize(line+1); - vlls[line] = lls; - } -}; - -// Options used for LexerVerilog -struct OptionsVerilog { - bool foldComment; - bool foldPreprocessor; - bool foldPreprocessorElse; - bool foldCompact; - bool foldAtElse; - bool foldAtModule; - bool trackPreprocessor; - bool updatePreprocessor; - bool portStyling; - bool allUppercaseDocKeyword; - OptionsVerilog() { - foldComment = false; - foldPreprocessor = false; - foldPreprocessorElse = false; - foldCompact = false; - foldAtElse = false; - foldAtModule = false; - // for backwards compatibility, preprocessor functionality is disabled by default - trackPreprocessor = false; - updatePreprocessor = false; - // for backwards compatibility, treat input/output/inout as regular keywords - portStyling = false; - // for backwards compatibility, don't treat all uppercase identifiers as documentation keywords - allUppercaseDocKeyword = false; - } -}; - -struct OptionSetVerilog : public OptionSet<OptionsVerilog> { - OptionSetVerilog() { - DefineProperty("fold.comment", &OptionsVerilog::foldComment, - "This option enables folding multi-line comments when using the Verilog lexer."); - DefineProperty("fold.preprocessor", &OptionsVerilog::foldPreprocessor, - "This option enables folding preprocessor directives when using the Verilog lexer."); - DefineProperty("fold.compact", &OptionsVerilog::foldCompact); - DefineProperty("fold.at.else", &OptionsVerilog::foldAtElse, - "This option enables folding on the else line of an if statement."); - DefineProperty("fold.verilog.flags", &OptionsVerilog::foldAtModule, - "This option enables folding module definitions. Typically source files " - "contain only one module definition so this option is somewhat useless."); - DefineProperty("lexer.verilog.track.preprocessor", &OptionsVerilog::trackPreprocessor, - "Set to 1 to interpret `if/`else/`endif to grey out code that is not active."); - DefineProperty("lexer.verilog.update.preprocessor", &OptionsVerilog::updatePreprocessor, - "Set to 1 to update preprocessor definitions when `define, `undef, or `undefineall found."); - DefineProperty("lexer.verilog.portstyling", &OptionsVerilog::portStyling, - "Set to 1 to style input, output, and inout ports differently from regular keywords."); - DefineProperty("lexer.verilog.allupperkeywords", &OptionsVerilog::allUppercaseDocKeyword, - "Set to 1 to style identifiers that are all uppercase as documentation keyword."); - DefineProperty("lexer.verilog.fold.preprocessor.else", &OptionsVerilog::foldPreprocessorElse, - "This option enables folding on `else and `elsif preprocessor directives."); - } -}; - -const char styleSubable[] = {0}; - -} - -class LexerVerilog : public DefaultLexer { - CharacterSet setWord; - WordList keywords; - WordList keywords2; - WordList keywords3; - WordList keywords4; - WordList keywords5; - WordList ppDefinitions; - PPStates vlls; - std::vector<PPDefinition> ppDefineHistory; - struct SymbolValue { - std::string value; - std::string arguments; - SymbolValue(const std::string &value_="", const std::string &arguments_="") : value(value_), arguments(arguments_) { - } - SymbolValue &operator = (const std::string &value_) { - value = value_; - arguments.clear(); - return *this; - } - bool IsMacro() const { - return !arguments.empty(); - } - }; - typedef std::map<std::string, SymbolValue> SymbolTable; - SymbolTable preprocessorDefinitionsStart; - OptionsVerilog options; - OptionSetVerilog osVerilog; - enum { activeFlag = 0x40 }; - SubStyles subStyles; - - // states at end of line (EOL) during fold operations: - // foldExternFlag: EOL while parsing an extern function/task declaration terminated by ';' - // foldWaitDisableFlag: EOL while parsing wait or disable statement, terminated by "fork" or '(' - // typdefFlag: EOL while parsing typedef statement, terminated by ';' - enum {foldExternFlag = 0x01, foldWaitDisableFlag = 0x02, typedefFlag = 0x04, protectedFlag = 0x08}; - // map using line number as key to store fold state information - std::map<Sci_Position, int> foldState; - -public: - LexerVerilog() : - DefaultLexer("verilog", SCLEX_VERILOG), - setWord(CharacterSet::setAlphaNum, "._", 0x80, true), - subStyles(styleSubable, 0x80, 0x40, activeFlag) { - } - virtual ~LexerVerilog() {} - int SCI_METHOD Version() const override { - return lvRelease5; - } - void SCI_METHOD Release() override { - delete this; - } - const char* SCI_METHOD PropertyNames() override { - return osVerilog.PropertyNames(); - } - int SCI_METHOD PropertyType(const char* name) override { - return osVerilog.PropertyType(name); - } - const char* SCI_METHOD DescribeProperty(const char* name) override { - return osVerilog.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char* key, const char* val) override { - return osVerilog.PropertySet(&options, key, val); - } - const char * SCI_METHOD PropertyGet(const char *key) override { - return osVerilog.PropertyGet(key); - } - const char* SCI_METHOD DescribeWordListSets() override { - return osVerilog.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 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 { - int styleBase = subStyles.BaseStyle(MaskActive(subStyle)); - int active = subStyle & activeFlag; - return styleBase | active; - } - int SCI_METHOD PrimaryStyleFromStyle(int style) 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() override { - return activeFlag; - } - const char * SCI_METHOD GetSubStyleBases() override { - return styleSubable; - } - static ILexer5* LexerFactoryVerilog() { - return new LexerVerilog(); - } - static int MaskActive(int style) { - return style & ~activeFlag; - } - std::vector<std::string> Tokenize(const std::string &expr) const; -}; - -Sci_Position SCI_METHOD LexerVerilog::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 = &ppDefinitions; - break; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - if (n == 5) { - // Rebuild preprocessorDefinitions - preprocessorDefinitionsStart.clear(); - for (int nDefinition = 0; nDefinition < ppDefinitions.Length(); nDefinition++) { - const char *cpDefinition = ppDefinitions.WordAt(nDefinition); - const char *cpEquals = strchr(cpDefinition, '='); - if (cpEquals) { - std::string name(cpDefinition, cpEquals - cpDefinition); - std::string val(cpEquals+1); - size_t bracket = name.find('('); - size_t bracketEnd = name.find(')'); - if ((bracket != std::string::npos) && (bracketEnd != std::string::npos)) { - // Macro - std::string args = name.substr(bracket + 1, bracketEnd - bracket - 1); - name = name.substr(0, bracket); - preprocessorDefinitionsStart[name] = SymbolValue(val, args); - } else { - preprocessorDefinitionsStart[name] = val; - } - } else { - std::string name(cpDefinition); - std::string val("1"); - preprocessorDefinitionsStart[name] = val; - } - } - } - } - } - return firstModification; -} - -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 == '$'); -} - -static inline bool AllUpperCase(const char *a) { - while (*a) { - if (*a >= 'a' && *a <= 'z') return false; - a++; - } - return true; -} - -// Functor used to truncate history -struct After { - Sci_Position line; - explicit After(Sci_Position line_) : line(line_) {} - bool operator()(PPDefinition &p) const { - return p.line > line; - } -}; - -static std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) { - std::string restOfLine; - Sci_Position i =0; - char ch = styler.SafeGetCharAt(start, '\n'); - Sci_Position endLine = styler.LineEnd(styler.GetLine(start)); - while (((start+i) < endLine) && (ch != '\r')) { - char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); - if (ch == '/' && (chNext == '/' || chNext == '*')) - break; - if (allowSpace || (ch != ' ')) - restOfLine += ch; - i++; - ch = chNext; - } - return restOfLine; -} - -static bool IsSpaceOrTab(int ch) { - return ch == ' ' || ch == '\t'; -} - -void SCI_METHOD LexerVerilog::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) -{ - LexAccessor styler(pAccess); - - const int kwOther=0, kwDot=0x100, kwInput=0x200, kwOutput=0x300, kwInout=0x400, kwProtected=0x800; - int lineState = kwOther; - bool continuationLine = false; - - Sci_Position curLine = styler.GetLine(startPos); - if (curLine > 0) lineState = styler.GetLineState(curLine - 1); - - // Do not leak onto next line - if (initStyle == SCE_V_STRINGEOL) - initStyle = SCE_V_DEFAULT; - - if ((MaskActive(initStyle) == SCE_V_PREPROCESSOR) || - (MaskActive(initStyle) == SCE_V_COMMENTLINE) || - (MaskActive(initStyle) == SCE_V_COMMENTLINEBANG)) { - // Set continuationLine if last character of previous line is '\' - if (curLine > 0) { - Sci_Position endLinePrevious = styler.LineEnd(curLine - 1); - if (endLinePrevious > 0) { - continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\'; - } - } - } - - StyleContext sc(startPos, length, initStyle, styler); - LinePPState preproc = vlls.ForLine(curLine); - - bool definitionsChanged = false; - - // Truncate ppDefineHistory before current line - - if (!options.updatePreprocessor) - ppDefineHistory.clear(); - - std::vector<PPDefinition>::iterator itInvalid = std::find_if(ppDefineHistory.begin(), ppDefineHistory.end(), After(curLine-1)); - if (itInvalid != ppDefineHistory.end()) { - ppDefineHistory.erase(itInvalid, ppDefineHistory.end()); - definitionsChanged = true; - } - - SymbolTable preprocessorDefinitions = preprocessorDefinitionsStart; - for (std::vector<PPDefinition>::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) { - if (itDef->isUndef) - preprocessorDefinitions.erase(itDef->key); - else - preprocessorDefinitions[itDef->key] = SymbolValue(itDef->value, itDef->arguments); - } - - int activitySet = preproc.IsInactive() ? activeFlag : 0; - Sci_Position lineEndNext = styler.LineEnd(curLine); - bool isEscapedId = false; // true when parsing an escaped Identifier - bool isProtected = (lineState&kwProtected) != 0; // true when parsing a protected region - - for (; sc.More(); sc.Forward()) { - if (sc.atLineStart) { - if (sc.state == SCE_V_STRING) { - // Prevent SCE_V_STRINGEOL from leaking back to previous line - sc.SetState(SCE_V_STRING); - } - if ((MaskActive(sc.state) == SCE_V_PREPROCESSOR) && (!continuationLine)) { - sc.SetState(SCE_V_DEFAULT|activitySet); - } - if (preproc.IsInactive()) { - activitySet = activeFlag; - sc.SetState(sc.state | activitySet); - } - } - - if (sc.atLineEnd) { - curLine++; - lineEndNext = styler.LineEnd(curLine); - vlls.Add(curLine, preproc); - // Update the line state, so it can be seen by next line - styler.SetLineState(curLine, lineState); - isEscapedId = false; // EOL terminates an escaped Identifier - } - - // Handle line continuation generically. - if (sc.ch == '\\') { - if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) { - curLine++; - lineEndNext = styler.LineEnd(curLine); - vlls.Add(curLine, preproc); - // Update the line state, so it can be seen by next line - styler.SetLineState(curLine, lineState); - 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; - } - } - - // for comment keyword - if (MaskActive(sc.state) == SCE_V_COMMENT_WORD && !IsAWordChar(sc.ch)) { - char s[100]; - int state = lineState & 0xff; - sc.GetCurrent(s, sizeof(s)); - if (keywords5.InList(s)) { - sc.ChangeState(SCE_V_COMMENT_WORD|activitySet); - } else { - sc.ChangeState(state|activitySet); - } - sc.SetState(state|activitySet); - } - - const bool atLineEndBeforeSwitch = sc.atLineEnd; - - // Determine if the current state should terminate. - switch (MaskActive(sc.state)) { - case SCE_V_OPERATOR: - sc.SetState(SCE_V_DEFAULT|activitySet); - break; - case SCE_V_NUMBER: - if (!(IsAWordChar(sc.ch) || (sc.ch == '?'))) { - sc.SetState(SCE_V_DEFAULT|activitySet); - } - break; - case SCE_V_IDENTIFIER: - if (!isEscapedId &&(!IsAWordChar(sc.ch) || (sc.ch == '.'))) { - char s[100]; - lineState &= 0xff00; - sc.GetCurrent(s, sizeof(s)); - if (options.portStyling && (strcmp(s, "input") == 0)) { - lineState = kwInput; - sc.ChangeState(SCE_V_INPUT|activitySet); - } else if (options.portStyling && (strcmp(s, "output") == 0)) { - lineState = kwOutput; - sc.ChangeState(SCE_V_OUTPUT|activitySet); - } else if (options.portStyling && (strcmp(s, "inout") == 0)) { - lineState = kwInout; - sc.ChangeState(SCE_V_INOUT|activitySet); - } else if (lineState == kwInput) { - sc.ChangeState(SCE_V_INPUT|activitySet); - } else if (lineState == kwOutput) { - sc.ChangeState(SCE_V_OUTPUT|activitySet); - } else if (lineState == kwInout) { - sc.ChangeState(SCE_V_INOUT|activitySet); - } else if (lineState == kwDot) { - lineState = kwOther; - if (options.portStyling) - sc.ChangeState(SCE_V_PORT_CONNECT|activitySet); - } else if (keywords.InList(s)) { - sc.ChangeState(SCE_V_WORD|activitySet); - } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_V_WORD2|activitySet); - } else if (keywords3.InList(s)) { - sc.ChangeState(SCE_V_WORD3|activitySet); - } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_V_USER|activitySet); - } else if (options.allUppercaseDocKeyword && AllUpperCase(s)) { - sc.ChangeState(SCE_V_USER|activitySet); - } - sc.SetState(SCE_V_DEFAULT|activitySet); - } - break; - case SCE_V_PREPROCESSOR: - if (!IsAWordChar(sc.ch) || sc.atLineEnd) { - sc.SetState(SCE_V_DEFAULT|activitySet); - } - break; - case SCE_V_COMMENT: - if (sc.Match('*', '/')) { - sc.Forward(); - sc.ForwardSetState(SCE_V_DEFAULT|activitySet); - } else if (IsAWordStart(sc.ch)) { - lineState = sc.state | (lineState & 0xff00); - sc.SetState(SCE_V_COMMENT_WORD|activitySet); - } - break; - case SCE_V_COMMENTLINE: - case SCE_V_COMMENTLINEBANG: - if (sc.atLineStart) { - sc.SetState(SCE_V_DEFAULT|activitySet); - } else if (IsAWordStart(sc.ch)) { - lineState = sc.state | (lineState & 0xff00); - sc.SetState(SCE_V_COMMENT_WORD|activitySet); - } - break; - case SCE_V_STRING: - if (sc.ch == '\\') { - if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { - sc.Forward(); - } - } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_V_DEFAULT|activitySet); - } else if (sc.atLineEnd) { - sc.ChangeState(SCE_V_STRINGEOL|activitySet); - sc.ForwardSetState(SCE_V_DEFAULT|activitySet); - } - break; - } - - if (sc.atLineEnd && !atLineEndBeforeSwitch) { - // State exit processing consumed characters up to end of line. - curLine++; - lineEndNext = styler.LineEnd(curLine); - vlls.Add(curLine, preproc); - // Update the line state, so it can be seen by next line - styler.SetLineState(curLine, lineState); - isEscapedId = false; // EOL terminates an escaped Identifier - } - - // Determine if a new state should be entered. - if (MaskActive(sc.state) == SCE_V_DEFAULT) { - if (sc.ch == '`') { - sc.SetState(SCE_V_PREPROCESSOR|activitySet); - // Skip whitespace between ` and preprocessor word - do { - sc.Forward(); - } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); - if (sc.atLineEnd) { - sc.SetState(SCE_V_DEFAULT|activitySet); - styler.SetLineState(curLine, lineState); - } else { - if (sc.Match("protected")) { - isProtected = true; - lineState |= kwProtected; - styler.SetLineState(curLine, lineState); - } else if (sc.Match("endprotected")) { - isProtected = false; - lineState &= ~kwProtected; - styler.SetLineState(curLine, lineState); - } else if (!isProtected && options.trackPreprocessor) { - if (sc.Match("ifdef") || sc.Match("ifndef")) { - bool isIfDef = sc.Match("ifdef"); - int i = isIfDef ? 5 : 6; - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + i + 1, false); - bool foundDef = preprocessorDefinitions.find(restOfLine) != preprocessorDefinitions.end(); - preproc.StartSection(isIfDef == foundDef); - } else if (sc.Match("else")) { - if (!preproc.CurrentIfTaken()) { - preproc.InvertCurrentLevel(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - if (!activitySet) { - sc.ChangeState(SCE_V_PREPROCESSOR|activitySet); - } - } else if (!preproc.IsInactive()) { - preproc.InvertCurrentLevel(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - if (!activitySet) { - sc.ChangeState(SCE_V_PREPROCESSOR|activitySet); - } - } - } else if (sc.Match("elsif")) { - // Ensure only one chosen out of `if .. `elsif .. `elsif .. `else .. `endif - if (!preproc.CurrentIfTaken()) { - // Similar to `ifdef - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true); - bool ifGood = preprocessorDefinitions.find(restOfLine) != preprocessorDefinitions.end(); - if (ifGood) { - preproc.InvertCurrentLevel(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - if (!activitySet) - sc.ChangeState(SCE_V_PREPROCESSOR|activitySet); - } - } else if (!preproc.IsInactive()) { - preproc.InvertCurrentLevel(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - if (!activitySet) - sc.ChangeState(SCE_V_PREPROCESSOR|activitySet); - } - } else if (sc.Match("endif")) { - preproc.EndSection(); - activitySet = preproc.IsInactive() ? activeFlag : 0; - sc.ChangeState(SCE_V_PREPROCESSOR|activitySet); - } else if (sc.Match("define")) { - if (options.updatePreprocessor && !preproc.IsInactive()) { - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true); - size_t startName = 0; - while ((startName < restOfLine.length()) && IsSpaceOrTab(restOfLine[startName])) - startName++; - size_t endName = startName; - while ((endName < restOfLine.length()) && setWord.Contains(static_cast<unsigned char>(restOfLine[endName]))) - endName++; - std::string key = restOfLine.substr(startName, endName-startName); - if ((endName < restOfLine.length()) && (restOfLine.at(endName) == '(')) { - // Macro - size_t endArgs = endName; - while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')')) - endArgs++; - std::string args = restOfLine.substr(endName + 1, endArgs - endName - 1); - size_t startValue = endArgs+1; - while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue])) - startValue++; - std::string value; - if (startValue < restOfLine.length()) - value = restOfLine.substr(startValue); - preprocessorDefinitions[key] = SymbolValue(value, args); - ppDefineHistory.push_back(PPDefinition(curLine, key, value, false, args)); - definitionsChanged = true; - } else { - // Value - size_t startValue = endName; - while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue])) - startValue++; - std::string value = restOfLine.substr(startValue); - preprocessorDefinitions[key] = value; - ppDefineHistory.push_back(PPDefinition(curLine, key, value)); - definitionsChanged = true; - } - } - } else if (sc.Match("undefineall")) { - if (options.updatePreprocessor && !preproc.IsInactive()) { - // remove all preprocessor definitions - std::map<std::string, SymbolValue>::iterator itDef; - for(itDef = preprocessorDefinitions.begin(); itDef != preprocessorDefinitions.end(); ++itDef) { - ppDefineHistory.push_back(PPDefinition(curLine, itDef->first, "", true)); - } - preprocessorDefinitions.clear(); - definitionsChanged = true; - } - } else if (sc.Match("undef")) { - if (options.updatePreprocessor && !preproc.IsInactive()) { - std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, true); - std::vector<std::string> tokens = Tokenize(restOfLine); - std::string key; - if (tokens.size() >= 1) { - key = tokens[0]; - preprocessorDefinitions.erase(key); - ppDefineHistory.push_back(PPDefinition(curLine, key, "", true)); - definitionsChanged = true; - } - } - } - } - } - } else if (!isProtected) { - if (IsADigit(sc.ch) || (sc.ch == '\'') || (sc.ch == '.' && IsADigit(sc.chNext))) { - sc.SetState(SCE_V_NUMBER|activitySet); - } else if (IsAWordStart(sc.ch)) { - sc.SetState(SCE_V_IDENTIFIER|activitySet); - } else if (sc.Match('/', '*')) { - sc.SetState(SCE_V_COMMENT|activitySet); - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('/', '/')) { - if (sc.Match("//!")) // Nice to have a different comment style - sc.SetState(SCE_V_COMMENTLINEBANG|activitySet); - else - sc.SetState(SCE_V_COMMENTLINE|activitySet); - } else if (sc.ch == '\"') { - sc.SetState(SCE_V_STRING|activitySet); - } else if (sc.ch == '\\') { - // escaped identifier, everything is ok up to whitespace - isEscapedId = true; - sc.SetState(SCE_V_IDENTIFIER|activitySet); - } else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '@' || sc.ch == '#') { - sc.SetState(SCE_V_OPERATOR|activitySet); - if (sc.ch == '.') lineState = kwDot; - if (sc.ch == ';') lineState = kwOther; - } - } - } - if (isEscapedId && isspacechar(sc.ch)) { - isEscapedId = false; - } - } - if (definitionsChanged) { - styler.ChangeLexerState(startPos, startPos + length); - } - sc.Complete(); -} - -static bool IsStreamCommentStyle(int style) { - return style == SCE_V_COMMENT; -} - -static bool IsCommentLine(Sci_Position line, LexAccessor &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_V_COMMENTLINE || style == SCE_V_COMMENTLINEBANG)) { - return true; - } else if (!IsASpaceOrTab(ch)) { - return false; - } - } - return false; -} - -// 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 LexerVerilog::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) -{ - LexAccessor styler(pAccess); - bool foldAtBrace = 1; - bool foldAtParenthese = 1; - - Sci_Position lineCurrent = styler.GetLine(startPos); - // Move back one line to be compatible with LexerModule::Fold behavior, fixes problem with foldComment behavior - if (lineCurrent > 0) { - lineCurrent--; - Sci_Position newStartPos = styler.LineStart(lineCurrent); - length += startPos - newStartPos; - startPos = newStartPos; - initStyle = 0; - if (startPos > 0) { - initStyle = styler.StyleAt(startPos - 1); - } - } - Sci_PositionU endPos = startPos + length; - int visibleChars = 0; - 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 = MaskActive(styler.StyleAt(startPos)); - int style = MaskActive(initStyle); - - // restore fold state (if it exists) for prior line - int stateCurrent = 0; - std::map<Sci_Position,int>::iterator foldStateIterator = foldState.find(lineCurrent-1); - if (foldStateIterator != foldState.end()) { - stateCurrent = foldStateIterator->second; - } - - // remove all foldState entries after lineCurrent-1 - foldStateIterator = foldState.upper_bound(lineCurrent-1); - if (foldStateIterator != foldState.end()) { - foldState.erase(foldStateIterator, foldState.end()); - } - - for (Sci_PositionU i = startPos; i < endPos; i++) { - char ch = chNext; - chNext = styler.SafeGetCharAt(i + 1); - int stylePrev = style; - style = styleNext; - styleNext = MaskActive(styler.StyleAt(i + 1)); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (!(stateCurrent & protectedFlag)) { - if (options.foldComment && 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 && atEOL && IsCommentLine(lineCurrent, styler)) - { - if (!IsCommentLine(lineCurrent - 1, styler) - && IsCommentLine(lineCurrent + 1, styler)) - levelNext++; - else if (IsCommentLine(lineCurrent - 1, styler) - && !IsCommentLine(lineCurrent+1, styler)) - levelNext--; - } - if (options.foldComment && (style == SCE_V_COMMENTLINE)) { - if ((ch == '/') && (chNext == '/')) { - char chNext2 = styler.SafeGetCharAt(i + 2); - if (chNext2 == '{') { - levelNext++; - } else if (chNext2 == '}') { - levelNext--; - } - } - } - } - if (ch == '`') { - Sci_PositionU j = i + 1; - while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) { - j++; - } - if (styler.Match(j, "protected")) { - stateCurrent |= protectedFlag; - levelNext++; - } else if (styler.Match(j, "endprotected")) { - stateCurrent &= ~protectedFlag; - levelNext--; - } else if (!(stateCurrent & protectedFlag) && options.foldPreprocessor && (style == SCE_V_PREPROCESSOR)) { - if (styler.Match(j, "if")) { - if (options.foldPreprocessorElse) { - // Measure the minimum before a begin to allow - // folding on "end else begin" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - } - levelNext++; - } else if (options.foldPreprocessorElse && styler.Match(j, "else")) { - levelNext--; - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (options.foldPreprocessorElse && styler.Match(j, "elsif")) { - levelNext--; - // Measure the minimum before a begin to allow - // folding on "end else begin" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (styler.Match(j, "endif")) { - levelNext--; - } - } - } - if (style == SCE_V_OPERATOR) { - if (foldAtParenthese) { - if (ch == '(') { - levelNext++; - } else if (ch == ')') { - levelNext--; - } - } - // semicolons terminate external declarations - if (ch == ';') { - // extern and pure virtual declarations terminated by semicolon - if (stateCurrent & foldExternFlag) { - levelNext--; - stateCurrent &= ~foldExternFlag; - } - // wait and disable statements terminated by semicolon - if (stateCurrent & foldWaitDisableFlag) { - stateCurrent &= ~foldWaitDisableFlag; - } - // typedef statements terminated by semicolon - if (stateCurrent & typedefFlag) { - stateCurrent &= ~typedefFlag; - } - } - // wait and disable statements containing '(' will not contain "fork" keyword, special processing is not needed - if (ch == '(') { - if (stateCurrent & foldWaitDisableFlag) { - stateCurrent &= ~foldWaitDisableFlag; - } - } - } - if (style == SCE_V_OPERATOR) { - if (foldAtBrace) { - if (ch == '{') { - levelNext++; - } else if (ch == '}') { - levelNext--; - } - } - } - if (style == SCE_V_WORD && stylePrev != SCE_V_WORD) { - Sci_PositionU j = i; - if (styler.Match(j, "case") || - styler.Match(j, "casex") || - styler.Match(j, "casez") || - styler.Match(j, "covergroup") || - styler.Match(j, "function") || - styler.Match(j, "generate") || - styler.Match(j, "interface") || - styler.Match(j, "package") || - styler.Match(j, "primitive") || - styler.Match(j, "program") || - styler.Match(j, "sequence") || - styler.Match(j, "specify") || - styler.Match(j, "table") || - styler.Match(j, "task") || - (styler.Match(j, "module") && options.foldAtModule)) { - levelNext++; - } else if (styler.Match(j, "begin")) { - // Measure the minimum before a begin to allow - // folding on "end else begin" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (styler.Match(j, "class")) { - // class does not introduce a block when used in a typedef statement - if (!(stateCurrent & typedefFlag)) - levelNext++; - } else if (styler.Match(j, "fork")) { - // fork does not introduce a block when used in a wait or disable statement - if (stateCurrent & foldWaitDisableFlag) { - stateCurrent &= ~foldWaitDisableFlag; - } else - levelNext++; - } else if (styler.Match(j, "endcase") || - styler.Match(j, "endclass") || - styler.Match(j, "endfunction") || - styler.Match(j, "endgenerate") || - styler.Match(j, "endgroup") || - styler.Match(j, "endinterface") || - styler.Match(j, "endpackage") || - styler.Match(j, "endprimitive") || - styler.Match(j, "endprogram") || - styler.Match(j, "endsequence") || - styler.Match(j, "endspecify") || - styler.Match(j, "endtable") || - styler.Match(j, "endtask") || - styler.Match(j, "join") || - styler.Match(j, "join_any") || - styler.Match(j, "join_none") || - (styler.Match(j, "endmodule") && options.foldAtModule) || - (styler.Match(j, "end") && !IsAWordChar(styler.SafeGetCharAt(j + 3)))) { - levelNext--; - } else if (styler.Match(j, "extern") || - styler.Match(j, "pure")) { - // extern and pure virtual functions/tasks are terminated by ';' not endfunction/endtask - stateCurrent |= foldExternFlag; - } else if (styler.Match(j, "disable") || - styler.Match(j, "wait")) { - // fork does not introduce a block when used in a wait or disable statement - stateCurrent |= foldWaitDisableFlag; - } else if (styler.Match(j, "typedef")) { - stateCurrent |= typedefFlag; - } - } - if (atEOL) { - int levelUse = levelCurrent; - if (options.foldAtElse||options.foldPreprocessorElse) { - levelUse = levelMinCurrent; - } - int lev = levelUse | levelNext << 16; - if (visibleChars == 0 && options.foldCompact) - lev |= SC_FOLDLEVELWHITEFLAG; - if (levelUse < levelNext) - lev |= SC_FOLDLEVELHEADERFLAG; - if (stateCurrent) { - foldState[lineCurrent] = stateCurrent; - } - if (lev != styler.LevelAt(lineCurrent)) { - styler.SetLevel(lineCurrent, lev); - } - lineCurrent++; - levelCurrent = levelNext; - levelMinCurrent = levelCurrent; - visibleChars = 0; - } - if (!isspacechar(ch)) - visibleChars++; - } -} - -std::vector<std::string> LexerVerilog::Tokenize(const std::string &expr) const { - // Break into tokens - std::vector<std::string> tokens; - const char *cp = expr.c_str(); - while (*cp) { - std::string word; - if (setWord.Contains(static_cast<unsigned char>(*cp))) { - // Identifiers and numbers - while (setWord.Contains(static_cast<unsigned char>(*cp))) { - word += *cp; - cp++; - } - } else if (IsSpaceOrTab(*cp)) { - while (IsSpaceOrTab(*cp)) { - cp++; - } - continue; - } else { - // Should handle strings, characters, and comments here - word += *cp; - cp++; - } - tokens.push_back(word); - } - return tokens; -} - -static const char * const verilogWordLists[] = { - "Primary keywords and identifiers", - "Secondary keywords and identifiers", - "System Tasks", - "User defined tasks and identifiers", - "Documentation comment keywords", - "Preprocessor definitions", - 0, - }; - -LexerModule lmVerilog(SCLEX_VERILOG, LexerVerilog::LexerFactoryVerilog, "verilog", verilogWordLists); diff --git a/lexers/LexVisualProlog.cxx b/lexers/LexVisualProlog.cxx deleted file mode 100644 index ba5b222c1..000000000 --- a/lexers/LexVisualProlog.cxx +++ /dev/null @@ -1,513 +0,0 @@ -// Scintilla source code edit control -/** @file LexVisualProlog.cxx -** Lexer for Visual Prolog. -**/ -// Author Thomas Linder Puls, Prolog Development Denter A/S, http://www.visual-prolog.com -// Based on Lexer for C++, C, Java, and JavaScript. -// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -// The line state contains: -// In SCE_VISUALPROLOG_STRING_VERBATIM_EOL (i.e. multiline string literal): The closingQuote. -// else (for SCE_VISUALPROLOG_COMMENT_BLOCK): The comment nesting level - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#ifdef _MSC_VER -#pragma warning(disable: 4786) -#endif - -#include <string> -#include <vector> -#include <map> -#include <algorithm> - -#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 "CharacterCategory.h" -#include "LexerModule.h" -#include "OptionSet.h" -#include "DefaultLexer.h" - -using namespace Scintilla; - -// Options used for LexerVisualProlog -struct OptionsVisualProlog { - OptionsVisualProlog() { - } -}; - -static const char *const visualPrologWordLists[] = { - "Major keywords (class, predicates, ...)", - "Minor keywords (if, then, try, ...)", - "Directive keywords without the '#' (include, requires, ...)", - "Documentation keywords without the '@' (short, detail, ...)", - 0, -}; - -struct OptionSetVisualProlog : public OptionSet<OptionsVisualProlog> { - OptionSetVisualProlog() { - DefineWordListSets(visualPrologWordLists); - } -}; - -class LexerVisualProlog : public DefaultLexer { - WordList majorKeywords; - WordList minorKeywords; - WordList directiveKeywords; - WordList docKeywords; - OptionsVisualProlog options; - OptionSetVisualProlog osVisualProlog; -public: - LexerVisualProlog() : DefaultLexer("visualprolog", SCLEX_VISUALPROLOG) { - } - virtual ~LexerVisualProlog() { - } - void SCI_METHOD Release() override { - delete this; - } - int SCI_METHOD Version() const override { - return lvRelease5; - } - const char * SCI_METHOD PropertyNames() override { - return osVisualProlog.PropertyNames(); - } - int SCI_METHOD PropertyType(const char *name) override { - return osVisualProlog.PropertyType(name); - } - const char * SCI_METHOD DescribeProperty(const char *name) override { - return osVisualProlog.DescribeProperty(name); - } - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; - const char * SCI_METHOD PropertyGet(const char *key) override { - return osVisualProlog.PropertyGet(key); - } - const char * SCI_METHOD DescribeWordListSets() override { - return osVisualProlog.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 *LexerFactoryVisualProlog() { - return new LexerVisualProlog(); - } -}; - -Sci_Position SCI_METHOD LexerVisualProlog::PropertySet(const char *key, const char *val) { - if (osVisualProlog.PropertySet(&options, key, val)) { - return 0; - } - return -1; -} - -Sci_Position SCI_METHOD LexerVisualProlog::WordListSet(int n, const char *wl) { - WordList *wordListN = 0; - switch (n) { - case 0: - wordListN = &majorKeywords; - break; - case 1: - wordListN = &minorKeywords; - break; - case 2: - wordListN = &directiveKeywords; - break; - case 3: - wordListN = &docKeywords; - break; - } - Sci_Position firstModification = -1; - if (wordListN) { - WordList wlNew; - wlNew.Set(wl); - if (*wordListN != wlNew) { - wordListN->Set(wl); - firstModification = 0; - } - } - return firstModification; -} - -// Functor used to truncate history -struct After { - Sci_Position line; - After(Sci_Position line_) : line(line_) {} -}; - -static bool isLowerLetter(int ch){ - return ccLl == CategoriseCharacter(ch); -} - -static bool isUpperLetter(int ch){ - return ccLu == CategoriseCharacter(ch); -} - -static bool isAlphaNum(int ch){ - CharacterCategory cc = CategoriseCharacter(ch); - return (ccLu == cc || ccLl == cc || ccLt == cc || ccLm == cc || ccLo == cc || ccNd == cc || ccNl == cc || ccNo == cc); -} - -static bool isStringVerbatimOpenClose(int ch){ - CharacterCategory cc = CategoriseCharacter(ch); - return (ccPc <= cc && cc <= ccSo); -} - -static bool isIdChar(int ch){ - return ('_') == ch || isAlphaNum(ch); -} - -static bool isOpenStringVerbatim(int next, int &closingQuote){ - switch (next) { - case L'<': - closingQuote = L'>'; - return true; - case L'>': - closingQuote = L'<'; - return true; - case L'(': - closingQuote = L')'; - return true; - case L')': - closingQuote = L'('; - return true; - case L'[': - closingQuote = L']'; - return true; - case L']': - closingQuote = L'['; - return true; - case L'{': - closingQuote = L'}'; - return true; - case L'}': - closingQuote = L'{'; - return true; - case L'_': - case L'.': - case L',': - case L';': - return false; - default: - if (isStringVerbatimOpenClose(next)) { - closingQuote = next; - return true; - } else { - return false; - } - } -} - -// Look ahead to see which colour "end" should have (takes colour after the following keyword) -static void endLookAhead(char s[], LexAccessor &styler, Sci_Position start) { - char ch = styler.SafeGetCharAt(start, '\n'); - while (' ' == ch) { - start++; - ch = styler.SafeGetCharAt(start, '\n'); - } - Sci_Position i = 0; - while (i < 100 && isLowerLetter(ch)){ - s[i] = ch; - i++; - ch = styler.SafeGetCharAt(start + i, '\n'); - } - s[i] = '\0'; -} - -static void forwardEscapeLiteral(StyleContext &sc, int EscapeState) { - sc.Forward(); - if (sc.Match('"') || sc.Match('\'') || sc.Match('\\') || sc.Match('n') || sc.Match('l') || sc.Match('r') || sc.Match('t')) { - sc.ChangeState(EscapeState); - } else if (sc.Match('u')) { - if (IsADigit(sc.chNext, 16)) { - sc.Forward(); - if (IsADigit(sc.chNext, 16)) { - sc.Forward(); - if (IsADigit(sc.chNext, 16)) { - sc.Forward(); - if (IsADigit(sc.chNext, 16)) { - sc.Forward(); - sc.ChangeState(EscapeState); - } - } - } - } - } -} - -void SCI_METHOD LexerVisualProlog::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - LexAccessor styler(pAccess); - CharacterSet setDoxygen(CharacterSet::setAlpha, ""); - CharacterSet setNumber(CharacterSet::setNone, "0123456789abcdefABCDEFxoXO"); - - StyleContext sc(startPos, length, initStyle, styler, 0x7f); - - int styleBeforeDocKeyword = SCE_VISUALPROLOG_DEFAULT; - Sci_Position currentLine = styler.GetLine(startPos); - - int closingQuote = '"'; - int nestLevel = 0; - if (currentLine >= 1) - { - nestLevel = styler.GetLineState(currentLine - 1); - closingQuote = nestLevel; - } - - // Truncate ppDefineHistory before current line - - for (; sc.More(); sc.Forward()) { - - // Determine if the current state should terminate. - switch (sc.state) { - case SCE_VISUALPROLOG_OPERATOR: - sc.SetState(SCE_VISUALPROLOG_DEFAULT); - break; - case SCE_VISUALPROLOG_NUMBER: - // We accept almost anything because of hex. and number suffixes - if (!(setNumber.Contains(sc.ch)) || (sc.Match('.') && IsADigit(sc.chNext))) { - sc.SetState(SCE_VISUALPROLOG_DEFAULT); - } - break; - case SCE_VISUALPROLOG_IDENTIFIER: - if (!isIdChar(sc.ch)) { - char s[1000]; - sc.GetCurrent(s, sizeof(s)); - if (0 == strcmp(s, "end")) { - endLookAhead(s, styler, sc.currentPos); - } - if (majorKeywords.InList(s)) { - sc.ChangeState(SCE_VISUALPROLOG_KEY_MAJOR); - } else if (minorKeywords.InList(s)) { - sc.ChangeState(SCE_VISUALPROLOG_KEY_MINOR); - } - sc.SetState(SCE_VISUALPROLOG_DEFAULT); - } - break; - case SCE_VISUALPROLOG_VARIABLE: - case SCE_VISUALPROLOG_ANONYMOUS: - if (!isIdChar(sc.ch)) { - sc.SetState(SCE_VISUALPROLOG_DEFAULT); - } - break; - case SCE_VISUALPROLOG_KEY_DIRECTIVE: - if (!isLowerLetter(sc.ch)) { - char s[1000]; - sc.GetCurrent(s, sizeof(s)); - if (!directiveKeywords.InList(s+1)) { - sc.ChangeState(SCE_VISUALPROLOG_IDENTIFIER); - } - sc.SetState(SCE_VISUALPROLOG_DEFAULT); - } - break; - case SCE_VISUALPROLOG_COMMENT_BLOCK: - if (sc.Match('*', '/')) { - sc.Forward(); - nestLevel--; - int nextState = (nestLevel == 0) ? SCE_VISUALPROLOG_DEFAULT : SCE_VISUALPROLOG_COMMENT_BLOCK; - sc.ForwardSetState(nextState); - } else if (sc.Match('/', '*')) { - sc.Forward(); - nestLevel++; - } else if (sc.Match('@')) { - styleBeforeDocKeyword = sc.state; - sc.SetState(SCE_VISUALPROLOG_COMMENT_KEY_ERROR); - } - break; - case SCE_VISUALPROLOG_COMMENT_LINE: - if (sc.atLineEnd) { - int nextState = (nestLevel == 0) ? SCE_VISUALPROLOG_DEFAULT : SCE_VISUALPROLOG_COMMENT_BLOCK; - sc.SetState(nextState); - } else if (sc.Match('@')) { - styleBeforeDocKeyword = sc.state; - sc.SetState(SCE_VISUALPROLOG_COMMENT_KEY_ERROR); - } - break; - case SCE_VISUALPROLOG_COMMENT_KEY_ERROR: - if (!setDoxygen.Contains(sc.ch) || sc.atLineEnd) { - char s[1000]; - sc.GetCurrent(s, sizeof(s)); - if (docKeywords.InList(s+1)) { - sc.ChangeState(SCE_VISUALPROLOG_COMMENT_KEY); - } - if (SCE_VISUALPROLOG_COMMENT_LINE == styleBeforeDocKeyword && sc.atLineEnd) { - // end line comment - int nextState = (nestLevel == 0) ? SCE_VISUALPROLOG_DEFAULT : SCE_VISUALPROLOG_COMMENT_BLOCK; - sc.SetState(nextState); - } else { - sc.SetState(styleBeforeDocKeyword); - if (SCE_VISUALPROLOG_COMMENT_BLOCK == styleBeforeDocKeyword && sc.Match('*', '/')) { - // we have consumed the '*' if it comes immediately after the docKeyword - sc.Forward(); - sc.Forward(); - nestLevel--; - if (0 == nestLevel) { - sc.SetState(SCE_VISUALPROLOG_DEFAULT); - } - } - } - } - break; - case SCE_VISUALPROLOG_STRING_ESCAPE: - case SCE_VISUALPROLOG_STRING_ESCAPE_ERROR: - // return to SCE_VISUALPROLOG_STRING and treat as such (fall-through) - sc.SetState(SCE_VISUALPROLOG_STRING); - // Falls through. - case SCE_VISUALPROLOG_STRING: - if (sc.atLineEnd) { - sc.SetState(SCE_VISUALPROLOG_STRING_EOL_OPEN); - } else if (sc.Match(closingQuote)) { - sc.ForwardSetState(SCE_VISUALPROLOG_DEFAULT); - } else if (sc.Match('\\')) { - sc.SetState(SCE_VISUALPROLOG_STRING_ESCAPE_ERROR); - forwardEscapeLiteral(sc, SCE_VISUALPROLOG_STRING_ESCAPE); - } - break; - case SCE_VISUALPROLOG_STRING_EOL_OPEN: - if (sc.atLineStart) { - sc.SetState(SCE_VISUALPROLOG_DEFAULT); - } - break; - case SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL: - case SCE_VISUALPROLOG_STRING_VERBATIM_EOL: - // return to SCE_VISUALPROLOG_STRING_VERBATIM and treat as such (fall-through) - sc.SetState(SCE_VISUALPROLOG_STRING_VERBATIM); - // Falls through. - case SCE_VISUALPROLOG_STRING_VERBATIM: - if (sc.atLineEnd) { - sc.SetState(SCE_VISUALPROLOG_STRING_VERBATIM_EOL); - } else if (sc.Match(closingQuote)) { - if (closingQuote == sc.chNext) { - sc.SetState(SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL); - sc.Forward(); - } else { - sc.ForwardSetState(SCE_VISUALPROLOG_DEFAULT); - } - } - break; - } - - if (sc.atLineEnd) { - // Update the line state, so it can be seen by next line - int lineState = 0; - if (SCE_VISUALPROLOG_STRING_VERBATIM_EOL == sc.state) { - lineState = closingQuote; - } else if (SCE_VISUALPROLOG_COMMENT_BLOCK == sc.state) { - lineState = nestLevel; - } - styler.SetLineState(currentLine, lineState); - currentLine++; - } - - // Determine if a new state should be entered. - if (sc.state == SCE_VISUALPROLOG_DEFAULT) { - if (sc.Match('@') && isOpenStringVerbatim(sc.chNext, closingQuote)) { - sc.SetState(SCE_VISUALPROLOG_STRING_VERBATIM); - sc.Forward(); - } else if (IsADigit(sc.ch) || (sc.Match('.') && IsADigit(sc.chNext))) { - sc.SetState(SCE_VISUALPROLOG_NUMBER); - } else if (isLowerLetter(sc.ch)) { - sc.SetState(SCE_VISUALPROLOG_IDENTIFIER); - } else if (isUpperLetter(sc.ch)) { - sc.SetState(SCE_VISUALPROLOG_VARIABLE); - } else if (sc.Match('_')) { - sc.SetState(SCE_VISUALPROLOG_ANONYMOUS); - } else if (sc.Match('/', '*')) { - sc.SetState(SCE_VISUALPROLOG_COMMENT_BLOCK); - nestLevel = 1; - sc.Forward(); // Eat the * so it isn't used for the end of the comment - } else if (sc.Match('%')) { - sc.SetState(SCE_VISUALPROLOG_COMMENT_LINE); - } else if (sc.Match('\'')) { - closingQuote = '\''; - sc.SetState(SCE_VISUALPROLOG_STRING); - } else if (sc.Match('"')) { - closingQuote = '"'; - sc.SetState(SCE_VISUALPROLOG_STRING); - } else if (sc.Match('#')) { - sc.SetState(SCE_VISUALPROLOG_KEY_DIRECTIVE); - } else if (isoperator(static_cast<char>(sc.ch)) || sc.Match('\\')) { - sc.SetState(SCE_VISUALPROLOG_OPERATOR); - } - } - - } - sc.Complete(); - styler.Flush(); -} - -// 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 LexerVisualProlog::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { - - LexAccessor styler(pAccess); - - Sci_PositionU endPos = startPos + length; - int visibleChars = 0; - Sci_Position currentLine = styler.GetLine(startPos); - int levelCurrent = SC_FOLDLEVELBASE; - if (currentLine > 0) - levelCurrent = styler.LevelAt(currentLine-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); - style = styleNext; - styleNext = styler.StyleAt(i + 1); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (style == SCE_VISUALPROLOG_OPERATOR) { - if (ch == '{') { - // Measure the minimum before a '{' to allow - // folding on "} else {" - if (levelMinCurrent > levelNext) { - levelMinCurrent = levelNext; - } - levelNext++; - } else if (ch == '}') { - levelNext--; - } - } - if (!IsASpace(ch)) - visibleChars++; - if (atEOL || (i == endPos-1)) { - int levelUse = levelCurrent; - int lev = levelUse | levelNext << 16; - if (levelUse < levelNext) - lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(currentLine)) { - styler.SetLevel(currentLine, lev); - } - currentLine++; - levelCurrent = levelNext; - levelMinCurrent = levelCurrent; - if (atEOL && (i == static_cast<Sci_PositionU>(styler.Length()-1))) { - // There is an empty line at end of file so give it same level and empty - styler.SetLevel(currentLine, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); - } - visibleChars = 0; - } - } -} - -LexerModule lmVisualProlog(SCLEX_VISUALPROLOG, LexerVisualProlog::LexerFactoryVisualProlog, "visualprolog", visualPrologWordLists); diff --git a/lexers/LexX12.cxx b/lexers/LexX12.cxx deleted file mode 100644 index 303bcf5d2..000000000 --- a/lexers/LexX12.cxx +++ /dev/null @@ -1,345 +0,0 @@ -// Scintilla Lexer for X12 -// @file LexX12.cxx -// Written by Iain Clarke, IMCSoft & Inobiz AB. -// X12 official documentation is behind a paywall, but there's a description of the syntax here: -// http://www.rawlinsecconsulting.com/x12tutorial/x12syn.html -// 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 <cstdlib> -#include <cassert> -#include <cstring> -#include <cctype> - -#include <vector> -#include <algorithm> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" -#include "LexerModule.h" -#include "DefaultLexer.h" - -using namespace Scintilla; - -class LexerX12 : public DefaultLexer -{ -public: - LexerX12(); - virtual ~LexerX12() {} // virtual destructor, as we inherit from ILexer - - static ILexer5 *Factory() { - return new LexerX12; - } - - int SCI_METHOD Version() const override - { - return lvRelease5; - } - void SCI_METHOD Release() override - { - delete this; - } - - const char * SCI_METHOD PropertyNames() override - { - return "fold"; - } - 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"; - 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; - } - return -1; - } - const char * SCI_METHOD PropertyGet(const char *) override { - return ""; - } - 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: - struct Terminator - { - int Style = SCE_X12_BAD; - Sci_PositionU pos = 0; - Sci_PositionU length = 0; - int FoldChange = 0; - }; - Terminator InitialiseFromISA(IDocument *pAccess); - Sci_PositionU FindPreviousSegmentStart(IDocument *pAccess, Sci_Position startPos) const; - Terminator DetectSegmentHeader(IDocument *pAccess, Sci_PositionU pos) const; - Terminator FindNextTerminator(IDocument *pAccess, Sci_PositionU pos, bool bJustSegmentTerminator = false) const; - - bool m_bFold; - char m_chSubElement; - char m_chElement; - char m_chSegment[3]; // might be CRLF -}; - -LexerModule lmX12(SCLEX_X12, LexerX12::Factory, "x12"); - -/////////////////////////////////////////////////////////////////////////////// - - - -/////////////////////////////////////////////////////////////////////////////// - -LexerX12::LexerX12() : DefaultLexer("x12", SCLEX_X12) -{ - m_bFold = false; - m_chSegment[0] = m_chSegment[1] = m_chSegment[2] = m_chElement = m_chSubElement = 0; -} - -void LexerX12::Lex(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) -{ - Sci_PositionU posFinish = startPos + length; - - Terminator T = InitialiseFromISA(pAccess); - - if (T.Style == SCE_X12_BAD) - { - if (T.pos < startPos) - T.pos = startPos; // we may be colouring in batches. - pAccess->StartStyling(startPos); - pAccess->SetStyleFor(T.pos - startPos, SCE_X12_ENVELOPE); - pAccess->SetStyleFor(posFinish - T.pos, SCE_X12_BAD); - return; - } - - // Look backwards for a segment start or a document beginning - Sci_PositionU posCurrent = FindPreviousSegmentStart (pAccess, startPos); - - // Style buffer, so we're not issuing loads of notifications - pAccess->StartStyling(posCurrent); - - while (posCurrent < posFinish) - { - // Look for first element marker, so we can denote segment - T = DetectSegmentHeader(pAccess, posCurrent); - if (T.Style == SCE_X12_BAD) - break; - - pAccess->SetStyleFor(T.pos - posCurrent, T.Style); - pAccess->SetStyleFor(T.length, SCE_X12_SEP_ELEMENT); - posCurrent = T.pos + T.length; - - while (T.Style != SCE_X12_BAD && T.Style != SCE_X12_SEGMENTEND) // Break on bad or segment ending - { - T = FindNextTerminator(pAccess, posCurrent); - if (T.Style == SCE_X12_BAD) - break; - - int Style = T.Style; - if (T.Style == SCE_X12_SEGMENTEND && m_chSegment[0] == '\r') // don't style cr/crlf - Style = SCE_X12_DEFAULT; - - pAccess->SetStyleFor(T.pos - posCurrent, SCE_X12_DEFAULT); - pAccess->SetStyleFor(T.length, Style); - posCurrent = T.pos + T.length; - } - if (T.Style == SCE_X12_BAD) - break; - } - - pAccess->SetStyleFor(posFinish - posCurrent, SCE_X12_BAD); -} - -void LexerX12::Fold(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) -{ - if (!m_bFold) - return; - - // Are we even foldable? - if (m_chSegment[0] != '\r' && m_chSegment[0] != '\n') // check for cr,lf,cr+lf. - return; - - Sci_PositionU posFinish = startPos + length; - - // Look backwards for a segment start or a document beginning - startPos = FindPreviousSegmentStart(pAccess, startPos); - Terminator T; - - 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_FOLDLEVELBASE - 1); - - while (startPos < posFinish) - { - T = DetectSegmentHeader(pAccess, startPos); - int indentNext = indentCurrent + T.FoldChange; - if (indentNext < 0) - indentNext = 0; - - levelCurrentStyle = (T.FoldChange > 0) ? (SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG) : SC_FOLDLEVELBASE; - - currLine = pAccess->LineFromPosition(startPos); - pAccess->SetLevel(currLine, levelCurrentStyle | indentCurrent); - - T = FindNextTerminator(pAccess, startPos, true); - startPos = T.pos + T.length; - indentCurrent = indentNext; - } -} - -LexerX12::Terminator LexerX12::InitialiseFromISA(IDocument *pAccess) -{ - Sci_Position length = pAccess->Length(); - char c; - if (length <= 106) - return { SCE_X12_BAD, 0 }; - - pAccess->GetCharRange(&m_chElement, 3, 1); - pAccess->GetCharRange(&m_chSubElement, 104, 1); - pAccess->GetCharRange(m_chSegment, 105, 1); - if (m_chSegment[0] == '\r') // are we CRLF? - { - pAccess->GetCharRange(&c, 106, 1); - if (c == '\n') - m_chSegment[1] = c; - } - - // Validate we have an element separator, and it's not silly! - if (m_chElement == '\0' || m_chElement == '\n' || m_chElement == '\r') - return { SCE_X12_BAD, 3 }; - - // Validate we have an element separator, and it's not silly! - if (m_chSubElement == '\0' || m_chSubElement == '\n' || m_chSubElement == '\r') - return { SCE_X12_BAD, 103 }; - - if (m_chElement == m_chSubElement) - return { SCE_X12_BAD, 104 }; - if (m_chElement == m_chSegment[0]) - return { SCE_X12_BAD, 105 }; - if (m_chSubElement == m_chSegment[0]) - return { SCE_X12_BAD, 104 }; - - // Check we have element markers at all the right places! ISA element has fixed entries. - std::vector<Sci_PositionU> ElementMarkers = { 3, 6, 17, 20, 31, 34, 50, 53, 69, 76, 81, 83, 89, 99, 101, 103 }; - for (auto i : ElementMarkers) - { - pAccess->GetCharRange(&c, i, 1); - if (c != m_chElement) - return { SCE_X12_BAD, i }; - } - // Check we have no element markers anywhere else! - for (Sci_PositionU i = 0; i < 105; i++) - { - if (std::find(ElementMarkers.begin(), ElementMarkers.end(), i) != ElementMarkers.end()) - continue; - - pAccess->GetCharRange(&c, i, 1); - if (c == m_chElement) - return { SCE_X12_BAD, i }; - } - - return { SCE_X12_ENVELOPE }; -} - -Sci_PositionU LexerX12::FindPreviousSegmentStart(IDocument *pAccess, Sci_Position startPos) const -{ - char c; - - for ( ; startPos > 0; startPos--) - { - pAccess->GetCharRange(&c, startPos, 1); - if (c != m_chSegment[0]) - continue; - // we've matched one - if this is not crlf we're done. - if (!m_chSegment[1]) - return startPos + 1; - pAccess->GetCharRange(&c, startPos+1, 1); - if (c == m_chSegment[1]) - return startPos + 2; - } - // We didn't find a ', so just go with the beginning - return 0; -} - -LexerX12::Terminator LexerX12::DetectSegmentHeader(IDocument *pAccess, Sci_PositionU pos) const -{ - Sci_PositionU posStart = pos; - Sci_Position Length = pAccess->Length(); - char Buf[6] = { 0 }; - while (pos - posStart < 5 && pos < (Sci_PositionU)Length) - { - pAccess->GetCharRange(Buf + pos - posStart, pos, 1); - if (Buf [pos - posStart] != m_chElement) // more? - { - pos++; - continue; - } - if (strcmp(Buf, "ISA*") == 0) - return { SCE_X12_ENVELOPE, pos, 1, +1 }; - if (strcmp(Buf, "IEA*") == 0) - return { SCE_X12_ENVELOPE, pos, 1, -1 }; - if (strcmp(Buf, "GS*") == 0) - return { SCE_X12_FUNCTIONGROUP, pos, 1, +1 }; - if (strcmp(Buf, "GE*") == 0) - return { SCE_X12_FUNCTIONGROUP, pos, 1, -1 }; - if (strcmp(Buf, "ST*") == 0) - return { SCE_X12_TRANSACTIONSET, pos, 1, +1 }; - if (strcmp(Buf, "SE*") == 0) - return { SCE_X12_TRANSACTIONSET, pos, 1, -1 }; - return { SCE_X12_SEGMENTHEADER, pos, 1, 0 }; - } - return { SCE_X12_BAD, pos, 0, 0 }; -} - -LexerX12::Terminator LexerX12::FindNextTerminator(IDocument *pAccess, Sci_PositionU pos, bool bJustSegmentTerminator) const -{ - char c; - Sci_Position Length = pAccess->Length(); - - while (pos < (Sci_PositionU)Length) - { - pAccess->GetCharRange(&c, pos, 1); - if (!bJustSegmentTerminator && c == m_chElement) - return { SCE_X12_SEP_ELEMENT, pos, 1 }; - else if (!bJustSegmentTerminator && c == m_chSubElement) - return { SCE_X12_SEP_SUBELEMENT, pos, 1 }; - else if (c == m_chSegment[0]) - { - if (!m_chSegment[1]) - return { SCE_X12_SEGMENTEND, pos, 1 }; - pos++; - if (pos >= (Sci_PositionU)Length) - break; - pAccess->GetCharRange(&c, pos, 1); - if (c == m_chSegment[1]) - return { SCE_X12_SEGMENTEND, pos-1, 2 }; - } - pos++; - } - - return { SCE_X12_BAD, pos }; -} diff --git a/lexers/LexYAML.cxx b/lexers/LexYAML.cxx deleted file mode 100644 index 75515603e..000000000 --- a/lexers/LexYAML.cxx +++ /dev/null @@ -1,351 +0,0 @@ -// Scintilla source code edit control -/** @file LexYAML.cxx - ** Lexer for YAML. - **/ -// Copyright 2003- by Sean O'Dell <sean@celsoft.com> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <stdlib.h> -#include <string.h> -#include <stdio.h> -#include <stdarg.h> -#include <assert.h> -#include <ctype.h> - -#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 Scintilla; - -static const char * const yamlWordListDesc[] = { - "Keywords", - 0 -}; - -static inline bool AtEOL(Accessor &styler, Sci_PositionU i) { - return (styler[i] == '\n') || - ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')); -} - -static unsigned int SpaceCount(char* lineBuffer) { - if (lineBuffer == NULL) - return 0; - - char* headBuffer = lineBuffer; - - while (*headBuffer == ' ') - headBuffer++; - - return static_cast<unsigned int>(headBuffer - lineBuffer); -} - -static bool KeywordAtChar(char* lineBuffer, char* startComment, const WordList &keywords) { - if (lineBuffer == NULL || startComment <= lineBuffer) - return false; - char* endValue = startComment - 1; - while (endValue >= lineBuffer && *endValue == ' ') - endValue--; - Sci_PositionU len = static_cast<Sci_PositionU>(endValue - lineBuffer) + 1; - char s[100]; - if (len > (sizeof(s) / sizeof(s[0]) - 1)) - return false; - strncpy(s, lineBuffer, len); - s[len] = '\0'; - return (keywords.InList(s)); -} - -#define YAML_STATE_BITSIZE 16 -#define YAML_STATE_MASK (0xFFFF0000) -#define YAML_STATE_DOCUMENT (1 << YAML_STATE_BITSIZE) -#define YAML_STATE_VALUE (2 << YAML_STATE_BITSIZE) -#define YAML_STATE_COMMENT (3 << YAML_STATE_BITSIZE) -#define YAML_STATE_TEXT_PARENT (4 << YAML_STATE_BITSIZE) -#define YAML_STATE_TEXT (5 << YAML_STATE_BITSIZE) - -static void ColouriseYAMLLine( - char *lineBuffer, - Sci_PositionU currentLine, - Sci_PositionU lengthLine, - Sci_PositionU startLine, - Sci_PositionU endPos, - WordList &keywords, - Accessor &styler) { - - Sci_PositionU i = 0; - bool bInQuotes = false; - unsigned int indentAmount = SpaceCount(lineBuffer); - - if (currentLine > 0) { - int parentLineState = styler.GetLineState(currentLine - 1); - - if ((parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT || (parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT_PARENT) { - unsigned int parentIndentAmount = parentLineState&(~YAML_STATE_MASK); - if (indentAmount > parentIndentAmount) { - styler.SetLineState(currentLine, YAML_STATE_TEXT | parentIndentAmount); - styler.ColourTo(endPos, SCE_YAML_TEXT); - return; - } - } - } - styler.SetLineState(currentLine, 0); - if (strncmp(lineBuffer, "---", 3) == 0 || strncmp(lineBuffer, "...", 3) == 0) { // Document marker - styler.SetLineState(currentLine, YAML_STATE_DOCUMENT); - styler.ColourTo(endPos, SCE_YAML_DOCUMENT); - return; - } - // Skip initial spaces - while ((i < lengthLine) && lineBuffer[i] == ' ') { // YAML always uses space, never TABS or anything else - i++; - } - if (lineBuffer[i] == '\t') { // if we skipped all spaces, and we are NOT inside a text block, this is wrong - styler.ColourTo(endPos, SCE_YAML_ERROR); - return; - } - if (lineBuffer[i] == '#') { // Comment - styler.SetLineState(currentLine, YAML_STATE_COMMENT); - styler.ColourTo(endPos, SCE_YAML_COMMENT); - return; - } - while (i < lengthLine) { - if (lineBuffer[i] == '\'' || lineBuffer[i] == '\"') { - bInQuotes = !bInQuotes; - } else if (lineBuffer[i] == '#' && isspacechar(lineBuffer[i - 1]) && !bInQuotes) { - styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT); - styler.ColourTo(endPos, SCE_YAML_COMMENT); - return; - } else if (lineBuffer[i] == ':' && !bInQuotes) { - styler.ColourTo(startLine + i - 1, SCE_YAML_IDENTIFIER); - styler.ColourTo(startLine + i, SCE_YAML_OPERATOR); - // Non-folding scalar - i++; - while ((i < lengthLine) && isspacechar(lineBuffer[i])) - i++; - Sci_PositionU endValue = lengthLine - 1; - while ((endValue >= i) && isspacechar(lineBuffer[endValue])) - endValue--; - lineBuffer[endValue + 1] = '\0'; - if (lineBuffer[i] == '|' || lineBuffer[i] == '>') { - i++; - if (lineBuffer[i] == '+' || lineBuffer[i] == '-') - i++; - while ((i < lengthLine) && isspacechar(lineBuffer[i])) - i++; - if (lineBuffer[i] == '\0') { - styler.SetLineState(currentLine, YAML_STATE_TEXT_PARENT | indentAmount); - styler.ColourTo(endPos, SCE_YAML_DEFAULT); - return; - } else if (lineBuffer[i] == '#') { - styler.SetLineState(currentLine, YAML_STATE_TEXT_PARENT | indentAmount); - styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT); - styler.ColourTo(endPos, SCE_YAML_COMMENT); - return; - } else { - styler.ColourTo(endPos, SCE_YAML_ERROR); - return; - } - } else if (lineBuffer[i] == '#') { - styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT); - styler.ColourTo(endPos, SCE_YAML_COMMENT); - return; - } - Sci_PositionU startComment = i; - bInQuotes = false; - while (startComment < lengthLine) { // Comment must be space padded - if (lineBuffer[startComment] == '\'' || lineBuffer[startComment] == '\"') - bInQuotes = !bInQuotes; - if (lineBuffer[startComment] == '#' && isspacechar(lineBuffer[startComment - 1]) && !bInQuotes) - break; - startComment++; - } - styler.SetLineState(currentLine, YAML_STATE_VALUE); - if (lineBuffer[i] == '&' || lineBuffer[i] == '*') { - styler.ColourTo(startLine + startComment - 1, SCE_YAML_REFERENCE); - if (startComment < lengthLine) - styler.ColourTo(endPos, SCE_YAML_COMMENT); - return; - } - if (KeywordAtChar(&lineBuffer[i], &lineBuffer[startComment], keywords)) { // Convertible value (true/false, etc.) - styler.ColourTo(startLine + startComment - 1, SCE_YAML_KEYWORD); - if (startComment < lengthLine) - styler.ColourTo(endPos, SCE_YAML_COMMENT); - return; - } - Sci_PositionU i2 = i; - while ((i < startComment) && lineBuffer[i]) { - if (!(IsASCII(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' - && lineBuffer[i] != '.' && lineBuffer[i] != ',' && lineBuffer[i] != ' ') { - styler.ColourTo(startLine + startComment - 1, SCE_YAML_DEFAULT); - if (startComment < lengthLine) - styler.ColourTo(endPos, SCE_YAML_COMMENT); - return; - } - i++; - } - if (i > i2) { - styler.ColourTo(startLine + startComment - 1, SCE_YAML_NUMBER); - if (startComment < lengthLine) - styler.ColourTo(endPos, SCE_YAML_COMMENT); - return; - } - break; // shouldn't get here, but just in case, the rest of the line is coloured the default - } - i++; - } - styler.ColourTo(endPos, SCE_YAML_DEFAULT); -} - -static void ColouriseYAMLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler) { - char lineBuffer[1024] = ""; - styler.StartAt(startPos); - styler.StartSegment(startPos); - Sci_PositionU linePos = 0; - Sci_PositionU startLine = startPos; - Sci_PositionU endPos = startPos + length; - Sci_PositionU maxPos = styler.Length(); - Sci_PositionU lineCurrent = styler.GetLine(startPos); - - for (Sci_PositionU i = startPos; i < maxPos && i < endPos; i++) { - lineBuffer[linePos++] = styler[i]; - if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { - // End of line (or of line buffer) met, colourise it - lineBuffer[linePos] = '\0'; - ColouriseYAMLLine(lineBuffer, lineCurrent, linePos, startLine, i, *keywordLists[0], styler); - linePos = 0; - startLine = i + 1; - lineCurrent++; - } - } - if (linePos > 0) { // Last line does not have ending characters - ColouriseYAMLLine(lineBuffer, lineCurrent, linePos, startLine, startPos + length - 1, *keywordLists[0], styler); - } -} - -static bool IsCommentLine(Sci_Position line, Accessor &styler) { - Sci_Position pos = styler.LineStart(line); - if (styler[pos] == '#') - return true; - return false; -} - -static void FoldYAMLDoc(Sci_PositionU startPos, Sci_Position length, int /*initStyle - unused*/, - WordList *[], Accessor &styler) { - 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 - const bool foldComment = styler.GetPropertyInt("fold.comment.yaml") != 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 unclosed 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 = Maximum(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 ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) - skipLevel = levelBeforeComments; - - int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; - - styler.SetLevel(skipLine, skipLevel | whiteFlag); - } - - // 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; - } - - // 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 lmYAML(SCLEX_YAML, ColouriseYAMLDoc, "yaml", FoldYAMLDoc, yamlWordListDesc); diff --git a/lexilla/scripts/LexillaGen.py b/lexilla/scripts/LexillaGen.py deleted file mode 100644 index c74afcd52..000000000 --- a/lexilla/scripts/LexillaGen.py +++ /dev/null @@ -1,134 +0,0 @@ -#!/usr/bin/env python3 -# LexillaGen.py - implemented 2019 by Neil Hodgson neilh@scintilla.org -# Released to the public domain. - -# Regenerate the Lexilla source files that list all the lexers. -# Should be run whenever a new lexer is added or removed. -# Requires Python 3.6 or later -# Files are regenerated in place with templates stored in comments. -# The format of generation comments is documented in FileGenerator.py. - -import os, pathlib, sys, uuid - -thisPath = pathlib.Path(__file__).resolve() - -sys.path.append(str(thisPath.parent.parent.parent / "scripts")) - -from FileGenerator import Regenerate, UpdateLineInFile, \ - ReplaceREInFile, UpdateLineInPlistFile, ReadFileAsList, UpdateFileFromLines, \ - FindSectionInList -import ScintillaData - -sys.path.append(str(thisPath.parent.parent / "src")) -import DepGen - -# RegenerateXcodeProject and assiciated functions is copied from scintilla/scripts/LexGen.py - -# Last 24 digits of UUID, used for item IDs in Xcode -def uid24(): - return str(uuid.uuid4()).replace("-", "").upper()[-24:] - -def ciLexerKey(a): - return a.split()[2].lower() - - -""" - 11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */; }; - 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexA68k.cxx; path = ../../lexers/LexA68k.cxx; sourceTree = SOURCE_ROOT; }; - 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */, - 11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */, -""" -def RegenerateXcodeProject(path, lexers, lexerReferences): - # Build 4 blocks for insertion: - # Each markers contains a unique section start, an optional wait string, and a section end - - markersPBXBuildFile = ["Begin PBXBuildFile section", "", "End PBXBuildFile section"] - sectionPBXBuildFile = [] - - markersPBXFileReference = ["Begin PBXFileReference section", "", "End PBXFileReference section"] - sectionPBXFileReference = [] - - markersLexers = ["/* Lexers */ =", "children", ");"] - sectionLexers = [] - - markersPBXSourcesBuildPhase = ["Begin PBXSourcesBuildPhase section", "files", ");"] - sectionPBXSourcesBuildPhase = [] - - for lexer in lexers: - if lexer not in lexerReferences: - uid1 = uid24() - uid2 = uid24() - print("Lexer", lexer, "is not in Xcode project. Use IDs", uid1, uid2) - lexerReferences[lexer] = [uid1, uid2] - linePBXBuildFile = "\t\t{} /* {}.cxx in Sources */ = {{isa = PBXBuildFile; fileRef = {} /* {}.cxx */; }};".format(uid1, lexer, uid2, lexer) - linePBXFileReference = "\t\t{} /* {}.cxx */ = {{isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = {}.cxx; path = ../../lexers/{}.cxx; sourceTree = SOURCE_ROOT; }};".format(uid2, lexer, lexer, lexer) - lineLexers = "\t\t\t\t{} /* {}.cxx */,".format(uid2, lexer) - linePBXSourcesBuildPhase = "\t\t\t\t{} /* {}.cxx in Sources */,".format(uid1, lexer) - sectionPBXBuildFile.append(linePBXBuildFile) - sectionPBXFileReference.append(linePBXFileReference) - sectionLexers.append(lineLexers) - sectionPBXSourcesBuildPhase.append(linePBXSourcesBuildPhase) - - lines = ReadFileAsList(path) - - sli = FindSectionInList(lines, markersPBXBuildFile) - lines[sli.stop:sli.stop] = sectionPBXBuildFile - - sli = FindSectionInList(lines, markersPBXFileReference) - lines[sli.stop:sli.stop] = sectionPBXFileReference - - sli = FindSectionInList(lines, markersLexers) - # This section is shown in the project outline so sort it to make it easier to navigate. - allLexers = sorted(lines[sli.start:sli.stop] + sectionLexers, key=ciLexerKey) - lines[sli] = allLexers - - sli = FindSectionInList(lines, markersPBXSourcesBuildPhase) - lines[sli.stop:sli.stop] = sectionPBXSourcesBuildPhase - - UpdateFileFromLines(path, lines, "\n") - -def RegenerateAll(rootDirectory): - - root = pathlib.Path(rootDirectory) - - scintillaBase = root.resolve() - - sci = ScintillaData.ScintillaData(scintillaBase) - - lexillaDir = scintillaBase / "lexilla" - srcDir = lexillaDir / "src" - - Regenerate(srcDir / "Lexilla.cxx", "//", sci.lexerModules) - Regenerate(srcDir / "lexilla.mak", "#", sci.lexFiles) - - # Discover version information - version = (lexillaDir / "version.txt").read_text().strip() - versionDotted = version[0] + '.' + version[1] + '.' + version[2] - versionCommad = versionDotted.replace(".", ", ") + ', 0' - - rcPath = srcDir / "LexillaVersion.rc" - UpdateLineInFile(rcPath, "#define VERSION_LEXILLA", - "#define VERSION_LEXILLA \"" + versionDotted + "\"") - UpdateLineInFile(rcPath, "#define VERSION_WORDS", - "#define VERSION_WORDS " + versionCommad) - - lexillaXcode = lexillaDir / "src" / "Lexilla" - lexillaXcodeProject = lexillaXcode / "Lexilla.xcodeproj" / "project.pbxproj" - - lexerReferences = ScintillaData.FindLexersInXcode(lexillaXcodeProject) - - UpdateLineInPlistFile(lexillaXcode / "Info.plist", - "CFBundleShortVersionString", versionDotted) - - ReplaceREInFile(lexillaXcodeProject, "CURRENT_PROJECT_VERSION = [0-9.]+;", - f'CURRENT_PROJECT_VERSION = {versionDotted};') - - RegenerateXcodeProject(lexillaXcodeProject, sci.lexFiles, lexerReferences) - - currentDirectory = pathlib.Path.cwd() - os.chdir(srcDir) - DepGen.Generate() - os.chdir(currentDirectory) - -if __name__=="__main__": - RegenerateAll(pathlib.Path(__file__).resolve().parent.parent.parent) diff --git a/lexilla/scripts/RunTest.bat b/lexilla/scripts/RunTest.bat deleted file mode 100644 index 5ab853811..000000000 --- a/lexilla/scripts/RunTest.bat +++ /dev/null @@ -1,7 +0,0 @@ -rem Test lexers -rem build lexilla.dll and TestLexers.exe then run TestLexers.exe -cd ../src -make -cd ../test -make -make test diff --git a/lexilla/scripts/RunTest.sh b/lexilla/scripts/RunTest.sh deleted file mode 100644 index 76d7fa66d..000000000 --- a/lexilla/scripts/RunTest.sh +++ /dev/null @@ -1,7 +0,0 @@ -# Test lexers -# build lexilla.so and TestLexers then run TestLexers -cd ../src -make -cd ../test -make -make test diff --git a/lexilla/src/DepGen.py b/lexilla/src/DepGen.py deleted file mode 100644 index 86cbb3bff..000000000 --- a/lexilla/src/DepGen.py +++ /dev/null @@ -1,40 +0,0 @@ -#!/usr/bin/env python3 -# DepGen.py - produce a make dependencies file for Scintilla -# Copyright 2019 by Neil Hodgson <neilh@scintilla.org> -# The License.txt file describes the conditions under which this software may be distributed. -# Requires Python 3.6 or later - -import os, sys - -sys.path.append(os.path.join("..", "..")) - -from scripts import Dependencies - -topComment = "# Created by DepGen.py. To recreate, run DepGen.py.\n" - -def Generate(): - scintilla = os.path.join("..", "..") - lexilla = os.path.join(scintilla, "lexilla") - sources = [ - os.path.join(lexilla, "src", "Lexilla.cxx"), - os.path.join(scintilla, "lexlib", "*.cxx"), - os.path.join(scintilla, "lexers", "*.cxx")] - includes = [ - os.path.join(scintilla, "include"), - os.path.join(scintilla, "src"), - os.path.join(scintilla, "lexlib")] - - # Create the dependencies file for g++ - deps = Dependencies.FindDependencies(sources, includes, ".o", "../lexilla/") - - Dependencies.UpdateDependencies(os.path.join(lexilla, "src", "deps.mak"), deps, topComment) - - # Create the dependencies file for MSVC - - # Place the objects in $(DIR_O) and change extension from ".o" to ".obj" - deps = [["$(DIR_O)/"+Dependencies.PathStem(obj)+".obj", headers] for obj, headers in deps] - - Dependencies.UpdateDependencies(os.path.join(lexilla, "src", "nmdeps.mak"), deps, topComment) - -if __name__ == "__main__": - Generate()
\ No newline at end of file diff --git a/lexilla/src/Lexilla.cxx b/lexilla/src/Lexilla.cxx deleted file mode 100644 index 5a7b7a1f3..000000000 --- a/lexilla/src/Lexilla.cxx +++ /dev/null @@ -1,340 +0,0 @@ -// Scintilla source code edit control -/** @file Lexilla.cxx - ** Lexer infrastructure. - ** Provides entry points to shared library. - **/ -// Copyright 2019 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstring> - -#include <vector> - -#if _WIN32 -#define EXPORT_FUNCTION __declspec(dllexport) -#define CALLING_CONVENTION __stdcall -#else -#define EXPORT_FUNCTION __attribute__((visibility("default"))) -#define CALLING_CONVENTION -#endif - -#include "ILexer.h" - -#include "LexerModule.h" -#include "CatalogueModules.h" - -using namespace Scintilla; - -//++Autogenerated -- run lexilla/scripts/LexillaGen.py to regenerate -//**\(extern LexerModule \*;\n\) -extern LexerModule lmA68k; -extern LexerModule lmAbaqus; -extern LexerModule lmAda; -extern LexerModule lmAPDL; -extern LexerModule lmAs; -extern LexerModule lmAsm; -extern LexerModule lmAsn1; -extern LexerModule lmASY; -extern LexerModule lmAU3; -extern LexerModule lmAVE; -extern LexerModule lmAVS; -extern LexerModule lmBaan; -extern LexerModule lmBash; -extern LexerModule lmBatch; -extern LexerModule lmBibTeX; -extern LexerModule lmBlitzBasic; -extern LexerModule lmBullant; -extern LexerModule lmCaml; -extern LexerModule lmCIL; -extern LexerModule lmClw; -extern LexerModule lmClwNoCase; -extern LexerModule lmCmake; -extern LexerModule lmCOBOL; -extern LexerModule lmCoffeeScript; -extern LexerModule lmConf; -extern LexerModule lmCPP; -extern LexerModule lmCPPNoCase; -extern LexerModule lmCsound; -extern LexerModule lmCss; -extern LexerModule lmD; -extern LexerModule lmDataflex; -extern LexerModule lmDiff; -extern LexerModule lmDMAP; -extern LexerModule lmDMIS; -extern LexerModule lmECL; -extern LexerModule lmEDIFACT; -extern LexerModule lmEiffel; -extern LexerModule lmEiffelkw; -extern LexerModule lmErlang; -extern LexerModule lmErrorList; -extern LexerModule lmESCRIPT; -extern LexerModule lmF77; -extern LexerModule lmFlagShip; -extern LexerModule lmForth; -extern LexerModule lmFortran; -extern LexerModule lmFreeBasic; -extern LexerModule lmGAP; -extern LexerModule lmGui4Cli; -extern LexerModule lmHaskell; -extern LexerModule lmHollywood; -extern LexerModule lmHTML; -extern LexerModule lmIHex; -extern LexerModule lmIndent; -extern LexerModule lmInno; -extern LexerModule lmJSON; -extern LexerModule lmKix; -extern LexerModule lmKVIrc; -extern LexerModule lmLatex; -extern LexerModule lmLISP; -extern LexerModule lmLiterateHaskell; -extern LexerModule lmLot; -extern LexerModule lmLout; -extern LexerModule lmLua; -extern LexerModule lmMagikSF; -extern LexerModule lmMake; -extern LexerModule lmMarkdown; -extern LexerModule lmMatlab; -extern LexerModule lmMaxima; -extern LexerModule lmMETAPOST; -extern LexerModule lmMMIXAL; -extern LexerModule lmModula; -extern LexerModule lmMSSQL; -extern LexerModule lmMySQL; -extern LexerModule lmNim; -extern LexerModule lmNimrod; -extern LexerModule lmNncrontab; -extern LexerModule lmNsis; -extern LexerModule lmNull; -extern LexerModule lmOctave; -extern LexerModule lmOpal; -extern LexerModule lmOScript; -extern LexerModule lmPascal; -extern LexerModule lmPB; -extern LexerModule lmPerl; -extern LexerModule lmPHPSCRIPT; -extern LexerModule lmPLM; -extern LexerModule lmPO; -extern LexerModule lmPOV; -extern LexerModule lmPowerPro; -extern LexerModule lmPowerShell; -extern LexerModule lmProgress; -extern LexerModule lmProps; -extern LexerModule lmPS; -extern LexerModule lmPureBasic; -extern LexerModule lmPython; -extern LexerModule lmR; -extern LexerModule lmRaku; -extern LexerModule lmREBOL; -extern LexerModule lmRegistry; -extern LexerModule lmRuby; -extern LexerModule lmRust; -extern LexerModule lmSAS; -extern LexerModule lmScriptol; -extern LexerModule lmSmalltalk; -extern LexerModule lmSML; -extern LexerModule lmSorc; -extern LexerModule lmSpecman; -extern LexerModule lmSpice; -extern LexerModule lmSQL; -extern LexerModule lmSrec; -extern LexerModule lmStata; -extern LexerModule lmSTTXT; -extern LexerModule lmTACL; -extern LexerModule lmTADS3; -extern LexerModule lmTAL; -extern LexerModule lmTCL; -extern LexerModule lmTCMD; -extern LexerModule lmTEHex; -extern LexerModule lmTeX; -extern LexerModule lmTxt2tags; -extern LexerModule lmVB; -extern LexerModule lmVBScript; -extern LexerModule lmVerilog; -extern LexerModule lmVHDL; -extern LexerModule lmVisualProlog; -extern LexerModule lmX12; -extern LexerModule lmXML; -extern LexerModule lmYAML; - -//--Autogenerated -- end of automatically generated section - -namespace { - -CatalogueModules catalogueLexilla; - -void AddEachLexer() { - - if (catalogueLexilla.Count() > 0) { - return; - } - -//++Autogenerated -- run scripts/LexGen.py to regenerate -//**\(\tcatalogueLexilla.AddLexerModule(&\*);\n\) - catalogueLexilla.AddLexerModule(&lmA68k); - catalogueLexilla.AddLexerModule(&lmAbaqus); - catalogueLexilla.AddLexerModule(&lmAda); - catalogueLexilla.AddLexerModule(&lmAPDL); - catalogueLexilla.AddLexerModule(&lmAs); - catalogueLexilla.AddLexerModule(&lmAsm); - catalogueLexilla.AddLexerModule(&lmAsn1); - catalogueLexilla.AddLexerModule(&lmASY); - catalogueLexilla.AddLexerModule(&lmAU3); - catalogueLexilla.AddLexerModule(&lmAVE); - catalogueLexilla.AddLexerModule(&lmAVS); - catalogueLexilla.AddLexerModule(&lmBaan); - catalogueLexilla.AddLexerModule(&lmBash); - catalogueLexilla.AddLexerModule(&lmBatch); - catalogueLexilla.AddLexerModule(&lmBibTeX); - catalogueLexilla.AddLexerModule(&lmBlitzBasic); - catalogueLexilla.AddLexerModule(&lmBullant); - catalogueLexilla.AddLexerModule(&lmCaml); - catalogueLexilla.AddLexerModule(&lmCIL); - catalogueLexilla.AddLexerModule(&lmClw); - catalogueLexilla.AddLexerModule(&lmClwNoCase); - catalogueLexilla.AddLexerModule(&lmCmake); - catalogueLexilla.AddLexerModule(&lmCOBOL); - catalogueLexilla.AddLexerModule(&lmCoffeeScript); - catalogueLexilla.AddLexerModule(&lmConf); - catalogueLexilla.AddLexerModule(&lmCPP); - catalogueLexilla.AddLexerModule(&lmCPPNoCase); - catalogueLexilla.AddLexerModule(&lmCsound); - catalogueLexilla.AddLexerModule(&lmCss); - catalogueLexilla.AddLexerModule(&lmD); - catalogueLexilla.AddLexerModule(&lmDataflex); - catalogueLexilla.AddLexerModule(&lmDiff); - catalogueLexilla.AddLexerModule(&lmDMAP); - catalogueLexilla.AddLexerModule(&lmDMIS); - catalogueLexilla.AddLexerModule(&lmECL); - catalogueLexilla.AddLexerModule(&lmEDIFACT); - catalogueLexilla.AddLexerModule(&lmEiffel); - catalogueLexilla.AddLexerModule(&lmEiffelkw); - catalogueLexilla.AddLexerModule(&lmErlang); - catalogueLexilla.AddLexerModule(&lmErrorList); - catalogueLexilla.AddLexerModule(&lmESCRIPT); - catalogueLexilla.AddLexerModule(&lmF77); - catalogueLexilla.AddLexerModule(&lmFlagShip); - catalogueLexilla.AddLexerModule(&lmForth); - catalogueLexilla.AddLexerModule(&lmFortran); - catalogueLexilla.AddLexerModule(&lmFreeBasic); - catalogueLexilla.AddLexerModule(&lmGAP); - catalogueLexilla.AddLexerModule(&lmGui4Cli); - catalogueLexilla.AddLexerModule(&lmHaskell); - catalogueLexilla.AddLexerModule(&lmHollywood); - catalogueLexilla.AddLexerModule(&lmHTML); - catalogueLexilla.AddLexerModule(&lmIHex); - catalogueLexilla.AddLexerModule(&lmIndent); - catalogueLexilla.AddLexerModule(&lmInno); - catalogueLexilla.AddLexerModule(&lmJSON); - catalogueLexilla.AddLexerModule(&lmKix); - catalogueLexilla.AddLexerModule(&lmKVIrc); - catalogueLexilla.AddLexerModule(&lmLatex); - catalogueLexilla.AddLexerModule(&lmLISP); - catalogueLexilla.AddLexerModule(&lmLiterateHaskell); - catalogueLexilla.AddLexerModule(&lmLot); - catalogueLexilla.AddLexerModule(&lmLout); - catalogueLexilla.AddLexerModule(&lmLua); - catalogueLexilla.AddLexerModule(&lmMagikSF); - catalogueLexilla.AddLexerModule(&lmMake); - catalogueLexilla.AddLexerModule(&lmMarkdown); - catalogueLexilla.AddLexerModule(&lmMatlab); - catalogueLexilla.AddLexerModule(&lmMaxima); - catalogueLexilla.AddLexerModule(&lmMETAPOST); - catalogueLexilla.AddLexerModule(&lmMMIXAL); - catalogueLexilla.AddLexerModule(&lmModula); - catalogueLexilla.AddLexerModule(&lmMSSQL); - catalogueLexilla.AddLexerModule(&lmMySQL); - catalogueLexilla.AddLexerModule(&lmNim); - catalogueLexilla.AddLexerModule(&lmNimrod); - catalogueLexilla.AddLexerModule(&lmNncrontab); - catalogueLexilla.AddLexerModule(&lmNsis); - catalogueLexilla.AddLexerModule(&lmNull); - catalogueLexilla.AddLexerModule(&lmOctave); - catalogueLexilla.AddLexerModule(&lmOpal); - catalogueLexilla.AddLexerModule(&lmOScript); - catalogueLexilla.AddLexerModule(&lmPascal); - catalogueLexilla.AddLexerModule(&lmPB); - catalogueLexilla.AddLexerModule(&lmPerl); - catalogueLexilla.AddLexerModule(&lmPHPSCRIPT); - catalogueLexilla.AddLexerModule(&lmPLM); - catalogueLexilla.AddLexerModule(&lmPO); - catalogueLexilla.AddLexerModule(&lmPOV); - catalogueLexilla.AddLexerModule(&lmPowerPro); - catalogueLexilla.AddLexerModule(&lmPowerShell); - catalogueLexilla.AddLexerModule(&lmProgress); - catalogueLexilla.AddLexerModule(&lmProps); - catalogueLexilla.AddLexerModule(&lmPS); - catalogueLexilla.AddLexerModule(&lmPureBasic); - catalogueLexilla.AddLexerModule(&lmPython); - catalogueLexilla.AddLexerModule(&lmR); - catalogueLexilla.AddLexerModule(&lmRaku); - catalogueLexilla.AddLexerModule(&lmREBOL); - catalogueLexilla.AddLexerModule(&lmRegistry); - catalogueLexilla.AddLexerModule(&lmRuby); - catalogueLexilla.AddLexerModule(&lmRust); - catalogueLexilla.AddLexerModule(&lmSAS); - catalogueLexilla.AddLexerModule(&lmScriptol); - catalogueLexilla.AddLexerModule(&lmSmalltalk); - catalogueLexilla.AddLexerModule(&lmSML); - catalogueLexilla.AddLexerModule(&lmSorc); - catalogueLexilla.AddLexerModule(&lmSpecman); - catalogueLexilla.AddLexerModule(&lmSpice); - catalogueLexilla.AddLexerModule(&lmSQL); - catalogueLexilla.AddLexerModule(&lmSrec); - catalogueLexilla.AddLexerModule(&lmStata); - catalogueLexilla.AddLexerModule(&lmSTTXT); - catalogueLexilla.AddLexerModule(&lmTACL); - catalogueLexilla.AddLexerModule(&lmTADS3); - catalogueLexilla.AddLexerModule(&lmTAL); - catalogueLexilla.AddLexerModule(&lmTCL); - catalogueLexilla.AddLexerModule(&lmTCMD); - catalogueLexilla.AddLexerModule(&lmTEHex); - catalogueLexilla.AddLexerModule(&lmTeX); - catalogueLexilla.AddLexerModule(&lmTxt2tags); - catalogueLexilla.AddLexerModule(&lmVB); - catalogueLexilla.AddLexerModule(&lmVBScript); - catalogueLexilla.AddLexerModule(&lmVerilog); - catalogueLexilla.AddLexerModule(&lmVHDL); - catalogueLexilla.AddLexerModule(&lmVisualProlog); - catalogueLexilla.AddLexerModule(&lmX12); - catalogueLexilla.AddLexerModule(&lmXML); - catalogueLexilla.AddLexerModule(&lmYAML); - -//--Autogenerated -- end of automatically generated section - -} - -} - -extern "C" { - -EXPORT_FUNCTION int CALLING_CONVENTION GetLexerCount() { - AddEachLexer(); - return catalogueLexilla.Count(); -} - -EXPORT_FUNCTION void CALLING_CONVENTION GetLexerName(unsigned int index, char *name, int buflength) { - AddEachLexer(); - *name = 0; - const char *lexerName = catalogueLexilla.Name(index); - if (static_cast<size_t>(buflength) > strlen(lexerName)) { - strcpy(name, lexerName); - } -} - -EXPORT_FUNCTION LexerFactoryFunction CALLING_CONVENTION GetLexerFactory(unsigned int index) { - AddEachLexer(); - return catalogueLexilla.Factory(index); -} - -EXPORT_FUNCTION ILexer5 * CALLING_CONVENTION CreateLexer(const char *name) { - AddEachLexer(); - for (unsigned int i = 0; i < catalogueLexilla.Count(); i++) { - const char *lexerName = catalogueLexilla.Name(i); - if (0 == strcmp(lexerName, name)) { - return catalogueLexilla.Create(i); - } - } - return nullptr; -} - -} diff --git a/lexilla/src/Lexilla.def b/lexilla/src/Lexilla.def deleted file mode 100644 index 4455c7a82..000000000 --- a/lexilla/src/Lexilla.def +++ /dev/null @@ -1,5 +0,0 @@ -EXPORTS - GetLexerCount - GetLexerName - GetLexerFactory - CreateLexer diff --git a/lexilla/src/Lexilla.h b/lexilla/src/Lexilla.h deleted file mode 100644 index 92b6378c0..000000000 --- a/lexilla/src/Lexilla.h +++ /dev/null @@ -1,19 +0,0 @@ -// Scintilla source code edit control -/** @file Lexilla.h - ** Lexer infrastructure. - ** Declare functions in Lexilla library. - **/ -// Copyright 2019 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#if _WIN32 -#define LEXILLA_CALLING_CONVENTION __stdcall -#else -#define LEXILLA_CALLING_CONVENTION -#endif - -extern "C" { - -Scintilla::ILexer5 * LEXILLA_CALLING_CONVENTION CreateLexer(const char *name); - -} diff --git a/lexilla/src/Lexilla.vcxproj b/lexilla/src/Lexilla.vcxproj deleted file mode 100644 index 7fd055008..000000000 --- a/lexilla/src/Lexilla.vcxproj +++ /dev/null @@ -1,165 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|ARM64">
- <Configuration>Debug</Configuration>
- <Platform>ARM64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|ARM64">
- <Configuration>Release</Configuration>
- <Platform>ARM64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{E541C9BE-13BC-4CE6-A0A4-31145F51A2C1}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>Lexilla</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v141</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <WarningLevel>Level4</WarningLevel>
- <PreprocessorDefinitions>WIN32;SCI_LEXER;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\..\include;..\src;..\..\lexlib;</AdditionalIncludeDirectories>
- <BrowseInformation>true</BrowseInformation>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <MinimalRebuild>false</MinimalRebuild>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>gdi32.lib;imm32.lib;ole32.lib;oleaut32.lib;msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
- <ClCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
- <ClCompile>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\..\lexers\*.cxx" />
- <ClCompile Include="..\..\lexlib\*.cxx" />
- <ClCompile Include="..\src\Lexilla.cxx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\..\include\SciLexer.h" />
- <ClInclude Include="..\src\*.h" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="..\src\LexillaVersion.rc" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file diff --git a/lexilla/src/Lexilla/Info.plist b/lexilla/src/Lexilla/Info.plist deleted file mode 100644 index 9637b2e87..000000000 --- a/lexilla/src/Lexilla/Info.plist +++ /dev/null @@ -1,24 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>CFBundleDevelopmentRegion</key> - <string>$(DEVELOPMENT_LANGUAGE)</string> - <key>CFBundleExecutable</key> - <string>$(EXECUTABLE_NAME)</string> - <key>CFBundleIdentifier</key> - <string>$(PRODUCT_BUNDLE_IDENTIFIER)</string> - <key>CFBundleInfoDictionaryVersion</key> - <string>6.0</string> - <key>CFBundleName</key> - <string>$(PRODUCT_NAME)</string> - <key>CFBundlePackageType</key> - <string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string> - <key>CFBundleShortVersionString</key> - <string>4.4.6</string> - <key>CFBundleVersion</key> - <string>$(CURRENT_PROJECT_VERSION)</string> - <key>NSHumanReadableCopyright</key> - <string>Copyright © 2020 Neil Hodgson. All rights reserved.</string> -</dict> -</plist> diff --git a/lexilla/src/Lexilla/Lexilla.xcodeproj/project.pbxproj b/lexilla/src/Lexilla/Lexilla.xcodeproj/project.pbxproj deleted file mode 100644 index a5d0b8738..000000000 --- a/lexilla/src/Lexilla/Lexilla.xcodeproj/project.pbxproj +++ /dev/null @@ -1,902 +0,0 @@ -// !$*UTF8*$! -{ - archiveVersion = 1; - classes = { - }; - objectVersion = 50; - objects = { - -/* Begin PBXBuildFile section */ - 28BA72AB24E34D5B00272C2D /* LexerBase.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA728F24E34D5A00272C2D /* LexerBase.cxx */; }; - 28BA72AC24E34D5B00272C2D /* LexAccessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729024E34D5A00272C2D /* LexAccessor.h */; }; - 28BA72AD24E34D5B00272C2D /* DefaultLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729124E34D5A00272C2D /* DefaultLexer.h */; }; - 28BA72AE24E34D5B00272C2D /* SubStyles.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729224E34D5A00272C2D /* SubStyles.h */; }; - 28BA72AF24E34D5B00272C2D /* LexerNoExceptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729324E34D5A00272C2D /* LexerNoExceptions.h */; }; - 28BA72B024E34D5B00272C2D /* LexerModule.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729424E34D5A00272C2D /* LexerModule.h */; }; - 28BA72B124E34D5B00272C2D /* CharacterCategory.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA729524E34D5A00272C2D /* CharacterCategory.cxx */; }; - 28BA72B224E34D5B00272C2D /* LexerSimple.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729624E34D5A00272C2D /* LexerSimple.h */; }; - 28BA72B324E34D5B00272C2D /* Accessor.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729724E34D5A00272C2D /* Accessor.h */; }; - 28BA72B424E34D5B00272C2D /* PropSetSimple.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA729824E34D5A00272C2D /* PropSetSimple.cxx */; }; - 28BA72B524E34D5B00272C2D /* CharacterSet.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA729924E34D5A00272C2D /* CharacterSet.cxx */; }; - 28BA72B624E34D5B00272C2D /* SparseState.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729A24E34D5A00272C2D /* SparseState.h */; }; - 28BA72B724E34D5B00272C2D /* WordList.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729B24E34D5A00272C2D /* WordList.h */; }; - 28BA72B824E34D5B00272C2D /* DefaultLexer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA729C24E34D5A00272C2D /* DefaultLexer.cxx */; }; - 28BA72B924E34D5B00272C2D /* LexerNoExceptions.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA729D24E34D5A00272C2D /* LexerNoExceptions.cxx */; }; - 28BA72BA24E34D5B00272C2D /* WordList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA729E24E34D5A00272C2D /* WordList.cxx */; }; - 28BA72BB24E34D5B00272C2D /* OptionSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA729F24E34D5A00272C2D /* OptionSet.h */; }; - 28BA72BC24E34D5B00272C2D /* CatalogueModules.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA72A024E34D5B00272C2D /* CatalogueModules.h */; }; - 28BA72BD24E34D5B00272C2D /* CharacterSet.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA72A124E34D5B00272C2D /* CharacterSet.h */; }; - 28BA72BE24E34D5B00272C2D /* StyleContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA72A224E34D5B00272C2D /* StyleContext.h */; }; - 28BA72BF24E34D5B00272C2D /* PropSetSimple.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA72A324E34D5B00272C2D /* PropSetSimple.h */; }; - 28BA72C024E34D5B00272C2D /* StringCopy.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA72A424E34D5B00272C2D /* StringCopy.h */; }; - 28BA72C124E34D5B00272C2D /* LexerModule.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72A524E34D5B00272C2D /* LexerModule.cxx */; }; - 28BA72C224E34D5B00272C2D /* LexerBase.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA72A624E34D5B00272C2D /* LexerBase.h */; }; - 28BA72C324E34D5B00272C2D /* LexerSimple.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72A724E34D5B00272C2D /* LexerSimple.cxx */; }; - 28BA72C424E34D5B00272C2D /* StyleContext.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72A824E34D5B00272C2D /* StyleContext.cxx */; }; - 28BA72C524E34D5B00272C2D /* CharacterCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA72A924E34D5B00272C2D /* CharacterCategory.h */; }; - 28BA72C624E34D5B00272C2D /* Accessor.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72AA24E34D5B00272C2D /* Accessor.cxx */; }; - 28BA733924E34D9700272C2D /* LexBasic.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72C724E34D9100272C2D /* LexBasic.cxx */; }; - 28BA733A24E34D9700272C2D /* LexCIL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72C824E34D9100272C2D /* LexCIL.cxx */; }; - 28BA733B24E34D9700272C2D /* LexTCL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72C924E34D9100272C2D /* LexTCL.cxx */; }; - 28BA733C24E34D9700272C2D /* LexMetapost.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72CA24E34D9100272C2D /* LexMetapost.cxx */; }; - 28BA733D24E34D9700272C2D /* LexForth.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72CB24E34D9100272C2D /* LexForth.cxx */; }; - 28BA733E24E34D9700272C2D /* LexSML.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72CC24E34D9100272C2D /* LexSML.cxx */; }; - 28BA733F24E34D9700272C2D /* LexOScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72CD24E34D9100272C2D /* LexOScript.cxx */; }; - 28BA734024E34D9700272C2D /* LexTACL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72CE24E34D9100272C2D /* LexTACL.cxx */; }; - 28BA734124E34D9700272C2D /* LexGui4Cli.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72CF24E34D9100272C2D /* LexGui4Cli.cxx */; }; - 28BA734224E34D9700272C2D /* LexCLW.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D024E34D9200272C2D /* LexCLW.cxx */; }; - 28BA734324E34D9700272C2D /* LexRebol.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D124E34D9200272C2D /* LexRebol.cxx */; }; - 28BA734424E34D9700272C2D /* LexSAS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D224E34D9200272C2D /* LexSAS.cxx */; }; - 28BA734524E34D9700272C2D /* LexNim.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D324E34D9200272C2D /* LexNim.cxx */; }; - 28BA734624E34D9700272C2D /* LexSmalltalk.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D424E34D9200272C2D /* LexSmalltalk.cxx */; }; - 28BA734724E34D9700272C2D /* LexModula.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D524E34D9200272C2D /* LexModula.cxx */; }; - 28BA734824E34D9700272C2D /* LexBullant.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D624E34D9200272C2D /* LexBullant.cxx */; }; - 28BA734924E34D9700272C2D /* LexASY.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D724E34D9200272C2D /* LexASY.cxx */; }; - 28BA734A24E34D9700272C2D /* LexBash.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D824E34D9200272C2D /* LexBash.cxx */; }; - 28BA734B24E34D9700272C2D /* LexEiffel.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72D924E34D9200272C2D /* LexEiffel.cxx */; }; - 28BA734C24E34D9700272C2D /* LexVHDL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72DA24E34D9200272C2D /* LexVHDL.cxx */; }; - 28BA734D24E34D9700272C2D /* LexAsn1.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72DB24E34D9200272C2D /* LexAsn1.cxx */; }; - 28BA734E24E34D9700272C2D /* LexCoffeeScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72DC24E34D9200272C2D /* LexCoffeeScript.cxx */; }; - 28BA734F24E34D9700272C2D /* LexDiff.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72DD24E34D9200272C2D /* LexDiff.cxx */; }; - 28BA735024E34D9700272C2D /* LexSorcus.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72DE24E34D9200272C2D /* LexSorcus.cxx */; }; - 28BA735124E34D9700272C2D /* LexAPDL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72DF24E34D9200272C2D /* LexAPDL.cxx */; }; - 28BA735224E34D9700272C2D /* LexD.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E024E34D9200272C2D /* LexD.cxx */; }; - 28BA735324E34D9700272C2D /* LexMySQL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E124E34D9200272C2D /* LexMySQL.cxx */; }; - 28BA735424E34D9700272C2D /* LexHollywood.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E224E34D9200272C2D /* LexHollywood.cxx */; }; - 28BA735524E34D9700272C2D /* LexProgress.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E324E34D9200272C2D /* LexProgress.cxx */; }; - 28BA735624E34D9700272C2D /* LexLisp.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E424E34D9200272C2D /* LexLisp.cxx */; }; - 28BA735724E34D9700272C2D /* LexPowerShell.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E524E34D9200272C2D /* LexPowerShell.cxx */; }; - 28BA735824E34D9700272C2D /* LexPS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E624E34D9200272C2D /* LexPS.cxx */; }; - 28BA735924E34D9700272C2D /* LexYAML.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E724E34D9200272C2D /* LexYAML.cxx */; }; - 28BA735A24E34D9700272C2D /* LexErlang.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E824E34D9200272C2D /* LexErlang.cxx */; }; - 28BA735B24E34D9700272C2D /* LexRuby.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72E924E34D9300272C2D /* LexRuby.cxx */; }; - 28BA735C24E34D9700272C2D /* LexIndent.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72EA24E34D9300272C2D /* LexIndent.cxx */; }; - 28BA735D24E34D9700272C2D /* LexErrorList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72EB24E34D9300272C2D /* LexErrorList.cxx */; }; - 28BA735E24E34D9700272C2D /* LexFlagship.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72EC24E34D9300272C2D /* LexFlagship.cxx */; }; - 28BA735F24E34D9700272C2D /* LexLaTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72ED24E34D9300272C2D /* LexLaTeX.cxx */; }; - 28BA736024E34D9700272C2D /* LexAbaqus.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72EE24E34D9300272C2D /* LexAbaqus.cxx */; }; - 28BA736124E34D9700272C2D /* LexBatch.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72EF24E34D9300272C2D /* LexBatch.cxx */; }; - 28BA736224E34D9700272C2D /* LexCPP.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F024E34D9300272C2D /* LexCPP.cxx */; }; - 28BA736324E34D9700272C2D /* LexRaku.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F124E34D9300272C2D /* LexRaku.cxx */; }; - 28BA736424E34D9700272C2D /* LexGAP.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F224E34D9300272C2D /* LexGAP.cxx */; }; - 28BA736524E34D9700272C2D /* LexSQL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F324E34D9300272C2D /* LexSQL.cxx */; }; - 28BA736624E34D9700272C2D /* LexNsis.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F424E34D9300272C2D /* LexNsis.cxx */; }; - 28BA736724E34D9700272C2D /* LexEDIFACT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F524E34D9300272C2D /* LexEDIFACT.cxx */; }; - 28BA736824E34D9700272C2D /* LexEScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F624E34D9300272C2D /* LexEScript.cxx */; }; - 28BA736924E34D9700272C2D /* LexPOV.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F724E34D9300272C2D /* LexPOV.cxx */; }; - 28BA736A24E34D9700272C2D /* LexKVIrc.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F824E34D9300272C2D /* LexKVIrc.cxx */; }; - 28BA736B24E34D9700272C2D /* LexSpecman.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72F924E34D9300272C2D /* LexSpecman.cxx */; }; - 28BA736C24E34D9700272C2D /* LexHTML.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72FA24E34D9300272C2D /* LexHTML.cxx */; }; - 28BA736D24E34D9700272C2D /* LexFortran.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72FB24E34D9400272C2D /* LexFortran.cxx */; }; - 28BA736E24E34D9700272C2D /* LexRegistry.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72FC24E34D9400272C2D /* LexRegistry.cxx */; }; - 28BA736F24E34D9700272C2D /* LexPython.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72FD24E34D9400272C2D /* LexPython.cxx */; }; - 28BA737024E34D9700272C2D /* LexCmake.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72FE24E34D9400272C2D /* LexCmake.cxx */; }; - 28BA737124E34D9700272C2D /* LexAsm.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA72FF24E34D9400272C2D /* LexAsm.cxx */; }; - 28BA737224E34D9700272C2D /* LexAda.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730024E34D9400272C2D /* LexAda.cxx */; }; - 28BA737324E34D9700272C2D /* LexCrontab.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730124E34D9400272C2D /* LexCrontab.cxx */; }; - 28BA737424E34D9700272C2D /* LexDMIS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730224E34D9400272C2D /* LexDMIS.cxx */; }; - 28BA737524E34D9700272C2D /* LexTCMD.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730324E34D9400272C2D /* LexTCMD.cxx */; }; - 28BA737624E34D9700272C2D /* LexConf.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730424E34D9400272C2D /* LexConf.cxx */; }; - 28BA737724E34D9700272C2D /* LexInno.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730524E34D9400272C2D /* LexInno.cxx */; }; - 28BA737824E34D9700272C2D /* LexA68k.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730624E34D9400272C2D /* LexA68k.cxx */; }; - 28BA737924E34D9700272C2D /* LexMake.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730724E34D9400272C2D /* LexMake.cxx */; }; - 28BA737A24E34D9700272C2D /* LexTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730824E34D9400272C2D /* LexTeX.cxx */; }; - 28BA737B24E34D9700272C2D /* LexSpice.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730924E34D9400272C2D /* LexSpice.cxx */; }; - 28BA737C24E34D9700272C2D /* LexX12.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730A24E34D9400272C2D /* LexX12.cxx */; }; - 28BA737D24E34D9700272C2D /* LexAU3.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730B24E34D9400272C2D /* LexAU3.cxx */; }; - 28BA737E24E34D9700272C2D /* LexBaan.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730C24E34D9400272C2D /* LexBaan.cxx */; }; - 28BA737F24E34D9700272C2D /* LexMPT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730D24E34D9500272C2D /* LexMPT.cxx */; }; - 28BA738024E34D9700272C2D /* LexTADS3.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730E24E34D9500272C2D /* LexTADS3.cxx */; }; - 28BA738124E34D9700272C2D /* LexTxt2tags.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA730F24E34D9500272C2D /* LexTxt2tags.cxx */; }; - 28BA738224E34D9700272C2D /* LexMMIXAL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731024E34D9500272C2D /* LexMMIXAL.cxx */; }; - 28BA738324E34D9700272C2D /* LexKix.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731124E34D9500272C2D /* LexKix.cxx */; }; - 28BA738424E34D9700272C2D /* LexSTTXT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731224E34D9500272C2D /* LexSTTXT.cxx */; }; - 28BA738524E34D9700272C2D /* LexMagik.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731324E34D9500272C2D /* LexMagik.cxx */; }; - 28BA738624E34D9700272C2D /* LexNull.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731424E34D9500272C2D /* LexNull.cxx */; }; - 28BA738724E34D9700272C2D /* LexCsound.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731524E34D9500272C2D /* LexCsound.cxx */; }; - 28BA738824E34D9700272C2D /* LexLua.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731624E34D9500272C2D /* LexLua.cxx */; }; - 28BA738924E34D9700272C2D /* LexStata.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731724E34D9500272C2D /* LexStata.cxx */; }; - 28BA738A24E34D9700272C2D /* LexOpal.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731824E34D9500272C2D /* LexOpal.cxx */; }; - 28BA738B24E34D9700272C2D /* LexHex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731924E34D9500272C2D /* LexHex.cxx */; }; - 28BA738C24E34D9700272C2D /* LexVerilog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731A24E34D9500272C2D /* LexVerilog.cxx */; }; - 28BA738D24E34D9700272C2D /* LexHaskell.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731B24E34D9500272C2D /* LexHaskell.cxx */; }; - 28BA738E24E34D9700272C2D /* LexR.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731C24E34D9500272C2D /* LexR.cxx */; }; - 28BA738F24E34D9700272C2D /* LexScriptol.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731D24E34D9500272C2D /* LexScriptol.cxx */; }; - 28BA739024E34D9700272C2D /* LexVisualProlog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731E24E34D9500272C2D /* LexVisualProlog.cxx */; }; - 28BA739124E34D9700272C2D /* LexVB.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA731F24E34D9600272C2D /* LexVB.cxx */; }; - 28BA739224E34D9700272C2D /* LexDMAP.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732024E34D9600272C2D /* LexDMAP.cxx */; }; - 28BA739324E34D9700272C2D /* LexAVS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732124E34D9600272C2D /* LexAVS.cxx */; }; - 28BA739424E34D9700272C2D /* LexPB.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732224E34D9600272C2D /* LexPB.cxx */; }; - 28BA739524E34D9700272C2D /* LexPO.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732324E34D9600272C2D /* LexPO.cxx */; }; - 28BA739624E34D9700272C2D /* LexPowerPro.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732424E34D9600272C2D /* LexPowerPro.cxx */; }; - 28BA739724E34D9700272C2D /* LexProps.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732524E34D9600272C2D /* LexProps.cxx */; }; - 28BA739824E34D9700272C2D /* LexCOBOL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732624E34D9600272C2D /* LexCOBOL.cxx */; }; - 28BA739924E34D9700272C2D /* LexPLM.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732724E34D9600272C2D /* LexPLM.cxx */; }; - 28BA739A24E34D9700272C2D /* LexMSSQL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732824E34D9600272C2D /* LexMSSQL.cxx */; }; - 28BA739B24E34D9700272C2D /* LexCSS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732924E34D9600272C2D /* LexCSS.cxx */; }; - 28BA739C24E34D9700272C2D /* LexMaxima.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732A24E34D9600272C2D /* LexMaxima.cxx */; }; - 28BA739D24E34D9700272C2D /* LexCaml.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732B24E34D9600272C2D /* LexCaml.cxx */; }; - 28BA739E24E34D9700272C2D /* LexDataflex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732C24E34D9600272C2D /* LexDataflex.cxx */; }; - 28BA739F24E34D9700272C2D /* LexLout.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732D24E34D9600272C2D /* LexLout.cxx */; }; - 28BA73A024E34D9700272C2D /* LexTAL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732E24E34D9600272C2D /* LexTAL.cxx */; }; - 28BA73A124E34D9700272C2D /* LexMarkdown.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA732F24E34D9600272C2D /* LexMarkdown.cxx */; }; - 28BA73A224E34D9700272C2D /* LexJSON.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733024E34D9600272C2D /* LexJSON.cxx */; }; - 28BA73A324E34D9700272C2D /* LexPascal.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733124E34D9700272C2D /* LexPascal.cxx */; }; - 28BA73A424E34D9700272C2D /* LexAVE.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733224E34D9700272C2D /* LexAVE.cxx */; }; - 28BA73A524E34D9700272C2D /* LexECL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733324E34D9700272C2D /* LexECL.cxx */; }; - 28BA73A624E34D9700272C2D /* LexMatlab.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733424E34D9700272C2D /* LexMatlab.cxx */; }; - 28BA73A724E34D9700272C2D /* LexBibTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733524E34D9700272C2D /* LexBibTeX.cxx */; }; - 28BA73A824E34D9700272C2D /* LexNimrod.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733624E34D9700272C2D /* LexNimrod.cxx */; }; - 28BA73A924E34D9700272C2D /* LexPerl.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733724E34D9700272C2D /* LexPerl.cxx */; }; - 28BA73AA24E34D9700272C2D /* LexRust.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA733824E34D9700272C2D /* LexRust.cxx */; }; - 28BA73AD24E34DBC00272C2D /* Lexilla.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BA73AB24E34DBC00272C2D /* Lexilla.h */; }; - 28BA73AE24E34DBC00272C2D /* Lexilla.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BA73AC24E34DBC00272C2D /* Lexilla.cxx */; }; -/* End PBXBuildFile section */ - -/* Begin PBXFileReference section */ - 280262A5246DF655000DF3B8 /* liblexilla.dylib */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.dylib"; includeInIndex = 0; path = liblexilla.dylib; sourceTree = BUILT_PRODUCTS_DIR; }; - 28BA728F24E34D5A00272C2D /* LexerBase.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexerBase.cxx; path = ../../../lexlib/LexerBase.cxx; sourceTree = "<group>"; }; - 28BA729024E34D5A00272C2D /* LexAccessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexAccessor.h; path = ../../../lexlib/LexAccessor.h; sourceTree = "<group>"; }; - 28BA729124E34D5A00272C2D /* DefaultLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefaultLexer.h; path = ../../../lexlib/DefaultLexer.h; sourceTree = "<group>"; }; - 28BA729224E34D5A00272C2D /* SubStyles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SubStyles.h; path = ../../../lexlib/SubStyles.h; sourceTree = "<group>"; }; - 28BA729324E34D5A00272C2D /* LexerNoExceptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexerNoExceptions.h; path = ../../../lexlib/LexerNoExceptions.h; sourceTree = "<group>"; }; - 28BA729424E34D5A00272C2D /* LexerModule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexerModule.h; path = ../../../lexlib/LexerModule.h; sourceTree = "<group>"; }; - 28BA729524E34D5A00272C2D /* CharacterCategory.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterCategory.cxx; path = ../../../lexlib/CharacterCategory.cxx; sourceTree = "<group>"; }; - 28BA729624E34D5A00272C2D /* LexerSimple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexerSimple.h; path = ../../../lexlib/LexerSimple.h; sourceTree = "<group>"; }; - 28BA729724E34D5A00272C2D /* Accessor.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Accessor.h; path = ../../../lexlib/Accessor.h; sourceTree = "<group>"; }; - 28BA729824E34D5A00272C2D /* PropSetSimple.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = PropSetSimple.cxx; path = ../../../lexlib/PropSetSimple.cxx; sourceTree = "<group>"; }; - 28BA729924E34D5A00272C2D /* CharacterSet.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterSet.cxx; path = ../../../lexlib/CharacterSet.cxx; sourceTree = "<group>"; }; - 28BA729A24E34D5A00272C2D /* SparseState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SparseState.h; path = ../../../lexlib/SparseState.h; sourceTree = "<group>"; }; - 28BA729B24E34D5A00272C2D /* WordList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WordList.h; path = ../../../lexlib/WordList.h; sourceTree = "<group>"; }; - 28BA729C24E34D5A00272C2D /* DefaultLexer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DefaultLexer.cxx; path = ../../../lexlib/DefaultLexer.cxx; sourceTree = "<group>"; }; - 28BA729D24E34D5A00272C2D /* LexerNoExceptions.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexerNoExceptions.cxx; path = ../../../lexlib/LexerNoExceptions.cxx; sourceTree = "<group>"; }; - 28BA729E24E34D5A00272C2D /* WordList.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = WordList.cxx; path = ../../../lexlib/WordList.cxx; sourceTree = "<group>"; }; - 28BA729F24E34D5A00272C2D /* OptionSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = OptionSet.h; path = ../../../lexlib/OptionSet.h; sourceTree = "<group>"; }; - 28BA72A024E34D5B00272C2D /* CatalogueModules.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CatalogueModules.h; path = ../../../lexlib/CatalogueModules.h; sourceTree = "<group>"; }; - 28BA72A124E34D5B00272C2D /* CharacterSet.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CharacterSet.h; path = ../../../lexlib/CharacterSet.h; sourceTree = "<group>"; }; - 28BA72A224E34D5B00272C2D /* StyleContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleContext.h; path = ../../../lexlib/StyleContext.h; sourceTree = "<group>"; }; - 28BA72A324E34D5B00272C2D /* PropSetSimple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PropSetSimple.h; path = ../../../lexlib/PropSetSimple.h; sourceTree = "<group>"; }; - 28BA72A424E34D5B00272C2D /* StringCopy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringCopy.h; path = ../../../lexlib/StringCopy.h; sourceTree = "<group>"; }; - 28BA72A524E34D5B00272C2D /* LexerModule.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexerModule.cxx; path = ../../../lexlib/LexerModule.cxx; sourceTree = "<group>"; }; - 28BA72A624E34D5B00272C2D /* LexerBase.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = LexerBase.h; path = ../../../lexlib/LexerBase.h; sourceTree = "<group>"; }; - 28BA72A724E34D5B00272C2D /* LexerSimple.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexerSimple.cxx; path = ../../../lexlib/LexerSimple.cxx; sourceTree = "<group>"; }; - 28BA72A824E34D5B00272C2D /* StyleContext.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = StyleContext.cxx; path = ../../../lexlib/StyleContext.cxx; sourceTree = "<group>"; }; - 28BA72A924E34D5B00272C2D /* CharacterCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CharacterCategory.h; path = ../../../lexlib/CharacterCategory.h; sourceTree = "<group>"; }; - 28BA72AA24E34D5B00272C2D /* Accessor.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Accessor.cxx; path = ../../../lexlib/Accessor.cxx; sourceTree = "<group>"; }; - 28BA72C724E34D9100272C2D /* LexBasic.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBasic.cxx; path = ../../../lexers/LexBasic.cxx; sourceTree = "<group>"; }; - 28BA72C824E34D9100272C2D /* LexCIL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCIL.cxx; path = ../../../lexers/LexCIL.cxx; sourceTree = "<group>"; }; - 28BA72C924E34D9100272C2D /* LexTCL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTCL.cxx; path = ../../../lexers/LexTCL.cxx; sourceTree = "<group>"; }; - 28BA72CA24E34D9100272C2D /* LexMetapost.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMetapost.cxx; path = ../../../lexers/LexMetapost.cxx; sourceTree = "<group>"; }; - 28BA72CB24E34D9100272C2D /* LexForth.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexForth.cxx; path = ../../../lexers/LexForth.cxx; sourceTree = "<group>"; }; - 28BA72CC24E34D9100272C2D /* LexSML.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSML.cxx; path = ../../../lexers/LexSML.cxx; sourceTree = "<group>"; }; - 28BA72CD24E34D9100272C2D /* LexOScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOScript.cxx; path = ../../../lexers/LexOScript.cxx; sourceTree = "<group>"; }; - 28BA72CE24E34D9100272C2D /* LexTACL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTACL.cxx; path = ../../../lexers/LexTACL.cxx; sourceTree = "<group>"; }; - 28BA72CF24E34D9100272C2D /* LexGui4Cli.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexGui4Cli.cxx; path = ../../../lexers/LexGui4Cli.cxx; sourceTree = "<group>"; }; - 28BA72D024E34D9200272C2D /* LexCLW.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCLW.cxx; path = ../../../lexers/LexCLW.cxx; sourceTree = "<group>"; }; - 28BA72D124E34D9200272C2D /* LexRebol.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRebol.cxx; path = ../../../lexers/LexRebol.cxx; sourceTree = "<group>"; }; - 28BA72D224E34D9200272C2D /* LexSAS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSAS.cxx; path = ../../../lexers/LexSAS.cxx; sourceTree = "<group>"; }; - 28BA72D324E34D9200272C2D /* LexNim.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNim.cxx; path = ../../../lexers/LexNim.cxx; sourceTree = "<group>"; }; - 28BA72D424E34D9200272C2D /* LexSmalltalk.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSmalltalk.cxx; path = ../../../lexers/LexSmalltalk.cxx; sourceTree = "<group>"; }; - 28BA72D524E34D9200272C2D /* LexModula.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexModula.cxx; path = ../../../lexers/LexModula.cxx; sourceTree = "<group>"; }; - 28BA72D624E34D9200272C2D /* LexBullant.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBullant.cxx; path = ../../../lexers/LexBullant.cxx; sourceTree = "<group>"; }; - 28BA72D724E34D9200272C2D /* LexASY.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexASY.cxx; path = ../../../lexers/LexASY.cxx; sourceTree = "<group>"; }; - 28BA72D824E34D9200272C2D /* LexBash.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBash.cxx; path = ../../../lexers/LexBash.cxx; sourceTree = "<group>"; }; - 28BA72D924E34D9200272C2D /* LexEiffel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexEiffel.cxx; path = ../../../lexers/LexEiffel.cxx; sourceTree = "<group>"; }; - 28BA72DA24E34D9200272C2D /* LexVHDL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVHDL.cxx; path = ../../../lexers/LexVHDL.cxx; sourceTree = "<group>"; }; - 28BA72DB24E34D9200272C2D /* LexAsn1.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAsn1.cxx; path = ../../../lexers/LexAsn1.cxx; sourceTree = "<group>"; }; - 28BA72DC24E34D9200272C2D /* LexCoffeeScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCoffeeScript.cxx; path = ../../../lexers/LexCoffeeScript.cxx; sourceTree = "<group>"; }; - 28BA72DD24E34D9200272C2D /* LexDiff.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDiff.cxx; path = ../../../lexers/LexDiff.cxx; sourceTree = "<group>"; }; - 28BA72DE24E34D9200272C2D /* LexSorcus.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSorcus.cxx; path = ../../../lexers/LexSorcus.cxx; sourceTree = "<group>"; }; - 28BA72DF24E34D9200272C2D /* LexAPDL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAPDL.cxx; path = ../../../lexers/LexAPDL.cxx; sourceTree = "<group>"; }; - 28BA72E024E34D9200272C2D /* LexD.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexD.cxx; path = ../../../lexers/LexD.cxx; sourceTree = "<group>"; }; - 28BA72E124E34D9200272C2D /* LexMySQL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMySQL.cxx; path = ../../../lexers/LexMySQL.cxx; sourceTree = "<group>"; }; - 28BA72E224E34D9200272C2D /* LexHollywood.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHollywood.cxx; path = ../../../lexers/LexHollywood.cxx; sourceTree = "<group>"; }; - 28BA72E324E34D9200272C2D /* LexProgress.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexProgress.cxx; path = ../../../lexers/LexProgress.cxx; sourceTree = "<group>"; }; - 28BA72E424E34D9200272C2D /* LexLisp.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLisp.cxx; path = ../../../lexers/LexLisp.cxx; sourceTree = "<group>"; }; - 28BA72E524E34D9200272C2D /* LexPowerShell.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPowerShell.cxx; path = ../../../lexers/LexPowerShell.cxx; sourceTree = "<group>"; }; - 28BA72E624E34D9200272C2D /* LexPS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPS.cxx; path = ../../../lexers/LexPS.cxx; sourceTree = "<group>"; }; - 28BA72E724E34D9200272C2D /* LexYAML.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexYAML.cxx; path = ../../../lexers/LexYAML.cxx; sourceTree = "<group>"; }; - 28BA72E824E34D9200272C2D /* LexErlang.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexErlang.cxx; path = ../../../lexers/LexErlang.cxx; sourceTree = "<group>"; }; - 28BA72E924E34D9300272C2D /* LexRuby.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRuby.cxx; path = ../../../lexers/LexRuby.cxx; sourceTree = "<group>"; }; - 28BA72EA24E34D9300272C2D /* LexIndent.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexIndent.cxx; path = ../../../lexers/LexIndent.cxx; sourceTree = "<group>"; }; - 28BA72EB24E34D9300272C2D /* LexErrorList.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexErrorList.cxx; path = ../../../lexers/LexErrorList.cxx; sourceTree = "<group>"; }; - 28BA72EC24E34D9300272C2D /* LexFlagship.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexFlagship.cxx; path = ../../../lexers/LexFlagship.cxx; sourceTree = "<group>"; }; - 28BA72ED24E34D9300272C2D /* LexLaTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLaTeX.cxx; path = ../../../lexers/LexLaTeX.cxx; sourceTree = "<group>"; }; - 28BA72EE24E34D9300272C2D /* LexAbaqus.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAbaqus.cxx; path = ../../../lexers/LexAbaqus.cxx; sourceTree = "<group>"; }; - 28BA72EF24E34D9300272C2D /* LexBatch.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBatch.cxx; path = ../../../lexers/LexBatch.cxx; sourceTree = "<group>"; }; - 28BA72F024E34D9300272C2D /* LexCPP.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCPP.cxx; path = ../../../lexers/LexCPP.cxx; sourceTree = "<group>"; }; - 28BA72F124E34D9300272C2D /* LexRaku.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRaku.cxx; path = ../../../lexers/LexRaku.cxx; sourceTree = "<group>"; }; - 28BA72F224E34D9300272C2D /* LexGAP.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexGAP.cxx; path = ../../../lexers/LexGAP.cxx; sourceTree = "<group>"; }; - 28BA72F324E34D9300272C2D /* LexSQL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSQL.cxx; path = ../../../lexers/LexSQL.cxx; sourceTree = "<group>"; }; - 28BA72F424E34D9300272C2D /* LexNsis.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNsis.cxx; path = ../../../lexers/LexNsis.cxx; sourceTree = "<group>"; }; - 28BA72F524E34D9300272C2D /* LexEDIFACT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexEDIFACT.cxx; path = ../../../lexers/LexEDIFACT.cxx; sourceTree = "<group>"; }; - 28BA72F624E34D9300272C2D /* LexEScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexEScript.cxx; path = ../../../lexers/LexEScript.cxx; sourceTree = "<group>"; }; - 28BA72F724E34D9300272C2D /* LexPOV.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPOV.cxx; path = ../../../lexers/LexPOV.cxx; sourceTree = "<group>"; }; - 28BA72F824E34D9300272C2D /* LexKVIrc.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexKVIrc.cxx; path = ../../../lexers/LexKVIrc.cxx; sourceTree = "<group>"; }; - 28BA72F924E34D9300272C2D /* LexSpecman.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSpecman.cxx; path = ../../../lexers/LexSpecman.cxx; sourceTree = "<group>"; }; - 28BA72FA24E34D9300272C2D /* LexHTML.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHTML.cxx; path = ../../../lexers/LexHTML.cxx; sourceTree = "<group>"; }; - 28BA72FB24E34D9400272C2D /* LexFortran.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexFortran.cxx; path = ../../../lexers/LexFortran.cxx; sourceTree = "<group>"; }; - 28BA72FC24E34D9400272C2D /* LexRegistry.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRegistry.cxx; path = ../../../lexers/LexRegistry.cxx; sourceTree = "<group>"; }; - 28BA72FD24E34D9400272C2D /* LexPython.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPython.cxx; path = ../../../lexers/LexPython.cxx; sourceTree = "<group>"; }; - 28BA72FE24E34D9400272C2D /* LexCmake.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCmake.cxx; path = ../../../lexers/LexCmake.cxx; sourceTree = "<group>"; }; - 28BA72FF24E34D9400272C2D /* LexAsm.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAsm.cxx; path = ../../../lexers/LexAsm.cxx; sourceTree = "<group>"; }; - 28BA730024E34D9400272C2D /* LexAda.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAda.cxx; path = ../../../lexers/LexAda.cxx; sourceTree = "<group>"; }; - 28BA730124E34D9400272C2D /* LexCrontab.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCrontab.cxx; path = ../../../lexers/LexCrontab.cxx; sourceTree = "<group>"; }; - 28BA730224E34D9400272C2D /* LexDMIS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMIS.cxx; path = ../../../lexers/LexDMIS.cxx; sourceTree = "<group>"; }; - 28BA730324E34D9400272C2D /* LexTCMD.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTCMD.cxx; path = ../../../lexers/LexTCMD.cxx; sourceTree = "<group>"; }; - 28BA730424E34D9400272C2D /* LexConf.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexConf.cxx; path = ../../../lexers/LexConf.cxx; sourceTree = "<group>"; }; - 28BA730524E34D9400272C2D /* LexInno.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexInno.cxx; path = ../../../lexers/LexInno.cxx; sourceTree = "<group>"; }; - 28BA730624E34D9400272C2D /* LexA68k.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexA68k.cxx; path = ../../../lexers/LexA68k.cxx; sourceTree = "<group>"; }; - 28BA730724E34D9400272C2D /* LexMake.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMake.cxx; path = ../../../lexers/LexMake.cxx; sourceTree = "<group>"; }; - 28BA730824E34D9400272C2D /* LexTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTeX.cxx; path = ../../../lexers/LexTeX.cxx; sourceTree = "<group>"; }; - 28BA730924E34D9400272C2D /* LexSpice.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSpice.cxx; path = ../../../lexers/LexSpice.cxx; sourceTree = "<group>"; }; - 28BA730A24E34D9400272C2D /* LexX12.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexX12.cxx; path = ../../../lexers/LexX12.cxx; sourceTree = "<group>"; }; - 28BA730B24E34D9400272C2D /* LexAU3.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAU3.cxx; path = ../../../lexers/LexAU3.cxx; sourceTree = "<group>"; }; - 28BA730C24E34D9400272C2D /* LexBaan.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBaan.cxx; path = ../../../lexers/LexBaan.cxx; sourceTree = "<group>"; }; - 28BA730D24E34D9500272C2D /* LexMPT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMPT.cxx; path = ../../../lexers/LexMPT.cxx; sourceTree = "<group>"; }; - 28BA730E24E34D9500272C2D /* LexTADS3.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTADS3.cxx; path = ../../../lexers/LexTADS3.cxx; sourceTree = "<group>"; }; - 28BA730F24E34D9500272C2D /* LexTxt2tags.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTxt2tags.cxx; path = ../../../lexers/LexTxt2tags.cxx; sourceTree = "<group>"; }; - 28BA731024E34D9500272C2D /* LexMMIXAL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMMIXAL.cxx; path = ../../../lexers/LexMMIXAL.cxx; sourceTree = "<group>"; }; - 28BA731124E34D9500272C2D /* LexKix.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexKix.cxx; path = ../../../lexers/LexKix.cxx; sourceTree = "<group>"; }; - 28BA731224E34D9500272C2D /* LexSTTXT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSTTXT.cxx; path = ../../../lexers/LexSTTXT.cxx; sourceTree = "<group>"; }; - 28BA731324E34D9500272C2D /* LexMagik.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMagik.cxx; path = ../../../lexers/LexMagik.cxx; sourceTree = "<group>"; }; - 28BA731424E34D9500272C2D /* LexNull.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNull.cxx; path = ../../../lexers/LexNull.cxx; sourceTree = "<group>"; }; - 28BA731524E34D9500272C2D /* LexCsound.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCsound.cxx; path = ../../../lexers/LexCsound.cxx; sourceTree = "<group>"; }; - 28BA731624E34D9500272C2D /* LexLua.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLua.cxx; path = ../../../lexers/LexLua.cxx; sourceTree = "<group>"; }; - 28BA731724E34D9500272C2D /* LexStata.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexStata.cxx; path = ../../../lexers/LexStata.cxx; sourceTree = "<group>"; }; - 28BA731824E34D9500272C2D /* LexOpal.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOpal.cxx; path = ../../../lexers/LexOpal.cxx; sourceTree = "<group>"; }; - 28BA731924E34D9500272C2D /* LexHex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHex.cxx; path = ../../../lexers/LexHex.cxx; sourceTree = "<group>"; }; - 28BA731A24E34D9500272C2D /* LexVerilog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVerilog.cxx; path = ../../../lexers/LexVerilog.cxx; sourceTree = "<group>"; }; - 28BA731B24E34D9500272C2D /* LexHaskell.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHaskell.cxx; path = ../../../lexers/LexHaskell.cxx; sourceTree = "<group>"; }; - 28BA731C24E34D9500272C2D /* LexR.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexR.cxx; path = ../../../lexers/LexR.cxx; sourceTree = "<group>"; }; - 28BA731D24E34D9500272C2D /* LexScriptol.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexScriptol.cxx; path = ../../../lexers/LexScriptol.cxx; sourceTree = "<group>"; }; - 28BA731E24E34D9500272C2D /* LexVisualProlog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVisualProlog.cxx; path = ../../../lexers/LexVisualProlog.cxx; sourceTree = "<group>"; }; - 28BA731F24E34D9600272C2D /* LexVB.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVB.cxx; path = ../../../lexers/LexVB.cxx; sourceTree = "<group>"; }; - 28BA732024E34D9600272C2D /* LexDMAP.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMAP.cxx; path = ../../../lexers/LexDMAP.cxx; sourceTree = "<group>"; }; - 28BA732124E34D9600272C2D /* LexAVS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAVS.cxx; path = ../../../lexers/LexAVS.cxx; sourceTree = "<group>"; }; - 28BA732224E34D9600272C2D /* LexPB.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPB.cxx; path = ../../../lexers/LexPB.cxx; sourceTree = "<group>"; }; - 28BA732324E34D9600272C2D /* LexPO.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPO.cxx; path = ../../../lexers/LexPO.cxx; sourceTree = "<group>"; }; - 28BA732424E34D9600272C2D /* LexPowerPro.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPowerPro.cxx; path = ../../../lexers/LexPowerPro.cxx; sourceTree = "<group>"; }; - 28BA732524E34D9600272C2D /* LexProps.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexProps.cxx; path = ../../../lexers/LexProps.cxx; sourceTree = "<group>"; }; - 28BA732624E34D9600272C2D /* LexCOBOL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCOBOL.cxx; path = ../../../lexers/LexCOBOL.cxx; sourceTree = "<group>"; }; - 28BA732724E34D9600272C2D /* LexPLM.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPLM.cxx; path = ../../../lexers/LexPLM.cxx; sourceTree = "<group>"; }; - 28BA732824E34D9600272C2D /* LexMSSQL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMSSQL.cxx; path = ../../../lexers/LexMSSQL.cxx; sourceTree = "<group>"; }; - 28BA732924E34D9600272C2D /* LexCSS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCSS.cxx; path = ../../../lexers/LexCSS.cxx; sourceTree = "<group>"; }; - 28BA732A24E34D9600272C2D /* LexMaxima.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMaxima.cxx; path = ../../../lexers/LexMaxima.cxx; sourceTree = "<group>"; }; - 28BA732B24E34D9600272C2D /* LexCaml.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCaml.cxx; path = ../../../lexers/LexCaml.cxx; sourceTree = "<group>"; }; - 28BA732C24E34D9600272C2D /* LexDataflex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDataflex.cxx; path = ../../../lexers/LexDataflex.cxx; sourceTree = "<group>"; }; - 28BA732D24E34D9600272C2D /* LexLout.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLout.cxx; path = ../../../lexers/LexLout.cxx; sourceTree = "<group>"; }; - 28BA732E24E34D9600272C2D /* LexTAL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTAL.cxx; path = ../../../lexers/LexTAL.cxx; sourceTree = "<group>"; }; - 28BA732F24E34D9600272C2D /* LexMarkdown.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMarkdown.cxx; path = ../../../lexers/LexMarkdown.cxx; sourceTree = "<group>"; }; - 28BA733024E34D9600272C2D /* LexJSON.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexJSON.cxx; path = ../../../lexers/LexJSON.cxx; sourceTree = "<group>"; }; - 28BA733124E34D9700272C2D /* LexPascal.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPascal.cxx; path = ../../../lexers/LexPascal.cxx; sourceTree = "<group>"; }; - 28BA733224E34D9700272C2D /* LexAVE.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAVE.cxx; path = ../../../lexers/LexAVE.cxx; sourceTree = "<group>"; }; - 28BA733324E34D9700272C2D /* LexECL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexECL.cxx; path = ../../../lexers/LexECL.cxx; sourceTree = "<group>"; }; - 28BA733424E34D9700272C2D /* LexMatlab.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMatlab.cxx; path = ../../../lexers/LexMatlab.cxx; sourceTree = "<group>"; }; - 28BA733524E34D9700272C2D /* LexBibTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBibTeX.cxx; path = ../../../lexers/LexBibTeX.cxx; sourceTree = "<group>"; }; - 28BA733624E34D9700272C2D /* LexNimrod.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNimrod.cxx; path = ../../../lexers/LexNimrod.cxx; sourceTree = "<group>"; }; - 28BA733724E34D9700272C2D /* LexPerl.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPerl.cxx; path = ../../../lexers/LexPerl.cxx; sourceTree = "<group>"; }; - 28BA733824E34D9700272C2D /* LexRust.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRust.cxx; path = ../../../lexers/LexRust.cxx; sourceTree = "<group>"; }; - 28BA73AB24E34DBC00272C2D /* Lexilla.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Lexilla.h; path = ../Lexilla.h; sourceTree = "<group>"; }; - 28BA73AC24E34DBC00272C2D /* Lexilla.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = Lexilla.cxx; path = ../Lexilla.cxx; sourceTree = "<group>"; }; - 28BA73B024E3510900272C2D /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; }; -/* End PBXFileReference section */ - -/* Begin PBXFrameworksBuildPhase section */ - 280262A3246DF655000DF3B8 /* Frameworks */ = { - isa = PBXFrameworksBuildPhase; - buildActionMask = 2147483647; - files = ( - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXFrameworksBuildPhase section */ - -/* Begin PBXGroup section */ - 2802629C246DF655000DF3B8 = { - isa = PBXGroup; - children = ( - 28BA73B024E3510900272C2D /* Info.plist */, - 280262B8246DF776000DF3B8 /* LexLib */, - 280262B7246DF765000DF3B8 /* Lexers */, - 280262A7246DF655000DF3B8 /* Lexilla */, - 280262A6246DF655000DF3B8 /* Products */, - ); - sourceTree = "<group>"; - }; - 280262A6246DF655000DF3B8 /* Products */ = { - isa = PBXGroup; - children = ( - 280262A5246DF655000DF3B8 /* liblexilla.dylib */, - ); - name = Products; - sourceTree = "<group>"; - }; - 280262A7246DF655000DF3B8 /* Lexilla */ = { - isa = PBXGroup; - children = ( - 28BA73AC24E34DBC00272C2D /* Lexilla.cxx */, - 28BA73AB24E34DBC00272C2D /* Lexilla.h */, - ); - name = Lexilla; - sourceTree = "<group>"; - }; - 280262B7246DF765000DF3B8 /* Lexers */ = { - isa = PBXGroup; - children = ( - 28BA730624E34D9400272C2D /* LexA68k.cxx */, - 28BA72EE24E34D9300272C2D /* LexAbaqus.cxx */, - 28BA730024E34D9400272C2D /* LexAda.cxx */, - 28BA72DF24E34D9200272C2D /* LexAPDL.cxx */, - 28BA72FF24E34D9400272C2D /* LexAsm.cxx */, - 28BA72DB24E34D9200272C2D /* LexAsn1.cxx */, - 28BA72D724E34D9200272C2D /* LexASY.cxx */, - 28BA730B24E34D9400272C2D /* LexAU3.cxx */, - 28BA733224E34D9700272C2D /* LexAVE.cxx */, - 28BA732124E34D9600272C2D /* LexAVS.cxx */, - 28BA730C24E34D9400272C2D /* LexBaan.cxx */, - 28BA72D824E34D9200272C2D /* LexBash.cxx */, - 28BA72C724E34D9100272C2D /* LexBasic.cxx */, - 28BA72EF24E34D9300272C2D /* LexBatch.cxx */, - 28BA733524E34D9700272C2D /* LexBibTeX.cxx */, - 28BA72D624E34D9200272C2D /* LexBullant.cxx */, - 28BA732B24E34D9600272C2D /* LexCaml.cxx */, - 28BA72C824E34D9100272C2D /* LexCIL.cxx */, - 28BA72D024E34D9200272C2D /* LexCLW.cxx */, - 28BA72FE24E34D9400272C2D /* LexCmake.cxx */, - 28BA732624E34D9600272C2D /* LexCOBOL.cxx */, - 28BA72DC24E34D9200272C2D /* LexCoffeeScript.cxx */, - 28BA730424E34D9400272C2D /* LexConf.cxx */, - 28BA72F024E34D9300272C2D /* LexCPP.cxx */, - 28BA730124E34D9400272C2D /* LexCrontab.cxx */, - 28BA731524E34D9500272C2D /* LexCsound.cxx */, - 28BA732924E34D9600272C2D /* LexCSS.cxx */, - 28BA72E024E34D9200272C2D /* LexD.cxx */, - 28BA732C24E34D9600272C2D /* LexDataflex.cxx */, - 28BA72DD24E34D9200272C2D /* LexDiff.cxx */, - 28BA732024E34D9600272C2D /* LexDMAP.cxx */, - 28BA730224E34D9400272C2D /* LexDMIS.cxx */, - 28BA733324E34D9700272C2D /* LexECL.cxx */, - 28BA72F524E34D9300272C2D /* LexEDIFACT.cxx */, - 28BA72D924E34D9200272C2D /* LexEiffel.cxx */, - 28BA72E824E34D9200272C2D /* LexErlang.cxx */, - 28BA72EB24E34D9300272C2D /* LexErrorList.cxx */, - 28BA72F624E34D9300272C2D /* LexEScript.cxx */, - 28BA72EC24E34D9300272C2D /* LexFlagship.cxx */, - 28BA72CB24E34D9100272C2D /* LexForth.cxx */, - 28BA72FB24E34D9400272C2D /* LexFortran.cxx */, - 28BA72F224E34D9300272C2D /* LexGAP.cxx */, - 28BA72CF24E34D9100272C2D /* LexGui4Cli.cxx */, - 28BA731B24E34D9500272C2D /* LexHaskell.cxx */, - 28BA731924E34D9500272C2D /* LexHex.cxx */, - 28BA72E224E34D9200272C2D /* LexHollywood.cxx */, - 28BA72FA24E34D9300272C2D /* LexHTML.cxx */, - 28BA72EA24E34D9300272C2D /* LexIndent.cxx */, - 28BA730524E34D9400272C2D /* LexInno.cxx */, - 28BA733024E34D9600272C2D /* LexJSON.cxx */, - 28BA731124E34D9500272C2D /* LexKix.cxx */, - 28BA72F824E34D9300272C2D /* LexKVIrc.cxx */, - 28BA72ED24E34D9300272C2D /* LexLaTeX.cxx */, - 28BA72E424E34D9200272C2D /* LexLisp.cxx */, - 28BA732D24E34D9600272C2D /* LexLout.cxx */, - 28BA731624E34D9500272C2D /* LexLua.cxx */, - 28BA731324E34D9500272C2D /* LexMagik.cxx */, - 28BA730724E34D9400272C2D /* LexMake.cxx */, - 28BA732F24E34D9600272C2D /* LexMarkdown.cxx */, - 28BA733424E34D9700272C2D /* LexMatlab.cxx */, - 28BA732A24E34D9600272C2D /* LexMaxima.cxx */, - 28BA72CA24E34D9100272C2D /* LexMetapost.cxx */, - 28BA731024E34D9500272C2D /* LexMMIXAL.cxx */, - 28BA72D524E34D9200272C2D /* LexModula.cxx */, - 28BA730D24E34D9500272C2D /* LexMPT.cxx */, - 28BA732824E34D9600272C2D /* LexMSSQL.cxx */, - 28BA72E124E34D9200272C2D /* LexMySQL.cxx */, - 28BA72D324E34D9200272C2D /* LexNim.cxx */, - 28BA733624E34D9700272C2D /* LexNimrod.cxx */, - 28BA72F424E34D9300272C2D /* LexNsis.cxx */, - 28BA731424E34D9500272C2D /* LexNull.cxx */, - 28BA731824E34D9500272C2D /* LexOpal.cxx */, - 28BA72CD24E34D9100272C2D /* LexOScript.cxx */, - 28BA733124E34D9700272C2D /* LexPascal.cxx */, - 28BA732224E34D9600272C2D /* LexPB.cxx */, - 28BA733724E34D9700272C2D /* LexPerl.cxx */, - 28BA732724E34D9600272C2D /* LexPLM.cxx */, - 28BA732324E34D9600272C2D /* LexPO.cxx */, - 28BA72F724E34D9300272C2D /* LexPOV.cxx */, - 28BA732424E34D9600272C2D /* LexPowerPro.cxx */, - 28BA72E524E34D9200272C2D /* LexPowerShell.cxx */, - 28BA72E324E34D9200272C2D /* LexProgress.cxx */, - 28BA732524E34D9600272C2D /* LexProps.cxx */, - 28BA72E624E34D9200272C2D /* LexPS.cxx */, - 28BA72FD24E34D9400272C2D /* LexPython.cxx */, - 28BA731C24E34D9500272C2D /* LexR.cxx */, - 28BA72F124E34D9300272C2D /* LexRaku.cxx */, - 28BA72D124E34D9200272C2D /* LexRebol.cxx */, - 28BA72FC24E34D9400272C2D /* LexRegistry.cxx */, - 28BA72E924E34D9300272C2D /* LexRuby.cxx */, - 28BA733824E34D9700272C2D /* LexRust.cxx */, - 28BA72D224E34D9200272C2D /* LexSAS.cxx */, - 28BA731D24E34D9500272C2D /* LexScriptol.cxx */, - 28BA72D424E34D9200272C2D /* LexSmalltalk.cxx */, - 28BA72CC24E34D9100272C2D /* LexSML.cxx */, - 28BA72DE24E34D9200272C2D /* LexSorcus.cxx */, - 28BA72F924E34D9300272C2D /* LexSpecman.cxx */, - 28BA730924E34D9400272C2D /* LexSpice.cxx */, - 28BA72F324E34D9300272C2D /* LexSQL.cxx */, - 28BA731724E34D9500272C2D /* LexStata.cxx */, - 28BA731224E34D9500272C2D /* LexSTTXT.cxx */, - 28BA72CE24E34D9100272C2D /* LexTACL.cxx */, - 28BA730E24E34D9500272C2D /* LexTADS3.cxx */, - 28BA732E24E34D9600272C2D /* LexTAL.cxx */, - 28BA72C924E34D9100272C2D /* LexTCL.cxx */, - 28BA730324E34D9400272C2D /* LexTCMD.cxx */, - 28BA730824E34D9400272C2D /* LexTeX.cxx */, - 28BA730F24E34D9500272C2D /* LexTxt2tags.cxx */, - 28BA731F24E34D9600272C2D /* LexVB.cxx */, - 28BA731A24E34D9500272C2D /* LexVerilog.cxx */, - 28BA72DA24E34D9200272C2D /* LexVHDL.cxx */, - 28BA731E24E34D9500272C2D /* LexVisualProlog.cxx */, - 28BA730A24E34D9400272C2D /* LexX12.cxx */, - 28BA72E724E34D9200272C2D /* LexYAML.cxx */, - ); - name = Lexers; - sourceTree = "<group>"; - }; - 280262B8246DF776000DF3B8 /* LexLib */ = { - isa = PBXGroup; - children = ( - 28BA72AA24E34D5B00272C2D /* Accessor.cxx */, - 28BA729724E34D5A00272C2D /* Accessor.h */, - 28BA72A024E34D5B00272C2D /* CatalogueModules.h */, - 28BA729524E34D5A00272C2D /* CharacterCategory.cxx */, - 28BA72A924E34D5B00272C2D /* CharacterCategory.h */, - 28BA729924E34D5A00272C2D /* CharacterSet.cxx */, - 28BA72A124E34D5B00272C2D /* CharacterSet.h */, - 28BA729C24E34D5A00272C2D /* DefaultLexer.cxx */, - 28BA729124E34D5A00272C2D /* DefaultLexer.h */, - 28BA729024E34D5A00272C2D /* LexAccessor.h */, - 28BA728F24E34D5A00272C2D /* LexerBase.cxx */, - 28BA72A624E34D5B00272C2D /* LexerBase.h */, - 28BA72A524E34D5B00272C2D /* LexerModule.cxx */, - 28BA729424E34D5A00272C2D /* LexerModule.h */, - 28BA729D24E34D5A00272C2D /* LexerNoExceptions.cxx */, - 28BA729324E34D5A00272C2D /* LexerNoExceptions.h */, - 28BA72A724E34D5B00272C2D /* LexerSimple.cxx */, - 28BA729624E34D5A00272C2D /* LexerSimple.h */, - 28BA729F24E34D5A00272C2D /* OptionSet.h */, - 28BA729824E34D5A00272C2D /* PropSetSimple.cxx */, - 28BA72A324E34D5B00272C2D /* PropSetSimple.h */, - 28BA729A24E34D5A00272C2D /* SparseState.h */, - 28BA72A424E34D5B00272C2D /* StringCopy.h */, - 28BA72A824E34D5B00272C2D /* StyleContext.cxx */, - 28BA72A224E34D5B00272C2D /* StyleContext.h */, - 28BA729224E34D5A00272C2D /* SubStyles.h */, - 28BA729E24E34D5A00272C2D /* WordList.cxx */, - 28BA729B24E34D5A00272C2D /* WordList.h */, - ); - name = LexLib; - sourceTree = "<group>"; - }; -/* End PBXGroup section */ - -/* Begin PBXHeadersBuildPhase section */ - 280262A1246DF655000DF3B8 /* Headers */ = { - isa = PBXHeadersBuildPhase; - buildActionMask = 2147483647; - files = ( - 28BA73AD24E34DBC00272C2D /* Lexilla.h in Headers */, - 28BA72BF24E34D5B00272C2D /* PropSetSimple.h in Headers */, - 28BA72B224E34D5B00272C2D /* LexerSimple.h in Headers */, - 28BA72AF24E34D5B00272C2D /* LexerNoExceptions.h in Headers */, - 28BA72B724E34D5B00272C2D /* WordList.h in Headers */, - 28BA72C024E34D5B00272C2D /* StringCopy.h in Headers */, - 28BA72AD24E34D5B00272C2D /* DefaultLexer.h in Headers */, - 28BA72B324E34D5B00272C2D /* Accessor.h in Headers */, - 28BA72BE24E34D5B00272C2D /* StyleContext.h in Headers */, - 28BA72BB24E34D5B00272C2D /* OptionSet.h in Headers */, - 28BA72B024E34D5B00272C2D /* LexerModule.h in Headers */, - 28BA72AC24E34D5B00272C2D /* LexAccessor.h in Headers */, - 28BA72C524E34D5B00272C2D /* CharacterCategory.h in Headers */, - 28BA72BD24E34D5B00272C2D /* CharacterSet.h in Headers */, - 28BA72AE24E34D5B00272C2D /* SubStyles.h in Headers */, - 28BA72BC24E34D5B00272C2D /* CatalogueModules.h in Headers */, - 28BA72C224E34D5B00272C2D /* LexerBase.h in Headers */, - 28BA72B624E34D5B00272C2D /* SparseState.h in Headers */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXHeadersBuildPhase section */ - -/* Begin PBXNativeTarget section */ - 280262A4246DF655000DF3B8 /* lexilla */ = { - isa = PBXNativeTarget; - buildConfigurationList = 280262B0246DF655000DF3B8 /* Build configuration list for PBXNativeTarget "lexilla" */; - buildPhases = ( - 280262A1246DF655000DF3B8 /* Headers */, - 280262A2246DF655000DF3B8 /* Sources */, - 280262A3246DF655000DF3B8 /* Frameworks */, - ); - buildRules = ( - ); - dependencies = ( - ); - name = lexilla; - productName = lexilla; - productReference = 280262A5246DF655000DF3B8 /* liblexilla.dylib */; - productType = "com.apple.product-type.library.dynamic"; - }; -/* End PBXNativeTarget section */ - -/* Begin PBXProject section */ - 2802629D246DF655000DF3B8 /* Project object */ = { - isa = PBXProject; - attributes = { - LastUpgradeCheck = 1200; - ORGANIZATIONNAME = "Neil Hodgson"; - TargetAttributes = { - 280262A4246DF655000DF3B8 = { - CreatedOnToolsVersion = 11.4.1; - }; - }; - }; - buildConfigurationList = 280262A0246DF655000DF3B8 /* Build configuration list for PBXProject "Lexilla" */; - compatibilityVersion = "Xcode 9.3"; - developmentRegion = en; - hasScannedForEncodings = 0; - knownRegions = ( - en, - Base, - ); - mainGroup = 2802629C246DF655000DF3B8; - productRefGroup = 280262A6246DF655000DF3B8 /* Products */; - projectDirPath = ""; - projectRoot = ""; - targets = ( - 280262A4246DF655000DF3B8 /* lexilla */, - ); - }; -/* End PBXProject section */ - -/* Begin PBXSourcesBuildPhase section */ - 280262A2246DF655000DF3B8 /* Sources */ = { - isa = PBXSourcesBuildPhase; - buildActionMask = 2147483647; - files = ( - 28BA739A24E34D9700272C2D /* LexMSSQL.cxx in Sources */, - 28BA735324E34D9700272C2D /* LexMySQL.cxx in Sources */, - 28BA738024E34D9700272C2D /* LexTADS3.cxx in Sources */, - 28BA73A924E34D9700272C2D /* LexPerl.cxx in Sources */, - 28BA733D24E34D9700272C2D /* LexForth.cxx in Sources */, - 28BA736824E34D9700272C2D /* LexEScript.cxx in Sources */, - 28BA737124E34D9700272C2D /* LexAsm.cxx in Sources */, - 28BA737B24E34D9700272C2D /* LexSpice.cxx in Sources */, - 28BA737024E34D9700272C2D /* LexCmake.cxx in Sources */, - 28BA734624E34D9700272C2D /* LexSmalltalk.cxx in Sources */, - 28BA72C424E34D5B00272C2D /* StyleContext.cxx in Sources */, - 28BA734C24E34D9700272C2D /* LexVHDL.cxx in Sources */, - 28BA737724E34D9700272C2D /* LexInno.cxx in Sources */, - 28BA739B24E34D9700272C2D /* LexCSS.cxx in Sources */, - 28BA734A24E34D9700272C2D /* LexBash.cxx in Sources */, - 28BA734224E34D9700272C2D /* LexCLW.cxx in Sources */, - 28BA734424E34D9700272C2D /* LexSAS.cxx in Sources */, - 28BA738E24E34D9700272C2D /* LexR.cxx in Sources */, - 28BA72C124E34D5B00272C2D /* LexerModule.cxx in Sources */, - 28BA735C24E34D9700272C2D /* LexIndent.cxx in Sources */, - 28BA736624E34D9700272C2D /* LexNsis.cxx in Sources */, - 28BA734724E34D9700272C2D /* LexModula.cxx in Sources */, - 28BA734924E34D9700272C2D /* LexASY.cxx in Sources */, - 28BA739024E34D9700272C2D /* LexVisualProlog.cxx in Sources */, - 28BA739524E34D9700272C2D /* LexPO.cxx in Sources */, - 28BA72BA24E34D5B00272C2D /* WordList.cxx in Sources */, - 28BA739624E34D9700272C2D /* LexPowerPro.cxx in Sources */, - 28BA733924E34D9700272C2D /* LexBasic.cxx in Sources */, - 28BA739D24E34D9700272C2D /* LexCaml.cxx in Sources */, - 28BA739724E34D9700272C2D /* LexProps.cxx in Sources */, - 28BA737424E34D9700272C2D /* LexDMIS.cxx in Sources */, - 28BA73A524E34D9700272C2D /* LexECL.cxx in Sources */, - 28BA736524E34D9700272C2D /* LexSQL.cxx in Sources */, - 28BA72AB24E34D5B00272C2D /* LexerBase.cxx in Sources */, - 28BA72B824E34D5B00272C2D /* DefaultLexer.cxx in Sources */, - 28BA73A024E34D9700272C2D /* LexTAL.cxx in Sources */, - 28BA733C24E34D9700272C2D /* LexMetapost.cxx in Sources */, - 28BA733A24E34D9700272C2D /* LexCIL.cxx in Sources */, - 28BA735D24E34D9700272C2D /* LexErrorList.cxx in Sources */, - 28BA737224E34D9700272C2D /* LexAda.cxx in Sources */, - 28BA737D24E34D9700272C2D /* LexAU3.cxx in Sources */, - 28BA734024E34D9700272C2D /* LexTACL.cxx in Sources */, - 28BA736724E34D9700272C2D /* LexEDIFACT.cxx in Sources */, - 28BA736024E34D9700272C2D /* LexAbaqus.cxx in Sources */, - 28BA734D24E34D9700272C2D /* LexAsn1.cxx in Sources */, - 28BA737A24E34D9700272C2D /* LexTeX.cxx in Sources */, - 28BA739124E34D9700272C2D /* LexVB.cxx in Sources */, - 28BA735E24E34D9700272C2D /* LexFlagship.cxx in Sources */, - 28BA735B24E34D9700272C2D /* LexRuby.cxx in Sources */, - 28BA735424E34D9700272C2D /* LexHollywood.cxx in Sources */, - 28BA72B924E34D5B00272C2D /* LexerNoExceptions.cxx in Sources */, - 28BA736D24E34D9700272C2D /* LexFortran.cxx in Sources */, - 28BA738924E34D9700272C2D /* LexStata.cxx in Sources */, - 28BA737524E34D9700272C2D /* LexTCMD.cxx in Sources */, - 28BA72C624E34D5B00272C2D /* Accessor.cxx in Sources */, - 28BA733B24E34D9700272C2D /* LexTCL.cxx in Sources */, - 28BA739C24E34D9700272C2D /* LexMaxima.cxx in Sources */, - 28BA73AA24E34D9700272C2D /* LexRust.cxx in Sources */, - 28BA733F24E34D9700272C2D /* LexOScript.cxx in Sources */, - 28BA737324E34D9700272C2D /* LexCrontab.cxx in Sources */, - 28BA734E24E34D9700272C2D /* LexCoffeeScript.cxx in Sources */, - 28BA735624E34D9700272C2D /* LexLisp.cxx in Sources */, - 28BA735824E34D9700272C2D /* LexPS.cxx in Sources */, - 28BA735F24E34D9700272C2D /* LexLaTeX.cxx in Sources */, - 28BA736B24E34D9700272C2D /* LexSpecman.cxx in Sources */, - 28BA73A724E34D9700272C2D /* LexBibTeX.cxx in Sources */, - 28BA737E24E34D9700272C2D /* LexBaan.cxx in Sources */, - 28BA738124E34D9700272C2D /* LexTxt2tags.cxx in Sources */, - 28BA737F24E34D9700272C2D /* LexMPT.cxx in Sources */, - 28BA738424E34D9700272C2D /* LexSTTXT.cxx in Sources */, - 28BA734F24E34D9700272C2D /* LexDiff.cxx in Sources */, - 28BA735924E34D9700272C2D /* LexYAML.cxx in Sources */, - 28BA735524E34D9700272C2D /* LexProgress.cxx in Sources */, - 28BA736F24E34D9700272C2D /* LexPython.cxx in Sources */, - 28BA72B524E34D5B00272C2D /* CharacterSet.cxx in Sources */, - 28BA739E24E34D9700272C2D /* LexDataflex.cxx in Sources */, - 28BA738F24E34D9700272C2D /* LexScriptol.cxx in Sources */, - 28BA736C24E34D9700272C2D /* LexHTML.cxx in Sources */, - 28BA737924E34D9700272C2D /* LexMake.cxx in Sources */, - 28BA738524E34D9700272C2D /* LexMagik.cxx in Sources */, - 28BA72B124E34D5B00272C2D /* CharacterCategory.cxx in Sources */, - 28BA739424E34D9700272C2D /* LexPB.cxx in Sources */, - 28BA73A624E34D9700272C2D /* LexMatlab.cxx in Sources */, - 28BA736324E34D9700272C2D /* LexRaku.cxx in Sources */, - 28BA736224E34D9700272C2D /* LexCPP.cxx in Sources */, - 28BA738A24E34D9700272C2D /* LexOpal.cxx in Sources */, - 28BA736E24E34D9700272C2D /* LexRegistry.cxx in Sources */, - 28BA738224E34D9700272C2D /* LexMMIXAL.cxx in Sources */, - 28BA736A24E34D9700272C2D /* LexKVIrc.cxx in Sources */, - 28BA73A224E34D9700272C2D /* LexJSON.cxx in Sources */, - 28BA738724E34D9700272C2D /* LexCsound.cxx in Sources */, - 28BA738824E34D9700272C2D /* LexLua.cxx in Sources */, - 28BA739824E34D9700272C2D /* LexCOBOL.cxx in Sources */, - 28BA73A824E34D9700272C2D /* LexNimrod.cxx in Sources */, - 28BA739324E34D9700272C2D /* LexAVS.cxx in Sources */, - 28BA737624E34D9700272C2D /* LexConf.cxx in Sources */, - 28BA734524E34D9700272C2D /* LexNim.cxx in Sources */, - 28BA73AE24E34DBC00272C2D /* Lexilla.cxx in Sources */, - 28BA72C324E34D5B00272C2D /* LexerSimple.cxx in Sources */, - 28BA735124E34D9700272C2D /* LexAPDL.cxx in Sources */, - 28BA736424E34D9700272C2D /* LexGAP.cxx in Sources */, - 28BA734324E34D9700272C2D /* LexRebol.cxx in Sources */, - 28BA733E24E34D9700272C2D /* LexSML.cxx in Sources */, - 28BA738C24E34D9700272C2D /* LexVerilog.cxx in Sources */, - 28BA738624E34D9700272C2D /* LexNull.cxx in Sources */, - 28BA736124E34D9700272C2D /* LexBatch.cxx in Sources */, - 28BA736924E34D9700272C2D /* LexPOV.cxx in Sources */, - 28BA734124E34D9700272C2D /* LexGui4Cli.cxx in Sources */, - 28BA734824E34D9700272C2D /* LexBullant.cxx in Sources */, - 28BA734B24E34D9700272C2D /* LexEiffel.cxx in Sources */, - 28BA73A424E34D9700272C2D /* LexAVE.cxx in Sources */, - 28BA738D24E34D9700272C2D /* LexHaskell.cxx in Sources */, - 28BA735024E34D9700272C2D /* LexSorcus.cxx in Sources */, - 28BA739F24E34D9700272C2D /* LexLout.cxx in Sources */, - 28BA73A124E34D9700272C2D /* LexMarkdown.cxx in Sources */, - 28BA739224E34D9700272C2D /* LexDMAP.cxx in Sources */, - 28BA737824E34D9700272C2D /* LexA68k.cxx in Sources */, - 28BA735A24E34D9700272C2D /* LexErlang.cxx in Sources */, - 28BA738B24E34D9700272C2D /* LexHex.cxx in Sources */, - 28BA735224E34D9700272C2D /* LexD.cxx in Sources */, - 28BA73A324E34D9700272C2D /* LexPascal.cxx in Sources */, - 28BA739924E34D9700272C2D /* LexPLM.cxx in Sources */, - 28BA735724E34D9700272C2D /* LexPowerShell.cxx in Sources */, - 28BA738324E34D9700272C2D /* LexKix.cxx in Sources */, - 28BA72B424E34D5B00272C2D /* PropSetSimple.cxx in Sources */, - 28BA737C24E34D9700272C2D /* LexX12.cxx in Sources */, - ); - runOnlyForDeploymentPostprocessing = 0; - }; -/* End PBXSourcesBuildPhase section */ - -/* Begin XCBuildConfiguration section */ - 280262AE246DF655000DF3B8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = dwarf; - ENABLE_STRICT_OBJC_MSGSEND = YES; - ENABLE_TESTABILITY = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_DYNAMIC_NO_PIC = NO; - GCC_NO_COMMON_BLOCKS = YES; - GCC_OPTIMIZATION_LEVEL = 0; - GCC_PREPROCESSOR_DEFINITIONS = ( - "DEBUG=1", - "$(inherited)", - ); - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.8; - MTL_ENABLE_DEBUG_INFO = INCLUDE_SOURCE; - MTL_FAST_MATH = YES; - ONLY_ACTIVE_ARCH = YES; - SDKROOT = macosx; - }; - name = Debug; - }; - 280262AF246DF655000DF3B8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - ALWAYS_SEARCH_USER_PATHS = NO; - CLANG_ANALYZER_NONNULL = YES; - CLANG_ANALYZER_NUMBER_OBJECT_CONVERSION = YES_AGGRESSIVE; - CLANG_CXX_LANGUAGE_STANDARD = "gnu++14"; - CLANG_CXX_LIBRARY = "libc++"; - CLANG_ENABLE_MODULES = YES; - CLANG_ENABLE_OBJC_ARC = YES; - CLANG_ENABLE_OBJC_WEAK = YES; - CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; - CLANG_WARN_BOOL_CONVERSION = YES; - CLANG_WARN_COMMA = YES; - CLANG_WARN_CONSTANT_CONVERSION = YES; - CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; - CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; - CLANG_WARN_DOCUMENTATION_COMMENTS = YES; - CLANG_WARN_EMPTY_BODY = YES; - CLANG_WARN_ENUM_CONVERSION = YES; - CLANG_WARN_INFINITE_RECURSION = YES; - CLANG_WARN_INT_CONVERSION = YES; - CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; - CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; - CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; - CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; - CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; - CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; - CLANG_WARN_STRICT_PROTOTYPES = YES; - CLANG_WARN_SUSPICIOUS_MOVE = YES; - CLANG_WARN_UNGUARDED_AVAILABILITY = YES_AGGRESSIVE; - CLANG_WARN_UNREACHABLE_CODE = YES; - CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; - COPY_PHASE_STRIP = NO; - DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym"; - ENABLE_NS_ASSERTIONS = NO; - ENABLE_STRICT_OBJC_MSGSEND = YES; - GCC_C_LANGUAGE_STANDARD = gnu11; - GCC_NO_COMMON_BLOCKS = YES; - GCC_WARN_64_TO_32_BIT_CONVERSION = YES; - GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; - GCC_WARN_UNDECLARED_SELECTOR = YES; - GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; - GCC_WARN_UNUSED_FUNCTION = YES; - GCC_WARN_UNUSED_VARIABLE = YES; - MACOSX_DEPLOYMENT_TARGET = 10.8; - MTL_ENABLE_DEBUG_INFO = NO; - MTL_FAST_MATH = YES; - SDKROOT = macosx; - }; - name = Release; - }; - 280262B1246DF655000DF3B8 /* Debug */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4.4.6; - DEVELOPMENT_TEAM = 4F446KW87E; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - EXECUTABLE_PREFIX = lib; - GCC_ENABLE_CPP_EXCEPTIONS = YES; - GCC_ENABLE_CPP_RTTI = YES; - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = ( - ../../../include, - ../../../lexlib, - ); - INFOPLIST_FILE = "$(SRCROOT)/Lexilla/Info.plist"; - INSTALL_PATH = "@rpath"; - PRODUCT_BUNDLE_IDENTIFIER = org.scintilla.Lexilla; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Debug; - }; - 280262B2246DF655000DF3B8 /* Release */ = { - isa = XCBuildConfiguration; - buildSettings = { - CLANG_CXX_LANGUAGE_STANDARD = "gnu++17"; - CODE_SIGN_STYLE = Automatic; - CURRENT_PROJECT_VERSION = 4.4.6; - DEVELOPMENT_TEAM = 4F446KW87E; - DYLIB_COMPATIBILITY_VERSION = 1; - DYLIB_CURRENT_VERSION = 1; - EXECUTABLE_PREFIX = lib; - GCC_ENABLE_CPP_EXCEPTIONS = YES; - GCC_ENABLE_CPP_RTTI = YES; - GCC_SYMBOLS_PRIVATE_EXTERN = YES; - HEADER_SEARCH_PATHS = ( - ../../../include, - ../../../lexlib, - ); - INFOPLIST_FILE = "$(SRCROOT)/Lexilla/Info.plist"; - INSTALL_PATH = "@rpath"; - PRODUCT_BUNDLE_IDENTIFIER = org.scintilla.Lexilla; - PRODUCT_NAME = "$(TARGET_NAME)"; - SKIP_INSTALL = YES; - }; - name = Release; - }; -/* End XCBuildConfiguration section */ - -/* Begin XCConfigurationList section */ - 280262A0246DF655000DF3B8 /* Build configuration list for PBXProject "Lexilla" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 280262AE246DF655000DF3B8 /* Debug */, - 280262AF246DF655000DF3B8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; - 280262B0246DF655000DF3B8 /* Build configuration list for PBXNativeTarget "lexilla" */ = { - isa = XCConfigurationList; - buildConfigurations = ( - 280262B1246DF655000DF3B8 /* Debug */, - 280262B2246DF655000DF3B8 /* Release */, - ); - defaultConfigurationIsVisible = 0; - defaultConfigurationName = Release; - }; -/* End XCConfigurationList section */ - }; - rootObject = 2802629D246DF655000DF3B8 /* Project object */; -} diff --git a/lexilla/src/Lexilla/Lexilla.xcodeproj/project.xcworkspace/contents.xcworkspacedata b/lexilla/src/Lexilla/Lexilla.xcodeproj/project.xcworkspace/contents.xcworkspacedata deleted file mode 100644 index 3a367d953..000000000 --- a/lexilla/src/Lexilla/Lexilla.xcodeproj/project.xcworkspace/contents.xcworkspacedata +++ /dev/null @@ -1,7 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<Workspace - version = "1.0"> - <FileRef - location = "self:Lexilla.xcodeproj"> - </FileRef> -</Workspace> diff --git a/lexilla/src/Lexilla/Lexilla.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist b/lexilla/src/Lexilla/Lexilla.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist deleted file mode 100644 index 18d981003..000000000 --- a/lexilla/src/Lexilla/Lexilla.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +++ /dev/null @@ -1,8 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> -<plist version="1.0"> -<dict> - <key>IDEDidComputeMac32BitWarning</key> - <true/> -</dict> -</plist> diff --git a/lexilla/src/LexillaVersion.rc b/lexilla/src/LexillaVersion.rc deleted file mode 100644 index 0afa04452..000000000 --- a/lexilla/src/LexillaVersion.rc +++ /dev/null @@ -1,37 +0,0 @@ -// Resource file for Lexilla - provides a version number -// Copyright 2020 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <windows.h> - -#define VERSION_LEXILLA "4.4.6" -#define VERSION_WORDS 4, 4, 6, 0 - -VS_VERSION_INFO VERSIONINFO -FILEVERSION VERSION_WORDS -PRODUCTVERSION VERSION_WORDS -FILEFLAGSMASK 0x3fL -FILEFLAGS 0 -FILEOS VOS_NT_WINDOWS32 -FILETYPE VFT_APP -FILESUBTYPE VFT2_UNKNOWN -BEGIN - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x409, 1200 - END - BLOCK "StringFileInfo" - BEGIN - BLOCK "040904b0" - BEGIN - VALUE "CompanyName", "Neil Hodgson neilh@scintilla.org\0" - VALUE "FileDescription", "Lexilla.DLL - a Lexical Analysis Component\0" - VALUE "FileVersion", VERSION_LEXILLA "\0" - VALUE "InternalName", "Lexilla\0" - VALUE "LegalCopyright", "Copyright 2019 by Neil Hodgson\0" - VALUE "OriginalFilename", "Lexilla.DLL\0" - VALUE "ProductName", "Lexilla\0" - VALUE "ProductVersion", VERSION_LEXILLA "\0" - END - END -END diff --git a/lexilla/src/README b/lexilla/src/README deleted file mode 100644 index d65790afd..000000000 --- a/lexilla/src/README +++ /dev/null @@ -1,45 +0,0 @@ -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.
-
-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 scintilla/bin.
-
-Lexilla relies on a list of lexers from the scintilla/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
diff --git a/lexilla/src/deps.mak b/lexilla/src/deps.mak deleted file mode 100644 index 8c3c33c79..000000000 --- a/lexilla/src/deps.mak +++ /dev/null @@ -1,1519 +0,0 @@ -# Created by DepGen.py. To recreate, run DepGen.py. -Lexilla.o: \ - ../../lexilla/src/Lexilla.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/CatalogueModules.h -Accessor.o: \ - ../../lexlib/Accessor.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h -CharacterCategory.o: \ - ../../lexlib/CharacterCategory.cxx \ - ../../lexlib/CharacterCategory.h -CharacterSet.o: \ - ../../lexlib/CharacterSet.cxx \ - ../../lexlib/CharacterSet.h -DefaultLexer.o: \ - ../../lexlib/DefaultLexer.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h -LexerBase.o: \ - ../../lexlib/LexerBase.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/LexerBase.h -LexerModule.o: \ - ../../lexlib/LexerModule.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/LexerBase.h \ - ../../lexlib/LexerSimple.h -LexerNoExceptions.o: \ - ../../lexlib/LexerNoExceptions.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/LexerBase.h \ - ../../lexlib/LexerNoExceptions.h -LexerSimple.o: \ - ../../lexlib/LexerSimple.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/LexerBase.h \ - ../../lexlib/LexerSimple.h -PropSetSimple.o: \ - ../../lexlib/PropSetSimple.cxx \ - ../../lexlib/PropSetSimple.h -StyleContext.o: \ - ../../lexlib/StyleContext.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h -WordList.o: \ - ../../lexlib/WordList.cxx \ - ../../lexlib/WordList.h -LexA68k.o: \ - ../../lexers/LexA68k.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexAbaqus.o: \ - ../../lexers/LexAbaqus.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexAda.o: \ - ../../lexers/LexAda.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexAPDL.o: \ - ../../lexers/LexAPDL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexAsm.o: \ - ../../lexers/LexAsm.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexAsn1.o: \ - ../../lexers/LexAsn1.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexASY.o: \ - ../../lexers/LexASY.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexAU3.o: \ - ../../lexers/LexAU3.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexAVE.o: \ - ../../lexers/LexAVE.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexAVS.o: \ - ../../lexers/LexAVS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexBaan.o: \ - ../../lexers/LexBaan.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexBash.o: \ - ../../lexers/LexBash.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SubStyles.h \ - ../../lexlib/DefaultLexer.h -LexBasic.o: \ - ../../lexers/LexBasic.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexBatch.o: \ - ../../lexers/LexBatch.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexBibTeX.o: \ - ../../lexers/LexBibTeX.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexBullant.o: \ - ../../lexers/LexBullant.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexCaml.o: \ - ../../lexers/LexCaml.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../src/ExternalLexer.h -LexCIL.o: \ - ../../lexers/LexCIL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexCLW.o: \ - ../../lexers/LexCLW.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexCmake.o: \ - ../../lexers/LexCmake.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexCOBOL.o: \ - ../../lexers/LexCOBOL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexCoffeeScript.o: \ - ../../lexers/LexCoffeeScript.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexConf.o: \ - ../../lexers/LexConf.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexCPP.o: \ - ../../lexers/LexCPP.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SparseState.h \ - ../../lexlib/SubStyles.h -LexCrontab.o: \ - ../../lexers/LexCrontab.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexCsound.o: \ - ../../lexers/LexCsound.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexCSS.o: \ - ../../lexers/LexCSS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexD.o: \ - ../../lexers/LexD.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexDataflex.o: \ - ../../lexers/LexDataflex.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexDiff.o: \ - ../../lexers/LexDiff.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexDMAP.o: \ - ../../lexers/LexDMAP.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexDMIS.o: \ - ../../lexers/LexDMIS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h -LexECL.o: \ - ../../lexers/LexECL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h -LexEDIFACT.o: \ - ../../lexers/LexEDIFACT.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h -LexEiffel.o: \ - ../../lexers/LexEiffel.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexErlang.o: \ - ../../lexers/LexErlang.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexErrorList.o: \ - ../../lexers/LexErrorList.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexEScript.o: \ - ../../lexers/LexEScript.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexFlagship.o: \ - ../../lexers/LexFlagship.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexForth.o: \ - ../../lexers/LexForth.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexFortran.o: \ - ../../lexers/LexFortran.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexGAP.o: \ - ../../lexers/LexGAP.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexGui4Cli.o: \ - ../../lexers/LexGui4Cli.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexHaskell.o: \ - ../../lexers/LexHaskell.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/CharacterCategory.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexHex.o: \ - ../../lexers/LexHex.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexHollywood.o: \ - ../../lexers/LexHollywood.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexHTML.o: \ - ../../lexers/LexHTML.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexIndent.o: \ - ../../lexers/LexIndent.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexInno.o: \ - ../../lexers/LexInno.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexJSON.o: \ - ../../lexers/LexJSON.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexKix.o: \ - ../../lexers/LexKix.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexKVIrc.o: \ - ../../lexers/LexKVIrc.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexLaTeX.o: \ - ../../lexers/LexLaTeX.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h \ - ../../lexlib/LexerBase.h -LexLisp.o: \ - ../../lexers/LexLisp.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexLout.o: \ - ../../lexers/LexLout.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexLua.o: \ - ../../lexers/LexLua.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMagik.o: \ - ../../lexers/LexMagik.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMake.o: \ - ../../lexers/LexMake.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMarkdown.o: \ - ../../lexers/LexMarkdown.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMatlab.o: \ - ../../lexers/LexMatlab.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMaxima.o: \ - ../../lexers/LexMaxima.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMetapost.o: \ - ../../lexers/LexMetapost.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMMIXAL.o: \ - ../../lexers/LexMMIXAL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexModula.o: \ - ../../lexers/LexModula.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMPT.o: \ - ../../lexers/LexMPT.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMSSQL.o: \ - ../../lexers/LexMSSQL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexMySQL.o: \ - ../../lexers/LexMySQL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexNim.o: \ - ../../lexers/LexNim.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexNimrod.o: \ - ../../lexers/LexNimrod.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexNsis.o: \ - ../../lexers/LexNsis.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexNull.o: \ - ../../lexers/LexNull.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexOpal.o: \ - ../../lexers/LexOpal.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexOScript.o: \ - ../../lexers/LexOScript.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexPascal.o: \ - ../../lexers/LexPascal.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexPB.o: \ - ../../lexers/LexPB.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexPerl.o: \ - ../../lexers/LexPerl.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexPLM.o: \ - ../../lexers/LexPLM.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexPO.o: \ - ../../lexers/LexPO.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexPOV.o: \ - ../../lexers/LexPOV.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexPowerPro.o: \ - ../../lexers/LexPowerPro.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexPowerShell.o: \ - ../../lexers/LexPowerShell.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexProgress.o: \ - ../../lexers/LexProgress.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SparseState.h \ - ../../lexlib/DefaultLexer.h -LexProps.o: \ - ../../lexers/LexProps.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexPS.o: \ - ../../lexers/LexPS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexPython.o: \ - ../../lexers/LexPython.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/CharacterCategory.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SubStyles.h \ - ../../lexlib/DefaultLexer.h -LexR.o: \ - ../../lexers/LexR.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexRaku.o: \ - ../../lexers/LexRaku.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/CharacterCategory.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexRebol.o: \ - ../../lexers/LexRebol.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexRegistry.o: \ - ../../lexers/LexRegistry.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexRuby.o: \ - ../../lexers/LexRuby.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexRust.o: \ - ../../lexers/LexRust.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexSAS.o: \ - ../../lexers/LexSAS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexScriptol.o: \ - ../../lexers/LexScriptol.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexSmalltalk.o: \ - ../../lexers/LexSmalltalk.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexSML.o: \ - ../../lexers/LexSML.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexSorcus.o: \ - ../../lexers/LexSorcus.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexSpecman.o: \ - ../../lexers/LexSpecman.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexSpice.o: \ - ../../lexers/LexSpice.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexSQL.o: \ - ../../lexers/LexSQL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SparseState.h \ - ../../lexlib/DefaultLexer.h -LexStata.o: \ - ../../lexers/LexStata.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexSTTXT.o: \ - ../../lexers/LexSTTXT.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexTACL.o: \ - ../../lexers/LexTACL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexTADS3.o: \ - ../../lexers/LexTADS3.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexTAL.o: \ - ../../lexers/LexTAL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexTCL.o: \ - ../../lexers/LexTCL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexTCMD.o: \ - ../../lexers/LexTCMD.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexTeX.o: \ - ../../lexers/LexTeX.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexTxt2tags.o: \ - ../../lexers/LexTxt2tags.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexVB.o: \ - ../../lexers/LexVB.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexVerilog.o: \ - ../../lexers/LexVerilog.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SubStyles.h \ - ../../lexlib/DefaultLexer.h -LexVHDL.o: \ - ../../lexers/LexVHDL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -LexVisualProlog.o: \ - ../../lexers/LexVisualProlog.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/CharacterCategory.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -LexX12.o: \ - ../../lexers/LexX12.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h -LexYAML.o: \ - ../../lexers/LexYAML.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h diff --git a/lexilla/src/lexilla.mak b/lexilla/src/lexilla.mak deleted file mode 100644 index 90ba13750..000000000 --- a/lexilla/src/lexilla.mak +++ /dev/null @@ -1,238 +0,0 @@ -# Make file for Lexilla on Windows Visual C++ version -# Copyright 2019 by Neil Hodgson <neilh@scintilla.org> -# The License.txt file describes the conditions under which this software may be distributed. -# This makefile is for using Visual C++ with nmake. -# Usage for Microsoft: -# nmake -f lexilla.mak -# For debug versions define DEBUG on the command line: -# nmake DEBUG=1 -f lexilla.mak -# To build with GCC or Clang, run makefile - -.SUFFIXES: .cxx - -DIR_O=. -DIR_BIN=..\..\bin - -LEXILLA=$(DIR_BIN)\lexilla.dll -LIBLEXILLA=$(DIR_BIN)\liblexilla.lib - -LD=link - -!IFDEF SUPPORT_XP -ADD_DEFINE=-D_USING_V110_SDK71_ -# Different subsystems for 32-bit and 64-bit Windows XP so detect based on Platform -# environment vairable set by vcvars*.bat to be either x86 or x64 -!IF "$(PLATFORM)" == "x64" -SUBSYSTEM=-SUBSYSTEM:WINDOWS,5.02 -!ELSE -SUBSYSTEM=-SUBSYSTEM:WINDOWS,5.01 -!ENDIF -!ELSEIFDEF ARM64 -ADD_DEFINE=-D_ARM64_WINAPI_PARTITION_DESKTOP_SDK_AVAILABLE=1 -SUBSYSTEM=-SUBSYSTEM:WINDOWS,10.00 -!ENDIF - -CRTFLAGS=-D_CRT_SECURE_CPP_OVERLOAD_STANDARD_NAMES=1 -D_CRT_SECURE_NO_DEPRECATE=1 -D_SCL_SECURE_NO_WARNINGS=1 $(ADD_DEFINE) -CXXFLAGS=-Zi -TP -MP -W4 -EHsc -std:c++17 $(CRTFLAGS) -CXXDEBUG=-Od -MTd -DDEBUG -CXXNDEBUG=-O1 -MT -DNDEBUG -GL -NAME=-Fo -LDFLAGS=-OPT:REF -LTCG -IGNORE:4197 -DEBUG $(SUBSYSTEM) -LDDEBUG= -LIBS= -NOLOGO=-nologo - -!IFDEF QUIET -CXX=@$(CXX) -CXXFLAGS=$(CXXFLAGS) $(NOLOGO) -LDFLAGS=$(LDFLAGS) $(NOLOGO) -!ENDIF - -!IFDEF DEBUG -CXXFLAGS=$(CXXFLAGS) $(CXXDEBUG) -LDFLAGS=$(LDDEBUG) $(LDFLAGS) -!ELSE -CXXFLAGS=$(CXXFLAGS) $(CXXNDEBUG) -!ENDIF - -INCLUDEDIRS=-I../../include -I../../src -I../../lexlib -CXXFLAGS=$(CXXFLAGS) $(INCLUDEDIRS) - -all: $(LEXILLA) $(LIBLEXILLA) - -clean: - -del /q $(DIR_O)\*.obj $(DIR_O)\*.o $(DIR_O)\*.pdb \ - $(DIR_O)\*.res $(DIR_BIN)\*.map $(DIR_BIN)\*.exp $(DIR_BIN)\*.pdb $(DIR_BIN)\lexilla.lib \ - $(LEXILLA) $(LIBLEXILLA) - -depend: - pyw DepGen.py - -#++Autogenerated -- run scripts/LexGen.py to regenerate -#**LEX_OBJS=\\\n\(\t$(DIR_O)\\\*.obj \\\n\) -LEX_OBJS=\ - $(DIR_O)\LexA68k.obj \ - $(DIR_O)\LexAbaqus.obj \ - $(DIR_O)\LexAda.obj \ - $(DIR_O)\LexAPDL.obj \ - $(DIR_O)\LexAsm.obj \ - $(DIR_O)\LexAsn1.obj \ - $(DIR_O)\LexASY.obj \ - $(DIR_O)\LexAU3.obj \ - $(DIR_O)\LexAVE.obj \ - $(DIR_O)\LexAVS.obj \ - $(DIR_O)\LexBaan.obj \ - $(DIR_O)\LexBash.obj \ - $(DIR_O)\LexBasic.obj \ - $(DIR_O)\LexBatch.obj \ - $(DIR_O)\LexBibTeX.obj \ - $(DIR_O)\LexBullant.obj \ - $(DIR_O)\LexCaml.obj \ - $(DIR_O)\LexCIL.obj \ - $(DIR_O)\LexCLW.obj \ - $(DIR_O)\LexCmake.obj \ - $(DIR_O)\LexCOBOL.obj \ - $(DIR_O)\LexCoffeeScript.obj \ - $(DIR_O)\LexConf.obj \ - $(DIR_O)\LexCPP.obj \ - $(DIR_O)\LexCrontab.obj \ - $(DIR_O)\LexCsound.obj \ - $(DIR_O)\LexCSS.obj \ - $(DIR_O)\LexD.obj \ - $(DIR_O)\LexDataflex.obj \ - $(DIR_O)\LexDiff.obj \ - $(DIR_O)\LexDMAP.obj \ - $(DIR_O)\LexDMIS.obj \ - $(DIR_O)\LexECL.obj \ - $(DIR_O)\LexEDIFACT.obj \ - $(DIR_O)\LexEiffel.obj \ - $(DIR_O)\LexErlang.obj \ - $(DIR_O)\LexErrorList.obj \ - $(DIR_O)\LexEScript.obj \ - $(DIR_O)\LexFlagship.obj \ - $(DIR_O)\LexForth.obj \ - $(DIR_O)\LexFortran.obj \ - $(DIR_O)\LexGAP.obj \ - $(DIR_O)\LexGui4Cli.obj \ - $(DIR_O)\LexHaskell.obj \ - $(DIR_O)\LexHex.obj \ - $(DIR_O)\LexHollywood.obj \ - $(DIR_O)\LexHTML.obj \ - $(DIR_O)\LexIndent.obj \ - $(DIR_O)\LexInno.obj \ - $(DIR_O)\LexJSON.obj \ - $(DIR_O)\LexKix.obj \ - $(DIR_O)\LexKVIrc.obj \ - $(DIR_O)\LexLaTeX.obj \ - $(DIR_O)\LexLisp.obj \ - $(DIR_O)\LexLout.obj \ - $(DIR_O)\LexLua.obj \ - $(DIR_O)\LexMagik.obj \ - $(DIR_O)\LexMake.obj \ - $(DIR_O)\LexMarkdown.obj \ - $(DIR_O)\LexMatlab.obj \ - $(DIR_O)\LexMaxima.obj \ - $(DIR_O)\LexMetapost.obj \ - $(DIR_O)\LexMMIXAL.obj \ - $(DIR_O)\LexModula.obj \ - $(DIR_O)\LexMPT.obj \ - $(DIR_O)\LexMSSQL.obj \ - $(DIR_O)\LexMySQL.obj \ - $(DIR_O)\LexNim.obj \ - $(DIR_O)\LexNimrod.obj \ - $(DIR_O)\LexNsis.obj \ - $(DIR_O)\LexNull.obj \ - $(DIR_O)\LexOpal.obj \ - $(DIR_O)\LexOScript.obj \ - $(DIR_O)\LexPascal.obj \ - $(DIR_O)\LexPB.obj \ - $(DIR_O)\LexPerl.obj \ - $(DIR_O)\LexPLM.obj \ - $(DIR_O)\LexPO.obj \ - $(DIR_O)\LexPOV.obj \ - $(DIR_O)\LexPowerPro.obj \ - $(DIR_O)\LexPowerShell.obj \ - $(DIR_O)\LexProgress.obj \ - $(DIR_O)\LexProps.obj \ - $(DIR_O)\LexPS.obj \ - $(DIR_O)\LexPython.obj \ - $(DIR_O)\LexR.obj \ - $(DIR_O)\LexRaku.obj \ - $(DIR_O)\LexRebol.obj \ - $(DIR_O)\LexRegistry.obj \ - $(DIR_O)\LexRuby.obj \ - $(DIR_O)\LexRust.obj \ - $(DIR_O)\LexSAS.obj \ - $(DIR_O)\LexScriptol.obj \ - $(DIR_O)\LexSmalltalk.obj \ - $(DIR_O)\LexSML.obj \ - $(DIR_O)\LexSorcus.obj \ - $(DIR_O)\LexSpecman.obj \ - $(DIR_O)\LexSpice.obj \ - $(DIR_O)\LexSQL.obj \ - $(DIR_O)\LexStata.obj \ - $(DIR_O)\LexSTTXT.obj \ - $(DIR_O)\LexTACL.obj \ - $(DIR_O)\LexTADS3.obj \ - $(DIR_O)\LexTAL.obj \ - $(DIR_O)\LexTCL.obj \ - $(DIR_O)\LexTCMD.obj \ - $(DIR_O)\LexTeX.obj \ - $(DIR_O)\LexTxt2tags.obj \ - $(DIR_O)\LexVB.obj \ - $(DIR_O)\LexVerilog.obj \ - $(DIR_O)\LexVHDL.obj \ - $(DIR_O)\LexVisualProlog.obj \ - $(DIR_O)\LexX12.obj \ - $(DIR_O)\LexYAML.obj \ - -#--Autogenerated -- end of automatically generated section - -# Required by lexers -LEXLIB_OBJS=\ - $(DIR_O)\Accessor.obj \ - $(DIR_O)\CharacterCategory.obj \ - $(DIR_O)\CharacterSet.obj \ - $(DIR_O)\DefaultLexer.obj \ - $(DIR_O)\LexerBase.obj \ - $(DIR_O)\LexerModule.obj \ - $(DIR_O)\LexerSimple.obj \ - $(DIR_O)\PropSetSimple.obj \ - $(DIR_O)\StyleContext.obj \ - $(DIR_O)\WordList.obj - -# Required by libraries and DLLs that include lexing -LEXILLA_OBJS=\ - $(DIR_O)\Lexilla.obj \ - $(LEXLIB_OBJS) \ - $(LEX_OBJS) - -$(LEXILLA): $(LEXILLA_OBJS) LexillaVersion.res - $(LD) $(LDFLAGS) -DEF:Lexilla.def -DLL -OUT:$@ $** $(LIBS) - -$(LIBLEXILLA): $(LEXILLA_OBJS) - LIB -OUT:$@ $** - -# Define how to build all the objects and what they depend on - -{..\..\src}.cxx{$(DIR_O)}.obj:: - $(CXX) $(CXXFLAGS) -c $(NAME)$(DIR_O)\ $< -{..\..\lexlib}.cxx{$(DIR_O)}.obj:: - $(CXX) $(CXXFLAGS) -c $(NAME)$(DIR_O)\ $< -{..\..\lexers}.cxx{$(DIR_O)}.obj:: - $(CXX) $(CXXFLAGS) -c $(NAME)$(DIR_O)\ $< -{.}.cxx{$(DIR_O)}.obj:: - $(CXX) $(CXXFLAGS) -c $(NAME)$(DIR_O)\ $< - -.rc.res: - $(RC) -fo$@ $** - -# Dependencies - -!IF EXISTS(nmdeps.mak) - -# Protect with !IF EXISTS to handle accidental deletion - just 'nmake -f lexilla.mak deps' - -!INCLUDE nmdeps.mak - -!ENDIF diff --git a/lexilla/src/makefile b/lexilla/src/makefile deleted file mode 100644 index 123d16e6d..000000000 --- a/lexilla/src/makefile +++ /dev/null @@ -1,129 +0,0 @@ -# Make file for Lexilla -# @file makefile -# Copyright 2019 by Neil Hodgson <neilh@scintilla.org> -# The License.txt file describes the conditions under which this software may be distributed. -# This works on Windows or Linux using GCC 9.0+ -# This works on Windows, Linux, or macOS using Clang 9.0+ -# On Windows, it is tested with Mingw-w64 GCC and Clang. -# on macOS, it always uses Clang -# For debug versions define DEBUG on the command line: -# make DEBUG=1 -# On Windows, to build with MSVC, run lexilla.mak - -.PHONY: all clean analyze depend - -.SUFFIXES: .cxx - -DIR_BIN=../../bin - -WARNINGS = -Wpedantic -Wall -Wextra - -ifdef windir - SHARED_NAME = lexilla - SHAREDEXTENSION = dll - WINDRES ?= windres - VERSION_RESOURCE = LexillaVersion.o -else - SHARED_NAME = liblexilla - ifeq ($(shell uname),Darwin) - CLANG := 1 - LDFLAGS += -dynamiclib - SHAREDEXTENSION = dylib - else - SHAREDEXTENSION = so - endif - BASE_FLAGS += -fvisibility=hidden -endif - -LEXILLA=$(DIR_BIN)/$(SHARED_NAME).$(SHAREDEXTENSION) -LIBLEXILLA=$(DIR_BIN)/liblexilla.a - -BASE_FLAGS += --std=c++17 - -ifdef CLANG -CXX = clang++ -ifdef windir -# Clang on Win32 uses MSVC headers so will complain about strcpy without this -DEFINES += -D_CRT_SECURE_NO_DEPRECATE=1 -endif -endif - -ifdef windir - LDFLAGS += -mwindows -else - BASE_FLAGS += -fPIC -endif - -# Take care of changing Unix style '/' directory separator to '\' on Windows -normalize = $(if $(windir),$(subst /,\,$1),$1) - -PYTHON = $(if $(windir),pyw,python3) - -ifdef windir - DEL = $(if $(wildcard $(dir $(SHELL))rm.exe), $(dir $(SHELL))rm.exe -f, del /q) -else - DEL = rm -f -endif - -RANLIB ?= ranlib - -vpath %.h ../../src ../../include ../../lexlib -vpath %.cxx ../../src ../../lexlib ../../lexers - -DEFINES += -D$(if $(DEBUG),DEBUG,NDEBUG) -BASE_FLAGS += $(if $(DEBUG),-g,-Os) - -INCLUDES = -I ../../include -I ../../src -I ../../lexlib -LDFLAGS += -shared - -BASE_FLAGS += $(WARNINGS) - -all: $(LEXILLA) $(LIBLEXILLA) - -clean: - $(DEL) *.o *.obj *.a *.res *.map *.plist $(call normalize,$(LEXILLA) $(LIBLEXILLA)) - -%.o: %.cxx - $(CXX) $(DEFINES) $(INCLUDES) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ - -%.o: %.rc - $(WINDRES) $< $@ - -analyze: - $(CXX) --analyze $(DEFINES) $(INCLUDES) $(BASE_FLAGS) $(CXXFLAGS) *.cxx ../../lexlib/*.cxx ../../lexers/*.cxx - -depend deps.mak: - $(PYTHON) DepGen.py - -LEXERS:=$(sort $(notdir $(wildcard ../../lexers/Lex*.cxx))) - -OBJS = Lexilla.o - -# Required by lexers -LEXLIB_OBJS=\ - Accessor.o \ - CharacterCategory.o \ - CharacterSet.o \ - DefaultLexer.o \ - LexerBase.o \ - LexerModule.o \ - LexerSimple.o \ - PropSetSimple.o \ - StyleContext.o \ - WordList.o - -# Required by libraries and DLLs that include lexing -LEXILLA_OBJS=\ - $(OBJS) \ - $(LEXLIB_OBJS) \ - $(LEXERS:.cxx=.o) - -$(LEXILLA): $(LEXILLA_OBJS) $(VERSION_RESOURCE) - $(CXX) $(CXXFLAGS) $(LDFLAGS) $^ -o $@ - -$(LIBLEXILLA): $(LEXILLA_OBJS) - $(AR) rc $@ $^ - $(RANLIB) $@ - -# Automatically generate dependencies for most files with "make deps" -include deps.mak diff --git a/lexilla/src/nmdeps.mak b/lexilla/src/nmdeps.mak deleted file mode 100644 index d35ef8852..000000000 --- a/lexilla/src/nmdeps.mak +++ /dev/null @@ -1,1519 +0,0 @@ -# Created by DepGen.py. To recreate, run DepGen.py. -$(DIR_O)/Lexilla.obj: \ - ../../lexilla/src/Lexilla.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/CatalogueModules.h -$(DIR_O)/Accessor.obj: \ - ../../lexlib/Accessor.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h -$(DIR_O)/CharacterCategory.obj: \ - ../../lexlib/CharacterCategory.cxx \ - ../../lexlib/CharacterCategory.h -$(DIR_O)/CharacterSet.obj: \ - ../../lexlib/CharacterSet.cxx \ - ../../lexlib/CharacterSet.h -$(DIR_O)/DefaultLexer.obj: \ - ../../lexlib/DefaultLexer.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexerBase.obj: \ - ../../lexlib/LexerBase.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/LexerBase.h -$(DIR_O)/LexerModule.obj: \ - ../../lexlib/LexerModule.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/LexerBase.h \ - ../../lexlib/LexerSimple.h -$(DIR_O)/LexerNoExceptions.obj: \ - ../../lexlib/LexerNoExceptions.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/LexerBase.h \ - ../../lexlib/LexerNoExceptions.h -$(DIR_O)/LexerSimple.obj: \ - ../../lexlib/LexerSimple.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/LexerBase.h \ - ../../lexlib/LexerSimple.h -$(DIR_O)/PropSetSimple.obj: \ - ../../lexlib/PropSetSimple.cxx \ - ../../lexlib/PropSetSimple.h -$(DIR_O)/StyleContext.obj: \ - ../../lexlib/StyleContext.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h -$(DIR_O)/WordList.obj: \ - ../../lexlib/WordList.cxx \ - ../../lexlib/WordList.h -$(DIR_O)/LexA68k.obj: \ - ../../lexers/LexA68k.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexAbaqus.obj: \ - ../../lexers/LexAbaqus.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexAda.obj: \ - ../../lexers/LexAda.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexAPDL.obj: \ - ../../lexers/LexAPDL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexAsm.obj: \ - ../../lexers/LexAsm.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexAsn1.obj: \ - ../../lexers/LexAsn1.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexASY.obj: \ - ../../lexers/LexASY.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexAU3.obj: \ - ../../lexers/LexAU3.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexAVE.obj: \ - ../../lexers/LexAVE.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexAVS.obj: \ - ../../lexers/LexAVS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexBaan.obj: \ - ../../lexers/LexBaan.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexBash.obj: \ - ../../lexers/LexBash.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SubStyles.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexBasic.obj: \ - ../../lexers/LexBasic.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexBatch.obj: \ - ../../lexers/LexBatch.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexBibTeX.obj: \ - ../../lexers/LexBibTeX.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexBullant.obj: \ - ../../lexers/LexBullant.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexCaml.obj: \ - ../../lexers/LexCaml.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../src/ExternalLexer.h -$(DIR_O)/LexCIL.obj: \ - ../../lexers/LexCIL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexCLW.obj: \ - ../../lexers/LexCLW.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexCmake.obj: \ - ../../lexers/LexCmake.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexCOBOL.obj: \ - ../../lexers/LexCOBOL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexCoffeeScript.obj: \ - ../../lexers/LexCoffeeScript.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexConf.obj: \ - ../../lexers/LexConf.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexCPP.obj: \ - ../../lexers/LexCPP.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SparseState.h \ - ../../lexlib/SubStyles.h -$(DIR_O)/LexCrontab.obj: \ - ../../lexers/LexCrontab.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexCsound.obj: \ - ../../lexers/LexCsound.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexCSS.obj: \ - ../../lexers/LexCSS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexD.obj: \ - ../../lexers/LexD.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexDataflex.obj: \ - ../../lexers/LexDataflex.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexDiff.obj: \ - ../../lexers/LexDiff.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexDMAP.obj: \ - ../../lexers/LexDMAP.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexDMIS.obj: \ - ../../lexers/LexDMIS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexECL.obj: \ - ../../lexers/LexECL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h -$(DIR_O)/LexEDIFACT.obj: \ - ../../lexers/LexEDIFACT.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexEiffel.obj: \ - ../../lexers/LexEiffel.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexErlang.obj: \ - ../../lexers/LexErlang.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexErrorList.obj: \ - ../../lexers/LexErrorList.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexEScript.obj: \ - ../../lexers/LexEScript.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexFlagship.obj: \ - ../../lexers/LexFlagship.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexForth.obj: \ - ../../lexers/LexForth.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexFortran.obj: \ - ../../lexers/LexFortran.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexGAP.obj: \ - ../../lexers/LexGAP.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexGui4Cli.obj: \ - ../../lexers/LexGui4Cli.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexHaskell.obj: \ - ../../lexers/LexHaskell.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/CharacterCategory.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexHex.obj: \ - ../../lexers/LexHex.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexHollywood.obj: \ - ../../lexers/LexHollywood.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexHTML.obj: \ - ../../lexers/LexHTML.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexIndent.obj: \ - ../../lexers/LexIndent.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexInno.obj: \ - ../../lexers/LexInno.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexJSON.obj: \ - ../../lexers/LexJSON.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexKix.obj: \ - ../../lexers/LexKix.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexKVIrc.obj: \ - ../../lexers/LexKVIrc.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexLaTeX.obj: \ - ../../lexers/LexLaTeX.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h \ - ../../lexlib/LexerBase.h -$(DIR_O)/LexLisp.obj: \ - ../../lexers/LexLisp.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexLout.obj: \ - ../../lexers/LexLout.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexLua.obj: \ - ../../lexers/LexLua.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMagik.obj: \ - ../../lexers/LexMagik.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMake.obj: \ - ../../lexers/LexMake.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMarkdown.obj: \ - ../../lexers/LexMarkdown.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMatlab.obj: \ - ../../lexers/LexMatlab.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMaxima.obj: \ - ../../lexers/LexMaxima.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMetapost.obj: \ - ../../lexers/LexMetapost.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMMIXAL.obj: \ - ../../lexers/LexMMIXAL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexModula.obj: \ - ../../lexers/LexModula.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMPT.obj: \ - ../../lexers/LexMPT.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMSSQL.obj: \ - ../../lexers/LexMSSQL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexMySQL.obj: \ - ../../lexers/LexMySQL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexNim.obj: \ - ../../lexers/LexNim.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexNimrod.obj: \ - ../../lexers/LexNimrod.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexNsis.obj: \ - ../../lexers/LexNsis.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexNull.obj: \ - ../../lexers/LexNull.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexOpal.obj: \ - ../../lexers/LexOpal.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexOScript.obj: \ - ../../lexers/LexOScript.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexPascal.obj: \ - ../../lexers/LexPascal.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexPB.obj: \ - ../../lexers/LexPB.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexPerl.obj: \ - ../../lexers/LexPerl.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexPLM.obj: \ - ../../lexers/LexPLM.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexPO.obj: \ - ../../lexers/LexPO.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexPOV.obj: \ - ../../lexers/LexPOV.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexPowerPro.obj: \ - ../../lexers/LexPowerPro.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexPowerShell.obj: \ - ../../lexers/LexPowerShell.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexProgress.obj: \ - ../../lexers/LexProgress.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SparseState.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexProps.obj: \ - ../../lexers/LexProps.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexPS.obj: \ - ../../lexers/LexPS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexPython.obj: \ - ../../lexers/LexPython.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/StringCopy.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/CharacterCategory.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SubStyles.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexR.obj: \ - ../../lexers/LexR.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexRaku.obj: \ - ../../lexers/LexRaku.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/CharacterCategory.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexRebol.obj: \ - ../../lexers/LexRebol.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexRegistry.obj: \ - ../../lexers/LexRegistry.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexRuby.obj: \ - ../../lexers/LexRuby.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexRust.obj: \ - ../../lexers/LexRust.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/PropSetSimple.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexSAS.obj: \ - ../../lexers/LexSAS.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexScriptol.obj: \ - ../../lexers/LexScriptol.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexSmalltalk.obj: \ - ../../lexers/LexSmalltalk.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexSML.obj: \ - ../../lexers/LexSML.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexSorcus.obj: \ - ../../lexers/LexSorcus.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexSpecman.obj: \ - ../../lexers/LexSpecman.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexSpice.obj: \ - ../../lexers/LexSpice.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexSQL.obj: \ - ../../lexers/LexSQL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SparseState.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexStata.obj: \ - ../../lexers/LexStata.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexSTTXT.obj: \ - ../../lexers/LexSTTXT.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexTACL.obj: \ - ../../lexers/LexTACL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexTADS3.obj: \ - ../../lexers/LexTADS3.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexTAL.obj: \ - ../../lexers/LexTAL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexTCL.obj: \ - ../../lexers/LexTCL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexTCMD.obj: \ - ../../lexers/LexTCMD.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexTeX.obj: \ - ../../lexers/LexTeX.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexTxt2tags.obj: \ - ../../lexers/LexTxt2tags.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexVB.obj: \ - ../../lexers/LexVB.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexVerilog.obj: \ - ../../lexers/LexVerilog.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/SubStyles.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexVHDL.obj: \ - ../../lexers/LexVHDL.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h -$(DIR_O)/LexVisualProlog.obj: \ - ../../lexers/LexVisualProlog.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/CharacterCategory.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/OptionSet.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexX12.obj: \ - ../../lexers/LexX12.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/LexerModule.h \ - ../../lexlib/DefaultLexer.h -$(DIR_O)/LexYAML.obj: \ - ../../lexers/LexYAML.cxx \ - ../../include/ILexer.h \ - ../../include/Sci_Position.h \ - ../../include/Scintilla.h \ - ../../include/SciLexer.h \ - ../../lexlib/WordList.h \ - ../../lexlib/LexAccessor.h \ - ../../lexlib/Accessor.h \ - ../../lexlib/StyleContext.h \ - ../../lexlib/CharacterSet.h \ - ../../lexlib/LexerModule.h diff --git a/lexilla/test/LexillaAccess.cxx b/lexilla/test/LexillaAccess.cxx deleted file mode 100644 index 10e7675db..000000000 --- a/lexilla/test/LexillaAccess.cxx +++ /dev/null @@ -1,95 +0,0 @@ -// Scintilla source code edit control -/** @file LexillaAccess.cxx - ** Interface to Lexilla shared library. - **/ - // Copyright 2019 by Neil Hodgson <neilh@scintilla.org> - // The License.txt file describes the conditions under which this software may be distributed. - -#include <cstring> - -#include <iterator> - -#include <iostream> -#include <filesystem> - -#if !_WIN32 -#include <dlfcn.h> -#else -#include <windows.h> -#endif - -#include "ILexer.h" - -#include "Lexilla.h" - -#include "LexillaAccess.h" - -#if _WIN32 -#define EXT_LEXER_DECL __stdcall -typedef FARPROC Function; -typedef HMODULE Module; -#else -#define EXT_LEXER_DECL -typedef void *Function; -typedef void *Module; -#endif - -typedef Scintilla::ILexer5 *(EXT_LEXER_DECL *CreateLexerFn)(const char *name); - -Module lexillaDL {}; - -/// Generic function to convert from a Function(void* or FARPROC) to a function pointer. -/// This avoids undefined and conditionally defined behaviour. -template<typename T> -T FunctionPointer(Function function) noexcept { - static_assert(sizeof(T) == sizeof(function)); - T fp; - memcpy(&fp, &function, sizeof(T)); - return fp; -} - -CreateLexerFn fnCL; - -Function FindSymbol(const char *symbol) noexcept { -#if _WIN32 - return ::GetProcAddress(lexillaDL, symbol); -#else - return dlsym(lexillaDL, symbol); -#endif -} - -Scintilla::ILexer5 *CreateLexer(std::string languageName) { -#ifdef LEXILLA_STATIC - return CreateLexer(languageName.c_str()); -#else - return fnCL(languageName.c_str()); -#endif -} - -bool LoadLexilla([[maybe_unused]] std::filesystem::path path) { -#ifdef LEXILLA_STATIC - return true; -#else - std::filesystem::path sharedLibrary = path; - sharedLibrary.append("bin"); -#if _WIN32 - sharedLibrary.append("lexilla.dll"); - lexillaDL = ::LoadLibraryW(sharedLibrary.c_str()); -#else -#if defined(__APPLE__) - sharedLibrary.append("liblexilla.dylib"); -#else - sharedLibrary.append("liblexilla.so"); -#endif - lexillaDL = dlopen(sharedLibrary.c_str(), RTLD_LAZY); -#endif - - if (lexillaDL) { - fnCL = FunctionPointer<CreateLexerFn>(FindSymbol("CreateLexer")); - } else { - std::cout << "Cannot load " << sharedLibrary.string() << "\n"; - } - - return lexillaDL && fnCL; -#endif -} diff --git a/lexilla/test/LexillaAccess.h b/lexilla/test/LexillaAccess.h deleted file mode 100644 index 3e4e087cb..000000000 --- a/lexilla/test/LexillaAccess.h +++ /dev/null @@ -1,9 +0,0 @@ -// Scintilla source code edit control -/** @file LexillaAccess.h - ** Interface to Lexilla shared library. - **/ -// Copyright 2019 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -Scintilla::ILexer5 *CreateLexer(std::string languageName); -bool LoadLexilla(std::filesystem::path path); diff --git a/lexilla/test/README b/lexilla/test/README deleted file mode 100644 index 119f08cf2..000000000 --- a/lexilla/test/README +++ /dev/null @@ -1,65 +0,0 @@ -README for testing lexers with lexilla/test.
-
-The TestLexers application is run to test the lexing of a set of example files
-and thus ensure that the lexers are working correctly.
-
-Lexers are accessed through the Lexilla shared library which must be built first
-in the lexilla/src directory.
-
-TestLexers works on Windows, Linux, or macOS and requires a C++20 compiler.
-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.
-
-To use GCC run lexilla/test/makefile:
- make test
-
-To use Clang run lexilla/test/makefile:
- make CLANG=1 test
-On macOS, CLANG is set automatically so this can just be
- make test
-
-To use MSVC:
- nmake -f testlexers.mak test
-There is also a project file TestLexers.vcxproj that can be loaded into the Visual
-C++ IDE.
-
-
-
-Adding or Changing Tests
-
-The lexilla/test/examples directory contains a set of tests located in a tree of
-subdirectories.
-
-Each directory contains example files along with control files called
-SciTE.properties and expected result files with a .styled suffix.
-If an unexpected result occurs then files with the suffix .new may be created.
-
-Each file in the examples tree that does not have an extension of .properties, .styled, or
-.new is an example file that will be lexed according to settings found in SciTE.properties.
-The results of the lex will be compared to the corresponding .styled file and if different
-the result will be saved to a .new file for checking.
-So, if x.cxx is the example, its lexed form will be checked against x.cxx.styled and a
-x.cxx.new file may be created. The .new and .styled files contain the text of the original
-file along with style number changes in {} like:
- {5}function{0} {11}first{10}(){0}
-After checking that the .new file is correct, it can be promoted to .styled and committed
-to the repository.
-
-The SciTE.properties file is similar to properties files used for SciTE but are simpler.
-The lexer to be run is defined with a lexer.{filepattern} statement like:
- lexer.*.d=d
-
-Keywords may be defined with keywords settings like:
- keywords.*.cxx=int char
- keywords2.*.cxx=open
-
-Other settings are treated as lexer properties and forwarded to the lexer:
- lexer.cpp.track.preprocessor=1
-
-If there is a need to test additional configurations of keywords or properties then
-create another subdirectory with the different settings in a new SciTE.properties.
diff --git a/lexilla/test/TestDocument.cxx b/lexilla/test/TestDocument.cxx deleted file mode 100644 index 7356768c8..000000000 --- a/lexilla/test/TestDocument.cxx +++ /dev/null @@ -1,246 +0,0 @@ -// Scintilla source code edit control -/** @file TestDocument.cxx - ** Lexer testing. - **/ - // Copyright 2019 by Neil Hodgson <neilh@scintilla.org> - // The License.txt file describes the conditions under which this software may be distributed. - -#include <cassert> - -#include <string> -#include <string_view> -#include <vector> -#include <algorithm> - -#include <iostream> - -#include "ILexer.h" - -#include "TestDocument.h" - -namespace { - - const unsigned char UTF8BytesOfLead[256] = { - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 00 - 0F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 10 - 1F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 20 - 2F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 30 - 3F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 40 - 4F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 50 - 5F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 60 - 6F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 70 - 7F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 80 - 8F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // 90 - 9F - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // A0 - AF - 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // B0 - BF - 1, 1, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // C0 - CF - 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, // D0 - DF - 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, // E0 - EF - 4, 4, 4, 4, 4, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, // F0 - FF - }; - - int UnicodeFromUTF8(const unsigned char *us) noexcept { - switch (UTF8BytesOfLead[us[0]]) { - case 1: - return us[0]; - case 2: - return ((us[0] & 0x1F) << 6) + (us[1] & 0x3F); - case 3: - return ((us[0] & 0xF) << 12) + ((us[1] & 0x3F) << 6) + (us[2] & 0x3F); - default: - return ((us[0] & 0x7) << 18) + ((us[1] & 0x3F) << 12) + ((us[2] & 0x3F) << 6) + (us[3] & 0x3F); - } - } - - inline constexpr bool UTF8IsTrailByte(unsigned char ch) noexcept { - return (ch >= 0x80) && (ch < 0xc0); - } - -} - -void TestDocument::Set(std::string_view sv) { - text = sv; - textStyles.resize(text.size()); - lineStarts.clear(); - endStyled = 0; - lineStarts.push_back(0); - for (size_t pos = 0; pos < text.length(); pos++) { - if (text[pos] == '\n') { - lineStarts.push_back(pos + 1); - } - } - lineStarts.push_back(text.length()); - lineStates.resize(lineStarts.size()); -} - -int SCI_METHOD TestDocument::Version() const { - return Scintilla::dvRelease4; -} - -void SCI_METHOD TestDocument::SetErrorStatus(int) { -} - -Sci_Position SCI_METHOD TestDocument::Length() const { - return text.length(); -} - -void SCI_METHOD TestDocument::GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const { - text.copy(buffer, lengthRetrieve, position); -} - -char SCI_METHOD TestDocument::StyleAt(Sci_Position position) const { - return textStyles.at(position); -} - -Sci_Position SCI_METHOD TestDocument::LineFromPosition(Sci_Position position) const { - if (position >= static_cast<Sci_Position>(text.length())) { - return lineStarts.size() - 1 - 1; - } - - std::vector<Sci_Position>::const_iterator it = std::lower_bound(lineStarts.begin(), lineStarts.end(), position); - Sci_Position line = it - lineStarts.begin(); - if (*it > position) - line--; - return line; -} - -Sci_Position SCI_METHOD TestDocument::LineStart(Sci_Position line) const { - if (line >= static_cast<Sci_Position>(lineStarts.size())) { - return text.length(); - } - return lineStarts.at(line); -} - -int SCI_METHOD TestDocument::GetLevel(Sci_Position) const { - // Only for folding so not implemented yet - return 0; -} - -int SCI_METHOD TestDocument::SetLevel(Sci_Position, int) { - // Only for folding so not implemented yet - return 0; -} - -int SCI_METHOD TestDocument::GetLineState(Sci_Position line) const { - return lineStates.at(line); -} - -int SCI_METHOD TestDocument::SetLineState(Sci_Position line, int state) { - return lineStates.at(line) = state; -} - -void SCI_METHOD TestDocument::StartStyling(Sci_Position position) { - endStyled = position; -} - -bool SCI_METHOD TestDocument::SetStyleFor(Sci_Position length, char style) { - for (Sci_Position i = 0; i < length; i++) { - textStyles[endStyled] = style; - endStyled++; - } - return true; -} - -bool SCI_METHOD TestDocument::SetStyles(Sci_Position length, const char *styles) { - for (Sci_Position i = 0; i < length; i++) { - textStyles[endStyled] = styles[i]; - endStyled++; - } - return true; -} - -void SCI_METHOD TestDocument::DecorationSetCurrentIndicator(int) { - // Not implemented as no way to read decorations -} - -void SCI_METHOD TestDocument::DecorationFillRange(Sci_Position, int, Sci_Position) { - // Not implemented as no way to read decorations -} - -void SCI_METHOD TestDocument::ChangeLexerState(Sci_Position, Sci_Position) { - // Not implemented as no watcher to trigger -} - -int SCI_METHOD TestDocument::CodePage() const { - // Always UTF-8 for now - return 65001; -} - -bool SCI_METHOD TestDocument::IsDBCSLeadByte(char) const { - // Always UTF-8 for now - return false; -} - -const char *SCI_METHOD TestDocument::BufferPointer() { - return text.c_str(); -} - -int SCI_METHOD TestDocument::GetLineIndentation(Sci_Position) { - // Never actually called - lexers use Accessor::IndentAmount - return 0; -} - -Sci_Position SCI_METHOD TestDocument::LineEnd(Sci_Position line) const { - Sci_Position position = LineStart(line + 1); - position--; // Back over CR or LF - // When line terminator is CR+LF, may need to go back one more - if ((position > LineStart(line)) && (text.at(position - 1) == '\r')) { - position--; - } - return position; -} - -Sci_Position SCI_METHOD TestDocument::GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const { - Sci_Position pos = positionStart; - if (characterOffset < 0) { - while (characterOffset < 0) { - if (pos <= 0) { - return 0; - } - unsigned char previousByte = text.at(pos - 1); - if (previousByte < 0x80) { - pos--; - characterOffset++; - } else { - while ((pos > 1) && UTF8IsTrailByte(previousByte)) { - pos--; - previousByte = text.at(pos - 1); - } - pos--; - // text[pos] is now a character start - characterOffset++; - } - } - return pos; - } - assert(characterOffset >= 0); - // TODO: invalid UTF-8 - while (characterOffset > 0) { - Sci_Position width = 0; - GetCharacterAndWidth(pos, &width); - pos += width; - characterOffset--; - } - return pos; -} - -int SCI_METHOD TestDocument::GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const { - // TODO: invalid UTF-8 - if (position >= static_cast<Sci_Position>(text.length())) { - // Return NULs after document end - if (pWidth) { - *pWidth = 1; - } - return '\0'; - } - const unsigned char leadByte = text.at(position); - const int widthCharBytes = UTF8BytesOfLead[leadByte]; - unsigned char charBytes[] = { leadByte,0,0,0 }; - for (int b = 1; b < widthCharBytes; b++) - charBytes[b] = text[position + b]; - - if (pWidth) { - *pWidth = widthCharBytes; - } - return UnicodeFromUTF8(charBytes); -} diff --git a/lexilla/test/TestDocument.h b/lexilla/test/TestDocument.h deleted file mode 100644 index fd7181319..000000000 --- a/lexilla/test/TestDocument.h +++ /dev/null @@ -1,43 +0,0 @@ -// Scintilla source code edit control -/** @file TestDocument.h - ** Lexer testing. - **/ -// Copyright 2019 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -class TestDocument : public Scintilla::IDocument { - std::string text; - std::string textStyles; - std::vector<Sci_Position> lineStarts; - std::vector<int> lineStates; - Sci_Position endStyled=0; -public: - void Set(std::string_view sv); - virtual ~TestDocument() = default; - - int SCI_METHOD Version() const override; - void SCI_METHOD SetErrorStatus(int status) override; - Sci_Position SCI_METHOD Length() const override; - void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const override; - char SCI_METHOD StyleAt(Sci_Position position) const override; - Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const override; - Sci_Position SCI_METHOD LineStart(Sci_Position line) const override; - int SCI_METHOD GetLevel(Sci_Position line) const override; - int SCI_METHOD SetLevel(Sci_Position line, int level) override; - int SCI_METHOD GetLineState(Sci_Position line) const override; - int SCI_METHOD SetLineState(Sci_Position line, int state) override; - void SCI_METHOD StartStyling(Sci_Position position) override; - bool SCI_METHOD SetStyleFor(Sci_Position length, char style) override; - bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) override; - void SCI_METHOD DecorationSetCurrentIndicator(int indicator) override; - void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) override; - void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) override; - int SCI_METHOD CodePage() const override; - bool SCI_METHOD IsDBCSLeadByte(char ch) const override; - const char *SCI_METHOD BufferPointer() override; - int SCI_METHOD GetLineIndentation(Sci_Position line) override; - Sci_Position SCI_METHOD LineEnd(Sci_Position line) const override; - Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const override; - int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const override; -}; - diff --git a/lexilla/test/TestLexers.cxx b/lexilla/test/TestLexers.cxx deleted file mode 100644 index 71b9a44e7..000000000 --- a/lexilla/test/TestLexers.cxx +++ /dev/null @@ -1,241 +0,0 @@ -// TestLexers.cxx : Test lexers through Lexilla -// - -#include <cassert> - -#include <string> -#include <string_view> -#include <vector> -#include <map> - -#include <iostream> -#include <sstream> -#include <fstream> -#include <filesystem> - -#include "ILexer.h" - -#include "TestDocument.h" -#include "LexillaAccess.h" - -namespace { - -std::string ReadFile(std::filesystem::path path) { - std::ifstream ifs(path, std::ios::binary); - std::string content((std::istreambuf_iterator<char>(ifs)), - (std::istreambuf_iterator<char>())); - return content; -} - -std::string MarkedDocument(const Scintilla::IDocument *pdoc) { - std::ostringstream os(std::ios::binary); - char prevStyle = -1; - for (Sci_Position pos = 0; pos < pdoc->Length(); pos++) { - const char styleNow = pdoc->StyleAt(pos); - if (styleNow != prevStyle) { - os << "{" << static_cast<unsigned int>(styleNow) << "}"; - prevStyle = styleNow; - } - char ch = '\0'; - pdoc->GetCharRange(&ch, pos, 1); - os << ch; - } - return os.str(); -} - -std::map<std::string, std::string> PropertiesFromFile(std::filesystem::path path) { - std::map<std::string, std::string> m; - std::ifstream ifs(path); - std::string line; - std::string logicalLine; - while (std::getline(ifs, line)) { - logicalLine += line; - if (logicalLine.ends_with("\\")) { - logicalLine.pop_back(); - } else { - const size_t positionEquals = logicalLine.find("="); - if (positionEquals != std::string::npos) { - const std::string key = logicalLine.substr(0, positionEquals); - const std::string value = logicalLine.substr(positionEquals+1); - m[key] = value; - } - logicalLine.clear(); - } - } - return m; -} - -int Substitute(std::string &s, const std::string &sFind, const std::string &sReplace) { - int c = 0; - const size_t lenFind = sFind.size(); - const size_t lenReplace = sReplace.size(); - size_t posFound = s.find(sFind); - while (posFound != std::string::npos) { - s.replace(posFound, lenFind, sReplace); - posFound = s.find(sFind, posFound + lenReplace); - c++; - } - return c; -} - -const std::string BOM = "\xEF\xBB\xBF"; - -void TestCRLF(std::filesystem::path path, const std::string s, Scintilla::ILexer5 *plex) { - // Convert all line ends to \r\n to check if styles change between \r and \n which makes - // it difficult to test on different platforms when files may have line ends changed. - std::string text = s; - Substitute(text, "\r\n", "\n"); - Substitute(text, "\n", "\r\n"); - TestDocument doc; - doc.Set(text); - Scintilla::IDocument *pdoc = &doc; - plex->Lex(0, pdoc->Length(), 0, pdoc); - int prevStyle = -1; - Sci_Position line = 1; - for (Sci_Position pos = 0; pos < pdoc->Length(); pos++) { - const int styleNow = pdoc->StyleAt(pos); - char ch = '\0'; - pdoc->GetCharRange(&ch, pos, 1); - if (ch == '\n') { - if (styleNow != prevStyle) { - std::cout << path.string() << ":" << line << ":" << - " different styles between \\r and \\n at " << - pos << ": " << prevStyle << ", " << styleNow << "\n"; - } - line++; - } - prevStyle = styleNow; - } - plex->Release(); -} - -bool TestFile(std::filesystem::path path, - std::map<std::string, std::string> properties) { - // Find and create correct lexer - std::string language; - Scintilla::ILexer5 *plex = nullptr; - for (auto const &[key, val] : properties) { - if (key.starts_with("lexer.*")) { - language = val; - plex = CreateLexer(language); - break; - } - } - if (!plex) { - return false; - } - - // Set parameters of lexer - const std::string keywords = "keywords"; - for (auto const &[key, val] : properties) { - if (key.starts_with("#")) { - // Ignore comments - } else if (key.starts_with("lexer.*")) { - // Ignore - } else if (key.starts_with("keywords")) { - // Get character after keywords - std::string afterKeywords = key.substr(keywords.length(), 1); - char characterAfterKeywords = afterKeywords.empty() ? '1' : afterKeywords[0]; - if (characterAfterKeywords < '1' || characterAfterKeywords > '9') - characterAfterKeywords = '1'; - const int wordSet = characterAfterKeywords - '1'; - plex->WordListSet(wordSet, val.c_str()); - } else { - plex->PropertySet(key.c_str(), val.c_str()); - } - } - std::string text = ReadFile(path); - if (text.starts_with(BOM)) { - text.erase(0, BOM.length()); - } - - TestDocument doc; - doc.Set(text); - Scintilla::IDocument *pdoc = &doc; - plex->Lex(0, pdoc->Length(), 0, pdoc); - const std::string styledTextNew = MarkedDocument(pdoc); - std::filesystem::path pathStyled = path; - pathStyled += ".styled"; - const std::string styledText = ReadFile(pathStyled); - if (styledTextNew != styledText) { - std::cout << "\n" << path.string() << ":1: is different\n\n"; - std::filesystem::path pathNew = path; - pathNew += ".new"; - std::ofstream ofs(pathNew, std::ios::binary); - ofs << styledTextNew; - } - plex->Release(); - - TestCRLF(path, text, CreateLexer(language)); - - return true; -} - -bool TestDirectory(std::filesystem::path directory, std::filesystem::path basePath) { - const std::map<std::string, std::string> properties = PropertiesFromFile(directory / "SciTE.properties"); - bool success = true; - for (auto &p : std::filesystem::directory_iterator(directory)) { - if (!p.is_directory()) { - const std::string extension = p.path().extension().string(); - if (extension != ".properties" && extension != ".styled" && extension != ".new") { - const std::filesystem::path relativePath = p.path().lexically_relative(basePath); - std::cout << "Lexing " << relativePath.string() << '\n'; - if (!TestFile(p, properties)) { - success = false; - } - } - } - } - return success; -} - -bool AccessLexilla(std::filesystem::path basePath) { - if (!std::filesystem::exists(basePath)) { - std::cout << "No examples at " << basePath.string() << "\n"; - return false; - } - - bool success = true; - for (auto &p : std::filesystem::recursive_directory_iterator(basePath)) { - if (p.is_directory()) { - //std::cout << p.path().string() << '\n'; - if (!TestDirectory(p, basePath)) { - success = false; - } - } - } - return success; -} - -std::filesystem::path FindScintillaDirectory(std::filesystem::path startDirectory) { - std::filesystem::path directory = startDirectory; - while (!directory.empty()) { - const std::filesystem::path localScintilla = directory / "scintilla"; - const std::filesystem::directory_entry entry(localScintilla); - if (entry.is_directory()) { - std::cout << "Found Scintilla at " << entry.path().string() << "\n"; - return localScintilla; - } - const std::filesystem::path parent = directory.parent_path(); - if (parent == directory) { - std::cout << "Reached root at " << directory.string() << "\n"; - return std::filesystem::path(); - } - directory = parent; - } - return std::filesystem::path(); -} - -} - - - -int main() { - // TODO: Allow specifying the base directory through a command line argument - const std::filesystem::path baseDirectory = FindScintillaDirectory(std::filesystem::current_path()); - if (!baseDirectory.empty()) { - if (LoadLexilla(baseDirectory)) { - AccessLexilla(baseDirectory / "lexilla" / "test" / "examples"); - } - } -} diff --git a/lexilla/test/TestLexers.vcxproj b/lexilla/test/TestLexers.vcxproj deleted file mode 100644 index aa6c516d4..000000000 --- a/lexilla/test/TestLexers.vcxproj +++ /dev/null @@ -1,176 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <VCProjectVersion>16.0</VCProjectVersion>
- <ProjectGuid>{2E0BBD6B-4BC8-4A6C-9DDA-199C27899335}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>lexillatest</RootNamespace>
- <WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>true</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <ConfigurationType>Application</ConfigurationType>
- <UseDebugLibraries>false</UseDebugLibraries>
- <PlatformToolset>v142</PlatformToolset>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- <CharacterSet>Unicode</CharacterSet>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="Shared">
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <LinkIncremental>true</LinkIncremental>
- <CodeAnalysisRuleSet>..\..\..\..\..\..\..\Users\Neil\NeilRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <LinkIncremental>true</LinkIncremental>
- <CodeAnalysisRuleSet>..\..\..\..\..\..\..\Users\Neil\NeilRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <LinkIncremental>false</LinkIncremental>
- <CodeAnalysisRuleSet>..\..\..\..\..\..\..\Users\Neil\NeilRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <LinkIncremental>false</LinkIncremental>
- <CodeAnalysisRuleSet>..\..\..\..\..\..\..\Users\Neil\NeilRules.ruleset</CodeAnalysisRuleSet>
- </PropertyGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <AdditionalIncludeDirectories>..\..\include;..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard>stdcpplatest</LanguageStandard>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>Disabled</Optimization>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <AdditionalIncludeDirectories>..\..\include;..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard>stdcpplatest</LanguageStandard>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <AdditionalIncludeDirectories>..\..\include;..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard>stdcpplatest</LanguageStandard>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <PrecompiledHeader>
- </PrecompiledHeader>
- <WarningLevel>Level3</WarningLevel>
- <Optimization>MaxSpeed</Optimization>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <SDLCheck>true</SDLCheck>
- <PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <ConformanceMode>true</ConformanceMode>
- <AdditionalIncludeDirectories>..\..\include;..\src;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
- <LanguageStandard>stdcpplatest</LanguageStandard>
- </ClCompile>
- <Link>
- <SubSystem>Console</SubSystem>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="LexillaAccess.cxx" />
- <ClCompile Include="TestLexers.cxx" />
- <ClCompile Include="TestDocument.cxx" />
- </ItemGroup>
- <ItemGroup>
- <None Include="..\..\bin\Lexilla.dll" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file diff --git a/lexilla/test/examples/batch/SciTE.properties b/lexilla/test/examples/batch/SciTE.properties deleted file mode 100644 index c3963bd1e..000000000 --- a/lexilla/test/examples/batch/SciTE.properties +++ /dev/null @@ -1,3 +0,0 @@ -lexer.*.bat=batch -keywords.*.bat=call defined do echo else errorlevel exist exit for goto if in not set - diff --git a/lexilla/test/examples/batch/x.bat b/lexilla/test/examples/batch/x.bat deleted file mode 100644 index 916efd36a..000000000 --- a/lexilla/test/examples/batch/x.bat +++ /dev/null @@ -1,39 +0,0 @@ -rem comment=1 -rem 'echo' is word=2, 'a' is default=0 -echo a -rem label=3 -:START -rem '@' is hide=4 -@echo b -rem 'gcc' is external command=5 -gcc --version -rem '%PATH%' is variable=6 -echo %PATH% -echo %ProgramFiles(x86)% -rem operator=7 '=' -@set Q=A - -::comment=1 - -:: Bug 1624: this construct produced inconsistent brackets in the past -if ERRORLEVEL 2 goto END -@if exist a ( -echo exists -) else ( -echo not -) - -FOR /L %%G IN (2,1,4) DO (echo %%G) - -:: Bug 1997: keywords not recognized when preceded by '(' -IF NOT DEFINED var (SET var=1) - -:: Bug 2065: keywords not recognized when followed by ')' -@if exist a ( exit) - -:: Bug: with \r or \n, 'command' is seen as continuation -echo word ^ -1 -command - -:END diff --git a/lexilla/test/examples/batch/x.bat.styled b/lexilla/test/examples/batch/x.bat.styled deleted file mode 100644 index 02d1ffcc8..000000000 --- a/lexilla/test/examples/batch/x.bat.styled +++ /dev/null @@ -1,39 +0,0 @@ -{1}rem comment=1 -rem 'echo' is word=2, 'a' is default=0 -{2}echo{0} a -{1}rem label=3 -{3}:START -{1}rem '@' is hide=4 -{4}@{2}echo{0} b -{1}rem 'gcc' is external command=5 -{5}gcc{0} --version -{1}rem '%PATH%' is variable=6 -{2}echo{0} {6}%PATH%{0} -{2}echo{0} {6}%ProgramFiles(x86)%{0} -{1}rem operator=7 '=' -{4}@{2}set{0} Q{7}={0}A - -{1}::comment=1 -{0} -{1}:: Bug 1624: this construct produced inconsistent brackets in the past -{2}if ERRORLEVEL{0} 2{2} goto{0} END -{4}@{2}if exist{0} a ( -{2}echo{0} exists -){2} else{0} ( -{2}echo{0} not -) - -{2}FOR{0} /L {6}%%G{2} IN{0} (2,1,4){2} DO{0} ({2}echo{0} {6}%%G{0}) - -{1}:: Bug 1997: keywords not recognized when preceded by '(' -{2}IF NOT DEFINED{0} var ({2}SET{0} var{7}={0}1) - -{1}:: Bug 2065: keywords not recognized when followed by ')' -{4}@{2}if exist{0} a ({2} exit{0}) - -{1}:: Bug: with \r or \n, 'command' is seen as continuation -{2}echo{0} word ^ -1 -{5}command{0} - -{3}:END diff --git a/lexilla/test/examples/cpp/SciTE.properties b/lexilla/test/examples/cpp/SciTE.properties deleted file mode 100644 index ae3a6e95b..000000000 --- a/lexilla/test/examples/cpp/SciTE.properties +++ /dev/null @@ -1,5 +0,0 @@ -lexer.*.cxx=cpp -keywords.*.cxx=int let -keywords2.*.cxx= -lexer.cpp.track.preprocessor=1 -lexer.cpp.escape.sequence=1 diff --git a/lexilla/test/examples/cpp/x.cxx b/lexilla/test/examples/cpp/x.cxx deleted file mode 100644 index c1f052882..000000000 --- a/lexilla/test/examples/cpp/x.cxx +++ /dev/null @@ -1,27 +0,0 @@ -// A demonstration program -#include <stdio.h> -#if 0 /* */ -#define DUMMY() \ - if (1); -#endif - -#define M\ - -\ - -int main() { - double x[] = {3.14159,6.02e23,1.6e-19,1.0+1}; - int y[] = {75,0113,0x4b}; - printf("hello world %d %g\n", y[0], x[0]); - - // JavaScript regular expression (14) tests - let a = /a/; - let b = /[a-z]+/gi; - - // Escape sequence (27) tests - printf("\'\"\?\\\a\b\f\n\r\t\v \P"); - printf("\0a \013a \019"); - printf("\x013ac \xdz"); - printf("\ua34df \uz"); - printf("\Ua34df7833 \Uz"); -} diff --git a/lexilla/test/examples/cpp/x.cxx.styled b/lexilla/test/examples/cpp/x.cxx.styled deleted file mode 100644 index e4241eba2..000000000 --- a/lexilla/test/examples/cpp/x.cxx.styled +++ /dev/null @@ -1,27 +0,0 @@ -{2}// A demonstration program -{9}#include <stdio.h> -#if 0 {23}/* */{9} -{73}#define DUMMY() \ - if (1); -{9}#endif -{0} -{9}#define M\ - -{0}\ - -{5}int{0} {11}main{10}(){0} {10}{{0} - {11}double{0} {11}x{10}[]{0} {10}={0} {10}{{4}3.14159{10},{4}6.02e23{10},{4}1.6e-19{10},{4}1.0{10}+{4}1{10}};{0} - {5}int{0} {11}y{10}[]{0} {10}={0} {10}{{4}75{10},{4}0113{10},{4}0x4b{10}};{0} - {11}printf{10}({6}"hello world %d %g{27}\n{6}"{10},{0} {11}y{10}[{4}0{10}],{0} {11}x{10}[{4}0{10}]);{0} - - {2}// JavaScript regular expression (14) tests -{0} {5}let{0} {11}a{0} {10}={0} {14}/a/{10};{0} - {5}let{0} {11}b{0} {10}={0} {14}/[a-z]+/gi{10};{0} - - {2}// Escape sequence (27) tests -{0} {11}printf{10}({6}"{27}\'\"\?\\\a\b\f\n\r\t\v{6} {27}\P{6}"{10});{0} - {11}printf{10}({6}"{27}\0{6}a {27}\013{6}a {27}\01{6}9"{10});{0} - {11}printf{10}({6}"{27}\x013a{6}c {27}\xd{6}z"{10});{0} - {11}printf{10}({6}"{27}\ua34d{6}f {27}\u{6}z"{10});{0} - {11}printf{10}({6}"{27}\Ua34df783{6}3 {27}\U{6}z"{10});{0} -{10}}{0} diff --git a/lexilla/test/examples/d/SciTE.properties b/lexilla/test/examples/d/SciTE.properties deleted file mode 100644 index 5db047ab5..000000000 --- a/lexilla/test/examples/d/SciTE.properties +++ /dev/null @@ -1,9 +0,0 @@ -lexer.*.d=d -keywords.*.d=keyword1 -keywords2.*.d=keyword2 -keywords3.*.d= -keywords4.*.d=keyword4 -keywords5.*.d=keyword5 -keywords6.*.d=keyword6 -keywords7.*.d=keyword7 - diff --git a/lexilla/test/examples/d/x.d b/lexilla/test/examples/d/x.d deleted file mode 100644 index 617aa38a1..000000000 --- a/lexilla/test/examples/d/x.d +++ /dev/null @@ -1,47 +0,0 @@ -$ -// /++ +/ doccomments are not yet supported -/* */ -/** */ -/// drdr -/+ /+ +/ +/ -//keyword test -keyword1 -keyword2 -keyword4 -keyword5 -keyword6 -keyword7 -//unicode identifier test -вапёasdÓΘΣαԷԸՑהכ拉麺とひシマイ단결을 -//strings test -'s -' -w's'w -"multiline - string"w -e"zz"e -r"asd\"e -r"multiline - string"c -r`asd\`e -`multiline - string`d -x"023 abc"e -x"023 - abc"w -//numbers test -a[3..4]=3 -2.stringof -2.0.stringof -2. -2.2e+2 -2.2e-2 -.2e+2 -.2 -2e+2 -0x2e+2 -0x2ep+10 -,.2.stringof, - -end - diff --git a/lexilla/test/examples/d/x.d.styled b/lexilla/test/examples/d/x.d.styled deleted file mode 100644 index 32e4556dd..000000000 --- a/lexilla/test/examples/d/x.d.styled +++ /dev/null @@ -1,47 +0,0 @@ -{14}${0} -{2}// /++ +/ doccomments are not yet supported -{1}/* */{0} -{3}/** */{0} -{15}/// drdr -{4}/+ /+ +/ +/{0} -{2}//keyword test -{6}keyword1{0} -{7}keyword2{0} -{9}keyword4{0} -{20}keyword5{0} -{21}keyword6{0} -{22}keyword7{0} -{2}//unicode identifier test -{14}вапёasdÓΘΣαԷԸՑהכ拉麺とひシマイ단결을{0} -{2}//strings test -{11}'s -' -{14}w{12}'s'{14}w{0} -{10}"multiline - string"w{0} -{14}e{10}"zz"{14}e{0} -{19}r"asd\"{14}e{0} -{19}r"multiline - string"c{0} -{14}r{18}`asd\`{14}e{0} -{18}`multiline - string`d{0} -{19}x"023 abc"{14}e{0} -{19}x"023 - abc"w{0} -{2}//numbers test -{14}a{13}[{5}3{13}..{5}4{13}]={5}3{0} -{5}2.stringof{0} -{5}2.0{13}.{14}stringof{0} -{5}2.{0} -{5}2.2e+2{0} -{5}2.2e-2{0} -{5}.2e+2{0} -{5}.2{0} -{5}2e+2{0} -{5}0x2e{13}+{5}2{0} -{5}0x2ep+10{0} -{13},{5}.2{13}.{14}stringof{13},{0} - -{14}end{0} - diff --git a/lexilla/test/examples/errorlist/AllStyles.err b/lexilla/test/examples/errorlist/AllStyles.err deleted file mode 100644 index b0c8046c2..000000000 --- a/lexilla/test/examples/errorlist/AllStyles.err +++ /dev/null @@ -1,107 +0,0 @@ -Default 0 -Some text in default - - -Python Error 1 - File "x.err", line 2 - - -Gcc Error 2, Find In Files Match 21 -ScintillaGTKAccessible.cxx:153:13: warning: Deprecated pre-processor symbol, replace with - - -Microsoft Error 3 -LexErrorList.cxx(15): fatal error C1083: Cannot open include file: 'ILexer.h': No such file or directory - - -Command 4 ->pwd - - -Borland Error 5 -Error E2378 oddEven.c 16: For statement missing ; in function main() - - -Perl Error 6 -Bareword found where operator expected at LexMMIXAL.cxx line 1, near "// Scintilla" - - -DotNET Traceback 7 - at ExceptionTrace.Program.f4() in C:\Ivan\dev\exp\ExceptionTrace\Program.cs:line 18 - - -Lua Error 8 -last token read: `result' at line 40 in file `Test.lua' - - -Ctags 9 -IsAWordChar LexMMIXAL.cxx /^static inline bool IsAWordChar(const int ch) {$/;" f file: - - -Diff Changed ! 10 -! GdkColor white = { 0, 0xFFFF, 0xFFFF, 0xFFFF}; - - -Diff Addition + 11 -+ <PlatformToolset>v142</PlatformToolset> - - -Diff Deletion - 12 -- <PlatformToolset>v141</PlatformToolset> - - -Diff Message --- 13 ---- a/win32/SciTE.vcxproj Fri Jan 31 12:23:51 2020 +1100 - - -PHP error 14 -Fatal error: Call to undefined function: foo() in example.php on line 11 - - -Essential Lahey Fortran 90 Error 15 -Line 11, file c:\fortran90\codigo\demo.f90 - - -Intel Fortran Compiler Error 16 -Error 71 at (17:teste.f90) : The program unit has no name - - -Intel Fortran Compiler v8.0 Error 17 -fortcom: Error: shf.f90, line 5602: This name does not have ... - - -Absoft Pro Fortran 90 Error 18 -cf90-113 f90fe: ERROR SHF3D, File = shf.f90, Line = 1101, Column = 19 - - -HTML Tidy 19 -line 8 column 1 - Error: unexpected </head> in <meta> - - -Java Runtime Stack Trace 20 - at MethodName>(FileName.java:33) - - -GCC Include Path 22 -In file included from /usr/include/gtk-2.0/gtk/gtkobject.h:37, - - -GCC Pointer 25 - 236 | void gtk_type_init (GTypeDebugFlags debug_flags); - | ^ - - -Escape Sequence 23 -[K - - -Escape Sequence Unknown 24 -[1n - - -Escape Sequence Colour 40 -[0mColour 0 is 40 - - -Escape Sequence Colour 41 -[31mColour 1 is 41 diff --git a/lexilla/test/examples/errorlist/AllStyles.err.styled b/lexilla/test/examples/errorlist/AllStyles.err.styled deleted file mode 100644 index fe89ef6bc..000000000 --- a/lexilla/test/examples/errorlist/AllStyles.err.styled +++ /dev/null @@ -1,107 +0,0 @@ -{0}Default 0 -Some text in default - - -Python Error 1 -{1} File "x.err", line 2 -{0} - -Gcc Error 2, Find In Files Match 21 -{2}ScintillaGTKAccessible.cxx:153:13:{21} warning: Deprecated pre-processor symbol, replace with -{0} - -Microsoft Error 3 -{3}LexErrorList.cxx(15): fatal error C1083: Cannot open include file: 'ILexer.h': No such file or directory -{0} - -Command 4 -{4}>pwd -{0} - -Borland Error 5 -{5}Error E2378 oddEven.c 16: For statement missing ; in function main() -{0} - -Perl Error 6 -{6}Bareword found where operator expected at LexMMIXAL.cxx line 1, near "// Scintilla" -{0} - -DotNET Traceback 7 -{7} at ExceptionTrace.Program.f4() in C:\Ivan\dev\exp\ExceptionTrace\Program.cs:line 18 -{0} - -Lua Error 8 -{8}last token read: `result' at line 40 in file `Test.lua' -{0} - -Ctags 9 -{9}IsAWordChar LexMMIXAL.cxx /^static inline bool IsAWordChar(const int ch) {$/;" f file: -{0} - -Diff Changed ! 10 -{10}! GdkColor white = { 0, 0xFFFF, 0xFFFF, 0xFFFF}; -{0} - -Diff Addition + 11 -{11}+ <PlatformToolset>v142</PlatformToolset> -{0} - -Diff Deletion - 12 -{12}- <PlatformToolset>v141</PlatformToolset> -{0} - -Diff Message --- 13 -{13}--- a/win32/SciTE.vcxproj Fri Jan 31 12:23:51 2020 +1100 -{0} - -PHP error 14 -{14}Fatal error: Call to undefined function: foo() in example.php on line 11 -{0} - -Essential Lahey Fortran 90 Error 15 -{15}Line 11, file c:\fortran90\codigo\demo.f90 -{0} - -Intel Fortran Compiler Error 16 -{16}Error 71 at (17:teste.f90) : The program unit has no name -{0} - -Intel Fortran Compiler v8.0 Error 17 -{17}fortcom: Error: shf.f90, line 5602: This name does not have ... -{0} - -Absoft Pro Fortran 90 Error 18 -{18}cf90-113 f90fe: ERROR SHF3D, File = shf.f90, Line = 1101, Column = 19 -{0} - -HTML Tidy 19 -{19}line 8 column 1 - Error: unexpected </head> in <meta> -{0} - -Java Runtime Stack Trace 20 -{20} at MethodName>(FileName.java:33) -{0} - -GCC Include Path 22 -{22}In file included from /usr/include/gtk-2.0/gtk/gtkobject.h:37, -{0} - -GCC Pointer 25 -{25} 236 | void gtk_type_init (GTypeDebugFlags debug_flags); - | ^ -{0} - -Escape Sequence 23 -{23}[K{0} - - -Escape Sequence Unknown 24 -{24}[1n{0} - - -Escape Sequence Colour 40 -{23}[0m{40}Colour 0 is 40 -{0} - -Escape Sequence Colour 41 -{23}[31m{41}Colour 1 is 41 diff --git a/lexilla/test/examples/errorlist/SciTE.properties b/lexilla/test/examples/errorlist/SciTE.properties deleted file mode 100644 index f9e4a20d3..000000000 --- a/lexilla/test/examples/errorlist/SciTE.properties +++ /dev/null @@ -1,5 +0,0 @@ -lexer.*.err=errorlist -lexer.errorlist.value.separate=1 -lexer.errorlist.escape.sequences=1 -style.errorlist.23=fore:#000000,back:#FFFFFF,$(error.background) -style.errorlist.25=fore:#CF008F,$(font.monospace.small) diff --git a/lexilla/test/examples/hypertext/SciTE.properties b/lexilla/test/examples/hypertext/SciTE.properties deleted file mode 100644 index 9d34ee95a..000000000 --- a/lexilla/test/examples/hypertext/SciTE.properties +++ /dev/null @@ -1,6 +0,0 @@ -lexer.*=hypertext -keywords.*=b body content head href html link meta \ -name rel script strong title type xmlns -keywords2.*=function -keywords3.*=sub - diff --git a/lexilla/test/examples/hypertext/apostophe.php b/lexilla/test/examples/hypertext/apostophe.php deleted file mode 100644 index ade729bfa..000000000 --- a/lexilla/test/examples/hypertext/apostophe.php +++ /dev/null @@ -1,11 +0,0 @@ -<?php -# Test that currently fails as comment style not started in a number. -# line-comment -// line-comment -/* comment */ -$foo = 0#comment -$foo = 0//comment -$foo = 0/*'*/; -?> - -<br /> diff --git a/lexilla/test/examples/hypertext/apostophe.php.styled b/lexilla/test/examples/hypertext/apostophe.php.styled deleted file mode 100644 index 0c27ab50c..000000000 --- a/lexilla/test/examples/hypertext/apostophe.php.styled +++ /dev/null @@ -1,11 +0,0 @@ -{18}<?php{118} -{125}# Test that currently fails as comment style not started in a number.{118} -{125}# line-comment{118} -{125}// line-comment{118} -{124}/* comment */{118} -{123}$foo{118} {127}={118} {122}0{118}#comment -{123}$foo{118} {127}={118} {122}0{127}//{118}comment -{123}$foo{118} {127}={118} {122}0{127}/*{120}'*/; -?> - -<br /> diff --git a/lexilla/test/examples/hypertext/x.asp b/lexilla/test/examples/hypertext/x.asp deleted file mode 100644 index a78acdc34..000000000 --- a/lexilla/test/examples/hypertext/x.asp +++ /dev/null @@ -1,12 +0,0 @@ -<%@language=javas%> -<% -#include -function x() { -} -%> -<%@language=vbscript%> -<% -sub x 'comment -%> -<head> -<body></body> diff --git a/lexilla/test/examples/hypertext/x.asp.styled b/lexilla/test/examples/hypertext/x.asp.styled deleted file mode 100644 index 920c6380d..000000000 --- a/lexilla/test/examples/hypertext/x.asp.styled +++ /dev/null @@ -1,12 +0,0 @@ -{15}<%@{16}language=javas{15}%>{0} -{15}<%{56} -#{61}include{56} -{62}function{56} {61}x{65}(){56} {65}{{56} -{65}}{56} -{15}%>{0} -{15}<%@{16}language=vbscript{15}%>{0} -{15}<%{81} -{84}sub{81} {86}x{81} {82}'comment {81} -{15}%>{0} -{1}<head>{0} -{1}<body></body>{0} diff --git a/lexilla/test/examples/hypertext/x.html b/lexilla/test/examples/hypertext/x.html deleted file mode 100644 index caebcf41a..000000000 --- a/lexilla/test/examples/hypertext/x.html +++ /dev/null @@ -1,12 +0,0 @@ -<html xmlns="http://www.w3.org/1999/xhtml"> -<script type="text/javascript"> -var b = /abc/i.test('abc'); -'x\ -</t>' -</script> -<head> - <meta name="Date.Modified" content="20010515" /> - <title>SinkWorld - Portability</title> - <unknown>SinkWorld - Portability</unknown> - <link rel="stylesheet" type="text/css" href="SW.css"> -</head> diff --git a/lexilla/test/examples/hypertext/x.html.styled b/lexilla/test/examples/hypertext/x.html.styled deleted file mode 100644 index 3e50a1147..000000000 --- a/lexilla/test/examples/hypertext/x.html.styled +++ /dev/null @@ -1,12 +0,0 @@ -{1}<html{8} {3}xmlns{8}={6}"http://www.w3.org/1999/xhtml"{1}>{0} -{1}<script{8} {3}type{8}={6}"text/javascript"{1}>{40} -{46}var{41} {46}b{41} {50}={41} {52}/abc/i{46}.test{50}({49}'abc'{50});{41} -{49}'x\ -</t>'{41} -{1}</script>{0} -{1}<head>{0} - {1}<meta{8} {3}name{8}={6}"Date.Modified"{8} {3}content{8}={6}"20010515"{8} {11}/>{0} - {1}<title>{0}SinkWorld - Portability{1}</title>{0} - {2}<unknown>{0}SinkWorld - Portability{2}</unknown>{0} - {1}<link{8} {3}rel{8}={6}"stylesheet"{8} {3}type{8}={6}"text/css"{8} {3}href{8}={6}"SW.css"{1}>{0} -{1}</head>{0} diff --git a/lexilla/test/examples/hypertext/x.php b/lexilla/test/examples/hypertext/x.php deleted file mode 100644 index bc7302d85..000000000 --- a/lexilla/test/examples/hypertext/x.php +++ /dev/null @@ -1,6 +0,0 @@ -<head> <!-- About to script --> -<?php -echo "<!-- -->\n"; -/* ?> */ -?> -<strong>for</strong><b>if</b> diff --git a/lexilla/test/examples/hypertext/x.php.styled b/lexilla/test/examples/hypertext/x.php.styled deleted file mode 100644 index fb90ba06e..000000000 --- a/lexilla/test/examples/hypertext/x.php.styled +++ /dev/null @@ -1,6 +0,0 @@ -{1}<head>{0} {9}<!-- About to script -->{0} -{18}<?php{118} -echo {119}"<!-- -->\n"{127};{118} -{124}/* ?> */{118} -{18}?>{0} -{1}<strong>{0}for{1}</strong><b>{0}if{1}</b>{0} diff --git a/lexilla/test/examples/latex/AllStyles.tex b/lexilla/test/examples/latex/AllStyles.tex deleted file mode 100644 index 066a308e5..000000000 --- a/lexilla/test/examples/latex/AllStyles.tex +++ /dev/null @@ -1,47 +0,0 @@ -% Enumerate all styles: 0 to 12 -% Not a valid laTeX file as entities are unbalanced and not semantically correct -% comment=4 - -% whitespace=0 -text % - -% command=1 -\documentclass - -% tag=2 -\begin{document} - -% tag closing=5 -\end{document} - -% math=3 -\begin{math} -E &= mc^2 -\end{math} - -% math block=6 -\begin{align} -E &= mc^2 -\end{align} - -% comment block=7 -\begin{comment} -A block comment -\end{comment} - -% verbatim=8 -\begin{verbatim} -puts $foo -\end{verbatim} - -% short command=9 -\(\) - -% special=10 -\# - -% command optional argument=11 -\x[12pt] - -% error=12 -\ diff --git a/lexilla/test/examples/latex/AllStyles.tex.styled b/lexilla/test/examples/latex/AllStyles.tex.styled deleted file mode 100644 index bed7ff5df..000000000 --- a/lexilla/test/examples/latex/AllStyles.tex.styled +++ /dev/null @@ -1,47 +0,0 @@ -{4}% Enumerate all styles: 0 to 12{0} -{4}% Not a valid laTeX file as entities are unbalanced and not semantically correct{0} -{4}% comment=4{0} - -{4}% whitespace=0{0} -text {4}%{0} - -{4}% command=1{0} -{1}\documentclass{0} - -{4}% tag=2{0} -{1}\begin{2}{document}{0} - -{4}% tag closing=5{0} -{1}\end{5}{document}{0} - -{4}% math=3{0} -{1}\begin{2}{math}{3} -E &= mc^2 -{1}\end{5}{math}{0} - -{4}% math block=6{0} -{1}\begin{2}{align}{6} -E &= mc^2 -{1}\end{5}{align}{0} - -{4}% comment block=7{0} -{1}\begin{2}{comment}{7} -A block comment -{1}\end{5}{comment}{0} - -{4}% verbatim=8{0} -{1}\begin{2}{verbatim}{8} -puts $foo -{1}\end{5}{verbatim}{0} - -{4}% short command=9{0} -{9}\(\){0} - -{4}% special=10{0} -{10}\#{0} - -{4}% command optional argument=11{0} -{1}\x{11}[12pt]{0} - -{4}% error=12{0} -{12}\{0} diff --git a/lexilla/test/examples/latex/Feature1358.tex b/lexilla/test/examples/latex/Feature1358.tex deleted file mode 100644 index 73f27b83c..000000000 --- a/lexilla/test/examples/latex/Feature1358.tex +++ /dev/null @@ -1,10 +0,0 @@ -\begin{lstlisting}[language=make] -# If no BOARD is found in the environment, use this default: -BOARD ?= bluepill - -# To use chinese st-link v2 and ch340 dongle with bluepill -ifeq ($(BOARD),bluepill) -STLINK_VERSION=2 -PORT_LINUX=/dev/ttyUSB0 -endif -\end{lstlisting} diff --git a/lexilla/test/examples/latex/Feature1358.tex.styled b/lexilla/test/examples/latex/Feature1358.tex.styled deleted file mode 100644 index e753ea14d..000000000 --- a/lexilla/test/examples/latex/Feature1358.tex.styled +++ /dev/null @@ -1,10 +0,0 @@ -{1}\begin{2}{lstlisting}{8}[language=make] -# If no BOARD is found in the environment, use this default: -BOARD ?= bluepill - -# To use chinese st-link v2 and ch340 dongle with bluepill -ifeq ($(BOARD),bluepill) -STLINK_VERSION=2 -PORT_LINUX=/dev/ttyUSB0 -endif -{1}\end{5}{lstlisting}{0} diff --git a/lexilla/test/examples/latex/SciTE.properties b/lexilla/test/examples/latex/SciTE.properties deleted file mode 100644 index 0b81c1199..000000000 --- a/lexilla/test/examples/latex/SciTE.properties +++ /dev/null @@ -1 +0,0 @@ -lexer.*.tex=latex diff --git a/lexilla/test/examples/lua/SciTE.properties b/lexilla/test/examples/lua/SciTE.properties deleted file mode 100644 index ae8c7ab91..000000000 --- a/lexilla/test/examples/lua/SciTE.properties +++ /dev/null @@ -1,2 +0,0 @@ -lexer.*.lua=lua -keywords.*.lua=function end diff --git a/lexilla/test/examples/lua/x.lua b/lexilla/test/examples/lua/x.lua deleted file mode 100644 index cfa3537b5..000000000 --- a/lexilla/test/examples/lua/x.lua +++ /dev/null @@ -1,7 +0,0 @@ ---[[ coding:UTF-8 -comment ]] -function first() -::開:: - -- Comment - func(SCI_ANNOTATIONSETTEXT, 'a', 0, "LINE1") -end diff --git a/lexilla/test/examples/lua/x.lua.styled b/lexilla/test/examples/lua/x.lua.styled deleted file mode 100644 index 0c8f76fa4..000000000 --- a/lexilla/test/examples/lua/x.lua.styled +++ /dev/null @@ -1,7 +0,0 @@ -{1}--[[ coding:UTF-8 -comment ]]{0} -{5}function{0} {11}first{10}(){0} -{20}::開::{0} - {2}-- Comment -{0} {11}func{10}({11}SCI_ANNOTATIONSETTEXT{10},{0} {7}'a'{10},{0} {4}0{10},{0} {6}"LINE1"{10}){0} -{5}end{0} diff --git a/lexilla/test/examples/makefile/SciTE.properties b/lexilla/test/examples/makefile/SciTE.properties deleted file mode 100644 index ddc87920e..000000000 --- a/lexilla/test/examples/makefile/SciTE.properties +++ /dev/null @@ -1 +0,0 @@ -lexer.*.mak=makefile diff --git a/lexilla/test/examples/makefile/x.mak b/lexilla/test/examples/makefile/x.mak deleted file mode 100644 index d5bdb83e9..000000000 --- a/lexilla/test/examples/makefile/x.mak +++ /dev/null @@ -1,16 +0,0 @@ -# '# comment' comment=1 -# comment - -# '.SUFFIXES' target=5, ':' operator=4 -.SUFFIXES: - -# 'LD' identifier=3, '=' operator=4, 'link' default=0 -LD=link - -# '!IFDEF DEBUG' preprocessor=2 -!IFDEF DEBUG - -# '$(' ID EOL=9 -X=$( - -# End of file diff --git a/lexilla/test/examples/makefile/x.mak.styled b/lexilla/test/examples/makefile/x.mak.styled deleted file mode 100644 index 752ed5884..000000000 --- a/lexilla/test/examples/makefile/x.mak.styled +++ /dev/null @@ -1,16 +0,0 @@ -{1}# '# comment' comment=1 -# comment -{0} -{1}# '.SUFFIXES' target=5, ':' operator=4 -{5}.SUFFIXES{4}:{0} - -{1}# 'LD' identifier=3, '=' operator=4, 'link' default=0 -{3}LD{4}={0}link - -{1}# '!IFDEF DEBUG' preprocessor=2 -{2}!IFDEF DEBUG -{0} -{1}# '$(' ID EOL=9 -{3}X{4}={9}$( -{0} -{1}# End of file diff --git a/lexilla/test/examples/mmixal/AllStyles.mms b/lexilla/test/examples/mmixal/AllStyles.mms deleted file mode 100644 index 54de34be4..000000000 --- a/lexilla/test/examples/mmixal/AllStyles.mms +++ /dev/null @@ -1,74 +0,0 @@ -% Demonstrate each possible style. Does not make sense as code. - -% A comment 1 -% Comment - - -% Whitespace 0 - - - -% Label 2 -label - - -% Not Validated Opcode 3 appears to always validate to either 5 or 6 -% so is never seen on screen. - - -% Division between Label and Opcode 4 -la - - -% Valid Opcode 5 - TRAP - - -% Invalid Opcode 6 - UNKNOWN - - -% Division between Opcode and Operands 7 - LOC - - -% Division of Operands 8 - LOC 0. - - -% Number 9 - BYTE 0 - - -% Reference 10 - JMP @label - - -% Char 11 - BYTE 'a' - - -% String 12 - BYTE "Hello, world!" - - -% Register 13 - BYTE rA - - -% Hexadecimal Number 14 - BYTE #FF - - -% Operator 15 - BYTE + - - -% Symbol 16 - TRAP Fputs - - -% Preprocessor 17 -@include a.mms - - diff --git a/lexilla/test/examples/mmixal/AllStyles.mms.styled b/lexilla/test/examples/mmixal/AllStyles.mms.styled deleted file mode 100644 index b3f64d4f7..000000000 --- a/lexilla/test/examples/mmixal/AllStyles.mms.styled +++ /dev/null @@ -1,74 +0,0 @@ -{1}% Demonstrate each possible style. Does not make sense as code. -{0} -{1}% A comment 1 -% Comment -{0} - -{1}% Whitespace 0 -{0} - - -{1}% Label 2 -{2}label{4} -{0} - -{1}% Not Validated Opcode 3 appears to always validate to either 5 or 6 -% so is never seen on screen. -{0} - -{1}% Division between Label and Opcode 4 -{2}la{4} -{0} - -{1}% Valid Opcode 5 -{0} {5}TRAP{7} -{0} - -{1}% Invalid Opcode 6 -{0} {6}UNKNOWN{7} -{0} - -{1}% Division between Opcode and Operands 7 -{0} {5}LOC{7} -{0} - -{1}% Division of Operands 8 -{0} {5}LOC{7} {9}0{8}.{1} -{0} - -{1}% Number 9 -{0} {5}BYTE{7} {9}0{1} -{0} - -{1}% Reference 10 -{0} {5}JMP{7} {10}@label{1} -{0} - -{1}% Char 11 -{0} {5}BYTE{7} {11}'a'{1} -{0} - -{1}% String 12 -{0} {5}BYTE{7} {12}"Hello, world!"{1} -{0} - -{1}% Register 13 -{0} {5}BYTE{7} {13}rA{1} -{0} - -{1}% Hexadecimal Number 14 -{0} {5}BYTE{7} {14}#FF{1} -{0} - -{1}% Operator 15 -{0} {5}BYTE{7} {15}+{1} -{0} - -{1}% Symbol 16 -{0} {5}TRAP{7} {16}Fputs{1} -{0} - -{1}% Preprocessor 17 -{17}@include a.mms -{0} - diff --git a/lexilla/test/examples/mmixal/SciTE.properties b/lexilla/test/examples/mmixal/SciTE.properties deleted file mode 100644 index d458a19fd..000000000 --- a/lexilla/test/examples/mmixal/SciTE.properties +++ /dev/null @@ -1,4 +0,0 @@ -lexer.*.mms=mmixal -keywords.*.mms=BYTE GETA JMP LOC PREFIX TRAP -keywords2.*.mms=rA -keywords3.*.mms=Fputs StdOut diff --git a/lexilla/test/examples/mmixal/references.mms b/lexilla/test/examples/mmixal/references.mms deleted file mode 100644 index 82be6e8c9..000000000 --- a/lexilla/test/examples/mmixal/references.mms +++ /dev/null @@ -1,16 +0,0 @@ -# Bug #2019 Buffer over-read in MMIXAL lexer -label - PREFIX Foo: -% Relative reference (uses PREFIX) - JMP label -% - JMP @label -% Absolute reference (does not use PREFIX) - JMP :label -% In register list so treated as register - JMP :rA -% Too long for buffer so truncated - JMP l1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 -% Too long for buffer so truncated then treated as absolute - JMP :l1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890 -% diff --git a/lexilla/test/examples/mmixal/references.mms.styled b/lexilla/test/examples/mmixal/references.mms.styled deleted file mode 100644 index 78ae29a3a..000000000 --- a/lexilla/test/examples/mmixal/references.mms.styled +++ /dev/null @@ -1,16 +0,0 @@ -{1}# Bug #2019 Buffer over-read in MMIXAL lexer -{2}label{4} -{0} {5}PREFIX{7} {10}Foo:{1} -% Relative reference (uses PREFIX) -{0} {5}JMP{7} {10}label{1} -% -{0} {5}JMP{7} {10}@label{1} -% Absolute reference (does not use PREFIX) -{0} {5}JMP{7} {10}:label{1} -% In register list so treated as register -{0} {5}JMP{7} {13}:rA{1} -% Too long for buffer so truncated -{0} {5}JMP{7} {10}l1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890{1} -% Too long for buffer so truncated then treated as absolute -{0} {5}JMP{7} {10}:l1234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890{1} -% diff --git a/lexilla/test/examples/mmixal/x.mms b/lexilla/test/examples/mmixal/x.mms deleted file mode 100644 index 538d22163..000000000 --- a/lexilla/test/examples/mmixal/x.mms +++ /dev/null @@ -1,12 +0,0 @@ -% Some example code - - % Set the address of the program initially to 0x100. - LOC #100 - -Main GETA $255,string - - TRAP 0,Fputs,StdOut - - TRAP 0,Halt,0 - -string BYTE "Hello, world!",#a,0 diff --git a/lexilla/test/examples/mmixal/x.mms.styled b/lexilla/test/examples/mmixal/x.mms.styled deleted file mode 100644 index 7221e37f9..000000000 --- a/lexilla/test/examples/mmixal/x.mms.styled +++ /dev/null @@ -1,12 +0,0 @@ -{1}% Some example code -{0} - {1}% Set the address of the program initially to 0x100. -{0} {5}LOC{7} {14}#100{1} -{0} -{2}Main{4} {5}GETA{7} {13}$255{15},{10}string{1} -{0} - {5}TRAP{7} {9}0{15},{16}Fputs{15},{16}StdOut{1} -{0} - {5}TRAP{7} {9}0{15},{10}Halt{15},{9}0{1} -{0} -{2}string{4} {5}BYTE{7} {12}"Hello, world!"{15},{14}#a{15},{9}0{1} diff --git a/lexilla/test/examples/nim/SciTE.properties b/lexilla/test/examples/nim/SciTE.properties deleted file mode 100644 index 3a0214952..000000000 --- a/lexilla/test/examples/nim/SciTE.properties +++ /dev/null @@ -1,2 +0,0 @@ -lexer.*.nim=nim -keywords.*.nim=else end if let proc diff --git a/lexilla/test/examples/nim/x.nim b/lexilla/test/examples/nim/x.nim deleted file mode 100644 index 874940d47..000000000 --- a/lexilla/test/examples/nim/x.nim +++ /dev/null @@ -1,28 +0,0 @@ -# Tests for Nim -let s = "foobar" - -# Feature #1260 -{.ident.} -stdin.readLine.split.map(parseInt).max.`$`.echo(" is the maximum!") - -# Feature #1261 -# IsFuncName("proc") so style ticks as SCE_NIM_FUNCNAME: -proc `$` (x: myDataType): string = ... -# Style ticks as SCE_NIM_BACKTICKS: -if `==`( `+`(3,4),7): echo "True" - -# Feature #1262 -# Standard raw string identifier: -let standardDoubleLitRawStr = R"A raw string\" -let standardTripleLitRawStr = R"""A triple-double raw string\"""" -# Style of 'customIdent' is determined by lexer.nim.raw.strings.highlight.ident. 16 if false, 6 or 10 if true -let customDoubleLitRawStr = customIdent"A string\" -let customTripleLitRawStr = customIdent"""A triple-double raw string\"""" - -# Feature #1268 -10_000 -10__000 -10_ -1....5 -1.ident -1._ident diff --git a/lexilla/test/examples/nim/x.nim.styled b/lexilla/test/examples/nim/x.nim.styled deleted file mode 100644 index 3a05c04b8..000000000 --- a/lexilla/test/examples/nim/x.nim.styled +++ /dev/null @@ -1,28 +0,0 @@ -{3}# Tests for Nim -{8}let{0} {16}s{0} {15}={0} {6}"foobar"{0} - -{3}# Feature #1260 -{15}{.{16}ident{15}.}{0} -{16}stdin{15}.{16}readLine{15}.{16}split{15}.{16}map{15}({16}parseInt{15}).{16}max{15}.{11}`$`{15}.{16}echo{15}({6}" is the maximum!"{15}){0} - -{3}# Feature #1261 -# IsFuncName("proc") so style ticks as SCE_NIM_FUNCNAME: -{8}proc{0} {12}`$`{0} {15}({16}x{15}:{0} {16}myDataType{15}):{0} {16}string{0} {15}={0} {15}...{0} -{3}# Style ticks as SCE_NIM_BACKTICKS: -{8}if{0} {11}`==`{15}({0} {11}`+`{15}({5}3{15},{5}4{15}),{5}7{15}):{0} {16}echo{0} {6}"True"{0} - -{3}# Feature #1262 -# Standard raw string identifier: -{8}let{0} {16}standardDoubleLitRawStr{0} {15}={0} {6}R"A raw string\"{0} -{8}let{0} {16}standardTripleLitRawStr{0} {15}={0} {10}R"""A triple-double raw string\""""{0} -{3}# Style of 'customIdent' is determined by lexer.nim.raw.strings.highlight.ident. 16 if false, 6 or 10 if true -{8}let{0} {16}customDoubleLitRawStr{0} {15}={0} {16}customIdent{6}"A string\"{0} -{8}let{0} {16}customTripleLitRawStr{0} {15}={0} {16}customIdent{10}"""A triple-double raw string\""""{0} - -{3}# Feature #1268 -{5}10_000{0} -{5}10{16}__000{0} -{5}10{16}_{0} -{5}1{15}....{5}5{0} -{5}1{15}.{16}ident{0} -{5}1{15}.{16}_ident{0} diff --git a/lexilla/test/examples/perl/SciTE.properties b/lexilla/test/examples/perl/SciTE.properties deleted file mode 100644 index 0aefae2c9..000000000 --- a/lexilla/test/examples/perl/SciTE.properties +++ /dev/null @@ -1,31 +0,0 @@ -lexer.*.pl=perl -keywords.*.pl=\ -NULL __FILE__ __LINE__ __PACKAGE__ __DATA__ __END__ AUTOLOAD \ -BEGIN CORE DESTROY END EQ GE GT INIT LE LT NE CHECK abs accept \ -alarm and atan2 bind binmode bless caller chdir chmod chomp chop \ -chown chr chroot close closedir cmp connect continue cos crypt \ -dbmclose dbmopen defined delete die do dump each else elsif endgrent \ -endhostent endnetent endprotoent endpwent endservent eof eq eval \ -exec exists exit exp fcntl fileno flock for foreach fork format \ -formline ge getc getgrent getgrgid getgrnam gethostbyaddr gethostbyname \ -gethostent getlogin getnetbyaddr getnetbyname getnetent getpeername \ -getpgrp getppid getpriority getprotobyname getprotobynumber getprotoent \ -getpwent getpwnam getpwuid getservbyname getservbyport getservent \ -getsockname getsockopt glob gmtime goto grep gt hex if index \ -int ioctl join keys kill last lc lcfirst le length link listen \ -local localtime lock log lstat lt map mkdir msgctl msgget msgrcv \ -msgsnd my ne next no not oct open opendir or ord our pack package \ -pipe pop pos print printf prototype push quotemeta qu \ -rand read readdir readline readlink readpipe recv redo \ -ref rename require reset return reverse rewinddir rindex rmdir \ -scalar seek seekdir select semctl semget semop send setgrent \ -sethostent setnetent setpgrp setpriority setprotoent setpwent \ -setservent setsockopt shift shmctl shmget shmread shmwrite shutdown \ -sin sleep socket socketpair sort splice split sprintf sqrt srand \ -stat study sub substr symlink syscall sysopen sysread sysseek \ -system syswrite tell telldir tie tied time times truncate \ -uc ucfirst umask undef unless unlink unpack unshift untie until \ -use utime values vec wait waitpid wantarray warn while write \ -xor \ -given when default break say state UNITCHECK __SUB__ fc - diff --git a/lexilla/test/examples/perl/perl-test-5220delta.pl b/lexilla/test/examples/perl/perl-test-5220delta.pl deleted file mode 100644 index a9c80caa2..000000000 --- a/lexilla/test/examples/perl/perl-test-5220delta.pl +++ /dev/null @@ -1,178 +0,0 @@ -# -*- coding: utf-8 -*- -#-------------------------------------------------------------------------- -# perl-test-5220delta.pl -#-------------------------------------------------------------------------- -# REF: https://metacpan.org/pod/distribution/perl/pod/perldelta.pod -# maybe future ref: https://metacpan.org/pod/distribution/perl/pod/perl5220delta.pod -# also: http://perltricks.com/article/165/2015/4/10/A-preview-of-Perl-5-22 -# -#-------------------------------------------------------------------------- -# Kein-Hong Man <keinhong@gmail.com> Public Domain 20151217 -#-------------------------------------------------------------------------- -# 20151217 initial document -# 20151218 updated tests and comments -#-------------------------------------------------------------------------- - -use v5.22; # may be needed - -#-------------------------------------------------------------------------- -# New bitwise operators -#-------------------------------------------------------------------------- - -use feature 'bitwise' # enable feature, warning enabled -use experimental "bitwise"; # enable feature, warning disabled - -# numerical operands -10&20 10|20 10^20 ~10 -$a&"8" $a|"8" $a^"8" ~$a ~"8" - -# string operands -'0'&."8" '0'|."8" '0'^."8" ~.'0' ~."8" -# the following is AMBIGUOUS, perl sees 10 and not .10 only when bitwise feature is enabled -# so it's feature-setting-dependent, no plans to change current behaviour - $a&.10 $a|.10 $a^.10 ~.$a ~.10 - -# assignment variants -$a&=10; $a|=10; $a^=10; -$b&.='20'; $b|.='20'; $b^.='20'; -$c&="30"; $c|="30"; $c^="30"; -$d&.=$e; $d|.=$e; $d^.=$e; - -#-------------------------------------------------------------------------- -# New double-diamond operator -#-------------------------------------------------------------------------- -# <<>> is like <> but each element of @ARGV will be treated as an actual file name - -# example snippet from brian d foy's blog post -while( <<>> ) { # new, safe line input operator - ...; - } - -#-------------------------------------------------------------------------- -# New \b boundaries in regular expressions -#-------------------------------------------------------------------------- - -qr/\b{gcb}/ -qr/\b{wb}/ -qr/\b{sb}/ - -#-------------------------------------------------------------------------- -# Non-Capturing Regular Expression Flag -#-------------------------------------------------------------------------- -# disables capturing and filling in $1, $2, etc - -"hello" =~ /(hi|hello)/n; # $1 is not set - -#-------------------------------------------------------------------------- -# Aliasing via reference -#-------------------------------------------------------------------------- -# Variables and subroutines can now be aliased by assigning to a reference - -\$c = \$d; -\&x = \&y; - -# Aliasing can also be applied to foreach iterator variables - -foreach \%hash (@array_of_hash_refs) { ... } - -# example snippet from brian d foy's blog post - -use feature qw(refaliasing); - -\%other_hash = \%hash; - -use v5.22; -use feature qw(refaliasing); - -foreach \my %hash ( @array_of_hashes ) { # named hash control variable - foreach my $key ( keys %hash ) { # named hash now! - ...; - } - } - -#-------------------------------------------------------------------------- -# New :const subroutine attribute -#-------------------------------------------------------------------------- - -my $x = 54321; -*INLINED = sub : const { $x }; -$x++; - -# more examples of attributes -# (not 5.22 stuff, but some general examples for study, useful for -# handling subroutine signature and subroutine prototype highlighting) - -sub foo : lvalue ; - -package X; -sub Y::x : lvalue { 1 } - -package X; -sub foo { 1 } -package Y; -BEGIN { *bar = \&X::foo; } -package Z; -sub Y::bar : lvalue ; - -# built-in attributes for subroutines: -lvalue method prototype(..) locked const - -#-------------------------------------------------------------------------- -# Repetition in list assignment -#-------------------------------------------------------------------------- - -# example snippet from brian d foy's blog post -use v5.22; -my(undef, $card_num, (undef)x3, $count) = split /:/; - -(undef,undef,$foo) = that_function() -# is equivalent to -((undef)x2, $foo) = that_function() - -#-------------------------------------------------------------------------- -# Floating point parsing has been improved -#-------------------------------------------------------------------------- -# Hexadecimal floating point literals - -# some hex floats from a program by Rick Regan -# appropriated and extended from Lua 5.2.x test cases -# tested on perl 5.22/cygwin - -0x1p-1074; -0x3.3333333333334p-5; -0xcc.ccccccccccdp-11; -0x1p+1; -0x1p-6; -0x1.b7p-1; -0x1.fffffffffffffp+1023; -0x1p-1022; -0X1.921FB4D12D84AP+1; -0x1.999999999999ap-4; - -# additional test cases for characterization -0x1p-1074. # dot is a string operator -0x.ABCDEFp10 # legal, dot immediately after 0x -0x.p10 # perl allows 0x as a zero, then concat with p10 bareword -0x.p 0x0.p # dot then bareword -0x_0_.A_BC___DEF_p1_0 # legal hex float, underscores are mostly allowed -0x0._ABCDEFp10 # _ABCDEFp10 is a bareword, no underscore allowed after dot - -# illegal, but does not use error highlighting -0x0p1ABC # illegal, highlighted as 0x0p1 abut with bareword ABC - -# allowed to FAIL for now -0x0.ABCDEFp_10 # ABCDEFp_10 is a bareword, '_10' exponent not allowed -0xp 0xp1 0x0.0p # syntax errors -0x41.65.65 # hex dot number, but lexer now fails with 0x41.65 left as a partial hex float - -#-------------------------------------------------------------------------- -# Support for ?PATTERN? without explicit operator has been removed -#-------------------------------------------------------------------------- -# ?PATTERN? must now be written as m?PATTERN? - -?PATTERN? # does not work in current LexPerl anyway, NO ACTION NEEDED -m?PATTERN? - -#-------------------------------------------------------------------------- -# end of test file -#-------------------------------------------------------------------------- diff --git a/lexilla/test/examples/perl/perl-test-5220delta.pl.styled b/lexilla/test/examples/perl/perl-test-5220delta.pl.styled deleted file mode 100644 index 4a763a47a..000000000 --- a/lexilla/test/examples/perl/perl-test-5220delta.pl.styled +++ /dev/null @@ -1,178 +0,0 @@ -{2}# -*- coding: utf-8 -*- -#-------------------------------------------------------------------------- -# perl-test-5220delta.pl -#-------------------------------------------------------------------------- -# REF: https://metacpan.org/pod/distribution/perl/pod/perldelta.pod -# maybe future ref: https://metacpan.org/pod/distribution/perl/pod/perl5220delta.pod -# also: http://perltricks.com/article/165/2015/4/10/A-preview-of-Perl-5-22 -# -#-------------------------------------------------------------------------- -# Kein-Hong Man <keinhong@gmail.com> Public Domain 20151217 -#-------------------------------------------------------------------------- -# 20151217 initial document -# 20151218 updated tests and comments -#-------------------------------------------------------------------------- -{0} -{5}use{0} {6}v5.22{10};{0} {2}# may be needed -{0} -{2}#-------------------------------------------------------------------------- -# New bitwise operators -#-------------------------------------------------------------------------- -{0} -{5}use{0} {11}feature{0} {7}'bitwise'{0} {2}# enable feature, warning enabled -{5}use{0} {11}experimental{0} {6}"bitwise"{10};{0} {2}# enable feature, warning disabled -{0} -{2}# numerical operands -{4}10{10}&{4}20{0} {4}10{10}|{4}20{0} {4}10{10}^{4}20{0} {10}~{4}10{0} -{12}$a{10}&{6}"8"{0} {12}$a{10}|{6}"8"{0} {12}$a{10}^{6}"8"{0} {10}~{12}$a{0} {10}~{6}"8"{0} - -{2}# string operands -{7}'0'{10}&.{6}"8"{0} {7}'0'{10}|.{6}"8"{0} {7}'0'{10}^.{6}"8"{0} {10}~.{7}'0'{0} {10}~.{6}"8"{0} -{2}# the following is AMBIGUOUS, perl sees 10 and not .10 only when bitwise feature is enabled -# so it's feature-setting-dependent, no plans to change current behaviour -{0} {12}$a{10}&{4}.10{0} {12}$a{10}|{4}.10{0} {12}$a{10}^{4}.10{0} {10}~.{12}$a{0} {10}~{4}.10{0} - -{2}# assignment variants -{12}$a{10}&={4}10{10};{0} {12}$a{10}|={4}10{10};{0} {12}$a{10}^={4}10{10};{0} -{12}$b{10}&.={7}'20'{10};{0} {12}$b{10}|.={7}'20'{10};{0} {12}$b{10}^.={7}'20'{10};{0} -{12}$c{10}&={6}"30"{10};{0} {12}$c{10}|={6}"30"{10};{0} {12}$c{10}^={6}"30"{10};{0} -{12}$d{10}&.={12}$e{10};{0} {12}$d{10}|.={12}$e{10};{0} {12}$d{10}^.={12}$e{10};{0} - -{2}#-------------------------------------------------------------------------- -# New double-diamond operator -#-------------------------------------------------------------------------- -# <<>> is like <> but each element of @ARGV will be treated as an actual file name -{0} -{2}# example snippet from brian d foy's blog post -{5}while{10}({0} {10}<<>>{0} {10}){0} {10}{{0} {2}# new, safe line input operator -{0} {10}...;{0} - {10}}{0} - -{2}#-------------------------------------------------------------------------- -# New \b boundaries in regular expressions -#-------------------------------------------------------------------------- -{0} -{29}qr/\b{gcb}/{0} -{29}qr/\b{wb}/{0} -{29}qr/\b{sb}/{0} - -{2}#-------------------------------------------------------------------------- -# Non-Capturing Regular Expression Flag -#-------------------------------------------------------------------------- -# disables capturing and filling in $1, $2, etc -{0} -{6}"hello"{0} {10}=~{0} {17}/(hi|hello)/n{10};{0} {2}# $1 is not set -{0} -{2}#-------------------------------------------------------------------------- -# Aliasing via reference -#-------------------------------------------------------------------------- -# Variables and subroutines can now be aliased by assigning to a reference -{0} -{10}\{12}$c{0} {10}={0} {10}\{12}$d{10};{0} -{10}\&{11}x{0} {10}={0} {10}\&{11}y{10};{0} - -{2}# Aliasing can also be applied to foreach iterator variables -{0} -{5}foreach{0} {10}\{14}%hash{0} {10}({13}@array_of_hash_refs{10}){0} {10}{{0} {10}...{0} {10}}{0} - -{2}# example snippet from brian d foy's blog post -{0} -{5}use{0} {11}feature{0} {30}qw(refaliasing){10};{0} - -{10}\{14}%other_hash{0} {10}={0} {10}\{14}%hash{10};{0} - -{5}use{0} {6}v5.22{10};{0} -{5}use{0} {11}feature{0} {30}qw(refaliasing){10};{0} - -{5}foreach{0} {10}\{5}my{0} {14}%hash{0} {10}({0} {13}@array_of_hashes{0} {10}){0} {10}{{0} {2}# named hash control variable -{0} {5}foreach{0} {5}my{0} {12}$key{0} {10}({0} {5}keys{0} {14}%hash{0} {10}){0} {10}{{0} {2}# named hash now! -{0} {10}...;{0} - {10}}{0} - {10}}{0} - -{2}#-------------------------------------------------------------------------- -# New :const subroutine attribute -#-------------------------------------------------------------------------- -{0} -{5}my{0} {12}$x{0} {10}={0} {4}54321{10};{0} -{15}*INLINED{0} {10}={0} {5}sub{0} {10}:{0} {11}const{0} {10}{{0} {12}$x{0} {10}};{0} -{12}$x{10}++;{0} - -{2}# more examples of attributes -# (not 5.22 stuff, but some general examples for study, useful for -# handling subroutine signature and subroutine prototype highlighting) -{0} -{5}sub{0} {11}foo{0} {10}:{0} {11}lvalue{0} {10};{0} - -{5}package{0} {11}X{10};{0} -{5}sub{0} {11}Y{10}::{11}x{0} {10}:{0} {11}lvalue{0} {10}{{0} {4}1{0} {10}}{0} - -{5}package{0} {11}X{10};{0} -{5}sub{0} {11}foo{0} {10}{{0} {4}1{0} {10}}{0} -{5}package{0} {11}Y{10};{0} -{5}BEGIN{0} {10}{{0} {15}*bar{0} {10}={0} {10}\&{11}X{10}::{11}foo{10};{0} {10}}{0} -{5}package{0} {11}Z{10};{0} -{5}sub{0} {11}Y{10}::{11}bar{0} {10}:{0} {11}lvalue{0} {10};{0} - -{2}# built-in attributes for subroutines: -{11}lvalue{0} {11}method{0} {5}prototype{10}(..){0} {11}locked{0} {11}const{0} - -{2}#-------------------------------------------------------------------------- -# Repetition in list assignment -#-------------------------------------------------------------------------- -{0} -{2}# example snippet from brian d foy's blog post -{5}use{0} {6}v5.22{10};{0} -{5}my{10}({5}undef{10},{0} {12}$card_num{10},{0} {10}({5}undef{10})x{4}3{10},{0} {12}$count{10}){0} {10}={0} {5}split{0} {17}/:/{10};{0} - -{10}({5}undef{10},{5}undef{10},{12}$foo{10}){0} {10}={0} {11}that_function{10}(){0} -{2}# is equivalent to -{10}(({5}undef{10})x{4}2{10},{0} {12}$foo{10}){0} {10}={0} {11}that_function{10}(){0} - -{2}#-------------------------------------------------------------------------- -# Floating point parsing has been improved -#-------------------------------------------------------------------------- -# Hexadecimal floating point literals -{0} -{2}# some hex floats from a program by Rick Regan -# appropriated and extended from Lua 5.2.x test cases -# tested on perl 5.22/cygwin -{0} -{4}0x1p-1074{10};{0} -{4}0x3.3333333333334p-5{10};{0} -{4}0xcc.ccccccccccdp-11{10};{0} -{4}0x1p+1{10};{0} -{4}0x1p-6{10};{0} -{4}0x1.b7p-1{10};{0} -{4}0x1.fffffffffffffp+1023{10};{0} -{4}0x1p-1022{10};{0} -{4}0X1.921FB4D12D84AP+1{10};{0} -{4}0x1.999999999999ap-4{10};{0} - -{2}# additional test cases for characterization -{4}0x1p-1074{10}.{0} {2}# dot is a string operator -{4}0x.ABCDEFp10{0} {2}# legal, dot immediately after 0x -{4}0x{10}.{11}p10{0} {2}# perl allows 0x as a zero, then concat with p10 bareword -{4}0x{10}.{11}p{0} {4}0x0{10}.{11}p{0} {2}# dot then bareword -{4}0x_0_.A_BC___DEF_p1_0{0} {2}# legal hex float, underscores are mostly allowed -{4}0x0{10}.{11}_ABCDEFp10{0} {2}# _ABCDEFp10 is a bareword, no underscore allowed after dot -{0} -{2}# illegal, but does not use error highlighting -{4}0x0p1{11}ABC{0} {2}# illegal, highlighted as 0x0p1 abut with bareword ABC -{0} -{2}# allowed to FAIL for now -{4}0x0.ABCDEFp_10{0} {2}# ABCDEFp_10 is a bareword, '_10' exponent not allowed -{4}0xp{0} {4}0xp1{0} {4}0x0.0p{0} {2}# syntax errors -{4}0x41.65{10}.{4}65{0} {2}# hex dot number, but lexer now fails with 0x41.65 left as a partial hex float -{0} -{2}#-------------------------------------------------------------------------- -# Support for ?PATTERN? without explicit operator has been removed -#-------------------------------------------------------------------------- -# ?PATTERN? must now be written as m?PATTERN? -{0} -{10}?{11}PATTERN{10}?{0} {2}# does not work in current LexPerl anyway, NO ACTION NEEDED -{17}m?PATTERN?{0} - -{2}#-------------------------------------------------------------------------- -# end of test file -#-------------------------------------------------------------------------- diff --git a/lexilla/test/examples/perl/perl-test-sub-prototypes.pl b/lexilla/test/examples/perl/perl-test-sub-prototypes.pl deleted file mode 100644 index 9cfb488ba..000000000 --- a/lexilla/test/examples/perl/perl-test-sub-prototypes.pl +++ /dev/null @@ -1,239 +0,0 @@ -# -*- coding: utf-8 -*- -#-------------------------------------------------------------------------- -# perl-test-sub-prototypes.pl -#-------------------------------------------------------------------------- -# compiled all relevant subroutine prototype test cases -# -#-------------------------------------------------------------------------- -# Kein-Hong Man <keinhong@gmail.com> Public Domain -#-------------------------------------------------------------------------- -# 20151227 initial document -#-------------------------------------------------------------------------- - -#-------------------------------------------------------------------------- -# test cases for sub syntax scanner -#-------------------------------------------------------------------------- -# sub syntax: simple and with added module notation -#-------------------------------------------------------------------------- - -sub fish($) { 123; } -sub fish::chips($) { 123; } # module syntax -sub fish::chips::sauce($) { 123; } # multiple module syntax - -sub fish :: chips :: sauce ($) { 123; } # added whitespace - -sub fish :: # embedded comment -chips # embedded comment - :: sauce ($) { 123; } - -sub fish :: ($) { 123; } # incomplete or bad syntax examples -sub fish :: 123 ($) { 123; } -sub fish :: chips 123 ($) { 123; } -sub 123 ($) { 123; } - -#-------------------------------------------------------------------------- -# sub syntax: prototype attributes -#-------------------------------------------------------------------------- - -sub fish:prototype($) { 123; } -sub fish : prototype ($) { 123; } # added whitespace - -sub fish:salted($) { 123; } # wrong attribute example (must use 'prototype') -sub fish : 123($) { 123; } # illegal attribute -sub fish:prototype:salted($) { 123; } # wrong 'prototype' position -sub fish:salted salt:prototype($) { 123; } # wrong attribute syntax - -sub fish:const:prototype($) { 123; } # extra attributes -sub fish:const:lvalue:prototype($) { 123; } -sub fish:const:prototype($):lvalue{ 123; } # might be legal too -sub fish :const :prototype($) { 123; } # extra whitespace - -sub fish :const # embedded comment: a constant sub -:prototype # embedded comment -($) { 123; } - -#-------------------------------------------------------------------------- -# sub syntax: mixed -#-------------------------------------------------------------------------- - -sub fish::chips:prototype($) { 123; } -sub fish::chips::sauce:prototype($) { 123; } -sub fish ::chips ::sauce :prototype($) { 123; } # +whitespace - -sub fish::chips::sauce:const:prototype($) { 123; } -sub fish::chips::sauce :const :prototype($) { 123; } # +whitespace - -sub fish # embedded comment -::chips ::sauce # embedded comment - : const # embedded comment - : prototype ($) { 123; } - -# wrong syntax examples, parentheses must follow ':prototype' -sub fish :prototype :const ($) { 123;} -sub fish :prototype ::chips ($) { 123;} - -#-------------------------------------------------------------------------- -# perl-test-5200delta.pl -#-------------------------------------------------------------------------- -# More consistent prototype parsing -#-------------------------------------------------------------------------- -# - whitespace now allowed, lexer now allows spaces or tabs - -sub foo ( $ $ ) {} -sub foo ( ) {} # spaces/tabs empty -sub foo ( * ) {} -sub foo (@ ) {} -sub foo ( %) {} - -# untested, should probably be \[ but scanner does not check this for now -sub foo ( \ [ $ @ % & * ] ) {} - -#-------------------------------------------------------------------------- -# perl-test-5140delta.pl -#-------------------------------------------------------------------------- -# new + prototype character, acts like (\[@%]) -#-------------------------------------------------------------------------- - -# these samples work as before -sub mylink ($$) # mylink $old, $new -sub myvec ($$$) # myvec $var, $offset, 1 -sub myindex ($$;$) # myindex &getstring, "substr" -sub mysyswrite ($$$;$) # mysyswrite $buf, 0, length($buf) - $off, $off -sub myreverse (@) # myreverse $a, $b, $c -sub myjoin ($@) # myjoin ":", $a, $b, $c -sub myopen (*;$) # myopen HANDLE, $name -sub mypipe (**) # mypipe READHANDLE, WRITEHANDLE -sub mygrep (&@) # mygrep { /foo/ } $a, $b, $c -sub myrand (;$) # myrand 42 -sub mytime () # mytime - -# backslash group notation to specify more than one allowed argument type -sub myref (\[$@%&*]) {} - -sub mysub (_) # underscore can be optionally used FIXED 20151211 - -# these uses the new '+' prototype character -sub mypop (+) # mypop @array -sub mysplice (+$$@) # mysplice @array, 0, 2, @pushme -sub mykeys (+) # mykeys %{$hashref} - -#-------------------------------------------------------------------------- -# perl-test-5200delta.pl -#-------------------------------------------------------------------------- -# Experimental Subroutine signatures (mostly works) -#-------------------------------------------------------------------------- -# INCLUDED FOR COMPLETENESS ONLY -# IMPORTANT NOTE the subroutine prototypes lexing implementation has -# no effect on subroutine signature syntax highlighting - -# subroutine signatures mostly looks fine except for the @ and % slurpy -# notation which are highlighted as operators (all other parameters are -# highlighted as vars of some sort), a minor aesthetic issue - -use feature 'signatures'; - -sub foo ($left, $right) { # mandatory positional parameters - return $left + $right; -} -sub foo ($first, $, $third) { # ignore second argument - return "first=$first, third=$third"; -} -sub foo ($left, $right = 0) { # optional parameter with default value - return $left + $right; -} -my $auto_id = 0; # default value expression, evaluated if default used only -sub foo ($thing, $id = $auto_id++) { - print "$thing has ID $id"; -} -sub foo ($first_name, $surname, $nickname = $first_name) { # 3rd parm may depend on 1st parm - print "$first_name $surname is known as \"$nickname\""; -} -sub foo ($thing, $ = 1) { # nameless default parameter - print $thing; -} -sub foo ($thing, $=) { # (this does something, I'm not sure what...) - print $thing; -} -sub foo ($filter, @inputs) { # additional arguments (slurpy parameter) - print $filter->($_) foreach @inputs; -} -sub foo ($thing, @) { # nameless slurpy parameter FAILS for now - print $thing; -} -sub foo ($filter, %inputs) { # slurpy parameter, hash type - print $filter->($_, $inputs{$_}) foreach sort keys %inputs; -} -sub foo ($thing, %) { # nameless slurpy parm, hash type FAILS for now - print $thing; -} -sub foo () { # empty signature no arguments (styled as prototype) - return 123; -} - -#-------------------------------------------------------------------------- -# perl-test-5200delta.pl -#-------------------------------------------------------------------------- -# subs now take a prototype attribute -#-------------------------------------------------------------------------- - -sub foo :prototype($) { $_[0] } - -sub foo :prototype($$) ($left, $right) { - return $left + $right; -} - -sub foo : prototype($$){} # whitespace allowed - -# additional samples from perl-test-cases.pl with ':prototype' added: -sub mylink :prototype($$) {} sub myvec :prototype($$$) {} -sub myindex :prototype($$;$) {} sub mysyswrite :prototype($$$;$) {} -sub myreverse :prototype(@) {} sub myjoin :prototype($@) {} -sub mypop :prototype(\@) {} sub mysplice :prototype(\@$$@) {} -sub mykeys :prototype(\%) {} sub myopen :prototype(*;$) {} -sub mypipe :prototype(**) {} sub mygrep :prototype(&@) {} -sub myrand :prototype($) {} sub mytime :prototype() {} -# backslash group notation to specify more than one allowed argument type -sub myref :prototype(\[$@%&*]) {} - -# additional attributes may complicate scanning for prototype syntax, -# for example (from https://metacpan.org/pod/perlsub): -# Lvalue subroutines - -my $val; -sub canmod : lvalue { - $val; # or: return $val; -} -canmod() = 5; # assigns to $val - -#-------------------------------------------------------------------------- -# perl-test-5220delta.pl -#-------------------------------------------------------------------------- -# New :const subroutine attribute -#-------------------------------------------------------------------------- - -my $x = 54321; -*INLINED = sub : const { $x }; -$x++; - -# more examples of attributes -# (not 5.22 stuff, but some general examples for study, useful for -# handling subroutine signature and subroutine prototype highlighting) - -sub foo : lvalue ; - -package X; -sub Y::z : lvalue { 1 } - -package X; -sub foo { 1 } -package Y; -BEGIN { *bar = \&X::foo; } -package Z; -sub Y::bar : lvalue ; - -# built-in attributes for subroutines: -lvalue method prototype(..) locked const - -#-------------------------------------------------------------------------- -# end of test file -#-------------------------------------------------------------------------- diff --git a/lexilla/test/examples/perl/perl-test-sub-prototypes.pl.styled b/lexilla/test/examples/perl/perl-test-sub-prototypes.pl.styled deleted file mode 100644 index e7290803b..000000000 --- a/lexilla/test/examples/perl/perl-test-sub-prototypes.pl.styled +++ /dev/null @@ -1,239 +0,0 @@ -{2}# -*- coding: utf-8 -*- -#-------------------------------------------------------------------------- -# perl-test-sub-prototypes.pl -#-------------------------------------------------------------------------- -# compiled all relevant subroutine prototype test cases -# -#-------------------------------------------------------------------------- -# Kein-Hong Man <keinhong@gmail.com> Public Domain -#-------------------------------------------------------------------------- -# 20151227 initial document -#-------------------------------------------------------------------------- -{0} -{2}#-------------------------------------------------------------------------- -# test cases for sub syntax scanner -#-------------------------------------------------------------------------- -# sub syntax: simple and with added module notation -#-------------------------------------------------------------------------- -{0} -{5}sub{0} {11}fish{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} -{5}sub{0} {11}fish{10}::{11}chips{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# module syntax -{5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# multiple module syntax -{0} -{5}sub{0} {11}fish{0} {10}::{0} {11}chips{0} {10}::{0} {11}sauce{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# added whitespace -{0} -{5}sub{0} {11}fish{0} {10}::{0} {2}# embedded comment -{11}chips{0} {2}# embedded comment -{0} {10}::{0} {11}sauce{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} - -{5}sub{0} {11}fish{0} {10}::{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# incomplete or bad syntax examples -{5}sub{0} {11}fish{0} {10}::{0} {4}123{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} -{5}sub{0} {11}fish{0} {10}::{0} {11}chips{0} {4}123{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} -{5}sub{0} {4}123{0} {10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} - -{2}#-------------------------------------------------------------------------- -# sub syntax: prototype attributes -#-------------------------------------------------------------------------- -{0} -{5}sub{0} {11}fish{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} -{5}sub{0} {11}fish{0} {10}:{0} {5}prototype{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# added whitespace -{0} -{5}sub{0} {11}fish{10}:{11}salted{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong attribute example (must use 'prototype') -{5}sub{0} {11}fish{0} {10}:{0} {4}123{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# illegal attribute -{5}sub{0} {11}fish{10}:{5}prototype{10}:{11}salted{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong 'prototype' position -{5}sub{0} {11}fish{10}:{11}salted{0} {11}salt{10}:{5}prototype{10}({12}$){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# wrong attribute syntax -{0} -{5}sub{0} {11}fish{10}:{11}const{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# extra attributes -{5}sub{0} {11}fish{10}:{11}const{10}:{11}lvalue{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} -{5}sub{0} {11}fish{10}:{11}const{10}:{5}prototype{40}($){10}:{11}lvalue{10}{{0} {4}123{10};{0} {10}}{0} {2}# might be legal too -{5}sub{0} {11}fish{0} {10}:{11}const{0} {10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# extra whitespace -{0} -{5}sub{0} {11}fish{0} {10}:{11}const{0} {2}# embedded comment: a constant sub -{10}:{5}prototype{0} {2}# embedded comment -{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} - -{2}#-------------------------------------------------------------------------- -# sub syntax: mixed -#-------------------------------------------------------------------------- -{0} -{5}sub{0} {11}fish{10}::{11}chips{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} -{5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} -{5}sub{0} {11}fish{0} {10}::{11}chips{0} {10}::{11}sauce{0} {10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# +whitespace -{0} -{5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{10}:{11}const{10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} -{5}sub{0} {11}fish{10}::{11}chips{10}::{11}sauce{0} {10}:{11}const{0} {10}:{5}prototype{40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} {2}# +whitespace -{0} -{5}sub{0} {11}fish{0} {2}# embedded comment -{10}::{11}chips{0} {10}::{11}sauce{0} {2}# embedded comment -{0} {10}:{0} {11}const{0} {2}# embedded comment -{0} {10}:{0} {5}prototype{0} {40}($){0} {10}{{0} {4}123{10};{0} {10}}{0} - -{2}# wrong syntax examples, parentheses must follow ':prototype' -{5}sub{0} {11}fish{0} {10}:{5}prototype{0} {10}:{11}const{0} {10}({12}$){0} {10}{{0} {4}123{10};}{0} -{5}sub{0} {11}fish{0} {10}:{5}prototype{0} {10}::{11}chips{0} {10}({12}$){0} {10}{{0} {4}123{10};}{0} - -{2}#-------------------------------------------------------------------------- -# perl-test-5200delta.pl -#-------------------------------------------------------------------------- -# More consistent prototype parsing -#-------------------------------------------------------------------------- -# - whitespace now allowed, lexer now allows spaces or tabs -{0} -{5}sub{0} {11}foo{0} {40}( $ $ ){0} {10}{}{0} -{5}sub{0} {11}foo{0} {40}( ){0} {10}{}{0} {2}# spaces/tabs empty -{5}sub{0} {11}foo{0} {40}( * ){0} {10}{}{0} -{5}sub{0} {11}foo{0} {40}(@ ){0} {10}{}{0} -{5}sub{0} {11}foo{0} {40}( %){0} {10}{}{0} - -{2}# untested, should probably be \[ but scanner does not check this for now -{5}sub{0} {11}foo{0} {40}( \ [ $ @ % & * ] ){0} {10}{}{0} - -{2}#-------------------------------------------------------------------------- -# perl-test-5140delta.pl -#-------------------------------------------------------------------------- -# new + prototype character, acts like (\[@%]) -#-------------------------------------------------------------------------- -{0} -{2}# these samples work as before -{5}sub{0} {11}mylink{0} {40}($$){0} {2}# mylink $old, $new -{5}sub{0} {11}myvec{0} {40}($$$){0} {2}# myvec $var, $offset, 1 -{5}sub{0} {11}myindex{0} {40}($$;$){0} {2}# myindex &getstring, "substr" -{5}sub{0} {11}mysyswrite{0} {40}($$$;$){0} {2}# mysyswrite $buf, 0, length($buf) - $off, $off -{5}sub{0} {11}myreverse{0} {40}(@){0} {2}# myreverse $a, $b, $c -{5}sub{0} {11}myjoin{0} {40}($@){0} {2}# myjoin ":", $a, $b, $c -{5}sub{0} {11}myopen{0} {40}(*;$){0} {2}# myopen HANDLE, $name -{5}sub{0} {11}mypipe{0} {40}(**){0} {2}# mypipe READHANDLE, WRITEHANDLE -{5}sub{0} {11}mygrep{0} {40}(&@){0} {2}# mygrep { /foo/ } $a, $b, $c -{5}sub{0} {11}myrand{0} {40}(;$){0} {2}# myrand 42 -{5}sub{0} {11}mytime{0} {40}(){0} {2}# mytime -{0} -{2}# backslash group notation to specify more than one allowed argument type -{5}sub{0} {11}myref{0} {40}(\[$@%&*]){0} {10}{}{0} - -{5}sub{0} {11}mysub{0} {40}(_){0} {2}# underscore can be optionally used FIXED 20151211 -{0} -{2}# these uses the new '+' prototype character -{5}sub{0} {11}mypop{0} {40}(+){0} {2}# mypop @array -{5}sub{0} {11}mysplice{0} {40}(+$$@){0} {2}# mysplice @array, 0, 2, @pushme -{5}sub{0} {11}mykeys{0} {40}(+){0} {2}# mykeys %{$hashref} -{0} -{2}#-------------------------------------------------------------------------- -# perl-test-5200delta.pl -#-------------------------------------------------------------------------- -# Experimental Subroutine signatures (mostly works) -#-------------------------------------------------------------------------- -# INCLUDED FOR COMPLETENESS ONLY -# IMPORTANT NOTE the subroutine prototypes lexing implementation has -# no effect on subroutine signature syntax highlighting -{0} -{2}# subroutine signatures mostly looks fine except for the @ and % slurpy -# notation which are highlighted as operators (all other parameters are -# highlighted as vars of some sort), a minor aesthetic issue -{0} -{5}use{0} {11}feature{0} {7}'signatures'{10};{0} - -{5}sub{0} {11}foo{0} {10}({12}$left{10},{0} {12}$right{10}){0} {10}{{0} {2}# mandatory positional parameters -{0} {5}return{0} {12}$left{0} {10}+{0} {12}$right{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {10}({12}$first{10},{0} {12}$,{0} {12}$third{10}){0} {10}{{0} {2}# ignore second argument -{0} {5}return{0} {6}"first={43}$first{6}, third={43}$third{6}"{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {10}({12}$left{10},{0} {12}$right{0} {10}={0} {4}0{10}){0} {10}{{0} {2}# optional parameter with default value -{0} {5}return{0} {12}$left{0} {10}+{0} {12}$right{10};{0} -{10}}{0} -{5}my{0} {12}$auto_id{0} {10}={0} {4}0{10};{0} {2}# default value expression, evaluated if default used only -{5}sub{0} {11}foo{0} {10}({12}$thing{10},{0} {12}$id{0} {10}={0} {12}$auto_id{10}++){0} {10}{{0} - {5}print{0} {6}"{43}$thing{6} has ID {43}$id{6}"{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {10}({12}$first_name{10},{0} {12}$surname{10},{0} {12}$nickname{0} {10}={0} {12}$first_name{10}){0} {10}{{0} {2}# 3rd parm may depend on 1st parm -{0} {5}print{0} {6}"{43}$first_name{6} {43}$surname{6} is known as \"{43}$nickname{6}\""{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {10}({12}$thing{10},{0} {12}${0} {10}={0} {4}1{10}){0} {10}{{0} {2}# nameless default parameter -{0} {5}print{0} {12}$thing{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {10}({12}$thing{10},{0} {12}$={10}){0} {10}{{0} {2}# (this does something, I'm not sure what...) -{0} {5}print{0} {12}$thing{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {10}({12}$filter{10},{0} {13}@inputs{10}){0} {10}{{0} {2}# additional arguments (slurpy parameter) -{0} {5}print{0} {12}$filter{10}->({12}$_{10}){0} {5}foreach{0} {13}@inputs{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {10}({12}$thing{10},{0} {10}@){0} {10}{{0} {2}# nameless slurpy parameter FAILS for now -{0} {5}print{0} {12}$thing{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {10}({12}$filter{10},{0} {14}%inputs{10}){0} {10}{{0} {2}# slurpy parameter, hash type -{0} {5}print{0} {12}$filter{10}->({12}$_{10},{0} {12}$inputs{10}{{12}$_{10}}){0} {5}foreach{0} {5}sort{0} {5}keys{0} {14}%inputs{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {10}({12}$thing{10},{0} {10}%){0} {10}{{0} {2}# nameless slurpy parm, hash type FAILS for now -{0} {5}print{0} {12}$thing{10};{0} -{10}}{0} -{5}sub{0} {11}foo{0} {40}(){0} {10}{{0} {2}# empty signature no arguments (styled as prototype) -{0} {5}return{0} {4}123{10};{0} -{10}}{0} - -{2}#-------------------------------------------------------------------------- -# perl-test-5200delta.pl -#-------------------------------------------------------------------------- -# subs now take a prototype attribute -#-------------------------------------------------------------------------- -{0} -{5}sub{0} {11}foo{0} {10}:{5}prototype{40}($){0} {10}{{0} {12}$_{10}[{4}0{10}]{0} {10}}{0} - -{5}sub{0} {11}foo{0} {10}:{5}prototype{40}($$){0} {10}({12}$left{10},{0} {12}$right{10}){0} {10}{{0} - {5}return{0} {12}$left{0} {10}+{0} {12}$right{10};{0} -{10}}{0} - -{5}sub{0} {11}foo{0} {10}:{0} {5}prototype{40}($$){10}{}{0} {2}# whitespace allowed -{0} -{2}# additional samples from perl-test-cases.pl with ':prototype' added: -{5}sub{0} {11}mylink{0} {10}:{5}prototype{40}($$){0} {10}{}{0} {5}sub{0} {11}myvec{0} {10}:{5}prototype{40}($$$){0} {10}{}{0} -{5}sub{0} {11}myindex{0} {10}:{5}prototype{40}($$;$){0} {10}{}{0} {5}sub{0} {11}mysyswrite{0} {10}:{5}prototype{40}($$$;$){0} {10}{}{0} -{5}sub{0} {11}myreverse{0} {10}:{5}prototype{40}(@){0} {10}{}{0} {5}sub{0} {11}myjoin{0} {10}:{5}prototype{40}($@){0} {10}{}{0} -{5}sub{0} {11}mypop{0} {10}:{5}prototype{40}(\@){0} {10}{}{0} {5}sub{0} {11}mysplice{0} {10}:{5}prototype{40}(\@$$@){0} {10}{}{0} -{5}sub{0} {11}mykeys{0} {10}:{5}prototype{40}(\%){0} {10}{}{0} {5}sub{0} {11}myopen{0} {10}:{5}prototype{40}(*;$){0} {10}{}{0} -{5}sub{0} {11}mypipe{0} {10}:{5}prototype{40}(**){0} {10}{}{0} {5}sub{0} {11}mygrep{0} {10}:{5}prototype{40}(&@){0} {10}{}{0} -{5}sub{0} {11}myrand{0} {10}:{5}prototype{40}($){0} {10}{}{0} {5}sub{0} {11}mytime{0} {10}:{5}prototype{40}(){0} {10}{}{0} -{2}# backslash group notation to specify more than one allowed argument type -{5}sub{0} {11}myref{0} {10}:{5}prototype{40}(\[$@%&*]){0} {10}{}{0} - -{2}# additional attributes may complicate scanning for prototype syntax, -# for example (from https://metacpan.org/pod/perlsub): -# Lvalue subroutines -{0} -{5}my{0} {12}$val{10};{0} -{5}sub{0} {11}canmod{0} {10}:{0} {11}lvalue{0} {10}{{0} - {12}$val{10};{0} {2}# or: return $val; -{10}}{0} -{11}canmod{10}(){0} {10}={0} {4}5{10};{0} {2}# assigns to $val -{0} -{2}#-------------------------------------------------------------------------- -# perl-test-5220delta.pl -#-------------------------------------------------------------------------- -# New :const subroutine attribute -#-------------------------------------------------------------------------- -{0} -{5}my{0} {12}$x{0} {10}={0} {4}54321{10};{0} -{15}*INLINED{0} {10}={0} {5}sub{0} {10}:{0} {11}const{0} {10}{{0} {12}$x{0} {10}};{0} -{12}$x{10}++;{0} - -{2}# more examples of attributes -# (not 5.22 stuff, but some general examples for study, useful for -# handling subroutine signature and subroutine prototype highlighting) -{0} -{5}sub{0} {11}foo{0} {10}:{0} {11}lvalue{0} {10};{0} - -{5}package{0} {11}X{10};{0} -{5}sub{0} {11}Y{10}::{11}z{0} {10}:{0} {11}lvalue{0} {10}{{0} {4}1{0} {10}}{0} - -{5}package{0} {11}X{10};{0} -{5}sub{0} {11}foo{0} {10}{{0} {4}1{0} {10}}{0} -{5}package{0} {11}Y{10};{0} -{5}BEGIN{0} {10}{{0} {15}*bar{0} {10}={0} {10}\&{11}X{10}::{11}foo{10};{0} {10}}{0} -{5}package{0} {11}Z{10};{0} -{5}sub{0} {11}Y{10}::{11}bar{0} {10}:{0} {11}lvalue{0} {10};{0} - -{2}# built-in attributes for subroutines: -{11}lvalue{0} {11}method{0} {5}prototype{10}(..){0} {11}locked{0} {11}const{0} - -{2}#-------------------------------------------------------------------------- -# end of test file -#-------------------------------------------------------------------------- diff --git a/lexilla/test/examples/perl/x.pl b/lexilla/test/examples/perl/x.pl deleted file mode 100644 index 19288f2c9..000000000 --- a/lexilla/test/examples/perl/x.pl +++ /dev/null @@ -1,5 +0,0 @@ -use strict; -while ( $r ) { - printf ( "Example text \n" ); - sleep 1; -}
\ No newline at end of file diff --git a/lexilla/test/examples/perl/x.pl.styled b/lexilla/test/examples/perl/x.pl.styled deleted file mode 100644 index 74da4e911..000000000 --- a/lexilla/test/examples/perl/x.pl.styled +++ /dev/null @@ -1,5 +0,0 @@ -{5}use{0} {11}strict{10};{0} -{5}while{0} {10}({0} {12}$r{0} {10}){0} {10}{{0} - {5}printf{0} {10}({0} {6}"Example text \n"{0} {10});{0} - {5}sleep{0} {4}1{10};{0} -{10}}
\ No newline at end of file diff --git a/lexilla/test/examples/python/AllStyles.py b/lexilla/test/examples/python/AllStyles.py deleted file mode 100644 index a93df7500..000000000 --- a/lexilla/test/examples/python/AllStyles.py +++ /dev/null @@ -1,63 +0,0 @@ -# Enumerate all styles: 0 to 19 -# comment=1 - -# whitespace=0 - # w - -# number=2 -37 - -# double-quoted-string=3 -"str" - -# single-quoted-string=4 -'str' - -# keyword=5 -pass - -# triple-quoted-string=6 -'''str''' - -# triple-double-quoted-string=7 -"""str""" - -# class-name=8 -class ClassName: - pass - -# function-name=9 -def function_name(): - pass - -# operator=10 -1 + 3 - -# identifier=11 -identifier = 2 - -# comment-block=12 -## block - -# unclosed-string=13 -" unclosed - -# highlighted-identifier=14 -hilight = 2 - -# decorator=15 -@staticmethod -def fn(): pass - -a = 1 -# double-quoted-f-string=16 -f"{a}" - -# single-quoted-f-string=17 -f'{a}' - -# triple-quoted-f-string=18 -f'''{a}''' - -# double-triple-quoted-f-string=19 -f"""{a}""" diff --git a/lexilla/test/examples/python/AllStyles.py.styled b/lexilla/test/examples/python/AllStyles.py.styled deleted file mode 100644 index e824e9e4c..000000000 --- a/lexilla/test/examples/python/AllStyles.py.styled +++ /dev/null @@ -1,63 +0,0 @@ -{1}# Enumerate all styles: 0 to 19{0} -{1}# comment=1{0} - -{1}# whitespace=0{0} - {1}# w{0} - -{1}# number=2{0} -{2}37{0} - -{1}# double-quoted-string=3{0} -{3}"str"{0} - -{1}# single-quoted-string=4{0} -{4}'str'{0} - -{1}# keyword=5{0} -{5}pass{0} - -{1}# triple-quoted-string=6{0} -{6}'''str'''{0} - -{1}# triple-double-quoted-string=7{0} -{7}"""str"""{0} - -{1}# class-name=8{0} -{5}class{0} {8}ClassName{10}:{0} - {5}pass{0} - -{1}# function-name=9{0} -{5}def{0} {9}function_name{10}():{0} - {5}pass{0} - -{1}# operator=10{0} -{2}1{0} {10}+{0} {2}3{0} - -{1}# identifier=11{0} -{11}identifier{0} {10}={0} {2}2{0} - -{1}# comment-block=12{0} -{12}## block{0} - -{1}# unclosed-string=13{0} -{13}" unclosed -{0} -{1}# highlighted-identifier=14{0} -{14}hilight{0} {10}={0} {2}2{0} - -{1}# decorator=15{0} -{15}@staticmethod{0} -{5}def{0} {9}fn{10}():{0} {5}pass{0} - -{11}a{0} {10}={0} {2}1{0} -{1}# double-quoted-f-string=16{0} -{16}f"{{11}a{16}}"{0} - -{1}# single-quoted-f-string=17{0} -{17}f'{{11}a{17}}'{0} - -{1}# triple-quoted-f-string=18{0} -{18}f'''{{11}a{18}}'''{0} - -{1}# double-triple-quoted-f-string=19{0} -{19}f"""{{11}a{19}}"""{0} diff --git a/lexilla/test/examples/python/SciTE.properties b/lexilla/test/examples/python/SciTE.properties deleted file mode 100644 index 7618b0731..000000000 --- a/lexilla/test/examples/python/SciTE.properties +++ /dev/null @@ -1,3 +0,0 @@ -lexer.*.py=python -keywords.*.py=class def else for if import in pass print return while with yield -keywords2.*.py=hilight diff --git a/lexilla/test/examples/python/x.py b/lexilla/test/examples/python/x.py deleted file mode 100644 index 57833c059..000000000 --- a/lexilla/test/examples/python/x.py +++ /dev/null @@ -1,19 +0,0 @@ -# Convert all punctuation characters except '_', '*', and '.' into spaces. -def depunctuate(s): - '''A docstring''' - """Docstring 2""" - d = "" - for ch in s: - if ch in 'abcde': - d = d + ch - else: - d = d + " " - return d - -import contextlib - -@contextlib.contextmanager -def singleuse(): - print("Before") - yield -with singleuse(): pass diff --git a/lexilla/test/examples/python/x.py.styled b/lexilla/test/examples/python/x.py.styled deleted file mode 100644 index 8ba7513c8..000000000 --- a/lexilla/test/examples/python/x.py.styled +++ /dev/null @@ -1,19 +0,0 @@ -{1}# Convert all punctuation characters except '_', '*', and '.' into spaces.{0} -{5}def{0} {9}depunctuate{10}({11}s{10}):{0} - {6}'''A docstring'''{0} - {7}"""Docstring 2"""{0} - {11}d{0} {10}={0} {3}""{0} - {5}for{0} {11}ch{0} {5}in{0} {11}s{10}:{0} - {5}if{0} {11}ch{0} {5}in{0} {4}'abcde'{10}:{0} - {11}d{0} {10}={0} {11}d{0} {10}+{0} {11}ch{0} - {5}else{10}:{0} - {11}d{0} {10}={0} {11}d{0} {10}+{0} {3}" "{0} - {5}return{0} {11}d{0} - -{5}import{0} {11}contextlib{0} - -{15}@contextlib{10}.{11}contextmanager{0} -{5}def{0} {9}singleuse{10}():{0} - {5}print{10}({3}"Before"{10}){0} - {5}yield{0} -{5}with{0} {11}singleuse{10}():{0} {5}pass{0} diff --git a/lexilla/test/examples/raku/SciTE.properties b/lexilla/test/examples/raku/SciTE.properties deleted file mode 100644 index 065af1363..000000000 --- a/lexilla/test/examples/raku/SciTE.properties +++ /dev/null @@ -1,113 +0,0 @@ -lexer.*.p6=raku -# Keywords (base) -keywords.$(file.patterns.raku)=BEGIN CATCH CHECK CONTROL END ENTER EVAL FIRST \ - INIT KEEP LAST LEAVE NEXT POST PRE START TEMP UNDO after also andthen as \ - async augment bag before but category circumfix class cmp complex constant \ - contend default defer div does dynamic else elsif enum eq eqv extra fail \ - fatal ff fff for gather gcd ge given grammar gt handles has if infix is lcm \ - le leave leg let lift loop lt macro make maybe method mix mod module multi \ - ne not o only oo or orelse orwith postcircumfix postfix prefix proto regex \ - repeat require return-rw returns role rule size_t slang start str submethod \ - subset supersede take temp term token trusts try unit unless until when \ - where while with without x xor xx -# Keywords (functions) -keywords2.$(file.patterns.raku)=ACCEPTS AT-KEY EVALFILE EXISTS-KEY Filetests \ - IO STORE abs accept acos acosec acosech acosh acotan acotanh alarm and \ - antipairs asec asech asin asinh atan atan2 atanh base bind binmode bless \ - break caller ceiling chars chdir chmod chomp chop chr chroot chrs cis close \ - closedir codes comb conj connect contains continue cos cosec cosech cosh \ - cotan cotanh crypt dbm defined die do dump each elems eof exec exists exit \ - exp expmod fc fcntl fileno flat flip flock floor fmt fork formats functions \ - get getc getpeername getpgrp getppid getpriority getsock gist glob gmtime \ - goto grep hyper import index int invert ioctl is-prime iterator join keyof \ - keys kill kv last lazy lc lcfirst lines link list listen local localtime \ - lock log log10 lsb lstat map match mkdir msb msg my narrow new next no of \ - open ord ords our pack package pairs path pick pipe polymod pop pos pred \ - print printf prototype push quoting race rand read readdir readline readlink \ - readpipe recv redo ref rename requires reset return reverse rewinddir rindex \ - rmdir roots round samecase say scalar sec sech seek seekdir select semctl \ - semget semop send set setpgrp setpriority setsockopt shift shm shutdown sign \ - sin sinh sleep sockets sort splice split sprintf sqrt srand stat state study \ - sub subst substr substr-rw succ symlink sys syscall system syswrite tan tanh \ - tc tclc tell telldir tie time times trans trim trim-leading trim-trailing \ - truncate uc ucfirst unimatch uniname uninames uniprop uniprops unival unlink \ - unpack unpolar unshift untie use utime values wait waitpid wantarray warn \ - wordcase words write -# Keywords (types) -keywords3.$(file.patterns.raku)=AST Any Block Bool CallFrame Callable Code \ - Collation Compiler Complex ComplexStr Cool CurrentThreadScheduler Date \ - DateTime Dateish Distribution Distribution::Hash Distribution::Locally \ - Distribution::Path Duration Encoding Encoding::Registry Endian FatRat \ - ForeignCode HyperSeq HyperWhatever Instant Int IntStr Junction Label \ - Lock::Async Macro Method Mu Nil Num NumStr Numeric ObjAt Parameter Perl \ - PredictiveIterator Proxy RaceSeq Rat RatStr Rational Real Routine \ - Routine::WrapHandle Scalar Sequence Signature Str StrDistance Stringy Sub \ - Submethod Telemetry Telemetry::Instrument::Thread \ - Telemetry::Instrument::ThreadPool Telemetry::Instrument::Usage \ - Telemetry::Period Telemetry::Sampler UInt ValueObjAt Variable Version \ - Whatever WhateverCode atomicint bit bool buf buf1 buf16 buf2 buf32 buf4 \ - buf64 buf8 int int1 int16 int2 int32 int4 int64 int8 long longlong num \ - num32 num64 rat rat1 rat16 rat2 rat32 rat4 rat64 rat8 uint uint1 uint16 \ - uint2 uint32 uint4 uint64 uint8 utf16 utf32 utf8 -# Keywords (types composite) -keywords4.$(file.patterns.raku)=Array Associative Bag BagHash Baggy Blob Buf \ - Capture Enumeration Hash Iterable Iterator List Map Mix MixHash Mixy NFC NFD \ - NFKC NFKD Pair Positional PositionalBindFailover PseudoStash QuantHash Range \ - Seq Set SetHash Setty Slip Stash Uni utf8 -# Keywords (types domain specific) -keywords5.$(file.patterns.raku)=Attribute Cancellation Channel CompUnit \ - CompUnit::Repository CompUnit::Repository::FileSystem \ - CompUnit::Repository::Installation Distro Grammar IO IO::ArgFiles \ - IO::CatHandle IO::Handle IO::Notification IO::Path IO::Path::Cygwin \ - IO::Path::QNX IO::Path::Unix IO::Path::Win32 IO::Pipe IO::Socket \ - IO::Socket::Async IO::Socket::INET IO::Spec IO::Spec::Cygwin \ - IO::Spec::QNX IO::Spec::Unix IO::Spec::Win32 IO::Special Kernel Lock \ - Match Order Pod::Block Pod::Block::Code Pod::Block::Comment \ - Pod::Block::Declarator Pod::Block::Named Pod::Block::Para Pod::Block::Table \ - Pod::Defn Pod::FormattingCode Pod::Heading Pod::Item Proc Proc::Async \ - Promise Regex Scheduler Semaphore Supplier Supplier::Preserving Supply \ - Systemic Tap Thread ThreadPoolScheduler VM -# Keywords (types domain exceptions) -keywords6.$(file.patterns.raku)=Backtrace Backtrace::Frame CX::Done CX::Emit \ - CX::Last CX::Next CX::Proceed CX::Redo CX::Return CX::Succeed CX::Take \ - CX::Warn Exception Failure X::AdHoc X::Anon::Augment X::Anon::Multi \ - X::Assignment::RO X::Attribute::NoPackage X::Attribute::Package \ - X::Attribute::Required X::Attribute::Undeclared X::Augment::NoSuchType \ - X::Bind X::Bind::NativeType X::Bind::Slice X::Caller::NotDynamic \ - X::Channel::ReceiveOnClosed X::Channel::SendOnClosed X::Comp \ - X::Composition::NotComposable X::Constructor::Positional X::Control \ - X::ControlFlow X::ControlFlow::Return X::DateTime::TimezoneClash \ - X::Declaration::Scope X::Declaration::Scope::Multi X::Does::TypeObject \ - X::Dynamic::NotFound X::Eval::NoSuchLang X::Export::NameClash X::IO \ - X::IO::Chdir X::IO::Chmod X::IO::Copy X::IO::Cwd X::IO::Dir X::IO::DoesNotExist \ - X::IO::Link X::IO::Mkdir X::IO::Move X::IO::Rename X::IO::Rmdir \ - X::IO::Symlink X::IO::Unlink X::Inheritance::NotComposed \ - X::Inheritance::Unsupported X::Method::InvalidQualifier X::Method::NotFound \ - X::Method::Private::Permission X::Method::Private::Unqualified \ - X::Mixin::NotComposable X::NYI X::NoDispatcher X::Numeric::Real \ - X::OS X::Obsolete X::OutOfRange X::Package::Stubbed X::Parameter::Default \ - X::Parameter::MultipleTypeConstraints X::Parameter::Placeholder \ - X::Parameter::Twigil X::Parameter::WrongOrder X::Phaser::Multiple \ - X::Phaser::PrePost X::Placeholder::Block X::Placeholder::Mainline \ - X::Pod X::Proc::Async X::Proc::Async::AlreadyStarted X::Proc::Async::BindOrUse \ - X::Proc::Async::CharsOrBytes X::Proc::Async::MustBeStarted \ - X::Proc::Async::OpenForWriting X::Proc::Async::TapBeforeSpawn \ - X::Proc::Unsuccessful X::Promise::CauseOnlyValidOnBroken X::Promise::Vowed \ - X::Redeclaration X::Role::Initialization X::Scheduler::CueInNaNSeconds \ - X::Seq::Consumed X::Sequence::Deduction X::Signature::NameClash \ - X::Signature::Placeholder X::Str::Numeric X::StubCode X::Syntax \ - X::Syntax::Augment::WithoutMonkeyTyping X::Syntax::Comment::Embedded \ - X::Syntax::Confused X::Syntax::InfixInTermPosition X::Syntax::Malformed \ - X::Syntax::Missing X::Syntax::NegatedPair X::Syntax::NoSelf \ - X::Syntax::Number::RadixOutOfRange X::Syntax::P5 X::Syntax::Perl5Var \ - X::Syntax::Regex::Adverb X::Syntax::Regex::SolitaryQuantifier \ - X::Syntax::Reserved X::Syntax::Self::WithoutObject \ - X::Syntax::Signature::InvocantMarker X::Syntax::Term::MissingInitializer \ - X::Syntax::UnlessElse X::Syntax::Variable::Match X::Syntax::Variable::Numeric \ - X::Syntax::Variable::Twigil X::Temporal X::Temporal::InvalidFormat \ - X::TypeCheck X::TypeCheck::Assignment X::TypeCheck::Binding \ - X::TypeCheck::Return X::TypeCheck::Splice X::Undeclared -# Keywords (adverbs) -keywords7.$(file.patterns.raku)=D a array b backslash c closure delete double \ - exec exists f function h hash heredoc k kv p q qq quotewords s scalar single \ - sym to v val w words ww x diff --git a/lexilla/test/examples/raku/x.p6 b/lexilla/test/examples/raku/x.p6 deleted file mode 100644 index 0cbdb6a57..000000000 --- a/lexilla/test/examples/raku/x.p6 +++ /dev/null @@ -1,54 +0,0 @@ -use v6; - -# Normal single line comment -my Int $i = 0; -my Rat $r = 3.142; -my Str $s = "Hello, world! \$i == $i and \$r == $r"; -say $s; - -#`{{ -*** This is a multi-line comment *** -}} - -my @array = #`[[ inline comment ]] <f fo foo food>; -my %hash = ( AAA => 1, BBB => 2 ); - -say q[This back\slash stays]; -say q[This back\\slash stays]; # Identical output -say Q:q!Just a literal "\n" here!; - -=begin pod -POD Documentation... -=end pod - -say qq:to/END/; -A multi-line -string with interpolated vars: $i, $r -END - -sub function { - return q:to/END/; -Here is -some multi-line -string -END -} - -my $func = &function; -say $func(); - -grammar Calculator { - token TOP { <calc-op> } - proto rule calc-op {*} - rule calc-op:sym<add> { <num> '+' <num> } - rule calc-op:sym<sub> { <num> '-' <num> } - token num { \d+ } -} - -class Calculations { - method TOP ($/) { make $<calc-op>.made; } - method calc-op:sym<add> ($/) { make [+] $<num>; } - method calc-op:sym<sub> ($/) { make [-] $<num>; } -} - -say Calculator.parse('2 + 3', actions => Calculations).made; diff --git a/lexilla/test/examples/raku/x.p6.styled b/lexilla/test/examples/raku/x.p6.styled deleted file mode 100644 index f23902104..000000000 --- a/lexilla/test/examples/raku/x.p6.styled +++ /dev/null @@ -1,54 +0,0 @@ -{20}use{0} {16}v6{18};{0} - -{2}# Normal single line comment{0} -{20}my{0} {22}Int{0} {23}$i{0} {18}={0} {16}0{18};{0} -{20}my{0} {22}Rat{0} {23}$r{0} {18}={0} {16}3.142{18};{0} -{20}my{0} {22}Str{0} {23}$s{0} {18}={0} {8}"Hello, world! \$i == {12}$i{8} and \$r == {12}$r{8}"{18};{0} -{20}say{0} {23}$s{18};{0} - -{2}#`{3}{{ -*** This is a multi-line comment *** -}}{0} - -{20}my{0} {24}@array{0} {18}={0} {2}#`{3}[[ inline comment ]]{0} {9}<f fo foo food>{18};{0} -{20}my{0} {25}%hash{0} {18}={0} {18}({0} {21}AAA{0} {18}=>{0} {16}1{18},{0} {21}BBB{0} {18}=>{0} {16}2{0} {18});{0} - -{20}say{0} {9}q[This back\slash stays]{18};{0} -{20}say{0} {9}q[This back\\slash stays]{18};{0} {2}# Identical output{0} -{20}say{0} {11}Q{15}:q{11}!Just a literal "\n" here!{18};{0} - -{4}=begin pod -POD Documentation... -=end pod{0} - -{20}say{0} {10}qq{15}:to{10}/END/{18};{0} -{7}A multi-line -string with interpolated vars: {12}$i{7}, {12}$r{7} -END{0} - -{20}sub{0} {21}function{0} {18}{{0} - {20}return{0} {9}q{15}:to{9}/END/{18};{0} -{6}Here is -some multi-line -string -END{0} -{18}}{0} - -{20}my{0} {23}$func{0} {18}={0} {26}&function{18};{0} -{20}say{0} {23}$func{18}();{0} - -{19}grammar{0} {27}Calculator{0} {18}{{0} - {19}token{0} {21}TOP{0} {13}{ <calc-op> }{0} - {19}proto{0} {19}rule{0} {21}calc-op{0} {13}{*}{0} - {19}rule{0} {21}calc-op{15}:sym{18}<{21}add{18}>{0} {13}{ <num> '+' <num> }{0} - {19}rule{0} {21}calc-op{15}:sym{18}<{21}sub{18}>{0} {13}{ <num> '-' <num> }{0} - {19}token{0} {21}num{0} {13}{ \d+ }{0} -{18}}{0} - -{19}class{0} {28}Calculations{0} {18}{{0} - {19}method{0} {21}TOP{0} {18}({23}$/{18}){0} {18}{{0} {19}make{0} {23}${18}<{23}calc-op{18}>.{21}made{18};{0} {18}}{0} - {19}method{0} {21}calc-op{15}:sym{18}<{21}add{18}>{0} {18}({23}$/{18}){0} {18}{{0} {21}make{0} {18}[+]{0} {23}${18}<{23}num{18}>;{0} {18}}{0} - {19}method{0} {21}calc-op{15}:sym{18}<{21}sub{18}>{0} {18}({23}$/{18}){0} {18}{{0} {21}make{0} {18}[-]{0} {23}${18}<{23}num{18}>;{0} {18}}{0} -{18}}{0} - -{20}say{0} {21}Calculator{18}.{21}parse{18}({8}'2 + 3'{18},{0} {21}actions{0} {18}=>{0} {21}Calculations{18}).{21}made{18};{0} diff --git a/lexilla/test/examples/ruby/SciTE.properties b/lexilla/test/examples/ruby/SciTE.properties deleted file mode 100644 index a4be7e9c6..000000000 --- a/lexilla/test/examples/ruby/SciTE.properties +++ /dev/null @@ -1,2 +0,0 @@ -lexer.*.rb=ruby -keywords.*.rb=class def end diff --git a/lexilla/test/examples/ruby/x.rb b/lexilla/test/examples/ruby/x.rb deleted file mode 100644 index d1bb0f0a8..000000000 --- a/lexilla/test/examples/ruby/x.rb +++ /dev/null @@ -1,6 +0,0 @@ -class Demo - def test # A test - i = 1 - puts "Example" - end -end
\ No newline at end of file diff --git a/lexilla/test/examples/ruby/x.rb.styled b/lexilla/test/examples/ruby/x.rb.styled deleted file mode 100644 index 904d07dd3..000000000 --- a/lexilla/test/examples/ruby/x.rb.styled +++ /dev/null @@ -1,6 +0,0 @@ -{5}class{0} {8}Demo{0} - {5}def{0} {9}test{0} {2}# A test{0} - {11}i{0} {10}={0} {4}1{0} - {11}puts{0} {6}"Example"{0} - {5}end{0} -{5}end
\ No newline at end of file diff --git a/lexilla/test/examples/tcl/SciTE.properties b/lexilla/test/examples/tcl/SciTE.properties deleted file mode 100644 index 8cecd97b4..000000000 --- a/lexilla/test/examples/tcl/SciTE.properties +++ /dev/null @@ -1,2 +0,0 @@ -lexer.*.tcl=tcl -keywords.*.tcl=proc set socket vwait diff --git a/lexilla/test/examples/tcl/x.tcl b/lexilla/test/examples/tcl/x.tcl deleted file mode 100644 index d1260fc82..000000000 --- a/lexilla/test/examples/tcl/x.tcl +++ /dev/null @@ -1,13 +0,0 @@ -# tcl tests - -#simple example - -proc Echo_Server {port} { - set s [socket -server EchoAccept $port] - vwait forever; -} - -# Bug #1947 - -$s($i,"n") -set n $showArray($i,"neighbor") diff --git a/lexilla/test/examples/tcl/x.tcl.styled b/lexilla/test/examples/tcl/x.tcl.styled deleted file mode 100644 index 66af41327..000000000 --- a/lexilla/test/examples/tcl/x.tcl.styled +++ /dev/null @@ -1,13 +0,0 @@ -{2}# tcl tests -{0} -{2}#simple example -{0} -{12}proc{0} {7}Echo_Server{0} {6}{{7}port{6}}{0} {6}{ -{0} {12}set{0} {7}s{0} {6}[{12}socket{0} {10}-server{0} {7}EchoAccept{0} {8}$port{6}] -{0} {12}vwait{0} {7}forever{0}; -{6}} -{0} -{2}# Bug #1947 -{0} -{8}$s{6}({8}$i{6},{5}"n"{6}) -{12}set{0} {7}n{0} {8}$showArray{6}({8}$i{6},{5}"neighbor"{6}) diff --git a/lexilla/test/examples/vb/SciTE.properties b/lexilla/test/examples/vb/SciTE.properties deleted file mode 100644 index 54fead3f1..000000000 --- a/lexilla/test/examples/vb/SciTE.properties +++ /dev/null @@ -1,2 +0,0 @@ -lexer.*.vb=vb -keywords.*.vb=as dim or string diff --git a/lexilla/test/examples/vb/x.vb b/lexilla/test/examples/vb/x.vb deleted file mode 100644 index a672831a0..000000000 --- a/lexilla/test/examples/vb/x.vb +++ /dev/null @@ -1,13 +0,0 @@ -' String" -Dim a As String = "hello, world" -Dim b As String = "hello world" -Dim c As String = "Joe said ""Hello"" to me" -Dim d As String = "\\\\server\\share\\file.txt" -' Character -""C "c"C "cc"C -' Date -d = #5/31/1993# or # 01/01/0001 12:00:00AM # -' Number -123_456___789 -123_ -&b10101_01010 diff --git a/lexilla/test/examples/vb/x.vb.styled b/lexilla/test/examples/vb/x.vb.styled deleted file mode 100644 index 1d19c8ae8..000000000 --- a/lexilla/test/examples/vb/x.vb.styled +++ /dev/null @@ -1,13 +0,0 @@ -{1}' String" -{3}Dim{0} {7}a{0} {3}As{0} {3}String{0} {6}={0} {4}"hello, world"{0} -{3}Dim{0} {7}b{0} {3}As{0} {3}String{0} {6}={0} {4}"hello world"{0} -{3}Dim{0} {7}c{0} {3}As{0} {3}String{0} {6}={0} {4}"Joe said ""Hello"" to me"{0} -{3}Dim{0} {7}d{0} {3}As{0} {3}String{0} {6}={0} {4}"\\\\server\\share\\file.txt"{0} -{1}' Character -{4}""C{0} {4}"c"C{0} {4}"cc"C{0} -{1}' Date -{7}d{0} {6}={0} {8}#5/31/1993#{0} {3}or{0} {8}# 01/01/0001 12:00:00AM #{0} -{1}' Number -{2}123_456___789{0} -{2}123_{0} -{2}&b10101_01010{0} diff --git a/lexilla/test/makefile b/lexilla/test/makefile deleted file mode 100644 index f89f75640..000000000 --- a/lexilla/test/makefile +++ /dev/null @@ -1,68 +0,0 @@ -# Build all the lexer tests using GNU make and either g++ or Clang -# @file makefile -# Copyright 2019 by Neil Hodgson <neilh@scintilla.org> -# The License.txt file describes the conditions under which this software may be distributed. -# Should be run using mingw32-make on Windows, not nmake -# On Windows g++ is used, on OS X clang, and on Linux g++ is used by default -# but clang can be used by defining CLANG when invoking make -# clang works only with libc++, not libstdc++ - -.PHONY: all test clean - -.SUFFIXES: .cxx - -WARNINGS = -Wpedantic -Wall -Wextra - -ifndef windir -LIBS += -ldl -ifeq ($(shell uname),Darwin) -# On macOS always use Clang -CLANG = 1 -endif -endif - -EXE = $(if $(windir),TestLexers.exe,TestLexers) - -BASE_FLAGS += --std=c++2a - -ifdef CLANG - CXX = clang++ - BASE_FLAGS += -fsanitize=address -endif - -ifdef LEXILLA_STATIC - DEFINES += -D LEXILLA_STATIC - LIBS += ../../bin/liblexilla.a -endif - -ifdef windir - DEL = $(if $(wildcard $(dir $(SHELL))rm.exe), $(dir $(SHELL))rm.exe -f, del /q) -else - DEL = rm -f -endif - -DEFINES += -D$(if $(DEBUG),DEBUG,NDEBUG) -BASE_FLAGS += $(if $(DEBUG),-g,-Os) - -INCLUDES = -I ../../include -I ../src -BASE_FLAGS += $(WARNINGS) - -all: $(EXE) - -test: $(EXE) - ./$(EXE) - -clean: - $(DEL) *.o *.obj $(EXE) - -%.o: %.cxx - $(CXX) $(DEFINES) $(INCLUDES) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@ - -OBJS = TestLexers.o TestDocument.o LexillaAccess.o - -$(EXE): $(OBJS) - $(CXX) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) $^ $(LIBS) $(LDLIBS) -o $@ - -TestLexers.o: TestLexers.cxx TestDocument.h LexillaAccess.h -TestDocument.o: TestDocument.cxx TestDocument.h -LexillaAccess.o: LexillaAccess.cxx LexillaAccess.h diff --git a/lexilla/test/testlexers.mak b/lexilla/test/testlexers.mak deleted file mode 100644 index dd89318c3..000000000 --- a/lexilla/test/testlexers.mak +++ /dev/null @@ -1,40 +0,0 @@ -# Build the lexers test with Microsoft Visual C++ using nmake -# Tested with Visual C++ 2019 - -DEL = del /q -EXE = TestLexers.exe - -INCLUDEDIRS = -I ../../include -I ../src - -!IFDEF LEXILLA_STATIC -STATIC_FLAG = -D LEXILLA_STATIC -LIBS = ../../bin/liblexilla.lib -!ENDIF - -!IFDEF DEBUG -DEBUG_OPTIONS = -Od -MTd -DDEBUG $(STATIC_FLAG) -!ELSE -DEBUG_OPTIONS=-O1 -MT -DNDEBUG $(STATIC_FLAG) -GL -!ENDIF - -CXXFLAGS = /EHsc /std:c++latest $(DEBUG_OPTIONS) $(INCLUDEDIRS) - -OBJS = TestLexers.obj TestDocument.obj LexillaAccess.obj - -all: $(EXE) - -test: $(EXE) - $(EXE) - -clean: - $(DEL) *.o *.obj *.exe - -$(EXE): $(OBJS) $(LIBS) - $(CXX) $(CXXFLAGS) $(LIBS) /Fe$@ $** - -.cxx.obj:: - $(CXX) $(CXXFLAGS) -c $< - -TestLexers.obj: $*.cxx TestDocument.h LexillaAccess.h -TestDocument.obj: $*.cxx $*.h -LexillaAccess.obj: $*.cxx $*.h diff --git a/lexilla/version.txt b/lexilla/version.txt deleted file mode 100644 index 018783526..000000000 --- a/lexilla/version.txt +++ /dev/null @@ -1 +0,0 @@ -446 diff --git a/lexlib/Accessor.cxx b/lexlib/Accessor.cxx deleted file mode 100644 index 7cce9a554..000000000 --- a/lexlib/Accessor.cxx +++ /dev/null @@ -1,73 +0,0 @@ -// Scintilla source code edit control -/** @file Accessor.cxx - ** Interfaces between Scintilla and lexers. - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" - -using namespace Scintilla; - -Accessor::Accessor(IDocument *pAccess_, PropSetSimple *pprops_) : LexAccessor(pAccess_), pprops(pprops_) { -} - -int Accessor::GetPropertyInt(const char *key, int defaultValue) const { - return pprops->GetInt(key, defaultValue); -} - -int Accessor::IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) { - const Sci_Position end = Length(); - int spaceFlags = 0; - - // Determines the indentation level of the current line and also checks for consistent - // indentation compared to the previous line. - // Indentation is judged consistent when the indentation whitespace of each line lines - // the same or the indentation of one line is a prefix of the other. - - Sci_Position pos = LineStart(line); - char ch = (*this)[pos]; - int indent = 0; - bool inPrevPrefix = line > 0; - Sci_Position posPrev = inPrevPrefix ? LineStart(line-1) : 0; - while ((ch == ' ' || ch == '\t') && (pos < end)) { - if (inPrevPrefix) { - const char chPrev = (*this)[posPrev++]; - if (chPrev == ' ' || chPrev == '\t') { - if (chPrev != ch) - spaceFlags |= wsInconsistent; - } else { - inPrevPrefix = false; - } - } - if (ch == ' ') { - spaceFlags |= wsSpace; - indent++; - } else { // Tab - spaceFlags |= wsTab; - if (spaceFlags & wsSpace) - spaceFlags |= wsSpaceTab; - indent = (indent / 8 + 1) * 8; - } - ch = (*this)[++pos]; - } - - *flags = spaceFlags; - indent += SC_FOLDLEVELBASE; - // if completely empty line or the start of a comment... - if ((LineStart(line) == Length()) || (ch == ' ' || ch == '\t' || ch == '\n' || ch == '\r') || - (pfnIsCommentLeader && (*pfnIsCommentLeader)(*this, pos, end-pos))) - return indent | SC_FOLDLEVELWHITEFLAG; - else - return indent; -} diff --git a/lexlib/Accessor.h b/lexlib/Accessor.h deleted file mode 100644 index 8fc3f641a..000000000 --- a/lexlib/Accessor.h +++ /dev/null @@ -1,31 +0,0 @@ -// Scintilla source code edit control -/** @file Accessor.h - ** Interfaces between Scintilla and lexers. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef ACCESSOR_H -#define ACCESSOR_H - -namespace Scintilla { - -enum { wsSpace=1, wsTab=2, wsSpaceTab=4, wsInconsistent=8 }; - -class Accessor; -class WordList; -class PropSetSimple; - -typedef bool (*PFNIsCommentLeader)(Accessor &styler, Sci_Position pos, Sci_Position len); - -class Accessor : public LexAccessor { -public: - PropSetSimple *pprops; - Accessor(IDocument *pAccess_, PropSetSimple *pprops_); - int GetPropertyInt(const char *, int defaultValue=0) const; - int IndentAmount(Sci_Position line, int *flags, PFNIsCommentLeader pfnIsCommentLeader = 0); -}; - -} - -#endif diff --git a/lexlib/CatalogueModules.h b/lexlib/CatalogueModules.h deleted file mode 100644 index 267a7b82b..000000000 --- a/lexlib/CatalogueModules.h +++ /dev/null @@ -1,70 +0,0 @@ -// Scintilla source code edit control -/** @file CatalogueModules.h - ** Lexer infrastructure. - ** Contains a list of LexerModules which can be searched to find a module appropriate for a - ** particular language. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CATALOGUEMODULES_H -#define CATALOGUEMODULES_H - -namespace Scintilla { - -class CatalogueModules { - std::vector<LexerModule *> lexerCatalogue; -public: - const LexerModule *Find(int language) const { - for (const LexerModule *lm : lexerCatalogue) { - if (lm->GetLanguage() == language) { - return lm; - } - } - return nullptr; - } - - const LexerModule *Find(const char *languageName) const noexcept { - if (languageName) { - for (const LexerModule *lm : lexerCatalogue) { - if (lm->languageName && (0 == strcmp(lm->languageName, languageName))) { - return lm; - } - } - } - return nullptr; - } - - void AddLexerModule(LexerModule *plm) { - lexerCatalogue.push_back(plm); - } - - unsigned int Count() const noexcept { - return static_cast<unsigned int>(lexerCatalogue.size()); - } - - const char *Name(unsigned int index) const noexcept { - if (index < static_cast<unsigned int>(lexerCatalogue.size())) { - return lexerCatalogue[index]->languageName; - } else { - return ""; - } - } - - LexerFactoryFunction Factory(unsigned int index) const noexcept { - // Works for object lexers but not for function lexers - return lexerCatalogue[index]->fnFactory; - } - - ILexer5 *Create(unsigned int index) const { - const LexerModule *plm = lexerCatalogue[index]; - if (!plm) { - return nullptr; - } - return plm->Create(); - } -}; - -} - -#endif diff --git a/lexlib/DefaultLexer.cxx b/lexlib/DefaultLexer.cxx deleted file mode 100644 index 89671aa30..000000000 --- a/lexlib/DefaultLexer.cxx +++ /dev/null @@ -1,139 +0,0 @@ -// Scintilla source code edit control -/** @file DefaultLexer.cxx - ** A lexer base class that provides reasonable default behaviour. - **/ -// Copyright 2017 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> -#include <cstring> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "LexerModule.h" -#include "DefaultLexer.h" - -using namespace Scintilla; - -static const char styleSubable[] = { 0 }; - -DefaultLexer::DefaultLexer(const char *languageName_, int language_, - const LexicalClass *lexClasses_, size_t nClasses_) : - languageName(languageName_), - language(language_), - lexClasses(lexClasses_), - nClasses(nClasses_) { -} - -DefaultLexer::~DefaultLexer() { -} - -void SCI_METHOD DefaultLexer::Release() { - delete this; -} - -int SCI_METHOD DefaultLexer::Version() const { - return lvRelease5; -} - -const char * SCI_METHOD DefaultLexer::PropertyNames() { - return ""; -} - -int SCI_METHOD DefaultLexer::PropertyType(const char *) { - return SC_TYPE_BOOLEAN; -} - -const char * SCI_METHOD DefaultLexer::DescribeProperty(const char *) { - return ""; -} - -Sci_Position SCI_METHOD DefaultLexer::PropertySet(const char *, const char *) { - return -1; -} - -const char * SCI_METHOD DefaultLexer::DescribeWordListSets() { - return ""; -} - -Sci_Position SCI_METHOD DefaultLexer::WordListSet(int, const char *) { - return -1; -} - -void SCI_METHOD DefaultLexer::Fold(Sci_PositionU, Sci_Position, int, IDocument *) { -} - -void * SCI_METHOD DefaultLexer::PrivateCall(int, void *) { - return nullptr; -} - -int SCI_METHOD DefaultLexer::LineEndTypesSupported() { - return SC_LINE_END_TYPE_DEFAULT; -} - -int SCI_METHOD DefaultLexer::AllocateSubStyles(int, int) { - return -1; -} - -int SCI_METHOD DefaultLexer::SubStylesStart(int) { - return -1; -} - -int SCI_METHOD DefaultLexer::SubStylesLength(int) { - return 0; -} - -int SCI_METHOD DefaultLexer::StyleFromSubStyle(int subStyle) { - return subStyle; -} - -int SCI_METHOD DefaultLexer::PrimaryStyleFromStyle(int style) { - return style; -} - -void SCI_METHOD DefaultLexer::FreeSubStyles() { -} - -void SCI_METHOD DefaultLexer::SetIdentifiers(int, const char *) { -} - -int SCI_METHOD DefaultLexer::DistanceToSecondaryStyles() { - return 0; -} - -const char * SCI_METHOD DefaultLexer::GetSubStyleBases() { - return styleSubable; -} - -int SCI_METHOD DefaultLexer::NamedStyles() { - return static_cast<int>(nClasses); -} - -const char * SCI_METHOD DefaultLexer::NameOfStyle(int style) { - return (style < NamedStyles()) ? lexClasses[style].name : ""; -} - -const char * SCI_METHOD DefaultLexer::TagsOfStyle(int style) { - return (style < NamedStyles()) ? lexClasses[style].tags : ""; -} - -const char * SCI_METHOD DefaultLexer::DescriptionOfStyle(int style) { - return (style < NamedStyles()) ? lexClasses[style].description : ""; -} - -// ILexer5 methods -const char * SCI_METHOD DefaultLexer::GetName() { - return languageName; -} - -int SCI_METHOD DefaultLexer::GetIdentifier() { - return language; -} - diff --git a/lexlib/DefaultLexer.h b/lexlib/DefaultLexer.h deleted file mode 100644 index 9139c4595..000000000 --- a/lexlib/DefaultLexer.h +++ /dev/null @@ -1,57 +0,0 @@ -// Scintilla source code edit control -/** @file DefaultLexer.h - ** A lexer base class with default empty implementations of methods. - ** For lexers that do not support all features so do not need real implementations. - ** Does have real implementation for style metadata. - **/ -// Copyright 2017 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef DEFAULTLEXER_H -#define DEFAULTLEXER_H - -namespace Scintilla { - -// A simple lexer with no state -class DefaultLexer : public ILexer5 { - const char *languageName; - int language; - const LexicalClass *lexClasses; - size_t nClasses; -public: - DefaultLexer(const char *languageName_, int language_, - const LexicalClass *lexClasses_ = nullptr, size_t nClasses_ = 0); - virtual ~DefaultLexer(); - void SCI_METHOD Release() override; - int SCI_METHOD Version() const override; - const char * SCI_METHOD PropertyNames() override; - int SCI_METHOD PropertyType(const char *name) override; - const char * SCI_METHOD DescribeProperty(const char *name) override; - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; - const char * SCI_METHOD DescribeWordListSets() override; - Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override = 0; - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override; - void * SCI_METHOD PrivateCall(int operation, void *pointer) override; - int SCI_METHOD LineEndTypesSupported() override; - int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override; - int SCI_METHOD SubStylesStart(int styleBase) override; - int SCI_METHOD SubStylesLength(int styleBase) override; - int SCI_METHOD StyleFromSubStyle(int subStyle) override; - int SCI_METHOD PrimaryStyleFromStyle(int style) override; - void SCI_METHOD FreeSubStyles() override; - void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override; - int SCI_METHOD DistanceToSecondaryStyles() override; - const char * SCI_METHOD GetSubStyleBases() override; - int SCI_METHOD NamedStyles() override; - const char * SCI_METHOD NameOfStyle(int style) override; - const char * SCI_METHOD TagsOfStyle(int style) override; - const char * SCI_METHOD DescriptionOfStyle(int style) override; - // ILexer5 methods - const char * SCI_METHOD GetName() override; - int SCI_METHOD GetIdentifier() override; -}; - -} - -#endif diff --git a/lexlib/LexAccessor.h b/lexlib/LexAccessor.h deleted file mode 100644 index 658eb6e6d..000000000 --- a/lexlib/LexAccessor.h +++ /dev/null @@ -1,195 +0,0 @@ -// Scintilla source code edit control -/** @file LexAccessor.h - ** Interfaces between Scintilla and lexers. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXACCESSOR_H -#define LEXACCESSOR_H - -namespace Scintilla { - -enum class EncodingType { eightBit, unicode, dbcs }; - -class LexAccessor { -private: - IDocument *pAccess; - enum {extremePosition=0x7FFFFFFF}; - /** @a bufferSize is a trade off between time taken to copy the characters - * and retrieval overhead. - * @a slopSize positions the buffer before the desired position - * in case there is some backtracking. */ - enum {bufferSize=4000, slopSize=bufferSize/8}; - char buf[bufferSize+1]; - Sci_Position startPos; - Sci_Position endPos; - int codePage; - enum EncodingType encodingType; - Sci_Position lenDoc; - char styleBuf[bufferSize]; - Sci_Position validLen; - Sci_PositionU startSeg; - Sci_Position startPosStyling; - int documentVersion; - - void Fill(Sci_Position position) { - startPos = position - slopSize; - if (startPos + bufferSize > lenDoc) - startPos = lenDoc - bufferSize; - if (startPos < 0) - startPos = 0; - endPos = startPos + bufferSize; - if (endPos > lenDoc) - endPos = lenDoc; - - pAccess->GetCharRange(buf, startPos, endPos-startPos); - buf[endPos-startPos] = '\0'; - } - -public: - explicit LexAccessor(IDocument *pAccess_) : - pAccess(pAccess_), startPos(extremePosition), endPos(0), - codePage(pAccess->CodePage()), - encodingType(EncodingType::eightBit), - lenDoc(pAccess->Length()), - validLen(0), - startSeg(0), startPosStyling(0), - documentVersion(pAccess->Version()) { - // Prevent warnings by static analyzers about uninitialized buf and styleBuf. - buf[0] = 0; - styleBuf[0] = 0; - switch (codePage) { - case 65001: - encodingType = EncodingType::unicode; - break; - case 932: - case 936: - case 949: - case 950: - case 1361: - encodingType = EncodingType::dbcs; - } - } - char operator[](Sci_Position position) { - if (position < startPos || position >= endPos) { - Fill(position); - } - return buf[position - startPos]; - } - IDocument *MultiByteAccess() const noexcept { - return pAccess; - } - /** Safe version of operator[], returning a defined value for invalid position. */ - char SafeGetCharAt(Sci_Position position, char chDefault=' ') { - if (position < startPos || position >= endPos) { - Fill(position); - if (position < startPos || position >= endPos) { - // Position is outside range of document - return chDefault; - } - } - return buf[position - startPos]; - } - bool IsLeadByte(char ch) const { - return pAccess->IsDBCSLeadByte(ch); - } - EncodingType Encoding() const noexcept { - return encodingType; - } - bool Match(Sci_Position pos, const char *s) { - for (int i=0; *s; i++) { - if (*s != SafeGetCharAt(pos+i)) - return false; - s++; - } - return true; - } - char StyleAt(Sci_Position position) const { - return pAccess->StyleAt(position); - } - Sci_Position GetLine(Sci_Position position) const { - return pAccess->LineFromPosition(position); - } - Sci_Position LineStart(Sci_Position line) const { - return pAccess->LineStart(line); - } - Sci_Position LineEnd(Sci_Position line) const { - return pAccess->LineEnd(line); - } - int LevelAt(Sci_Position line) const { - return pAccess->GetLevel(line); - } - Sci_Position Length() const { - return lenDoc; - } - void Flush() { - if (validLen > 0) { - pAccess->SetStyles(validLen, styleBuf); - startPosStyling += validLen; - validLen = 0; - } - } - int GetLineState(Sci_Position line) const { - return pAccess->GetLineState(line); - } - int SetLineState(Sci_Position line, int state) { - return pAccess->SetLineState(line, state); - } - // Style setting - void StartAt(Sci_PositionU start) { - pAccess->StartStyling(start); - startPosStyling = start; - } - Sci_PositionU GetStartSegment() const { - return startSeg; - } - void StartSegment(Sci_PositionU pos) { - startSeg = pos; - } - void ColourTo(Sci_PositionU pos, int chAttr) { - // Only perform styling if non empty range - if (pos != startSeg - 1) { - assert(pos >= startSeg); - if (pos < startSeg) { - return; - } - - if (validLen + (pos - startSeg + 1) >= bufferSize) - Flush(); - const char attr = static_cast<char>(chAttr); - if (validLen + (pos - startSeg + 1) >= bufferSize) { - // Too big for buffer so send directly - pAccess->SetStyleFor(pos - startSeg + 1, attr); - } else { - for (Sci_PositionU i = startSeg; i <= pos; i++) { - assert((startPosStyling + validLen) < Length()); - styleBuf[validLen++] = attr; - } - } - } - startSeg = pos+1; - } - void SetLevel(Sci_Position line, int level) { - pAccess->SetLevel(line, level); - } - void IndicatorFill(Sci_Position start, Sci_Position end, int indicator, int value) { - pAccess->DecorationSetCurrentIndicator(indicator); - pAccess->DecorationFillRange(start, value, end - start); - } - - void ChangeLexerState(Sci_Position start, Sci_Position end) { - pAccess->ChangeLexerState(start, end); - } -}; - -struct LexicalClass { - int value; - const char *name; - const char *tags; - const char *description; -}; - -} - -#endif diff --git a/lexlib/LexerBase.cxx b/lexlib/LexerBase.cxx deleted file mode 100644 index bf195d824..000000000 --- a/lexlib/LexerBase.cxx +++ /dev/null @@ -1,155 +0,0 @@ -// Scintilla source code edit control -/** @file LexerBase.cxx - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> -#include <cstring> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "LexerModule.h" -#include "LexerBase.h" - -using namespace Scintilla; - -static const char styleSubable[] = { 0 }; - -LexerBase::LexerBase(const LexicalClass *lexClasses_, size_t nClasses_) : - lexClasses(lexClasses_), nClasses(nClasses_) { - for (int wl = 0; wl < numWordLists; wl++) - keyWordLists[wl] = new WordList; - keyWordLists[numWordLists] = 0; -} - -LexerBase::~LexerBase() { - for (int wl = 0; wl < numWordLists; wl++) { - delete keyWordLists[wl]; - keyWordLists[wl] = 0; - } - keyWordLists[numWordLists] = 0; -} - -void SCI_METHOD LexerBase::Release() { - delete this; -} - -int SCI_METHOD LexerBase::Version() const { - return lvRelease5; -} - -const char * SCI_METHOD LexerBase::PropertyNames() { - return ""; -} - -int SCI_METHOD LexerBase::PropertyType(const char *) { - return SC_TYPE_BOOLEAN; -} - -const char * SCI_METHOD LexerBase::DescribeProperty(const char *) { - return ""; -} - -Sci_Position SCI_METHOD LexerBase::PropertySet(const char *key, const char *val) { - const char *valOld = props.Get(key); - if (strcmp(val, valOld) != 0) { - props.Set(key, val, strlen(key), strlen(val)); - return 0; - } else { - return -1; - } -} - -const char *SCI_METHOD LexerBase::PropertyGet(const char *key) { - return props.Get(key); -} - -const char * SCI_METHOD LexerBase::DescribeWordListSets() { - return ""; -} - -Sci_Position SCI_METHOD LexerBase::WordListSet(int n, const char *wl) { - if (n < numWordLists) { - if (keyWordLists[n]->Set(wl)) { - return 0; - } - } - return -1; -} - -void * SCI_METHOD LexerBase::PrivateCall(int, void *) { - return nullptr; -} - -int SCI_METHOD LexerBase::LineEndTypesSupported() { - return SC_LINE_END_TYPE_DEFAULT; -} - -int SCI_METHOD LexerBase::AllocateSubStyles(int, int) { - return -1; -} - -int SCI_METHOD LexerBase::SubStylesStart(int) { - return -1; -} - -int SCI_METHOD LexerBase::SubStylesLength(int) { - return 0; -} - -int SCI_METHOD LexerBase::StyleFromSubStyle(int subStyle) { - return subStyle; -} - -int SCI_METHOD LexerBase::PrimaryStyleFromStyle(int style) { - return style; -} - -void SCI_METHOD LexerBase::FreeSubStyles() { -} - -void SCI_METHOD LexerBase::SetIdentifiers(int, const char *) { -} - -int SCI_METHOD LexerBase::DistanceToSecondaryStyles() { - return 0; -} - -const char * SCI_METHOD LexerBase::GetSubStyleBases() { - return styleSubable; -} - -int SCI_METHOD LexerBase::NamedStyles() { - return static_cast<int>(nClasses); -} - -const char * SCI_METHOD LexerBase::NameOfStyle(int style) { - return (style < NamedStyles()) ? lexClasses[style].name : ""; -} - -const char * SCI_METHOD LexerBase::TagsOfStyle(int style) { - return (style < NamedStyles()) ? lexClasses[style].tags : ""; -} - -const char * SCI_METHOD LexerBase::DescriptionOfStyle(int style) { - return (style < NamedStyles()) ? lexClasses[style].description : ""; -} - -// ILexer5 methods - -const char *SCI_METHOD LexerBase::GetName() { - return ""; -} - -int SCI_METHOD LexerBase::GetIdentifier() { - return SCLEX_AUTOMATIC; -} diff --git a/lexlib/LexerBase.h b/lexlib/LexerBase.h deleted file mode 100644 index 22d17fea1..000000000 --- a/lexlib/LexerBase.h +++ /dev/null @@ -1,57 +0,0 @@ -// Scintilla source code edit control -/** @file LexerBase.h - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXERBASE_H -#define LEXERBASE_H - -namespace Scintilla { - -// A simple lexer with no state -class LexerBase : public ILexer5 { -protected: - const LexicalClass *lexClasses; - size_t nClasses; - PropSetSimple props; - enum {numWordLists=KEYWORDSET_MAX+1}; - WordList *keyWordLists[numWordLists+1]; -public: - LexerBase(const LexicalClass *lexClasses_=nullptr, size_t nClasses_=0); - virtual ~LexerBase(); - void SCI_METHOD Release() override; - int SCI_METHOD Version() const override; - const char * SCI_METHOD PropertyNames() override; - int SCI_METHOD PropertyType(const char *name) override; - const char * SCI_METHOD DescribeProperty(const char *name) override; - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; - const char * SCI_METHOD DescribeWordListSets() override; - Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override = 0; - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override = 0; - void * SCI_METHOD PrivateCall(int operation, void *pointer) override; - int SCI_METHOD LineEndTypesSupported() override; - int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override; - int SCI_METHOD SubStylesStart(int styleBase) override; - int SCI_METHOD SubStylesLength(int styleBase) override; - int SCI_METHOD StyleFromSubStyle(int subStyle) override; - int SCI_METHOD PrimaryStyleFromStyle(int style) override; - void SCI_METHOD FreeSubStyles() override; - void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override; - int SCI_METHOD DistanceToSecondaryStyles() override; - const char * SCI_METHOD GetSubStyleBases() override; - int SCI_METHOD NamedStyles() override; - const char * SCI_METHOD NameOfStyle(int style) override; - const char * SCI_METHOD TagsOfStyle(int style) override; - const char * SCI_METHOD DescriptionOfStyle(int style) override; - // ILexer5 methods - const char * SCI_METHOD GetName() override; - int SCI_METHOD GetIdentifier() override; - const char *SCI_METHOD PropertyGet(const char *key) override; -}; - -} - -#endif diff --git a/lexlib/LexerModule.cxx b/lexlib/LexerModule.cxx deleted file mode 100644 index 0f1498bf2..000000000 --- a/lexlib/LexerModule.cxx +++ /dev/null @@ -1,123 +0,0 @@ -// Scintilla source code edit control -/** @file LexerModule.cxx - ** Colourise for particular languages. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> - -#include <string> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "LexerModule.h" -#include "LexerBase.h" -#include "LexerSimple.h" - -using namespace Scintilla; - -LexerModule::LexerModule(int language_, - LexerFunction fnLexer_, - const char *languageName_, - LexerFunction fnFolder_, - const char *const wordListDescriptions_[], - const LexicalClass *lexClasses_, - size_t nClasses_) noexcept : - language(language_), - fnLexer(fnLexer_), - fnFolder(fnFolder_), - fnFactory(nullptr), - wordListDescriptions(wordListDescriptions_), - lexClasses(lexClasses_), - nClasses(nClasses_), - languageName(languageName_) { -} - -LexerModule::LexerModule(int language_, - LexerFactoryFunction fnFactory_, - const char *languageName_, - const char * const wordListDescriptions_[]) noexcept : - language(language_), - fnLexer(nullptr), - fnFolder(nullptr), - fnFactory(fnFactory_), - wordListDescriptions(wordListDescriptions_), - lexClasses(nullptr), - nClasses(0), - languageName(languageName_) { -} - -int LexerModule::GetLanguage() const noexcept { - return language; -} - -int LexerModule::GetNumWordLists() const noexcept { - if (!wordListDescriptions) { - return -1; - } else { - int numWordLists = 0; - - while (wordListDescriptions[numWordLists]) { - ++numWordLists; - } - - return numWordLists; - } -} - -const char *LexerModule::GetWordListDescription(int index) const noexcept { - assert(index < GetNumWordLists()); - if (!wordListDescriptions || (index >= GetNumWordLists())) { - return ""; - } else { - return wordListDescriptions[index]; - } -} - -const LexicalClass *LexerModule::LexClasses() const noexcept { - return lexClasses; -} - -size_t LexerModule::NamedStyles() const noexcept { - return nClasses; -} - -ILexer5 *LexerModule::Create() const { - if (fnFactory) - return fnFactory(); - else - return new LexerSimple(this); -} - -void LexerModule::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const { - if (fnLexer) - fnLexer(startPos, lengthDoc, initStyle, keywordlists, styler); -} - -void LexerModule::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const { - if (fnFolder) { - Sci_Position lineCurrent = styler.GetLine(startPos); - // Move back one line in case deletion wrecked current line fold state - if (lineCurrent > 0) { - lineCurrent--; - const Sci_Position newStartPos = styler.LineStart(lineCurrent); - lengthDoc += startPos - newStartPos; - startPos = newStartPos; - initStyle = 0; - if (startPos > 0) { - initStyle = styler.StyleAt(startPos - 1); - } - } - fnFolder(startPos, lengthDoc, initStyle, keywordlists, styler); - } -} diff --git a/lexlib/LexerModule.h b/lexlib/LexerModule.h deleted file mode 100644 index 83bdf237d..000000000 --- a/lexlib/LexerModule.h +++ /dev/null @@ -1,92 +0,0 @@ -// Scintilla source code edit control -/** @file LexerModule.h - ** Colourise for particular languages. - **/ -// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXERMODULE_H -#define LEXERMODULE_H - -namespace Scintilla { - -class Accessor; -class WordList; -struct LexicalClass; - -typedef void (*LexerFunction)(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler); -typedef ILexer5 *(*LexerFactoryFunction)(); - -/** - * A LexerModule is responsible for lexing and folding a particular language. - * The Catalogue class maintains a list of LexerModules which can be searched to find a - * module appropriate to a particular language. - * The ExternalLexerModule subclass holds lexers loaded from DLLs or shared libraries. - */ -class LexerModule { -protected: - int language; - LexerFunction fnLexer; - LexerFunction fnFolder; - LexerFactoryFunction fnFactory; - const char * const * wordListDescriptions; - const LexicalClass *lexClasses; - size_t nClasses; - -public: - const char *languageName; - LexerModule( - int language_, - LexerFunction fnLexer_, - const char *languageName_=nullptr, - LexerFunction fnFolder_= nullptr, - const char * const wordListDescriptions_[]=nullptr, - const LexicalClass *lexClasses_=nullptr, - size_t nClasses_=0) noexcept; - LexerModule( - int language_, - LexerFactoryFunction fnFactory_, - const char *languageName_, - const char * const wordListDescriptions_[]=nullptr) noexcept; - int GetLanguage() const noexcept; - - // -1 is returned if no WordList information is available - int GetNumWordLists() const noexcept; - const char *GetWordListDescription(int index) const noexcept; - const LexicalClass *LexClasses() const noexcept; - size_t NamedStyles() const noexcept; - - ILexer5 *Create() const; - - void Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - void Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, - WordList *keywordlists[], Accessor &styler) const; - - friend class CatalogueModules; -}; - -inline int Maximum(int a, int b) noexcept { - return (a > b) ? a : b; -} - -// Shut up annoying Visual C++ warnings: -#ifdef _MSC_VER -#pragma warning(disable: 4244 4456 4457) -#endif - -// Turn off shadow warnings for lexers as may be maintained by others -#if defined(__GNUC__) -#pragma GCC diagnostic ignored "-Wshadow" -#endif - -// Clang doesn't like omitting braces in array initialization but they just add -// noise to LexicalClass arrays in lexers -#if defined(__clang__) -#pragma clang diagnostic ignored "-Wmissing-braces" -#endif - -} - -#endif diff --git a/lexlib/LexerNoExceptions.cxx b/lexlib/LexerNoExceptions.cxx deleted file mode 100644 index 3627e188a..000000000 --- a/lexlib/LexerNoExceptions.cxx +++ /dev/null @@ -1,62 +0,0 @@ -// Scintilla source code edit control -/** @file LexerNoExceptions.cxx - ** A simple lexer with no state which does not throw exceptions so can be used in an external lexer. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "LexerModule.h" -#include "LexerBase.h" -#include "LexerNoExceptions.h" - -using namespace Scintilla; - -Sci_Position SCI_METHOD LexerNoExceptions::PropertySet(const char *key, const char *val) { - try { - return LexerBase::PropertySet(key, val); - } catch (...) { - // Should not throw into caller as may be compiled with different compiler or options - } - return -1; -} - -Sci_Position SCI_METHOD LexerNoExceptions::WordListSet(int n, const char *wl) { - try { - return LexerBase::WordListSet(n, wl); - } catch (...) { - // Should not throw into caller as may be compiled with different compiler or options - } - return -1; -} - -void SCI_METHOD LexerNoExceptions::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { - try { - Accessor astyler(pAccess, &props); - Lexer(startPos, lengthDoc, initStyle, pAccess, astyler); - astyler.Flush(); - } catch (...) { - // Should not throw into caller as may be compiled with different compiler or options - pAccess->SetErrorStatus(SC_STATUS_FAILURE); - } -} -void SCI_METHOD LexerNoExceptions::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { - try { - Accessor astyler(pAccess, &props); - Folder(startPos, lengthDoc, initStyle, pAccess, astyler); - astyler.Flush(); - } catch (...) { - // Should not throw into caller as may be compiled with different compiler or options - pAccess->SetErrorStatus(SC_STATUS_FAILURE); - } -} diff --git a/lexlib/LexerNoExceptions.h b/lexlib/LexerNoExceptions.h deleted file mode 100644 index 5bcb090f0..000000000 --- a/lexlib/LexerNoExceptions.h +++ /dev/null @@ -1,28 +0,0 @@ -// Scintilla source code edit control -/** @file LexerNoExceptions.h - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXERNOEXCEPTIONS_H -#define LEXERNOEXCEPTIONS_H - -namespace Scintilla { - -// A simple lexer with no state -class LexerNoExceptions : public LexerBase { -public: - // TODO Also need to prevent exceptions in constructor and destructor - Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override; - Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override; - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override; - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *) override; - - virtual void Lexer(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; - virtual void Folder(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess, Accessor &styler) = 0; -}; - -} - -#endif diff --git a/lexlib/LexerSimple.cxx b/lexlib/LexerSimple.cxx deleted file mode 100644 index e69c44ad6..000000000 --- a/lexlib/LexerSimple.cxx +++ /dev/null @@ -1,61 +0,0 @@ -// Scintilla source code edit control -/** @file LexerSimple.cxx - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> - -#include <string> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "PropSetSimple.h" -#include "WordList.h" -#include "LexAccessor.h" -#include "Accessor.h" -#include "LexerModule.h" -#include "LexerBase.h" -#include "LexerSimple.h" - -using namespace Scintilla; - -LexerSimple::LexerSimple(const LexerModule *module_) : - LexerBase(module_->LexClasses(), module_->NamedStyles()), - module(module_) { - for (int wl = 0; wl < module->GetNumWordLists(); wl++) { - if (!wordLists.empty()) - wordLists += "\n"; - wordLists += module->GetWordListDescription(wl); - } -} - -const char * SCI_METHOD LexerSimple::DescribeWordListSets() { - return wordLists.c_str(); -} - -void SCI_METHOD LexerSimple::Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { - Accessor astyler(pAccess, &props); - module->Lex(startPos, lengthDoc, initStyle, keyWordLists, astyler); - astyler.Flush(); -} - -void SCI_METHOD LexerSimple::Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) { - if (props.GetInt("fold")) { - Accessor astyler(pAccess, &props); - module->Fold(startPos, lengthDoc, initStyle, keyWordLists, astyler); - astyler.Flush(); - } -} - -const char * SCI_METHOD LexerSimple::GetName() { - return module->languageName; -} - -int SCI_METHOD LexerSimple::GetIdentifier() { - return module->GetLanguage(); -} diff --git a/lexlib/LexerSimple.h b/lexlib/LexerSimple.h deleted file mode 100644 index ae4177769..000000000 --- a/lexlib/LexerSimple.h +++ /dev/null @@ -1,29 +0,0 @@ -// Scintilla source code edit control -/** @file LexerSimple.h - ** A simple lexer with no state. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef LEXERSIMPLE_H -#define LEXERSIMPLE_H - -namespace Scintilla { - -// A simple lexer with no state -class LexerSimple : public LexerBase { - const LexerModule *module; - std::string wordLists; -public: - explicit LexerSimple(const LexerModule *module_); - const char * SCI_METHOD DescribeWordListSets() override; - void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override; - void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) override; - // ILexer5 methods - const char * SCI_METHOD GetName() override; - int SCI_METHOD GetIdentifier() override; -}; - -} - -#endif diff --git a/lexlib/OptionSet.h b/lexlib/OptionSet.h deleted file mode 100644 index 3c282e49b..000000000 --- a/lexlib/OptionSet.h +++ /dev/null @@ -1,149 +0,0 @@ -// Scintilla source code edit control -/** @file OptionSet.h - ** Manage descriptive information about an options struct for a lexer. - ** Hold the names, positions, and descriptions of boolean, integer and string options and - ** allow setting options and retrieving metadata about the options. - **/ -// Copyright 2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef OPTIONSET_H -#define OPTIONSET_H - -namespace Scintilla { - -template <typename T> -class OptionSet { - typedef T Target; - typedef bool T::*plcob; - typedef int T::*plcoi; - typedef std::string T::*plcos; - struct Option { - int opType; - union { - plcob pb; - plcoi pi; - plcos ps; - }; - std::string value; - std::string description; - Option() : - opType(SC_TYPE_BOOLEAN), pb(0), description("") { - } - Option(plcob pb_, std::string description_="") : - opType(SC_TYPE_BOOLEAN), pb(pb_), description(description_) { - } - Option(plcoi pi_, std::string description_) : - opType(SC_TYPE_INTEGER), pi(pi_), description(description_) { - } - Option(plcos ps_, std::string description_) : - opType(SC_TYPE_STRING), ps(ps_), description(description_) { - } - bool Set(T *base, const char *val) { - value = val; - switch (opType) { - case SC_TYPE_BOOLEAN: { - bool option = atoi(val) != 0; - if ((*base).*pb != option) { - (*base).*pb = option; - return true; - } - break; - } - case SC_TYPE_INTEGER: { - int option = atoi(val); - if ((*base).*pi != option) { - (*base).*pi = option; - return true; - } - break; - } - case SC_TYPE_STRING: { - if ((*base).*ps != val) { - (*base).*ps = val; - return true; - } - break; - } - } - return false; - } - const char *Get() const noexcept { - return value.c_str(); - } - }; - typedef std::map<std::string, Option> OptionMap; - OptionMap nameToDef; - std::string names; - std::string wordLists; - - void AppendName(const char *name) { - if (!names.empty()) - names += "\n"; - names += name; - } -public: - void DefineProperty(const char *name, plcob pb, std::string description="") { - nameToDef[name] = Option(pb, description); - AppendName(name); - } - void DefineProperty(const char *name, plcoi pi, std::string description="") { - nameToDef[name] = Option(pi, description); - AppendName(name); - } - void DefineProperty(const char *name, plcos ps, std::string description="") { - nameToDef[name] = Option(ps, description); - AppendName(name); - } - const char *PropertyNames() const noexcept { - return names.c_str(); - } - int PropertyType(const char *name) { - typename OptionMap::iterator it = nameToDef.find(name); - if (it != nameToDef.end()) { - return it->second.opType; - } - return SC_TYPE_BOOLEAN; - } - const char *DescribeProperty(const char *name) { - typename OptionMap::iterator it = nameToDef.find(name); - if (it != nameToDef.end()) { - return it->second.description.c_str(); - } - return ""; - } - - bool PropertySet(T *base, const char *name, const char *val) { - typename OptionMap::iterator it = nameToDef.find(name); - if (it != nameToDef.end()) { - return it->second.Set(base, val); - } - return false; - } - - const char *PropertyGet(const char *name) { - typename OptionMap::iterator it = nameToDef.find(name); - if (it != nameToDef.end()) { - return it->second.Get(); - } - return nullptr; - } - - void DefineWordListSets(const char * const wordListDescriptions[]) { - if (wordListDescriptions) { - for (size_t wl = 0; wordListDescriptions[wl]; wl++) { - if (!wordLists.empty()) - wordLists += "\n"; - wordLists += wordListDescriptions[wl]; - } - } - } - - const char *DescribeWordListSets() const noexcept { - return wordLists.c_str(); - } -}; - -} - -#endif diff --git a/lexlib/PropSetSimple.cxx b/lexlib/PropSetSimple.cxx deleted file mode 100644 index 6ee57d667..000000000 --- a/lexlib/PropSetSimple.cxx +++ /dev/null @@ -1,157 +0,0 @@ -// Scintilla source code edit control -/** @file PropSetSimple.cxx - ** A basic string to string map. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -// Maintain a dictionary of properties - -#include <cstdlib> -#include <cstring> - -#include <string> -#include <map> - -#include "PropSetSimple.h" - -using namespace Scintilla; - -namespace { - -typedef std::map<std::string, std::string> mapss; - -mapss *PropsFromPointer(void *impl) noexcept { - return static_cast<mapss *>(impl); -} - -constexpr bool IsASpaceCharacter(int ch) noexcept { - return (ch == ' ') || ((ch >= 0x09) && (ch <= 0x0d)); -} - -} - -PropSetSimple::PropSetSimple() { - mapss *props = new mapss; - impl = static_cast<void *>(props); -} - -PropSetSimple::~PropSetSimple() { - mapss *props = PropsFromPointer(impl); - delete props; - impl = nullptr; -} - -void PropSetSimple::Set(const char *key, const char *val, size_t lenKey, size_t lenVal) { - mapss *props = PropsFromPointer(impl); - if (!*key) // Empty keys are not supported - return; - (*props)[std::string(key, lenKey)] = std::string(val, lenVal); -} - -void PropSetSimple::Set(const char *keyVal) { - while (IsASpaceCharacter(*keyVal)) - keyVal++; - const char *endVal = keyVal; - while (*endVal && (*endVal != '\n')) - endVal++; - const char *eqAt = strchr(keyVal, '='); - if (eqAt) { - Set(keyVal, eqAt + 1, eqAt-keyVal, - endVal - eqAt - 1); - } else if (*keyVal) { // No '=' so assume '=1' - Set(keyVal, "1", endVal-keyVal, 1); - } -} - -void PropSetSimple::SetMultiple(const char *s) { - const char *eol = strchr(s, '\n'); - while (eol) { - Set(s); - s = eol + 1; - eol = strchr(s, '\n'); - } - Set(s); -} - -const char *PropSetSimple::Get(const char *key) const { - mapss *props = PropsFromPointer(impl); - mapss::const_iterator keyPos = props->find(std::string(key)); - if (keyPos != props->end()) { - return keyPos->second.c_str(); - } else { - return ""; - } -} - -// There is some inconsistency between GetExpanded("foo") and Expand("$(foo)"). -// A solution is to keep a stack of variables that have been expanded, so that -// recursive expansions can be skipped. For now I'll just use the C++ stack -// for that, through a recursive function and a simple chain of pointers. - -struct VarChain { - VarChain(const char *var_=nullptr, const VarChain *link_= nullptr) noexcept : var(var_), link(link_) {} - - bool contains(const char *testVar) const { - return (var && (0 == strcmp(var, testVar))) - || (link && link->contains(testVar)); - } - - const char *var; - const VarChain *link; -}; - -static int ExpandAllInPlace(const PropSetSimple &props, std::string &withVars, int maxExpands, const VarChain &blankVars) { - size_t varStart = withVars.find("$("); - while ((varStart != std::string::npos) && (maxExpands > 0)) { - const size_t varEnd = withVars.find(')', varStart+2); - if (varEnd == std::string::npos) { - break; - } - - // For consistency, when we see '$(ab$(cde))', expand the inner variable first, - // regardless whether there is actually a degenerate variable named 'ab$(cde'. - size_t innerVarStart = withVars.find("$(", varStart+2); - while ((innerVarStart != std::string::npos) && (innerVarStart > varStart) && (innerVarStart < varEnd)) { - varStart = innerVarStart; - innerVarStart = withVars.find("$(", varStart+2); - } - - std::string var(withVars, varStart + 2, varEnd - varStart - 2); - std::string val = props.Get(var.c_str()); - - if (blankVars.contains(var.c_str())) { - val = ""; // treat blankVar as an empty string (e.g. to block self-reference) - } - - if (--maxExpands >= 0) { - maxExpands = ExpandAllInPlace(props, val, maxExpands, VarChain(var.c_str(), &blankVars)); - } - - withVars.erase(varStart, varEnd-varStart+1); - withVars.insert(varStart, val.c_str(), val.length()); - - varStart = withVars.find("$("); - } - - return maxExpands; -} - -size_t PropSetSimple::GetExpanded(const char *key, char *result) const { - std::string val = Get(key); - ExpandAllInPlace(*this, val, 100, VarChain(key)); - const size_t n = val.size(); - if (result) { - memcpy(result, val.c_str(), n+1); - } - return n; // Not including NUL -} - -int PropSetSimple::GetInt(const char *key, int defaultValue) const { - std::string val = Get(key); - ExpandAllInPlace(*this, val, 100, VarChain(key)); - if (!val.empty()) { - return atoi(val.c_str()); - } - return defaultValue; -} diff --git a/lexlib/PropSetSimple.h b/lexlib/PropSetSimple.h deleted file mode 100644 index d4a5b2243..000000000 --- a/lexlib/PropSetSimple.h +++ /dev/null @@ -1,28 +0,0 @@ -// Scintilla source code edit control -/** @file PropSetSimple.h - ** A basic string to string map. - **/ -// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef PROPSETSIMPLE_H -#define PROPSETSIMPLE_H - -namespace Scintilla { - -class PropSetSimple { - void *impl; - void Set(const char *keyVal); -public: - PropSetSimple(); - virtual ~PropSetSimple(); - void Set(const char *key, const char *val, size_t lenKey, size_t lenVal); - void SetMultiple(const char *); - const char *Get(const char *key) const; - size_t GetExpanded(const char *key, char *result) const; - int GetInt(const char *key, int defaultValue=0) const; -}; - -} - -#endif diff --git a/lexlib/SparseState.h b/lexlib/SparseState.h deleted file mode 100644 index 6286c76af..000000000 --- a/lexlib/SparseState.h +++ /dev/null @@ -1,106 +0,0 @@ -// Scintilla source code edit control -/** @file SparseState.h - ** Hold lexer state that may change rarely. - ** This is often per-line state such as whether a particular type of section has been entered. - ** A state continues until it is changed. - **/ -// Copyright 2011 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SPARSESTATE_H -#define SPARSESTATE_H - -namespace Scintilla { - -template <typename T> -class SparseState { - struct State { - Sci_Position position; - T value; - constexpr State(Sci_Position position_, T value_) noexcept : position(position_), value(value_) { - } - inline bool operator<(const State &other) const noexcept { - return position < other.position; - } - inline bool operator==(const State &other) const noexcept { - return (position == other.position) && (value == other.value); - } - }; - Sci_Position positionFirst; - typedef std::vector<State> stateVector; - stateVector states; - - typename stateVector::iterator Find(Sci_Position position) { - const State searchValue(position, T()); - return std::lower_bound(states.begin(), states.end(), searchValue); - } - -public: - explicit SparseState(Sci_Position positionFirst_=-1) { - positionFirst = positionFirst_; - } - void Set(Sci_Position position, T value) { - Delete(position); - if (states.empty() || (value != states[states.size()-1].value)) { - states.push_back(State(position, value)); - } - } - T ValueAt(Sci_Position position) { - if (states.empty()) - return T(); - if (position < states[0].position) - return T(); - typename stateVector::iterator low = Find(position); - if (low == states.end()) { - return states[states.size()-1].value; - } else { - if (low->position > position) { - --low; - } - return low->value; - } - } - bool Delete(Sci_Position position) { - typename stateVector::iterator low = Find(position); - if (low != states.end()) { - states.erase(low, states.end()); - return true; - } - return false; - } - size_t size() const { - return states.size(); - } - - // Returns true if Merge caused a significant change - bool Merge(const SparseState<T> &other, Sci_Position ignoreAfter) { - // Changes caused beyond ignoreAfter are not significant - Delete(ignoreAfter+1); - - bool different = true; - bool changed = false; - typename stateVector::iterator low = Find(other.positionFirst); - if (static_cast<size_t>(states.end() - low) == other.states.size()) { - // Same number in other as after positionFirst in this - different = !std::equal(low, states.end(), other.states.begin()); - } - if (different) { - if (low != states.end()) { - states.erase(low, states.end()); - changed = true; - } - typename stateVector::const_iterator startOther = other.states.begin(); - if (!states.empty() && !other.states.empty() && states.back().value == startOther->value) - ++startOther; - if (startOther != other.states.end()) { - states.insert(states.end(), startOther, other.states.end()); - changed = true; - } - } - return changed; - } -}; - -} - -#endif diff --git a/lexlib/StringCopy.h b/lexlib/StringCopy.h deleted file mode 100644 index 1c5442e65..000000000 --- a/lexlib/StringCopy.h +++ /dev/null @@ -1,32 +0,0 @@ -// Scintilla source code edit control -/** @file StringCopy.h - ** Safe string copy function which always NUL terminates. - ** ELEMENTS macro for determining array sizes. - **/ -// Copyright 2013 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef STRINGCOPY_H -#define STRINGCOPY_H - -namespace Scintilla { - -// Safer version of string copy functions like strcpy, wcsncpy, etc. -// Instantiate over fixed length strings of both char and wchar_t. -// May truncate if source doesn't fit into dest with room for NUL. - -template <typename T, size_t count> -void StringCopy(T (&dest)[count], const T* source) { - for (size_t i=0; i<count; i++) { - dest[i] = source[i]; - if (!source[i]) - break; - } - dest[count-1] = 0; -} - -#define ELEMENTS(a) (sizeof(a) / sizeof(a[0])) - -} - -#endif diff --git a/lexlib/StyleContext.cxx b/lexlib/StyleContext.cxx deleted file mode 100644 index fe56e53d7..000000000 --- a/lexlib/StyleContext.cxx +++ /dev/null @@ -1,68 +0,0 @@ -// Scintilla source code edit control -/** @file StyleContext.cxx - ** Lexer infrastructure. - **/ -// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org> -// This file is in the public domain. - -#include <cstdlib> -#include <cassert> - -#include "ILexer.h" - -#include "LexAccessor.h" -#include "Accessor.h" -#include "StyleContext.h" -#include "CharacterSet.h" - -using namespace Scintilla; - -bool StyleContext::MatchIgnoreCase(const char *s) { - if (MakeLowerCase(ch) != static_cast<unsigned char>(*s)) - return false; - s++; - if (MakeLowerCase(chNext) != static_cast<unsigned char>(*s)) - return false; - s++; - for (int n = 2; *s; n++) { - if (*s != - MakeLowerCase(styler.SafeGetCharAt(currentPos + n, 0))) - return false; - s++; - } - return true; -} - -static void getRange(Sci_PositionU start, - Sci_PositionU end, - LexAccessor &styler, - char *s, - Sci_PositionU len) { - Sci_PositionU i = 0; - while ((i < end - start + 1) && (i < len-1)) { - s[i] = styler[start + i]; - i++; - } - s[i] = '\0'; -} - -void StyleContext::GetCurrent(char *s, Sci_PositionU len) { - getRange(styler.GetStartSegment(), currentPos - 1, styler, s, len); -} - -static void getRangeLowered(Sci_PositionU start, - Sci_PositionU end, - LexAccessor &styler, - char *s, - Sci_PositionU len) { - Sci_PositionU i = 0; - while ((i < end - start + 1) && (i < len-1)) { - s[i] = MakeLowerCase(styler[start + i]); - i++; - } - s[i] = '\0'; -} - -void StyleContext::GetCurrentLowered(char *s, Sci_PositionU len) { - getRangeLowered(styler.GetStartSegment(), currentPos - 1, styler, s, len); -} diff --git a/lexlib/StyleContext.h b/lexlib/StyleContext.h deleted file mode 100644 index c9ff4efbb..000000000 --- a/lexlib/StyleContext.h +++ /dev/null @@ -1,212 +0,0 @@ -// Scintilla source code edit control -/** @file StyleContext.h - ** Lexer infrastructure. - **/ -// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org> -// This file is in the public domain. - -#ifndef STYLECONTEXT_H -#define STYLECONTEXT_H - -namespace Scintilla { - -// All languages handled so far can treat all characters >= 0x80 as one class -// which just continues the current token or starts an identifier if in default. -// DBCS treated specially as the second character can be < 0x80 and hence -// syntactically significant. UTF-8 avoids this as all trail bytes are >= 0x80 -class StyleContext { - LexAccessor &styler; - IDocument *multiByteAccess; - Sci_PositionU endPos; - Sci_PositionU lengthDocument; - - // Used for optimizing GetRelativeCharacter - Sci_PositionU posRelative; - Sci_PositionU currentPosLastRelative; - Sci_Position offsetRelative; - - void GetNextChar() { - if (multiByteAccess) { - chNext = multiByteAccess->GetCharacterAndWidth(currentPos+width, &widthNext); - } else { - chNext = static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+width, 0)); - widthNext = 1; - } - // End of line determined from line end position, allowing CR, LF, - // CRLF and Unicode line ends as set by document. - if (currentLine < lineDocEnd) - atLineEnd = static_cast<Sci_Position>(currentPos) >= (lineStartNext-1); - else // Last line - atLineEnd = static_cast<Sci_Position>(currentPos) >= lineStartNext; - } - -public: - Sci_PositionU currentPos; - Sci_Position currentLine; - Sci_Position lineDocEnd; - Sci_Position lineStartNext; - bool atLineStart; - bool atLineEnd; - int state; - int chPrev; - int ch; - Sci_Position width; - int chNext; - Sci_Position widthNext; - - StyleContext(Sci_PositionU startPos, Sci_PositionU length, - int initStyle, LexAccessor &styler_, char chMask='\377') : - styler(styler_), - multiByteAccess(nullptr), - endPos(startPos + length), - posRelative(0), - currentPosLastRelative(0x7FFFFFFF), - offsetRelative(0), - currentPos(startPos), - currentLine(-1), - lineStartNext(-1), - atLineEnd(false), - state(initStyle & chMask), // Mask off all bits which aren't in the chMask. - chPrev(0), - ch(0), - width(0), - chNext(0), - widthNext(1) { - if (styler.Encoding() != EncodingType::eightBit) { - multiByteAccess = styler.MultiByteAccess(); - } - styler.StartAt(startPos /*, chMask*/); - styler.StartSegment(startPos); - currentLine = styler.GetLine(startPos); - lineStartNext = styler.LineStart(currentLine+1); - lengthDocument = static_cast<Sci_PositionU>(styler.Length()); - if (endPos == lengthDocument) - endPos++; - lineDocEnd = styler.GetLine(lengthDocument); - atLineStart = static_cast<Sci_PositionU>(styler.LineStart(currentLine)) == startPos; - - // Variable width is now 0 so GetNextChar gets the char at currentPos into chNext/widthNext - width = 0; - GetNextChar(); - ch = chNext; - width = widthNext; - - GetNextChar(); - } - // Deleted so StyleContext objects can not be copied. - StyleContext(const StyleContext &) = delete; - StyleContext &operator=(const StyleContext &) = delete; - void Complete() { - styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state); - styler.Flush(); - } - bool More() const noexcept { - return currentPos < endPos; - } - void Forward() { - if (currentPos < endPos) { - atLineStart = atLineEnd; - if (atLineStart) { - currentLine++; - lineStartNext = styler.LineStart(currentLine+1); - } - chPrev = ch; - currentPos += width; - ch = chNext; - width = widthNext; - GetNextChar(); - } else { - atLineStart = false; - chPrev = ' '; - ch = ' '; - chNext = ' '; - atLineEnd = true; - } - } - void Forward(Sci_Position nb) { - for (Sci_Position i = 0; i < nb; i++) { - Forward(); - } - } - void ForwardBytes(Sci_Position nb) { - const Sci_PositionU forwardPos = currentPos + nb; - while (forwardPos > currentPos) { - const Sci_PositionU currentPosStart = currentPos; - Forward(); - if (currentPos == currentPosStart) { - // Reached end - return; - } - } - } - void ChangeState(int state_) noexcept { - state = state_; - } - void SetState(int state_) { - styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state); - state = state_; - } - void ForwardSetState(int state_) { - Forward(); - styler.ColourTo(currentPos - ((currentPos > lengthDocument) ? 2 : 1), state); - state = state_; - } - Sci_Position LengthCurrent() const { - return currentPos - styler.GetStartSegment(); - } - int GetRelative(Sci_Position n, char chDefault='\0') { - return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n, chDefault)); - } - int GetRelativeCharacter(Sci_Position n) { - if (n == 0) - return ch; - if (multiByteAccess) { - if ((currentPosLastRelative != currentPos) || - ((n > 0) && ((offsetRelative < 0) || (n < offsetRelative))) || - ((n < 0) && ((offsetRelative > 0) || (n > offsetRelative)))) { - posRelative = currentPos; - offsetRelative = 0; - } - const Sci_Position diffRelative = n - offsetRelative; - const Sci_Position posNew = multiByteAccess->GetRelativePosition(posRelative, diffRelative); - const int chReturn = multiByteAccess->GetCharacterAndWidth(posNew, nullptr); - posRelative = posNew; - currentPosLastRelative = currentPos; - offsetRelative = n; - return chReturn; - } else { - // fast version for single byte encodings - return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos + n, 0)); - } - } - bool Match(char ch0) const { - return ch == static_cast<unsigned char>(ch0); - } - bool Match(char ch0, char ch1) const { - return (ch == static_cast<unsigned char>(ch0)) && (chNext == static_cast<unsigned char>(ch1)); - } - bool Match(const char *s) { - if (ch != static_cast<unsigned char>(*s)) - return false; - s++; - if (!*s) - return true; - if (chNext != static_cast<unsigned char>(*s)) - return false; - s++; - for (int n=2; *s; n++) { - if (*s != styler.SafeGetCharAt(currentPos+n, 0)) - return false; - s++; - } - return true; - } - // Non-inline - bool MatchIgnoreCase(const char *s); - void GetCurrent(char *s, Sci_PositionU len); - void GetCurrentLowered(char *s, Sci_PositionU len); -}; - -} - -#endif diff --git a/lexlib/SubStyles.h b/lexlib/SubStyles.h deleted file mode 100644 index 4bfe7ebfc..000000000 --- a/lexlib/SubStyles.h +++ /dev/null @@ -1,208 +0,0 @@ -// Scintilla source code edit control -/** @file SubStyles.h - ** Manage substyles for a lexer. - **/ -// Copyright 2012 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef SUBSTYLES_H -#define SUBSTYLES_H - -namespace Scintilla { - -class WordClassifier { - int baseStyle; - int firstStyle; - int lenStyles; - std::map<std::string, int> wordToStyle; - -public: - - explicit WordClassifier(int baseStyle_) : baseStyle(baseStyle_), firstStyle(0), lenStyles(0) { - } - - void Allocate(int firstStyle_, int lenStyles_) { - firstStyle = firstStyle_; - lenStyles = lenStyles_; - wordToStyle.clear(); - } - - int Base() const noexcept { - return baseStyle; - } - - int Start() const noexcept { - return firstStyle; - } - - int Last() const noexcept { - return firstStyle + lenStyles - 1; - } - - int Length() const noexcept { - return lenStyles; - } - - void Clear() noexcept { - firstStyle = 0; - lenStyles = 0; - wordToStyle.clear(); - } - - int ValueFor(const std::string &s) const { - std::map<std::string, int>::const_iterator it = wordToStyle.find(s); - if (it != wordToStyle.end()) - return it->second; - else - return -1; - } - - bool IncludesStyle(int style) const noexcept { - return (style >= firstStyle) && (style < (firstStyle + lenStyles)); - } - - void RemoveStyle(int style) { - std::map<std::string, int>::iterator it = wordToStyle.begin(); - while (it != wordToStyle.end()) { - if (it->second == style) { - it = wordToStyle.erase(it); - } else { - ++it; - } - } - } - - void SetIdentifiers(int style, const char *identifiers) { - RemoveStyle(style); - while (*identifiers) { - const char *cpSpace = identifiers; - while (*cpSpace && !(*cpSpace == ' ' || *cpSpace == '\t' || *cpSpace == '\r' || *cpSpace == '\n')) - cpSpace++; - if (cpSpace > identifiers) { - std::string word(identifiers, cpSpace - identifiers); - wordToStyle[word] = style; - } - identifiers = cpSpace; - if (*identifiers) - identifiers++; - } - } -}; - -class SubStyles { - int classifications; - const char *baseStyles; - int styleFirst; - int stylesAvailable; - int secondaryDistance; - int allocated; - std::vector<WordClassifier> classifiers; - - int BlockFromBaseStyle(int baseStyle) const noexcept { - for (int b=0; b < classifications; b++) { - if (baseStyle == baseStyles[b]) - return b; - } - return -1; - } - - int BlockFromStyle(int style) const { - int b = 0; - for (std::vector<WordClassifier>::const_iterator it=classifiers.begin(); it != classifiers.end(); ++it) { - if (it->IncludesStyle(style)) - return b; - b++; - } - return -1; - } - -public: - - SubStyles(const char *baseStyles_, int styleFirst_, int stylesAvailable_, int secondaryDistance_) : - classifications(0), - baseStyles(baseStyles_), - styleFirst(styleFirst_), - stylesAvailable(stylesAvailable_), - secondaryDistance(secondaryDistance_), - allocated(0) { - while (baseStyles[classifications]) { - classifiers.push_back(WordClassifier(baseStyles[classifications])); - classifications++; - } - } - - int Allocate(int styleBase, int numberStyles) { - const int block = BlockFromBaseStyle(styleBase); - if (block >= 0) { - if ((allocated + numberStyles) > stylesAvailable) - return -1; - const int startBlock = styleFirst + allocated; - allocated += numberStyles; - classifiers[block].Allocate(startBlock, numberStyles); - return startBlock; - } else { - return -1; - } - } - - int Start(int styleBase) noexcept { - const int block = BlockFromBaseStyle(styleBase); - return (block >= 0) ? classifiers[block].Start() : -1; - } - - int Length(int styleBase) noexcept { - const int block = BlockFromBaseStyle(styleBase); - return (block >= 0) ? classifiers[block].Length() : 0; - } - - int BaseStyle(int subStyle) const { - const int block = BlockFromStyle(subStyle); - if (block >= 0) - return classifiers[block].Base(); - else - return subStyle; - } - - int DistanceToSecondaryStyles() const noexcept { - return secondaryDistance; - } - - int FirstAllocated() const { - int start = 257; - for (std::vector<WordClassifier>::const_iterator it = classifiers.begin(); it != classifiers.end(); ++it) { - if (start > it->Start()) - start = it->Start(); - } - return (start < 256) ? start : -1; - } - - int LastAllocated() const { - int last = -1; - for (std::vector<WordClassifier>::const_iterator it = classifiers.begin(); it != classifiers.end(); ++it) { - if (last < it->Last()) - last = it->Last(); - } - return last; - } - - void SetIdentifiers(int style, const char *identifiers) { - const int block = BlockFromStyle(style); - if (block >= 0) - classifiers[block].SetIdentifiers(style, identifiers); - } - - void Free() { - allocated = 0; - for (std::vector<WordClassifier>::iterator it=classifiers.begin(); it != classifiers.end(); ++it) - it->Clear(); - } - - const WordClassifier &Classifier(int baseStyle) const noexcept { - const int block = BlockFromBaseStyle(baseStyle); - return classifiers[block >= 0 ? block : 0]; - } -}; - -} - -#endif diff --git a/lexlib/WordList.cxx b/lexlib/WordList.cxx deleted file mode 100644 index 460995daa..000000000 --- a/lexlib/WordList.cxx +++ /dev/null @@ -1,315 +0,0 @@ -// Scintilla source code edit control -/** @file WordList.cxx - ** Hold a list of words. - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> -#include <cstring> - -#include <algorithm> -#include <iterator> - -#include "WordList.h" - -using namespace Scintilla; - -/** - * Creates an array that points into each word in the string and puts \0 terminators - * after each word. - */ -static char **ArrayFromWordList(char *wordlist, size_t slen, int *len, bool onlyLineEnds = false) { - int prev = '\n'; - int words = 0; - // For rapid determination of whether a character is a separator, build - // a look up table. - bool wordSeparator[256] = {}; // Initialise all to false. - wordSeparator[static_cast<unsigned int>('\r')] = true; - wordSeparator[static_cast<unsigned int>('\n')] = true; - if (!onlyLineEnds) { - wordSeparator[static_cast<unsigned int>(' ')] = true; - wordSeparator[static_cast<unsigned int>('\t')] = true; - } - for (int j = 0; wordlist[j]; j++) { - const int curr = static_cast<unsigned char>(wordlist[j]); - if (!wordSeparator[curr] && wordSeparator[prev]) - words++; - prev = curr; - } - char **keywords = new char *[words + 1]; - int wordsStore = 0; - if (words) { - prev = '\0'; - for (size_t k = 0; k < slen; k++) { - if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) { - if (!prev) { - keywords[wordsStore] = &wordlist[k]; - wordsStore++; - } - } else { - wordlist[k] = '\0'; - } - prev = wordlist[k]; - } - } - assert(wordsStore < (words + 1)); - keywords[wordsStore] = &wordlist[slen]; - *len = wordsStore; - return keywords; -} - -WordList::WordList(bool onlyLineEnds_) : - words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_) { - // Prevent warnings by static analyzers about uninitialized starts. - starts[0] = -1; -} - -WordList::~WordList() { - Clear(); -} - -WordList::operator bool() const noexcept { - return len ? true : false; -} - -bool WordList::operator!=(const WordList &other) const noexcept { - if (len != other.len) - return true; - for (int i=0; i<len; i++) { - if (strcmp(words[i], other.words[i]) != 0) - return true; - } - return false; -} - -int WordList::Length() const noexcept { - return len; -} - -void WordList::Clear() noexcept { - if (words) { - delete []list; - delete []words; - } - words = nullptr; - list = nullptr; - len = 0; -} - -#ifdef _MSC_VER - -static bool cmpWords(const char *a, const char *b) { - return strcmp(a, b) < 0; -} - -#else - -static int cmpWords(const void *a, const void *b) { - return strcmp(*static_cast<const char * const *>(a), *static_cast<const char * const *>(b)); -} - -static void SortWordList(char **words, unsigned int len) { - qsort(words, len, sizeof(*words), cmpWords); -} - -#endif - -bool WordList::Set(const char *s) { - const size_t lenS = strlen(s) + 1; - char *listTemp = new char[lenS]; - memcpy(listTemp, s, lenS); - int lenTemp = 0; - char **wordsTemp = ArrayFromWordList(listTemp, lenS - 1, &lenTemp, onlyLineEnds); -#ifdef _MSC_VER - std::sort(wordsTemp, wordsTemp + lenTemp, cmpWords); -#else - SortWordList(wordsTemp, lenTemp); -#endif - - if (lenTemp == len) { - bool changed = false; - for (int i = 0; i < lenTemp; i++) { - if (strcmp(words[i], wordsTemp[i]) != 0) { - changed = true; - break; - } - } - if (!changed) { - delete []listTemp; - delete []wordsTemp; - return false; - } - } - - Clear(); - words = wordsTemp; - list = listTemp; - len = lenTemp; - std::fill(starts, std::end(starts), -1); - for (int l = len - 1; l >= 0; l--) { - unsigned char indexChar = words[l][0]; - starts[indexChar] = l; - } - return true; -} - -/** Check whether a string is in the list. - * List elements are either exact matches or prefixes. - * Prefix elements start with '^' and match all strings that start with the rest of the element - * so '^GTK_' matches 'GTK_X', 'GTK_MAJOR_VERSION', and 'GTK_'. - */ -bool WordList::InList(const char *s) const noexcept { - if (0 == words) - return false; - const unsigned char firstChar = s[0]; - int j = starts[firstChar]; - if (j >= 0) { - while (words[j][0] == firstChar) { - if (s[1] == words[j][1]) { - const char *a = words[j] + 1; - const char *b = s + 1; - while (*a && *a == *b) { - a++; - b++; - } - if (!*a && !*b) - return true; - } - j++; - } - } - j = starts[static_cast<unsigned int>('^')]; - if (j >= 0) { - while (words[j][0] == '^') { - const char *a = words[j] + 1; - const char *b = s; - while (*a && *a == *b) { - a++; - b++; - } - if (!*a) - return true; - j++; - } - } - return false; -} - -/** similar to InList, but word s can be a substring of keyword. - * eg. the keyword define is defined as def~ine. This means the word must start - * with def to be a keyword, but also defi, defin and define are valid. - * The marker is ~ in this case. - */ -bool WordList::InListAbbreviated(const char *s, const char marker) const noexcept { - if (0 == words) - return false; - const unsigned char firstChar = s[0]; - int j = starts[firstChar]; - if (j >= 0) { - while (words[j][0] == firstChar) { - bool isSubword = false; - int start = 1; - if (words[j][1] == marker) { - isSubword = true; - start++; - } - if (s[1] == words[j][start]) { - const char *a = words[j] + start; - const char *b = s + 1; - while (*a && *a == *b) { - a++; - if (*a == marker) { - isSubword = true; - a++; - } - b++; - } - if ((!*a || isSubword) && !*b) - return true; - } - j++; - } - } - j = starts[static_cast<unsigned int>('^')]; - if (j >= 0) { - while (words[j][0] == '^') { - const char *a = words[j] + 1; - const char *b = s; - while (*a && *a == *b) { - a++; - b++; - } - if (!*a) - return true; - j++; - } - } - return false; -} - -/** similar to InListAbbreviated, but word s can be a abridged version of a keyword. -* eg. the keyword is defined as "after.~:". This means the word must have a prefix (begins with) of -* "after." and suffix (ends with) of ":" to be a keyword, Hence "after.field:" , "after.form.item:" are valid. -* Similarly "~.is.valid" keyword is suffix only... hence "field.is.valid" , "form.is.valid" are valid. -* The marker is ~ in this case. -* No multiple markers check is done and wont work. -*/ -bool WordList::InListAbridged(const char *s, const char marker) const noexcept { - if (0 == words) - return false; - const unsigned char firstChar = s[0]; - int j = starts[firstChar]; - if (j >= 0) { - while (words[j][0] == firstChar) { - const char *a = words[j]; - const char *b = s; - while (*a && *a == *b) { - a++; - if (*a == marker) { - a++; - const size_t suffixLengthA = strlen(a); - const size_t suffixLengthB = strlen(b); - if (suffixLengthA >= suffixLengthB) - break; - b = b + suffixLengthB - suffixLengthA - 1; - } - b++; - } - if (!*a && !*b) - return true; - j++; - } - } - - j = starts[static_cast<unsigned int>(marker)]; - if (j >= 0) { - while (words[j][0] == marker) { - const char *a = words[j] + 1; - const char *b = s; - const size_t suffixLengthA = strlen(a); - const size_t suffixLengthB = strlen(b); - if (suffixLengthA > suffixLengthB) { - j++; - continue; - } - b = b + suffixLengthB - suffixLengthA; - - while (*a && *a == *b) { - a++; - b++; - } - if (!*a && !*b) - return true; - j++; - } - } - - return false; -} - -const char *WordList::WordAt(int n) const noexcept { - return words[n]; -} - diff --git a/lexlib/WordList.h b/lexlib/WordList.h deleted file mode 100644 index 127f00e68..000000000 --- a/lexlib/WordList.h +++ /dev/null @@ -1,38 +0,0 @@ -// Scintilla source code edit control -/** @file WordList.h - ** Hold a list of words. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef WORDLIST_H -#define WORDLIST_H - -namespace Scintilla { - -/** - */ -class WordList { - // Each word contains at least one character - a empty word acts as sentinel at the end. - char **words; - char *list; - int len; - bool onlyLineEnds; ///< Delimited by any white space or only line ends - int starts[256]; -public: - explicit WordList(bool onlyLineEnds_ = false); - ~WordList(); - operator bool() const noexcept; - bool operator!=(const WordList &other) const noexcept; - int Length() const noexcept; - void Clear() noexcept; - bool Set(const char *s); - bool InList(const char *s) const noexcept; - bool InListAbbreviated(const char *s, const char marker) const noexcept; - bool InListAbridged(const char *s, const char marker) const noexcept; - const char *WordAt(int n) const noexcept; -}; - -} - -#endif diff --git a/src/Catalogue.cxx b/src/Catalogue.cxx deleted file mode 100644 index 7f2415e0b..000000000 --- a/src/Catalogue.cxx +++ /dev/null @@ -1,197 +0,0 @@ -// Scintilla source code edit control -/** @file Catalogue.cxx - ** Lexer infrastructure. - ** Contains a list of LexerModules which can be searched to find a module appropriate for a - ** particular language. - **/ -// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> -#include <cstring> - -#include <stdexcept> -#include <vector> - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "LexerModule.h" -#include "CatalogueModules.h" -#include "Catalogue.h" - -using namespace Scintilla; - -namespace { - -CatalogueModules catalogueDefault; - -} - -const LexerModule *Catalogue::Find(int language) { - return catalogueDefault.Find(language); -} - -const LexerModule *Catalogue::Find(const char *languageName) noexcept { - return catalogueDefault.Find(languageName); -} - -void Catalogue::AddLexerModule(LexerModule *plm) { - catalogueDefault.AddLexerModule(plm); -} - -// To add or remove a lexer, add or remove its file and run LexGen.py. - -// Force a reference to all of the Scintilla lexers so that the linker will -// not remove the code of the lexers. -int Scintilla_LinkLexers() { - - static int initialised = 0; - if (initialised) - return 0; - initialised = 1; - -#if !defined(SCI_EMPTYCATALOGUE) - -// Shorten the code that declares a lexer and ensures it is linked in by calling a method. -#define LINK_LEXER(lexer) extern LexerModule lexer; catalogueDefault.AddLexerModule(&lexer); - -//++Autogenerated -- run scripts/LexGen.py to regenerate -//**\(\tLINK_LEXER(\*);\n\) - LINK_LEXER(lmA68k); - LINK_LEXER(lmAbaqus); - LINK_LEXER(lmAda); - LINK_LEXER(lmAPDL); - LINK_LEXER(lmAs); - LINK_LEXER(lmAsm); - LINK_LEXER(lmAsn1); - LINK_LEXER(lmASY); - LINK_LEXER(lmAU3); - LINK_LEXER(lmAVE); - LINK_LEXER(lmAVS); - LINK_LEXER(lmBaan); - LINK_LEXER(lmBash); - LINK_LEXER(lmBatch); - LINK_LEXER(lmBibTeX); - LINK_LEXER(lmBlitzBasic); - LINK_LEXER(lmBullant); - LINK_LEXER(lmCaml); - LINK_LEXER(lmCIL); - LINK_LEXER(lmClw); - LINK_LEXER(lmClwNoCase); - LINK_LEXER(lmCmake); - LINK_LEXER(lmCOBOL); - LINK_LEXER(lmCoffeeScript); - LINK_LEXER(lmConf); - LINK_LEXER(lmCPP); - LINK_LEXER(lmCPPNoCase); - LINK_LEXER(lmCsound); - LINK_LEXER(lmCss); - LINK_LEXER(lmD); - LINK_LEXER(lmDataflex); - LINK_LEXER(lmDiff); - LINK_LEXER(lmDMAP); - LINK_LEXER(lmDMIS); - LINK_LEXER(lmECL); - LINK_LEXER(lmEDIFACT); - LINK_LEXER(lmEiffel); - LINK_LEXER(lmEiffelkw); - LINK_LEXER(lmErlang); - LINK_LEXER(lmErrorList); - LINK_LEXER(lmESCRIPT); - LINK_LEXER(lmF77); - LINK_LEXER(lmFlagShip); - LINK_LEXER(lmForth); - LINK_LEXER(lmFortran); - LINK_LEXER(lmFreeBasic); - LINK_LEXER(lmGAP); - LINK_LEXER(lmGui4Cli); - LINK_LEXER(lmHaskell); - LINK_LEXER(lmHollywood); - LINK_LEXER(lmHTML); - LINK_LEXER(lmIHex); - LINK_LEXER(lmIndent); - LINK_LEXER(lmInno); - LINK_LEXER(lmJSON); - LINK_LEXER(lmKix); - LINK_LEXER(lmKVIrc); - LINK_LEXER(lmLatex); - LINK_LEXER(lmLISP); - LINK_LEXER(lmLiterateHaskell); - LINK_LEXER(lmLot); - LINK_LEXER(lmLout); - LINK_LEXER(lmLua); - LINK_LEXER(lmMagikSF); - LINK_LEXER(lmMake); - LINK_LEXER(lmMarkdown); - LINK_LEXER(lmMatlab); - LINK_LEXER(lmMaxima); - LINK_LEXER(lmMETAPOST); - LINK_LEXER(lmMMIXAL); - LINK_LEXER(lmModula); - LINK_LEXER(lmMSSQL); - LINK_LEXER(lmMySQL); - LINK_LEXER(lmNim); - LINK_LEXER(lmNimrod); - LINK_LEXER(lmNncrontab); - LINK_LEXER(lmNsis); - LINK_LEXER(lmNull); - LINK_LEXER(lmOctave); - LINK_LEXER(lmOpal); - LINK_LEXER(lmOScript); - LINK_LEXER(lmPascal); - LINK_LEXER(lmPB); - LINK_LEXER(lmPerl); - LINK_LEXER(lmPHPSCRIPT); - LINK_LEXER(lmPLM); - LINK_LEXER(lmPO); - LINK_LEXER(lmPOV); - LINK_LEXER(lmPowerPro); - LINK_LEXER(lmPowerShell); - LINK_LEXER(lmProgress); - LINK_LEXER(lmProps); - LINK_LEXER(lmPS); - LINK_LEXER(lmPureBasic); - LINK_LEXER(lmPython); - LINK_LEXER(lmR); - LINK_LEXER(lmRaku); - LINK_LEXER(lmREBOL); - LINK_LEXER(lmRegistry); - LINK_LEXER(lmRuby); - LINK_LEXER(lmRust); - LINK_LEXER(lmSAS); - LINK_LEXER(lmScriptol); - LINK_LEXER(lmSmalltalk); - LINK_LEXER(lmSML); - LINK_LEXER(lmSorc); - LINK_LEXER(lmSpecman); - LINK_LEXER(lmSpice); - LINK_LEXER(lmSQL); - LINK_LEXER(lmSrec); - LINK_LEXER(lmStata); - LINK_LEXER(lmSTTXT); - LINK_LEXER(lmTACL); - LINK_LEXER(lmTADS3); - LINK_LEXER(lmTAL); - LINK_LEXER(lmTCL); - LINK_LEXER(lmTCMD); - LINK_LEXER(lmTEHex); - LINK_LEXER(lmTeX); - LINK_LEXER(lmTxt2tags); - LINK_LEXER(lmVB); - LINK_LEXER(lmVBScript); - LINK_LEXER(lmVerilog); - LINK_LEXER(lmVHDL); - LINK_LEXER(lmVisualProlog); - LINK_LEXER(lmX12); - LINK_LEXER(lmXML); - LINK_LEXER(lmYAML); - -//--Autogenerated -- end of automatically generated section - -#endif - - return 1; -} diff --git a/src/Catalogue.h b/src/Catalogue.h deleted file mode 100644 index 05a1f1d29..000000000 --- a/src/Catalogue.h +++ /dev/null @@ -1,24 +0,0 @@ -// Scintilla source code edit control -/** @file Catalogue.h - ** Lexer infrastructure. - ** Contains a list of LexerModules which can be searched to find a module appropriate for a - ** particular language. - **/ -// Copyright 1998-2010 by Neil Hodgson <neilh@scintilla.org> -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef CATALOGUE_H -#define CATALOGUE_H - -namespace Scintilla { - -class Catalogue { -public: - static const LexerModule *Find(int language); - static const LexerModule *Find(const char *languageName) noexcept; - static void AddLexerModule(LexerModule *plm); -}; - -} - -#endif diff --git a/src/ExternalLexer.cxx b/src/ExternalLexer.cxx deleted file mode 100644 index 1609b676e..000000000 --- a/src/ExternalLexer.cxx +++ /dev/null @@ -1,222 +0,0 @@ -// Scintilla source code edit control -/** @file ExternalLexer.cxx - ** Support external lexers in DLLs or shared libraries. - **/ -// Copyright 2001 Simon Steele <ss@pnotepad.org>, portions copyright Neil Hodgson. -// The License.txt file describes the conditions under which this software may be distributed. - -#include <cstdlib> -#include <cassert> -#include <cstring> - -#include <stdexcept> -#include <string> -#include <string_view> -#include <vector> -#include <memory> - -#include "Platform.h" - -#include "ILexer.h" -#include "Scintilla.h" -#include "SciLexer.h" - -#include "LexerModule.h" -#include "Catalogue.h" -#include "ExternalLexer.h" - -using namespace Scintilla; - -#if PLAT_WIN -#define EXT_LEXER_DECL __stdcall -#else -#define EXT_LEXER_DECL -#endif - -namespace { - -int nextLanguage = SCLEX_AUTOMATIC + 1; - -typedef int (EXT_LEXER_DECL *GetLexerCountFn)(); -typedef void (EXT_LEXER_DECL *GetLexerNameFn)(unsigned int Index, char *name, int buflength); -typedef LexerFactoryFunction(EXT_LEXER_DECL *GetLexerFactoryFunction)(unsigned int Index); - -/// Generic function to convert from a void* to a function pointer. -/// This avoids undefined and conditionally defined behaviour. -template<typename T> -T FunctionPointer(void *function) noexcept { - static_assert(sizeof(T) == sizeof(function)); - T fp; - memcpy(&fp, &function, sizeof(T)); - return fp; -} - -/// Sub-class of LexerModule to use an external lexer. -class ExternalLexerModule : public LexerModule { -protected: - GetLexerFactoryFunction fneFactory; - std::string name; -public: - ExternalLexerModule(int language_, LexerFunction fnLexer_, - const char *languageName_=nullptr, LexerFunction fnFolder_=nullptr) : - LexerModule(language_, fnLexer_, nullptr, fnFolder_), - fneFactory(nullptr), name(languageName_){ - languageName = name.c_str(); - } - void SetExternal(GetLexerFactoryFunction fFactory, int index) noexcept; -}; - -/// LexerLibrary exists for every External Lexer DLL, contains ExternalLexerModules. -class LexerLibrary { - std::unique_ptr<DynamicLibrary> lib; - std::vector<std::unique_ptr<ExternalLexerModule>> modules; -public: - explicit LexerLibrary(const char *moduleName_); - ~LexerLibrary(); - - std::string moduleName; -}; - -/// LexerManager manages external lexers, contains LexerLibrarys. -class LexerManager { -public: - ~LexerManager(); - - static LexerManager *GetInstance(); - static void DeleteInstance() noexcept; - - void Load(const char *path); - void Clear() noexcept; - -private: - LexerManager(); - static std::unique_ptr<LexerManager> theInstance; - std::vector<std::unique_ptr<LexerLibrary>> libraries; -}; - -class LMMinder { -public: - ~LMMinder(); -}; - -std::unique_ptr<LexerManager> LexerManager::theInstance; - -//------------------------------------------ -// -// ExternalLexerModule -// -//------------------------------------------ - -void ExternalLexerModule::SetExternal(GetLexerFactoryFunction fFactory, int index) noexcept { - fneFactory = fFactory; - fnFactory = fFactory(index); -} - -//------------------------------------------ -// -// LexerLibrary -// -//------------------------------------------ - -LexerLibrary::LexerLibrary(const char *moduleName_) { - // Load the DLL - lib.reset(DynamicLibrary::Load(moduleName_)); - if (lib->IsValid()) { - moduleName = moduleName_; - GetLexerCountFn GetLexerCount = FunctionPointer<GetLexerCountFn>(lib->FindFunction("GetLexerCount")); - - if (GetLexerCount) { - // Find functions in the DLL - GetLexerNameFn GetLexerName = FunctionPointer<GetLexerNameFn>(lib->FindFunction("GetLexerName")); - GetLexerFactoryFunction fnFactory = FunctionPointer<GetLexerFactoryFunction>(lib->FindFunction("GetLexerFactory")); - - if (!GetLexerName || !fnFactory) { - return; - } - - const int nl = GetLexerCount(); - - for (int i = 0; i < nl; i++) { - // Assign a buffer for the lexer name. - char lexname[100] = ""; - GetLexerName(i, lexname, sizeof(lexname)); - ExternalLexerModule *lex = new ExternalLexerModule(nextLanguage, nullptr, lexname, nullptr); - nextLanguage++; - - // This is storing a second reference to lex in the Catalogue as well as in modules. - // TODO: Should use std::shared_ptr or similar to ensure allocation safety. - Catalogue::AddLexerModule(lex); - - // Remember ExternalLexerModule so we don't leak it - modules.push_back(std::unique_ptr<ExternalLexerModule>(lex)); - - // The external lexer needs to know how to call into its DLL to - // do its lexing and folding, we tell it here. - lex->SetExternal(fnFactory, i); - } - } - } -} - -LexerLibrary::~LexerLibrary() { -} - -//------------------------------------------ -// -// LexerManager -// -//------------------------------------------ - -/// Return the single LexerManager instance... -LexerManager *LexerManager::GetInstance() { - if (!theInstance) - theInstance.reset(new LexerManager); - return theInstance.get(); -} - -/// Delete any LexerManager instance... -void LexerManager::DeleteInstance() noexcept { - theInstance.reset(); -} - -/// protected constructor - this is a singleton... -LexerManager::LexerManager() { -} - -LexerManager::~LexerManager() { - Clear(); -} - -void LexerManager::Load(const char *path) { - for (const std::unique_ptr<LexerLibrary> &ll : libraries) { - if (ll->moduleName == path) - return; - } - libraries.push_back(std::make_unique<LexerLibrary>(path)); -} - -void LexerManager::Clear() noexcept { - libraries.clear(); -} - -//------------------------------------------ -// -// LMMinder -- trigger to clean up at exit. -// -//------------------------------------------ - -LMMinder::~LMMinder() { - LexerManager::DeleteInstance(); -} - -LMMinder minder; - -} - -namespace Scintilla { - -void ExternalLexerLoad(const char *path) { - LexerManager::GetInstance()->Load(path); -} - -} diff --git a/src/ExternalLexer.h b/src/ExternalLexer.h deleted file mode 100644 index d0a615e31..000000000 --- a/src/ExternalLexer.h +++ /dev/null @@ -1,17 +0,0 @@ -// Scintilla source code edit control -/** @file ExternalLexer.h - ** Support external lexers in DLLs or shared libraries. - **/ -// Copyright 2001 Simon Steele <ss@pnotepad.org>, portions copyright Neil Hodgson. -// The License.txt file describes the conditions under which this software may be distributed. - -#ifndef EXTERNALLEXER_H -#define EXTERNALLEXER_H - -namespace Scintilla { - -void ExternalLexerLoad(const char *path); - -} - -#endif diff --git a/test/unit/testSparseState.cxx b/test/unit/testSparseState.cxx deleted file mode 100644 index 758c57359..000000000 --- a/test/unit/testSparseState.cxx +++ /dev/null @@ -1,234 +0,0 @@ -// Unit Tests for Scintilla internal data structures - -#include <string> -#include <string_view> -#include <vector> -#include <algorithm> -#include <memory> - -#include "Platform.h" - -#include "Sci_Position.h" - -#include "SparseState.h" - -#include "catch.hpp" - -using namespace Scintilla; - -// Test SparseState. - -TEST_CASE("SparseState") { - - SparseState<int> ss; - - SECTION("IsEmptyInitially") { - REQUIRE(0u == ss.size()); - int val = ss.ValueAt(0); - REQUIRE(0 == val); - } - - SECTION("SimpleSetAndGet") { - ss.Set(0, 22); - ss.Set(1, 23); - REQUIRE(2u == ss.size()); - REQUIRE(0 == ss.ValueAt(-1)); - REQUIRE(22 == ss.ValueAt(0)); - REQUIRE(23 == ss.ValueAt(1)); - REQUIRE(23 == ss.ValueAt(2)); - } - - SECTION("RetrieveBetween") { - ss.Set(0, 10); - ss.Set(2, 12); - REQUIRE(2u == ss.size()); - REQUIRE(0 == ss.ValueAt(-1)); - REQUIRE(10 == ss.ValueAt(0)); - REQUIRE(10 == ss.ValueAt(1)); - REQUIRE(12 == ss.ValueAt(2)); - } - - SECTION("RetrieveBefore") { - ss.Set(2, 12); - REQUIRE(1u == ss.size()); - REQUIRE(0 == ss.ValueAt(-1)); - REQUIRE(0 == ss.ValueAt(0)); - REQUIRE(0 == ss.ValueAt(1)); - REQUIRE(12 == ss.ValueAt(2)); - } - - SECTION("Delete") { - ss.Set(0, 30); - ss.Set(2, 32); - ss.Delete(2); - REQUIRE(1u == ss.size()); - REQUIRE(0 == ss.ValueAt(-1)); - REQUIRE(30 == ss.ValueAt(0)); - REQUIRE(30 == ss.ValueAt(1)); - REQUIRE(30 == ss.ValueAt(2)); - } - - SECTION("DeleteBetween") { - ss.Set(0, 30); - ss.Set(2, 32); - ss.Delete(1); - REQUIRE(1u == ss.size()); - REQUIRE(0 == ss.ValueAt(-1)); - REQUIRE(30 == ss.ValueAt(0)); - REQUIRE(30 == ss.ValueAt(1)); - REQUIRE(30 == ss.ValueAt(2)); - } - - SECTION("ReplaceLast") { - ss.Set(0, 30); - ss.Set(2, 31); - ss.Set(2, 32); - REQUIRE(2u == ss.size()); - REQUIRE(0 == ss.ValueAt(-1)); - REQUIRE(30 == ss.ValueAt(0)); - REQUIRE(30 == ss.ValueAt(1)); - REQUIRE(32 == ss.ValueAt(2)); - REQUIRE(32 == ss.ValueAt(3)); - } - - SECTION("OnlyChangeAppended") { - ss.Set(0, 30); - ss.Set(2, 31); - ss.Set(3, 31); - REQUIRE(2u == ss.size()); - } - - SECTION("MergeBetween") { - ss.Set(0, 30); - ss.Set(2, 32); - ss.Set(4, 34); - REQUIRE(3u == ss.size()); - - SparseState<int> ssAdditions(3); - ssAdditions.Set(4, 34); - REQUIRE(1u == ssAdditions.size()); - bool mergeChanged = ss.Merge(ssAdditions,5); - REQUIRE(false == mergeChanged); - - ssAdditions.Set(4, 44); - REQUIRE(1u == ssAdditions.size()); - mergeChanged = ss.Merge(ssAdditions,5); - REQUIRE(true == mergeChanged); - REQUIRE(3u == ss.size()); - REQUIRE(44 == ss.ValueAt(4)); - } - - SECTION("MergeAtExisting") { - ss.Set(0, 30); - ss.Set(2, 32); - ss.Set(4, 34); - REQUIRE(3u == ss.size()); - - SparseState<int> ssAdditions(4); - ssAdditions.Set(4, 34); - REQUIRE(1u == ssAdditions.size()); - bool mergeChanged = ss.Merge(ssAdditions,5); - REQUIRE(false == mergeChanged); - - ssAdditions.Set(4, 44); - REQUIRE(1u == ssAdditions.size()); - mergeChanged = ss.Merge(ssAdditions,5); - REQUIRE(true == mergeChanged); - REQUIRE(3u == ss.size()); - REQUIRE(44 == ss.ValueAt(4)); - } - - SECTION("MergeWhichRemoves") { - ss.Set(0, 30); - ss.Set(2, 32); - ss.Set(4, 34); - REQUIRE(3u == ss.size()); - - SparseState<int> ssAdditions(2); - ssAdditions.Set(2, 22); - REQUIRE(1u == ssAdditions.size()); - REQUIRE(22 == ssAdditions.ValueAt(2)); - bool mergeChanged = ss.Merge(ssAdditions,5); - REQUIRE(true == mergeChanged); - REQUIRE(2u == ss.size()); - REQUIRE(22 == ss.ValueAt(2)); - } - - SECTION("MergeIgnoreSome") { - ss.Set(0, 30); - ss.Set(2, 32); - ss.Set(4, 34); - - SparseState<int> ssAdditions(2); - ssAdditions.Set(2, 32); - bool mergeChanged = ss.Merge(ssAdditions,3); - - REQUIRE(false == mergeChanged); - REQUIRE(2u == ss.size()); - REQUIRE(32 == ss.ValueAt(2)); - } - - SECTION("MergeIgnoreSomeStart") { - ss.Set(0, 30); - ss.Set(2, 32); - ss.Set(4, 34); - - SparseState<int> ssAdditions(2); - ssAdditions.Set(2, 32); - bool mergeChanged = ss.Merge(ssAdditions,2); - - REQUIRE(false == mergeChanged); - REQUIRE(2u == ss.size()); - REQUIRE(32 == ss.ValueAt(2)); - } - - SECTION("MergeIgnoreRepeat") { - ss.Set(0, 30); - ss.Set(2, 32); - ss.Set(4, 34); - - SparseState<int> ssAdditions(5); - // Appending same value as at end of pss. - ssAdditions.Set(5, 34); - bool mergeChanged = ss.Merge(ssAdditions,6); - - REQUIRE(false == mergeChanged); - REQUIRE(3u == ss.size()); - REQUIRE(34 == ss.ValueAt(4)); - } - -} - -TEST_CASE("SparseStateString") { - - SparseState<std::string> ss; - - SECTION("IsEmptyInitially") { - REQUIRE(0u == ss.size()); - std::string val = ss.ValueAt(0); - REQUIRE("" == val); - } - - SECTION("SimpleSetAndGet") { - REQUIRE(0u == ss.size()); - ss.Set(0, "22"); - ss.Set(1, "23"); - REQUIRE(2u == ss.size()); - REQUIRE("" == ss.ValueAt(-1)); - REQUIRE("22" == ss.ValueAt(0)); - REQUIRE("23" == ss.ValueAt(1)); - REQUIRE("23" == ss.ValueAt(2)); - } - - SECTION("DeleteBetween") { - ss.Set(0, "30"); - ss.Set(2, "32"); - ss.Delete(1); - REQUIRE(1u == ss.size()); - REQUIRE("" == ss.ValueAt(-1)); - REQUIRE("30" == ss.ValueAt(0)); - REQUIRE("30" == ss.ValueAt(1)); - REQUIRE("30" == ss.ValueAt(2)); - } - -} diff --git a/test/unit/testWordList.cxx b/test/unit/testWordList.cxx deleted file mode 100644 index 3970d37d4..000000000 --- a/test/unit/testWordList.cxx +++ /dev/null @@ -1,87 +0,0 @@ -// Unit Tests for Scintilla internal data structures - -#include <string.h> - -#include "WordList.h" - -#include "catch.hpp" - -using namespace Scintilla; - -// Test WordList. - -TEST_CASE("WordList") { - - WordList wl; - - SECTION("IsEmptyInitially") { - REQUIRE(0 == wl.Length()); - REQUIRE(!wl.InList("struct")); - } - - SECTION("InList") { - wl.Set("else struct"); - REQUIRE(2 == wl.Length()); - REQUIRE(wl.InList("struct")); - REQUIRE(!wl.InList("class")); - } - - SECTION("Set") { - // Check whether Set returns whether it has changed correctly - const bool changed = wl.Set("else struct"); - REQUIRE(changed); - // Changing to same thing - const bool changed2 = wl.Set("else struct"); - REQUIRE(!changed2); - // Changed order shouldn't be seen as a change - const bool changed3 = wl.Set("struct else"); - REQUIRE(!changed3); - // Removing word is a change - const bool changed4 = wl.Set("struct"); - REQUIRE(changed4); - } - - SECTION("WordAt") { - wl.Set("else struct"); - REQUIRE(0 == strcmp(wl.WordAt(0), "else")); - } - - SECTION("InListAbbreviated") { - wl.Set("else stru~ct w~hile"); - REQUIRE(wl.InListAbbreviated("else", '~')); - - REQUIRE(wl.InListAbbreviated("struct", '~')); - REQUIRE(wl.InListAbbreviated("stru", '~')); - REQUIRE(wl.InListAbbreviated("struc", '~')); - REQUIRE(!wl.InListAbbreviated("str", '~')); - - REQUIRE(wl.InListAbbreviated("while", '~')); - REQUIRE(wl.InListAbbreviated("wh", '~')); - // TODO: Next line fails but should allow single character prefixes - //REQUIRE(wl.InListAbbreviated("w", '~')); - REQUIRE(!wl.InListAbbreviated("", '~')); - } - - SECTION("InListAbridged") { - wl.Set("list w.~.active bo~k a~z ~_frozen"); - REQUIRE(wl.InListAbridged("list", '~')); - - REQUIRE(wl.InListAbridged("w.front.active", '~')); - REQUIRE(wl.InListAbridged("w.x.active", '~')); - REQUIRE(wl.InListAbridged("w..active", '~')); - REQUIRE(!wl.InListAbridged("w.active", '~')); - REQUIRE(!wl.InListAbridged("w.x.closed", '~')); - - REQUIRE(wl.InListAbridged("book", '~')); - REQUIRE(wl.InListAbridged("bok", '~')); - REQUIRE(!wl.InListAbridged("bk", '~')); - - REQUIRE(wl.InListAbridged("a_frozen", '~')); - REQUIRE(wl.InListAbridged("_frozen", '~')); - REQUIRE(!wl.InListAbridged("frozen", '~')); - - REQUIRE(wl.InListAbridged("abcz", '~')); - REQUIRE(wl.InListAbridged("abz", '~')); - REQUIRE(wl.InListAbridged("az", '~')); - } -} diff --git a/win32/SciLexer.vcxproj b/win32/SciLexer.vcxproj deleted file mode 100644 index b72f87c22..000000000 --- a/win32/SciLexer.vcxproj +++ /dev/null @@ -1,171 +0,0 @@ -<?xml version="1.0" encoding="utf-8"?>
-<Project DefaultTargets="Build" ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <ItemGroup Label="ProjectConfigurations">
- <ProjectConfiguration Include="Debug|ARM64">
- <Configuration>Debug</Configuration>
- <Platform>ARM64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|Win32">
- <Configuration>Debug</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Debug|x64">
- <Configuration>Debug</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|ARM64">
- <Configuration>Release</Configuration>
- <Platform>ARM64</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|Win32">
- <Configuration>Release</Configuration>
- <Platform>Win32</Platform>
- </ProjectConfiguration>
- <ProjectConfiguration Include="Release|x64">
- <Configuration>Release</Configuration>
- <Platform>x64</Platform>
- </ProjectConfiguration>
- </ItemGroup>
- <PropertyGroup Label="Globals">
- <ProjectGuid>{FBE04237-9C7B-4973-9C60-505975998B39}</ProjectGuid>
- <Keyword>Win32Proj</Keyword>
- <RootNamespace>SciLexer</RootNamespace>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
- <PropertyGroup>
- <ConfigurationType>DynamicLibrary</ConfigurationType>
- <CharacterSet>Unicode</CharacterSet>
- <PlatformToolset>v141</PlatformToolset>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'" Label="Configuration">
- <UseDebugLibraries>true</UseDebugLibraries>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'" Label="Configuration">
- <UseDebugLibraries>false</UseDebugLibraries>
- <WholeProgramOptimization>true</WholeProgramOptimization>
- </PropertyGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
- <ImportGroup Label="ExtensionSettings">
- </ImportGroup>
- <ImportGroup Label="PropertySheets">
- <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
- </ImportGroup>
- <PropertyGroup Label="UserMacros" />
- <PropertyGroup>
- <LinkIncremental>false</LinkIncremental>
- </PropertyGroup>
- <ItemDefinitionGroup>
- <ClCompile>
- <WarningLevel>Level4</WarningLevel>
- <PreprocessorDefinitions>WIN32;SCI_LEXER;_CRT_SECURE_NO_DEPRECATE;_SCL_SECURE_NO_WARNINGS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <AdditionalIncludeDirectories>..\include;..\src;..\lexlib;</AdditionalIncludeDirectories>
- <BrowseInformation>true</BrowseInformation>
- <MultiProcessorCompilation>true</MultiProcessorCompilation>
- <MinimalRebuild>false</MinimalRebuild>
- <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
- </ClCompile>
- <Link>
- <SubSystem>Windows</SubSystem>
- <GenerateDebugInformation>true</GenerateDebugInformation>
- <AdditionalDependencies>gdi32.lib;imm32.lib;ole32.lib;oleaut32.lib;msimg32.lib;%(AdditionalDependencies)</AdditionalDependencies>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
- <ClCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
- <ClCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM64'">
- <ClCompile>
- <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <LinkTimeCodeGeneration>Default</LinkTimeCodeGeneration>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
- <ClCompile>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
- <ClCompile>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|ARM64'">
- <ClCompile>
- <FunctionLevelLinking>true</FunctionLevelLinking>
- <IntrinsicFunctions>true</IntrinsicFunctions>
- <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
- <LanguageStandard>stdcpp17</LanguageStandard>
- </ClCompile>
- <Link>
- <EnableCOMDATFolding>true</EnableCOMDATFolding>
- <OptimizeReferences>true</OptimizeReferences>
- </Link>
- </ItemDefinitionGroup>
- <ItemGroup>
- <ClCompile Include="..\lexers\*.cxx" />
- <ClCompile Include="..\lexlib\*.cxx" />
- <ClCompile Include="..\src\*.cxx" />
- <ClCompile Include="..\win32\HanjaDic.cxx" />
- <ClCompile Include="..\win32\PlatWin.cxx" />
- <ClCompile Include="..\win32\ScintillaWin.cxx" />
- <ClCompile Include="..\win32\ScintillaDLL.cxx" />
- </ItemGroup>
- <ItemGroup>
- <ClInclude Include="..\include\*.h" />
- <ClInclude Include="..\src\*.h" />
- <ClInclude Include="..\lexlib\*.h" />
- <ClInclude Include="..\win32\*.h" />
- </ItemGroup>
- <ItemGroup>
- <ResourceCompile Include="..\win32\ScintRes.rc" />
- </ItemGroup>
- <Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
- <ImportGroup Label="ExtensionTargets">
- </ImportGroup>
-</Project>
\ No newline at end of file |