Apply patch (plus some additional changes) upgrading Scintilla to version 2.03. Closes #11765, #11748, #11346

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@63792 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2010-03-30 03:50:06 +00:00
parent a7d354c6d7
commit 9e96e16fe0
125 changed files with 17134 additions and 6735 deletions

View File

@@ -246,6 +246,7 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_LexCSS.o \ wxscintilla_LexCSS.o \
wxscintilla_LexCaml.o \ wxscintilla_LexCaml.o \
wxscintilla_LexCsound.o \ wxscintilla_LexCsound.o \
wxscintilla_LexCOBOL.o \
wxscintilla_LexConf.o \ wxscintilla_LexConf.o \
wxscintilla_LexCrontab.o \ wxscintilla_LexCrontab.o \
wxscintilla_LexD.o \ wxscintilla_LexD.o \
@@ -264,11 +265,14 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_LexLisp.o \ wxscintilla_LexLisp.o \
wxscintilla_LexLout.o \ wxscintilla_LexLout.o \
wxscintilla_LexLua.o \ wxscintilla_LexLua.o \
wxscintilla_LexMagik.o \
wxscintilla_LexMMIXAL.o \ wxscintilla_LexMMIXAL.o \
wxscintilla_LexMPT.o \ wxscintilla_LexMPT.o \
wxscintilla_LexMSSQL.o \ wxscintilla_LexMSSQL.o \
wxscintilla_LexMatlab.o \ wxscintilla_LexMatlab.o \
wxscintilla_LexMetapost.o \ wxscintilla_LexMetapost.o \
wxscintilla_LexMySQL.o \
wxscintilla_LexNimrod.o \
wxscintilla_LexNsis.o \ wxscintilla_LexNsis.o \
wxscintilla_LexOpal.o \ wxscintilla_LexOpal.o \
wxscintilla_LexOthers.o \ wxscintilla_LexOthers.o \
@@ -279,16 +283,22 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_LexPS.o \ wxscintilla_LexPS.o \
wxscintilla_LexPascal.o \ wxscintilla_LexPascal.o \
wxscintilla_LexPerl.o \ wxscintilla_LexPerl.o \
wxscintilla_LexPowerPro.o \
wxscintilla_LexPowerShell.o \
wxscintilla_LexPython.o \ wxscintilla_LexPython.o \
wxscintilla_LexR.o \ wxscintilla_LexR.o \
wxscintilla_LexRebol.o \ wxscintilla_LexRebol.o \
wxscintilla_LexRuby.o \ wxscintilla_LexRuby.o \
wxscintilla_LexSQL.o \ wxscintilla_LexSQL.o \
wxscintilla_LexSML.o \
wxscintilla_LexSmalltalk.o \ wxscintilla_LexSmalltalk.o \
wxscintilla_LexTADS3.o \ wxscintilla_LexTADS3.o \
wxscintilla_LexScriptol.o \ wxscintilla_LexScriptol.o \
wxscintilla_LexSpecman.o \ wxscintilla_LexSpecman.o \
wxscintilla_LexSorcus.o \
wxscintilla_LexSpice.o \ wxscintilla_LexSpice.o \
wxscintilla_LexTAL.o \
wxscintilla_LexTACL.o \
wxscintilla_LexTCL.o \ wxscintilla_LexTCL.o \
wxscintilla_LexTeX.o \ wxscintilla_LexTeX.o \
wxscintilla_LexVB.o \ wxscintilla_LexVB.o \
@@ -296,17 +306,21 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_LexVerilog.o \ wxscintilla_LexVerilog.o \
wxscintilla_LexYAML.o \ wxscintilla_LexYAML.o \
wxscintilla_LineMarker.o \ wxscintilla_LineMarker.o \
wxscintilla_PerLine.o \
wxscintilla_PositionCache.o \ wxscintilla_PositionCache.o \
wxscintilla_PropSet.o \ wxscintilla_PropSet.o \
wxscintilla_RESearch.o \ wxscintilla_RESearch.o \
wxscintilla_RunStyles.o \ wxscintilla_RunStyles.o \
wxscintilla_Selection.o \
wxscintilla_ScintillaBase.o \ wxscintilla_ScintillaBase.o \
wxscintilla_Style.o \ wxscintilla_Style.o \
wxscintilla_StyleContext.o \ wxscintilla_StyleContext.o \
wxscintilla_UniConversion.o \ wxscintilla_UniConversion.o \
wxscintilla_ViewStyle.o \ wxscintilla_ViewStyle.o \
wxscintilla_WindowAccessor.o \ wxscintilla_WindowAccessor.o \
wxscintilla_XPM.o wxscintilla_XPM.o \
wxscintilla_LexMarkdown.o \
wxscintilla_Array.o
PLUGINS_INST_DIR = $(libdir)/wx/$(PLUGIN_VERSION0) PLUGINS_INST_DIR = $(libdir)/wx/$(PLUGIN_VERSION0)
ALL_BASE_HEADERS = \ ALL_BASE_HEADERS = \
wx/afterstd.h \ wx/afterstd.h \
@@ -14501,6 +14515,9 @@ wxscintilla_LexCaml.o: $(srcdir)/src/stc/scintilla/src/LexCaml.cxx
wxscintilla_LexCsound.o: $(srcdir)/src/stc/scintilla/src/LexCsound.cxx wxscintilla_LexCsound.o: $(srcdir)/src/stc/scintilla/src/LexCsound.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexCsound.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexCsound.cxx
wxscintilla_LexCOBOL.o: $(srcdir)/src/stc/scintilla/src/LexCOBOL.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexCOBOL.cxx
wxscintilla_LexConf.o: $(srcdir)/src/stc/scintilla/src/LexConf.cxx wxscintilla_LexConf.o: $(srcdir)/src/stc/scintilla/src/LexConf.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexConf.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexConf.cxx
@@ -14555,6 +14572,9 @@ wxscintilla_LexLout.o: $(srcdir)/src/stc/scintilla/src/LexLout.cxx
wxscintilla_LexLua.o: $(srcdir)/src/stc/scintilla/src/LexLua.cxx wxscintilla_LexLua.o: $(srcdir)/src/stc/scintilla/src/LexLua.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexLua.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexLua.cxx
wxscintilla_LexMagik.o: $(srcdir)/src/stc/scintilla/src/LexMagik.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexMagik.cxx
wxscintilla_LexMMIXAL.o: $(srcdir)/src/stc/scintilla/src/LexMMIXAL.cxx wxscintilla_LexMMIXAL.o: $(srcdir)/src/stc/scintilla/src/LexMMIXAL.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexMMIXAL.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexMMIXAL.cxx
@@ -14570,6 +14590,12 @@ wxscintilla_LexMatlab.o: $(srcdir)/src/stc/scintilla/src/LexMatlab.cxx
wxscintilla_LexMetapost.o: $(srcdir)/src/stc/scintilla/src/LexMetapost.cxx wxscintilla_LexMetapost.o: $(srcdir)/src/stc/scintilla/src/LexMetapost.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexMetapost.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexMetapost.cxx
wxscintilla_LexMySQL.o: $(srcdir)/src/stc/scintilla/src/LexMySQL.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexMySQL.cxx
wxscintilla_LexNimrod.o: $(srcdir)/src/stc/scintilla/src/LexNimrod.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexNimrod.cxx
wxscintilla_LexNsis.o: $(srcdir)/src/stc/scintilla/src/LexNsis.cxx wxscintilla_LexNsis.o: $(srcdir)/src/stc/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexNsis.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexNsis.cxx
@@ -14600,6 +14626,12 @@ wxscintilla_LexPascal.o: $(srcdir)/src/stc/scintilla/src/LexPascal.cxx
wxscintilla_LexPerl.o: $(srcdir)/src/stc/scintilla/src/LexPerl.cxx wxscintilla_LexPerl.o: $(srcdir)/src/stc/scintilla/src/LexPerl.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPerl.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPerl.cxx
wxscintilla_LexPowerPro.o: $(srcdir)/src/stc/scintilla/src/LexPowerPro.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPowerPro.cxx
wxscintilla_LexPowerShell.o: $(srcdir)/src/stc/scintilla/src/LexPowerShell.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPowerShell.cxx
wxscintilla_LexPython.o: $(srcdir)/src/stc/scintilla/src/LexPython.cxx wxscintilla_LexPython.o: $(srcdir)/src/stc/scintilla/src/LexPython.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPython.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexPython.cxx
@@ -14615,6 +14647,9 @@ wxscintilla_LexRuby.o: $(srcdir)/src/stc/scintilla/src/LexRuby.cxx
wxscintilla_LexSQL.o: $(srcdir)/src/stc/scintilla/src/LexSQL.cxx wxscintilla_LexSQL.o: $(srcdir)/src/stc/scintilla/src/LexSQL.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSQL.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSQL.cxx
wxscintilla_LexSML.o: $(srcdir)/src/stc/scintilla/src/LexSML.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSML.cxx
wxscintilla_LexSmalltalk.o: $(srcdir)/src/stc/scintilla/src/LexSmalltalk.cxx wxscintilla_LexSmalltalk.o: $(srcdir)/src/stc/scintilla/src/LexSmalltalk.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSmalltalk.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSmalltalk.cxx
@@ -14627,9 +14662,18 @@ wxscintilla_LexScriptol.o: $(srcdir)/src/stc/scintilla/src/LexScriptol.cxx
wxscintilla_LexSpecman.o: $(srcdir)/src/stc/scintilla/src/LexSpecman.cxx wxscintilla_LexSpecman.o: $(srcdir)/src/stc/scintilla/src/LexSpecman.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSpecman.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSpecman.cxx
wxscintilla_LexSorcus.o: $(srcdir)/src/stc/scintilla/src/LexSorcus.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSorcus.cxx
wxscintilla_LexSpice.o: $(srcdir)/src/stc/scintilla/src/LexSpice.cxx wxscintilla_LexSpice.o: $(srcdir)/src/stc/scintilla/src/LexSpice.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSpice.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexSpice.cxx
wxscintilla_LexTAL.o: $(srcdir)/src/stc/scintilla/src/LexTAL.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexTAL.cxx
wxscintilla_LexTACL.o: $(srcdir)/src/stc/scintilla/src/LexTACL.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexTACL.cxx
wxscintilla_LexTCL.o: $(srcdir)/src/stc/scintilla/src/LexTCL.cxx wxscintilla_LexTCL.o: $(srcdir)/src/stc/scintilla/src/LexTCL.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexTCL.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexTCL.cxx
@@ -14651,6 +14695,9 @@ wxscintilla_LexYAML.o: $(srcdir)/src/stc/scintilla/src/LexYAML.cxx
wxscintilla_LineMarker.o: $(srcdir)/src/stc/scintilla/src/LineMarker.cxx wxscintilla_LineMarker.o: $(srcdir)/src/stc/scintilla/src/LineMarker.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LineMarker.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LineMarker.cxx
wxscintilla_PerLine.o: $(srcdir)/src/stc/scintilla/src/PerLine.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/PerLine.cxx
wxscintilla_PositionCache.o: $(srcdir)/src/stc/scintilla/src/PositionCache.cxx wxscintilla_PositionCache.o: $(srcdir)/src/stc/scintilla/src/PositionCache.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/PositionCache.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/PositionCache.cxx
@@ -14663,6 +14710,9 @@ wxscintilla_RESearch.o: $(srcdir)/src/stc/scintilla/src/RESearch.cxx
wxscintilla_RunStyles.o: $(srcdir)/src/stc/scintilla/src/RunStyles.cxx wxscintilla_RunStyles.o: $(srcdir)/src/stc/scintilla/src/RunStyles.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/RunStyles.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/RunStyles.cxx
wxscintilla_Selection.o: $(srcdir)/src/stc/scintilla/src/Selection.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/Selection.cxx
wxscintilla_ScintillaBase.o: $(srcdir)/src/stc/scintilla/src/ScintillaBase.cxx wxscintilla_ScintillaBase.o: $(srcdir)/src/stc/scintilla/src/ScintillaBase.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/ScintillaBase.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/ScintillaBase.cxx
@@ -14684,6 +14734,12 @@ wxscintilla_WindowAccessor.o: $(srcdir)/src/stc/scintilla/src/WindowAccessor.cxx
wxscintilla_XPM.o: $(srcdir)/src/stc/scintilla/src/XPM.cxx wxscintilla_XPM.o: $(srcdir)/src/stc/scintilla/src/XPM.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/XPM.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/XPM.cxx
wxscintilla_LexMarkdown.o: $(srcdir)/src/stc/scintilla/src/LexMarkdown.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/LexMarkdown.cxx
wxscintilla_Array.o: $(srcdir)/src/stc/scintilla/src/Array.cpp
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/Array.cpp
monodll_any.o: $(srcdir)/src/common/any.cpp $(MONODLL_ODEP) monodll_any.o: $(srcdir)/src/common/any.cpp $(MONODLL_ODEP)
$(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/any.cpp $(CXXC) -c -o $@ $(MONODLL_CXXFLAGS) $(srcdir)/src/common/any.cpp

View File

@@ -69,6 +69,7 @@
src/stc/scintilla/src/LexCSS.cxx src/stc/scintilla/src/LexCSS.cxx
src/stc/scintilla/src/LexCaml.cxx src/stc/scintilla/src/LexCaml.cxx
src/stc/scintilla/src/LexCsound.cxx src/stc/scintilla/src/LexCsound.cxx
src/stc/scintilla/src/LexCOBOL.cxx
src/stc/scintilla/src/LexConf.cxx src/stc/scintilla/src/LexConf.cxx
src/stc/scintilla/src/LexCrontab.cxx src/stc/scintilla/src/LexCrontab.cxx
src/stc/scintilla/src/LexD.cxx src/stc/scintilla/src/LexD.cxx
@@ -87,11 +88,14 @@
src/stc/scintilla/src/LexLisp.cxx src/stc/scintilla/src/LexLisp.cxx
src/stc/scintilla/src/LexLout.cxx src/stc/scintilla/src/LexLout.cxx
src/stc/scintilla/src/LexLua.cxx src/stc/scintilla/src/LexLua.cxx
src/stc/scintilla/src/LexMagik.cxx
src/stc/scintilla/src/LexMMIXAL.cxx src/stc/scintilla/src/LexMMIXAL.cxx
src/stc/scintilla/src/LexMPT.cxx src/stc/scintilla/src/LexMPT.cxx
src/stc/scintilla/src/LexMSSQL.cxx src/stc/scintilla/src/LexMSSQL.cxx
src/stc/scintilla/src/LexMatlab.cxx src/stc/scintilla/src/LexMatlab.cxx
src/stc/scintilla/src/LexMetapost.cxx src/stc/scintilla/src/LexMetapost.cxx
src/stc/scintilla/src/LexMySQL.cxx
src/stc/scintilla/src/LexNimrod.cxx
src/stc/scintilla/src/LexNsis.cxx src/stc/scintilla/src/LexNsis.cxx
src/stc/scintilla/src/LexOpal.cxx src/stc/scintilla/src/LexOpal.cxx
src/stc/scintilla/src/LexOthers.cxx src/stc/scintilla/src/LexOthers.cxx
@@ -102,16 +106,22 @@
src/stc/scintilla/src/LexPS.cxx src/stc/scintilla/src/LexPS.cxx
src/stc/scintilla/src/LexPascal.cxx src/stc/scintilla/src/LexPascal.cxx
src/stc/scintilla/src/LexPerl.cxx src/stc/scintilla/src/LexPerl.cxx
src/stc/scintilla/src/LexPowerPro.cxx
src/stc/scintilla/src/LexPowerShell.cxx
src/stc/scintilla/src/LexPython.cxx src/stc/scintilla/src/LexPython.cxx
src/stc/scintilla/src/LexR.cxx src/stc/scintilla/src/LexR.cxx
src/stc/scintilla/src/LexRebol.cxx src/stc/scintilla/src/LexRebol.cxx
src/stc/scintilla/src/LexRuby.cxx src/stc/scintilla/src/LexRuby.cxx
src/stc/scintilla/src/LexSQL.cxx src/stc/scintilla/src/LexSQL.cxx
src/stc/scintilla/src/LexSML.cxx
src/stc/scintilla/src/LexSmalltalk.cxx src/stc/scintilla/src/LexSmalltalk.cxx
src/stc/scintilla/src/LexTADS3.cxx src/stc/scintilla/src/LexTADS3.cxx
src/stc/scintilla/src/LexScriptol.cxx src/stc/scintilla/src/LexScriptol.cxx
src/stc/scintilla/src/LexSpecman.cxx src/stc/scintilla/src/LexSpecman.cxx
src/stc/scintilla/src/LexSorcus.cxx
src/stc/scintilla/src/LexSpice.cxx src/stc/scintilla/src/LexSpice.cxx
src/stc/scintilla/src/LexTAL.cxx
src/stc/scintilla/src/LexTACL.cxx
src/stc/scintilla/src/LexTCL.cxx src/stc/scintilla/src/LexTCL.cxx
src/stc/scintilla/src/LexTeX.cxx src/stc/scintilla/src/LexTeX.cxx
src/stc/scintilla/src/LexVB.cxx src/stc/scintilla/src/LexVB.cxx
@@ -119,10 +129,12 @@
src/stc/scintilla/src/LexVerilog.cxx src/stc/scintilla/src/LexVerilog.cxx
src/stc/scintilla/src/LexYAML.cxx src/stc/scintilla/src/LexYAML.cxx
src/stc/scintilla/src/LineMarker.cxx src/stc/scintilla/src/LineMarker.cxx
src/stc/scintilla/src/PerLine.cxx
src/stc/scintilla/src/PositionCache.cxx src/stc/scintilla/src/PositionCache.cxx
src/stc/scintilla/src/PropSet.cxx src/stc/scintilla/src/PropSet.cxx
src/stc/scintilla/src/RESearch.cxx src/stc/scintilla/src/RESearch.cxx
src/stc/scintilla/src/RunStyles.cxx src/stc/scintilla/src/RunStyles.cxx
src/stc/scintilla/src/Selection.cxx
src/stc/scintilla/src/ScintillaBase.cxx src/stc/scintilla/src/ScintillaBase.cxx
src/stc/scintilla/src/Style.cxx src/stc/scintilla/src/Style.cxx
src/stc/scintilla/src/StyleContext.cxx src/stc/scintilla/src/StyleContext.cxx
@@ -130,6 +142,8 @@
src/stc/scintilla/src/ViewStyle.cxx src/stc/scintilla/src/ViewStyle.cxx
src/stc/scintilla/src/WindowAccessor.cxx src/stc/scintilla/src/WindowAccessor.cxx
src/stc/scintilla/src/XPM.cxx src/stc/scintilla/src/XPM.cxx
src/stc/scintilla/src/LexMarkdown.cxx
src/stc/scintilla/src/Array.cpp
</sources> </sources>
</lib> </lib>

View File

@@ -227,6 +227,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexCSS.obj \ $(OBJS)\wxscintilla_LexCSS.obj \
$(OBJS)\wxscintilla_LexCaml.obj \ $(OBJS)\wxscintilla_LexCaml.obj \
$(OBJS)\wxscintilla_LexCsound.obj \ $(OBJS)\wxscintilla_LexCsound.obj \
$(OBJS)\wxscintilla_LexCOBOL.obj \
$(OBJS)\wxscintilla_LexConf.obj \ $(OBJS)\wxscintilla_LexConf.obj \
$(OBJS)\wxscintilla_LexCrontab.obj \ $(OBJS)\wxscintilla_LexCrontab.obj \
$(OBJS)\wxscintilla_LexD.obj \ $(OBJS)\wxscintilla_LexD.obj \
@@ -245,11 +246,14 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexLisp.obj \ $(OBJS)\wxscintilla_LexLisp.obj \
$(OBJS)\wxscintilla_LexLout.obj \ $(OBJS)\wxscintilla_LexLout.obj \
$(OBJS)\wxscintilla_LexLua.obj \ $(OBJS)\wxscintilla_LexLua.obj \
$(OBJS)\wxscintilla_LexMagik.obj \
$(OBJS)\wxscintilla_LexMMIXAL.obj \ $(OBJS)\wxscintilla_LexMMIXAL.obj \
$(OBJS)\wxscintilla_LexMPT.obj \ $(OBJS)\wxscintilla_LexMPT.obj \
$(OBJS)\wxscintilla_LexMSSQL.obj \ $(OBJS)\wxscintilla_LexMSSQL.obj \
$(OBJS)\wxscintilla_LexMatlab.obj \ $(OBJS)\wxscintilla_LexMatlab.obj \
$(OBJS)\wxscintilla_LexMetapost.obj \ $(OBJS)\wxscintilla_LexMetapost.obj \
$(OBJS)\wxscintilla_LexMySQL.obj \
$(OBJS)\wxscintilla_LexNimrod.obj \
$(OBJS)\wxscintilla_LexNsis.obj \ $(OBJS)\wxscintilla_LexNsis.obj \
$(OBJS)\wxscintilla_LexOpal.obj \ $(OBJS)\wxscintilla_LexOpal.obj \
$(OBJS)\wxscintilla_LexOthers.obj \ $(OBJS)\wxscintilla_LexOthers.obj \
@@ -260,16 +264,22 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexPS.obj \ $(OBJS)\wxscintilla_LexPS.obj \
$(OBJS)\wxscintilla_LexPascal.obj \ $(OBJS)\wxscintilla_LexPascal.obj \
$(OBJS)\wxscintilla_LexPerl.obj \ $(OBJS)\wxscintilla_LexPerl.obj \
$(OBJS)\wxscintilla_LexPowerPro.obj \
$(OBJS)\wxscintilla_LexPowerShell.obj \
$(OBJS)\wxscintilla_LexPython.obj \ $(OBJS)\wxscintilla_LexPython.obj \
$(OBJS)\wxscintilla_LexR.obj \ $(OBJS)\wxscintilla_LexR.obj \
$(OBJS)\wxscintilla_LexRebol.obj \ $(OBJS)\wxscintilla_LexRebol.obj \
$(OBJS)\wxscintilla_LexRuby.obj \ $(OBJS)\wxscintilla_LexRuby.obj \
$(OBJS)\wxscintilla_LexSQL.obj \ $(OBJS)\wxscintilla_LexSQL.obj \
$(OBJS)\wxscintilla_LexSML.obj \
$(OBJS)\wxscintilla_LexSmalltalk.obj \ $(OBJS)\wxscintilla_LexSmalltalk.obj \
$(OBJS)\wxscintilla_LexTADS3.obj \ $(OBJS)\wxscintilla_LexTADS3.obj \
$(OBJS)\wxscintilla_LexScriptol.obj \ $(OBJS)\wxscintilla_LexScriptol.obj \
$(OBJS)\wxscintilla_LexSpecman.obj \ $(OBJS)\wxscintilla_LexSpecman.obj \
$(OBJS)\wxscintilla_LexSorcus.obj \
$(OBJS)\wxscintilla_LexSpice.obj \ $(OBJS)\wxscintilla_LexSpice.obj \
$(OBJS)\wxscintilla_LexTAL.obj \
$(OBJS)\wxscintilla_LexTACL.obj \
$(OBJS)\wxscintilla_LexTCL.obj \ $(OBJS)\wxscintilla_LexTCL.obj \
$(OBJS)\wxscintilla_LexTeX.obj \ $(OBJS)\wxscintilla_LexTeX.obj \
$(OBJS)\wxscintilla_LexVB.obj \ $(OBJS)\wxscintilla_LexVB.obj \
@@ -277,17 +287,21 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexVerilog.obj \ $(OBJS)\wxscintilla_LexVerilog.obj \
$(OBJS)\wxscintilla_LexYAML.obj \ $(OBJS)\wxscintilla_LexYAML.obj \
$(OBJS)\wxscintilla_LineMarker.obj \ $(OBJS)\wxscintilla_LineMarker.obj \
$(OBJS)\wxscintilla_PerLine.obj \
$(OBJS)\wxscintilla_PositionCache.obj \ $(OBJS)\wxscintilla_PositionCache.obj \
$(OBJS)\wxscintilla_PropSet.obj \ $(OBJS)\wxscintilla_PropSet.obj \
$(OBJS)\wxscintilla_RESearch.obj \ $(OBJS)\wxscintilla_RESearch.obj \
$(OBJS)\wxscintilla_RunStyles.obj \ $(OBJS)\wxscintilla_RunStyles.obj \
$(OBJS)\wxscintilla_Selection.obj \
$(OBJS)\wxscintilla_ScintillaBase.obj \ $(OBJS)\wxscintilla_ScintillaBase.obj \
$(OBJS)\wxscintilla_Style.obj \ $(OBJS)\wxscintilla_Style.obj \
$(OBJS)\wxscintilla_StyleContext.obj \ $(OBJS)\wxscintilla_StyleContext.obj \
$(OBJS)\wxscintilla_UniConversion.obj \ $(OBJS)\wxscintilla_UniConversion.obj \
$(OBJS)\wxscintilla_ViewStyle.obj \ $(OBJS)\wxscintilla_ViewStyle.obj \
$(OBJS)\wxscintilla_WindowAccessor.obj \ $(OBJS)\wxscintilla_WindowAccessor.obj \
$(OBJS)\wxscintilla_XPM.obj $(OBJS)\wxscintilla_XPM.obj \
$(OBJS)\wxscintilla_LexMarkdown.obj \
$(OBJS)\wxscintilla_Array.obj
MONODLL_CFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \ MONODLL_CFLAGS = $(__RUNTIME_LIBS) -I$(BCCDIR)\include $(__DEBUGINFO) \
$(__OPTIMIZEFLAG) $(__THREADSFLAG) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \ $(__OPTIMIZEFLAG) $(__THREADSFLAG) -D__WXMSW__ $(__WXUNIV_DEFINE_p) \
$(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \ $(__DEBUG_DEFINE_p) $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) \
@@ -5434,6 +5448,9 @@ $(OBJS)\wxscintilla_LexCaml.obj: ..\..\src\stc\scintilla\src\LexCaml.cxx
$(OBJS)\wxscintilla_LexCsound.obj: ..\..\src\stc\scintilla\src\LexCsound.cxx $(OBJS)\wxscintilla_LexCsound.obj: ..\..\src\stc\scintilla\src\LexCsound.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexCsound.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexCsound.cxx
$(OBJS)\wxscintilla_LexCOBOL.obj: ..\..\src\stc\scintilla\src\LexCOBOL.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexCOBOL.cxx
$(OBJS)\wxscintilla_LexConf.obj: ..\..\src\stc\scintilla\src\LexConf.cxx $(OBJS)\wxscintilla_LexConf.obj: ..\..\src\stc\scintilla\src\LexConf.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexConf.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexConf.cxx
@@ -5488,6 +5505,9 @@ $(OBJS)\wxscintilla_LexLout.obj: ..\..\src\stc\scintilla\src\LexLout.cxx
$(OBJS)\wxscintilla_LexLua.obj: ..\..\src\stc\scintilla\src\LexLua.cxx $(OBJS)\wxscintilla_LexLua.obj: ..\..\src\stc\scintilla\src\LexLua.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexLua.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexLua.cxx
$(OBJS)\wxscintilla_LexMagik.obj: ..\..\src\stc\scintilla\src\LexMagik.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMagik.cxx
$(OBJS)\wxscintilla_LexMMIXAL.obj: ..\..\src\stc\scintilla\src\LexMMIXAL.cxx $(OBJS)\wxscintilla_LexMMIXAL.obj: ..\..\src\stc\scintilla\src\LexMMIXAL.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMMIXAL.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMMIXAL.cxx
@@ -5503,6 +5523,12 @@ $(OBJS)\wxscintilla_LexMatlab.obj: ..\..\src\stc\scintilla\src\LexMatlab.cxx
$(OBJS)\wxscintilla_LexMetapost.obj: ..\..\src\stc\scintilla\src\LexMetapost.cxx $(OBJS)\wxscintilla_LexMetapost.obj: ..\..\src\stc\scintilla\src\LexMetapost.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMetapost.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMetapost.cxx
$(OBJS)\wxscintilla_LexMySQL.obj: ..\..\src\stc\scintilla\src\LexMySQL.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMySQL.cxx
$(OBJS)\wxscintilla_LexNimrod.obj: ..\..\src\stc\scintilla\src\LexNimrod.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexNimrod.cxx
$(OBJS)\wxscintilla_LexNsis.obj: ..\..\src\stc\scintilla\src\LexNsis.cxx $(OBJS)\wxscintilla_LexNsis.obj: ..\..\src\stc\scintilla\src\LexNsis.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexNsis.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexNsis.cxx
@@ -5533,6 +5559,12 @@ $(OBJS)\wxscintilla_LexPascal.obj: ..\..\src\stc\scintilla\src\LexPascal.cxx
$(OBJS)\wxscintilla_LexPerl.obj: ..\..\src\stc\scintilla\src\LexPerl.cxx $(OBJS)\wxscintilla_LexPerl.obj: ..\..\src\stc\scintilla\src\LexPerl.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPerl.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPerl.cxx
$(OBJS)\wxscintilla_LexPowerPro.obj: ..\..\src\stc\scintilla\src\LexPowerPro.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPowerPro.cxx
$(OBJS)\wxscintilla_LexPowerShell.obj: ..\..\src\stc\scintilla\src\LexPowerShell.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPowerShell.cxx
$(OBJS)\wxscintilla_LexPython.obj: ..\..\src\stc\scintilla\src\LexPython.cxx $(OBJS)\wxscintilla_LexPython.obj: ..\..\src\stc\scintilla\src\LexPython.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPython.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPython.cxx
@@ -5548,6 +5580,9 @@ $(OBJS)\wxscintilla_LexRuby.obj: ..\..\src\stc\scintilla\src\LexRuby.cxx
$(OBJS)\wxscintilla_LexSQL.obj: ..\..\src\stc\scintilla\src\LexSQL.cxx $(OBJS)\wxscintilla_LexSQL.obj: ..\..\src\stc\scintilla\src\LexSQL.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSQL.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSQL.cxx
$(OBJS)\wxscintilla_LexSML.obj: ..\..\src\stc\scintilla\src\LexSML.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSML.cxx
$(OBJS)\wxscintilla_LexSmalltalk.obj: ..\..\src\stc\scintilla\src\LexSmalltalk.cxx $(OBJS)\wxscintilla_LexSmalltalk.obj: ..\..\src\stc\scintilla\src\LexSmalltalk.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSmalltalk.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSmalltalk.cxx
@@ -5560,9 +5595,18 @@ $(OBJS)\wxscintilla_LexScriptol.obj: ..\..\src\stc\scintilla\src\LexScriptol.cxx
$(OBJS)\wxscintilla_LexSpecman.obj: ..\..\src\stc\scintilla\src\LexSpecman.cxx $(OBJS)\wxscintilla_LexSpecman.obj: ..\..\src\stc\scintilla\src\LexSpecman.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSpecman.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSpecman.cxx
$(OBJS)\wxscintilla_LexSorcus.obj: ..\..\src\stc\scintilla\src\LexSorcus.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSorcus.cxx
$(OBJS)\wxscintilla_LexSpice.obj: ..\..\src\stc\scintilla\src\LexSpice.cxx $(OBJS)\wxscintilla_LexSpice.obj: ..\..\src\stc\scintilla\src\LexSpice.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSpice.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSpice.cxx
$(OBJS)\wxscintilla_LexTAL.obj: ..\..\src\stc\scintilla\src\LexTAL.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexTAL.cxx
$(OBJS)\wxscintilla_LexTACL.obj: ..\..\src\stc\scintilla\src\LexTACL.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexTACL.cxx
$(OBJS)\wxscintilla_LexTCL.obj: ..\..\src\stc\scintilla\src\LexTCL.cxx $(OBJS)\wxscintilla_LexTCL.obj: ..\..\src\stc\scintilla\src\LexTCL.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexTCL.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexTCL.cxx
@@ -5584,6 +5628,9 @@ $(OBJS)\wxscintilla_LexYAML.obj: ..\..\src\stc\scintilla\src\LexYAML.cxx
$(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx $(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LineMarker.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LineMarker.cxx
$(OBJS)\wxscintilla_PerLine.obj: ..\..\src\stc\scintilla\src\PerLine.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PerLine.cxx
$(OBJS)\wxscintilla_PositionCache.obj: ..\..\src\stc\scintilla\src\PositionCache.cxx $(OBJS)\wxscintilla_PositionCache.obj: ..\..\src\stc\scintilla\src\PositionCache.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PositionCache.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PositionCache.cxx
@@ -5596,6 +5643,9 @@ $(OBJS)\wxscintilla_RESearch.obj: ..\..\src\stc\scintilla\src\RESearch.cxx
$(OBJS)\wxscintilla_RunStyles.obj: ..\..\src\stc\scintilla\src\RunStyles.cxx $(OBJS)\wxscintilla_RunStyles.obj: ..\..\src\stc\scintilla\src\RunStyles.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\RunStyles.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\RunStyles.cxx
$(OBJS)\wxscintilla_Selection.obj: ..\..\src\stc\scintilla\src\Selection.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Selection.cxx
$(OBJS)\wxscintilla_ScintillaBase.obj: ..\..\src\stc\scintilla\src\ScintillaBase.cxx $(OBJS)\wxscintilla_ScintillaBase.obj: ..\..\src\stc\scintilla\src\ScintillaBase.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\ScintillaBase.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\ScintillaBase.cxx
@@ -5617,6 +5667,12 @@ $(OBJS)\wxscintilla_WindowAccessor.obj: ..\..\src\stc\scintilla\src\WindowAccess
$(OBJS)\wxscintilla_XPM.obj: ..\..\src\stc\scintilla\src\XPM.cxx $(OBJS)\wxscintilla_XPM.obj: ..\..\src\stc\scintilla\src\XPM.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\XPM.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\XPM.cxx
$(OBJS)\wxscintilla_LexMarkdown.obj: ..\..\src\stc\scintilla\src\LexMarkdown.cxx
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMarkdown.cxx
$(OBJS)\wxscintilla_Array.obj: ..\..\src\stc\scintilla\src\Array.cpp
$(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Array.cpp
$(OBJS)\monodll_dummy.obj: ..\..\src\common\dummy.cpp $(OBJS)\monodll_dummy.obj: ..\..\src\common\dummy.cpp
$(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) -H ..\..\src\common\dummy.cpp $(CXX) -q -c -P -o$@ $(MONODLL_CXXFLAGS) -H ..\..\src\common\dummy.cpp

View File

@@ -214,6 +214,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexCSS.o \ $(OBJS)\wxscintilla_LexCSS.o \
$(OBJS)\wxscintilla_LexCaml.o \ $(OBJS)\wxscintilla_LexCaml.o \
$(OBJS)\wxscintilla_LexCsound.o \ $(OBJS)\wxscintilla_LexCsound.o \
$(OBJS)\wxscintilla_LexCOBOL.o \
$(OBJS)\wxscintilla_LexConf.o \ $(OBJS)\wxscintilla_LexConf.o \
$(OBJS)\wxscintilla_LexCrontab.o \ $(OBJS)\wxscintilla_LexCrontab.o \
$(OBJS)\wxscintilla_LexD.o \ $(OBJS)\wxscintilla_LexD.o \
@@ -232,11 +233,14 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexLisp.o \ $(OBJS)\wxscintilla_LexLisp.o \
$(OBJS)\wxscintilla_LexLout.o \ $(OBJS)\wxscintilla_LexLout.o \
$(OBJS)\wxscintilla_LexLua.o \ $(OBJS)\wxscintilla_LexLua.o \
$(OBJS)\wxscintilla_LexMagik.o \
$(OBJS)\wxscintilla_LexMMIXAL.o \ $(OBJS)\wxscintilla_LexMMIXAL.o \
$(OBJS)\wxscintilla_LexMPT.o \ $(OBJS)\wxscintilla_LexMPT.o \
$(OBJS)\wxscintilla_LexMSSQL.o \ $(OBJS)\wxscintilla_LexMSSQL.o \
$(OBJS)\wxscintilla_LexMatlab.o \ $(OBJS)\wxscintilla_LexMatlab.o \
$(OBJS)\wxscintilla_LexMetapost.o \ $(OBJS)\wxscintilla_LexMetapost.o \
$(OBJS)\wxscintilla_LexMySQL.o \
$(OBJS)\wxscintilla_LexNimrod.o \
$(OBJS)\wxscintilla_LexNsis.o \ $(OBJS)\wxscintilla_LexNsis.o \
$(OBJS)\wxscintilla_LexOpal.o \ $(OBJS)\wxscintilla_LexOpal.o \
$(OBJS)\wxscintilla_LexOthers.o \ $(OBJS)\wxscintilla_LexOthers.o \
@@ -247,16 +251,22 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexPS.o \ $(OBJS)\wxscintilla_LexPS.o \
$(OBJS)\wxscintilla_LexPascal.o \ $(OBJS)\wxscintilla_LexPascal.o \
$(OBJS)\wxscintilla_LexPerl.o \ $(OBJS)\wxscintilla_LexPerl.o \
$(OBJS)\wxscintilla_LexPowerPro.o \
$(OBJS)\wxscintilla_LexPowerShell.o \
$(OBJS)\wxscintilla_LexPython.o \ $(OBJS)\wxscintilla_LexPython.o \
$(OBJS)\wxscintilla_LexR.o \ $(OBJS)\wxscintilla_LexR.o \
$(OBJS)\wxscintilla_LexRebol.o \ $(OBJS)\wxscintilla_LexRebol.o \
$(OBJS)\wxscintilla_LexRuby.o \ $(OBJS)\wxscintilla_LexRuby.o \
$(OBJS)\wxscintilla_LexSQL.o \ $(OBJS)\wxscintilla_LexSQL.o \
$(OBJS)\wxscintilla_LexSML.o \
$(OBJS)\wxscintilla_LexSmalltalk.o \ $(OBJS)\wxscintilla_LexSmalltalk.o \
$(OBJS)\wxscintilla_LexTADS3.o \ $(OBJS)\wxscintilla_LexTADS3.o \
$(OBJS)\wxscintilla_LexScriptol.o \ $(OBJS)\wxscintilla_LexScriptol.o \
$(OBJS)\wxscintilla_LexSpecman.o \ $(OBJS)\wxscintilla_LexSpecman.o \
$(OBJS)\wxscintilla_LexSorcus.o \
$(OBJS)\wxscintilla_LexSpice.o \ $(OBJS)\wxscintilla_LexSpice.o \
$(OBJS)\wxscintilla_LexTAL.o \
$(OBJS)\wxscintilla_LexTACL.o \
$(OBJS)\wxscintilla_LexTCL.o \ $(OBJS)\wxscintilla_LexTCL.o \
$(OBJS)\wxscintilla_LexTeX.o \ $(OBJS)\wxscintilla_LexTeX.o \
$(OBJS)\wxscintilla_LexVB.o \ $(OBJS)\wxscintilla_LexVB.o \
@@ -264,17 +274,21 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexVerilog.o \ $(OBJS)\wxscintilla_LexVerilog.o \
$(OBJS)\wxscintilla_LexYAML.o \ $(OBJS)\wxscintilla_LexYAML.o \
$(OBJS)\wxscintilla_LineMarker.o \ $(OBJS)\wxscintilla_LineMarker.o \
$(OBJS)\wxscintilla_PerLine.o \
$(OBJS)\wxscintilla_PositionCache.o \ $(OBJS)\wxscintilla_PositionCache.o \
$(OBJS)\wxscintilla_PropSet.o \ $(OBJS)\wxscintilla_PropSet.o \
$(OBJS)\wxscintilla_RESearch.o \ $(OBJS)\wxscintilla_RESearch.o \
$(OBJS)\wxscintilla_RunStyles.o \ $(OBJS)\wxscintilla_RunStyles.o \
$(OBJS)\wxscintilla_Selection.o \
$(OBJS)\wxscintilla_ScintillaBase.o \ $(OBJS)\wxscintilla_ScintillaBase.o \
$(OBJS)\wxscintilla_Style.o \ $(OBJS)\wxscintilla_Style.o \
$(OBJS)\wxscintilla_StyleContext.o \ $(OBJS)\wxscintilla_StyleContext.o \
$(OBJS)\wxscintilla_UniConversion.o \ $(OBJS)\wxscintilla_UniConversion.o \
$(OBJS)\wxscintilla_ViewStyle.o \ $(OBJS)\wxscintilla_ViewStyle.o \
$(OBJS)\wxscintilla_WindowAccessor.o \ $(OBJS)\wxscintilla_WindowAccessor.o \
$(OBJS)\wxscintilla_XPM.o $(OBJS)\wxscintilla_XPM.o \
$(OBJS)\wxscintilla_LexMarkdown.o \
$(OBJS)\wxscintilla_Array.o
MONODLL_CFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) $(GCCFLAGS) \ MONODLL_CFLAGS = $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) $(GCCFLAGS) \
-DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \ -DHAVE_W32API_H -D__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) \
$(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \ $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) \
@@ -5600,6 +5614,9 @@ $(OBJS)\wxscintilla_LexCaml.o: ../../src/stc/scintilla/src/LexCaml.cxx
$(OBJS)\wxscintilla_LexCsound.o: ../../src/stc/scintilla/src/LexCsound.cxx $(OBJS)\wxscintilla_LexCsound.o: ../../src/stc/scintilla/src/LexCsound.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexCOBOL.o: ../../src/stc/scintilla/src/LexCOBOL.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexConf.o: ../../src/stc/scintilla/src/LexConf.cxx $(OBJS)\wxscintilla_LexConf.o: ../../src/stc/scintilla/src/LexConf.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -5654,6 +5671,9 @@ $(OBJS)\wxscintilla_LexLout.o: ../../src/stc/scintilla/src/LexLout.cxx
$(OBJS)\wxscintilla_LexLua.o: ../../src/stc/scintilla/src/LexLua.cxx $(OBJS)\wxscintilla_LexLua.o: ../../src/stc/scintilla/src/LexLua.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexMagik.o: ../../src/stc/scintilla/src/LexMagik.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexMMIXAL.o: ../../src/stc/scintilla/src/LexMMIXAL.cxx $(OBJS)\wxscintilla_LexMMIXAL.o: ../../src/stc/scintilla/src/LexMMIXAL.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -5669,6 +5689,12 @@ $(OBJS)\wxscintilla_LexMatlab.o: ../../src/stc/scintilla/src/LexMatlab.cxx
$(OBJS)\wxscintilla_LexMetapost.o: ../../src/stc/scintilla/src/LexMetapost.cxx $(OBJS)\wxscintilla_LexMetapost.o: ../../src/stc/scintilla/src/LexMetapost.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexMySQL.o: ../../src/stc/scintilla/src/LexMySQL.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexNimrod.o: ../../src/stc/scintilla/src/LexNimrod.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexNsis.o: ../../src/stc/scintilla/src/LexNsis.cxx $(OBJS)\wxscintilla_LexNsis.o: ../../src/stc/scintilla/src/LexNsis.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -5699,6 +5725,12 @@ $(OBJS)\wxscintilla_LexPascal.o: ../../src/stc/scintilla/src/LexPascal.cxx
$(OBJS)\wxscintilla_LexPerl.o: ../../src/stc/scintilla/src/LexPerl.cxx $(OBJS)\wxscintilla_LexPerl.o: ../../src/stc/scintilla/src/LexPerl.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexPowerPro.o: ../../src/stc/scintilla/src/LexPowerPro.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexPowerShell.o: ../../src/stc/scintilla/src/LexPowerShell.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexPython.o: ../../src/stc/scintilla/src/LexPython.cxx $(OBJS)\wxscintilla_LexPython.o: ../../src/stc/scintilla/src/LexPython.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -5714,6 +5746,9 @@ $(OBJS)\wxscintilla_LexRuby.o: ../../src/stc/scintilla/src/LexRuby.cxx
$(OBJS)\wxscintilla_LexSQL.o: ../../src/stc/scintilla/src/LexSQL.cxx $(OBJS)\wxscintilla_LexSQL.o: ../../src/stc/scintilla/src/LexSQL.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexSML.o: ../../src/stc/scintilla/src/LexSML.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexSmalltalk.o: ../../src/stc/scintilla/src/LexSmalltalk.cxx $(OBJS)\wxscintilla_LexSmalltalk.o: ../../src/stc/scintilla/src/LexSmalltalk.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -5726,9 +5761,18 @@ $(OBJS)\wxscintilla_LexScriptol.o: ../../src/stc/scintilla/src/LexScriptol.cxx
$(OBJS)\wxscintilla_LexSpecman.o: ../../src/stc/scintilla/src/LexSpecman.cxx $(OBJS)\wxscintilla_LexSpecman.o: ../../src/stc/scintilla/src/LexSpecman.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexSorcus.o: ../../src/stc/scintilla/src/LexSorcus.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexSpice.o: ../../src/stc/scintilla/src/LexSpice.cxx $(OBJS)\wxscintilla_LexSpice.o: ../../src/stc/scintilla/src/LexSpice.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexTAL.o: ../../src/stc/scintilla/src/LexTAL.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexTACL.o: ../../src/stc/scintilla/src/LexTACL.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexTCL.o: ../../src/stc/scintilla/src/LexTCL.cxx $(OBJS)\wxscintilla_LexTCL.o: ../../src/stc/scintilla/src/LexTCL.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -5750,6 +5794,9 @@ $(OBJS)\wxscintilla_LexYAML.o: ../../src/stc/scintilla/src/LexYAML.cxx
$(OBJS)\wxscintilla_LineMarker.o: ../../src/stc/scintilla/src/LineMarker.cxx $(OBJS)\wxscintilla_LineMarker.o: ../../src/stc/scintilla/src/LineMarker.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_PerLine.o: ../../src/stc/scintilla/src/PerLine.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_PositionCache.o: ../../src/stc/scintilla/src/PositionCache.cxx $(OBJS)\wxscintilla_PositionCache.o: ../../src/stc/scintilla/src/PositionCache.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -5762,6 +5809,9 @@ $(OBJS)\wxscintilla_RESearch.o: ../../src/stc/scintilla/src/RESearch.cxx
$(OBJS)\wxscintilla_RunStyles.o: ../../src/stc/scintilla/src/RunStyles.cxx $(OBJS)\wxscintilla_RunStyles.o: ../../src/stc/scintilla/src/RunStyles.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_Selection.o: ../../src/stc/scintilla/src/Selection.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_ScintillaBase.o: ../../src/stc/scintilla/src/ScintillaBase.cxx $(OBJS)\wxscintilla_ScintillaBase.o: ../../src/stc/scintilla/src/ScintillaBase.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
@@ -5783,6 +5833,12 @@ $(OBJS)\wxscintilla_WindowAccessor.o: ../../src/stc/scintilla/src/WindowAccessor
$(OBJS)\wxscintilla_XPM.o: ../../src/stc/scintilla/src/XPM.cxx $(OBJS)\wxscintilla_XPM.o: ../../src/stc/scintilla/src/XPM.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_LexMarkdown.o: ../../src/stc/scintilla/src/LexMarkdown.cxx
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\wxscintilla_Array.o: ../../src/stc/scintilla/src/Array.cpp
$(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\monodll_dummy.o: ../../src/common/dummy.cpp $(OBJS)\monodll_dummy.o: ../../src/common/dummy.cpp
$(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $< $(CXX) -c -o $@ $(MONODLL_CXXFLAGS) $(CPPDEPS) $<

View File

@@ -227,6 +227,7 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexCSS.obj \ $(OBJS)\wxscintilla_LexCSS.obj \
$(OBJS)\wxscintilla_LexCaml.obj \ $(OBJS)\wxscintilla_LexCaml.obj \
$(OBJS)\wxscintilla_LexCsound.obj \ $(OBJS)\wxscintilla_LexCsound.obj \
$(OBJS)\wxscintilla_LexCOBOL.obj \
$(OBJS)\wxscintilla_LexConf.obj \ $(OBJS)\wxscintilla_LexConf.obj \
$(OBJS)\wxscintilla_LexCrontab.obj \ $(OBJS)\wxscintilla_LexCrontab.obj \
$(OBJS)\wxscintilla_LexD.obj \ $(OBJS)\wxscintilla_LexD.obj \
@@ -245,11 +246,14 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexLisp.obj \ $(OBJS)\wxscintilla_LexLisp.obj \
$(OBJS)\wxscintilla_LexLout.obj \ $(OBJS)\wxscintilla_LexLout.obj \
$(OBJS)\wxscintilla_LexLua.obj \ $(OBJS)\wxscintilla_LexLua.obj \
$(OBJS)\wxscintilla_LexMagik.obj \
$(OBJS)\wxscintilla_LexMMIXAL.obj \ $(OBJS)\wxscintilla_LexMMIXAL.obj \
$(OBJS)\wxscintilla_LexMPT.obj \ $(OBJS)\wxscintilla_LexMPT.obj \
$(OBJS)\wxscintilla_LexMSSQL.obj \ $(OBJS)\wxscintilla_LexMSSQL.obj \
$(OBJS)\wxscintilla_LexMatlab.obj \ $(OBJS)\wxscintilla_LexMatlab.obj \
$(OBJS)\wxscintilla_LexMetapost.obj \ $(OBJS)\wxscintilla_LexMetapost.obj \
$(OBJS)\wxscintilla_LexMySQL.obj \
$(OBJS)\wxscintilla_LexNimrod.obj \
$(OBJS)\wxscintilla_LexNsis.obj \ $(OBJS)\wxscintilla_LexNsis.obj \
$(OBJS)\wxscintilla_LexOpal.obj \ $(OBJS)\wxscintilla_LexOpal.obj \
$(OBJS)\wxscintilla_LexOthers.obj \ $(OBJS)\wxscintilla_LexOthers.obj \
@@ -260,16 +264,22 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexPS.obj \ $(OBJS)\wxscintilla_LexPS.obj \
$(OBJS)\wxscintilla_LexPascal.obj \ $(OBJS)\wxscintilla_LexPascal.obj \
$(OBJS)\wxscintilla_LexPerl.obj \ $(OBJS)\wxscintilla_LexPerl.obj \
$(OBJS)\wxscintilla_LexPowerPro.obj \
$(OBJS)\wxscintilla_LexPowerShell.obj \
$(OBJS)\wxscintilla_LexPython.obj \ $(OBJS)\wxscintilla_LexPython.obj \
$(OBJS)\wxscintilla_LexR.obj \ $(OBJS)\wxscintilla_LexR.obj \
$(OBJS)\wxscintilla_LexRebol.obj \ $(OBJS)\wxscintilla_LexRebol.obj \
$(OBJS)\wxscintilla_LexRuby.obj \ $(OBJS)\wxscintilla_LexRuby.obj \
$(OBJS)\wxscintilla_LexSQL.obj \ $(OBJS)\wxscintilla_LexSQL.obj \
$(OBJS)\wxscintilla_LexSML.obj \
$(OBJS)\wxscintilla_LexSmalltalk.obj \ $(OBJS)\wxscintilla_LexSmalltalk.obj \
$(OBJS)\wxscintilla_LexTADS3.obj \ $(OBJS)\wxscintilla_LexTADS3.obj \
$(OBJS)\wxscintilla_LexScriptol.obj \ $(OBJS)\wxscintilla_LexScriptol.obj \
$(OBJS)\wxscintilla_LexSpecman.obj \ $(OBJS)\wxscintilla_LexSpecman.obj \
$(OBJS)\wxscintilla_LexSorcus.obj \
$(OBJS)\wxscintilla_LexSpice.obj \ $(OBJS)\wxscintilla_LexSpice.obj \
$(OBJS)\wxscintilla_LexTAL.obj \
$(OBJS)\wxscintilla_LexTACL.obj \
$(OBJS)\wxscintilla_LexTCL.obj \ $(OBJS)\wxscintilla_LexTCL.obj \
$(OBJS)\wxscintilla_LexTeX.obj \ $(OBJS)\wxscintilla_LexTeX.obj \
$(OBJS)\wxscintilla_LexVB.obj \ $(OBJS)\wxscintilla_LexVB.obj \
@@ -277,17 +287,21 @@ WXSCINTILLA_OBJECTS = \
$(OBJS)\wxscintilla_LexVerilog.obj \ $(OBJS)\wxscintilla_LexVerilog.obj \
$(OBJS)\wxscintilla_LexYAML.obj \ $(OBJS)\wxscintilla_LexYAML.obj \
$(OBJS)\wxscintilla_LineMarker.obj \ $(OBJS)\wxscintilla_LineMarker.obj \
$(OBJS)\wxscintilla_PerLine.obj \
$(OBJS)\wxscintilla_PositionCache.obj \ $(OBJS)\wxscintilla_PositionCache.obj \
$(OBJS)\wxscintilla_PropSet.obj \ $(OBJS)\wxscintilla_PropSet.obj \
$(OBJS)\wxscintilla_RESearch.obj \ $(OBJS)\wxscintilla_RESearch.obj \
$(OBJS)\wxscintilla_RunStyles.obj \ $(OBJS)\wxscintilla_RunStyles.obj \
$(OBJS)\wxscintilla_Selection.obj \
$(OBJS)\wxscintilla_ScintillaBase.obj \ $(OBJS)\wxscintilla_ScintillaBase.obj \
$(OBJS)\wxscintilla_Style.obj \ $(OBJS)\wxscintilla_Style.obj \
$(OBJS)\wxscintilla_StyleContext.obj \ $(OBJS)\wxscintilla_StyleContext.obj \
$(OBJS)\wxscintilla_UniConversion.obj \ $(OBJS)\wxscintilla_UniConversion.obj \
$(OBJS)\wxscintilla_ViewStyle.obj \ $(OBJS)\wxscintilla_ViewStyle.obj \
$(OBJS)\wxscintilla_WindowAccessor.obj \ $(OBJS)\wxscintilla_WindowAccessor.obj \
$(OBJS)\wxscintilla_XPM.obj $(OBJS)\wxscintilla_XPM.obj \
$(OBJS)\wxscintilla_LexMarkdown.obj \
$(OBJS)\wxscintilla_Array.obj
MONODLL_CFLAGS = /M$(__RUNTIME_LIBS_116)$(__DEBUGRUNTIME) /DWIN32 \ MONODLL_CFLAGS = /M$(__RUNTIME_LIBS_116)$(__DEBUGRUNTIME) /DWIN32 \
$(__DEBUGINFO) \ $(__DEBUGINFO) \
/Fd$(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_VERSION_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_vc$(VENDORTAG).pdb \ /Fd$(LIBDIRNAME)\wx$(PORTNAME)$(WXUNIVNAME)$(WX_VERSION_NODOT)$(WXUNICODEFLAG)$(WXDEBUGFLAG)$(WX_LIB_FLAVOUR)_vc$(VENDORTAG).pdb \
@@ -6031,6 +6045,9 @@ $(OBJS)\wxscintilla_LexCaml.obj: ..\..\src\stc\scintilla\src\LexCaml.cxx
$(OBJS)\wxscintilla_LexCsound.obj: ..\..\src\stc\scintilla\src\LexCsound.cxx $(OBJS)\wxscintilla_LexCsound.obj: ..\..\src\stc\scintilla\src\LexCsound.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexCsound.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexCsound.cxx
$(OBJS)\wxscintilla_LexCOBOL.obj: ..\..\src\stc\scintilla\src\LexCOBOL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexCOBOL.cxx
$(OBJS)\wxscintilla_LexConf.obj: ..\..\src\stc\scintilla\src\LexConf.cxx $(OBJS)\wxscintilla_LexConf.obj: ..\..\src\stc\scintilla\src\LexConf.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexConf.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexConf.cxx
@@ -6085,6 +6102,9 @@ $(OBJS)\wxscintilla_LexLout.obj: ..\..\src\stc\scintilla\src\LexLout.cxx
$(OBJS)\wxscintilla_LexLua.obj: ..\..\src\stc\scintilla\src\LexLua.cxx $(OBJS)\wxscintilla_LexLua.obj: ..\..\src\stc\scintilla\src\LexLua.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexLua.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexLua.cxx
$(OBJS)\wxscintilla_LexMagik.obj: ..\..\src\stc\scintilla\src\LexMagik.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMagik.cxx
$(OBJS)\wxscintilla_LexMMIXAL.obj: ..\..\src\stc\scintilla\src\LexMMIXAL.cxx $(OBJS)\wxscintilla_LexMMIXAL.obj: ..\..\src\stc\scintilla\src\LexMMIXAL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMMIXAL.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMMIXAL.cxx
@@ -6100,6 +6120,12 @@ $(OBJS)\wxscintilla_LexMatlab.obj: ..\..\src\stc\scintilla\src\LexMatlab.cxx
$(OBJS)\wxscintilla_LexMetapost.obj: ..\..\src\stc\scintilla\src\LexMetapost.cxx $(OBJS)\wxscintilla_LexMetapost.obj: ..\..\src\stc\scintilla\src\LexMetapost.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMetapost.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMetapost.cxx
$(OBJS)\wxscintilla_LexMySQL.obj: ..\..\src\stc\scintilla\src\LexMySQL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMySQL.cxx
$(OBJS)\wxscintilla_LexNimrod.obj: ..\..\src\stc\scintilla\src\LexNimrod.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexNimrod.cxx
$(OBJS)\wxscintilla_LexNsis.obj: ..\..\src\stc\scintilla\src\LexNsis.cxx $(OBJS)\wxscintilla_LexNsis.obj: ..\..\src\stc\scintilla\src\LexNsis.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexNsis.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexNsis.cxx
@@ -6130,6 +6156,12 @@ $(OBJS)\wxscintilla_LexPascal.obj: ..\..\src\stc\scintilla\src\LexPascal.cxx
$(OBJS)\wxscintilla_LexPerl.obj: ..\..\src\stc\scintilla\src\LexPerl.cxx $(OBJS)\wxscintilla_LexPerl.obj: ..\..\src\stc\scintilla\src\LexPerl.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPerl.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPerl.cxx
$(OBJS)\wxscintilla_LexPowerPro.obj: ..\..\src\stc\scintilla\src\LexPowerPro.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPowerPro.cxx
$(OBJS)\wxscintilla_LexPowerShell.obj: ..\..\src\stc\scintilla\src\LexPowerShell.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPowerShell.cxx
$(OBJS)\wxscintilla_LexPython.obj: ..\..\src\stc\scintilla\src\LexPython.cxx $(OBJS)\wxscintilla_LexPython.obj: ..\..\src\stc\scintilla\src\LexPython.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPython.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexPython.cxx
@@ -6145,6 +6177,9 @@ $(OBJS)\wxscintilla_LexRuby.obj: ..\..\src\stc\scintilla\src\LexRuby.cxx
$(OBJS)\wxscintilla_LexSQL.obj: ..\..\src\stc\scintilla\src\LexSQL.cxx $(OBJS)\wxscintilla_LexSQL.obj: ..\..\src\stc\scintilla\src\LexSQL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSQL.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSQL.cxx
$(OBJS)\wxscintilla_LexSML.obj: ..\..\src\stc\scintilla\src\LexSML.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSML.cxx
$(OBJS)\wxscintilla_LexSmalltalk.obj: ..\..\src\stc\scintilla\src\LexSmalltalk.cxx $(OBJS)\wxscintilla_LexSmalltalk.obj: ..\..\src\stc\scintilla\src\LexSmalltalk.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSmalltalk.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSmalltalk.cxx
@@ -6157,9 +6192,18 @@ $(OBJS)\wxscintilla_LexScriptol.obj: ..\..\src\stc\scintilla\src\LexScriptol.cxx
$(OBJS)\wxscintilla_LexSpecman.obj: ..\..\src\stc\scintilla\src\LexSpecman.cxx $(OBJS)\wxscintilla_LexSpecman.obj: ..\..\src\stc\scintilla\src\LexSpecman.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSpecman.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSpecman.cxx
$(OBJS)\wxscintilla_LexSorcus.obj: ..\..\src\stc\scintilla\src\LexSorcus.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSorcus.cxx
$(OBJS)\wxscintilla_LexSpice.obj: ..\..\src\stc\scintilla\src\LexSpice.cxx $(OBJS)\wxscintilla_LexSpice.obj: ..\..\src\stc\scintilla\src\LexSpice.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSpice.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexSpice.cxx
$(OBJS)\wxscintilla_LexTAL.obj: ..\..\src\stc\scintilla\src\LexTAL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexTAL.cxx
$(OBJS)\wxscintilla_LexTACL.obj: ..\..\src\stc\scintilla\src\LexTACL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexTACL.cxx
$(OBJS)\wxscintilla_LexTCL.obj: ..\..\src\stc\scintilla\src\LexTCL.cxx $(OBJS)\wxscintilla_LexTCL.obj: ..\..\src\stc\scintilla\src\LexTCL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexTCL.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexTCL.cxx
@@ -6181,6 +6225,9 @@ $(OBJS)\wxscintilla_LexYAML.obj: ..\..\src\stc\scintilla\src\LexYAML.cxx
$(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx $(OBJS)\wxscintilla_LineMarker.obj: ..\..\src\stc\scintilla\src\LineMarker.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LineMarker.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LineMarker.cxx
$(OBJS)\wxscintilla_PerLine.obj: ..\..\src\stc\scintilla\src\PerLine.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PerLine.cxx
$(OBJS)\wxscintilla_PositionCache.obj: ..\..\src\stc\scintilla\src\PositionCache.cxx $(OBJS)\wxscintilla_PositionCache.obj: ..\..\src\stc\scintilla\src\PositionCache.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PositionCache.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\PositionCache.cxx
@@ -6193,6 +6240,9 @@ $(OBJS)\wxscintilla_RESearch.obj: ..\..\src\stc\scintilla\src\RESearch.cxx
$(OBJS)\wxscintilla_RunStyles.obj: ..\..\src\stc\scintilla\src\RunStyles.cxx $(OBJS)\wxscintilla_RunStyles.obj: ..\..\src\stc\scintilla\src\RunStyles.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\RunStyles.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\RunStyles.cxx
$(OBJS)\wxscintilla_Selection.obj: ..\..\src\stc\scintilla\src\Selection.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Selection.cxx
$(OBJS)\wxscintilla_ScintillaBase.obj: ..\..\src\stc\scintilla\src\ScintillaBase.cxx $(OBJS)\wxscintilla_ScintillaBase.obj: ..\..\src\stc\scintilla\src\ScintillaBase.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\ScintillaBase.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\ScintillaBase.cxx
@@ -6214,6 +6264,12 @@ $(OBJS)\wxscintilla_WindowAccessor.obj: ..\..\src\stc\scintilla\src\WindowAccess
$(OBJS)\wxscintilla_XPM.obj: ..\..\src\stc\scintilla\src\XPM.cxx $(OBJS)\wxscintilla_XPM.obj: ..\..\src\stc\scintilla\src\XPM.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\XPM.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\XPM.cxx
$(OBJS)\wxscintilla_LexMarkdown.obj: ..\..\src\stc\scintilla\src\LexMarkdown.cxx
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\LexMarkdown.cxx
$(OBJS)\wxscintilla_Array.obj: ..\..\src\stc\scintilla\src\Array.cpp
$(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Array.cpp
$(OBJS)\monodll_dummy.obj: ..\..\src\common\dummy.cpp $(OBJS)\monodll_dummy.obj: ..\..\src\common\dummy.cpp
$(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) /Ycwx/wxprec.h ..\..\src\common\dummy.cpp $(CXX) /c /nologo /TP /Fo$@ $(MONODLL_CXXFLAGS) /Ycwx/wxprec.h ..\..\src\common\dummy.cpp

View File

@@ -3430,6 +3430,7 @@ WXSCINTILLA_OBJECTS = &
$(OBJS)\wxscintilla_LexCSS.obj & $(OBJS)\wxscintilla_LexCSS.obj &
$(OBJS)\wxscintilla_LexCaml.obj & $(OBJS)\wxscintilla_LexCaml.obj &
$(OBJS)\wxscintilla_LexCsound.obj & $(OBJS)\wxscintilla_LexCsound.obj &
$(OBJS)\wxscintilla_LexCOBOL.obj &
$(OBJS)\wxscintilla_LexConf.obj & $(OBJS)\wxscintilla_LexConf.obj &
$(OBJS)\wxscintilla_LexCrontab.obj & $(OBJS)\wxscintilla_LexCrontab.obj &
$(OBJS)\wxscintilla_LexD.obj & $(OBJS)\wxscintilla_LexD.obj &
@@ -3448,11 +3449,14 @@ WXSCINTILLA_OBJECTS = &
$(OBJS)\wxscintilla_LexLisp.obj & $(OBJS)\wxscintilla_LexLisp.obj &
$(OBJS)\wxscintilla_LexLout.obj & $(OBJS)\wxscintilla_LexLout.obj &
$(OBJS)\wxscintilla_LexLua.obj & $(OBJS)\wxscintilla_LexLua.obj &
$(OBJS)\wxscintilla_LexMagik.obj &
$(OBJS)\wxscintilla_LexMMIXAL.obj & $(OBJS)\wxscintilla_LexMMIXAL.obj &
$(OBJS)\wxscintilla_LexMPT.obj & $(OBJS)\wxscintilla_LexMPT.obj &
$(OBJS)\wxscintilla_LexMSSQL.obj & $(OBJS)\wxscintilla_LexMSSQL.obj &
$(OBJS)\wxscintilla_LexMatlab.obj & $(OBJS)\wxscintilla_LexMatlab.obj &
$(OBJS)\wxscintilla_LexMetapost.obj & $(OBJS)\wxscintilla_LexMetapost.obj &
$(OBJS)\wxscintilla_LexMySQL.obj &
$(OBJS)\wxscintilla_LexNimrod.obj &
$(OBJS)\wxscintilla_LexNsis.obj & $(OBJS)\wxscintilla_LexNsis.obj &
$(OBJS)\wxscintilla_LexOpal.obj & $(OBJS)\wxscintilla_LexOpal.obj &
$(OBJS)\wxscintilla_LexOthers.obj & $(OBJS)\wxscintilla_LexOthers.obj &
@@ -3463,16 +3467,22 @@ WXSCINTILLA_OBJECTS = &
$(OBJS)\wxscintilla_LexPS.obj & $(OBJS)\wxscintilla_LexPS.obj &
$(OBJS)\wxscintilla_LexPascal.obj & $(OBJS)\wxscintilla_LexPascal.obj &
$(OBJS)\wxscintilla_LexPerl.obj & $(OBJS)\wxscintilla_LexPerl.obj &
$(OBJS)\wxscintilla_LexPowerPro.obj &
$(OBJS)\wxscintilla_LexPowerShell.obj &
$(OBJS)\wxscintilla_LexPython.obj & $(OBJS)\wxscintilla_LexPython.obj &
$(OBJS)\wxscintilla_LexR.obj & $(OBJS)\wxscintilla_LexR.obj &
$(OBJS)\wxscintilla_LexRebol.obj & $(OBJS)\wxscintilla_LexRebol.obj &
$(OBJS)\wxscintilla_LexRuby.obj & $(OBJS)\wxscintilla_LexRuby.obj &
$(OBJS)\wxscintilla_LexSQL.obj & $(OBJS)\wxscintilla_LexSQL.obj &
$(OBJS)\wxscintilla_LexSML.obj &
$(OBJS)\wxscintilla_LexSmalltalk.obj & $(OBJS)\wxscintilla_LexSmalltalk.obj &
$(OBJS)\wxscintilla_LexTADS3.obj & $(OBJS)\wxscintilla_LexTADS3.obj &
$(OBJS)\wxscintilla_LexScriptol.obj & $(OBJS)\wxscintilla_LexScriptol.obj &
$(OBJS)\wxscintilla_LexSpecman.obj & $(OBJS)\wxscintilla_LexSpecman.obj &
$(OBJS)\wxscintilla_LexSorcus.obj &
$(OBJS)\wxscintilla_LexSpice.obj & $(OBJS)\wxscintilla_LexSpice.obj &
$(OBJS)\wxscintilla_LexTAL.obj &
$(OBJS)\wxscintilla_LexTACL.obj &
$(OBJS)\wxscintilla_LexTCL.obj & $(OBJS)\wxscintilla_LexTCL.obj &
$(OBJS)\wxscintilla_LexTeX.obj & $(OBJS)\wxscintilla_LexTeX.obj &
$(OBJS)\wxscintilla_LexVB.obj & $(OBJS)\wxscintilla_LexVB.obj &
@@ -3480,17 +3490,21 @@ WXSCINTILLA_OBJECTS = &
$(OBJS)\wxscintilla_LexVerilog.obj & $(OBJS)\wxscintilla_LexVerilog.obj &
$(OBJS)\wxscintilla_LexYAML.obj & $(OBJS)\wxscintilla_LexYAML.obj &
$(OBJS)\wxscintilla_LineMarker.obj & $(OBJS)\wxscintilla_LineMarker.obj &
$(OBJS)\wxscintilla_PerLine.obj &
$(OBJS)\wxscintilla_PositionCache.obj & $(OBJS)\wxscintilla_PositionCache.obj &
$(OBJS)\wxscintilla_PropSet.obj & $(OBJS)\wxscintilla_PropSet.obj &
$(OBJS)\wxscintilla_RESearch.obj & $(OBJS)\wxscintilla_RESearch.obj &
$(OBJS)\wxscintilla_RunStyles.obj & $(OBJS)\wxscintilla_RunStyles.obj &
$(OBJS)\wxscintilla_Selection.obj &
$(OBJS)\wxscintilla_ScintillaBase.obj & $(OBJS)\wxscintilla_ScintillaBase.obj &
$(OBJS)\wxscintilla_Style.obj & $(OBJS)\wxscintilla_Style.obj &
$(OBJS)\wxscintilla_StyleContext.obj & $(OBJS)\wxscintilla_StyleContext.obj &
$(OBJS)\wxscintilla_UniConversion.obj & $(OBJS)\wxscintilla_UniConversion.obj &
$(OBJS)\wxscintilla_ViewStyle.obj & $(OBJS)\wxscintilla_ViewStyle.obj &
$(OBJS)\wxscintilla_WindowAccessor.obj & $(OBJS)\wxscintilla_WindowAccessor.obj &
$(OBJS)\wxscintilla_XPM.obj $(OBJS)\wxscintilla_XPM.obj &
$(OBJS)\wxscintilla_LexMarkdown.obj &
$(OBJS)\wxscintilla_Array.obj
MONODLL_CFLAGS = -bd $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) & MONODLL_CFLAGS = -bd $(__DEBUGINFO) $(__OPTIMIZEFLAG) $(__THREADSFLAG) &
$(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) & $(__RUNTIME_LIBS) -d__WXMSW__ $(__WXUNIV_DEFINE_p) $(__DEBUG_DEFINE_p) &
$(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) & $(__NDEBUG_DEFINE_p) $(__EXCEPTIONS_DEFINE_p) $(__RTTI_DEFINE_p) &
@@ -5859,6 +5873,9 @@ $(OBJS)\wxscintilla_LexCaml.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexCa
$(OBJS)\wxscintilla_LexCsound.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexCsound.cxx $(OBJS)\wxscintilla_LexCsound.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexCsound.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexCOBOL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexCOBOL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexConf.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexConf.cxx $(OBJS)\wxscintilla_LexConf.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexConf.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
@@ -5913,6 +5930,9 @@ $(OBJS)\wxscintilla_LexLout.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexLo
$(OBJS)\wxscintilla_LexLua.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexLua.cxx $(OBJS)\wxscintilla_LexLua.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexLua.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexMagik.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexMagik.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexMMIXAL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexMMIXAL.cxx $(OBJS)\wxscintilla_LexMMIXAL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexMMIXAL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
@@ -5928,6 +5948,12 @@ $(OBJS)\wxscintilla_LexMatlab.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\Lex
$(OBJS)\wxscintilla_LexMetapost.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexMetapost.cxx $(OBJS)\wxscintilla_LexMetapost.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexMetapost.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexMySQL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexMySQL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexNimrod.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexNimrod.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexNsis.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexNsis.cxx $(OBJS)\wxscintilla_LexNsis.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexNsis.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
@@ -5958,6 +5984,12 @@ $(OBJS)\wxscintilla_LexPascal.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\Lex
$(OBJS)\wxscintilla_LexPerl.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPerl.cxx $(OBJS)\wxscintilla_LexPerl.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPerl.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexPowerPro.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPowerPro.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexPowerShell.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPowerShell.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexPython.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPython.cxx $(OBJS)\wxscintilla_LexPython.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexPython.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
@@ -5973,6 +6005,9 @@ $(OBJS)\wxscintilla_LexRuby.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexRu
$(OBJS)\wxscintilla_LexSQL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSQL.cxx $(OBJS)\wxscintilla_LexSQL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSQL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexSML.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSML.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexSmalltalk.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSmalltalk.cxx $(OBJS)\wxscintilla_LexSmalltalk.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSmalltalk.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
@@ -5985,9 +6020,18 @@ $(OBJS)\wxscintilla_LexScriptol.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\L
$(OBJS)\wxscintilla_LexSpecman.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSpecman.cxx $(OBJS)\wxscintilla_LexSpecman.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSpecman.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexSorcus.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSorcus.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexSpice.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSpice.cxx $(OBJS)\wxscintilla_LexSpice.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexSpice.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexTAL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexTAL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexTACL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexTACL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexTCL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexTCL.cxx $(OBJS)\wxscintilla_LexTCL.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexTCL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
@@ -6009,6 +6053,9 @@ $(OBJS)\wxscintilla_LexYAML.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexYA
$(OBJS)\wxscintilla_LineMarker.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LineMarker.cxx $(OBJS)\wxscintilla_LineMarker.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LineMarker.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_PerLine.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\PerLine.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_PositionCache.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\PositionCache.cxx $(OBJS)\wxscintilla_PositionCache.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\PositionCache.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
@@ -6021,6 +6068,9 @@ $(OBJS)\wxscintilla_RESearch.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\RESe
$(OBJS)\wxscintilla_RunStyles.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\RunStyles.cxx $(OBJS)\wxscintilla_RunStyles.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\RunStyles.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_Selection.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\Selection.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_ScintillaBase.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\ScintillaBase.cxx $(OBJS)\wxscintilla_ScintillaBase.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\ScintillaBase.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
@@ -6042,6 +6092,12 @@ $(OBJS)\wxscintilla_WindowAccessor.obj : .AUTODEPEND ..\..\src\stc\scintilla\sr
$(OBJS)\wxscintilla_XPM.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\XPM.cxx $(OBJS)\wxscintilla_XPM.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\XPM.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_LexMarkdown.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\LexMarkdown.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\wxscintilla_Array.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\Array.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $<
$(OBJS)\monodll_dummy.obj : .AUTODEPEND ..\..\src\common\dummy.cpp $(OBJS)\monodll_dummy.obj : .AUTODEPEND ..\..\src\common\dummy.cpp
$(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $< $(CXX) -bt=nt -zq -fo=$^@ $(MONODLL_CXXFLAGS) $<

View File

@@ -461,6 +461,9 @@
Name="Source Files" Name="Source Files"
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"> UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}">
<File
RelativePath="..\..\src\stc\scintilla\src\Array.cpp">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\AutoComplete.cxx"> RelativePath="..\..\src\stc\scintilla\src\AutoComplete.cxx">
</File> </File>
@@ -539,6 +542,9 @@
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexCLW.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexCLW.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexCOBOL.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexCPP.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexCPP.cxx">
</File> </File>
@@ -617,12 +623,24 @@
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexMSSQL.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexMSSQL.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexMagik.cxx">
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexMarkdown.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexMatlab.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexMatlab.cxx">
</File> </File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexMetapost.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexMetapost.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexMySQL.cxx">
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexNimrod.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexNsis.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexNsis.cxx">
</File> </File>
@@ -650,6 +668,12 @@
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexPerl.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexPerl.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexPowerPro.cxx">
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexPowerShell.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexProgress.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexProgress.cxx">
</File> </File>
@@ -665,6 +689,9 @@
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexRuby.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexRuby.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexSML.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexSQL.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexSQL.cxx">
</File> </File>
@@ -674,15 +701,24 @@
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexSmalltalk.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexSmalltalk.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexSorcus.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexSpecman.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexSpecman.cxx">
</File> </File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexSpice.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexSpice.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexTACL.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexTADS3.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexTADS3.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexTAL.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexTCL.cxx"> RelativePath="..\..\src\stc\scintilla\src\LexTCL.cxx">
</File> </File>
@@ -704,6 +740,9 @@
<File <File
RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx"> RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\PositionCache.cxx"> RelativePath="..\..\src\stc\scintilla\src\PositionCache.cxx">
</File> </File>
@@ -719,6 +758,9 @@
<File <File
RelativePath="..\..\src\stc\scintilla\src\ScintillaBase.cxx"> RelativePath="..\..\src\stc\scintilla\src\ScintillaBase.cxx">
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\Selection.cxx">
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\Style.cxx"> RelativePath="..\..\src\stc\scintilla\src\Style.cxx">
</File> </File>

View File

@@ -667,6 +667,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath="..\..\src\stc\scintilla\src\Array.cpp"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\AutoComplete.cxx" RelativePath="..\..\src\stc\scintilla\src\AutoComplete.cxx"
> >
@@ -771,6 +775,10 @@
RelativePath="..\..\src\stc\scintilla\src\LexCLW.cxx" RelativePath="..\..\src\stc\scintilla\src\LexCLW.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexCOBOL.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexCPP.cxx" RelativePath="..\..\src\stc\scintilla\src\LexCPP.cxx"
> >
@@ -875,6 +883,14 @@
RelativePath="..\..\src\stc\scintilla\src\LexMSSQL.cxx" RelativePath="..\..\src\stc\scintilla\src\LexMSSQL.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexMagik.cxx"
>
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexMarkdown.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexMatlab.cxx" RelativePath="..\..\src\stc\scintilla\src\LexMatlab.cxx"
> >
@@ -883,6 +899,14 @@
RelativePath="..\..\src\stc\scintilla\src\LexMetapost.cxx" RelativePath="..\..\src\stc\scintilla\src\LexMetapost.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexMySQL.cxx"
>
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexNimrod.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexNsis.cxx" RelativePath="..\..\src\stc\scintilla\src\LexNsis.cxx"
> >
@@ -919,6 +943,14 @@
RelativePath="..\..\src\stc\scintilla\src\LexPerl.cxx" RelativePath="..\..\src\stc\scintilla\src\LexPerl.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexPowerPro.cxx"
>
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexPowerShell.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexProgress.cxx" RelativePath="..\..\src\stc\scintilla\src\LexProgress.cxx"
> >
@@ -939,6 +971,10 @@
RelativePath="..\..\src\stc\scintilla\src\LexRuby.cxx" RelativePath="..\..\src\stc\scintilla\src\LexRuby.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexSML.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexSQL.cxx" RelativePath="..\..\src\stc\scintilla\src\LexSQL.cxx"
> >
@@ -951,6 +987,10 @@
RelativePath="..\..\src\stc\scintilla\src\LexSmalltalk.cxx" RelativePath="..\..\src\stc\scintilla\src\LexSmalltalk.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexSorcus.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexSpecman.cxx" RelativePath="..\..\src\stc\scintilla\src\LexSpecman.cxx"
> >
@@ -959,10 +999,18 @@
RelativePath="..\..\src\stc\scintilla\src\LexSpice.cxx" RelativePath="..\..\src\stc\scintilla\src\LexSpice.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexTACL.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexTADS3.cxx" RelativePath="..\..\src\stc\scintilla\src\LexTADS3.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexTAL.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexTCL.cxx" RelativePath="..\..\src\stc\scintilla\src\LexTCL.cxx"
> >
@@ -991,6 +1039,10 @@
RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx" RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\PositionCache.cxx" RelativePath="..\..\src\stc\scintilla\src\PositionCache.cxx"
> >
@@ -1011,6 +1063,10 @@
RelativePath="..\..\src\stc\scintilla\src\ScintillaBase.cxx" RelativePath="..\..\src\stc\scintilla\src\ScintillaBase.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\Selection.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\Style.cxx" RelativePath="..\..\src\stc\scintilla\src\Style.cxx"
> >

View File

@@ -663,6 +663,10 @@
Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx"
UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
> >
<File
RelativePath="..\..\src\stc\scintilla\src\Array.cpp"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\AutoComplete.cxx" RelativePath="..\..\src\stc\scintilla\src\AutoComplete.cxx"
> >
@@ -767,6 +771,10 @@
RelativePath="..\..\src\stc\scintilla\src\LexCLW.cxx" RelativePath="..\..\src\stc\scintilla\src\LexCLW.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexCOBOL.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexCPP.cxx" RelativePath="..\..\src\stc\scintilla\src\LexCPP.cxx"
> >
@@ -871,6 +879,14 @@
RelativePath="..\..\src\stc\scintilla\src\LexMSSQL.cxx" RelativePath="..\..\src\stc\scintilla\src\LexMSSQL.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexMagik.cxx"
>
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexMarkdown.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexMatlab.cxx" RelativePath="..\..\src\stc\scintilla\src\LexMatlab.cxx"
> >
@@ -879,6 +895,14 @@
RelativePath="..\..\src\stc\scintilla\src\LexMetapost.cxx" RelativePath="..\..\src\stc\scintilla\src\LexMetapost.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexMySQL.cxx"
>
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexNimrod.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexNsis.cxx" RelativePath="..\..\src\stc\scintilla\src\LexNsis.cxx"
> >
@@ -915,6 +939,14 @@
RelativePath="..\..\src\stc\scintilla\src\LexPerl.cxx" RelativePath="..\..\src\stc\scintilla\src\LexPerl.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexPowerPro.cxx"
>
</File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexPowerShell.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexProgress.cxx" RelativePath="..\..\src\stc\scintilla\src\LexProgress.cxx"
> >
@@ -935,6 +967,10 @@
RelativePath="..\..\src\stc\scintilla\src\LexRuby.cxx" RelativePath="..\..\src\stc\scintilla\src\LexRuby.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexSML.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexSQL.cxx" RelativePath="..\..\src\stc\scintilla\src\LexSQL.cxx"
> >
@@ -947,6 +983,10 @@
RelativePath="..\..\src\stc\scintilla\src\LexSmalltalk.cxx" RelativePath="..\..\src\stc\scintilla\src\LexSmalltalk.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexSorcus.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexSpecman.cxx" RelativePath="..\..\src\stc\scintilla\src\LexSpecman.cxx"
> >
@@ -955,10 +995,18 @@
RelativePath="..\..\src\stc\scintilla\src\LexSpice.cxx" RelativePath="..\..\src\stc\scintilla\src\LexSpice.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexTACL.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexTADS3.cxx" RelativePath="..\..\src\stc\scintilla\src\LexTADS3.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\LexTAL.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\LexTCL.cxx" RelativePath="..\..\src\stc\scintilla\src\LexTCL.cxx"
> >
@@ -987,6 +1035,10 @@
RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx" RelativePath="..\..\src\stc\scintilla\src\LineMarker.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\PerLine.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\PositionCache.cxx" RelativePath="..\..\src\stc\scintilla\src\PositionCache.cxx"
> >
@@ -1007,6 +1059,10 @@
RelativePath="..\..\src\stc\scintilla\src\ScintillaBase.cxx" RelativePath="..\..\src\stc\scintilla\src\ScintillaBase.cxx"
> >
</File> </File>
<File
RelativePath="..\..\src\stc\scintilla\src\Selection.cxx"
>
</File>
<File <File
RelativePath="..\..\src\stc\scintilla\src\Style.cxx" RelativePath="..\..\src\stc\scintilla\src\Style.cxx"
> >

View File

@@ -235,6 +235,10 @@ LIB32=link.exe -lib
# PROP Default_Filter "" # PROP Default_Filter ""
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\Array.cpp
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\AutoComplete.cxx SOURCE=..\..\src\stc\scintilla\src\AutoComplete.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -339,6 +343,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexCLW.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexCOBOL.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexCPP.cxx SOURCE=..\..\src\stc\scintilla\src\LexCPP.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -443,6 +451,14 @@ SOURCE=..\..\src\stc\scintilla\src\LexMSSQL.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexMagik.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexMarkdown.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexMatlab.cxx SOURCE=..\..\src\stc\scintilla\src\LexMatlab.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -451,6 +467,14 @@ SOURCE=..\..\src\stc\scintilla\src\LexMetapost.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexMySQL.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexNimrod.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexNsis.cxx SOURCE=..\..\src\stc\scintilla\src\LexNsis.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -487,6 +511,14 @@ SOURCE=..\..\src\stc\scintilla\src\LexPerl.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexPowerPro.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexPowerShell.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexProgress.cxx SOURCE=..\..\src\stc\scintilla\src\LexProgress.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -507,6 +539,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexRuby.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexSML.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexSQL.cxx SOURCE=..\..\src\stc\scintilla\src\LexSQL.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -519,6 +555,10 @@ SOURCE=..\..\src\stc\scintilla\src\LexSmalltalk.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexSorcus.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexSpecman.cxx SOURCE=..\..\src\stc\scintilla\src\LexSpecman.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -527,10 +567,18 @@ SOURCE=..\..\src\stc\scintilla\src\LexSpice.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexTACL.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexTADS3.cxx SOURCE=..\..\src\stc\scintilla\src\LexTADS3.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexTAL.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\LexTCL.cxx SOURCE=..\..\src\stc\scintilla\src\LexTCL.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -559,6 +607,10 @@ SOURCE=..\..\src\stc\scintilla\src\LineMarker.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\PerLine.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\PositionCache.cxx SOURCE=..\..\src\stc\scintilla\src\PositionCache.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
@@ -579,6 +631,10 @@ SOURCE=..\..\src\stc\scintilla\src\ScintillaBase.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File
SOURCE=..\..\src\stc\scintilla\src\Selection.cxx
# End Source File
# Begin Source File
SOURCE=..\..\src\stc\scintilla\src\Style.cxx SOURCE=..\..\src\stc\scintilla\src\Style.cxx
# End Source File # End Source File
# Begin Source File # Begin Source File

View File

@@ -111,6 +111,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_MARK_ARROWS 24 #define wxSTC_MARK_ARROWS 24
#define wxSTC_MARK_PIXMAP 25 #define wxSTC_MARK_PIXMAP 25
#define wxSTC_MARK_FULLRECT 26 #define wxSTC_MARK_FULLRECT 26
#define wxSTC_MARK_LEFTRECT 27
#define wxSTC_MARK_AVAILABLE 28
#define wxSTC_MARK_UNDERLINE 29
#define wxSTC_MARK_CHARACTER 10000 #define wxSTC_MARK_CHARACTER 10000
// Markers used for outlining column. // Markers used for outlining column.
@@ -126,6 +129,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_MARGIN_NUMBER 1 #define wxSTC_MARGIN_NUMBER 1
#define wxSTC_MARGIN_BACK 2 #define wxSTC_MARGIN_BACK 2
#define wxSTC_MARGIN_FORE 3 #define wxSTC_MARGIN_FORE 3
#define wxSTC_MARGIN_TEXT 4
#define wxSTC_MARGIN_RTEXT 5
// Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles. // Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
// Style 39 is for future use. // Style 39 is for future use.
@@ -208,17 +213,12 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_FOLDLEVELBASE 0x400 #define wxSTC_FOLDLEVELBASE 0x400
#define wxSTC_FOLDLEVELWHITEFLAG 0x1000 #define wxSTC_FOLDLEVELWHITEFLAG 0x1000
#define wxSTC_FOLDLEVELHEADERFLAG 0x2000 #define wxSTC_FOLDLEVELHEADERFLAG 0x2000
#define wxSTC_FOLDLEVELBOXHEADERFLAG 0x4000
#define wxSTC_FOLDLEVELBOXFOOTERFLAG 0x8000
#define wxSTC_FOLDLEVELCONTRACTED 0x10000
#define wxSTC_FOLDLEVELUNINDENT 0x20000
#define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF #define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF
#define wxSTC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 #define wxSTC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002
#define wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 #define wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004
#define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 #define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
#define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 #define wxSTC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
#define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040 #define wxSTC_FOLDFLAG_LEVELNUMBERS 0x0040
#define wxSTC_FOLDFLAG_BOX 0x0001
#define wxSTC_TIME_FOREVER 10000000 #define wxSTC_TIME_FOREVER 10000000
#define wxSTC_WRAP_NONE 0 #define wxSTC_WRAP_NONE 0
#define wxSTC_WRAP_WORD 1 #define wxSTC_WRAP_WORD 1
@@ -229,13 +229,26 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_WRAPVISUALFLAGLOC_DEFAULT 0x0000 #define wxSTC_WRAPVISUALFLAGLOC_DEFAULT 0x0000
#define wxSTC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001 #define wxSTC_WRAPVISUALFLAGLOC_END_BY_TEXT 0x0001
#define wxSTC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002 #define wxSTC_WRAPVISUALFLAGLOC_START_BY_TEXT 0x0002
#define wxSTC_WRAPINDENT_FIXED 0
#define wxSTC_WRAPINDENT_SAME 1
#define wxSTC_WRAPINDENT_INDENT 2
#define wxSTC_CACHE_NONE 0 #define wxSTC_CACHE_NONE 0
#define wxSTC_CACHE_CARET 1 #define wxSTC_CACHE_CARET 1
#define wxSTC_CACHE_PAGE 2 #define wxSTC_CACHE_PAGE 2
#define wxSTC_CACHE_DOCUMENT 3 #define wxSTC_CACHE_DOCUMENT 3
// Control font anti-aliasing.
#define wxSTC_EFF_QUALITY_MASK 0xF
#define wxSTC_EFF_QUALITY_DEFAULT 0
#define wxSTC_EFF_QUALITY_NON_ANTIALIASED 1
#define wxSTC_EFF_QUALITY_ANTIALIASED 2
#define wxSTC_EFF_QUALITY_LCD_OPTIMIZED 3
#define wxSTC_EDGE_NONE 0 #define wxSTC_EDGE_NONE 0
#define wxSTC_EDGE_LINE 1 #define wxSTC_EDGE_LINE 1
#define wxSTC_EDGE_BACKGROUND 2 #define wxSTC_EDGE_BACKGROUND 2
#define wxSTC_STATUS_OK 0
#define wxSTC_STATUS_FAILURE 1
#define wxSTC_STATUS_BADALLOC 2
#define wxSTC_CURSORNORMAL -1 #define wxSTC_CURSORNORMAL -1
#define wxSTC_CURSORWAIT 4 #define wxSTC_CURSORWAIT 4
@@ -268,19 +281,23 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
// This way, we favour the displaying of useful information: the begining of lines, // This way, we favour the displaying of useful information: the begining of lines,
// where most code reside, and the lines after the caret, eg. the body of a function. // where most code reside, and the lines after the caret, eg. the body of a function.
#define wxSTC_CARET_EVEN 0x08 #define wxSTC_CARET_EVEN 0x08
// Selection Modes
#define wxSTC_SEL_STREAM 0 #define wxSTC_SEL_STREAM 0
#define wxSTC_SEL_RECTANGLE 1 #define wxSTC_SEL_RECTANGLE 1
#define wxSTC_SEL_LINES 2 #define wxSTC_SEL_LINES 2
#define wxSTC_SEL_THIN 3
#define wxSTC_ALPHA_TRANSPARENT 0 #define wxSTC_ALPHA_TRANSPARENT 0
#define wxSTC_ALPHA_OPAQUE 255 #define wxSTC_ALPHA_OPAQUE 255
#define wxSTC_ALPHA_NOALPHA 256 #define wxSTC_ALPHA_NOALPHA 256
// Caret Styles
#define wxSTC_CARETSTYLE_INVISIBLE 0 #define wxSTC_CARETSTYLE_INVISIBLE 0
#define wxSTC_CARETSTYLE_LINE 1 #define wxSTC_CARETSTYLE_LINE 1
#define wxSTC_CARETSTYLE_BLOCK 2 #define wxSTC_CARETSTYLE_BLOCK 2
#define wxSTC_ANNOTATION_HIDDEN 0
#define wxSTC_ANNOTATION_STANDARD 1
#define wxSTC_ANNOTATION_BOXED 2
#define wxSTC_UNDO_MAY_COALESCE 1
#define wxSTC_SCVS_NONE 0
#define wxSTC_SCVS_RECTANGULARSELECTION 1
#define wxSTC_SCVS_USERACCESSIBLE 2
// Maximum value of keywordSet parameter of SetKeyWords. // Maximum value of keywordSet parameter of SetKeyWords.
#define wxSTC_KEYWORDSET_MAX 8 #define wxSTC_KEYWORDSET_MAX 8
@@ -305,7 +322,10 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_STARTACTION 0x2000 #define wxSTC_STARTACTION 0x2000
#define wxSTC_MOD_CHANGEINDICATOR 0x4000 #define wxSTC_MOD_CHANGEINDICATOR 0x4000
#define wxSTC_MOD_CHANGELINESTATE 0x8000 #define wxSTC_MOD_CHANGELINESTATE 0x8000
#define wxSTC_MODEVENTMASKALL 0xFFFF #define wxSTC_MOD_CHANGEMARGIN 0x10000
#define wxSTC_MOD_CHANGEANNOTATION 0x20000
#define wxSTC_MOD_CONTAINER 0x40000
#define wxSTC_MODEVENTMASKALL 0x7FFFF
// Symbolic key codes and modifier flags. // Symbolic key codes and modifier flags.
// ASCII and other printable characters below 256. // ASCII and other printable characters below 256.
@@ -334,6 +354,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_SCMOD_SHIFT 1 #define wxSTC_SCMOD_SHIFT 1
#define wxSTC_SCMOD_CTRL 2 #define wxSTC_SCMOD_CTRL 2
#define wxSTC_SCMOD_ALT 4 #define wxSTC_SCMOD_ALT 4
#define wxSTC_SCMOD_SUPER 8
// For SciLexer.h // For SciLexer.h
#define wxSTC_LEX_CONTAINER 0 #define wxSTC_LEX_CONTAINER 0
@@ -421,6 +442,18 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_LEX_ABAQUS 84 #define wxSTC_LEX_ABAQUS 84
#define wxSTC_LEX_ASYMPTOTE 85 #define wxSTC_LEX_ASYMPTOTE 85
#define wxSTC_LEX_R 86 #define wxSTC_LEX_R 86
#define wxSTC_LEX_MAGIK 87
#define wxSTC_LEX_POWERSHELL 88
#define wxSTC_LEX_MYSQL 89
#define wxSTC_LEX_PO 90
#define wxSTC_LEX_TAL 91
#define wxSTC_LEX_COBOL 92
#define wxSTC_LEX_TACL 93
#define wxSTC_LEX_SORCUS 94
#define wxSTC_LEX_POWERPRO 95
#define wxSTC_LEX_NIMROD 96
#define wxSTC_LEX_SML 97
#define wxSTC_LEX_MARKDOWN 98
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a // When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1. // value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -485,6 +518,11 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_D_COMMENTLINEDOC 15 #define wxSTC_D_COMMENTLINEDOC 15
#define wxSTC_D_COMMENTDOCKEYWORD 16 #define wxSTC_D_COMMENTDOCKEYWORD 16
#define wxSTC_D_COMMENTDOCKEYWORDERROR 17 #define wxSTC_D_COMMENTDOCKEYWORDERROR 17
#define wxSTC_D_STRINGB 18
#define wxSTC_D_STRINGR 19
#define wxSTC_D_WORD5 20
#define wxSTC_D_WORD6 21
#define wxSTC_D_WORD7 22
// Lexical states for SCLEX_TCL // Lexical states for SCLEX_TCL
#define wxSTC_TCL_DEFAULT 0 #define wxSTC_TCL_DEFAULT 0
@@ -829,6 +867,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_DIFF_POSITION 4 #define wxSTC_DIFF_POSITION 4
#define wxSTC_DIFF_DELETED 5 #define wxSTC_DIFF_DELETED 5
#define wxSTC_DIFF_ADDED 6 #define wxSTC_DIFF_ADDED 6
#define wxSTC_DIFF_CHANGED 7
// Lexical states for SCLEX_CONF (Apache Configuration Files Lexer) // Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
#define wxSTC_CONF_DEFAULT 0 #define wxSTC_CONF_DEFAULT 0
@@ -1021,6 +1060,11 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_CSS_SINGLESTRING 14 #define wxSTC_CSS_SINGLESTRING 14
#define wxSTC_CSS_IDENTIFIER2 15 #define wxSTC_CSS_IDENTIFIER2 15
#define wxSTC_CSS_ATTRIBUTE 16 #define wxSTC_CSS_ATTRIBUTE 16
#define wxSTC_CSS_IDENTIFIER3 17
#define wxSTC_CSS_PSEUDOELEMENT 18
#define wxSTC_CSS_EXTENDED_IDENTIFIER 19
#define wxSTC_CSS_EXTENDED_PSEUDOCLASS 20
#define wxSTC_CSS_EXTENDED_PSEUDOELEMENT 21
// Lexical states for SCLEX_POV // Lexical states for SCLEX_POV
#define wxSTC_POV_DEFAULT 0 #define wxSTC_POV_DEFAULT 0
@@ -1195,8 +1239,19 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_ERLANG_CHARACTER 9 #define wxSTC_ERLANG_CHARACTER 9
#define wxSTC_ERLANG_MACRO 10 #define wxSTC_ERLANG_MACRO 10
#define wxSTC_ERLANG_RECORD 11 #define wxSTC_ERLANG_RECORD 11
#define wxSTC_ERLANG_SEPARATOR 12 #define wxSTC_ERLANG_PREPROC 12
#define wxSTC_ERLANG_NODE_NAME 13 #define wxSTC_ERLANG_NODE_NAME 13
#define wxSTC_ERLANG_COMMENT_FUNCTION 14
#define wxSTC_ERLANG_COMMENT_MODULE 15
#define wxSTC_ERLANG_COMMENT_DOC 16
#define wxSTC_ERLANG_COMMENT_DOC_MACRO 17
#define wxSTC_ERLANG_ATOM_QUOTED 18
#define wxSTC_ERLANG_MACRO_QUOTED 19
#define wxSTC_ERLANG_RECORD_QUOTED 20
#define wxSTC_ERLANG_NODE_NAME_QUOTED 21
#define wxSTC_ERLANG_BIFS 22
#define wxSTC_ERLANG_MODULES 23
#define wxSTC_ERLANG_MODULES_ATT 24
#define wxSTC_ERLANG_UNKNOWN 31 #define wxSTC_ERLANG_UNKNOWN 31
// Lexical states for SCLEX_OCTAVE are identical to MatLab // Lexical states for SCLEX_OCTAVE are identical to MatLab
@@ -1368,6 +1423,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_CAML_OPERATOR 7 #define wxSTC_CAML_OPERATOR 7
#define wxSTC_CAML_NUMBER 8 #define wxSTC_CAML_NUMBER 8
#define wxSTC_CAML_CHAR 9 #define wxSTC_CAML_CHAR 9
#define wxSTC_CAML_WHITE 10
#define wxSTC_CAML_STRING 11 #define wxSTC_CAML_STRING 11
#define wxSTC_CAML_COMMENT 12 #define wxSTC_CAML_COMMENT 12
#define wxSTC_CAML_COMMENT1 13 #define wxSTC_CAML_COMMENT1 13
@@ -1541,7 +1597,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_INNO_PARAMETER 3 #define wxSTC_INNO_PARAMETER 3
#define wxSTC_INNO_SECTION 4 #define wxSTC_INNO_SECTION 4
#define wxSTC_INNO_PREPROC 5 #define wxSTC_INNO_PREPROC 5
#define wxSTC_INNO_PREPROC_INLINE 6 #define wxSTC_INNO_INLINE_EXPANSION 6
#define wxSTC_INNO_COMMENT_PASCAL 7 #define wxSTC_INNO_COMMENT_PASCAL 7
#define wxSTC_INNO_KEYWORD_PASCAL 8 #define wxSTC_INNO_KEYWORD_PASCAL 8
#define wxSTC_INNO_KEYWORD_USER 9 #define wxSTC_INNO_KEYWORD_USER 9
@@ -1690,6 +1746,162 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_R_INFIX 10 #define wxSTC_R_INFIX 10
#define wxSTC_R_INFIXEOL 11 #define wxSTC_R_INFIXEOL 11
// Lexical state for SCLEX_MAGIKSF
#define wxSTC_MAGIK_DEFAULT 0
#define wxSTC_MAGIK_COMMENT 1
#define wxSTC_MAGIK_HYPER_COMMENT 16
#define wxSTC_MAGIK_STRING 2
#define wxSTC_MAGIK_CHARACTER 3
#define wxSTC_MAGIK_NUMBER 4
#define wxSTC_MAGIK_IDENTIFIER 5
#define wxSTC_MAGIK_OPERATOR 6
#define wxSTC_MAGIK_FLOW 7
#define wxSTC_MAGIK_CONTAINER 8
#define wxSTC_MAGIK_BRACKET_BLOCK 9
#define wxSTC_MAGIK_BRACE_BLOCK 10
#define wxSTC_MAGIK_SQBRACKET_BLOCK 11
#define wxSTC_MAGIK_UNKNOWN_KEYWORD 12
#define wxSTC_MAGIK_KEYWORD 13
#define wxSTC_MAGIK_PRAGMA 14
#define wxSTC_MAGIK_SYMBOL 15
// Lexical state for SCLEX_POWERSHELL
#define wxSTC_POWERSHELL_DEFAULT 0
#define wxSTC_POWERSHELL_COMMENT 1
#define wxSTC_POWERSHELL_STRING 2
#define wxSTC_POWERSHELL_CHARACTER 3
#define wxSTC_POWERSHELL_NUMBER 4
#define wxSTC_POWERSHELL_VARIABLE 5
#define wxSTC_POWERSHELL_OPERATOR 6
#define wxSTC_POWERSHELL_IDENTIFIER 7
#define wxSTC_POWERSHELL_KEYWORD 8
#define wxSTC_POWERSHELL_CMDLET 9
#define wxSTC_POWERSHELL_ALIAS 10
// Lexical state for SCLEX_MYSQL
#define wxSTC_MYSQL_DEFAULT 0
#define wxSTC_MYSQL_COMMENT 1
#define wxSTC_MYSQL_COMMENTLINE 2
#define wxSTC_MYSQL_VARIABLE 3
#define wxSTC_MYSQL_SYSTEMVARIABLE 4
#define wxSTC_MYSQL_KNOWNSYSTEMVARIABLE 5
#define wxSTC_MYSQL_NUMBER 6
#define wxSTC_MYSQL_MAJORKEYWORD 7
#define wxSTC_MYSQL_KEYWORD 8
#define wxSTC_MYSQL_DATABASEOBJECT 9
#define wxSTC_MYSQL_PROCEDUREKEYWORD 10
#define wxSTC_MYSQL_STRING 11
#define wxSTC_MYSQL_SQSTRING 12
#define wxSTC_MYSQL_DQSTRING 13
#define wxSTC_MYSQL_OPERATOR 14
#define wxSTC_MYSQL_FUNCTION 15
#define wxSTC_MYSQL_IDENTIFIER 16
#define wxSTC_MYSQL_QUOTEDIDENTIFIER 17
#define wxSTC_MYSQL_USER1 18
#define wxSTC_MYSQL_USER2 19
#define wxSTC_MYSQL_USER3 20
#define wxSTC_MYSQL_HIDDENCOMMAND 21
// Lexical state for SCLEX_PO
#define wxSTC_PO_DEFAULT 0
#define wxSTC_PO_COMMENT 1
#define wxSTC_PO_MSGID 2
#define wxSTC_PO_MSGID_TEXT 3
#define wxSTC_PO_MSGSTR 4
#define wxSTC_PO_MSGSTR_TEXT 5
#define wxSTC_PO_MSGCTXT 6
#define wxSTC_PO_MSGCTXT_TEXT 7
#define wxSTC_PO_FUZZY 8
// Lexical states for SCLEX_PASCAL
#define wxSTC_PAS_DEFAULT 0
#define wxSTC_PAS_IDENTIFIER 1
#define wxSTC_PAS_COMMENT 2
#define wxSTC_PAS_COMMENT2 3
#define wxSTC_PAS_COMMENTLINE 4
#define wxSTC_PAS_PREPROCESSOR 5
#define wxSTC_PAS_PREPROCESSOR2 6
#define wxSTC_PAS_NUMBER 7
#define wxSTC_PAS_HEXNUMBER 8
#define wxSTC_PAS_WORD 9
#define wxSTC_PAS_STRING 10
#define wxSTC_PAS_STRINGEOL 11
#define wxSTC_PAS_CHARACTER 12
#define wxSTC_PAS_OPERATOR 13
#define wxSTC_PAS_ASM 14
// Lexical state for SCLEX_SORCUS
#define wxSTC_SORCUS_DEFAULT 0
#define wxSTC_SORCUS_COMMAND 1
#define wxSTC_SORCUS_PARAMETER 2
#define wxSTC_SORCUS_COMMENTLINE 3
#define wxSTC_SORCUS_STRING 4
#define wxSTC_SORCUS_STRINGEOL 5
#define wxSTC_SORCUS_IDENTIFIER 6
#define wxSTC_SORCUS_OPERATOR 7
#define wxSTC_SORCUS_NUMBER 8
#define wxSTC_SORCUS_CONSTANT 9
// Lexical state for SCLEX_POWERPRO
#define wxSTC_POWERPRO_DEFAULT 0
#define wxSTC_POWERPRO_COMMENTBLOCK 1
#define wxSTC_POWERPRO_COMMENTLINE 2
#define wxSTC_POWERPRO_NUMBER 3
#define wxSTC_POWERPRO_WORD 4
#define wxSTC_POWERPRO_WORD2 5
#define wxSTC_POWERPRO_WORD3 6
#define wxSTC_POWERPRO_WORD4 7
#define wxSTC_POWERPRO_DOUBLEQUOTEDSTRING 8
#define wxSTC_POWERPRO_SINGLEQUOTEDSTRING 9
#define wxSTC_POWERPRO_LINECONTINUE 10
#define wxSTC_POWERPRO_OPERATOR 11
#define wxSTC_POWERPRO_IDENTIFIER 12
#define wxSTC_POWERPRO_STRINGEOL 13
#define wxSTC_POWERPRO_VERBATIM 14
#define wxSTC_POWERPRO_ALTQUOTE 15
#define wxSTC_POWERPRO_FUNCTION 16
// Lexical states for SCLEX_SML
#define wxSTC_SML_DEFAULT 0
#define wxSTC_SML_IDENTIFIER 1
#define wxSTC_SML_TAGNAME 2
#define wxSTC_SML_KEYWORD 3
#define wxSTC_SML_KEYWORD2 4
#define wxSTC_SML_KEYWORD3 5
#define wxSTC_SML_LINENUM 6
#define wxSTC_SML_OPERATOR 7
#define wxSTC_SML_NUMBER 8
#define wxSTC_SML_CHAR 9
#define wxSTC_SML_STRING 11
#define wxSTC_SML_COMMENT 12
#define wxSTC_SML_COMMENT1 13
#define wxSTC_SML_COMMENT2 14
#define wxSTC_SML_COMMENT3 15
// Lexical state for SCLEX_MARKDOWN
#define wxSTC_MARKDOWN_DEFAULT 0
#define wxSTC_MARKDOWN_LINE_BEGIN 1
#define wxSTC_MARKDOWN_STRONG1 2
#define wxSTC_MARKDOWN_STRONG2 3
#define wxSTC_MARKDOWN_EM1 4
#define wxSTC_MARKDOWN_EM2 5
#define wxSTC_MARKDOWN_HEADER1 6
#define wxSTC_MARKDOWN_HEADER2 7
#define wxSTC_MARKDOWN_HEADER3 8
#define wxSTC_MARKDOWN_HEADER4 9
#define wxSTC_MARKDOWN_HEADER5 10
#define wxSTC_MARKDOWN_HEADER6 11
#define wxSTC_MARKDOWN_PRECHAR 12
#define wxSTC_MARKDOWN_ULIST_ITEM 13
#define wxSTC_MARKDOWN_OLIST_ITEM 14
#define wxSTC_MARKDOWN_BLOCKQUOTE 15
#define wxSTC_MARKDOWN_STRIKEOUT 16
#define wxSTC_MARKDOWN_HRULE 17
#define wxSTC_MARKDOWN_LINK 18
#define wxSTC_MARKDOWN_CODE 19
#define wxSTC_MARKDOWN_CODE2 20
#define wxSTC_MARKDOWN_CODEBK 21
//}}} //}}}
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -2039,7 +2251,7 @@ public:
// Set all style bytes to 0, remove all folding information. // Set all style bytes to 0, remove all folding information.
void ClearDocumentStyle(); void ClearDocumentStyle();
// Returns the number of characters in the document. // Returns the number of bytes in the document.
int GetLength() const; int GetLength() const;
// Returns the character byte at the position. // Returns the character byte at the position.
@@ -2290,10 +2502,10 @@ public:
// Set a style to be a hotspot or not. // Set a style to be a hotspot or not.
void StyleSetHotSpot(int style, bool hotspot); void StyleSetHotSpot(int style, bool hotspot);
// Set the foreground colour of the selection and whether to use this setting. // Set the foreground colour of the main and additional selections and whether to use this setting.
void SetSelForeground(bool useSetting, const wxColour& fore); void SetSelForeground(bool useSetting, const wxColour& fore);
// Set the background colour of the selection and whether to use this setting. // Set the background colour of the main and additional selections and whether to use this setting.
void SetSelBackground(bool useSetting, const wxColour& back); void SetSelBackground(bool useSetting, const wxColour& back);
// Get the alpha of the selection. // Get the alpha of the selection.
@@ -2333,7 +2545,7 @@ public:
void SetCaretPeriod(int periodMilliseconds); void SetCaretPeriod(int periodMilliseconds);
// Set the set of characters making up words for when moving or selecting by word. // Set the set of characters making up words for when moving or selecting by word.
// First sets deaults like SetCharsDefault. // First sets defaults like SetCharsDefault.
void SetWordChars(const wxString& characters); void SetWordChars(const wxString& characters);
// Start a sequence of actions that is undone and redone as a unit. // Start a sequence of actions that is undone and redone as a unit.
@@ -2367,6 +2579,12 @@ public:
// Set the background colour of all whitespace and whether to use this setting. // Set the background colour of all whitespace and whether to use this setting.
void SetWhitespaceBackground(bool useSetting, const wxColour& back); void SetWhitespaceBackground(bool useSetting, const wxColour& back);
// Set the size of the dots used to mark space characters.
void SetWhitespaceSize(int size);
// Get the size of the dots used to mark space characters.
int GetWhitespaceSize() const;
// Divide each styling byte into lexical class bits (default: 5) and indicator // Divide each styling byte into lexical class bits (default: 5) and indicator
// bits (default: 3). If a lexer requires more than 32 lexical states, then this // bits (default: 3). If a lexer requires more than 32 lexical states, then this
// is used to expand the possible states. // is used to expand the possible states.
@@ -2852,6 +3070,12 @@ public:
// Retrive the start indent for wrapped lines. // Retrive the start indent for wrapped lines.
int GetWrapStartIndent() const; int GetWrapStartIndent() const;
// Sets how wrapped sublines are placed. Default is fixed.
void SetWrapIndentMode(int mode);
// Retrieve how wrapped sublines are placed. Default is fixed.
int GetWrapIndentMode() const;
// Sets the degree of caching of layout information. // Sets the degree of caching of layout information.
void SetLayoutCache(int mode); void SetLayoutCache(int mode);
@@ -2903,6 +3127,9 @@ public:
// and then the foreground. This avoids chopping off characters that overlap the next run. // and then the foreground. This avoids chopping off characters that overlap the next run.
void SetTwoPhaseDraw(bool twoPhase); void SetTwoPhaseDraw(bool twoPhase);
// Scroll so that a display line is at the top of the display.
void SetFirstVisibleLine(int lineDisplay);
// Make the target range start and end be the same as the selection range start and end. // Make the target range start and end be the same as the selection range start and end.
void TargetFromSelection(); void TargetFromSelection();
@@ -3093,7 +3320,7 @@ public:
// Move the caret inside current view if it's not there already. // Move the caret inside current view if it's not there already.
void MoveCaretInsideView(); void MoveCaretInsideView();
// How many characters are on a line, not including end of line characters? // How many characters are on a line, including end of line characters?
int LineLength(int line) const; int LineLength(int line) const;
// Highlight the characters at two positions. // Highlight the characters at two positions.
@@ -3301,7 +3528,7 @@ public:
// Copy argument text to the clipboard. // Copy argument text to the clipboard.
void CopyText(int length, const wxString& text); void CopyText(int length, const wxString& text);
// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or // Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
// by lines (SC_SEL_LINES). // by lines (SC_SEL_LINES).
void SetSelectionMode(int mode); void SetSelectionMode(int mode);
@@ -3450,6 +3677,217 @@ public:
// How many entries are allocated to the position cache? // How many entries are allocated to the position cache?
int GetPositionCacheSize() const; int GetPositionCacheSize() const;
// Copy the selection, if selection empty copy the line with the caret
void CopyAllowLine();
// Compact the document buffer and return a read-only pointer to the
// characters in the document.
const char* GetCharacterPointer();
// Always interpret keyboard input as Unicode
void SetKeysUnicode(bool keysUnicode);
// Are keys always interpreted as Unicode?
bool GetKeysUnicode() const;
// Set the alpha fill colour of the given indicator.
void IndicatorSetAlpha(int indicator, int alpha);
// Get the alpha fill colour of the given indicator.
int IndicatorGetAlpha(int indicator) const;
// Set extra ascent for each line
void SetExtraAscent(int extraAscent);
// Get extra ascent for each line
int GetExtraAscent() const;
// Set extra descent for each line
void SetExtraDescent(int extraDescent);
// Get extra descent for each line
int GetExtraDescent() const;
// Which symbol was defined for markerNumber with MarkerDefine
int GetMarkerSymbolDefined(int markerNumber);
// Set the text in the text margin for a line
void MarginSetText(int line, const wxString& text);
// Get the text in the text margin for a line
wxString MarginGetText(int line) const;
// Set the style number for the text margin for a line
void MarginSetStyle(int line, int style);
// Get the style number for the text margin for a line
int MarginGetStyle(int line) const;
// Set the style in the text margin for a line
void MarginSetStyles(int line, const wxString& styles);
// Get the styles in the text margin for a line
wxString MarginGetStyles(int line) const;
// Clear the margin text on all lines
void MarginTextClearAll();
// Get the start of the range of style numbers used for margin text
void MarginSetStyleOffset(int style);
// Get the start of the range of style numbers used for margin text
int MarginGetStyleOffset() const;
// Set the annotation text for a line
void AnnotationSetText(int line, const wxString& text);
// Get the annotation text for a line
wxString AnnotationGetText(int line) const;
// Set the style number for the annotations for a line
void AnnotationSetStyle(int line, int style);
// Get the style number for the annotations for a line
int AnnotationGetStyle(int line) const;
// Set the annotation styles for a line
void AnnotationSetStyles(int line, const wxString& styles);
// Get the annotation styles for a line
wxString AnnotationGetStyles(int line) const;
// Get the number of annotation lines for a line
int AnnotationGetLines(int line) const;
// Clear the annotations from all lines
void AnnotationClearAll();
// Set the visibility for the annotations for a view
void AnnotationSetVisible(int visible);
// Get the visibility for the annotations for a view
int AnnotationGetVisible() const;
// Get the start of the range of style numbers used for annotations
void AnnotationSetStyleOffset(int style);
// Get the start of the range of style numbers used for annotations
int AnnotationGetStyleOffset() const;
// Add a container action to the undo stack
void AddUndoAction(int token, int flags);
// Find the position of a character from a point within the window.
int CharPositionFromPoint(int x, int y);
// Find the position of a character from a point within the window.
// Return INVALID_POSITION if not close to text.
int CharPositionFromPointClose(int x, int y);
// Set whether multiple selections can be made
void SetMultipleSelection(bool multipleSelection);
// Whether multiple selections can be made
bool GetMultipleSelection() const;
// Set whether typing can be performed into multiple selections
void SetAdditionalSelectionTyping(bool additionalSelectionTyping);
// Whether typing can be performed into multiple selections
bool GetAdditionalSelectionTyping() const;
// Set whether additional carets will blink
void SetAdditionalCaretsBlink(bool additionalCaretsBlink);
// Whether additional carets will blink
bool GetAdditionalCaretsBlink() const;
// Set whether additional carets are visible
void SetAdditionalCaretsVisible(bool additionalCaretsBlink);
// Whether additional carets are visible
bool GetAdditionalCaretsVisible() const;
// How many selections are there?
int GetSelections() const;
// Clear selections to a single empty stream selection
void ClearSelections();
// Add a selection
int AddSelection(int caret, int anchor);
// Set the main selection
void SetMainSelection(int selection);
// Which selection is the main selection
int GetMainSelection() const;
void SetSelectionNCaret(int selection, int pos);
int GetSelectionNCaret(int selection) const;
void SetSelectionNAnchor(int selection, int posAnchor);
int GetSelectionNAnchor(int selection) const;
void SetSelectionNCaretVirtualSpace(int selection, int space);
int GetSelectionNCaretVirtualSpace(int selection) const;
void SetSelectionNAnchorVirtualSpace(int selection, int space);
int GetSelectionNAnchorVirtualSpace(int selection) const;
// Sets the position that starts the selection - this becomes the anchor.
void SetSelectionNStart(int selection, int pos);
// Returns the position at the start of the selection.
int GetSelectionNStart(int selection) const;
// Sets the position that ends the selection - this becomes the currentPosition.
void SetSelectionNEnd(int selection, int pos);
// Returns the position at the end of the selection.
int GetSelectionNEnd(int selection) const;
void SetRectangularSelectionCaret(int pos);
int GetRectangularSelectionCaret() const;
void SetRectangularSelectionAnchor(int posAnchor);
int GetRectangularSelectionAnchor() const;
void SetRectangularSelectionCaretVirtualSpace(int space);
int GetRectangularSelectionCaretVirtualSpace() const;
void SetRectangularSelectionAnchorVirtualSpace(int space);
int GetRectangularSelectionAnchorVirtualSpace() const;
void SetVirtualSpaceOptions(int virtualSpaceOptions);
int GetVirtualSpaceOptions() const;
// On GTK+, allow selecting the modifier key to use for mouse-based
// rectangular selection. Often the window manager requires Alt+Mouse Drag
// for moving windows.
// Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
void SetRectangularSelectionModifier(int modifier);
// Get the modifier key used for rectangular selection.
int GetRectangularSelectionModifier() const;
// Set the foreground colour of additional selections.
// Must have previously called SetSelFore with non-zero first argument for this to have an effect.
void SetAdditionalSelForeground(const wxColour& fore);
// Set the background colour of additional selections.
// Must have previously called SetSelBack with non-zero first argument for this to have an effect.
void SetAdditionalSelBackground(const wxColour& back);
// Set the alpha of the selection.
void SetAdditionalSelAlpha(int alpha);
// Get the alpha of the selection.
int GetAdditionalSelAlpha() const;
// Set the foreground colour of additional carets.
void SetAdditionalCaretForeground(const wxColour& fore);
// Get the foreground colour of additional carets.
wxColour GetAdditionalCaretForeground() const;
// Set the main selection to the next selection.
void RotateSelection();
// Swap that caret and anchor of the main selection.
void SwapMainAnchorCaret();
// Start notifying the container of all key presses and commands. // Start notifying the container of all key presses and commands.
void StartRecord(); void StartRecord();
@@ -3988,6 +4426,8 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, wxStyledText
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_CLICK, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_CLICK, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent ); wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_RELEASE, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CANCELLED, wxStyledTextEvent );
wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_CHAR_DELETED, wxStyledTextEvent );
#else #else
enum { enum {
wxEVT_STC_CHANGE, wxEVT_STC_CHANGE,
@@ -4017,7 +4457,9 @@ wxDECLARE_EXPORTED_EVENT( WXDLLIMPEXP_STC, wxEVT_STC_INDICATOR_RELEASE, wxStyled
wxEVT_STC_CALLTIP_CLICK, wxEVT_STC_CALLTIP_CLICK,
wxEVT_STC_AUTOCOMP_SELECTION, wxEVT_STC_AUTOCOMP_SELECTION,
wxEVT_STC_INDICATOR_CLICK, wxEVT_STC_INDICATOR_CLICK,
wxEVT_STC_INDICATOR_RELEASE wxEVT_STC_INDICATOR_RELEASE,
wxEVT_STC_AUTOCOMP_CANCELLED,
wxEVT_STC_AUTOCOMP_CHAR_DELETED
}; };
#endif #endif
@@ -4057,6 +4499,8 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#define EVT_STC_AUTOCOMP_SELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_AUTOCOMP_SELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_INDICATOR_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_INDICATOR_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_CLICK, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_INDICATOR_RELEASE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ), #define EVT_STC_INDICATOR_RELEASE(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_INDICATOR_RELEASE, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_CANCELLED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CANCELLED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_CHAR_DELETED, id, wxID_ANY, wxStyledTextEventHandler( fn ), (wxObject *) NULL ),
#endif #endif

View File

@@ -316,6 +316,14 @@ public:
TOWRITE TOWRITE
@event{EVT_STC_AUTOCOMP_SELECTION(id, fn)} @event{EVT_STC_AUTOCOMP_SELECTION(id, fn)}
TOWRITE TOWRITE
@event{EVT_STC_INDICATOR_CLICK(id, fn)}
TOWRITE
@event{EVT_STC_INDICATOR_RELEASE(id, fn)}
TOWRITE
@event{EVT_STC_AUTOCOMP_CANCELLED(id, fn)}
TOWRITE
@event{EVT_STC_AUTOCOMP_CHAR_DELETED(id, fn)}
TOWRITE
@endEventTable @endEventTable
@library{wxbase} @library{wxbase}
@@ -1040,7 +1048,7 @@ public:
int GetLayoutCache() const; int GetLayoutCache() const;
/** /**
Returns the number of characters in the document. Returns the number of bytes in the document.
*/ */
int GetLength() const; int GetLength() const;
@@ -1568,7 +1576,7 @@ public:
int LineFromPosition(int pos) const; int LineFromPosition(int pos) const;
/** /**
How many characters are on a line, not including end of line characters? How many characters are on a line, including end of line characters?
*/ */
int LineLength(int line) const; int LineLength(int line) const;
@@ -2234,12 +2242,12 @@ public:
void SetSelAlpha(int alpha); void SetSelAlpha(int alpha);
/** /**
Set the background colour of the selection and whether to use this setting. Set the background colour of the main and additional selections and whether to use this setting.
*/ */
void SetSelBackground(bool useSetting, const wxColour& back); void SetSelBackground(bool useSetting, const wxColour& back);
/** /**
Set the foreground colour of the selection and whether to use this setting. Set the foreground colour of the main and additional selections and whether to use this setting.
*/ */
void SetSelForeground(bool useSetting, const wxColour& fore); void SetSelForeground(bool useSetting, const wxColour& fore);
@@ -2254,9 +2262,8 @@ public:
void SetSelectionEnd(int pos); void SetSelectionEnd(int pos);
/** /**
Set the selection mode to stream (SC_SEL_STREAM) or rectangular Set the selection mode to stream (wxSTC_SEL_STREAM) or rectangular
(SC_SEL_RECTANGLE) or (wxSTC_SEL_RECTANGLE/wxSTC_SEL_THIN) or by lines (wxSTC_SEL_LINES).
by lines (SC_SEL_LINES).
*/ */
void SetSelectionMode(int mode); void SetSelectionMode(int mode);
@@ -2398,9 +2405,20 @@ public:
void SetWhitespaceForeground(bool useSetting, void SetWhitespaceForeground(bool useSetting,
const wxColour& fore); const wxColour& fore);
/**
Set the size of the dots used to mark space characters.
*/
void SetWhitespaceSize(int size);
/**
Get the size of the dots used to mark space characters.
*/
int GetWhitespaceSize() const;
/** /**
Set the set of characters making up words for when moving or selecting by word. Set the set of characters making up words for when moving or selecting by word.
First sets deaults like SetCharsDefault. First sets defaults like SetCharsDefault.
*/ */
void SetWordChars(const wxString& characters); void SetWordChars(const wxString& characters);
@@ -2780,5 +2798,372 @@ public:
Make the displayed text smaller by decreasing the sizes by 1 point. Make the displayed text smaller by decreasing the sizes by 1 point.
*/ */
void ZoomOut(); void ZoomOut();
/**
Set the size of the dots used to mark space characters.
*/
void SetWhitespaceSize(int size);
/**
Get the size of the dots used to mark space characters.
*/
int GetWhitespaceSize() const;
/**
Sets how wrapped sublines are placed. Default is fixed.
*/
void SetWrapIndentMode(int mode);
/**
Retrieve how wrapped sublines are placed. Default is fixed.
*/
int GetWrapIndentMode() const;
/**
Scroll so that a display line is at the top of the display.
*/
void SetFirstVisibleLine(int lineDisplay);
/**
Copy the selection, if selection empty copy the line with the caret
*/
void CopyAllowLine();
/**
Compact the document buffer and return a read-only pointer to the
characters in the document.
*/
const char* GetCharacterPointer();
/**
Always interpret keyboard input as Unicode
*/
void SetKeysUnicode(bool keysUnicode);
/**
Are keys always interpreted as Unicode?
*/
bool GetKeysUnicode() const;
/**
Set the alpha fill colour of the given indicator.
*/
void IndicatorSetAlpha(int indicator, int alpha);
/**
Get the alpha fill colour of the given indicator.
*/
int IndicatorGetAlpha(int indicator) const;
/**
Set extra ascent for each line
*/
void SetExtraAscent(int extraAscent);
/**
Get extra ascent for each line
*/
int GetExtraAscent() const;
/**
Set extra descent for each line
*/
void SetExtraDescent(int extraDescent);
/**
Get extra descent for each line
*/
int GetExtraDescent() const;
/**
Which symbol was defined for markerNumber with MarkerDefine
*/
int GetMarkerSymbolDefined(int markerNumber);
/**
Set the text in the text margin for a line
*/
void MarginSetText(int line, const wxString& text);
/**
Get the text in the text margin for a line
*/
wxString MarginGetText(int line) const;
/**
Set the style number for the text margin for a line
*/
void MarginSetStyle(int line, int style);
/**
Get the style number for the text margin for a line
*/
int MarginGetStyle(int line) const;
/**
Set the style in the text margin for a line
*/
void MarginSetStyles(int line, const wxString& styles);
/**
Get the styles in the text margin for a line
*/
wxString MarginGetStyles(int line) const;
/**
Clear the margin text on all lines
*/
void MarginTextClearAll();
/**
Get the start of the range of style numbers used for margin text
*/
void MarginSetStyleOffset(int style);
/**
Get the start of the range of style numbers used for margin text
*/
int MarginGetStyleOffset() const;
/**
Set the annotation text for a line
*/
void AnnotationSetText(int line, const wxString& text);
/**
Get the annotation text for a line
*/
wxString AnnotationGetText(int line) const;
/**
Set the style number for the annotations for a line
*/
void AnnotationSetStyle(int line, int style);
/**
Get the style number for the annotations for a line
*/
int AnnotationGetStyle(int line) const;
/**
Set the annotation styles for a line
*/
void AnnotationSetStyles(int line, const wxString& styles);
/**
Get the annotation styles for a line
*/
wxString AnnotationGetStyles(int line) const;
/**
Get the number of annotation lines for a line
*/
int AnnotationGetLines(int line) const;
/**
Clear the annotations from all lines
*/
void AnnotationClearAll();
/**
Set the visibility for the annotations for a view
*/
void AnnotationSetVisible(int visible);
/**
Get the visibility for the annotations for a view
*/
int AnnotationGetVisible() const;
/**
Get the start of the range of style numbers used for annotations
*/
void AnnotationSetStyleOffset(int style);
/**
Get the start of the range of style numbers used for annotations
*/
int AnnotationGetStyleOffset() const;
/**
Add a container action to the undo stack
*/
void AddUndoAction(int token, int flags);
/**
Find the position of a character from a point within the window.
*/
int CharPositionFromPoint(int x, int y);
/**
Find the position of a character from a point within the window.
Return INVALID_POSITION if not close to text.
*/
int CharPositionFromPointClose(int x, int y);
/**
Set whether multiple selections can be made
*/
void SetMultipleSelection(bool multipleSelection);
/**
Whether multiple selections can be made
*/
bool GetMultipleSelection() const;
/**
Set whether typing can be performed into multiple selections
*/
void SetAdditionalSelectionTyping(bool additionalSelectionTyping);
/**
Whether typing can be performed into multiple selections
*/
bool GetAdditionalSelectionTyping() const;
/**
Set whether additional carets will blink
*/
void SetAdditionalCaretsBlink(bool additionalCaretsBlink);
/**
Whether additional carets will blink
*/
bool GetAdditionalCaretsBlink() const;
/**
Set whether additional carets are visible
*/
void SetAdditionalCaretsVisible(bool additionalCaretsBlink);
/**
Whether additional carets are visible
*/
bool GetAdditionalCaretsVisible() const;
/**
How many selections are there?
*/
int GetSelections() const;
/**
Clear selections to a single empty stream selection
*/
void ClearSelections();
/**
Add a selection
*/
int AddSelection(int caret, int anchor);
/**
Set the main selection
*/
void SetMainSelection(int selection);
/**
Which selection is the main selection
*/
int GetMainSelection() const;
void SetSelectionNCaret(int selection, int pos);
int GetSelectionNCaret(int selection) const;
void SetSelectionNAnchor(int selection, int posAnchor);
int GetSelectionNAnchor(int selection) const;
void SetSelectionNCaretVirtualSpace(int selection, int space);
int GetSelectionNCaretVirtualSpace(int selection) const;
void SetSelectionNAnchorVirtualSpace(int selection, int space);
int GetSelectionNAnchorVirtualSpace(int selection) const;
/**
Sets the position that starts the selection - this becomes the anchor.
*/
void SetSelectionNStart(int selection, int pos);
/**
Returns the position at the start of the selection.
*/
int GetSelectionNStart(int selection) const;
/**
Sets the position that ends the selection - this becomes the currentPosition.
*/
void SetSelectionNEnd(int selection, int pos);
/**
Returns the position at the end of the selection.
*/
int GetSelectionNEnd(int selection) const;
void SetRectangularSelectionCaret(int pos);
int GetRectangularSelectionCaret() const;
void SetRectangularSelectionAnchor(int posAnchor);
int GetRectangularSelectionAnchor() const;
void SetRectangularSelectionCaretVirtualSpace(int space);
int GetRectangularSelectionCaretVirtualSpace() const;
void SetRectangularSelectionAnchorVirtualSpace(int space);
int GetRectangularSelectionAnchorVirtualSpace() const;
void SetVirtualSpaceOptions(int virtualSpaceOptions);
int GetVirtualSpaceOptions() const;
/**
Select the modifier key to use for mouse-based rectangular selection.
*/
void SetRectangularSelectionModifier(int modifier);
/**
Get the modifier key used for rectangular selection.
*/
int GetRectangularSelectionModifier() const;
/**
Set the foreground colour of additional selections. Must have
previously called SetSelFore with non-zero first argument for this to
have an effect.
*/
void SetAdditionalSelForeground(const wxColour& fore);
/**
Set the background colour of additional selections. Must have
previously called SetSelBack with non-zero first argument for this to
have an effect.
*/
void SetAdditionalSelBackground(const wxColour& back);
/**
Set the alpha of the selection.
*/
void SetAdditionalSelAlpha(int alpha);
/**
Get the alpha of the selection.
*/
int GetAdditionalSelAlpha() const;
/**
Set the foreground colour of additional carets.
*/
void SetAdditionalCaretForeground(const wxColour& fore);
/**
Get the foreground colour of additional carets.
*/
wxColour GetAdditionalCaretForeground() const;
/**
Set the main selection to the next selection.
*/
void RotateSelection();
/**
Swap that caret and anchor of the main selection.
*/
void SwapMainAnchorCaret();
}; };

View File

@@ -102,6 +102,7 @@ BEGIN_EVENT_TABLE (Edit, wxStyledTextCtrl)
// stc // stc
EVT_STC_MARGINCLICK (wxID_ANY, Edit::OnMarginClick) EVT_STC_MARGINCLICK (wxID_ANY, Edit::OnMarginClick)
EVT_STC_CHARADDED (wxID_ANY, Edit::OnCharAdded) EVT_STC_CHARADDED (wxID_ANY, Edit::OnCharAdded)
EVT_STC_KEY( wxID_ANY , Edit::OnKey )
END_EVENT_TABLE() END_EVENT_TABLE()
Edit::Edit (wxWindow *parent, wxWindowID id, Edit::Edit (wxWindow *parent, wxWindowID id,
@@ -189,6 +190,11 @@ void Edit::OnEditClear (wxCommandEvent &WXUNUSED(event)) {
Clear (); Clear ();
} }
void Edit::OnKey (wxStyledTextEvent &event)
{
wxMessageBox("OnKey");
}
void Edit::OnEditCut (wxCommandEvent &WXUNUSED(event)) { void Edit::OnEditCut (wxCommandEvent &WXUNUSED(event)) {
if (GetReadOnly() || (GetSelectionEnd()-GetSelectionStart() <= 0)) return; if (GetReadOnly() || (GetSelectionEnd()-GetSelectionStart() <= 0)) return;
Cut (); Cut ();

View File

@@ -97,6 +97,7 @@ public:
// stc // stc
void OnMarginClick (wxStyledTextEvent &event); void OnMarginClick (wxStyledTextEvent &event);
void OnCharAdded (wxStyledTextEvent &event); void OnCharAdded (wxStyledTextEvent &event);
void OnKey (wxStyledTextEvent &event);
//! language/lexer //! language/lexer
wxString DeterminePrefs (const wxString &filename); wxString DeterminePrefs (const wxString &filename);

View File

@@ -1275,7 +1275,7 @@ bool wxWindowBase::RemoveEventHandler(wxEvtHandler *handlerToRemove)
// NOTE: the wxWindow event handler list is always terminated with "this" handler // NOTE: the wxWindow event handler list is always terminated with "this" handler
wxEvtHandler *handlerCur = GetEventHandler()->GetNextHandler(); wxEvtHandler *handlerCur = GetEventHandler()->GetNextHandler();
while ( handlerCur != this ) while ( handlerCur != this && handlerCur )
{ {
wxEvtHandler *handlerNext = handlerCur->GetNextHandler(); wxEvtHandler *handlerNext = handlerCur->GetNextHandler();

View File

@@ -141,6 +141,7 @@ STCDLL_OBJECTS = \
stcdll_PropSet.o \ stcdll_PropSet.o \
stcdll_RESearch.o \ stcdll_RESearch.o \
stcdll_ScintillaBase.o \ stcdll_ScintillaBase.o \
stcdll_Selection.o \
stcdll_Style.o \ stcdll_Style.o \
stcdll_StyleContext.o \ stcdll_StyleContext.o \
stcdll_UniConversion.o \ stcdll_UniConversion.o \
@@ -231,6 +232,7 @@ STCLIB_OBJECTS = \
stclib_PropSet.o \ stclib_PropSet.o \
stclib_RESearch.o \ stclib_RESearch.o \
stclib_ScintillaBase.o \ stclib_ScintillaBase.o \
stcdll_Selection.o \
stclib_Style.o \ stclib_Style.o \
stclib_StyleContext.o \ stclib_StyleContext.o \
stclib_UniConversion.o \ stclib_UniConversion.o \
@@ -661,6 +663,9 @@ stcdll_RESearch.o: $(srcdir)/scintilla/src/RESearch.cxx
stcdll_ScintillaBase.o: $(srcdir)/scintilla/src/ScintillaBase.cxx stcdll_ScintillaBase.o: $(srcdir)/scintilla/src/ScintillaBase.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/ScintillaBase.cxx $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/ScintillaBase.cxx
stcdll_Selection.o: $(srcdir)/scintilla/src/Selction.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/Selection.cxx
stcdll_Style.o: $(srcdir)/scintilla/src/Style.cxx stcdll_Style.o: $(srcdir)/scintilla/src/Style.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/Style.cxx $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/Style.cxx
@@ -913,6 +918,9 @@ stclib_RESearch.o: $(srcdir)/scintilla/src/RESearch.cxx
stclib_ScintillaBase.o: $(srcdir)/scintilla/src/ScintillaBase.cxx stclib_ScintillaBase.o: $(srcdir)/scintilla/src/ScintillaBase.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/ScintillaBase.cxx $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/ScintillaBase.cxx
stclib_Selection.o: $(srcdir)/scintilla/src/Selection.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/Selection.cxx
stclib_Style.o: $(srcdir)/scintilla/src/Style.cxx stclib_Style.o: $(srcdir)/scintilla/src/Style.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/Style.cxx $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/Style.cxx

View File

@@ -45,7 +45,6 @@
#include "wx/stc/private.h" #include "wx/stc/private.h"
Point Point::FromLong(long lpoint) { Point Point::FromLong(long lpoint) {
return Point(lpoint & 0xFFFF, lpoint >> 16); return Point(lpoint & 0xFFFF, lpoint >> 16);
} }
@@ -142,7 +141,7 @@ void Palette::Allocate(Window &) {
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Font::Font() { Font::Font() {
id = 0; fid = 0;
ascent = 0; ascent = 0;
} }
@@ -151,7 +150,7 @@ Font::~Font() {
void Font::Create(const char *faceName, int characterSet, void Font::Create(const char *faceName, int characterSet,
int size, bool bold, bool italic, int size, bool bold, bool italic,
bool WXUNUSED(extraFontFlag)) { int WXUNUSED(extraFontFlag)) {
Release(); Release();
// The minus one is done because since Scintilla uses SC_SHARSET_DEFAULT // The minus one is done because since Scintilla uses SC_SHARSET_DEFAULT
@@ -171,14 +170,14 @@ void Font::Create(const char *faceName, int characterSet,
false, false,
stc2wx(faceName), stc2wx(faceName),
encoding); encoding);
id = font; fid = font;
} }
void Font::Release() { void Font::Release() {
if (id) if (fid)
delete (wxFont*)id; delete (wxFont*)fid;
id = 0; fid = 0;
} }
//---------------------------------------------------------------------- //----------------------------------------------------------------------
@@ -648,26 +647,26 @@ Window::~Window() {
} }
void Window::Destroy() { void Window::Destroy() {
if (id) { if (wid) {
Show(false); Show(false);
GETWIN(id)->Destroy(); GETWIN(wid)->Destroy();
} }
id = 0; wid = 0;
} }
bool Window::HasFocus() { bool Window::HasFocus() {
return wxWindow::FindFocus() == GETWIN(id); return wxWindow::FindFocus() == GETWIN(wid);
} }
PRectangle Window::GetPosition() { PRectangle Window::GetPosition() {
if (! id) return PRectangle(); if (! wid) return PRectangle();
wxRect rc(GETWIN(id)->GetPosition(), GETWIN(id)->GetSize()); wxRect rc(GETWIN(wid)->GetPosition(), GETWIN(wid)->GetSize());
return PRectangleFromwxRect(rc); return PRectangleFromwxRect(rc);
} }
void Window::SetPosition(PRectangle rc) { void Window::SetPosition(PRectangle rc) {
wxRect r = wxRectFromPRectangle(rc); wxRect r = wxRectFromPRectangle(rc);
GETWIN(id)->SetSize(r); GETWIN(wid)->SetSize(r);
} }
void Window::SetPositionRelative(PRectangle rc, Window) { void Window::SetPositionRelative(PRectangle rc, Window) {
@@ -675,26 +674,26 @@ void Window::SetPositionRelative(PRectangle rc, Window) {
} }
PRectangle Window::GetClientPosition() { PRectangle Window::GetClientPosition() {
if (! id) return PRectangle(); if (! wid) return PRectangle();
wxSize sz = GETWIN(id)->GetClientSize(); wxSize sz = GETWIN(wid)->GetClientSize();
return PRectangle(0, 0, sz.x, sz.y); return PRectangle(0, 0, sz.x, sz.y);
} }
void Window::Show(bool show) { void Window::Show(bool show) {
GETWIN(id)->Show(show); GETWIN(wid)->Show(show);
} }
void Window::InvalidateAll() { void Window::InvalidateAll() {
GETWIN(id)->Refresh(false); GETWIN(wid)->Refresh(false);
} }
void Window::InvalidateRectangle(PRectangle rc) { void Window::InvalidateRectangle(PRectangle rc) {
wxRect r = wxRectFromPRectangle(rc); wxRect r = wxRectFromPRectangle(rc);
GETWIN(id)->Refresh(false, &r); GETWIN(wid)->Refresh(false, &r);
} }
void Window::SetFont(Font &font) { void Window::SetFont(Font &font) {
GETWIN(id)->SetFont(*((wxFont*)font.GetID())); GETWIN(wid)->SetFont(*((wxFont*)font.GetID()));
} }
void Window::SetCursor(Cursor curs) { void Window::SetCursor(Cursor curs) {
@@ -733,21 +732,21 @@ void Window::SetCursor(Cursor curs) {
wxCursor wc = wxCursor(cursorId); wxCursor wc = wxCursor(cursorId);
if(curs != cursorLast) if(curs != cursorLast)
{ {
GETWIN(id)->SetCursor(wc); GETWIN(wid)->SetCursor(wc);
cursorLast = curs; cursorLast = curs;
} }
} }
void Window::SetTitle(const char *s) { void Window::SetTitle(const char *s) {
GETWIN(id)->SetLabel(stc2wx(s)); GETWIN(wid)->SetLabel(stc2wx(s));
} }
// Returns rectangle of monitor pt is on // Returns rectangle of monitor pt is on
PRectangle Window::GetMonitorRect(Point pt) { PRectangle Window::GetMonitorRect(Point pt) {
wxRect rect; wxRect rect;
if (! id) return PRectangle(); if (! wid) return PRectangle();
#if wxUSE_DISPLAY #if wxUSE_DISPLAY
// Get the display the point is found on // Get the display the point is found on
int n = wxDisplay::GetFromPoint(wxPoint(pt.x, pt.y)); int n = wxDisplay::GetFromPoint(wxPoint(pt.x, pt.y));
@@ -823,15 +822,6 @@ END_EVENT_TABLE()
#if wxUSE_POPUPWIN //----------------------------------- #if wxUSE_POPUPWIN //-----------------------------------
#include "wx/popupwin.h" #include "wx/popupwin.h"
//
// TODO: Refactor these two classes to have a common base (or a mix-in) to get
// rid of the code duplication. (Either that or convince somebody to
// implement wxPopupWindow for the Mac!!)
//
// In the meantime, be careful to duplicate any changes as needed...
//
// A popup window to place the wxSTCListBox upon // A popup window to place the wxSTCListBox upon
class wxSTCListBoxWin : public wxPopupWindow class wxSTCListBoxWin : public wxPopupWindow
{ {
@@ -841,11 +831,9 @@ private:
void* doubleClickActionData; void* doubleClickActionData;
public: public:
wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point WXUNUSED(location)) : wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point WXUNUSED(location)) :
wxPopupWindow(parent, wxBORDER_NONE) wxPopupWindow(parent, wxBORDER_SIMPLE)
{ {
SetBackgroundColour(*wxBLACK); // for our simple border
lv = new wxSTCListBox(parent, id, wxPoint(-50,-50), wxDefaultSize, lv = new wxSTCListBox(parent, id, wxPoint(-50,-50), wxDefaultSize,
wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER | wxBORDER_NONE); wxLC_REPORT | wxLC_SINGLE_SEL | wxLC_NO_HEADER | wxBORDER_NONE);
lv->SetCursor(wxCursor(wxCURSOR_ARROW)); lv->SetCursor(wxCursor(wxCURSOR_ARROW));
@@ -919,11 +907,9 @@ public:
} }
void OnSize(wxSizeEvent& event) { void OnSize(wxSizeEvent& event) {
// resize the child // resize the child to fill the popup
wxSize sz = GetSize(); wxSize sz = GetClientSize();
sz.x -= 2; lv->SetSize(0, 0, sz.x, sz.y);
sz.y -= 2;
lv->SetSize(1, 1, sz.x, sz.y);
// reset the column widths // reset the column widths
lv->SetColumnWidth(0, IconWidth()+4); lv->SetColumnWidth(0, IconWidth()+4);
lv->SetColumnWidth(1, sz.x - 2 - lv->GetColumnWidth(0) - lv->SetColumnWidth(1, sz.x - 2 - lv->GetColumnWidth(0) -
@@ -1170,7 +1156,7 @@ ListBoxImpl::~ListBoxImpl() {
void ListBoxImpl::SetFont(Font &font) { void ListBoxImpl::SetFont(Font &font) {
GETLB(id)->SetFont(*((wxFont*)font.GetID())); GETLB(wid)->SetFont(*((wxFont*)font.GetID()));
} }
@@ -1179,9 +1165,9 @@ void ListBoxImpl::Create(Window &parent, int ctrlID, Point location_, int lineHe
lineHeight = lineHeight_; lineHeight = lineHeight_;
unicodeMode = unicodeMode_; unicodeMode = unicodeMode_;
maxStrWidth = 0; maxStrWidth = 0;
id = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID, location); wid = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID, location);
if (imgList != NULL) if (imgList != NULL)
GETLB(id)->SetImageList(imgList, wxIMAGE_LIST_SMALL); GETLB(wid)->SetImageList(imgList, wxIMAGE_LIST_SMALL);
} }
@@ -1208,15 +1194,15 @@ PRectangle ListBoxImpl::GetDesiredRect() {
// give it a default if there are no lines, and/or add a bit more // give it a default if there are no lines, and/or add a bit more
if (maxw == 0) maxw = 100; if (maxw == 0) maxw = 100;
maxw += aveCharWidth * 3 + maxw += aveCharWidth * 3 +
GETLBW(id)->IconWidth() + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X); GETLBW(wid)->IconWidth() + wxSystemSettings::GetMetric(wxSYS_VSCROLL_X);
if (maxw > 350) if (maxw > 350)
maxw = 350; maxw = 350;
// estimate a desired height // estimate a desired height
int count = GETLB(id)->GetItemCount(); int count = GETLB(wid)->GetItemCount();
if (count) { if (count) {
wxRect rect; wxRect rect;
GETLB(id)->GetItemRect(0, rect); GETLB(wid)->GetItemRect(0, rect);
maxh = count * rect.GetHeight(); maxh = count * rect.GetHeight();
if (maxh > 140) // TODO: Use desiredVisibleRows?? if (maxh > 140) // TODO: Use desiredVisibleRows??
maxh = 140; maxh = 140;
@@ -1238,12 +1224,12 @@ PRectangle ListBoxImpl::GetDesiredRect() {
int ListBoxImpl::CaretFromEdge() { int ListBoxImpl::CaretFromEdge() {
return 4 + GETLBW(id)->IconWidth(); return 4 + GETLBW(wid)->IconWidth();
} }
void ListBoxImpl::Clear() { void ListBoxImpl::Clear() {
GETLB(id)->DeleteAllItems(); GETLB(wid)->DeleteAllItems();
} }
@@ -1252,20 +1238,20 @@ void ListBoxImpl::Append(char *s, int type) {
} }
void ListBoxImpl::Append(const wxString& text, int type) { void ListBoxImpl::Append(const wxString& text, int type) {
long count = GETLB(id)->GetItemCount(); long count = GETLB(wid)->GetItemCount();
long itemID = GETLB(id)->InsertItem(count, wxEmptyString); long itemID = GETLB(wid)->InsertItem(count, wxEmptyString);
long idx = -1; long idx = -1;
GETLB(id)->SetItem(itemID, 1, text); GETLB(wid)->SetItem(itemID, 1, text);
maxStrWidth = wxMax(maxStrWidth, text.length()); maxStrWidth = wxMax(maxStrWidth, text.length());
if (type != -1) { if (type != -1) {
wxCHECK_RET(imgTypeMap, wxT("Unexpected NULL imgTypeMap")); wxCHECK_RET(imgTypeMap, wxT("Unexpected NULL imgTypeMap"));
idx = imgTypeMap->Item(type); idx = imgTypeMap->Item(type);
} }
GETLB(id)->SetItemImage(itemID, idx, idx); GETLB(wid)->SetItemImage(itemID, idx, idx);
} }
void ListBoxImpl::SetList(const char* list, char separator, char typesep) { void ListBoxImpl::SetList(const char* list, char separator, char typesep) {
GETLB(id)->Freeze(); GETLB(wid)->Freeze();
Clear(); Clear();
wxStringTokenizer tkzr(stc2wx(list), (wxChar)separator); wxStringTokenizer tkzr(stc2wx(list), (wxChar)separator);
while ( tkzr.HasMoreTokens() ) { while ( tkzr.HasMoreTokens() ) {
@@ -1278,12 +1264,12 @@ void ListBoxImpl::SetList(const char* list, char separator, char typesep) {
} }
Append(token, (int)type); Append(token, (int)type);
} }
GETLB(id)->Thaw(); GETLB(wid)->Thaw();
} }
int ListBoxImpl::Length() { int ListBoxImpl::Length() {
return GETLB(id)->GetItemCount(); return GETLB(wid)->GetItemCount();
} }
@@ -1293,13 +1279,13 @@ void ListBoxImpl::Select(int n) {
n = 0; n = 0;
select = false; select = false;
} }
GETLB(id)->EnsureVisible(n); GETLB(wid)->EnsureVisible(n);
GETLB(id)->Select(n, select); GETLB(wid)->Select(n, select);
} }
int ListBoxImpl::GetSelection() { int ListBoxImpl::GetSelection() {
return GETLB(id)->GetFirstSelected(); return GETLB(wid)->GetFirstSelected();
} }
@@ -1314,7 +1300,7 @@ void ListBoxImpl::GetValue(int n, char *value, int len) {
item.SetId(n); item.SetId(n);
item.SetColumn(1); item.SetColumn(1);
item.SetMask(wxLIST_MASK_TEXT); item.SetMask(wxLIST_MASK_TEXT);
GETLB(id)->GetItem(item); GETLB(wid)->GetItem(item);
strncpy(value, wx2stc(item.GetText()), len); strncpy(value, wx2stc(item.GetText()), len);
value[len-1] = '\0'; value[len-1] = '\0';
} }
@@ -1351,13 +1337,13 @@ void ListBoxImpl::ClearRegisteredImages() {
delete imgTypeMap; delete imgTypeMap;
imgTypeMap = NULL; imgTypeMap = NULL;
} }
if (id) if (wid)
GETLB(id)->SetImageList(NULL, wxIMAGE_LIST_SMALL); GETLB(wid)->SetImageList(NULL, wxIMAGE_LIST_SMALL);
} }
void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data) { void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data) {
GETLBW(id)->SetDoubleClickAction(action, data); GETLBW(wid)->SetDoubleClickAction(action, data);
} }
@@ -1373,22 +1359,22 @@ ListBox *ListBox::Allocate() {
//---------------------------------------------------------------------- //----------------------------------------------------------------------
Menu::Menu() : id(0) { Menu::Menu() : mid(0) {
} }
void Menu::CreatePopUp() { void Menu::CreatePopUp() {
Destroy(); Destroy();
id = new wxMenu(); mid = new wxMenu();
} }
void Menu::Destroy() { void Menu::Destroy() {
if (id) if (mid)
delete (wxMenu*)id; delete (wxMenu*)mid;
id = 0; mid = 0;
} }
void Menu::Show(Point pt, Window &w) { void Menu::Show(Point pt, Window &w) {
GETWIN(w.GetID())->PopupMenu((wxMenu*)id, pt.x - 4, pt.y); GETWIN(w.GetID())->PopupMenu((wxMenu*)mid, pt.x - 4, pt.y);
Destroy(); Destroy();
} }

View File

@@ -301,7 +301,7 @@ void ScintillaWX::StartDrag() {
if (result == wxDragMove && dropWentOutside) if (result == wxDragMove && dropWentOutside)
ClearSelection(); ClearSelection();
inDragDrop = ddNone; inDragDrop = ddNone;
SetDragPosition(invalidPosition); SetDragPosition(SelectionPosition(invalidPosition));
} }
#endif // wxUSE_DRAG_AND_DROP #endif // wxUSE_DRAG_AND_DROP
} }
@@ -472,7 +472,7 @@ void ScintillaWX::CancelModes() {
void ScintillaWX::Copy() { void ScintillaWX::Copy() {
if (currentPos != anchor) { if (!sel.Empty()) {
SelectionText st; SelectionText st;
CopySelectionRange(&st); CopySelectionRange(&st);
CopyToClipboard(st); CopyToClipboard(st);
@@ -504,8 +504,9 @@ void ScintillaWX::Paste() {
text = wxEmptyString; text = wxEmptyString;
#endif #endif
int len = strlen(buf); int len = strlen(buf);
pdoc->InsertString(currentPos, buf, len); int caretMain = sel.MainCaret();
SetEmptySelection(currentPos + len); pdoc->InsertString(caretMain, buf, len);
SetEmptySelection(caretMain + len);
} }
#endif // wxUSE_DATAOBJ #endif // wxUSE_DATAOBJ
@@ -580,7 +581,7 @@ void ScintillaWX::AddToPopUp(const char *label, int cmd, bool enabled) {
void ScintillaWX::ClaimSelection() { void ScintillaWX::ClaimSelection() {
#ifdef __WXGTK__ #ifdef __WXGTK__
// Put the selected text in the PRIMARY selection // Put the selected text in the PRIMARY selection
if (currentPos != anchor) { if (!sel.Empty()) {
SelectionText st; SelectionText st;
CopySelectionRange(&st); CopySelectionRange(&st);
wxTheClipboard->UsePrimarySelection(true); wxTheClipboard->UsePrimarySelection(true);
@@ -602,7 +603,7 @@ void ScintillaWX::UpdateSystemCaret() {
DestroySystemCaret(); DestroySystemCaret();
CreateSystemCaret(); CreateSystemCaret();
} }
Point pos = LocationFromPosition(currentPos); Point pos = PointMainCaret();
::SetCaretPos(pos.x, pos.y); ::SetCaretPos(pos.x, pos.y);
} }
#endif #endif
@@ -679,7 +680,8 @@ sptr_t ScintillaWX::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam)
{ {
ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back); ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
} }
PRectangle rc = ct.CallTipStart(currentPos, pt, int caretMain = sel.MainCaret();
PRectangle rc = ct.CallTipStart(caretMain, pt,
defn, defn,
vs.styles[ctStyle].fontName, vs.styles[ctStyle].fontName,
vs.styles[ctStyle].sizeZoomed, vs.styles[ctStyle].sizeZoomed,
@@ -862,7 +864,7 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) {
// Set the current position to the mouse click point and // Set the current position to the mouse click point and
// then paste in the PRIMARY selection, if any. wxGTK only. // then paste in the PRIMARY selection, if any. wxGTK only.
int newPos = PositionFromLocation(pt); int newPos = PositionFromLocation(pt);
MovePositionTo(newPos, noSel, true); MovePositionTo(newPos, Selection::noSel, true);
pdoc->BeginUndoAction(); pdoc->BeginUndoAction();
wxTextDataObject data; wxTextDataObject data;
@@ -878,8 +880,9 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) {
wxConvertEOLMode(pdoc->eolMode)); wxConvertEOLMode(pdoc->eolMode));
wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text); wxWX2MBbuf buf = (wxWX2MBbuf)wx2stc(text);
int len = strlen(buf); int len = strlen(buf);
pdoc->InsertString(currentPos, buf, len); int caretMain = sel.MainCaret();
SetEmptySelection(currentPos + len); pdoc->InsertString(caretMain, buf, len);
SetEmptySelection(caretMain + len);
} }
pdoc->EndUndoAction(); pdoc->EndUndoAction();
NotifyChange(); NotifyChange();
@@ -1007,7 +1010,7 @@ void ScintillaWX::DoOnIdle(wxIdleEvent& evt) {
#if wxUSE_DRAG_AND_DROP #if wxUSE_DRAG_AND_DROP
bool ScintillaWX::DoDropText(long x, long y, const wxString& data) { bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
SetDragPosition(invalidPosition); SetDragPosition(SelectionPosition(invalidPosition));
wxString text = wxTextBuffer::Translate(data, wxString text = wxTextBuffer::Translate(data,
wxConvertEOLMode(pdoc->eolMode)); wxConvertEOLMode(pdoc->eolMode));
@@ -1024,7 +1027,7 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
dragResult = evt.GetDragResult(); dragResult = evt.GetDragResult();
if (dragResult == wxDragMove || dragResult == wxDragCopy) { if (dragResult == wxDragMove || dragResult == wxDragCopy) {
DropAt(evt.GetPosition(), DropAt(SelectionPosition(evt.GetPosition()),
wx2stc(evt.GetDragText()), wx2stc(evt.GetDragText()),
dragResult == wxDragMove, dragResult == wxDragMove,
false); // TODO: rectangular? false); // TODO: rectangular?
@@ -1041,7 +1044,7 @@ wxDragResult ScintillaWX::DoDragEnter(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) { wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
SetDragPosition(PositionFromLocation(Point(x, y))); SetDragPosition(SelectionPosition(PositionFromLocation(Point(x, y))));
// Send an event to allow the drag result to be changed // Send an event to allow the drag result to be changed
wxStyledTextEvent evt(wxEVT_STC_DRAG_OVER, stc->GetId()); wxStyledTextEvent evt(wxEVT_STC_DRAG_OVER, stc->GetId());
@@ -1058,7 +1061,7 @@ wxDragResult ScintillaWX::DoDragOver(wxCoord x, wxCoord y, wxDragResult def) {
void ScintillaWX::DoDragLeave() { void ScintillaWX::DoDragLeave() {
SetDragPosition(invalidPosition); SetDragPosition(SelectionPosition(invalidPosition));
} }
#endif // wxUSE_DRAG_AND_DROP #endif // wxUSE_DRAG_AND_DROP
//---------------------------------------------------------------------- //----------------------------------------------------------------------

View File

@@ -26,32 +26,35 @@
#include <string.h> #include <string.h>
#include "Platform.h" #include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "CharClassify.h"
#include "XPM.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
#endif
#include "SplitVector.h" #include "SplitVector.h"
#include "Partitioning.h" #include "Partitioning.h"
#include "RunStyles.h" #include "RunStyles.h"
#include "Scintilla.h"
#include "ScintillaWidget.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#endif
#include "ContractionState.h" #include "ContractionState.h"
#include "SVector.h"
#include "CellBuffer.h" #include "CellBuffer.h"
#include "CallTip.h" #include "CallTip.h"
#include "KeyMap.h" #include "KeyMap.h"
#include "Indicator.h" #include "Indicator.h"
#include "XPM.h"
#include "LineMarker.h" #include "LineMarker.h"
#include "Style.h" #include "Style.h"
#include "ViewStyle.h"
#include "AutoComplete.h" #include "AutoComplete.h"
#include "ViewStyle.h"
#include "CharClassify.h"
#include "Decoration.h" #include "Decoration.h"
#include "Document.h" #include "Document.h"
#include "Selection.h"
#include "PositionCache.h" #include "PositionCache.h"
#include "Editor.h" #include "Editor.h"
#include "PropSetSimple.h"
#include "ScintillaBase.h" #include "ScintillaBase.h"
#ifdef __WXMSW__ #ifdef __WXMSW__

View File

@@ -21,7 +21,10 @@ H_TEMPLATE = os.path.abspath('./stc.h.in')
CPP_TEMPLATE = os.path.abspath('./stc.cpp.in') CPP_TEMPLATE = os.path.abspath('./stc.cpp.in')
H_DEST = os.path.abspath('../../include/wx/stc/stc.h') H_DEST = os.path.abspath('../../include/wx/stc/stc.h')
CPP_DEST = os.path.abspath('./stc.cpp') CPP_DEST = os.path.abspath('./stc.cpp')
DOCSTR_DEST = '/dev/null' #os.path.abspath('../../../wxPython/contrib/stc/_stc_gendocs.i') if len(sys.argv) > 1 and sys.argv[1] == '--wxpython':
DOCSTR_DEST = os.path.abspath('../../../wxPython/src/_stc_gendocs.i')
else:
DOCSTR_DEST = '/dev/null'
# Value prefixes to convert # Value prefixes to convert
@@ -29,6 +32,7 @@ valPrefixes = [('SCI_', ''),
('SC_', ''), ('SC_', ''),
('SCN_', None), # just toss these out... ('SCN_', None), # just toss these out...
('SCEN_', None), ('SCEN_', None),
('SC_EFF', None),
('SCE_', ''), ('SCE_', ''),
('SCLEX_', 'LEX_'), ('SCLEX_', 'LEX_'),
('SCK_', 'KEY_'), ('SCK_', 'KEY_'),
@@ -177,6 +181,8 @@ methodOverrideMap = {
'MarkerSetFore' : ('MarkerSetForeground', 0, 0, 0), 'MarkerSetFore' : ('MarkerSetForeground', 0, 0, 0),
'MarkerSetBack' : ('MarkerSetBackground', 0, 0, 0), 'MarkerSetBack' : ('MarkerSetBackground', 0, 0, 0),
'MarkerSymbolDefined' : ('GetMarkerSymbolDefined', 0, 0, 0),
'MarkerDefine' : 'MarkerDefine' :
(0, (0,
'''void %s(int markerNumber, int markerSymbol, '''void %s(int markerNumber, int markerSymbol,
@@ -226,6 +232,74 @@ methodOverrideMap = {
'SetMarginSensitiveN' : ('SetMarginSensitive', 0, 0, 0), 'SetMarginSensitiveN' : ('SetMarginSensitive', 0, 0, 0),
'GetMarginSensitiveN' : ('GetMarginSensitive', 0, 0, 0), 'GetMarginSensitiveN' : ('GetMarginSensitive', 0, 0, 0),
'MarginGetText' :
(0,
'wxString %s(int line) const;',
'''wxString %s(int line) const {
long msg = %s;
long len = SendMsg(msg, line, 0);
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(msg, line, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
0),
'MarginGetStyles' :
(0,
'wxString %s(int line) const;',
'''wxString %s(int line) const {
long msg = %s;
long len = SendMsg(msg, line, 0);
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(msg, line, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
0),
'SetAdditionalSelFore' : ('SetAdditionalSelForeground', 0, 0, 0),
'SetAdditionalSelBack' : ('SetAdditionalSelBackground', 0, 0, 0),
'SetAdditionalCaretFore' : ('SetAdditionalCaretForeground', 0, 0, 0),
'GetAdditionalCaretFore' : ('GetAdditionalCaretForeground', 0, 0, 0),
'AnnotationGetText' :
(0,
'wxString %s(int line) const;',
'''wxString %s(int line) const {
long msg = %s;
long len = SendMsg(msg, line, 0);
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(msg, line, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
0),
'AnnotationGetStyles' :
(0,
'wxString %s(int line) const;',
'''wxString %s(int line) const {
long msg = %s;
long len = SendMsg(msg, line, 0);
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(msg, line, (sptr_t)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
0),
'StyleGetFore' : ('StyleGetForeground', 0, 0, 0), 'StyleGetFore' : ('StyleGetForeground', 0, 0, 0),
'StyleGetBack' : ('StyleGetBackground', 0, 0, 0), 'StyleGetBack' : ('StyleGetBackground', 0, 0, 0),
@@ -279,6 +353,8 @@ methodOverrideMap = {
0), 0),
'IndicSetAlpha' : ('IndicatorSetAlpha', 0, 0, 0),
'IndicGetAlpha' : ('IndicatorGetAlpha', 0, 0, 0),
'IndicSetStyle' : ('IndicatorSetStyle', 0, 0, 0), 'IndicSetStyle' : ('IndicatorSetStyle', 0, 0, 0),
'IndicGetStyle' : ('IndicatorGetStyle', 0, 0, 0), 'IndicGetStyle' : ('IndicatorGetStyle', 0, 0, 0),
'IndicSetFore' : ('IndicatorSetForeground', 0, 0, 0), 'IndicSetFore' : ('IndicatorSetForeground', 0, 0, 0),
@@ -312,6 +388,7 @@ methodOverrideMap = {
'AutoCGetTypeSeparator' : ('AutoCompGetTypeSeparator', 0, 0, 0), 'AutoCGetTypeSeparator' : ('AutoCompGetTypeSeparator', 0, 0, 0),
'AutoCSetTypeSeparator' : ('AutoCompSetTypeSeparator', 0, 0, 0), 'AutoCSetTypeSeparator' : ('AutoCompSetTypeSeparator', 0, 0, 0),
'AutoCGetCurrent' : ('AutoCompGetCurrent', 0, 0, 0), 'AutoCGetCurrent' : ('AutoCompGetCurrent', 0, 0, 0),
'AutoCGetCurrentText' : (None, 0, 0, 0),
'AutoCSetMaxWidth' : ('AutoCompSetMaxWidth', 0, 0, 0), 'AutoCSetMaxWidth' : ('AutoCompSetMaxWidth', 0, 0, 0),
'AutoCGetMaxWidth' : ('AutoCompGetMaxWidth', 0, 0, 0), 'AutoCGetMaxWidth' : ('AutoCompGetMaxWidth', 0, 0, 0),
'AutoCSetMaxHeight' : ('AutoCompSetMaxHeight', 0, 0, 0), 'AutoCSetMaxHeight' : ('AutoCompSetMaxHeight', 0, 0, 0),
@@ -650,6 +727,17 @@ methodOverrideMap = {
'SetPositionCache' : ('SetPositionCacheSize', 0, 0, 0), 'SetPositionCache' : ('SetPositionCacheSize', 0, 0, 0),
'GetPositionCache' : ('GetPositionCacheSize', 0, 0, 0), 'GetPositionCache' : ('GetPositionCacheSize', 0, 0, 0),
'GetLexerLanguage' : (None, 0, 0, 0),
'SetFontQuality' : (None, 0, 0, 0),
'GetFontQuality' : (None, 0, 0, 0),
'SetSelection' : (None, 0, 0, 0),
'GetCharacterPointer' : (0,
'const char* %s();',
'const char* %s() {\n'
' return (const char*)SendMsg(%s, 0, 0);',
0),
'' : ('', 0, 0, 0), '' : ('', 0, 0, 0),
@@ -889,7 +977,7 @@ funregex = re.compile(r'\s*([a-zA-Z0-9_]+)' # <ws>return type
'\s+([a-zA-Z0-9_]+)=' # <ws>name= '\s+([a-zA-Z0-9_]+)=' # <ws>name=
'([0-9]+)' # number '([0-9]+)' # number
'\(([ a-zA-Z0-9_]*),' # (param, '\(([ a-zA-Z0-9_]*),' # (param,
'([ a-zA-Z0-9_]*)\)') # param) '([ a-zA-Z0-9_]*),*\)') # param)
def parseFun(line, methods, docs, values, is_const): def parseFun(line, methods, docs, values, is_const):
def parseParam(param): def parseParam(param):

View File

@@ -1,7 +1,7 @@
This directory contains copies of the scintilla/src and This directory contains copies of the scintilla/src and
scintilla/include directories from the Scintilla/SCiTE source scintilla/include directories from the Scintilla source distribution.
distribution. All other code needed to implement Scintilla on top of All other code needed to implement Scintilla on top of wxWidgets is
wxWindows is located in the directory above this one. located in the directory above this one.
The current version of the Scintilla code is 1.75 The current version of the Scintilla code is 2.03

View File

@@ -9,6 +9,29 @@
namespace Scintilla { namespace Scintilla {
#endif #endif
/**
*/
class WordList {
public:
// 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
bool sorted;
int starts[256];
WordList(bool onlyLineEnds_ = false) :
words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
sorted(false)
{}
~WordList() { Clear(); }
operator bool() { return len ? true : false; }
void Clear();
void Set(const char *s);
bool InList(const char *s);
bool InListAbbreviated(const char *s, const char marker);
};
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle, typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler); WordList *keywordlists[], Accessor &styler);

View File

@@ -3,7 +3,7 @@
** Interface to platform facilities. Also includes some basic utilities. ** Interface to platform facilities. Also includes some basic utilities.
** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows. ** Implemented in PlatGTK.cxx for GTK+/Linux, PlatWin.cxx for Windows, and PlatWX.cxx for wxWindows.
**/ **/
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#ifndef PLATFORM_H #ifndef PLATFORM_H
@@ -33,12 +33,13 @@
#undef PLAT_GTK #undef PLAT_GTK
#define PLAT_GTK 1 #define PLAT_GTK 1
#ifdef _MSC_VER #if defined(__WIN32__) || defined(_MSC_VER)
#undef PLAT_GTK_WIN32 #undef PLAT_GTK_WIN32
#define PLAT_GTK_WIN32 1 #define PLAT_GTK_WIN32 1
#endif #endif
#elif defined(MACOSX) #elif defined(__APPLE__)
#undef PLAT_MACOSX #undef PLAT_MACOSX
#define PLAT_MACOSX 1 #define PLAT_MACOSX 1
@@ -122,7 +123,7 @@ public:
} }
int Width() { return right - left; } int Width() { return right - left; }
int Height() { return bottom - top; } int Height() { return bottom - top; }
bool Empty() { bool Empty() {
return (Height() <= 0) || (Width() <= 0); return (Height() <= 0) || (Width() <= 0);
} }
}; };
@@ -282,24 +283,24 @@ public:
*/ */
class Font { class Font {
protected: protected:
FontID id; FontID fid;
#if PLAT_WX #if PLAT_WX
int ascent; int ascent;
#endif #endif
// Private so Font objects can not be copied // Private so Font objects can not be copied
Font(const Font &) {} Font(const Font &) {}
Font &operator=(const Font &) { id=0; return *this; } Font &operator=(const Font &) { fid=0; return *this; }
public: public:
Font(); Font();
virtual ~Font(); virtual ~Font();
virtual void Create(const char *faceName, int characterSet, int size, virtual void Create(const char *faceName, int characterSet, int size,
bool bold, bool italic, bool extraFontFlag=false); bool bold, bool italic, int extraFontFlag=0);
virtual void Release(); virtual void Release();
FontID GetID() { return id; } FontID GetID() { return fid; }
// Alias another font - caller guarantees not to Release // Alias another font - caller guarantees not to Release
void SetID(FontID id_) { id = id_; } void SetID(FontID fid_) { fid = fid_; }
friend class Surface; friend class Surface;
friend class SurfaceImpl; friend class SurfaceImpl;
}; };
@@ -370,31 +371,31 @@ typedef void (*CallBackAction)(void*);
*/ */
class Window { class Window {
protected: protected:
WindowID id; WindowID wid;
#if PLAT_MACOSX #if PLAT_MACOSX
void *windowRef; void *windowRef;
void *control; void *control;
#endif #endif
public: public:
Window() : id(0), cursorLast(cursorInvalid) { Window() : wid(0), cursorLast(cursorInvalid) {
#if PLAT_MACOSX #if PLAT_MACOSX
windowRef = 0; windowRef = 0;
control = 0; control = 0;
#endif #endif
} }
Window(const Window &source) : id(source.id), cursorLast(cursorInvalid) { Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) {
#if PLAT_MACOSX #if PLAT_MACOSX
windowRef = 0; windowRef = 0;
control = 0; control = 0;
#endif #endif
} }
virtual ~Window(); virtual ~Window();
Window &operator=(WindowID id_) { Window &operator=(WindowID wid_) {
id = id_; wid = wid_;
return *this; return *this;
} }
WindowID GetID() const { return id; } WindowID GetID() const { return wid; }
bool Created() const { return id != 0; } bool Created() const { return wid != 0; }
void Destroy(); void Destroy();
bool HasFocus(); bool HasFocus();
PRectangle GetPosition(); PRectangle GetPosition();
@@ -451,10 +452,10 @@ public:
* Menu management. * Menu management.
*/ */
class Menu { class Menu {
MenuID id; MenuID mid;
public: public:
Menu(); Menu();
MenuID GetID() { return id; } MenuID GetID() { return mid; }
void CreatePopUp(); void CreatePopUp();
void Destroy(); void Destroy();
void Show(Point pt, Window &w); void Show(Point pt, Window &w);

View File

@@ -1,104 +1,26 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file PropSet.h /** @file PropSet.h
** A Java style properties file module. ** An interface to the methods needed for access to property sets inside lexers.
**/ **/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#ifndef PROPSET_H #ifndef PROPSET_H
#define PROPSET_H #define PROPSET_H
#include "SString.h"
bool EqualCaseInsensitive(const char *a, const char *b);
bool isprefix(const char *target, const char *prefix);
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
namespace Scintilla { namespace Scintilla {
#endif #endif
struct Property { class PropertyGet {
unsigned int hash;
char *key;
char *val;
Property *next;
Property() : hash(0), key(0), val(0), next(0) {}
};
/**
*/
class PropSet {
protected:
enum { hashRoots=31 };
Property *props[hashRoots];
Property *enumnext;
int enumhash;
static unsigned int HashString(const char *s, size_t len) {
unsigned int ret = 0;
while (len--) {
ret <<= 4;
ret ^= *s;
s++;
}
return ret;
}
public: public:
PropSet *superPS; virtual char *ToString() const=0; // Caller must delete[] the return value
PropSet(); virtual int GetInt(const char *key, int defaultValue=0) const=0;
~PropSet(); virtual ~PropertyGet() {}
void Set(const char *key, const char *val, int lenKey=-1, int lenVal=-1);
void Set(const char *keyVal);
void Unset(const char *key, int lenKey=-1);
void SetMultiple(const char *s);
SString Get(const char *key) const;
SString GetExpanded(const char *key) const;
SString Expand(const char *withVars, int maxExpands=100) const;
int GetInt(const char *key, int defaultValue=0) const;
void Clear();
char *ToString() const; // Caller must delete[] the return value
private:
// copy-value semantics not implemented
PropSet(const PropSet &copy);
void operator=(const PropSet &assign);
}; };
/**
*/
class WordList {
public:
// 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
bool sorted;
int starts[256];
WordList(bool onlyLineEnds_ = false) :
words(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
sorted(false)
{}
~WordList() { Clear(); }
operator bool() { return len ? true : false; }
void Clear();
void Set(const char *s);
bool InList(const char *s);
bool InListAbbreviated(const char *s, const char marker);
};
inline bool IsAlphabetic(unsigned int ch) {
return ((ch >= 'A') && (ch <= 'Z')) || ((ch >= 'a') && (ch <= 'z'));
}
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
} }
#endif #endif
#ifdef _MSC_VER
// Visual C++ doesn't like the private copy idiom for disabling
// the default copy constructor and operator=, but it's fine.
#pragma warning(disable: 4511 4512)
#endif
#endif #endif

View File

@@ -1,19 +1,19 @@
// Scintilla source code edit control /* Scintilla source code edit control */
/** @file SciLexer.h /** @file SciLexer.h
** Interface to the added lexer functions in the SciLexer version of the edit control. ** Interface to the added lexer functions in the SciLexer version of the edit control.
**/ **/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org> /* Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. * 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 /* 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. * file which contains any comments about the definitions. HFacer.py does the generation. */
#ifndef SCILEXER_H #ifndef SCILEXER_H
#define SCILEXER_H #define SCILEXER_H
// SciLexer features - not in standard Scintilla /* SciLexer features - not in standard Scintilla */
//++Autogenerated -- start of section automatically generated from Scintilla.iface /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
#define SCLEX_CONTAINER 0 #define SCLEX_CONTAINER 0
#define SCLEX_NULL 1 #define SCLEX_NULL 1
#define SCLEX_PYTHON 2 #define SCLEX_PYTHON 2
@@ -99,6 +99,18 @@
#define SCLEX_ABAQUS 84 #define SCLEX_ABAQUS 84
#define SCLEX_ASYMPTOTE 85 #define SCLEX_ASYMPTOTE 85
#define SCLEX_R 86 #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_AUTOMATIC 1000 #define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0 #define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1 #define SCE_P_COMMENTLINE 1
@@ -154,6 +166,11 @@
#define SCE_D_COMMENTLINEDOC 15 #define SCE_D_COMMENTLINEDOC 15
#define SCE_D_COMMENTDOCKEYWORD 16 #define SCE_D_COMMENTDOCKEYWORD 16
#define SCE_D_COMMENTDOCKEYWORDERROR 17 #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_DEFAULT 0
#define SCE_TCL_COMMENT 1 #define SCE_TCL_COMMENT 1
#define SCE_TCL_COMMENTLINE 2 #define SCE_TCL_COMMENTLINE 2
@@ -450,6 +467,7 @@
#define SCE_DIFF_POSITION 4 #define SCE_DIFF_POSITION 4
#define SCE_DIFF_DELETED 5 #define SCE_DIFF_DELETED 5
#define SCE_DIFF_ADDED 6 #define SCE_DIFF_ADDED 6
#define SCE_DIFF_CHANGED 7
#define SCE_CONF_DEFAULT 0 #define SCE_CONF_DEFAULT 0
#define SCE_CONF_COMMENT 1 #define SCE_CONF_COMMENT 1
#define SCE_CONF_NUMBER 2 #define SCE_CONF_NUMBER 2
@@ -614,6 +632,11 @@
#define SCE_CSS_SINGLESTRING 14 #define SCE_CSS_SINGLESTRING 14
#define SCE_CSS_IDENTIFIER2 15 #define SCE_CSS_IDENTIFIER2 15
#define SCE_CSS_ATTRIBUTE 16 #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_POV_DEFAULT 0 #define SCE_POV_DEFAULT 0
#define SCE_POV_COMMENT 1 #define SCE_POV_COMMENT 1
#define SCE_POV_COMMENTLINE 2 #define SCE_POV_COMMENTLINE 2
@@ -766,8 +789,19 @@
#define SCE_ERLANG_CHARACTER 9 #define SCE_ERLANG_CHARACTER 9
#define SCE_ERLANG_MACRO 10 #define SCE_ERLANG_MACRO 10
#define SCE_ERLANG_RECORD 11 #define SCE_ERLANG_RECORD 11
#define SCE_ERLANG_SEPARATOR 12 #define SCE_ERLANG_PREPROC 12
#define SCE_ERLANG_NODE_NAME 13 #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_ERLANG_UNKNOWN 31
#define SCE_MSSQL_DEFAULT 0 #define SCE_MSSQL_DEFAULT 0
#define SCE_MSSQL_COMMENT 1 #define SCE_MSSQL_COMMENT 1
@@ -916,6 +950,7 @@
#define SCE_CAML_OPERATOR 7 #define SCE_CAML_OPERATOR 7
#define SCE_CAML_NUMBER 8 #define SCE_CAML_NUMBER 8
#define SCE_CAML_CHAR 9 #define SCE_CAML_CHAR 9
#define SCE_CAML_WHITE 10
#define SCE_CAML_STRING 11 #define SCE_CAML_STRING 11
#define SCE_CAML_COMMENT 12 #define SCE_CAML_COMMENT 12
#define SCE_CAML_COMMENT1 13 #define SCE_CAML_COMMENT1 13
@@ -1073,7 +1108,7 @@
#define SCE_INNO_PARAMETER 3 #define SCE_INNO_PARAMETER 3
#define SCE_INNO_SECTION 4 #define SCE_INNO_SECTION 4
#define SCE_INNO_PREPROC 5 #define SCE_INNO_PREPROC 5
#define SCE_INNO_PREPROC_INLINE 6 #define SCE_INNO_INLINE_EXPANSION 6
#define SCE_INNO_COMMENT_PASCAL 7 #define SCE_INNO_COMMENT_PASCAL 7
#define SCE_INNO_KEYWORD_PASCAL 8 #define SCE_INNO_KEYWORD_PASCAL 8
#define SCE_INNO_KEYWORD_USER 9 #define SCE_INNO_KEYWORD_USER 9
@@ -1203,8 +1238,144 @@
#define SCE_R_IDENTIFIER 9 #define SCE_R_IDENTIFIER 9
#define SCE_R_INFIX 10 #define SCE_R_INFIX 10
#define SCE_R_INFIXEOL 11 #define SCE_R_INFIXEOL 11
#define SCLEX_ASP 29 #define SCE_MAGIK_DEFAULT 0
#define SCLEX_PHP 30 #define SCE_MAGIK_COMMENT 1
//--Autogenerated -- end of section automatically generated from Scintilla.iface #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_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_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_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
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif #endif

View File

@@ -1,12 +1,12 @@
// Scintilla source code edit control /* Scintilla source code edit control */
/** @file Scintilla.h /** @file Scintilla.h
** Interface to the edit control. ** Interface to the edit control.
**/ **/
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org> /* Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. * 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 /* 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. * file which contains any comments about the definitions. HFacer.py does the generation. */
#ifndef SCINTILLA_H #ifndef SCINTILLA_H
#define SCINTILLA_H #define SCINTILLA_H
@@ -15,18 +15,26 @@
typedef BOOL bool; typedef BOOL bool;
#endif #endif
#ifdef __cplusplus
extern "C" {
#endif
#if PLAT_WIN #if PLAT_WIN
// Return false on failure: /* Return false on failure: */
bool Scintilla_RegisterClasses(void *hInstance); bool Scintilla_RegisterClasses(void *hInstance);
bool Scintilla_ReleaseResources(); bool Scintilla_ReleaseResources();
#endif #endif
int Scintilla_LinkLexers(); int Scintilla_LinkLexers();
// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to #ifdef __cplusplus
// hold a pointer and sptr_t, a signed integer large enough to hold a pointer. }
// May need to be changed for 64 bit platforms. #endif
#ifdef _WIN32
#include <windows.h> /* Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
* hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
* May need to be changed for 64 bit platforms. */
#if defined(_WIN32)
#include <basetsd.h>
#endif #endif
#ifdef MAXULONG_PTR #ifdef MAXULONG_PTR
typedef ULONG_PTR uptr_t; typedef ULONG_PTR uptr_t;
@@ -38,7 +46,7 @@ typedef long sptr_t;
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam); typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
//++Autogenerated -- start of section automatically generated from Scintilla.iface /* ++Autogenerated -- start of section automatically generated from Scintilla.iface */
#define INVALID_POSITION -1 #define INVALID_POSITION -1
#define SCI_START 2000 #define SCI_START 2000
#define SCI_OPTIONAL_START 3000 #define SCI_OPTIONAL_START 3000
@@ -118,6 +126,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARK_ARROWS 24 #define SC_MARK_ARROWS 24
#define SC_MARK_PIXMAP 25 #define SC_MARK_PIXMAP 25
#define SC_MARK_FULLRECT 26 #define SC_MARK_FULLRECT 26
#define SC_MARK_LEFTRECT 27
#define SC_MARK_AVAILABLE 28
#define SC_MARK_UNDERLINE 29
#define SC_MARK_CHARACTER 10000 #define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25 #define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26 #define SC_MARKNUM_FOLDEROPENMID 26
@@ -143,6 +154,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARGIN_NUMBER 1 #define SC_MARGIN_NUMBER 1
#define SC_MARGIN_BACK 2 #define SC_MARGIN_BACK 2
#define SC_MARGIN_FORE 3 #define SC_MARGIN_FORE 3
#define SC_MARGIN_TEXT 4
#define SC_MARGIN_RTEXT 5
#define SCI_SETMARGINTYPEN 2240 #define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241 #define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242 #define SCI_SETMARGINWIDTHN 2242
@@ -249,6 +262,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_INDICGETUNDER 2511 #define SCI_INDICGETUNDER 2511
#define SCI_SETWHITESPACEFORE 2084 #define SCI_SETWHITESPACEFORE 2084
#define SCI_SETWHITESPACEBACK 2085 #define SCI_SETWHITESPACEBACK 2085
#define SCI_SETWHITESPACESIZE 2086
#define SCI_GETWHITESPACESIZE 2087
#define SCI_SETSTYLEBITS 2090 #define SCI_SETSTYLEBITS 2090
#define SCI_GETSTYLEBITS 2091 #define SCI_GETSTYLEBITS 2091
#define SCI_SETLINESTATE 2092 #define SCI_SETLINESTATE 2092
@@ -394,10 +409,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_FOLDLEVELBASE 0x400 #define SC_FOLDLEVELBASE 0x400
#define SC_FOLDLEVELWHITEFLAG 0x1000 #define SC_FOLDLEVELWHITEFLAG 0x1000
#define SC_FOLDLEVELHEADERFLAG 0x2000 #define SC_FOLDLEVELHEADERFLAG 0x2000
#define SC_FOLDLEVELBOXHEADERFLAG 0x4000
#define SC_FOLDLEVELBOXFOOTERFLAG 0x8000
#define SC_FOLDLEVELCONTRACTED 0x10000
#define SC_FOLDLEVELUNINDENT 0x20000
#define SC_FOLDLEVELNUMBERMASK 0x0FFF #define SC_FOLDLEVELNUMBERMASK 0x0FFF
#define SCI_SETFOLDLEVEL 2222 #define SCI_SETFOLDLEVEL 2222
#define SCI_GETFOLDLEVEL 2223 #define SCI_GETFOLDLEVEL 2223
@@ -415,7 +426,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 #define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010 #define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
#define SC_FOLDFLAG_LEVELNUMBERS 0x0040 #define SC_FOLDFLAG_LEVELNUMBERS 0x0040
#define SC_FOLDFLAG_BOX 0x0001
#define SCI_SETFOLDFLAGS 2233 #define SCI_SETFOLDFLAGS 2233
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234 #define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
#define SCI_SETTABINDENTS 2260 #define SCI_SETTABINDENTS 2260
@@ -444,6 +454,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETWRAPVISUALFLAGSLOCATION 2463 #define SCI_GETWRAPVISUALFLAGSLOCATION 2463
#define SCI_SETWRAPSTARTINDENT 2464 #define SCI_SETWRAPSTARTINDENT 2464
#define SCI_GETWRAPSTARTINDENT 2465 #define SCI_GETWRAPSTARTINDENT 2465
#define SC_WRAPINDENT_FIXED 0
#define SC_WRAPINDENT_SAME 1
#define SC_WRAPINDENT_INDENT 2
#define SCI_SETWRAPINDENTMODE 2472
#define SCI_GETWRAPINDENTMODE 2473
#define SC_CACHE_NONE 0 #define SC_CACHE_NONE 0
#define SC_CACHE_CARET 1 #define SC_CACHE_CARET 1
#define SC_CACHE_PAGE 2 #define SC_CACHE_PAGE 2
@@ -463,6 +478,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_APPENDTEXT 2282 #define SCI_APPENDTEXT 2282
#define SCI_GETTWOPHASEDRAW 2283 #define SCI_GETTWOPHASEDRAW 2283
#define SCI_SETTWOPHASEDRAW 2284 #define SCI_SETTWOPHASEDRAW 2284
#define SC_EFF_QUALITY_MASK 0xF
#define SC_EFF_QUALITY_DEFAULT 0
#define SC_EFF_QUALITY_NON_ANTIALIASED 1
#define SC_EFF_QUALITY_ANTIALIASED 2
#define SC_EFF_QUALITY_LCD_OPTIMIZED 3
#define SCI_SETFONTQUALITY 2611
#define SCI_GETFONTQUALITY 2612
#define SCI_SETFIRSTVISIBLELINE 2613
#define SCI_TARGETFROMSELECTION 2287 #define SCI_TARGETFROMSELECTION 2287
#define SCI_LINESJOIN 2288 #define SCI_LINESJOIN 2288
#define SCI_LINESSPLIT 2289 #define SCI_LINESSPLIT 2289
@@ -559,6 +582,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETMODEVENTMASK 2378 #define SCI_GETMODEVENTMASK 2378
#define SCI_SETFOCUS 2380 #define SCI_SETFOCUS 2380
#define SCI_GETFOCUS 2381 #define SCI_GETFOCUS 2381
#define SC_STATUS_OK 0
#define SC_STATUS_FAILURE 1
#define SC_STATUS_BADALLOC 2
#define SCI_SETSTATUS 2382 #define SCI_SETSTATUS 2382
#define SCI_GETSTATUS 2383 #define SCI_GETSTATUS 2383
#define SCI_SETMOUSEDOWNCAPTURES 2384 #define SCI_SETMOUSEDOWNCAPTURES 2384
@@ -609,6 +635,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_SEL_STREAM 0 #define SC_SEL_STREAM 0
#define SC_SEL_RECTANGLE 1 #define SC_SEL_RECTANGLE 1
#define SC_SEL_LINES 2 #define SC_SEL_LINES 2
#define SC_SEL_THIN 3
#define SCI_SETSELECTIONMODE 2422 #define SCI_SETSELECTIONMODE 2422
#define SCI_GETSELECTIONMODE 2423 #define SCI_GETSELECTIONMODE 2423
#define SCI_GETLINESELSTARTPOSITION 2424 #define SCI_GETLINESELSTARTPOSITION 2424
@@ -633,6 +660,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETWHITESPACECHARS 2443 #define SCI_SETWHITESPACECHARS 2443
#define SCI_SETCHARSDEFAULT 2444 #define SCI_SETCHARSDEFAULT 2444
#define SCI_AUTOCGETCURRENT 2445 #define SCI_AUTOCGETCURRENT 2445
#define SCI_AUTOCGETCURRENTTEXT 2610
#define SCI_ALLOCATE 2446 #define SCI_ALLOCATE 2446
#define SCI_TARGETASUTF8 2447 #define SCI_TARGETASUTF8 2447
#define SCI_SETLENGTHFORENCODE 2448 #define SCI_SETLENGTHFORENCODE 2448
@@ -666,6 +694,94 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_INDICATOREND 2509 #define SCI_INDICATOREND 2509
#define SCI_SETPOSITIONCACHE 2514 #define SCI_SETPOSITIONCACHE 2514
#define SCI_GETPOSITIONCACHE 2515 #define SCI_GETPOSITIONCACHE 2515
#define SCI_COPYALLOWLINE 2519
#define SCI_GETCHARACTERPOINTER 2520
#define SCI_SETKEYSUNICODE 2521
#define SCI_GETKEYSUNICODE 2522
#define SCI_INDICSETALPHA 2523
#define SCI_INDICGETALPHA 2524
#define SCI_SETEXTRAASCENT 2525
#define SCI_GETEXTRAASCENT 2526
#define SCI_SETEXTRADESCENT 2527
#define SCI_GETEXTRADESCENT 2528
#define SCI_MARKERSYMBOLDEFINED 2529
#define SCI_MARGINSETTEXT 2530
#define SCI_MARGINGETTEXT 2531
#define SCI_MARGINSETSTYLE 2532
#define SCI_MARGINGETSTYLE 2533
#define SCI_MARGINSETSTYLES 2534
#define SCI_MARGINGETSTYLES 2535
#define SCI_MARGINTEXTCLEARALL 2536
#define SCI_MARGINSETSTYLEOFFSET 2537
#define SCI_MARGINGETSTYLEOFFSET 2538
#define SCI_ANNOTATIONSETTEXT 2540
#define SCI_ANNOTATIONGETTEXT 2541
#define SCI_ANNOTATIONSETSTYLE 2542
#define SCI_ANNOTATIONGETSTYLE 2543
#define SCI_ANNOTATIONSETSTYLES 2544
#define SCI_ANNOTATIONGETSTYLES 2545
#define SCI_ANNOTATIONGETLINES 2546
#define SCI_ANNOTATIONCLEARALL 2547
#define ANNOTATION_HIDDEN 0
#define ANNOTATION_STANDARD 1
#define ANNOTATION_BOXED 2
#define SCI_ANNOTATIONSETVISIBLE 2548
#define SCI_ANNOTATIONGETVISIBLE 2549
#define SCI_ANNOTATIONSETSTYLEOFFSET 2550
#define SCI_ANNOTATIONGETSTYLEOFFSET 2551
#define UNDO_MAY_COALESCE 1
#define SCI_ADDUNDOACTION 2560
#define SCI_CHARPOSITIONFROMPOINT 2561
#define SCI_CHARPOSITIONFROMPOINTCLOSE 2562
#define SCI_SETMULTIPLESELECTION 2563
#define SCI_GETMULTIPLESELECTION 2564
#define SCI_SETADDITIONALSELECTIONTYPING 2565
#define SCI_GETADDITIONALSELECTIONTYPING 2566
#define SCI_SETADDITIONALCARETSBLINK 2567
#define SCI_GETADDITIONALCARETSBLINK 2568
#define SCI_SETADDITIONALCARETSVISIBLE 2608
#define SCI_GETADDITIONALCARETSVISIBLE 2609
#define SCI_GETSELECTIONS 2570
#define SCI_CLEARSELECTIONS 2571
#define SCI_SETSELECTION 2572
#define SCI_ADDSELECTION 2573
#define SCI_SETMAINSELECTION 2574
#define SCI_GETMAINSELECTION 2575
#define SCI_SETSELECTIONNCARET 2576
#define SCI_GETSELECTIONNCARET 2577
#define SCI_SETSELECTIONNANCHOR 2578
#define SCI_GETSELECTIONNANCHOR 2579
#define SCI_SETSELECTIONNCARETVIRTUALSPACE 2580
#define SCI_GETSELECTIONNCARETVIRTUALSPACE 2581
#define SCI_SETSELECTIONNANCHORVIRTUALSPACE 2582
#define SCI_GETSELECTIONNANCHORVIRTUALSPACE 2583
#define SCI_SETSELECTIONNSTART 2584
#define SCI_GETSELECTIONNSTART 2585
#define SCI_SETSELECTIONNEND 2586
#define SCI_GETSELECTIONNEND 2587
#define SCI_SETRECTANGULARSELECTIONCARET 2588
#define SCI_GETRECTANGULARSELECTIONCARET 2589
#define SCI_SETRECTANGULARSELECTIONANCHOR 2590
#define SCI_GETRECTANGULARSELECTIONANCHOR 2591
#define SCI_SETRECTANGULARSELECTIONCARETVIRTUALSPACE 2592
#define SCI_GETRECTANGULARSELECTIONCARETVIRTUALSPACE 2593
#define SCI_SETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2594
#define SCI_GETRECTANGULARSELECTIONANCHORVIRTUALSPACE 2595
#define SCVS_NONE 0
#define SCVS_RECTANGULARSELECTION 1
#define SCVS_USERACCESSIBLE 2
#define SCI_SETVIRTUALSPACEOPTIONS 2596
#define SCI_GETVIRTUALSPACEOPTIONS 2597
#define SCI_SETRECTANGULARSELECTIONMODIFIER 2598
#define SCI_GETRECTANGULARSELECTIONMODIFIER 2599
#define SCI_SETADDITIONALSELFORE 2600
#define SCI_SETADDITIONALSELBACK 2601
#define SCI_SETADDITIONALSELALPHA 2602
#define SCI_GETADDITIONALSELALPHA 2603
#define SCI_SETADDITIONALCARETFORE 2604
#define SCI_GETADDITIONALCARETFORE 2605
#define SCI_ROTATESELECTION 2606
#define SCI_SWAPMAINANCHORCARET 2607
#define SCI_STARTRECORD 3001 #define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002 #define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001 #define SCI_SETLEXER 4001
@@ -680,6 +796,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETPROPERTYEXPANDED 4009 #define SCI_GETPROPERTYEXPANDED 4009
#define SCI_GETPROPERTYINT 4010 #define SCI_GETPROPERTYINT 4010
#define SCI_GETSTYLEBITSNEEDED 4011 #define SCI_GETSTYLEBITSNEEDED 4011
#define SCI_GETLEXERLANGUAGE 4012
#define SC_MOD_INSERTTEXT 0x1 #define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2 #define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4 #define SC_MOD_CHANGESTYLE 0x4
@@ -696,7 +813,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_STARTACTION 0x2000 #define SC_STARTACTION 0x2000
#define SC_MOD_CHANGEINDICATOR 0x4000 #define SC_MOD_CHANGEINDICATOR 0x4000
#define SC_MOD_CHANGELINESTATE 0x8000 #define SC_MOD_CHANGELINESTATE 0x8000
#define SC_MODEVENTMASKALL 0xFFFF #define SC_MOD_CHANGEMARGIN 0x10000
#define SC_MOD_CHANGEANNOTATION 0x20000
#define SC_MOD_CONTAINER 0x40000
#define SC_MODEVENTMASKALL 0x7FFFF
#define SCEN_CHANGE 768 #define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512 #define SCEN_SETFOCUS 512
#define SCEN_KILLFOCUS 256 #define SCEN_KILLFOCUS 256
@@ -724,6 +844,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCMOD_SHIFT 1 #define SCMOD_SHIFT 1
#define SCMOD_CTRL 2 #define SCMOD_CTRL 2
#define SCMOD_ALT 4 #define SCMOD_ALT 4
#define SCMOD_SUPER 8
#define SCN_STYLENEEDED 2000 #define SCN_STYLENEEDED 2000
#define SCN_CHARADDED 2001 #define SCN_CHARADDED 2001
#define SCN_SAVEPOINTREACHED 2002 #define SCN_SAVEPOINTREACHED 2002
@@ -748,95 +869,91 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCN_AUTOCSELECTION 2022 #define SCN_AUTOCSELECTION 2022
#define SCN_INDICATORCLICK 2023 #define SCN_INDICATORCLICK 2023
#define SCN_INDICATORRELEASE 2024 #define SCN_INDICATORRELEASE 2024
//--Autogenerated -- end of section automatically generated from Scintilla.iface #define SCN_AUTOCCANCELLED 2025
#define SCN_AUTOCCHARDELETED 2026
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
// These structures are defined to be exactly the same shape as the Win32 /* These structures are defined to be exactly the same shape as the Win32
// CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs. * CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
// So older code that treats Scintilla as a RichEdit will work. * So older code that treats Scintilla as a RichEdit will work. */
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
namespace Scintilla { namespace Scintilla {
#endif #endif
struct CharacterRange { struct Sci_CharacterRange {
long cpMin; long cpMin;
long cpMax; long cpMax;
}; };
struct TextRange { struct Sci_TextRange {
struct CharacterRange chrg; struct Sci_CharacterRange chrg;
char *lpstrText; char *lpstrText;
}; };
struct TextToFind { struct Sci_TextToFind {
struct CharacterRange chrg; struct Sci_CharacterRange chrg;
char *lpstrText; char *lpstrText;
struct CharacterRange chrgText; struct Sci_CharacterRange chrgText;
}; };
#define CharacterRange Sci_CharacterRange
#define TextRange Sci_TextRange
#define TextToFind Sci_TextToFind
#ifdef PLATFORM_H #ifdef PLATFORM_H
// This structure is used in printing and requires some of the graphics types /* This structure is used in printing and requires some of the graphics types
// from Platform.h. Not needed by most client code. * from Platform.h. Not needed by most client code. */
struct RangeToFormat { struct Sci_RangeToFormat {
SurfaceID hdc; SurfaceID hdc;
SurfaceID hdcTarget; SurfaceID hdcTarget;
PRectangle rc; PRectangle rc;
PRectangle rcPage; PRectangle rcPage;
CharacterRange chrg; Sci_CharacterRange chrg;
}; };
#define RangeToFormat Sci_RangeToFormat
#endif #endif
struct NotifyHeader { struct Sci_NotifyHeader {
// Compatible with Windows NMHDR. /* Compatible with Windows NMHDR.
// hwndFrom is really an environment specific window handle or pointer * hwndFrom is really an environment specific window handle or pointer
// but most clients of Scintilla.h do not have this type visible. * but most clients of Scintilla.h do not have this type visible. */
void *hwndFrom; void *hwndFrom;
uptr_t idFrom; uptr_t idFrom;
unsigned int code; unsigned int code;
}; };
#define NotifyHeader Sci_NotifyHeader
struct SCNotification { struct SCNotification {
struct NotifyHeader nmhdr; struct Sci_NotifyHeader nmhdr;
int position; // SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND int position; /* SCN_STYLENEEDED, SCN_MODIFIED, SCN_DWELLSTART, SCN_DWELLEND */
int ch; // SCN_CHARADDED, SCN_KEY int ch; /* SCN_CHARADDED, SCN_KEY */
int modifiers; // SCN_KEY int modifiers; /* SCN_KEY */
int modificationType; // SCN_MODIFIED int modificationType; /* SCN_MODIFIED */
const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION const char *text; /* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
int length; // SCN_MODIFIED int length; /* SCN_MODIFIED */
int linesAdded; // SCN_MODIFIED int linesAdded; /* SCN_MODIFIED */
int message; // SCN_MACRORECORD int message; /* SCN_MACRORECORD */
uptr_t wParam; // SCN_MACRORECORD uptr_t wParam; /* SCN_MACRORECORD */
sptr_t lParam; // SCN_MACRORECORD sptr_t lParam; /* SCN_MACRORECORD */
int line; // SCN_MODIFIED int line; /* SCN_MODIFIED */
int foldLevelNow; // SCN_MODIFIED int foldLevelNow; /* SCN_MODIFIED */
int foldLevelPrev; // SCN_MODIFIED int foldLevelPrev; /* SCN_MODIFIED */
int margin; // SCN_MARGINCLICK int margin; /* SCN_MARGINCLICK */
int listType; // SCN_USERLISTSELECTION int listType; /* SCN_USERLISTSELECTION */
int x; // SCN_DWELLSTART, SCN_DWELLEND int x; /* SCN_DWELLSTART, SCN_DWELLEND */
int y; // SCN_DWELLSTART, SCN_DWELLEND int y; /* SCN_DWELLSTART, SCN_DWELLEND */
int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
int annotationLinesAdded; /* SC_MOD_CHANGEANNOTATION */
}; };
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
} }
#endif #endif
// Deprecation section listing all API features that are deprecated and will
// will be removed completely in a future version.
// To enable these features define INCLUDE_DEPRECATED_FEATURES
#ifdef INCLUDE_DEPRECATED_FEATURES
#define SCI_SETCARETPOLICY 2369
#define CARET_CENTER 0x02
#define CARET_XEVEN 0x08
#define CARET_XJUMPS 0x10
#define SCN_POSCHANGED 2012
#define SCN_CHECKBRACE 2007
#endif
#endif #endif

View File

@@ -104,7 +104,7 @@ fun void ClearAll=2004(,)
# Set all style bytes to 0, remove all folding information. # Set all style bytes to 0, remove all folding information.
fun void ClearDocumentStyle=2005(,) fun void ClearDocumentStyle=2005(,)
# Returns the number of characters in the document. # Returns the number of bytes in the document.
get int GetLength=2006(,) get int GetLength=2006(,)
# Returns the character byte at the position. # Returns the character byte at the position.
@@ -268,6 +268,9 @@ val SC_MARK_DOTDOTDOT=23
val SC_MARK_ARROWS=24 val SC_MARK_ARROWS=24
val SC_MARK_PIXMAP=25 val SC_MARK_PIXMAP=25
val SC_MARK_FULLRECT=26 val SC_MARK_FULLRECT=26
val SC_MARK_LEFTRECT=27
val SC_MARK_AVAILABLE=28
val SC_MARK_UNDERLINE=29
val SC_MARK_CHARACTER=10000 val SC_MARK_CHARACTER=10000
@@ -324,6 +327,8 @@ val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1 val SC_MARGIN_NUMBER=1
val SC_MARGIN_BACK=2 val SC_MARGIN_BACK=2
val SC_MARGIN_FORE=3 val SC_MARGIN_FORE=3
val SC_MARGIN_TEXT=4
val SC_MARGIN_RTEXT=5
# Set a margin to be either numeric or symbolic. # Set a margin to be either numeric or symbolic.
set void SetMarginTypeN=2240(int margin, int marginType) set void SetMarginTypeN=2240(int margin, int marginType)
@@ -472,10 +477,10 @@ set void StyleSetCharacterSet=2066(int style, int characterSet)
# Set a style to be a hotspot or not. # Set a style to be a hotspot or not.
set void StyleSetHotSpot=2409(int style, bool hotspot) set void StyleSetHotSpot=2409(int style, bool hotspot)
# Set the foreground colour of the selection and whether to use this setting. # Set the foreground colour of the main and additional selections and whether to use this setting.
fun void SetSelFore=2067(bool useSetting, colour fore) fun void SetSelFore=2067(bool useSetting, colour fore)
# Set the background colour of the selection and whether to use this setting. # Set the background colour of the main and additional selections and whether to use this setting.
fun void SetSelBack=2068(bool useSetting, colour back) fun void SetSelBack=2068(bool useSetting, colour back)
# Get the alpha of the selection. # Get the alpha of the selection.
@@ -515,7 +520,7 @@ get int GetCaretPeriod=2075(,)
set void SetCaretPeriod=2076(int periodMilliseconds,) set void SetCaretPeriod=2076(int periodMilliseconds,)
# Set the set of characters making up words for when moving or selecting by word. # Set the set of characters making up words for when moving or selecting by word.
# First sets deaults like SetCharsDefault. # First sets defaults like SetCharsDefault.
set void SetWordChars=2077(, string characters) set void SetWordChars=2077(, string characters)
# Start a sequence of actions that is undone and redone as a unit. # Start a sequence of actions that is undone and redone as a unit.
@@ -566,6 +571,12 @@ fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
# Set the background colour of all whitespace and whether to use this setting. # Set the background colour of all whitespace and whether to use this setting.
fun void SetWhitespaceBack=2085(bool useSetting, colour back) fun void SetWhitespaceBack=2085(bool useSetting, colour back)
# Set the size of the dots used to mark space characters.
set void SetWhitespaceSize=2086(int size,)
# Get the size of the dots used to mark space characters.
get int GetWhitespaceSize=2087(,)
# Divide each styling byte into lexical class bits (default: 5) and indicator # Divide each styling byte into lexical class bits (default: 5) and indicator
# bits (default: 3). If a lexer requires more than 32 lexical states, then this # bits (default: 3). If a lexer requires more than 32 lexical states, then this
# is used to expand the possible states. # is used to expand the possible states.
@@ -1010,10 +1021,6 @@ enu FoldLevel=SC_FOLDLEVEL
val SC_FOLDLEVELBASE=0x400 val SC_FOLDLEVELBASE=0x400
val SC_FOLDLEVELWHITEFLAG=0x1000 val SC_FOLDLEVELWHITEFLAG=0x1000
val SC_FOLDLEVELHEADERFLAG=0x2000 val SC_FOLDLEVELHEADERFLAG=0x2000
val SC_FOLDLEVELBOXHEADERFLAG=0x4000
val SC_FOLDLEVELBOXFOOTERFLAG=0x8000
val SC_FOLDLEVELCONTRACTED=0x10000
val SC_FOLDLEVELUNINDENT=0x20000
val SC_FOLDLEVELNUMBERMASK=0x0FFF val SC_FOLDLEVELNUMBERMASK=0x0FFF
# Set the fold level of a line. # Set the fold level of a line.
@@ -1057,7 +1064,6 @@ val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004
val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008 val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008
val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010 val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010
val SC_FOLDFLAG_LEVELNUMBERS=0x0040 val SC_FOLDFLAG_LEVELNUMBERS=0x0040
val SC_FOLDFLAG_BOX=0x0001
# Set some style options for folding. # Set some style options for folding.
fun void SetFoldFlags=2233(int flags,) fun void SetFoldFlags=2233(int flags,)
@@ -1131,6 +1137,17 @@ set void SetWrapStartIndent=2464(int indent,)
# Retrive the start indent for wrapped lines. # Retrive the start indent for wrapped lines.
get int GetWrapStartIndent=2465(,) get int GetWrapStartIndent=2465(,)
enu WrapIndentMode=SC_WRAPINDENT_
val SC_WRAPINDENT_FIXED=0
val SC_WRAPINDENT_SAME=1
val SC_WRAPINDENT_INDENT=2
# Sets how wrapped sublines are placed. Default is fixed.
set void SetWrapIndentMode=2472(int mode,)
# Retrieve how wrapped sublines are placed. Default is fixed.
get int GetWrapIndentMode=2473(,)
enu LineCache=SC_CACHE_ enu LineCache=SC_CACHE_
val SC_CACHE_NONE=0 val SC_CACHE_NONE=0
val SC_CACHE_CARET=1 val SC_CACHE_CARET=1
@@ -1188,6 +1205,24 @@ get bool GetTwoPhaseDraw=2283(,)
# and then the foreground. This avoids chopping off characters that overlap the next run. # and then the foreground. This avoids chopping off characters that overlap the next run.
set void SetTwoPhaseDraw=2284(bool twoPhase,) set void SetTwoPhaseDraw=2284(bool twoPhase,)
# Control font anti-aliasing.
enu FontQuality=SC_EFF_
val SC_EFF_QUALITY_MASK=0xF
val SC_EFF_QUALITY_DEFAULT=0
val SC_EFF_QUALITY_NON_ANTIALIASED=1
val SC_EFF_QUALITY_ANTIALIASED=2
val SC_EFF_QUALITY_LCD_OPTIMIZED=3
# Choose the quality level for text from the FontQuality enumeration.
set void SetFontQuality=2611(int fontQuality,)
# Retrieve the quality level for text.
get int GetFontQuality=2612(,)
# Scroll so that a display line is at the top of the display.
set void SetFirstVisibleLine=2613(int lineDisplay,)
# Make the target range start and end be the same as the selection range start and end. # Make the target range start and end be the same as the selection range start and end.
fun void TargetFromSelection=2287(,) fun void TargetFromSelection=2287(,)
@@ -1382,7 +1417,7 @@ fun void LineCopy=2455(,)
# Move the caret inside current view if it's not there already. # Move the caret inside current view if it's not there already.
fun void MoveCaretInsideView=2401(,) fun void MoveCaretInsideView=2401(,)
# How many characters are on a line, not including end of line characters? # How many characters are on a line, including end of line characters?
fun int LineLength=2350(int line,) fun int LineLength=2350(int line,)
# Highlight the characters at two positions. # Highlight the characters at two positions.
@@ -1477,6 +1512,11 @@ set void SetFocus=2380(bool focus,)
# Get internal focus flag. # Get internal focus flag.
get bool GetFocus=2381(,) get bool GetFocus=2381(,)
enu Status=SC_STATUS_
val SC_STATUS_OK=0
val SC_STATUS_FAILURE=1
val SC_STATUS_BADALLOC=2
# Change error status - 0 = OK. # Change error status - 0 = OK.
set void SetStatus=2382(int statusCode,) set void SetStatus=2382(int statusCode,)
# Get error status. # Get error status.
@@ -1535,7 +1575,7 @@ fun void ChooseCaretX=2399(,)
# Set the focus to this Scintilla widget. # Set the focus to this Scintilla widget.
fun void GrabFocus=2400(,) fun void GrabFocus=2400(,)
enu CaretPolicy = CARET_ enu CaretPolicy=CARET_
# Caret policy, used by SetXCaretPolicy and SetYCaretPolicy. # Caret policy, used by SetXCaretPolicy and SetYCaretPolicy.
# If CARET_SLOP is set, we can define a slop value: caretSlop. # If CARET_SLOP is set, we can define a slop value: caretSlop.
# This value defines an unwanted zone (UZ) where the caret is... unwanted. # This value defines an unwanted zone (UZ) where the caret is... unwanted.
@@ -1617,13 +1657,13 @@ fun void CopyRange=2419(position start, position end)
# Copy argument text to the clipboard. # Copy argument text to the clipboard.
fun void CopyText=2420(int length, string text) fun void CopyText=2420(int length, string text)
# Selection Modes
enu SelectionMode=SC_SEL_ enu SelectionMode=SC_SEL_
val SC_SEL_STREAM=0 val SC_SEL_STREAM=0
val SC_SEL_RECTANGLE=1 val SC_SEL_RECTANGLE=1
val SC_SEL_LINES=2 val SC_SEL_LINES=2
val SC_SEL_THIN=3
# Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or # Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE/SC_SEL_THIN) or
# by lines (SC_SEL_LINES). # by lines (SC_SEL_LINES).
set void SetSelectionMode=2422(int mode,) set void SetSelectionMode=2422(int mode,)
@@ -1702,6 +1742,10 @@ fun void SetCharsDefault=2444(,)
# Get currently selected item position in the auto-completion list # Get currently selected item position in the auto-completion list
fun int AutoCGetCurrent=2445(,) fun int AutoCGetCurrent=2445(,)
# Get currently selected item text in the auto-completion list
# Returns the length of the item text
fun int AutoCGetCurrentText=2610(, stringresult s)
# Enlarge the document to a particular size of text bytes. # Enlarge the document to a particular size of text bytes.
fun void Allocate=2446(int bytes,) fun void Allocate=2446(int bytes,)
@@ -1750,7 +1794,6 @@ set void SetCaretLineBackAlpha=2470(int alpha,)
# Get the background alpha of the caret line. # Get the background alpha of the caret line.
get int GetCaretLineBackAlpha=2471(,) get int GetCaretLineBackAlpha=2471(,)
# Caret Styles
enu CaretStyle=CARETSTYLE_ enu CaretStyle=CARETSTYLE_
val CARETSTYLE_INVISIBLE=0 val CARETSTYLE_INVISIBLE=0
val CARETSTYLE_LINE=1 val CARETSTYLE_LINE=1
@@ -1798,6 +1841,236 @@ set void SetPositionCache=2514(int size,)
# How many entries are allocated to the position cache? # How many entries are allocated to the position cache?
get int GetPositionCache=2515(,) get int GetPositionCache=2515(,)
# Copy the selection, if selection empty copy the line with the caret
fun void CopyAllowLine=2519(,)
# Compact the document buffer and return a read-only pointer to the
# characters in the document.
get int GetCharacterPointer=2520(,)
# Always interpret keyboard input as Unicode
set void SetKeysUnicode=2521(bool keysUnicode,)
# Are keys always interpreted as Unicode?
get bool GetKeysUnicode=2522(,)
# Set the alpha fill colour of the given indicator.
set void IndicSetAlpha=2523(int indicator, int alpha)
# Get the alpha fill colour of the given indicator.
get int IndicGetAlpha=2524(int indicator,)
# Set extra ascent for each line
set void SetExtraAscent=2525(int extraAscent,)
# Get extra ascent for each line
get int GetExtraAscent=2526(,)
# Set extra descent for each line
set void SetExtraDescent=2527(int extraDescent,)
# Get extra descent for each line
get int GetExtraDescent=2528(,)
# Which symbol was defined for markerNumber with MarkerDefine
fun int MarkerSymbolDefined=2529(int markerNumber,)
# Set the text in the text margin for a line
set void MarginSetText=2530(int line, string text)
# Get the text in the text margin for a line
get int MarginGetText=2531(int line, stringresult text)
# Set the style number for the text margin for a line
set void MarginSetStyle=2532(int line, int style)
# Get the style number for the text margin for a line
get int MarginGetStyle=2533(int line,)
# Set the style in the text margin for a line
set void MarginSetStyles=2534(int line, string styles)
# Get the styles in the text margin for a line
get int MarginGetStyles=2535(int line, stringresult styles)
# Clear the margin text on all lines
fun void MarginTextClearAll=2536(,)
# Get the start of the range of style numbers used for margin text
set void MarginSetStyleOffset=2537(int style,)
# Get the start of the range of style numbers used for margin text
get int MarginGetStyleOffset=2538(,)
# Set the annotation text for a line
set void AnnotationSetText=2540(int line, string text)
# Get the annotation text for a line
get int AnnotationGetText=2541(int line, stringresult text)
# Set the style number for the annotations for a line
set void AnnotationSetStyle=2542(int line, int style)
# Get the style number for the annotations for a line
get int AnnotationGetStyle=2543(int line,)
# Set the annotation styles for a line
set void AnnotationSetStyles=2544(int line, string styles)
# Get the annotation styles for a line
get int AnnotationGetStyles=2545(int line, stringresult styles)
# Get the number of annotation lines for a line
get int AnnotationGetLines=2546(int line,)
# Clear the annotations from all lines
fun void AnnotationClearAll=2547(,)
enu AnnotationVisible=ANNOTATION_
val ANNOTATION_HIDDEN=0
val ANNOTATION_STANDARD=1
val ANNOTATION_BOXED=2
# Set the visibility for the annotations for a view
set void AnnotationSetVisible=2548(int visible,)
# Get the visibility for the annotations for a view
get int AnnotationGetVisible=2549(,)
# Get the start of the range of style numbers used for annotations
set void AnnotationSetStyleOffset=2550(int style,)
# Get the start of the range of style numbers used for annotations
get int AnnotationGetStyleOffset=2551(,)
val UNDO_MAY_COALESCE=1
# Add a container action to the undo stack
fun void AddUndoAction=2560(int token, int flags)
# Find the position of a character from a point within the window.
fun position CharPositionFromPoint=2561(int x, int y)
# Find the position of a character from a point within the window.
# Return INVALID_POSITION if not close to text.
fun position CharPositionFromPointClose=2562(int x, int y)
# Set whether multiple selections can be made
set void SetMultipleSelection=2563(bool multipleSelection,)
# Whether multiple selections can be made
get bool GetMultipleSelection=2564(,)
# Set whether typing can be performed into multiple selections
set void SetAdditionalSelectionTyping=2565(bool additionalSelectionTyping,)
# Whether typing can be performed into multiple selections
get bool GetAdditionalSelectionTyping=2566(,)
# Set whether additional carets will blink
set void SetAdditionalCaretsBlink=2567(bool additionalCaretsBlink,)
# Whether additional carets will blink
get bool GetAdditionalCaretsBlink=2568(,)
# Set whether additional carets are visible
set void SetAdditionalCaretsVisible=2608(bool additionalCaretsBlink,)
# Whether additional carets are visible
get bool GetAdditionalCaretsVisible=2609(,)
# How many selections are there?
get int GetSelections=2570(,)
# Clear selections to a single empty stream selection
fun void ClearSelections=2571(,)
# Set a simple selection
fun int SetSelection=2572(int caret,int anchor)
# Add a selection
fun int AddSelection=2573(int caret,int anchor)
# Set the main selection
set void SetMainSelection=2574(int selection,)
# Which selection is the main selection
get int GetMainSelection=2575(,)
set void SetSelectionNCaret=2576(int selection, position pos)
get position GetSelectionNCaret=2577(int selection,)
set void SetSelectionNAnchor=2578(int selection, position posAnchor)
get position GetSelectionNAnchor=2579(int selection,)
set void SetSelectionNCaretVirtualSpace=2580(int selection, int space)
get int GetSelectionNCaretVirtualSpace=2581(int selection,)
set void SetSelectionNAnchorVirtualSpace=2582(int selection, int space)
get int GetSelectionNAnchorVirtualSpace=2583(int selection,)
# Sets the position that starts the selection - this becomes the anchor.
set void SetSelectionNStart=2584(int selection, position pos)
# Returns the position at the start of the selection.
get position GetSelectionNStart=2585(int selection,)
# Sets the position that ends the selection - this becomes the currentPosition.
set void SetSelectionNEnd=2586(int selection, position pos,)
# Returns the position at the end of the selection.
get position GetSelectionNEnd=2587(int selection,)
set void SetRectangularSelectionCaret=2588(position pos,)
get position GetRectangularSelectionCaret=2589(,)
set void SetRectangularSelectionAnchor=2590(position posAnchor,)
get position GetRectangularSelectionAnchor=2591(,)
set void SetRectangularSelectionCaretVirtualSpace=2592(int space,)
get int GetRectangularSelectionCaretVirtualSpace=2593(,)
set void SetRectangularSelectionAnchorVirtualSpace=2594(int space,)
get int GetRectangularSelectionAnchorVirtualSpace=2595(,)
enu VirtualSpace=SCVS_
val SCVS_NONE=0
val SCVS_RECTANGULARSELECTION=1
val SCVS_USERACCESSIBLE=2
set void SetVirtualSpaceOptions=2596(int virtualSpaceOptions,)
get int GetVirtualSpaceOptions=2597(,)
# On GTK+, allow selecting the modifier key to use for mouse-based
# rectangular selection. Often the window manager requires Alt+Mouse Drag
# for moving windows.
# Valid values are SCMOD_CTRL(default), SCMOD_ALT, or SCMOD_SUPER.
set void SetRectangularSelectionModifier=2598(int modifier,)
# Get the modifier key used for rectangular selection.
get int GetRectangularSelectionModifier=2599(,)
# Set the foreground colour of additional selections.
# Must have previously called SetSelFore with non-zero first argument for this to have an effect.
set void SetAdditionalSelFore=2600(colour fore,)
# Set the background colour of additional selections.
# Must have previously called SetSelBack with non-zero first argument for this to have an effect.
set void SetAdditionalSelBack=2601(colour back,)
# Set the alpha of the selection.
set void SetAdditionalSelAlpha=2602(int alpha,)
# Get the alpha of the selection.
get int GetAdditionalSelAlpha=2603(,)
# Set the foreground colour of additional carets.
set void SetAdditionalCaretFore=2604(colour fore,)
# Get the foreground colour of additional carets.
get colour GetAdditionalCaretFore=2605(,)
# Set the main selection to the next selection.
fun void RotateSelection=2606(,)
# Swap that caret and anchor of the main selection.
fun void SwapMainAnchorCaret=2607(,)
# Start notifying the container of all key presses and commands. # Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,) fun void StartRecord=3001(,)
@@ -1842,6 +2115,10 @@ get int GetPropertyInt=4010(string key,)
# Retrieve the number of bits the current lexer needs for styling. # Retrieve the number of bits the current lexer needs for styling.
get int GetStyleBitsNeeded=4011(,) get int GetStyleBitsNeeded=4011(,)
# Retrieve the name of the lexer.
# Return the length of the text.
get int GetLexerLanguage=4012(, stringresult text)
# Notifications # Notifications
# Type of modification and the action which caused the modification. # Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted. # These are defined as a bit mask to make it easy to specify which notifications are wanted.
@@ -1863,7 +2140,10 @@ val SC_MULTILINEUNDOREDO=0x1000
val SC_STARTACTION=0x2000 val SC_STARTACTION=0x2000
val SC_MOD_CHANGEINDICATOR=0x4000 val SC_MOD_CHANGEINDICATOR=0x4000
val SC_MOD_CHANGELINESTATE=0x8000 val SC_MOD_CHANGELINESTATE=0x8000
val SC_MODEVENTMASKALL=0xFFFF val SC_MOD_CHANGEMARGIN=0x10000
val SC_MOD_CHANGEANNOTATION=0x20000
val SC_MOD_CONTAINER=0x40000
val SC_MODEVENTMASKALL=0x7FFFF
# For compatibility, these go through the COMMAND notification rather than NOTIFY # For compatibility, these go through the COMMAND notification rather than NOTIFY
# and should have had exactly the same values as the EN_* constants. # and should have had exactly the same values as the EN_* constants.
@@ -1904,6 +2184,7 @@ val SCMOD_NORM=0
val SCMOD_SHIFT=1 val SCMOD_SHIFT=1
val SCMOD_CTRL=2 val SCMOD_CTRL=2
val SCMOD_ALT=4 val SCMOD_ALT=4
val SCMOD_SUPER=8
################################################ ################################################
# For SciLexer.h # For SciLexer.h
@@ -1993,12 +2274,25 @@ val SCLEX_PROGRESS=83
val SCLEX_ABAQUS=84 val SCLEX_ABAQUS=84
val SCLEX_ASYMPTOTE=85 val SCLEX_ASYMPTOTE=85
val SCLEX_R=86 val SCLEX_R=86
val SCLEX_MAGIK=87
val SCLEX_POWERSHELL=88
val SCLEX_MYSQL=89
val SCLEX_PO=90
val SCLEX_TAL=91
val SCLEX_COBOL=92
val SCLEX_TACL=93
val SCLEX_SORCUS=94
val SCLEX_POWERPRO=95
val SCLEX_NIMROD=96
val SCLEX_SML=97
val SCLEX_MARKDOWN=98
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1. # value assigned in sequence from SCLEX_AUTOMATIC+1.
val SCLEX_AUTOMATIC=1000 val SCLEX_AUTOMATIC=1000
# Lexical states for SCLEX_PYTHON # Lexical states for SCLEX_PYTHON
lex Python=SCLEX_PYTHON SCE_P_ lex Python=SCLEX_PYTHON SCE_P_
lex Nimrod=SCLEX_NIMROD SCE_P_
val SCE_P_DEFAULT=0 val SCE_P_DEFAULT=0
val SCE_P_COMMENTLINE=1 val SCE_P_COMMENTLINE=1
val SCE_P_NUMBER=2 val SCE_P_NUMBER=2
@@ -2017,7 +2311,6 @@ val SCE_P_WORD2=14
val SCE_P_DECORATOR=15 val SCE_P_DECORATOR=15
# Lexical states for SCLEX_CPP # Lexical states for SCLEX_CPP
lex Cpp=SCLEX_CPP SCE_C_ lex Cpp=SCLEX_CPP SCE_C_
lex Pascal=SCLEX_PASCAL SCE_C_
lex BullAnt=SCLEX_BULLANT SCE_C_ lex BullAnt=SCLEX_BULLANT SCE_C_
val SCE_C_DEFAULT=0 val SCE_C_DEFAULT=0
val SCE_C_COMMENT=1 val SCE_C_COMMENT=1
@@ -2059,6 +2352,11 @@ val SCE_D_IDENTIFIER=14
val SCE_D_COMMENTLINEDOC=15 val SCE_D_COMMENTLINEDOC=15
val SCE_D_COMMENTDOCKEYWORD=16 val SCE_D_COMMENTDOCKEYWORD=16
val SCE_D_COMMENTDOCKEYWORDERROR=17 val SCE_D_COMMENTDOCKEYWORDERROR=17
val SCE_D_STRINGB=18
val SCE_D_STRINGR=19
val SCE_D_WORD5=20
val SCE_D_WORD6=21
val SCE_D_WORD7=22
# Lexical states for SCLEX_TCL # Lexical states for SCLEX_TCL
lex TCL=SCLEX_TCL SCE_TCL_ lex TCL=SCLEX_TCL SCE_TCL_
val SCE_TCL_DEFAULT=0 val SCE_TCL_DEFAULT=0
@@ -2396,6 +2694,7 @@ val SCE_DIFF_HEADER=3
val SCE_DIFF_POSITION=4 val SCE_DIFF_POSITION=4
val SCE_DIFF_DELETED=5 val SCE_DIFF_DELETED=5
val SCE_DIFF_ADDED=6 val SCE_DIFF_ADDED=6
val SCE_DIFF_CHANGED=7
# Lexical states for SCLEX_CONF (Apache Configuration Files Lexer) # Lexical states for SCLEX_CONF (Apache Configuration Files Lexer)
lex Conf=SCLEX_CONF SCE_CONF_ lex Conf=SCLEX_CONF SCE_CONF_
val SCE_CONF_DEFAULT=0 val SCE_CONF_DEFAULT=0
@@ -2589,6 +2888,11 @@ val SCE_CSS_DOUBLESTRING=13
val SCE_CSS_SINGLESTRING=14 val SCE_CSS_SINGLESTRING=14
val SCE_CSS_IDENTIFIER2=15 val SCE_CSS_IDENTIFIER2=15
val SCE_CSS_ATTRIBUTE=16 val SCE_CSS_ATTRIBUTE=16
val SCE_CSS_IDENTIFIER3=17
val SCE_CSS_PSEUDOELEMENT=18
val SCE_CSS_EXTENDED_IDENTIFIER=19
val SCE_CSS_EXTENDED_PSEUDOCLASS=20
val SCE_CSS_EXTENDED_PSEUDOELEMENT=21
# Lexical states for SCLEX_POV # Lexical states for SCLEX_POV
lex POV=SCLEX_POV SCE_POV_ lex POV=SCLEX_POV SCE_POV_
val SCE_POV_DEFAULT=0 val SCE_POV_DEFAULT=0
@@ -2764,8 +3068,19 @@ val SCE_ERLANG_FUNCTION_NAME=8
val SCE_ERLANG_CHARACTER=9 val SCE_ERLANG_CHARACTER=9
val SCE_ERLANG_MACRO=10 val SCE_ERLANG_MACRO=10
val SCE_ERLANG_RECORD=11 val SCE_ERLANG_RECORD=11
val SCE_ERLANG_SEPARATOR=12 val SCE_ERLANG_PREPROC=12
val SCE_ERLANG_NODE_NAME=13 val SCE_ERLANG_NODE_NAME=13
val SCE_ERLANG_COMMENT_FUNCTION=14
val SCE_ERLANG_COMMENT_MODULE=15
val SCE_ERLANG_COMMENT_DOC=16
val SCE_ERLANG_COMMENT_DOC_MACRO=17
val SCE_ERLANG_ATOM_QUOTED=18
val SCE_ERLANG_MACRO_QUOTED=19
val SCE_ERLANG_RECORD_QUOTED=20
val SCE_ERLANG_NODE_NAME_QUOTED=21
val SCE_ERLANG_BIFS=22
val SCE_ERLANG_MODULES=23
val SCE_ERLANG_MODULES_ATT=24
val SCE_ERLANG_UNKNOWN=31 val SCE_ERLANG_UNKNOWN=31
# Lexical states for SCLEX_OCTAVE are identical to MatLab # Lexical states for SCLEX_OCTAVE are identical to MatLab
lex Octave=SCLEX_OCTAVE SCE_MATLAB_ lex Octave=SCLEX_OCTAVE SCE_MATLAB_
@@ -2937,6 +3252,7 @@ val SCE_CAML_LINENUM=6
val SCE_CAML_OPERATOR=7 val SCE_CAML_OPERATOR=7
val SCE_CAML_NUMBER=8 val SCE_CAML_NUMBER=8
val SCE_CAML_CHAR=9 val SCE_CAML_CHAR=9
val SCE_CAML_WHITE=10
val SCE_CAML_STRING=11 val SCE_CAML_STRING=11
val SCE_CAML_COMMENT=12 val SCE_CAML_COMMENT=12
val SCE_CAML_COMMENT1=13 val SCE_CAML_COMMENT1=13
@@ -3110,7 +3426,7 @@ val SCE_INNO_KEYWORD=2
val SCE_INNO_PARAMETER=3 val SCE_INNO_PARAMETER=3
val SCE_INNO_SECTION=4 val SCE_INNO_SECTION=4
val SCE_INNO_PREPROC=5 val SCE_INNO_PREPROC=5
val SCE_INNO_PREPROC_INLINE=6 val SCE_INNO_INLINE_EXPANSION=6
val SCE_INNO_COMMENT_PASCAL=7 val SCE_INNO_COMMENT_PASCAL=7
val SCE_INNO_KEYWORD_PASCAL=8 val SCE_INNO_KEYWORD_PASCAL=8
val SCE_INNO_KEYWORD_USER=9 val SCE_INNO_KEYWORD_USER=9
@@ -3258,6 +3574,162 @@ val SCE_R_OPERATOR=8
val SCE_R_IDENTIFIER=9 val SCE_R_IDENTIFIER=9
val SCE_R_INFIX=10 val SCE_R_INFIX=10
val SCE_R_INFIXEOL=11 val SCE_R_INFIXEOL=11
# Lexical state for SCLEX_MAGIKSF
lex MagikSF=SCLEX_MAGIKSF SCE_MAGIK_
val SCE_MAGIK_DEFAULT=0
val SCE_MAGIK_COMMENT=1
val SCE_MAGIK_HYPER_COMMENT=16
val SCE_MAGIK_STRING=2
val SCE_MAGIK_CHARACTER=3
val SCE_MAGIK_NUMBER=4
val SCE_MAGIK_IDENTIFIER=5
val SCE_MAGIK_OPERATOR=6
val SCE_MAGIK_FLOW=7
val SCE_MAGIK_CONTAINER=8
val SCE_MAGIK_BRACKET_BLOCK=9
val SCE_MAGIK_BRACE_BLOCK=10
val SCE_MAGIK_SQBRACKET_BLOCK=11
val SCE_MAGIK_UNKNOWN_KEYWORD=12
val SCE_MAGIK_KEYWORD=13
val SCE_MAGIK_PRAGMA=14
val SCE_MAGIK_SYMBOL=15
# Lexical state for SCLEX_POWERSHELL
lex PowerShell=SCLEX_POWERSHELL SCE_POWERSHELL_
val SCE_POWERSHELL_DEFAULT=0
val SCE_POWERSHELL_COMMENT=1
val SCE_POWERSHELL_STRING=2
val SCE_POWERSHELL_CHARACTER=3
val SCE_POWERSHELL_NUMBER=4
val SCE_POWERSHELL_VARIABLE=5
val SCE_POWERSHELL_OPERATOR=6
val SCE_POWERSHELL_IDENTIFIER=7
val SCE_POWERSHELL_KEYWORD=8
val SCE_POWERSHELL_CMDLET=9
val SCE_POWERSHELL_ALIAS=10
# Lexical state for SCLEX_MYSQL
lex MySQL=SCLEX_MYSQL SCE_MYSQL_
val SCE_MYSQL_DEFAULT=0
val SCE_MYSQL_COMMENT=1
val SCE_MYSQL_COMMENTLINE=2
val SCE_MYSQL_VARIABLE=3
val SCE_MYSQL_SYSTEMVARIABLE=4
val SCE_MYSQL_KNOWNSYSTEMVARIABLE=5
val SCE_MYSQL_NUMBER=6
val SCE_MYSQL_MAJORKEYWORD=7
val SCE_MYSQL_KEYWORD=8
val SCE_MYSQL_DATABASEOBJECT=9
val SCE_MYSQL_PROCEDUREKEYWORD=10
val SCE_MYSQL_STRING=11
val SCE_MYSQL_SQSTRING=12
val SCE_MYSQL_DQSTRING=13
val SCE_MYSQL_OPERATOR=14
val SCE_MYSQL_FUNCTION=15
val SCE_MYSQL_IDENTIFIER=16
val SCE_MYSQL_QUOTEDIDENTIFIER=17
val SCE_MYSQL_USER1=18
val SCE_MYSQL_USER2=19
val SCE_MYSQL_USER3=20
val SCE_MYSQL_HIDDENCOMMAND=21
# Lexical state for SCLEX_PO
lex Po=SCLEX_PO SCE_PO_
val SCE_PO_DEFAULT=0
val SCE_PO_COMMENT=1
val SCE_PO_MSGID=2
val SCE_PO_MSGID_TEXT=3
val SCE_PO_MSGSTR=4
val SCE_PO_MSGSTR_TEXT=5
val SCE_PO_MSGCTXT=6
val SCE_PO_MSGCTXT_TEXT=7
val SCE_PO_FUZZY=8
# Lexical states for SCLEX_PASCAL
lex Pascal=SCLEX_PASCAL SCE_PAS_
val SCE_PAS_DEFAULT=0
val SCE_PAS_IDENTIFIER=1
val SCE_PAS_COMMENT=2
val SCE_PAS_COMMENT2=3
val SCE_PAS_COMMENTLINE=4
val SCE_PAS_PREPROCESSOR=5
val SCE_PAS_PREPROCESSOR2=6
val SCE_PAS_NUMBER=7
val SCE_PAS_HEXNUMBER=8
val SCE_PAS_WORD=9
val SCE_PAS_STRING=10
val SCE_PAS_STRINGEOL=11
val SCE_PAS_CHARACTER=12
val SCE_PAS_OPERATOR=13
val SCE_PAS_ASM=14
# Lexical state for SCLEX_SORCUS
lex SORCUS=SCLEX_SORCUS SCE_SORCUS_
val SCE_SORCUS_DEFAULT=0
val SCE_SORCUS_COMMAND=1
val SCE_SORCUS_PARAMETER=2
val SCE_SORCUS_COMMENTLINE=3
val SCE_SORCUS_STRING=4
val SCE_SORCUS_STRINGEOL=5
val SCE_SORCUS_IDENTIFIER=6
val SCE_SORCUS_OPERATOR=7
val SCE_SORCUS_NUMBER=8
val SCE_SORCUS_CONSTANT=9
# Lexical state for SCLEX_POWERPRO
lex PowerPro=SCLEX_POWERPRO SCE_POWERPRO_
val SCE_POWERPRO_DEFAULT=0
val SCE_POWERPRO_COMMENTBLOCK=1
val SCE_POWERPRO_COMMENTLINE=2
val SCE_POWERPRO_NUMBER=3
val SCE_POWERPRO_WORD=4
val SCE_POWERPRO_WORD2=5
val SCE_POWERPRO_WORD3=6
val SCE_POWERPRO_WORD4=7
val SCE_POWERPRO_DOUBLEQUOTEDSTRING=8
val SCE_POWERPRO_SINGLEQUOTEDSTRING=9
val SCE_POWERPRO_LINECONTINUE=10
val SCE_POWERPRO_OPERATOR=11
val SCE_POWERPRO_IDENTIFIER=12
val SCE_POWERPRO_STRINGEOL=13
val SCE_POWERPRO_VERBATIM=14
val SCE_POWERPRO_ALTQUOTE=15
val SCE_POWERPRO_FUNCTION=16
# Lexical states for SCLEX_SML
lex SML=SCLEX_SML SCE_SML_
val SCE_SML_DEFAULT=0
val SCE_SML_IDENTIFIER=1
val SCE_SML_TAGNAME=2
val SCE_SML_KEYWORD=3
val SCE_SML_KEYWORD2=4
val SCE_SML_KEYWORD3=5
val SCE_SML_LINENUM=6
val SCE_SML_OPERATOR=7
val SCE_SML_NUMBER=8
val SCE_SML_CHAR=9
val SCE_SML_STRING=11
val SCE_SML_COMMENT=12
val SCE_SML_COMMENT1=13
val SCE_SML_COMMENT2=14
val SCE_SML_COMMENT3=15
# Lexical state for SCLEX_MARKDOWN
lex Markdown=SCLEX_MARKDOWN SCE_MARKDOWN_
val SCE_MARKDOWN_DEFAULT=0
val SCE_MARKDOWN_LINE_BEGIN=1
val SCE_MARKDOWN_STRONG1=2
val SCE_MARKDOWN_STRONG2=3
val SCE_MARKDOWN_EM1=4
val SCE_MARKDOWN_EM2=5
val SCE_MARKDOWN_HEADER1=6
val SCE_MARKDOWN_HEADER2=7
val SCE_MARKDOWN_HEADER3=8
val SCE_MARKDOWN_HEADER4=9
val SCE_MARKDOWN_HEADER5=10
val SCE_MARKDOWN_HEADER6=11
val SCE_MARKDOWN_PRECHAR=12
val SCE_MARKDOWN_ULIST_ITEM=13
val SCE_MARKDOWN_OLIST_ITEM=14
val SCE_MARKDOWN_BLOCKQUOTE=15
val SCE_MARKDOWN_STRIKEOUT=16
val SCE_MARKDOWN_HRULE=17
val SCE_MARKDOWN_LINK=18
val SCE_MARKDOWN_CODE=19
val SCE_MARKDOWN_CODE2=20
val SCE_MARKDOWN_CODEBK=21
# Events # Events
@@ -3286,19 +3758,5 @@ evt void CallTipClick=2021(int position)
evt void AutoCSelection=2022(string text) evt void AutoCSelection=2022(string text)
evt void IndicatorClick=2023(int modifiers, int position) evt void IndicatorClick=2023(int modifiers, int position)
evt void IndicatorRelease=2024(int modifiers, int position) evt void IndicatorRelease=2024(int modifiers, int position)
evt void AutoCCancelled=2025(void)
cat Deprecated evt void AutoCCharDeleted=2026(void)
# CARET_POLICY changed in 1.47
fun void SetCaretPolicy=2369(int caretPolicy, int caretSlop)
val CARET_CENTER=0x02
val CARET_XEVEN=0x08
val CARET_XJUMPS=0x10
# The old name for SCN_UPDATEUI
val SCN_CHECKBRACE=2007
evt void PosChanged=2012(int position)
# SCLEX_HTML should be used in preference to these.
val SCLEX_ASP=29
val SCLEX_PHP=30

View File

@@ -1,10 +1,10 @@
// Scintilla source code edit control /* Scintilla source code edit control */
/** @file ScintillaWidget.h /** @file ScintillaWidget.h
** Definition of Scintilla widget for GTK+. ** Definition of Scintilla widget for GTK+.
** Only needed by GTK+ code but is harmless on other platforms. ** Only needed by GTK+ code but is harmless on other platforms.
**/ **/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> /* Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. * The License.txt file describes the conditions under which this software may be distributed. */
#ifndef SCINTILLAWIDGET_H #ifndef SCINTILLAWIDGET_H
#define SCINTILLAWIDGET_H #define SCINTILLAWIDGET_H

View File

@@ -12,13 +12,14 @@ namespace Scintilla {
/** /**
*/ */
class WindowAccessor : public Accessor { class WindowAccessor : public Accessor {
// Private so WindowAccessor objects can not be copied // Private so WindowAccessor objects can not be copied
WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {} WindowAccessor(const WindowAccessor &source) : Accessor(), props(source.props) {}
WindowAccessor &operator=(const WindowAccessor &) { return *this; } WindowAccessor &operator=(const WindowAccessor &) { return *this; }
protected: protected:
WindowID id; WindowID id;
PropSet &props; PropertyGet &props;
int lenDoc; int lenDoc;
char styleBuf[bufferSize]; char styleBuf[bufferSize];
@@ -30,7 +31,7 @@ protected:
bool InternalIsLeadByte(char ch); bool InternalIsLeadByte(char ch);
void Fill(int position); void Fill(int position);
public: public:
WindowAccessor(WindowID id_, PropSet &props_) : WindowAccessor(WindowID id_, PropertyGet &props_) :
Accessor(), id(id_), props(props_), Accessor(), id(id_), props(props_),
lenDoc(-1), validLen(0), chFlags(0), chWhile(0) { lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
} }

View File

@@ -0,0 +1,380 @@
/** file Array.cpp
* This file is defining a kind of tool for simulating std::vector
* for using wx on OS which are not supporting the STL
* @author foldink (foldink@gmail.com)
* @date 26-February-2010
*/
#include <string.h>
#include "Platform.h"
#include "Scintilla.h"
#include "Selection.h"
#include "Array.h"
SelectionRange& ArrayIterator::operator*()
{
if ( m_idx >= m_parent->size() )
throw "Error access out of bounds";
return (*m_parent)[m_idx];
}
ArrayIterator ArrayIterator::operator++(int)
{
ArrayIterator ret(*this);
ret.m_idx++;
return ret;
}
ArrayIterator& ArrayIterator::operator++()
{
m_idx++;
return (*this);
}
ArrayIterator ArrayIterator::operator--(int)
{
if ( m_idx == 0 )
throw "Error access out of bounds";
ArrayIterator ret(*this);
ret.m_idx--;
return ret;
}
ArrayIterator& ArrayIterator::operator--()
{
if ( m_idx == 0 )
m_idx--;
return (*this);
}
ArrayIterator ArrayIterator::operator+(size_t idx)
{
ArrayIterator ret(*this);
ret.m_idx += idx;
return ret;
}
ArrayIterator ArrayIterator::operator-(size_t idx)
{
if ( idx > m_idx )
throw "Error access out of bounds";
ArrayIterator ret(*this);
ret.m_idx -= idx;
return ret;
}
ArrayIterator& ArrayIterator::operator+=(size_t idx)
{
m_idx += idx;
return (*this);
}
ArrayIterator& ArrayIterator::operator-=(size_t idx)
{
if ( idx > m_idx )
throw "Error access out of bounds";
m_idx -= idx;
return (*this);
}
bool ArrayIterator::operator!=(const ArrayIterator& rhs)
{
if ( m_parent == rhs.m_parent && m_idx == rhs.m_idx )
return false;
return true;
}
bool ArrayIterator::operator==(const ArrayIterator& rhs)
{
if ( m_parent == rhs.m_parent && m_idx == rhs.m_idx )
return true;
return false;
}
Array::Array( size_t len ):
m_data(0L),
m_size(0)
{
if ( len == 0 )
return;
m_data = new SelectionRange[len];
m_size = len;
}
Array::Array( size_t len , const SelectionRange& val ):
m_data(0L),
m_size(0)
{
if ( len == 0 )
return;
m_data = new SelectionRange[len];
m_size = len;
for ( size_t i = 0; i < len ; ++i )
*(m_data + i) = val;
}
Array::Array( const Array& rhs ):
m_data(0L),
m_size(0)
{
if ( rhs.m_size == 0 )
return;
m_data = new SelectionRange[rhs.m_size];
m_size = rhs.m_size;
memcpy( m_data , rhs.m_data , m_size*sizeof(SelectionRange) );
}
Array::~Array()
{
if ( m_data )
delete m_data;
}
Array& Array::operator=( const Array& rhs )
{
if ( m_data )
delete m_data;
m_data = 0L;
m_size = 0;
if ( rhs.m_size == 0 )
return (*this);
m_data = new SelectionRange[rhs.m_size];
m_size = rhs.m_size;
memcpy( m_data , rhs.m_data , m_size*sizeof(SelectionRange) );
return (*this);
}
void Array::reserve( size_t len )
{
if ( len <= m_size || len == 0 )
return;
SelectionRange* data = 0L;
data = new SelectionRange[len];
if ( m_data ) {
memcpy( data , m_data , m_size*sizeof(SelectionRange) );
delete m_data;
m_data = data;
} else
m_data = data;
}
void Array::push_back( const SelectionRange& val )
{
if ( !m_data ) {
m_data = new SelectionRange[1];
*m_data = val;
m_size = 1;
return;
}
SelectionRange* data = 0L;
data = new SelectionRange[m_size+1];
memcpy( data , m_data , m_size*sizeof(SelectionRange) );
m_data = data;
*(m_data+m_size) = val;
m_size++;
}
void Array::pop_back( )
{
if ( !m_data )
throw "Error access out of bounds";
m_size--;
SelectionRange* data = 0L;
if ( m_size > 0 ) {
data = new SelectionRange[m_size];
memcpy( data , m_data , m_size*sizeof(SelectionRange) );
}
delete m_data;
m_data = data;
}
void Array::insert( ArrayIterator it , SelectionRange& val )
{
size_t idx = it.GetIdx();
SelectionRange* data = 0L;
if (!m_data) {
m_size = idx+1;
m_data = new SelectionRange[m_size];
} else if ( idx >= m_size ) {
data = new SelectionRange[idx+1];
memcpy( data , m_data , m_size*sizeof(SelectionRange) );
m_size = idx+1;
delete m_data;
m_data = data;
} else if ( idx == 0 ) {
data = new SelectionRange[m_size+1];
memcpy( data + 1 , m_data , m_size*sizeof(SelectionRange) );
delete m_data;
m_size++;
m_data = data;
} else {
data = new SelectionRange[m_size+1];
memcpy( data , m_data , idx*sizeof(SelectionRange) );
memcpy( data + idx + 1 , m_data + idx , (m_size-idx)*sizeof(SelectionRange) );
delete m_data;
m_size++;
m_data = data;
}
*(m_data + idx) = val;
}
void Array::erase( ArrayIterator it )
{
size_t idx = it.GetIdx();
if (!m_data || idx >= m_size )
throw "Error access out of bounds";
SelectionRange* data = 0L;
if ( m_size == 1 ) {
delete m_data;
m_data = 0L;
return;
} else if ( idx == 0) {
data = new SelectionRange[m_size-1];
memcpy( data , m_data + 1 , (m_size-1)*sizeof(SelectionRange) );
delete m_data;
m_size--;
m_data = data;
} else {
data = new SelectionRange[m_size-1];
memcpy( data , m_data , (idx)*sizeof(SelectionRange) );
memcpy( data + idx , m_data + idx + 1 , (m_size-idx-1)*sizeof(SelectionRange) );
delete m_data;
m_size--;
m_data = data;
}
}
void Array::clear( )
{
if ( !m_data )
return;
delete m_data;
m_data = 0L;
m_size = 0;
}
void Array::resize( size_t n , SelectionRange val )
{
if ( (n == 0 && !m_data) || n <= m_size )
return;
if ( n == 0 ) {
delete m_data;
m_data = 0L;
m_size = 0;
}
SelectionRange* data = 0L;
data = new SelectionRange[n];
memcpy( data , m_data , m_size*sizeof(SelectionRange) );
delete m_data;
m_data = data;
for ( size_t i = m_size ; i < n ; ++i )
*( m_data + i ) = val;
m_size = n;
}
bool Array::operator==(const Array& rhs)
{
if ( m_size != rhs.m_size )
return false;
if ( m_size == 0 && rhs.m_size == 0 )
return true;
for ( size_t i = 0 ; i < m_size ; ++i )
if ( ! ((*(m_data +i)) == (*(rhs.m_data+i))) )
return false;
return true;
}
ArrayIterator Array::begin()
{
ArrayIterator ret(this,0);
return ret;
}
ArrayIterator Array::end()
{
ArrayIterator ret(this,m_size);
return ret;
}
int partition(Array &array, int top, int bottom)
{
SelectionRange x = array[top];
int i = top - 1;
int j = bottom + 1;
SelectionRange temp;
do {
do {
j--;
} while (x < array[j]);
do {
i++;
} while (array[j] < x);
if (i < j) {
temp = array[i];
array[i] = array[j];
array[j] = temp;
}
} while (i < j);
return j; // returns middle subscript
}
void quicksort(Array &num, int top, int bottom)
{
// top = subscript of beginning of array
// bottom = subscript of end of array
int middle;
if (top < bottom) {
middle = partition(num, top, bottom);
quicksort(num, top, middle); // sort first section
quicksort(num, middle+1, bottom); // sort second section
}
return;
}
void ArraySort( ArrayIterator start , ArrayIterator finish )
{
if ( start.m_parent != finish.m_parent )
throw "Invalid iterators parent mismatch";
if ( start.m_idx >= finish.m_idx-1 )
throw "Invalid iterators are refering to bad values";
quicksort( *(start.m_parent) , start.m_idx , finish.m_idx-1 );
}

View File

@@ -0,0 +1,209 @@
/** file Array.h
* This file is defining a kind of tool for simulating std::vector
* for using wx on OS which are not supporting the STL
* @author foldink (foldink@gmail.com)
* @date 26-February-2010
*/
#ifndef ARRAY_H
#define ARRAY_H
#include <stdio.h>
/* defines */
class Array;
class ArrayIterator;
//struct SelectionRange;
/**
* @class ArrayIterator
* @brief This class is used to simulate an iterator in the array
* @author foldink (foldink@gmail.com)
* @date 26-February-2010
*/
class ArrayIterator
{
friend class Array;
public :
/** ctor
* @param parent, parented array to store positions in
*/
ArrayIterator( Array* parent , size_t idx ):
m_parent(parent),
m_idx(idx) {};
/** dtor */
virtual ~ArrayIterator()
{
m_parent = 0L;
}
/** copy ctor */
ArrayIterator(const ArrayIterator& rhs):
m_parent(rhs.m_parent),
m_idx(rhs.m_idx) { }
/***********************************************************************
* OPERATOR OVERLOADS
**********************************************************************/
/** the equal operator is used to overload copy for the array */
ArrayIterator& operator=(const ArrayIterator& rhs)
{
m_parent = rhs.m_parent;
m_idx = rhs.m_idx;
return (*this);
}
/** Smart pointer part overload as it is in standard templates arrays */
SelectionRange& operator*();
/** a++ operator */
ArrayIterator operator++(int);
/** ++a operator */
ArrayIterator& operator++();
/** a-- operator */
ArrayIterator operator--(int);
/** --a operator */
ArrayIterator& operator--();
/** a + int operator */
ArrayIterator operator+(size_t idx);
/** a - int operator */
ArrayIterator operator-(size_t idx);
/** a += int operator */
ArrayIterator& operator+=(size_t idx);
/** a -= int operator */
ArrayIterator& operator-=(size_t idx);
/** != operator */
bool operator!=(const ArrayIterator& rhs);
/** == operator */
bool operator==(const ArrayIterator& rhs);
/** Set the idx if needed */
void SetIdx(size_t idx) {m_idx = idx;};
/** Get the idx if needed */
size_t GetIdx() {return m_idx;};
Array* m_parent;
size_t m_idx;
};
/**
* @class Array
* @brief simple array of SelectionRange
* @brief This class is used to simulate an iterator in the array
* @author foldink (foldink@gmail.com)
* @date 26-February-2010
*/
class Array
{
friend class ArrayIterator;
public :
/** default ctor taking the len in input */
Array( size_t len = 0 );
/** ctor with len and initial value */
Array( size_t len , const SelectionRange& val );
/** copy ctor */
Array( const Array& rhs );
/** dtor */
virtual ~Array();
/** operator= */
Array& operator=( const Array& rhs );
/** operator[] */
SelectionRange& operator[]( size_t idx )
{
if( idx >= m_size )
throw "Error access to vector range out of bounds";
return *(m_data + idx);
}
/** operator[] */
const SelectionRange& operator[]( size_t idx ) const
{
if( idx >= m_size )
throw "Error access to vector range out of bounds";
return *(m_data + idx);
}
/** Get the size */
size_t size() const {return m_size;};
/** check if the array is empty or not */
bool empty() const {return (m_size == 0);};
/** reserve */
void reserve( size_t len );
/** front */
SelectionRange& front() {
if( !m_data )
throw "Trying to access to an uninitialized array";
return (*m_data);
}
/** back */
SelectionRange& back() {
if( !m_data )
throw "Trying to access to an uninitialized array";
return *(m_data + m_size-1);
}
/** push back */
void push_back( const SelectionRange& val );
/** pop back */
void pop_back( );
/** insert before the given iterator position */
void insert( ArrayIterator it , SelectionRange& val );
/** erase */
void erase( ArrayIterator it );
/** clear */
void clear( );
/** resize */
void resize( size_t n , SelectionRange val = SelectionRange() );
/** == operator */
bool operator==(const Array& rhs);
/** begin */
ArrayIterator begin();
/** end */
ArrayIterator end();
private :
SelectionRange* m_data;
size_t m_size;
};
/**
* @brief Sorting method for a replace in Editor.cxx
* @author foldink (foldink@gmail.com)
* @date 26-February-2010
*/
extern void ArraySort( ArrayIterator start , ArrayIterator finish );
#endif

View File

@@ -11,7 +11,7 @@
#include "Platform.h" #include "Platform.h"
#include "PropSet.h" #include "CharClassify.h"
#include "AutoComplete.h" #include "AutoComplete.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE

View File

@@ -229,7 +229,7 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
offsetMain = insetX; // initial alignment assuming no arrows offsetMain = insetX; // initial alignment assuming no arrows
PaintContents(surfaceWindow, true); PaintContents(surfaceWindow, true);
#if !defined(__APPLE__) || defined(__WX__) #ifndef __APPLE__
// OSX doesn't put borders on "help tags" // OSX doesn't put borders on "help tags"
// Draw a raised border around the edges of the window // Draw a raised border around the edges of the window
surfaceWindow->MoveTo(0, rcClientSize.bottom - 1); surfaceWindow->MoveTo(0, rcClientSize.bottom - 1);
@@ -254,11 +254,9 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
const char *faceName, int size, const char *faceName, int size,
int codePage_, int characterSet, Window &wParent) { int codePage_, int characterSet, Window &wParent) {
clickPlace = 0; clickPlace = 0;
if (val) delete []val;
delete []val; val = 0;
val = new char[strlen(defn) + 1]; val = new char[strlen(defn) + 1];
if (!val)
return PRectangle();
strcpy(val, defn); strcpy(val, defn);
codePage = codePage_; codePage = codePage_;
Surface *surfaceMeasure = Surface::Allocate(); Surface *surfaceMeasure = Surface::Allocate();

View File

@@ -27,8 +27,8 @@ class CallTip {
bool useStyleCallTip; // if true, STYLE_CALLTIP should be used bool useStyleCallTip; // if true, STYLE_CALLTIP should be used
// Private so CallTip objects can not be copied // Private so CallTip objects can not be copied
CallTip(const CallTip &) {} CallTip(const CallTip &);
CallTip &operator=(const CallTip &) { return *this; } CallTip &operator=(const CallTip &);
void DrawChunk(Surface *surface, int &x, const char *s, void DrawChunk(Surface *surface, int &x, const char *s,
int posStart, int posEnd, int ytext, PRectangle rcClient, int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw); bool highlight, bool draw);

View File

@@ -21,165 +21,23 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
MarkerHandleSet::MarkerHandleSet() { LineVector::LineVector() : starts(256), perLine(0) {
root = 0;
}
MarkerHandleSet::~MarkerHandleSet() {
MarkerHandleNumber *mhn = root;
while (mhn) {
MarkerHandleNumber *mhnToFree = mhn;
mhn = mhn->next;
delete mhnToFree;
}
root = 0;
}
int MarkerHandleSet::Length() const {
int c = 0;
MarkerHandleNumber *mhn = root;
while (mhn) {
c++;
mhn = mhn->next;
}
return c;
}
int MarkerHandleSet::NumberFromHandle(int handle) const {
MarkerHandleNumber *mhn = root;
while (mhn) {
if (mhn->handle == handle) {
return mhn->number;
}
mhn = mhn->next;
}
return - 1;
}
int MarkerHandleSet::MarkValue() const {
unsigned int m = 0;
MarkerHandleNumber *mhn = root;
while (mhn) {
m |= (1 << mhn->number);
mhn = mhn->next;
}
return m;
}
bool MarkerHandleSet::Contains(int handle) const {
MarkerHandleNumber *mhn = root;
while (mhn) {
if (mhn->handle == handle) {
return true;
}
mhn = mhn->next;
}
return false;
}
bool MarkerHandleSet::InsertHandle(int handle, int markerNum) {
MarkerHandleNumber *mhn = new MarkerHandleNumber;
if (!mhn)
return false;
mhn->handle = handle;
mhn->number = markerNum;
mhn->next = root;
root = mhn;
return true;
}
void MarkerHandleSet::RemoveHandle(int handle) {
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
MarkerHandleNumber *mhn = *pmhn;
if (mhn->handle == handle) {
*pmhn = mhn->next;
delete mhn;
return;
}
pmhn = &((*pmhn)->next);
}
}
bool MarkerHandleSet::RemoveNumber(int markerNum) {
bool performedDeletion = false;
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
MarkerHandleNumber *mhn = *pmhn;
if (mhn->number == markerNum) {
*pmhn = mhn->next;
delete mhn;
performedDeletion = true;
} else {
pmhn = &((*pmhn)->next);
}
}
return performedDeletion;
}
void MarkerHandleSet::CombineWith(MarkerHandleSet *other) {
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
pmhn = &((*pmhn)->next);
}
*pmhn = other->root;
other->root = 0;
}
LineVector::LineVector() : starts(256) {
handleCurrent = 1;
Init(); Init();
} }
LineVector::~LineVector() { LineVector::~LineVector() {
starts.DeleteAll(); starts.DeleteAll();
for (int line = 0; line < markers.Length(); line++) {
delete markers[line];
markers[line] = 0;
}
markers.DeleteAll();
levels.DeleteAll();
} }
void LineVector::Init() { void LineVector::Init() {
starts.DeleteAll(); starts.DeleteAll();
for (int line = 0; line < markers.Length(); line++) { if (perLine) {
delete markers[line]; perLine->Init();
markers[line] = 0;
} }
markers.DeleteAll();
levels.DeleteAll();
} }
void LineVector::ExpandLevels(int sizeNew) { void LineVector::SetPerLine(PerLine *pl) {
levels.InsertValue(levels.Length(), sizeNew - levels.Length(), SC_FOLDLEVELBASE); perLine = pl;
}
void LineVector::ClearLevels() {
levels.DeleteAll();
}
int LineVector::SetLevel(int line, int level) {
int prev = 0;
if ((line >= 0) && (line < Lines())) {
if (!levels.Length()) {
ExpandLevels(Lines() + 1);
}
prev = levels[line];
if (prev != level) {
levels[line] = level;
}
}
return prev;
}
int LineVector::GetLevel(int line) {
if (levels.Length() && (line >= 0) && (line < Lines())) {
return levels[line];
} else {
return SC_FOLDLEVELBASE;
}
} }
void LineVector::InsertText(int line, int delta) { void LineVector::InsertText(int line, int delta) {
@@ -188,15 +46,8 @@ void LineVector::InsertText(int line, int delta) {
void LineVector::InsertLine(int line, int position) { void LineVector::InsertLine(int line, int position) {
starts.InsertPartition(line, position); starts.InsertPartition(line, position);
if (markers.Length()) { if (perLine) {
markers.Insert(line, 0); perLine->InsertLine(line);
}
if (levels.Length()) {
int level = SC_FOLDLEVELBASE;
if ((line > 0) && (line < Lines())) {
level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG;
}
levels.InsertValue(line, 1, level);
} }
} }
@@ -206,108 +57,21 @@ void LineVector::SetLineStart(int line, int position) {
void LineVector::RemoveLine(int line) { void LineVector::RemoveLine(int line) {
starts.RemovePartition(line); starts.RemovePartition(line);
// Retain the markers from the deleted line by oring them into the previous line if (perLine) {
if (markers.Length()) { perLine->RemoveLine(line);
if (line > 0) {
MergeMarkers(line - 1);
}
markers.Delete(line);
}
if (levels.Length()) {
// Move up following lines but merge header flag from this line
// to line before to avoid a temporary disappearence causing expansion.
int firstHeader = levels[line] & SC_FOLDLEVELHEADERFLAG;
levels.Delete(line);
if (line > 0)
levels[line-1] |= firstHeader;
} }
} }
int LineVector::LineFromPosition(int pos) { int LineVector::LineFromPosition(int pos) const {
return starts.PartitionFromPosition(pos); return starts.PartitionFromPosition(pos);
} }
int LineVector::MarkValue(int line) {
if (markers.Length() && markers[line])
return markers[line]->MarkValue();
else
return 0;
}
int LineVector::AddMark(int line, int markerNum) {
handleCurrent++;
if (!markers.Length()) {
// No existing markers so allocate one element per line
markers.InsertValue(0, Lines(), 0);
}
if (!markers[line]) {
// Need new structure to hold marker handle
markers[line] = new MarkerHandleSet();
if (!markers[line])
return - 1;
}
markers[line]->InsertHandle(handleCurrent, markerNum);
return handleCurrent;
}
void LineVector::MergeMarkers(int pos) {
if (markers[pos + 1] != NULL) {
if (markers[pos] == NULL)
markers[pos] = new MarkerHandleSet;
markers[pos]->CombineWith(markers[pos + 1]);
delete markers[pos + 1];
markers[pos + 1] = NULL;
}
}
void LineVector::DeleteMark(int line, int markerNum, bool all) {
if (markers.Length() && markers[line]) {
if (markerNum == -1) {
delete markers[line];
markers[line] = NULL;
} else {
bool performedDeletion = markers[line]->RemoveNumber(markerNum);
while (all && performedDeletion) {
performedDeletion = markers[line]->RemoveNumber(markerNum);
}
if (markers[line]->Length() == 0) {
delete markers[line];
markers[line] = NULL;
}
}
}
}
void LineVector::DeleteMarkFromHandle(int markerHandle) {
int line = LineFromHandle(markerHandle);
if (line >= 0) {
markers[line]->RemoveHandle(markerHandle);
if (markers[line]->Length() == 0) {
delete markers[line];
markers[line] = NULL;
}
}
}
int LineVector::LineFromHandle(int markerHandle) {
if (markers.Length()) {
for (int line = 0; line < Lines(); line++) {
if (markers[line]) {
if (markers[line]->Contains(markerHandle)) {
return line;
}
}
}
}
return -1;
}
Action::Action() { Action::Action() {
at = startAction; at = startAction;
position = 0; position = 0;
data = 0; data = 0;
lenData = 0; lenData = 0;
mayCoalesce = false;
} }
Action::~Action() { Action::~Action() {
@@ -387,8 +151,6 @@ void UndoHistory::EnsureUndoRoom() {
// Run out of undo nodes so extend the array // Run out of undo nodes so extend the array
int lenActionsNew = lenActions * 2; int lenActionsNew = lenActions * 2;
Action *actionsNew = new Action[lenActionsNew]; Action *actionsNew = new Action[lenActionsNew];
if (!actionsNew)
return;
for (int act = 0; act <= currentAction; act++) for (int act = 0; act <= currentAction; act++)
actionsNew[act].Grab(&actions[act]); actionsNew[act].Grab(&actions[act]);
delete []actions; delete []actions;
@@ -398,7 +160,7 @@ void UndoHistory::EnsureUndoRoom() {
} }
void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData, void UndoHistory::AppendAction(actionType at, int position, char *data, int lengthData,
bool &startSequence) { bool &startSequence, bool mayCoalesce) {
EnsureUndoRoom(); EnsureUndoRoom();
//Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction); //Platform::DebugPrintf("%% %d action %d %d %d\n", at, position, lengthData, currentAction);
//Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at, //Platform::DebugPrintf("^ %d action %d %d\n", actions[currentAction - 1].at,
@@ -410,25 +172,35 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
if (currentAction >= 1) { if (currentAction >= 1) {
if (0 == undoSequenceDepth) { if (0 == undoSequenceDepth) {
// Top level actions may not always be coalesced // Top level actions may not always be coalesced
Action &actPrevious = actions[currentAction - 1]; int targetAct = -1;
const Action *actPrevious = &(actions[currentAction + targetAct]);
// Container actions may forward the coalesce state of Scintilla Actions.
while ((actPrevious->at == containerAction) && actPrevious->mayCoalesce) {
targetAct--;
actPrevious = &(actions[currentAction + targetAct]);
}
// See if current action can be coalesced into previous action // See if current action can be coalesced into previous action
// Will work if both are inserts or deletes and position is same // Will work if both are inserts or deletes and position is same
if (at != actPrevious.at) { if (currentAction == savePoint) {
currentAction++;
} else if (currentAction == savePoint) {
currentAction++;
} else if ((at == insertAction) &&
(position != (actPrevious.position + actPrevious.lenData))) {
// Insertions must be immediately after to coalesce
currentAction++; currentAction++;
} else if (!actions[currentAction].mayCoalesce) { } else if (!actions[currentAction].mayCoalesce) {
// Not allowed to coalesce if this set // Not allowed to coalesce if this set
currentAction++; currentAction++;
} else if (!mayCoalesce || !actPrevious->mayCoalesce) {
currentAction++;
} else if (at == containerAction || actions[currentAction].at == containerAction) {
; // A coalescible containerAction
} else if ((at != actPrevious->at) && (actPrevious->at != startAction)) {
currentAction++;
} else if ((at == insertAction) &&
(position != (actPrevious->position + actPrevious->lenData))) {
// Insertions must be immediately after to coalesce
currentAction++;
} else if (at == removeAction) { } else if (at == removeAction) {
if ((lengthData == 1) || (lengthData == 2)){ if ((lengthData == 1) || (lengthData == 2)){
if ((position + lengthData) == actPrevious.position) { if ((position + lengthData) == actPrevious->position) {
; // Backspace -> OK ; // Backspace -> OK
} else if (position == actPrevious.position) { } else if (position == actPrevious->position) {
; // Delete -> OK ; // Delete -> OK
} else { } else {
// Removals must be at same position to coalesce // Removals must be at same position to coalesce
@@ -451,7 +223,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
currentAction++; currentAction++;
} }
startSequence = oldCurrentAction != currentAction; startSequence = oldCurrentAction != currentAction;
actions[currentAction].Create(at, position, data, lengthData); actions[currentAction].Create(at, position, data, lengthData, mayCoalesce);
currentAction++; currentAction++;
actions[currentAction].Create(startAction); actions[currentAction].Create(startAction);
maxAction = currentAction; maxAction = currentAction;
@@ -587,6 +359,10 @@ char CellBuffer::StyleAt(int position) {
return style.ValueAt(position); return style.ValueAt(position);
} }
const char *CellBuffer::BufferPointer() {
return substance.BufferPointer();
}
// The char* returned is to an allocation owned by the undo history // The char* returned is to an allocation owned by the undo history
const char *CellBuffer::InsertString(int position, const char *s, int insertLength, bool &startSequence) { const char *CellBuffer::InsertString(int position, const char *s, int insertLength, bool &startSequence) {
char *data = 0; char *data = 0;
@@ -662,6 +438,10 @@ void CellBuffer::Allocate(int newSize) {
style.ReAllocate(newSize); style.ReAllocate(newSize);
} }
void CellBuffer::SetPerLine(PerLine *pl) {
lv.SetPerLine(pl);
}
int CellBuffer::Lines() const { int CellBuffer::Lines() const {
return lv.Lines(); return lv.Lines();
} }
@@ -691,53 +471,14 @@ bool CellBuffer::IsSavePoint() {
return uh.IsSavePoint(); return uh.IsSavePoint();
} }
int CellBuffer::AddMark(int line, int markerNum) {
if ((line >= 0) && (line < Lines())) {
return lv.AddMark(line, markerNum);
}
return - 1;
}
void CellBuffer::DeleteMark(int line, int markerNum) {
if ((line >= 0) && (line < Lines())) {
lv.DeleteMark(line, markerNum, false);
}
}
void CellBuffer::DeleteMarkFromHandle(int markerHandle) {
lv.DeleteMarkFromHandle(markerHandle);
}
int CellBuffer::GetMark(int line) {
if ((line >= 0) && (line < Lines()))
return lv.MarkValue(line);
return 0;
}
void CellBuffer::DeleteAllMarks(int markerNum) {
for (int line = 0; line < Lines(); line++) {
lv.DeleteMark(line, markerNum, true);
}
}
int CellBuffer::LineFromHandle(int markerHandle) {
return lv.LineFromHandle(markerHandle);
}
// Without undo // Without undo
void CellBuffer::InsertLine(int line, int position) { void CellBuffer::InsertLine(int line, int position) {
lv.InsertLine(line, position); lv.InsertLine(line, position);
if (lineStates.Length()) {
lineStates.Insert(line, 0);
}
} }
void CellBuffer::RemoveLine(int line) { void CellBuffer::RemoveLine(int line) {
lv.RemoveLine(line); lv.RemoveLine(line);
if (lineStates.Length()) {
lineStates.Delete(line);
}
} }
void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) { void CellBuffer::BasicInsertString(int position, const char *s, int insertLength) {
@@ -857,6 +598,11 @@ void CellBuffer::EndUndoAction() {
uh.EndUndoAction(); uh.EndUndoAction();
} }
void CellBuffer::AddUndoAction(int token, bool mayCoalesce) {
bool startSequence;
uh.AppendAction(containerAction, token, 0, 0, startSequence, mayCoalesce);
}
void CellBuffer::DeleteUndoHistory() { void CellBuffer::DeleteUndoHistory() {
uh.DeleteUndoHistory(); uh.DeleteUndoHistory();
} }
@@ -905,30 +651,3 @@ void CellBuffer::PerformRedoStep() {
uh.CompletedRedoStep(); uh.CompletedRedoStep();
} }
int CellBuffer::SetLineState(int line, int state) {
lineStates.EnsureLength(line + 1);
int stateOld = lineStates[line];
lineStates[line] = state;
return stateOld;
}
int CellBuffer::GetLineState(int line) {
lineStates.EnsureLength(line + 1);
return lineStates[line];
}
int CellBuffer::GetMaxLineState() {
return lineStates.Length();
}
int CellBuffer::SetLevel(int line, int level) {
return lv.SetLevel(line, level);
}
int CellBuffer::GetLevel(int line) {
return lv.GetLevel(line);
}
void CellBuffer::ClearLevels() {
lv.ClearLevels();
}

View File

@@ -12,33 +12,13 @@
namespace Scintilla { namespace Scintilla {
#endif #endif
/** // Interface to per-line data that wants to see each line insertion and deletion
* This holds the marker identifier and the marker type to display. class PerLine {
* MarkerHandleNumbers are members of lists.
*/
struct MarkerHandleNumber {
int handle;
int number;
MarkerHandleNumber *next;
};
/**
* A marker handle set contains any number of MarkerHandleNumbers.
*/
class MarkerHandleSet {
MarkerHandleNumber *root;
public: public:
MarkerHandleSet(); virtual ~PerLine() {}
~MarkerHandleSet(); virtual void Init()=0;
int Length() const; virtual void InsertLine(int)=0;
int NumberFromHandle(int handle) const; virtual void RemoveLine(int)=0;
int MarkValue() const; ///< Bit set of marker numbers.
bool Contains(int handle) const;
bool InsertHandle(int handle, int markerNum);
void RemoveHandle(int handle);
bool RemoveNumber(int markerNum);
void CombineWith(MarkerHandleSet *other);
}; };
/** /**
@@ -47,21 +27,14 @@ public:
class LineVector { class LineVector {
Partitioning starts; Partitioning starts;
SplitVector<MarkerHandleSet *> markers; PerLine *perLine;
SplitVector<int> levels;
/// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
int handleCurrent;
public: public:
LineVector(); LineVector();
~LineVector(); ~LineVector();
void Init(); void Init();
void SetPerLine(PerLine *pl);
void ExpandLevels(int sizeNew=-1);
void ClearLevels();
int SetLevel(int line, int level);
int GetLevel(int line);
void InsertText(int line, int delta); void InsertText(int line, int delta);
void InsertLine(int line, int position); void InsertLine(int line, int position);
@@ -70,7 +43,7 @@ public:
int Lines() const { int Lines() const {
return starts.Partitions(); return starts.Partitions();
} }
int LineFromPosition(int pos); int LineFromPosition(int pos) const;
int LineStart(int line) const { int LineStart(int line) const {
return starts.PositionFromPartition(line); return starts.PositionFromPartition(line);
} }
@@ -81,9 +54,18 @@ public:
void DeleteMark(int line, int markerNum, bool all); void DeleteMark(int line, int markerNum, bool all);
void DeleteMarkFromHandle(int markerHandle); void DeleteMarkFromHandle(int markerHandle);
int LineFromHandle(int markerHandle); int LineFromHandle(int markerHandle);
void ClearLevels();
int SetLevel(int line, int level);
int GetLevel(int line);
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState();
}; };
enum actionType { insertAction, removeAction, startAction }; enum actionType { insertAction, removeAction, startAction, containerAction };
/** /**
* Actions are used to store all the information required to perform one undo/redo step. * Actions are used to store all the information required to perform one undo/redo step.
@@ -120,7 +102,7 @@ public:
UndoHistory(); UndoHistory();
~UndoHistory(); ~UndoHistory();
void AppendAction(actionType at, int position, char *data, int length, bool &startSequence); void AppendAction(actionType at, int position, char *data, int length, bool &startSequence, bool mayCoalesce=true);
void BeginUndoAction(); void BeginUndoAction();
void EndUndoAction(); void EndUndoAction();
@@ -160,8 +142,6 @@ private:
LineVector lv; LineVector lv;
SplitVector<int> lineStates;
public: public:
CellBuffer(); CellBuffer();
@@ -171,12 +151,14 @@ public:
char CharAt(int position) const; char CharAt(int position) const;
void GetCharRange(char *buffer, int position, int lengthRetrieve); void GetCharRange(char *buffer, int position, int lengthRetrieve);
char StyleAt(int position); char StyleAt(int position);
const char *BufferPointer();
int Length() const; int Length() const;
void Allocate(int newSize); void Allocate(int newSize);
void SetPerLine(PerLine *pl);
int Lines() const; int Lines() const;
int LineStart(int line) const; int LineStart(int line) const;
int LineFromPosition(int pos) { return lv.LineFromPosition(pos); } int LineFromPosition(int pos) const { return lv.LineFromPosition(pos); }
void InsertLine(int line, int position); void InsertLine(int line, int position);
void RemoveLine(int line); void RemoveLine(int line);
const char *InsertString(int position, const char *s, int insertLength, bool &startSequence); const char *InsertString(int position, const char *s, int insertLength, bool &startSequence);
@@ -196,14 +178,6 @@ public:
void SetSavePoint(); void SetSavePoint();
bool IsSavePoint(); bool IsSavePoint();
/// Line marker functions
int AddMark(int line, int markerNum);
void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle);
int GetMark(int line);
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle);
/// Actions without undo /// Actions without undo
void BasicInsertString(int position, const char *s, int insertLength); void BasicInsertString(int position, const char *s, int insertLength);
void BasicDeleteChars(int position, int deleteLength); void BasicDeleteChars(int position, int deleteLength);
@@ -212,6 +186,7 @@ public:
bool IsCollectingUndo(); bool IsCollectingUndo();
void BeginUndoAction(); void BeginUndoAction();
void EndUndoAction(); void EndUndoAction();
void AddUndoAction(int token, bool mayCoalesce);
void DeleteUndoHistory(); void DeleteUndoHistory();
/// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is /// To perform an undo, StartUndo is called to retrieve the number of steps, then UndoStep is
@@ -224,14 +199,6 @@ public:
int StartRedo(); int StartRedo();
const Action &GetRedoStep() const; const Action &GetRedoStep() const;
void PerformRedoStep(); void PerformRedoStep();
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState();
int SetLevel(int line, int level);
int GetLevel(int line);
void ClearLevels();
}; };
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE

View File

@@ -5,6 +5,7 @@
// Copyright 2006 by Neil Hodgson <neilh@scintilla.org> // Copyright 2006 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <ctype.h> #include <ctype.h>
#include "CharClassify.h" #include "CharClassify.h"
@@ -41,3 +42,37 @@ void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) {
} }
} }
} }
int CompareCaseInsensitive(const char *a, const char *b) {
while (*a && *b) {
if (*a != *b) {
char upperA = MakeUpperCase(*a);
char upperB = MakeUpperCase(*b);
if (upperA != upperB)
return upperA - upperB;
}
a++;
b++;
}
// Either *a or *b is nul
return *a - *b;
}
int CompareNCaseInsensitive(const char *a, const char *b, size_t len) {
while (*a && *b && len) {
if (*a != *b) {
char upperA = MakeUpperCase(*a);
char upperB = MakeUpperCase(*b);
if (upperA != upperB)
return upperA - upperB;
}
a++;
b++;
len--;
}
if (len == 0)
return 0;
else
// Either *a or *b is nul
return *a - *b;
}

View File

@@ -2,7 +2,7 @@
/** @file CharClassify.h /** @file CharClassify.h
** Character classifications used by Document and RESearch. ** Character classifications used by Document and RESearch.
**/ **/
// Copyright 2006 by Neil Hodgson <neilh@scintilla.org> // Copyright 2006-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#ifndef CHARCLASSIFY_H #ifndef CHARCLASSIFY_H
@@ -22,4 +22,16 @@ private:
enum { maxChar=256 }; enum { maxChar=256 };
unsigned char charClass[maxChar]; // not type cc to save space unsigned char charClass[maxChar]; // not type cc to save space
}; };
// These functions are implemented because each platform calls them something different.
int CompareCaseInsensitive(const char *a, const char *b);
int CompareNCaseInsensitive(const char *a, const char *b, size_t len);
inline char MakeUpperCase(char ch) {
if (ch < 'a' || ch > 'z')
return ch;
else
return static_cast<char>(ch - 'a' + 'A');
}
#endif #endif

View File

@@ -17,6 +17,7 @@
#include "Partitioning.h" #include "Partitioning.h"
#include "RunStyles.h" #include "RunStyles.h"
#include "CellBuffer.h" #include "CellBuffer.h"
#include "PerLine.h"
#include "CharClassify.h" #include "CharClassify.h"
#include "Decoration.h" #include "Decoration.h"
#include "Document.h" #include "Document.h"
@@ -73,8 +74,15 @@ Document::Document() {
lenWatchers = 0; lenWatchers = 0;
matchesValid = false; matchesValid = false;
pre = 0; regex = 0;
substituted = 0;
perLineData[ldMarkers] = new LineMarkers();
perLineData[ldLevels] = new LineLevels();
perLineData[ldState] = new LineState();
perLineData[ldMargin] = new LineAnnotation();
perLineData[ldAnnotation] = new LineAnnotation();
cb.SetPerLine(this);
} }
Document::~Document() { Document::~Document() {
@@ -82,12 +90,35 @@ Document::~Document() {
watchers[i].watcher->NotifyDeleted(this, watchers[i].userData); watchers[i].watcher->NotifyDeleted(this, watchers[i].userData);
} }
delete []watchers; delete []watchers;
for (int j=0; j<ldSize; j++) {
delete perLineData[j];
perLineData[j] = 0;
}
watchers = 0; watchers = 0;
lenWatchers = 0; lenWatchers = 0;
delete pre; delete regex;
pre = 0; regex = 0;
delete []substituted; }
substituted = 0;
void Document::Init() {
for (int j=0; j<ldSize; j++) {
if (perLineData[j])
perLineData[j]->Init();
}
}
void Document::InsertLine(int line) {
for (int j=0; j<ldSize; j++) {
if (perLineData[j])
perLineData[j]->InsertLine(line);
}
}
void Document::RemoveLine(int line) {
for (int j=0; j<ldSize; j++) {
if (perLineData[j])
perLineData[j]->RemoveLine(line);
}
} }
// Increase reference count and return its previous value. // Increase reference count and return its previous value.
@@ -109,42 +140,58 @@ void Document::SetSavePoint() {
NotifySavePoint(true); NotifySavePoint(true);
} }
int Document::GetMark(int line) {
return static_cast<LineMarkers*>(perLineData[ldMarkers])->MarkValue(line);
}
int Document::AddMark(int line, int markerNum) { int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum); if (line <= LinesTotal()) {
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); int prev = static_cast<LineMarkers*>(perLineData[ldMarkers])->
NotifyModified(mh); AddMark(line, markerNum, LinesTotal());
return prev; DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
NotifyModified(mh);
return prev;
} else {
return 0;
}
} }
void Document::AddMarkSet(int line, int valueSet) { void Document::AddMarkSet(int line, int valueSet) {
unsigned int m = valueSet; unsigned int m = valueSet;
for (int i = 0; m; i++, m >>= 1) for (int i = 0; m; i++, m >>= 1)
if (m & 1) if (m & 1)
cb.AddMark(line, i); static_cast<LineMarkers*>(perLineData[ldMarkers])->
AddMark(line, i, LinesTotal());
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
NotifyModified(mh); NotifyModified(mh);
} }
void Document::DeleteMark(int line, int markerNum) { void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum); static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMark(line, markerNum, false);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line); DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
NotifyModified(mh); NotifyModified(mh);
} }
void Document::DeleteMarkFromHandle(int markerHandle) { void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle); static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMarkFromHandle(markerHandle);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1; mh.line = -1;
NotifyModified(mh); NotifyModified(mh);
} }
void Document::DeleteAllMarks(int markerNum) { void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum); for (int line = 0; line < LinesTotal(); line++) {
static_cast<LineMarkers*>(perLineData[ldMarkers])->DeleteMark(line, markerNum, true);
}
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0); DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1; mh.line = -1;
NotifyModified(mh); NotifyModified(mh);
} }
int Document::LineFromHandle(int markerHandle) {
return static_cast<LineMarkers*>(perLineData[ldMarkers])->LineFromHandle(markerHandle);
}
int Document::LineStart(int line) const { int Document::LineStart(int line) const {
return cb.LineStart(line); return cb.LineStart(line);
} }
@@ -162,18 +209,22 @@ int Document::LineEnd(int line) const {
} }
} }
int Document::LineFromPosition(int pos) { int Document::LineFromPosition(int pos) const {
return cb.LineFromPosition(pos); return cb.LineFromPosition(pos);
} }
int Document::LineEndPosition(int position) { int Document::LineEndPosition(int position) const {
return LineEnd(LineFromPosition(position)); return LineEnd(LineFromPosition(position));
} }
int Document::VCHomePosition(int position) { bool Document::IsLineEndPosition(int position) const {
return LineEnd(LineFromPosition(position)) == position;
}
int Document::VCHomePosition(int position) const {
int line = LineFromPosition(position); int line = LineFromPosition(position);
int startPosition = LineStart(line); int startPosition = LineStart(line);
int endLine = LineStart(line + 1) - 1; int endLine = LineEnd(line);
int startText = startPosition; int startText = startPosition;
while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) ) while (startText < endLine && (cb.CharAt(startText) == ' ' || cb.CharAt(startText) == '\t' ) )
startText++; startText++;
@@ -184,7 +235,7 @@ int Document::VCHomePosition(int position) {
} }
int Document::SetLevel(int line, int level) { int Document::SetLevel(int line, int level) {
int prev = cb.SetLevel(line, level); int prev = static_cast<LineLevels*>(perLineData[ldLevels])->SetLevel(line, level, LinesTotal());
if (prev != level) { if (prev != level) {
DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER, DocModification mh(SC_MOD_CHANGEFOLD | SC_MOD_CHANGEMARKER,
LineStart(line), 0, 0, 0, line); LineStart(line), 0, 0, 0, line);
@@ -195,6 +246,14 @@ int Document::SetLevel(int line, int level) {
return prev; return prev;
} }
int Document::GetLevel(int line) {
return static_cast<LineLevels*>(perLineData[ldLevels])->GetLevel(line);
}
void Document::ClearLevels() {
static_cast<LineLevels*>(perLineData[ldLevels])->ClearLevels();
}
static bool IsSubordinate(int levelStart, int levelTry) { static bool IsSubordinate(int levelStart, int levelTry) {
if (levelTry & SC_FOLDLEVELWHITEFLAG) if (levelTry & SC_FOLDLEVELWHITEFLAG)
return true; return true;
@@ -506,21 +565,27 @@ int Document::Undo() {
if (action.at == removeAction) { if (action.at == removeAction) {
NotifyModified(DocModification( NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action)); SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
} else if (action.at == containerAction) {
DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_UNDO);
dm.token = action.position;
NotifyModified(dm);
} else { } else {
NotifyModified(DocModification( NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action)); SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
} }
cb.PerformUndoStep(); cb.PerformUndoStep();
int cellPosition = action.position; int cellPosition = action.position;
ModifiedAt(cellPosition); if (action.at != containerAction) {
newPos = cellPosition; ModifiedAt(cellPosition);
newPos = cellPosition;
}
int modFlags = SC_PERFORMED_UNDO; int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification // With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) { if (action.at == removeAction) {
newPos += action.lenData; newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT; modFlags |= SC_MOD_INSERTTEXT;
} else { } else if (action.at == insertAction) {
modFlags |= SC_MOD_DELETETEXT; modFlags |= SC_MOD_DELETETEXT;
} }
if (steps > 1) if (steps > 1)
@@ -561,19 +626,25 @@ int Document::Redo() {
if (action.at == insertAction) { if (action.at == insertAction) {
NotifyModified(DocModification( NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action)); SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
} else if (action.at == containerAction) {
DocModification dm(SC_MOD_CONTAINER | SC_PERFORMED_REDO);
dm.token = action.position;
NotifyModified(dm);
} else { } else {
NotifyModified(DocModification( NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action)); SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
} }
cb.PerformRedoStep(); cb.PerformRedoStep();
ModifiedAt(action.position); if (action.at != containerAction) {
newPos = action.position; ModifiedAt(action.position);
newPos = action.position;
}
int modFlags = SC_PERFORMED_REDO; int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) { if (action.at == insertAction) {
newPos += action.lenData; newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT; modFlags |= SC_MOD_INSERTTEXT;
} else { } else if (action.at == removeAction) {
modFlags |= SC_MOD_DELETETEXT; modFlags |= SC_MOD_DELETETEXT;
} }
if (steps > 1) if (steps > 1)
@@ -690,10 +761,9 @@ void Document::SetLineIndentation(int line, int indent) {
CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs); CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs);
int thisLineStart = LineStart(line); int thisLineStart = LineStart(line);
int indentPos = GetLineIndentPosition(line); int indentPos = GetLineIndentPosition(line);
BeginUndoAction(); UndoGroup ug(this);
DeleteChars(thisLineStart, indentPos - thisLineStart); DeleteChars(thisLineStart, indentPos - thisLineStart);
InsertCString(thisLineStart, linebuf); InsertCString(thisLineStart, linebuf);
EndUndoAction();
} }
} }
@@ -734,8 +804,8 @@ int Document::GetColumn(int pos) {
int Document::FindColumn(int line, int column) { int Document::FindColumn(int line, int column) {
int position = LineStart(line); int position = LineStart(line);
int columnCurrent = 0;
if ((line >= 0) && (line < LinesTotal())) { if ((line >= 0) && (line < LinesTotal())) {
int columnCurrent = 0;
while ((columnCurrent < column) && (position < Length())) { while ((columnCurrent < column) && (position < Length())) {
char ch = cb.CharAt(position); char ch = cb.CharAt(position);
if (ch == '\t') { if (ch == '\t') {
@@ -800,7 +870,7 @@ char *Document::TransformLineEnds(int *pLenOut, const char *s, size_t len, int e
} }
void Document::ConvertLineEnds(int eolModeSet) { void Document::ConvertLineEnds(int eolModeSet) {
BeginUndoAction(); UndoGroup ug(this);
for (int pos = 0; pos < Length(); pos++) { for (int pos = 0; pos < Length(); pos++) {
if (cb.CharAt(pos) == '\r') { if (cb.CharAt(pos) == '\r') {
@@ -835,7 +905,6 @@ void Document::ConvertLineEnds(int eolModeSet) {
} }
} }
EndUndoAction();
} }
bool Document::IsWhiteLine(int line) const { bool Document::IsWhiteLine(int line) const {
@@ -998,16 +1067,6 @@ bool Document::IsWordAt(int start, int end) {
return IsWordStartAt(start) && IsWordEndAt(end); return IsWordStartAt(start) && IsWordEndAt(end);
} }
// The comparison and case changing functions here assume ASCII
// or extended ASCII such as the normal Windows code page.
static inline char MakeUpperCase(char ch) {
if (ch < 'a' || ch > 'z')
return ch;
else
return static_cast<char>(ch - 'a' + 'A');
}
static inline char MakeLowerCase(char ch) { static inline char MakeLowerCase(char ch) {
if (ch < 'A' || ch > 'Z') if (ch < 'A' || ch > 'Z')
return ch; return ch;
@@ -1015,123 +1074,18 @@ static inline char MakeLowerCase(char ch) {
return static_cast<char>(ch - 'A' + 'a'); return static_cast<char>(ch - 'A' + 'a');
} }
// Define a way for the Regular Expression code to access the document
class DocumentIndexer : public CharacterIndexer {
Document *pdoc;
int end;
public:
DocumentIndexer(Document *pdoc_, int end_) :
pdoc(pdoc_), end(end_) {
}
virtual ~DocumentIndexer() {
}
virtual char CharAt(int index) {
if (index < 0 || index >= end)
return 0;
else
return pdoc->CharAt(index);
}
};
/** /**
* Find text in document, supporting both forward and backward * Find text in document, supporting both forward and backward
* searches (just pass minPos > maxPos to do a backward search) * searches (just pass minPos > maxPos to do a backward search)
* Has not been tested with backwards DBCS searches yet. * Has not been tested with backwards DBCS searches yet.
*/ */
long Document::FindText(int minPos, int maxPos, const char *s, long Document::FindText(int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, bool caseSensitive, bool word, bool wordStart, bool regExp, int flags,
int *length) { int *length) {
if (regExp) { if (regExp) {
if (!pre) if (!regex)
pre = new RESearch(&charClass); regex = CreateRegexSearch(&charClass);
if (!pre) return regex->FindText(this, minPos, maxPos, s, caseSensitive, word, wordStart, flags, length);
return -1;
int increment = (minPos <= maxPos) ? 1 : -1;
int startPos = minPos;
int endPos = maxPos;
// Range endpoints should not be inside DBCS characters, but just in case, move them.
startPos = MovePositionOutsideChar(startPos, 1, false);
endPos = MovePositionOutsideChar(endPos, 1, false);
const char *errmsg = pre->Compile(s, *length, caseSensitive, posix);
if (errmsg) {
return -1;
}
// Find a variable in a property file: \$(\([A-Za-z0-9_.]+\))
// Replace first '.' with '-' in each property file variable reference:
// Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
// Replace: $(\1-\2)
int lineRangeStart = LineFromPosition(startPos);
int lineRangeEnd = LineFromPosition(endPos);
if ((increment == 1) &&
(startPos >= LineEnd(lineRangeStart)) &&
(lineRangeStart < lineRangeEnd)) {
// the start position is at end of line or between line end characters.
lineRangeStart++;
startPos = LineStart(lineRangeStart);
}
int pos = -1;
int lenRet = 0;
char searchEnd = s[*length - 1];
int lineRangeBreak = lineRangeEnd + increment;
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = LineStart(line);
int endOfLine = LineEnd(line);
if (increment == 1) {
if (line == lineRangeStart) {
if ((startPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if start position after start of line
startOfLine = startPos;
}
if (line == lineRangeEnd) {
if ((endPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if end position before end of line
endOfLine = endPos;
}
} else {
if (line == lineRangeEnd) {
if ((endPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if end position after start of line
startOfLine = endPos;
}
if (line == lineRangeStart) {
if ((startPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if start position before end of line
endOfLine = startPos;
}
}
DocumentIndexer di(this, endOfLine);
int success = pre->Execute(di, startOfLine, endOfLine);
if (success) {
pos = pre->bopat[0];
lenRet = pre->eopat[0] - pre->bopat[0];
if (increment == -1) {
// Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop
while (success && (pre->eopat[0] <= endOfLine) && (repetitions--)) {
success = pre->Execute(di, pos+1, endOfLine);
if (success) {
if (pre->eopat[0] <= minPos) {
pos = pre->bopat[0];
lenRet = pre->eopat[0] - pre->bopat[0];
} else {
success = 0;
}
}
}
}
break;
}
}
*length = lenRet;
return pos;
} else { } else {
bool forward = minPos <= maxPos; bool forward = minPos <= maxPos;
@@ -1167,8 +1121,8 @@ long Document::FindText(int minPos, int maxPos, const char *s,
} }
if (found) { if (found) {
if ((!word && !wordStart) || if ((!word && !wordStart) ||
word && IsWordAt(pos, pos + lengthFind) || (word && IsWordAt(pos, pos + lengthFind)) ||
wordStart && IsWordStartAt(pos)) (wordStart && IsWordStartAt(pos)))
return pos; return pos;
} }
} }
@@ -1183,8 +1137,8 @@ long Document::FindText(int minPos, int maxPos, const char *s,
} }
if (found) { if (found) {
if ((!word && !wordStart) || if ((!word && !wordStart) ||
word && IsWordAt(pos, pos + lengthFind) || (word && IsWordAt(pos, pos + lengthFind)) ||
wordStart && IsWordStartAt(pos)) (wordStart && IsWordStartAt(pos)))
return pos; return pos;
} }
} }
@@ -1201,86 +1155,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
} }
const char *Document::SubstituteByPosition(const char *text, int *length) { const char *Document::SubstituteByPosition(const char *text, int *length) {
if (!pre) return regex->SubstituteByPosition(this, text, length);
return 0;
delete []substituted;
substituted = 0;
DocumentIndexer di(this, Length());
if (!pre->GrabMatches(di))
return 0;
unsigned int lenResult = 0;
for (int i = 0; i < *length; i++) {
if (text[i] == '\\') {
if (text[i + 1] >= '1' && text[i + 1] <= '9') {
unsigned int patNum = text[i + 1] - '0';
lenResult += pre->eopat[patNum] - pre->bopat[patNum];
i++;
} else {
switch (text[i + 1]) {
case 'a':
case 'b':
case 'f':
case 'n':
case 'r':
case 't':
case 'v':
i++;
}
lenResult++;
}
} else {
lenResult++;
}
}
substituted = new char[lenResult + 1];
if (!substituted)
return 0;
char *o = substituted;
for (int j = 0; j < *length; j++) {
if (text[j] == '\\') {
if (text[j + 1] >= '1' && text[j + 1] <= '9') {
unsigned int patNum = text[j + 1] - '0';
unsigned int len = pre->eopat[patNum] - pre->bopat[patNum];
if (pre->pat[patNum]) // Will be null if try for a match that did not occur
memcpy(o, pre->pat[patNum], len);
o += len;
j++;
} else {
j++;
switch (text[j]) {
case 'a':
*o++ = '\a';
break;
case 'b':
*o++ = '\b';
break;
case 'f':
*o++ = '\f';
break;
case 'n':
*o++ = '\n';
break;
case 'r':
*o++ = '\r';
break;
case 't':
*o++ = '\t';
break;
case 'v':
*o++ = '\v';
break;
default:
*o++ = '\\';
j--;
}
}
} else {
*o++ = text[j];
}
}
*o = '\0';
*length = lenResult;
return substituted;
} }
int Document::LinesTotal() const { int Document::LinesTotal() const {
@@ -1342,7 +1217,7 @@ bool Document::SetStyleFor(int length, char style) {
} }
} }
bool Document::SetStyles(int length, char *styles) { bool Document::SetStyles(int length, const char *styles) {
if (enteredStyling != 0) { if (enteredStyling != 0) {
return false; return false;
} else { } else {
@@ -1380,8 +1255,8 @@ void Document::EnsureStyledTo(int pos) {
} }
} }
int Document::SetLineState(int line, int state) { int Document::SetLineState(int line, int state) {
int statePrevious = cb.SetLineState(line, state); int statePrevious = static_cast<LineState*>(perLineData[ldState])->SetLineState(line, state);
if (state != statePrevious) { if (state != statePrevious) {
DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line); DocModification mh(SC_MOD_CHANGELINESTATE, 0, 0, 0, 0, line);
NotifyModified(mh); NotifyModified(mh);
@@ -1389,6 +1264,89 @@ int Document::SetLineState(int line, int state) {
return statePrevious; return statePrevious;
} }
int Document::GetLineState(int line) {
return static_cast<LineState*>(perLineData[ldState])->GetLineState(line);
}
int Document::GetMaxLineState() {
return static_cast<LineState*>(perLineData[ldState])->GetMaxLineState();
}
StyledText Document::MarginStyledText(int line) {
LineAnnotation *pla = static_cast<LineAnnotation*>(perLineData[ldMargin]);
return StyledText(pla->Length(line), pla->Text(line),
pla->MultipleStyles(line), pla->Style(line), pla->Styles(line));
}
void Document::MarginSetText(int line, const char *text) {
static_cast<LineAnnotation*>(perLineData[ldMargin])->SetText(line, text);
DocModification mh(SC_MOD_CHANGEMARGIN, LineStart(line), 0, 0, 0, line);
NotifyModified(mh);
}
void Document::MarginSetStyle(int line, int style) {
static_cast<LineAnnotation*>(perLineData[ldMargin])->SetStyle(line, style);
}
void Document::MarginSetStyles(int line, const unsigned char *styles) {
static_cast<LineAnnotation*>(perLineData[ldMargin])->SetStyles(line, styles);
}
int Document::MarginLength(int line) const {
return static_cast<LineAnnotation*>(perLineData[ldMargin])->Length(line);
}
void Document::MarginClearAll() {
int maxEditorLine = LinesTotal();
for (int l=0;l<maxEditorLine;l++)
MarginSetText(l, 0);
// Free remaining data
static_cast<LineAnnotation*>(perLineData[ldMargin])->ClearAll();
}
bool Document::AnnotationAny() const {
return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->AnySet();
}
StyledText Document::AnnotationStyledText(int line) {
LineAnnotation *pla = static_cast<LineAnnotation*>(perLineData[ldAnnotation]);
return StyledText(pla->Length(line), pla->Text(line),
pla->MultipleStyles(line), pla->Style(line), pla->Styles(line));
}
void Document::AnnotationSetText(int line, const char *text) {
const int linesBefore = AnnotationLines(line);
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetText(line, text);
const int linesAfter = AnnotationLines(line);
DocModification mh(SC_MOD_CHANGEANNOTATION, LineStart(line), 0, 0, 0, line);
mh.annotationLinesAdded = linesAfter - linesBefore;
NotifyModified(mh);
}
void Document::AnnotationSetStyle(int line, int style) {
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetStyle(line, style);
}
void Document::AnnotationSetStyles(int line, const unsigned char *styles) {
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->SetStyles(line, styles);
}
int Document::AnnotationLength(int line) const {
return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->Length(line);
}
int Document::AnnotationLines(int line) const {
return static_cast<LineAnnotation*>(perLineData[ldAnnotation])->Lines(line);
}
void Document::AnnotationClearAll() {
int maxEditorLine = LinesTotal();
for (int l=0;l<maxEditorLine;l++)
AnnotationSetText(l, 0);
// Free remaining data
static_cast<LineAnnotation*>(perLineData[ldAnnotation])->ClearAll();
}
void Document::IncrementStyleClock() { void Document::IncrementStyleClock() {
styleClock = (styleClock + 1) % 0x100000; styleClock = (styleClock + 1) % 0x100000;
} }
@@ -1408,8 +1366,6 @@ bool Document::AddWatcher(DocWatcher *watcher, void *userData) {
return false; return false;
} }
WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers + 1]; WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers + 1];
if (!pwNew)
return false;
for (int j = 0; j < lenWatchers; j++) for (int j = 0; j < lenWatchers; j++)
pwNew[j] = watchers[j]; pwNew[j] = watchers[j];
pwNew[lenWatchers].watcher = watcher; pwNew[lenWatchers].watcher = watcher;
@@ -1430,8 +1386,6 @@ bool Document::RemoveWatcher(DocWatcher *watcher, void *userData) {
lenWatchers = 0; lenWatchers = 0;
} else { } else {
WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers]; WatcherWithUserData *pwNew = new WatcherWithUserData[lenWatchers];
if (!pwNew)
return false;
for (int j = 0; j < lenWatchers - 1; j++) { for (int j = 0; j < lenWatchers - 1; j++) {
pwNew[j] = (j < i) ? watchers[j] : watchers[j + 1]; pwNew[j] = (j < i) ? watchers[j] : watchers[j + 1];
} }
@@ -1630,3 +1584,230 @@ int Document::BraceMatch(int position, int /*maxReStyle*/) {
} }
return - 1; return - 1;
} }
/**
* Implementation of RegexSearchBase for the default built-in regular expression engine
*/
class BuiltinRegex : public RegexSearchBase {
public:
BuiltinRegex(CharClassify *charClassTable) : search(charClassTable), substituted(NULL) {}
virtual ~BuiltinRegex() {
delete substituted;
}
virtual long FindText(Document *doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, int flags,
int *length);
virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length);
private:
RESearch search;
char *substituted;
};
// Define a way for the Regular Expression code to access the document
class DocumentIndexer : public CharacterIndexer {
Document *pdoc;
int end;
public:
DocumentIndexer(Document *pdoc_, int end_) :
pdoc(pdoc_), end(end_) {
}
virtual ~DocumentIndexer() {
}
virtual char CharAt(int index) {
if (index < 0 || index >= end)
return 0;
else
return pdoc->CharAt(index);
}
};
long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool, bool, int flags,
int *length) {
bool posix = (flags & SCFIND_POSIX) != 0;
int increment = (minPos <= maxPos) ? 1 : -1;
int startPos = minPos;
int endPos = maxPos;
// Range endpoints should not be inside DBCS characters, but just in case, move them.
startPos = doc->MovePositionOutsideChar(startPos, 1, false);
endPos = doc->MovePositionOutsideChar(endPos, 1, false);
const char *errmsg = search.Compile(s, *length, caseSensitive, posix);
if (errmsg) {
return -1;
}
// Find a variable in a property file: \$(\([A-Za-z0-9_.]+\))
// Replace first '.' with '-' in each property file variable reference:
// Search: \$(\([A-Za-z0-9_-]+\)\.\([A-Za-z0-9_.]+\))
// Replace: $(\1-\2)
int lineRangeStart = doc->LineFromPosition(startPos);
int lineRangeEnd = doc->LineFromPosition(endPos);
if ((increment == 1) &&
(startPos >= doc->LineEnd(lineRangeStart)) &&
(lineRangeStart < lineRangeEnd)) {
// the start position is at end of line or between line end characters.
lineRangeStart++;
startPos = doc->LineStart(lineRangeStart);
}
int pos = -1;
int lenRet = 0;
char searchEnd = s[*length - 1];
int lineRangeBreak = lineRangeEnd + increment;
for (int line = lineRangeStart; line != lineRangeBreak; line += increment) {
int startOfLine = doc->LineStart(line);
int endOfLine = doc->LineEnd(line);
if (increment == 1) {
if (line == lineRangeStart) {
if ((startPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if start position after start of line
startOfLine = startPos;
}
if (line == lineRangeEnd) {
if ((endPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if end position before end of line
endOfLine = endPos;
}
} else {
if (line == lineRangeEnd) {
if ((endPos != startOfLine) && (s[0] == '^'))
continue; // Can't match start of line if end position after start of line
startOfLine = endPos;
}
if (line == lineRangeStart) {
if ((startPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if start position before end of line
endOfLine = startPos;
}
}
DocumentIndexer di(doc, endOfLine);
int success = search.Execute(di, startOfLine, endOfLine);
if (success) {
pos = search.bopat[0];
lenRet = search.eopat[0] - search.bopat[0];
if (increment == -1) {
// Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop
while (success && (search.eopat[0] <= endOfLine) && (repetitions--)) {
success = search.Execute(di, pos+1, endOfLine);
if (success) {
if (search.eopat[0] <= minPos) {
pos = search.bopat[0];
lenRet = search.eopat[0] - search.bopat[0];
} else {
success = 0;
}
}
}
}
break;
}
}
*length = lenRet;
return pos;
}
const char *BuiltinRegex::SubstituteByPosition(Document* doc, const char *text, int *length) {
delete []substituted;
substituted = 0;
DocumentIndexer di(doc, doc->Length());
if (!search.GrabMatches(di))
return 0;
unsigned int lenResult = 0;
for (int i = 0; i < *length; i++) {
if (text[i] == '\\') {
if (text[i + 1] >= '1' && text[i + 1] <= '9') {
unsigned int patNum = text[i + 1] - '0';
lenResult += search.eopat[patNum] - search.bopat[patNum];
i++;
} else {
switch (text[i + 1]) {
case 'a':
case 'b':
case 'f':
case 'n':
case 'r':
case 't':
case 'v':
i++;
}
lenResult++;
}
} else {
lenResult++;
}
}
substituted = new char[lenResult + 1];
char *o = substituted;
for (int j = 0; j < *length; j++) {
if (text[j] == '\\') {
if (text[j + 1] >= '1' && text[j + 1] <= '9') {
unsigned int patNum = text[j + 1] - '0';
unsigned int len = search.eopat[patNum] - search.bopat[patNum];
if (search.pat[patNum]) // Will be null if try for a match that did not occur
memcpy(o, search.pat[patNum], len);
o += len;
j++;
} else {
j++;
switch (text[j]) {
case 'a':
*o++ = '\a';
break;
case 'b':
*o++ = '\b';
break;
case 'f':
*o++ = '\f';
break;
case 'n':
*o++ = '\n';
break;
case 'r':
*o++ = '\r';
break;
case 't':
*o++ = '\t';
break;
case 'v':
*o++ = '\v';
break;
default:
*o++ = '\\';
j--;
}
}
} else {
*o++ = text[j];
}
}
*o = '\0';
*length = lenResult;
return substituted;
}
#ifndef SCI_OWNREGEX
#ifdef SCI_NAMESPACE
RegexSearchBase *Scintilla::CreateRegexSearch(CharClassify *charClassTable) {
return new BuiltinRegex(charClassTable);
}
#else
RegexSearchBase *CreateRegexSearch(CharClassify *charClassTable) {
return new BuiltinRegex(charClassTable);
}
#endif
#endif

View File

@@ -74,11 +74,50 @@ public:
class DocWatcher; class DocWatcher;
class DocModification; class DocModification;
class RESearch; class Document;
/**
* Interface class for regular expression searching
*/
class RegexSearchBase {
public:
virtual ~RegexSearchBase(){}
virtual long FindText(Document* doc, int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, int flags, int *length) = 0;
///@return String with the substitutions, must remain valid until the next call or destruction
virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length) = 0;
};
/// Factory function for RegexSearchBase
extern RegexSearchBase* CreateRegexSearch(CharClassify *charClassTable);
struct StyledText {
size_t length;
const char *text;
bool multipleStyles;
size_t style;
const unsigned char *styles;
StyledText( size_t length_, const char *text_, bool multipleStyles_, int style_, const unsigned char *styles_) :
length(length_), text(text_), multipleStyles(multipleStyles_), style(style_), styles(styles_) {
}
// Return number of bytes from start to before '\n' or end of text.
// Return 1 when start is outside text
size_t LineLength(size_t start) const {
size_t cur = start;
while ((cur < length) && (text[cur] != '\n'))
cur++;
return cur-start;
}
size_t StyleAt(size_t i) const {
return multipleStyles ? styles[i] : style;
}
};
/** /**
*/ */
class Document { class Document : PerLine {
public: public:
/** Used to pair watcher pointer with user data. */ /** Used to pair watcher pointer with user data. */
@@ -93,7 +132,6 @@ public:
}; };
enum charClassification { ccSpace, ccNewLine, ccWord, ccPunctuation }; enum charClassification { ccSpace, ccNewLine, ccWord, ccPunctuation };
private: private:
int refCount; int refCount;
CellBuffer cb; CellBuffer cb;
@@ -108,9 +146,12 @@ private:
WatcherWithUserData *watchers; WatcherWithUserData *watchers;
int lenWatchers; int lenWatchers;
// ldSize is not real data - it is for dimensions and loops
enum lineData { ldMarkers, ldLevels, ldState, ldMargin, ldAnnotation, ldSize };
PerLine *perLineData[ldSize];
bool matchesValid; bool matchesValid;
RESearch *pre; RegexSearchBase* regex;
char *substituted;
public: public:
int stylingBits; int stylingBits;
@@ -134,7 +175,11 @@ public:
int AddRef(); int AddRef();
int Release(); int Release();
int LineFromPosition(int pos); virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
int LineFromPosition(int pos) const;
int ClampPositionIntoDocument(int pos); int ClampPositionIntoDocument(int pos);
bool IsCrLf(int pos); bool IsCrLf(int pos);
int LenChar(int pos); int LenChar(int pos);
@@ -157,8 +202,10 @@ public:
bool IsCollectingUndo() { return cb.IsCollectingUndo(); } bool IsCollectingUndo() { return cb.IsCollectingUndo(); }
void BeginUndoAction() { cb.BeginUndoAction(); } void BeginUndoAction() { cb.BeginUndoAction(); }
void EndUndoAction() { cb.EndUndoAction(); } void EndUndoAction() { cb.EndUndoAction(); }
void AddUndoAction(int token, bool mayCoalesce) { cb.AddUndoAction(token, mayCoalesce); }
void SetSavePoint(); void SetSavePoint();
bool IsSavePoint() { return cb.IsSavePoint(); } bool IsSavePoint() { return cb.IsSavePoint(); }
const char *BufferPointer() { return cb.BufferPointer(); }
int GetLineIndentation(int line); int GetLineIndentation(int line);
void SetLineIndentation(int line, int indent); void SetLineIndentation(int line, int indent);
@@ -182,21 +229,22 @@ public:
cb.GetCharRange(buffer, position, lengthRetrieve); cb.GetCharRange(buffer, position, lengthRetrieve);
} }
char StyleAt(int position) { return cb.StyleAt(position); } char StyleAt(int position) { return cb.StyleAt(position); }
int GetMark(int line) { return cb.GetMark(line); } int GetMark(int line);
int AddMark(int line, int markerNum); int AddMark(int line, int markerNum);
void AddMarkSet(int line, int valueSet); void AddMarkSet(int line, int valueSet);
void DeleteMark(int line, int markerNum); void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle); void DeleteMarkFromHandle(int markerHandle);
void DeleteAllMarks(int markerNum); void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle) { return cb.LineFromHandle(markerHandle); } int LineFromHandle(int markerHandle);
int LineStart(int line) const; int LineStart(int line) const;
int LineEnd(int line) const; int LineEnd(int line) const;
int LineEndPosition(int position); int LineEndPosition(int position) const;
int VCHomePosition(int position); bool IsLineEndPosition(int position) const;
int VCHomePosition(int position) const;
int SetLevel(int line, int level); int SetLevel(int line, int level);
int GetLevel(int line) { return cb.GetLevel(line); } int GetLevel(int line);
void ClearLevels() { cb.ClearLevels(); } void ClearLevels();
int GetLastChild(int lineParent, int level=-1); int GetLastChild(int lineParent, int level=-1);
int GetFoldParent(int line); int GetFoldParent(int line);
@@ -207,7 +255,7 @@ public:
int Length() const { return cb.Length(); } int Length() const { return cb.Length(); }
void Allocate(int newSize) { cb.Allocate(newSize); } void Allocate(int newSize) { cb.Allocate(newSize); }
long FindText(int minPos, int maxPos, const char *s, long FindText(int minPos, int maxPos, const char *s,
bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length); bool caseSensitive, bool word, bool wordStart, bool regExp, int flags, int *length);
long FindText(int iMessage, unsigned long wParam, long lParam); long FindText(int iMessage, unsigned long wParam, long lParam);
const char *SubstituteByPosition(const char *text, int *length); const char *SubstituteByPosition(const char *text, int *length);
int LinesTotal() const; int LinesTotal() const;
@@ -219,7 +267,7 @@ public:
void SetStylingBits(int bits); void SetStylingBits(int bits);
void StartStyling(int position, char mask); void StartStyling(int position, char mask);
bool SetStyleFor(int length, char style); bool SetStyleFor(int length, char style);
bool SetStyles(int length, char *styles); bool SetStyles(int length, const char *styles);
int GetEndStyled() { return endStyled; } int GetEndStyled() { return endStyled; }
void EnsureStyledTo(int pos); void EnsureStyledTo(int pos);
int GetStyleClock() { return styleClock; } int GetStyleClock() { return styleClock; }
@@ -227,8 +275,24 @@ public:
void DecorationFillRange(int position, int value, int fillLength); void DecorationFillRange(int position, int value, int fillLength);
int SetLineState(int line, int state); int SetLineState(int line, int state);
int GetLineState(int line) { return cb.GetLineState(line); } int GetLineState(int line);
int GetMaxLineState() { return cb.GetMaxLineState(); } int GetMaxLineState();
StyledText MarginStyledText(int line);
void MarginSetStyle(int line, int style);
void MarginSetStyles(int line, const unsigned char *styles);
void MarginSetText(int line, const char *text);
int MarginLength(int line) const;
void MarginClearAll();
bool AnnotationAny() const;
StyledText AnnotationStyledText(int line);
void AnnotationSetText(int line, const char *text);
void AnnotationSetStyle(int line, int style);
void AnnotationSetStyles(int line, const unsigned char *styles);
int AnnotationLength(int line) const;
int AnnotationLines(int line) const;
void AnnotationClearAll();
bool AddWatcher(DocWatcher *watcher, void *userData); bool AddWatcher(DocWatcher *watcher, void *userData);
bool RemoveWatcher(DocWatcher *watcher, void *userData); bool RemoveWatcher(DocWatcher *watcher, void *userData);
@@ -256,6 +320,27 @@ private:
void NotifyModified(DocModification mh); void NotifyModified(DocModification mh);
}; };
class UndoGroup {
Document *pdoc;
bool groupNeeded;
public:
UndoGroup(Document *pdoc_, bool groupNeeded_=true) :
pdoc(pdoc_), groupNeeded(groupNeeded_) {
if (groupNeeded) {
pdoc->BeginUndoAction();
}
}
~UndoGroup() {
if (groupNeeded) {
pdoc->EndUndoAction();
}
}
bool Needed() const {
return groupNeeded;
}
};
/** /**
* To optimise processing of document modifications by DocWatchers, a hint is passed indicating the * To optimise processing of document modifications by DocWatchers, a hint is passed indicating the
* scope of the change. * scope of the change.
@@ -271,6 +356,8 @@ public:
int line; int line;
int foldLevelNow; int foldLevelNow;
int foldLevelPrev; int foldLevelPrev;
int annotationLinesAdded;
int token;
DocModification(int modificationType_, int position_=0, int length_=0, DocModification(int modificationType_, int position_=0, int length_=0,
int linesAdded_=0, const char *text_=0, int line_=0) : int linesAdded_=0, const char *text_=0, int line_=0) :
@@ -281,7 +368,9 @@ public:
text(text_), text(text_),
line(line_), line(line_),
foldLevelNow(0), foldLevelNow(0),
foldLevelPrev(0) {} foldLevelPrev(0),
annotationLinesAdded(0),
token(0) {}
DocModification(int modificationType_, const Action &act, int linesAdded_=0) : DocModification(int modificationType_, const Action &act, int linesAdded_=0) :
modificationType(modificationType_), modificationType(modificationType_),
@@ -291,7 +380,9 @@ public:
text(act.data), text(act.data),
line(0), line(0),
foldLevelNow(0), foldLevelNow(0),
foldLevelPrev(0) {} foldLevelPrev(0),
annotationLinesAdded(0),
token(0) {}
}; };
/** /**

View File

@@ -14,14 +14,15 @@ class Document;
/** /**
*/ */
class DocumentAccessor : public Accessor { class DocumentAccessor : public Accessor {
// Private so DocumentAccessor objects can not be copied // Private so DocumentAccessor objects can not be copied
DocumentAccessor(const DocumentAccessor &source) : Accessor(), props(source.props) {} DocumentAccessor(const DocumentAccessor &source);
DocumentAccessor &operator=(const DocumentAccessor &) { return *this; } DocumentAccessor &operator=(const DocumentAccessor &);
protected: protected:
Document *pdoc; Document *pdoc;
PropSet &props; PropertyGet &props;
WindowID id; WindowID id;
int lenDoc; int lenDoc;
@@ -37,7 +38,7 @@ protected:
void Fill(int position); void Fill(int position);
public: public:
DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) : DocumentAccessor(Document *pdoc_, PropertyGet &props_, WindowID id_=0) :
Accessor(), pdoc(pdoc_), props(props_), id(id_), Accessor(), pdoc(pdoc_), props(props_), id(id_),
lenDoc(-1), validLen(0), chFlags(0), chWhile(0), lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
startSeg(0), startPosStyling(0), startSeg(0), startPosStyling(0),

File diff suppressed because it is too large Load Diff

View File

@@ -54,16 +54,17 @@ public:
char *s; char *s;
int len; int len;
bool rectangular; bool rectangular;
bool lineCopy;
int codePage; int codePage;
int characterSet; int characterSet;
SelectionText() : s(0), len(0), rectangular(false), codePage(0), characterSet(0) {} SelectionText() : s(0), len(0), rectangular(false), lineCopy(false), codePage(0), characterSet(0) {}
~SelectionText() { ~SelectionText() {
Free(); Free();
} }
void Free() { void Free() {
Set(0, 0, 0, 0, false); Set(0, 0, 0, 0, false, false);
} }
void Set(char *s_, int len_, int codePage_, int characterSet_, bool rectangular_) { void Set(char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
delete []s; delete []s;
s = s_; s = s_;
if (s) if (s)
@@ -73,24 +74,23 @@ public:
codePage = codePage_; codePage = codePage_;
characterSet = characterSet_; characterSet = characterSet_;
rectangular = rectangular_; rectangular = rectangular_;
lineCopy = lineCopy_;
} }
void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_) { void Copy(const char *s_, int len_, int codePage_, int characterSet_, bool rectangular_, bool lineCopy_) {
delete []s; delete []s;
s = 0;
s = new char[len_]; s = new char[len_];
if (s) { len = len_;
len = len_; for (int i = 0; i < len_; i++) {
for (int i = 0; i < len_; i++) { s[i] = s_[i];
s[i] = s_[i];
}
} else {
len = 0;
} }
codePage = codePage_; codePage = codePage_;
characterSet = characterSet_; characterSet = characterSet_;
rectangular = rectangular_; rectangular = rectangular_;
lineCopy = lineCopy_;
} }
void Copy(const SelectionText &other) { void Copy(const SelectionText &other) {
Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular); Copy(other.s, other.len, other.codePage, other.characterSet, other.rectangular, other.lineCopy);
} }
}; };
@@ -98,8 +98,8 @@ public:
*/ */
class Editor : public DocWatcher { class Editor : public DocWatcher {
// Private so Editor objects can not be copied // Private so Editor objects can not be copied
Editor(const Editor &) : DocWatcher() {} Editor(const Editor &);
Editor &operator=(const Editor &) { return *this; } Editor &operator=(const Editor &);
protected: // ScintillaBase subclass needs access to much of Editor protected: // ScintillaBase subclass needs access to much of Editor
@@ -122,7 +122,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool hasFocus; bool hasFocus;
bool hideSelection; bool hideSelection;
bool inOverstrike; bool inOverstrike;
int errorStatus;
bool mouseDownCaptures; bool mouseDownCaptures;
/** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to /** In bufferedDraw mode, graphics operations are drawn to a pixmap and then copied to
@@ -141,6 +140,12 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool verticalScrollBarVisible; bool verticalScrollBarVisible;
bool endAtLastLine; bool endAtLastLine;
bool caretSticky; bool caretSticky;
bool multipleSelection;
bool additionalSelectionTyping;
bool additionalCaretsBlink;
bool additionalCaretsVisible;
int virtualSpaceOptions;
Surface *pixmapLine; Surface *pixmapLine;
Surface *pixmapSelMargin; Surface *pixmapSelMargin;
@@ -169,13 +174,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
Point ptMouseLast; Point ptMouseLast;
enum { ddNone, ddInitial, ddDragging } inDragDrop; enum { ddNone, ddInitial, ddDragging } inDragDrop;
bool dropWentOutside; bool dropWentOutside;
int posDrag; SelectionPosition posDrag;
int posDrop; SelectionPosition posDrop;
int lastXChosen; int lastXChosen;
int lineAnchor; int lineAnchor;
int originalAnchorPos; int originalAnchorPos;
int currentPos;
int anchor;
int targetStart; int targetStart;
int targetEnd; int targetEnd;
int searchFlags; int searchFlags;
@@ -197,11 +200,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
int modEventMask; int modEventMask;
SelectionText drag; SelectionText drag;
enum selTypes { noSel, selStream, selRectangle, selLines }; Selection sel;
selTypes selType;
bool moveExtendsSelection;
int xStartSelect; ///< x position of start of rectangular selection
int xEndSelect; ///< x position of end of rectangular selection
bool primarySelection; bool primarySelection;
int caretXPolicy; int caretXPolicy;
@@ -233,7 +232,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
int wrapVisualFlags; int wrapVisualFlags;
int wrapVisualFlagsLocation; int wrapVisualFlagsLocation;
int wrapVisualStartIndent; int wrapVisualStartIndent;
int actualWrapVisualStartIndent; int wrapAddIndent; // This will be added to initial indent of line
int wrapIndentMode; // SC_WRAPINDENT_FIXED, _SAME, _INDENT
bool convertPastes; bool convertPastes;
@@ -256,10 +256,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
int LinesOnScreen(); int LinesOnScreen();
int LinesToScroll(); int LinesToScroll();
int MaxScrollPos(); int MaxScrollPos();
SelectionPosition ClampPositionIntoDocument(SelectionPosition sp) const;
Point LocationFromPosition(SelectionPosition pos);
Point LocationFromPosition(int pos); Point LocationFromPosition(int pos);
int XFromPosition(int pos); int XFromPosition(int pos);
int PositionFromLocation(Point pt); int XFromPosition(SelectionPosition sp);
int PositionFromLocationClose(Point pt); SelectionPosition SPositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false, bool virtualSpace=true);
int PositionFromLocation(Point pt, bool canReturnInvalid=false, bool charPosition=false);
SelectionPosition SPositionFromLineX(int lineDoc, int x);
int PositionFromLineX(int line, int x); int PositionFromLineX(int line, int x);
int LineFromLocation(Point pt); int LineFromLocation(Point pt);
void SetTopLine(int topLineNew); void SetTopLine(int topLineNew);
@@ -271,20 +275,31 @@ protected: // ScintillaBase subclass needs access to much of Editor
PRectangle RectangleFromRange(int start, int end); PRectangle RectangleFromRange(int start, int end);
void InvalidateRange(int start, int end); void InvalidateRange(int start, int end);
bool UserVirtualSpace() const {
return ((virtualSpaceOptions & SCVS_USERACCESSIBLE) != 0);
}
int CurrentPosition(); int CurrentPosition();
bool SelectionEmpty(); bool SelectionEmpty();
int SelectionStart(); SelectionPosition SelectionStart();
int SelectionEnd(); SelectionPosition SelectionEnd();
void SetRectangularRange(); void SetRectangularRange();
void InvalidateSelection(int currentPos_, int anchor_); void ThinRectangularRange();
void InvalidateSelection(SelectionRange newMain, bool invalidateWholeSelection=false);
void SetSelection(SelectionPosition currentPos_, SelectionPosition anchor_);
void SetSelection(int currentPos_, int anchor_); void SetSelection(int currentPos_, int anchor_);
void SetSelection(SelectionPosition currentPos_);
void SetSelection(int currentPos_); void SetSelection(int currentPos_);
void SetEmptySelection(SelectionPosition currentPos_);
void SetEmptySelection(int currentPos_); void SetEmptySelection(int currentPos_);
bool RangeContainsProtected(int start, int end) const; bool RangeContainsProtected(int start, int end) const;
bool SelectionContainsProtected(); bool SelectionContainsProtected();
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true); int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true) const;
int MovePositionTo(int newPos, selTypes sel=noSel, bool ensureVisible=true); SelectionPosition MovePositionOutsideChar(SelectionPosition pos, int moveDir, bool checkLineEnd=true) const;
int MovePositionSoVisible(int pos, int moveDir); int MovePositionTo(SelectionPosition newPos, Selection::selTypes sel=Selection::noSel, bool ensureVisible=true);
int MovePositionTo(int newPos, Selection::selTypes sel=Selection::noSel, bool ensureVisible=true);
SelectionPosition MovePositionSoVisible(SelectionPosition pos, int moveDir);
SelectionPosition MovePositionSoVisible(int pos, int moveDir);
Point PointMainCaret();
void SetLastXChosen(); void SetLastXChosen();
void ScrollTo(int line, bool moveThumb=true); void ScrollTo(int line, bool moveThumb=true);
@@ -309,8 +324,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
LineLayout *RetrieveLineLayout(int lineNumber); LineLayout *RetrieveLineLayout(int lineNumber);
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll, void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite); int width=LineLayout::wrapWidthInfinite);
ColourAllocated SelectionBackground(ViewStyle &vsDraw); ColourAllocated SelectionBackground(ViewStyle &vsDraw, bool main);
ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll); ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, int inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll);
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight); void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour); void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour);
void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll, void DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
@@ -319,12 +334,17 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool drawWrapMark, ColourAllocated wrapColour); bool drawWrapMark, ColourAllocated wrapColour);
void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart, void DrawIndicators(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under); PRectangle rcLine, LineLayout *ll, int subLine, int lineEnd, bool under);
void DrawAnnotation(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart, void DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVisible, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine=0); PRectangle rcLine, LineLayout *ll, int subLine);
void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine, int xStart, int offset, int posCaret, PRectangle rcCaret); void DrawBlockCaret(Surface *surface, ViewStyle &vsDraw, LineLayout *ll, int subLine,
int xStart, int offset, int posCaret, PRectangle rcCaret, ColourAllocated caretColour);
void DrawCarets(Surface *surface, ViewStyle &vsDraw, int line, int xStart,
PRectangle rcLine, LineLayout *ll, int subLine);
void RefreshPixMaps(Surface *surfaceWindow); void RefreshPixMaps(Surface *surfaceWindow);
void Paint(Surface *surfaceWindow, PRectangle rcArea); void Paint(Surface *surfaceWindow, PRectangle rcArea);
long FormatRange(bool draw, RangeToFormat *pfr); long FormatRange(bool draw, Sci_RangeToFormat *pfr);
int TextWidth(int style, const char *text); int TextWidth(int style, const char *text);
virtual void SetVerticalScrollPos() = 0; virtual void SetVerticalScrollPos() = 0;
@@ -334,14 +354,17 @@ protected: // ScintillaBase subclass needs access to much of Editor
void SetScrollBars(); void SetScrollBars();
void ChangeSize(); void ChangeSize();
void FilterSelections();
int InsertSpace(int position, unsigned int spaces);
void AddChar(char ch); void AddChar(char ch);
virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false); virtual void AddCharUTF(char *s, unsigned int len, bool treatAsDBCS=false);
void ClearSelection(); void ClearSelection();
void ClearAll(); void ClearAll();
void ClearDocumentStyle(); void ClearDocumentStyle();
void Cut(); void Cut();
void PasteRectangular(int pos, const char *ptr, int len); void PasteRectangular(SelectionPosition pos, const char *ptr, int len);
virtual void Copy() = 0; virtual void Copy() = 0;
virtual void CopyAllowLine();
virtual bool CanPaste(); virtual bool CanPaste();
virtual void Paste() = 0; virtual void Paste() = 0;
void Clear(); void Clear();
@@ -358,7 +381,6 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void NotifyParent(SCNotification scn) = 0; virtual void NotifyParent(SCNotification scn) = 0;
virtual void NotifyStyleToNeeded(int endStyleNeeded); virtual void NotifyStyleToNeeded(int endStyleNeeded);
void NotifyChar(int ch); void NotifyChar(int ch);
void NotifyMove(int position);
void NotifySavePoint(bool isSavePoint); void NotifySavePoint(bool isSavePoint);
void NotifyModifyAttempt(); void NotifyModifyAttempt();
virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt); virtual void NotifyDoubleClick(Point pt, bool shift, bool ctrl, bool alt);
@@ -380,14 +402,14 @@ protected: // ScintillaBase subclass needs access to much of Editor
void NotifyStyleNeeded(Document *doc, void *userData, int endPos); void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam); void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void PageMove(int direction, selTypes sel=noSel, bool stuttered = false); void PageMove(int direction, Selection::selTypes sel=Selection::noSel, bool stuttered = false);
void ChangeCaseOfSelection(bool makeUpperCase); void ChangeCaseOfSelection(bool makeUpperCase);
void LineTranspose(); void LineTranspose();
void Duplicate(bool forLine); void Duplicate(bool forLine);
virtual void CancelModes(); virtual void CancelModes();
void NewLine(); void NewLine();
void CursorUpOrDown(int direction, selTypes sel=noSel); void CursorUpOrDown(int direction, Selection::selTypes sel=Selection::noSel);
void ParaUpOrDown(int direction, selTypes sel=noSel); void ParaUpOrDown(int direction, Selection::selTypes sel=Selection::noSel);
int StartEndDisplayLine(int pos, bool start); int StartEndDisplayLine(int pos, bool start);
virtual int KeyCommand(unsigned int iMessage); virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/); virtual int KeyDefault(int /* key */, int /*modifiers*/);
@@ -406,18 +428,16 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual void CopyToClipboard(const SelectionText &selectedText) = 0; virtual void CopyToClipboard(const SelectionText &selectedText) = 0;
char *CopyRange(int start, int end); char *CopyRange(int start, int end);
void CopySelectionFromRange(SelectionText *ss, int start, int end); void CopySelectionRange(SelectionText *ss, bool allowLineCopy=false);
void CopySelectionRange(SelectionText *ss);
void CopyRangeToClipboard(int start, int end); void CopyRangeToClipboard(int start, int end);
void CopyText(int length, const char *text); void CopyText(int length, const char *text);
void SetDragPosition(int newPos); void SetDragPosition(SelectionPosition newPos);
virtual void DisplayCursor(Window::Cursor c); virtual void DisplayCursor(Window::Cursor c);
virtual bool DragThreshold(Point ptStart, Point ptNow); virtual bool DragThreshold(Point ptStart, Point ptNow);
virtual void StartDrag(); virtual void StartDrag();
void DropAt(int position, const char *value, bool moving, bool rectangular); void DropAt(SelectionPosition position, const char *value, bool moving, bool rectangular);
/** PositionInSelection returns 0 if position in selection, -1 if position before selection, and 1 if after. /** PositionInSelection returns true if position in selection. */
* Before means either before any line of selection or before selection on its line, with a similar meaning to after. */ bool PositionInSelection(int pos);
int PositionInSelection(int pos);
bool PointInSelection(Point pt); bool PointInSelection(Point pt);
bool PointInSelMargin(Point pt); bool PointInSelMargin(Point pt);
void LineSelection(int lineCurrent_, int lineAnchor_); void LineSelection(int lineCurrent_, int lineAnchor_);
@@ -439,7 +459,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
void CheckForChangeOutsidePaint(Range r); void CheckForChangeOutsidePaint(Range r);
void SetBraceHighlight(Position pos0, Position pos1, int matchStyle); void SetBraceHighlight(Position pos0, Position pos1, int matchStyle);
void SetAnnotationHeights(int start, int end);
void SetDocPointer(Document *document); void SetDocPointer(Document *document);
void SetAnnotationVisible(int visible);
void Expand(int &line, bool doExpand); void Expand(int &line, bool doExpand);
void ToggleContraction(int line); void ToggleContraction(int line);
@@ -460,6 +483,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); void StyleSetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam); sptr_t StyleGetMessage(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
static const char *StringFromEOLMode(int eolMode);
static sptr_t StringResult(sptr_t lParam, const char *val);
public: public:
// Public so the COM thunks can access it. // Public so the COM thunks can access it.
bool IsUnicodeMode() const; bool IsUnicodeMode() const;
@@ -467,6 +494,8 @@ public:
virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam); virtual sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
// Public so scintilla_set_id can use it. // Public so scintilla_set_id can use it.
int ctrlID; int ctrlID;
// Public so COM methods for drag and drop can set it.
int errorStatus;
friend class AutoSurface; friend class AutoSurface;
friend class SelectionLineIterator; friend class SelectionLineIterator;
}; };

View File

@@ -10,6 +10,8 @@
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
#include <string>
#include "Platform.h" #include "Platform.h"
#include "Scintilla.h" #include "Scintilla.h"
@@ -39,7 +41,7 @@ char **WordListsToStrings(WordList *val[]) {
dim++; dim++;
char **wls = new char * [dim + 1]; char **wls = new char * [dim + 1];
for (int i = 0;i < dim;i++) { for (int i = 0;i < dim;i++) {
SString words; std::string words;
words = ""; words = "";
for (int n = 0; n < val[i]->len; n++) { for (int n = 0; n < val[i]->len; n++) {
words += val[i]->words[n]; words += val[i]->words[n];
@@ -172,13 +174,13 @@ LexerLibrary::~LexerLibrary() {
void LexerLibrary::Release() { void LexerLibrary::Release() {
//TODO maintain a list of lexers created, and delete them! //TODO maintain a list of lexers created, and delete them!
LexerMinder *lm; LexerMinder *lm;
LexerMinder *next; LexerMinder *lmNext;
lm = first; lm = first;
while (NULL != lm) { while (NULL != lm) {
next = lm->next; lmNext = lm->next;
delete lm->self; delete lm->self;
delete lm; delete lm;
lm = next; lm = lmNext;
} }
first = NULL; first = NULL;

View File

@@ -40,6 +40,7 @@ public:
ExternalLexerModule(int language_, LexerFunction fnLexer_, ExternalLexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){ const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){
strncpy(name, languageName_, sizeof(name)); strncpy(name, languageName_, sizeof(name));
name[sizeof(name)-1] = '\0';
languageName = name; languageName = name;
}; };
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle, virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
@@ -68,7 +69,7 @@ public:
void Release(); void Release();
LexerLibrary *next; LexerLibrary *next;
SString m_sModuleName; std::string m_sModuleName;
}; };
/// LexerManager manages external lexers, contains LexerLibrarys. /// LexerManager manages external lexers, contains LexerLibrarys.

View File

@@ -0,0 +1,12 @@
// Scintilla source code edit control
/** @file FontQuality.h
** Definitions to control font anti-aliasing.
**/
// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#define SC_EFF_QUALITY_MASK 0xF
#define SC_EFF_QUALITY_DEFAULT 0
#define SC_EFF_QUALITY_NON_ANTIALIASED 1
#define SC_EFF_QUALITY_ANTIALIASED 2
#define SC_EFF_QUALITY_LCD_OPTIMIZED 3

View File

@@ -72,7 +72,7 @@ void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &r
rcBox.top = rcLine.top + 1; rcBox.top = rcLine.top + 1;
rcBox.left = rc.left; rcBox.left = rc.left;
rcBox.right = rc.right; rcBox.right = rc.right;
surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0); surface->AlphaRectangle(rcBox, 1, fore.allocated, fillAlpha, fore.allocated, 50, 0);
} else { // Either INDIC_PLAIN or unknown } else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid); surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid); surface->LineTo(rc.right, ymid);

View File

@@ -19,7 +19,8 @@ public:
int style; int style;
bool under; bool under;
ColourPair fore; ColourPair fore;
Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)) { int fillAlpha;
Indicator() : style(INDIC_PLAIN), under(false), fore(ColourDesired(0,0,0)), fillAlpha(30) {
} }
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine); void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine);
}; };

View File

@@ -23,6 +23,192 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
/**
* Creates an array that points into each word in the string and puts \0 terminators
* after each word.
*/
static char **ArrayFromWordList(char *wordlist, 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];
for (int i=0;i<256; i++) {
wordSeparator[i] = false;
}
wordSeparator['\r'] = true;
wordSeparator['\n'] = true;
if (!onlyLineEnds) {
wordSeparator[' '] = true;
wordSeparator['\t'] = true;
}
for (int j = 0; wordlist[j]; j++) {
int curr = static_cast<unsigned char>(wordlist[j]);
if (!wordSeparator[curr] && wordSeparator[prev])
words++;
prev = curr;
}
char **keywords = new char *[words + 1];
if (keywords) {
words = 0;
prev = '\0';
size_t slen = strlen(wordlist);
for (size_t k = 0; k < slen; k++) {
if (!wordSeparator[static_cast<unsigned char>(wordlist[k])]) {
if (!prev) {
keywords[words] = &wordlist[k];
words++;
}
} else {
wordlist[k] = '\0';
}
prev = wordlist[k];
}
keywords[words] = &wordlist[slen];
*len = words;
} else {
*len = 0;
}
return keywords;
}
void WordList::Clear() {
if (words) {
delete []list;
delete []words;
}
words = 0;
list = 0;
len = 0;
sorted = false;
}
void WordList::Set(const char *s) {
list = new char[strlen(s) + 1];
strcpy(list, s);
sorted = false;
words = ArrayFromWordList(list, &len, onlyLineEnds);
}
extern "C" int cmpString(const void *a1, const void *a2) {
// Can't work out the correct incantation to use modern casts here
return strcmp(*(char**)(a1), *(char**)(a2));
}
static void SortWordList(char **words, unsigned int len) {
qsort(reinterpret_cast<void*>(words), len, sizeof(*words),
cmpString);
}
bool WordList::InList(const char *s) {
if (0 == words)
return false;
if (!sorted) {
sorted = true;
SortWordList(words, len);
for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
starts[k] = -1;
for (int l = len - 1; l >= 0; l--) {
unsigned char indexChar = words[l][0];
starts[indexChar] = l;
}
}
unsigned char firstChar = s[0];
int j = starts[firstChar];
if (j >= 0) {
while ((unsigned char)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['^'];
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) {
if (0 == words)
return false;
if (!sorted) {
sorted = true;
SortWordList(words, len);
for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
starts[k] = -1;
for (int l = len - 1; l >= 0; l--) {
unsigned char indexChar = words[l][0];
starts[indexChar] = l;
}
}
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['^'];
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;
}
const LexerModule *LexerModule::base = 0; const LexerModule *LexerModule::base = 0;
int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1; int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
@@ -146,7 +332,6 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmAns1); LINK_LEXER(lmAns1);
LINK_LEXER(lmAPDL); LINK_LEXER(lmAPDL);
LINK_LEXER(lmAsm); LINK_LEXER(lmAsm);
LINK_LEXER(lmASP);
LINK_LEXER(lmASY); LINK_LEXER(lmASY);
LINK_LEXER(lmAU3); LINK_LEXER(lmAU3);
LINK_LEXER(lmAVE); LINK_LEXER(lmAVE);
@@ -159,6 +344,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmClw); LINK_LEXER(lmClw);
LINK_LEXER(lmClwNoCase); LINK_LEXER(lmClwNoCase);
LINK_LEXER(lmCmake); LINK_LEXER(lmCmake);
LINK_LEXER(lmCOBOL);
LINK_LEXER(lmConf); LINK_LEXER(lmConf);
LINK_LEXER(lmCPP); LINK_LEXER(lmCPP);
LINK_LEXER(lmCPPNoCase); LINK_LEXER(lmCPPNoCase);
@@ -187,11 +373,15 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmLot); LINK_LEXER(lmLot);
LINK_LEXER(lmLout); LINK_LEXER(lmLout);
LINK_LEXER(lmLua); LINK_LEXER(lmLua);
LINK_LEXER(lmMagikSF);
LINK_LEXER(lmMake); LINK_LEXER(lmMake);
LINK_LEXER(lmMarkdown);
LINK_LEXER(lmMatlab); LINK_LEXER(lmMatlab);
LINK_LEXER(lmMETAPOST); LINK_LEXER(lmMETAPOST);
LINK_LEXER(lmMMIXAL); LINK_LEXER(lmMMIXAL);
LINK_LEXER(lmMSSQL); LINK_LEXER(lmMSSQL);
LINK_LEXER(lmMySQL);
LINK_LEXER(lmNimrod);
LINK_LEXER(lmNncrontab); LINK_LEXER(lmNncrontab);
LINK_LEXER(lmNsis); LINK_LEXER(lmNsis);
LINK_LEXER(lmNull); LINK_LEXER(lmNull);
@@ -200,10 +390,12 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmPascal); LINK_LEXER(lmPascal);
LINK_LEXER(lmPB); LINK_LEXER(lmPB);
LINK_LEXER(lmPerl); LINK_LEXER(lmPerl);
LINK_LEXER(lmPHP);
LINK_LEXER(lmPHPSCRIPT); LINK_LEXER(lmPHPSCRIPT);
LINK_LEXER(lmPLM); LINK_LEXER(lmPLM);
LINK_LEXER(lmPo);
LINK_LEXER(lmPOV); LINK_LEXER(lmPOV);
LINK_LEXER(lmPowerPro);
LINK_LEXER(lmPowerShell);
LINK_LEXER(lmProgress); LINK_LEXER(lmProgress);
LINK_LEXER(lmProps); LINK_LEXER(lmProps);
LINK_LEXER(lmPS); LINK_LEXER(lmPS);
@@ -214,10 +406,14 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmRuby); LINK_LEXER(lmRuby);
LINK_LEXER(lmScriptol); LINK_LEXER(lmScriptol);
LINK_LEXER(lmSmalltalk); LINK_LEXER(lmSmalltalk);
LINK_LEXER(lmSML);
LINK_LEXER(lmSorc);
LINK_LEXER(lmSpecman); LINK_LEXER(lmSpecman);
LINK_LEXER(lmSpice); LINK_LEXER(lmSpice);
LINK_LEXER(lmSQL); LINK_LEXER(lmSQL);
LINK_LEXER(lmTACL);
LINK_LEXER(lmTADS3); LINK_LEXER(lmTADS3);
LINK_LEXER(lmTAL);
LINK_LEXER(lmTCL); LINK_LEXER(lmTCL);
LINK_LEXER(lmTeX); LINK_LEXER(lmTeX);
LINK_LEXER(lmVB); LINK_LEXER(lmVB);

View File

@@ -253,11 +253,12 @@ static void ColouriseAU3Doc(unsigned int startPos,
//Reset at line end //Reset at line end
if (sc.atLineEnd) { if (sc.atLineEnd) {
ci=0; ci=0;
if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0)) if (strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0) {
if (sc.atLineEnd) if (sc.atLineEnd)
sc.SetState(SCE_AU3_DEFAULT); sc.SetState(SCE_AU3_DEFAULT);
else else
sc.SetState(SCE_AU3_COMMENTBLOCK); sc.SetState(SCE_AU3_COMMENTBLOCK);
}
break; break;
} }
//skip rest of line when a ; is encountered //skip rest of line when a ; is encountered

View File

@@ -2,6 +2,7 @@
/** @file LexABAQUS.cxx /** @file LexABAQUS.cxx
** Lexer for ABAQUS. Based on the lexer for APDL by Hadar Raz. ** Lexer for ABAQUS. Based on the lexer for APDL by Hadar Raz.
** By Sergio Lucato. ** By Sergio Lucato.
** Sort of completely rewritten by Gertjan Kloosterman
**/ **/
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
@@ -27,7 +28,15 @@ using namespace Scintilla;
#endif #endif
static inline bool IsAWordChar(const int ch) { static inline bool IsAWordChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || ch == '_')); return (ch < 0x80 && (isalnum(ch) || (ch == '_')));
}
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 inline bool IsAnOperator(char ch) { static inline bool IsAnOperator(char ch) {
@@ -41,90 +50,228 @@ static inline bool IsAnOperator(char ch) {
return false; return false;
} }
static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */,
Accessor &styler) { Accessor &styler) {
enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \
int stringStart = ' '; DAT_LINE_VAL, DAT_LINE_COMMA,\
COMMENT_LINE,\
WordList &processors = *keywordlists[0]; ST_ERROR, LINE_END } state ;
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 // Do not leak onto next line
state = LINE_END ;
initStyle = SCE_ABAQUS_DEFAULT; initStyle = SCE_ABAQUS_DEFAULT;
StyleContext sc(startPos, length, initStyle, styler); StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) { // Things are actually quite simple
// Determine if the current state should terminate. // we have commentlines
if (sc.state == SCE_ABAQUS_NUMBER) { // keywordlines and datalines
if (!(IsADigit(sc.ch) || sc.ch == '.' || (sc.ch == 'e' || sc.ch == 'E') || // On a data line there will only be colouring of numbers
((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { // a keyword line is constructed as
sc.SetState(SCE_ABAQUS_DEFAULT); // *word,[ paramname[=paramvalue]]*
} // if the line ends with a , the keyword line continues onto the new line
} else if (sc.state == SCE_ABAQUS_COMMENT) {
if (sc.atLineEnd) {
sc.SetState(SCE_ABAQUS_DEFAULT);
}
} else if (sc.state == SCE_ABAQUS_COMMENTBLOCK) {
if (sc.atLineEnd) {
if (sc.ch == '\r') {
sc.Forward();
}
sc.ForwardSetState(SCE_ABAQUS_DEFAULT);
}
} else if (sc.state == SCE_ABAQUS_STRING) {
if (sc.atLineEnd) {
sc.SetState(SCE_ABAQUS_DEFAULT);
} else if ((sc.ch == '\'' && stringStart == '\'') || (sc.ch == '\"' && stringStart == '\"')) {
sc.ForwardSetState(SCE_ABAQUS_DEFAULT);
}
} else if (sc.state == SCE_ABAQUS_WORD) {
if (!IsAWordChar(sc.ch)) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (processors.InList(s)) {
sc.ChangeState(SCE_ABAQUS_PROCESSOR);
} else if (slashcommands.InList(s)) {
sc.ChangeState(SCE_ABAQUS_SLASHCOMMAND);
} else if (starcommands.InList(s)) {
sc.ChangeState(SCE_ABAQUS_STARCOMMAND);
} else if (commands.InList(s)) {
sc.ChangeState(SCE_ABAQUS_COMMAND);
} else if (arguments.InList(s)) {
sc.ChangeState(SCE_ABAQUS_ARGUMENT);
} else if (functions.InList(s)) {
sc.ChangeState(SCE_ABAQUS_FUNCTION);
}
sc.SetState(SCE_ABAQUS_DEFAULT);
}
} else if (sc.state == SCE_ABAQUS_OPERATOR) {
if (!IsAnOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_ABAQUS_DEFAULT);
}
}
// Determine if a new state should be entered. for (; sc.More(); sc.Forward()) {
if (sc.state == SCE_ABAQUS_DEFAULT) { switch ( state ) {
if (sc.ch == '*' && sc.chNext == '*') { case KW_LINE_KW :
sc.SetState(SCE_ABAQUS_COMMENTBLOCK); if ( sc.atLineEnd ) {
} else if (sc.ch == '!') { // finished the line in keyword state, switch to LINE_END
sc.SetState(SCE_ABAQUS_COMMENT); sc.SetState(SCE_ABAQUS_DEFAULT) ;
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { state = LINE_END ;
sc.SetState(SCE_ABAQUS_NUMBER); } else if ( IsAKeywordChar(sc.ch) ) {
} else if (sc.ch == '\'' || sc.ch == '\"') { // nothing changes
sc.SetState(SCE_ABAQUS_STRING); state = KW_LINE_KW ;
stringStart = sc.ch; } else if ( sc.ch == ',' ) {
} else if (IsAWordChar(sc.ch) || ((sc.ch == '*' || sc.ch == '/') && !isgraph(sc.chPrev))) { // Well well we say a comma, arguments *MUST* follow
sc.SetState(SCE_ABAQUS_WORD); sc.SetState(SCE_ABAQUS_OPERATOR) ;
} else if (IsAnOperator(static_cast<char>(sc.ch))) { state = KW_LINE_COMMA ;
sc.SetState(SCE_ABAQUS_OPERATOR); } else {
} // Flag an error
} sc.SetState(SCE_ABAQUS_PROCESSOR) ;
} state = ST_ERROR ;
sc.Complete(); }
// 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();
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@@ -166,85 +313,295 @@ static int LowerCase(int c)
return c; return c;
} }
static int CheckABAQUSFoldPoint(char const *token, int &level) { static int LineEnd(int line, Accessor &styler)
if (!strcmp(token, "*step") || {
!strcmp(token, "*part") || const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
!strcmp(token, "*instance") || int eol_pos ;
!strcmp(token, "*assembly") || // if the line is the last line, the eol_pos is styler.Length()
!strcmp(token, "***region") ) { // eol will contain a new line, or a virtual new line
level |= SC_FOLDLEVELHEADERFLAG; if ( docLines == line )
return 1; eol_pos = styler.Length() ;
} else
if (!strcmp(token, "*end step") || eol_pos = styler.LineStart(line + 1) - 1;
!strcmp(token, "*end part") || return eol_pos ;
!strcmp(token, "*end instance") || }
!strcmp(token, "*end assembly") ||
!strcmp(token, "***end region") ) { static int LineStart(int line, Accessor &styler)
return -1; {
} return styler.LineStart(line) ;
return 0; }
// 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(int line, Accessor &styler) {
int pos = LineStart(line, styler) ;
int eol_pos = LineEnd(line, styler) ;
int c ;
char ch = ' ';
int 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(int 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(unsigned int startPos, int length, int, static void FoldABAQUSDoc(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) { WordList *[], Accessor &styler) {
int startLine = styler.GetLine(startPos) ;
int endLine = styler.GetLine(startPos+length-1) ;
int line = styler.GetLine(startPos); // bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
int level = styler.LevelAt(line); // We want to deal with all the cases
int go = 0, done = 0; // To know the correct indentlevel, we need to look back to the
int endPos = startPos + length; // previous command line indentation level
char word[256]; // order of formatting keyline datalines commentlines
int wordlen = 0; int beginData = -1 ;
int i; int beginComment = -1 ;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; int prvKeyLine = startLine ;
// Scan for tokens at the start of the line (they may include int prvKeyLineTp = 0 ;
// whitespace, for tokens like "End Function"
for (i = startPos; i < endPos; i++) { // Scan until we find the previous keyword line
int c = styler.SafeGetCharAt(i); // this will give us the level reference that we need
if (!done && !go) { while ( prvKeyLine > 0 ) {
if (wordlen) { // are we scanning a token already? prvKeyLine-- ;
word[wordlen] = static_cast<char>(LowerCase(c)); prvKeyLineTp = LineType(prvKeyLine, styler) ;
if (!IsIdentifier(c)) { // done with token if ( prvKeyLineTp & 4 )
word[wordlen] = '\0'; break ;
go = CheckABAQUSFoldPoint(word, level); }
if (!go) {
// Treat any whitespace as single blank, for // Determine the base line level of all lines following
// things like "End Function". // the previous keyword
if (IsSpace(c) && IsIdentifier(word[wordlen - 1])) { // new keyword lines are placed on this level
word[wordlen] = ' '; //if ( prvKeyLineTp & 4 ) {
if (wordlen < 255) int level = styler.LevelAt(prvKeyLine) & ~SC_FOLDLEVELHEADERFLAG ;
wordlen++; //}
}
else // done with this line // uncomment line below if weird behaviour continues
done = 1; prvKeyLine = -1 ;
}
} else if (wordlen < 255) { // Now start scanning over the lines.
wordlen++; for ( int line = startLine; line <= endLine; line++ ) {
} int lineType = LineType(line, styler) ;
} else { // start scanning at first non-whitespace character
if (!IsSpace(c)) { // Check for comment line
if (IsIdentifier(c)) { if ( lineType == 8 ) {
word[0] = static_cast<char>(LowerCase(c)); if ( beginComment < 0 ) {
wordlen = 1; beginComment = line ;
} else // done with this line
done = 1;
}
} }
}
// Check for data line
if ( (lineType == 1) || (lineType == 3) ) {
if ( beginData < 0 ) {
if ( beginComment >= 0 ) {
beginData = beginComment ;
} else {
beginData = line ;
}
}
beginComment = -1 ;
} }
if (c == '\n') { // line end
if (!done && wordlen == 0 && foldCompact) // line was only space // Check for keywordline.
level |= SC_FOLDLEVELWHITEFLAG; // As soon as a keyword line is encountered, we can set the
if (level != styler.LevelAt(line)) // levels of everything from the previous keyword line to this one
styler.SetLevel(line, level); if ( lineType & 4 ) {
level += go; // this is a keyword, we can now place the previous keyword
line++; // all its data lines and the remainder
// reset state
wordlen = 0; // Write comments and data line
level &= ~SC_FOLDLEVELHEADERFLAG; if ( beginComment < 0 ) {
level &= ~SC_FOLDLEVELWHITEFLAG; beginComment = line ;
go = 0; }
done = 0;
} 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 ( int 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 ( int 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 int docLines = styler.GetLine(styler.Length() - 1);
for ( int line = endLine + 1; line <= docLines; line++ ) {
int 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 ( int ll = beginData; ll < beginComment; ll++ )
SafeSetLevel(ll, datLevel, styler) ;
if ( prvKeyLineTp == 5 ) {
level += 1 ;
}
if ( prvKeyLineTp == 6 ) {
level -= 1 ;
}
for ( int m = beginComment; m <= endLine; m++ )
SafeSetLevel(m, level, styler) ;
} }
static const char * const abaqusWordListDesc[] = { static const char * const abaqusWordListDesc[] = {

View File

@@ -10,6 +10,8 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <string>
#include "Platform.h" #include "Platform.h"
#include "Accessor.h" #include "Accessor.h"
@@ -17,7 +19,6 @@
#include "PropSet.h" #include "PropSet.h"
#include "KeyWords.h" #include "KeyWords.h"
#include "SciLexer.h" #include "SciLexer.h"
#include "SString.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
@@ -62,8 +63,8 @@ static inline bool IsDelimiterCharacter(int ch);
static inline bool IsNumberStartCharacter(int ch); static inline bool IsNumberStartCharacter(int ch);
static inline bool IsNumberCharacter(int ch); static inline bool IsNumberCharacter(int ch);
static inline bool IsSeparatorOrDelimiterCharacter(int ch); static inline bool IsSeparatorOrDelimiterCharacter(int ch);
static bool IsValidIdentifier(const SString& identifier); static bool IsValidIdentifier(const std::string& identifier);
static bool IsValidNumber(const SString& number); static bool IsValidNumber(const std::string& number);
static inline bool IsWordStartCharacter(int ch); static inline bool IsWordStartCharacter(int ch);
static inline bool IsWordCharacter(int ch); static inline bool IsWordCharacter(int ch);
@@ -117,7 +118,7 @@ static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostroph
sc.Forward(); sc.Forward();
sc.Forward(); sc.Forward();
SString identifier; std::string identifier;
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
identifier += static_cast<char>(tolower(sc.ch)); identifier += static_cast<char>(tolower(sc.ch));
@@ -144,7 +145,7 @@ static void ColouriseLabel(StyleContext& sc, WordList& keywords, bool& apostroph
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) { static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true; apostropheStartsAttribute = true;
SString number; std::string number;
sc.SetState(SCE_ADA_NUMBER); sc.SetState(SCE_ADA_NUMBER);
// Get all characters up to a delimiter or a separator, including points, but excluding // Get all characters up to a delimiter or a separator, including points, but excluding
@@ -192,7 +193,7 @@ static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostrophe
apostropheStartsAttribute = true; apostropheStartsAttribute = true;
sc.SetState(SCE_ADA_IDENTIFIER); sc.SetState(SCE_ADA_IDENTIFIER);
SString word; std::string word;
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
word += static_cast<char>(tolower(sc.ch)); word += static_cast<char>(tolower(sc.ch));
@@ -321,7 +322,7 @@ static inline bool IsSeparatorOrDelimiterCharacter(int ch) {
return IsASpace(ch) || IsDelimiterCharacter(ch); return IsASpace(ch) || IsDelimiterCharacter(ch);
} }
static bool IsValidIdentifier(const SString& identifier) { static bool IsValidIdentifier(const std::string& identifier) {
// First character can't be '_', so initialize the flag to true // First character can't be '_', so initialize the flag to true
bool lastWasUnderscore = true; bool lastWasUnderscore = true;
@@ -355,8 +356,8 @@ static bool IsValidIdentifier(const SString& identifier) {
return true; return true;
} }
static bool IsValidNumber(const SString& number) { static bool IsValidNumber(const std::string& number) {
int hashPos = number.search("#"); size_t hashPos = number.find("#");
bool seenDot = false; bool seenDot = false;
size_t i = 0; size_t i = 0;
@@ -366,7 +367,7 @@ static bool IsValidNumber(const SString& number) {
return false; // Just in case return false; // Just in case
// Decimal number // Decimal number
if (hashPos == -1) { if (hashPos == std::string::npos) {
bool canBeSpecial = false; bool canBeSpecial = false;
for (; i < length; i++) { for (; i < length; i++) {

View File

@@ -37,8 +37,8 @@ static inline bool IsAWordStart(const int ch) {
ch == '%' || ch == '@' || ch == '$' || ch == '?'); ch == '%' || ch == '@' || ch == '$' || ch == '?');
} }
static inline bool IsAsmOperator(char ch) { static inline bool IsAsmOperator(const int ch) {
if (isalnum(ch)) if ((ch < 0x80) && (isalnum(ch)))
return false; return false;
// '.' left out as it is used to make up numbers // '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
@@ -89,7 +89,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
// Determine if the current state should terminate. // Determine if the current state should terminate.
if (sc.state == SCE_ASM_OPERATOR) { if (sc.state == SCE_ASM_OPERATOR) {
if (!IsAsmOperator(static_cast<char>(sc.ch))) { if (!IsAsmOperator(sc.ch)) {
sc.SetState(SCE_ASM_DEFAULT); sc.SetState(SCE_ASM_DEFAULT);
} }
}else if (sc.state == SCE_ASM_NUMBER) { }else if (sc.state == SCE_ASM_NUMBER) {
@@ -149,7 +149,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.state == SCE_ASM_DEFAULT) { if (sc.state == SCE_ASM_DEFAULT) {
if (sc.ch == ';'){ if (sc.ch == ';'){
sc.SetState(SCE_ASM_COMMENT); sc.SetState(SCE_ASM_COMMENT);
} else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) { } else if (isascii(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && isascii(sc.chNext) && isdigit(sc.chNext)))) {
sc.SetState(SCE_ASM_NUMBER); sc.SetState(SCE_ASM_NUMBER);
} else if (IsAWordStart(sc.ch)) { } else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_ASM_IDENTIFIER); sc.SetState(SCE_ASM_IDENTIFIER);
@@ -157,7 +157,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_ASM_STRING); sc.SetState(SCE_ASM_STRING);
} else if (sc.ch == '\'') { } else if (sc.ch == '\'') {
sc.SetState(SCE_ASM_CHARACTER); sc.SetState(SCE_ASM_CHARACTER);
} else if (IsAsmOperator(static_cast<char>(sc.ch))) { } else if (IsAsmOperator(sc.ch)) {
sc.SetState(SCE_ASM_OPERATOR); sc.SetState(SCE_ASM_OPERATOR);
} }
} }

View File

@@ -2,8 +2,8 @@
/** @file LexBash.cxx /** @file LexBash.cxx
** Lexer for Bash. ** Lexer for Bash.
**/ **/
// Copyright 2004-2007 by Neil Hodgson <neilh@scintilla.org> // Copyright 2004-2008 by Neil Hodgson <neilh@scintilla.org>
// Adapted from LexPerl by Kein-Hong Man <mkh@pl.jaring.my> 2004 // Adapted from LexPerl by Kein-Hong Man 2004
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h> #include <stdlib.h>
@@ -16,9 +16,17 @@
#include "PropSet.h" #include "PropSet.h"
#include "Accessor.h" #include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h" #include "KeyWords.h"
#include "Scintilla.h" #include "Scintilla.h"
#include "SciLexer.h" #include "SciLexer.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#define HERE_DELIM_MAX 256
// define this if you want 'invalid octals' to be marked as errors // define this if you want 'invalid octals' to be marked as errors
// usually, this is not a good idea, permissive lexing is better // usually, this is not a good idea, permissive lexing is better
@@ -32,13 +40,7 @@
#define BASH_BASE_OCTAL_ERROR 69 #define BASH_BASE_OCTAL_ERROR 69
#endif #endif
#define HERE_DELIM_MAX 256 static inline int translateBashDigit(int ch) {
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline int translateBashDigit(char ch) {
if (ch >= '0' && ch <= '9') { if (ch >= '0' && ch <= '9') {
return ch - '0'; return ch - '0';
} else if (ch >= 'a' && ch <= 'z') { } else if (ch >= 'a' && ch <= 'z') {
@@ -53,407 +55,210 @@ static inline int translateBashDigit(char ch) {
return BASH_BASE_ERROR; return BASH_BASE_ERROR;
} }
static inline bool isEOLChar(char ch) { static inline int getBashNumberBase(char *s) {
return (ch == '\r') || (ch == '\n'); int i = 0;
}
static bool isSingleCharOp(char ch) {
char strCharSet[2];
strCharSet[0] = ch;
strCharSet[1] = '\0';
return (NULL != strstr("rwxoRWXOezsfdlpSbctugkTBMACahGLNn", strCharSet));
}
static inline bool isBashOperator(char ch) {
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 int classifyWordBash(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char s[100];
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
}
char chAttr = SCE_SH_IDENTIFIER;
if (keywords.InList(s))
chAttr = SCE_SH_WORD;
styler.ColourTo(end, chAttr);
return chAttr;
}
static inline int getBashNumberBase(unsigned int start, unsigned int end, Accessor &styler) {
int base = 0; int base = 0;
for (unsigned int i = 0; i < end - start + 1 && i < 10; i++) { while (*s) {
base = base * 10 + (styler[start + i] - '0'); base = base * 10 + (*s++ - '0');
i++;
} }
if (base > 64 || (end - start) > 1) { if (base > 64 || i > 2) {
return BASH_BASE_ERROR; return BASH_BASE_ERROR;
} }
return base; return base;
} }
static inline bool isEndVar(char ch) { static int opposite(int ch) {
return !isalnum(ch) && ch != '$' && ch != '_'; if (ch == '(') return ')';
} if (ch == '[') return ']';
if (ch == '{') return '}';
static inline bool isNonQuote(char ch) { if (ch == '<') return '>';
return isalnum(ch) || ch == '_';
}
static bool isMatch(Accessor &styler, int lengthDoc, int 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;
}
static char opposite(char ch) {
if (ch == '(')
return ')';
if (ch == '[')
return ']';
if (ch == '{')
return '}';
if (ch == '<')
return '>';
return ch; return ch;
} }
static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) { WordList *keywordlists[], Accessor &styler) {
// Lexer for bash 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]; WordList &keywords = *keywordlists[0];
class HereDocCls { CharacterSet setWordStart(CharacterSet::setAlpha, "_");
// note that [+-] are often parts of identifiers in shell scripts
CharacterSet setWord(CharacterSet::setAlphaNum, "._+-");
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: public:
int State; // 0: '<<' encountered int State; // 0: '<<' encountered
// 1: collect the delimiter // 1: collect the delimiter
// 2: here doc text (lines after the delimiter) // 2: here doc text (lines after the delimiter)
char Quote; // the char after '<<' int Quote; // the char after '<<'
bool Quoted; // true if Quote in ('\'','"','`') bool Quoted; // true if Quote in ('\'','"','`')
bool Indent; // indented delimiter (for <<-) bool Indent; // indented delimiter (for <<-)
int DelimiterLength; // strlen(Delimiter) int DelimiterLength; // strlen(Delimiter)
char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf
HereDocCls() { HereDocCls() {
State = 0; State = 0;
Quote = 0; Quote = 0;
Quoted = false; Quoted = false;
Indent = 0; Indent = 0;
DelimiterLength = 0; DelimiterLength = 0;
Delimiter = new char[HERE_DELIM_MAX]; Delimiter = new char[HERE_DELIM_MAX];
Delimiter[0] = '\0'; Delimiter[0] = '\0';
} }
void Append(int ch) {
Delimiter[DelimiterLength++] = static_cast<char>(ch);
Delimiter[DelimiterLength] = '\0';
}
~HereDocCls() { ~HereDocCls() {
delete []Delimiter; delete []Delimiter;
} }
}; };
HereDocCls HereDoc; HereDocCls HereDoc;
class QuoteCls { class QuoteCls { // Class to manage quote pairs (simplified vs LexPerl)
public: public:
int Rep; int Count;
int Count; int Up, Down;
char Up;
char Down;
QuoteCls() { QuoteCls() {
this->New(1);
}
void New(int r) {
Rep = r;
Count = 0; Count = 0;
Up = '\0'; Up = '\0';
Down = '\0'; Down = '\0';
} }
void Open(char u) { void Open(int u) {
Count++; Count++;
Up = u; Up = u;
Down = opposite(Up); Down = opposite(Up);
} }
void Start(int u) {
Count = 0;
Open(u);
}
}; };
QuoteCls Quote; QuoteCls Quote;
int state = initStyle;
int numBase = 0; int numBase = 0;
unsigned int lengthDoc = startPos + length; int digit;
unsigned int endPos = startPos + length;
// If in a long distance lexical state, seek to the beginning to find quote characters // Backtrack to beginning of style if required...
// Bash strings can be multi-line with embedded newlines, so backtrack. // If in a long distance lexical state, backtrack to find quote characters
// Bash numbers have additional state during lexing, so backtrack too. if (initStyle == SCE_SH_HERE_Q) {
if (state == SCE_SH_HERE_Q) {
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_SH_HERE_DELIM)) { while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_SH_HERE_DELIM)) {
startPos--; startPos--;
} }
startPos = styler.LineStart(styler.GetLine(startPos)); startPos = styler.LineStart(styler.GetLine(startPos));
state = styler.StyleAt(startPos - 1); initStyle = styler.StyleAt(startPos - 1);
} }
if (state == SCE_SH_STRING // Bash strings can be multi-line with embedded newlines, so backtrack.
|| state == SCE_SH_BACKTICKS // Bash numbers have additional state during lexing, so backtrack too.
|| state == SCE_SH_CHARACTER if (initStyle == SCE_SH_STRING
|| state == SCE_SH_NUMBER || initStyle == SCE_SH_BACKTICKS
|| state == SCE_SH_IDENTIFIER || initStyle == SCE_SH_CHARACTER
|| state == SCE_SH_COMMENTLINE || initStyle == SCE_SH_NUMBER
) { || initStyle == SCE_SH_IDENTIFIER
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) { || initStyle == SCE_SH_COMMENTLINE) {
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == initStyle)) {
startPos--; startPos--;
} }
state = SCE_SH_DEFAULT; initStyle = SCE_SH_DEFAULT;
} }
styler.StartAt(startPos); StyleContext sc(startPos, endPos - startPos, initStyle, styler);
char chPrev = styler.SafeGetCharAt(startPos - 1);
if (startPos == 0)
chPrev = '\n';
char chNext = styler[startPos];
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) { for (; sc.More(); sc.Forward()) {
char ch = chNext;
// if the current character is not consumed due to the completion of an
// earlier style, lexing can be restarted via a simple goto
restartLexer:
chNext = styler.SafeGetCharAt(i + 1);
char chNext2 = styler.SafeGetCharAt(i + 2);
if (styler.IsLeadByte(ch)) { // Determine if the current state should terminate.
chNext = styler.SafeGetCharAt(i + 2); switch (sc.state) {
chPrev = ' '; case SCE_SH_OPERATOR:
i += 1; sc.SetState(SCE_SH_DEFAULT);
continue; break;
} case SCE_SH_WORD:
// "." never used in Bash variable names but used in file names
if ((chPrev == '\r' && ch == '\n')) { // skip on DOS/Windows if (!setWord.Contains(sc.ch)) {
styler.ColourTo(i, state); char s[1000];
chPrev = ch; sc.GetCurrent(s, sizeof(s));
continue; if (s[0] != '-' && // for file operators
} !keywords.InList(s)) {
sc.ChangeState(SCE_SH_IDENTIFIER);
if (HereDoc.State == 1 && isEOLChar(ch)) {
// 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 (state == SCE_SH_HERE_DELIM) {
// Missing quote at end of string! We are stricter than bash.
// Colour here-doc anyway while marking this bit as an error.
state = SCE_SH_ERROR;
}
styler.ColourTo(i - 1, state);
// HereDoc.Quote always == '\''
state = SCE_SH_HERE_Q;
} else {
styler.ColourTo(i - 1, state);
// always switch
state = SCE_SH_HERE_Q;
}
}
if (state == SCE_SH_DEFAULT) {
if (ch == '\\') { // escaped character
if (i < lengthDoc - 1)
i++;
ch = chNext;
chNext = chNext2;
styler.ColourTo(i, SCE_SH_IDENTIFIER);
} else if (isdigit(ch)) {
state = SCE_SH_NUMBER;
numBase = BASH_BASE_DECIMAL;
if (ch == '0') { // hex,octal
if (chNext == 'x' || chNext == 'X') {
numBase = BASH_BASE_HEX;
i++;
ch = chNext;
chNext = chNext2;
} else if (isdigit(chNext)) {
#ifdef PEDANTIC_OCTAL
numBase = BASH_BASE_OCTAL;
#else
numBase = BASH_BASE_HEX;
#endif
} }
sc.SetState(SCE_SH_DEFAULT);
} }
} else if (iswordstart(ch)) { break;
state = SCE_SH_WORD; case SCE_SH_IDENTIFIER:
if (!iswordchar(chNext) && chNext != '+' && chNext != '-') { if (sc.chPrev == '\\') { // for escaped chars
// We need that if length of word == 1! sc.ForwardSetState(SCE_SH_DEFAULT);
// This test is copied from the SCE_SH_WORD handler. } else if (!setWord.Contains(sc.ch)) {
classifyWordBash(styler.GetStartSegment(), i, keywords, styler); sc.SetState(SCE_SH_DEFAULT);
state = SCE_SH_DEFAULT;
} }
} else if (ch == '#') { break;
state = SCE_SH_COMMENTLINE; case SCE_SH_NUMBER:
} else if (ch == '\"') { digit = translateBashDigit(sc.ch);
state = SCE_SH_STRING; if (numBase == BASH_BASE_DECIMAL) {
Quote.New(1); if (sc.ch == '#') {
Quote.Open(ch); char s[10];
} else if (ch == '\'') { sc.GetCurrent(s, sizeof(s));
state = SCE_SH_CHARACTER; numBase = getBashNumberBase(s);
Quote.New(1); if (numBase != BASH_BASE_ERROR)
Quote.Open(ch); break;
} else if (ch == '`') { } else if (IsADigit(sc.ch))
state = SCE_SH_BACKTICKS; break;
Quote.New(1); } else if (numBase == BASH_BASE_HEX) {
Quote.Open(ch); if (IsADigit(sc.ch, 16))
} else if (ch == '$') { break;
if (chNext == '{') {
state = SCE_SH_PARAM;
goto startQuote;
} else if (chNext == '\'') {
state = SCE_SH_CHARACTER;
goto startQuote;
} else if (chNext == '"') {
state = SCE_SH_STRING;
goto startQuote;
} else if (chNext == '(' && chNext2 == '(') {
styler.ColourTo(i, SCE_SH_OPERATOR);
state = SCE_SH_DEFAULT;
goto skipChar;
} else if (chNext == '(' || chNext == '`') {
state = SCE_SH_BACKTICKS;
startQuote:
Quote.New(1);
Quote.Open(chNext);
goto skipChar;
} else {
state = SCE_SH_SCALAR;
skipChar:
i++;
ch = chNext;
chNext = chNext2;
}
} else if (ch == '*') {
if (chNext == '*') { // exponentiation
i++;
ch = chNext;
chNext = chNext2;
}
styler.ColourTo(i, SCE_SH_OPERATOR);
} else if (ch == '<' && chNext == '<') {
state = SCE_SH_HERE_DELIM;
HereDoc.State = 0;
HereDoc.Indent = false;
} else if (ch == '-' // file test operators
&& isSingleCharOp(chNext)
&& !isalnum((chNext2 = styler.SafeGetCharAt(i+2)))
&& isspace(chPrev)) {
styler.ColourTo(i + 1, SCE_SH_WORD);
state = SCE_SH_DEFAULT;
i++;
ch = chNext;
chNext = chNext2;
} else if (isBashOperator(ch)) {
styler.ColourTo(i, SCE_SH_OPERATOR);
} else {
// keep colouring defaults to make restart easier
styler.ColourTo(i, SCE_SH_DEFAULT);
}
} else if (state == SCE_SH_NUMBER) {
int digit = translateBashDigit(ch);
if (numBase == BASH_BASE_DECIMAL) {
if (ch == '#') {
numBase = getBashNumberBase(styler.GetStartSegment(), i - 1, styler);
if (numBase == BASH_BASE_ERROR) // take the rest as comment
goto numAtEnd;
} else if (!isdigit(ch))
goto numAtEnd;
} else if (numBase == BASH_BASE_HEX) {
if ((digit < 16) || (digit >= 36 && digit <= 41)) {
// hex digit 0-9a-fA-F
} else
goto numAtEnd;
#ifdef PEDANTIC_OCTAL #ifdef PEDANTIC_OCTAL
} else if (numBase == BASH_BASE_OCTAL || } else if (numBase == BASH_BASE_OCTAL ||
numBase == BASH_BASE_OCTAL_ERROR) { numBase == BASH_BASE_OCTAL_ERROR) {
if (digit > 7) { if (digit <= 7)
break;
if (digit <= 9) { if (digit <= 9) {
numBase = BASH_BASE_OCTAL_ERROR; numBase = BASH_BASE_OCTAL_ERROR;
} else break;
goto numAtEnd;
}
#endif
} else if (numBase == BASH_BASE_ERROR) {
if (digit > 9)
goto numAtEnd;
} 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) { #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) { if (digit <= 9) {
numBase = BASH_BASE_ERROR; numBase = BASH_BASE_ERROR;
} else break;
goto numAtEnd; }
} }
} else { }
numAtEnd: // fallthrough when number is at an end or error
if (numBase == BASH_BASE_ERROR if (numBase == BASH_BASE_ERROR
#ifdef PEDANTIC_OCTAL #ifdef PEDANTIC_OCTAL
|| numBase == BASH_BASE_OCTAL_ERROR || numBase == BASH_BASE_OCTAL_ERROR
#endif #endif
) ) {
state = SCE_SH_ERROR; sc.ChangeState(SCE_SH_ERROR);
styler.ColourTo(i - 1, state);
state = SCE_SH_DEFAULT;
goto restartLexer;
} }
} sc.SetState(SCE_SH_DEFAULT);
} else if (state == SCE_SH_WORD) { break;
if (!iswordchar(chNext) && chNext != '+' && chNext != '-') { case SCE_SH_COMMENTLINE:
// "." never used in Bash variable names if (sc.ch == '\\' && (sc.chNext == '\r' || sc.chNext == '\n')) {
// but used in file names
classifyWordBash(styler.GetStartSegment(), i, keywords, styler);
state = SCE_SH_DEFAULT;
ch = ' ';
}
} else if (state == SCE_SH_IDENTIFIER) {
if (!iswordchar(chNext) && chNext != '+' && chNext != '-') {
styler.ColourTo(i, SCE_SH_IDENTIFIER);
state = SCE_SH_DEFAULT;
ch = ' ';
}
} else {
if (state == SCE_SH_COMMENTLINE) {
if (ch == '\\' && isEOLChar(chNext)) {
// comment continuation // comment continuation
if (chNext == '\r' && chNext2 == '\n') { sc.Forward();
i += 2; if (sc.ch == '\r' && sc.chNext == '\n') {
ch = styler.SafeGetCharAt(i); sc.Forward();
chNext = styler.SafeGetCharAt(i + 1);
} else {
i++;
ch = chNext;
chNext = chNext2;
} }
} else if (isEOLChar(ch)) { } else if (sc.atLineEnd) {
styler.ColourTo(i - 1, state); sc.ForwardSetState(SCE_SH_DEFAULT);
state = SCE_SH_DEFAULT;
goto restartLexer;
} else if (isEOLChar(chNext)) {
styler.ColourTo(i, state);
state = SCE_SH_DEFAULT;
} }
} else if (state == SCE_SH_HERE_DELIM) { break;
// case SCE_SH_HERE_DELIM:
// From Bash info: // From Bash info:
// --------------- // ---------------
// Specifier format is: <<[-]WORD // Specifier format is: <<[-]WORD
@@ -461,150 +266,198 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
// Whitespace acceptable after <<[-] operator // Whitespace acceptable after <<[-] operator
// //
if (HereDoc.State == 0) { // '<<' encountered if (HereDoc.State == 0) { // '<<' encountered
HereDoc.State = 1; HereDoc.Quote = sc.chNext;
HereDoc.Quote = chNext;
HereDoc.Quoted = false; HereDoc.Quoted = false;
HereDoc.DelimiterLength = 0; HereDoc.DelimiterLength = 0;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
if (chNext == '\'' || chNext == '\"') { // a quoted here-doc delimiter (' or ") if (sc.chNext == '\'' || sc.chNext == '\"') { // a quoted here-doc delimiter (' or ")
i++; sc.Forward();
ch = chNext;
chNext = chNext2;
HereDoc.Quoted = true; HereDoc.Quoted = true;
} else if (!HereDoc.Indent && chNext == '-') { // <<- indent case HereDoc.State = 1;
} else if (!HereDoc.Indent && sc.chNext == '-') { // <<- indent case
HereDoc.Indent = true; HereDoc.Indent = true;
HereDoc.State = 0; } else if (setHereDoc.Contains(sc.chNext)) {
} else if (isalpha(chNext) || chNext == '_' || chNext == '\\'
|| chNext == '-' || chNext == '+' || chNext == '!') {
// an unquoted here-doc delimiter, no special handling // an unquoted here-doc delimiter, no special handling
// TODO check what exactly bash considers part of the delim // TODO check what exactly bash considers part of the delim
} else if (chNext == '<') { // HERE string <<< HereDoc.State = 1;
i++; } else if (sc.chNext == '<') { // HERE string <<<
ch = chNext; sc.Forward();
chNext = chNext2; sc.ForwardSetState(SCE_SH_DEFAULT);
styler.ColourTo(i, SCE_SH_HERE_DELIM); } else if (IsASpace(sc.chNext)) {
state = SCE_SH_DEFAULT;
HereDoc.State = 0;
} else if (isspacechar(chNext)) {
// eat whitespace // eat whitespace
HereDoc.State = 0; } else if (setLeftShift.Contains(sc.chNext)) {
} else if (isdigit(chNext) || chNext == '=' || chNext == '$') {
// left shift << or <<= operator cases // left shift << or <<= operator cases
styler.ColourTo(i, SCE_SH_OPERATOR); sc.ChangeState(SCE_SH_OPERATOR);
state = SCE_SH_DEFAULT; sc.ForwardSetState(SCE_SH_DEFAULT);
HereDoc.State = 0;
} else { } else {
// symbols terminates; deprecated zero-length delimiter // symbols terminates; deprecated zero-length delimiter
HereDoc.State = 1;
} }
} else if (HereDoc.State == 1) { // collect the delimiter } else if (HereDoc.State == 1) { // collect the delimiter
if (HereDoc.Quoted) { // a quoted here-doc delimiter if (HereDoc.Quoted) { // a quoted here-doc delimiter
if (ch == HereDoc.Quote) { // closing quote => end of delimiter if (sc.ch == HereDoc.Quote) { // closing quote => end of delimiter
styler.ColourTo(i, state); sc.ForwardSetState(SCE_SH_DEFAULT);
state = SCE_SH_DEFAULT;
} else { } else {
if (ch == '\\' && chNext == HereDoc.Quote) { // escaped quote if (sc.ch == '\\' && sc.chNext == HereDoc.Quote) { // escaped quote
i++; sc.Forward();
ch = chNext;
chNext = chNext2;
} }
HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; HereDoc.Append(sc.ch);
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
} }
} else { // an unquoted here-doc delimiter } else { // an unquoted here-doc delimiter
if (isalnum(ch) || ch == '_' || ch == '-' || ch == '+' || ch == '!') { if (setHereDoc2.Contains(sc.ch)) {
HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch; HereDoc.Append(sc.ch);
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0'; } else if (sc.ch == '\\') {
} else if (ch == '\\') {
// skip escape prefix // skip escape prefix
} else { } else {
styler.ColourTo(i - 1, state); sc.SetState(SCE_SH_DEFAULT);
state = SCE_SH_DEFAULT;
goto restartLexer;
} }
} }
if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup
styler.ColourTo(i - 1, state); sc.SetState(SCE_SH_ERROR);
state = SCE_SH_ERROR; HereDoc.State = 0;
goto restartLexer;
} }
} }
} else if (HereDoc.State == 2) { break;
// state == SCE_SH_HERE_Q case SCE_SH_HERE_Q:
if (isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) { // HereDoc.State == 2
if (!HereDoc.Indent && isEOLChar(chPrev)) { if (sc.atLineStart) {
endHereDoc: sc.SetState(SCE_SH_HERE_Q);
// standard HERE delimiter int prefixws = 0;
i += HereDoc.DelimiterLength; while (IsASpace(sc.ch) && !sc.atLineEnd) { // whitespace prefix
chPrev = styler.SafeGetCharAt(i - 1); sc.Forward();
ch = styler.SafeGetCharAt(i); prefixws++;
if (isEOLChar(ch)) { }
styler.ColourTo(i - 1, state); if (prefixws > 0)
state = SCE_SH_DEFAULT; sc.SetState(SCE_SH_HERE_Q);
HereDoc.State = 0; while (!sc.atLineEnd) {
goto restartLexer; sc.Forward();
} }
chNext = styler.SafeGetCharAt(i + 1); char s[HERE_DELIM_MAX];
} else if (HereDoc.Indent) { sc.GetCurrent(s, sizeof(s));
// indented HERE delimiter if (sc.LengthCurrent() == 0)
unsigned int bk = (i > 0)? i - 1: 0; break;
while (i > 0) { if (s[strlen(s) - 1] == '\r')
ch = styler.SafeGetCharAt(bk--); s[strlen(s) - 1] = '\0';
if (isEOLChar(ch)) { if (strcmp(HereDoc.Delimiter, s) == 0) {
goto endHereDoc; if ((prefixws > 0 && HereDoc.Indent) || // indentation rule
} else if (!isspacechar(ch)) { (prefixws == 0 && !HereDoc.Indent)) {
break; // got leading non-whitespace sc.SetState(SCE_SH_DEFAULT);
} break;
} }
} }
} }
} else if (state == SCE_SH_SCALAR) { // variable names break;
if (isEndVar(ch)) { case SCE_SH_SCALAR: // variable names
if ((state == SCE_SH_SCALAR) if (!setParam.Contains(sc.ch)) {
&& i == (styler.GetStartSegment() + 1)) { if (sc.LengthCurrent() == 1) {
// Special variable: $(, $_ etc. // Special variable: $(, $_ etc.
styler.ColourTo(i, state); sc.ForwardSetState(SCE_SH_DEFAULT);
state = SCE_SH_DEFAULT;
} else { } else {
styler.ColourTo(i - 1, state); sc.SetState(SCE_SH_DEFAULT);
state = SCE_SH_DEFAULT;
goto restartLexer;
} }
} }
} else if (state == SCE_SH_STRING break;
|| state == SCE_SH_CHARACTER case SCE_SH_STRING: // delimited styles
|| state == SCE_SH_BACKTICKS case SCE_SH_CHARACTER:
|| state == SCE_SH_PARAM case SCE_SH_BACKTICKS:
) { case SCE_SH_PARAM:
if (!Quote.Down && !isspacechar(ch)) { if (sc.ch == '\\' && Quote.Up != '\\') {
Quote.Open(ch); sc.Forward();
} else if (ch == '\\' && Quote.Up != '\\') { } else if (sc.ch == Quote.Down) {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else if (ch == Quote.Down) {
Quote.Count--; Quote.Count--;
if (Quote.Count == 0) { if (Quote.Count == 0) {
Quote.Rep--; sc.ForwardSetState(SCE_SH_DEFAULT);
if (Quote.Rep <= 0) {
styler.ColourTo(i, state);
state = SCE_SH_DEFAULT;
ch = ' ';
}
if (Quote.Up == Quote.Down) {
Quote.Count++;
}
} }
} else if (ch == Quote.Up) { } else if (sc.ch == Quote.Up) {
Quote.Count++; Quote.Count++;
} }
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! We are stricter than bash.
// Colour here-doc anyway while marking this bit as an error.
sc.ChangeState(SCE_SH_ERROR);
}
// HereDoc.Quote always == '\''
}
sc.SetState(SCE_SH_HERE_Q);
}
// Determine if a new state should be entered.
if (sc.state == SCE_SH_DEFAULT) {
if (sc.ch == '\\') { // escaped character
sc.SetState(SCE_SH_IDENTIFIER);
} 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 == '#') {
sc.SetState(SCE_SH_COMMENTLINE);
} else if (sc.ch == '\"') {
sc.SetState(SCE_SH_STRING);
Quote.Start(sc.ch);
} else if (sc.ch == '\'') {
sc.SetState(SCE_SH_CHARACTER);
Quote.Start(sc.ch);
} else if (sc.ch == '`') {
sc.SetState(SCE_SH_BACKTICKS);
Quote.Start(sc.ch);
} else if (sc.ch == '$') {
sc.SetState(SCE_SH_SCALAR);
sc.Forward();
if (sc.ch == '{') {
sc.ChangeState(SCE_SH_PARAM);
} else if (sc.ch == '\'') {
sc.ChangeState(SCE_SH_CHARACTER);
} else if (sc.ch == '"') {
sc.ChangeState(SCE_SH_STRING);
} else if (sc.ch == '(' || sc.ch == '`') {
sc.ChangeState(SCE_SH_BACKTICKS);
if (sc.chNext == '(') { // $(( is lexed as operator
sc.ChangeState(SCE_SH_OPERATOR);
}
} else {
continue; // scalar has no delimiter pair
}
// fallthrough, open delim for $[{'"(`]
Quote.Start(sc.ch);
} else if (sc.Match('<', '<')) {
sc.SetState(SCE_SH_HERE_DELIM);
HereDoc.State = 0;
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)) {
sc.SetState(SCE_SH_OPERATOR);
} }
} }
if (state == SCE_SH_ERROR) {
break;
}
chPrev = ch;
} }
styler.ColourTo(lengthDoc - 1, state); sc.Complete();
} }
static bool IsCommentLine(int line, Accessor &styler) { static bool IsCommentLine(int line, Accessor &styler) {
@@ -621,7 +474,7 @@ static bool IsCommentLine(int line, Accessor &styler) {
} }
static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[], static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) { Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
@@ -637,16 +490,16 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
int style = styleNext; int style = styleNext;
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
// Comment folding // Comment folding
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler)) if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
{ {
if (!IsCommentLine(lineCurrent - 1, styler) if (!IsCommentLine(lineCurrent - 1, styler)
&& IsCommentLine(lineCurrent + 1, styler)) && IsCommentLine(lineCurrent + 1, styler))
levelCurrent++; levelCurrent++;
else if (IsCommentLine(lineCurrent - 1, styler) else if (IsCommentLine(lineCurrent - 1, styler)
&& !IsCommentLine(lineCurrent+1, styler)) && !IsCommentLine(lineCurrent + 1, styler))
levelCurrent--; levelCurrent--;
} }
if (style == SCE_SH_OPERATOR) { if (style == SCE_SH_OPERATOR) {
if (ch == '{') { if (ch == '{') {
levelCurrent++; levelCurrent++;

View File

@@ -0,0 +1,368 @@
// 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 <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#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(unsigned int start,
unsigned int end,
Accessor &styler,
char *s,
unsigned int len) {
unsigned int 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, unsigned int end, unsigned int attr) {
styler.ColourTo(end, attr);
}
static int classifyWordCOBOL(unsigned int start, unsigned int 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];
getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
if (isdigit(s[0]) || (s[0] == '.')) {
chAttr = SCE_C_NUMBER;
char *p = s + 1;
while (*p) {
if (!isdigit(*p) && 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(unsigned int startPos, int 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];
unsigned int lengthDoc = startPos + length;
int nContainment;
int 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 (unsigned int 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 == '$' && isalpha(chNext))) {
ColourTo(styler, i-1, state);
state = SCE_C_IDENTIFIER;
} 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<unsigned int>(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(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int 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 (unsigned int 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);

View File

@@ -58,15 +58,21 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
WordList &keywords3 = *keywordlists[2]; WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3]; WordList &keywords4 = *keywordlists[3];
// property styling.within.preprocessor
// 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).
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0; bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-"); CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-"); CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-");
CharacterSet setDoxygen(CharacterSet::setLower, "$@\\&<>#{}[]"); CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true); CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
// property lexer.cpp.allow.dollars
// Set to 0 to disallow the '$' character in identifiers with the cpp lexer.
if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) { if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) {
setWordStart.Add('$'); setWordStart.Add('$');
setWord.Add('$'); setWord.Add('$');
@@ -77,6 +83,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
bool lastWordWasUUID = false; bool lastWordWasUUID = false;
int styleBeforeDCKeyword = SCE_C_DEFAULT; int styleBeforeDCKeyword = SCE_C_DEFAULT;
bool continuationLine = false; bool continuationLine = false;
bool isIncludePreprocessor = false;
if (initStyle == SCE_C_PREPROCESSOR) { if (initStyle == SCE_C_PREPROCESSOR) {
// Set continuationLine if last character of previous line is '\' // Set continuationLine if last character of previous line is '\'
@@ -118,6 +125,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
// if different sets of lines lexed. // if different sets of lines lexed.
visibleChars = 0; visibleChars = 0;
lastWordWasUUID = false; lastWordWasUUID = false;
isIncludePreprocessor = false;
} }
// Handle line continuation generically. // Handle line continuation generically.
@@ -230,6 +238,11 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
case SCE_C_STRING: case SCE_C_STRING:
if (sc.atLineEnd) { if (sc.atLineEnd) {
sc.ChangeState(SCE_C_STRINGEOL); sc.ChangeState(SCE_C_STRINGEOL);
} else if (isIncludePreprocessor) {
if (sc.ch == '>') {
sc.ForwardSetState(SCE_C_DEFAULT);
isIncludePreprocessor = false;
}
} else if (sc.ch == '\\') { } else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward(); sc.Forward();
@@ -321,6 +334,9 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_C_REGEX); // JavaScript's RegEx sc.SetState(SCE_C_REGEX); // JavaScript's RegEx
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
sc.SetState(SCE_C_STRING); sc.SetState(SCE_C_STRING);
isIncludePreprocessor = false; // ensure that '>' won't end the string
} else if (isIncludePreprocessor && sc.ch == '<') {
sc.SetState(SCE_C_STRING);
} else if (sc.ch == '\'') { } else if (sc.ch == '\'') {
sc.SetState(SCE_C_CHARACTER); sc.SetState(SCE_C_CHARACTER);
} else if (sc.ch == '#' && visibleChars == 0) { } else if (sc.ch == '#' && visibleChars == 0) {
@@ -332,6 +348,8 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
} while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()); } while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
if (sc.atLineEnd) { if (sc.atLineEnd) {
sc.SetState(SCE_C_DEFAULT); sc.SetState(SCE_C_DEFAULT);
} else if (sc.Match("include")) {
isIncludePreprocessor = true;
} }
} else if (isoperator(static_cast<char>(sc.ch))) { } else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_C_OPERATOR); sc.SetState(SCE_C_OPERATOR);
@@ -359,10 +377,24 @@ static bool IsStreamCommentStyle(int style) {
// and to make it possible to fiddle the current level for "} else {". // and to make it possible to fiddle the current level for "} else {".
static void FoldCppDoc(unsigned int startPos, int length, int initStyle, static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) { WordList *[], Accessor &styler) {
// property fold.comment
// 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.
bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
// property fold.preprocessor
// This option enables folding preprocessor directives when using the C++ lexer.
// Includes C#'s explicit #region and #endregion folding directives.
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// property fold.at.else
// This option enables C++ folding on a "} else {" line of an if statement.
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0; bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
int visibleChars = 0; int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
@@ -424,7 +456,9 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
levelNext--; levelNext--;
} }
} }
if (atEOL) { if (!IsASpace(ch))
visibleChars++;
if (atEOL || (i == endPos-1)) {
int levelUse = levelCurrent; int levelUse = levelCurrent;
if (foldAtElse) { if (foldAtElse) {
levelUse = levelMinCurrent; levelUse = levelMinCurrent;
@@ -440,10 +474,12 @@ static void FoldCppDoc(unsigned int startPos, int length, int initStyle,
lineCurrent++; lineCurrent++;
levelCurrent = levelNext; levelCurrent = levelNext;
levelMinCurrent = levelCurrent; levelMinCurrent = levelCurrent;
if (atEOL && (i == static_cast<unsigned int>(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; visibleChars = 0;
} }
if (!IsASpace(ch))
visibleChars++;
} }
} }

View File

@@ -28,11 +28,16 @@ using namespace Scintilla;
static inline bool IsAWordChar(const unsigned int ch) { static inline bool IsAWordChar(const unsigned int ch) {
return (isalnum(ch) || ch == '-' || ch == '_' || ch >= 161); // _ is not in fact correct CSS word-character /* 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 char ch) { inline bool IsCssOperator(const int ch) {
if (!isalnum(ch) && if (!((ch < 0x80) && isalnum(ch)) &&
(ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' || (ch == '{' || ch == '}' || ch == ':' || ch == ',' || ch == ';' ||
ch == '.' || ch == '#' || ch == '!' || ch == '@' || ch == '.' || ch == '#' || ch == '!' || ch == '@' ||
/* CSS2 */ /* CSS2 */
@@ -44,15 +49,21 @@ inline bool IsCssOperator(const char ch) {
} }
static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0]; WordList &css1Props = *keywordlists[0];
WordList &pseudoClasses = *keywordlists[1]; WordList &pseudoClasses = *keywordlists[1];
WordList &keywords2 = *keywordlists[2]; 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); StyleContext sc(startPos, length, initStyle, styler);
int lastState = -1; // before operator int lastState = -1; // before operator
int lastStateC = -1; // before comment int lastStateC = -1; // before comment
int op = ' '; // last operator int op = ' '; // last operator
int opPrev = ' '; // last operator
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
if (sc.state == SCE_CSS_COMMENT && sc.Match('*', '/')) { if (sc.state == SCE_CSS_COMMENT && sc.Match('*', '/')) {
@@ -64,6 +75,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) { if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) {
if (lastStateC == SCE_CSS_OPERATOR) { if (lastStateC == SCE_CSS_OPERATOR) {
op = styler.SafeGetCharAt(i-1); op = styler.SafeGetCharAt(i-1);
opPrev = styler.SafeGetCharAt(i-2);
while (--i) { while (--i) {
lastState = styler.StyleAt(i-1); lastState = styler.StyleAt(i-1);
if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT) if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT)
@@ -100,6 +112,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (op == ' ') { if (op == ' ') {
unsigned int i = startPos; unsigned int i = startPos;
op = styler.SafeGetCharAt(i-1); op = styler.SafeGetCharAt(i-1);
opPrev = styler.SafeGetCharAt(i-2);
while (--i) { while (--i) {
lastState = styler.StyleAt(i-1); lastState = styler.StyleAt(i-1);
if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT) if (lastState != SCE_CSS_OPERATOR && lastState != SCE_CSS_COMMENT)
@@ -111,19 +124,15 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (lastState == SCE_CSS_DEFAULT) if (lastState == SCE_CSS_DEFAULT)
sc.SetState(SCE_CSS_DIRECTIVE); sc.SetState(SCE_CSS_DIRECTIVE);
break; break;
case '*':
if (lastState == SCE_CSS_DEFAULT)
sc.SetState(SCE_CSS_TAG);
break;
case '>': case '>':
case '+': case '+':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_CLASS if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
|| lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_DEFAULT); sc.SetState(SCE_CSS_DEFAULT);
break; break;
case '[': case '[':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_ATTRIBUTE); sc.SetState(SCE_CSS_ATTRIBUTE);
break; break;
case ']': case ']':
@@ -138,27 +147,44 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
break; break;
case '}': case '}':
if (lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT || if (lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_VALUE || lastState == SCE_CSS_IMPORTANT ||
lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2) lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 || lastState == SCE_CSS_IDENTIFIER3)
sc.SetState(SCE_CSS_DEFAULT); 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 ':': case ':':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) 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_PSEUDOCLASS); sc.SetState(SCE_CSS_PSEUDOCLASS);
else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 || lastState == SCE_CSS_UNKNOWN_IDENTIFIER) else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_IDENTIFIER2 ||
lastState == SCE_CSS_IDENTIFIER3 || lastState == SCE_CSS_EXTENDED_IDENTIFIER ||
lastState == SCE_CSS_UNKNOWN_IDENTIFIER)
sc.SetState(SCE_CSS_VALUE); sc.SetState(SCE_CSS_VALUE);
break; break;
case '.': case '.':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_CLASS); sc.SetState(SCE_CSS_CLASS);
break; break;
case '#': case '#':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS) lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_EXTENDED_PSEUDOCLASS || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_ID); sc.SetState(SCE_CSS_ID);
break; break;
case ',': case ',':
case '|':
case '~':
if (lastState == SCE_CSS_TAG) if (lastState == SCE_CSS_TAG)
sc.SetState(SCE_CSS_DEFAULT); sc.SetState(SCE_CSS_DEFAULT);
break; break;
@@ -181,11 +207,19 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
continue; continue;
} }
if (sc.ch == '*' && sc.state == SCE_CSS_DEFAULT) {
sc.SetState(SCE_CSS_TAG);
continue;
}
if (IsAWordChar(sc.chPrev) && ( if (IsAWordChar(sc.chPrev) && (
sc.state == SCE_CSS_IDENTIFIER || sc.state == SCE_CSS_IDENTIFIER2 sc.state == SCE_CSS_IDENTIFIER || sc.state == SCE_CSS_IDENTIFIER2 ||
|| sc.state == SCE_CSS_UNKNOWN_IDENTIFIER sc.state == SCE_CSS_IDENTIFIER3 || sc.state == SCE_CSS_EXTENDED_IDENTIFIER ||
|| sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS sc.state == SCE_CSS_UNKNOWN_IDENTIFIER ||
|| sc.state == SCE_CSS_IMPORTANT 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
)) { )) {
char s[100]; char s[100];
sc.GetCurrentLowered(s, sizeof(s)); sc.GetCurrentLowered(s, sizeof(s));
@@ -194,27 +228,36 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
s2++; s2++;
switch (sc.state) { switch (sc.state) {
case SCE_CSS_IDENTIFIER: case SCE_CSS_IDENTIFIER:
if (!keywords.InList(s2)) { case SCE_CSS_IDENTIFIER2:
if (keywords2.InList(s2)) { case SCE_CSS_IDENTIFIER3:
sc.ChangeState(SCE_CSS_IDENTIFIER2); case SCE_CSS_EXTENDED_IDENTIFIER:
} else {
sc.ChangeState(SCE_CSS_UNKNOWN_IDENTIFIER);
}
}
break;
case SCE_CSS_UNKNOWN_IDENTIFIER: case SCE_CSS_UNKNOWN_IDENTIFIER:
if (keywords.InList(s2)) if (css1Props.InList(s2))
sc.ChangeState(SCE_CSS_IDENTIFIER); sc.ChangeState(SCE_CSS_IDENTIFIER);
else if (keywords2.InList(s2)) else if (css2Props.InList(s2))
sc.ChangeState(SCE_CSS_IDENTIFIER2); 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; break;
case SCE_CSS_PSEUDOCLASS: case SCE_CSS_PSEUDOCLASS:
if (!pseudoClasses.InList(s2)) case SCE_CSS_PSEUDOELEMENT:
sc.ChangeState(SCE_CSS_UNKNOWN_PSEUDOCLASS); case SCE_CSS_EXTENDED_PSEUDOCLASS:
break; case SCE_CSS_EXTENDED_PSEUDOELEMENT:
case SCE_CSS_UNKNOWN_PSEUDOCLASS: case SCE_CSS_UNKNOWN_PSEUDOCLASS:
if (pseudoClasses.InList(s2)) if (op == ':' && opPrev != ':' && pseudoClasses.InList(s2))
sc.ChangeState(SCE_CSS_PSEUDOCLASS); 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; break;
case SCE_CSS_IMPORTANT: case SCE_CSS_IMPORTANT:
if (strcmp(s2, "important") != 0) if (strcmp(s2, "important") != 0)
@@ -223,7 +266,14 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
} }
} }
if (sc.ch != '.' && sc.ch != ':' && sc.ch != '#' && (sc.state == SCE_CSS_CLASS || sc.state == SCE_CSS_PSEUDOCLASS || sc.state == SCE_CSS_UNKNOWN_PSEUDOCLASS || sc.state == SCE_CSS_ID)) 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); sc.SetState(SCE_CSS_TAG);
if (sc.Match('/', '*')) { if (sc.Match('/', '*')) {
@@ -232,7 +282,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.Forward(); sc.Forward();
} else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) { } else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) {
sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING)); sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING));
} else if (IsCssOperator(static_cast<char>(sc.ch)) } else if (IsCssOperator(sc.ch)
&& (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']') && (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']')
&& (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!') && (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!')
&& (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{') && (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{')
@@ -241,6 +291,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
lastState = sc.state; lastState = sc.state;
sc.SetState(SCE_CSS_OPERATOR); sc.SetState(SCE_CSS_OPERATOR);
op = sc.ch; op = sc.ch;
opPrev = sc.chPrev;
} }
} }
@@ -298,9 +349,14 @@ static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Acc
} }
static const char * const cssWordListDesc[] = { static const char * const cssWordListDesc[] = {
"CSS1 Keywords", "CSS1 Properties",
"Pseudo classes", "Pseudo-classes",
"CSS2 Keywords", "CSS2 Properties",
"CSS3 Properties",
"Pseudo-elements",
"Browser-Specific CSS Properties",
"Browser-Specific Pseudo-classes",
"Browser-Specific Pseudo-elements",
0 0
}; };

View File

@@ -2,7 +2,7 @@
/** @file LexCaml.cxx /** @file LexCaml.cxx
** Lexer for Objective Caml. ** Lexer for Objective Caml.
**/ **/
// Copyright 2005 by Robert Roessler <robertr@rftp.com> // Copyright 2005-2009 by Robert Roessler <robertr@rftp.com>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
/* Release History /* Release History
20050204 Initial release. 20050204 Initial release.
@@ -15,6 +15,7 @@
20051125 Added 2nd "optional" keywords class. 20051125 Added 2nd "optional" keywords class.
20051129 Support "magic" (read-only) comments for RCaml. 20051129 Support "magic" (read-only) comments for RCaml.
20051204 Swtich to using StyleContext infrastructure. 20051204 Swtich to using StyleContext infrastructure.
20090629 Add full Standard ML '97 support.
*/ */
#include <stdlib.h> #include <stdlib.h>
@@ -26,6 +27,7 @@
#include "Platform.h" #include "Platform.h"
#include "PropSet.h" #include "PropSet.h"
#include "PropSetSimple.h"
#include "Accessor.h" #include "Accessor.h"
#include "StyleContext.h" #include "StyleContext.h"
#include "KeyWords.h" #include "KeyWords.h"
@@ -35,7 +37,6 @@
// Since the Microsoft __iscsym[f] funcs are not ANSI... // Since the Microsoft __iscsym[f] funcs are not ANSI...
inline int iscaml(int c) {return isalnum(c) || c == '_';} inline int iscaml(int c) {return isalnum(c) || c == '_';}
inline int iscamlf(int c) {return isalpha(c) || c == '_';} inline int iscamlf(int c) {return isalpha(c) || c == '_';}
inline int iscamld(int c) {return isdigit(c) || c == '_';}
static const int baseT[24] = { static const int baseT[24] = {
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* A - L */ 0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* A - L */
@@ -143,7 +144,7 @@ static void InternalLexOrFold(int foldOrLex, unsigned int startPos, int length,
int initStyle, char *words[], WindowID window, char *props) int initStyle, char *words[], WindowID window, char *props)
{ {
// create and initialize a WindowAccessor (including contained PropSet) // create and initialize a WindowAccessor (including contained PropSet)
PropSet ps; PropSetSimple ps;
ps.SetMultiple(props); ps.SetMultiple(props);
WindowAccessor wa(window, ps); WindowAccessor wa(window, ps);
// create and initialize WordList(s) // create and initialize WordList(s)
@@ -179,25 +180,27 @@ void ColouriseCamlDoc(
{ {
// initialize styler // initialize styler
StyleContext sc(startPos, length, initStyle, styler); StyleContext sc(startPos, length, initStyle, styler);
// set up [initial] state info (terminating states that shouldn't "bleed")
int nesting = 0;
if (sc.state < SCE_CAML_STRING)
sc.state = SCE_CAML_DEFAULT;
if (sc.state >= SCE_CAML_COMMENT)
nesting = (sc.state & 0x0f) - SCE_CAML_COMMENT;
int chBase = 0, chToken = 0, chLit = 0; int chBase = 0, chToken = 0, chLit = 0;
WordList& keywords = *keywordlists[0]; WordList& keywords = *keywordlists[0];
WordList& keywords2 = *keywordlists[1]; WordList& keywords2 = *keywordlists[1];
WordList& keywords3 = *keywordlists[2]; WordList& keywords3 = *keywordlists[2];
const bool isSML = keywords.InList("andalso");
const int useMagic = styler.GetPropertyInt("lexer.caml.magic", 0); 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... // foreach char in range...
while (sc.More()) { while (sc.More()) {
// set up [per-char] state info // set up [per-char] state info
int state2 = -1; // (ASSUME no state change) int state2 = -1; // (ASSUME no state change)
int chColor = sc.currentPos - 1;// (ASSUME standard coloring range) int chColor = sc.currentPos - 1;// (ASSUME standard coloring range)
bool advance = true; // (ASSUME scanner "eats" 1 char) bool advance = true; // (ASSUME scanner "eats" 1 char)
// step state machine // step state machine
switch (sc.state & 0x0f) { switch (sc.state & 0x0f) {
@@ -206,25 +209,38 @@ void ColouriseCamlDoc(
// it's wide open; what do we have? // it's wide open; what do we have?
if (iscamlf(sc.ch)) if (iscamlf(sc.ch))
state2 = SCE_CAML_IDENTIFIER; state2 = SCE_CAML_IDENTIFIER;
else if (sc.Match('`') && iscamlf(sc.chNext)) else if (!isSML && sc.Match('`') && iscamlf(sc.chNext))
state2 = SCE_CAML_TAGNAME; state2 = SCE_CAML_TAGNAME;
else if (sc.Match('#') && isdigit(sc.chNext)) else if (!isSML && sc.Match('#') && isdigit(sc.chNext))
state2 = SCE_CAML_LINENUM; state2 = SCE_CAML_LINENUM;
else if (isdigit(sc.ch)) { else if (isdigit(sc.ch)) {
// it's a number, assume base 10
state2 = SCE_CAML_NUMBER, chBase = 10; state2 = SCE_CAML_NUMBER, chBase = 10;
if (sc.Match('0') && strchr("bBoOxX", sc.chNext)) if (sc.Match('0')) {
chBase = baseT[tolower(sc.chNext) - 'a'], sc.Forward(); // there MAY be a base specified...
} else if (sc.Match('\'')) /* (char literal?) */ 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; state2 = SCE_CAML_CHAR, chLit = 0;
else if (sc.Match('\"')) else if (isSML && sc.Match('#', '"')) // (SML char literal?)
state2 = SCE_CAML_CHAR, sc.Forward();
else if (sc.Match('"'))
state2 = SCE_CAML_STRING; state2 = SCE_CAML_STRING;
else if (sc.Match('(', '*')) else if (sc.Match('(', '*'))
state2 = SCE_CAML_COMMENT, state2 = SCE_CAML_COMMENT, sc.Forward(), sc.ch = ' '; // (*)...
sc.ch = ' ', // (make SURE "(*)" isn't seen as a closed comment) else if (strchr("!?~" /* Caml "prefix-symbol" */
sc.Forward(); "=<>@^|&+-*/$%" /* Caml "infix-symbol" */
else if (strchr("!?~" /* Caml "prefix-symbol" */ "()[]{};,:.#", sc.ch) // Caml "bracket" or ;,:.#
"=<>@^|&+-*/$%" /* Caml "infix-symbol" */ // SML "extra" ident chars
"()[]{};,:.#", sc.ch)) /* Caml "bracket" or ;,:.# */ || (isSML && (sc.Match('\\') || sc.Match('`'))))
state2 = SCE_CAML_OPERATOR; state2 = SCE_CAML_OPERATOR;
break; break;
@@ -273,9 +289,12 @@ void ColouriseCamlDoc(
case SCE_CAML_OPERATOR: { case SCE_CAML_OPERATOR: {
// [try to] interpret as [additional] operator char // [try to] interpret as [additional] operator char
const char* o = 0; const char* o = 0;
if (iscaml(sc.ch) || isspace(sc.ch) /* ident or whitespace */ if (iscaml(sc.ch) || isspace(sc.ch) // ident or whitespace
|| (o = strchr(")]};,\'\"`#", sc.ch),o)/* "termination" chars */ || (o = strchr(")]};,\'\"#", sc.ch),o) // "termination" chars
|| !strchr("!$%&*+-./:<=>?@^|~", sc.ch)/* "operator" 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 // check for INCLUSIVE termination
if (o && strchr(")]};,", sc.ch)) { if (o && strchr(")]};,", sc.ch)) {
if ((sc.Match(')') && sc.chPrev == '(') if ((sc.Match(')') && sc.chPrev == '(')
@@ -292,24 +311,27 @@ void ColouriseCamlDoc(
case SCE_CAML_NUMBER: case SCE_CAML_NUMBER:
// [try to] interpret as [additional] numeric literal char // [try to] interpret as [additional] numeric literal char
// N.B. - improperly accepts "extra" digits in base 2 or 8 literals if ((!isSML && sc.Match('_')) || IsADigit(sc.ch, chBase))
if (iscamld(sc.ch) || IsADigit(sc.ch, chBase))
break; break;
// how about an integer suffix? // how about an integer suffix?
if ((sc.Match('l') || sc.Match('L') || sc.Match('n')) if (!isSML && (sc.Match('l') || sc.Match('L') || sc.Match('n'))
&& (iscamld(sc.chPrev) || IsADigit(sc.chPrev, chBase))) && (sc.chPrev == '_' || IsADigit(sc.chPrev, chBase)))
break; break;
// or a floating-point literal? // or a floating-point literal?
if (chBase == 10) { if (chBase == 10) {
// with a decimal point? // with a decimal point?
if (sc.Match('.') && iscamld(sc.chPrev)) if (sc.Match('.')
&& ((!isSML && sc.chPrev == '_')
|| IsADigit(sc.chPrev, chBase)))
break; break;
// with an exponent? (I) // with an exponent? (I)
if ((sc.Match('e') || sc.Match('E')) if ((sc.Match('e') || sc.Match('E'))
&& (iscamld(sc.chPrev) || sc.chPrev == '.')) && ((!isSML && (sc.chPrev == '.' || sc.chPrev == '_'))
|| IsADigit(sc.chPrev, chBase)))
break; break;
// with an exponent? (II) // with an exponent? (II)
if ((sc.Match('+') || sc.Match('-')) if (((!isSML && (sc.Match('+') || sc.Match('-')))
|| (isSML && sc.Match('~')))
&& (sc.chPrev == 'e' || sc.chPrev == 'E')) && (sc.chPrev == 'e' || sc.chPrev == 'E'))
break; break;
} }
@@ -318,29 +340,56 @@ void ColouriseCamlDoc(
break; break;
case SCE_CAML_CHAR: case SCE_CAML_CHAR:
// [try to] interpret as [additional] char literal char if (!isSML) {
if (sc.Match('\\')) { // [try to] interpret as [additional] char literal char
chLit = 1; // (definitely IS a char literal) if (sc.Match('\\')) {
if (sc.chPrev == '\\') chLit = 1; // (definitely IS a char literal)
sc.ch = ' '; // (so termination test isn't fooled) if (sc.chPrev == '\\')
// should we be terminating - one way or another? sc.ch = ' '; // (...\\')
} else if ((sc.Match('\'') && sc.chPrev != '\\') || sc.atLineEnd) { // should we be terminating - one way or another?
state2 = SCE_CAML_DEFAULT; } else if ((sc.Match('\'') && sc.chPrev != '\\')
if (sc.Match('\'')) || sc.atLineEnd) {
chColor++; state2 = SCE_CAML_DEFAULT;
else if (sc.Match('\''))
sc.ChangeState(SCE_CAML_IDENTIFIER); chColor++;
// ... maybe a char literal, maybe not else
} else if (chLit < 1 && sc.currentPos - chToken >= 2) sc.ChangeState(SCE_CAML_IDENTIFIER);
sc.ChangeState(SCE_CAML_IDENTIFIER), advance = false; // ... maybe a char literal, maybe not
break; } 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) */
case SCE_CAML_STRING: case SCE_CAML_STRING:
// [try to] interpret as [additional] string literal char // [try to] interpret as [additional] [SML char/] string literal char
if (sc.Match('\\') && sc.chPrev == '\\') if (isSML && sc.Match('\\') && sc.chPrev != '\\' && isspace(sc.chNext))
sc.ch = ' '; // (so '\\' doesn't cause us trouble) state2 = SCE_CAML_WHITE;
else if (sc.Match('\"') && sc.chPrev != '\\') else if (sc.Match('\\') && sc.chPrev == '\\')
state2 = SCE_CAML_DEFAULT, chColor++; 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
int 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; break;
case SCE_CAML_COMMENT: case SCE_CAML_COMMENT:
@@ -350,8 +399,7 @@ void ColouriseCamlDoc(
// we're IN a comment - does this start a NESTED comment? // we're IN a comment - does this start a NESTED comment?
if (sc.Match('(', '*')) if (sc.Match('(', '*'))
state2 = sc.state + 1, chToken = sc.currentPos, state2 = sc.state + 1, chToken = sc.currentPos,
sc.ch = ' ', // (make SURE "(*)" isn't seen as a closed comment) sc.Forward(), sc.ch = ' ' /* (*)... */, nesting++;
sc.Forward(), nesting++;
// [try to] interpret as [additional] comment char // [try to] interpret as [additional] comment char
else if (sc.Match(')') && sc.chPrev == '*') { else if (sc.Match(')') && sc.chPrev == '*') {
if (nesting) if (nesting)
@@ -366,7 +414,7 @@ void ColouriseCamlDoc(
break; break;
} }
// handle state change and char coloring as required // handle state change and char coloring AS REQUIRED
if (state2 >= 0) if (state2 >= 0)
styler.ColourTo(chColor, sc.state), sc.ChangeState(state2); styler.ColourTo(chColor, sc.state), sc.ChangeState(state2);
// move to next char UNLESS re-scanning current char // move to next char UNLESS re-scanning current char

View File

@@ -13,6 +13,7 @@
#include "Platform.h" #include "Platform.h"
#include "CharClassify.h"
#include "PropSet.h" #include "PropSet.h"
#include "Accessor.h" #include "Accessor.h"
#include "KeyWords.h" #include "KeyWords.h"

View File

@@ -25,20 +25,20 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
/*/ Nested comments require keeping the value of the nesting level for every /* Nested comments require keeping the value of the nesting level for every
position in the document. But since scintilla always styles line by line, 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 we only need to store one value per line. The non-negative number indicates
nesting level at the end of the line. nesting level at the end of the line.
/*/ */
// We use custom qualifiers since it is not clear what D allows. // Underscore, letter, digit and universal alphas from C99 Appendix D.
static bool IsWordStart(int ch) { static bool IsWordStart(int ch) {
return isascii(ch) && (isalpha(ch) || ch == '_'); return (isascii(ch) && (isalpha(ch) || ch == '_')) || !isascii(ch);
} }
static bool IsWord(int ch) { static bool IsWord(int ch) {
return isascii(ch) && (isalnum(ch) || ch == '_'); return (isascii(ch) && (isalnum(ch) || ch == '_')) || !isascii(ch);
} }
static bool IsDoxygen(int ch) { static bool IsDoxygen(int ch) {
@@ -51,308 +51,349 @@ static bool IsDoxygen(int ch) {
return false; return false;
} }
static bool IsStringSuffix(int ch) {
return ch == 'c' || ch == 'w' || ch == 'd';
}
static void ColouriseDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler, bool caseSensitive) {
WordList &keywords = *keywordlists[0]; static void ColouriseDoc(unsigned int startPos, int length, int initStyle,
WordList &keywords2 = *keywordlists[1]; WordList *keywordlists[], Accessor &styler, bool caseSensitive) {
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
int styleBeforeDCKeyword = SCE_D_DEFAULT; WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2]; //doxygen
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
StyleContext sc(startPos, length, initStyle, styler); int styleBeforeDCKeyword = SCE_D_DEFAULT;
int curLine = styler.GetLine(startPos); StyleContext sc(startPos, length, initStyle, styler);
int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0;
for (; sc.More(); sc.Forward()) { int curLine = styler.GetLine(startPos);
int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0;
bool numFloat = false; // Float literals have '+' and '-' signs
bool numHex = false;
if (sc.atLineStart) { for (; sc.More(); sc.Forward()) {
if (sc.state == SCE_D_STRING) {
// Prevent SCE_D_STRINGEOL from leaking back to previous line which
// ends with a line continuation by locking in the state upto this position.
sc.SetState(SCE_D_STRING);
}
curLine = styler.GetLine(sc.currentPos);
styler.SetLineState(curLine, curNcLevel);
}
// Handle line continuation generically. if (sc.atLineStart) {
if (sc.ch == '\\') { curLine = styler.GetLine(sc.currentPos);
if (sc.chNext == '\n' || sc.chNext == '\r') { styler.SetLineState(curLine, curNcLevel);
sc.Forward(); }
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
continue;
}
}
// Determine if the current state should terminate. // Determine if the current state should terminate.
switch (sc.state) { switch (sc.state) {
case SCE_D_OPERATOR: case SCE_D_OPERATOR:
sc.SetState(SCE_D_DEFAULT); sc.SetState(SCE_D_DEFAULT);
break; break;
case SCE_D_NUMBER: case SCE_D_NUMBER:
// We accept almost anything because of hex. and number suffixes // We accept almost anything because of hex. and number suffixes
if (!IsWord(sc.ch) && sc.ch != '.') { if (isascii(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) {
sc.SetState(SCE_D_DEFAULT); continue;
} } else if (sc.ch == '.' && sc.chNext != '.' && !numFloat) {
break; // Don't parse 0..2 as number.
case SCE_D_IDENTIFIER: numFloat=true;
if (!IsWord(sc.ch)) { continue;
char s[1000]; } else if ( ( sc.ch == '-' || sc.ch == '+' ) && ( /*sign and*/
if (caseSensitive) { ( !numHex && ( sc.chPrev == 'e' || sc.chPrev == 'E' ) ) || /*decimal or*/
sc.GetCurrent(s, sizeof(s)); ( sc.chPrev == 'p' || sc.chPrev == 'P' ) ) ) { /*hex*/
} else { // Parse exponent sign in float literals: 2e+10 0x2e+10
sc.GetCurrentLowered(s, sizeof(s)); continue;
} } else {
if (keywords.InList(s)) { sc.SetState(SCE_D_DEFAULT);
sc.ChangeState(SCE_D_WORD); }
} else if (keywords2.InList(s)) { break;
sc.ChangeState(SCE_D_WORD2); case SCE_D_IDENTIFIER:
} else if (keywords4.InList(s)) { if (!IsWord(sc.ch)) {
sc.ChangeState(SCE_D_TYPEDEF); char s[1000];
} if (caseSensitive) {
sc.SetState(SCE_D_DEFAULT); sc.GetCurrent(s, sizeof(s));
} } else {
break; sc.GetCurrentLowered(s, sizeof(s));
case SCE_D_COMMENT: }
if (sc.Match('*', '/')) { if (keywords.InList(s)) {
sc.Forward(); sc.ChangeState(SCE_D_WORD);
sc.ForwardSetState(SCE_D_DEFAULT); } else if (keywords2.InList(s)) {
} sc.ChangeState(SCE_D_WORD2);
break; } else if (keywords4.InList(s)) {
case SCE_D_COMMENTDOC: sc.ChangeState(SCE_D_TYPEDEF);
if (sc.Match('*', '/')) { } else if (keywords5.InList(s)) {
sc.Forward(); sc.ChangeState(SCE_D_WORD5);
sc.ForwardSetState(SCE_D_DEFAULT); } else if (keywords6.InList(s)) {
} else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support sc.ChangeState(SCE_D_WORD6);
// Verify that we have the conditions to mark a comment-doc-keyword } else if (keywords7.InList(s)) {
if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { sc.ChangeState(SCE_D_WORD7);
styleBeforeDCKeyword = SCE_D_COMMENTDOC; }
sc.SetState(SCE_D_COMMENTDOCKEYWORD); sc.SetState(SCE_D_DEFAULT);
} }
} break;
break; case SCE_D_COMMENT:
case SCE_D_COMMENTLINE: if (sc.Match('*', '/')) {
if (sc.atLineStart) { sc.Forward();
sc.SetState(SCE_D_DEFAULT); sc.ForwardSetState(SCE_D_DEFAULT);
} }
break; break;
case SCE_D_COMMENTLINEDOC: case SCE_D_COMMENTDOC:
if (sc.atLineStart) { if (sc.Match('*', '/')) {
sc.SetState(SCE_D_DEFAULT); sc.Forward();
} else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support sc.ForwardSetState(SCE_D_DEFAULT);
// Verify that we have the conditions to mark a comment-doc-keyword } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { // Verify that we have the conditions to mark a comment-doc-keyword
styleBeforeDCKeyword = SCE_D_COMMENTLINEDOC; if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) {
sc.SetState(SCE_D_COMMENTDOCKEYWORD); styleBeforeDCKeyword = SCE_D_COMMENTDOC;
} sc.SetState(SCE_D_COMMENTDOCKEYWORD);
} }
break; }
case SCE_D_COMMENTDOCKEYWORD: break;
if ((styleBeforeDCKeyword == SCE_D_COMMENTDOC) && sc.Match('*', '/')) { case SCE_D_COMMENTLINE:
sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); if (sc.atLineStart) {
sc.Forward(); sc.SetState(SCE_D_DEFAULT);
sc.ForwardSetState(SCE_D_DEFAULT); }
} else if (!IsDoxygen(sc.ch)) { break;
char s[100]; case SCE_D_COMMENTLINEDOC:
if (caseSensitive) { if (sc.atLineStart) {
sc.GetCurrent(s, sizeof(s)); sc.SetState(SCE_D_DEFAULT);
} else { } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
sc.GetCurrentLowered(s, sizeof(s)); // Verify that we have the conditions to mark a comment-doc-keyword
} if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) {
if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { styleBeforeDCKeyword = SCE_D_COMMENTLINEDOC;
sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR); sc.SetState(SCE_D_COMMENTDOCKEYWORD);
} }
sc.SetState(styleBeforeDCKeyword); }
} break;
break; case SCE_D_COMMENTDOCKEYWORD:
case SCE_D_COMMENTNESTED: if ((styleBeforeDCKeyword == SCE_D_COMMENTDOC) && sc.Match('*', '/')) {
if (sc.Match('+', '/')) { sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR);
if (curNcLevel > 0) sc.Forward();
curNcLevel -= 1; sc.ForwardSetState(SCE_D_DEFAULT);
curLine = styler.GetLine(sc.currentPos); } else if (!IsDoxygen(sc.ch)) {
styler.SetLineState(curLine, curNcLevel); char s[100];
sc.Forward(); if (caseSensitive) {
if (curNcLevel == 0) { sc.GetCurrent(s, sizeof(s));
sc.ForwardSetState(SCE_D_DEFAULT); } else {
} sc.GetCurrentLowered(s, sizeof(s));
} }
else if (sc.Match('/','+')) { if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) {
curNcLevel += 1; sc.ChangeState(SCE_D_COMMENTDOCKEYWORDERROR);
curLine = styler.GetLine(sc.currentPos); }
styler.SetLineState(curLine, curNcLevel); sc.SetState(styleBeforeDCKeyword);
sc.Forward(); }
} break;
break; case SCE_D_COMMENTNESTED:
case SCE_D_STRING: if (sc.Match('+', '/')) {
if (sc.atLineEnd) { if (curNcLevel > 0)
sc.ChangeState(SCE_D_STRINGEOL); curNcLevel -= 1;
} else if (sc.ch == '\\') { curLine = styler.GetLine(sc.currentPos);
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { styler.SetLineState(curLine, curNcLevel);
sc.Forward(); sc.Forward();
} if (curNcLevel == 0) {
} else if (sc.ch == '\"') { sc.ForwardSetState(SCE_D_DEFAULT);
sc.ForwardSetState(SCE_D_DEFAULT); }
} } else if (sc.Match('/','+')) {
break; curNcLevel += 1;
case SCE_D_CHARACTER: curLine = styler.GetLine(sc.currentPos);
if (sc.atLineEnd) { styler.SetLineState(curLine, curNcLevel);
sc.ChangeState(SCE_D_STRINGEOL); sc.Forward();
} else if (sc.ch == '\\') { }
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { break;
sc.Forward(); case SCE_D_STRING:
} if (sc.ch == '\\') {
} else if (sc.ch == '\'') { if (sc.chNext == '"' || sc.chNext == '\\') {
sc.ForwardSetState(SCE_D_DEFAULT); sc.Forward();
} }
break; } else if (sc.ch == '"') {
case SCE_D_STRINGEOL: if(IsStringSuffix(sc.chNext))
if (sc.atLineStart) { sc.Forward();
sc.SetState(SCE_D_DEFAULT); sc.ForwardSetState(SCE_D_DEFAULT);
} }
break; 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. // Determine if a new state should be entered.
if (sc.state == SCE_D_DEFAULT) { if (sc.state == SCE_D_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_D_NUMBER); sc.SetState(SCE_D_NUMBER);
} else if (IsWordStart(sc.ch)) { numFloat = sc.ch == '.';
sc.SetState(SCE_D_IDENTIFIER); // Remember hex literal
} else if (sc.Match('/','+')) { numHex = sc.ch == '0' && ( sc.chNext == 'x' || sc.chNext == 'X' );
curNcLevel += 1; } else if ( (sc.ch == 'r' || sc.ch == 'x' || sc.ch == 'q')
curLine = styler.GetLine(sc.currentPos); && sc.chNext == '"' ) {
styler.SetLineState(curLine, curNcLevel); // Limited support for hex and delimited strings: parse as r""
sc.SetState(SCE_D_COMMENTNESTED); sc.SetState(SCE_D_STRINGR);
sc.Forward(); sc.Forward();
} else if (sc.Match('/', '*')) { } else if (IsWordStart(sc.ch) || sc.ch == '$') {
if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style sc.SetState(SCE_D_IDENTIFIER);
sc.SetState(SCE_D_COMMENTDOC); } else if (sc.Match('/','+')) {
} else { curNcLevel += 1;
sc.SetState(SCE_D_COMMENT); curLine = styler.GetLine(sc.currentPos);
} styler.SetLineState(curLine, curNcLevel);
sc.Forward(); // Eat the * so it isn't used for the end of the comment sc.SetState(SCE_D_COMMENTNESTED);
} else if (sc.Match('/', '/')) { sc.Forward();
if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!")) } else if (sc.Match('/', '*')) {
// Support of Qt/Doxygen doc. style if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style
sc.SetState(SCE_D_COMMENTLINEDOC); sc.SetState(SCE_D_COMMENTDOC);
else } else {
sc.SetState(SCE_D_COMMENTLINE); sc.SetState(SCE_D_COMMENT);
} else if (sc.ch == '\"') { }
sc.SetState(SCE_D_STRING); sc.Forward(); // Eat the * so it isn't used for the end of the comment
} else if (sc.ch == '\'') { } else if (sc.Match('/', '/')) {
sc.SetState(SCE_D_CHARACTER); if ((sc.Match("///") && !sc.Match("////")) || sc.Match("//!"))
} else if (isoperator(static_cast<char>(sc.ch))) { // Support of Qt/Doxygen doc. style
sc.SetState(SCE_D_OPERATOR); sc.SetState(SCE_D_COMMENTLINEDOC);
} else
} sc.SetState(SCE_D_COMMENTLINE);
} } else if (sc.ch == '"') {
sc.Complete(); 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();
} }
static bool IsStreamCommentStyle(int style) { static bool IsStreamCommentStyle(int style) {
return style == SCE_D_COMMENT || return style == SCE_D_COMMENT ||
style == SCE_D_COMMENTDOC || style == SCE_D_COMMENTDOC ||
style == SCE_D_COMMENTDOCKEYWORD || style == SCE_D_COMMENTDOCKEYWORD ||
style == SCE_D_COMMENTDOCKEYWORDERROR; style == SCE_D_COMMENTDOCKEYWORDERROR;
} }
// Store both the current line's fold level and the next lines in the // 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 // level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {". // and to make it possible to fiddle the current level for "} else {".
static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &styler) { static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("lexer.d.fold.at.else",
// property lexer.d.fold.at.else
// This option enables D folding on a "} else {" line of an if statement.
bool foldAtElse = styler.GetPropertyInt("lexer.d.fold.at.else",
styler.GetPropertyInt("fold.at.else", 0)) != 0; styler.GetPropertyInt("fold.at.else", 0)) != 0;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
int visibleChars = 0; int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE; int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0) if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
int levelMinCurrent = levelCurrent; int levelMinCurrent = levelCurrent;
int levelNext = levelCurrent; int levelNext = levelCurrent;
char chNext = styler[startPos]; char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos); int styleNext = styler.StyleAt(startPos);
int style = initStyle; int style = initStyle;
for (unsigned int i = startPos; i < endPos; i++) { for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext; char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style; int stylePrev = style;
style = styleNext; style = styleNext;
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment && IsStreamCommentStyle(style)) { if (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) { if (!IsStreamCommentStyle(stylePrev)) {
levelNext++; levelNext++;
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) { } else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled. // Comments don't end at end of line and the next character may be unstyled.
levelNext--; levelNext--;
} }
} }
if (style == SCE_D_OPERATOR) { if (style == SCE_D_OPERATOR) {
if (ch == '{') { if (ch == '{') {
// Measure the minimum before a '{' to allow // Measure the minimum before a '{' to allow
// folding on "} else {" // folding on "} else {"
if (levelMinCurrent > levelNext) { if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext; levelMinCurrent = levelNext;
} }
levelNext++; levelNext++;
} else if (ch == '}') { } else if (ch == '}') {
levelNext--; levelNext--;
} }
} }
if (atEOL) { if (atEOL) {
if (foldComment) { // Handle nested comments if (foldComment) { // Handle nested comments
int nc; int nc;
nc = styler.GetLineState(lineCurrent); nc = styler.GetLineState(lineCurrent);
nc -= lineCurrent>0? styler.GetLineState(lineCurrent-1): 0; nc -= lineCurrent>0? styler.GetLineState(lineCurrent-1): 0;
levelNext += nc; levelNext += nc;
} }
int levelUse = levelCurrent; int levelUse = levelCurrent;
if (foldAtElse) { if (foldAtElse) {
levelUse = levelMinCurrent; levelUse = levelMinCurrent;
} }
int lev = levelUse | levelNext << 16; int lev = levelUse | levelNext << 16;
if (visibleChars == 0 && foldCompact) if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG; lev |= SC_FOLDLEVELWHITEFLAG;
if (levelUse < levelNext) if (levelUse < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG; lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) { if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev); styler.SetLevel(lineCurrent, lev);
} }
lineCurrent++; lineCurrent++;
levelCurrent = levelNext; levelCurrent = levelNext;
levelMinCurrent = levelCurrent; levelMinCurrent = levelCurrent;
visibleChars = 0; visibleChars = 0;
} }
if (!IsASpace(ch)) if (!IsASpace(ch))
visibleChars++; visibleChars++;
} }
} }
static void FoldDDoc(unsigned int startPos, int length, int initStyle, static void FoldDDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) { WordList *[], Accessor &styler) {
FoldDoc(startPos, length, initStyle, styler); FoldDoc(startPos, length, initStyle, styler);
} }
static const char * const dWordLists[] = { static const char * const dWordLists[] = {
"Primary keywords and identifiers", "Primary keywords and identifiers",
"Secondary keywords and identifiers", "Secondary keywords and identifiers",
"Documentation comment keywords", "Documentation comment keywords",
"Type definitions and aliases", "Type definitions and aliases",
0, "Keywords 5",
}; "Keywords 6",
"Keywords 7",
0,
};
static void ColouriseDDoc(unsigned int startPos, int length, static void ColouriseDDoc(unsigned int startPos, int length,
int initStyle, WordList *keywordlists[], Accessor &styler) { int initStyle, WordList *keywordlists[], Accessor &styler) {
ColouriseDoc(startPos, length, initStyle, keywordlists, styler, true); ColouriseDoc(startPos, length, initStyle, keywordlists, styler, true);
} }
LexerModule lmD(SCLEX_D, ColouriseDDoc, "d", FoldDDoc, dWordLists); LexerModule lmD(SCLEX_D, ColouriseDDoc, "d", FoldDDoc, dWordLists);

File diff suppressed because it is too large Load Diff

View File

@@ -1,10 +1,8 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file LexCrontab.cxx /** @file LexForth.cxx
** Lexer to use with extended crontab files used by a powerful ** Lexer for FORTH
** Windows scheduler/event monitor/automation manager nnCron.
** (http://nemtsev.eserv.ru/)
**/ **/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org> // Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed. // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h> #include <stdlib.h>
@@ -17,6 +15,7 @@
#include "PropSet.h" #include "PropSet.h"
#include "Accessor.h" #include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h" #include "KeyWords.h"
#include "Scintilla.h" #include "Scintilla.h"
#include "SciLexer.h" #include "SciLexer.h"
@@ -25,100 +24,29 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
bool is_whitespace(int ch){ static inline bool IsAWordChar(int ch) {
return ch == '\n' || ch == '\r' || ch == '\t' || ch == ' '; return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
ch == '_' || ch == '?' || ch == '"' || ch == '@' ||
ch == '!' || ch == '[' || ch == ']' || ch == '/' ||
ch == '+' || ch == '-' || ch == '*' || ch == '<' ||
ch == '>' || ch == '=' || ch == ';' || ch == '(' ||
ch == ')' );
} }
bool is_blank(int ch){ static inline bool IsAWordStart(int ch) {
return ch == '\t' || ch == ' '; return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
}
//#define FORTH_DEBUG
#ifdef FORTH_DEBUG
static FILE *f_debug;
#define log(x) fputs(f_debug,x);
#else
#define log(x)
#endif
#define STATE_LOCALE
#define BL ' '
static Accessor *st;
static int cur_pos,pos1,pos2,pos0,lengthDoc;
char *buffer;
char getChar(bool is_bl){
char ch=st->SafeGetCharAt(cur_pos);
if(is_bl) if(is_whitespace(ch)) ch=BL;
return ch;
} }
char getCharBL(){ static inline bool IsANumChar(int ch) {
char ch=st->SafeGetCharAt(cur_pos); return (ch < 0x80) && (isxdigit(ch) || ch == '.' || ch == 'e' || ch == 'E' );
return ch;
}
bool is_eol(char ch){
return ch=='\n' || ch=='\r';
} }
int parse(char ch, bool skip_eol){ static inline bool IsASpaceChar(int ch) {
// pos1 - start pos of word return (ch < 0x80) && isspace(ch);
// pos2 - pos after of word
// pos0 - start pos
char c=0;
int len;
bool is_bl=ch==BL;
pos0=pos1=pos2=cur_pos;
for(;cur_pos<lengthDoc && (c=getChar(is_bl))==ch; cur_pos++){
if(is_eol(c) && !skip_eol){
pos2=pos1;
return 0;
}
}
pos1=cur_pos;
pos2=pos1;
if(cur_pos==lengthDoc) return 0;
for(len=0;cur_pos<lengthDoc && (c=getChar(is_bl))!=ch; cur_pos++){
if(is_eol(c) && !skip_eol) break;
pos2++;
buffer[len++]=c;
}
if(c==ch) pos2--;
buffer[len]='\0';
#ifdef FORTH_DEBUG
fprintf(f_debug,"parse: %c %s\n",ch,buffer);
#endif
return len;
} }
bool _is_number(char *s,int base){ static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle, WordList *keywordLists[],
for(;*s;s++){ Accessor &styler) {
int digit=((int)*s)-(int)'0';
#ifdef FORTH_DEBUG
fprintf(f_debug,"digit: %c %d\n",*s,digit);
#endif
if(digit>9 && base>10) digit-=7;
if(digit<0) return false;
if(digit>=base) return false;
}
return true;
}
bool is_number(char *s){
if(strncmp(s,"0x",2)==0) return _is_number(s+2,16);
return _is_number(s,10);
}
static void ColouriseForthDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
{
st=&styler;
cur_pos=startPos;
lengthDoc = startPos + length;
buffer = new char[length];
#ifdef FORTH_DEBUG
f_debug=fopen("c:\\sci.log","at");
#endif
WordList &control = *keywordLists[0]; WordList &control = *keywordLists[0];
WordList &keyword = *keywordLists[1]; WordList &keyword = *keywordLists[1];
@@ -127,226 +55,122 @@ static void ColouriseForthDoc(unsigned int startPos, int length, int, WordList *
WordList &preword2 = *keywordLists[4]; WordList &preword2 = *keywordLists[4];
WordList &strings = *keywordLists[5]; WordList &strings = *keywordLists[5];
// go through all provided text segment StyleContext sc(startPos, length, initStyle, styler);
// using the hand-written state machine shown below
styler.StartAt(startPos);
styler.StartSegment(startPos);
while(parse(BL,true)!=0){
if(pos0!=pos1){
styler.ColourTo(pos0,SCE_FORTH_DEFAULT);
styler.ColourTo(pos1-1,SCE_FORTH_DEFAULT);
}
if(strcmp("\\",buffer)==0){
styler.ColourTo(pos1,SCE_FORTH_COMMENT);
parse(1,false);
styler.ColourTo(pos2,SCE_FORTH_COMMENT);
}else if(strcmp("(",buffer)==0){
styler.ColourTo(pos1,SCE_FORTH_COMMENT);
parse(')',true);
if(cur_pos<lengthDoc) cur_pos++;
styler.ColourTo(cur_pos,SCE_FORTH_COMMENT);
}else if(strcmp("[",buffer)==0){
styler.ColourTo(pos1,SCE_FORTH_STRING);
parse(']',true);
if(cur_pos<lengthDoc) cur_pos++;
styler.ColourTo(cur_pos,SCE_FORTH_STRING);
}else if(strcmp("{",buffer)==0){
styler.ColourTo(pos1,SCE_FORTH_LOCALE);
parse('}',false);
if(cur_pos<lengthDoc) cur_pos++;
styler.ColourTo(cur_pos,SCE_FORTH_LOCALE);
}else if(strings.InList(buffer)) {
styler.ColourTo(pos1,SCE_FORTH_STRING);
parse('"',false);
if(cur_pos<lengthDoc) cur_pos++;
styler.ColourTo(cur_pos,SCE_FORTH_STRING);
}else if(control.InList(buffer)) {
styler.ColourTo(pos1,SCE_FORTH_CONTROL);
styler.ColourTo(pos2,SCE_FORTH_CONTROL);
}else if(keyword.InList(buffer)) {
styler.ColourTo(pos1,SCE_FORTH_KEYWORD);
styler.ColourTo(pos2,SCE_FORTH_KEYWORD);
}else if(defword.InList(buffer)) {
styler.ColourTo(pos1,SCE_FORTH_KEYWORD);
styler.ColourTo(pos2,SCE_FORTH_KEYWORD);
parse(BL,false);
styler.ColourTo(pos1-1,SCE_FORTH_DEFAULT);
styler.ColourTo(pos1,SCE_FORTH_DEFWORD);
styler.ColourTo(pos2,SCE_FORTH_DEFWORD);
}else if(preword1.InList(buffer)) {
styler.ColourTo(pos1,SCE_FORTH_PREWORD1);
parse(BL,false);
styler.ColourTo(pos2,SCE_FORTH_PREWORD1);
}else if(preword2.InList(buffer)) {
styler.ColourTo(pos1,SCE_FORTH_PREWORD2);
parse(BL,false);
styler.ColourTo(pos2,SCE_FORTH_PREWORD2);
parse(BL,false);
styler.ColourTo(pos1,SCE_FORTH_STRING);
styler.ColourTo(pos2,SCE_FORTH_STRING);
}else if(is_number(buffer)){
styler.ColourTo(pos1,SCE_FORTH_NUMBER);
styler.ColourTo(pos2,SCE_FORTH_NUMBER);
}
}
#ifdef FORTH_DEBUG
fclose(f_debug);
#endif
delete []buffer;
return;
/*
if(control.InList(buffer)) {
styler.ColourTo(i,SCE_FORTH_CONTROL);
} else if(keyword.InList(buffer)) {
styler.ColourTo(i-1,SCE_FORTH_KEYWORD );
} else if(defword.InList(buffer)) {
styler.ColourTo(i-1,SCE_FORTH_DEFWORD );
// prev_state=SCE_FORTH_DEFWORD
} else if(preword1.InList(buffer)) {
styler.ColourTo(i-1,SCE_FORTH_PREWORD1 );
// state=SCE_FORTH_PREWORD1;
} else if(preword2.InList(buffer)) {
styler.ColourTo(i-1,SCE_FORTH_PREWORD2 );
} else {
styler.ColourTo(i-1,SCE_FORTH_DEFAULT);
}
*/
/*
chPrev=' ';
for (int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if(i!=startPos) chPrev=styler.SafeGetCharAt(i - 1);
if (styler.IsLeadByte(ch)) { for (; sc.More(); sc.Forward())
chNext = styler.SafeGetCharAt(i + 2); {
i++; // Determine if the current state should terminate.
continue; if (sc.state == SCE_FORTH_COMMENT) {
} if (sc.atLineEnd) {
#ifdef FORTH_DEBUG sc.SetState(SCE_FORTH_DEFAULT);
fprintf(f_debug,"%c %d ",ch,state); }
#endif }else if (sc.state == SCE_FORTH_COMMENT_ML) {
switch(state) { if (sc.ch == ')') {
case SCE_FORTH_DEFAULT: sc.ForwardSetState(SCE_FORTH_DEFAULT);
if(is_whitespace(ch)) { }
// whitespace is simply ignored here... }else if (sc.state == SCE_FORTH_IDENTIFIER || sc.state == SCE_FORTH_NUMBER) {
styler.ColourTo(i,SCE_FORTH_DEFAULT); // handle numbers here too, because what we thought was a number might
break; // turn out to be a keyword e.g. 2DUP
} else if( ch == '\\' && is_blank(chNext)) { if (IsASpaceChar(sc.ch) ) {
// signals the start of an one line comment... char s[100];
state = SCE_FORTH_COMMENT; sc.GetCurrentLowered(s, sizeof(s));
styler.ColourTo(i,SCE_FORTH_COMMENT); int newState = sc.state == SCE_FORTH_NUMBER ? SCE_FORTH_NUMBER : SCE_FORTH_DEFAULT;
} else if( is_whitespace(chPrev) && ch == '(' && is_whitespace(chNext)) { if (control.InList(s)) {
// signals the start of a plain comment... sc.ChangeState(SCE_FORTH_CONTROL);
state = SCE_FORTH_COMMENT_ML; } else if (keyword.InList(s)) {
styler.ColourTo(i,SCE_FORTH_COMMENT_ML); sc.ChangeState(SCE_FORTH_KEYWORD);
} else if( isdigit(ch) ) { } else if (defword.InList(s)) {
// signals the start of a number sc.ChangeState(SCE_FORTH_DEFWORD);
bufferCount = 0; } else if (preword1.InList(s)) {
buffer[bufferCount++] = ch; sc.ChangeState(SCE_FORTH_PREWORD1);
state = SCE_FORTH_NUMBER; } else if (preword2.InList(s)) {
} else if( !is_whitespace(ch)) { sc.ChangeState(SCE_FORTH_PREWORD2);
// signals the start of an identifier } else if (strings.InList(s)) {
bufferCount = 0; sc.ChangeState(SCE_FORTH_STRING);
buffer[bufferCount++] = ch; newState = SCE_FORTH_STRING;
state = SCE_FORTH_IDENTIFIER; }
} else { sc.SetState(newState);
// style it the default style.. }
styler.ColourTo(i,SCE_FORTH_DEFAULT); if (sc.state == SCE_FORTH_NUMBER) {
} if (IsASpaceChar(sc.ch)) {
break; 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);
}
}
case SCE_FORTH_COMMENT: // Determine if a new state should be entered.
// if we find a newline here, if (sc.state == SCE_FORTH_DEFAULT) {
// we simply go to default state if (sc.ch == '\\'){
// else continue to work on it... sc.SetState(SCE_FORTH_COMMENT);
if( ch == '\n' || ch == '\r' ) { } else if (sc.ch == '(' &&
state = SCE_FORTH_DEFAULT; (sc.atLineStart || IsASpaceChar(sc.chPrev)) &&
} else { (sc.atLineEnd || IsASpaceChar(sc.chNext))) {
styler.ColourTo(i,SCE_FORTH_COMMENT); sc.SetState(SCE_FORTH_COMMENT_ML);
} } else if ( (sc.ch == '$' && (isascii(sc.chNext) && isxdigit(sc.chNext))) ) {
break; // 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);
}
}
case SCE_FORTH_COMMENT_ML: }
if( ch == ')') { sc.Complete();
state = SCE_FORTH_DEFAULT;
} else {
styler.ColourTo(i+1,SCE_FORTH_COMMENT_ML);
}
break;
case SCE_FORTH_IDENTIFIER:
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric
if( !is_whitespace(ch) ) {
buffer[bufferCount++] = ch;
} else {
state = SCE_FORTH_DEFAULT;
buffer[bufferCount] = '\0';
#ifdef FORTH_DEBUG
fprintf(f_debug,"\nid %s\n",buffer);
#endif
// check if the buffer contains a keyword,
// and highlight it if it is a keyword...
// switch(prev_state)
// case SCE_FORTH_DEFAULT:
if(control.InList(buffer)) {
styler.ColourTo(i,SCE_FORTH_CONTROL);
} else if(keyword.InList(buffer)) {
styler.ColourTo(i-1,SCE_FORTH_KEYWORD );
} else if(defword.InList(buffer)) {
styler.ColourTo(i-1,SCE_FORTH_DEFWORD );
// prev_state=SCE_FORTH_DEFWORD
} else if(preword1.InList(buffer)) {
styler.ColourTo(i-1,SCE_FORTH_PREWORD1 );
// state=SCE_FORTH_PREWORD1;
} else if(preword2.InList(buffer)) {
styler.ColourTo(i-1,SCE_FORTH_PREWORD2 );
} else {
styler.ColourTo(i-1,SCE_FORTH_DEFAULT);
}
// break;
// case
// push back the faulty character
chNext = styler[i--];
}
break;
case SCE_FORTH_NUMBER:
// stay in CONF_NUMBER state until we find a non-numeric
if( isdigit(ch) ) {
buffer[bufferCount++] = ch;
} else {
state = SCE_FORTH_DEFAULT;
buffer[bufferCount] = '\0';
// Colourize here... (normal number)
styler.ColourTo(i-1,SCE_FORTH_NUMBER);
// push back a character
chNext = styler[i--];
}
break;
}
}
#ifdef FORTH_DEBUG
fclose(f_debug);
#endif
delete []buffer;
*/
} }
static void FoldForthDoc(unsigned int, int, int, WordList *[], static void FoldForthDoc(unsigned int, int, int, WordList *[],
Accessor &) { Accessor &) {
} }
static const char * const forthWordLists[] = { static const char * const forthWordLists[] = {
"control keywords", "control keywords",
"keywords", "keywords",
"definition words", "definition words",
"prewords with one argument", "prewords with one argument",
"prewords with two arguments", "prewords with two arguments",
"string definition keywords", "string definition keywords",
0, 0,
}; };
LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth",FoldForthDoc,forthWordLists); LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth", FoldForthDoc, forthWordLists);

View File

@@ -83,8 +83,16 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
// Handle the fix format generically // Handle the fix format generically
int toLineStart = sc.currentPos - posLineStart; int toLineStart = sc.currentPos - posLineStart;
if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) { if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) {
if (toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*') || sc.ch == '!') { if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') {
sc.SetState(SCE_F_COMMENT); 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 while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end
} else if (toLineStart > 72) { } else if (toLineStart > 72) {
sc.SetState(SCE_F_COMMENT); sc.SetState(SCE_F_COMMENT);
@@ -198,7 +206,8 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
// Determine if a new state should be entered. // Determine if a new state should be entered.
if (sc.state == SCE_F_DEFAULT) { if (sc.state == SCE_F_DEFAULT) {
if (sc.ch == '!') { if (sc.ch == '!') {
if (sc.chNext == '$') { if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
sc.SetState(SCE_F_PREPROCESSOR); sc.SetState(SCE_F_PREPROCESSOR);
} else { } else {
sc.SetState(SCE_F_COMMENT); sc.SetState(SCE_F_COMMENT);
@@ -243,7 +252,7 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
lev = 0; lev = 0;
else else
lev = 1; lev = 1;
} else if (strcmp(s, "end") == 0 && chNextNonBlank != '=' } else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=')
|| strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0 || strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
|| strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0 || strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
|| strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0 || strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0

View File

@@ -0,0 +1,288 @@
# LexGen.py - implemented 2002 by Neil Hodgson neilh@scintilla.org
# Released to the public domain.
# Regenerate the Scintilla and SciTE source files that list
# all the lexers and all the properties files.
# Should be run whenever a new lexer is added or removed.
# Requires Python 2.4 or later
# Most files are regenerated in place with templates stored in comments.
# The VS .NET project file is generated into a different file as the
# VS .NET environment will not retain comments when modifying the file.
# The files are copied to a string apart from sections between a
# ++Autogenerated comment and a --Autogenerated comment which is
# generated by the CopyWithInsertion function. After the whole
# string is instantiated, it is compared with the target file and
# if different the file is rewritten.
# Does not regenerate the Visual C++ 6 project files but does the VS .NET
# project file.
import string
import sys
import os
import glob
# EOL constants
CR = "\r"
LF = "\n"
CRLF = "\r\n"
if sys.platform == "win32":
NATIVE = CRLF
else:
# Yes, LF is the native EOL even on Mac OS X. CR is just for
# Mac OS <=9 (a.k.a. "Mac Classic")
NATIVE = LF
# Automatically generated sections contain start and end comments,
# a definition line and the results.
# The results are replaced by regenerating based on the definition line.
# The definition line is a comment prefix followed by "**".
# If there is a digit after the ** then this indicates which list to use
# and the digit and next character are not part of the definition
# Backslash is used as an escape within the definition line.
# The part between \( and \) is repeated for each item in the list.
# \* is replaced by each list item. \t, and \n are tab and newline.
def CopyWithInsertion(input, commentPrefix, retainDefs, eolType, *lists):
copying = 1
listid = 0
output = []
for line in input.splitlines(0):
isStartGenerated = line.startswith(commentPrefix + "++Autogenerated")
if copying and not isStartGenerated:
output.append(line)
if isStartGenerated:
if retainDefs:
output.append(line)
copying = 0
definition = ""
elif not copying and line.startswith(commentPrefix + "**"):
if retainDefs:
output.append(line)
definition = line[len(commentPrefix + "**"):]
if (commentPrefix == "<!--") and (" -->" in definition):
definition = definition.replace(" -->", "")
listid = 0
if definition[0] in string.digits:
listid = int(definition[:1])
definition = definition[2:]
# Hide double slashes as a control character
definition = definition.replace("\\\\", "\001")
# Do some normal C style transforms
definition = definition.replace("\\n", "\n")
definition = definition.replace("\\t", "\t")
# Get the doubled backslashes back as single backslashes
definition = definition.replace("\001", "\\")
startRepeat = definition.find("\\(")
endRepeat = definition.find("\\)")
intro = definition[:startRepeat]
out = ""
if intro.endswith("\n"):
pos = 0
else:
pos = len(intro)
out += intro
middle = definition[startRepeat+2:endRepeat]
for i in lists[listid]:
item = middle.replace("\\*", i)
if pos and (pos + len(item) >= 80):
out += "\\\n"
pos = 0
out += item
pos += len(item)
if item.endswith("\n"):
pos = 0
outro = definition[endRepeat+2:]
out += outro
out = out.replace("\n", eolType) # correct EOLs in generated content
output.append(out)
elif line.startswith(commentPrefix + "--Autogenerated"):
copying = 1
if retainDefs:
output.append(line)
output = [line.rstrip(" \t") for line in output] # trim trailing whitespace
return eolType.join(output) + eolType
def UpdateFile(filename, updated):
""" If the file is different to updated then copy updated
into the file else leave alone so CVS and make don't treat
it as modified. """
try:
infile = open(filename, "rb")
except IOError: # File is not there yet
out = open(filename, "wb")
out.write(updated.encode('utf-8'))
out.close()
print("New %s" % filename)
return
original = infile.read()
infile.close()
original = original.decode('utf-8')
if updated != original:
os.unlink(filename)
out = open(filename, "wb")
out.write(updated.encode('utf-8'))
out.close()
print("Changed %s " % filename)
#~ else:
#~ print "Unchanged", filename
def Generate(inpath, outpath, commentPrefix, eolType, *lists):
"""Generate 'outpath' from 'inpath'.
"eolType" indicates the type of EOLs to use in the generated
file. It should be one of following constants: LF, CRLF,
CR, or NATIVE.
"""
#print "generate '%s' -> '%s' (comment prefix: %r, eols: %r)"\
# % (inpath, outpath, commentPrefix, eolType)
try:
infile = open(inpath, "rb")
except IOError:
print("Can not open %s" % inpath)
return
original = infile.read()
infile.close()
original = original.decode('utf-8')
updated = CopyWithInsertion(original, commentPrefix,
inpath == outpath, eolType, *lists)
UpdateFile(outpath, updated)
def Regenerate(filename, commentPrefix, eolType, *lists):
"""Regenerate the given file.
"eolType" indicates the type of EOLs to use in the generated
file. It should be one of following constants: LF, CRLF,
CR, or NATIVE.
"""
Generate(filename, filename, commentPrefix, eolType, *lists)
def FindModules(lexFile):
modules = []
f = open(lexFile)
for l in f.readlines():
if l.startswith("LexerModule"):
l = l.replace("(", " ")
modules.append(l.split()[1])
return modules
knownIrregularProperties = [
"fold",
"styling.within.preprocessor",
"tab.timmy.whinge.level",
"asp.default.language",
"html.tags.case.sensitive",
"ps.level",
"ps.tokenize",
"sql.backslash.escapes",
"nsis.uservars",
"nsis.ignorecase"
]
def FindProperties(lexFile):
properties = {}
f = open(lexFile)
for l in f.readlines():
if "GetProperty" in l:
l = l.strip()
if not l.startswith("//"): # Drop comments
propertyName = l.split("\"")[1]
if propertyName.lower() == propertyName:
# Only allow lower case property names
if propertyName in knownIrregularProperties or \
propertyName.startswith("fold.") or \
propertyName.startswith("lexer."):
properties[propertyName] = 1
return properties
def FindPropertyDocumentation(lexFile):
documents = {}
f = open(lexFile)
name = ""
for l in f.readlines():
l = l.strip()
if "// property " in l:
propertyName = l.split()[2]
if propertyName.lower() == propertyName:
# Only allow lower case property names
name = propertyName
documents[name] = ""
elif name:
if l.startswith("//"):
if documents[name]:
documents[name] += " "
documents[name] += l[2:].strip()
else:
name = ""
return documents
def ciCompare(a,b):
return cmp(a.lower(), b.lower())
def ciKey(a):
return a.lower()
def sortListInsensitive(l):
try: # Try key function
l.sort(key=ciKey)
except TypeError: # Earlier version of Python, so use comparison function
l.sort(ciCompare)
def RegenerateAll():
root="../../"
# Find all the lexer source code files
lexFilePaths = glob.glob(root + "scintilla/src/Lex*.cxx")
sortListInsensitive(lexFilePaths)
lexFiles = [os.path.basename(f)[:-4] for f in lexFilePaths]
print(lexFiles)
lexerModules = []
lexerProperties = {}
propertyDocuments = {}
for lexFile in lexFilePaths:
lexerModules.extend(FindModules(lexFile))
for k in FindProperties(lexFile).keys():
lexerProperties[k] = 1
documents = FindPropertyDocumentation(lexFile)
for k in documents.keys():
propertyDocuments[k] = documents[k]
sortListInsensitive(lexerModules)
del lexerProperties["fold.comment.python"]
lexerProperties = list(lexerProperties.keys())
sortListInsensitive(lexerProperties)
# Generate HTML to document each property
# This is done because tags can not be safely put inside comments in HTML
documentProperties = list(propertyDocuments.keys())
sortListInsensitive(documentProperties)
propertiesHTML = []
for k in documentProperties:
propertiesHTML.append("\t<tr>\n\t<td>%s</td>\n\t<td>%s</td>\n\t</tr>" %
(k, propertyDocuments[k]))
# Find all the SciTE properties files
otherProps = ["abbrev.properties", "Embedded.properties", "SciTEGlobal.properties", "SciTE.properties"]
if os.path.exists(root + "scite"):
propFilePaths = glob.glob(root + "scite/src/*.properties")
sortListInsensitive(propFilePaths)
propFiles = [os.path.basename(f) for f in propFilePaths if os.path.basename(f) not in otherProps]
sortListInsensitive(propFiles)
print(propFiles)
Regenerate(root + "scintilla/src/KeyWords.cxx", "//", NATIVE, lexerModules)
Regenerate(root + "scintilla/win32/makefile", "#", NATIVE, lexFiles)
Regenerate(root + "scintilla/win32/scintilla.mak", "#", NATIVE, lexFiles)
Regenerate(root + "scintilla/win32/scintilla_vc6.mak", "#", NATIVE, lexFiles)
# Use Unix EOLs for gtk Makefiles so they work for Linux users when
# extracted from the Scintilla source ZIP (typically created on
# Windows).
Regenerate(root + "scintilla/gtk/makefile", "#", LF, lexFiles)
Regenerate(root + "scintilla/gtk/scintilla.mak", "#", NATIVE, lexFiles)
Regenerate(root + "scintilla/macosx/makefile", "#", LF, lexFiles)
if os.path.exists(root + "scite"):
Regenerate(root + "scite/win32/makefile", "#", NATIVE, lexFiles, propFiles)
Regenerate(root + "scite/win32/scite.mak", "#", NATIVE, lexFiles, propFiles)
Regenerate(root + "scite/src/SciTEProps.cxx", "//", NATIVE, lexerProperties)
Regenerate(root + "scite/doc/SciTEDoc.html", "<!--", NATIVE, propertiesHTML)
Generate(root + "scite/boundscheck/vcproj.gen",
root + "scite/boundscheck/SciTE.vcproj", "#", NATIVE, lexFiles)
RegenerateAll()

File diff suppressed because it is too large Load Diff

View File

@@ -25,6 +25,7 @@
#include "Platform.h" #include "Platform.h"
#include "PropSet.h" #include "PropSet.h"
#include "PropSetSimple.h"
#include "Accessor.h" #include "Accessor.h"
#include "StyleContext.h" #include "StyleContext.h"
#include "KeyWords.h" #include "KeyWords.h"
@@ -179,6 +180,9 @@ static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle,
// Digit // Digit
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_HA_NUMBER); 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(1);
}
} }
// Comment line // Comment line
else if (sc.Match("--")) { else if (sc.Match("--")) {
@@ -222,7 +226,7 @@ static const char* LexerName = "haskell";
void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, int initStyle, void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, int initStyle,
char *words[], WindowID window, char *props) char *words[], WindowID window, char *props)
{ {
PropSet ps; PropSetSimple ps;
ps.SetMultiple(props); ps.SetMultiple(props);
WindowAccessor wa(window, ps); WindowAccessor wa(window, ps);

View File

@@ -13,6 +13,7 @@
#include "Platform.h" #include "Platform.h"
#include "CharClassify.h"
#include "PropSet.h" #include "PropSet.h"
#include "Accessor.h" #include "Accessor.h"
#include "StyleContext.h" #include "StyleContext.h"
@@ -33,6 +34,8 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
char *buffer = new char[length]; char *buffer = new char[length];
int bufferCount = 0; int bufferCount = 0;
bool isBOL, isEOL, isWS, isBOLWS = 0; bool isBOL, isEOL, isWS, isBOLWS = 0;
bool isCode = false;
bool isCStyleComment = false;
WordList &sectionKeywords = *keywordLists[0]; WordList &sectionKeywords = *keywordLists[0];
WordList &standardKeywords = *keywordLists[1]; WordList &standardKeywords = *keywordLists[1];
@@ -63,7 +66,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
switch(state) { switch(state) {
case SCE_INNO_DEFAULT: case SCE_INNO_DEFAULT:
if (ch == ';' && isBOLWS) { if (!isCode && ch == ';' && isBOLWS) {
// Start of a comment // Start of a comment
state = SCE_INNO_COMMENT; state = SCE_INNO_COMMENT;
} else if (ch == '[' && isBOLWS) { } else if (ch == '[' && isBOLWS) {
@@ -73,13 +76,17 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
} else if (ch == '#' && isBOLWS) { } else if (ch == '#' && isBOLWS) {
// Start of a preprocessor directive // Start of a preprocessor directive
state = SCE_INNO_PREPROC; state = SCE_INNO_PREPROC;
} else if (ch == '{' && chNext == '#') { } else if (!isCode && ch == '{' && chNext != '{' && chPrev != '{') {
// Start of a preprocessor inline directive // Start of an inline expansion
state = SCE_INNO_PREPROC_INLINE; state = SCE_INNO_INLINE_EXPANSION;
} else if ((ch == '{' && (chNext == ' ' || chNext == '\t')) } else if (isCode && (ch == '{' || (ch == '(' && chNext == '*'))) {
|| (ch == '(' && chNext == '*')) {
// Start of a Pascal comment // Start of a Pascal comment
state = SCE_INNO_COMMENT_PASCAL; 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 == '"') { } else if (ch == '"') {
// Start of a double-quote string // Start of a double-quote string
state = SCE_INNO_STRING_DOUBLE; state = SCE_INNO_STRING_DOUBLE;
@@ -112,13 +119,13 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
buffer[bufferCount] = '\0'; buffer[bufferCount] = '\0';
// Check if the buffer contains a keyword // Check if the buffer contains a keyword
if (standardKeywords.InList(buffer)) { if (!isCode && standardKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD); styler.ColourTo(i-1,SCE_INNO_KEYWORD);
} else if (parameterKeywords.InList(buffer)) { } else if (!isCode && parameterKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_PARAMETER); styler.ColourTo(i-1,SCE_INNO_PARAMETER);
} else if (pascalKeywords.InList(buffer)) { } else if (isCode && pascalKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD_PASCAL); styler.ColourTo(i-1,SCE_INNO_KEYWORD_PASCAL);
} else if (userKeywords.InList(buffer)) { } else if (!isCode && userKeywords.InList(buffer)) {
styler.ColourTo(i-1,SCE_INNO_KEYWORD_USER); styler.ColourTo(i-1,SCE_INNO_KEYWORD_USER);
} else { } else {
styler.ColourTo(i-1,SCE_INNO_DEFAULT); styler.ColourTo(i-1,SCE_INNO_DEFAULT);
@@ -138,6 +145,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
// Check if the buffer contains a section name // Check if the buffer contains a section name
if (sectionKeywords.InList(buffer)) { if (sectionKeywords.InList(buffer)) {
styler.ColourTo(i,SCE_INNO_SECTION); styler.ColourTo(i,SCE_INNO_SECTION);
isCode = !CompareCaseInsensitive(buffer, "code");
} else { } else {
styler.ColourTo(i,SCE_INNO_DEFAULT); styler.ColourTo(i,SCE_INNO_DEFAULT);
} }
@@ -187,10 +195,10 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
} }
break; break;
case SCE_INNO_PREPROC_INLINE: case SCE_INNO_INLINE_EXPANSION:
if (ch == '}') { if (ch == '}') {
state = SCE_INNO_DEFAULT; state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_PREPROC_INLINE); styler.ColourTo(i,SCE_INNO_INLINE_EXPANSION);
} else if (isEOL) { } else if (isEOL) {
state = SCE_INNO_DEFAULT; state = SCE_INNO_DEFAULT;
styler.ColourTo(i,SCE_INNO_DEFAULT); styler.ColourTo(i,SCE_INNO_DEFAULT);
@@ -198,12 +206,19 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
break; break;
case SCE_INNO_COMMENT_PASCAL: case SCE_INNO_COMMENT_PASCAL:
if (ch == '}' || (ch == ')' && chPrev == '*')) { if (isCStyleComment) {
state = SCE_INNO_DEFAULT; if (isEOL) {
styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL); state = SCE_INNO_DEFAULT;
} else if (isEOL) { styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL);
state = SCE_INNO_DEFAULT; }
styler.ColourTo(i,SCE_INNO_DEFAULT); } 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; break;
@@ -223,72 +238,42 @@ static const char * const innoWordListDesc[] = {
}; };
static void FoldInnoDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) { static void FoldInnoDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
int visibleChars = 0; char chNext = styler[startPos];
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
char chNext = styler[startPos]; bool sectionFlag = false;
int styleNext = styler.StyleAt(startPos); int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) : SC_FOLDLEVELBASE;
bool headerPoint = false; int level;
int lev;
for (unsigned int i = startPos; i < endPos; i++) { for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext; char ch = chNext;
chNext = styler[i+1]; chNext = styler[i+1];
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
int style = styler.StyleAt(i);
if (style == SCE_INNO_SECTION) if (style == SCE_INNO_SECTION)
headerPoint = true; sectionFlag = true;
if (atEOL) { if (atEOL || i == endPos - 1) {
lev = SC_FOLDLEVELBASE; if (sectionFlag) {
level = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
if (lineCurrent > 0) { if (level == levelPrev)
int levelPrevious = styler.LevelAt(lineCurrent - 1); styler.SetLevel(lineCurrent - 1, levelPrev & ~SC_FOLDLEVELHEADERFLAG);
} else {
if (levelPrevious & SC_FOLDLEVELHEADERFLAG) level = levelPrev & SC_FOLDLEVELNUMBERMASK;
lev = SC_FOLDLEVELBASE + 1; if (levelPrev & SC_FOLDLEVELHEADERFLAG)
else level++;
lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
} }
if (headerPoint) styler.SetLevel(lineCurrent, level);
lev = SC_FOLDLEVELBASE;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (headerPoint)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent))
styler.SetLevel(lineCurrent, lev);
levelPrev = level;
lineCurrent++; lineCurrent++;
visibleChars = 0; sectionFlag = false;
headerPoint = false;
} }
if (!isspacechar(ch))
visibleChars++;
} }
if (lineCurrent > 0) {
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);
} }
LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc); LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc);

View File

@@ -32,7 +32,7 @@ using namespace Scintilla;
static inline bool isLispoperator(char ch) { static inline bool isLispoperator(char ch) {
if (isascii(ch) && isalnum(ch)) if (isascii(ch) && isalnum(ch))
return false; return false;
if (ch == '\'' || ch == '`' || ch == '(' || ch == ')' ) if (ch == '\'' || ch == '`' || ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == '{' || ch == '}')
return true; return true;
return false; return false;
} }
@@ -100,6 +100,9 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W
styler.ColourTo(i - 1, state); styler.ColourTo(i - 1, state);
radix = -1; radix = -1;
state = SCE_LISP_MACRO_DISPATCH; state = SCE_LISP_MACRO_DISPATCH;
} else if (ch == ':' && isLispwordstart(chNext)) {
styler.ColourTo(i - 1, state);
state = SCE_LISP_SYMBOL;
} else if (isLispwordstart(ch)) { } else if (isLispwordstart(ch)) {
styler.ColourTo(i - 1, state); styler.ColourTo(i - 1, state);
state = SCE_LISP_IDENTIFIER; state = SCE_LISP_IDENTIFIER;
@@ -243,9 +246,9 @@ static void FoldLispDoc(unsigned int startPos, int length, int /* initStyle */,
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_LISP_OPERATOR) { if (style == SCE_LISP_OPERATOR) {
if (ch == '(') { if (ch == '(' || ch == '[' || ch == '{') {
levelCurrent++; levelCurrent++;
} else if (ch == ')') { } else if (ch == ')' || ch == ']' || ch == '}') {
levelCurrent--; levelCurrent--;
} }
} }

View File

@@ -21,48 +21,12 @@
#include "KeyWords.h" #include "KeyWords.h"
#include "Scintilla.h" #include "Scintilla.h"
#include "SciLexer.h" #include "SciLexer.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
#endif #endif
// 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 >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'));
}
static inline bool IsLuaOperator(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 == '^' || ch == '%' || ch == ':' ||
ch == '#') {
return true;
}
return false;
}
// Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ], // Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ],
// return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on. // return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on.
// The maximum number of '=' characters allowed is 254. // The maximum number of '=' characters allowed is 254.
@@ -91,6 +55,15 @@ static void ColouriseLuaDoc(
WordList &keywords7 = *keywordlists[6]; WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7]; 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.
CharacterSet setNumber(CharacterSet::setDigits, ".-+abcdefABCDEF");
CharacterSet setLuaOperator(CharacterSet::setNone, "*/-+()={}~[];<>,.^%:#");
CharacterSet setEscapeSkip(CharacterSet::setNone, "\"'\\");
int currentLine = styler.GetLine(startPos); int currentLine = styler.GetLine(startPos);
// Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level, // Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level,
// if we are inside such a string. Block comment was introduced in Lua 5.0, // if we are inside such a string. Block comment was introduced in Lua 5.0,
@@ -136,7 +109,7 @@ static void ColouriseLuaDoc(
// Handle string line continuation // Handle string line continuation
if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) && if ((sc.state == SCE_LUA_STRING || sc.state == SCE_LUA_CHARACTER) &&
sc.ch == '\\') { sc.ch == '\\') {
if (sc.chNext == '\n' || sc.chNext == '\r') { if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward(); sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') { if (sc.ch == '\r' && sc.chNext == '\n') {
@@ -151,14 +124,14 @@ static void ColouriseLuaDoc(
sc.SetState(SCE_LUA_DEFAULT); sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.state == SCE_LUA_NUMBER) { } else if (sc.state == SCE_LUA_NUMBER) {
// We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char // We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char
if (!IsANumberChar(sc.ch)) { if (!setNumber.Contains(sc.ch)) {
sc.SetState(SCE_LUA_DEFAULT); sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.ch == '-' || sc.ch == '+') { } else if (sc.ch == '-' || sc.ch == '+') {
if (sc.chPrev != 'E' && sc.chPrev != 'e') if (sc.chPrev != 'E' && sc.chPrev != 'e')
sc.SetState(SCE_LUA_DEFAULT); sc.SetState(SCE_LUA_DEFAULT);
} }
} else if (sc.state == SCE_LUA_IDENTIFIER) { } else if (sc.state == SCE_LUA_IDENTIFIER) {
if (!IsAWordChar(sc.ch) || sc.Match('.', '.')) { if (!setWord.Contains(sc.ch) || sc.Match('.', '.')) {
char s[100]; char s[100];
sc.GetCurrent(s, sizeof(s)); sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) { if (keywords.InList(s)) {
@@ -186,7 +159,7 @@ static void ColouriseLuaDoc(
} }
} else if (sc.state == SCE_LUA_STRING) { } else if (sc.state == SCE_LUA_STRING) {
if (sc.ch == '\\') { if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { if (setEscapeSkip.Contains(sc.chNext)) {
sc.Forward(); sc.Forward();
} }
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
@@ -197,7 +170,7 @@ static void ColouriseLuaDoc(
} }
} else if (sc.state == SCE_LUA_CHARACTER) { } else if (sc.state == SCE_LUA_CHARACTER) {
if (sc.ch == '\\') { if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { if (setEscapeSkip.Contains(sc.chNext)) {
sc.Forward(); sc.Forward();
} }
} else if (sc.ch == '\'') { } else if (sc.ch == '\'') {
@@ -233,9 +206,9 @@ static void ColouriseLuaDoc(
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_LUA_NUMBER); sc.SetState(SCE_LUA_NUMBER);
if (sc.ch == '0' && toupper(sc.chNext) == 'X') { if (sc.ch == '0' && toupper(sc.chNext) == 'X') {
sc.Forward(1); sc.Forward();
} }
} else if (IsAWordStart(sc.ch)) { } else if (setWordStart.Contains(sc.ch)) {
sc.SetState(SCE_LUA_IDENTIFIER); sc.SetState(SCE_LUA_IDENTIFIER);
} else if (sc.ch == '\"') { } else if (sc.ch == '\"') {
sc.SetState(SCE_LUA_STRING); sc.SetState(SCE_LUA_STRING);
@@ -265,11 +238,34 @@ static void ColouriseLuaDoc(
} }
} else if (sc.atLineStart && sc.Match('$')) { } else if (sc.atLineStart && sc.Match('$')) {
sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code
} else if (IsLuaOperator(static_cast<char>(sc.ch))) { } else if (setLuaOperator.Contains(sc.ch)) {
sc.SetState(SCE_LUA_OPERATOR); sc.SetState(SCE_LUA_OPERATOR);
} }
} }
} }
if (setWord.Contains(sc.chPrev)) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) {
sc.ChangeState(SCE_LUA_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_LUA_WORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_LUA_WORD3);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_LUA_WORD4);
} else if (keywords5.InList(s)) {
sc.ChangeState(SCE_LUA_WORD5);
} else if (keywords6.InList(s)) {
sc.ChangeState(SCE_LUA_WORD6);
} else if (keywords7.InList(s)) {
sc.ChangeState(SCE_LUA_WORD7);
} else if (keywords8.InList(s)) {
sc.ChangeState(SCE_LUA_WORD8);
}
}
sc.Complete(); sc.Complete();
} }

View File

@@ -11,6 +11,9 @@
#include <stdio.h> #include <stdio.h>
#include <ctype.h> #include <ctype.h>
#include <stdlib.h> #include <stdlib.h>
#include <string>
#include "Platform.h" #include "Platform.h"
#include "PropSet.h" #include "PropSet.h"
@@ -18,13 +21,12 @@
#include "KeyWords.h" #include "KeyWords.h"
#include "Scintilla.h" #include "Scintilla.h"
#include "SciLexer.h" #include "SciLexer.h"
#include "SString.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
#endif #endif
static int GetLotLineState(SString &line) { static int GetLotLineState(std::string &line) {
if (line.length()) { if (line.length()) {
// Most of the time the first non-blank character in line determines that line's type // Most of the time the first non-blank character in line determines that line's type
// Now finds the first non-blank character // Now finds the first non-blank character
@@ -54,13 +56,13 @@ static int GetLotLineState(SString &line) {
default: // Any other line default: // Any other line
// Checks for message at the end of lot file // Checks for message at the end of lot file
if (line.contains("PASSED")) { if (line.find("PASSED") != std::string::npos) {
return SCE_LOT_PASS; return SCE_LOT_PASS;
} }
else if (line.contains("FAILED")) { else if (line.find("FAILED") != std::string::npos) {
return SCE_LOT_FAIL; return SCE_LOT_FAIL;
} }
else if (line.contains("ABORTED")) { else if (line.find("ABORTED") != std::string::npos) {
return SCE_LOT_ABORT; return SCE_LOT_ABORT;
} }
else { else {
@@ -78,8 +80,8 @@ static void ColourizeLotDoc(unsigned int startPos, int length, int, WordList *[]
styler.StartSegment(startPos); styler.StartSegment(startPos);
bool atLineStart = true;// Arms the 'at line start' flag bool atLineStart = true;// Arms the 'at line start' flag
char chNext = styler.SafeGetCharAt(startPos); char chNext = styler.SafeGetCharAt(startPos);
SString line(""); std::string line("");
line.setsizegrowth(256); // Lot lines are less than 256 chars long most of the time. This should avoid reallocations line.reserve(256); // Lot lines are less than 256 chars long most of the time. This should avoid reallocations
// Styles LOT document // Styles LOT document
unsigned int i; // Declared here because it's used after the for loop unsigned int i; // Declared here because it's used after the for loop

View File

@@ -0,0 +1,445 @@
// 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 <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/**
* 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 keywordslists The keywordslists, currently, number 5 is used
* \param styler The styler
*/
static void ColouriseMagikDoc(unsigned int startPos, int 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<int>(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(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 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(unsigned int startPos, int length, int,
WordList *keywordslists[], Accessor &styler) {
bool compact = styler.GetPropertyInt("fold.compact") != 0;
WordList &foldingElements = *keywordslists[5];
int endPos = startPos + length;
int line = styler.GetLine(startPos);
int level = styler.LevelAt(line) & SC_FOLDLEVELNUMBERMASK;
int flags = styler.LevelAt(line) & ~SC_FOLDLEVELNUMBERMASK;
for(
int currentPos = startPos;
currentPos < endPos;
currentPos++) {
char currentState = styler.StyleAt(currentPos);
char c = styler.SafeGetCharAt(currentPos, ' ');
int 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);

View File

@@ -0,0 +1,412 @@
/******************************************************************
* 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 <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
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 unsigned int endPos, StyleContext &sc) {
unsigned int 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 int 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) {
int 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;
}
static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
int c, count = 1;
unsigned int i = 0;
while (++i) {
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;
}
}
}
return false;
}
static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle,
WordList **, Accessor &styler) {
unsigned int 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_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("~~~")) {
int 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;
}
// 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.ch == '[') {
int i = 0, j = 0, k = 0;
int 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_MARKDOWN_LINK);
sc.Forward(j);
// Also has a URL or reference portion
if (k)
sc.Forward(k - j);
sc.ForwardSetState(SCE_MARKDOWN_DEFAULT);
}
}
// Code - also a special case for alternate inside spacing
if (sc.Match("``") && sc.GetRelative(3) != ' ') {
sc.SetState(SCE_MARKDOWN_CODE2);
sc.Forward();
}
else if (sc.ch == '`' && sc.chNext != ' ') {
sc.SetState(SCE_MARKDOWN_CODE);
}
// Strong
else if (sc.Match("**") && sc.GetRelative(2) != ' ') {
sc.SetState(SCE_MARKDOWN_STRONG1);
sc.Forward();
}
else if (sc.Match("__") && sc.GetRelative(2) != ' ') {
sc.SetState(SCE_MARKDOWN_STRONG2);
sc.Forward();
}
// Emphasis
else if (sc.ch == '*' && sc.chNext != ' ')
sc.SetState(SCE_MARKDOWN_EM1);
else if (sc.ch == '_' && sc.chNext != ' ')
sc.SetState(SCE_MARKDOWN_EM2);
// Strikeout
else if (sc.Match("~~") && sc.GetRelative(2) != ' ') {
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");

View File

@@ -1,7 +1,7 @@
// Scintilla source code edit control // Scintilla source code edit control
/** @file LexMatlab.cxx /** @file LexMatlab.cxx
** Lexer for Matlab. ** Lexer for Matlab.
** Written by Jose' Fonseca ** Written by Jos<EFBFBD> Fonseca
** **
** Changes by Christoph Dalitz 2003/12/04: ** Changes by Christoph Dalitz 2003/12/04:
** - added support for Octave ** - added support for Octave
@@ -128,7 +128,7 @@ static void ColouriseMatlabOctaveDoc(
if (sc.state == SCE_MATLAB_DEFAULT) { if (sc.state == SCE_MATLAB_DEFAULT) {
if (IsCommentChar(sc.ch)) { if (IsCommentChar(sc.ch)) {
sc.SetState(SCE_MATLAB_COMMENT); sc.SetState(SCE_MATLAB_COMMENT);
} else if (sc.ch == '!') { } else if (sc.ch == '!' && sc.chNext != '=' ) {
sc.SetState(SCE_MATLAB_COMMAND); sc.SetState(SCE_MATLAB_COMMAND);
} else if (sc.ch == '\'') { } else if (sc.ch == '\'') {
if (transpose) { if (transpose) {

View File

@@ -0,0 +1,518 @@
/**
* Scintilla source code edit control
* @file LexMySQL.cxx
* Lexer for MySQL
*
* Improved by Mike Lischke <mike.lischke@sun.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 <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
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 IsADoxygenChar(int ch) {
return (islower(ch) || ch == '$' || ch == '@' ||
ch == '\\' || ch == '&' || ch == '<' ||
ch == '>' || ch == '#' || ch == '{' ||
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) || 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 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);
else
if (keywordlists[1]->InList(s))
sc.ChangeState(SCE_MYSQL_KEYWORD);
else
if (keywordlists[2]->InList(s))
sc.ChangeState(SCE_MYSQL_DATABASEOBJECT);
else
if (keywordlists[3]->InList(s))
sc.ChangeState(SCE_MYSQL_FUNCTION);
else
if (keywordlists[5]->InList(s))
sc.ChangeState(SCE_MYSQL_PROCEDUREKEYWORD);
else
if (keywordlists[6]->InList(s))
sc.ChangeState(SCE_MYSQL_USER1);
else
if (keywordlists[7]->InList(s))
sc.ChangeState(SCE_MYSQL_USER2);
else
if (keywordlists[8]->InList(s))
sc.ChangeState(SCE_MYSQL_USER3);
delete [] s;
}
//--------------------------------------------------------------------------------------------------
static void ColouriseMySQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler)
{
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward())
{
// Determine if the current state should terminate.
switch (sc.state)
{
case SCE_MYSQL_OPERATOR:
sc.SetState(SCE_MYSQL_DEFAULT);
break;
case SCE_MYSQL_NUMBER:
// We stop the number definition on non-numerical non-dot non-eE non-sign char.
if (!IsANumberChar(sc.ch))
sc.SetState(SCE_MYSQL_DEFAULT);
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);
// Additional check for function keywords needed.
// A function name must be followed by an opening parenthesis.
if (sc.state == SCE_MYSQL_FUNCTION && sc.ch != '(')
sc.ChangeState(SCE_MYSQL_DEFAULT);
sc.SetState(SCE_MYSQL_DEFAULT);
}
break;
case SCE_MYSQL_VARIABLE:
if (!IsAWordChar(sc.ch))
sc.SetState(SCE_MYSQL_DEFAULT);
break;
case SCE_MYSQL_SYSTEMVARIABLE:
if (!IsAWordChar(sc.ch))
{
int 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);
delete [] s;
sc.SetState(SCE_MYSQL_DEFAULT);
}
break;
case SCE_MYSQL_QUOTEDIDENTIFIER:
if (sc.ch == '`')
{
if (sc.chNext == '`')
sc.Forward(); // Ignore it
else
sc.ForwardSetState(SCE_MYSQL_DEFAULT);
}
break;
case SCE_MYSQL_COMMENT:
case SCE_MYSQL_HIDDENCOMMAND:
if (sc.Match('*', '/'))
{
sc.Forward();
sc.ForwardSetState(SCE_MYSQL_DEFAULT);
}
break;
case SCE_MYSQL_COMMENTLINE:
if (sc.atLineStart)
sc.SetState(SCE_MYSQL_DEFAULT);
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
sc.ForwardSetState(SCE_MYSQL_DEFAULT);
}
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
sc.ForwardSetState(SCE_MYSQL_DEFAULT);
}
break;
}
// Determine if a new state should be entered.
if (sc.state == SCE_MYSQL_DEFAULT)
{
switch (sc.ch)
{
case '@':
if (sc.chNext == '@')
{
sc.SetState(SCE_MYSQL_SYSTEMVARIABLE);
sc.Forward(2); // Skip past @@.
}
else
if (IsAWordStart(sc.ch))
{
sc.SetState(SCE_MYSQL_VARIABLE);
sc.Forward(); // Skip past @.
}
else
sc.SetState(SCE_MYSQL_OPERATOR);
break;
case '`':
sc.SetState(SCE_MYSQL_QUOTEDIDENTIFIER);
break;
case '#':
sc.SetState(SCE_MYSQL_COMMENTLINE);
break;
case '\'':
sc.SetState(SCE_MYSQL_SQSTRING);
break;
case '\"':
sc.SetState(SCE_MYSQL_DQSTRING);
break;
default:
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)))
sc.SetState(SCE_MYSQL_NUMBER);
else
if (IsAWordStart(sc.ch))
sc.SetState(SCE_MYSQL_IDENTIFIER);
else
if (sc.Match('/', '*'))
{
sc.SetState(SCE_MYSQL_COMMENT);
// Skip comment introducer and check for hidden command.
sc.Forward(2);
if (sc.ch == '!')
{
sc.ChangeState(SCE_MYSQL_HIDDENCOMMAND);
sc.Forward();
}
}
else
if (sc.Match("--"))
{
// Special MySQL single line comment.
sc.SetState(SCE_MYSQL_COMMENTLINE);
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);
}
else
if (isoperator(static_cast<char>(sc.ch)))
sc.SetState(SCE_MYSQL_OPERATOR);
}
}
}
// 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);
// Additional check for function keywords needed.
// A function name must be followed by an opening parenthesis.
if (sc.state == SCE_MYSQL_FUNCTION && sc.ch != '(')
sc.ChangeState(SCE_MYSQL_DEFAULT);
}
sc.Complete();
}
//--------------------------------------------------------------------------------------------------
/**
* Helper function to determine if we have a foldable comment currently.
*/
static bool IsStreamCommentStyle(int style)
{
return style == SCE_MYSQL_COMMENT;
}
//--------------------------------------------------------------------------------------------------
/**
* Code copied from StyleContext and modified to work here. Should go into Accessor as a
* companion to Match()...
*/
bool MatchIgnoreCase(Accessor &styler, int currentPos, const char *s)
{
for (int 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(unsigned int startPos, int 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;
int 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;
bool endFound = false;
bool whenFound = false;
bool elseFound = false;
char nextChar = styler.SafeGetCharAt(startPos);
for (unsigned int i = startPos; length > 0; i++, length--)
{
int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
char currentChar = nextChar;
nextChar = styler.SafeGetCharAt(i + 1);
bool atEOL = (currentChar == '\r' && nextChar != '\n') || (currentChar == '\n');
switch (style)
{
case SCE_MYSQL_COMMENT:
if (foldComment)
{
// Multiline comment style /* .. */.
if (IsStreamCommentStyle(style))
{
// Increase level if we just start a foldable comment.
if (!IsStreamCommentStyle(stylePrev))
levelNext++;
else
// If we are in the middle of a foldable comment check if it ends now.
// Don't end at the line end, though.
if (!IsStreamCommentStyle(styleNext) && !atEOL)
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 (style != stylePrev)
levelNext++;
else
if (style != styleNext)
levelNext--;
break;
case SCE_MYSQL_OPERATOR:
if (currentChar == '(')
levelNext++;
else
if (currentChar == ')')
levelNext--;
break;
case SCE_MYSQL_MAJORKEYWORD:
case SCE_MYSQL_KEYWORD:
case SCE_MYSQL_FUNCTION:
case SCE_MYSQL_PROCEDUREKEYWORD:
// Reserved and other keywords.
if (style != stylePrev)
{
bool beginFound = MatchIgnoreCase(styler, i, "begin");
bool ifFound = MatchIgnoreCase(styler, i, "if");
bool thenFound = MatchIgnoreCase(styler, i, "then");
bool whileFound = MatchIgnoreCase(styler, i, "while");
bool loopFound = MatchIgnoreCase(styler, i, "loop");
bool repeatFound = MatchIgnoreCase(styler, i, "repeat");
if (!foldOnlyBegin && endFound && (ifFound || whileFound || loopFound))
{
endFound = false;
levelNext--;
if (levelNext < SC_FOLDLEVELBASE)
levelNext = SC_FOLDLEVELBASE;
// Note that "else" is special here. It may or may not be followed by an "if .. then",
// but in any case the level stays the same. When followed by an "if .. then" the level
// will be increased later, if not, then at eol.
}
else
if (!foldOnlyBegin && MatchIgnoreCase(styler, i, "else"))
{
levelNext--;
elseFound = true;
}
else
if (!foldOnlyBegin && thenFound)
{
if (whenFound)
whenFound = false;
else
levelNext++;
}
else
if (ifFound)
elseFound = false;
else
if (MatchIgnoreCase(styler, i, "when"))
whenFound = true;
else
{
if (beginFound)
levelNext++;
else
if (!foldOnlyBegin && (loopFound || repeatFound || whileFound))
{
if (endFound)
endFound = false;
else
levelNext++;
}
else
if (MatchIgnoreCase(styler, i, "end"))
{
// Multiple "end" in a row are counted multiple times!
if (endFound)
{
levelNext--;
if (levelNext < SC_FOLDLEVELBASE)
levelNext = SC_FOLDLEVELBASE;
}
endFound = true;
whenFound = false;
}
}
}
break;
}
// Handle the case of a trailing end without an if / while etc, as in the case of a begin.
if (endFound)
{
endFound = false;
levelNext--;
if (levelNext < SC_FOLDLEVELBASE)
levelNext = SC_FOLDLEVELBASE;
}
if (atEOL)
{
if (elseFound)
{
levelNext++;
elseFound = false;
}
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;
endFound = false;
whenFound = false;
}
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);

View File

@@ -0,0 +1,430 @@
// 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 <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(int ch) {
return (ch >= 0x80) || isalnum(ch) || ch == '_';
}
static int tillEndOfTripleQuote(Accessor &styler, int pos, int 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 int scanString(Accessor &styler, int pos, int 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 int scanChar(Accessor &styler, int pos, int 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 int scanIdent(Accessor &styler, int pos, WordList &keywords) {
char buf[100]; /* copy to lowercase and ignore underscores */
int 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 int scanNumber(Accessor &styler, int 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(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
int pos = startPos;
int 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(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int 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(int line, Accessor &styler) {
int style = styler.StyleAt(styler.LineStart(line)) & 31;
return ((style == SCE_P_TRIPLE) || (style == SCE_P_TRIPLEDOUBLE));
}
static void FoldNimrodDoc(unsigned int startPos, int length,
int /*initStyle - unused*/,
WordList *[], Accessor &styler) {
const int maxPos = startPos + length;
const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
const int 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;
int 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;
int 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 =
Platform::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
int 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);

View File

@@ -13,6 +13,7 @@
#include "Platform.h" #include "Platform.h"
#include "CharClassify.h"
#include "PropSet.h" #include "PropSet.h"
#include "Accessor.h" #include "Accessor.h"
#include "KeyWords.h" #include "KeyWords.h"
@@ -77,7 +78,7 @@ static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &
} }
} }
if( nNextLine == -1 ) // We never foudn the next line... if( nNextLine == -1 ) // We never found the next line...
return false; return false;
for( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) for( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ )
@@ -145,7 +146,7 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel
if( s[0] == '!' ) if( s[0] == '!' )
{ {
if( NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!macro", bIgnoreCase ) == 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++; newFoldlevel++;
else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 ) else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 )
newFoldlevel--; newFoldlevel--;
@@ -190,16 +191,16 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
} }
// Check for special words... // Check for special words...
if( NsisCmp(s, "!macro", bIgnoreCase ) == 0 || NsisCmp(s, "!macroend", bIgnoreCase) == 0 ) // Covers !micro and !microend if( NsisCmp(s, "!macro", bIgnoreCase ) == 0 || NsisCmp(s, "!macroend", bIgnoreCase) == 0 ) // Covers !macro and !macroend
return SCE_NSIS_MACRODEF; return SCE_NSIS_MACRODEF;
if( NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 ) 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; return SCE_NSIS_IFDEFINEDEF;
if( NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 ) if( NsisCmp(s, "!if", bIgnoreCase ) == 0 || NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // Covers !if and else
return SCE_NSIS_IFDEFINEDEF; return SCE_NSIS_IFDEFINEDEF;
if( NsisCmp(s, "!if", bIgnoreCase ) == 0 ) if (NsisCmp(s, "!ifmacrodef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifmacrondef", bIgnoreCase ) == 0 ) // Covers !ifmacrodef and !ifnmacrodef
return SCE_NSIS_IFDEFINEDEF; return SCE_NSIS_IFDEFINEDEF;
if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd

View File

@@ -14,6 +14,7 @@
#include "Platform.h" #include "Platform.h"
#include "CharClassify.h"
#include "PropSet.h" #include "PropSet.h"
#include "Accessor.h" #include "Accessor.h"
#include "KeyWords.h" #include "KeyWords.h"
@@ -24,6 +25,10 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
static bool strstart(const char *haystack, const char *needle) {
return strncmp(haystack, needle, strlen(needle)) == 0;
}
static bool Is0To9(char ch) { static bool Is0To9(char ch) {
return (ch >= '0') && (ch <= '9'); return (ch >= '0') && (ch <= '9');
} }
@@ -58,7 +63,6 @@ static void ColouriseBatchLine(
Accessor &styler) { Accessor &styler) {
unsigned int offset = 0; // Line Buffer Offset unsigned int offset = 0; // Line Buffer Offset
unsigned int enVarEnd; // Environment Variable End point
unsigned int cmdLoc; // External Command / Program Location unsigned int cmdLoc; // External Command / Program Location
char wordBuffer[81]; // Word Buffer - large to catch long paths char wordBuffer[81]; // Word Buffer - large to catch long paths
unsigned int wbl; // Word Buffer Length unsigned int wbl; // Word Buffer Length
@@ -111,39 +115,6 @@ static void ColouriseBatchLine(
if (lineBuffer[offset] == '@') { if (lineBuffer[offset] == '@') {
styler.ColourTo(startLine + offset, SCE_BAT_HIDE); styler.ColourTo(startLine + offset, SCE_BAT_HIDE);
offset++; offset++;
// Check for Argument (%n) or Environment Variable (%x...%)
} else if (lineBuffer[offset] == '%') {
enVarEnd = offset + 1;
// Search end of word for second % (can be a long path)
while ((enVarEnd < lengthLine) &&
(!isspacechar(lineBuffer[enVarEnd])) &&
(lineBuffer[enVarEnd] != '%') &&
(!IsBOperator(lineBuffer[enVarEnd])) &&
(!IsBSeparator(lineBuffer[enVarEnd]))) {
enVarEnd++;
}
// Check for Argument (%n)
if ((Is0To9(lineBuffer[offset + 1])) &&
(lineBuffer[enVarEnd] != '%')) {
// Colorize Argument
styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
offset += 2;
// Check for External Command / Program
if (offset < lengthLine && !isspacechar(lineBuffer[offset])) {
cmdLoc = offset;
}
// Check for Environment Variable (%x...%)
} else if ((lineBuffer[offset + 1] != '%') &&
(lineBuffer[enVarEnd] == '%')) {
offset = enVarEnd;
// Colorize Environment Variable
styler.ColourTo(startLine + offset, SCE_BAT_IDENTIFIER);
offset++;
// Check for External Command / Program
if (offset < lengthLine && !isspacechar(lineBuffer[offset])) {
cmdLoc = offset;
}
}
} }
// Skip next spaces // Skip next spaces
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) { while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
@@ -243,6 +214,7 @@ static void ColouriseBatchLine(
// No need to Reset Offset // No need to Reset Offset
// Check for Special Keyword in list, External Command / Program, or Default Text // Check for Special Keyword in list, External Command / Program, or Default Text
} else if ((wordBuffer[0] != '%') && } else if ((wordBuffer[0] != '%') &&
(wordBuffer[0] != '!') &&
(!IsBOperator(wordBuffer[0])) && (!IsBOperator(wordBuffer[0])) &&
(continueProcessing)) { (continueProcessing)) {
// Check for Special Keyword // Check for Special Keyword
@@ -279,6 +251,7 @@ static void ColouriseBatchLine(
// Read up to %, Operator or Separator // Read up to %, Operator or Separator
while ((wbo < wbl) && while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') && (wordBuffer[wbo] != '%') &&
(wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) && (!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) { (!IsBSeparator(wordBuffer[wbo]))) {
wbo++; wbo++;
@@ -328,6 +301,7 @@ static void ColouriseBatchLine(
// Read up to %, Operator or Separator // Read up to %, Operator or Separator
while ((wbo < wbl) && while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') && (wordBuffer[wbo] != '%') &&
(wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) && (!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) { (!IsBSeparator(wordBuffer[wbo]))) {
wbo++; wbo++;
@@ -350,8 +324,8 @@ static void ColouriseBatchLine(
(!IsBSeparator(wordBuffer[wbo]))) { (!IsBSeparator(wordBuffer[wbo]))) {
wbo++; wbo++;
} }
// Check for Argument (%n) // Check for Argument (%n) or (%*)
if ((Is0To9(wordBuffer[1])) && if (((Is0To9(wordBuffer[1])) || (wordBuffer[1] == '*')) &&
(wordBuffer[wbo] != '%')) { (wordBuffer[wbo] != '%')) {
// Check for External Command / Program // Check for External Command / Program
if (cmdLoc == offset - wbl) { if (cmdLoc == offset - wbl) {
@@ -361,6 +335,17 @@ static void ColouriseBatchLine(
styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER); styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER);
// Reset Offset to re-process remainder of word // Reset Offset to re-process remainder of word
offset -= (wbl - 2); 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...%) // Check for Environment Variable (%x...%)
} else if ((wordBuffer[1] != '%') && } else if ((wordBuffer[1] != '%') &&
(wordBuffer[wbo] == '%')) { (wordBuffer[wbo] == '%')) {
@@ -389,6 +374,29 @@ static void ColouriseBatchLine(
// Reset Offset to re-process remainder of word // Reset Offset to re-process remainder of word
offset -= (wbl - 3); 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] != '!') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(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 // Check for Operator
} else if (IsBOperator(wordBuffer[0])) { } else if (IsBOperator(wordBuffer[0])) {
// Colorize Default Text // Colorize Default Text
@@ -436,6 +444,7 @@ static void ColouriseBatchLine(
// Read up to %, Operator or Separator // Read up to %, Operator or Separator
while ((wbo < wbl) && while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') && (wordBuffer[wbo] != '%') &&
(wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) && (!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) { (!IsBSeparator(wordBuffer[wbo]))) {
wbo++; wbo++;
@@ -491,9 +500,13 @@ static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
// otherwise it is considered a comment (Only in..., Binary file...) // otherwise it is considered a comment (Only in..., Binary file...)
if (0 == strncmp(lineBuffer, "diff ", 5)) { if (0 == strncmp(lineBuffer, "diff ", 5)) {
styler.ColourTo(endLine, SCE_DIFF_COMMAND); styler.ColourTo(endLine, SCE_DIFF_COMMAND);
} else if (0 == strncmp(lineBuffer, "--- ", 4)) { } else if (0 == strncmp(lineBuffer, "Index: ", 7)) { // For subversion's diff
styler.ColourTo(endLine, SCE_DIFF_COMMAND);
} else if (0 == strncmp(lineBuffer, "---", 3)) {
// In a context diff, --- appears in both the header and the position markers // In a context diff, --- appears in both the header and the position markers
if (atoi(lineBuffer+4) && !strchr(lineBuffer, '/')) 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); styler.ColourTo(endLine, SCE_DIFF_POSITION);
else else
styler.ColourTo(endLine, SCE_DIFF_HEADER); styler.ColourTo(endLine, SCE_DIFF_HEADER);
@@ -526,6 +539,8 @@ static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
styler.ColourTo(endLine, SCE_DIFF_DELETED); styler.ColourTo(endLine, SCE_DIFF_DELETED);
} else if (lineBuffer[0] == '+' || lineBuffer[0] == '>') { } else if (lineBuffer[0] == '+' || lineBuffer[0] == '>') {
styler.ColourTo(endLine, SCE_DIFF_ADDED); styler.ColourTo(endLine, SCE_DIFF_ADDED);
} else if (lineBuffer[0] == '!') {
styler.ColourTo(endLine, SCE_DIFF_CHANGED);
} else if (lineBuffer[0] != ' ') { } else if (lineBuffer[0] != ' ') {
styler.ColourTo(endLine, SCE_DIFF_COMMENT); styler.ColourTo(endLine, SCE_DIFF_COMMENT);
} else { } else {
@@ -552,25 +567,24 @@ static void ColouriseDiffDoc(unsigned int startPos, int length, int, WordList *[
} }
} }
static void FoldDiffDoc(unsigned int startPos, int length, int, WordList*[], Accessor &styler) { static void FoldDiffDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
int curLine = styler.GetLine(startPos); int curLine = styler.GetLine(startPos);
int prevLevel = SC_FOLDLEVELBASE;
if (curLine > 0)
prevLevel = styler.LevelAt(curLine-1);
int curLineStart = styler.LineStart(curLine); int curLineStart = styler.LineStart(curLine);
do { int prevLevel = curLine > 0 ? styler.LevelAt(curLine - 1) : SC_FOLDLEVELBASE;
int nextLevel = prevLevel; int nextLevel;
if (prevLevel & SC_FOLDLEVELHEADERFLAG)
nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1;
do {
int lineType = styler.StyleAt(curLineStart); int lineType = styler.StyleAt(curLineStart);
if (lineType == SCE_DIFF_COMMAND) if (lineType == SCE_DIFF_COMMAND)
nextLevel = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
else if (lineType == SCE_DIFF_HEADER)
nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG; nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG;
else if (lineType == SCE_DIFF_HEADER) { else if (lineType == SCE_DIFF_POSITION && styler[curLineStart] != '-')
nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG; nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG;
} else if (lineType == SCE_DIFF_POSITION) else if (prevLevel & SC_FOLDLEVELHEADERFLAG)
nextLevel = (SC_FOLDLEVELBASE + 3) | SC_FOLDLEVELHEADERFLAG; nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1;
else
nextLevel = prevLevel;
if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel)) if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel))
styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG); styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG);
@@ -582,8 +596,7 @@ static void FoldDiffDoc(unsigned int startPos, int length, int, WordList*[], Acc
} while (static_cast<int>(startPos) + length > curLineStart); } while (static_cast<int>(startPos) + length > curLineStart);
} }
static void ColourisePoLine(
static void ColourisePropsLine(
char *lineBuffer, char *lineBuffer,
unsigned int lengthLine, unsigned int lengthLine,
unsigned int startLine, unsigned int startLine,
@@ -591,8 +604,91 @@ static void ColourisePropsLine(
Accessor &styler) { Accessor &styler) {
unsigned int i = 0; unsigned int i = 0;
static unsigned int state = SCE_PO_DEFAULT;
unsigned int state_start = SCE_PO_DEFAULT;
while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces while ((i < lengthLine) && isspacechar(lineBuffer[i])) // Skip initial spaces
i++; i++;
if (i < lengthLine) {
if (lineBuffer[i] == '#') {
// check if the comment contains any flags ("#, ") and
// then whether the flags contain "fuzzy"
if (strstart(lineBuffer, "#, ") && strstr(lineBuffer, "fuzzy"))
styler.ColourTo(endPos, SCE_PO_FUZZY);
else
styler.ColourTo(endPos, SCE_PO_COMMENT);
} else {
if (lineBuffer[0] == '"') {
// line continuation, use previous style
styler.ColourTo(endPos, state);
return;
// this implicitly also matches "msgid_plural"
} else if (strstart(lineBuffer, "msgid")) {
state_start = SCE_PO_MSGID;
state = SCE_PO_MSGID_TEXT;
} else if (strstart(lineBuffer, "msgstr")) {
state_start = SCE_PO_MSGSTR;
state = SCE_PO_MSGSTR_TEXT;
} else if (strstart(lineBuffer, "msgctxt")) {
state_start = SCE_PO_MSGCTXT;
state = SCE_PO_MSGCTXT_TEXT;
}
if (state_start != SCE_PO_DEFAULT) {
// find the next space
while ((i < lengthLine) && ! isspacechar(lineBuffer[i]))
i++;
styler.ColourTo(startLine + i - 1, state_start);
styler.ColourTo(startLine + i, SCE_PO_DEFAULT);
styler.ColourTo(endPos, state);
}
}
} else {
styler.ColourTo(endPos, SCE_PO_DEFAULT);
}
}
static void ColourisePoDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
char lineBuffer[1024];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;
unsigned int startLine = startPos;
for (unsigned int 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';
ColourisePoLine(lineBuffer, linePos, startLine, i, styler);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0) { // Last line does not have ending characters
ColourisePoLine(lineBuffer, linePos, startLine, startPos + length - 1, styler);
}
}
static inline bool isassignchar(unsigned char ch) {
return (ch == '=') || (ch == ':');
}
static void ColourisePropsLine(
char *lineBuffer,
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
Accessor &styler,
bool allowInitialSpaces) {
unsigned int 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 (i < lengthLine) {
if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') { if (lineBuffer[i] == '#' || lineBuffer[i] == '!' || lineBuffer[i] == ';') {
styler.ColourTo(endPos, SCE_PROPS_COMMENT); styler.ColourTo(endPos, SCE_PROPS_COMMENT);
@@ -600,14 +696,14 @@ static void ColourisePropsLine(
styler.ColourTo(endPos, SCE_PROPS_SECTION); styler.ColourTo(endPos, SCE_PROPS_SECTION);
} else if (lineBuffer[i] == '@') { } else if (lineBuffer[i] == '@') {
styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL); styler.ColourTo(startLine + i, SCE_PROPS_DEFVAL);
if (lineBuffer[++i] == '=') if (isassignchar(lineBuffer[i++]))
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT); styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT); styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else { } else {
// Search for the '=' character // Search for the '=' character
while ((i < lengthLine) && (lineBuffer[i] != '=')) while ((i < lengthLine) && !isassignchar(lineBuffer[i]))
i++; i++;
if ((i < lengthLine) && (lineBuffer[i] == '=')) { if ((i < lengthLine) && isassignchar(lineBuffer[i])) {
styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY); styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT); styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT); styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
@@ -626,18 +722,25 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *
styler.StartSegment(startPos); styler.StartSegment(startPos);
unsigned int linePos = 0; unsigned int linePos = 0;
unsigned int startLine = startPos; unsigned int 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.
bool allowInitialSpaces = styler.GetPropertyInt("lexer.props.allow.initial.spaces", 1) != 0;
for (unsigned int i = startPos; i < startPos + length; i++) { for (unsigned int i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i]; lineBuffer[linePos++] = styler[i];
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) { if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it // End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0'; lineBuffer[linePos] = '\0';
ColourisePropsLine(lineBuffer, linePos, startLine, i, styler); ColourisePropsLine(lineBuffer, linePos, startLine, i, styler, allowInitialSpaces);
linePos = 0; linePos = 0;
startLine = i + 1; startLine = i + 1;
} }
} }
if (linePos > 0) { // Last line does not have ending characters if (linePos > 0) { // Last line does not have ending characters
ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler); ColourisePropsLine(lineBuffer, linePos, startLine, startPos + length - 1, styler, allowInitialSpaces);
} }
} }
@@ -712,7 +815,7 @@ static void FoldPropsDoc(unsigned int startPos, int length, int, WordList *[], A
lev = SC_FOLDLEVELBASE; lev = SC_FOLDLEVELBASE;
} }
int flagsNext = styler.LevelAt(lineCurrent); int flagsNext = styler.LevelAt(lineCurrent);
styler.SetLevel(lineCurrent, lev | flagsNext & ~SC_FOLDLEVELNUMBERMASK); styler.SetLevel(lineCurrent, lev | (flagsNext & ~SC_FOLDLEVELNUMBERMASK));
} }
static void ColouriseMakeLine( static void ColouriseMakeLine(
@@ -814,10 +917,6 @@ static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[
} }
} }
static bool strstart(const char *haystack, const char *needle) {
return strncmp(haystack, needle, strlen(needle)) == 0;
}
static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine, int &startValue) { static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine, int &startValue) {
if (lineBuffer[0] == '>') { if (lineBuffer[0] == '>') {
// Command or return status // Command or return status
@@ -921,7 +1020,7 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) { if ((chNext != '\\') && (chNext != '/') && (chNext != ' ')) {
// This check is not completely accurate as may be on // This check is not completely accurate as may be on
// GTK+ with a file name that includes ':'. // GTK+ with a file name that includes ':'.
state = stGccStart; state = stGccStart;
} else if (chNext == ' ') { // indicates a Lua 5.1 error message } else if (chNext == ' ') { // indicates a Lua 5.1 error message
initialColonPart = true; initialColonPart = true;
} }
@@ -1031,6 +1130,12 @@ static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordLi
styler.StartAt(startPos); styler.StartAt(startPos);
styler.StartSegment(startPos); styler.StartSegment(startPos);
unsigned int linePos = 0; unsigned int linePos = 0;
// 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.
bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0; bool valueSeparate = styler.GetPropertyInt("lexer.errorlist.value.separate", 0) != 0;
for (unsigned int i = startPos; i < startPos + length; i++) { for (unsigned int i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i]; lineBuffer[linePos++] = styler[i];
@@ -1169,6 +1274,7 @@ static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc); LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc); LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", FoldDiffDoc, emptyWordListDesc);
LexerModule lmPo(SCLEX_PO, ColourisePoDoc, "po", 0, emptyWordListDesc);
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc); LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc);
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc); LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc);
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc); LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc);

View File

@@ -4,8 +4,109 @@
** Written by Laurent le Tynevez ** Written by Laurent le Tynevez
** Updated by Simon Steele <s.steele@pnotepad.org> September 2002 ** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments) ** 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 2009 at this time), including .NET specific features.
~ 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")
- 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
2009):
- Keywords: absolute abstract and array as asm assembler automated begin case
cdecl class const constructor deprecated destructor dispid dispinterface div do
downto dynamic else end except export exports external far file final
finalization finally for forward function goto if implementation in inherited
initialization inline interface is label library message mod near nil not object
of on or out overload override packed pascal platform private procedure program
property protected public published raise record 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 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 <stdlib.h>
#include <string.h> #include <string.h>
#include <ctype.h> #include <ctype.h>
@@ -20,12 +121,13 @@
#include "Scintilla.h" #include "Scintilla.h"
#include "SciLexer.h" #include "SciLexer.h"
#include "StyleContext.h" #include "StyleContext.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
#endif #endif
static void getRange(unsigned int start, static void GetRangeLowered(unsigned int start,
unsigned int end, unsigned int end,
Accessor &styler, Accessor &styler,
char *s, char *s,
@@ -38,239 +140,361 @@ static void getRange(unsigned int start,
s[i] = '\0'; s[i] = '\0';
} }
static bool IsStreamCommentStyle(int style) { static void GetForwardRangeLowered(unsigned int start,
return style == SCE_C_COMMENT || CharacterSet &charSet,
style == SCE_C_COMMENTDOC || Accessor &styler,
style == SCE_C_COMMENTDOCKEYWORD || char *s,
style == SCE_C_COMMENTDOCKEYWORDERROR; unsigned int len) {
unsigned int 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';
} }
static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) { enum {
if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) { stateInAsm = 0x1000,
styler.ColourTo(end, SCE_C_REGEX); stateInProperty = 0x2000,
} else stateInExport = 0x4000,
styler.ColourTo(end, attr); stateFoldInPreprocessor = 0x0100,
} stateFoldInRecord = 0x0200,
stateFoldInPreprocessorLevelMask = 0x00FF,
// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm" stateFoldMaskAll = 0x0FFF
static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass, bool bInAsm) { };
int ret = 0;
static void ClassifyPascalWord(WordList *keywordlists[], StyleContext &sc, int &curLineState, bool bSmartHighlighting) {
WordList& keywords = *keywordlists[0]; WordList& keywords = *keywordlists[0];
WordList& classwords = *keywordlists[1];
char s[100]; char s[100];
getRange(start, end, styler, s, sizeof(s)); sc.GetCurrentLowered(s, sizeof(s));
if (keywords.InList(s)) {
char chAttr = SCE_C_IDENTIFIER; if (curLineState & stateInAsm) {
if (isdigit(s[0]) || (s[0] == '.') ||(s[0] == '$')) { if (strcmp(s, "end") == 0 && sc.GetRelative(-4) != '@') {
chAttr = SCE_C_NUMBER; curLineState &= ~stateInAsm;
} sc.ChangeState(SCE_PAS_WORD);
else { } else {
if (s[0] == '#') { sc.ChangeState(SCE_PAS_ASM);
chAttr = SCE_C_CHARACTER; }
} } else {
else { bool ignoreKeyword = false;
if (keywords.InList(s)) { if (strcmp(s, "asm") == 0) {
chAttr = SCE_C_WORD; curLineState |= stateInAsm;
} else if (bSmartHighlighting) {
if(strcmp(s, "class") == 0) { if (strcmp(s, "property") == 0) {
ret = 1; curLineState |= stateInProperty;
} } else if (strcmp(s, "exports") == 0) {
else if (strcmp(s, "asm") == 0) { curLineState |= stateInExport;
ret = 2; } else if (!(curLineState & (stateInProperty | stateInExport)) && strcmp(s, "index") == 0) {
} ignoreKeyword = true;
else if (strcmp(s, "end") == 0) { } else if (!(curLineState & stateInExport) && strcmp(s, "name") == 0) {
ret = -1; ignoreKeyword = true;
} } else if (!(curLineState & stateInProperty) &&
} else if (bInClass) { (strcmp(s, "read") == 0 || strcmp(s, "write") == 0 ||
if (classwords.InList(s)) { strcmp(s, "default") == 0 || strcmp(s, "nodefault") == 0 ||
chAttr = SCE_C_WORD; 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);
} }
ColourTo(styler, end, chAttr, (bInAsm && ret != -1)); sc.SetState(SCE_PAS_DEFAULT);
return ret;
}
static int classifyFoldPointPascal(const char* s) {
int lev = 0;
if (!(isdigit(s[0]) || (s[0] == '.'))) {
if (strcmp(s, "begin") == 0 ||
strcmp(s, "object") == 0 ||
strcmp(s, "case") == 0 ||
strcmp(s, "class") == 0 ||
strcmp(s, "record") == 0 ||
strcmp(s, "try") == 0) {
lev=1;
} else if (strcmp(s, "end") == 0) {
lev=-1;
}
}
return lev;
} }
static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) { Accessor &styler) {
bool bSmartHighlighting = styler.GetPropertyInt("lexer.pascal.smart.highlighting", 1) != 0;
styler.StartAt(startPos); 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, "#$&'()*+,-./:;<=>@[]^{}");
int state = initStyle; int curLine = styler.GetLine(startPos);
if (state == SCE_C_CHARACTER) // Does not leak onto next line int curLineState = curLine > 0 ? styler.GetLineState(curLine - 1) : 0;
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
bool bInClassDefinition; StyleContext sc(startPos, length, initStyle, styler);
int currentLine = styler.GetLine(startPos); for (; sc.More(); sc.Forward()) {
if (currentLine > 0) { if (sc.atLineEnd) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1)); // Update the line state, so it can be seen by next line
bInClassDefinition = (styler.GetLineState(currentLine) == 1); curLine = styler.GetLine(sc.currentPos);
} else { styler.SetLineState(curLine, curLineState);
styler.SetLineState(currentLine, 0);
bInClassDefinition = false;
}
bool bInAsm = (state == SCE_C_REGEX);
if (bInAsm)
state = SCE_C_DEFAULT;
styler.StartSegment(startPos);
for (unsigned int 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;
}
currentLine++;
styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0));
} }
if (styler.IsLeadByte(ch)) { // Determine if the current state should terminate.
chNext = styler.SafeGetCharAt(i + 2); switch (sc.state) {
chPrev = ' '; case SCE_PAS_NUMBER:
i += 1; if (!setNumber.Contains(sc.ch) || (sc.ch == '.' && sc.chNext == '.')) {
continue; sc.SetState(SCE_PAS_DEFAULT);
} } else if (sc.ch == '-' || sc.ch == '+') {
if (sc.chPrev != 'E' && sc.chPrev != 'e') {
if (state == SCE_C_DEFAULT) { sc.SetState(SCE_PAS_DEFAULT);
if (iswordstart(ch) || ch == '#' || ch == '$' || (ch == '@' && bInAsm)) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_IDENTIFIER;
} else if (ch == '{' && chNext != '$' && chNext != '&') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENT;
} else if (ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) != '$'
&& styler.SafeGetCharAt(i + 2) != '&') {
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_CHARACTER;
} else if (ch == '{' && (chNext == '$' || chNext=='&')) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_PREPROCESSOR;
} else if (isoperator(ch)) {
ColourTo(styler, i-1, state, bInAsm);
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
}
} else if (state == SCE_C_IDENTIFIER) {
bool bDoublePoint = ((ch == '.') && (chPrev == '.'));
if ((!iswordchar(ch) && ch != '$' && ch != '#' && (ch != '@' || !bInAsm)) || bDoublePoint) {
if (bDoublePoint) i--;
int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition, 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 (bDoublePoint) {
i++;
ColourTo(styler, i-1, SCE_C_DEFAULT, bInAsm);
}
state = SCE_C_DEFAULT;
chNext = styler.SafeGetCharAt(i + 1);
if (ch == '{' && chNext != '$' && chNext != '&') {
state = SCE_C_COMMENT;
} else if (ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) != '$'
&& styler.SafeGetCharAt(i + 2) != '&') {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (isoperator(ch)) {
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
}
}
} else {
if (state == SCE_C_PREPROCESSOR) {
if (ch=='}'){
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
} else {
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_DEFAULT;
} }
} }
} else if (state == SCE_C_COMMENT) { break;
if (ch == '}' ) { case SCE_PAS_IDENTIFIER:
ColourTo(styler, i, state, bInAsm); if (!setWord.Contains(sc.ch)) {
state = SCE_C_DEFAULT; ClassifyPascalWord(keywordlists, sc, curLineState, bSmartHighlighting);
} }
} else if (state == SCE_C_COMMENTDOC) { break;
if (ch == ')' && chPrev == '*') { case SCE_PAS_HEXNUMBER:
if (((i > styler.GetStartSegment() + 2) || ( if (!setHexNumber.Contains(sc.ch)) {
(initStyle == SCE_C_COMMENTDOC) && sc.SetState(SCE_PAS_DEFAULT);
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) { }
ColourTo(styler, i, state, bInAsm); break;
state = SCE_C_DEFAULT; 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(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eolPos = styler.LineStart(line + 1) - 1;
for (int 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,
unsigned int 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 unsigned int SkipWhiteSpace(unsigned int currentPos, unsigned int endPos,
Accessor &styler, bool includeChars = false) {
CharacterSet setWord(CharacterSet::setAlphaNum, "_");
unsigned int 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,
int startPos, unsigned int endPos,
unsigned int lastStart, unsigned int 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;
unsigned int 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;
} }
}
} 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_CHARACTER) {
if (ch == '\'') {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
} }
} }
} }
chPrev = ch; if (!ignoreKeyword) {
levelCurrent++;
}
} else if (strcmp(s, "interface") == 0) {
// "interface" keyword requires special handling...
bool ignoreKeyword = true;
int 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) {
levelCurrent++;
}
} else if (strcmp(s, "end") == 0) {
lineFoldStateCurrent &= ~stateFoldInRecord;
levelCurrent--;
if (levelCurrent < SC_FOLDLEVELBASE) {
levelCurrent = SC_FOLDLEVELBASE;
}
} }
ColourTo(styler, lengthDoc - 1, state, bInAsm);
} }
static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[], static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[],
Accessor &styler) { Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0; bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0; bool foldPreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
@@ -279,11 +503,13 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev; int levelCurrent = levelPrev;
int lineFoldStateCurrent = lineCurrent > 0 ? styler.GetLineState(lineCurrent - 1) & stateFoldMaskAll : 0;
char chNext = styler[startPos]; char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos); int styleNext = styler.StyleAt(startPos);
int style = initStyle; int style = initStyle;
int lastStart = 0; int lastStart = 0;
CharacterSet setWord(CharacterSet::setAlphaNum, "_", 0x80, true);
for (unsigned int i = startPos; i < endPos; i++) { for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext; char ch = chNext;
@@ -293,45 +519,6 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
styleNext = styler.StyleAt(i + 1); styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (stylePrev != SCE_C_WORD && style == SCE_C_WORD)
{
// Store last word start point.
lastStart = i;
}
if (stylePrev == SCE_C_WORD) {
if(iswordchar(ch) && !iswordchar(chNext)) {
char s[100];
getRange(lastStart, i, styler, s, sizeof(s));
levelCurrent += classifyFoldPointPascal(s);
}
}
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 == '$') {
unsigned int 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 (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) { if (!IsStreamCommentStyle(stylePrev)) {
levelCurrent++; levelCurrent++;
@@ -340,6 +527,37 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
levelCurrent--; 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) { if (atEOL) {
int lev = levelPrev; int lev = levelPrev;
@@ -350,23 +568,24 @@ static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, Word
if (lev != styler.LevelAt(lineCurrent)) { if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev); styler.SetLevel(lineCurrent, lev);
} }
int newLineState = (styler.GetLineState(lineCurrent) & ~stateFoldMaskAll) | lineFoldStateCurrent;
styler.SetLineState(lineCurrent, newLineState);
lineCurrent++; lineCurrent++;
levelPrev = levelCurrent; levelPrev = levelCurrent;
visibleChars = 0; 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 // If we didn't reach the EOL in previous loop, store line level and whitespace information.
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; // The rest will be filled in later...
styler.SetLevel(lineCurrent, levelPrev | flagsNext); int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
styler.SetLevel(lineCurrent, lev);
} }
static const char * const pascalWordListDesc[] = { static const char * const pascalWordListDesc[] = {
"Keywords", "Keywords",
"Classwords",
0 0
}; };

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,600 @@
// 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 szKeyword 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
// passsing 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
//
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "CharacterSet.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsStreamCommentStyle(int style) {
return style == SCE_POWERPRO_COMMENTBLOCK;
}
static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
int nePos = styler.LineStart(szLine + 1) - 2;
while (nsPos < nePos)
{
int stylech = styler.StyleAt(nsPos);
if (!(stylech == SCE_POWERPRO_COMMENTBLOCK)) {
char ch = styler.SafeGetCharAt(nePos);
char chPrev = styler.SafeGetCharAt(nePos-1);
char chPrevPrev = styler.SafeGetCharAt(nePos-2);
if (ch > 0 && chPrev > 0 && chPrevPrev > 0 && !isspacechar(ch) && !isspacechar(chPrev) && !isspacechar(chPrevPrev) ) {
if (chPrevPrev == ';' && chPrev == ';' && ch == '+')
return true;
else
return false;
}
}
nePos--; // 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(unsigned int szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
int nePos = styler.LineStart(szLine+1) - 1;
char ch = styler.SafeGetCharAt(nsPos);
while (ch > 0 && isspacechar(ch) && nsPos < nePos)
{
nsPos++; // skip to next char
ch = styler.SafeGetCharAt(nsPos);
}
return styler.StyleAt(nsPos);
}
//returns true if there is a function to highlight
//used to highlight <name> in 'function <name>'
static bool HasFunction(Accessor &styler, unsigned int currentPos) {
//check for presence of 'function '
return (styler.SafeGetCharAt(currentPos) == ' '
&& tolower(styler.SafeGetCharAt(currentPos-1)) == 'n'
&& tolower(styler.SafeGetCharAt(currentPos-2)) == 'o'
&& tolower(styler.SafeGetCharAt(currentPos-3)) == 'i'
&& tolower(styler.SafeGetCharAt(currentPos-4)) == 't'
&& tolower(styler.SafeGetCharAt(currentPos-5)) == 'c'
&& tolower(styler.SafeGetCharAt(currentPos-6)) == 'n'
&& tolower(styler.SafeGetCharAt(currentPos-7)) == 'u'
&& tolower(styler.SafeGetCharAt(currentPos-8)) == 'f'
//only allow 'function ' to appear at the beginning of a line
&& (styler.SafeGetCharAt(currentPos-9) == '\n'
|| styler.SafeGetCharAt(currentPos-9) == '\r'
|| (styler.SafeGetCharAt(currentPos -9, '\0')) == '\0') //is the first line
);
}
static void ColourisePowerProDoc(unsigned int startPos, int 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
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 = 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 (sc.ch == '\r' || sc.ch == '\n' || 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 (HasFunction(styler, sc.currentPos)) { //highlight <name> in 'function <name>'
sc.SetState(SCE_POWERPRO_FUNCTION);
} else if (sc.ch == '@' && sc.atLineStart) { //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 (sc.atLineStart && sc.ch == ';') { //legacy comment that can only appear at the beginning of a line
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);
}
}
}
//*************************************
// 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(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
{
//define the character sets
CharacterSet setWordStart(CharacterSet::setAlpha, "_@", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
bool isFoldingAll = true; //used to tell if we're recursively folding the whole document, or just a small piece (ie: if statement or 1 function)
int endPos = startPos + length;
int 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
int 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 FirstWordStart = false;
bool FirstWordEnd = false;
const unsigned int KEYWORD_MAX = 10;
char szKeyword[KEYWORD_MAX]="";
unsigned int szKeywordlen = 0;
char szDo[3]="";
int szDolen = 0;
bool DoFoundLast = 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 (int 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);
// get first word for the line for indent check max 9 characters
if (FirstWordStart && (!(FirstWordEnd))) {
if ((ch > 0) && !setWord.Contains(ch)) {
FirstWordEnd = true;
}
else if (szKeywordlen < KEYWORD_MAX - 1) {
szKeyword[szKeywordlen++] = static_cast<char>(tolower(ch));
szKeyword[szKeywordlen] = '\0';
}
}
// start the capture of the first word
if (!(FirstWordStart)) {
if ((ch > 0) && (setWord.Contains(ch) || setWordStart.Contains(ch) || ch == ';' || ch == '/')) {
FirstWordStart = true;
if (szKeywordlen < KEYWORD_MAX - 1) {
szKeyword[szKeywordlen++] = static_cast<char>(tolower(ch));
szKeyword[szKeywordlen] = '\0';
}
}
}
// only process this logic when not in comment section
if (stylech != SCE_POWERPRO_COMMENTLINE) {
if (DoFoundLast) {
if (DoFoundLast && (ch > 0) && setWord.Contains(ch)) {
DoFoundLast = false;
}
}
// find out if the word "do" is the last on a "if" line
if (FirstWordEnd && strcmp(szKeyword,"if") == 0) {
if (szDolen == 2) {
szDo[0] = szDo[1];
szDo[1] = static_cast<char>(tolower(ch));
szDo[2] = '\0';
if (strcmp(szDo,"do") == 0 ) {
DoFoundLast = 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') || (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 == '+' && chPrevPrev == ';' && chPrevPrevPrev ==';')) &&
((!(IsStreamCommentStyle(style)) || foldInComment)) ) {
// only fold "if" last keyword is "then" (else its a one line if)
if (strcmp(szKeyword,"if") == 0 && DoFoundLast) {
levelNext++;
}
// create new fold for these words
if (strcmp(szKeyword,"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(szKeyword,"function") == 0) || (szKeywordlen > 0 && szKeyword[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(szKeyword,"endif") == 0 || strcmp(szKeyword,"endfor") == 0) {
levelNext--;
levelCurrent--;
}
// end the fold for these words before the current line and Start new fold
if (strcmp(szKeyword,"else") == 0 || strcmp(szKeyword,"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 == ';') {
//do nothing
} else {
szKeywordlen = 0;
szDolen = 0;
FirstWordStart = false;
FirstWordEnd = false;
DoFoundLast = false;
//blank out keyword
for (unsigned int i = 0; i < KEYWORD_MAX; i++) {
szKeyword[i] = '\0';
}
}
}
// save the last processed characters
if ((ch > 0) && !isspacechar(ch)) {
chPrevPrevPrev = chPrevPrev;
chPrevPrev = chPrev;
chPrev = ch;
visibleChars++;
}
}
//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(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
ColourisePowerProDoc(startPos, length, initStyle, keywordlists, styler, false);
}
LexerModule lmPowerPro(SCLEX_POWERPRO, ColourisePowerProDocWrapper, "powerpro", FoldPowerProDoc, powerProWordLists);

View File

@@ -0,0 +1,175 @@
// 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 <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
return ch >= 0x80 || isalnum(ch) || ch == '-';
}
static void ColourisePowerShellDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
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_STRING) {
// This is a doubles quotes string
if (sc.ch == '\"') {
sc.ForwardSetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_CHARACTER) {
// This is a single quote string
if (sc.ch == '\'') {
sc.ForwardSetState(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);
}
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.SetState(SCE_POWERSHELL_STRING);
} else if (sc.ch == '\'') {
sc.SetState(SCE_POWERSHELL_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);
}
}
}
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(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int 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 (unsigned int 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_POWERSHELL_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 (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",
0
};
LexerModule lmPowerShell(SCLEX_POWERSHELL, ColourisePowerShellDoc, "powershell", FoldPowerShellDoc, powershellWordLists);

View File

@@ -9,7 +9,6 @@
/** TODO: /** TODO:
WebSpeed support in html lexer WebSpeed support in html lexer
Support "end triggers" expression of the triggers phrase Support "end triggers" expression of the triggers phrase
change lmPS to lmProgress
Support more than 6 comments levels Support more than 6 comments levels
**/ **/
#include <stdlib.h> #include <stdlib.h>
@@ -44,11 +43,11 @@ enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true
static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) { Accessor &styler) {
WordList &keywords1 = *keywordlists[0]; WordList &keywords1 = *keywordlists[0]; // regular keywords
WordList &keywords2 = *keywordlists[1]; WordList &keywords2 = *keywordlists[1]; // block opening keywords, only when SentenceStart
WordList &keywords3 = *keywordlists[2]; WordList &keywords3 = *keywordlists[2]; // block opening keywords
//WordList &keywords4 = *keywordlists[3]; //WordList &keywords4 = *keywordlists[3]; // preprocessor keywords. Not implemented
//WordList &keywords5 = *keywordlists[4];
int visibleChars = 0; int visibleChars = 0;
int mask; int mask;
@@ -64,23 +63,28 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
} }
// Handle line continuation generically. // Handle line continuation generically.
if ((sc.state & 0xf) < SCE_4GL_COMMENT1) {
if (sc.ch == '~') { if (sc.ch == '~') {
// Skip whitespace between ~ and EOL if (sc.chNext > ' ') {
/* do { // skip special char after ~
sc.Forward();
} */
while ((sc.chNext == ' ' || sc.chNext == '\t') ) {
sc.Forward();
sc.More();
}
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
sc.Forward(); sc.Forward();
continue; continue;
} }
else {
// Skip whitespace between ~ and EOL
while (sc.More() && (sc.chNext == ' ' || sc.chNext == '\t') ) {
sc.Forward();
}
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
sc.Forward();
continue;
}
}
}
} }
// Determine if a new state should be terminated. // Determine if a new state should be terminated.
mask = sc.state & 0x10; mask = sc.state & 0x10;
@@ -97,7 +101,7 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
if (!IsAWordChar(sc.ch) && sc.ch != '-') { if (!IsAWordChar(sc.ch) && sc.ch != '-') {
char s[1000]; char s[1000];
sc.GetCurrentLowered(s, sizeof(s)); sc.GetCurrentLowered(s, sizeof(s));
if (((sc.state & 0x10) == 0) && keywords2.InList(s) || keywords3.InList(s)) { if ((((sc.state & 0x10) == 0) && keywords2.InList(s)) || keywords3.InList(s)) {
sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart); sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart);
} }
else if (keywords1.InList(s)) { else if (keywords1.InList(s)) {
@@ -119,9 +123,10 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
case SCE_4GL_PREPROCESSOR: case SCE_4GL_PREPROCESSOR:
if (sc.atLineStart) { if (sc.atLineStart) {
sc.SetState(SCE_4GL_DEFAULT & SetSentenceStart); sc.SetState(SCE_4GL_DEFAULT & SetSentenceStart);
} else if (sc.ch == '*' && sc.chNext == '/') {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
} }
/* code removed to allow comments inside preprocessor
else if (sc.ch == '*' && sc.chNext == '/') {
sc.ForwardSetState(SCE_4GL_DEFAULT | sentenceStartState); } */
break; break;
case SCE_4GL_STRING: case SCE_4GL_STRING:
if (sc.ch == '\"') { if (sc.ch == '\"') {
@@ -173,9 +178,12 @@ static void Colourise4glDoc(unsigned int startPos, int length, int initStyle, Wo
} else if ((sc.ch == '.' || sc.ch == ':' || sc.ch == '}') && (sc.chNext == ' ' || sc.chNext == '\t' || sc.chNext == '\n' || sc.chNext == '\r')) { } else if ((sc.ch == '.' || sc.ch == ':' || sc.ch == '}') && (sc.chNext == ' ' || sc.chNext == '\t' || sc.chNext == '\n' || sc.chNext == '\r')) {
sc.SetState(sc.state & SetSentenceStart); sc.SetState(sc.state & SetSentenceStart);
} else if (isoperator(static_cast<char>(sc.ch))) { } else if (isoperator(static_cast<char>(sc.ch))) {
/* This code allows highlight of handles. Alas, it would cause the phrase "last-event:function"
to be recognized as a BlockBegin */
if (sc.ch == ':') if (sc.ch == ':')
sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart); sc.SetState(SCE_4GL_OPERATOR & SetSentenceStart);
else /* else */
sc.SetState(SCE_4GL_OPERATOR | ResetSentenceStart); sc.SetState(SCE_4GL_OPERATOR | ResetSentenceStart);
} }
} }
@@ -268,4 +276,4 @@ static const char * const FglWordLists[] = {
0, 0,
}; };
LexerModule lmProgress(SCLEX_PS, Colourise4glDoc, "progress", Fold4glDoc, FglWordLists); LexerModule lmProgress(SCLEX_PROGRESS, Colourise4glDoc, "progress", Fold4glDoc, FglWordLists);

View File

@@ -24,17 +24,27 @@
using namespace Scintilla; using namespace Scintilla;
#endif #endif
enum kwType { kwOther, kwClass, kwDef, kwImport }; /* kwCDef, kwCTypeName only used for Cython */
enum kwType { kwOther, kwClass, kwDef, kwImport, kwCDef, kwCTypeName };
static const int indicatorWhitespace = 1; static const int indicatorWhitespace = 1;
static bool IsPyComment(Accessor &styler, int pos, int len) { static bool IsPyComment(Accessor &styler, int pos, int len) {
return len > 0 && styler[pos] == '#'; return len > 0 && styler[pos] == '#';
} }
static bool IsPyStringStart(int ch, int chNext, int chNext2) { enum literalsAllowed { litNone=0, litU=1, litB=2};
static bool IsPyStringTypeChar(int ch, literalsAllowed allowed) {
return
((allowed & litB) && (ch == 'b' || ch == 'B')) ||
((allowed & litU) && (ch == 'u' || ch == 'U'));
}
static bool IsPyStringStart(int ch, int chNext, int chNext2, literalsAllowed allowed) {
if (ch == '\'' || ch == '"') if (ch == '\'' || ch == '"')
return true; return true;
if (ch == 'u' || ch == 'U') { if (IsPyStringTypeChar(ch, allowed)) {
if (chNext == '"' || chNext == '\'') if (chNext == '"' || chNext == '\'')
return true; return true;
if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\'')) if ((chNext == 'r' || chNext == 'R') && (chNext2 == '"' || chNext2 == '\''))
@@ -47,16 +57,16 @@ static bool IsPyStringStart(int ch, int chNext, int chNext2) {
} }
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */ /* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
static int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex) { static int GetPyStringState(Accessor &styler, int i, unsigned int *nextIndex, literalsAllowed allowed) {
char ch = styler.SafeGetCharAt(i); char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1); char chNext = styler.SafeGetCharAt(i + 1);
// Advance beyond r, u, or ur prefix, but bail if there are any unexpected chars // Advance beyond r, u, or ur prefix (or r, b, or br in Python 3.0), but bail if there are any unexpected chars
if (ch == 'r' || ch == 'R') { if (ch == 'r' || ch == 'R') {
i++; i++;
ch = styler.SafeGetCharAt(i); ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1); chNext = styler.SafeGetCharAt(i + 1);
} else if (ch == 'u' || ch == 'U') { } else if (IsPyStringTypeChar(ch, allowed)) {
if (chNext == 'r' || chNext == 'R') if (chNext == 'r' || chNext == 'R')
i += 2; i += 2;
else else
@@ -96,7 +106,7 @@ static inline bool IsAWordStart(int ch) {
} }
static void ColourisePyDoc(unsigned int startPos, int length, int initStyle, static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) { WordList *keywordlists[], Accessor &styler) {
int endPos = startPos + length; int endPos = startPos + length;
@@ -105,19 +115,53 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
if (startPos > 0) { if (startPos > 0) {
if (lineCurrent > 0) { if (lineCurrent > 0) {
lineCurrent--; lineCurrent--;
// Look for backslash-continued lines
while (lineCurrent > 0) {
int eolPos = styler.LineStart(lineCurrent) - 1;
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); startPos = styler.LineStart(lineCurrent);
if (startPos == 0)
initStyle = SCE_P_DEFAULT;
else
initStyle = styler.StyleAt(startPos - 1);
} }
initStyle = startPos == 0 ? SCE_P_DEFAULT : styler.StyleAt(startPos - 1);
} }
WordList &keywords = *keywordlists[0]; WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1]; WordList &keywords2 = *keywordlists[1];
// property tab.timmy.whinge.level
// 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.
const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level"); const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
// property lexer.python.literals.binary
// Set to 0 to not recognise Python 3 binary and octal literals: 0b1011 0o712.
bool base2or8Literals = styler.GetPropertyInt("lexer.python.literals.binary", 1) != 0;
// property lexer.python.strings.u
// Set to 0 to not recognise Python Unicode literals u"x" as used before Python 3.
literalsAllowed allowedLiterals = (styler.GetPropertyInt("lexer.python.strings.u", 1)) ? litU : litNone;
// property lexer.python.strings.b
// Set to 0 to not recognise Python 3 bytes literals b"x".
if (styler.GetPropertyInt("lexer.python.strings.b", 1))
allowedLiterals = static_cast<literalsAllowed>(allowedLiterals | litB);
// property lexer.python.strings.over.newline
// Set to 1 to allow strings to span newline characters.
bool stringsOverNewline = styler.GetPropertyInt("lexer.python.strings.over.newline") != 0;
initStyle = initStyle & 31; initStyle = initStyle & 31;
if (initStyle == SCE_P_STRINGEOL) { if (initStyle == SCE_P_STRINGEOL) {
initStyle = SCE_P_DEFAULT; initStyle = SCE_P_DEFAULT;
@@ -126,12 +170,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
kwType kwLast = kwOther; kwType kwLast = kwOther;
int spaceFlags = 0; int spaceFlags = 0;
styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment); styler.IndentAmount(lineCurrent, &spaceFlags, IsPyComment);
bool hexadecimal = false; bool base_n_number = false;
StyleContext sc(startPos, endPos - startPos, initStyle, styler); StyleContext sc(startPos, endPos - startPos, initStyle, styler);
bool indentGood = true; bool indentGood = true;
int startIndicator = sc.currentPos; int startIndicator = sc.currentPos;
bool inContinuedString = false;
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
@@ -163,8 +208,12 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
} }
lineCurrent++; lineCurrent++;
if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) { if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
sc.ChangeState(SCE_P_STRINGEOL); if (inContinuedString || stringsOverNewline) {
sc.ForwardSetState(SCE_P_DEFAULT); inContinuedString = false;
} else {
sc.ChangeState(SCE_P_STRINGEOL);
sc.ForwardSetState(SCE_P_DEFAULT);
}
} }
if (!sc.More()) if (!sc.More())
break; break;
@@ -178,7 +227,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_P_DEFAULT); sc.SetState(SCE_P_DEFAULT);
} else if (sc.state == SCE_P_NUMBER) { } else if (sc.state == SCE_P_NUMBER) {
if (!IsAWordChar(sc.ch) && if (!IsAWordChar(sc.ch) &&
!(!hexadecimal && ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { !(!base_n_number && ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) {
sc.SetState(SCE_P_DEFAULT); sc.SetState(SCE_P_DEFAULT);
} }
} else if (sc.state == SCE_P_IDENTIFIER) { } else if (sc.state == SCE_P_IDENTIFIER) {
@@ -194,6 +243,23 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
style = SCE_P_CLASSNAME; style = SCE_P_CLASSNAME;
} else if (kwLast == kwDef) { } else if (kwLast == kwDef) {
style = SCE_P_DEFNAME; style = SCE_P_DEFNAME;
} else if (kwLast == kwCDef) {
int 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)) { } else if (keywords2.InList(s)) {
style = SCE_P_WORD2; style = SCE_P_WORD2;
} }
@@ -206,9 +272,13 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
kwLast = kwDef; kwLast = kwDef;
else if (0 == strcmp(s, "import")) else if (0 == strcmp(s, "import"))
kwLast = kwImport; kwLast = kwImport;
else else if (0 == strcmp(s, "cdef"))
kwLast = kwCDef;
else if (0 == strcmp(s, "cimport"))
kwLast = kwImport;
else if (kwLast != kwCDef)
kwLast = kwOther; kwLast = kwOther;
} else { } else if (kwLast != kwCDef) {
kwLast = kwOther; kwLast = kwOther;
} }
} }
@@ -225,7 +295,12 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) { if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) {
sc.Forward(); sc.Forward();
} }
sc.Forward(); if (sc.chNext == '\n' || sc.chNext == '\r') {
inContinuedString = true;
} else {
// Don't roll over the newline.
sc.Forward();
}
} else if ((sc.state == SCE_P_STRING) && (sc.ch == '\"')) { } else if ((sc.state == SCE_P_STRING) && (sc.ch == '\"')) {
sc.ForwardSetState(SCE_P_DEFAULT); sc.ForwardSetState(SCE_P_DEFAULT);
needEOLCheck = true; needEOLCheck = true;
@@ -259,6 +334,11 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
indentGood = true; indentGood = true;
} }
// One cdef line, clear kwLast only at end of line
if (kwLast == kwCDef && sc.atLineEnd) {
kwLast = kwOther;
}
// State exit code may have moved on to end of line // State exit code may have moved on to end of line
if (needEOLCheck && sc.atLineEnd) { if (needEOLCheck && sc.atLineEnd) {
lineCurrent++; lineCurrent++;
@@ -271,20 +351,30 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
if (sc.state == SCE_P_DEFAULT) { if (sc.state == SCE_P_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) { if (sc.ch == '0' && (sc.chNext == 'x' || sc.chNext == 'X')) {
hexadecimal = true; 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 (base2or8Literals) {
base_n_number = true;
sc.SetState(SCE_P_NUMBER);
} else {
sc.SetState(SCE_P_NUMBER);
sc.ForwardSetState(SCE_P_IDENTIFIER);
}
} else { } else {
hexadecimal = false; base_n_number = false;
sc.SetState(SCE_P_NUMBER);
} }
sc.SetState(SCE_P_NUMBER); } else if ((isascii(sc.ch) && isoperator(static_cast<char>(sc.ch))) || sc.ch == '`') {
} else if (isascii(sc.ch) && isoperator(static_cast<char>(sc.ch)) || sc.ch == '`') {
sc.SetState(SCE_P_OPERATOR); sc.SetState(SCE_P_OPERATOR);
} else if (sc.ch == '#') { } else if (sc.ch == '#') {
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE); sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
} else if (sc.ch == '@') { } else if (sc.ch == '@') {
sc.SetState(SCE_P_DECORATOR); sc.SetState(SCE_P_DECORATOR);
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2))) { } else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2), allowedLiterals)) {
unsigned int nextIndex = 0; unsigned int nextIndex = 0;
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex)); sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex, allowedLiterals));
while (nextIndex > (sc.currentPos + 1) && sc.More()) { while (nextIndex > (sc.currentPos + 1) && sc.More()) {
sc.Forward(); sc.Forward();
} }
@@ -321,9 +411,17 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
const int maxPos = startPos + length; const int maxPos = startPos + length;
const int maxLines = styler.GetLine(maxPos - 1); // Requested last line const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
// property fold.comment.python
// This option enables folding multi-line comments when using the Python lexer.
const bool foldComment = styler.GetPropertyInt("fold.comment.python") != 0; const bool foldComment = styler.GetPropertyInt("fold.comment.python") != 0;
// property fold.quotes.python
// This option enables folding multi-line quoted strings when using the Python lexer.
const bool foldQuotes = styler.GetPropertyInt("fold.quotes.python") != 0; const bool foldQuotes = styler.GetPropertyInt("fold.quotes.python") != 0;
const bool foldCompact = styler.GetPropertyInt("fold.compact") != 0;
// Backtrack to previous non-blank line so we can determine indent level // Backtrack to previous non-blank line so we can determine indent level
// for any white space lines (needed esp. within triple quoted strings) // 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 // and so we can fix any preceding fold level (which is why we go back
@@ -422,12 +520,21 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
while (--skipLine > lineCurrent) { while (--skipLine > lineCurrent) {
int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL); int skipLineIndent = styler.IndentAmount(skipLine, &spaceFlags, NULL);
if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments) if (foldCompact) {
skipLevel = levelBeforeComments; if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > levelAfterComments)
skipLevel = levelBeforeComments;
int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG;
styler.SetLevel(skipLine, skipLevel | whiteFlag); 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/non-comment line // Set fold header on non-quote/non-comment line
@@ -459,3 +566,4 @@ static const char * const pythonWordListDesc[] = {
LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc, LexerModule lmPython(SCLEX_PYTHON, ColourisePyDoc, "python", FoldPyDoc,
pythonWordListDesc); pythonWordListDesc);

View File

@@ -784,13 +784,13 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
state = SCE_RB_COMMENTLINE; state = SCE_RB_COMMENTLINE;
} else if (ch == '=') { } else if (ch == '=') {
// =begin indicates the start of a comment (doc) block // =begin indicates the start of a comment (doc) block
if (i == 0 || isEOLChar(chPrev) if (i == 0 || (isEOLChar(chPrev)
&& chNext == 'b' && chNext == 'b'
&& styler.SafeGetCharAt(i + 2) == 'e' && styler.SafeGetCharAt(i + 2) == 'e'
&& styler.SafeGetCharAt(i + 3) == 'g' && styler.SafeGetCharAt(i + 3) == 'g'
&& styler.SafeGetCharAt(i + 4) == 'i' && styler.SafeGetCharAt(i + 4) == 'i'
&& styler.SafeGetCharAt(i + 5) == 'n' && styler.SafeGetCharAt(i + 5) == 'n'
&& !isSafeWordcharOrHigh(styler.SafeGetCharAt(i + 6))) { && !isSafeWordcharOrHigh(styler.SafeGetCharAt(i + 6)))) {
styler.ColourTo(i - 1, state); styler.ColourTo(i - 1, state);
state = SCE_RB_POD; state = SCE_RB_POD;
} else { } else {
@@ -1641,7 +1641,7 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
if (foldComment && stylePrev != SCE_RB_COMMENTLINE) { if (foldComment && stylePrev != SCE_RB_COMMENTLINE) {
if (chNext == '{') { if (chNext == '{') {
levelCurrent++; levelCurrent++;
} else if (chNext == '}') { } else if (chNext == '}' && levelCurrent > 0) {
levelCurrent--; levelCurrent--;
} }
} }
@@ -1692,6 +1692,7 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
visibleChars++; visibleChars++;
buffer_ends_with_eol = false; 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 // 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) { if (!buffer_ends_with_eol) {

View File

@@ -0,0 +1,223 @@
// 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 <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
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 == '_';}
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
void ColouriseSMLDoc(
unsigned int startPos, int 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;
int chBase = 0, chToken = 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;
int 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 int n = sc.currentPos - chToken;
if (n < 24) {
char t[24];
for (int 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();
}
void FoldSMLDoc(
unsigned int startPos, int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
{
//supress "not used" warnings
startPos || length || initStyle || keywordlists[0] || styler.Length();
}
static const char * const SMLWordListDesc[] = {
"Keywords",
"Keywords2",
"Keywords3",
0
};
LexerModule lmSML(SCLEX_SML, ColouriseSMLDoc, "SML", FoldSMLDoc, SMLWordListDesc);

View File

@@ -61,7 +61,10 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
StyleContext sc(startPos, length, initStyle, styler); StyleContext sc(startPos, length, initStyle, styler);
// property sql.backslash.escapes
// Enables backslash as an escape character in SQL.
bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0; bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0; bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0;
int styleBeforeDCKeyword = SCE_SQL_DEFAULT; int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
for (; sc.More(); sc.Forward()) { for (; sc.More(); sc.Forward()) {
@@ -228,6 +231,10 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0; bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
// property fold.sql.exists
// Enables "EXISTS" to end a fold as is started by "IF" in "DROP TABLE IF EXISTS".
bool foldSqlExists = styler.GetPropertyInt("fold.sql.exists", 1) != 0;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
int visibleChars = 0; int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
@@ -300,9 +307,13 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
} }
} else if (strcmp(s, "begin") == 0) { } else if (strcmp(s, "begin") == 0) {
levelNext++; levelNext++;
} else if (strcmp(s, "end") == 0 || } else if ((strcmp(s, "end") == 0) ||
// DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS // // DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS
strcmp(s, "exists") == 0) { (foldSqlExists && (strcmp(s, "exists") == 0)) ||
// // SQL Anywhere permits IF ... ELSE ... ENDIF
// // will only be active if "endif" appears in the
// // keyword list.
(strcmp(s, "endif") == 0)) {
endFound = true; endFound = true;
levelNext--; levelNext--;
if (levelNext < SC_FOLDLEVELBASE) { if (levelNext < SC_FOLDLEVELBASE) {

View File

@@ -0,0 +1,205 @@
// 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 <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
//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(unsigned int startPos, int 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);

View File

@@ -10,6 +10,8 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <string>
#include "Platform.h" #include "Platform.h"
#include "Accessor.h" #include "Accessor.h"
@@ -17,7 +19,6 @@
#include "PropSet.h" #include "PropSet.h"
#include "KeyWords.h" #include "KeyWords.h"
#include "SciLexer.h" #include "SciLexer.h"
#include "SString.h"
#ifdef SCI_NAMESPACE #ifdef SCI_NAMESPACE
using namespace Scintilla; using namespace Scintilla;
@@ -75,7 +76,7 @@ static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute
static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) { static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true; apostropheStartsAttribute = true;
SString number; std::string number;
sc.SetState(SCE_SPICE_NUMBER); sc.SetState(SCE_SPICE_NUMBER);
// Get all characters up to a delimiter or a separator, including points, but excluding // Get all characters up to a delimiter or a separator, including points, but excluding
// double points (ranges). // double points (ranges).
@@ -104,7 +105,7 @@ static void ColouriseWhiteSpace(StyleContext& sc, bool& ) {
static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute) { static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute) {
apostropheStartsAttribute = true; apostropheStartsAttribute = true;
sc.SetState(SCE_SPICE_IDENTIFIER); sc.SetState(SCE_SPICE_IDENTIFIER);
SString word; std::string word;
while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) { while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
word += static_cast<char>(tolower(sc.ch)); word += static_cast<char>(tolower(sc.ch));
sc.Forward(); sc.Forward();

View File

@@ -0,0 +1,397 @@
// 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 TACL
**/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
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(unsigned int start,
unsigned int end,
Accessor &styler,
char *s,
unsigned int len) {
unsigned int 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, unsigned int 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(unsigned int start, unsigned int 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(unsigned int startPos, int 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];
unsigned int lengthDoc = startPos + length;
bool bInClassDefinition;
int 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;
unsigned int 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<unsigned int>(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(unsigned int startPos, int 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;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int 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;
int lastStart = 0;
for (unsigned int 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 == '$') {
unsigned int 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);

View File

@@ -679,7 +679,7 @@ static const int T3_EXPECTINGPUNCTUATION = 1 << 14;
static inline bool IsStringTransition(int s1, int s2) { static inline bool IsStringTransition(int s1, int s2) {
return s1 != s2 return s1 != s2
&& (s1 == SCE_T3_S_STRING || s1 == SCE_T3_X_STRING && (s1 == SCE_T3_S_STRING || s1 == SCE_T3_X_STRING
|| s1 == SCE_T3_D_STRING && s2 != SCE_T3_X_DEFAULT) || (s1 == SCE_T3_D_STRING && s2 != SCE_T3_X_DEFAULT))
&& s2 != SCE_T3_LIB_DIRECTIVE && s2 != SCE_T3_LIB_DIRECTIVE
&& s2 != SCE_T3_MSG_PARAM && s2 != SCE_T3_MSG_PARAM
&& s2 != SCE_T3_HTML_TAG && s2 != SCE_T3_HTML_TAG

View File

@@ -0,0 +1,396 @@
// 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 <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
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(unsigned int start,
unsigned int end,
Accessor &styler,
char *s,
unsigned int len) {
unsigned int 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, unsigned int 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(unsigned int start, unsigned int 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(unsigned int startPos, int 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];
unsigned int lengthDoc = startPos + length;
bool bInClassDefinition;
int 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 (unsigned int 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<unsigned int>(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(unsigned int startPos, int 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;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int 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;
int lastStart = 0;
for (unsigned int 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 == '$') {
unsigned int 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);

View File

@@ -242,8 +242,11 @@ static void ColouriseTeXDoc(
} }
} }
if (isTeXzero(sc.ch)) { if (isTeXzero(sc.ch)) {
sc.SetState(SCE_TEX_SYMBOL) ; sc.SetState(SCE_TEX_SYMBOL);
sc.ForwardSetState(SCE_TEX_DEFAULT) ;
if (!endOfLine(styler,sc.currentPos + 1))
sc.ForwardSetState(SCE_TEX_DEFAULT) ;
inComment = ! processComment ; inComment = ! processComment ;
newifDone = false ; newifDone = false ;
} else if (isTeXseven(sc.ch) && isTeXseven(sc.chNext)) { } else if (isTeXseven(sc.ch) && isTeXseven(sc.chNext)) {
@@ -395,7 +398,7 @@ static void FoldTexDoc(unsigned int startPos, int length, int, WordList *[], Acc
levelCurrent += classifyFoldPointTeXPaired(buffer)+classifyFoldPointTeXUnpaired(buffer); levelCurrent += classifyFoldPointTeXPaired(buffer)+classifyFoldPointTeXUnpaired(buffer);
} }
if((ch == '\r' || ch=='\n') && (chNext == '\\')){ if (levelCurrent > SC_FOLDLEVELBASE && ((ch == '\r' || ch=='\n') && (chNext == '\\'))) {
ParseTeXCommand(i+1, styler, buffer); ParseTeXCommand(i+1, styler, buffer);
levelCurrent -= classifyFoldPointTeXUnpaired(buffer); levelCurrent -= classifyFoldPointTeXUnpaired(buffer);
} }

View File

@@ -214,6 +214,40 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
visibleChars++; 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(); sc.Complete();
} }

View File

@@ -97,7 +97,7 @@ static void ColouriseVerilogDoc(unsigned int startPos, int length, int initStyle
sc.ForwardSetState(SCE_V_DEFAULT); sc.ForwardSetState(SCE_V_DEFAULT);
} }
} else if (sc.state == SCE_V_COMMENTLINE || sc.state == SCE_V_COMMENTLINEBANG) { } else if (sc.state == SCE_V_COMMENTLINE || sc.state == SCE_V_COMMENTLINEBANG) {
if (sc.atLineEnd) { if (sc.atLineStart) {
sc.SetState(SCE_V_DEFAULT); sc.SetState(SCE_V_DEFAULT);
} }
} else if (sc.state == SCE_V_STRING) { } else if (sc.state == SCE_V_STRING) {
@@ -164,11 +164,11 @@ static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle
// Generally used methodology in verilog code is // Generally used methodology in verilog code is
// one module per file, so folding at module definition is useless. // one module per file, so folding at module definition is useless.
// fold_at_brace/parenthese - // fold_at_brace/parenthese -
// Folding of long port lists can be convenient. // Folding of long port lists can be convenient.
bool foldAtModule = styler.GetPropertyInt("fold.verilog.flags", 0) != 0; bool foldAtModule = styler.GetPropertyInt("fold.verilog.flags", 0) != 0;
bool foldAtBrace = 1; bool foldAtBrace = 1;
bool foldAtParenthese = 1; bool foldAtParenthese = 1;
unsigned int endPos = startPos + length; unsigned int endPos = startPos + length;
int visibleChars = 0; int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos); int lineCurrent = styler.GetLine(startPos);
@@ -238,27 +238,29 @@ static void FoldNoBoxVerilogDoc(unsigned int startPos, int length, int initStyle
} }
if (style == SCE_V_WORD && stylePrev != SCE_V_WORD) { if (style == SCE_V_WORD && stylePrev != SCE_V_WORD) {
unsigned int j = i; unsigned int j = i;
if (styler.Match(j, "case") || if (styler.Match(j, "case") ||
styler.Match(j, "casex") || styler.Match(j, "casex") ||
styler.Match(j, "casez") || styler.Match(j, "casez") ||
styler.Match(j, "function") || styler.Match(j, "function") ||
styler.Match(j, "fork") || styler.Match(j, "fork") ||
styler.Match(j, "table") || styler.Match(j, "table") ||
styler.Match(j, "task") || styler.Match(j, "task") ||
styler.Match(j, "specify") || styler.Match(j, "generate") ||
styler.Match(j, "primitive") || styler.Match(j, "specify") ||
styler.Match(j, "module") && foldAtModule || styler.Match(j, "primitive") ||
(styler.Match(j, "module") && foldAtModule) ||
styler.Match(j, "begin")) { styler.Match(j, "begin")) {
levelNext++; levelNext++;
} else if (styler.Match(j, "endcase") || } else if (styler.Match(j, "endcase") ||
styler.Match(j, "endfunction") || styler.Match(j, "endfunction") ||
styler.Match(j, "join") || styler.Match(j, "join") ||
styler.Match(j, "endtask") || styler.Match(j, "endtask") ||
styler.Match(j, "endgenerate") ||
styler.Match(j, "endtable") || styler.Match(j, "endtable") ||
styler.Match(j, "endspecify") || styler.Match(j, "endspecify") ||
styler.Match(j, "endprimitive") || styler.Match(j, "endprimitive") ||
styler.Match(j, "endmodule") && foldAtModule || (styler.Match(j, "endmodule") && foldAtModule) ||
styler.Match(j, "end") && !IsAWordChar(styler.SafeGetCharAt(j+3))) { (styler.Match(j, "end") && !IsAWordChar(styler.SafeGetCharAt(j+3)))) {
levelNext--; levelNext--;
} }
} }

View File

@@ -3,7 +3,7 @@
** Lexer for YAML. ** Lexer for YAML.
**/ **/
// Copyright 2003- by Sean O'Dell <sean@celsoft.com> // Copyright 2003- by Sean O'Dell <sean@celsoft.com>
// Release under the same license as Scintilla/SciTE. // The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
@@ -147,7 +147,7 @@ static void ColouriseYAMLLine(
} else { } else {
unsigned int i2 = i; unsigned int i2 = i;
while ((i < lengthLine) && lineBuffer[i]) { while ((i < lengthLine) && lineBuffer[i]) {
if (!isdigit(lineBuffer[i]) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') { if (!(isascii(lineBuffer[i]) && isdigit(lineBuffer[i])) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') {
styler.ColourTo(endPos, SCE_YAML_DEFAULT); styler.ColourTo(endPos, SCE_YAML_DEFAULT);
return; return;
} }

View File

@@ -154,7 +154,8 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
rcSmall.bottom = rc.bottom - 2; rcSmall.bottom = rc.bottom - 2;
surface->RectangleDraw(rcSmall, fore.allocated, back.allocated); surface->RectangleDraw(rcSmall, fore.allocated, back.allocated);
} else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND) { } else if (markType == SC_MARK_EMPTY || markType == SC_MARK_BACKGROUND ||
markType == SC_MARK_UNDERLINE || markType == SC_MARK_AVAILABLE) {
// An invisible marker so don't draw anything // An invisible marker so don't draw anything
} else if (markType == SC_MARK_VLINE) { } else if (markType == SC_MARK_VLINE) {
@@ -299,6 +300,10 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
}; };
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]), surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
fore.allocated, back.allocated); fore.allocated, back.allocated);
} else if (markType == SC_MARK_LEFTRECT) {
PRectangle rcLeft = rcWhole;
rcLeft.right = rcLeft.left + 4;
surface->FillRectangle(rcLeft, back.allocated);
} else { // SC_MARK_FULLRECT } else { // SC_MARK_FULLRECT
surface->FillRectangle(rcWhole, back.allocated); surface->FillRectangle(rcWhole, back.allocated);
} }

View File

@@ -39,16 +39,14 @@ public:
~LineMarker() { ~LineMarker() {
delete pxpm; delete pxpm;
} }
LineMarker &operator=(const LineMarker &other) { LineMarker &operator=(const LineMarker &) {
// Defined to avoid pxpm being blindly copied, not as real assignment operator // Defined to avoid pxpm being blindly copied, not as real assignment operator
if ( &other != this ) { markType = SC_MARK_CIRCLE;
markType = SC_MARK_CIRCLE; fore = ColourDesired(0,0,0);
fore = ColourDesired(0,0,0); back = ColourDesired(0xff,0xff,0xff);
back = ColourDesired(0xff,0xff,0xff); alpha = SC_ALPHA_NOALPHA;
alpha = SC_ALPHA_NOALPHA; delete pxpm;
delete pxpm; pxpm = NULL;
pxpm = NULL;
}
return *this; return *this;
} }
void RefreshColourPalette(Palette &pal, bool want); void RefreshColourPalette(Palette &pal, bool want);

View File

@@ -153,7 +153,7 @@ public:
return pos; return pos;
} }
int PartitionFromPosition(int pos) { int PartitionFromPosition(int pos) const {
if (body->Length() <= 1) if (body->Length() <= 1)
return 0; return 0;
if (pos >= (PositionFromPartition(body->Length()-1))) if (pos >= (PositionFromPartition(body->Length()-1)))

View File

@@ -0,0 +1,486 @@
// Scintilla source code edit control
/** @file PerLine.cxx
** Manages data associated with each line of the document
**/
// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <string.h>
#include "Platform.h"
#include "Scintilla.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "CellBuffer.h"
#include "PerLine.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
MarkerHandleSet::MarkerHandleSet() {
root = 0;
}
MarkerHandleSet::~MarkerHandleSet() {
MarkerHandleNumber *mhn = root;
while (mhn) {
MarkerHandleNumber *mhnToFree = mhn;
mhn = mhn->next;
delete mhnToFree;
}
root = 0;
}
int MarkerHandleSet::Length() const {
int c = 0;
MarkerHandleNumber *mhn = root;
while (mhn) {
c++;
mhn = mhn->next;
}
return c;
}
int MarkerHandleSet::NumberFromHandle(int handle) const {
MarkerHandleNumber *mhn = root;
while (mhn) {
if (mhn->handle == handle) {
return mhn->number;
}
mhn = mhn->next;
}
return - 1;
}
int MarkerHandleSet::MarkValue() const {
unsigned int m = 0;
MarkerHandleNumber *mhn = root;
while (mhn) {
m |= (1 << mhn->number);
mhn = mhn->next;
}
return m;
}
bool MarkerHandleSet::Contains(int handle) const {
MarkerHandleNumber *mhn = root;
while (mhn) {
if (mhn->handle == handle) {
return true;
}
mhn = mhn->next;
}
return false;
}
bool MarkerHandleSet::InsertHandle(int handle, int markerNum) {
MarkerHandleNumber *mhn = new MarkerHandleNumber;
if (!mhn)
return false;
mhn->handle = handle;
mhn->number = markerNum;
mhn->next = root;
root = mhn;
return true;
}
void MarkerHandleSet::RemoveHandle(int handle) {
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
MarkerHandleNumber *mhn = *pmhn;
if (mhn->handle == handle) {
*pmhn = mhn->next;
delete mhn;
return;
}
pmhn = &((*pmhn)->next);
}
}
bool MarkerHandleSet::RemoveNumber(int markerNum) {
bool performedDeletion = false;
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
MarkerHandleNumber *mhn = *pmhn;
if (mhn->number == markerNum) {
*pmhn = mhn->next;
delete mhn;
performedDeletion = true;
} else {
pmhn = &((*pmhn)->next);
}
}
return performedDeletion;
}
void MarkerHandleSet::CombineWith(MarkerHandleSet *other) {
MarkerHandleNumber **pmhn = &root;
while (*pmhn) {
pmhn = &((*pmhn)->next);
}
*pmhn = other->root;
other->root = 0;
}
LineMarkers::~LineMarkers() {
Init();
}
void LineMarkers::Init() {
for (int line = 0; line < markers.Length(); line++) {
delete markers[line];
markers[line] = 0;
}
markers.DeleteAll();
}
void LineMarkers::InsertLine(int line) {
if (markers.Length()) {
markers.Insert(line, 0);
}
}
void LineMarkers::RemoveLine(int line) {
// Retain the markers from the deleted line by oring them into the previous line
if (markers.Length()) {
if (line > 0) {
MergeMarkers(line - 1);
}
markers.Delete(line);
}
}
int LineMarkers::LineFromHandle(int markerHandle) {
if (markers.Length()) {
for (int line = 0; line < markers.Length(); line++) {
if (markers[line]) {
if (markers[line]->Contains(markerHandle)) {
return line;
}
}
}
}
return -1;
}
void LineMarkers::MergeMarkers(int pos) {
if (markers[pos + 1] != NULL) {
if (markers[pos] == NULL)
markers[pos] = new MarkerHandleSet;
markers[pos]->CombineWith(markers[pos + 1]);
delete markers[pos + 1];
markers[pos + 1] = NULL;
}
}
int LineMarkers::MarkValue(int line) {
if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line])
return markers[line]->MarkValue();
else
return 0;
}
int LineMarkers::AddMark(int line, int markerNum, int lines) {
handleCurrent++;
if (!markers.Length()) {
// No existing markers so allocate one element per line
markers.InsertValue(0, lines, 0);
}
if (line >= markers.Length()) {
return -1;
}
if (!markers[line]) {
// Need new structure to hold marker handle
markers[line] = new MarkerHandleSet();
if (!markers[line])
return -1;
}
markers[line]->InsertHandle(handleCurrent, markerNum);
return handleCurrent;
}
void LineMarkers::DeleteMark(int line, int markerNum, bool all) {
if (markers.Length() && (line >= 0) && (line < markers.Length()) && markers[line]) {
if (markerNum == -1) {
delete markers[line];
markers[line] = NULL;
} else {
bool performedDeletion = markers[line]->RemoveNumber(markerNum);
while (all && performedDeletion) {
performedDeletion = markers[line]->RemoveNumber(markerNum);
}
if (markers[line]->Length() == 0) {
delete markers[line];
markers[line] = NULL;
}
}
}
}
void LineMarkers::DeleteMarkFromHandle(int markerHandle) {
int line = LineFromHandle(markerHandle);
if (line >= 0) {
markers[line]->RemoveHandle(markerHandle);
if (markers[line]->Length() == 0) {
delete markers[line];
markers[line] = NULL;
}
}
}
LineLevels::~LineLevels() {
}
void LineLevels::Init() {
levels.DeleteAll();
}
void LineLevels::InsertLine(int line) {
if (levels.Length()) {
int level = SC_FOLDLEVELBASE;
if ((line > 0) && (line < levels.Length())) {
level = levels[line-1] & ~SC_FOLDLEVELWHITEFLAG;
}
levels.InsertValue(line, 1, level);
}
}
void LineLevels::RemoveLine(int line) {
if (levels.Length()) {
// Move up following lines but merge header flag from this line
// to line before to avoid a temporary disappearence causing expansion.
int firstHeader = levels[line] & SC_FOLDLEVELHEADERFLAG;
levels.Delete(line);
if (line == levels.Length()-1) // Last line loses the header flag
levels[line-1] &= ~SC_FOLDLEVELHEADERFLAG;
else if (line > 0)
levels[line-1] |= firstHeader;
}
}
void LineLevels::ExpandLevels(int sizeNew) {
levels.InsertValue(levels.Length(), sizeNew - levels.Length(), SC_FOLDLEVELBASE);
}
void LineLevels::ClearLevels() {
levels.DeleteAll();
}
int LineLevels::SetLevel(int line, int level, int lines) {
int prev = 0;
if ((line >= 0) && (line < lines)) {
if (!levels.Length()) {
ExpandLevels(lines + 1);
}
prev = levels[line];
if (prev != level) {
levels[line] = level;
}
}
return prev;
}
int LineLevels::GetLevel(int line) {
if (levels.Length() && (line >= 0) && (line < levels.Length())) {
return levels[line];
} else {
return SC_FOLDLEVELBASE;
}
}
LineState::~LineState() {
}
void LineState::Init() {
lineStates.DeleteAll();
}
void LineState::InsertLine(int line) {
if (lineStates.Length()) {
lineStates.EnsureLength(line);
lineStates.Insert(line, 0);
}
}
void LineState::RemoveLine(int line) {
if (lineStates.Length() > line) {
lineStates.Delete(line);
}
}
int LineState::SetLineState(int line, int state) {
lineStates.EnsureLength(line + 1);
int stateOld = lineStates[line];
lineStates[line] = state;
return stateOld;
}
int LineState::GetLineState(int line) {
lineStates.EnsureLength(line + 1);
return lineStates[line];
}
int LineState::GetMaxLineState() {
return lineStates.Length();
}
static int NumberLines(const char *text) {
if (text) {
int newLines = 0;
while (*text) {
if (*text == '\n')
newLines++;
text++;
}
return newLines+1;
} else {
return 0;
}
}
// Each allocated LineAnnotation is a char array which starts with an AnnotationHeader
// and then has text and optional styles.
static const int IndividualStyles = 0x100;
struct AnnotationHeader {
short style; // Style IndividualStyles implies array of styles
short lines;
int length;
};
LineAnnotation::~LineAnnotation() {
ClearAll();
}
void LineAnnotation::Init() {
ClearAll();
}
void LineAnnotation::InsertLine(int line) {
if (annotations.Length()) {
annotations.EnsureLength(line);
annotations.Insert(line, 0);
}
}
void LineAnnotation::RemoveLine(int line) {
if (annotations.Length() && (line < annotations.Length())) {
delete []annotations[line];
annotations.Delete(line);
}
}
bool LineAnnotation::AnySet() const {
return annotations.Length() > 0;
}
bool LineAnnotation::MultipleStyles(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return reinterpret_cast<AnnotationHeader *>(annotations[line])->style == IndividualStyles;
else
return 0;
}
int LineAnnotation::Style(int line) {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return reinterpret_cast<AnnotationHeader *>(annotations[line])->style;
else
return 0;
}
const char *LineAnnotation::Text(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return annotations[line]+sizeof(AnnotationHeader);
else
return 0;
}
const unsigned char *LineAnnotation::Styles(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line] && MultipleStyles(line))
return reinterpret_cast<unsigned char *>(annotations[line] + sizeof(AnnotationHeader) + Length(line));
else
return 0;
}
static char *AllocateAnnotation(int length, int style) {
size_t len = sizeof(AnnotationHeader) + length + ((style == IndividualStyles) ? length : 0);
char *ret = new char[len];
memset(ret, 0, len);
return ret;
}
void LineAnnotation::SetText(int line, const char *text) {
if (text) {
annotations.EnsureLength(line+1);
int style = Style(line);
if (annotations[line]) {
delete []annotations[line];
}
annotations[line] = AllocateAnnotation(strlen(text), style);
AnnotationHeader *pah = reinterpret_cast<AnnotationHeader*>(annotations[line]);
pah->style = static_cast<short>(style);
pah->length = strlen(text);
pah->lines = static_cast<short>(NumberLines(text));
memcpy(annotations[line]+sizeof(AnnotationHeader), text, pah->length);
} else {
if (annotations.Length() && (line < annotations.Length()) && annotations[line]) {
delete []annotations[line];
annotations[line] = 0;
}
}
}
void LineAnnotation::ClearAll() {
for (int line = 0; line < annotations.Length(); line++) {
delete []annotations[line];
annotations[line] = 0;
}
annotations.DeleteAll();
}
void LineAnnotation::SetStyle(int line, int style) {
annotations.EnsureLength(line+1);
if (!annotations[line]) {
annotations[line] = AllocateAnnotation(0, style);
}
reinterpret_cast<AnnotationHeader *>(annotations[line])->style = static_cast<short>(style);
}
void LineAnnotation::SetStyles(int line, const unsigned char *styles) {
annotations.EnsureLength(line+1);
if (!annotations[line]) {
annotations[line] = AllocateAnnotation(0, IndividualStyles);
} else {
AnnotationHeader *pahSource = reinterpret_cast<AnnotationHeader *>(annotations[line]);
if (pahSource->style != IndividualStyles) {
char *allocation = AllocateAnnotation(pahSource->length, IndividualStyles);
AnnotationHeader *pahAlloc = reinterpret_cast<AnnotationHeader *>(allocation);
pahAlloc->length = pahSource->length;
pahAlloc->lines = pahSource->lines;
memcpy(allocation + sizeof(AnnotationHeader), annotations[line] + sizeof(AnnotationHeader), pahSource->length);
delete []annotations[line];
annotations[line] = allocation;
}
}
AnnotationHeader *pah = reinterpret_cast<AnnotationHeader *>(annotations[line]);
pah->style = IndividualStyles;
memcpy(annotations[line] + sizeof(AnnotationHeader) + pah->length, styles, pah->length);
}
int LineAnnotation::Length(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return reinterpret_cast<AnnotationHeader *>(annotations[line])->length;
else
return 0;
}
int LineAnnotation::Lines(int line) const {
if (annotations.Length() && (line < annotations.Length()) && annotations[line])
return reinterpret_cast<AnnotationHeader *>(annotations[line])->lines;
else
return 0;
}

View File

@@ -0,0 +1,120 @@
// Scintilla source code edit control
/** @file PerLine.h
** Manages data associated with each line of the document
**/
// Copyright 1998-2009 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef PERLINE_H
#define PERLINE_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
/**
* This holds the marker identifier and the marker type to display.
* MarkerHandleNumbers are members of lists.
*/
struct MarkerHandleNumber {
int handle;
int number;
MarkerHandleNumber *next;
};
/**
* A marker handle set contains any number of MarkerHandleNumbers.
*/
class MarkerHandleSet {
MarkerHandleNumber *root;
public:
MarkerHandleSet();
~MarkerHandleSet();
int Length() const;
int NumberFromHandle(int handle) const;
int MarkValue() const; ///< Bit set of marker numbers.
bool Contains(int handle) const;
bool InsertHandle(int handle, int markerNum);
void RemoveHandle(int handle);
bool RemoveNumber(int markerNum);
void CombineWith(MarkerHandleSet *other);
};
class LineMarkers : public PerLine {
SplitVector<MarkerHandleSet *> markers;
/// Handles are allocated sequentially and should never have to be reused as 32 bit ints are very big.
int handleCurrent;
public:
LineMarkers() : handleCurrent(0) {
}
virtual ~LineMarkers();
virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
int MarkValue(int line);
int AddMark(int line, int marker, int lines);
void MergeMarkers(int pos);
void DeleteMark(int line, int markerNum, bool all);
void DeleteMarkFromHandle(int markerHandle);
int LineFromHandle(int markerHandle);
};
class LineLevels : public PerLine {
SplitVector<int> levels;
public:
virtual ~LineLevels();
virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
void ExpandLevels(int sizeNew=-1);
void ClearLevels();
int SetLevel(int line, int level, int lines);
int GetLevel(int line);
};
class LineState : public PerLine {
SplitVector<int> lineStates;
public:
LineState() {
}
virtual ~LineState();
virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
int SetLineState(int line, int state);
int GetLineState(int line);
int GetMaxLineState();
};
class LineAnnotation : public PerLine {
SplitVector<char *> annotations;
public:
LineAnnotation() {
}
virtual ~LineAnnotation();
virtual void Init();
virtual void InsertLine(int line);
virtual void RemoveLine(int line);
bool AnySet() const;
bool MultipleStyles(int line) const;
int Style(int line);
const char *Text(int line) const;
const unsigned char *Styles(int line) const;
void SetText(int line, const char *text);
void ClearAll();
void SetStyle(int line, int style);
void SetStyles(int line, const unsigned char *styles);
int Length(int line) const;
int Lines(int line) const;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

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