Updated Scintilla to version 1.58
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@25523 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -57,48 +57,56 @@ STCDLL_OBJECTS = \
|
||||
stcdll_CallTip.o \
|
||||
stcdll_CellBuffer.o \
|
||||
stcdll_ContractionState.o \
|
||||
stcdll_Document.o \
|
||||
stcdll_DocumentAccessor.o \
|
||||
stcdll_Document.o \
|
||||
stcdll_Editor.o \
|
||||
stcdll_ExternalLexer.o \
|
||||
stcdll_Indicator.o \
|
||||
stcdll_KeyMap.o \
|
||||
stcdll_KeyWords.o \
|
||||
stcdll_LexAVE.o \
|
||||
stcdll_LexAda.o \
|
||||
stcdll_LexAsm.o \
|
||||
stcdll_LexAVE.o \
|
||||
stcdll_LexBaan.o \
|
||||
stcdll_LexBullant.o \
|
||||
stcdll_LexCPP.o \
|
||||
stcdll_LexCSS.o \
|
||||
stcdll_LexCLW.o \
|
||||
stcdll_LexConf.o \
|
||||
stcdll_LexCPP.o \
|
||||
stcdll_LexCrontab.o \
|
||||
stcdll_LexCSS.o \
|
||||
stcdll_LexEiffel.o \
|
||||
stcdll_LexErlang.o \
|
||||
stcdll_LexEScript.o \
|
||||
stcdll_LexForth.o \
|
||||
stcdll_LexFortran.o \
|
||||
stcdll_LexHTML.o \
|
||||
stcdll_LexLisp.o \
|
||||
stcdll_LexLout.o \
|
||||
stcdll_LexLua.o \
|
||||
stcdll_LexMMIXAL.o \
|
||||
stcdll_LexMatlab.o \
|
||||
stcdll_LexMetapost.o \
|
||||
stcdll_LexMMIXAL.o \
|
||||
stcdll_LexMPT.o \
|
||||
stcdll_LexNsis.o \
|
||||
stcdll_LexOthers.o \
|
||||
stcdll_LexPascal.o \
|
||||
stcdll_LexPB.o \
|
||||
stcdll_LexPerl.o \
|
||||
stcdll_LexPOV.o \
|
||||
stcdll_LexPS.o \
|
||||
stcdll_LexPascal.o \
|
||||
stcdll_LexPerl.o \
|
||||
stcdll_LexPython.o \
|
||||
stcdll_LexRuby.o \
|
||||
stcdll_LexSQL.o \
|
||||
stcdll_LexScriptol.o \
|
||||
stcdll_LexSQL.o \
|
||||
stcdll_LexTeX.o \
|
||||
stcdll_LexVB.o \
|
||||
stcdll_LexYAML.o \
|
||||
stcdll_LineMarker.o \
|
||||
stcdll_PropSet.o \
|
||||
stcdll_RESearch.o \
|
||||
stcdll_ScintillaBase.o \
|
||||
stcdll_Style.o \
|
||||
stcdll_StyleContext.o \
|
||||
stcdll_Style.o \
|
||||
stcdll_UniConversion.o \
|
||||
stcdll_ViewStyle.o \
|
||||
stcdll_WindowAccessor.o \
|
||||
@@ -115,48 +123,56 @@ STCLIB_OBJECTS = \
|
||||
stclib_CallTip.o \
|
||||
stclib_CellBuffer.o \
|
||||
stclib_ContractionState.o \
|
||||
stclib_Document.o \
|
||||
stclib_DocumentAccessor.o \
|
||||
stclib_Document.o \
|
||||
stclib_Editor.o \
|
||||
stclib_ExternalLexer.o \
|
||||
stclib_Indicator.o \
|
||||
stclib_KeyMap.o \
|
||||
stclib_KeyWords.o \
|
||||
stclib_LexAVE.o \
|
||||
stclib_LexAda.o \
|
||||
stclib_LexAsm.o \
|
||||
stclib_LexAVE.o \
|
||||
stclib_LexBaan.o \
|
||||
stclib_LexBullant.o \
|
||||
stclib_LexCPP.o \
|
||||
stclib_LexCSS.o \
|
||||
stclib_LexCLW.o \
|
||||
stclib_LexConf.o \
|
||||
stclib_LexCPP.o \
|
||||
stclib_LexCrontab.o \
|
||||
stclib_LexCSS.o \
|
||||
stclib_LexEiffel.o \
|
||||
stclib_LexErlang.o \
|
||||
stclib_LexEScript.o \
|
||||
stclib_LexForth.o \
|
||||
stclib_LexFortran.o \
|
||||
stclib_LexHTML.o \
|
||||
stclib_LexLisp.o \
|
||||
stclib_LexLout.o \
|
||||
stclib_LexLua.o \
|
||||
stclib_LexMMIXAL.o \
|
||||
stclib_LexMatlab.o \
|
||||
stclib_LexMetapost.o \
|
||||
stclib_LexMMIXAL.o \
|
||||
stclib_LexMPT.o \
|
||||
stclib_LexNsis.o \
|
||||
stclib_LexOthers.o \
|
||||
stclib_LexPascal.o \
|
||||
stclib_LexPB.o \
|
||||
stclib_LexPerl.o \
|
||||
stclib_LexPOV.o \
|
||||
stclib_LexPS.o \
|
||||
stclib_LexPascal.o \
|
||||
stclib_LexPerl.o \
|
||||
stclib_LexPython.o \
|
||||
stclib_LexRuby.o \
|
||||
stclib_LexSQL.o \
|
||||
stclib_LexScriptol.o \
|
||||
stclib_LexSQL.o \
|
||||
stclib_LexTeX.o \
|
||||
stclib_LexVB.o \
|
||||
stclib_LexYAML.o \
|
||||
stclib_LineMarker.o \
|
||||
stclib_PropSet.o \
|
||||
stclib_RESearch.o \
|
||||
stclib_ScintillaBase.o \
|
||||
stclib_Style.o \
|
||||
stclib_StyleContext.o \
|
||||
stclib_Style.o \
|
||||
stclib_UniConversion.o \
|
||||
stclib_ViewStyle.o \
|
||||
stclib_WindowAccessor.o \
|
||||
@@ -332,10 +348,10 @@ stcdll_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
|
||||
stcdll_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_Document.o: $(srcdir)/scintilla/src/Document.cxx
|
||||
stcdll_DocumentAccessor.o: $(srcdir)/scintilla/src/DocumentAccessor.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_DocumentAccessor.o: $(srcdir)/scintilla/src/DocumentAccessor.cxx
|
||||
stcdll_Document.o: $(srcdir)/scintilla/src/Document.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_Editor.o: $(srcdir)/scintilla/src/Editor.cxx
|
||||
@@ -353,39 +369,48 @@ stcdll_KeyMap.o: $(srcdir)/scintilla/src/KeyMap.cxx
|
||||
stcdll_KeyWords.o: $(srcdir)/scintilla/src/KeyWords.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexAVE.o: $(srcdir)/scintilla/src/LexAVE.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexAda.o: $(srcdir)/scintilla/src/LexAda.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexAsm.o: $(srcdir)/scintilla/src/LexAsm.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexAVE.o: $(srcdir)/scintilla/src/LexAVE.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexBaan.o: $(srcdir)/scintilla/src/LexBaan.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexBullant.o: $(srcdir)/scintilla/src/LexBullant.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexCPP.o: $(srcdir)/scintilla/src/LexCPP.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexCSS.o: $(srcdir)/scintilla/src/LexCSS.cxx
|
||||
stcdll_LexCLW.o: $(srcdir)/scintilla/src/LexCLW.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexConf.o: $(srcdir)/scintilla/src/LexConf.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexCPP.o: $(srcdir)/scintilla/src/LexCPP.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexCrontab.o: $(srcdir)/scintilla/src/LexCrontab.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexCSS.o: $(srcdir)/scintilla/src/LexCSS.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexEiffel.o: $(srcdir)/scintilla/src/LexEiffel.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexErlang.o: $(srcdir)/scintilla/src/LexErlang.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexEScript.o: $(srcdir)/scintilla/src/LexEScript.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexForth.o: $(srcdir)/scintilla/src/LexForth.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexFortran.o: $(srcdir)/scintilla/src/LexFortran.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -401,10 +426,16 @@ stcdll_LexLout.o: $(srcdir)/scintilla/src/LexLout.cxx
|
||||
stcdll_LexLua.o: $(srcdir)/scintilla/src/LexLua.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexMetapost.o: $(srcdir)/scintilla/src/LexMetapost.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexMMIXAL.o: $(srcdir)/scintilla/src/LexMMIXAL.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
|
||||
stcdll_LexMPT.o: $(srcdir)/scintilla/src/LexMPT.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
|
||||
@@ -413,33 +444,42 @@ stcdll_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
|
||||
stcdll_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPB.o: $(srcdir)/scintilla/src/LexPB.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPerl.o: $(srcdir)/scintilla/src/LexPerl.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPOV.o: $(srcdir)/scintilla/src/LexPOV.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPS.o: $(srcdir)/scintilla/src/LexPS.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPerl.o: $(srcdir)/scintilla/src/LexPerl.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexPython.o: $(srcdir)/scintilla/src/LexPython.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexVB.o: $(srcdir)/scintilla/src/LexVB.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LexYAML.o: $(srcdir)/scintilla/src/LexYAML.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_LineMarker.o: $(srcdir)/scintilla/src/LineMarker.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
@@ -452,10 +492,10 @@ stcdll_RESearch.o: $(srcdir)/scintilla/src/RESearch.cxx
|
||||
stcdll_ScintillaBase.o: $(srcdir)/scintilla/src/ScintillaBase.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_Style.o: $(srcdir)/scintilla/src/Style.cxx
|
||||
stcdll_StyleContext.o: $(srcdir)/scintilla/src/StyleContext.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_StyleContext.o: $(srcdir)/scintilla/src/StyleContext.cxx
|
||||
stcdll_Style.o: $(srcdir)/scintilla/src/Style.cxx
|
||||
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
|
||||
|
||||
stcdll_UniConversion.o: $(srcdir)/scintilla/src/UniConversion.cxx
|
||||
@@ -491,10 +531,10 @@ stclib_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
|
||||
stclib_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_Document.o: $(srcdir)/scintilla/src/Document.cxx
|
||||
stclib_DocumentAccessor.o: $(srcdir)/scintilla/src/DocumentAccessor.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_DocumentAccessor.o: $(srcdir)/scintilla/src/DocumentAccessor.cxx
|
||||
stclib_Document.o: $(srcdir)/scintilla/src/Document.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_Editor.o: $(srcdir)/scintilla/src/Editor.cxx
|
||||
@@ -512,39 +552,48 @@ stclib_KeyMap.o: $(srcdir)/scintilla/src/KeyMap.cxx
|
||||
stclib_KeyWords.o: $(srcdir)/scintilla/src/KeyWords.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexAVE.o: $(srcdir)/scintilla/src/LexAVE.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexAda.o: $(srcdir)/scintilla/src/LexAda.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexAsm.o: $(srcdir)/scintilla/src/LexAsm.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexAVE.o: $(srcdir)/scintilla/src/LexAVE.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexBaan.o: $(srcdir)/scintilla/src/LexBaan.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexBullant.o: $(srcdir)/scintilla/src/LexBullant.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexCPP.o: $(srcdir)/scintilla/src/LexCPP.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexCSS.o: $(srcdir)/scintilla/src/LexCSS.cxx
|
||||
stclib_LexCLW.o: $(srcdir)/scintilla/src/LexCLW.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexConf.o: $(srcdir)/scintilla/src/LexConf.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexCPP.o: $(srcdir)/scintilla/src/LexCPP.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexCrontab.o: $(srcdir)/scintilla/src/LexCrontab.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexCSS.o: $(srcdir)/scintilla/src/LexCSS.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexEiffel.o: $(srcdir)/scintilla/src/LexEiffel.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexErlang.o: $(srcdir)/scintilla/src/LexErlang.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexEScript.o: $(srcdir)/scintilla/src/LexEScript.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexForth.o: $(srcdir)/scintilla/src/LexForth.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexFortran.o: $(srcdir)/scintilla/src/LexFortran.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
@@ -560,10 +609,16 @@ stclib_LexLout.o: $(srcdir)/scintilla/src/LexLout.cxx
|
||||
stclib_LexLua.o: $(srcdir)/scintilla/src/LexLua.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexMetapost.o: $(srcdir)/scintilla/src/LexMetapost.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexMMIXAL.o: $(srcdir)/scintilla/src/LexMMIXAL.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
|
||||
stclib_LexMPT.o: $(srcdir)/scintilla/src/LexMPT.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
|
||||
@@ -572,33 +627,42 @@ stclib_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
|
||||
stclib_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPB.o: $(srcdir)/scintilla/src/LexPB.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPerl.o: $(srcdir)/scintilla/src/LexPerl.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPOV.o: $(srcdir)/scintilla/src/LexPOV.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPS.o: $(srcdir)/scintilla/src/LexPS.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPerl.o: $(srcdir)/scintilla/src/LexPerl.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexPython.o: $(srcdir)/scintilla/src/LexPython.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexVB.o: $(srcdir)/scintilla/src/LexVB.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LexYAML.o: $(srcdir)/scintilla/src/LexYAML.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_LineMarker.o: $(srcdir)/scintilla/src/LineMarker.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
@@ -611,10 +675,10 @@ stclib_RESearch.o: $(srcdir)/scintilla/src/RESearch.cxx
|
||||
stclib_ScintillaBase.o: $(srcdir)/scintilla/src/ScintillaBase.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_Style.o: $(srcdir)/scintilla/src/Style.cxx
|
||||
stclib_StyleContext.o: $(srcdir)/scintilla/src/StyleContext.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_StyleContext.o: $(srcdir)/scintilla/src/StyleContext.cxx
|
||||
stclib_Style.o: $(srcdir)/scintilla/src/Style.cxx
|
||||
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
|
||||
|
||||
stclib_UniConversion.o: $(srcdir)/scintilla/src/UniConversion.cxx
|
||||
|
@@ -855,7 +855,6 @@ public:
|
||||
virtual int GetSelection();
|
||||
virtual int Find(const char *prefix);
|
||||
virtual void GetValue(int n, char *value, int len);
|
||||
virtual void Sort();
|
||||
virtual void RegisterImage(int type, const char *xpm_data);
|
||||
virtual void ClearRegisteredImages();
|
||||
virtual void SetDoubleClickAction(CallBackAction, void *);
|
||||
@@ -1008,9 +1007,6 @@ void ListBoxImpl::GetValue(int n, char *value, int len) {
|
||||
value[len-1] = '\0';
|
||||
}
|
||||
|
||||
void ListBoxImpl::Sort() {
|
||||
}
|
||||
|
||||
|
||||
void ListBoxImpl::RegisterImage(int type, const char *xpm_data) {
|
||||
wxMemoryInputStream stream(xpm_data, strlen(xpm_data)+1);
|
||||
|
@@ -146,7 +146,6 @@ ScintillaWX::ScintillaWX(wxStyledTextCtrl* win) {
|
||||
|
||||
|
||||
ScintillaWX::~ScintillaWX() {
|
||||
SetTicking(false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
@@ -165,6 +164,8 @@ void ScintillaWX::Initialise() {
|
||||
|
||||
void ScintillaWX::Finalise() {
|
||||
ScintillaBase::Finalise();
|
||||
SetTicking(false);
|
||||
SetIdle(false);
|
||||
}
|
||||
|
||||
|
||||
@@ -199,6 +200,19 @@ void ScintillaWX::StartDrag() {
|
||||
}
|
||||
|
||||
|
||||
bool ScintillaWX::SetIdle(bool on) {
|
||||
if (idler.state != on) {
|
||||
// connect or disconnect the EVT_IDLE handler
|
||||
if (on)
|
||||
stc->Connect(-1, wxEVT_IDLE, (wxObjectEventFunction)&wxStyledTextCtrl::OnIdle);
|
||||
else
|
||||
stc->Disconnect(-1, wxEVT_IDLE, (wxObjectEventFunction)&wxStyledTextCtrl::OnIdle);
|
||||
idler.state = on;
|
||||
}
|
||||
return idler.state;
|
||||
}
|
||||
|
||||
|
||||
void ScintillaWX::SetTicking(bool on) {
|
||||
wxSTCTimer* steTimer;
|
||||
if (timer.ticking != on) {
|
||||
@@ -219,11 +233,13 @@ void ScintillaWX::SetTicking(bool on) {
|
||||
|
||||
|
||||
void ScintillaWX::SetMouseCapture(bool on) {
|
||||
if (on && !capturedMouse)
|
||||
stc->CaptureMouse();
|
||||
else if (!on && capturedMouse && stc->HasCapture())
|
||||
stc->ReleaseMouse();
|
||||
capturedMouse = on;
|
||||
if (mouseDownCaptures) {
|
||||
if (on && !capturedMouse)
|
||||
stc->CaptureMouse();
|
||||
else if (!on && capturedMouse && stc->HasCapture())
|
||||
stc->ReleaseMouse();
|
||||
capturedMouse = on;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -652,7 +668,7 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) {
|
||||
// Set the current position to the mouse click point and
|
||||
// then paste in the PRIMARY selection, if any. wxGTK only.
|
||||
int newPos = PositionFromLocation(pt);
|
||||
MovePositionTo(newPos, 0, 1);
|
||||
MovePositionTo(newPos, noSel, true);
|
||||
|
||||
pdoc->BeginUndoAction();
|
||||
wxTextDataObject data;
|
||||
@@ -775,6 +791,15 @@ void ScintillaWX::DoOnListBox() {
|
||||
AutoCompleteCompleted();
|
||||
}
|
||||
|
||||
|
||||
void ScintillaWX::DoOnIdle(wxIdleEvent& evt) {
|
||||
|
||||
if ( Idle() )
|
||||
evt.RequestMore();
|
||||
else
|
||||
SetIdle(false);
|
||||
}
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
|
@@ -99,6 +99,7 @@ public:
|
||||
virtual void Initialise();
|
||||
virtual void Finalise();
|
||||
virtual void StartDrag();
|
||||
virtual bool SetIdle(bool on);
|
||||
virtual void SetTicking(bool on);
|
||||
virtual void SetMouseCapture(bool on);
|
||||
virtual bool HaveMouseCapture();
|
||||
@@ -142,7 +143,8 @@ public:
|
||||
void DoAddChar(int key);
|
||||
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool meta, bool* consumed);
|
||||
void DoTick() { Tick(); }
|
||||
|
||||
void DoOnIdle(wxIdleEvent& evt);
|
||||
|
||||
#if wxUSE_DRAG_AND_DROP
|
||||
bool DoDropText(long x, long y, const wxString& data);
|
||||
wxDragResult DoDragEnter(wxCoord x, wxCoord y, wxDragResult def);
|
||||
|
@@ -44,6 +44,7 @@ cmdValues = [ (2300, 2349),
|
||||
(2395, 2396),
|
||||
2404,
|
||||
(2413, 2416),
|
||||
(2426, 2442),
|
||||
(2450, 2454),
|
||||
]
|
||||
|
||||
@@ -275,6 +276,7 @@ methodOverrideMap = {
|
||||
'AutoCGetDropRestOfWord' : ('AutoCompGetDropRestOfWord', 0,0,0),
|
||||
'AutoCGetTypeSeparator' : ('AutoCompGetTypeSeparator', 0, 0, 0),
|
||||
'AutoCSetTypeSeparator' : ('AutoCompSetTypeSeparator', 0, 0, 0),
|
||||
'AutoCGetCurrent' : ('AutoCompGetCurrent', 0, 0, 0),
|
||||
|
||||
'RegisterImage' :
|
||||
(0,
|
||||
@@ -330,14 +332,14 @@ methodOverrideMap = {
|
||||
int startPos,
|
||||
int endPos,
|
||||
wxDC* draw,
|
||||
wxDC* target, // Why does it use two? Can they be the same?
|
||||
wxDC* target,
|
||||
wxRect renderRect,
|
||||
wxRect pageRect);''',
|
||||
''' int %s(bool doDraw,
|
||||
int startPos,
|
||||
int endPos,
|
||||
wxDC* draw,
|
||||
wxDC* target, // Why does it use two? Can they be the same?
|
||||
wxDC* target,
|
||||
wxRect renderRect,
|
||||
wxRect pageRect) {
|
||||
RangeToFormat fr;
|
||||
@@ -615,8 +617,23 @@ methodOverrideMap = {
|
||||
'ParaDownExtend' : (None, 0, 0, 0),
|
||||
'ParaUp' : (None, 0, 0, 0),
|
||||
'ParaUpExtend' : (None, 0, 0, 0),
|
||||
|
||||
|
||||
'LineDownRectExtend' : (None, 0, 0, 0),
|
||||
'LineUpRectExtend' : (None, 0, 0, 0),
|
||||
'CharLeftRectExtend' : (None, 0, 0, 0),
|
||||
'CharRightRectExtend' : (None, 0, 0, 0),
|
||||
'HomeRectExtend' : (None, 0, 0, 0),
|
||||
'VCHomeRectExtend' : (None, 0, 0, 0),
|
||||
'LineEndRectExtend' : (None, 0, 0, 0),
|
||||
'PageUpRectExtend' : (None, 0, 0, 0),
|
||||
'PageDownRectExtend' : (None, 0, 0, 0),
|
||||
'StutteredPageUp' : (None, 0, 0, 0),
|
||||
'StutteredPageUpExtend' : (None, 0, 0, 0),
|
||||
'StutteredPageDown' : (None, 0, 0, 0),
|
||||
'StutteredPageDownExtend' : (None, 0, 0, 0),
|
||||
'WordLeftEnd' : (None, 0, 0, 0),
|
||||
'WordLeftEndExtend' : (None, 0, 0, 0),
|
||||
'WordRightEnd' : (None, 0, 0, 0),
|
||||
'WordRightEndExtend' : (None, 0, 0, 0),
|
||||
|
||||
'' : ('', 0, 0, 0),
|
||||
|
||||
|
@@ -3,4 +3,4 @@ scintilla/include directories from the Scintilla/SCiTE source
|
||||
distribution. All other code needed to implement Scintilla on top of
|
||||
wxWindows is located in the directory above this one.
|
||||
|
||||
The current version of the Scintilla code is 1.54
|
||||
The current version of the Scintilla code is 1.58
|
||||
|
@@ -58,6 +58,7 @@ typedef void *WindowID;
|
||||
typedef void *MenuID;
|
||||
typedef void *TickerID;
|
||||
typedef void *Function;
|
||||
typedef void *IdlerID;
|
||||
|
||||
/**
|
||||
* A geometric point class.
|
||||
@@ -408,7 +409,6 @@ public:
|
||||
virtual int GetSelection()=0;
|
||||
virtual int Find(const char *prefix)=0;
|
||||
virtual void GetValue(int n, char *value, int len)=0;
|
||||
virtual void Sort()=0;
|
||||
virtual void RegisterImage(int type, const char *xpm_data)=0;
|
||||
virtual void ClearRegisteredImages()=0;
|
||||
virtual void SetDoubleClickAction(CallBackAction, void *)=0;
|
||||
|
@@ -81,7 +81,7 @@ public:
|
||||
void SetFromAllocated();
|
||||
bool InList(const char *s);
|
||||
const char *GetNearestWord(const char *wordStart, int searchLen = -1,
|
||||
bool ignoreCase = false, SString wordCharacters="");
|
||||
bool ignoreCase = false, SString wordCharacters="", int wordIndex = -1);
|
||||
char *GetNearestWords(const char *wordStart, int searchLen=-1,
|
||||
bool ignoreCase=false, char otherSeparator='\0');
|
||||
};
|
||||
|
@@ -59,6 +59,16 @@
|
||||
#define SCLEX_PS 42
|
||||
#define SCLEX_NSIS 43
|
||||
#define SCLEX_MMIXAL 44
|
||||
#define SCLEX_CLW 45
|
||||
#define SCLEX_CLWNOCASE 46
|
||||
#define SCLEX_LOT 47
|
||||
#define SCLEX_YAML 48
|
||||
#define SCLEX_TEX 49
|
||||
#define SCLEX_METAPOST 50
|
||||
#define SCLEX_POWERBASIC 51
|
||||
#define SCLEX_FORTH 52
|
||||
#define SCLEX_ERLANG 53
|
||||
#define SCLEX_OCTAVE 54
|
||||
#define SCLEX_AUTOMATIC 1000
|
||||
#define SCE_P_DEFAULT 0
|
||||
#define SCE_P_COMMENTLINE 1
|
||||
@@ -243,6 +253,10 @@
|
||||
#define SCE_B_OPERATOR 6
|
||||
#define SCE_B_IDENTIFIER 7
|
||||
#define SCE_B_DATE 8
|
||||
#define SCE_B_STRINGEOL 9
|
||||
#define SCE_B_KEYWORD2 10
|
||||
#define SCE_B_KEYWORD3 11
|
||||
#define SCE_B_KEYWORD4 12
|
||||
#define SCE_PROPS_DEFAULT 0
|
||||
#define SCE_PROPS_COMMENT 1
|
||||
#define SCE_PROPS_SECTION 2
|
||||
@@ -290,6 +304,8 @@
|
||||
#define SCE_ERR_PHP 14
|
||||
#define SCE_ERR_ELF 15
|
||||
#define SCE_ERR_IFC 16
|
||||
#define SCE_ERR_IFORT 17
|
||||
#define SCE_ERR_ABSF 18
|
||||
#define SCE_BAT_DEFAULT 0
|
||||
#define SCE_BAT_COMMENT 1
|
||||
#define SCE_BAT_WORD 2
|
||||
@@ -388,6 +404,18 @@
|
||||
#define SCE_NNCRONTAB_STRING 8
|
||||
#define SCE_NNCRONTAB_ENVIRONMENT 9
|
||||
#define SCE_NNCRONTAB_IDENTIFIER 10
|
||||
#define SCE_FORTH_DEFAULT 0
|
||||
#define SCE_FORTH_COMMENT 1
|
||||
#define SCE_FORTH_COMMENT_ML 2
|
||||
#define SCE_FORTH_IDENTIFIER 3
|
||||
#define SCE_FORTH_CONTROL 4
|
||||
#define SCE_FORTH_KEYWORD 5
|
||||
#define SCE_FORTH_DEFWORD 6
|
||||
#define SCE_FORTH_PREWORD1 7
|
||||
#define SCE_FORTH_PREWORD2 8
|
||||
#define SCE_FORTH_NUMBER 9
|
||||
#define SCE_FORTH_STRING 10
|
||||
#define SCE_FORTH_LOCALE 11
|
||||
#define SCE_MATLAB_DEFAULT 0
|
||||
#define SCE_MATLAB_COMMENT 1
|
||||
#define SCE_MATLAB_COMMAND 2
|
||||
@@ -396,26 +424,23 @@
|
||||
#define SCE_MATLAB_STRING 5
|
||||
#define SCE_MATLAB_OPERATOR 6
|
||||
#define SCE_MATLAB_IDENTIFIER 7
|
||||
#define SCE_MATLAB_DOUBLEQUOTESTRING 8
|
||||
#define SCE_SCRIPTOL_DEFAULT 0
|
||||
#define SCE_SCRIPTOL_COMMENT 1
|
||||
#define SCE_SCRIPTOL_WHITE 1
|
||||
#define SCE_SCRIPTOL_COMMENTLINE 2
|
||||
#define SCE_SCRIPTOL_COMMENTDOC 3
|
||||
#define SCE_SCRIPTOL_NUMBER 4
|
||||
#define SCE_SCRIPTOL_WORD 5
|
||||
#define SCE_SCRIPTOL_STRING 6
|
||||
#define SCE_SCRIPTOL_CHARACTER 7
|
||||
#define SCE_SCRIPTOL_UUID 8
|
||||
#define SCE_SCRIPTOL_PREPROCESSOR 9
|
||||
#define SCE_SCRIPTOL_OPERATOR 10
|
||||
#define SCE_SCRIPTOL_IDENTIFIER 11
|
||||
#define SCE_SCRIPTOL_STRINGEOL 12
|
||||
#define SCE_SCRIPTOL_VERBATIM 13
|
||||
#define SCE_SCRIPTOL_REGEX 14
|
||||
#define SCE_SCRIPTOL_COMMENTLINEDOC 15
|
||||
#define SCE_SCRIPTOL_WORD2 16
|
||||
#define SCE_SCRIPTOL_COMMENTDOCKEYWORD 17
|
||||
#define SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR 18
|
||||
#define SCE_SCRIPTOL_COMMENTBASIC 19
|
||||
#define SCE_SCRIPTOL_PERSISTENT 3
|
||||
#define SCE_SCRIPTOL_CSTYLE 4
|
||||
#define SCE_SCRIPTOL_COMMENTBLOCK 5
|
||||
#define SCE_SCRIPTOL_NUMBER 6
|
||||
#define SCE_SCRIPTOL_STRING 7
|
||||
#define SCE_SCRIPTOL_CHARACTER 8
|
||||
#define SCE_SCRIPTOL_STRINGEOL 9
|
||||
#define SCE_SCRIPTOL_KEYWORD 10
|
||||
#define SCE_SCRIPTOL_OPERATOR 11
|
||||
#define SCE_SCRIPTOL_IDENTIFIER 12
|
||||
#define SCE_SCRIPTOL_TRIPLE 13
|
||||
#define SCE_SCRIPTOL_CLASSNAME 14
|
||||
#define SCE_SCRIPTOL_PREPROCESSOR 15
|
||||
#define SCE_ASM_DEFAULT 0
|
||||
#define SCE_ASM_COMMENT 1
|
||||
#define SCE_ASM_NUMBER 2
|
||||
@@ -427,6 +452,10 @@
|
||||
#define SCE_ASM_REGISTER 8
|
||||
#define SCE_ASM_DIRECTIVE 9
|
||||
#define SCE_ASM_DIRECTIVEOPERAND 10
|
||||
#define SCE_ASM_COMMENTBLOCK 11
|
||||
#define SCE_ASM_CHARACTER 12
|
||||
#define SCE_ASM_STRINGEOL 13
|
||||
#define SCE_ASM_EXTINSTRUCTION 14
|
||||
#define SCE_F_DEFAULT 0
|
||||
#define SCE_F_COMMENT 1
|
||||
#define SCE_F_NUMBER 2
|
||||
@@ -545,6 +574,65 @@
|
||||
#define SCE_MMIXAL_OPERATOR 15
|
||||
#define SCE_MMIXAL_SYMBOL 16
|
||||
#define SCE_MMIXAL_INCLUDE 17
|
||||
#define SCE_CLW_DEFAULT 0
|
||||
#define SCE_CLW_LABEL 1
|
||||
#define SCE_CLW_COMMENT 2
|
||||
#define SCE_CLW_STRING 3
|
||||
#define SCE_CLW_USER_IDENTIFIER 4
|
||||
#define SCE_CLW_INTEGER_CONSTANT 5
|
||||
#define SCE_CLW_REAL_CONSTANT 6
|
||||
#define SCE_CLW_PICTURE_STRING 7
|
||||
#define SCE_CLW_KEYWORD 8
|
||||
#define SCE_CLW_COMPILER_DIRECTIVE 9
|
||||
#define SCE_CLW_BUILTIN_PROCEDURES_FUNCTION 10
|
||||
#define SCE_CLW_STRUCTURE_DATA_TYPE 11
|
||||
#define SCE_CLW_ATTRIBUTE 12
|
||||
#define SCE_CLW_STANDARD_EQUATE 13
|
||||
#define SCE_CLW_ERROR 14
|
||||
#define SCE_LOT_DEFAULT 0
|
||||
#define SCE_LOT_HEADER 1
|
||||
#define SCE_LOT_BREAK 2
|
||||
#define SCE_LOT_SET 3
|
||||
#define SCE_LOT_PASS 4
|
||||
#define SCE_LOT_FAIL 5
|
||||
#define SCE_LOT_ABORT 6
|
||||
#define SCE_YAML_DEFAULT 0
|
||||
#define SCE_YAML_COMMENT 1
|
||||
#define SCE_YAML_IDENTIFIER 2
|
||||
#define SCE_YAML_KEYWORD 3
|
||||
#define SCE_YAML_NUMBER 4
|
||||
#define SCE_YAML_REFERENCE 5
|
||||
#define SCE_YAML_DOCUMENT 6
|
||||
#define SCE_YAML_TEXT 7
|
||||
#define SCE_YAML_ERROR 8
|
||||
#define SCE_TEX_DEFAULT 0
|
||||
#define SCE_TEX_SPECIAL 1
|
||||
#define SCE_TEX_GROUP 2
|
||||
#define SCE_TEX_SYMBOL 3
|
||||
#define SCE_TEX_COMMAND 4
|
||||
#define SCE_TEX_TEXT 5
|
||||
#define SCE_METAPOST_DEFAULT 0
|
||||
#define SCE_METAPOST_SPECIAL 1
|
||||
#define SCE_METAPOST_GROUP 2
|
||||
#define SCE_METAPOST_SYMBOL 3
|
||||
#define SCE_METAPOST_COMMAND 4
|
||||
#define SCE_METAPOST_TEXT 5
|
||||
#define SCE_METAPOST_EXTRA 6
|
||||
#define SCE_ERLANG_DEFAULT 0
|
||||
#define SCE_ERLANG_COMMENT 1
|
||||
#define SCE_ERLANG_VARIABLE 2
|
||||
#define SCE_ERLANG_NUMBER 3
|
||||
#define SCE_ERLANG_KEYWORD 4
|
||||
#define SCE_ERLANG_STRING 5
|
||||
#define SCE_ERLANG_OPERATOR 6
|
||||
#define SCE_ERLANG_ATOM 7
|
||||
#define SCE_ERLANG_FUNCTION_NAME 8
|
||||
#define SCE_ERLANG_CHARACTER 9
|
||||
#define SCE_ERLANG_MACRO 10
|
||||
#define SCE_ERLANG_RECORD 11
|
||||
#define SCE_ERLANG_SEPARATOR 12
|
||||
#define SCE_ERLANG_NODE_NAME 13
|
||||
#define SCE_ERLANG_UNKNOWN 31
|
||||
//--Autogenerated -- end of section automatically generated from Scintilla.iface
|
||||
|
||||
#endif
|
||||
|
@@ -205,6 +205,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define INDIC_DIAGONAL 3
|
||||
#define INDIC_STRIKE 4
|
||||
#define INDIC_HIDDEN 5
|
||||
#define INDIC_BOX 6
|
||||
#define INDIC0_MASK 0x20
|
||||
#define INDIC1_MASK 0x40
|
||||
#define INDIC2_MASK 0x80
|
||||
@@ -533,6 +534,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_SETHOTSPOTACTIVEFORE 2410
|
||||
#define SCI_SETHOTSPOTACTIVEBACK 2411
|
||||
#define SCI_SETHOTSPOTACTIVEUNDERLINE 2412
|
||||
#define SCI_SETHOTSPOTSINGLELINE 2421
|
||||
#define SCI_PARADOWN 2413
|
||||
#define SCI_PARADOWNEXTEND 2414
|
||||
#define SCI_PARAUP 2415
|
||||
@@ -541,6 +543,33 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_POSITIONAFTER 2418
|
||||
#define SCI_COPYRANGE 2419
|
||||
#define SCI_COPYTEXT 2420
|
||||
#define SC_SEL_STREAM 0
|
||||
#define SC_SEL_RECTANGLE 1
|
||||
#define SC_SEL_LINES 2
|
||||
#define SCI_SETSELECTIONMODE 2422
|
||||
#define SCI_GETSELECTIONMODE 2423
|
||||
#define SCI_GETLINESELSTARTPOSITION 2424
|
||||
#define SCI_GETLINESELENDPOSITION 2425
|
||||
#define SCI_LINEDOWNRECTEXTEND 2426
|
||||
#define SCI_LINEUPRECTEXTEND 2427
|
||||
#define SCI_CHARLEFTRECTEXTEND 2428
|
||||
#define SCI_CHARRIGHTRECTEXTEND 2429
|
||||
#define SCI_HOMERECTEXTEND 2430
|
||||
#define SCI_VCHOMERECTEXTEND 2431
|
||||
#define SCI_LINEENDRECTEXTEND 2432
|
||||
#define SCI_PAGEUPRECTEXTEND 2433
|
||||
#define SCI_PAGEDOWNRECTEXTEND 2434
|
||||
#define SCI_STUTTEREDPAGEUP 2435
|
||||
#define SCI_STUTTEREDPAGEUPEXTEND 2436
|
||||
#define SCI_STUTTEREDPAGEDOWN 2437
|
||||
#define SCI_STUTTEREDPAGEDOWNEXTEND 2438
|
||||
#define SCI_WORDLEFTEND 2439
|
||||
#define SCI_WORDLEFTENDEXTEND 2440
|
||||
#define SCI_WORDRIGHTEND 2441
|
||||
#define SCI_WORDRIGHTENDEXTEND 2442
|
||||
#define SCI_SETWHITESPACECHARS 2443
|
||||
#define SCI_SETCHARSDEFAULT 2444
|
||||
#define SCI_AUTOCGETCURRENT 2445
|
||||
#define SCI_STARTRECORD 3001
|
||||
#define SCI_STOPRECORD 3002
|
||||
#define SCI_SETLEXER 4001
|
||||
|
@@ -2,7 +2,7 @@
|
||||
|
||||
## This file defines the interface to Scintilla
|
||||
|
||||
## Copyright 2000-2002 by Neil Hodgson <neilh@scintilla.org>
|
||||
## Copyright 2000-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
## The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
## A line starting with ## is a pure comment and should be stripped by readers.
|
||||
@@ -26,7 +26,8 @@
|
||||
## A property may be subscripted, in which case the first parameter is the subscript.
|
||||
## fun, get, and set features have a strict syntax:
|
||||
## <featureType><ws><returnType><ws><name>[=<number](<param>,<param>)
|
||||
## param is <paramType><ws><paramName>[=<value>]
|
||||
## where <ws> stands for white space.
|
||||
## param may be empty (null value) or is <paramType><ws><paramName>[=<value>]
|
||||
## Additional white space is allowed between elements.
|
||||
## The syntax for evt is <featureType><ws><returnType><ws><name>[=<number]([<param>[,<param>]*])
|
||||
## Feature names that contain an underscore are defined by Windows, so in these
|
||||
@@ -80,7 +81,7 @@ cat Basics
|
||||
################################################
|
||||
## For Scintilla.h
|
||||
val INVALID_POSITION=-1
|
||||
# Define start of Scintilla messages to be greater than all edit (EM_*) messages
|
||||
# Define start of Scintilla messages to be greater than all Windows edit (EM_*) messages
|
||||
# as many EM_ messages can be used although that use is deprecated.
|
||||
val SCI_START=2000
|
||||
val SCI_OPTIONAL_START=3000
|
||||
@@ -131,7 +132,7 @@ fun void SelectAll=2013(,)
|
||||
fun void SetSavePoint=2014(,)
|
||||
|
||||
# Retrieve a buffer of cells.
|
||||
# Returns the number of bytes in the buffer not including terminating nulls.
|
||||
# Returns the number of bytes in the buffer not including terminating NULs.
|
||||
fun int GetStyledText=2015(, textrange tr)
|
||||
|
||||
# Are there any redoable actions in the undo history?
|
||||
@@ -159,11 +160,11 @@ get int GetViewWS=2020(,)
|
||||
set void SetViewWS=2021(int viewWS,)
|
||||
|
||||
# Find the position from a point within the window.
|
||||
fun int PositionFromPoint=2022(int x, int y)
|
||||
fun position PositionFromPoint=2022(int x, int y)
|
||||
|
||||
# Find the position from a point within the window but return
|
||||
# INVALID_POSITION if not close to text.
|
||||
fun int PositionFromPointClose=2023(int x, int y)
|
||||
fun position PositionFromPointClose=2023(int x, int y)
|
||||
|
||||
# Set caret to start of a line and ensure it is visible.
|
||||
fun void GotoLine=2024(int line,)
|
||||
@@ -427,7 +428,7 @@ set void SetCaretFore=2069(colour fore,)
|
||||
# When key+modifier combination km is pressed perform msg.
|
||||
fun void AssignCmdKey=2070(keymod km, int msg)
|
||||
|
||||
# When key+modifier combination km do nothing.
|
||||
# When key+modifier combination km is pressed do nothing.
|
||||
fun void ClearCmdKey=2071(keymod km,)
|
||||
|
||||
# Drop all key mappings.
|
||||
@@ -446,6 +447,7 @@ get int GetCaretPeriod=2075(,)
|
||||
set void SetCaretPeriod=2076(int periodMilliseconds,)
|
||||
|
||||
# Set the set of characters making up words for when moving or selecting by word.
|
||||
# First sets deaults like SetCharsDefault.
|
||||
set void SetWordChars=2077(, string characters)
|
||||
|
||||
# Start a sequence of actions that is undone and redone as a unit.
|
||||
@@ -463,6 +465,7 @@ val INDIC_TT=2
|
||||
val INDIC_DIAGONAL=3
|
||||
val INDIC_STRIKE=4
|
||||
val INDIC_HIDDEN=5
|
||||
val INDIC_BOX=6
|
||||
val INDIC0_MASK=0x20
|
||||
val INDIC1_MASK=0x40
|
||||
val INDIC2_MASK=0x80
|
||||
@@ -711,7 +714,7 @@ val SCFIND_POSIX=0x00400000
|
||||
fun position FindText=2150(int flags, findtext ft)
|
||||
|
||||
# On Windows, will draw the document into a display context such as a printer.
|
||||
fun void FormatRange=2151(bool draw, formatrange fr)
|
||||
fun position FormatRange=2151(bool draw, formatrange fr)
|
||||
|
||||
# Retrieve the display line at the top of the display.
|
||||
get int GetFirstVisibleLine=2152(,)
|
||||
@@ -743,7 +746,7 @@ fun void SetSel=2160(position start, position end)
|
||||
|
||||
# Retrieve the selected text.
|
||||
# Return the length of the text.
|
||||
fun int GetSelText=2161(,stringresult text)
|
||||
fun int GetSelText=2161(, stringresult text)
|
||||
|
||||
# Retrieve a range of text.
|
||||
# Return the length of the text.
|
||||
@@ -762,7 +765,7 @@ fun int PointYFromPosition=2165(, position pos)
|
||||
fun int LineFromPosition=2166(position pos,)
|
||||
|
||||
# Retrieve the position at the start of a line.
|
||||
fun int PositionFromLine=2167(int line,)
|
||||
fun position PositionFromLine=2167(int line,)
|
||||
|
||||
# Scroll horizontally and vertically.
|
||||
fun void LineScroll=2168(int columns, int lines)
|
||||
@@ -847,12 +850,12 @@ set void SetTargetEnd=2192(position pos,)
|
||||
get position GetTargetEnd=2193(,)
|
||||
|
||||
# Replace the target text with the argument text.
|
||||
# Text is counted so it can contain nulls.
|
||||
# Text is counted so it can contain NULs.
|
||||
# Returns the length of the replacement text.
|
||||
fun int ReplaceTarget=2194(int length, string text)
|
||||
|
||||
# Replace the target text with the argument text after \d processing.
|
||||
# Text is counted so it can contain nulls.
|
||||
# Text is counted so it can contain NULs.
|
||||
# Looks for \d where d is between 1 and 9 and replaces these with the strings
|
||||
# matched in the last search operation which were surrounded by \( and \).
|
||||
# Returns the length of the replacement text including any change
|
||||
@@ -860,7 +863,7 @@ fun int ReplaceTarget=2194(int length, string text)
|
||||
fun int ReplaceTargetRE=2195(int length, string text)
|
||||
|
||||
# Search for a counted string in the target and set the target to the found
|
||||
# range. Text is counted so it can contain nulls.
|
||||
# range. Text is counted so it can contain NULs.
|
||||
# Returns length of range or -1 for failure in which case target is not moved.
|
||||
fun int SearchInTarget=2197(int length, string text)
|
||||
|
||||
@@ -1015,7 +1018,7 @@ set void SetScrollWidth=2274(int pixelWidth,)
|
||||
get int GetScrollWidth=2275(,)
|
||||
|
||||
# Measure the pixel width of some text in a particular style.
|
||||
# Nul terminated text argument.
|
||||
# NUL terminated text argument.
|
||||
# Does not handle tab or control characters.
|
||||
fun int TextWidth=2276(int style, string text)
|
||||
|
||||
@@ -1223,7 +1226,7 @@ fun void LineEndDisplayExtend=2348(,)
|
||||
# except they behave differently when word-wrap is enabled:
|
||||
# They go first to the start / end of the display line, like (Home|LineEnd)Display
|
||||
# The difference is that, the cursor is already at the point, it goes on to the start
|
||||
# or end of the document line, as appropriate for (Home|LineEnd|VCHome)Extend.
|
||||
# or end of the document line, as appropriate for (Home|LineEnd|VCHome)(Extend)?.
|
||||
|
||||
fun void HomeWrap=2349(,)
|
||||
fun void HomeWrapExtend=2450(,)
|
||||
@@ -1260,7 +1263,7 @@ set void SetViewEOL=2356(bool visible,)
|
||||
get int GetDocPointer=2357(,)
|
||||
|
||||
# Change the document object used.
|
||||
set void SetDocPointer=2358(,int pointer)
|
||||
set void SetDocPointer=2358(, int pointer)
|
||||
|
||||
# Set which document modification events are sent to the container.
|
||||
set void SetModEventMask=2359(int mask,)
|
||||
@@ -1385,7 +1388,7 @@ fun void DelLineRight=2396(,)
|
||||
set void SetXOffset=2397(int newOffset,)
|
||||
get int GetXOffset=2398(,)
|
||||
|
||||
# Set the last x chosen value to be the caret x position
|
||||
# Set the last x chosen value to be the caret x position.
|
||||
fun void ChooseCaretX=2399(,)
|
||||
|
||||
# Set the focus to this Scintilla widget.
|
||||
@@ -1427,7 +1430,7 @@ fun void SetYCaretPolicy=2403(int caretPolicy, int caretSlop)
|
||||
# Set printing to line wrapped (SC_WRAP_WORD) or not line wrapped (SC_WRAP_NONE).
|
||||
set void SetPrintWrapMode=2406(int mode,)
|
||||
|
||||
# Is printing line wrapped.
|
||||
# Is printing line wrapped?
|
||||
get int GetPrintWrapMode=2407(,)
|
||||
|
||||
# Set a fore colour for active hotspots.
|
||||
@@ -1439,7 +1442,10 @@ set void SetHotspotActiveBack=2411(bool useSetting, colour back)
|
||||
# Enable / Disable underlining active hotspots.
|
||||
set void SetHotspotActiveUnderline=2412(bool underline,)
|
||||
|
||||
# Move caret between paragraphs (delimited by empty lines)
|
||||
# Limit hotspots to single line so hotspots on two lines don't merge.
|
||||
set void SetHotspotSingleLine=2421(bool singleLine,)
|
||||
|
||||
# Move caret between paragraphs (delimited by empty lines).
|
||||
fun void ParaDown=2413(,)
|
||||
fun void ParaDownExtend=2414(,)
|
||||
fun void ParaUp=2415(,)
|
||||
@@ -1459,6 +1465,91 @@ fun void CopyRange=2419(position start, position end)
|
||||
# Copy argument text to the clipboard.
|
||||
fun void CopyText=2420(int length, string text)
|
||||
|
||||
# Selection modes
|
||||
enu SelectionMode=SC_SEL_
|
||||
val SC_SEL_STREAM=0
|
||||
val SC_SEL_RECTANGLE=1
|
||||
val SC_SEL_LINES=2
|
||||
|
||||
# Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
|
||||
# by lines (SC_SEL_LINES).
|
||||
set void SetSelectionMode=2422(int mode,)
|
||||
|
||||
# Get the mode of the current selection.
|
||||
get int GetSelectionMode=2423(,)
|
||||
|
||||
# Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
|
||||
fun position GetLineSelStartPosition=2424(int line,)
|
||||
|
||||
# Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
|
||||
fun position GetLineSelEndPosition=2425(int line,)
|
||||
|
||||
## RectExtended rectangular selection moves
|
||||
# Move caret down one line, extending rectangular selection to new caret position.
|
||||
fun void LineDownRectExtend=2426(,)
|
||||
|
||||
# Move caret up one line, extending rectangular selection to new caret position.
|
||||
fun void LineUpRectExtend=2427(,)
|
||||
|
||||
# Move caret left one character, extending rectangular selection to new caret position.
|
||||
fun void CharLeftRectExtend=2428(,)
|
||||
|
||||
# Move caret right one character, extending rectangular selection to new caret position.
|
||||
fun void CharRightRectExtend=2429(,)
|
||||
|
||||
# Move caret to first position on line, extending rectangular selection to new caret position.
|
||||
fun void HomeRectExtend=2430(,)
|
||||
|
||||
# Move caret to before first visible character on line.
|
||||
# If already there move to first character on line.
|
||||
# In either case, extend rectangular selection to new caret position.
|
||||
fun void VCHomeRectExtend=2431(,)
|
||||
|
||||
# Move caret to last position on line, extending rectangular selection to new caret position.
|
||||
fun void LineEndRectExtend=2432(,)
|
||||
|
||||
# Move caret one page up, extending rectangular selection to new caret position.
|
||||
fun void PageUpRectExtend=2433(,)
|
||||
|
||||
# Move caret one page down, extending rectangular selection to new caret position.
|
||||
fun void PageDownRectExtend=2434(,)
|
||||
|
||||
|
||||
# Move caret to top of page, or one page up if already at top of page.
|
||||
fun void StutteredPageUp=2435(,)
|
||||
|
||||
# Move caret to top of page, or one page up if already at top of page, extending selection to new caret position.
|
||||
fun void StutteredPageUpExtend=2436(,)
|
||||
|
||||
# Move caret to bottom of page, or one page down if already at bottom of page.
|
||||
fun void StutteredPageDown=2437(,)
|
||||
|
||||
# Move caret to bottom of page, or one page down if already at bottom of page, extending selection to new caret position.
|
||||
fun void StutteredPageDownExtend=2438(,)
|
||||
|
||||
|
||||
# Move caret left one word, position cursor at end of word.
|
||||
fun void WordLeftEnd=2439(,)
|
||||
|
||||
# Move caret left one word, position cursor at end of word, extending selection to new caret position.
|
||||
fun void WordLeftEndExtend=2440(,)
|
||||
|
||||
# Move caret right one word, position cursor at end of word.
|
||||
fun void WordRightEnd=2441(,)
|
||||
|
||||
# Move caret right one word, position cursor at end of word, extending selection to new caret position.
|
||||
fun void WordRightEndExtend=2442(,)
|
||||
|
||||
# Set the set of characters making up whitespace for when moving or selecting by word.
|
||||
# Should be called after SetWordChars.
|
||||
set void SetWhitespaceChars=2443(, string characters)
|
||||
|
||||
# Reset the set of characters for whitespace and word characters to the defaults.
|
||||
fun void SetCharsDefault=2444(,)
|
||||
|
||||
# Get currently selected item position in the auto-completion list
|
||||
fun int AutoCGetCurrent=2445(,)
|
||||
|
||||
# Start notifying the container of all key presses and commands.
|
||||
fun void StartRecord=3001(,)
|
||||
|
||||
@@ -1486,7 +1577,7 @@ set void SetKeyWords=4005(int keywordSet, string keyWords)
|
||||
# Set the lexing language of the document based on string name.
|
||||
set void SetLexerLanguage=4006(, string language)
|
||||
|
||||
# Load a lexer library (dll / so)
|
||||
# Load a lexer library (dll / so).
|
||||
fun void LoadLexerLibrary=4007(, string path)
|
||||
|
||||
# Notifications
|
||||
@@ -1591,6 +1682,16 @@ val SCLEX_ESCRIPT=41
|
||||
val SCLEX_PS=42
|
||||
val SCLEX_NSIS=43
|
||||
val SCLEX_MMIXAL=44
|
||||
val SCLEX_CLW=45
|
||||
val SCLEX_CLWNOCASE=46
|
||||
val SCLEX_LOT=47
|
||||
val SCLEX_YAML=48
|
||||
val SCLEX_TEX=49
|
||||
val SCLEX_METAPOST=50
|
||||
val SCLEX_POWERBASIC=51
|
||||
val SCLEX_FORTH=52
|
||||
val SCLEX_ERLANG=53
|
||||
val SCLEX_OCTAVE=54
|
||||
|
||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@@ -1796,9 +1897,10 @@ val SCE_PL_STRING_QQ=27
|
||||
val SCE_PL_STRING_QX=28
|
||||
val SCE_PL_STRING_QR=29
|
||||
val SCE_PL_STRING_QW=30
|
||||
# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT
|
||||
# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC
|
||||
lex VB=SCLEX_VB SCE_B_
|
||||
lex VBScript=SCLEX_VBSCRIPT SCE_B_
|
||||
lex PowerBasic=SCLEX_POWERBASIC SCE_B_
|
||||
val SCE_B_DEFAULT=0
|
||||
val SCE_B_COMMENT=1
|
||||
val SCE_B_NUMBER=2
|
||||
@@ -1808,6 +1910,10 @@ val SCE_B_PREPROCESSOR=5
|
||||
val SCE_B_OPERATOR=6
|
||||
val SCE_B_IDENTIFIER=7
|
||||
val SCE_B_DATE=8
|
||||
val SCE_B_STRINGEOL=9
|
||||
val SCE_B_KEYWORD2=10
|
||||
val SCE_B_KEYWORD3=11
|
||||
val SCE_B_KEYWORD4=12
|
||||
# Lexical states for SCLEX_PROPERTIES
|
||||
lex Properties=SCLEX_PROPERTIES SCE_PROPS_
|
||||
val SCE_PROPS_DEFAULT=0
|
||||
@@ -1863,6 +1969,8 @@ val SCE_ERR_DIFF_MESSAGE=13
|
||||
val SCE_ERR_PHP=14
|
||||
val SCE_ERR_ELF=15
|
||||
val SCE_ERR_IFC=16
|
||||
val SCE_ERR_IFORT=17
|
||||
val SCE_ERR_ABSF=18
|
||||
# Lexical states for SCLEX_BATCH
|
||||
lex Batch=SCLEX_BATCH SCE_BAT_
|
||||
val SCE_BAT_DEFAULT=0
|
||||
@@ -1982,6 +2090,20 @@ val SCE_NNCRONTAB_NUMBER=7
|
||||
val SCE_NNCRONTAB_STRING=8
|
||||
val SCE_NNCRONTAB_ENVIRONMENT=9
|
||||
val SCE_NNCRONTAB_IDENTIFIER=10
|
||||
# Lexical states for SCLEX_FORTH (Forth Lexer)
|
||||
lex Forth=SCLEX_FORTH SCE_FORTH_
|
||||
val SCE_FORTH_DEFAULT=0
|
||||
val SCE_FORTH_COMMENT=1
|
||||
val SCE_FORTH_COMMENT_ML=2
|
||||
val SCE_FORTH_IDENTIFIER=3
|
||||
val SCE_FORTH_CONTROL=4
|
||||
val SCE_FORTH_KEYWORD=5
|
||||
val SCE_FORTH_DEFWORD=6
|
||||
val SCE_FORTH_PREWORD1=7
|
||||
val SCE_FORTH_PREWORD2=8
|
||||
val SCE_FORTH_NUMBER=9
|
||||
val SCE_FORTH_STRING=10
|
||||
val SCE_FORTH_LOCALE=11
|
||||
# Lexical states for SCLEX_MATLAB
|
||||
lex MatLab=SCLEX_MATLAB SCE_MATLAB_
|
||||
val SCE_MATLAB_DEFAULT=0
|
||||
@@ -1989,31 +2111,29 @@ val SCE_MATLAB_COMMENT=1
|
||||
val SCE_MATLAB_COMMAND=2
|
||||
val SCE_MATLAB_NUMBER=3
|
||||
val SCE_MATLAB_KEYWORD=4
|
||||
# single quoted string
|
||||
val SCE_MATLAB_STRING=5
|
||||
val SCE_MATLAB_OPERATOR=6
|
||||
val SCE_MATLAB_IDENTIFIER=7
|
||||
val SCE_MATLAB_DOUBLEQUOTESTRING=8
|
||||
# Lexical states for SCLEX_SCRIPTOL
|
||||
lex Sol=SCLEX_SCRIPTOL SCE_SCRIPTOL_
|
||||
val SCE_SCRIPTOL_DEFAULT=0
|
||||
val SCE_SCRIPTOL_COMMENT=1
|
||||
val SCE_SCRIPTOL_WHITE=1
|
||||
val SCE_SCRIPTOL_COMMENTLINE=2
|
||||
val SCE_SCRIPTOL_COMMENTDOC=3
|
||||
val SCE_SCRIPTOL_NUMBER=4
|
||||
val SCE_SCRIPTOL_WORD=5
|
||||
val SCE_SCRIPTOL_STRING=6
|
||||
val SCE_SCRIPTOL_CHARACTER=7
|
||||
val SCE_SCRIPTOL_UUID=8
|
||||
val SCE_SCRIPTOL_PREPROCESSOR=9
|
||||
val SCE_SCRIPTOL_OPERATOR=10
|
||||
val SCE_SCRIPTOL_IDENTIFIER=11
|
||||
val SCE_SCRIPTOL_STRINGEOL=12
|
||||
val SCE_SCRIPTOL_VERBATIM=13
|
||||
val SCE_SCRIPTOL_REGEX=14
|
||||
val SCE_SCRIPTOL_COMMENTLINEDOC=15
|
||||
val SCE_SCRIPTOL_WORD2=16
|
||||
val SCE_SCRIPTOL_COMMENTDOCKEYWORD=17
|
||||
val SCE_SCRIPTOL_COMMENTDOCKEYWORDERROR=18
|
||||
val SCE_SCRIPTOL_COMMENTBASIC=19
|
||||
val SCE_SCRIPTOL_PERSISTENT=3
|
||||
val SCE_SCRIPTOL_CSTYLE=4
|
||||
val SCE_SCRIPTOL_COMMENTBLOCK=5
|
||||
val SCE_SCRIPTOL_NUMBER=6
|
||||
val SCE_SCRIPTOL_STRING=7
|
||||
val SCE_SCRIPTOL_CHARACTER=8
|
||||
val SCE_SCRIPTOL_STRINGEOL=9
|
||||
val SCE_SCRIPTOL_KEYWORD=10
|
||||
val SCE_SCRIPTOL_OPERATOR=11
|
||||
val SCE_SCRIPTOL_IDENTIFIER=12
|
||||
val SCE_SCRIPTOL_TRIPLE=13
|
||||
val SCE_SCRIPTOL_CLASSNAME=14
|
||||
val SCE_SCRIPTOL_PREPROCESSOR=15
|
||||
# Lexical states for SCLEX_ASM
|
||||
lex Asm=SCLEX_ASM SCE_ASM_
|
||||
val SCE_ASM_DEFAULT=0
|
||||
@@ -2027,6 +2147,10 @@ val SCE_ASM_MATHINSTRUCTION=7
|
||||
val SCE_ASM_REGISTER=8
|
||||
val SCE_ASM_DIRECTIVE=9
|
||||
val SCE_ASM_DIRECTIVEOPERAND=10
|
||||
val SCE_ASM_COMMENTBLOCK=11
|
||||
val SCE_ASM_CHARACTER=12
|
||||
val SCE_ASM_STRINGEOL=13
|
||||
val SCE_ASM_EXTINSTRUCTION=14
|
||||
# Lexical states for SCLEX_FORTRAN
|
||||
lex Fortran=SCLEX_FORTRAN SCE_F_
|
||||
lex F77=SCLEX_F77 SCE_F_
|
||||
@@ -2162,6 +2286,78 @@ val SCE_MMIXAL_HEX=14
|
||||
val SCE_MMIXAL_OPERATOR=15
|
||||
val SCE_MMIXAL_SYMBOL=16
|
||||
val SCE_MMIXAL_INCLUDE=17
|
||||
# Lexical states for SCLEX_CLW
|
||||
lex Clarion=SCLEX_CLW SCE_CLW_
|
||||
val SCE_CLW_DEFAULT=0
|
||||
val SCE_CLW_LABEL=1
|
||||
val SCE_CLW_COMMENT=2
|
||||
val SCE_CLW_STRING=3
|
||||
val SCE_CLW_USER_IDENTIFIER=4
|
||||
val SCE_CLW_INTEGER_CONSTANT=5
|
||||
val SCE_CLW_REAL_CONSTANT=6
|
||||
val SCE_CLW_PICTURE_STRING=7
|
||||
val SCE_CLW_KEYWORD=8
|
||||
val SCE_CLW_COMPILER_DIRECTIVE=9
|
||||
val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=10
|
||||
val SCE_CLW_STRUCTURE_DATA_TYPE=11
|
||||
val SCE_CLW_ATTRIBUTE=12
|
||||
val SCE_CLW_STANDARD_EQUATE=13
|
||||
val SCE_CLW_ERROR=14
|
||||
# Lexical states for SCLEX_LOT
|
||||
lex LOT=SCLEX_LOT SCE_LOT_
|
||||
val SCE_LOT_DEFAULT=0
|
||||
val SCE_LOT_HEADER=1
|
||||
val SCE_LOT_BREAK=2
|
||||
val SCE_LOT_SET=3
|
||||
val SCE_LOT_PASS=4
|
||||
val SCE_LOT_FAIL=5
|
||||
val SCE_LOT_ABORT=6
|
||||
# Lexical states for SCLEX_YAML
|
||||
lex YAML=SCLEX_YAML SCE_YAML_
|
||||
val SCE_YAML_DEFAULT=0
|
||||
val SCE_YAML_COMMENT=1
|
||||
val SCE_YAML_IDENTIFIER=2
|
||||
val SCE_YAML_KEYWORD=3
|
||||
val SCE_YAML_NUMBER=4
|
||||
val SCE_YAML_REFERENCE=5
|
||||
val SCE_YAML_DOCUMENT=6
|
||||
val SCE_YAML_TEXT=7
|
||||
val SCE_YAML_ERROR=8
|
||||
# Lexical states for SCLEX_TEX
|
||||
lex TeX=SCLEX_TEX SCE_TEX_
|
||||
val SCE_TEX_DEFAULT=0
|
||||
val SCE_TEX_SPECIAL=1
|
||||
val SCE_TEX_GROUP=2
|
||||
val SCE_TEX_SYMBOL=3
|
||||
val SCE_TEX_COMMAND=4
|
||||
val SCE_TEX_TEXT=5
|
||||
lex Metapost=SCLEX_METAPOST SCE_METAPOST_
|
||||
val SCE_METAPOST_DEFAULT=0
|
||||
val SCE_METAPOST_SPECIAL=1
|
||||
val SCE_METAPOST_GROUP=2
|
||||
val SCE_METAPOST_SYMBOL=3
|
||||
val SCE_METAPOST_COMMAND=4
|
||||
val SCE_METAPOST_TEXT=5
|
||||
val SCE_METAPOST_EXTRA=6
|
||||
# Lexical states for SCLEX_ERLANG
|
||||
lex Erlang=SCLEX_ERLANG SCE_ERLANG_
|
||||
val SCE_ERLANG_DEFAULT=0
|
||||
val SCE_ERLANG_COMMENT=1
|
||||
val SCE_ERLANG_VARIABLE=2
|
||||
val SCE_ERLANG_NUMBER=3
|
||||
val SCE_ERLANG_KEYWORD=4
|
||||
val SCE_ERLANG_STRING=5
|
||||
val SCE_ERLANG_OPERATOR=6
|
||||
val SCE_ERLANG_ATOM=7
|
||||
val SCE_ERLANG_FUNCTION_NAME=8
|
||||
val SCE_ERLANG_CHARACTER=9
|
||||
val SCE_ERLANG_MACRO=10
|
||||
val SCE_ERLANG_RECORD=11
|
||||
val SCE_ERLANG_SEPARATOR=12
|
||||
val SCE_ERLANG_NODE_NAME=13
|
||||
val SCE_ERLANG_UNKNOWN=31
|
||||
# Lexical states for SCLEX_OCTAVE are identical to MatLab
|
||||
lex Octave=SCLEX_OCTAVE SCE_MATLAB_
|
||||
|
||||
# Events
|
||||
|
||||
|
@@ -48,6 +48,10 @@ void CallTip::RefreshColourPalette(Palette &pal, bool want) {
|
||||
pal.WantFind(colourLight, want);
|
||||
}
|
||||
|
||||
static bool IsArrowCharacter(char ch) {
|
||||
return (ch >= 0) && (ch <= '\002');
|
||||
}
|
||||
|
||||
void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
int posStart, int posEnd, int ytext, PRectangle rcClient,
|
||||
bool highlight, bool draw) {
|
||||
@@ -56,7 +60,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
int maxEnd = 0;
|
||||
int ends[10];
|
||||
for (int i=0;i<len;i++) {
|
||||
if (s[i] <= '\002') {
|
||||
if (IsArrowCharacter(s[i])) {
|
||||
if (i > 0)
|
||||
ends[maxEnd++] = i;
|
||||
ends[maxEnd++] = i+1;
|
||||
@@ -68,7 +72,7 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
|
||||
for (int seg = 0; seg<maxEnd; seg++) {
|
||||
int endSeg = ends[seg];
|
||||
if (endSeg > startSeg) {
|
||||
if (s[startSeg] <= '\002') {
|
||||
if (IsArrowCharacter(s[startSeg])) {
|
||||
xEnd = x + widthArrow;
|
||||
offsetMain = xEnd;
|
||||
if (draw) {
|
||||
|
@@ -175,6 +175,7 @@ void ContractionState::DeleteLines(int lineDoc, int lineCount) {
|
||||
if (i != 0) // Line zero is always visible
|
||||
lines[i].visible = lines[i + lineCount].visible;
|
||||
lines[i].expanded = lines[i + lineCount].expanded;
|
||||
lines[i].height = lines[i + lineCount].height;
|
||||
}
|
||||
linesInDoc -= lineCount;
|
||||
linesInDisplay += deltaDisplayed;
|
||||
|
@@ -50,7 +50,7 @@ Document::Document() {
|
||||
stylingBits = 5;
|
||||
stylingBitsMask = 0x1F;
|
||||
stylingMask = 0;
|
||||
SetWordChars(0);
|
||||
SetDefaultCharClasses();
|
||||
endStyled = 0;
|
||||
styleClock = 0;
|
||||
enteredCount = 0;
|
||||
@@ -761,7 +761,7 @@ int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
|
||||
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart))
|
||||
pos++;
|
||||
}
|
||||
return pos;
|
||||
return MovePositionOutsideChar(pos, delta);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -791,6 +791,40 @@ int Document::NextWordStart(int pos, int delta) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Find the end of the next word in either a forward (delta >= 0) or backwards direction
|
||||
* (delta < 0).
|
||||
* This is looking for a transition between character classes although there is also some
|
||||
* additional movement to transit white space.
|
||||
* Used by cursor movement by word commands.
|
||||
*/
|
||||
int Document::NextWordEnd(int pos, int delta) {
|
||||
if (delta < 0) {
|
||||
if (pos > 0) {
|
||||
charClassification ccStart = WordCharClass(cb.CharAt(pos-1));
|
||||
if (ccStart != ccSpace) {
|
||||
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) {
|
||||
pos--;
|
||||
}
|
||||
}
|
||||
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccSpace) {
|
||||
pos--;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccSpace) {
|
||||
pos++;
|
||||
}
|
||||
if (pos < Length()) {
|
||||
charClassification ccStart = WordCharClass(cb.CharAt(pos));
|
||||
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) {
|
||||
pos++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return pos;
|
||||
}
|
||||
|
||||
/**
|
||||
* Check that the character at the given position is a word or punctuation character and that
|
||||
* the previous character is of a different character class.
|
||||
@@ -1012,7 +1046,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
|
||||
}
|
||||
}
|
||||
pos += increment;
|
||||
if (dbcsCodePage) {
|
||||
if (dbcsCodePage && (pos >= 0)) {
|
||||
// Ensure trying to match from start of character
|
||||
pos = MovePositionOutsideChar(pos, increment, false);
|
||||
}
|
||||
@@ -1032,10 +1066,24 @@ const char *Document::SubstituteByPosition(const char *text, int *length) {
|
||||
return 0;
|
||||
unsigned int lenResult = 0;
|
||||
for (int i = 0; i < *length; i++) {
|
||||
if ((text[i] == '\\') && (text[i + 1] >= '1' && text[i + 1] <= '9')) {
|
||||
unsigned int patNum = text[i + 1] - '0';
|
||||
lenResult += pre->eopat[patNum] - pre->bopat[patNum];
|
||||
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++;
|
||||
}
|
||||
@@ -1045,13 +1093,43 @@ const char *Document::SubstituteByPosition(const char *text, int *length) {
|
||||
return 0;
|
||||
char *o = substituted;
|
||||
for (int j = 0; j < *length; j++) {
|
||||
if ((text[j] == '\\') && (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++;
|
||||
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];
|
||||
}
|
||||
@@ -1085,26 +1163,27 @@ void Document::ChangeCase(Range r, bool makeUpperCase) {
|
||||
}
|
||||
}
|
||||
|
||||
void Document::SetWordChars(unsigned char *chars) {
|
||||
int ch;
|
||||
for (ch = 0; ch < 256; ch++) {
|
||||
void Document::SetDefaultCharClasses() {
|
||||
// Initialize all char classes to default values
|
||||
for (int ch = 0; ch < 256; ch++) {
|
||||
if (ch == '\r' || ch == '\n')
|
||||
charClass[ch] = ccNewLine;
|
||||
else if (ch < 0x20 || ch == ' ')
|
||||
charClass[ch] = ccSpace;
|
||||
else if (ch >= 0x80 || isalnum(ch) || ch == '_')
|
||||
charClass[ch] = ccWord;
|
||||
else
|
||||
charClass[ch] = ccPunctuation;
|
||||
}
|
||||
}
|
||||
|
||||
void Document::SetCharClasses(unsigned char *chars, charClassification newCharClass) {
|
||||
// Apply the newCharClass to the specifed chars
|
||||
if (chars) {
|
||||
while (*chars) {
|
||||
charClass[*chars] = ccWord;
|
||||
charClass[*chars] = newCharClass;
|
||||
chars++;
|
||||
}
|
||||
} else {
|
||||
for (ch = 0; ch < 256; ch++) {
|
||||
if (ch >= 0x80 || isalnum(ch) || ch == '_')
|
||||
charClass[ch] = ccWord;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1335,14 +1414,18 @@ int Document::WordPartRight(int pos) {
|
||||
return pos;
|
||||
}
|
||||
|
||||
int Document::ExtendStyleRange(int pos, int delta) {
|
||||
bool IsLineEndChar(char c) {
|
||||
return (c == '\n' || c == '\r');
|
||||
}
|
||||
|
||||
int Document::ExtendStyleRange(int pos, int delta, bool singleLine) {
|
||||
int sStart = cb.StyleAt(pos);
|
||||
if (delta < 0) {
|
||||
while (pos > 0 && (cb.StyleAt(pos) == sStart))
|
||||
while (pos > 0 && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) )
|
||||
pos--;
|
||||
pos++;
|
||||
} else {
|
||||
while (pos < (Length()) && (cb.StyleAt(pos) == sStart))
|
||||
while (pos < (Length()) && (cb.StyleAt(pos) == sStart) && (!singleLine || !IsLineEndChar(cb.CharAt(pos))) )
|
||||
pos++;
|
||||
}
|
||||
return pos;
|
||||
|
@@ -87,11 +87,12 @@ public:
|
||||
userData = 0;
|
||||
}
|
||||
};
|
||||
|
||||
enum charClassification { ccSpace, ccNewLine, ccWord, ccPunctuation };
|
||||
|
||||
private:
|
||||
int refCount;
|
||||
CellBuffer cb;
|
||||
enum charClassification { ccSpace, ccNewLine, ccWord, ccPunctuation };
|
||||
charClassification charClass[256];
|
||||
char stylingMask;
|
||||
int endStyled;
|
||||
@@ -190,6 +191,7 @@ public:
|
||||
void Indent(bool forwards);
|
||||
int ExtendWordSelect(int pos, int delta, bool onlyWordCharacters=false);
|
||||
int NextWordStart(int pos, int delta);
|
||||
int NextWordEnd(int pos, int delta);
|
||||
int Length() { return cb.Length(); }
|
||||
long FindText(int minPos, int maxPos, const char *s,
|
||||
bool caseSensitive, bool word, bool wordStart, bool regExp, bool posix, int *length);
|
||||
@@ -198,8 +200,9 @@ public:
|
||||
int LinesTotal();
|
||||
|
||||
void ChangeCase(Range r, bool makeUpperCase);
|
||||
|
||||
void SetWordChars(unsigned char *chars);
|
||||
|
||||
void SetDefaultCharClasses();
|
||||
void SetCharClasses(unsigned char *chars, charClassification newCharClass);
|
||||
void SetStylingBits(int bits);
|
||||
void StartStyling(int position, char mask);
|
||||
bool SetStyleFor(int length, char style);
|
||||
@@ -220,7 +223,7 @@ public:
|
||||
bool IsWordPartSeparator(char ch);
|
||||
int WordPartLeft(int pos);
|
||||
int WordPartRight(int pos);
|
||||
int ExtendStyleRange(int pos, int delta);
|
||||
int ExtendStyleRange(int pos, int delta, bool singleLine = false);
|
||||
int ParaUp(int pos);
|
||||
int ParaDown(int pos);
|
||||
|
||||
|
File diff suppressed because it is too large
Load Diff
@@ -31,6 +31,16 @@ public:
|
||||
Timer();
|
||||
};
|
||||
|
||||
/**
|
||||
*/
|
||||
class Idler {
|
||||
public:
|
||||
bool state;
|
||||
IdlerID idlerID;
|
||||
|
||||
Idler();
|
||||
};
|
||||
|
||||
/**
|
||||
*/
|
||||
class LineLayout {
|
||||
@@ -115,6 +125,10 @@ public:
|
||||
void Dispose(LineLayout *ll);
|
||||
};
|
||||
|
||||
/**
|
||||
* Hold a piece of text selected for copying or dragging.
|
||||
* The text is expected to hold a terminating '\0'.
|
||||
*/
|
||||
class SelectionText {
|
||||
public:
|
||||
char *s;
|
||||
@@ -208,6 +222,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
Timer autoScrollTimer;
|
||||
enum { autoScrollDelay = 200 };
|
||||
|
||||
Idler idler;
|
||||
|
||||
Point lastClick;
|
||||
unsigned int lastClickTime;
|
||||
int dwellDelay;
|
||||
@@ -244,9 +260,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
int modEventMask;
|
||||
|
||||
SelectionText drag;
|
||||
enum { selStream, selRectangle, selRectangleFixed } selType;
|
||||
int xStartSelect;
|
||||
int xEndSelect;
|
||||
enum selTypes { noSel, selStream, selRectangle, selLines };
|
||||
selTypes selType;
|
||||
bool moveExtendsSelection;
|
||||
int xStartSelect; ///< x position of start of rectangular selection
|
||||
int xEndSelect; ///< x position of end of rectangular selection
|
||||
bool primarySelection;
|
||||
|
||||
int caretXPolicy;
|
||||
@@ -271,8 +289,10 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
// Wrapping support
|
||||
enum { eWrapNone, eWrapWord } wrapState;
|
||||
bool backgroundWrapEnabled;
|
||||
int wrapWidth;
|
||||
int docLineLastWrapped;
|
||||
int docLastLineToWrap;
|
||||
|
||||
Document *pdoc;
|
||||
|
||||
@@ -310,15 +330,16 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
|
||||
int CurrentPosition();
|
||||
bool SelectionEmpty();
|
||||
int SelectionStart(int line=-1);
|
||||
int SelectionEnd(int line=-1);
|
||||
int SelectionStart();
|
||||
int SelectionEnd();
|
||||
void InvalidateSelection(int currentPos_, int anchor_);
|
||||
void SetSelection(int currentPos_, int anchor_);
|
||||
void SetSelection(int currentPos_);
|
||||
void SetEmptySelection(int currentPos_);
|
||||
bool RangeContainsProtected(int start, int end) const;
|
||||
bool SelectionContainsProtected() const;
|
||||
bool SelectionContainsProtected();
|
||||
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
|
||||
int MovePositionTo(int newPos, bool extend=false, bool ensureVisible=true);
|
||||
int MovePositionTo(int newPos, selTypes sel=noSel, bool ensureVisible=true);
|
||||
int MovePositionSoVisible(int pos, int moveDir);
|
||||
void SetLastXChosen();
|
||||
|
||||
@@ -332,8 +353,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void DropCaret();
|
||||
void InvalidateCaret();
|
||||
|
||||
void NeedWrapping(int docLineStartWrapping=0);
|
||||
bool WrapLines();
|
||||
void NeedWrapping(int docLineStartWrapping = 0, int docLineEndWrapping = 0x7ffffff);
|
||||
bool WrapLines(bool fullWrap, int priorityWrapLineStart);
|
||||
void LinesJoin();
|
||||
void LinesSplit(int pixelWidth);
|
||||
|
||||
@@ -406,13 +427,13 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void NotifyStyleNeeded(Document *doc, void *userData, int endPos);
|
||||
void NotifyMacroRecord(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
|
||||
|
||||
void PageMove(int direction, bool extend=false);
|
||||
void PageMove(int direction, selTypes sel=noSel, bool stuttered = false);
|
||||
void ChangeCaseOfSelection(bool makeUpperCase);
|
||||
void LineTranspose();
|
||||
void LineDuplicate();
|
||||
virtual void CancelModes();
|
||||
void NewLine();
|
||||
void CursorUpOrDown(int direction, bool extend=false);
|
||||
void CursorUpOrDown(int direction, selTypes sel=noSel);
|
||||
int StartEndDisplayLine(int pos, bool start);
|
||||
virtual int KeyCommand(unsigned int iMessage);
|
||||
virtual int KeyDefault(int /* key */, int /*modifiers*/);
|
||||
@@ -451,7 +472,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
|
||||
void ButtonUp(Point pt, unsigned int curTime, bool ctrl);
|
||||
|
||||
void Tick();
|
||||
bool Idle();
|
||||
virtual void SetTicking(bool on) = 0;
|
||||
virtual bool SetIdle(bool) { return false; }
|
||||
virtual void SetMouseCapture(bool on) = 0;
|
||||
virtual bool HaveMouseCapture() = 0;
|
||||
void SetFocusState(bool focusState);
|
||||
@@ -484,6 +507,7 @@ public:
|
||||
// Public so scintilla_set_id can use it.
|
||||
int ctrlID;
|
||||
friend class AutoSurface;
|
||||
friend class SelectionLineIterator;
|
||||
};
|
||||
|
||||
/**
|
||||
|
@@ -232,8 +232,9 @@ void LexerManager::Clear()
|
||||
{
|
||||
if (NULL != first) {
|
||||
LexerLibrary *cur = first;
|
||||
LexerLibrary *next = first->next;
|
||||
LexerLibrary *next;
|
||||
while (cur) {
|
||||
next = cur->next;
|
||||
delete cur;
|
||||
cur = next;
|
||||
}
|
||||
|
@@ -10,7 +10,7 @@
|
||||
#include "Scintilla.h"
|
||||
#include "Indicator.h"
|
||||
|
||||
void Indicator::Draw(Surface *surface, PRectangle &rc) {
|
||||
void Indicator::Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine) {
|
||||
surface->PenColour(fore.allocated);
|
||||
int ymid = (rc.bottom + rc.top) / 2;
|
||||
if (style == INDIC_SQUIGGLE) {
|
||||
@@ -57,6 +57,12 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) {
|
||||
surface->LineTo(rc.right, rc.top - 4);
|
||||
} else if (style == INDIC_HIDDEN) {
|
||||
// Draw nothing
|
||||
} else if (style == INDIC_BOX) {
|
||||
surface->MoveTo(rc.left, ymid+1);
|
||||
surface->LineTo(rc.right, ymid+1);
|
||||
surface->LineTo(rc.right, rcLine.top+1);
|
||||
surface->LineTo(rc.left, rcLine.top+1);
|
||||
surface->LineTo(rc.left, ymid+1);
|
||||
} else { // Either INDIC_PLAIN or unknown
|
||||
surface->MoveTo(rc.left, ymid);
|
||||
surface->LineTo(rc.right, ymid);
|
||||
|
@@ -16,7 +16,7 @@ public:
|
||||
ColourPair fore;
|
||||
Indicator() : style(INDIC_PLAIN), fore(ColourDesired(0,0,0)) {
|
||||
}
|
||||
void Draw(Surface *surface, PRectangle &rc);
|
||||
void Draw(Surface *surface, const PRectangle &rc, const PRectangle &rcLine);
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@@ -2,7 +2,7 @@
|
||||
/** @file KeyMap.cxx
|
||||
** Defines a mapping between keystrokes and commands.
|
||||
**/
|
||||
// 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.
|
||||
|
||||
#include "Platform.h"
|
||||
@@ -15,7 +15,7 @@ KeyMap::KeyMap() : kmap(0), len(0), alloc(0) {
|
||||
for (int i = 0; MapDefault[i].key; i++) {
|
||||
AssignCmdKey(MapDefault[i].key,
|
||||
MapDefault[i].modifiers,
|
||||
MapDefault[i].msg);
|
||||
MapDefault[i].msg);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -35,7 +35,7 @@ void KeyMap::AssignCmdKey(int key, int modifiers, unsigned int msg) {
|
||||
KeyToCommand *ktcNew = new KeyToCommand[alloc + 5];
|
||||
if (!ktcNew)
|
||||
return;
|
||||
for (int k=0;k<len;k++)
|
||||
for (int k = 0; k < len; k++)
|
||||
ktcNew[k] = kmap[k];
|
||||
alloc += 5;
|
||||
delete []kmap;
|
||||
@@ -54,7 +54,7 @@ void KeyMap::AssignCmdKey(int key, int modifiers, unsigned int msg) {
|
||||
}
|
||||
|
||||
unsigned int KeyMap::Find(int key, int modifiers) {
|
||||
for (int i=0; i < len; i++) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
if ((key == kmap[i].key) && (modifiers == kmap[i].modifiers)) {
|
||||
return kmap[i].msg;
|
||||
}
|
||||
@@ -66,41 +66,49 @@ const KeyToCommand KeyMap::MapDefault[] = {
|
||||
{SCK_DOWN, SCI_NORM, SCI_LINEDOWN},
|
||||
{SCK_DOWN, SCI_SHIFT, SCI_LINEDOWNEXTEND},
|
||||
{SCK_DOWN, SCI_CTRL, SCI_LINESCROLLDOWN},
|
||||
{SCK_DOWN, SCI_ALT, SCI_PARADOWN},
|
||||
{SCK_DOWN, SCI_ASHIFT, SCI_PARADOWNEXTEND},
|
||||
{SCK_UP, SCI_NORM, SCI_LINEUP},
|
||||
{SCK_DOWN, SCI_ASHIFT, SCI_LINEDOWNRECTEXTEND},
|
||||
{SCK_UP, SCI_NORM, SCI_LINEUP},
|
||||
{SCK_UP, SCI_SHIFT, SCI_LINEUPEXTEND},
|
||||
{SCK_UP, SCI_CTRL, SCI_LINESCROLLUP},
|
||||
{SCK_UP, SCI_ALT, SCI_PARAUP},
|
||||
{SCK_UP, SCI_ASHIFT, SCI_PARAUPEXTEND},
|
||||
{SCK_UP, SCI_ASHIFT, SCI_LINEUPRECTEXTEND},
|
||||
{'[', SCI_CTRL, SCI_PARAUP},
|
||||
{'[', SCI_CSHIFT, SCI_PARAUPEXTEND},
|
||||
{']', SCI_CTRL, SCI_PARADOWN},
|
||||
{']', SCI_CSHIFT, SCI_PARADOWNEXTEND},
|
||||
{SCK_LEFT, SCI_NORM, SCI_CHARLEFT},
|
||||
{SCK_LEFT, SCI_SHIFT, SCI_CHARLEFTEXTEND},
|
||||
{SCK_LEFT, SCI_CTRL, SCI_WORDLEFT},
|
||||
{SCK_LEFT, SCI_CSHIFT, SCI_WORDLEFTEXTEND},
|
||||
{SCK_LEFT, SCI_ALT, SCI_WORDPARTLEFT},
|
||||
{SCK_LEFT, SCI_ASHIFT, SCI_WORDPARTLEFTEXTEND},
|
||||
{SCK_LEFT, SCI_ASHIFT, SCI_CHARLEFTRECTEXTEND},
|
||||
{SCK_RIGHT, SCI_NORM, SCI_CHARRIGHT},
|
||||
{SCK_RIGHT, SCI_SHIFT, SCI_CHARRIGHTEXTEND},
|
||||
{SCK_RIGHT, SCI_CTRL, SCI_WORDRIGHT},
|
||||
{SCK_RIGHT, SCI_CSHIFT, SCI_WORDRIGHTEXTEND},
|
||||
{SCK_RIGHT, SCI_ALT, SCI_WORDPARTRIGHT},
|
||||
{SCK_RIGHT, SCI_ASHIFT, SCI_WORDPARTRIGHTEXTEND},
|
||||
{SCK_HOME, SCI_NORM, SCI_VCHOME},
|
||||
{SCK_RIGHT, SCI_ASHIFT, SCI_CHARRIGHTRECTEXTEND},
|
||||
{'/', SCI_CTRL, SCI_WORDPARTLEFT},
|
||||
{'/', SCI_CSHIFT, SCI_WORDPARTLEFTEXTEND},
|
||||
{'\\', SCI_CTRL, SCI_WORDPARTRIGHT},
|
||||
{'\\', SCI_CSHIFT, SCI_WORDPARTRIGHTEXTEND},
|
||||
{SCK_HOME, SCI_NORM, SCI_VCHOME},
|
||||
{SCK_HOME, SCI_SHIFT, SCI_VCHOMEEXTEND},
|
||||
{SCK_HOME, SCI_CTRL, SCI_DOCUMENTSTART},
|
||||
{SCK_HOME, SCI_CSHIFT, SCI_DOCUMENTSTARTEXTEND},
|
||||
{SCK_HOME, SCI_ALT, SCI_HOMEDISPLAY},
|
||||
{SCK_HOME, SCI_ASHIFT, SCI_HOMEDISPLAYEXTEND},
|
||||
{SCK_END, SCI_NORM, SCI_LINEEND},
|
||||
// {SCK_HOME, SCI_ASHIFT, SCI_HOMEDISPLAYEXTEND},
|
||||
{SCK_HOME, SCI_ASHIFT, SCI_VCHOMERECTEXTEND},
|
||||
{SCK_END, SCI_NORM, SCI_LINEEND},
|
||||
{SCK_END, SCI_SHIFT, SCI_LINEENDEXTEND},
|
||||
{SCK_END, SCI_CTRL, SCI_DOCUMENTEND},
|
||||
{SCK_END, SCI_CSHIFT, SCI_DOCUMENTENDEXTEND},
|
||||
{SCK_END, SCI_ALT, SCI_LINEENDDISPLAY},
|
||||
{SCK_END, SCI_ASHIFT, SCI_LINEENDDISPLAYEXTEND},
|
||||
{SCK_PRIOR, SCI_NORM, SCI_PAGEUP},
|
||||
// {SCK_END, SCI_ASHIFT, SCI_LINEENDDISPLAYEXTEND},
|
||||
{SCK_END, SCI_ASHIFT, SCI_LINEENDRECTEXTEND},
|
||||
{SCK_PRIOR, SCI_NORM, SCI_PAGEUP},
|
||||
{SCK_PRIOR, SCI_SHIFT, SCI_PAGEUPEXTEND},
|
||||
{SCK_PRIOR, SCI_ASHIFT, SCI_PAGEUPRECTEXTEND},
|
||||
{SCK_NEXT, SCI_NORM, SCI_PAGEDOWN},
|
||||
{SCK_NEXT, SCI_SHIFT, SCI_PAGEDOWNEXTEND},
|
||||
{SCK_NEXT, SCI_ASHIFT, SCI_PAGEDOWNRECTEXTEND},
|
||||
{SCK_DELETE, SCI_NORM, SCI_CLEAR},
|
||||
{SCK_DELETE, SCI_SHIFT, SCI_CUT},
|
||||
{SCK_DELETE, SCI_CTRL, SCI_DELWORDRIGHT},
|
||||
|
@@ -134,6 +134,8 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmAVE);
|
||||
LINK_LEXER(lmBaan);
|
||||
LINK_LEXER(lmBullant);
|
||||
LINK_LEXER(lmClw);
|
||||
LINK_LEXER(lmClwNoCase);
|
||||
LINK_LEXER(lmConf);
|
||||
LINK_LEXER(lmCPP);
|
||||
LINK_LEXER(lmCPPNoCase);
|
||||
@@ -142,7 +144,9 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmCss);
|
||||
LINK_LEXER(lmEiffel);
|
||||
LINK_LEXER(lmEiffelkw);
|
||||
LINK_LEXER(lmErlang);
|
||||
LINK_LEXER(lmESCRIPT);
|
||||
LINK_LEXER(lmForth);
|
||||
LINK_LEXER(lmFortran);
|
||||
LINK_LEXER(lmF77);
|
||||
LINK_LEXER(lmHTML);
|
||||
@@ -153,7 +157,10 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmLout);
|
||||
LINK_LEXER(lmLua);
|
||||
LINK_LEXER(lmMatlab);
|
||||
LINK_LEXER(lmOctave);
|
||||
LINK_LEXER(lmMETAPOST);
|
||||
LINK_LEXER(lmMMIXAL);
|
||||
LINK_LEXER(lmLot);
|
||||
LINK_LEXER(lmNsis);
|
||||
LINK_LEXER(lmBatch);
|
||||
LINK_LEXER(lmDiff);
|
||||
@@ -163,6 +170,7 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmLatex);
|
||||
LINK_LEXER(lmNull);
|
||||
LINK_LEXER(lmPascal);
|
||||
LINK_LEXER(lmPB);
|
||||
LINK_LEXER(lmPerl);
|
||||
LINK_LEXER(lmPOV);
|
||||
LINK_LEXER(lmPS);
|
||||
@@ -170,8 +178,10 @@ int Scintilla_LinkLexers() {
|
||||
LINK_LEXER(lmRuby);
|
||||
LINK_LEXER(lmScriptol);
|
||||
LINK_LEXER(lmSQL);
|
||||
LINK_LEXER(lmTeX);
|
||||
LINK_LEXER(lmVB);
|
||||
LINK_LEXER(lmVBScript);
|
||||
LINK_LEXER(lmYAML);
|
||||
|
||||
//--Autogenerated -- end of automatically generated section
|
||||
|
||||
|
@@ -1,9 +1,11 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexAsm.cxx
|
||||
** Lexer for Assembler, just for the Masm Syntax
|
||||
** Lexer for Assembler, just for the MASM syntax
|
||||
** Written by The Black Horus
|
||||
** Enhancements and NASM stuff by Kein-Hong Man, 2003-10
|
||||
** SCE_ASM_COMMENTBLOCK and SCE_ASM_CHARACTER are for future GNU as colouring
|
||||
**/
|
||||
// Copyright 1998-2002 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.
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -22,24 +24,25 @@
|
||||
#include "SciLexer.h"
|
||||
|
||||
|
||||
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch =='\\');
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
|
||||
ch == '_' || ch == '?');
|
||||
}
|
||||
|
||||
static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' ||
|
||||
ch == '%' || ch == '@' || ch == '$' || ch == '?');
|
||||
}
|
||||
|
||||
inline bool isAsmOperator(char ch) {
|
||||
static inline bool IsAsmOperator(char ch) {
|
||||
if (isalnum(ch))
|
||||
return false;
|
||||
// '.' left out as it is used to make up numbers
|
||||
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
|
||||
ch == '(' || ch == ')' || ch == '=' ||
|
||||
ch == '[' || ch == ']' || ch == '<' ||
|
||||
ch == '>' || ch == ',' ||
|
||||
ch == '.' || ch == '%' || ch == ':')
|
||||
ch == '(' || ch == ')' || ch == '=' || ch == '^' ||
|
||||
ch == '[' || ch == ']' || ch == '<' || ch == '&' ||
|
||||
ch == '>' || ch == ',' || ch == '|' || ch == '~' ||
|
||||
ch == '%' || ch == ':')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
@@ -52,48 +55,63 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
WordList ®isters = *keywordlists[2];
|
||||
WordList &directive = *keywordlists[3];
|
||||
WordList &directiveOperand = *keywordlists[4];
|
||||
WordList &extInstruction = *keywordlists[5];
|
||||
|
||||
// Do not leak onto next line
|
||||
if (initStyle == SCE_ASM_STRINGEOL)
|
||||
initStyle = SCE_ASM_DEFAULT;
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
for (; sc.More(); sc.Forward())
|
||||
{
|
||||
|
||||
// Prevent SCE_ASM_STRINGEOL from leaking back to previous line
|
||||
if (sc.atLineStart && (sc.state == SCE_ASM_STRING)) {
|
||||
sc.SetState(SCE_ASM_STRING);
|
||||
} else if (sc.atLineStart && (sc.state == SCE_ASM_CHARACTER)) {
|
||||
sc.SetState(SCE_ASM_CHARACTER);
|
||||
}
|
||||
|
||||
// Handle line continuation generically.
|
||||
if (sc.ch == '\\') {
|
||||
if (sc.Match("\\\n")) {
|
||||
sc.Forward();
|
||||
continue;
|
||||
}
|
||||
if (sc.Match("\\\r\n")) {
|
||||
sc.Forward();
|
||||
if (sc.chNext == '\n' || sc.chNext == '\r') {
|
||||
sc.Forward();
|
||||
if (sc.ch == '\r' && sc.chNext == '\n') {
|
||||
sc.Forward();
|
||||
}
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if the current state should terminate.
|
||||
if (sc.state == SCE_ASM_OPERATOR) {
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
if (!IsAsmOperator(static_cast<char>(sc.ch))) {
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
}else if (sc.state == SCE_ASM_NUMBER) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_ASM_IDENTIFIER) {
|
||||
if (!IsAWordChar(sc.ch) ) {
|
||||
char s[100];
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
char s[100];
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
|
||||
if (cpuInstruction.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_CPUINSTRUCTION);
|
||||
} else if (mathInstruction.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_MATHINSTRUCTION);
|
||||
} else if (registers.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_REGISTER);
|
||||
} else if (directive.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_DIRECTIVE);
|
||||
} else if (directiveOperand.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_DIRECTIVEOPERAND);
|
||||
}
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
if (cpuInstruction.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_CPUINSTRUCTION);
|
||||
} else if (mathInstruction.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_MATHINSTRUCTION);
|
||||
} else if (registers.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_REGISTER);
|
||||
} else if (directive.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_DIRECTIVE);
|
||||
} else if (directiveOperand.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_DIRECTIVEOPERAND);
|
||||
} else if (extInstruction.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_EXTINSTRUCTION);
|
||||
}
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
}
|
||||
else if (sc.state == SCE_ASM_COMMENT ) {
|
||||
@@ -108,20 +126,36 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.ForwardSetState(SCE_ASM_DEFAULT);
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.ChangeState(SCE_ASM_STRINGEOL);
|
||||
sc.ForwardSetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_ASM_CHARACTER) {
|
||||
if (sc.ch == '\\') {
|
||||
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
|
||||
sc.Forward();
|
||||
}
|
||||
} else if (sc.ch == '\'') {
|
||||
sc.ForwardSetState(SCE_ASM_DEFAULT);
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.ChangeState(SCE_ASM_STRINGEOL);
|
||||
sc.ForwardSetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
// Determine if a new state should be entered.
|
||||
else if (sc.state == SCE_ASM_DEFAULT) {
|
||||
if (sc.state == SCE_ASM_DEFAULT) {
|
||||
if (sc.ch == ';'){
|
||||
sc.SetState(SCE_ASM_COMMENT);
|
||||
} else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) {
|
||||
sc.SetState(SCE_ASM_NUMBER);
|
||||
} else if (IsAWordStart(sc.ch)) {
|
||||
sc.SetState(SCE_ASM_IDENTIFIER);
|
||||
} else if (sc.Match('\"')) {
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.SetState(SCE_ASM_STRING);
|
||||
} else if (sc.ch == '\'') {
|
||||
sc.SetState(SCE_ASM_CHARACTER);
|
||||
} else if (IsAsmOperator(static_cast<char>(sc.ch))) {
|
||||
sc.SetState(SCE_ASM_OPERATOR);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -135,6 +169,7 @@ static const char * const asmWordListDesc[] = {
|
||||
"Registers",
|
||||
"Directives",
|
||||
"Directive operands",
|
||||
"Extended instructions",
|
||||
0
|
||||
};
|
||||
|
||||
|
441
contrib/src/stc/scintilla/src/LexCLW.cxx
Normal file
441
contrib/src/stc/scintilla/src/LexCLW.cxx
Normal file
@@ -0,0 +1,441 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexClw.cxx
|
||||
** Lexer for Clarion.
|
||||
**/
|
||||
// Copyright 2003 by Ron Schofield <ron@schofieldcomputer.com>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <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"
|
||||
|
||||
static char MakeUpperCase(char ch) {
|
||||
if (ch < 'a' || ch > 'z')
|
||||
return ch;
|
||||
else
|
||||
return static_cast<char>(ch - 'a' + 'A');
|
||||
}
|
||||
|
||||
static void MakeUpperCaseString(char *s) {
|
||||
while (*s) {
|
||||
*s = MakeUpperCase(*s);
|
||||
s++;
|
||||
}
|
||||
}
|
||||
|
||||
// Is a label start character
|
||||
inline bool IsALabelStart(const int iChar) {
|
||||
return(isalpha(iChar) || iChar == '_');
|
||||
}
|
||||
|
||||
// Is a label character
|
||||
inline bool IsALabelCharacter(const int iChar) {
|
||||
return(isalnum(iChar) || iChar == '_' || iChar == ':');
|
||||
}
|
||||
|
||||
// Is the character is a ! and the the next character is not a !
|
||||
inline bool IsACommentStart(StyleContext &scDoc) {
|
||||
return(scDoc.ch == '!' && scDoc.chNext != '!');
|
||||
}
|
||||
|
||||
// Is the character a Clarion hex character (ABCDEF)
|
||||
inline bool IsAHexCharacter(const int iChar, bool bCaseSensitive) {
|
||||
// Case insensitive.
|
||||
if (!bCaseSensitive) {
|
||||
if (strchr("ABCDEFabcdef", iChar) != NULL) {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
// Case sensitive
|
||||
else {
|
||||
if (strchr("ABCDEF", iChar) != NULL) {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
// Is the character a Clarion base character (B=Binary, O=Octal, H=Hex)
|
||||
inline bool IsANumericBaseCharacter(const int iChar, bool bCaseSensitive) {
|
||||
// Case insensitive.
|
||||
if (!bCaseSensitive) {
|
||||
// If character is a numeric base character
|
||||
if (strchr("BOHboh", iChar) != NULL) {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
// Case sensitive
|
||||
else {
|
||||
// If character is a numeric base character
|
||||
if (strchr("BOH", iChar) != NULL) {
|
||||
return(true);
|
||||
}
|
||||
}
|
||||
return(false);
|
||||
}
|
||||
|
||||
// Set the correct numeric constant state
|
||||
inline bool SetNumericConstantState(StyleContext &scDoc) {
|
||||
int iPoints = 0; // Point counter
|
||||
char cNumericString[100]; // Numeric string buffer
|
||||
|
||||
// Buffer the current numberic string
|
||||
scDoc.GetCurrent(cNumericString, sizeof(cNumericString));
|
||||
// Loop through the string until end of string (NULL termination)
|
||||
for (int iIndex = 0; cNumericString[iIndex] != '\0'; iIndex++) {
|
||||
// Depending on the character
|
||||
switch (cNumericString[iIndex]) {
|
||||
// Is a . (point)
|
||||
case '.' :
|
||||
// Increment point counter
|
||||
iPoints++;
|
||||
break;
|
||||
default :
|
||||
break;
|
||||
}
|
||||
}
|
||||
// If points found (can be more than one for improper formatted number
|
||||
if (iPoints > 0) {
|
||||
return(true);
|
||||
}
|
||||
// Else no points found
|
||||
else {
|
||||
return(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Clarion Language Colouring Procedure
|
||||
static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
|
||||
|
||||
int iParenthesesLevel=0; // Parenthese Level
|
||||
|
||||
WordList &wlClarionKeywords = *wlKeywords[0]; // Clarion Keywords
|
||||
WordList &wlCompilerDirectives = *wlKeywords[1]; // Compiler Directives
|
||||
WordList &wlBuiltInProcsFuncs = *wlKeywords[2]; // Builtin Procedures and Functions
|
||||
WordList &wlStructsDataTypes = *wlKeywords[3]; // Structures and Data Types
|
||||
WordList &wlAttributes = *wlKeywords[4]; // Procedure Attributes
|
||||
WordList &wlStandardEquates = *wlKeywords[5]; // Standard Equates
|
||||
WordList &wlReservedWords = *wlKeywords[6]; // Clarion Reserved Keywords
|
||||
|
||||
StyleContext scDoc(uiStartPos, iLength, iInitStyle, accStyler);
|
||||
|
||||
// lex source code
|
||||
for (; scDoc.More(); scDoc.Forward())
|
||||
{
|
||||
//
|
||||
// Determine if the current state should terminate.
|
||||
//
|
||||
|
||||
// Label State Handling
|
||||
if (scDoc.state == SCE_CLW_LABEL) {
|
||||
// If the character is not a valid label
|
||||
if (!IsALabelCharacter(scDoc.ch)) {
|
||||
// If the character is a . (dot syntax)
|
||||
if (scDoc.ch == '.') {
|
||||
// Uncolour the . (dot) to default state, move forward one character,
|
||||
// and change back to the label state.
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
scDoc.Forward();
|
||||
scDoc.SetState(SCE_CLW_LABEL);
|
||||
}
|
||||
// Else terminate the label state
|
||||
else {
|
||||
char cLabel[100]; // Label buffer
|
||||
// Buffer the current label string
|
||||
scDoc.GetCurrent(cLabel,sizeof(cLabel));
|
||||
// If case insensitive, convert string to UPPERCASE to match passed keywords.
|
||||
if (!bCaseSensitive) {
|
||||
MakeUpperCaseString(cLabel);
|
||||
}
|
||||
// If label string is in the Clarion reserved keyword list
|
||||
if (wlReservedWords.InList(cLabel)){
|
||||
// change to error state
|
||||
scDoc.ChangeState(SCE_CLW_ERROR);
|
||||
}
|
||||
// Else if label string is in the compiler directive keyword list
|
||||
else if (wlCompilerDirectives.InList(cLabel)) {
|
||||
// change the state to compiler directive state
|
||||
scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE);
|
||||
}
|
||||
// Terminate the label state and set to default state
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
// Keyword State Handling
|
||||
else if (scDoc.state == SCE_CLW_KEYWORD) {
|
||||
// If character is : (colon)
|
||||
if (scDoc.ch == ':') {
|
||||
char cEquate[100]; // Equate buffer
|
||||
// Move forward to include : (colon) in buffer
|
||||
scDoc.Forward();
|
||||
// Buffer the equate string
|
||||
scDoc.GetCurrent(cEquate,sizeof(cEquate));
|
||||
// If case insensitive, convert string to UPPERCASE to match passed keywords.
|
||||
if (!bCaseSensitive) {
|
||||
MakeUpperCaseString(cEquate);
|
||||
}
|
||||
// If statement string is in the equate list
|
||||
if (wlStandardEquates.InList(cEquate)) {
|
||||
// Change to equate state
|
||||
scDoc.ChangeState(SCE_CLW_STANDARD_EQUATE);
|
||||
}
|
||||
}
|
||||
// If the character is not a valid label character
|
||||
else if (!IsALabelCharacter(scDoc.ch)) {
|
||||
char cStatement[100]; // Statement buffer
|
||||
// Buffer the statement string
|
||||
scDoc.GetCurrent(cStatement,sizeof(cStatement));
|
||||
// If case insensitive, convert string to UPPERCASE to match passed keywords.
|
||||
if (!bCaseSensitive) {
|
||||
MakeUpperCaseString(cStatement);
|
||||
}
|
||||
// If statement string is in the Clarion keyword list
|
||||
if (wlClarionKeywords.InList(cStatement)) {
|
||||
// Set to the Clarion keyword state
|
||||
scDoc.ChangeState(SCE_CLW_KEYWORD);
|
||||
}
|
||||
// Else if statement string is in the compiler directive keyword list
|
||||
else if (wlCompilerDirectives.InList(cStatement)) {
|
||||
// Set to the compiler directive state
|
||||
scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE);
|
||||
}
|
||||
// Else if statement string is in the builtin procedures and functions keyword list
|
||||
else if (wlBuiltInProcsFuncs.InList(cStatement)) {
|
||||
// Set to the builtin procedures and functions state
|
||||
scDoc.ChangeState(SCE_CLW_BUILTIN_PROCEDURES_FUNCTION);
|
||||
}
|
||||
// Else if statement string is in the tructures and data types keyword list
|
||||
else if (wlStructsDataTypes.InList(cStatement)) {
|
||||
// Set to the structures and data types state
|
||||
scDoc.ChangeState(SCE_CLW_STRUCTURE_DATA_TYPE);
|
||||
}
|
||||
// Else if statement string is in the procedure attribute keyword list
|
||||
else if (wlAttributes.InList(cStatement)) {
|
||||
// Set to the procedure attribute state
|
||||
scDoc.ChangeState(SCE_CLW_ATTRIBUTE);
|
||||
}
|
||||
// Else if statement string is in the standard equate keyword list
|
||||
else if (wlStandardEquates.InList(cStatement)) {
|
||||
// Set to the standard equate state
|
||||
scDoc.ChangeState(SCE_CLW_STANDARD_EQUATE);
|
||||
}
|
||||
// Terminate the keyword state and set to default state
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
}
|
||||
}
|
||||
// String State Handling
|
||||
else if (scDoc.state == SCE_CLW_STRING) {
|
||||
// If the character is an ' (single quote)
|
||||
if (scDoc.ch == '\'') {
|
||||
// Set the state to default and move forward colouring
|
||||
// the ' (single quote) as default state
|
||||
// terminating the string state
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
scDoc.Forward();
|
||||
}
|
||||
// If the next character is an ' (single quote)
|
||||
if (scDoc.chNext == '\'') {
|
||||
// Move forward one character and set to default state
|
||||
// colouring the next ' (single quote) as default state
|
||||
// terminating the string state
|
||||
scDoc.ForwardSetState(SCE_CLW_DEFAULT);
|
||||
scDoc.Forward();
|
||||
}
|
||||
}
|
||||
// Picture String State Handling
|
||||
else if (scDoc.state == SCE_CLW_PICTURE_STRING) {
|
||||
// If the character is an ( (open parenthese)
|
||||
if (scDoc.ch == '(') {
|
||||
// Increment the parenthese level
|
||||
iParenthesesLevel++;
|
||||
}
|
||||
// Else if the character is a ) (close parenthese)
|
||||
else if (scDoc.ch == ')') {
|
||||
// If the parenthese level is set to zero
|
||||
// parentheses matched
|
||||
if (!iParenthesesLevel) {
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
}
|
||||
// Else parenthese level is greater than zero
|
||||
// still looking for matching parentheses
|
||||
else {
|
||||
// Decrement the parenthese level
|
||||
iParenthesesLevel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
// Standard Equate State Handling
|
||||
else if (scDoc.state == SCE_CLW_STANDARD_EQUATE) {
|
||||
if (!isalnum(scDoc.ch)) {
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
}
|
||||
}
|
||||
// Integer Constant State Handling
|
||||
else if (scDoc.state == SCE_CLW_INTEGER_CONSTANT) {
|
||||
// If the character is not a digit (0-9)
|
||||
// or character is not a hexidecimal character (A-F)
|
||||
// or character is not a . (point)
|
||||
// or character is not a numberic base character (B,O,H)
|
||||
if (!(isdigit(scDoc.ch)
|
||||
|| IsAHexCharacter(scDoc.ch, bCaseSensitive)
|
||||
|| scDoc.ch == '.'
|
||||
|| IsANumericBaseCharacter(scDoc.ch, bCaseSensitive))) {
|
||||
// If the number was a real
|
||||
if (SetNumericConstantState(scDoc)) {
|
||||
// Colour the matched string to the real constant state
|
||||
scDoc.ChangeState(SCE_CLW_REAL_CONSTANT);
|
||||
}
|
||||
// Else the number was an integer
|
||||
else {
|
||||
// Colour the matched string to an integer constant state
|
||||
scDoc.ChangeState(SCE_CLW_INTEGER_CONSTANT);
|
||||
}
|
||||
// Terminate the integer constant state and set to default state
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Determine if a new state should be entered.
|
||||
//
|
||||
|
||||
// Beginning of Line Handling
|
||||
if (scDoc.atLineStart) {
|
||||
// If column 1 character is a label start character
|
||||
if (IsALabelStart(scDoc.ch)) {
|
||||
// Set the state to label
|
||||
scDoc.SetState(SCE_CLW_LABEL);
|
||||
}
|
||||
// else if character is a space or tab
|
||||
else if (IsASpace(scDoc.ch)){
|
||||
// Set to default state
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
}
|
||||
// else if the start of a comment or is an * (asterisk)
|
||||
else if (IsACommentStart(scDoc) || scDoc.ch == '*' ) {
|
||||
// then set the state to comment.
|
||||
scDoc.SetState(SCE_CLW_COMMENT);
|
||||
}
|
||||
// else the character is a ? (question mark)
|
||||
else if (scDoc.ch == '?') {
|
||||
// Change to the compiler directive state, move forward,
|
||||
// colouring the ? (question mark), change back to default state.
|
||||
scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE);
|
||||
scDoc.Forward();
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
}
|
||||
// else an invalid character in column 1
|
||||
else {
|
||||
// Set to error state
|
||||
scDoc.SetState(SCE_CLW_ERROR);
|
||||
}
|
||||
}
|
||||
// End of Line Handling
|
||||
else if (scDoc.atLineEnd) {
|
||||
// Reset to the default state at the end of each line.
|
||||
scDoc.SetState(SCE_CLW_DEFAULT);
|
||||
}
|
||||
// Default Handling
|
||||
else {
|
||||
// If in default state
|
||||
if (scDoc.state == SCE_CLW_DEFAULT) {
|
||||
// If is a letter could be a possible statement
|
||||
if (isalpha(scDoc.ch)) {
|
||||
// Set the state to Clarion Keyword and verify later
|
||||
scDoc.SetState(SCE_CLW_KEYWORD);
|
||||
}
|
||||
// else is a number
|
||||
else if (isdigit(scDoc.ch)) {
|
||||
// Set the state to Integer Constant and verify later
|
||||
scDoc.SetState(SCE_CLW_INTEGER_CONSTANT);
|
||||
}
|
||||
// else if the start of a comment or a | (line continuation)
|
||||
else if (IsACommentStart(scDoc) || scDoc.ch == '|') {
|
||||
// then set the state to comment.
|
||||
scDoc.SetState(SCE_CLW_COMMENT);
|
||||
}
|
||||
// else if the character is a ' (single quote)
|
||||
else if (scDoc.ch == '\'') {
|
||||
// If the character is also a ' (single quote)
|
||||
// Embedded Apostrophe
|
||||
if (scDoc.chNext == '\'') {
|
||||
// Move forward colouring it as default state
|
||||
scDoc.ForwardSetState(SCE_CLW_DEFAULT);
|
||||
}
|
||||
else {
|
||||
// move to the next character and then set the state to comment.
|
||||
scDoc.ForwardSetState(SCE_CLW_STRING);
|
||||
}
|
||||
}
|
||||
// else the character is an @ (apersand)
|
||||
else if (scDoc.ch == '@') {
|
||||
// Case insensitive.
|
||||
if (!bCaseSensitive) {
|
||||
// If character is a valid picture token character
|
||||
if (strchr("DEKNPSTdeknpst", scDoc.chNext) != NULL) {
|
||||
// Set to the picture string state
|
||||
scDoc.SetState(SCE_CLW_PICTURE_STRING);
|
||||
}
|
||||
}
|
||||
// Case sensitive
|
||||
else {
|
||||
// If character is a valid picture token character
|
||||
if (strchr("DEKNPST", scDoc.chNext) != NULL) {
|
||||
// Set the picture string state
|
||||
scDoc.SetState(SCE_CLW_PICTURE_STRING);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// lexing complete
|
||||
scDoc.Complete();
|
||||
}
|
||||
|
||||
// Clarion Language Case Sensitive Colouring Procedure
|
||||
static void ColouriseClwDocSensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
|
||||
ColouriseClwDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, true);
|
||||
}
|
||||
|
||||
// Clarion Language Case Insensitive Colouring Procedure
|
||||
static void ColouriseClwDocInsensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
|
||||
ColouriseClwDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, false);
|
||||
}
|
||||
|
||||
// Clarion Language Folding Procedure
|
||||
#ifdef FOLDING_IMPLEMENTED
|
||||
static void FoldClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
|
||||
|
||||
}
|
||||
#endif
|
||||
|
||||
// Word List Descriptions
|
||||
static const char * const rgWordListDescriptions[] = {
|
||||
"Clarion Keywords",
|
||||
"Compiler Directives",
|
||||
"Built-in Procedures and Functions",
|
||||
"Structure and Data Types",
|
||||
"Attributes",
|
||||
"Standard Equates",
|
||||
"Reserved Words",
|
||||
0,
|
||||
};
|
||||
|
||||
// Case Sensitive Clarion Language Lexer
|
||||
LexerModule lmClw(SCLEX_CLW, ColouriseClwDocSensitive, "clw", NULL, rgWordListDescriptions);
|
||||
|
||||
// Case Insensitive Clarion Language Lexer
|
||||
LexerModule lmClwNoCase(SCLEX_CLWNOCASE, ColouriseClwDocInsensitive, "clwnocase", NULL, rgWordListDescriptions);
|
522
contrib/src/stc/scintilla/src/LexErlang.cxx
Normal file
522
contrib/src/stc/scintilla/src/LexErlang.cxx
Normal file
@@ -0,0 +1,522 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexErlang.cxx
|
||||
** Lexer for Erlang.
|
||||
** Written by Peter-Henry Mander, based on Matlab lexer by Jos<6F> Fonseca
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <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"
|
||||
|
||||
/*
|
||||
TODO:
|
||||
o _Param should be a new lexical type
|
||||
*/
|
||||
|
||||
static int is_radix(int radix, int ch) {
|
||||
int digit;
|
||||
if ( 16 < radix || 2 > radix ) {
|
||||
return 0;
|
||||
}
|
||||
if ( isdigit(ch) ) {
|
||||
digit = ch - '0';
|
||||
} else if ( isxdigit(ch) ) {
|
||||
digit = toupper(ch) - 'A' + 10;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
if ( digit < radix ) {
|
||||
return 1;
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
typedef enum {
|
||||
STATE_NULL,
|
||||
ATOM_UNQUOTED,
|
||||
ATOM_QUOTED,
|
||||
ATOM_FUN_NAME,
|
||||
NODE_NAME_UNQUOTED,
|
||||
NODE_NAME_QUOTED,
|
||||
MACRO_START,
|
||||
MACRO_UNQUOTED,
|
||||
MACRO_QUOTED,
|
||||
RECORD_START,
|
||||
RECORD_UNQUOTED,
|
||||
RECORD_QUOTED,
|
||||
NUMERAL_START,
|
||||
NUMERAL_SIGNED,
|
||||
NUMERAL_RADIX_LITERAL,
|
||||
NUMERAL_SPECULATIVE_MANTISSA,
|
||||
NUMERAL_FLOAT_MANTISSA,
|
||||
NUMERAL_FLOAT_EXPONENT,
|
||||
NUMERAL_FLOAT_SIGNED_EXPONENT,
|
||||
PARSE_ERROR
|
||||
} atom_parse_state_t;
|
||||
|
||||
static void ColouriseErlangDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
atom_parse_state_t parse_state = STATE_NULL;
|
||||
int radix_digits = 0;
|
||||
int exponent_digits = 0;
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
if ( STATE_NULL != parse_state ) {
|
||||
switch (parse_state) {
|
||||
case STATE_NULL:
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
break;
|
||||
case ATOM_UNQUOTED:
|
||||
if ( '@' == sc.ch ){
|
||||
parse_state = NODE_NAME_UNQUOTED;
|
||||
} else if ( !isalnum(sc.ch) && sc.ch != '_' ) {
|
||||
char s[100];
|
||||
sc.GetCurrent(s, sizeof(s));
|
||||
if (keywords.InList(s)) {
|
||||
sc.ChangeState(SCE_ERLANG_KEYWORD);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
} else {
|
||||
if ( '/' == sc.ch ) {
|
||||
parse_state = ATOM_FUN_NAME;
|
||||
} else {
|
||||
sc.ChangeState(SCE_ERLANG_ATOM);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
case ATOM_QUOTED:
|
||||
if ( '@' == sc.ch ){
|
||||
parse_state = NODE_NAME_QUOTED;
|
||||
} else if ( '\'' == sc.ch && '\\' != sc.chPrev ) {
|
||||
sc.ChangeState(SCE_ERLANG_ATOM);
|
||||
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case ATOM_FUN_NAME:
|
||||
if ( !isdigit(sc.ch) ) {
|
||||
sc.ChangeState(SCE_ERLANG_FUNCTION_NAME);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case NODE_NAME_QUOTED:
|
||||
if ( '@' == sc.ch ) {
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
} else if ( '\'' == sc.ch && '\\' != sc.chPrev ) {
|
||||
sc.ChangeState(SCE_ERLANG_NODE_NAME);
|
||||
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case NODE_NAME_UNQUOTED:
|
||||
if ( '@' == sc.ch ) {
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
} else if ( !isalnum(sc.ch) && sc.ch != '_' ) {
|
||||
sc.ChangeState(SCE_ERLANG_NODE_NAME);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case RECORD_START:
|
||||
if ( '\'' == sc.ch ) {
|
||||
parse_state = RECORD_QUOTED;
|
||||
} else if (isalpha(sc.ch) && islower(sc.ch)) {
|
||||
parse_state = RECORD_UNQUOTED;
|
||||
} else { // error
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case RECORD_QUOTED:
|
||||
if ( '\'' == sc.ch && '\\' != sc.chPrev ) {
|
||||
sc.ChangeState(SCE_ERLANG_RECORD);
|
||||
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case RECORD_UNQUOTED:
|
||||
if ( !isalpha(sc.ch) && '_' != sc.ch ) {
|
||||
sc.ChangeState(SCE_ERLANG_RECORD);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case MACRO_START:
|
||||
if ( '\'' == sc.ch ) {
|
||||
parse_state = MACRO_QUOTED;
|
||||
} else if (isalpha(sc.ch)) {
|
||||
parse_state = MACRO_UNQUOTED;
|
||||
} else { // error
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case MACRO_UNQUOTED:
|
||||
if ( !isalpha(sc.ch) && '_' != sc.ch ) {
|
||||
sc.ChangeState(SCE_ERLANG_MACRO);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case MACRO_QUOTED:
|
||||
if ( '\'' == sc.ch && '\\' != sc.chPrev ) {
|
||||
sc.ChangeState(SCE_ERLANG_MACRO);
|
||||
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case NUMERAL_START:
|
||||
if ( isdigit(sc.ch) ) {
|
||||
radix_digits *= 10;
|
||||
radix_digits += sc.ch - '0'; // Assuming ASCII here!
|
||||
} else if ( '#' == sc.ch ) {
|
||||
if ( 2 > radix_digits || 16 < radix_digits) {
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
} else {
|
||||
parse_state = NUMERAL_RADIX_LITERAL;
|
||||
}
|
||||
} else if ( '.' == sc.ch && isdigit(sc.chNext)) {
|
||||
radix_digits = 0;
|
||||
parse_state = NUMERAL_FLOAT_MANTISSA;
|
||||
} else if ( 'e' == sc.ch || 'E' == sc.ch ) {
|
||||
exponent_digits = 0;
|
||||
parse_state = NUMERAL_FLOAT_EXPONENT;
|
||||
} else {
|
||||
radix_digits = 0;
|
||||
sc.ChangeState(SCE_ERLANG_NUMBER);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case NUMERAL_RADIX_LITERAL:
|
||||
if ( !is_radix(radix_digits,sc.ch) ) {
|
||||
radix_digits = 0;
|
||||
if ( !isalnum(sc.ch) ) {
|
||||
sc.ChangeState(SCE_ERLANG_NUMBER);
|
||||
}
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case NUMERAL_FLOAT_MANTISSA:
|
||||
if ( 'e' == sc.ch || 'E' == sc.ch ) {
|
||||
exponent_digits = 0;
|
||||
parse_state = NUMERAL_FLOAT_EXPONENT;
|
||||
} else if ( !isdigit(sc.ch) ) {
|
||||
sc.ChangeState(SCE_ERLANG_NUMBER);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
}
|
||||
break;
|
||||
case NUMERAL_FLOAT_EXPONENT:
|
||||
if ( '-' == sc.ch || '+' == sc.ch ) {
|
||||
parse_state = NUMERAL_FLOAT_SIGNED_EXPONENT;
|
||||
} else if ( !isdigit(sc.ch) ) {
|
||||
if ( 0 < exponent_digits ) {
|
||||
sc.ChangeState(SCE_ERLANG_NUMBER);
|
||||
}
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
} else {
|
||||
++exponent_digits;
|
||||
}
|
||||
break;
|
||||
case NUMERAL_FLOAT_SIGNED_EXPONENT:
|
||||
if ( !isdigit(sc.ch) ) {
|
||||
if ( 0 < exponent_digits ) {
|
||||
sc.ChangeState(SCE_ERLANG_NUMBER);
|
||||
}
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
} else {
|
||||
++exponent_digits;
|
||||
}
|
||||
break;
|
||||
case NUMERAL_SIGNED:
|
||||
if ( !isdigit(sc.ch) ) {
|
||||
sc.ChangeState(SCE_ERLANG_NUMBER);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
} else if ( '.' == sc.ch ) {
|
||||
parse_state = NUMERAL_FLOAT_MANTISSA;
|
||||
}
|
||||
break;
|
||||
case NUMERAL_SPECULATIVE_MANTISSA:
|
||||
if ( !isdigit(sc.ch) ) {
|
||||
sc.ChangeState(SCE_ERLANG_OPERATOR);
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
} else {
|
||||
parse_state = NUMERAL_FLOAT_MANTISSA;
|
||||
}
|
||||
break;
|
||||
case PARSE_ERROR:
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
parse_state = STATE_NULL;
|
||||
break;
|
||||
}
|
||||
} else if (sc.state == SCE_ERLANG_OPERATOR) {
|
||||
if (sc.chPrev == '.') {
|
||||
if (sc.ch == '*' || sc.ch == '/' || sc.ch == '\\' || sc.ch == '^') {
|
||||
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
|
||||
} else if (sc.ch == '\'') {
|
||||
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
|
||||
} else {
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
}
|
||||
} else {
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_ERLANG_VARIABLE) {
|
||||
if (!isalnum(sc.ch) && sc.ch != '_') {
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_ERLANG_STRING) {
|
||||
if (sc.ch == '\"' && sc.chPrev != '\\') {
|
||||
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_ERLANG_COMMENT ) {
|
||||
if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_ERLANG_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_ERLANG_CHARACTER ) {
|
||||
if ( sc.chPrev == '\\' ) {
|
||||
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
|
||||
} else if ( sc.ch != '\\' ) {
|
||||
sc.ForwardSetState(SCE_ERLANG_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
if (sc.state == SCE_ERLANG_DEFAULT) {
|
||||
if (sc.ch == '%') {
|
||||
sc.SetState(SCE_ERLANG_COMMENT);
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.SetState(SCE_ERLANG_STRING);
|
||||
} else if (sc.ch == '#') {
|
||||
parse_state = RECORD_START;
|
||||
sc.SetState(SCE_ERLANG_UNKNOWN);
|
||||
} else if (sc.ch == '?') {
|
||||
parse_state = MACRO_START;
|
||||
sc.SetState(SCE_ERLANG_UNKNOWN);
|
||||
} else if (sc.ch == '$') {
|
||||
sc.SetState(SCE_ERLANG_CHARACTER);
|
||||
} else if (sc.ch == '\'') {
|
||||
parse_state = ATOM_QUOTED;
|
||||
sc.SetState(SCE_ERLANG_UNKNOWN);
|
||||
} else if ( isdigit(sc.ch) ) {
|
||||
parse_state = NUMERAL_START;
|
||||
radix_digits = sc.ch - '0';
|
||||
sc.SetState(SCE_ERLANG_UNKNOWN);
|
||||
} else if ( '.' == sc.ch ) {
|
||||
parse_state = NUMERAL_SPECULATIVE_MANTISSA;
|
||||
sc.SetState(SCE_ERLANG_UNKNOWN);
|
||||
} else if (isalpha(sc.ch) && isupper(sc.ch)) {
|
||||
sc.SetState(SCE_ERLANG_VARIABLE);
|
||||
} else if (isalpha(sc.ch)) {
|
||||
parse_state = ATOM_UNQUOTED;
|
||||
sc.SetState(SCE_ERLANG_UNKNOWN);
|
||||
} else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '\\') {
|
||||
sc.SetState(SCE_ERLANG_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static int ClassifyFoldPointErlang(
|
||||
Accessor &styler,
|
||||
int styleNext,
|
||||
int keyword_start
|
||||
) {
|
||||
int lev = 0;
|
||||
if ( styler.Match(keyword_start,"case")
|
||||
|| (
|
||||
styler.Match(keyword_start,"fun")
|
||||
&& SCE_ERLANG_FUNCTION_NAME != styleNext)
|
||||
|| styler.Match(keyword_start,"if")
|
||||
|| styler.Match(keyword_start,"query")
|
||||
|| styler.Match(keyword_start,"receive")
|
||||
) {
|
||||
++lev;
|
||||
} else if ( styler.Match(keyword_start,"end") ) {
|
||||
--lev;
|
||||
}
|
||||
return lev;
|
||||
}
|
||||
|
||||
|
||||
static void FoldErlangDoc(
|
||||
unsigned int startPos, int length, int initStyle,
|
||||
WordList** /*keywordlists*/, Accessor &styler
|
||||
) {
|
||||
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.SafeGetCharAt(startPos);
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
int keyword_start = 0;
|
||||
|
||||
bool fold_keywords = true;
|
||||
bool fold_comments = true;
|
||||
bool fold_braces = true;
|
||||
bool fold_function_clauses = false;
|
||||
bool fold_clauses = false;
|
||||
|
||||
//int clause_level = 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_ERLANG_KEYWORD) && (style == SCE_ERLANG_KEYWORD) ) {
|
||||
keyword_start = i;
|
||||
}
|
||||
if ( fold_keywords ) {
|
||||
if ( (stylePrev == SCE_ERLANG_KEYWORD)
|
||||
&& (style != SCE_ERLANG_KEYWORD)
|
||||
&& (style != SCE_ERLANG_ATOM)
|
||||
) {
|
||||
levelCurrent += ClassifyFoldPointErlang(styler,styleNext,keyword_start);
|
||||
}
|
||||
}
|
||||
|
||||
if ( fold_comments ) {
|
||||
if (style == SCE_ERLANG_COMMENT) {
|
||||
if ((ch == '%') && (chNext == '{')) {
|
||||
levelCurrent++;
|
||||
} else if ((ch == '%') && (chNext == '}')) {
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if ( fold_function_clauses ) {
|
||||
if ( (SC_FOLDLEVELBASE == levelCurrent) /*&& (style == SCE_ERLANG_OPERATOR)*/ ) {
|
||||
if ( (ch == '-') && (chNext == '>')) {
|
||||
//~ fprintf(stderr,"levelCurrent=%d\n", levelCurrent);
|
||||
//++clause_level;
|
||||
//~ if ( 0 < clause_level )
|
||||
++levelCurrent;
|
||||
}
|
||||
}
|
||||
//~ if ( (stylePrev != SCE_ERLANG_RECORD)
|
||||
//~ && (style != SCE_ERLANG_NUMBER)
|
||||
//~ && (style != SCE_ERLANG_STRING)
|
||||
//~ && (style != SCE_ERLANG_COMMENT)
|
||||
//~ ) {
|
||||
if ( (SC_FOLDLEVELBASE+1 == levelCurrent) && (ch == '.') ) {
|
||||
//--clause_level;
|
||||
//~ if ( 0 == clause_level )
|
||||
--levelCurrent;
|
||||
}
|
||||
//~ }
|
||||
}
|
||||
|
||||
if ( fold_clauses ) {
|
||||
if ( (0 < levelCurrent) && (style == SCE_ERLANG_OPERATOR) ) {
|
||||
if ((ch == '-') && (chNext == '>')) {
|
||||
levelCurrent++;
|
||||
}
|
||||
if ( (ch == ';') ) {
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
if ( (stylePrev != SCE_ERLANG_RECORD)
|
||||
&& (style != SCE_ERLANG_NUMBER)
|
||||
&& (style != SCE_ERLANG_STRING)
|
||||
&& (style != SCE_ERLANG_COMMENT)
|
||||
) {
|
||||
if ( (ch == '.') ) {
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
if ( (stylePrev == SCE_ERLANG_KEYWORD)
|
||||
&& (style != SCE_ERLANG_KEYWORD)
|
||||
&& (style != SCE_ERLANG_ATOM)
|
||||
&& (
|
||||
styler.Match(keyword_start,"end") // 'end' counted twice if fold_keywords too
|
||||
|| styler.Match(keyword_start,"after") )
|
||||
) {
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
|
||||
if ( fold_braces ) {
|
||||
if (style == SCE_ERLANG_OPERATOR) {
|
||||
if ( (ch == '{') || (ch == '(') || (ch == '[') ) {
|
||||
levelCurrent++;
|
||||
} else if ( (ch == '}') || (ch == ')') || (ch == ']') ) {
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (atEOL) {
|
||||
int lev = levelPrev;
|
||||
//~ if (visibleChars == 0 && foldCompact)
|
||||
//~ lev |= SC_FOLDLEVELWHITEFLAG;
|
||||
//~ if ((levelCurrent > levelPrev) && (visibleChars > 0))
|
||||
if ((levelCurrent > levelPrev)) {
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
if (lev != styler.LevelAt(lineCurrent)) {
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
}
|
||||
lineCurrent++;
|
||||
levelPrev = levelCurrent;
|
||||
//~ visibleChars = 0;
|
||||
}
|
||||
//~ if (!isspacechar(ch))
|
||||
//~ visibleChars++;
|
||||
|
||||
}
|
||||
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
|
||||
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
|
||||
}
|
||||
|
||||
static const char * const erlangWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmErlang(
|
||||
SCLEX_ERLANG,
|
||||
ColouriseErlangDoc,
|
||||
"erlang",
|
||||
FoldErlangDoc,
|
||||
erlangWordListDesc);
|
||||
|
348
contrib/src/stc/scintilla/src/LexForth.cxx
Normal file
348
contrib/src/stc/scintilla/src/LexForth.cxx
Normal file
@@ -0,0 +1,348 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexCrontab.cxx
|
||||
** Lexer to use with extended crontab files used by a powerful
|
||||
** Windows scheduler/event monitor/automation manager nnCron.
|
||||
** (http://nemtsev.eserv.ru/)
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <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"
|
||||
|
||||
bool is_whitespace(int ch){
|
||||
return ch == '\n' || ch == '\r' || ch == '\t' || ch == ' ';
|
||||
}
|
||||
|
||||
bool is_blank(int ch){
|
||||
return ch == '\t' || 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(){
|
||||
char ch=st->SafeGetCharAt(cur_pos);
|
||||
return ch;
|
||||
}
|
||||
bool is_eol(char ch){
|
||||
return ch=='\n' || ch=='\r';
|
||||
}
|
||||
|
||||
int parse(char ch, bool skip_eol){
|
||||
// pos1 - start pos of word
|
||||
// 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){
|
||||
for(;*s;s++){
|
||||
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 &keyword = *keywordLists[1];
|
||||
WordList &defword = *keywordLists[2];
|
||||
WordList &preword1 = *keywordLists[3];
|
||||
WordList &preword2 = *keywordLists[4];
|
||||
WordList &strings = *keywordLists[5];
|
||||
|
||||
// go through all provided text segment
|
||||
// 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)) {
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
i++;
|
||||
continue;
|
||||
}
|
||||
#ifdef FORTH_DEBUG
|
||||
fprintf(f_debug,"%c %d ",ch,state);
|
||||
#endif
|
||||
switch(state) {
|
||||
case SCE_FORTH_DEFAULT:
|
||||
if(is_whitespace(ch)) {
|
||||
// whitespace is simply ignored here...
|
||||
styler.ColourTo(i,SCE_FORTH_DEFAULT);
|
||||
break;
|
||||
} else if( ch == '\\' && is_blank(chNext)) {
|
||||
// signals the start of an one line comment...
|
||||
state = SCE_FORTH_COMMENT;
|
||||
styler.ColourTo(i,SCE_FORTH_COMMENT);
|
||||
} else if( is_whitespace(chPrev) && ch == '(' && is_whitespace(chNext)) {
|
||||
// signals the start of a plain comment...
|
||||
state = SCE_FORTH_COMMENT_ML;
|
||||
styler.ColourTo(i,SCE_FORTH_COMMENT_ML);
|
||||
} else if( isdigit(ch) ) {
|
||||
// signals the start of a number
|
||||
bufferCount = 0;
|
||||
buffer[bufferCount++] = ch;
|
||||
state = SCE_FORTH_NUMBER;
|
||||
} else if( !is_whitespace(ch)) {
|
||||
// signals the start of an identifier
|
||||
bufferCount = 0;
|
||||
buffer[bufferCount++] = ch;
|
||||
state = SCE_FORTH_IDENTIFIER;
|
||||
} else {
|
||||
// style it the default style..
|
||||
styler.ColourTo(i,SCE_FORTH_DEFAULT);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCE_FORTH_COMMENT:
|
||||
// if we find a newline here,
|
||||
// we simply go to default state
|
||||
// else continue to work on it...
|
||||
if( ch == '\n' || ch == '\r' ) {
|
||||
state = SCE_FORTH_DEFAULT;
|
||||
} else {
|
||||
styler.ColourTo(i,SCE_FORTH_COMMENT);
|
||||
}
|
||||
break;
|
||||
|
||||
case SCE_FORTH_COMMENT_ML:
|
||||
if( ch == ')') {
|
||||
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 *[],
|
||||
Accessor &) {
|
||||
}
|
||||
|
||||
static const char * const forthWordLists[] = {
|
||||
"control keywords",
|
||||
"keywords",
|
||||
"definition words",
|
||||
"prewords with one argument",
|
||||
"prewords with two arguments",
|
||||
"string definition keywords",
|
||||
0,
|
||||
};
|
||||
|
||||
LexerModule lmForth(SCLEX_FORTH, ColouriseForthDoc, "forth",FoldForthDoc,forthWordLists);
|
@@ -1,51 +1,63 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexFortran.cxx
|
||||
** Lexer for Fortran.
|
||||
** Writen by Chuan-jian Shen, Last changed Nov. 2002
|
||||
** Writen by Chuan-jian Shen, Last changed Sep. 2003
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
/***************************************/
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <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"
|
||||
|
||||
/***********************************************/
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%');
|
||||
}
|
||||
|
||||
/**********************************************/
|
||||
static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch));
|
||||
}
|
||||
|
||||
/***************************************/
|
||||
inline bool IsABlank(unsigned int ch) {
|
||||
return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ;
|
||||
}
|
||||
static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler, bool isFixFormat) {
|
||||
|
||||
/***************************************/
|
||||
inline bool IsALineEnd(char ch) {
|
||||
return ((ch == '\n') || (ch == '\r')) ;
|
||||
}
|
||||
/***************************************/
|
||||
unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
|
||||
while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue;
|
||||
if (styler.SafeGetCharAt(pos) == '\n') pos++;
|
||||
while (IsABlank(styler.SafeGetCharAt(pos++))) continue;
|
||||
char chCur = styler.SafeGetCharAt(pos);
|
||||
if (chCur == '&') {
|
||||
while (IsABlank(styler.SafeGetCharAt(++pos))) continue;
|
||||
return pos;
|
||||
} else {
|
||||
return pos;
|
||||
}
|
||||
}
|
||||
/***************************************/
|
||||
static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler, bool isFixFormat) {
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
WordList &keywords3 = *keywordlists[2];
|
||||
|
||||
int posLineStart = 0, prevState = 0;
|
||||
/***************************************/
|
||||
int posLineStart = 0, numNonBlank = 0, prevState = 0;
|
||||
int endPos = startPos + length;
|
||||
|
||||
// backtrack to the beginning of the document, this may be slow for big documents.
|
||||
// initStyle = SCE_F_DEFAULT;
|
||||
// StyleContext sc(0, startPos+length, initStyle, styler);
|
||||
|
||||
/***************************************/
|
||||
// backtrack to the nearest keyword
|
||||
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_F_WORD)) {
|
||||
startPos--;
|
||||
@@ -53,22 +65,47 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
startPos = styler.LineStart(styler.GetLine(startPos));
|
||||
initStyle = styler.StyleAt(startPos - 1);
|
||||
StyleContext sc(startPos, endPos-startPos, initStyle, styler);
|
||||
|
||||
/***************************************/
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
|
||||
// remember the position of the line
|
||||
// remember the start position of the line
|
||||
if (sc.atLineStart) {
|
||||
posLineStart = sc.currentPos;
|
||||
numNonBlank = 0;
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
}
|
||||
|
||||
if (!IsASpaceOrTab(sc.ch)) numNonBlank ++;
|
||||
/***********************************************/
|
||||
// Handle the fix format generically
|
||||
int toLineStart = sc.currentPos - posLineStart;
|
||||
if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) {
|
||||
if (toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*') || sc.ch == '!') {
|
||||
sc.SetState(SCE_F_COMMENT);
|
||||
while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end
|
||||
} else if (toLineStart > 72) {
|
||||
sc.SetState(SCE_F_COMMENT);
|
||||
while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end
|
||||
} else if (toLineStart < 5) {
|
||||
if (IsADigit(sc.ch))
|
||||
sc.SetState(SCE_F_LABEL);
|
||||
else
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
} else if (toLineStart == 5) {
|
||||
if (!IsASpace(sc.ch) && sc.ch != '0') {
|
||||
sc.SetState(SCE_F_CONTINUATION);
|
||||
sc.ForwardSetState(prevState);
|
||||
} else
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
/***************************************/
|
||||
// Handle line continuation generically.
|
||||
if (sc.ch == '&') {
|
||||
if (!isFixFormat && sc.ch == '&') {
|
||||
char chTemp = ' ';
|
||||
int j = 1;
|
||||
while (IsABlank(chTemp) && j<132) {
|
||||
chTemp = static_cast<char>(sc.GetRelative(j));
|
||||
j ++;
|
||||
j++;
|
||||
}
|
||||
if (chTemp == '!') {
|
||||
sc.SetState(SCE_F_CONTINUATION);
|
||||
@@ -76,24 +113,21 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
} else if (chTemp == '\r' || chTemp == '\n') {
|
||||
int currentState = sc.state;
|
||||
sc.SetState(SCE_F_CONTINUATION);
|
||||
if (currentState == SCE_F_STRING1 || currentState == SCE_F_STRING2) {
|
||||
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||
while (IsASpace(sc.ch) && sc.More()) sc.Forward();
|
||||
if (sc.ch == '&') {
|
||||
sc.SetState(SCE_F_CONTINUATION);
|
||||
sc.Forward();
|
||||
}
|
||||
sc.SetState(currentState);
|
||||
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||
while (IsASpace(sc.ch) && sc.More()) sc.Forward();
|
||||
if (sc.ch == '&') {
|
||||
sc.SetState(SCE_F_CONTINUATION);
|
||||
sc.Forward();
|
||||
}
|
||||
sc.SetState(currentState);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
/***************************************/
|
||||
// Determine if the current state should terminate.
|
||||
if (sc.state == SCE_F_OPERATOR) {
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
} else if (sc.state == SCE_F_NUMBER) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
if (!(IsAWordChar(sc.ch) || sc.ch=='\'' || sc.ch=='\"' || sc.ch=='.')) {
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_F_IDENTIFIER) {
|
||||
@@ -109,7 +143,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
}
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_F_COMMENT) {
|
||||
} else if (sc.state == SCE_F_COMMENT || sc.state == SCE_F_PREPROCESSOR) {
|
||||
if (sc.ch == '\r' || sc.ch == '\n') {
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
}
|
||||
@@ -123,24 +157,14 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
prevState = SCE_F_DEFAULT;
|
||||
}
|
||||
} else if (sc.atLineEnd) {
|
||||
if (isFixFormat) {
|
||||
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||
posLineStart = sc.currentPos;
|
||||
} else {
|
||||
sc.ChangeState(SCE_F_STRINGEOL);
|
||||
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||
}
|
||||
sc.ChangeState(SCE_F_STRINGEOL);
|
||||
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_F_STRING2) {
|
||||
prevState = sc.state;
|
||||
if (sc.atLineEnd) {
|
||||
if (isFixFormat) {
|
||||
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||
posLineStart = sc.currentPos;
|
||||
} else {
|
||||
sc.ChangeState(SCE_F_STRINGEOL);
|
||||
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||
}
|
||||
sc.ChangeState(SCE_F_STRINGEOL);
|
||||
sc.ForwardSetState(SCE_F_DEFAULT);
|
||||
} else if (sc.ch == '\"') {
|
||||
if (sc.chNext == '\"') {
|
||||
sc.Forward();
|
||||
@@ -156,33 +180,36 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
} else if (sc.state == SCE_F_CONTINUATION) {
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
} else if (sc.state == SCE_F_LABEL) {
|
||||
if (sc.currentPos >= static_cast<unsigned int>(posLineStart+5)) {
|
||||
if (!IsADigit(sc.ch)) {
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
} else {
|
||||
if (isFixFormat && sc.currentPos-posLineStart > 4)
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
else if (numNonBlank > 5)
|
||||
sc.SetState(SCE_F_DEFAULT);
|
||||
}
|
||||
}
|
||||
|
||||
/***************************************/
|
||||
// Determine if a new state should be entered.
|
||||
if (sc.state == SCE_F_DEFAULT) {
|
||||
int toLineStart = sc.currentPos - posLineStart;
|
||||
if (isFixFormat && (toLineStart < 6 || toLineStart > 72)) {
|
||||
if (sc.atLineStart && (tolower(sc.ch) == 'c' || sc.ch == '*') || sc.ch == '!') {
|
||||
if (sc.ch == '!') {
|
||||
if (sc.chNext == '$') {
|
||||
sc.SetState(SCE_F_PREPROCESSOR);
|
||||
} else {
|
||||
sc.SetState(SCE_F_COMMENT);
|
||||
} else if (toLineStart > 72) {
|
||||
sc.SetState(SCE_F_COMMENT);
|
||||
} else if (toLineStart < 5 && !IsASpace(sc.ch)) {
|
||||
sc.SetState(SCE_F_LABEL);
|
||||
} else if (toLineStart == 5 && (!IsASpace(sc.ch) && sc.ch != '0')) {
|
||||
sc.SetState(SCE_F_CONTINUATION);
|
||||
sc.ForwardSetState(prevState);
|
||||
}
|
||||
} else if ((!isFixFormat) && IsADigit(sc.ch) && numNonBlank == 1) {
|
||||
sc.SetState(SCE_F_LABEL);
|
||||
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
sc.SetState(SCE_F_NUMBER);
|
||||
} else if ((tolower(sc.ch) == 'b' || tolower(sc.ch) == 'o' ||
|
||||
tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) {
|
||||
sc.SetState(SCE_F_NUMBER);
|
||||
sc.Forward();
|
||||
} else if (sc.ch == '.' && isalpha(sc.chNext)) {
|
||||
sc.SetState(SCE_F_OPERATOR2);
|
||||
} else if (IsAWordStart(sc.ch)) {
|
||||
sc.SetState(SCE_F_IDENTIFIER);
|
||||
} else if (sc.ch == '!') {
|
||||
sc.SetState(SCE_F_COMMENT);
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.SetState(SCE_F_STRING2);
|
||||
} else if (sc.ch == '\'') {
|
||||
@@ -194,37 +221,46 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
|
||||
}
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
// The folding depends on the mercy of the programer.
|
||||
static int classifyFoldPointFortran(const char* s, const char* prevWord) {
|
||||
/***************************************/
|
||||
// To determine the folding level depending on keywords
|
||||
static int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) {
|
||||
int lev = 0;
|
||||
if (strcmp(prevWord, "end") == 0) return lev;
|
||||
if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0)
|
||||
return -1;
|
||||
if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0
|
||||
|| strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0
|
||||
|| strcmp(s, "do") == 0 || strcmp(s, "enum") ==0
|
||||
|| strcmp(s, "forall") == 0 || strcmp(s, "function") == 0
|
||||
|| strcmp(s, "interface") == 0 || strcmp(s, "module") == 0
|
||||
|| strcmp(s, "program") == 0 || strcmp(s, "subroutine") == 0
|
||||
|| strcmp(s, "then") == 0 || strcmp(s, "where") == 0) {
|
||||
lev = 1;
|
||||
} else if (strcmp(s, "end") == 0 || strcmp(s, "continue") == 0
|
||||
|| strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
|
||||
|| strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
|
||||
|| strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0
|
||||
|| strcmp(s, "endif") == 0
|
||||
|| strcmp(s, "endforall") == 0 || strcmp(s, "endfunction") == 0
|
||||
|| strcmp(s, "endinterface") == 0 || strcmp(s, "endmodule") == 0
|
||||
|| strcmp(s, "endprogram") == 0 || strcmp(s, "endsubroutine") == 0
|
||||
|| strcmp(s, "endwhere") == 0 || strcmp(s, "procedure") == 0 ) {
|
||||
lev = -1;
|
||||
|| strcmp(s, "function") == 0 || strcmp(s, "interface") == 0
|
||||
|| strcmp(s, "module") == 0 || strcmp(s, "program") == 0
|
||||
|| strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0
|
||||
|| (strcmp(s, "type") == 0 && chNextNonBlank != '(') ){
|
||||
if (strcmp(prevWord, "end") == 0)
|
||||
lev = 0;
|
||||
else
|
||||
lev = 1;
|
||||
} else if (strcmp(s, "end") == 0 && chNextNonBlank != '='
|
||||
|| strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
|
||||
|| strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
|
||||
|| strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0
|
||||
|| strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0
|
||||
|| strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0
|
||||
|| strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0
|
||||
|| strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0
|
||||
|| strcmp(s, "endwhere") == 0
|
||||
|| strcmp(s, "procedure") == 0 ) { // Take care of the module procedure statement
|
||||
lev = -1;
|
||||
} else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if
|
||||
lev = 0;
|
||||
}
|
||||
return lev;
|
||||
}
|
||||
static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) {
|
||||
//~ bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
// Folding the code
|
||||
static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
|
||||
Accessor &styler, bool isFixFormat) {
|
||||
//
|
||||
// bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
// Do not know how to fold the comment at the moment.
|
||||
//
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
@@ -232,37 +268,133 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
|
||||
int levelCurrent = levelPrev;
|
||||
char chNext = styler[startPos];
|
||||
char chNextNonBlank;
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
|
||||
/***************************************/
|
||||
int lastStart = 0;
|
||||
char prevWord[32] = "";
|
||||
|
||||
char prevWord[32] = "", Label[6] = "";
|
||||
// Variables for do label folding.
|
||||
static int doLabels[100], posLabel=-1;
|
||||
/***************************************/
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
chNextNonBlank = chNext;
|
||||
unsigned int j=i+1;
|
||||
while(IsABlank(chNextNonBlank) && j<endPos) {
|
||||
j ++ ;
|
||||
chNextNonBlank = styler.SafeGetCharAt(j);
|
||||
}
|
||||
int stylePrev = style;
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
|
||||
if (stylePrev == SCE_F_DEFAULT && style == SCE_F_WORD)
|
||||
{
|
||||
// Store last word start point.
|
||||
//
|
||||
if (stylePrev == SCE_F_DEFAULT && (style == SCE_F_WORD || style == SCE_F_LABEL)) {
|
||||
// Store last word and label start point.
|
||||
lastStart = i;
|
||||
}
|
||||
|
||||
/***************************************/
|
||||
if (style == SCE_F_WORD) {
|
||||
if(iswordchar(ch) && !iswordchar(chNext)) {
|
||||
char s[32];
|
||||
unsigned int j;
|
||||
for(j = 0; ( j < 31 ) && ( j < i-lastStart+1 ); j++) {
|
||||
s[j] = static_cast<char>(tolower(styler[lastStart + j]));
|
||||
unsigned int k;
|
||||
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
|
||||
s[k] = static_cast<char>(tolower(styler[lastStart+k]));
|
||||
}
|
||||
s[k] = '\0';
|
||||
// Handle the forall and where statement and structure.
|
||||
if (strcmp(s, "forall") == 0 || strcmp(s, "where") == 0) {
|
||||
if (strcmp(prevWord, "end") != 0) {
|
||||
j = i + 1;
|
||||
char chBrace = '(', chSeek = ')', ch1 = styler.SafeGetCharAt(j);
|
||||
// Find the position of the first (
|
||||
while (ch1 != chBrace && j<endPos) {
|
||||
j++;
|
||||
ch1 = styler.SafeGetCharAt(j);
|
||||
}
|
||||
char styBrace = styler.StyleAt(j);
|
||||
int depth = 1;
|
||||
char chAtPos;
|
||||
char styAtPos;
|
||||
while (j<endPos) {
|
||||
j++;
|
||||
chAtPos = styler.SafeGetCharAt(j);
|
||||
styAtPos = styler.StyleAt(j);
|
||||
if (styAtPos == styBrace) {
|
||||
if (chAtPos == chBrace) depth++;
|
||||
if (chAtPos == chSeek) depth--;
|
||||
if (depth == 0) break;
|
||||
}
|
||||
}
|
||||
while (j<endPos) {
|
||||
j++;
|
||||
chAtPos = styler.SafeGetCharAt(j);
|
||||
styAtPos = styler.StyleAt(j);
|
||||
if (styAtPos == SCE_F_COMMENT || IsABlank(chAtPos)) continue;
|
||||
if (isFixFormat) {
|
||||
if (!IsALineEnd(chAtPos)) {
|
||||
break;
|
||||
} else {
|
||||
if (lineCurrent < styler.GetLine(styler.Length()-1)) {
|
||||
j = styler.LineStart(lineCurrent+1);
|
||||
if (styler.StyleAt(j+5) == SCE_F_CONTINUATION) {
|
||||
j += 5;
|
||||
continue;
|
||||
} else {
|
||||
levelCurrent++;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (chAtPos == '&' && styler.StyleAt(j) == SCE_F_CONTINUATION) {
|
||||
j = GetContinuedPos(j+1, styler);
|
||||
continue;
|
||||
} else if (IsALineEnd(chAtPos)) {
|
||||
levelCurrent ++;
|
||||
break;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
levelCurrent += classifyFoldPointFortran(s, prevWord, chNextNonBlank);
|
||||
// Store the do Labels into array
|
||||
if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) {
|
||||
unsigned int k = 0;
|
||||
for (i=j; (i<j+5 && i<endPos); i++) {
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
if (IsADigit(ch))
|
||||
Label[k++] = ch;
|
||||
else
|
||||
break;
|
||||
}
|
||||
Label[k] = '\0';
|
||||
posLabel ++;
|
||||
doLabels[posLabel] = atoi(Label);
|
||||
}
|
||||
}
|
||||
s[j] = '\0';
|
||||
levelCurrent += classifyFoldPointFortran(s, prevWord);
|
||||
strcpy(prevWord, s);
|
||||
}
|
||||
} else if (style == SCE_F_LABEL) {
|
||||
if(IsADigit(ch) && !IsADigit(chNext)) {
|
||||
for(j = 0; ( j < 5 ) && ( j < i-lastStart+1 ); j++) {
|
||||
ch = styler.SafeGetCharAt(lastStart + j);
|
||||
if (IsADigit(ch) && styler.StyleAt(lastStart+j) == SCE_F_LABEL)
|
||||
Label[j] = ch;
|
||||
else
|
||||
break;
|
||||
}
|
||||
Label[j] = '\0';
|
||||
while (doLabels[posLabel] == atoi(Label) && posLabel > -1) {
|
||||
levelCurrent--;
|
||||
posLabel--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (atEOL) {
|
||||
int lev = levelPrev;
|
||||
@@ -278,33 +410,41 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, Wor
|
||||
visibleChars = 0;
|
||||
strcpy(prevWord, "");
|
||||
}
|
||||
|
||||
if (!isspacechar(ch))
|
||||
visibleChars++;
|
||||
/***************************************/
|
||||
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 FortranWordLists[] = {
|
||||
"Primary keywords and identifiers",
|
||||
"Intrinsic functions",
|
||||
"Extended and user defined functions",
|
||||
0,
|
||||
};
|
||||
|
||||
/***************************************/
|
||||
static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false);
|
||||
}
|
||||
|
||||
/***************************************/
|
||||
static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true);
|
||||
}
|
||||
|
||||
|
||||
LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDoc, FortranWordLists);
|
||||
LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDoc, FortranWordLists);
|
||||
/***************************************/
|
||||
static void FoldFortranDocFreeFormat(unsigned int startPos, int length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
FoldFortranDoc(startPos, length, initStyle,styler, false);
|
||||
}
|
||||
/***************************************/
|
||||
static void FoldFortranDocFixFormat(unsigned int startPos, int length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
FoldFortranDoc(startPos, length, initStyle,styler, true);
|
||||
}
|
||||
/***************************************/
|
||||
LexerModule lmFortran(SCLEX_FORTRAN, ColouriseFortranDocFreeFormat, "fortran", FoldFortranDocFreeFormat, FortranWordLists);
|
||||
LexerModule lmF77(SCLEX_F77, ColouriseFortranDocFixFormat, "f77", FoldFortranDocFixFormat, FortranWordLists);
|
||||
|
@@ -27,21 +27,31 @@ static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
|
||||
}
|
||||
|
||||
inline bool IsAWordStart(const int ch) {
|
||||
static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
inline bool isLuaOperator(char ch) {
|
||||
if (isalnum(ch))
|
||||
static inline bool IsANumberChar(const int ch) {
|
||||
// Not exactly following number definition (several dots are seen as OK, etc.)
|
||||
// but probably enough in most cases.
|
||||
return (ch < 0x80) &&
|
||||
(isdigit(ch) || toupper(ch) == 'E' ||
|
||||
ch == '.' || ch == '-' || ch == '+');
|
||||
}
|
||||
|
||||
static 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 == '.' || ch == '^' || ch == '%' || ch == ':') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -124,11 +134,8 @@ static void ColouriseLuaDoc(
|
||||
sc.SetState(SCE_LUA_DEFAULT);
|
||||
} else if (sc.state == SCE_LUA_NUMBER) {
|
||||
// We stop the number definition on non-numerical non-dot non-eE non-sign char
|
||||
if (!(isdigit(sc.ch) || sc.ch == '.' ||
|
||||
toupper(sc.ch) == 'E' || sc.ch == '-' || sc.ch == '+')) {
|
||||
// Not exactly following number definition (several dots are seen as OK, etc.)
|
||||
// but probably enough in most cases.
|
||||
sc.SetState(SCE_LUA_DEFAULT);
|
||||
if (!IsANumberChar(sc.ch)) {
|
||||
sc.SetState(SCE_LUA_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_LUA_IDENTIFIER) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
@@ -233,7 +240,7 @@ static void ColouriseLuaDoc(
|
||||
sc.Forward();
|
||||
} else if (sc.atLineStart && sc.Match('$')) {
|
||||
sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code
|
||||
} else if (isLuaOperator(static_cast<char>(sc.ch))) {
|
||||
} else if (IsLuaOperator(static_cast<char>(sc.ch))) {
|
||||
sc.SetState(SCE_LUA_OPERATOR);
|
||||
}
|
||||
}
|
||||
|
182
contrib/src/stc/scintilla/src/LexMPT.cxx
Normal file
182
contrib/src/stc/scintilla/src/LexMPT.cxx
Normal file
@@ -0,0 +1,182 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexMPT.cxx
|
||||
** Lexer for MPT specific files. Based on LexOthers.cxx
|
||||
** LOT = the text log file created by the MPT application while running a test program
|
||||
** Other MPT specific files to be added later.
|
||||
**/
|
||||
// Copyright 2003 by Marius Gheorghe <mgheorghe@cabletest.com>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <ctype.h>
|
||||
#include <stdlib.h>
|
||||
#include "Platform.h"
|
||||
|
||||
#include "PropSet.h"
|
||||
#include "Accessor.h"
|
||||
#include "KeyWords.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
#include "SString.h"
|
||||
|
||||
static int GetLotLineState(SString &line) {
|
||||
if (line.length()) {
|
||||
// Most of the time the first non-blank character in line determines that line's type
|
||||
// Now finds the first non-blank character
|
||||
unsigned i; // Declares counter here to make it persistent after the for loop
|
||||
for (i = 0; i < line.length(); ++i) {
|
||||
if (!isspace(line[i]))
|
||||
break;
|
||||
}
|
||||
|
||||
// Checks if it was a blank line
|
||||
if (i == line.length())
|
||||
return SCE_LOT_DEFAULT;
|
||||
|
||||
switch (line[i]) {
|
||||
case '*': // Fail measurement
|
||||
return SCE_LOT_FAIL;
|
||||
|
||||
case '+': // Header
|
||||
case '|': // Header
|
||||
return SCE_LOT_HEADER;
|
||||
|
||||
case ':': // Set test limits
|
||||
return SCE_LOT_SET;
|
||||
|
||||
case '-': // Section break
|
||||
return SCE_LOT_BREAK;
|
||||
|
||||
default: // Any other line
|
||||
// Checks for message at the end of lot file
|
||||
if (line.contains("PASSED")) {
|
||||
return SCE_LOT_PASS;
|
||||
}
|
||||
else if (line.contains("FAILED")) {
|
||||
return SCE_LOT_FAIL;
|
||||
}
|
||||
else if (line.contains("ABORTED")) {
|
||||
return SCE_LOT_ABORT;
|
||||
}
|
||||
else {
|
||||
return i ? SCE_LOT_PASS : SCE_LOT_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
return SCE_LOT_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
static void ColourizeLotDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
bool atLineStart = true;// Arms the 'at line start' flag
|
||||
char chNext = styler.SafeGetCharAt(startPos);
|
||||
SString line("");
|
||||
line.setsizegrowth(256); // Lot lines are less than 256 chars long most of the time. This should avoid reallocations
|
||||
|
||||
// Styles LOT document
|
||||
unsigned int i; // Declared here because it's used after the for loop
|
||||
for (i = startPos; i < startPos + length; ++i) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
line += ch;
|
||||
atLineStart = false;
|
||||
|
||||
// LOT files are only used on the Win32 platform, thus EOL == CR+LF
|
||||
// Searches for the end of line
|
||||
if (ch == '\r' && chNext == '\n') {
|
||||
line += chNext; // Gets the '\n'
|
||||
++i; // Advances past the '\n'
|
||||
chNext = styler.SafeGetCharAt(i + 1); // Gets character of next line
|
||||
styler.ColourTo(i, GetLotLineState(line));
|
||||
line = "";
|
||||
atLineStart = true; // Arms flag for next line
|
||||
}
|
||||
}
|
||||
|
||||
// Last line may not have a line ending
|
||||
if (!atLineStart) {
|
||||
styler.ColourTo(i - 1, GetLotLineState(line));
|
||||
}
|
||||
}
|
||||
|
||||
// Folds an MPT LOT file: the blocks that can be folded are:
|
||||
// sections (headed by a set line)
|
||||
// passes (contiguous pass results within a section)
|
||||
// fails (contiguous fail results within a section)
|
||||
static void FoldLotDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 0) != 0;
|
||||
unsigned int endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
|
||||
char chNext = styler.SafeGetCharAt(startPos);
|
||||
int style = SCE_LOT_DEFAULT;
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int lev = SC_FOLDLEVELBASE;
|
||||
|
||||
// Gets style of previous line if not at the beginning of the document
|
||||
if (startPos > 1)
|
||||
style = styler.StyleAt(startPos - 2);
|
||||
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if (ch == '\r' && chNext == '\n') {
|
||||
// TO DO:
|
||||
// Should really get the state of the previous line from the styler
|
||||
int stylePrev = style;
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 2);
|
||||
|
||||
switch (style) {
|
||||
/*
|
||||
case SCE_LOT_SET:
|
||||
lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
|
||||
break;
|
||||
*/
|
||||
case SCE_LOT_FAIL:
|
||||
/*
|
||||
if (stylePrev != SCE_LOT_FAIL)
|
||||
lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
|
||||
else
|
||||
lev = SC_FOLDLEVELBASE + 1;
|
||||
*/
|
||||
lev = SC_FOLDLEVELBASE;
|
||||
break;
|
||||
|
||||
default:
|
||||
if (lineCurrent == 0 || stylePrev == SCE_LOT_FAIL)
|
||||
lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
|
||||
else
|
||||
lev = SC_FOLDLEVELBASE + 1;
|
||||
|
||||
if (visibleChars == 0 && foldCompact)
|
||||
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||
break;
|
||||
}
|
||||
|
||||
if (lev != styler.LevelAt(lineCurrent))
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
|
||||
lineCurrent++;
|
||||
visibleChars = 0;
|
||||
}
|
||||
|
||||
if (!isspacechar(ch))
|
||||
visibleChars++;
|
||||
}
|
||||
|
||||
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
|
||||
styler.SetLevel(lineCurrent, lev | flagsNext);
|
||||
}
|
||||
|
||||
static const char * const emptyWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmLot(SCLEX_LOT, ColourizeLotDoc, "lot", FoldLotDoc, emptyWordListDesc);
|
@@ -2,6 +2,10 @@
|
||||
/** @file LexMatlab.cxx
|
||||
** Lexer for Matlab.
|
||||
** Written by Jos<6F> Fonseca
|
||||
**
|
||||
** Changes by Christoph Dalitz 2003/12/04:
|
||||
** - added support for Octave
|
||||
** - Strings can now be included both in single or double quotes
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
@@ -21,8 +25,21 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
|
||||
static bool IsMatlabCommentChar(int c) {
|
||||
return (c == '%') ;
|
||||
}
|
||||
|
||||
static bool IsOctaveCommentChar(int c) {
|
||||
return (c == '%' || c == '#') ;
|
||||
}
|
||||
|
||||
static bool IsMatlabComment(Accessor &styler, int pos, int len) {
|
||||
return len > 0 && (styler[pos] == '%' || styler[pos] == '!') ;
|
||||
return len > 0 && IsMatlabCommentChar(styler[pos]) ;
|
||||
}
|
||||
|
||||
static bool IsOctaveComment(Accessor &styler, int pos, int len) {
|
||||
return len > 0 && IsOctaveCommentChar(styler[pos]) ;
|
||||
}
|
||||
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
@@ -33,8 +50,10 @@ static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
static void ColouriseMatlabOctaveDoc(
|
||||
unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler,
|
||||
bool (*IsCommentChar)(int)) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
@@ -81,9 +100,11 @@ static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
|
||||
transpose = true;
|
||||
}
|
||||
} else if (sc.state == SCE_MATLAB_STRING) {
|
||||
// Matlab doubles quotes to preserve them, so just end this string
|
||||
// state now as a following quote will start again
|
||||
if (sc.ch == '\'') {
|
||||
if (sc.ch == '\'' && sc.chPrev != '\\') {
|
||||
sc.ForwardSetState(SCE_MATLAB_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_MATLAB_DOUBLEQUOTESTRING) {
|
||||
if (sc.ch == '"' && sc.chPrev != '\\') {
|
||||
sc.ForwardSetState(SCE_MATLAB_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_MATLAB_COMMENT || sc.state == SCE_MATLAB_COMMAND) {
|
||||
@@ -94,7 +115,7 @@ static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
|
||||
if (sc.state == SCE_MATLAB_DEFAULT) {
|
||||
if (sc.ch == '%') {
|
||||
if (IsCommentChar(sc.ch)) {
|
||||
sc.SetState(SCE_MATLAB_COMMENT);
|
||||
} else if (sc.ch == '!') {
|
||||
sc.SetState(SCE_MATLAB_COMMAND);
|
||||
@@ -104,6 +125,8 @@ static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else {
|
||||
sc.SetState(SCE_MATLAB_STRING);
|
||||
}
|
||||
} else if (sc.ch == '"') {
|
||||
sc.SetState(SCE_MATLAB_DOUBLEQUOTESTRING);
|
||||
} else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) {
|
||||
sc.SetState(SCE_MATLAB_NUMBER);
|
||||
} else if (isalpha(sc.ch)) {
|
||||
@@ -123,8 +146,20 @@ static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldMatlabDoc(unsigned int startPos, int length, int,
|
||||
WordList *[], Accessor &styler) {
|
||||
static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar);
|
||||
}
|
||||
|
||||
static void ColouriseOctaveDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar);
|
||||
}
|
||||
|
||||
static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,
|
||||
WordList *[], Accessor &styler,
|
||||
bool (*IsComment)(Accessor&,int,int)) {
|
||||
|
||||
int endPos = startPos + length;
|
||||
|
||||
// Backtrack to previous line in case need to fix its fold status
|
||||
@@ -136,7 +171,7 @@ static void FoldMatlabDoc(unsigned int startPos, int length, int,
|
||||
}
|
||||
}
|
||||
int spaceFlags = 0;
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsMatlabComment);
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsComment);
|
||||
char chNext = styler[startPos];
|
||||
for (int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
@@ -144,7 +179,7 @@ static void FoldMatlabDoc(unsigned int startPos, int length, int,
|
||||
|
||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) {
|
||||
int lev = indentCurrent;
|
||||
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsMatlabComment);
|
||||
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsComment);
|
||||
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
|
||||
// Only non whitespace lines can be headers
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
|
||||
@@ -152,7 +187,7 @@ static void FoldMatlabDoc(unsigned int startPos, int length, int,
|
||||
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
|
||||
// Line after is blank so check the next - maybe should continue further?
|
||||
int spaceFlags2 = 0;
|
||||
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsMatlabComment);
|
||||
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsComment);
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
@@ -165,9 +200,26 @@ static void FoldMatlabDoc(unsigned int startPos, int length, int,
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldMatlabDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabComment);
|
||||
}
|
||||
|
||||
static void FoldOctaveDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
FoldMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveComment);
|
||||
}
|
||||
|
||||
static const char * const matlabWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
static const char * const octaveWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmMatlab(SCLEX_MATLAB, ColouriseMatlabDoc, "matlab", FoldMatlabDoc, matlabWordListDesc);
|
||||
|
||||
LexerModule lmOctave(SCLEX_OCTAVE, ColouriseOctaveDoc, "octave", FoldOctaveDoc, octaveWordListDesc);
|
||||
|
320
contrib/src/stc/scintilla/src/LexMetapost.cxx
Normal file
320
contrib/src/stc/scintilla/src/LexMetapost.cxx
Normal file
@@ -0,0 +1,320 @@
|
||||
// Scintilla source code edit control
|
||||
|
||||
// File: LexMetapost.cxx - general context conformant metapost coloring scheme
|
||||
// Author: Hans Hagen - PRAGMA ADE - Hasselt NL - www.pragma-ade.com
|
||||
// Version: September 28, 2003
|
||||
|
||||
// Copyright: 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
// This lexer is derived from the one written for the texwork environment (1999++) which in
|
||||
// turn is inspired on texedit (1991++) which finds its roots in wdt (1986).
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <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"
|
||||
|
||||
// val SCE_METAPOST_DEFAULT = 0
|
||||
// val SCE_METAPOST_SPECIAL = 1
|
||||
// val SCE_METAPOST_GROUP = 2
|
||||
// val SCE_METAPOST_SYMBOL = 3
|
||||
// val SCE_METAPOST_COMMAND = 4
|
||||
// val SCE_METAPOST_TEXT = 5
|
||||
|
||||
// Definitions in SciTEGlobal.properties:
|
||||
//
|
||||
// Metapost Highlighting
|
||||
//
|
||||
// # Default
|
||||
// style.metapost.0=fore:#7F7F00
|
||||
// # Special
|
||||
// style.metapost.1=fore:#007F7F
|
||||
// # Group
|
||||
// style.metapost.2=fore:#880000
|
||||
// # Symbol
|
||||
// style.metapost.3=fore:#7F7F00
|
||||
// # Command
|
||||
// style.metapost.4=fore:#008800
|
||||
// # Text
|
||||
// style.metapost.5=fore:#000000
|
||||
|
||||
// lexer.tex.comment.process=0
|
||||
|
||||
// Auxiliary functions:
|
||||
|
||||
static inline bool endOfLine(Accessor &styler, unsigned int i) {
|
||||
return
|
||||
(styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')) ;
|
||||
}
|
||||
|
||||
static inline bool isMETAPOSTcomment(int ch) {
|
||||
return
|
||||
(ch == '%') ;
|
||||
}
|
||||
|
||||
static inline bool isMETAPOSTone(int ch) {
|
||||
return
|
||||
(ch == '[') || (ch == ']') || (ch == '(') || (ch == ')') ||
|
||||
(ch == ':') || (ch == '=') || (ch == '<') || (ch == '>') ||
|
||||
(ch == '{') || (ch == '}') || (ch == '\'') || (ch == '\"') ;
|
||||
}
|
||||
|
||||
static inline bool isMETAPOSTtwo(int ch) {
|
||||
return
|
||||
(ch == ';') || (ch == '$') || (ch == '@') || (ch == '#');
|
||||
}
|
||||
|
||||
static inline bool isMETAPOSTthree(int ch) {
|
||||
return
|
||||
(ch == '.') || (ch == '-') || (ch == '+') || (ch == '/') ||
|
||||
(ch == '*') || (ch == ',') || (ch == '|') || (ch == '`') ||
|
||||
(ch == '!') || (ch == '?') || (ch == '^') || (ch == '&') ||
|
||||
(ch == '%') ;
|
||||
}
|
||||
|
||||
static inline bool isMETAPOSTidentifier(int ch) {
|
||||
return
|
||||
((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ||
|
||||
(ch == '_') ;
|
||||
}
|
||||
|
||||
static inline bool isMETAPOSTnumber(int ch) {
|
||||
return
|
||||
(ch >= '0') && (ch <= '9') ;
|
||||
}
|
||||
|
||||
static inline bool isMETAPOSTstring(int ch) {
|
||||
return
|
||||
(ch == '\"') ;
|
||||
}
|
||||
|
||||
static inline bool isMETAPOSTcolon(int ch) {
|
||||
return
|
||||
(ch == ':') ;
|
||||
}
|
||||
|
||||
static inline bool isMETAPOSTequal(int ch) {
|
||||
return
|
||||
(ch == '=') ;
|
||||
}
|
||||
|
||||
static int CheckMETAPOSTInterface(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Accessor &styler,
|
||||
int defaultInterface) {
|
||||
|
||||
char lineBuffer[1024] ;
|
||||
unsigned int linePos = 0 ;
|
||||
|
||||
// some day we can make something lexer.metapost.mapping=(none,0)(metapost,1)(mp,1)(metafun,2)...
|
||||
|
||||
if (styler.SafeGetCharAt(0) == '%') {
|
||||
for (unsigned int i = 0; i < startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler.SafeGetCharAt(i) ;
|
||||
if (endOfLine(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
lineBuffer[linePos] = '\0';
|
||||
if (strstr(lineBuffer, "interface=none")) {
|
||||
return 0 ;
|
||||
} else if (strstr(lineBuffer, "interface=metapost") || strstr(lineBuffer, "interface=mp")) {
|
||||
return 1 ;
|
||||
} else if (strstr(lineBuffer, "interface=metafun")) {
|
||||
return 2 ;
|
||||
} else if (styler.SafeGetCharAt(1) == 'D' && strstr(lineBuffer, "%D \\module")) {
|
||||
// better would be to limit the search to just one line
|
||||
return 2 ;
|
||||
} else {
|
||||
return defaultInterface ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return defaultInterface ;
|
||||
}
|
||||
|
||||
static void ColouriseMETAPOSTDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
int,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
styler.StartAt(startPos) ;
|
||||
styler.StartSegment(startPos) ;
|
||||
|
||||
bool processComment = styler.GetPropertyInt("lexer.metapost.comment.process", 0) == 1 ;
|
||||
int defaultInterface = styler.GetPropertyInt("lexer.metapost.interface.default", 1) ;
|
||||
|
||||
int currentInterface = CheckMETAPOSTInterface(startPos,length,styler,defaultInterface) ;
|
||||
|
||||
// 0 no keyword highlighting
|
||||
// 1 metapost keyword hightlighting
|
||||
// 2+ metafun keyword hightlighting
|
||||
|
||||
int extraInterface = 0 ;
|
||||
|
||||
if (currentInterface != 0) {
|
||||
extraInterface = currentInterface ;
|
||||
}
|
||||
|
||||
WordList &keywords = *keywordlists[0] ;
|
||||
WordList &keywords2 = *keywordlists[extraInterface-1] ;
|
||||
|
||||
StyleContext sc(startPos, length, SCE_METAPOST_TEXT, styler) ;
|
||||
|
||||
char key[100] ;
|
||||
|
||||
bool inTeX = false ;
|
||||
bool inComment = false ;
|
||||
bool inString = false ;
|
||||
bool inClause = false ;
|
||||
|
||||
bool going = sc.More() ; // needed because of a fuzzy end of file state
|
||||
|
||||
for (; going; sc.Forward()) {
|
||||
|
||||
if (! sc.More()) { going = false ; } // we need to go one behind the end of text
|
||||
|
||||
if (inClause) {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
inClause = false ;
|
||||
}
|
||||
|
||||
if (inComment) {
|
||||
if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
inTeX = false ;
|
||||
inComment = false ;
|
||||
inClause = false ;
|
||||
inString = false ; // not correct but we want to stimulate one-lines
|
||||
}
|
||||
} else if (inString) {
|
||||
if (isMETAPOSTstring(sc.ch)) {
|
||||
sc.SetState(SCE_METAPOST_SPECIAL) ;
|
||||
sc.ForwardSetState(SCE_METAPOST_TEXT) ;
|
||||
inString = false ;
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
inTeX = false ;
|
||||
inComment = false ;
|
||||
inClause = false ;
|
||||
inString = false ; // not correct but we want to stimulate one-lines
|
||||
}
|
||||
} else {
|
||||
if ((! isMETAPOSTidentifier(sc.ch)) && (sc.LengthCurrent() > 0)) {
|
||||
if (sc.state == SCE_METAPOST_COMMAND) {
|
||||
sc.GetCurrent(key, sizeof(key)) ;
|
||||
if ((strcmp(key,"btex") == 0) || (strcmp(key,"verbatimtex") == 0)) {
|
||||
sc.ChangeState(SCE_METAPOST_GROUP) ;
|
||||
inTeX = true ;
|
||||
} else if (inTeX) {
|
||||
if (strcmp(key,"etex") == 0) {
|
||||
sc.ChangeState(SCE_METAPOST_GROUP) ;
|
||||
inTeX = false ;
|
||||
} else {
|
||||
sc.ChangeState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
} else {
|
||||
if (keywords && keywords.InList(key)) {
|
||||
sc.ChangeState(SCE_METAPOST_COMMAND) ;
|
||||
} else if (keywords2 && keywords2.InList(key)) {
|
||||
sc.ChangeState(SCE_METAPOST_EXTRA) ;
|
||||
} else {
|
||||
sc.ChangeState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isMETAPOSTcomment(sc.ch)) {
|
||||
if (! inTeX) {
|
||||
sc.SetState(SCE_METAPOST_SYMBOL) ;
|
||||
sc.ForwardSetState(SCE_METAPOST_DEFAULT) ;
|
||||
inComment = ! processComment ;
|
||||
} else {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
} else if (isMETAPOSTstring(sc.ch)) {
|
||||
if (! inTeX) {
|
||||
sc.SetState(SCE_METAPOST_SPECIAL) ;
|
||||
if (! isMETAPOSTstring(sc.chNext)) {
|
||||
sc.ForwardSetState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
inString = true ;
|
||||
} else {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
} else if (isMETAPOSTcolon(sc.ch)) {
|
||||
if (! inTeX) {
|
||||
if (! isMETAPOSTequal(sc.chNext)) {
|
||||
sc.SetState(SCE_METAPOST_COMMAND) ;
|
||||
inClause = true ;
|
||||
} else {
|
||||
sc.SetState(SCE_METAPOST_SPECIAL) ;
|
||||
}
|
||||
} else {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
} else if (isMETAPOSTone(sc.ch)) {
|
||||
if (! inTeX) {
|
||||
sc.SetState(SCE_METAPOST_SPECIAL) ;
|
||||
} else {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
} else if (isMETAPOSTtwo(sc.ch)) {
|
||||
if (! inTeX) {
|
||||
sc.SetState(SCE_METAPOST_GROUP) ;
|
||||
} else {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
} else if (isMETAPOSTthree(sc.ch)) {
|
||||
if (! inTeX) {
|
||||
sc.SetState(SCE_METAPOST_SYMBOL) ;
|
||||
} else {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
} else if (isMETAPOSTidentifier(sc.ch)) {
|
||||
if (sc.state != SCE_METAPOST_COMMAND) {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
sc.ChangeState(SCE_METAPOST_COMMAND) ;
|
||||
}
|
||||
} else if (isMETAPOSTnumber(sc.ch)) {
|
||||
// rather redundant since for the moment we don't handle numbers
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
inTeX = false ;
|
||||
inComment = false ;
|
||||
inClause = false ;
|
||||
inString = false ;
|
||||
} else {
|
||||
sc.SetState(SCE_METAPOST_TEXT) ;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
sc.Complete();
|
||||
|
||||
}
|
||||
|
||||
// Hooks info the system:
|
||||
|
||||
static const char * const metapostWordListDesc[] = {
|
||||
"MetaPost",
|
||||
"MetaFun",
|
||||
0
|
||||
} ;
|
||||
|
||||
LexerModule lmMETAPOST(SCLEX_METAPOST, ColouriseMETAPOSTDoc, "metapost", 0, metapostWordListDesc);
|
@@ -427,6 +427,12 @@ static void ColouriseErrorListLine(
|
||||
styler.ColourTo(endPos, SCE_ERR_DIFF_ADDITION);
|
||||
} else if (lineBuffer[0] == '-' && lineBuffer[1] == '-' && lineBuffer[2] == '-') {
|
||||
styler.ColourTo(endPos, SCE_ERR_DIFF_MESSAGE);
|
||||
} else if (strstart(lineBuffer, "cf90-")) {
|
||||
// Absoft Pro Fortran 90/95 v8.2 error and/or warning message
|
||||
styler.ColourTo(endPos, SCE_ERR_ABSF);
|
||||
} else if (strstart(lineBuffer, "fortcom:")) {
|
||||
// Intel Fortran Compiler v8.0 error/warning message
|
||||
styler.ColourTo(endPos, SCE_ERR_IFORT);
|
||||
} else if (lineBuffer[0] == '-') {
|
||||
styler.ColourTo(endPos, SCE_ERR_DIFF_DELETION);
|
||||
} else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
|
||||
|
228
contrib/src/stc/scintilla/src/LexPB.cxx
Normal file
228
contrib/src/stc/scintilla/src/LexPB.cxx
Normal file
@@ -0,0 +1,228 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexPB.cxx
|
||||
** Lexer for PowerBasic by Roland Walter, roland@rowalt.de
|
||||
** Last update: 17.10.2003 (toggling of subs/functions now until next sub/functin - this gives better results)
|
||||
**/
|
||||
//
|
||||
// Necessary changes in Scintilla project:
|
||||
// - In SciLexer.h and Scintilla.iface:
|
||||
//
|
||||
// #define SCLEX_PB 51 //ID for PowerBasic lexer
|
||||
// (...)
|
||||
// #define SCE_B_DEFAULT 0 //in both VB and PB lexer
|
||||
// #define SCE_B_COMMENT 1 //in both VB and PB lexer
|
||||
// #define SCE_B_NUMBER 2 //in both VB and PB lexer
|
||||
// #define SCE_B_KEYWORD 3 //in both VB and PB lexer
|
||||
// #define SCE_B_STRING 4 //in both VB and PB lexer
|
||||
// #define SCE_B_PREPROCESSOR 5 //VB lexer only, unsupported by PB lexer
|
||||
// #define SCE_B_OPERATOR 6 //in both VB and PB lexer
|
||||
// #define SCE_B_IDENTIFIER 7 //in both VB and PB lexer
|
||||
// #define SCE_B_DATE 8 //VB lexer only, unsupported by PB lexer
|
||||
|
||||
// - Statement added to KeyWords.cxx: 'LINK_LEXER(lmPB);'
|
||||
// - Statement added to scintilla_vc6.mak: '$(DIR_O)\LexPB.obj: ...\src\LexPB.cxx $(LEX_HEADERS)'
|
||||
//
|
||||
// Copyright for Scintilla: 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <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"
|
||||
|
||||
static inline bool IsTypeCharacter(const int ch) {
|
||||
return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$';
|
||||
}
|
||||
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||
}
|
||||
|
||||
static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
bool MatchUpperCase(Accessor &styler, int pos, const char *s) //Same as styler.Match() but uppercase comparison (a-z,A-Z and space only)
|
||||
{
|
||||
char ch;
|
||||
for (int i=0; *s; i++)
|
||||
{
|
||||
ch=styler.SafeGetCharAt(pos+i);
|
||||
if (ch > 0x60) ch -= '\x20';
|
||||
if (*s != ch) return false;
|
||||
s++;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ColourisePBDoc(unsigned int startPos, int length, int initStyle,WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
|
||||
if (sc.state == SCE_B_OPERATOR)
|
||||
{
|
||||
sc.SetState(SCE_B_DEFAULT);
|
||||
}
|
||||
else if (sc.state == SCE_B_KEYWORD)
|
||||
{
|
||||
if (!IsAWordChar(sc.ch))
|
||||
{
|
||||
if (!IsTypeCharacter(sc.ch))
|
||||
{
|
||||
if (sc.ch == ']') {sc.Forward();}
|
||||
char s[100];
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
if (keywords.InList(s))
|
||||
{
|
||||
if (strcmp(s, "rem") == 0)
|
||||
{
|
||||
sc.ChangeState(SCE_B_COMMENT);
|
||||
if (sc.atLineEnd) {sc.SetState(SCE_B_DEFAULT);}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.SetState(SCE_B_DEFAULT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
sc.ChangeState(SCE_B_IDENTIFIER);
|
||||
sc.SetState(SCE_B_DEFAULT);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sc.state == SCE_B_NUMBER)
|
||||
{
|
||||
if (!IsAWordChar(sc.ch)) {sc.SetState(SCE_B_DEFAULT);}
|
||||
}
|
||||
else if (sc.state == SCE_B_STRING)
|
||||
{
|
||||
// PB doubles quotes to preserve them, so just end this string
|
||||
// state now as a following quote will start again
|
||||
if (sc.ch == '\"')
|
||||
{
|
||||
if (tolower(sc.chNext) == 'c') {sc.Forward();}
|
||||
sc.ForwardSetState(SCE_B_DEFAULT);
|
||||
}
|
||||
}
|
||||
else if (sc.state == SCE_B_COMMENT)
|
||||
{
|
||||
if (sc.atLineEnd) {sc.SetState(SCE_B_DEFAULT);}
|
||||
}
|
||||
|
||||
if (sc.state == SCE_B_DEFAULT)
|
||||
{
|
||||
if (sc.ch == '\'') {sc.SetState(SCE_B_COMMENT);}
|
||||
else if (sc.ch == '\"') {sc.SetState(SCE_B_STRING);}
|
||||
else if (sc.ch == '#')
|
||||
{ int n = 1;
|
||||
int chSeek = ' ';
|
||||
while ((n < 100) && (chSeek == ' ' || chSeek == '\t'))
|
||||
{
|
||||
chSeek = sc.GetRelative(n);
|
||||
n++;
|
||||
}
|
||||
sc.SetState(SCE_B_OPERATOR);
|
||||
}
|
||||
else if (sc.ch == '&' && tolower(sc.chNext) == 'h') {sc.SetState(SCE_B_NUMBER);}
|
||||
else if (sc.ch == '&' && tolower(sc.chNext) == 'b') {sc.SetState(SCE_B_NUMBER);}
|
||||
else if (sc.ch == '&' && tolower(sc.chNext) == 'o') {sc.SetState(SCE_B_NUMBER);}
|
||||
else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {sc.SetState(SCE_B_NUMBER);}
|
||||
else if (IsAWordStart(sc.ch) || (sc.ch == '[')) {sc.SetState(SCE_B_KEYWORD);}
|
||||
else if (isoperator(static_cast<char>(sc.ch)) || (sc.ch == '\\')) {sc.SetState(SCE_B_OPERATOR);}
|
||||
}
|
||||
|
||||
}
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static void FoldPBDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
|
||||
{
|
||||
// No folding enabled, no reason to continue...
|
||||
if( styler.GetPropertyInt("fold") == 0 )
|
||||
return;
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
int levelCurrent = SC_FOLDLEVELBASE;
|
||||
if (lineCurrent > 0)
|
||||
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
|
||||
int levelNext = levelCurrent;
|
||||
char chNext = styler[startPos];
|
||||
|
||||
bool atEOL=1;
|
||||
for (unsigned int i = startPos; i < endPos; i++)
|
||||
{
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if( atEOL ) //Begin of a new line (The Sub/Function/Macro keywords may occur at begin of line only)
|
||||
{
|
||||
if( MatchUpperCase(styler,i,"FUNCTION") ) //else if(
|
||||
{
|
||||
styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG);
|
||||
levelNext=SC_FOLDLEVELBASE+1;
|
||||
}
|
||||
else if( MatchUpperCase(styler,i,"CALLBACK FUNCTION") )
|
||||
{
|
||||
styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG);
|
||||
levelNext=SC_FOLDLEVELBASE+1;
|
||||
}
|
||||
else if( MatchUpperCase(styler,i,"STATIC FUNCTION") )
|
||||
{
|
||||
styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG);
|
||||
levelNext=SC_FOLDLEVELBASE+1;
|
||||
}
|
||||
else if( MatchUpperCase(styler,i,"SUB") )
|
||||
{
|
||||
styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG);
|
||||
levelNext=SC_FOLDLEVELBASE+1;
|
||||
}
|
||||
else if( MatchUpperCase(styler,i,"STATIC SUB") )
|
||||
{
|
||||
styler.SetLevel(lineCurrent, (SC_FOLDLEVELBASE << 16) | SC_FOLDLEVELHEADERFLAG);
|
||||
levelNext=SC_FOLDLEVELBASE+1;
|
||||
}
|
||||
//else if( MatchUpperCase(styler,i,"MACRO") ) //ToDo: What's with single-line macros?
|
||||
}
|
||||
|
||||
atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
if( atEOL )
|
||||
{
|
||||
lineCurrent++;
|
||||
levelCurrent = levelNext;
|
||||
}
|
||||
}
|
||||
|
||||
if (levelNext == SC_FOLDLEVELBASE)
|
||||
{
|
||||
int levelUse = levelCurrent;
|
||||
int lev = levelUse | levelNext << 16;
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
}
|
||||
}
|
||||
|
||||
static const char * const pbWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmPB(SCLEX_POWERBASIC, ColourisePBDoc, "powerbasic", FoldPBDoc, pbWordListDesc);
|
@@ -33,10 +33,18 @@ static inline bool IsAWordChar(const int ch) {
|
||||
return ch < 0x80 && (isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
inline bool IsAWordStart(const int ch) {
|
||||
static inline bool IsAWordStart(const int ch) {
|
||||
return ch < 0x80 && isalpha(ch);
|
||||
}
|
||||
|
||||
static inline bool IsANumberChar(const int ch) {
|
||||
// Not exactly following number definition (several dots are seen as OK, etc.)
|
||||
// but probably enough in most cases.
|
||||
return (ch < 0x80) &&
|
||||
(isdigit(ch) || toupper(ch) == 'E' ||
|
||||
ch == '.' || ch == '-' || ch == '+');
|
||||
}
|
||||
|
||||
static void ColourisePovDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
@@ -91,11 +99,8 @@ static void ColourisePovDoc(
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
} else if (sc.state == SCE_POV_NUMBER) {
|
||||
// We stop the number definition on non-numerical non-dot non-eE non-sign char
|
||||
if (!(isdigit(sc.ch) || sc.ch == '.' ||
|
||||
toupper(sc.ch) == 'E' || sc.ch == '-' || sc.ch == '+')) {
|
||||
// Not exactly following number definition (several dots are seen as OK, etc.)
|
||||
// but probably enough in most cases.
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
if (!IsANumberChar(sc.ch)) {
|
||||
sc.SetState(SCE_POV_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_POV_IDENTIFIER) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
|
@@ -2,7 +2,8 @@
|
||||
/** @file LexPerl.cxx
|
||||
** Lexer for subset of Perl.
|
||||
**/
|
||||
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
|
||||
// Lexical analysis fixes by Kein-Hong Man <mkh@pl.jaring.my> 20031020
|
||||
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -19,6 +20,14 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#define PERLNUM_DECIMAL 1
|
||||
#define PERLNUM_NON_DEC 2
|
||||
#define PERLNUM_FLOAT 3
|
||||
#define PERLNUM_VECTOR 4
|
||||
#define PERLNUM_V_VECTOR 5
|
||||
|
||||
#define HERE_DELIM_MAX 256
|
||||
|
||||
static inline bool isEOLChar(char ch) {
|
||||
return (ch == '\r') || (ch == '\n');
|
||||
}
|
||||
@@ -31,9 +40,6 @@ static bool isSingleCharOp(char ch) {
|
||||
}
|
||||
|
||||
static inline bool isPerlOperator(char ch) {
|
||||
if (isalnum(ch))
|
||||
return false;
|
||||
// '.' left out as it is used to make up numbers
|
||||
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || ch == '\\' ||
|
||||
ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
|
||||
ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
|
||||
@@ -46,18 +52,13 @@ static inline bool isPerlOperator(char ch) {
|
||||
|
||||
static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
|
||||
s[i] = styler[start + i];
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
char chAttr = SCE_PL_IDENTIFIER;
|
||||
if (wordIsNumber)
|
||||
chAttr = SCE_PL_NUMBER;
|
||||
else {
|
||||
if (keywords.InList(s))
|
||||
chAttr = SCE_PL_WORD;
|
||||
}
|
||||
if (keywords.InList(s))
|
||||
chAttr = SCE_PL_WORD;
|
||||
styler.ColourTo(end, chAttr);
|
||||
return chAttr;
|
||||
}
|
||||
@@ -67,6 +68,23 @@ static inline bool isEndVar(char ch) {
|
||||
ch != '_' && ch != '\'';
|
||||
}
|
||||
|
||||
static inline bool isNonQuote(char ch) {
|
||||
return isalnum(ch) || ch == '_';
|
||||
}
|
||||
|
||||
static inline char actualNumStyle(int numberStyle) {
|
||||
switch (numberStyle) {
|
||||
case PERLNUM_VECTOR:
|
||||
case PERLNUM_V_VECTOR:
|
||||
return SCE_PL_STRING;
|
||||
case PERLNUM_DECIMAL:
|
||||
case PERLNUM_NON_DEC:
|
||||
case PERLNUM_FLOAT:
|
||||
default:
|
||||
return SCE_PL_NUMBER;
|
||||
}
|
||||
}
|
||||
|
||||
static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) {
|
||||
if ((pos + static_cast<int>(strlen(val))) >= lengthDoc) {
|
||||
return false;
|
||||
@@ -109,12 +127,16 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
char Quote; // the char after '<<'
|
||||
bool Quoted; // true if Quote in ('\'','"','`')
|
||||
int DelimiterLength; // strlen(Delimiter)
|
||||
char Delimiter[256]; // the Delimiter, 256: sizeof PL_tokenbuf
|
||||
char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf
|
||||
HereDocCls() {
|
||||
State = 0;
|
||||
DelimiterLength = 0;
|
||||
Delimiter = new char[HERE_DELIM_MAX];
|
||||
Delimiter[0] = '\0';
|
||||
}
|
||||
~HereDocCls() {
|
||||
delete []Delimiter;
|
||||
}
|
||||
};
|
||||
HereDocCls HereDoc; // TODO: FIFO for stacked here-docs
|
||||
|
||||
@@ -141,14 +163,17 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
};
|
||||
QuoteCls Quote;
|
||||
|
||||
char sooked[100];
|
||||
int sookedpos = 0;
|
||||
bool preferRE = true;
|
||||
sooked[sookedpos] = '\0';
|
||||
int state = initStyle;
|
||||
char numState = PERLNUM_DECIMAL;
|
||||
int dotCount = 0;
|
||||
unsigned int lengthDoc = startPos + length;
|
||||
//int sookedpos = 0; // these have no apparent use, see POD state
|
||||
//char sooked[100];
|
||||
//sooked[sookedpos] = '\0';
|
||||
|
||||
// If in a long distance lexical state, seek to the beginning to find quote characters
|
||||
// If in a long distance lexical state, seek to the beginning to find quote characters
|
||||
// Perl strings can be multi-line with embedded newlines, so backtrack.
|
||||
// Perl numbers have additional state during lexing, so backtrack too.
|
||||
if (state == SCE_PL_HERE_Q || state == SCE_PL_HERE_QQ || state == SCE_PL_HERE_QX) {
|
||||
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_PL_HERE_DELIM)) {
|
||||
startPos--;
|
||||
@@ -163,6 +188,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
|| state == SCE_PL_STRING_QW
|
||||
|| state == SCE_PL_REGEX
|
||||
|| state == SCE_PL_REGSUBST
|
||||
|| state == SCE_PL_STRING
|
||||
|| state == SCE_PL_BACKTICKS
|
||||
|| state == SCE_PL_CHARACTER
|
||||
|| state == SCE_PL_NUMBER
|
||||
) {
|
||||
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
|
||||
startPos--;
|
||||
@@ -179,6 +208,9 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
|
||||
for (unsigned int i = startPos; i < lengthDoc; i++) {
|
||||
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);
|
||||
|
||||
@@ -189,32 +221,36 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
continue;
|
||||
}
|
||||
if ((chPrev == '\r' && ch == '\n')) { // skip on DOS/Windows
|
||||
styler.ColourTo(i, state);
|
||||
chPrev = ch;
|
||||
continue;
|
||||
}
|
||||
|
||||
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;
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (HereDoc.Quoted) {
|
||||
if (state == SCE_PL_HERE_DELIM) {
|
||||
// Missing quote at end of string! We are stricter than perl.
|
||||
// Colour here-doc anyway while marking this bit as an error.
|
||||
state = SCE_PL_ERROR;
|
||||
} else {
|
||||
switch (HereDoc.Quote) {
|
||||
case '\'':
|
||||
state = SCE_PL_HERE_Q ;
|
||||
break;
|
||||
case '"':
|
||||
state = SCE_PL_HERE_QQ;
|
||||
break;
|
||||
case '`':
|
||||
state = SCE_PL_HERE_QX;
|
||||
break;
|
||||
}
|
||||
}
|
||||
styler.ColourTo(i - 1, state);
|
||||
switch (HereDoc.Quote) {
|
||||
case '\'':
|
||||
state = SCE_PL_HERE_Q ;
|
||||
break;
|
||||
case '"':
|
||||
state = SCE_PL_HERE_QQ;
|
||||
break;
|
||||
case '`':
|
||||
state = SCE_PL_HERE_QX;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
styler.ColourTo(i - 1, state);
|
||||
switch (HereDoc.Quote) {
|
||||
case '\\':
|
||||
state = SCE_PL_HERE_Q ;
|
||||
@@ -226,26 +262,37 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
|
||||
if (state == SCE_PL_DEFAULT) {
|
||||
if (iswordstart(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (ch == 's' && !isalnum(chNext)) {
|
||||
if (isdigit(ch) || (isdigit(chNext) &&
|
||||
(ch == '.' || ch == 'v'))) {
|
||||
state = SCE_PL_NUMBER;
|
||||
numState = PERLNUM_DECIMAL;
|
||||
dotCount = 0;
|
||||
if (ch == '0') { // hex,bin,octal
|
||||
if (chNext == 'x' || chNext == 'b' || isdigit(chNext)) {
|
||||
numState = PERLNUM_NON_DEC;
|
||||
}
|
||||
} else if (ch == 'v') { // vector
|
||||
numState = PERLNUM_V_VECTOR;
|
||||
}
|
||||
} else if (iswordstart(ch)) {
|
||||
if (ch == 's' && !isNonQuote(chNext)) {
|
||||
state = SCE_PL_REGSUBST;
|
||||
Quote.New(2);
|
||||
} else if (ch == 'm' && !isalnum(chNext)) {
|
||||
} else if (ch == 'm' && !isNonQuote(chNext)) {
|
||||
state = SCE_PL_REGEX;
|
||||
Quote.New(1);
|
||||
} else if (ch == 'q' && !isalnum(chNext)) {
|
||||
} else if (ch == 'q' && !isNonQuote(chNext)) {
|
||||
state = SCE_PL_STRING_Q;
|
||||
Quote.New(1);
|
||||
} else if (ch == 'y' && !isalnum(chNext)) {
|
||||
} else if (ch == 'y' && !isNonQuote(chNext)) {
|
||||
state = SCE_PL_REGSUBST;
|
||||
Quote.New(2);
|
||||
} else if (ch == 't' && chNext == 'r' && !isalnum(chNext2)) {
|
||||
} else if (ch == 't' && chNext == 'r' && !isNonQuote(chNext2)) {
|
||||
state = SCE_PL_REGSUBST;
|
||||
Quote.New(2);
|
||||
i++;
|
||||
chNext = chNext2;
|
||||
} else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isalnum(chNext2)) {
|
||||
} else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isNonQuote(chNext2)) {
|
||||
if (chNext == 'q') state = SCE_PL_STRING_QQ;
|
||||
else if (chNext == 'x') state = SCE_PL_STRING_QX;
|
||||
else if (chNext == 'r') state = SCE_PL_STRING_QR;
|
||||
@@ -253,9 +300,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
i++;
|
||||
chNext = chNext2;
|
||||
Quote.New(1);
|
||||
} else if (ch == 'x' && (chNext == '=' || // repetition
|
||||
(chNext != '_' && !isalnum(chNext)) ||
|
||||
(isdigit(chPrev) && isdigit(chNext)))) {
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
} else {
|
||||
state = SCE_PL_WORD;
|
||||
preferRE = false;
|
||||
if ((!iswordchar(chNext) && chNext != '\'')
|
||||
|| (chNext == '.' && chNext2 == '.')) {
|
||||
// We need that if length of word == 1!
|
||||
@@ -265,10 +315,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
} else if (ch == '#') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_STRING;
|
||||
Quote.New(1);
|
||||
Quote.Open(ch);
|
||||
@@ -277,31 +325,32 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
// Archaic call
|
||||
styler.ColourTo(i, state);
|
||||
} else {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_CHARACTER;
|
||||
Quote.New(1);
|
||||
Quote.Open(ch);
|
||||
}
|
||||
} else if (ch == '`') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_BACKTICKS;
|
||||
Quote.New(1);
|
||||
Quote.Open(ch);
|
||||
} else if (ch == '$') {
|
||||
preferRE = false;
|
||||
styler.ColourTo(i - 1, state);
|
||||
if ((chNext == '{') || isspacechar(chNext)) {
|
||||
styler.ColourTo(i, SCE_PL_SCALAR);
|
||||
} else {
|
||||
state = SCE_PL_SCALAR;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
if (chNext == '`' && chNext2 == '`') {
|
||||
i += 2;
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} else {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
}
|
||||
}
|
||||
} else if (ch == '@') {
|
||||
preferRE = false;
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
|
||||
if (isalpha(chNext) || chNext == '#' || chNext == '$'
|
||||
|| chNext == '_' || chNext == '+') {
|
||||
state = SCE_PL_ARRAY;
|
||||
} else if (chNext != '{' && chNext != '[') {
|
||||
styler.ColourTo(i, SCE_PL_ARRAY);
|
||||
@@ -311,8 +360,6 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
styler.ColourTo(i, SCE_PL_ARRAY);
|
||||
}
|
||||
} else if (ch == '%') {
|
||||
preferRE = false;
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
|
||||
state = SCE_PL_HASH;
|
||||
} else if (chNext == '{') {
|
||||
@@ -321,56 +368,189 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
}
|
||||
} else if (ch == '*') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_SYMBOLTABLE;
|
||||
} else if (ch == '/' && preferRE) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_REGEX;
|
||||
Quote.New(1);
|
||||
Quote.Open(ch);
|
||||
if (isalpha(chNext) || chNext == '_' || chNext == '{') {
|
||||
state = SCE_PL_SYMBOLTABLE;
|
||||
} else {
|
||||
if (chNext == '*') { // exponentiation
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
}
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
}
|
||||
} else if (ch == '/') {
|
||||
// Explicit backward peeking to set a consistent preferRE for
|
||||
// any slash found, so no longer need to track preferRE state.
|
||||
// Find first previous significant lexed element and interpret.
|
||||
bool preferRE = false;
|
||||
unsigned int bk = (i > 0)? i - 1: 0;
|
||||
char bkch;
|
||||
styler.Flush();
|
||||
while ((bk > 0) && (styler.StyleAt(bk) == SCE_PL_DEFAULT ||
|
||||
styler.StyleAt(bk) == SCE_PL_COMMENTLINE)) {
|
||||
bk--;
|
||||
}
|
||||
if (bk == 0) {
|
||||
preferRE = true;
|
||||
} else {
|
||||
int bkstyle = styler.StyleAt(bk);
|
||||
switch(bkstyle) {
|
||||
case SCE_PL_OPERATOR:
|
||||
preferRE = true;
|
||||
bkch = styler.SafeGetCharAt(bk);
|
||||
if (bkch == ')' || bkch == ']') {
|
||||
preferRE = false;
|
||||
} else if (bkch == '}') {
|
||||
// backtrack further, count balanced brace pairs
|
||||
// if a brace pair found, see if it's a variable
|
||||
int braceCount = 1;
|
||||
while (--bk > 0) {
|
||||
bkstyle = styler.StyleAt(bk);
|
||||
if (bkstyle == SCE_PL_OPERATOR) {
|
||||
bkch = styler.SafeGetCharAt(bk);
|
||||
if (bkch == '}') {
|
||||
braceCount++;
|
||||
} else if (bkch == '{') {
|
||||
if (--braceCount == 0)
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bk == 0) {
|
||||
// at beginning, true
|
||||
} else if (braceCount == 0) {
|
||||
// balanced { found, check for variable
|
||||
bkstyle = styler.StyleAt(bk - 1);
|
||||
if (bkstyle == SCE_PL_SCALAR
|
||||
|| bkstyle == SCE_PL_ARRAY
|
||||
|| bkstyle == SCE_PL_HASH
|
||||
|| bkstyle == SCE_PL_SYMBOLTABLE) {
|
||||
preferRE = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
break;
|
||||
// other styles uses the default, preferRE=false
|
||||
case SCE_PL_IDENTIFIER:
|
||||
case SCE_PL_POD:
|
||||
case SCE_PL_WORD:
|
||||
case SCE_PL_HERE_Q:
|
||||
case SCE_PL_HERE_QQ:
|
||||
case SCE_PL_HERE_QX:
|
||||
preferRE = true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (preferRE) {
|
||||
state = SCE_PL_REGEX;
|
||||
Quote.New(1);
|
||||
Quote.Open(ch);
|
||||
} else {
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
}
|
||||
} else if (ch == '<' && chNext == '<') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_HERE_DELIM;
|
||||
HereDoc.State = 0;
|
||||
} else if (ch == '='
|
||||
} else if (ch == '=' // POD
|
||||
&& isalpha(chNext)
|
||||
&& (isEOLChar(chPrev))) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_POD;
|
||||
sookedpos = 0;
|
||||
sooked[sookedpos] = '\0';
|
||||
} else if (ch == '-'
|
||||
//sookedpos = 0;
|
||||
//sooked[sookedpos] = '\0';
|
||||
} else if (ch == '-' // file test operators
|
||||
&& isSingleCharOp(chNext)
|
||||
&& !isalnum((chNext2 = styler.SafeGetCharAt(i+2)))) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
styler.ColourTo(i + 1, SCE_PL_WORD);
|
||||
state = SCE_PL_DEFAULT;
|
||||
preferRE = false;
|
||||
i += 2;
|
||||
ch = chNext2;
|
||||
chNext = chNext2 = styler.SafeGetCharAt(i + 1);
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
} else if (isPerlOperator(ch)) {
|
||||
if (ch == ')' || ch == ']')
|
||||
preferRE = false;
|
||||
else
|
||||
preferRE = true;
|
||||
styler.ColourTo(i - 1, state);
|
||||
if (ch == '.' && chNext == '.') { // .. and ...
|
||||
i++;
|
||||
if (chNext2 == '.') { i++; }
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
} else {
|
||||
// keep colouring defaults to make restart easier
|
||||
styler.ColourTo(i, SCE_PL_DEFAULT);
|
||||
}
|
||||
} else if (state == SCE_PL_NUMBER) {
|
||||
if (ch == '.') {
|
||||
if (chNext == '.') {
|
||||
// double dot is always an operator
|
||||
goto numAtEnd;
|
||||
} else if (numState == PERLNUM_NON_DEC || numState == PERLNUM_FLOAT) {
|
||||
// non-decimal number or float exponent, consume next dot
|
||||
styler.ColourTo(i - 1, SCE_PL_NUMBER);
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
state = SCE_PL_DEFAULT;
|
||||
} else { // decimal or vectors allows dots
|
||||
dotCount++;
|
||||
if (numState == PERLNUM_DECIMAL) {
|
||||
if (dotCount > 1) {
|
||||
if (isdigit(chNext)) { // really a vector
|
||||
numState = PERLNUM_VECTOR;
|
||||
} else // number then dot
|
||||
goto numAtEnd;
|
||||
}
|
||||
} else { // vectors
|
||||
if (!isdigit(chNext)) // vector then dot
|
||||
goto numAtEnd;
|
||||
}
|
||||
}
|
||||
} else if (ch == '_' && numState == PERLNUM_DECIMAL) {
|
||||
if (!isdigit(chNext)) {
|
||||
goto numAtEnd;
|
||||
}
|
||||
} else if (isalnum(ch)) {
|
||||
if (numState == PERLNUM_VECTOR || numState == PERLNUM_V_VECTOR) {
|
||||
if (isalpha(ch)) {
|
||||
if (dotCount == 0) { // change to word
|
||||
state = SCE_PL_WORD;
|
||||
} else { // vector then word
|
||||
goto numAtEnd;
|
||||
}
|
||||
}
|
||||
} else if (numState == PERLNUM_DECIMAL) {
|
||||
if (ch == 'E' || ch == 'e') { // exponent
|
||||
numState = PERLNUM_FLOAT;
|
||||
if (chNext == '+' || chNext == '-') {
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
}
|
||||
} else if (!isdigit(ch)) { // number then word
|
||||
goto numAtEnd;
|
||||
}
|
||||
} else if (numState == PERLNUM_FLOAT) {
|
||||
if (!isdigit(ch)) { // float then word
|
||||
goto numAtEnd;
|
||||
}
|
||||
} else {// (numState == PERLNUM_NON_DEC)
|
||||
// allow alphanum for bin,hex,oct for now
|
||||
}
|
||||
} else {
|
||||
// complete current number or vector
|
||||
numAtEnd:
|
||||
styler.ColourTo(i - 1, actualNumStyle(numState));
|
||||
state = SCE_PL_DEFAULT;
|
||||
goto restartLexer;
|
||||
}
|
||||
} else if (state == SCE_PL_WORD) {
|
||||
if ((!iswordchar(chNext) && chNext != '\'')
|
||||
|| (chNext == '.' && chNext2 == '.')) {
|
||||
// ".." is always an operator if preceded by a SCE_PL_WORD.
|
||||
// Archaic Perl has quotes inside names
|
||||
if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")) {
|
||||
styler.ColourTo(i, SCE_PL_DATASECTION);
|
||||
state = SCE_PL_DATASECTION;
|
||||
} else if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__END__")) {
|
||||
if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")
|
||||
|| isMatch(styler, lengthDoc, styler.GetStartSegment(), "__END__")) {
|
||||
styler.ColourTo(i, SCE_PL_DATASECTION);
|
||||
state = SCE_PL_DATASECTION;
|
||||
} else {
|
||||
if (classifyWordPerl(styler.GetStartSegment(), i, keywords, styler) == SCE_PL_WORD)
|
||||
preferRE = true;
|
||||
classifyWordPerl(styler.GetStartSegment(), i, keywords, styler);
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = ' ';
|
||||
}
|
||||
@@ -380,6 +560,10 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (isEOLChar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
goto restartLexer;
|
||||
} else if (isEOLChar(chNext)) {
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_HERE_DELIM) {
|
||||
//
|
||||
@@ -398,9 +582,16 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
// There must be no space between the << and the identifier.
|
||||
// (If you put a space it will be treated as a null identifier,
|
||||
// which is valid, and matches the first empty line.)
|
||||
// (This is deprecated, -w warns of this syntax)
|
||||
// The terminating string must appear by itself (unquoted and with no
|
||||
// surrounding whitespace) on the terminating line.
|
||||
//
|
||||
// From Bash info:
|
||||
// ---------------
|
||||
// Specifier format is: <<[-]WORD
|
||||
// Optional '-' is for removal of leading tabs from here-doc.
|
||||
// Whitespace acceptable after <<[-] operator.
|
||||
//
|
||||
if (HereDoc.State == 0) { // '<<' encountered
|
||||
HereDoc.State = 1;
|
||||
HereDoc.Quote = chNext;
|
||||
@@ -412,15 +603,16 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
HereDoc.Quoted = true;
|
||||
} else if (chNext == '\\') { // ref?
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
} else if (isalnum(chNext) || chNext == '_') { // an unquoted here-doc delimiter
|
||||
}
|
||||
else if (isspacechar(chNext)) { // deprecated here-doc delimiter || TODO: left shift operator
|
||||
}
|
||||
else { // TODO: ???
|
||||
} else if (isalpha(chNext) || chNext == '_') {
|
||||
// an unquoted here-doc delimiter, no special handling
|
||||
} else if (isspacechar(chNext) || isdigit(chNext) || chNext == '\\'
|
||||
|| chNext == '=' || chNext == '$' || chNext == '@') {
|
||||
// left shift << or <<= operator cases
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
state = SCE_PL_DEFAULT;
|
||||
HereDoc.State = 0;
|
||||
} else {
|
||||
// symbols terminates; deprecated zero-length delimiter
|
||||
}
|
||||
|
||||
} else if (HereDoc.State == 1) { // collect the delimiter
|
||||
@@ -428,9 +620,6 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (ch == HereDoc.Quote) { // closing quote => end of delimiter
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
} else {
|
||||
if (ch == '\\' && chNext == HereDoc.Quote) { // escaped quote
|
||||
i++;
|
||||
@@ -447,24 +636,27 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
goto restartLexer;
|
||||
}
|
||||
}
|
||||
if (HereDoc.DelimiterLength >= static_cast<int>(sizeof(HereDoc.Delimiter)) - 1) {
|
||||
if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_ERROR;
|
||||
goto restartLexer;
|
||||
}
|
||||
}
|
||||
} else if (HereDoc.State == 2) {
|
||||
// state == SCE_PL_HERE_Q || state == SCE_PL_HERE_QQ || state == SCE_PL_HERE_QX
|
||||
if (isEOLChar(chPrev) && isMatch(styler, lengthDoc, i, HereDoc.Delimiter)) {
|
||||
i += HereDoc.DelimiterLength;
|
||||
chNext = styler.SafeGetCharAt(i);
|
||||
if (isEOLChar(chNext)) {
|
||||
chPrev = styler.SafeGetCharAt(i - 1);
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
if (isEOLChar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
HereDoc.State = 0;
|
||||
goto restartLexer;
|
||||
}
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
} else if (state == SCE_PL_POD) {
|
||||
@@ -474,33 +666,30 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
i += 4;
|
||||
state = SCE_PL_DEFAULT;
|
||||
ch = styler.SafeGetCharAt(i);
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
//chNext = styler.SafeGetCharAt(i + 1);
|
||||
goto restartLexer;
|
||||
}
|
||||
}
|
||||
} else if (state == SCE_PL_SCALAR) {
|
||||
if (isEndVar(ch)) {
|
||||
if (i == (styler.GetStartSegment() + 1)) {
|
||||
} else if (state == SCE_PL_SCALAR // variable names
|
||||
|| state == SCE_PL_ARRAY
|
||||
|| state == SCE_PL_HASH
|
||||
|| state == SCE_PL_SYMBOLTABLE) {
|
||||
if (ch == ':' && chNext == ':') { // skip ::
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = chNext2;
|
||||
}
|
||||
else if (isEndVar(ch)) {
|
||||
if ((state == SCE_PL_SCALAR || state == SCE_PL_ARRAY)
|
||||
&& i == (styler.GetStartSegment() + 1)) {
|
||||
// Special variable: $(, $_ etc.
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
} else {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
goto restartLexer;
|
||||
}
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_ARRAY) {
|
||||
if (isEndVar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_HASH) {
|
||||
if (isEndVar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_SYMBOLTABLE) {
|
||||
if (isEndVar(ch)) {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_PL_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_PL_REGEX
|
||||
|| state == SCE_PL_STRING_QR
|
||||
@@ -627,29 +816,6 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
Quote.Count++;
|
||||
}
|
||||
}
|
||||
|
||||
if (state == SCE_PL_DEFAULT) { // One of the above succeeded
|
||||
if (ch == '#') {
|
||||
state = SCE_PL_COMMENTLINE;
|
||||
} else if (ch == '\"') {
|
||||
state = SCE_PL_STRING;
|
||||
Quote.New(1);
|
||||
Quote.Open(ch);
|
||||
} else if (ch == '\'') {
|
||||
state = SCE_PL_CHARACTER;
|
||||
Quote.New(1);
|
||||
Quote.Open(ch);
|
||||
} else if (iswordstart(ch)) {
|
||||
state = SCE_PL_WORD;
|
||||
preferRE = false;
|
||||
} else if (isPerlOperator(ch)) {
|
||||
if (ch == ')' || ch == ']')
|
||||
preferRE = false;
|
||||
else
|
||||
preferRE = true;
|
||||
styler.ColourTo(i, SCE_PL_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (state == SCE_PL_ERROR) {
|
||||
break;
|
||||
|
@@ -96,6 +96,11 @@ static int GetRbStringState(Accessor &styler, int i, int *nextIndex) {
|
||||
return SCE_P_DEFAULT;
|
||||
}
|
||||
|
||||
if (i>0 && styler.SafeGetCharAt(i-1) == '$') {
|
||||
*nextIndex = i + 1;
|
||||
return SCE_P_DEFAULT;
|
||||
}
|
||||
|
||||
if (ch == chNext && ch == styler.SafeGetCharAt(i + 2)) {
|
||||
*nextIndex = i + 3;
|
||||
|
||||
|
@@ -88,7 +88,10 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
} else if (ch == '-' && chNext == '-') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if ((ch == '\'') || (ch == '"')) {
|
||||
} else if (ch == '\'') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_CHARACTER;
|
||||
} else if (ch == '"') {
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_STRING;
|
||||
} else if (isoperator(ch)) {
|
||||
@@ -103,7 +106,9 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '-' && chNext == '-') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if ((ch == '\'') || (ch == '"')) {
|
||||
} else if (ch == '\'') {
|
||||
state = SCE_C_CHARACTER;
|
||||
} else if (ch == '"') {
|
||||
state = SCE_C_STRING;
|
||||
} else if (isoperator(ch)) {
|
||||
styler.ColourTo(i, SCE_C_OPERATOR);
|
||||
@@ -123,7 +128,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_C_DEFAULT;
|
||||
}
|
||||
} else if (state == SCE_C_STRING) {
|
||||
} else if (state == SCE_C_CHARACTER) {
|
||||
if (ch == '\'') {
|
||||
if ( chNext == '\'' ) {
|
||||
i++;
|
||||
@@ -134,7 +139,9 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
}
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
} else if (ch == '"') {
|
||||
}
|
||||
} else if (state == SCE_C_STRING) {
|
||||
if (ch == '"') {
|
||||
if (chNext == '"') {
|
||||
i++;
|
||||
} else {
|
||||
@@ -151,7 +158,9 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
|
||||
state = SCE_C_COMMENT;
|
||||
} else if (ch == '-' && chNext == '-') {
|
||||
state = SCE_C_COMMENTLINE;
|
||||
} else if ((ch == '\'') || (ch == '"')) {
|
||||
} else if (ch == '\'') {
|
||||
state = SCE_C_CHARACTER;
|
||||
} else if (ch == '"') {
|
||||
state = SCE_C_STRING;
|
||||
} else if (iswordstart(ch)) {
|
||||
state = SCE_C_WORD;
|
||||
|
@@ -19,32 +19,31 @@
|
||||
|
||||
static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord)
|
||||
{
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]) != 0;
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
|
||||
{
|
||||
s[i] = styler[start + i];
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
char chAttr = SCE_P_IDENTIFIER;
|
||||
if (0 == strcmp(prevWord, "class")) chAttr = SCE_P_CLASSNAME;
|
||||
else if (wordIsNumber) chAttr = SCE_P_NUMBER;
|
||||
else if (keywords.InList(s)) chAttr = SCE_P_WORD;
|
||||
char s[100];
|
||||
bool wordIsNumber = isdigit(styler[start]) != 0;
|
||||
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
|
||||
{
|
||||
s[i] = styler[start + i];
|
||||
s[i + 1] = '\0';
|
||||
}
|
||||
char chAttr = SCE_SCRIPTOL_IDENTIFIER;
|
||||
if (0 == strcmp(prevWord, "class")) chAttr = SCE_SCRIPTOL_CLASSNAME;
|
||||
else if (wordIsNumber) chAttr = SCE_SCRIPTOL_NUMBER;
|
||||
else if (keywords.InList(s)) chAttr = SCE_SCRIPTOL_KEYWORD;
|
||||
else for (unsigned int i = 0; i < end - start + 1; i++) // test dotted idents
|
||||
{
|
||||
if (styler[start + i] == '.')
|
||||
if (styler[start + i] == '.')
|
||||
{
|
||||
styler.ColourTo(start + i - 1, chAttr);
|
||||
styler.ColourTo(start + i, SCE_P_OPERATOR);
|
||||
}
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
strcpy(prevWord, s);
|
||||
styler.ColourTo(start + i - 1, chAttr);
|
||||
styler.ColourTo(start + i, SCE_SCRIPTOL_OPERATOR);
|
||||
}
|
||||
}
|
||||
styler.ColourTo(end, chAttr);
|
||||
strcpy(prevWord, s);
|
||||
}
|
||||
|
||||
static bool IsSolComment(Accessor &styler, int pos, int len)
|
||||
{
|
||||
// return len > 0 && styler[pos]=='`';
|
||||
char c;
|
||||
if(len > 0)
|
||||
{
|
||||
@@ -63,60 +62,62 @@ static bool IsSolComment(Accessor &styler, int pos, int len)
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsSolStringStart(char ch, char /*chNext*/)
|
||||
static bool IsSolStringStart(char ch)
|
||||
{
|
||||
if (ch == '\'' || ch == '"') return true;
|
||||
//chNext = chNext; // for future use
|
||||
|
||||
return false;
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool IsSolWordStart(char ch, char chNext)
|
||||
static bool IsSolWordStart(char ch)
|
||||
{
|
||||
return (iswordchar(ch) && !IsSolStringStart(ch, chNext));
|
||||
return (iswordchar(ch) && !IsSolStringStart(ch));
|
||||
}
|
||||
|
||||
/* 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 GetSolStringState(Accessor &styler, int i, int *nextIndex)
|
||||
{
|
||||
char ch = styler.SafeGetCharAt(i);
|
||||
char chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if (ch != '"' && ch != '\'') {
|
||||
*nextIndex = i + 1;
|
||||
return SCE_P_DEFAULT;
|
||||
if (ch != '\"' && ch != '\'')
|
||||
{
|
||||
*nextIndex = i + 1;
|
||||
return SCE_SCRIPTOL_DEFAULT;
|
||||
}
|
||||
|
||||
// ch is either single or double quotes in string
|
||||
// code below seem non-sense but is here for future extensions
|
||||
if (ch == chNext && ch == styler.SafeGetCharAt(i + 2))
|
||||
{
|
||||
*nextIndex = i + 3;
|
||||
if (ch == '"') return SCE_P_TRIPLEDOUBLE;
|
||||
else return SCE_P_TRIPLE;
|
||||
{
|
||||
*nextIndex = i + 3;
|
||||
if(ch == '\"') return SCE_SCRIPTOL_TRIPLE;
|
||||
if(ch == '\'') return SCE_SCRIPTOL_TRIPLE;
|
||||
return SCE_SCRIPTOL_STRING;
|
||||
}
|
||||
else
|
||||
{
|
||||
*nextIndex = i + 1;
|
||||
if (ch == '"') return SCE_P_STRING;
|
||||
else return SCE_P_CHARACTER;
|
||||
else
|
||||
{
|
||||
*nextIndex = i + 1;
|
||||
if (ch == '"') return SCE_SCRIPTOL_STRING;
|
||||
else return SCE_SCRIPTOL_STRING;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler)
|
||||
WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
|
||||
int lengthDoc = startPos + length;
|
||||
char stringType = '\"';
|
||||
|
||||
// Backtrack to previous line in case need to fix its tab whinging
|
||||
if (startPos > 0)
|
||||
{
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
if (lineCurrent > 0)
|
||||
{
|
||||
startPos = styler.LineStart(lineCurrent-1);
|
||||
if (startPos == 0) initStyle = SCE_P_DEFAULT;
|
||||
else initStyle = styler.StyleAt(startPos-1);
|
||||
}
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
if (lineCurrent > 0)
|
||||
{
|
||||
startPos = styler.LineStart(lineCurrent-1);
|
||||
if (startPos == 0) initStyle = SCE_SCRIPTOL_DEFAULT;
|
||||
else initStyle = styler.StyleAt(startPos-1);
|
||||
}
|
||||
}
|
||||
|
||||
styler.StartAt(startPos, 127);
|
||||
@@ -126,241 +127,216 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
|
||||
char prevWord[200];
|
||||
prevWord[0] = '\0';
|
||||
if (length == 0) return ;
|
||||
if (length == 0) return;
|
||||
|
||||
int state = initStyle & 31;
|
||||
|
||||
int nextIndex = 0;
|
||||
char chPrev = ' ';
|
||||
//char chPrev2 = ' ';
|
||||
char chNext = styler[startPos];
|
||||
char chPrev = ' ';
|
||||
char chPrev2 = ' ';
|
||||
char chNext = styler[startPos];
|
||||
styler.StartSegment(startPos);
|
||||
bool atStartLine = true;
|
||||
int spaceFlags = 0;
|
||||
for (int i = startPos; i < lengthDoc; i++)
|
||||
{
|
||||
{
|
||||
|
||||
if (atStartLine)
|
||||
{
|
||||
if (atStartLine)
|
||||
{
|
||||
char chBad = static_cast<char>(64);
|
||||
char chGood = static_cast<char>(0);
|
||||
char chFlags = chGood;
|
||||
|
||||
if (whingeLevel == 1)
|
||||
{
|
||||
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
|
||||
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
|
||||
}
|
||||
else if (whingeLevel == 2)
|
||||
{
|
||||
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
|
||||
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
|
||||
}
|
||||
else if (whingeLevel == 3)
|
||||
{
|
||||
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
|
||||
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
|
||||
}
|
||||
else if (whingeLevel == 4)
|
||||
{
|
||||
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
||||
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
|
||||
}
|
||||
styler.SetFlags(chFlags, static_cast<char>(state));
|
||||
atStartLine = false;
|
||||
}
|
||||
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
|
||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc))
|
||||
{
|
||||
if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
}
|
||||
atStartLine = true;
|
||||
}
|
||||
|
||||
if (styler.IsLeadByte(ch))
|
||||
{
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
chPrev = ' ';
|
||||
//chPrev2 = ' ';
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == SCE_P_STRINGEOL)
|
||||
{
|
||||
if (ch != '\r' && ch != '\n')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc))
|
||||
{
|
||||
if ((state == SCE_SCRIPTOL_DEFAULT) ||
|
||||
(state == SCE_SCRIPTOL_TRIPLE) ||
|
||||
(state == SCE_SCRIPTOL_COMMENTBLOCK))
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
}
|
||||
atStartLine = true;
|
||||
}
|
||||
|
||||
if (state == SCE_P_DEFAULT)
|
||||
{
|
||||
if (IsSolWordStart(ch, chNext))
|
||||
if (styler.IsLeadByte(ch))
|
||||
{
|
||||
chNext = styler.SafeGetCharAt(i + 2);
|
||||
chPrev = ' ';
|
||||
chPrev2 = ' ';
|
||||
i += 1;
|
||||
continue;
|
||||
}
|
||||
|
||||
if (state == SCE_SCRIPTOL_STRINGEOL)
|
||||
{
|
||||
if (ch != '\r' && ch != '\n')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_SCRIPTOL_DEFAULT;
|
||||
}
|
||||
}
|
||||
|
||||
if (state == SCE_SCRIPTOL_DEFAULT)
|
||||
{
|
||||
if (IsSolWordStart(ch))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_WORD;
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_SCRIPTOL_KEYWORD;
|
||||
}
|
||||
else if (ch == '`')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_COMMENTLINE;
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_SCRIPTOL_COMMENTLINE;
|
||||
}
|
||||
else if (ch == '/')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
if(chNext == '/') state = SCE_P_COMMENTLINE;
|
||||
if(chNext == '*') state = SCE_P_COMMENTBLOCK;
|
||||
styler.ColourTo(i - 1, state);
|
||||
if(chNext == '/') state = SCE_SCRIPTOL_CSTYLE;
|
||||
if(chNext == '*') state = SCE_SCRIPTOL_COMMENTBLOCK;
|
||||
}
|
||||
|
||||
else if (ch == '=' && chNext == 'b')
|
||||
{
|
||||
// =begin indicates the start of a comment (doc) block
|
||||
if(styler.SafeGetCharAt(i + 2) == 'e' && styler.SafeGetCharAt(i + 3) == 'g' && styler.SafeGetCharAt(i + 4) == 'i' && styler.SafeGetCharAt(i + 5) == 'n')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_TRIPLEDOUBLE; //SCE_C_COMMENT;
|
||||
}
|
||||
}
|
||||
else if (IsSolStringStart(ch, chNext))
|
||||
else if (IsSolStringStart(ch))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = GetSolStringState(styler, i, &nextIndex);
|
||||
if(state == SCE_SCRIPTOL_STRING)
|
||||
{
|
||||
stringType = ch;
|
||||
}
|
||||
if (nextIndex != i + 1)
|
||||
{
|
||||
i = nextIndex - 1;
|
||||
ch = ' ';
|
||||
//chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
i = nextIndex - 1;
|
||||
ch = ' ';
|
||||
chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (isoperator(ch))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
||||
}
|
||||
styler.ColourTo(i - 1, state);
|
||||
styler.ColourTo(i, SCE_SCRIPTOL_OPERATOR);
|
||||
}
|
||||
}
|
||||
else if (state == SCE_P_WORD)
|
||||
else if (state == SCE_SCRIPTOL_KEYWORD)
|
||||
{
|
||||
if (!iswordchar(ch))
|
||||
{
|
||||
ClassifyWordSol(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
|
||||
state = SCE_P_DEFAULT;
|
||||
state = SCE_SCRIPTOL_DEFAULT;
|
||||
if (ch == '`')
|
||||
{
|
||||
state = chNext == '`' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
|
||||
state = chNext == '`' ? SCE_SCRIPTOL_PERSISTENT : SCE_SCRIPTOL_COMMENTLINE;
|
||||
}
|
||||
else if (IsSolStringStart(ch, chNext))
|
||||
else if (IsSolStringStart(ch))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = GetSolStringState(styler, i, &nextIndex);
|
||||
if (nextIndex != i + 1)
|
||||
if (nextIndex != i + 1)
|
||||
{
|
||||
i = nextIndex - 1;
|
||||
ch = ' ';
|
||||
//chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
i = nextIndex - 1;
|
||||
ch = ' ';
|
||||
chPrev = ' ';
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else if (isoperator(ch))
|
||||
{
|
||||
styler.ColourTo(i, SCE_P_OPERATOR);
|
||||
styler.ColourTo(i, SCE_SCRIPTOL_OPERATOR);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (state == SCE_P_COMMENTLINE)
|
||||
if (state == SCE_SCRIPTOL_COMMENTLINE ||
|
||||
state == SCE_SCRIPTOL_PERSISTENT ||
|
||||
state == SCE_SCRIPTOL_CSTYLE)
|
||||
{
|
||||
if (ch == '\r' || ch == '\n')
|
||||
if (ch == '\r' || ch == '\n')
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_SCRIPTOL_DEFAULT;
|
||||
}
|
||||
}
|
||||
else if(state == SCE_P_COMMENTBLOCK)
|
||||
else if(state == SCE_SCRIPTOL_COMMENTBLOCK)
|
||||
{
|
||||
if(ch == '*' && chNext == '/') state = SCE_P_DEFAULT;
|
||||
if(chPrev == '*' && ch == '/')
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_SCRIPTOL_DEFAULT;
|
||||
}
|
||||
}
|
||||
else if (state == SCE_P_STRING)
|
||||
else if ((state == SCE_SCRIPTOL_STRING) ||
|
||||
(state == SCE_SCRIPTOL_CHARACTER))
|
||||
{
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_STRINGEOL;
|
||||
}
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_SCRIPTOL_STRINGEOL;
|
||||
}
|
||||
else if (ch == '\\')
|
||||
{
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\')
|
||||
{
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else if (ch == '\"')
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
else if (state == SCE_P_CHARACTER)
|
||||
{
|
||||
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
|
||||
{
|
||||
styler.ColourTo(i - 1, state);
|
||||
state = SCE_P_STRINGEOL;
|
||||
}
|
||||
else if (ch == '\\')
|
||||
{
|
||||
if (chNext == '\"' || chNext == '\'' || chNext == '\\')
|
||||
{
|
||||
i++;
|
||||
ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
}
|
||||
}
|
||||
else if (ch == '\'')
|
||||
else if ((ch == '\"') || (ch == '\''))
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
/*
|
||||
else if (state == SCE_P_TRIPLE)
|
||||
// must match the entered quote type
|
||||
if(ch == stringType)
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_SCRIPTOL_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (state == SCE_SCRIPTOL_TRIPLE)
|
||||
{
|
||||
if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'')
|
||||
if ((ch == '\'' && chPrev == '\'' && chPrev2 == '\'') ||
|
||||
(ch == '\"' && chPrev == '\"' && chPrev2 == '\"'))
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
state = SCE_SCRIPTOL_DEFAULT;
|
||||
}
|
||||
}
|
||||
else if (state == SCE_P_TRIPLEDOUBLE)
|
||||
{
|
||||
// =end terminates the comment block
|
||||
if (ch == 'd' && chPrev == 'n' && chPrev2 == 'e')
|
||||
{
|
||||
if (styler.SafeGetCharAt(i - 3) == '=')
|
||||
{
|
||||
styler.ColourTo(i, state);
|
||||
state = SCE_P_DEFAULT;
|
||||
}
|
||||
}
|
||||
}
|
||||
*/
|
||||
}
|
||||
//chPrev2 = chPrev;
|
||||
chPrev = ch;
|
||||
}
|
||||
|
||||
}
|
||||
chPrev2 = chPrev;
|
||||
chPrev = ch;
|
||||
}
|
||||
if (state == SCE_P_WORD)
|
||||
{
|
||||
ClassifyWordSol(styler.GetStartSegment(), lengthDoc-1, keywords, styler, prevWord);
|
||||
if (state == SCE_SCRIPTOL_KEYWORD)
|
||||
{
|
||||
ClassifyWordSol(styler.GetStartSegment(),
|
||||
lengthDoc-1, keywords, styler, prevWord);
|
||||
}
|
||||
else
|
||||
{
|
||||
styler.ColourTo(lengthDoc-1, state);
|
||||
else
|
||||
{
|
||||
styler.ColourTo(lengthDoc-1, state);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -369,57 +345,58 @@ static void FoldSolDoc(unsigned int startPos, int length, int initStyle,
|
||||
{
|
||||
int lengthDoc = startPos + length;
|
||||
|
||||
// Backtrack to previous line in case need to fix its fold status
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
if (startPos > 0) {
|
||||
if (lineCurrent > 0)
|
||||
if (startPos > 0)
|
||||
{
|
||||
lineCurrent--;
|
||||
startPos = styler.LineStart(lineCurrent);
|
||||
if (startPos == 0)
|
||||
initStyle = SCE_P_DEFAULT;
|
||||
else
|
||||
initStyle = styler.StyleAt(startPos-1);
|
||||
}
|
||||
if (lineCurrent > 0)
|
||||
{
|
||||
lineCurrent--;
|
||||
startPos = styler.LineStart(lineCurrent);
|
||||
if (startPos == 0)
|
||||
initStyle = SCE_SCRIPTOL_DEFAULT;
|
||||
else
|
||||
initStyle = styler.StyleAt(startPos-1);
|
||||
}
|
||||
}
|
||||
int state = initStyle & 31;
|
||||
int spaceFlags = 0;
|
||||
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsSolComment);
|
||||
if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
|
||||
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
|
||||
if ((state == SCE_SCRIPTOL_TRIPLE))
|
||||
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
|
||||
char chNext = styler[startPos];
|
||||
for (int i = startPos; i < lengthDoc; i++)
|
||||
{
|
||||
{
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int style = styler.StyleAt(i) & 31;
|
||||
|
||||
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc))
|
||||
{
|
||||
int lev = indentCurrent;
|
||||
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsSolComment);
|
||||
if ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE))
|
||||
indentNext |= SC_FOLDLEVELWHITEFLAG;
|
||||
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG))
|
||||
{
|
||||
// Only non whitespace lines can be headers
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
|
||||
{
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
} else if (indentNext & SC_FOLDLEVELWHITEFLAG)
|
||||
{
|
||||
// Line after is blank so check the next - maybe should continue further?
|
||||
int spaceFlags2 = 0;
|
||||
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsSolComment);
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK))
|
||||
int lev = indentCurrent;
|
||||
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsSolComment);
|
||||
if (style == SCE_SCRIPTOL_TRIPLE)
|
||||
indentNext |= SC_FOLDLEVELWHITEFLAG;
|
||||
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG))
|
||||
{
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
indentCurrent = indentNext;
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
lineCurrent++;
|
||||
// Only non whitespace lines can be headers
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
|
||||
{
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
else if (indentNext & SC_FOLDLEVELWHITEFLAG)
|
||||
{
|
||||
// Line after is blank so check the next - maybe should continue further?
|
||||
int spaceFlags2 = 0;
|
||||
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsSolComment);
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK))
|
||||
{
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
}
|
||||
}
|
||||
indentCurrent = indentNext;
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
lineCurrent++;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
288
contrib/src/stc/scintilla/src/LexTeX.cxx
Normal file
288
contrib/src/stc/scintilla/src/LexTeX.cxx
Normal file
@@ -0,0 +1,288 @@
|
||||
// Scintilla source code edit control
|
||||
|
||||
// File: LexTeX.cxx - general context conformant tex coloring scheme
|
||||
// Author: Hans Hagen - PRAGMA ADE - Hasselt NL - www.pragma-ade.com
|
||||
// Version: September 28, 2003
|
||||
|
||||
// Copyright: 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
// This lexer is derived from the one written for the texwork environment (1999++) which in
|
||||
// turn is inspired on texedit (1991++) which finds its roots in wdt (1986).
|
||||
|
||||
// If you run into strange boundary cases, just tell me and I'll look into it.
|
||||
|
||||
#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"
|
||||
|
||||
// val SCE_TEX_DEFAULT = 0
|
||||
// val SCE_TEX_SPECIAL = 1
|
||||
// val SCE_TEX_GROUP = 2
|
||||
// val SCE_TEX_SYMBOL = 3
|
||||
// val SCE_TEX_COMMAND = 4
|
||||
// val SCE_TEX_TEXT = 5
|
||||
|
||||
// Definitions in SciTEGlobal.properties:
|
||||
//
|
||||
// TeX Highlighting
|
||||
//
|
||||
// # Default
|
||||
// style.tex.0=fore:#7F7F00
|
||||
// # Special
|
||||
// style.tex.1=fore:#007F7F
|
||||
// # Group
|
||||
// style.tex.2=fore:#880000
|
||||
// # Symbol
|
||||
// style.tex.3=fore:#7F7F00
|
||||
// # Command
|
||||
// style.tex.4=fore:#008800
|
||||
// # Text
|
||||
// style.tex.5=fore:#000000
|
||||
|
||||
// lexer.tex.interface.default=0
|
||||
// lexer.tex.comment.process=0
|
||||
|
||||
// todo: lexer.tex.auto.if
|
||||
|
||||
// Auxiliary functions:
|
||||
|
||||
static inline bool endOfLine(Accessor &styler, unsigned int i) {
|
||||
return
|
||||
(styler[i] == '\n') || ((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n')) ;
|
||||
}
|
||||
|
||||
static inline bool isTeXzero(int ch) {
|
||||
return
|
||||
(ch == '%') ;
|
||||
}
|
||||
|
||||
static inline bool isTeXone(int ch) {
|
||||
return
|
||||
(ch == '[') || (ch == ']') || (ch == '=') || (ch == '#') ||
|
||||
(ch == '(') || (ch == ')') || (ch == '<') || (ch == '>') ||
|
||||
(ch == '"') ;
|
||||
}
|
||||
|
||||
static inline bool isTeXtwo(int ch) {
|
||||
return
|
||||
(ch == '{') || (ch == '}') || (ch == '$') ;
|
||||
}
|
||||
|
||||
static inline bool isTeXthree(int ch) {
|
||||
return
|
||||
(ch == '~') || (ch == '^') || (ch == '_') || (ch == '&') ||
|
||||
(ch == '-') || (ch == '+') || (ch == '\"') || (ch == '`') ||
|
||||
(ch == '/') || (ch == '|') || (ch == '%') ;
|
||||
}
|
||||
|
||||
static inline bool isTeXfour(int ch) {
|
||||
return
|
||||
(ch == '\\') ;
|
||||
}
|
||||
|
||||
static inline bool isTeXfive(int ch) {
|
||||
return
|
||||
((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ||
|
||||
(ch == '@') || (ch == '!') || (ch == '?') ;
|
||||
}
|
||||
|
||||
static inline bool isTeXsix(int ch) {
|
||||
return
|
||||
(ch == ' ') ;
|
||||
}
|
||||
|
||||
static inline bool isTeXseven(int ch) {
|
||||
return
|
||||
(ch == '^') ;
|
||||
}
|
||||
|
||||
// Interface determination
|
||||
|
||||
static int CheckTeXInterface(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
Accessor &styler,
|
||||
int defaultInterface) {
|
||||
|
||||
char lineBuffer[1024] ;
|
||||
unsigned int linePos = 0 ;
|
||||
|
||||
// some day we can make something lexer.tex.mapping=(all,0)(nl,1)(en,2)...
|
||||
|
||||
if (styler.SafeGetCharAt(0) == '%') {
|
||||
for (unsigned int i = 0; i < startPos + length; i++) {
|
||||
lineBuffer[linePos++] = styler.SafeGetCharAt(i) ;
|
||||
if (endOfLine(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
lineBuffer[linePos] = '\0';
|
||||
if (strstr(lineBuffer, "interface=all")) {
|
||||
return 0 ;
|
||||
} else if (strstr(lineBuffer, "interface=tex")) {
|
||||
return 1 ;
|
||||
} else if (strstr(lineBuffer, "interface=nl")) {
|
||||
return 2 ;
|
||||
} else if (strstr(lineBuffer, "interface=en")) {
|
||||
return 3 ;
|
||||
} else if (strstr(lineBuffer, "interface=de")) {
|
||||
return 4 ;
|
||||
} else if (strstr(lineBuffer, "interface=cz")) {
|
||||
return 5 ;
|
||||
} else if (strstr(lineBuffer, "interface=it")) {
|
||||
return 6 ;
|
||||
} else if (strstr(lineBuffer, "interface=ro")) {
|
||||
return 7 ;
|
||||
} else if (strstr(lineBuffer, "interface=latex")) {
|
||||
// we will move latex cum suis up to 91+ when more keyword lists are supported
|
||||
return 8 ;
|
||||
} else if (styler.SafeGetCharAt(1) == 'D' && strstr(lineBuffer, "%D \\module")) {
|
||||
// better would be to limit the search to just one line
|
||||
return 3 ;
|
||||
} else {
|
||||
return defaultInterface ;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return defaultInterface ;
|
||||
}
|
||||
|
||||
static void ColouriseTeXDoc(
|
||||
unsigned int startPos,
|
||||
int length,
|
||||
int,
|
||||
WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
styler.StartAt(startPos) ;
|
||||
styler.StartSegment(startPos) ;
|
||||
|
||||
bool processComment = styler.GetPropertyInt("lexer.tex.comment.process", 0) == 1 ;
|
||||
bool useKeywords = styler.GetPropertyInt("lexer.tex.use.keywords", 1) == 1 ;
|
||||
bool autoIf = styler.GetPropertyInt("lexer.tex.auto.if", 1) == 1 ;
|
||||
int defaultInterface = styler.GetPropertyInt("lexer.tex.interface.default", 1) ;
|
||||
|
||||
char key[100] ;
|
||||
int k ;
|
||||
bool newifDone = false ;
|
||||
bool inComment = false ;
|
||||
|
||||
int currentInterface = CheckTeXInterface(startPos,length,styler,defaultInterface) ;
|
||||
|
||||
if (currentInterface == 0) {
|
||||
useKeywords = false ;
|
||||
currentInterface = 1 ;
|
||||
}
|
||||
|
||||
WordList &keywords = *keywordlists[currentInterface-1] ;
|
||||
|
||||
StyleContext sc(startPos, length, SCE_TEX_TEXT, styler);
|
||||
|
||||
bool going = sc.More() ; // needed because of a fuzzy end of file state
|
||||
|
||||
for (; going; sc.Forward()) {
|
||||
|
||||
if (! sc.More()) { going = false ; } // we need to go one behind the end of text
|
||||
|
||||
if (inComment) {
|
||||
if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_TEX_TEXT) ;
|
||||
newifDone = false ;
|
||||
inComment = false ;
|
||||
}
|
||||
} else {
|
||||
if (! isTeXfive(sc.ch)) {
|
||||
if (sc.state == SCE_TEX_COMMAND) {
|
||||
if (sc.LengthCurrent() == 1) { // \<noncstoken>
|
||||
if (isTeXseven(sc.ch) && isTeXseven(sc.chNext)) {
|
||||
sc.Forward(2) ; // \^^ and \^^<token>
|
||||
}
|
||||
sc.ForwardSetState(SCE_TEX_TEXT) ;
|
||||
} else {
|
||||
sc.GetCurrent(key, sizeof(key)-1) ;
|
||||
k = strlen(key) ;
|
||||
memmove(key,key+1,k) ; // shift left over escape token
|
||||
key[k] = '\0' ;
|
||||
k-- ;
|
||||
if (! keywords || ! useKeywords) {
|
||||
sc.SetState(SCE_TEX_COMMAND) ;
|
||||
newifDone = false ;
|
||||
} else if (k == 1) { //\<cstoken>
|
||||
sc.SetState(SCE_TEX_COMMAND) ;
|
||||
newifDone = false ;
|
||||
} else if (keywords.InList(key)) {
|
||||
sc.SetState(SCE_TEX_COMMAND) ;
|
||||
newifDone = autoIf && (strcmp(key,"newif") == 0) ;
|
||||
} else if (autoIf && ! newifDone && (key[0] == 'i') && (key[1] == 'f') && keywords.InList("if")) {
|
||||
sc.SetState(SCE_TEX_COMMAND) ;
|
||||
} else {
|
||||
sc.ChangeState(SCE_TEX_TEXT) ;
|
||||
sc.SetState(SCE_TEX_TEXT) ;
|
||||
newifDone = false ;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (isTeXzero(sc.ch)) {
|
||||
sc.SetState(SCE_TEX_SYMBOL) ;
|
||||
sc.ForwardSetState(SCE_TEX_DEFAULT) ;
|
||||
inComment = ! processComment ;
|
||||
newifDone = false ;
|
||||
} else if (isTeXseven(sc.ch) && isTeXseven(sc.chNext)) {
|
||||
sc.SetState(SCE_TEX_TEXT) ;
|
||||
sc.ForwardSetState(SCE_TEX_TEXT) ;
|
||||
} else if (isTeXone(sc.ch)) {
|
||||
sc.SetState(SCE_TEX_SPECIAL) ;
|
||||
newifDone = false ;
|
||||
} else if (isTeXtwo(sc.ch)) {
|
||||
sc.SetState(SCE_TEX_GROUP) ;
|
||||
newifDone = false ;
|
||||
} else if (isTeXthree(sc.ch)) {
|
||||
sc.SetState(SCE_TEX_SYMBOL) ;
|
||||
newifDone = false ;
|
||||
} else if (isTeXfour(sc.ch)) {
|
||||
sc.SetState(SCE_TEX_COMMAND) ;
|
||||
} else if (isTeXsix(sc.ch)) {
|
||||
sc.SetState(SCE_TEX_TEXT) ;
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_TEX_TEXT) ;
|
||||
newifDone = false ;
|
||||
inComment = false ;
|
||||
} else {
|
||||
sc.SetState(SCE_TEX_TEXT) ;
|
||||
}
|
||||
} else if (sc.state != SCE_TEX_COMMAND) {
|
||||
sc.SetState(SCE_TEX_TEXT) ;
|
||||
}
|
||||
}
|
||||
}
|
||||
sc.ChangeState(SCE_TEX_TEXT) ;
|
||||
sc.Complete();
|
||||
|
||||
}
|
||||
|
||||
|
||||
// Hooks into the system:
|
||||
|
||||
static const char * const texWordListDesc[] = {
|
||||
"TeX, eTeX, pdfTeX, Omega"
|
||||
"ConTeXt Dutch",
|
||||
"ConTeXt English",
|
||||
"ConTeXt German",
|
||||
"ConTeXt Czech",
|
||||
"ConTeXt Italian",
|
||||
"ConTeXt Romanian",
|
||||
0,
|
||||
} ;
|
||||
|
||||
LexerModule lmTeX(SCLEX_TEX, ColouriseTeXDoc, "tex", 0, texWordListDesc);
|
@@ -2,7 +2,7 @@
|
||||
/** @file LexVB.cxx
|
||||
** Lexer for Visual Basic and VBScript.
|
||||
**/
|
||||
// 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.
|
||||
|
||||
#include <stdlib.h>
|
||||
@@ -24,16 +24,19 @@ static bool IsVBComment(Accessor &styler, int pos, int len) {
|
||||
return len>0 && styler[pos]=='\'';
|
||||
}
|
||||
|
||||
static inline bool IsTypeCharacter(const int ch) {
|
||||
static inline bool IsTypeCharacter(int ch) {
|
||||
return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$';
|
||||
}
|
||||
|
||||
static inline bool IsAWordChar(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
|
||||
// Extended to accept accented characters
|
||||
static inline bool IsAWordChar(int ch) {
|
||||
return ch >= 0x80 ||
|
||||
(isalnum(ch) || ch == '.' || ch == '_');
|
||||
}
|
||||
|
||||
static inline bool IsAWordStart(const int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
static inline bool IsAWordStart(int ch) {
|
||||
return ch >= 0x80 ||
|
||||
(isalnum(ch) || ch == '_');
|
||||
}
|
||||
|
||||
static inline bool IsADateCharacter(const int ch) {
|
||||
@@ -45,6 +48,9 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler, bool vbScriptSyntax) {
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
WordList &keywords3 = *keywordlists[2];
|
||||
WordList &keywords4 = *keywordlists[3];
|
||||
|
||||
styler.StartAt(startPos);
|
||||
|
||||
@@ -56,26 +62,37 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
|
||||
|
||||
if (sc.state == SCE_B_OPERATOR) {
|
||||
sc.SetState(SCE_B_DEFAULT);
|
||||
} else if (sc.state == SCE_B_KEYWORD) {
|
||||
} else if (sc.state == SCE_B_IDENTIFIER) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
if (vbScriptSyntax || !IsTypeCharacter(sc.ch)) {
|
||||
if (sc.ch == ']')
|
||||
sc.Forward();
|
||||
char s[100];
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
// 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)) {
|
||||
if (strcmp(s, "rem") == 0) {
|
||||
sc.ChangeState(SCE_B_COMMENT);
|
||||
if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_B_DEFAULT);
|
||||
}
|
||||
} else {
|
||||
sc.SetState(SCE_B_DEFAULT);
|
||||
}
|
||||
} else {
|
||||
sc.ChangeState(SCE_B_IDENTIFIER);
|
||||
sc.SetState(SCE_B_DEFAULT);
|
||||
}
|
||||
sc.ChangeState(SCE_B_KEYWORD);
|
||||
} else if (keywords2.InList(s)) {
|
||||
sc.ChangeState(SCE_B_KEYWORD2);
|
||||
} else if (keywords3.InList(s)) {
|
||||
sc.ChangeState(SCE_B_KEYWORD3);
|
||||
} else if (keywords4.InList(s)) {
|
||||
sc.ChangeState(SCE_B_KEYWORD4);
|
||||
} // Else, it is really an identifier...
|
||||
sc.SetState(SCE_B_DEFAULT);
|
||||
}
|
||||
}
|
||||
} else if (sc.state == SCE_B_NUMBER) {
|
||||
@@ -90,6 +107,9 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Forward();
|
||||
}
|
||||
sc.ForwardSetState(SCE_B_DEFAULT);
|
||||
} else if (sc.atLineEnd) {
|
||||
sc.ChangeState(SCE_B_STRINGEOL);
|
||||
sc.ForwardSetState(SCE_B_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_B_COMMENT) {
|
||||
if (sc.atLineEnd) {
|
||||
@@ -132,7 +152,7 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
sc.SetState(SCE_B_NUMBER);
|
||||
} else if (IsAWordStart(sc.ch) || (sc.ch == '[')) {
|
||||
sc.SetState(SCE_B_KEYWORD);
|
||||
sc.SetState(SCE_B_IDENTIFIER);
|
||||
} else if (isoperator(static_cast<char>(sc.ch)) || (sc.ch == '\\')) {
|
||||
sc.SetState(SCE_B_OPERATOR);
|
||||
}
|
||||
@@ -202,6 +222,9 @@ static void ColouriseVBScriptDoc(unsigned int startPos, int length, int initStyl
|
||||
|
||||
static const char * const vbWordListDesc[] = {
|
||||
"Keywords",
|
||||
"user1",
|
||||
"user2",
|
||||
"user3",
|
||||
0
|
||||
};
|
||||
|
||||
|
305
contrib/src/stc/scintilla/src/LexYAML.cxx
Normal file
305
contrib/src/stc/scintilla/src/LexYAML.cxx
Normal file
@@ -0,0 +1,305 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexYAML.cxx
|
||||
** Lexer for YAML.
|
||||
**/
|
||||
// Copyright 2003- by Sean O'Dell <sean@celsoft.com>
|
||||
// Release under the same license as Scintilla/SciTE.
|
||||
|
||||
#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"
|
||||
|
||||
static const char * const yamlWordListDesc[] = {
|
||||
"Keywords",
|
||||
0
|
||||
};
|
||||
|
||||
static inline bool AtEOL(Accessor &styler, unsigned int i) {
|
||||
return (styler[i] == '\n') ||
|
||||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
|
||||
}
|
||||
|
||||
static unsigned int SpaceCount(char* lineBuffer) {
|
||||
if (lineBuffer == NULL)
|
||||
return 0;
|
||||
|
||||
char* headBuffer = lineBuffer;
|
||||
|
||||
while (*headBuffer == ' ')
|
||||
headBuffer++;
|
||||
|
||||
return headBuffer - lineBuffer;
|
||||
}
|
||||
|
||||
#define YAML_STATE_BITSIZE 16
|
||||
#define YAML_STATE_MASK (0xFFFF0000)
|
||||
#define YAML_STATE_DOCUMENT (1 << YAML_STATE_BITSIZE)
|
||||
#define YAML_STATE_VALUE (2 << YAML_STATE_BITSIZE)
|
||||
#define YAML_STATE_COMMENT (3 << YAML_STATE_BITSIZE)
|
||||
#define YAML_STATE_TEXT_PARENT (4 << YAML_STATE_BITSIZE)
|
||||
#define YAML_STATE_TEXT (5 << YAML_STATE_BITSIZE)
|
||||
|
||||
static void ColouriseYAMLLine(
|
||||
char *lineBuffer,
|
||||
unsigned int currentLine,
|
||||
unsigned int lengthLine,
|
||||
unsigned int startLine,
|
||||
unsigned int endPos,
|
||||
WordList &keywords,
|
||||
Accessor &styler) {
|
||||
|
||||
unsigned int i = 0;
|
||||
bool bInQuotes = false;
|
||||
unsigned int indentAmount = SpaceCount(lineBuffer);
|
||||
|
||||
if (currentLine > 0) {
|
||||
int parentLineState = styler.GetLineState(currentLine - 1);
|
||||
|
||||
if ((parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT || (parentLineState&YAML_STATE_MASK) == YAML_STATE_TEXT_PARENT) {
|
||||
unsigned int parentIndentAmount = parentLineState&(~YAML_STATE_MASK);
|
||||
if (indentAmount > parentIndentAmount) {
|
||||
styler.SetLineState(currentLine, YAML_STATE_TEXT | parentIndentAmount);
|
||||
styler.ColourTo(endPos, SCE_YAML_TEXT);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
styler.SetLineState(currentLine, 0);
|
||||
if (strncmp(lineBuffer, "---", 3) == 0) { // Document marker
|
||||
styler.SetLineState(currentLine, YAML_STATE_DOCUMENT);
|
||||
styler.ColourTo(endPos, SCE_YAML_DOCUMENT);
|
||||
return;
|
||||
}
|
||||
// Skip initial spaces
|
||||
while ((i < lengthLine) && lineBuffer[i] == ' ') { // YAML always uses space, never TABS or anything else
|
||||
i++;
|
||||
}
|
||||
if (lineBuffer[i] == '\t') { // if we skipped all spaces, and we are NOT inside a text block, this is wrong
|
||||
styler.ColourTo(endPos, SCE_YAML_ERROR);
|
||||
return;
|
||||
}
|
||||
if (lineBuffer[i] == '#') { // Comment
|
||||
styler.SetLineState(currentLine, YAML_STATE_COMMENT);
|
||||
styler.ColourTo(endPos, SCE_YAML_COMMENT);
|
||||
return;
|
||||
}
|
||||
while (i < lengthLine) {
|
||||
if (lineBuffer[i] == '\'' || lineBuffer[i] == '\"') {
|
||||
bInQuotes = !bInQuotes;
|
||||
} else if (lineBuffer[i] == ':' && !bInQuotes) {
|
||||
styler.ColourTo(startLine + i, SCE_YAML_IDENTIFIER);
|
||||
// Non-folding scalar
|
||||
i++;
|
||||
while ((i < lengthLine) && isspacechar(lineBuffer[i]))
|
||||
i++;
|
||||
unsigned int endValue = lengthLine - 1;
|
||||
while ((endValue >= i) && isspacechar(lineBuffer[endValue]))
|
||||
endValue--;
|
||||
lineBuffer[endValue + 1] = '\0';
|
||||
if (lineBuffer[i] == '|' || lineBuffer[i] == '>') {
|
||||
i++;
|
||||
if (lineBuffer[i] == '+' || lineBuffer[i] == '-')
|
||||
i++;
|
||||
while ((i < lengthLine) && isspacechar(lineBuffer[i]))
|
||||
i++;
|
||||
if (lineBuffer[i] == '\0') {
|
||||
styler.SetLineState(currentLine, YAML_STATE_TEXT_PARENT | indentAmount);
|
||||
styler.ColourTo(endPos, SCE_YAML_DEFAULT);
|
||||
return;
|
||||
} else if (lineBuffer[i] == '#') {
|
||||
styler.SetLineState(currentLine, YAML_STATE_TEXT_PARENT | indentAmount);
|
||||
styler.ColourTo(startLine + i - 1, SCE_YAML_DEFAULT);
|
||||
styler.ColourTo(endPos, SCE_YAML_COMMENT);
|
||||
return;
|
||||
} else {
|
||||
styler.ColourTo(endPos, SCE_YAML_ERROR);
|
||||
return;
|
||||
}
|
||||
}
|
||||
styler.SetLineState(currentLine, YAML_STATE_VALUE);
|
||||
if (lineBuffer[i] == '&' || lineBuffer[i] == '*') {
|
||||
styler.ColourTo(endPos, SCE_YAML_REFERENCE);
|
||||
return;
|
||||
}
|
||||
if (keywords.InList(&lineBuffer[i])) { // Convertible value (true/false, etc.)
|
||||
styler.ColourTo(endPos, SCE_YAML_KEYWORD);
|
||||
return;
|
||||
} else {
|
||||
unsigned int i2 = i;
|
||||
while ((i < lengthLine) && lineBuffer[i]) {
|
||||
if (!isdigit(lineBuffer[i]) && lineBuffer[i] != '-' && lineBuffer[i] != '.' && lineBuffer[i] != ',') {
|
||||
styler.ColourTo(endPos, SCE_YAML_DEFAULT);
|
||||
return;
|
||||
}
|
||||
i++;
|
||||
}
|
||||
if (i > i2) {
|
||||
styler.ColourTo(endPos, SCE_YAML_NUMBER);
|
||||
return;
|
||||
}
|
||||
}
|
||||
break; // shouldn't get here, but just in case, the rest of the line is coloured the default
|
||||
}
|
||||
i++;
|
||||
}
|
||||
styler.ColourTo(endPos, SCE_YAML_DEFAULT);
|
||||
}
|
||||
|
||||
static void ColouriseYAMLDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
|
||||
char lineBuffer[1024];
|
||||
styler.StartAt(startPos);
|
||||
styler.StartSegment(startPos);
|
||||
unsigned int linePos = 0;
|
||||
unsigned int startLine = startPos;
|
||||
unsigned int endPos = startPos + length;
|
||||
unsigned int maxPos = styler.Length();
|
||||
unsigned int lineCurrent = styler.GetLine(startPos);
|
||||
|
||||
for (unsigned int i = startPos; i < maxPos && i < endPos; i++) {
|
||||
lineBuffer[linePos++] = styler[i];
|
||||
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
|
||||
// End of line (or of line buffer) met, colourise it
|
||||
lineBuffer[linePos] = '\0';
|
||||
ColouriseYAMLLine(lineBuffer, lineCurrent, linePos, startLine, i, *keywordLists[0], styler);
|
||||
linePos = 0;
|
||||
startLine = i + 1;
|
||||
lineCurrent++;
|
||||
}
|
||||
}
|
||||
if (linePos > 0) { // Last line does not have ending characters
|
||||
ColouriseYAMLLine(lineBuffer, lineCurrent, linePos, startLine, startPos + length - 1, *keywordLists[0], styler);
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsCommentLine(int line, Accessor &styler) {
|
||||
int pos = styler.LineStart(line);
|
||||
if (styler[pos] == '#')
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static void FoldYAMLDoc(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.yaml") != 0;
|
||||
|
||||
// Backtrack to previous non-blank line so we can determine indent level
|
||||
// for any white space lines
|
||||
// and so we can fix any preceding fold level (which is why we go back
|
||||
// at least one line in all cases)
|
||||
int spaceFlags = 0;
|
||||
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)))
|
||||
break;
|
||||
}
|
||||
int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
||||
|
||||
// Set up initial loop state
|
||||
int prevComment = 0;
|
||||
if (lineCurrent >= 1)
|
||||
prevComment = foldComment && IsCommentLine(lineCurrent - 1, styler);
|
||||
|
||||
// Process all characters to end of requested range
|
||||
// or comment that hangs over the end of the range. Cap processing in all cases
|
||||
// to end of document (in case of unclosed comment at end).
|
||||
while ((lineCurrent <= docLines) && ((lineCurrent <= maxLines) || prevComment)) {
|
||||
|
||||
// Gather info
|
||||
int lev = indentCurrent;
|
||||
int lineNext = lineCurrent + 1;
|
||||
int indentNext = indentCurrent;
|
||||
if (lineNext <= docLines) {
|
||||
// Information about next line is only available if not at end of document
|
||||
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
||||
}
|
||||
const int comment = foldComment && IsCommentLine(lineCurrent, styler);
|
||||
const int comment_start = (comment && !prevComment && (lineNext <= docLines) &&
|
||||
IsCommentLine(lineNext, styler) && (lev > SC_FOLDLEVELBASE));
|
||||
const int comment_continue = (comment && prevComment);
|
||||
if (!comment)
|
||||
indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK;
|
||||
if (indentNext & SC_FOLDLEVELWHITEFLAG)
|
||||
indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel;
|
||||
|
||||
if (comment_start) {
|
||||
// Place fold point at start of a block of comments
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
} else if (comment_continue) {
|
||||
// Add level to rest of lines in the block
|
||||
lev = lev + 1;
|
||||
}
|
||||
|
||||
// Skip past any blank lines for next indent level info; we skip also
|
||||
// comments (all comments, not just those starting in column 0)
|
||||
// which effectively folds them into surrounding code rather
|
||||
// than screwing up folding.
|
||||
|
||||
while ((lineNext < docLines) &&
|
||||
((indentNext & SC_FOLDLEVELWHITEFLAG) ||
|
||||
(lineNext <= docLines && IsCommentLine(lineNext, styler)))) {
|
||||
|
||||
lineNext++;
|
||||
indentNext = styler.IndentAmount(lineNext, &spaceFlags, NULL);
|
||||
}
|
||||
|
||||
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
|
||||
const int levelBeforeComments = 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-comment line
|
||||
if (!comment && !(indentCurrent & SC_FOLDLEVELWHITEFLAG) ) {
|
||||
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
}
|
||||
|
||||
// Keep track of block comment state of previous line
|
||||
prevComment = comment_start || comment_continue;
|
||||
|
||||
// Set fold level for this line and move to next line
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
indentCurrent = indentNext;
|
||||
lineCurrent = lineNext;
|
||||
}
|
||||
|
||||
// NOTE: Cannot set level of last line here because indentCurrent doesn't have
|
||||
// header flag set; the loop above is crafted to take care of this case!
|
||||
//styler.SetLevel(lineCurrent, indentCurrent);
|
||||
}
|
||||
|
||||
LexerModule lmYAML(SCLEX_YAML, ColouriseYAMLDoc, "yaml", FoldYAMLDoc, yamlWordListDesc);
|
@@ -562,7 +562,7 @@ bool WordList::InList(const char *s) {
|
||||
* The length of the word to compare is passed too.
|
||||
* Letter case can be ignored or preserved (default).
|
||||
*/
|
||||
const char *WordList::GetNearestWord(const char *wordStart, int searchLen /*= -1*/, bool ignoreCase /*= false*/, SString wordCharacters /*='/0' */) {
|
||||
const char *WordList::GetNearestWord(const char *wordStart, int searchLen /*= -1*/, bool ignoreCase /*= false*/, SString wordCharacters /*='/0' */, int wordIndex /*= -1 */) {
|
||||
int start = 0; // lower bound of the api array block to search
|
||||
int end = len - 1; // upper bound of the api array block to search
|
||||
int pivot; // index of api array element just being compared
|
||||
@@ -580,8 +580,33 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen /*= -1
|
||||
pivot = (start + end) >> 1;
|
||||
word = wordsNoCase[pivot];
|
||||
cond = CompareNCaseInsensitive(wordStart, word, searchLen);
|
||||
if (!cond && (!wordCharacters.contains(word[searchLen])))
|
||||
if (!cond && (!wordCharacters.contains(word[searchLen]))) {
|
||||
// Found a word in a binary fashion. Now checks if a specific index was requested
|
||||
if (wordIndex < 0)
|
||||
return word; // result must not be freed with free()
|
||||
|
||||
// Finds first word in a series of equal words
|
||||
int first = pivot;
|
||||
end = pivot - 1;
|
||||
while (start <= end) {
|
||||
pivot = (start + end) >> 1;
|
||||
word = wordsNoCase[pivot];
|
||||
cond = CompareNCaseInsensitive(wordStart, word, searchLen);
|
||||
if (!cond && (!wordCharacters.contains(word[searchLen]))) {
|
||||
// Found another word
|
||||
first = pivot;
|
||||
end = pivot - 1;
|
||||
}
|
||||
else if (cond > 0)
|
||||
start = pivot + 1;
|
||||
else if (cond <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
// Gets the word at the requested index
|
||||
word = wordsNoCase[first + wordIndex];
|
||||
return word;
|
||||
}
|
||||
else if (cond > 0)
|
||||
start = pivot + 1;
|
||||
else if (cond <= 0)
|
||||
@@ -592,8 +617,33 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen /*= -1
|
||||
pivot = (start + end) >> 1;
|
||||
word = words[pivot];
|
||||
cond = strncmp(wordStart, word, searchLen);
|
||||
if (!cond && (!wordCharacters.contains(word[searchLen])))
|
||||
return word; // result must not be freed with free()
|
||||
if (!cond && (!wordCharacters.contains(word[searchLen]))) {
|
||||
// Found a word in a binary fashion. Now checks if a specific index was requested
|
||||
if (wordIndex < 0)
|
||||
return word; // result must not be freed with free()
|
||||
|
||||
// Finds first word in a series of equal words
|
||||
int first = pivot;
|
||||
end = pivot - 1;
|
||||
while (start <= end) {
|
||||
pivot = (start + end) >> 1;
|
||||
word = words[pivot];
|
||||
cond = strncmp(wordStart, word, searchLen);
|
||||
if (!cond && (!wordCharacters.contains(word[searchLen]))) {
|
||||
// Found another word
|
||||
first = pivot;
|
||||
end = pivot - 1;
|
||||
}
|
||||
else if (cond > 0)
|
||||
start = pivot + 1;
|
||||
else if (cond <= 0)
|
||||
break;
|
||||
}
|
||||
|
||||
// Gets the word at the requested index
|
||||
word = words[first + wordIndex];
|
||||
return word;
|
||||
}
|
||||
else if (cond > 0)
|
||||
start = pivot + 1;
|
||||
else if (cond <= 0)
|
||||
|
@@ -10,11 +10,11 @@
|
||||
* Dept. of Computer Science
|
||||
* York University
|
||||
*
|
||||
* Original code available from http://www.cs.yorku.ca/~oz/
|
||||
* Original code available from http://www.cs.yorku.ca/~oz/
|
||||
* Translation to C++ by Neil Hodgson neilh@scintilla.org
|
||||
* Removed all use of register.
|
||||
* Converted to modern function prototypes.
|
||||
* Put all global/static variables into an object so this code can be
|
||||
* Put all global/static variables into an object so this code can be
|
||||
* used from multiple threads etc.
|
||||
*
|
||||
* These routines are the PUBLIC DOMAIN equivalents of regex
|
||||
@@ -27,74 +27,8 @@
|
||||
* see Henry Spencer's regexp routines, or GNU Emacs pattern
|
||||
* matching module.
|
||||
*
|
||||
* Modification history:
|
||||
* Modification history removed.
|
||||
*
|
||||
* $Log$
|
||||
* Revision 1.8 2003/09/18 05:05:38 RD
|
||||
* Updated to Scintilla 1.54
|
||||
* Applied most of patch #806092
|
||||
* Added new wxSTC sample from Otto Wyss
|
||||
*
|
||||
* Revision 1.9 2003/03/21 10:36:08 nyamatongwe
|
||||
* Detect patterns too long in regular expression search.
|
||||
*
|
||||
* Revision 1.8 2003/03/04 10:53:59 nyamatongwe
|
||||
* Patch from Jakub to optionally implement more POSIX compatible regular
|
||||
* expressions. \(..\) changes to (..)
|
||||
* Fixes problem where find previous would not find earlier matches on same
|
||||
* line.
|
||||
*
|
||||
* Revision 1.8 2003/03/03 20:12:56 vrana
|
||||
* Added posix syntax.
|
||||
*
|
||||
* Revision 1.7 2002/09/28 00:33:28 nyamatongwe
|
||||
* Fixed problem with character ranges caused by expansion to 8 bits.
|
||||
*
|
||||
* Revision 1.6 2001/04/29 13:32:10 nyamatongwe
|
||||
* Addition of new target methods - versions of ReplaceTarget that take counted
|
||||
* strings to allow for nulls, SearchInTarget and Get/SetSearchFlags to use a
|
||||
* series of calls rather than a structure.
|
||||
* Handling of \000 in search and replace.
|
||||
* Handling of /escapes within character ranges of regular expressions.
|
||||
* Some handling of bare ^ and $ regular expressions.
|
||||
*
|
||||
* Revision 1.5 2001/04/20 07:36:09 nyamatongwe
|
||||
* Removed DEBUG code that failed to compile on GTK+.
|
||||
*
|
||||
* Revision 1.4 2001/04/13 03:52:13 nyamatongwe
|
||||
* Added URL to find original code to comments.
|
||||
*
|
||||
* Revision 1.3 2001/04/06 12:24:21 nyamatongwe
|
||||
* Made regular expression searching work on a line by line basis, made ^ and
|
||||
* $ work, made [set] work, and added a case insensitive option.
|
||||
*
|
||||
* Revision 1.2 2001/04/05 01:58:04 nyamatongwe
|
||||
* Replace target functionality to make find and replace operations faster
|
||||
* by diminishing screen updates and allow for \d patterns in the replacement
|
||||
* text.
|
||||
*
|
||||
* Revision 1.1 2001/04/04 12:52:44 nyamatongwe
|
||||
* Moved to public domain regular expresion implementation.
|
||||
*
|
||||
* Revision 1.4 1991/10/17 03:56:42 oz
|
||||
* miscellaneous changes, small cleanups etc.
|
||||
*
|
||||
* Revision 1.3 1989/04/01 14:18:09 oz
|
||||
* Change all references to a dfa: this is actually an nfa.
|
||||
*
|
||||
* Revision 1.2 88/08/28 15:36:04 oz
|
||||
* Use a complement bitmap to represent NCL.
|
||||
* This removes the need to have seperate
|
||||
* code in the PMatch case block - it is
|
||||
* just CCL code now.
|
||||
*
|
||||
* Use the actual CCL code in the CLO
|
||||
* section of PMatch. No need for a recursive
|
||||
* PMatch call.
|
||||
*
|
||||
* Use a bitmap table to set char bits in an
|
||||
* 8-bit chunk.
|
||||
*
|
||||
* Interfaces:
|
||||
* RESearch::Compile: compile a regular expression into a NFA.
|
||||
*
|
||||
@@ -124,7 +58,7 @@
|
||||
* void re_fail(msg, op)
|
||||
* char *msg;
|
||||
* char op;
|
||||
*
|
||||
*
|
||||
* Regular Expressions:
|
||||
*
|
||||
* [1] char matches itself, unless it is a special
|
||||
@@ -134,20 +68,20 @@
|
||||
*
|
||||
* [3] \ matches the character following it, except
|
||||
* when followed by a left or right round bracket,
|
||||
* a digit 1 to 9 or a left or right angle bracket.
|
||||
* a digit 1 to 9 or a left or right angle bracket.
|
||||
* (see [7], [8] and [9])
|
||||
* It is used as an escape character for all
|
||||
* It is used as an escape character for all
|
||||
* other meta-characters, and itself. When used
|
||||
* in a set ([4]), it is treated as an ordinary
|
||||
* character.
|
||||
*
|
||||
* [4] [set] matches one of the characters in the set.
|
||||
* If the first character in the set is "^",
|
||||
* it matches a character NOT in the set, i.e.
|
||||
* complements the set. A shorthand S-E is
|
||||
* used to specify a set of characters S upto
|
||||
* E, inclusive. The special characters "]" and
|
||||
* "-" have no special meaning if they appear
|
||||
* it matches a character NOT in the set, i.e.
|
||||
* complements the set. A shorthand S-E is
|
||||
* used to specify a set of characters S upto
|
||||
* E, inclusive. The special characters "]" and
|
||||
* "-" have no special meaning if they appear
|
||||
* as the first chars in the set.
|
||||
* examples: match:
|
||||
*
|
||||
@@ -212,8 +146,8 @@
|
||||
* Notes:
|
||||
*
|
||||
* This implementation uses a bit-set representation for character
|
||||
* classes for speed and compactness. Each character is represented
|
||||
* by one bit in a 128-bit block. Thus, CCL always takes a
|
||||
* classes for speed and compactness. Each character is represented
|
||||
* by one bit in a 128-bit block. Thus, CCL always takes a
|
||||
* constant 16 bytes in the internal nfa, and RESearch::Execute does a single
|
||||
* bit comparison to locate the character in the set.
|
||||
*
|
||||
@@ -223,7 +157,7 @@
|
||||
* compile: CHR f CHR o CLO CHR o END CLO ANY END END
|
||||
* matches: fo foo fooo foobar fobar foxx ...
|
||||
*
|
||||
* pattern: fo[ob]a[rz]
|
||||
* pattern: fo[ob]a[rz]
|
||||
* compile: CHR f CHR o CCL bitset CHR a CCL bitset END
|
||||
* matches: fobar fooar fobaz fooaz
|
||||
*
|
||||
@@ -263,7 +197,7 @@
|
||||
* The following defines are not meant to be changeable.
|
||||
* They are for readability only.
|
||||
*/
|
||||
#define BLKIND 0170
|
||||
#define BLKIND 0370
|
||||
#define BITIND 07
|
||||
|
||||
#define ASCIIB 0177
|
||||
@@ -271,7 +205,7 @@
|
||||
const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
|
||||
|
||||
#define badpat(x) (*nfa = END, x)
|
||||
|
||||
|
||||
RESearch::RESearch() {
|
||||
Init();
|
||||
}
|
||||
@@ -361,7 +295,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
|
||||
int n;
|
||||
char mask; /* xor mask -CCL/NCL */
|
||||
int c1, c2;
|
||||
|
||||
|
||||
if (!pat || !length)
|
||||
if (sta)
|
||||
return 0;
|
||||
@@ -403,7 +337,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
|
||||
|
||||
i++;
|
||||
if (*++p == '^') {
|
||||
mask = '\377';
|
||||
mask = '\377';
|
||||
i++;
|
||||
p++;
|
||||
} else
|
||||
@@ -447,7 +381,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
|
||||
|
||||
for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
|
||||
*mp++ = static_cast<char>(mask ^ bittab[n]);
|
||||
|
||||
|
||||
break;
|
||||
|
||||
case '*': /* match 0 or more.. */
|
||||
@@ -592,7 +526,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
|
||||
* RESearch::Execute:
|
||||
* execute nfa to find a match.
|
||||
*
|
||||
* special cases: (nfa[0])
|
||||
* special cases: (nfa[0])
|
||||
* BOL
|
||||
* Match only once, starting from the
|
||||
* beginning.
|
||||
@@ -617,7 +551,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
|
||||
|
||||
bol = lp;
|
||||
failure = 0;
|
||||
|
||||
|
||||
Clear();
|
||||
|
||||
switch(*ap) {
|
||||
@@ -658,7 +592,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
|
||||
return 1;
|
||||
}
|
||||
|
||||
/*
|
||||
/*
|
||||
* PMatch: internal routine for the hard part
|
||||
*
|
||||
* This code is partly snarfed from an early grep written by
|
||||
@@ -684,7 +618,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
|
||||
*
|
||||
* At the end of a successful match, bopat[n] and eopat[n]
|
||||
* are set to the beginning and end of subpatterns matched
|
||||
* by tagged expressions (n = 1 to 9).
|
||||
* by tagged expressions (n = 1 to 9).
|
||||
*
|
||||
*/
|
||||
|
||||
@@ -695,23 +629,23 @@ extern void re_fail(char *,char);
|
||||
* and EOW. the reason for not using ctype macros is that we can
|
||||
* let the user add into our own table. see RESearch::ModifyWord. This table
|
||||
* is not in the bitset form, since we may wish to extend it in the
|
||||
* future for other character classifications.
|
||||
* future for other character classifications.
|
||||
*
|
||||
* TRUE for 0-9 A-Z a-z _
|
||||
*/
|
||||
static char chrtyp[MAXCHR] = {
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
|
||||
0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
|
||||
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
|
||||
1, 1, 1, 0, 0, 0, 0, 0
|
||||
};
|
||||
|
||||
@@ -833,10 +767,10 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
|
||||
* the compact bitset representation for the default table]
|
||||
*/
|
||||
|
||||
static char deftab[16] = {
|
||||
0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',
|
||||
'\376', '\377', '\377', 007
|
||||
};
|
||||
static char deftab[16] = {
|
||||
0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',
|
||||
'\376', '\377', '\377', 007
|
||||
};
|
||||
|
||||
void RESearch::ModifyWord(char *s) {
|
||||
int i;
|
||||
@@ -883,7 +817,7 @@ int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
|
||||
pin = c - '0';
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
default:
|
||||
*dst++ = c;
|
||||
continue;
|
||||
|
@@ -198,16 +198,18 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
|
||||
|
||||
if (ac.chooseSingle && (listType == 0)) {
|
||||
if (list && !strchr(list, ac.GetSeparator())) {
|
||||
const char *typeSep = strchr(list, ac.GetTypesep());
|
||||
size_t lenInsert = (typeSep) ? (typeSep-list) : strlen(list);
|
||||
if (ac.ignoreCase) {
|
||||
SetEmptySelection(currentPos - lenEntered);
|
||||
pdoc->DeleteChars(currentPos, lenEntered);
|
||||
SetEmptySelection(currentPos);
|
||||
pdoc->InsertString(currentPos, list);
|
||||
SetEmptySelection(currentPos + static_cast<int>(strlen(list)));
|
||||
pdoc->InsertString(currentPos, list, lenInsert);
|
||||
SetEmptySelection(currentPos + lenInsert);
|
||||
} else {
|
||||
SetEmptySelection(currentPos);
|
||||
pdoc->InsertString(currentPos, list + lenEntered);
|
||||
SetEmptySelection(currentPos + static_cast<int>(strlen(list + lenEntered)));
|
||||
pdoc->InsertString(currentPos, list + lenEntered, lenInsert - lenEntered);
|
||||
SetEmptySelection(currentPos + lenInsert - lenEntered);
|
||||
}
|
||||
return;
|
||||
}
|
||||
@@ -345,6 +347,10 @@ void ScintillaBase::AutoCompleteCompleted() {
|
||||
pdoc->EndUndoAction();
|
||||
}
|
||||
|
||||
int ScintillaBase::AutoCompleteGetCurrent() {
|
||||
return ac.lb->GetSelection();
|
||||
}
|
||||
|
||||
void ScintillaBase::CallTipShow(Point pt, const char *defn) {
|
||||
AutoCompleteCancel();
|
||||
pt.y += vs.lineHeight;
|
||||
@@ -497,6 +503,9 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
ac.Select(reinterpret_cast<char *>(lParam));
|
||||
break;
|
||||
|
||||
case SCI_AUTOCGETCURRENT:
|
||||
return AutoCompleteGetCurrent();
|
||||
|
||||
case SCI_AUTOCSETCANCELATSTART:
|
||||
ac.cancelAtStartPos = wParam != 0;
|
||||
break;
|
||||
@@ -557,7 +566,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
|
||||
return ac.GetTypesep();
|
||||
|
||||
case SCI_CALLTIPSHOW:
|
||||
CallTipShow(LocationFromPosition(wParam),
|
||||
CallTipShow(LocationFromPosition(wParam),
|
||||
reinterpret_cast<const char *>(lParam));
|
||||
break;
|
||||
|
||||
|
@@ -65,6 +65,7 @@ protected:
|
||||
void AutoCompleteStart(int lenEntered, const char *list);
|
||||
void AutoCompleteCancel();
|
||||
void AutoCompleteMove(int delta);
|
||||
int AutoCompleteGetCurrent();
|
||||
void AutoCompleteCharacterAdded(char ch);
|
||||
void AutoCompleteCharacterDeleted();
|
||||
void AutoCompleteCompleted();
|
||||
|
@@ -84,6 +84,7 @@ ViewStyle::ViewStyle(const ViewStyle &source) {
|
||||
hotspotBackgroundSet = source.hotspotBackgroundSet;
|
||||
hotspotBackground.desired = source.hotspotBackground.desired;
|
||||
hotspotUnderline = source.hotspotUnderline;
|
||||
hotspotSingleLine = source.hotspotSingleLine;
|
||||
|
||||
whitespaceForegroundSet = source.whitespaceForegroundSet;
|
||||
whitespaceForeground.desired = source.whitespaceForeground.desired;
|
||||
@@ -164,6 +165,7 @@ void ViewStyle::Init() {
|
||||
hotspotBackgroundSet = false;
|
||||
hotspotBackground.desired = ColourDesired(0xff, 0xff, 0xff);
|
||||
hotspotUnderline = true;
|
||||
hotspotSingleLine = true;
|
||||
|
||||
leftMarginWidth = 1;
|
||||
rightMarginWidth = 1;
|
||||
|
@@ -68,6 +68,7 @@ public:
|
||||
bool hotspotBackgroundSet;
|
||||
ColourPair hotspotBackground;
|
||||
bool hotspotUnderline;
|
||||
bool hotspotSingleLine;
|
||||
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
|
||||
enum { margins=3 };
|
||||
int leftMarginWidth; ///< Spacing margin on left of text
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file XPM.cxx
|
||||
** Define a class that holds data in the X Pixmap (XPM) format,
|
||||
** Define a class that holds data in the X Pixmap (XPM) format.
|
||||
**/
|
||||
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
@@ -33,7 +33,7 @@ static size_t MeasureLength(const char *s) {
|
||||
ColourAllocated XPM::ColourFromCode(int ch) {
|
||||
return colourCodeTable[ch]->allocated;
|
||||
#ifdef SLOW
|
||||
for (int i=0;i<nColours;i++) {
|
||||
for (int i=0; i<nColours; i++) {
|
||||
if (codes[i] == ch) {
|
||||
return colours[i].allocated;
|
||||
}
|
||||
@@ -49,13 +49,13 @@ void XPM::FillRun(Surface *surface, int code, int startX, int y, int x) {
|
||||
}
|
||||
}
|
||||
|
||||
XPM::XPM(const char *textForm) :
|
||||
data(0), codes(0), colours(0), lines(0) {
|
||||
XPM::XPM(const char *textForm) :
|
||||
data(0), codes(0), colours(0), lines(0) {
|
||||
Init(textForm);
|
||||
}
|
||||
|
||||
XPM::XPM(const char * const *linesForm) :
|
||||
data(0), codes(0), colours(0), lines(0) {
|
||||
data(0), codes(0), colours(0), lines(0) {
|
||||
Init(linesForm);
|
||||
}
|
||||
|
||||
@@ -116,7 +116,7 @@ void XPM::Init(const char * const *linesForm) {
|
||||
*nextBit++ = '\0';
|
||||
}
|
||||
|
||||
for (int code=0;code<256; code++) {
|
||||
for (int code=0; code<256; code++) {
|
||||
colourCodeTable[code] = 0;
|
||||
}
|
||||
|
||||
@@ -149,7 +149,7 @@ void XPM::RefreshColourPalette(Palette &pal, bool want) {
|
||||
if (!data || !codes || !colours || !lines) {
|
||||
return;
|
||||
}
|
||||
for (int i=0;i<nColours;i++) {
|
||||
for (int i=0; i<nColours; i++) {
|
||||
pal.WantFind(colours[i], want);
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ void XPM::CopyDesiredColours() {
|
||||
if (!data || !codes || !colours || !lines) {
|
||||
return;
|
||||
}
|
||||
for (int i=0;i<nColours;i++) {
|
||||
for (int i=0; i<nColours; i++) {
|
||||
colours[i].Copy();
|
||||
}
|
||||
}
|
||||
@@ -222,7 +222,7 @@ XPMSet::~XPMSet() {
|
||||
}
|
||||
|
||||
void XPMSet::Clear() {
|
||||
for (int i=0;i<maximum;i++) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
delete set[i];
|
||||
}
|
||||
delete []set;
|
||||
@@ -239,34 +239,34 @@ void XPMSet::Add(int id, const char *textForm) {
|
||||
width = -1;
|
||||
|
||||
// Replace if this id already present
|
||||
for (int i=0;i<maximum;i++) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (set[i]->GetId() == id) {
|
||||
set[i]->Init(textForm);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
// No present, so add to end
|
||||
// Not present, so add to end
|
||||
XPM *pxpm = new XPM(textForm);
|
||||
if (pxpm) {
|
||||
pxpm->SetId(id);
|
||||
pxpm->CopyDesiredColours();
|
||||
if (len == maximum) {
|
||||
int lenNew = len + 100;
|
||||
XPM **setNew = new XPM *[lenNew];
|
||||
for (int i=0; i<maximum; i++) {
|
||||
maximum += 64;
|
||||
XPM **setNew = new XPM *[maximum];
|
||||
for (int i = 0; i < len; i++) {
|
||||
setNew[i] = set[i];
|
||||
}
|
||||
delete []set;
|
||||
set = setNew;
|
||||
}
|
||||
set[maximum] = pxpm;
|
||||
maximum++;
|
||||
set[len] = pxpm;
|
||||
len++;
|
||||
}
|
||||
}
|
||||
|
||||
XPM *XPMSet::Get(int id) {
|
||||
for (int i=0;i<maximum;i++) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (set[i]->GetId() == id) {
|
||||
return set[i];
|
||||
}
|
||||
@@ -276,7 +276,7 @@ XPM *XPMSet::Get(int id) {
|
||||
|
||||
int XPMSet::GetHeight() {
|
||||
if (height < 0) {
|
||||
for (int i=0; i<maximum; i++) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (height < set[i]->GetHeight()) {
|
||||
height = set[i]->GetHeight();
|
||||
}
|
||||
@@ -287,7 +287,7 @@ int XPMSet::GetHeight() {
|
||||
|
||||
int XPMSet::GetWidth() {
|
||||
if (width < 0) {
|
||||
for (int i=0; i<maximum; i++) {
|
||||
for (int i = 0; i < len; i++) {
|
||||
if (width < set[i]->GetWidth()) {
|
||||
width = set[i]->GetWidth();
|
||||
}
|
||||
|
@@ -1,6 +1,6 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file XPM.h
|
||||
** Define a class that holds data in the X Pixmap (XPM) format,
|
||||
** Define a class that holds data in the X Pixmap (XPM) format.
|
||||
**/
|
||||
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
@@ -31,11 +31,11 @@ public:
|
||||
void Init(const char *textForm);
|
||||
void Init(const char * const *linesForm);
|
||||
void Clear();
|
||||
// Similar to same named method in ViewStyle:
|
||||
/// Similar to same named method in ViewStyle:
|
||||
void RefreshColourPalette(Palette &pal, bool want);
|
||||
// No palette used, so just copy the desired colours to the allocated colours:
|
||||
/// No palette used, so just copy the desired colours to the allocated colours
|
||||
void CopyDesiredColours();
|
||||
// Decompose image into runs and use FillRectangle for each run:
|
||||
/// Decompose image into runs and use FillRectangle for each run
|
||||
void Draw(Surface *surface, PRectangle &rc);
|
||||
char **InLinesForm() { return lines; }
|
||||
void SetId(int id_) { id = id_; }
|
||||
@@ -49,18 +49,23 @@ public:
|
||||
* A collection of pixmaps indexed by integer id.
|
||||
*/
|
||||
class XPMSet {
|
||||
XPM **set;
|
||||
int len;
|
||||
int maximum;
|
||||
int height;
|
||||
int width;
|
||||
XPM **set; ///< The stored XPMs.
|
||||
int len; ///< Current number of XPMs.
|
||||
int maximum; ///< Current maximum number of XPMs, increased by steps if reached.
|
||||
int height; ///< Memorize largest height of the set.
|
||||
int width; ///< Memorize largest width of the set.
|
||||
public:
|
||||
XPMSet();
|
||||
~XPMSet();
|
||||
/// Remove all XPMs.
|
||||
void Clear();
|
||||
/// Add a XPM.
|
||||
void Add(int id, const char *textForm);
|
||||
/// Get XPM by id.
|
||||
XPM *Get(int id);
|
||||
/// Give the largest height of the set.
|
||||
int GetHeight();
|
||||
/// Give the largest width of the set.
|
||||
int GetWidth();
|
||||
};
|
||||
|
||||
|
@@ -154,7 +154,7 @@ void wxStyledTextCtrl::Create(wxWindow *parent,
|
||||
style |= wxVSCROLL | wxHSCROLL;
|
||||
#endif
|
||||
wxControl::Create(parent, id, pos, size,
|
||||
style | wxWANTS_CHARS | wxCLIP_CHILDREN,
|
||||
style | wxWANTS_CHARS | wxCLIP_CHILDREN,
|
||||
wxDefaultValidator, name);
|
||||
|
||||
#ifdef LINK_LEXERS
|
||||
@@ -619,7 +619,7 @@ void wxStyledTextCtrl::CmdKeyAssign(int key, int modifiers, int cmd) {
|
||||
SendMsg(2070, MAKELONG(key, modifiers), cmd);
|
||||
}
|
||||
|
||||
// When key+modifier combination km do nothing.
|
||||
// When key+modifier combination km is pressed do nothing.
|
||||
void wxStyledTextCtrl::CmdKeyClear(int key, int modifiers) {
|
||||
SendMsg(2071, MAKELONG(key, modifiers));
|
||||
}
|
||||
@@ -650,6 +650,7 @@ void wxStyledTextCtrl::SetCaretPeriod(int periodMilliseconds) {
|
||||
}
|
||||
|
||||
// Set the set of characters making up words for when moving or selecting by word.
|
||||
// First sets deaults like SetCharsDefault.
|
||||
void wxStyledTextCtrl::SetWordChars(const wxString& characters) {
|
||||
SendMsg(2077, 0, (long)(const char*)wx2stc(characters));
|
||||
}
|
||||
@@ -1049,7 +1050,7 @@ int wxStyledTextCtrl::FindText(int minPos, int maxPos,
|
||||
int startPos,
|
||||
int endPos,
|
||||
wxDC* draw,
|
||||
wxDC* target, // Why does it use two? Can they be the same?
|
||||
wxDC* target,
|
||||
wxRect renderRect,
|
||||
wxRect pageRect) {
|
||||
RangeToFormat fr;
|
||||
@@ -1305,7 +1306,7 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
||||
}
|
||||
|
||||
// Replace the target text with the argument text.
|
||||
// Text is counted so it can contain nulls.
|
||||
// Text is counted so it can contain NULs.
|
||||
// Returns the length of the replacement text.
|
||||
|
||||
int wxStyledTextCtrl::ReplaceTarget(const wxString& text) {
|
||||
@@ -1314,7 +1315,7 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
||||
}
|
||||
|
||||
// Replace the target text with the argument text after \d processing.
|
||||
// Text is counted so it can contain nulls.
|
||||
// Text is counted so it can contain NULs.
|
||||
// Looks for \d where d is between 1 and 9 and replaces these with the strings
|
||||
// matched in the last search operation which were surrounded by \( and \).
|
||||
// Returns the length of the replacement text including any change
|
||||
@@ -1326,7 +1327,7 @@ int wxStyledTextCtrl::GetTargetEnd() {
|
||||
}
|
||||
|
||||
// Search for a counted string in the target and set the target to the found
|
||||
// range. Text is counted so it can contain nulls.
|
||||
// range. Text is counted so it can contain NULs.
|
||||
// Returns length of range or -1 for failure in which case target is not moved.
|
||||
|
||||
int wxStyledTextCtrl::SearchInTarget(const wxString& text) {
|
||||
@@ -1533,7 +1534,7 @@ int wxStyledTextCtrl::GetScrollWidth() {
|
||||
}
|
||||
|
||||
// Measure the pixel width of some text in a particular style.
|
||||
// Nul terminated text argument.
|
||||
// NUL terminated text argument.
|
||||
// Does not handle tab or control characters.
|
||||
int wxStyledTextCtrl::TextWidth(int style, const wxString& text) {
|
||||
return SendMsg(2276, style, (long)(const char*)wx2stc(text));
|
||||
@@ -1884,7 +1885,7 @@ int wxStyledTextCtrl::GetXOffset() {
|
||||
return SendMsg(2398, 0, 0);
|
||||
}
|
||||
|
||||
// Set the last x chosen value to be the caret x position
|
||||
// Set the last x chosen value to be the caret x position.
|
||||
void wxStyledTextCtrl::ChooseCaretX() {
|
||||
SendMsg(2399, 0, 0);
|
||||
}
|
||||
@@ -1906,7 +1907,7 @@ void wxStyledTextCtrl::SetPrintWrapMode(int mode) {
|
||||
SendMsg(2406, mode, 0);
|
||||
}
|
||||
|
||||
// Is printing line wrapped.
|
||||
// Is printing line wrapped?
|
||||
int wxStyledTextCtrl::GetPrintWrapMode() {
|
||||
return SendMsg(2407, 0, 0);
|
||||
}
|
||||
@@ -1926,6 +1927,11 @@ void wxStyledTextCtrl::SetHotspotActiveUnderline(bool underline) {
|
||||
SendMsg(2412, underline, 0);
|
||||
}
|
||||
|
||||
// Limit hotspots to single line so hotspots on two lines don't merge.
|
||||
void wxStyledTextCtrl::SetHotspotSingleLine(bool singleLine) {
|
||||
SendMsg(2421, singleLine, 0);
|
||||
}
|
||||
|
||||
// Given a valid document position, return the previous position taking code
|
||||
// page into account. Returns 0 if passed 0.
|
||||
int wxStyledTextCtrl::PositionBefore(int pos) {
|
||||
@@ -1948,6 +1954,43 @@ void wxStyledTextCtrl::CopyText(int length, const wxString& text) {
|
||||
SendMsg(2420, length, (long)(const char*)wx2stc(text));
|
||||
}
|
||||
|
||||
// Set the selection mode to stream (SC_SEL_STREAM) or rectangular (SC_SEL_RECTANGLE) or
|
||||
// by lines (SC_SEL_LINES).
|
||||
void wxStyledTextCtrl::SetSelectionMode(int mode) {
|
||||
SendMsg(2422, mode, 0);
|
||||
}
|
||||
|
||||
// Get the mode of the current selection.
|
||||
int wxStyledTextCtrl::GetSelectionMode() {
|
||||
return SendMsg(2423, 0, 0);
|
||||
}
|
||||
|
||||
// Retrieve the position of the start of the selection at the given line (INVALID_POSITION if no selection on this line).
|
||||
int wxStyledTextCtrl::GetLineSelStartPosition(int line) {
|
||||
return SendMsg(2424, line, 0);
|
||||
}
|
||||
|
||||
// Retrieve the position of the end of the selection at the given line (INVALID_POSITION if no selection on this line).
|
||||
int wxStyledTextCtrl::GetLineSelEndPosition(int line) {
|
||||
return SendMsg(2425, line, 0);
|
||||
}
|
||||
|
||||
// Set the set of characters making up whitespace for when moving or selecting by word.
|
||||
// Should be called after SetWordChars.
|
||||
void wxStyledTextCtrl::SetWhitespaceChars(const wxString& characters) {
|
||||
SendMsg(2443, 0, (long)(const char*)wx2stc(characters));
|
||||
}
|
||||
|
||||
// Reset the set of characters for whitespace and word characters to the defaults.
|
||||
void wxStyledTextCtrl::SetCharsDefault() {
|
||||
SendMsg(2444, 0, 0);
|
||||
}
|
||||
|
||||
// Get currently selected item position in the auto-completion list
|
||||
int wxStyledTextCtrl::AutoCompGetCurrent() {
|
||||
return SendMsg(2445, 0, 0);
|
||||
}
|
||||
|
||||
// Start notifying the container of all key presses and commands.
|
||||
void wxStyledTextCtrl::StartRecord() {
|
||||
SendMsg(3001, 0, 0);
|
||||
@@ -2336,6 +2379,11 @@ void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) {
|
||||
m_swx->DoOnIdle(evt);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Turn notifications from Scintilla into events
|
||||
|
||||
|
@@ -541,6 +541,11 @@ void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
|
||||
}
|
||||
|
||||
|
||||
void wxStyledTextCtrl::OnIdle(wxIdleEvent& evt) {
|
||||
m_swx->DoOnIdle(evt);
|
||||
}
|
||||
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
// Turn notifications from Scintilla into events
|
||||
|
||||
|
@@ -237,7 +237,8 @@ private:
|
||||
void OnEraseBackground(wxEraseEvent& evt);
|
||||
void OnMenu(wxCommandEvent& evt);
|
||||
void OnListBox(wxCommandEvent& evt);
|
||||
|
||||
void OnIdle(wxIdleEvent& evt);
|
||||
|
||||
|
||||
// Turn notifications from Scintilla into events
|
||||
void NotifyChange();
|
||||
|
Reference in New Issue
Block a user