diff --git a/Makefile.in b/Makefile.in index 9f95f13fe3..0dc4d1a902 100644 --- a/Makefile.in +++ b/Makefile.in @@ -247,6 +247,7 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_LexCsound.o \ wxscintilla_LexCSS.o \ wxscintilla_LexD.o \ + wxscintilla_LexDMAP.o \ wxscintilla_LexECL.o \ wxscintilla_LexEiffel.o \ wxscintilla_LexErlang.o \ @@ -260,6 +261,8 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_LexHTML.o \ wxscintilla_LexInno.o \ wxscintilla_LexKix.o \ + wxscintilla_LexKVIrc.o \ + wxscintilla_LexLaTeX.o \ wxscintilla_LexLisp.o \ wxscintilla_LexLout.o \ wxscintilla_LexLua.o \ @@ -281,6 +284,7 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_LexPB.o \ wxscintilla_LexPerl.o \ wxscintilla_LexPLM.o \ + wxscintilla_LexPO.o \ wxscintilla_LexPOV.o \ wxscintilla_LexPowerPro.o \ wxscintilla_LexPowerShell.o \ @@ -290,6 +294,7 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_LexR.o \ wxscintilla_LexRebol.o \ wxscintilla_LexRuby.o \ + wxscintilla_LexRust.o \ wxscintilla_LexScriptol.o \ wxscintilla_LexSmalltalk.o \ wxscintilla_LexSML.o \ @@ -297,6 +302,7 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_LexSpecman.o \ wxscintilla_LexSpice.o \ wxscintilla_LexSQL.o \ + wxscintilla_LexSTTXT.o \ wxscintilla_LexTACL.o \ wxscintilla_LexTADS3.o \ wxscintilla_LexTAL.o \ @@ -310,6 +316,7 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_LexVisualProlog.o \ wxscintilla_LexYAML.o \ wxscintilla_Accessor.o \ + wxscintilla_CharacterCategory.o \ wxscintilla_CharacterSet.o \ wxscintilla_LexerBase.o \ wxscintilla_LexerModule.o \ @@ -320,6 +327,8 @@ WXSCINTILLA_OBJECTS = \ wxscintilla_WordList.o \ wxscintilla_AutoComplete.o \ wxscintilla_CallTip.o \ + wxscintilla_CaseConvert.o \ + wxscintilla_CaseFolder.o \ wxscintilla_Catalogue.o \ wxscintilla_CellBuffer.o \ wxscintilla_CharClassify.o \ @@ -16600,6 +16609,9 @@ wxscintilla_LexCSS.o: $(srcdir)/src/stc/scintilla/lexers/LexCSS.cxx wxscintilla_LexD.o: $(srcdir)/src/stc/scintilla/lexers/LexD.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexD.cxx +wxscintilla_LexDMAP.o: $(srcdir)/src/stc/scintilla/lexers/LexDMAP.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexDMAP.cxx + wxscintilla_LexECL.o: $(srcdir)/src/stc/scintilla/lexers/LexECL.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexECL.cxx @@ -16639,6 +16651,12 @@ wxscintilla_LexInno.o: $(srcdir)/src/stc/scintilla/lexers/LexInno.cxx wxscintilla_LexKix.o: $(srcdir)/src/stc/scintilla/lexers/LexKix.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexKix.cxx +wxscintilla_LexKVIrc.o: $(srcdir)/src/stc/scintilla/lexers/LexKVIrc.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexKVIrc.cxx + +wxscintilla_LexLaTeX.o: $(srcdir)/src/stc/scintilla/lexers/LexLaTeX.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexLaTeX.cxx + wxscintilla_LexLisp.o: $(srcdir)/src/stc/scintilla/lexers/LexLisp.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexLisp.cxx @@ -16702,6 +16720,9 @@ wxscintilla_LexPerl.o: $(srcdir)/src/stc/scintilla/lexers/LexPerl.cxx wxscintilla_LexPLM.o: $(srcdir)/src/stc/scintilla/lexers/LexPLM.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexPLM.cxx +wxscintilla_LexPO.o: $(srcdir)/src/stc/scintilla/lexers/LexPO.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexPO.cxx + wxscintilla_LexPOV.o: $(srcdir)/src/stc/scintilla/lexers/LexPOV.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexPOV.cxx @@ -16729,6 +16750,9 @@ wxscintilla_LexRebol.o: $(srcdir)/src/stc/scintilla/lexers/LexRebol.cxx wxscintilla_LexRuby.o: $(srcdir)/src/stc/scintilla/lexers/LexRuby.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexRuby.cxx +wxscintilla_LexRust.o: $(srcdir)/src/stc/scintilla/lexers/LexRust.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexRust.cxx + wxscintilla_LexScriptol.o: $(srcdir)/src/stc/scintilla/lexers/LexScriptol.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexScriptol.cxx @@ -16750,6 +16774,9 @@ wxscintilla_LexSpice.o: $(srcdir)/src/stc/scintilla/lexers/LexSpice.cxx wxscintilla_LexSQL.o: $(srcdir)/src/stc/scintilla/lexers/LexSQL.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexSQL.cxx +wxscintilla_LexSTTXT.o: $(srcdir)/src/stc/scintilla/lexers/LexSTTXT.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexSTTXT.cxx + wxscintilla_LexTACL.o: $(srcdir)/src/stc/scintilla/lexers/LexTACL.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexTACL.cxx @@ -16789,6 +16816,9 @@ wxscintilla_LexYAML.o: $(srcdir)/src/stc/scintilla/lexers/LexYAML.cxx wxscintilla_Accessor.o: $(srcdir)/src/stc/scintilla/lexlib/Accessor.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexlib/Accessor.cxx +wxscintilla_CharacterCategory.o: $(srcdir)/src/stc/scintilla/lexlib/CharacterCategory.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexlib/CharacterCategory.cxx + wxscintilla_CharacterSet.o: $(srcdir)/src/stc/scintilla/lexlib/CharacterSet.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexlib/CharacterSet.cxx @@ -16819,6 +16849,12 @@ wxscintilla_AutoComplete.o: $(srcdir)/src/stc/scintilla/src/AutoComplete.cxx wxscintilla_CallTip.o: $(srcdir)/src/stc/scintilla/src/CallTip.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/CallTip.cxx +wxscintilla_CaseConvert.o: $(srcdir)/src/stc/scintilla/src/CaseConvert.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/CaseConvert.cxx + +wxscintilla_CaseFolder.o: $(srcdir)/src/stc/scintilla/src/CaseFolder.cxx + $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/CaseFolder.cxx + wxscintilla_Catalogue.o: $(srcdir)/src/stc/scintilla/src/Catalogue.cxx $(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/src/Catalogue.cxx @@ -40771,6 +40807,7 @@ ALL_GUI_DIST: ALL_DIST mkdir $(DISTDIR)/include/wx/generic/private mkdir $(DISTDIR)/include/wx/html mkdir $(DISTDIR)/include/wx/richtext + mkdir $(DISTDIR)/include/wx/richtext/bitmaps mkdir $(DISTDIR)/include/wx/aui mkdir $(DISTDIR)/include/wx/ribbon mkdir $(DISTDIR)/include/wx/persist @@ -40788,6 +40825,7 @@ ALL_GUI_DIST: ALL_DIST $(CP_P) $(INCDIR)/wx/generic/private/*.h $(DISTDIR)/include/wx/generic/private $(CP_P) $(INCDIR)/wx/html/*.h $(DISTDIR)/include/wx/html $(CP_P) $(INCDIR)/wx/richtext/*.h $(DISTDIR)/include/wx/richtext + $(CP_P) $(INCDIR)/wx/richtext/bitmaps/*.xpm $(DISTDIR)/include/wx/richtext/bitmaps $(CP_P) $(INCDIR)/wx/aui/*.h $(DISTDIR)/include/wx/aui $(CP_P) $(INCDIR)/wx/ribbon/*.h $(DISTDIR)/include/wx/ribbon $(CP_P) $(INCDIR)/wx/persist/*.h $(DISTDIR)/include/wx/persist @@ -40898,6 +40936,7 @@ BASE_DIST: ALL_DIST INTL_DIST mkdir $(DISTDIR)/include/wx/msw mkdir $(DISTDIR)/include/wx/html mkdir $(DISTDIR)/include/wx/richtext + mkdir $(DISTDIR)/include/wx/richtext/bitmaps mkdir $(DISTDIR)/include/wx/aui mkdir $(DISTDIR)/include/wx/ribbon mkdir $(DISTDIR)/include/wx/persist diff --git a/build/bakefiles/scintilla.bkl b/build/bakefiles/scintilla.bkl index 97fad316c4..9a24e9304f 100644 --- a/build/bakefiles/scintilla.bkl +++ b/build/bakefiles/scintilla.bkl @@ -81,6 +81,7 @@ src/stc/scintilla/lexers/LexCsound.cxx src/stc/scintilla/lexers/LexCSS.cxx src/stc/scintilla/lexers/LexD.cxx + src/stc/scintilla/lexers/LexDMAP.cxx src/stc/scintilla/lexers/LexECL.cxx src/stc/scintilla/lexers/LexEiffel.cxx src/stc/scintilla/lexers/LexErlang.cxx @@ -94,6 +95,8 @@ src/stc/scintilla/lexers/LexHTML.cxx src/stc/scintilla/lexers/LexInno.cxx src/stc/scintilla/lexers/LexKix.cxx + src/stc/scintilla/lexers/LexKVIrc.cxx + src/stc/scintilla/lexers/LexLaTeX.cxx src/stc/scintilla/lexers/LexLisp.cxx src/stc/scintilla/lexers/LexLout.cxx src/stc/scintilla/lexers/LexLua.cxx @@ -115,6 +118,7 @@ src/stc/scintilla/lexers/LexPB.cxx src/stc/scintilla/lexers/LexPerl.cxx src/stc/scintilla/lexers/LexPLM.cxx + src/stc/scintilla/lexers/LexPO.cxx src/stc/scintilla/lexers/LexPOV.cxx src/stc/scintilla/lexers/LexPowerPro.cxx src/stc/scintilla/lexers/LexPowerShell.cxx @@ -124,6 +128,7 @@ src/stc/scintilla/lexers/LexR.cxx src/stc/scintilla/lexers/LexRebol.cxx src/stc/scintilla/lexers/LexRuby.cxx + src/stc/scintilla/lexers/LexRust.cxx src/stc/scintilla/lexers/LexScriptol.cxx src/stc/scintilla/lexers/LexSmalltalk.cxx src/stc/scintilla/lexers/LexSML.cxx @@ -131,6 +136,7 @@ src/stc/scintilla/lexers/LexSpecman.cxx src/stc/scintilla/lexers/LexSpice.cxx src/stc/scintilla/lexers/LexSQL.cxx + src/stc/scintilla/lexers/LexSTTXT.cxx src/stc/scintilla/lexers/LexTACL.cxx src/stc/scintilla/lexers/LexTADS3.cxx src/stc/scintilla/lexers/LexTAL.cxx @@ -144,6 +150,7 @@ src/stc/scintilla/lexers/LexVisualProlog.cxx src/stc/scintilla/lexers/LexYAML.cxx src/stc/scintilla/lexlib/Accessor.cxx + src/stc/scintilla/lexlib/CharacterCategory.cxx src/stc/scintilla/lexlib/CharacterSet.cxx src/stc/scintilla/lexlib/LexerBase.cxx src/stc/scintilla/lexlib/LexerModule.cxx @@ -154,6 +161,8 @@ src/stc/scintilla/lexlib/WordList.cxx src/stc/scintilla/src/AutoComplete.cxx src/stc/scintilla/src/CallTip.cxx + src/stc/scintilla/src/CaseConvert.cxx + src/stc/scintilla/src/CaseFolder.cxx src/stc/scintilla/src/Catalogue.cxx src/stc/scintilla/src/CellBuffer.cxx src/stc/scintilla/src/CharClassify.cxx diff --git a/build/msw/makefile.bcc b/build/msw/makefile.bcc index 4825141f05..9804e95f69 100644 --- a/build/msw/makefile.bcc +++ b/build/msw/makefile.bcc @@ -229,6 +229,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexCsound.obj \ $(OBJS)\wxscintilla_LexCSS.obj \ $(OBJS)\wxscintilla_LexD.obj \ + $(OBJS)\wxscintilla_LexDMAP.obj \ $(OBJS)\wxscintilla_LexECL.obj \ $(OBJS)\wxscintilla_LexEiffel.obj \ $(OBJS)\wxscintilla_LexErlang.obj \ @@ -242,6 +243,8 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexHTML.obj \ $(OBJS)\wxscintilla_LexInno.obj \ $(OBJS)\wxscintilla_LexKix.obj \ + $(OBJS)\wxscintilla_LexKVIrc.obj \ + $(OBJS)\wxscintilla_LexLaTeX.obj \ $(OBJS)\wxscintilla_LexLisp.obj \ $(OBJS)\wxscintilla_LexLout.obj \ $(OBJS)\wxscintilla_LexLua.obj \ @@ -263,6 +266,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexPB.obj \ $(OBJS)\wxscintilla_LexPerl.obj \ $(OBJS)\wxscintilla_LexPLM.obj \ + $(OBJS)\wxscintilla_LexPO.obj \ $(OBJS)\wxscintilla_LexPOV.obj \ $(OBJS)\wxscintilla_LexPowerPro.obj \ $(OBJS)\wxscintilla_LexPowerShell.obj \ @@ -272,6 +276,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexR.obj \ $(OBJS)\wxscintilla_LexRebol.obj \ $(OBJS)\wxscintilla_LexRuby.obj \ + $(OBJS)\wxscintilla_LexRust.obj \ $(OBJS)\wxscintilla_LexScriptol.obj \ $(OBJS)\wxscintilla_LexSmalltalk.obj \ $(OBJS)\wxscintilla_LexSML.obj \ @@ -279,6 +284,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexSpecman.obj \ $(OBJS)\wxscintilla_LexSpice.obj \ $(OBJS)\wxscintilla_LexSQL.obj \ + $(OBJS)\wxscintilla_LexSTTXT.obj \ $(OBJS)\wxscintilla_LexTACL.obj \ $(OBJS)\wxscintilla_LexTADS3.obj \ $(OBJS)\wxscintilla_LexTAL.obj \ @@ -292,6 +298,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexVisualProlog.obj \ $(OBJS)\wxscintilla_LexYAML.obj \ $(OBJS)\wxscintilla_Accessor.obj \ + $(OBJS)\wxscintilla_CharacterCategory.obj \ $(OBJS)\wxscintilla_CharacterSet.obj \ $(OBJS)\wxscintilla_LexerBase.obj \ $(OBJS)\wxscintilla_LexerModule.obj \ @@ -302,6 +309,8 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_WordList.obj \ $(OBJS)\wxscintilla_AutoComplete.obj \ $(OBJS)\wxscintilla_CallTip.obj \ + $(OBJS)\wxscintilla_CaseConvert.obj \ + $(OBJS)\wxscintilla_CaseFolder.obj \ $(OBJS)\wxscintilla_Catalogue.obj \ $(OBJS)\wxscintilla_CellBuffer.obj \ $(OBJS)\wxscintilla_CharClassify.obj \ @@ -5969,6 +5978,9 @@ $(OBJS)\wxscintilla_LexCSS.obj: ..\..\src\stc\scintilla\lexers\LexCSS.cxx $(OBJS)\wxscintilla_LexD.obj: ..\..\src\stc\scintilla\lexers\LexD.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexD.cxx +$(OBJS)\wxscintilla_LexDMAP.obj: ..\..\src\stc\scintilla\lexers\LexDMAP.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMAP.cxx + $(OBJS)\wxscintilla_LexECL.obj: ..\..\src\stc\scintilla\lexers\LexECL.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexECL.cxx @@ -6008,6 +6020,12 @@ $(OBJS)\wxscintilla_LexInno.obj: ..\..\src\stc\scintilla\lexers\LexInno.cxx $(OBJS)\wxscintilla_LexKix.obj: ..\..\src\stc\scintilla\lexers\LexKix.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexKix.cxx +$(OBJS)\wxscintilla_LexKVIrc.obj: ..\..\src\stc\scintilla\lexers\LexKVIrc.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexKVIrc.cxx + +$(OBJS)\wxscintilla_LexLaTeX.obj: ..\..\src\stc\scintilla\lexers\LexLaTeX.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexLaTeX.cxx + $(OBJS)\wxscintilla_LexLisp.obj: ..\..\src\stc\scintilla\lexers\LexLisp.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexLisp.cxx @@ -6071,6 +6089,9 @@ $(OBJS)\wxscintilla_LexPerl.obj: ..\..\src\stc\scintilla\lexers\LexPerl.cxx $(OBJS)\wxscintilla_LexPLM.obj: ..\..\src\stc\scintilla\lexers\LexPLM.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexPLM.cxx +$(OBJS)\wxscintilla_LexPO.obj: ..\..\src\stc\scintilla\lexers\LexPO.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexPO.cxx + $(OBJS)\wxscintilla_LexPOV.obj: ..\..\src\stc\scintilla\lexers\LexPOV.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexPOV.cxx @@ -6098,6 +6119,9 @@ $(OBJS)\wxscintilla_LexRebol.obj: ..\..\src\stc\scintilla\lexers\LexRebol.cxx $(OBJS)\wxscintilla_LexRuby.obj: ..\..\src\stc\scintilla\lexers\LexRuby.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRuby.cxx +$(OBJS)\wxscintilla_LexRust.obj: ..\..\src\stc\scintilla\lexers\LexRust.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRust.cxx + $(OBJS)\wxscintilla_LexScriptol.obj: ..\..\src\stc\scintilla\lexers\LexScriptol.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexScriptol.cxx @@ -6119,6 +6143,9 @@ $(OBJS)\wxscintilla_LexSpice.obj: ..\..\src\stc\scintilla\lexers\LexSpice.cxx $(OBJS)\wxscintilla_LexSQL.obj: ..\..\src\stc\scintilla\lexers\LexSQL.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexSQL.cxx +$(OBJS)\wxscintilla_LexSTTXT.obj: ..\..\src\stc\scintilla\lexers\LexSTTXT.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexSTTXT.cxx + $(OBJS)\wxscintilla_LexTACL.obj: ..\..\src\stc\scintilla\lexers\LexTACL.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexTACL.cxx @@ -6158,6 +6185,9 @@ $(OBJS)\wxscintilla_LexYAML.obj: ..\..\src\stc\scintilla\lexers\LexYAML.cxx $(OBJS)\wxscintilla_Accessor.obj: ..\..\src\stc\scintilla\lexlib\Accessor.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexlib\Accessor.cxx +$(OBJS)\wxscintilla_CharacterCategory.obj: ..\..\src\stc\scintilla\lexlib\CharacterCategory.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexlib\CharacterCategory.cxx + $(OBJS)\wxscintilla_CharacterSet.obj: ..\..\src\stc\scintilla\lexlib\CharacterSet.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexlib\CharacterSet.cxx @@ -6188,6 +6218,12 @@ $(OBJS)\wxscintilla_AutoComplete.obj: ..\..\src\stc\scintilla\src\AutoComplete.c $(OBJS)\wxscintilla_CallTip.obj: ..\..\src\stc\scintilla\src\CallTip.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\CallTip.cxx +$(OBJS)\wxscintilla_CaseConvert.obj: ..\..\src\stc\scintilla\src\CaseConvert.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\CaseConvert.cxx + +$(OBJS)\wxscintilla_CaseFolder.obj: ..\..\src\stc\scintilla\src\CaseFolder.cxx + $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\CaseFolder.cxx + $(OBJS)\wxscintilla_Catalogue.obj: ..\..\src\stc\scintilla\src\Catalogue.cxx $(CXX) -q -c -P -o$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Catalogue.cxx diff --git a/build/msw/makefile.gcc b/build/msw/makefile.gcc index efd75acf52..23bf7c327b 100644 --- a/build/msw/makefile.gcc +++ b/build/msw/makefile.gcc @@ -217,6 +217,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexCsound.o \ $(OBJS)\wxscintilla_LexCSS.o \ $(OBJS)\wxscintilla_LexD.o \ + $(OBJS)\wxscintilla_LexDMAP.o \ $(OBJS)\wxscintilla_LexECL.o \ $(OBJS)\wxscintilla_LexEiffel.o \ $(OBJS)\wxscintilla_LexErlang.o \ @@ -230,6 +231,8 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexHTML.o \ $(OBJS)\wxscintilla_LexInno.o \ $(OBJS)\wxscintilla_LexKix.o \ + $(OBJS)\wxscintilla_LexKVIrc.o \ + $(OBJS)\wxscintilla_LexLaTeX.o \ $(OBJS)\wxscintilla_LexLisp.o \ $(OBJS)\wxscintilla_LexLout.o \ $(OBJS)\wxscintilla_LexLua.o \ @@ -251,6 +254,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexPB.o \ $(OBJS)\wxscintilla_LexPerl.o \ $(OBJS)\wxscintilla_LexPLM.o \ + $(OBJS)\wxscintilla_LexPO.o \ $(OBJS)\wxscintilla_LexPOV.o \ $(OBJS)\wxscintilla_LexPowerPro.o \ $(OBJS)\wxscintilla_LexPowerShell.o \ @@ -260,6 +264,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexR.o \ $(OBJS)\wxscintilla_LexRebol.o \ $(OBJS)\wxscintilla_LexRuby.o \ + $(OBJS)\wxscintilla_LexRust.o \ $(OBJS)\wxscintilla_LexScriptol.o \ $(OBJS)\wxscintilla_LexSmalltalk.o \ $(OBJS)\wxscintilla_LexSML.o \ @@ -267,6 +272,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexSpecman.o \ $(OBJS)\wxscintilla_LexSpice.o \ $(OBJS)\wxscintilla_LexSQL.o \ + $(OBJS)\wxscintilla_LexSTTXT.o \ $(OBJS)\wxscintilla_LexTACL.o \ $(OBJS)\wxscintilla_LexTADS3.o \ $(OBJS)\wxscintilla_LexTAL.o \ @@ -280,6 +286,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexVisualProlog.o \ $(OBJS)\wxscintilla_LexYAML.o \ $(OBJS)\wxscintilla_Accessor.o \ + $(OBJS)\wxscintilla_CharacterCategory.o \ $(OBJS)\wxscintilla_CharacterSet.o \ $(OBJS)\wxscintilla_LexerBase.o \ $(OBJS)\wxscintilla_LexerModule.o \ @@ -290,6 +297,8 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_WordList.o \ $(OBJS)\wxscintilla_AutoComplete.o \ $(OBJS)\wxscintilla_CallTip.o \ + $(OBJS)\wxscintilla_CaseConvert.o \ + $(OBJS)\wxscintilla_CaseFolder.o \ $(OBJS)\wxscintilla_Catalogue.o \ $(OBJS)\wxscintilla_CellBuffer.o \ $(OBJS)\wxscintilla_CharClassify.o \ @@ -6140,6 +6149,9 @@ $(OBJS)\wxscintilla_LexCSS.o: ../../src/stc/scintilla/lexers/LexCSS.cxx $(OBJS)\wxscintilla_LexD.o: ../../src/stc/scintilla/lexers/LexD.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexDMAP.o: ../../src/stc/scintilla/lexers/LexDMAP.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexECL.o: ../../src/stc/scintilla/lexers/LexECL.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -6179,6 +6191,12 @@ $(OBJS)\wxscintilla_LexInno.o: ../../src/stc/scintilla/lexers/LexInno.cxx $(OBJS)\wxscintilla_LexKix.o: ../../src/stc/scintilla/lexers/LexKix.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexKVIrc.o: ../../src/stc/scintilla/lexers/LexKVIrc.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + +$(OBJS)\wxscintilla_LexLaTeX.o: ../../src/stc/scintilla/lexers/LexLaTeX.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexLisp.o: ../../src/stc/scintilla/lexers/LexLisp.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -6242,6 +6260,9 @@ $(OBJS)\wxscintilla_LexPerl.o: ../../src/stc/scintilla/lexers/LexPerl.cxx $(OBJS)\wxscintilla_LexPLM.o: ../../src/stc/scintilla/lexers/LexPLM.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexPO.o: ../../src/stc/scintilla/lexers/LexPO.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexPOV.o: ../../src/stc/scintilla/lexers/LexPOV.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -6269,6 +6290,9 @@ $(OBJS)\wxscintilla_LexRebol.o: ../../src/stc/scintilla/lexers/LexRebol.cxx $(OBJS)\wxscintilla_LexRuby.o: ../../src/stc/scintilla/lexers/LexRuby.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexRust.o: ../../src/stc/scintilla/lexers/LexRust.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexScriptol.o: ../../src/stc/scintilla/lexers/LexScriptol.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -6290,6 +6314,9 @@ $(OBJS)\wxscintilla_LexSpice.o: ../../src/stc/scintilla/lexers/LexSpice.cxx $(OBJS)\wxscintilla_LexSQL.o: ../../src/stc/scintilla/lexers/LexSQL.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_LexSTTXT.o: ../../src/stc/scintilla/lexers/LexSTTXT.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_LexTACL.o: ../../src/stc/scintilla/lexers/LexTACL.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -6329,6 +6356,9 @@ $(OBJS)\wxscintilla_LexYAML.o: ../../src/stc/scintilla/lexers/LexYAML.cxx $(OBJS)\wxscintilla_Accessor.o: ../../src/stc/scintilla/lexlib/Accessor.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_CharacterCategory.o: ../../src/stc/scintilla/lexlib/CharacterCategory.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_CharacterSet.o: ../../src/stc/scintilla/lexlib/CharacterSet.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< @@ -6359,6 +6389,12 @@ $(OBJS)\wxscintilla_AutoComplete.o: ../../src/stc/scintilla/src/AutoComplete.cxx $(OBJS)\wxscintilla_CallTip.o: ../../src/stc/scintilla/src/CallTip.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< +$(OBJS)\wxscintilla_CaseConvert.o: ../../src/stc/scintilla/src/CaseConvert.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + +$(OBJS)\wxscintilla_CaseFolder.o: ../../src/stc/scintilla/src/CaseFolder.cxx + $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< + $(OBJS)\wxscintilla_Catalogue.o: ../../src/stc/scintilla/src/Catalogue.cxx $(CXX) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(CPPDEPS) $< diff --git a/build/msw/makefile.vc b/build/msw/makefile.vc index 1a768022bc..96daab06c6 100644 --- a/build/msw/makefile.vc +++ b/build/msw/makefile.vc @@ -240,6 +240,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexCsound.obj \ $(OBJS)\wxscintilla_LexCSS.obj \ $(OBJS)\wxscintilla_LexD.obj \ + $(OBJS)\wxscintilla_LexDMAP.obj \ $(OBJS)\wxscintilla_LexECL.obj \ $(OBJS)\wxscintilla_LexEiffel.obj \ $(OBJS)\wxscintilla_LexErlang.obj \ @@ -253,6 +254,8 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexHTML.obj \ $(OBJS)\wxscintilla_LexInno.obj \ $(OBJS)\wxscintilla_LexKix.obj \ + $(OBJS)\wxscintilla_LexKVIrc.obj \ + $(OBJS)\wxscintilla_LexLaTeX.obj \ $(OBJS)\wxscintilla_LexLisp.obj \ $(OBJS)\wxscintilla_LexLout.obj \ $(OBJS)\wxscintilla_LexLua.obj \ @@ -274,6 +277,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexPB.obj \ $(OBJS)\wxscintilla_LexPerl.obj \ $(OBJS)\wxscintilla_LexPLM.obj \ + $(OBJS)\wxscintilla_LexPO.obj \ $(OBJS)\wxscintilla_LexPOV.obj \ $(OBJS)\wxscintilla_LexPowerPro.obj \ $(OBJS)\wxscintilla_LexPowerShell.obj \ @@ -283,6 +287,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexR.obj \ $(OBJS)\wxscintilla_LexRebol.obj \ $(OBJS)\wxscintilla_LexRuby.obj \ + $(OBJS)\wxscintilla_LexRust.obj \ $(OBJS)\wxscintilla_LexScriptol.obj \ $(OBJS)\wxscintilla_LexSmalltalk.obj \ $(OBJS)\wxscintilla_LexSML.obj \ @@ -290,6 +295,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexSpecman.obj \ $(OBJS)\wxscintilla_LexSpice.obj \ $(OBJS)\wxscintilla_LexSQL.obj \ + $(OBJS)\wxscintilla_LexSTTXT.obj \ $(OBJS)\wxscintilla_LexTACL.obj \ $(OBJS)\wxscintilla_LexTADS3.obj \ $(OBJS)\wxscintilla_LexTAL.obj \ @@ -303,6 +309,7 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_LexVisualProlog.obj \ $(OBJS)\wxscintilla_LexYAML.obj \ $(OBJS)\wxscintilla_Accessor.obj \ + $(OBJS)\wxscintilla_CharacterCategory.obj \ $(OBJS)\wxscintilla_CharacterSet.obj \ $(OBJS)\wxscintilla_LexerBase.obj \ $(OBJS)\wxscintilla_LexerModule.obj \ @@ -313,6 +320,8 @@ WXSCINTILLA_OBJECTS = \ $(OBJS)\wxscintilla_WordList.obj \ $(OBJS)\wxscintilla_AutoComplete.obj \ $(OBJS)\wxscintilla_CallTip.obj \ + $(OBJS)\wxscintilla_CaseConvert.obj \ + $(OBJS)\wxscintilla_CaseFolder.obj \ $(OBJS)\wxscintilla_Catalogue.obj \ $(OBJS)\wxscintilla_CellBuffer.obj \ $(OBJS)\wxscintilla_CharClassify.obj \ @@ -6655,6 +6664,9 @@ $(OBJS)\wxscintilla_LexCSS.obj: ..\..\src\stc\scintilla\lexers\LexCSS.cxx $(OBJS)\wxscintilla_LexD.obj: ..\..\src\stc\scintilla\lexers\LexD.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexD.cxx +$(OBJS)\wxscintilla_LexDMAP.obj: ..\..\src\stc\scintilla\lexers\LexDMAP.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexDMAP.cxx + $(OBJS)\wxscintilla_LexECL.obj: ..\..\src\stc\scintilla\lexers\LexECL.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexECL.cxx @@ -6694,6 +6706,12 @@ $(OBJS)\wxscintilla_LexInno.obj: ..\..\src\stc\scintilla\lexers\LexInno.cxx $(OBJS)\wxscintilla_LexKix.obj: ..\..\src\stc\scintilla\lexers\LexKix.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexKix.cxx +$(OBJS)\wxscintilla_LexKVIrc.obj: ..\..\src\stc\scintilla\lexers\LexKVIrc.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexKVIrc.cxx + +$(OBJS)\wxscintilla_LexLaTeX.obj: ..\..\src\stc\scintilla\lexers\LexLaTeX.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexLaTeX.cxx + $(OBJS)\wxscintilla_LexLisp.obj: ..\..\src\stc\scintilla\lexers\LexLisp.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexLisp.cxx @@ -6757,6 +6775,9 @@ $(OBJS)\wxscintilla_LexPerl.obj: ..\..\src\stc\scintilla\lexers\LexPerl.cxx $(OBJS)\wxscintilla_LexPLM.obj: ..\..\src\stc\scintilla\lexers\LexPLM.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexPLM.cxx +$(OBJS)\wxscintilla_LexPO.obj: ..\..\src\stc\scintilla\lexers\LexPO.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexPO.cxx + $(OBJS)\wxscintilla_LexPOV.obj: ..\..\src\stc\scintilla\lexers\LexPOV.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexPOV.cxx @@ -6784,6 +6805,9 @@ $(OBJS)\wxscintilla_LexRebol.obj: ..\..\src\stc\scintilla\lexers\LexRebol.cxx $(OBJS)\wxscintilla_LexRuby.obj: ..\..\src\stc\scintilla\lexers\LexRuby.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRuby.cxx +$(OBJS)\wxscintilla_LexRust.obj: ..\..\src\stc\scintilla\lexers\LexRust.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexRust.cxx + $(OBJS)\wxscintilla_LexScriptol.obj: ..\..\src\stc\scintilla\lexers\LexScriptol.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexScriptol.cxx @@ -6805,6 +6829,9 @@ $(OBJS)\wxscintilla_LexSpice.obj: ..\..\src\stc\scintilla\lexers\LexSpice.cxx $(OBJS)\wxscintilla_LexSQL.obj: ..\..\src\stc\scintilla\lexers\LexSQL.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexSQL.cxx +$(OBJS)\wxscintilla_LexSTTXT.obj: ..\..\src\stc\scintilla\lexers\LexSTTXT.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexSTTXT.cxx + $(OBJS)\wxscintilla_LexTACL.obj: ..\..\src\stc\scintilla\lexers\LexTACL.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexers\LexTACL.cxx @@ -6844,6 +6871,9 @@ $(OBJS)\wxscintilla_LexYAML.obj: ..\..\src\stc\scintilla\lexers\LexYAML.cxx $(OBJS)\wxscintilla_Accessor.obj: ..\..\src\stc\scintilla\lexlib\Accessor.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexlib\Accessor.cxx +$(OBJS)\wxscintilla_CharacterCategory.obj: ..\..\src\stc\scintilla\lexlib\CharacterCategory.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexlib\CharacterCategory.cxx + $(OBJS)\wxscintilla_CharacterSet.obj: ..\..\src\stc\scintilla\lexlib\CharacterSet.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\lexlib\CharacterSet.cxx @@ -6874,6 +6904,12 @@ $(OBJS)\wxscintilla_AutoComplete.obj: ..\..\src\stc\scintilla\src\AutoComplete.c $(OBJS)\wxscintilla_CallTip.obj: ..\..\src\stc\scintilla\src\CallTip.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\CallTip.cxx +$(OBJS)\wxscintilla_CaseConvert.obj: ..\..\src\stc\scintilla\src\CaseConvert.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\CaseConvert.cxx + +$(OBJS)\wxscintilla_CaseFolder.obj: ..\..\src\stc\scintilla\src\CaseFolder.cxx + $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\CaseFolder.cxx + $(OBJS)\wxscintilla_Catalogue.obj: ..\..\src\stc\scintilla\src\Catalogue.cxx $(CXX) /c /nologo /TP /Fo$@ $(WXSCINTILLA_CXXFLAGS) ..\..\src\stc\scintilla\src\Catalogue.cxx diff --git a/build/msw/makefile.wat b/build/msw/makefile.wat index 58d27d1bfe..08989db780 100644 --- a/build/msw/makefile.wat +++ b/build/msw/makefile.wat @@ -3847,6 +3847,7 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_LexCsound.obj & $(OBJS)\wxscintilla_LexCSS.obj & $(OBJS)\wxscintilla_LexD.obj & + $(OBJS)\wxscintilla_LexDMAP.obj & $(OBJS)\wxscintilla_LexECL.obj & $(OBJS)\wxscintilla_LexEiffel.obj & $(OBJS)\wxscintilla_LexErlang.obj & @@ -3860,6 +3861,8 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_LexHTML.obj & $(OBJS)\wxscintilla_LexInno.obj & $(OBJS)\wxscintilla_LexKix.obj & + $(OBJS)\wxscintilla_LexKVIrc.obj & + $(OBJS)\wxscintilla_LexLaTeX.obj & $(OBJS)\wxscintilla_LexLisp.obj & $(OBJS)\wxscintilla_LexLout.obj & $(OBJS)\wxscintilla_LexLua.obj & @@ -3881,6 +3884,7 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_LexPB.obj & $(OBJS)\wxscintilla_LexPerl.obj & $(OBJS)\wxscintilla_LexPLM.obj & + $(OBJS)\wxscintilla_LexPO.obj & $(OBJS)\wxscintilla_LexPOV.obj & $(OBJS)\wxscintilla_LexPowerPro.obj & $(OBJS)\wxscintilla_LexPowerShell.obj & @@ -3890,6 +3894,7 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_LexR.obj & $(OBJS)\wxscintilla_LexRebol.obj & $(OBJS)\wxscintilla_LexRuby.obj & + $(OBJS)\wxscintilla_LexRust.obj & $(OBJS)\wxscintilla_LexScriptol.obj & $(OBJS)\wxscintilla_LexSmalltalk.obj & $(OBJS)\wxscintilla_LexSML.obj & @@ -3897,6 +3902,7 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_LexSpecman.obj & $(OBJS)\wxscintilla_LexSpice.obj & $(OBJS)\wxscintilla_LexSQL.obj & + $(OBJS)\wxscintilla_LexSTTXT.obj & $(OBJS)\wxscintilla_LexTACL.obj & $(OBJS)\wxscintilla_LexTADS3.obj & $(OBJS)\wxscintilla_LexTAL.obj & @@ -3910,6 +3916,7 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_LexVisualProlog.obj & $(OBJS)\wxscintilla_LexYAML.obj & $(OBJS)\wxscintilla_Accessor.obj & + $(OBJS)\wxscintilla_CharacterCategory.obj & $(OBJS)\wxscintilla_CharacterSet.obj & $(OBJS)\wxscintilla_LexerBase.obj & $(OBJS)\wxscintilla_LexerModule.obj & @@ -3920,6 +3927,8 @@ WXSCINTILLA_OBJECTS = & $(OBJS)\wxscintilla_WordList.obj & $(OBJS)\wxscintilla_AutoComplete.obj & $(OBJS)\wxscintilla_CallTip.obj & + $(OBJS)\wxscintilla_CaseConvert.obj & + $(OBJS)\wxscintilla_CaseFolder.obj & $(OBJS)\wxscintilla_Catalogue.obj & $(OBJS)\wxscintilla_CellBuffer.obj & $(OBJS)\wxscintilla_CharClassify.obj & @@ -6412,6 +6421,9 @@ $(OBJS)\wxscintilla_LexCSS.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\Lex $(OBJS)\wxscintilla_LexD.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexD.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexDMAP.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexDMAP.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexECL.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexECL.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -6451,6 +6463,12 @@ $(OBJS)\wxscintilla_LexInno.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\Le $(OBJS)\wxscintilla_LexKix.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexKix.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexKVIrc.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexKVIrc.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + +$(OBJS)\wxscintilla_LexLaTeX.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexLaTeX.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexLisp.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexLisp.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -6514,6 +6532,9 @@ $(OBJS)\wxscintilla_LexPerl.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\Le $(OBJS)\wxscintilla_LexPLM.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexPLM.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexPO.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexPO.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexPOV.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexPOV.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -6541,6 +6562,9 @@ $(OBJS)\wxscintilla_LexRebol.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\L $(OBJS)\wxscintilla_LexRuby.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexRuby.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexRust.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexRust.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexScriptol.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexScriptol.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -6562,6 +6586,9 @@ $(OBJS)\wxscintilla_LexSpice.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\L $(OBJS)\wxscintilla_LexSQL.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexSQL.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_LexSTTXT.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexSTTXT.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_LexTACL.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\LexTACL.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -6601,6 +6628,9 @@ $(OBJS)\wxscintilla_LexYAML.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexers\Le $(OBJS)\wxscintilla_Accessor.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexlib\Accessor.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_CharacterCategory.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexlib\CharacterCategory.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_CharacterSet.obj : .AUTODEPEND ..\..\src\stc\scintilla\lexlib\CharacterSet.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< @@ -6631,6 +6661,12 @@ $(OBJS)\wxscintilla_AutoComplete.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\ $(OBJS)\wxscintilla_CallTip.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\CallTip.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< +$(OBJS)\wxscintilla_CaseConvert.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\CaseConvert.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + +$(OBJS)\wxscintilla_CaseFolder.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\CaseFolder.cxx + $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< + $(OBJS)\wxscintilla_Catalogue.obj : .AUTODEPEND ..\..\src\stc\scintilla\src\Catalogue.cxx $(CXX) -bt=nt -zq -fo=$^@ $(WXSCINTILLA_CXXFLAGS) $< diff --git a/build/msw/wx_vc10_wxscintilla.vcxproj b/build/msw/wx_vc10_wxscintilla.vcxproj index 531777ec72..1a3c8bf041 100644 --- a/build/msw/wx_vc10_wxscintilla.vcxproj +++ b/build/msw/wx_vc10_wxscintilla.vcxproj @@ -396,8 +396,11 @@ + + + @@ -434,6 +437,7 @@ + @@ -447,6 +451,8 @@ + + @@ -466,6 +472,7 @@ + @@ -477,8 +484,10 @@ + + @@ -580,4 +589,4 @@ - \ No newline at end of file + diff --git a/build/msw/wx_vc10_wxscintilla.vcxproj.filters b/build/msw/wx_vc10_wxscintilla.vcxproj.filters index 81f348d5c1..7ea3d3a46f 100644 --- a/build/msw/wx_vc10_wxscintilla.vcxproj.filters +++ b/build/msw/wx_vc10_wxscintilla.vcxproj.filters @@ -14,12 +14,21 @@ Source Files + + Source Files + Source Files Source Files + + Source Files + + + Source Files + Source Files @@ -128,6 +137,9 @@ Source Files + + Source Files + Source Files @@ -167,6 +179,12 @@ Source Files + + Source Files + + + Source Files + Source Files @@ -224,6 +242,9 @@ Source Files + + Source Files + Source Files @@ -263,6 +284,9 @@ Source Files + + Source Files + Source Files diff --git a/build/msw/wx_vc11_wxscintilla.vcxproj b/build/msw/wx_vc11_wxscintilla.vcxproj index 5e0190cf41..3c0358db15 100644 --- a/build/msw/wx_vc11_wxscintilla.vcxproj +++ b/build/msw/wx_vc11_wxscintilla.vcxproj @@ -434,8 +434,11 @@ + + + @@ -472,6 +475,7 @@ + @@ -485,6 +489,8 @@ + + @@ -504,6 +510,7 @@ + @@ -515,8 +522,10 @@ + + @@ -618,4 +627,4 @@ - \ No newline at end of file + diff --git a/build/msw/wx_vc11_wxscintilla.vcxproj.filters b/build/msw/wx_vc11_wxscintilla.vcxproj.filters index 1b75ea62c8..8158726d16 100644 --- a/build/msw/wx_vc11_wxscintilla.vcxproj.filters +++ b/build/msw/wx_vc11_wxscintilla.vcxproj.filters @@ -14,12 +14,21 @@ Source Files + + Source Files + Source Files Source Files + + Source Files + + + Source Files + Source Files @@ -128,6 +137,9 @@ Source Files + + Source Files + Source Files @@ -167,6 +179,12 @@ Source Files + + Source Files + + + Source Files + Source Files @@ -224,6 +242,9 @@ Source Files + + Source Files + Source Files @@ -263,6 +284,9 @@ Source Files + + Source Files + Source Files diff --git a/build/msw/wx_vc12_wxscintilla.vcxproj b/build/msw/wx_vc12_wxscintilla.vcxproj index 064edb46b3..e013ea27c6 100644 --- a/build/msw/wx_vc12_wxscintilla.vcxproj +++ b/build/msw/wx_vc12_wxscintilla.vcxproj @@ -434,8 +434,11 @@ + + + @@ -472,6 +475,7 @@ + @@ -485,6 +489,8 @@ + + @@ -504,6 +510,7 @@ + @@ -515,8 +522,10 @@ + + @@ -618,4 +627,4 @@ - \ No newline at end of file + diff --git a/build/msw/wx_vc12_wxscintilla.vcxproj.filters b/build/msw/wx_vc12_wxscintilla.vcxproj.filters index 1b75ea62c8..8158726d16 100644 --- a/build/msw/wx_vc12_wxscintilla.vcxproj.filters +++ b/build/msw/wx_vc12_wxscintilla.vcxproj.filters @@ -14,12 +14,21 @@ Source Files + + Source Files + Source Files Source Files + + Source Files + + + Source Files + Source Files @@ -128,6 +137,9 @@ Source Files + + Source Files + Source Files @@ -167,6 +179,12 @@ Source Files + + Source Files + + + Source Files + Source Files @@ -224,6 +242,9 @@ Source Files + + Source Files + Source Files @@ -263,6 +284,9 @@ Source Files + + Source Files + Source Files diff --git a/build/msw/wx_vc7_wxscintilla.vcproj b/build/msw/wx_vc7_wxscintilla.vcproj index 98b4c15cb5..e5961cb068 100644 --- a/build/msw/wx_vc7_wxscintilla.vcproj +++ b/build/msw/wx_vc7_wxscintilla.vcproj @@ -256,6 +256,12 @@ + + + + @@ -265,6 +271,9 @@ + + @@ -364,6 +373,9 @@ + + @@ -400,9 +412,15 @@ + + + + @@ -460,6 +478,9 @@ + + @@ -493,12 +514,18 @@ + + + + diff --git a/build/msw/wx_vc8_wxscintilla.vcproj b/build/msw/wx_vc8_wxscintilla.vcproj index 9e150277e8..f8851adc13 100644 --- a/build/msw/wx_vc8_wxscintilla.vcproj +++ b/build/msw/wx_vc8_wxscintilla.vcproj @@ -365,6 +365,14 @@ RelativePath="..\..\src\stc\scintilla\src\CallTip.cxx" > + + + + @@ -377,6 +385,10 @@ RelativePath="..\..\src\stc\scintilla\src\CharClassify.cxx" > + + @@ -509,6 +521,10 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexD.cxx" > + + @@ -557,10 +573,18 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx" > + + + + @@ -637,6 +661,10 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexPLM.cxx" > + + @@ -681,6 +709,10 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx" > + + @@ -689,6 +721,10 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexSQL.cxx" > + + diff --git a/build/msw/wx_vc9_wxscintilla.vcproj b/build/msw/wx_vc9_wxscintilla.vcproj index e183cfe553..638e5abb5c 100644 --- a/build/msw/wx_vc9_wxscintilla.vcproj +++ b/build/msw/wx_vc9_wxscintilla.vcproj @@ -363,6 +363,14 @@ RelativePath="..\..\src\stc\scintilla\src\CallTip.cxx" > + + + + @@ -375,6 +383,10 @@ RelativePath="..\..\src\stc\scintilla\src\CharClassify.cxx" > + + @@ -507,6 +519,10 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexD.cxx" > + + @@ -555,10 +571,18 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexInno.cxx" > + + + + @@ -635,6 +659,10 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexPLM.cxx" > + + @@ -679,6 +707,10 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexRuby.cxx" > + + @@ -687,6 +719,10 @@ RelativePath="..\..\src\stc\scintilla\lexers\LexSQL.cxx" > + + diff --git a/build/msw/wx_wxscintilla.dsp b/build/msw/wx_wxscintilla.dsp index 4765f66b5d..4a894e0665 100644 --- a/build/msw/wx_wxscintilla.dsp +++ b/build/msw/wx_wxscintilla.dsp @@ -147,6 +147,14 @@ SOURCE=..\..\src\stc\scintilla\src\CallTip.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\src\CaseConvert.cxx +# End Source File +# Begin Source File + +SOURCE=..\..\src\stc\scintilla\src\CaseFolder.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\src\Catalogue.cxx # End Source File # Begin Source File @@ -159,6 +167,10 @@ SOURCE=..\..\src\stc\scintilla\src\CharClassify.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\lexlib\CharacterCategory.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\lexlib\CharacterSet.cxx # End Source File # Begin Source File @@ -291,6 +303,10 @@ SOURCE=..\..\src\stc\scintilla\lexers\LexD.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\lexers\LexDMAP.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\lexers\LexECL.cxx # End Source File # Begin Source File @@ -339,10 +355,18 @@ SOURCE=..\..\src\stc\scintilla\lexers\LexInno.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\lexers\LexKVIrc.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\lexers\LexKix.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\lexers\LexLaTeX.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\lexers\LexLisp.cxx # End Source File # Begin Source File @@ -419,6 +443,10 @@ SOURCE=..\..\src\stc\scintilla\lexers\LexPLM.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\lexers\LexPO.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\lexers\LexPOV.cxx # End Source File # Begin Source File @@ -463,6 +491,10 @@ SOURCE=..\..\src\stc\scintilla\lexers\LexRuby.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\lexers\LexRust.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\lexers\LexSML.cxx # End Source File # Begin Source File @@ -471,6 +503,10 @@ SOURCE=..\..\src\stc\scintilla\lexers\LexSQL.cxx # End Source File # Begin Source File +SOURCE=..\..\src\stc\scintilla\lexers\LexSTTXT.cxx +# End Source File +# Begin Source File + SOURCE=..\..\src\stc\scintilla\lexers\LexScriptol.cxx # End Source File # Begin Source File diff --git a/docs/changes.txt b/docs/changes.txt index d01b6e501a..2a8510e7f2 100644 --- a/docs/changes.txt +++ b/docs/changes.txt @@ -38,6 +38,7 @@ All (GUI): - Optimized wxRTC insertion and deletion when floating objects are present. - Added on-demand image loading option to wxRTC. - Add wxFont::GetBaseFont() (Melroy Tellis). +- Update included Scintilla to version 3.3.9 (Christian Walther). wxGTK: diff --git a/include/wx/stc/stc.h b/include/wx/stc/stc.h index 833a68b51a..3209a6922c 100644 --- a/include/wx/stc/stc.h +++ b/include/wx/stc/stc.h @@ -111,6 +111,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_MARK_AVAILABLE 28 #define wxSTC_MARK_UNDERLINE 29 #define wxSTC_MARK_RGBAIMAGE 30 +#define wxSTC_MARK_BOOKMARK 31 #define wxSTC_MARK_CHARACTER 10000 /// Markers used for outlining column. @@ -122,6 +123,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_MARKNUM_FOLDER 30 #define wxSTC_MARKNUM_FOLDEROPEN 31 #define wxSTC_MASK_FOLDERS 0xFE000000 +#define wxSTC_MAX_MARGIN 4 #define wxSTC_MARGIN_SYMBOL 0 #define wxSTC_MARGIN_NUMBER 1 #define wxSTC_MARGIN_BACK 2 @@ -186,6 +188,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_INDIC_DOTS 10 #define wxSTC_INDIC_SQUIGGLELOW 11 #define wxSTC_INDIC_DOTBOX 12 +#define wxSTC_INDIC_SQUIGGLEPIXMAP 13 +#define wxSTC_INDIC_COMPOSITIONTHICK 14 #define wxSTC_INDIC_MAX 31 #define wxSTC_INDIC_CONTAINER 8 #define wxSTC_INDIC0_MASK 0x20 @@ -211,8 +215,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; /// PrintColourMode - only the default-background is forced to be white for printing. #define wxSTC_PRINT_COLOURONWHITEDEFAULTBG 4 -#define wxSTC_FIND_WHOLEWORD 2 -#define wxSTC_FIND_MATCHCASE 4 +#define wxSTC_FIND_WHOLEWORD 0x2 +#define wxSTC_FIND_MATCHCASE 0x4 #define wxSTC_FIND_WORDSTART 0x00100000 #define wxSTC_FIND_REGEXP 0x00200000 #define wxSTC_FIND_POSIX 0x00400000 @@ -220,6 +224,12 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_FOLDLEVELWHITEFLAG 0x1000 #define wxSTC_FOLDLEVELHEADERFLAG 0x2000 #define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF +#define wxSTC_FOLDACTION_CONTRACT 0 +#define wxSTC_FOLDACTION_EXPAND 1 +#define wxSTC_FOLDACTION_TOGGLE 2 +#define wxSTC_AUTOMATICFOLD_SHOW 0x0001 +#define wxSTC_AUTOMATICFOLD_CLICK 0x0002 +#define wxSTC_AUTOMATICFOLD_CHANGE 0x0004 #define wxSTC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 #define wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 #define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 @@ -298,6 +308,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_SEL_THIN 3 #define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0 #define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 +#define wxSTC_ORDER_PRESORTED 0 +#define wxSTC_ORDER_PERFORMSORT 1 +#define wxSTC_ORDER_CUSTOM 2 #define wxSTC_CARETSTICKY_OFF 0 #define wxSTC_CARETSTICKY_ON 1 #define wxSTC_CARETSTICKY_WHITESPACE 2 @@ -492,6 +505,11 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_LEX_ECL 105 #define wxSTC_LEX_OSCRIPT 106 #define wxSTC_LEX_VISUALPROLOG 107 +#define wxSTC_LEX_LITERATEHASKELL 108 +#define wxSTC_LEX_STTXT 109 +#define wxSTC_LEX_KVIRC 110 +#define wxSTC_LEX_RUST 111 +#define wxSTC_LEX_DMAP 112 /// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a /// value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -540,6 +558,8 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_C_TRIPLEVERBATIM 21 #define wxSTC_C_HASHQUOTEDSTRING 22 #define wxSTC_C_PREPROCESSORCOMMENT 23 +#define wxSTC_C_PREPROCESSORCOMMENTDOC 24 +#define wxSTC_C_USERLITERAL 25 /// Lexical states for SCLEX_D #define wxSTC_D_DEFAULT 0 @@ -830,6 +850,10 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_B_ERROR 16 #define wxSTC_B_HEXNUMBER 17 #define wxSTC_B_BINNUMBER 18 +#define wxSTC_B_COMMENTBLOCK 19 +#define wxSTC_B_DOCLINE 20 +#define wxSTC_B_DOCBLOCK 21 +#define wxSTC_B_DOCKEYWORD 22 /// Lexical states for SCLEX_PROPERTIES #define wxSTC_PROPS_DEFAULT 0 @@ -900,6 +924,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_ERR_TIDY 19 #define wxSTC_ERR_JAVA_STACK 20 #define wxSTC_ERR_VALUE 21 +#define wxSTC_ERR_GCC_INCLUDED_FROM 22 /// Lexical states for SCLEX_BATCH #define wxSTC_BAT_DEFAULT 0 @@ -1525,6 +1550,12 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_HA_COMMENTBLOCK 14 #define wxSTC_HA_COMMENTBLOCK2 15 #define wxSTC_HA_COMMENTBLOCK3 16 +#define wxSTC_HA_PRAGMA 17 +#define wxSTC_HA_PREPROCESSOR 18 +#define wxSTC_HA_STRINGEOL 19 +#define wxSTC_HA_RESERVED_OPERATOR 20 +#define wxSTC_HA_LITERATE_COMMENT 21 +#define wxSTC_HA_LITERATE_CODEDELIM 22 /// Lexical states of SCLEX_TADS3 #define wxSTC_T3_DEFAULT 0 @@ -1831,7 +1862,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_R_INFIX 10 #define wxSTC_R_INFIXEOL 11 -/// Lexical state for SCLEX_MAGIKSF +/// Lexical state for SCLEX_MAGIK #define wxSTC_MAGIK_DEFAULT 0 #define wxSTC_MAGIK_COMMENT 1 #define wxSTC_MAGIK_HYPER_COMMENT 16 @@ -1865,6 +1896,9 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_POWERSHELL_FUNCTION 11 #define wxSTC_POWERSHELL_USER1 12 #define wxSTC_POWERSHELL_COMMENTSTREAM 13 +#define wxSTC_POWERSHELL_HERE_STRING 14 +#define wxSTC_POWERSHELL_HERE_CHARACTER 15 +#define wxSTC_POWERSHELL_COMMENTDOCKEYWORD 16 /// Lexical state for SCLEX_MYSQL #define wxSTC_MYSQL_DEFAULT 0 @@ -1889,6 +1923,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_MYSQL_USER2 19 #define wxSTC_MYSQL_USER3 20 #define wxSTC_MYSQL_HIDDENCOMMAND 21 +#define wxSTC_MYSQL_PLACEHOLDER 22 /// Lexical state for SCLEX_PO #define wxSTC_PO_DEFAULT 0 @@ -1900,6 +1935,13 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_PO_MSGCTXT 6 #define wxSTC_PO_MSGCTXT_TEXT 7 #define wxSTC_PO_FUZZY 8 +#define wxSTC_PO_PROGRAMMER_COMMENT 9 +#define wxSTC_PO_REFERENCE 10 +#define wxSTC_PO_FLAGS 11 +#define wxSTC_PO_MSGID_TEXT_EOL 12 +#define wxSTC_PO_MSGSTR_TEXT_EOL 13 +#define wxSTC_PO_MSGCTXT_TEXT_EOL 14 +#define wxSTC_PO_ERROR 15 /// Lexical states for SCLEX_PASCAL #define wxSTC_PAS_DEFAULT 0 @@ -2082,7 +2124,6 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_COFFEESCRIPT_GLOBALCLASS 19 #define wxSTC_COFFEESCRIPT_STRINGRAW 20 #define wxSTC_COFFEESCRIPT_TRIPLEVERBATIM 21 -#define wxSTC_COFFEESCRIPT_HASHQUOTEDSTRING 22 #define wxSTC_COFFEESCRIPT_COMMENTBLOCK 22 #define wxSTC_COFFEESCRIPT_VERBOSE_REGEX 23 #define wxSTC_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24 @@ -2180,6 +2221,86 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; #define wxSTC_VISUALPROLOG_STRING_VERBATIM_SPECIAL 21 #define wxSTC_VISUALPROLOG_STRING_VERBATIM_EOL 22 +/// Lexical states for SCLEX_STTXT +#define wxSTC_STTXT_DEFAULT 0 +#define wxSTC_STTXT_COMMENT 1 +#define wxSTC_STTXT_COMMENTLINE 2 +#define wxSTC_STTXT_KEYWORD 3 +#define wxSTC_STTXT_TYPE 4 +#define wxSTC_STTXT_FUNCTION 5 +#define wxSTC_STTXT_FB 6 +#define wxSTC_STTXT_NUMBER 7 +#define wxSTC_STTXT_HEXNUMBER 8 +#define wxSTC_STTXT_PRAGMA 9 +#define wxSTC_STTXT_OPERATOR 10 +#define wxSTC_STTXT_CHARACTER 11 +#define wxSTC_STTXT_STRING1 12 +#define wxSTC_STTXT_STRING2 13 +#define wxSTC_STTXT_STRINGEOL 14 +#define wxSTC_STTXT_IDENTIFIER 15 +#define wxSTC_STTXT_DATETIME 16 +#define wxSTC_STTXT_VARS 17 +#define wxSTC_STTXT_PRAGMAS 18 + +/// Lexical states for SCLEX_KVIRC +#define wxSTC_KVIRC_DEFAULT 0 +#define wxSTC_KVIRC_COMMENT 1 +#define wxSTC_KVIRC_COMMENTBLOCK 2 +#define wxSTC_KVIRC_STRING 3 +#define wxSTC_KVIRC_WORD 4 +#define wxSTC_KVIRC_KEYWORD 5 +#define wxSTC_KVIRC_FUNCTION_KEYWORD 6 +#define wxSTC_KVIRC_FUNCTION 7 +#define wxSTC_KVIRC_VARIABLE 8 +#define wxSTC_KVIRC_NUMBER 9 +#define wxSTC_KVIRC_OPERATOR 10 +#define wxSTC_KVIRC_STRING_FUNCTION 11 +#define wxSTC_KVIRC_STRING_VARIABLE 12 + +/// Lexical states for SCLEX_RUST +#define wxSTC_RUST_DEFAULT 0 +#define wxSTC_RUST_COMMENTBLOCK 1 +#define wxSTC_RUST_COMMENTLINE 2 +#define wxSTC_RUST_COMMENTBLOCKDOC 3 +#define wxSTC_RUST_COMMENTLINEDOC 4 +#define wxSTC_RUST_NUMBER 5 +#define wxSTC_RUST_WORD 6 +#define wxSTC_RUST_WORD2 7 +#define wxSTC_RUST_WORD3 8 +#define wxSTC_RUST_WORD4 9 +#define wxSTC_RUST_WORD5 10 +#define wxSTC_RUST_WORD6 11 +#define wxSTC_RUST_WORD7 12 +#define wxSTC_RUST_STRING 13 +#define wxSTC_RUST_STRINGR 14 +#define wxSTC_RUST_CHARACTER 15 +#define wxSTC_RUST_OPERATOR 16 +#define wxSTC_RUST_IDENTIFIER 17 +#define wxSTC_RUST_LIFETIME 18 +#define wxSTC_RUST_MACRO 19 +#define wxSTC_RUST_LEXERROR 20 + +/// Lexical states for SCLEX_DMAP +#define wxSTC_DMAP_DEFAULT 0 +#define wxSTC_DMAP_COMMENT 1 +#define wxSTC_DMAP_NUMBER 2 +#define wxSTC_DMAP_STRING1 3 +#define wxSTC_DMAP_STRING2 4 +#define wxSTC_DMAP_STRINGEOL 5 +#define wxSTC_DMAP_OPERATOR 6 +#define wxSTC_DMAP_IDENTIFIER 7 +#define wxSTC_DMAP_WORD 8 +#define wxSTC_DMAP_WORD2 9 +#define wxSTC_DMAP_WORD3 10 + +/// Events +/// GTK+ Specific to work around focus and accelerator problems: +/// Line end types which may be used in addition to LF, CR, and CRLF +/// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator, +/// U+2029 Paragraph Separator, and U+0085 Next Line +#define wxSTC_LINE_END_TYPE_DEFAULT 0 +#define wxSTC_LINE_END_TYPE_UNICODE 1 + //}}} //---------------------------------------------------------------------- @@ -2475,6 +2596,13 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar; /// Scroll to end of document. #define wxSTC_CMD_SCROLLTOEND 2629 +/// Move caret to before first visible character on display line. +/// If already there move to first character on display line. +#define wxSTC_CMD_VCHOMEDISPLAY 2652 + +/// Like VCHomeDisplay but extending selection to new caret position. +#define wxSTC_CMD_VCHOMEDISPLAYEXTEND 2653 + //}}} //---------------------------------------------------------------------- @@ -3185,6 +3313,11 @@ public: // Ensure the caret is visible. void EnsureCaretVisible(); + // Scroll the argument positions and the range between them into view giving + // priority to the primary position then the secondary position. + // This may be used to make a search match visible. + void ScrollRange(int secondary, int primary); + // Replace the selected text with the argument text. void ReplaceSelection(const wxString& text); @@ -3286,6 +3419,9 @@ public: // Retrieve the position where the caret was before displaying the call tip. int CallTipPosAtStart(); + // Set the start position in order to change when backspacing removes the calltip. + void CallTipSetPosAtStart(int posStart); + // Highlight a segment of the definition. void CallTipSetHighlight(int start, int end); @@ -3348,9 +3484,27 @@ public: // Switch a header line between expanded and contracted. void ToggleFold(int line); + // Expand or contract a fold header. + void FoldLine(int line, int action); + + // Expand or contract a fold header and its children. + void FoldChildren(int line, int action); + + // Expand a fold header and all children. Use the level argument instead of the line's current level. + void ExpandChildren(int line, int level); + + // Expand or contract all fold headers. + void FoldAll(int action); + // Ensure a particular line is visible by expanding any header line hiding it. void EnsureVisible(int line); + // Set automatic folding behaviours. + void SetAutomaticFold(int automaticFold); + + // Get automatic folding behaviours. + int GetAutomaticFold() const; + // Set some style options for folding. void SetFoldFlags(int flags); @@ -3873,6 +4027,10 @@ public: // page into account. Maximum value returned is the last position in the document. int PositionAfter(int pos); + // Given a valid document position, return a position that differs in a number + // of characters. Returned value is always between 0 and last position in document. + int PositionRelative(int pos, int relative); + // Copy a range of text to the clipboard. Positions are clipped into the document. void CopyRange(int start, int end); @@ -3971,6 +4129,12 @@ public: // Get auto-completion case insensitive behaviour. int AutoCompGetCaseInsensitiveBehaviour() const; + // Set the way autocompletion lists are ordered. + void AutoCompSetOrder(int order); + + // Get the way autocompletion lists are ordered. + int AutoCompGetOrder() const; + // Enlarge the document to a particular size of text bytes. void Allocate(int bytes); @@ -4162,6 +4326,12 @@ public: // Get the start of the range of style numbers used for annotations int AnnotationGetStyleOffset() const; + // Release all extended (>255) style numbers + void ReleaseAllExtendedStyles(); + + // Allocate some extended (>255) style numbers and return the start of the range + int AllocateExtendedStyles(int numberStyles); + // Add a container action to the undo stack void AddUndoAction(int token, int flags); @@ -4172,6 +4342,12 @@ public: // Return INVALID_POSITION if not close to text. int CharPositionFromPointClose(int x, int y); + // Set whether switching to rectangular mode while selecting with the mouse is allowed. + void SetMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch); + + // Whether switching to rectangular mode while selecting with the mouse is allowed. + bool GetMouseSelectionRectangularSwitch() const; + // Set whether multiple selections can be made void SetMultipleSelection(bool multipleSelection); @@ -4199,12 +4375,18 @@ public: // How many selections are there? int GetSelections() const; + // Is every selected range empty? + bool GetSelectionEmpty() const; + // Clear selections to a single empty stream selection void ClearSelections(); // Add a selection int AddSelection(int caret, int anchor); + // Drop one selection + void DropSelectionN(int selection); + // Set the main selection void SetMainSelection(int selection); @@ -4305,6 +4487,9 @@ public: // Set the height for future RGBA image data. void RGBAImageSetHeight(int height); + // Set the scale factor in percent for future RGBA image data. + void RGBAImageSetScale(int scalePercent); + // Define a marker from RGBA data. // It has the width and height from RGBAImageSetWidth/Height void MarkerDefineRGBAImage(int markerNumber, const unsigned char* pixels); @@ -4328,6 +4513,28 @@ public: // Create an ILoader*. void* CreateLoader(int bytes) const; + // Move caret to before first visible character on display line. + // If already there move to first character on display line. + void VCHomeDisplay(); + + // Like VCHomeDisplay but extending selection to new caret position. + void VCHomeDisplayExtend(); + + // Is the caret line always visible? + bool GetCaretLineVisibleAlways() const; + + // Sets the caret line to always visible. + void SetCaretLineVisibleAlways(bool alwaysVisible); + + // Set the way a character is drawn. + void SetRepresentation(const wxString& encodedCharacter, const wxString& representation); + + // Get the way a character is drawn. + wxString GetRepresentation(const wxString& encodedCharacter) const; + + // Remove a character representation. + void ClearRepresentation(const wxString& encodedCharacter); + // Start notifying the container of all key presses and commands. void StartRecord(); @@ -4381,6 +4588,47 @@ public: // Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer. wxString DescribeKeyWordSets() const; + // Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. + void SetLineEndTypesAllowed(int lineEndBitSet); + + // Get the line end types currently allowed. + int GetLineEndTypesAllowed() const; + + // Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. + int GetLineEndTypesActive() const; + + // Bit set of LineEndType enumertion for which line ends beyond the standard + // LF, CR, and CRLF are supported by the lexer. + int GetLineEndTypesSupported() const; + + // Allocate a set of sub styles for a particular base style, returning start of range + int AllocateSubStyles(int styleBase, int numberStyles); + + // The starting style number for the sub styles associated with a base style + int GetSubStylesStart(int styleBase) const; + + // The number of sub styles associated with a base style + int GetSubStylesLength(int styleBase) const; + + // For a sub style, return the base style, else return the argument. + int GetStyleFromSubStyle(int subStyle) const; + + // For a secondary style, return the primary style, else return the argument. + int GetPrimaryStyleFromStyle(int style) const; + + // Free allocated sub styles + void FreeSubStyles(); + + // Set the identifiers that are shown in a particular style + void SetIdentifiers(int style, const wxString& identifiers); + + // Where styles are duplicated by a feature such as active/inactive code + // return the distance between the two types. + int DistanceToSecondaryStyles() const; + + // Get the set of base styles that can be extended with sub styles + wxString GetSubStyleBases() const; + //}}} //---------------------------------------------------------------------- diff --git a/interface/wx/stc/stc.h b/interface/wx/stc/stc.h index 0f22c99636..0a3fc95b03 100644 --- a/interface/wx/stc/stc.h +++ b/interface/wx/stc/stc.h @@ -67,6 +67,7 @@ #define wxSTC_MARK_AVAILABLE 28 #define wxSTC_MARK_UNDERLINE 29 #define wxSTC_MARK_RGBAIMAGE 30 +#define wxSTC_MARK_BOOKMARK 31 #define wxSTC_MARK_CHARACTER 10000 /// Markers used for outlining column. @@ -78,6 +79,7 @@ #define wxSTC_MARKNUM_FOLDER 30 #define wxSTC_MARKNUM_FOLDEROPEN 31 #define wxSTC_MASK_FOLDERS 0xFE000000 +#define wxSTC_MAX_MARGIN 4 #define wxSTC_MARGIN_SYMBOL 0 #define wxSTC_MARGIN_NUMBER 1 #define wxSTC_MARGIN_BACK 2 @@ -142,6 +144,8 @@ #define wxSTC_INDIC_DOTS 10 #define wxSTC_INDIC_SQUIGGLELOW 11 #define wxSTC_INDIC_DOTBOX 12 +#define wxSTC_INDIC_SQUIGGLEPIXMAP 13 +#define wxSTC_INDIC_COMPOSITIONTHICK 14 #define wxSTC_INDIC_MAX 31 #define wxSTC_INDIC_CONTAINER 8 #define wxSTC_INDIC0_MASK 0x20 @@ -167,8 +171,8 @@ /// PrintColourMode - only the default-background is forced to be white for printing. #define wxSTC_PRINT_COLOURONWHITEDEFAULTBG 4 -#define wxSTC_FIND_WHOLEWORD 2 -#define wxSTC_FIND_MATCHCASE 4 +#define wxSTC_FIND_WHOLEWORD 0x2 +#define wxSTC_FIND_MATCHCASE 0x4 #define wxSTC_FIND_WORDSTART 0x00100000 #define wxSTC_FIND_REGEXP 0x00200000 #define wxSTC_FIND_POSIX 0x00400000 @@ -176,6 +180,12 @@ #define wxSTC_FOLDLEVELWHITEFLAG 0x1000 #define wxSTC_FOLDLEVELHEADERFLAG 0x2000 #define wxSTC_FOLDLEVELNUMBERMASK 0x0FFF +#define wxSTC_FOLDACTION_CONTRACT 0 +#define wxSTC_FOLDACTION_EXPAND 1 +#define wxSTC_FOLDACTION_TOGGLE 2 +#define wxSTC_AUTOMATICFOLD_SHOW 0x0001 +#define wxSTC_AUTOMATICFOLD_CLICK 0x0002 +#define wxSTC_AUTOMATICFOLD_CHANGE 0x0004 #define wxSTC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 #define wxSTC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 #define wxSTC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 @@ -254,6 +264,9 @@ #define wxSTC_SEL_THIN 3 #define wxSTC_CASEINSENSITIVEBEHAVIOUR_RESPECTCASE 0 #define wxSTC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 +#define wxSTC_ORDER_PRESORTED 0 +#define wxSTC_ORDER_PERFORMSORT 1 +#define wxSTC_ORDER_CUSTOM 2 #define wxSTC_CARETSTICKY_OFF 0 #define wxSTC_CARETSTICKY_ON 1 #define wxSTC_CARETSTICKY_WHITESPACE 2 @@ -448,6 +461,11 @@ #define wxSTC_LEX_ECL 105 #define wxSTC_LEX_OSCRIPT 106 #define wxSTC_LEX_VISUALPROLOG 107 +#define wxSTC_LEX_LITERATEHASKELL 108 +#define wxSTC_LEX_STTXT 109 +#define wxSTC_LEX_KVIRC 110 +#define wxSTC_LEX_RUST 111 +#define wxSTC_LEX_DMAP 112 /// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a /// value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -496,6 +514,8 @@ #define wxSTC_C_TRIPLEVERBATIM 21 #define wxSTC_C_HASHQUOTEDSTRING 22 #define wxSTC_C_PREPROCESSORCOMMENT 23 +#define wxSTC_C_PREPROCESSORCOMMENTDOC 24 +#define wxSTC_C_USERLITERAL 25 /// Lexical states for SCLEX_D #define wxSTC_D_DEFAULT 0 @@ -786,6 +806,10 @@ #define wxSTC_B_ERROR 16 #define wxSTC_B_HEXNUMBER 17 #define wxSTC_B_BINNUMBER 18 +#define wxSTC_B_COMMENTBLOCK 19 +#define wxSTC_B_DOCLINE 20 +#define wxSTC_B_DOCBLOCK 21 +#define wxSTC_B_DOCKEYWORD 22 /// Lexical states for SCLEX_PROPERTIES #define wxSTC_PROPS_DEFAULT 0 @@ -856,6 +880,7 @@ #define wxSTC_ERR_TIDY 19 #define wxSTC_ERR_JAVA_STACK 20 #define wxSTC_ERR_VALUE 21 +#define wxSTC_ERR_GCC_INCLUDED_FROM 22 /// Lexical states for SCLEX_BATCH #define wxSTC_BAT_DEFAULT 0 @@ -1481,6 +1506,12 @@ #define wxSTC_HA_COMMENTBLOCK 14 #define wxSTC_HA_COMMENTBLOCK2 15 #define wxSTC_HA_COMMENTBLOCK3 16 +#define wxSTC_HA_PRAGMA 17 +#define wxSTC_HA_PREPROCESSOR 18 +#define wxSTC_HA_STRINGEOL 19 +#define wxSTC_HA_RESERVED_OPERATOR 20 +#define wxSTC_HA_LITERATE_COMMENT 21 +#define wxSTC_HA_LITERATE_CODEDELIM 22 /// Lexical states of SCLEX_TADS3 #define wxSTC_T3_DEFAULT 0 @@ -1787,7 +1818,7 @@ #define wxSTC_R_INFIX 10 #define wxSTC_R_INFIXEOL 11 -/// Lexical state for SCLEX_MAGIKSF +/// Lexical state for SCLEX_MAGIK #define wxSTC_MAGIK_DEFAULT 0 #define wxSTC_MAGIK_COMMENT 1 #define wxSTC_MAGIK_HYPER_COMMENT 16 @@ -1821,6 +1852,9 @@ #define wxSTC_POWERSHELL_FUNCTION 11 #define wxSTC_POWERSHELL_USER1 12 #define wxSTC_POWERSHELL_COMMENTSTREAM 13 +#define wxSTC_POWERSHELL_HERE_STRING 14 +#define wxSTC_POWERSHELL_HERE_CHARACTER 15 +#define wxSTC_POWERSHELL_COMMENTDOCKEYWORD 16 /// Lexical state for SCLEX_MYSQL #define wxSTC_MYSQL_DEFAULT 0 @@ -1845,6 +1879,7 @@ #define wxSTC_MYSQL_USER2 19 #define wxSTC_MYSQL_USER3 20 #define wxSTC_MYSQL_HIDDENCOMMAND 21 +#define wxSTC_MYSQL_PLACEHOLDER 22 /// Lexical state for SCLEX_PO #define wxSTC_PO_DEFAULT 0 @@ -1856,6 +1891,13 @@ #define wxSTC_PO_MSGCTXT 6 #define wxSTC_PO_MSGCTXT_TEXT 7 #define wxSTC_PO_FUZZY 8 +#define wxSTC_PO_PROGRAMMER_COMMENT 9 +#define wxSTC_PO_REFERENCE 10 +#define wxSTC_PO_FLAGS 11 +#define wxSTC_PO_MSGID_TEXT_EOL 12 +#define wxSTC_PO_MSGSTR_TEXT_EOL 13 +#define wxSTC_PO_MSGCTXT_TEXT_EOL 14 +#define wxSTC_PO_ERROR 15 /// Lexical states for SCLEX_PASCAL #define wxSTC_PAS_DEFAULT 0 @@ -2038,7 +2080,6 @@ #define wxSTC_COFFEESCRIPT_GLOBALCLASS 19 #define wxSTC_COFFEESCRIPT_STRINGRAW 20 #define wxSTC_COFFEESCRIPT_TRIPLEVERBATIM 21 -#define wxSTC_COFFEESCRIPT_HASHQUOTEDSTRING 22 #define wxSTC_COFFEESCRIPT_COMMENTBLOCK 22 #define wxSTC_COFFEESCRIPT_VERBOSE_REGEX 23 #define wxSTC_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24 @@ -2136,6 +2177,86 @@ #define wxSTC_VISUALPROLOG_STRING_VERBATIM_SPECIAL 21 #define wxSTC_VISUALPROLOG_STRING_VERBATIM_EOL 22 +/// Lexical states for SCLEX_STTXT +#define wxSTC_STTXT_DEFAULT 0 +#define wxSTC_STTXT_COMMENT 1 +#define wxSTC_STTXT_COMMENTLINE 2 +#define wxSTC_STTXT_KEYWORD 3 +#define wxSTC_STTXT_TYPE 4 +#define wxSTC_STTXT_FUNCTION 5 +#define wxSTC_STTXT_FB 6 +#define wxSTC_STTXT_NUMBER 7 +#define wxSTC_STTXT_HEXNUMBER 8 +#define wxSTC_STTXT_PRAGMA 9 +#define wxSTC_STTXT_OPERATOR 10 +#define wxSTC_STTXT_CHARACTER 11 +#define wxSTC_STTXT_STRING1 12 +#define wxSTC_STTXT_STRING2 13 +#define wxSTC_STTXT_STRINGEOL 14 +#define wxSTC_STTXT_IDENTIFIER 15 +#define wxSTC_STTXT_DATETIME 16 +#define wxSTC_STTXT_VARS 17 +#define wxSTC_STTXT_PRAGMAS 18 + +/// Lexical states for SCLEX_KVIRC +#define wxSTC_KVIRC_DEFAULT 0 +#define wxSTC_KVIRC_COMMENT 1 +#define wxSTC_KVIRC_COMMENTBLOCK 2 +#define wxSTC_KVIRC_STRING 3 +#define wxSTC_KVIRC_WORD 4 +#define wxSTC_KVIRC_KEYWORD 5 +#define wxSTC_KVIRC_FUNCTION_KEYWORD 6 +#define wxSTC_KVIRC_FUNCTION 7 +#define wxSTC_KVIRC_VARIABLE 8 +#define wxSTC_KVIRC_NUMBER 9 +#define wxSTC_KVIRC_OPERATOR 10 +#define wxSTC_KVIRC_STRING_FUNCTION 11 +#define wxSTC_KVIRC_STRING_VARIABLE 12 + +/// Lexical states for SCLEX_RUST +#define wxSTC_RUST_DEFAULT 0 +#define wxSTC_RUST_COMMENTBLOCK 1 +#define wxSTC_RUST_COMMENTLINE 2 +#define wxSTC_RUST_COMMENTBLOCKDOC 3 +#define wxSTC_RUST_COMMENTLINEDOC 4 +#define wxSTC_RUST_NUMBER 5 +#define wxSTC_RUST_WORD 6 +#define wxSTC_RUST_WORD2 7 +#define wxSTC_RUST_WORD3 8 +#define wxSTC_RUST_WORD4 9 +#define wxSTC_RUST_WORD5 10 +#define wxSTC_RUST_WORD6 11 +#define wxSTC_RUST_WORD7 12 +#define wxSTC_RUST_STRING 13 +#define wxSTC_RUST_STRINGR 14 +#define wxSTC_RUST_CHARACTER 15 +#define wxSTC_RUST_OPERATOR 16 +#define wxSTC_RUST_IDENTIFIER 17 +#define wxSTC_RUST_LIFETIME 18 +#define wxSTC_RUST_MACRO 19 +#define wxSTC_RUST_LEXERROR 20 + +/// Lexical states for SCLEX_DMAP +#define wxSTC_DMAP_DEFAULT 0 +#define wxSTC_DMAP_COMMENT 1 +#define wxSTC_DMAP_NUMBER 2 +#define wxSTC_DMAP_STRING1 3 +#define wxSTC_DMAP_STRING2 4 +#define wxSTC_DMAP_STRINGEOL 5 +#define wxSTC_DMAP_OPERATOR 6 +#define wxSTC_DMAP_IDENTIFIER 7 +#define wxSTC_DMAP_WORD 8 +#define wxSTC_DMAP_WORD2 9 +#define wxSTC_DMAP_WORD3 10 + +/// Events +/// GTK+ Specific to work around focus and accelerator problems: +/// Line end types which may be used in addition to LF, CR, and CRLF +/// SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator, +/// U+2029 Paragraph Separator, and U+0085 Next Line +#define wxSTC_LINE_END_TYPE_DEFAULT 0 +#define wxSTC_LINE_END_TYPE_UNICODE 1 + //}}} // Commands that can be bound to keystrokes {{{ @@ -2429,6 +2550,13 @@ /// Scroll to end of document. #define wxSTC_CMD_SCROLLTOEND 2629 +/// Move caret to before first visible character on display line. +/// If already there move to first character on display line. +#define wxSTC_CMD_VCHOMEDISPLAY 2652 + +/// Like VCHomeDisplay but extending selection to new caret position. +#define wxSTC_CMD_VCHOMEDISPLAYEXTEND 2653 + //}}} @@ -3619,6 +3747,13 @@ public: */ void EnsureCaretVisible(); + /** + Scroll the argument positions and the range between them into view giving + priority to the primary position then the secondary position. + This may be used to make a search match visible. + */ + void ScrollRange(int secondary, int primary); + /** Replace the selected text with the argument text. */ @@ -3780,6 +3915,11 @@ public: */ int CallTipPosAtStart(); + /** + Set the start position in order to change when backspacing removes the calltip. + */ + void CallTipSetPosAtStart(int posStart); + /** Highlight a segment of the definition. */ @@ -3882,11 +4022,41 @@ public: */ void ToggleFold(int line); + /** + Expand or contract a fold header. + */ + void FoldLine(int line, int action); + + /** + Expand or contract a fold header and its children. + */ + void FoldChildren(int line, int action); + + /** + Expand a fold header and all children. Use the level argument instead of the line's current level. + */ + void ExpandChildren(int line, int level); + + /** + Expand or contract all fold headers. + */ + void FoldAll(int action); + /** Ensure a particular line is visible by expanding any header line hiding it. */ void EnsureVisible(int line); + /** + Set automatic folding behaviours. + */ + void SetAutomaticFold(int automaticFold); + + /** + Get automatic folding behaviours. + */ + int GetAutomaticFold() const; + /** Set some style options for folding. */ @@ -4729,6 +4899,12 @@ public: */ int PositionAfter(int pos); + /** + Given a valid document position, return a position that differs in a number + of characters. Returned value is always between 0 and last position in document. + */ + int PositionRelative(int pos, int relative); + /** Copy a range of text to the clipboard. Positions are clipped into the document. */ @@ -4889,6 +5065,16 @@ public: */ int AutoCompGetCaseInsensitiveBehaviour() const; + /** + Set the way autocompletion lists are ordered. + */ + void AutoCompSetOrder(int order); + + /** + Get the way autocompletion lists are ordered. + */ + int AutoCompGetOrder() const; + /** Enlarge the document to a particular size of text bytes. */ @@ -5204,6 +5390,16 @@ public: */ int AnnotationGetStyleOffset() const; + /** + Release all extended (>255) style numbers + */ + void ReleaseAllExtendedStyles(); + + /** + Allocate some extended (>255) style numbers and return the start of the range + */ + int AllocateExtendedStyles(int numberStyles); + /** Add a container action to the undo stack */ @@ -5220,6 +5416,16 @@ public: */ int CharPositionFromPointClose(int x, int y); + /** + Set whether switching to rectangular mode while selecting with the mouse is allowed. + */ + void SetMouseSelectionRectangularSwitch(bool mouseSelectionRectangularSwitch); + + /** + Whether switching to rectangular mode while selecting with the mouse is allowed. + */ + bool GetMouseSelectionRectangularSwitch() const; + /** Set whether multiple selections can be made */ @@ -5265,6 +5471,11 @@ public: */ int GetSelections() const; + /** + Is every selected range empty? + */ + bool GetSelectionEmpty() const; + /** Clear selections to a single empty stream selection */ @@ -5275,6 +5486,11 @@ public: */ int AddSelection(int caret, int anchor); + /** + Drop one selection + */ + void DropSelectionN(int selection); + /** Set the main selection */ @@ -5425,6 +5641,11 @@ public: */ void RGBAImageSetHeight(int height); + /** + Set the scale factor in percent for future RGBA image data. + */ + void RGBAImageSetScale(int scalePercent); + /** Define a marker from RGBA data. It has the width and height from RGBAImageSetWidth/Height @@ -5462,6 +5683,42 @@ public: */ void* CreateLoader(int bytes) const; + /** + Move caret to before first visible character on display line. + If already there move to first character on display line. + */ + void VCHomeDisplay(); + + /** + Like VCHomeDisplay but extending selection to new caret position. + */ + void VCHomeDisplayExtend(); + + /** + Is the caret line always visible? + */ + bool GetCaretLineVisibleAlways() const; + + /** + Sets the caret line to always visible. + */ + void SetCaretLineVisibleAlways(bool alwaysVisible); + + /** + Set the way a character is drawn. + */ + void SetRepresentation(const wxString& encodedCharacter, const wxString& representation); + + /** + Get the way a character is drawn. + */ + wxString GetRepresentation(const wxString& encodedCharacter) const; + + /** + Remove a character representation. + */ + void ClearRepresentation(const wxString& encodedCharacter); + /** Start notifying the container of all key presses and commands. */ @@ -5549,6 +5806,73 @@ public: */ wxString DescribeKeyWordSets() const; + /** + Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. + */ + void SetLineEndTypesAllowed(int lineEndBitSet); + + /** + Get the line end types currently allowed. + */ + int GetLineEndTypesAllowed() const; + + /** + Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. + */ + int GetLineEndTypesActive() const; + + /** + Bit set of LineEndType enumertion for which line ends beyond the standard + LF, CR, and CRLF are supported by the lexer. + */ + int GetLineEndTypesSupported() const; + + /** + Allocate a set of sub styles for a particular base style, returning start of range + */ + int AllocateSubStyles(int styleBase, int numberStyles); + + /** + The starting style number for the sub styles associated with a base style + */ + int GetSubStylesStart(int styleBase) const; + + /** + The number of sub styles associated with a base style + */ + int GetSubStylesLength(int styleBase) const; + + /** + For a sub style, return the base style, else return the argument. + */ + int GetStyleFromSubStyle(int subStyle) const; + + /** + For a secondary style, return the primary style, else return the argument. + */ + int GetPrimaryStyleFromStyle(int style) const; + + /** + Free allocated sub styles + */ + void FreeSubStyles(); + + /** + Set the identifiers that are shown in a particular style + */ + void SetIdentifiers(int style, const wxString& identifiers); + + /** + Where styles are duplicated by a feature such as active/inactive code + return the distance between the two types. + */ + int DistanceToSecondaryStyles() const; + + /** + Get the set of base styles that can be extended with sub styles + */ + wxString GetSubStyleBases() const; + //}}} diff --git a/src/stc/ScintillaWX.cpp b/src/stc/ScintillaWX.cpp index 503e05ea37..eb0d2cd4a4 100644 --- a/src/stc/ScintillaWX.cpp +++ b/src/stc/ScintillaWX.cpp @@ -283,7 +283,7 @@ void ScintillaWX::Finalise() { void ScintillaWX::StartDrag() { #if wxUSE_DRAG_AND_DROP - wxString dragText = stc2wx(drag.s, drag.len); + wxString dragText = stc2wx(drag.Data(), drag.Length()); // Send an event to allow the drag text to be changed wxStyledTextEvent evt(wxEVT_STC_START_DRAG, stc->GetId()); @@ -420,7 +420,7 @@ bool ScintillaWX::ModifyScrollBars(int nMax, int nPage) { int horizEnd = scrollWidth; if (horizEnd < 0) horizEnd = 0; - if (!horizontalScrollBarVisible || (wrapState != eWrapNone)) + if (!horizontalScrollBarVisible || Wrapping()) horizEnd = 0; int pageWidth = rcText.Width(); @@ -523,12 +523,12 @@ void ScintillaWX::Paste() { void ScintillaWX::CopyToClipboard(const SelectionText& st) { #if wxUSE_CLIPBOARD - if ( !st.len ) + if ( !st.LengthWithTerminator() ) return; wxTheClipboard->UsePrimarySelection(false); if (wxTheClipboard->Open()) { - wxString text = wxTextBuffer::Translate(stc2wx(st.s, st.len-1)); + wxString text = wxTextBuffer::Translate(stc2wx(st.Data(), st.Length())); wxTheClipboard->SetData(new wxTextDataObject(text)); wxTheClipboard->Close(); } @@ -591,7 +591,7 @@ void ScintillaWX::ClaimSelection() { CopySelectionRange(&st); wxTheClipboard->UsePrimarySelection(true); if (wxTheClipboard->Open()) { - wxString text = stc2wx(st.s, st.len); + wxString text = stc2wx(st.Data(), st.Length()); wxTheClipboard->SetData(new wxTextDataObject(text)); wxTheClipboard->Close(); } diff --git a/src/stc/ScintillaWX.h b/src/stc/ScintillaWX.h index 7f537f456f..a01f8020d3 100644 --- a/src/stc/ScintillaWX.h +++ b/src/stc/ScintillaWX.h @@ -25,6 +25,7 @@ #include #include #include +#include // These are all Scintilla headers #include "Platform.h" @@ -43,7 +44,6 @@ #include "WordList.h" #endif #include "ContractionState.h" -#include "SVector.h" #include "CellBuffer.h" #include "CallTip.h" #include "KeyMap.h" @@ -55,6 +55,7 @@ #include "ViewStyle.h" #include "CharClassify.h" #include "Decoration.h" +#include "CaseFolder.h" #include "Document.h" #include "Selection.h" #include "PositionCache.h" diff --git a/src/stc/gen_iface.py b/src/stc/gen_iface.py index 71eb171e68..78fe754bd2 100755 --- a/src/stc/gen_iface.py +++ b/src/stc/gen_iface.py @@ -55,7 +55,8 @@ cmdValues = [ 2011, (2450, 2455), 2518, (2619, 2621), - (2628, 2629) + (2628, 2629), + (2652, 2653) ] @@ -405,6 +406,8 @@ methodOverrideMap = { 'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0), 'AutoCSetCaseInsensitiveBehaviour' : ('AutoCompSetCaseInsensitiveBehaviour', 0, 0, 0), 'AutoCGetCaseInsensitiveBehaviour' : ('AutoCompGetCaseInsensitiveBehaviour', 0, 0, 0), + 'AutoCSetOrder' : ('AutoCompSetOrder', 0, 0, 0), + 'AutoCGetOrder' : ('AutoCompGetOrder', 0, 0, 0), 'RegisterImage' : (0, @@ -584,6 +587,7 @@ methodOverrideMap = { 'GetDirectPointer' : (None, 0, 0, 0), 'CallTipPosStart' : ('CallTipPosAtStart', 0, 0, 0), + 'CallTipSetPosStart': ('CallTipSetPosAtStart', 0, 0, 0), 'CallTipSetHlt' : ('CallTipSetHighlight', 0, 0, 0), 'CallTipSetBack' : ('CallTipSetBackground', 0, 0, 0), 'CallTipSetFore' : ('CallTipSetForeground', 0, 0, 0), @@ -913,6 +917,22 @@ methodOverrideMap = { return (void*)(sptr_t)SendMsg(%s, bytes); """, 0), + 'GetRepresentation' : + (0, + 'wxString %s(const wxString& encodedCharacter) const;', + '''wxString %s(const wxString& encodedCharacter) const { + int msg = %s; + int len = SendMsg(msg, (sptr_t)(const char*)wx2stc(encodedCharacter), (sptr_t)NULL); + if (!len) return wxEmptyString; + + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, (sptr_t)(const char*)wx2stc(encodedCharacter), (sptr_t)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf);''', + 0), + 'PrivateLexerCall' : (0, 'void* %s(int operation, void* pointer);', @@ -923,6 +943,22 @@ methodOverrideMap = { 'GetMultiPaste' : (0, 0, 0, ('Retrieve the effect of pasting when there are multiple selections.',)), + + 'GetSubStyleBases' : + (0, + 'wxString %s() const;', + '''wxString %s() const { + int msg = %s; + int len = SendMsg(msg, 0, (sptr_t)NULL); + if (!len) return wxEmptyString; + + wxMemoryBuffer mbuf(len+1); + char* buf = (char*)mbuf.GetWriteBuf(len+1); + SendMsg(msg, 0, (sptr_t)buf); + mbuf.UngetWriteBuf(len); + mbuf.AppendByte(0); + return stc2wx(buf);''', + 0), '' : ('', 0, 0, 0), diff --git a/src/stc/scintilla/README.txt b/src/stc/scintilla/README.txt index 6db6698805..db9f55fa33 100644 --- a/src/stc/scintilla/README.txt +++ b/src/stc/scintilla/README.txt @@ -1,19 +1,19 @@ -This directory contains copies of the scintilla/src and -scintilla/include directories from the Scintilla source distribution. -All other code needed to implement Scintilla on top of wxWidgets is -located in the directory above this one. +This directory contains copies of the src, include, lexers, and lexlib +directories from the Scintilla source distribution. All other code +needed to implement Scintilla on top of wxWidgets is located in the +directory above this one. -The current version of the Scintilla code is 3.21 +The current version of the Scintilla code is 3.3.9 These are the basic steps needed to update the version of Scintilla used by wxSTC. 1. Copy include, lexers, lexlib and src folders to src/stc/scintilla -2. Examine diffs between the new src/stc/scintilla/Scintilla.iface +2. Examine diffs between the new src/stc/scintilla/include/Scintilla.iface file and the version in SVN. You should get familiar especially with new method names or constants because some of them may need to be tweaked to conform to similar naming patterns already used. (See step -#5 below.) +#6 below.) 3. Identify new source files and update build/bakefiles/scintilla.bkl accordingly so the new files will get built. Use bakefile to @@ -27,7 +27,10 @@ code from the Scintilla source tree as a guide if needed. You may have to make a few tweaks to src/stc/scintilla/include/Platform.h to keep the compile working cleanly, but try to keep them minimal. -5. Edit the gen_iface.py file. This is where the Scintilla.iface file +5. Adjust the version number in wxStyledTextCtrl::GetLibraryVersionInfo() +in src/stc/stc.cpp.in. + +6. Edit the gen_iface.py file. This is where the Scintilla.iface file is read and the code for stc.h and stc.cpp is generated. For all new methods or constant names check if there are similarly named things defined here that are having something special done to them, and then @@ -41,18 +44,18 @@ and could conceivably be bound to a key event) then I make sure that it's ID is in cmdValues or included in one of the existing ranges in that list. -6. Run gen_iface.py. +7. Run gen_iface.py. -7. Any other new methods should be checked to ensure that the +8. Any other new methods should be checked to ensure that the generated code is appropriate for what they are doing and if not then in gen_iface.py you can supply custom function bodies for them instead. -8. Add documentation code for any new methods to +9. Add documentation code for any new methods to interface/wx/stc/stc.h, also check any documentation-only changes from Scintilla.iface and see if the existing docs for those items should be updated too. -9. Build and test. +10. Build and test. -10. Submit patch to wxTrac. +11. Submit patch to wxTrac. diff --git a/src/stc/scintilla/include/ILexer.h b/src/stc/scintilla/include/ILexer.h index e08b8701c2..b900927507 100644 --- a/src/stc/scintilla/include/ILexer.h +++ b/src/stc/scintilla/include/ILexer.h @@ -18,7 +18,7 @@ namespace Scintilla { #define SCI_METHOD #endif -enum { dvOriginal=0 }; +enum { dvOriginal=0, dvLineEnd=1 }; class IDocument { public: @@ -45,7 +45,14 @@ public: virtual int SCI_METHOD GetLineIndentation(int line) = 0; }; -enum { lvOriginal=0 }; +class IDocumentWithLineEnd : public IDocument { +public: + virtual int SCI_METHOD LineEnd(int line) const = 0; + virtual int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const = 0; + virtual int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const = 0; +}; + +enum { lvOriginal=0, lvSubStyles=1 }; class ILexer { public: @@ -62,6 +69,20 @@ public: virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0; }; +class ILexerWithSubStyles : public ILexer { +public: + virtual int SCI_METHOD LineEndTypesSupported() = 0; + virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0; + virtual int SCI_METHOD SubStylesStart(int styleBase) = 0; + virtual int SCI_METHOD SubStylesLength(int styleBase) = 0; + virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0; + virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0; + virtual void SCI_METHOD FreeSubStyles() = 0; + virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0; + virtual int SCI_METHOD DistanceToSecondaryStyles() = 0; + virtual const char * SCI_METHOD GetSubStyleBases() = 0; +}; + class ILoader { public: virtual int SCI_METHOD Release() = 0; diff --git a/src/stc/scintilla/include/Platform.h b/src/stc/scintilla/include/Platform.h index 1b5dfbe3df..3920f7321a 100644 --- a/src/stc/scintilla/include/Platform.h +++ b/src/stc/scintilla/include/Platform.h @@ -13,6 +13,7 @@ // PLAT_GTK_WIN32 is defined additionally when running PLAT_GTK under Win32 // PLAT_WIN = Win32 API on Win32 OS // PLAT_WX is wxWindows on any supported platform +// PLAT_TK = Tcl/TK on Linux or Win32 #define PLAT_GTK 0 #define PLAT_GTK_WIN32 0 @@ -22,6 +23,8 @@ #define PLAT_WX 0 #define PLAT_QT 0 #define PLAT_FOX 0 +#define PLAT_CURSES 0 +#define PLAT_TK 0 #if defined(FOX) #undef PLAT_FOX @@ -31,10 +34,18 @@ #undef PLAT_WX #define PLAT_WX 1 +#elif defined(CURSES) +#undef PLAT_CURSES +#define PLAT_CURSES 1 + #elif defined(SCINTILLA_QT) #undef PLAT_QT #define PLAT_QT 1 +#elif defined(TK) +#undef PLAT_TK +#define PLAT_TK 1 + #elif defined(GTK) #undef PLAT_GTK #define PLAT_GTK 1 @@ -114,19 +125,19 @@ public: // Other automatically defined methods (assignment, copy constructor, destructor) are fine - bool operator==(PRectangle &rc) { + bool operator==(PRectangle &rc) const { return (rc.left == left) && (rc.right == right) && (rc.top == top) && (rc.bottom == bottom); } - bool Contains(Point pt) { + bool Contains(Point pt) const { return (pt.x >= left) && (pt.x <= right) && (pt.y >= top) && (pt.y <= bottom); } - bool Contains(PRectangle rc) { + bool Contains(PRectangle rc) const { return (rc.left >= left) && (rc.right <= right) && (rc.top >= top) && (rc.bottom <= bottom); } - bool Intersects(PRectangle other) { + bool Intersects(PRectangle other) const { return (right > other.left) && (left < other.right) && (bottom > other.top) && (top < other.bottom); } @@ -136,9 +147,9 @@ public: right += xDelta; bottom += yDelta; } - XYPOSITION Width() { return right - left; } - XYPOSITION Height() { return bottom - top; } - bool Empty() { + XYPOSITION Width() const { return right - left; } + XYPOSITION Height() const { return bottom - top; } + bool Empty() const { return (Height() <= 0) || (Width() <= 0); } }; @@ -194,15 +205,15 @@ public: return co; } - unsigned int GetRed() { + unsigned int GetRed() const { return co & 0xff; } - unsigned int GetGreen() { + unsigned int GetGreen() const { return (co >> 8) & 0xff; } - unsigned int GetBlue() { + unsigned int GetBlue() const { return (co >> 16) & 0xff; } }; @@ -334,22 +345,10 @@ typedef void (*CallBackAction)(void*); class Window { protected: WindowID wid; -#if PLAT_MACOSX - void *windowRef; - void *control; -#endif public: Window() : wid(0), cursorLast(cursorInvalid) { -#if PLAT_MACOSX - windowRef = 0; - control = 0; -#endif } Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) { -#if PLAT_MACOSX - windowRef = 0; - control = 0; -#endif } virtual ~Window(); Window &operator=(WindowID wid_) { @@ -372,10 +371,6 @@ public: void SetCursor(Cursor curs); void SetTitle(const char *s); PRectangle GetMonitorRect(Point pt); -#if PLAT_MACOSX - void SetWindow(void *ref) { windowRef = ref; } - void SetControl(void *_control) { control = _control; } -#endif private: Cursor cursorLast; }; @@ -517,9 +512,7 @@ public: #endif #if defined(__GNUC__) && defined(SCINTILLA_QT) -#pragma GCC diagnostic ignored "-Wmissing-braces" #pragma GCC diagnostic ignored "-Wmissing-field-initializers" -#pragma GCC diagnostic ignored "-Wchar-subscripts" #endif #endif diff --git a/src/stc/scintilla/include/SciLexer.h b/src/stc/scintilla/include/SciLexer.h index 57b5cf6e7b..1101bf2269 100644 --- a/src/stc/scintilla/include/SciLexer.h +++ b/src/stc/scintilla/include/SciLexer.h @@ -120,6 +120,11 @@ #define SCLEX_ECL 105 #define SCLEX_OSCRIPT 106 #define SCLEX_VISUALPROLOG 107 +#define SCLEX_LITERATEHASKELL 108 +#define SCLEX_STTXT 109 +#define SCLEX_KVIRC 110 +#define SCLEX_RUST 111 +#define SCLEX_DMAP 112 #define SCLEX_AUTOMATIC 1000 #define SCE_P_DEFAULT 0 #define SCE_P_COMMENTLINE 1 @@ -161,6 +166,8 @@ #define SCE_C_TRIPLEVERBATIM 21 #define SCE_C_HASHQUOTEDSTRING 22 #define SCE_C_PREPROCESSORCOMMENT 23 +#define SCE_C_PREPROCESSORCOMMENTDOC 24 +#define SCE_C_USERLITERAL 25 #define SCE_D_DEFAULT 0 #define SCE_D_COMMENT 1 #define SCE_D_COMMENTLINE 2 @@ -415,6 +422,10 @@ #define SCE_B_ERROR 16 #define SCE_B_HEXNUMBER 17 #define SCE_B_BINNUMBER 18 +#define SCE_B_COMMENTBLOCK 19 +#define SCE_B_DOCLINE 20 +#define SCE_B_DOCBLOCK 21 +#define SCE_B_DOCKEYWORD 22 #define SCE_PROPS_DEFAULT 0 #define SCE_PROPS_COMMENT 1 #define SCE_PROPS_SECTION 2 @@ -477,6 +488,7 @@ #define SCE_ERR_TIDY 19 #define SCE_ERR_JAVA_STACK 20 #define SCE_ERR_VALUE 21 +#define SCE_ERR_GCC_INCLUDED_FROM 22 #define SCE_BAT_DEFAULT 0 #define SCE_BAT_COMMENT 1 #define SCE_BAT_WORD 2 @@ -1019,6 +1031,12 @@ #define SCE_HA_COMMENTBLOCK 14 #define SCE_HA_COMMENTBLOCK2 15 #define SCE_HA_COMMENTBLOCK3 16 +#define SCE_HA_PRAGMA 17 +#define SCE_HA_PREPROCESSOR 18 +#define SCE_HA_STRINGEOL 19 +#define SCE_HA_RESERVED_OPERATOR 20 +#define SCE_HA_LITERATE_COMMENT 21 +#define SCE_HA_LITERATE_CODEDELIM 22 #define SCE_T3_DEFAULT 0 #define SCE_T3_X_DEFAULT 1 #define SCE_T3_PREPROCESSOR 2 @@ -1323,6 +1341,9 @@ #define SCE_POWERSHELL_FUNCTION 11 #define SCE_POWERSHELL_USER1 12 #define SCE_POWERSHELL_COMMENTSTREAM 13 +#define SCE_POWERSHELL_HERE_STRING 14 +#define SCE_POWERSHELL_HERE_CHARACTER 15 +#define SCE_POWERSHELL_COMMENTDOCKEYWORD 16 #define SCE_MYSQL_DEFAULT 0 #define SCE_MYSQL_COMMENT 1 #define SCE_MYSQL_COMMENTLINE 2 @@ -1345,6 +1366,7 @@ #define SCE_MYSQL_USER2 19 #define SCE_MYSQL_USER3 20 #define SCE_MYSQL_HIDDENCOMMAND 21 +#define SCE_MYSQL_PLACEHOLDER 22 #define SCE_PO_DEFAULT 0 #define SCE_PO_COMMENT 1 #define SCE_PO_MSGID 2 @@ -1354,6 +1376,13 @@ #define SCE_PO_MSGCTXT 6 #define SCE_PO_MSGCTXT_TEXT 7 #define SCE_PO_FUZZY 8 +#define SCE_PO_PROGRAMMER_COMMENT 9 +#define SCE_PO_REFERENCE 10 +#define SCE_PO_FLAGS 11 +#define SCE_PO_MSGID_TEXT_EOL 12 +#define SCE_PO_MSGSTR_TEXT_EOL 13 +#define SCE_PO_MSGCTXT_TEXT_EOL 14 +#define SCE_PO_ERROR 15 #define SCE_PAS_DEFAULT 0 #define SCE_PAS_IDENTIFIER 1 #define SCE_PAS_COMMENT 2 @@ -1518,7 +1547,6 @@ #define SCE_COFFEESCRIPT_GLOBALCLASS 19 #define SCE_COFFEESCRIPT_STRINGRAW 20 #define SCE_COFFEESCRIPT_TRIPLEVERBATIM 21 -#define SCE_COFFEESCRIPT_HASHQUOTEDSTRING 22 #define SCE_COFFEESCRIPT_COMMENTBLOCK 22 #define SCE_COFFEESCRIPT_VERBOSE_REGEX 23 #define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24 @@ -1607,6 +1635,70 @@ #define SCE_VISUALPROLOG_STRING_VERBATIM 20 #define SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL 21 #define SCE_VISUALPROLOG_STRING_VERBATIM_EOL 22 +#define SCE_STTXT_DEFAULT 0 +#define SCE_STTXT_COMMENT 1 +#define SCE_STTXT_COMMENTLINE 2 +#define SCE_STTXT_KEYWORD 3 +#define SCE_STTXT_TYPE 4 +#define SCE_STTXT_FUNCTION 5 +#define SCE_STTXT_FB 6 +#define SCE_STTXT_NUMBER 7 +#define SCE_STTXT_HEXNUMBER 8 +#define SCE_STTXT_PRAGMA 9 +#define SCE_STTXT_OPERATOR 10 +#define SCE_STTXT_CHARACTER 11 +#define SCE_STTXT_STRING1 12 +#define SCE_STTXT_STRING2 13 +#define SCE_STTXT_STRINGEOL 14 +#define SCE_STTXT_IDENTIFIER 15 +#define SCE_STTXT_DATETIME 16 +#define SCE_STTXT_VARS 17 +#define SCE_STTXT_PRAGMAS 18 +#define SCE_KVIRC_DEFAULT 0 +#define SCE_KVIRC_COMMENT 1 +#define SCE_KVIRC_COMMENTBLOCK 2 +#define SCE_KVIRC_STRING 3 +#define SCE_KVIRC_WORD 4 +#define SCE_KVIRC_KEYWORD 5 +#define SCE_KVIRC_FUNCTION_KEYWORD 6 +#define SCE_KVIRC_FUNCTION 7 +#define SCE_KVIRC_VARIABLE 8 +#define SCE_KVIRC_NUMBER 9 +#define SCE_KVIRC_OPERATOR 10 +#define SCE_KVIRC_STRING_FUNCTION 11 +#define SCE_KVIRC_STRING_VARIABLE 12 +#define SCE_RUST_DEFAULT 0 +#define SCE_RUST_COMMENTBLOCK 1 +#define SCE_RUST_COMMENTLINE 2 +#define SCE_RUST_COMMENTBLOCKDOC 3 +#define SCE_RUST_COMMENTLINEDOC 4 +#define SCE_RUST_NUMBER 5 +#define SCE_RUST_WORD 6 +#define SCE_RUST_WORD2 7 +#define SCE_RUST_WORD3 8 +#define SCE_RUST_WORD4 9 +#define SCE_RUST_WORD5 10 +#define SCE_RUST_WORD6 11 +#define SCE_RUST_WORD7 12 +#define SCE_RUST_STRING 13 +#define SCE_RUST_STRINGR 14 +#define SCE_RUST_CHARACTER 15 +#define SCE_RUST_OPERATOR 16 +#define SCE_RUST_IDENTIFIER 17 +#define SCE_RUST_LIFETIME 18 +#define SCE_RUST_MACRO 19 +#define SCE_RUST_LEXERROR 20 +#define SCE_DMAP_DEFAULT 0 +#define SCE_DMAP_COMMENT 1 +#define SCE_DMAP_NUMBER 2 +#define SCE_DMAP_STRING1 3 +#define SCE_DMAP_STRING2 4 +#define SCE_DMAP_STRINGEOL 5 +#define SCE_DMAP_OPERATOR 6 +#define SCE_DMAP_IDENTIFIER 7 +#define SCE_DMAP_WORD 8 +#define SCE_DMAP_WORD2 9 +#define SCE_DMAP_WORD3 10 /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ #endif diff --git a/src/stc/scintilla/include/Scintilla.h b/src/stc/scintilla/include/Scintilla.h index 3cacd53101..ae1abc8e0b 100644 --- a/src/stc/scintilla/include/Scintilla.h +++ b/src/stc/scintilla/include/Scintilla.h @@ -125,6 +125,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_MARK_AVAILABLE 28 #define SC_MARK_UNDERLINE 29 #define SC_MARK_RGBAIMAGE 30 +#define SC_MARK_BOOKMARK 31 #define SC_MARK_CHARACTER 10000 #define SC_MARKNUM_FOLDEREND 25 #define SC_MARKNUM_FOLDEROPENMID 26 @@ -148,6 +149,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_MARKERDEFINEPIXMAP 2049 #define SCI_MARKERADDSET 2466 #define SCI_MARKERSETALPHA 2476 +#define SC_MAX_MARGIN 4 #define SC_MARGIN_SYMBOL 0 #define SC_MARGIN_NUMBER 1 #define SC_MARGIN_BACK 2 @@ -262,6 +264,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define INDIC_DOTS 10 #define INDIC_SQUIGGLELOW 11 #define INDIC_DOTBOX 12 +#define INDIC_SQUIGGLEPIXMAP 13 +#define INDIC_COMPOSITIONTHICK 14 #define INDIC_MAX 31 #define INDIC_CONTAINER 8 #define INDIC0_MASK 0x20 @@ -355,8 +359,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_PRINT_COLOURONWHITEDEFAULTBG 4 #define SCI_SETPRINTCOLOURMODE 2148 #define SCI_GETPRINTCOLOURMODE 2149 -#define SCFIND_WHOLEWORD 2 -#define SCFIND_MATCHCASE 4 +#define SCFIND_WHOLEWORD 0x2 +#define SCFIND_MATCHCASE 0x4 #define SCFIND_WORDSTART 0x00100000 #define SCFIND_REGEXP 0x00200000 #define SCFIND_POSIX 0x00400000 @@ -380,6 +384,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_POSITIONFROMLINE 2167 #define SCI_LINESCROLL 2168 #define SCI_SCROLLCARET 2169 +#define SCI_SCROLLRANGE 2569 #define SCI_REPLACESEL 2170 #define SCI_SETREADONLY 2171 #define SCI_NULL 2172 @@ -413,6 +418,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_CALLTIPCANCEL 2201 #define SCI_CALLTIPACTIVE 2202 #define SCI_CALLTIPPOSSTART 2203 +#define SCI_CALLTIPSETPOSSTART 2214 #define SCI_CALLTIPSETHLT 2204 #define SCI_CALLTIPSETBACK 2205 #define SCI_CALLTIPSETFORE 2206 @@ -437,7 +443,19 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETFOLDEXPANDED 2229 #define SCI_GETFOLDEXPANDED 2230 #define SCI_TOGGLEFOLD 2231 +#define SC_FOLDACTION_CONTRACT 0 +#define SC_FOLDACTION_EXPAND 1 +#define SC_FOLDACTION_TOGGLE 2 +#define SCI_FOLDLINE 2237 +#define SCI_FOLDCHILDREN 2238 +#define SCI_EXPANDCHILDREN 2239 +#define SCI_FOLDALL 2662 #define SCI_ENSUREVISIBLE 2232 +#define SC_AUTOMATICFOLD_SHOW 0x0001 +#define SC_AUTOMATICFOLD_CLICK 0x0002 +#define SC_AUTOMATICFOLD_CHANGE 0x0004 +#define SCI_SETAUTOMATICFOLD 2663 +#define SCI_GETAUTOMATICFOLD 2664 #define SC_FOLDFLAG_LINEBEFORE_EXPANDED 0x0002 #define SC_FOLDFLAG_LINEBEFORE_CONTRACTED 0x0004 #define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008 @@ -657,6 +675,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_PARAUPEXTEND 2416 #define SCI_POSITIONBEFORE 2417 #define SCI_POSITIONAFTER 2418 +#define SCI_POSITIONRELATIVE 2670 #define SCI_COPYRANGE 2419 #define SCI_COPYTEXT 2420 #define SC_SEL_STREAM 0 @@ -695,6 +714,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1 #define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634 #define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635 +#define SC_ORDER_PRESORTED 0 +#define SC_ORDER_PERFORMSORT 1 +#define SC_ORDER_CUSTOM 2 +#define SCI_AUTOCSETORDER 2660 +#define SCI_AUTOCGETORDER 2661 #define SCI_ALLOCATE 2446 #define SCI_TARGETASUTF8 2447 #define SCI_SETLENGTHFORENCODE 2448 @@ -774,10 +798,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_ANNOTATIONGETVISIBLE 2549 #define SCI_ANNOTATIONSETSTYLEOFFSET 2550 #define SCI_ANNOTATIONGETSTYLEOFFSET 2551 +#define SCI_RELEASEALLEXTENDEDSTYLES 2552 +#define SCI_ALLOCATEEXTENDEDSTYLES 2553 #define UNDO_MAY_COALESCE 1 #define SCI_ADDUNDOACTION 2560 #define SCI_CHARPOSITIONFROMPOINT 2561 #define SCI_CHARPOSITIONFROMPOINTCLOSE 2562 +#define SCI_SETMOUSESELECTIONRECTANGULARSWITCH 2668 +#define SCI_GETMOUSESELECTIONRECTANGULARSWITCH 2669 #define SCI_SETMULTIPLESELECTION 2563 #define SCI_GETMULTIPLESELECTION 2564 #define SCI_SETADDITIONALSELECTIONTYPING 2565 @@ -787,9 +815,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_SETADDITIONALCARETSVISIBLE 2608 #define SCI_GETADDITIONALCARETSVISIBLE 2609 #define SCI_GETSELECTIONS 2570 +#define SCI_GETSELECTIONEMPTY 2650 #define SCI_CLEARSELECTIONS 2571 #define SCI_SETSELECTION 2572 #define SCI_ADDSELECTION 2573 +#define SCI_DROPSELECTIONN 2671 #define SCI_SETMAINSELECTION 2574 #define SCI_GETMAINSELECTION 2575 #define SCI_SETSELECTIONNCARET 2576 @@ -836,6 +866,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_GETIDENTIFIER 2623 #define SCI_RGBAIMAGESETWIDTH 2624 #define SCI_RGBAIMAGESETHEIGHT 2625 +#define SCI_RGBAIMAGESETSCALE 2651 #define SCI_MARKERDEFINERGBAIMAGE 2626 #define SCI_REGISTERRGBAIMAGE 2627 #define SCI_SCROLLTOSTART 2628 @@ -848,6 +879,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCI_FINDINDICATORSHOW 2640 #define SCI_FINDINDICATORFLASH 2641 #define SCI_FINDINDICATORHIDE 2642 +#define SCI_VCHOMEDISPLAY 2652 +#define SCI_VCHOMEDISPLAYEXTEND 2653 +#define SCI_GETCARETLINEVISIBLEALWAYS 2654 +#define SCI_SETCARETLINEVISIBLEALWAYS 2655 +#define SCI_SETREPRESENTATION 2665 +#define SCI_GETREPRESENTATION 2666 +#define SCI_CLEARREPRESENTATION 2667 #define SCI_STARTRECORD 3001 #define SCI_STOPRECORD 3002 #define SCI_SETLEXER 4001 @@ -952,6 +990,25 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, #define SCN_AUTOCCANCELLED 2025 #define SCN_AUTOCCHARDELETED 2026 #define SCN_HOTSPOTRELEASECLICK 2027 +#define SCN_FOCUSIN 2028 +#define SCN_FOCUSOUT 2029 +#ifndef SCI_DISABLE_PROVISIONAL +#define SC_LINE_END_TYPE_DEFAULT 0 +#define SC_LINE_END_TYPE_UNICODE 1 +#define SCI_SETLINEENDTYPESALLOWED 2656 +#define SCI_GETLINEENDTYPESALLOWED 2657 +#define SCI_GETLINEENDTYPESACTIVE 2658 +#define SCI_GETLINEENDTYPESSUPPORTED 4018 +#define SCI_ALLOCATESUBSTYLES 4020 +#define SCI_GETSUBSTYLESSTART 4021 +#define SCI_GETSUBSTYLESLENGTH 4022 +#define SCI_GETSTYLEFROMSUBSTYLE 4027 +#define SCI_GETPRIMARYSTYLEFROMSTYLE 4028 +#define SCI_FREESUBSTYLES 4023 +#define SCI_SETIDENTIFIERS 4024 +#define SCI_DISTANCETOSECONDARYSTYLES 4025 +#define SCI_GETSUBSTYLEBASES 4026 +#endif /* --Autogenerated -- end of section automatically generated from Scintilla.iface */ /* These structures are defined to be exactly the same shape as the Win32 @@ -974,7 +1031,7 @@ struct Sci_TextRange { struct Sci_TextToFind { struct Sci_CharacterRange chrg; - char *lpstrText; + const char *lpstrText; struct Sci_CharacterRange chrgText; }; diff --git a/src/stc/scintilla/include/Scintilla.iface b/src/stc/scintilla/include/Scintilla.iface index ba5afaa7ed..df28c6393e 100644 --- a/src/stc/scintilla/include/Scintilla.iface +++ b/src/stc/scintilla/include/Scintilla.iface @@ -268,6 +268,7 @@ val SC_MARK_LEFTRECT=27 val SC_MARK_AVAILABLE=28 val SC_MARK_UNDERLINE=29 val SC_MARK_RGBAIMAGE=30 +val SC_MARK_BOOKMARK=31 val SC_MARK_CHARACTER=10000 @@ -326,6 +327,8 @@ fun void MarkerAddSet=2466(int line, int set) # Set the alpha used for a marker that is drawn in the text area, not the margin. set void MarkerSetAlpha=2476(int markerNumber, int alpha) +val SC_MAX_MARGIN=4 + enu MarginType=SC_MARGIN_ val SC_MARGIN_SYMBOL=0 val SC_MARGIN_NUMBER=1 @@ -578,6 +581,8 @@ val INDIC_DASH=9 val INDIC_DOTS=10 val INDIC_SQUIGGLELOW=11 val INDIC_DOTBOX=12 +val INDIC_SQUIGGLEPIXMAP=13 +val INDIC_COMPOSITIONTHICK=14 val INDIC_MAX=31 val INDIC_CONTAINER=8 val INDIC0_MASK=0x20 @@ -852,8 +857,8 @@ set void SetPrintColourMode=2148(int mode,) get int GetPrintColourMode=2149(,) enu FindOption=SCFIND_ -val SCFIND_WHOLEWORD=2 -val SCFIND_MATCHCASE=4 +val SCFIND_WHOLEWORD=0x2 +val SCFIND_MATCHCASE=0x4 val SCFIND_WORDSTART=0x00100000 val SCFIND_REGEXP=0x00200000 val SCFIND_POSIX=0x00400000 @@ -921,6 +926,11 @@ fun void LineScroll=2168(int columns, int lines) # Ensure the caret is visible. fun void ScrollCaret=2169(,) +# Scroll the argument positions and the range between them into view giving +# priority to the primary position then the secondary position. +# This may be used to make a search match visible. +fun void ScrollRange=2569(position secondary, position primary) + # Replace the selected text with the argument text. fun void ReplaceSel=2170(, string text) @@ -1033,6 +1043,9 @@ fun bool CallTipActive=2202(,) # Retrieve the position where the caret was before displaying the call tip. fun position CallTipPosStart=2203(,) +# Set the start position in order to change when backspacing removes the calltip. +set void CallTipSetPosStart=2214(int posStart,) + # Highlight a segment of the definition. fun void CallTipSetHlt=2204(int start, int end) @@ -1101,9 +1114,37 @@ get bool GetFoldExpanded=2230(int line,) # Switch a header line between expanded and contracted. fun void ToggleFold=2231(int line,) +enu FoldAction=SC_FOLDACTION +val SC_FOLDACTION_CONTRACT=0 +val SC_FOLDACTION_EXPAND=1 +val SC_FOLDACTION_TOGGLE=2 + +# Expand or contract a fold header. +fun void FoldLine=2237(int line, int action) + +# Expand or contract a fold header and its children. +fun void FoldChildren=2238(int line, int action) + +# Expand a fold header and all children. Use the level argument instead of the line's current level. +fun void ExpandChildren=2239(int line, int level) + +# Expand or contract all fold headers. +fun void FoldAll=2662(int action,) + # Ensure a particular line is visible by expanding any header line hiding it. fun void EnsureVisible=2232(int line,) +enu AutomaticFold=SC_AUTOMATICFOLD_ +val SC_AUTOMATICFOLD_SHOW=0x0001 +val SC_AUTOMATICFOLD_CLICK=0x0002 +val SC_AUTOMATICFOLD_CHANGE=0x0004 + +# Set automatic folding behaviours. +set void SetAutomaticFold=2663(int automaticFold,) + +# Get automatic folding behaviours. +get int GetAutomaticFold=2664(,) + enu FoldFlag=SC_FOLDFLAG_ val SC_FOLDFLAG_LINEBEFORE_EXPANDED=0x0002 val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004 @@ -1719,6 +1760,10 @@ fun position PositionBefore=2417(position pos,) # page into account. Maximum value returned is the last position in the document. fun position PositionAfter=2418(position pos,) +# Given a valid document position, return a position that differs in a number +# of characters. Returned value is always between 0 and last position in document. +fun position PositionRelative=2670(position pos, int relative) + # Copy a range of text to the clipboard. Positions are clipped into the document. fun void CopyRange=2419(position start, position end) @@ -1834,6 +1879,17 @@ set void AutoCSetCaseInsensitiveBehaviour=2634(int behaviour,) # Get auto-completion case insensitive behaviour. get int AutoCGetCaseInsensitiveBehaviour=2635(,) +enu Ordering=SC_ORDER_ +val SC_ORDER_PRESORTED=0 +val SC_ORDER_PERFORMSORT=1 +val SC_ORDER_CUSTOM=2 + +# Set the way autocompletion lists are ordered. +set void AutoCSetOrder=2660(int order,) + +# Get the way autocompletion lists are ordered. +get int AutoCGetOrder=2661(,) + # Enlarge the document to a particular size of text bytes. fun void Allocate=2446(int bytes,) @@ -2061,6 +2117,12 @@ set void AnnotationSetStyleOffset=2550(int style,) # Get the start of the range of style numbers used for annotations get int AnnotationGetStyleOffset=2551(,) +# Release all extended (>255) style numbers +fun void ReleaseAllExtendedStyles=2552(,) + +# Allocate some extended (>255) style numbers and return the start of the range +fun int AllocateExtendedStyles=2553(int numberStyles,) + val UNDO_MAY_COALESCE=1 # Add a container action to the undo stack @@ -2073,6 +2135,12 @@ fun position CharPositionFromPoint=2561(int x, int y) # Return INVALID_POSITION if not close to text. fun position CharPositionFromPointClose=2562(int x, int y) +# Set whether switching to rectangular mode while selecting with the mouse is allowed. +set void SetMouseSelectionRectangularSwitch=2668(bool mouseSelectionRectangularSwitch,) + +# Whether switching to rectangular mode while selecting with the mouse is allowed. +get bool GetMouseSelectionRectangularSwitch=2669(,) + # Set whether multiple selections can be made set void SetMultipleSelection=2563(bool multipleSelection,) @@ -2100,6 +2168,9 @@ get bool GetAdditionalCaretsVisible=2609(,) # How many selections are there? get int GetSelections=2570(,) +# Is every selected range empty? +get bool GetSelectionEmpty=2650(,) + # Clear selections to a single empty stream selection fun void ClearSelections=2571(,) @@ -2109,6 +2180,9 @@ fun int SetSelection=2572(int caret, int anchor) # Add a selection fun int AddSelection=2573(int caret, int anchor) +# Drop one selection +fun void DropSelectionN=2671(int selection,) + # Set the main selection set void SetMainSelection=2574(int selection,) @@ -2218,6 +2292,9 @@ set void RGBAImageSetWidth=2624(int width,) # Set the height for future RGBA image data. set void RGBAImageSetHeight=2625(int height,) +# Set the scale factor in percent for future RGBA image data. +set void RGBAImageSetScale=2651(int scalePercent,) + # Define a marker from RGBA data. # It has the width and height from RGBAImageSetWidth/Height fun void MarkerDefineRGBAImage=2626(int markerNumber, string pixels) @@ -2253,6 +2330,28 @@ fun void FindIndicatorFlash=2641(position start, position end) # On OS X, hide the find indicator. fun void FindIndicatorHide=2642(,) +# Move caret to before first visible character on display line. +# If already there move to first character on display line. +fun void VCHomeDisplay=2652(,) + +# Like VCHomeDisplay but extending selection to new caret position. +fun void VCHomeDisplayExtend=2653(,) + +# Is the caret line always visible? +get bool GetCaretLineVisibleAlways=2654(,) + +# Sets the caret line to always visible. +set void SetCaretLineVisibleAlways=2655(bool alwaysVisible,) + +# Set the way a character is drawn. +set void SetRepresentation=2665(string encodedCharacter, string representation) + +# Get the way a character is drawn. +get int GetRepresentation=2666(string encodedCharacter, stringresult representation) + +# Remove a character representation. +fun void ClearRepresentation=2667(string encodedCharacter,) + # Start notifying the container of all key presses and commands. fun void StartRecord=3001(,) @@ -2505,6 +2604,11 @@ val SCLEX_AVS=104 val SCLEX_ECL=105 val SCLEX_OSCRIPT=106 val SCLEX_VISUALPROLOG=107 +val SCLEX_LITERATEHASKELL=108 +val SCLEX_STTXT=109 +val SCLEX_KVIRC=110 +val SCLEX_RUST=111 +val SCLEX_DMAP=112 # When a lexer specifies its language as SCLEX_AUTOMATIC it receives a # value assigned in sequence from SCLEX_AUTOMATIC+1. @@ -2555,6 +2659,8 @@ val SCE_C_STRINGRAW=20 val SCE_C_TRIPLEVERBATIM=21 val SCE_C_HASHQUOTEDSTRING=22 val SCE_C_PREPROCESSORCOMMENT=23 +val SCE_C_PREPROCESSORCOMMENTDOC=24 +val SCE_C_USERLITERAL=25 # Lexical states for SCLEX_D lex D=SCLEX_D SCE_D_ val SCE_D_DEFAULT=0 @@ -2607,8 +2713,6 @@ val SCE_TCL_BLOCK_COMMENT=21 # Lexical states for SCLEX_HTML, SCLEX_XML lex HTML=SCLEX_HTML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_ lex XML=SCLEX_XML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_ -lex ASP=SCLEX_ASP SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_ -lex PHP=SCLEX_PHP SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_ val SCE_H_DEFAULT=0 val SCE_H_TAG=1 val SCE_H_TAGUNKNOWN=2 @@ -2838,6 +2942,10 @@ val SCE_B_LABEL=15 val SCE_B_ERROR=16 val SCE_B_HEXNUMBER=17 val SCE_B_BINNUMBER=18 +val SCE_B_COMMENTBLOCK=19 +val SCE_B_DOCLINE=20 +val SCE_B_DOCBLOCK=21 +val SCE_B_DOCKEYWORD=22 # Lexical states for SCLEX_PROPERTIES lex Properties=SCLEX_PROPERTIES SCE_PROPS_ val SCE_PROPS_DEFAULT=0 @@ -2908,6 +3016,7 @@ val SCE_ERR_ABSF=18 val SCE_ERR_TIDY=19 val SCE_ERR_JAVA_STACK=20 val SCE_ERR_VALUE=21 +val SCE_ERR_GCC_INCLUDED_FROM=22 # Lexical states for SCLEX_BATCH lex Batch=SCLEX_BATCH SCE_BAT_ val SCE_BAT_DEFAULT=0 @@ -3391,6 +3500,7 @@ val SCE_KIX_FUNCTIONS=8 val SCE_KIX_OPERATOR=9 val SCE_KIX_IDENTIFIER=31 # Lexical states for SCLEX_GUI4CLI +lex Gui4Cli=SCLEX_GUI4CLI SCE_GC_ val SCE_GC_DEFAULT=0 val SCE_GC_COMMENTLINE=1 val SCE_GC_COMMENTBLOCK=2 @@ -3535,6 +3645,12 @@ val SCE_HA_COMMENTLINE=13 val SCE_HA_COMMENTBLOCK=14 val SCE_HA_COMMENTBLOCK2=15 val SCE_HA_COMMENTBLOCK3=16 +val SCE_HA_PRAGMA=17 +val SCE_HA_PREPROCESSOR=18 +val SCE_HA_STRINGEOL=19 +val SCE_HA_RESERVED_OPERATOR=20 +val SCE_HA_LITERATE_COMMENT=21 +val SCE_HA_LITERATE_CODEDELIM=22 # Lexical states of SCLEX_TADS3 lex TADS3=SCLEX_TADS3 SCE_T3_ val SCE_T3_DEFAULT=0 @@ -3840,8 +3956,8 @@ val SCE_R_OPERATOR=8 val SCE_R_IDENTIFIER=9 val SCE_R_INFIX=10 val SCE_R_INFIXEOL=11 -# Lexical state for SCLEX_MAGIKSF -lex MagikSF=SCLEX_MAGIKSF SCE_MAGIK_ +# Lexical state for SCLEX_MAGIK +lex MagikSF=SCLEX_MAGIK SCE_MAGIK_ val SCE_MAGIK_DEFAULT=0 val SCE_MAGIK_COMMENT=1 val SCE_MAGIK_HYPER_COMMENT=16 @@ -3875,6 +3991,9 @@ val SCE_POWERSHELL_ALIAS=10 val SCE_POWERSHELL_FUNCTION=11 val SCE_POWERSHELL_USER1=12 val SCE_POWERSHELL_COMMENTSTREAM=13 +val SCE_POWERSHELL_HERE_STRING=14 +val SCE_POWERSHELL_HERE_CHARACTER=15 +val SCE_POWERSHELL_COMMENTDOCKEYWORD=16 # Lexical state for SCLEX_MYSQL lex MySQL=SCLEX_MYSQL SCE_MYSQL_ val SCE_MYSQL_DEFAULT=0 @@ -3899,6 +4018,7 @@ val SCE_MYSQL_USER1=18 val SCE_MYSQL_USER2=19 val SCE_MYSQL_USER3=20 val SCE_MYSQL_HIDDENCOMMAND=21 +val SCE_MYSQL_PLACEHOLDER=22 # Lexical state for SCLEX_PO lex Po=SCLEX_PO SCE_PO_ val SCE_PO_DEFAULT=0 @@ -3910,6 +4030,13 @@ val SCE_PO_MSGSTR_TEXT=5 val SCE_PO_MSGCTXT=6 val SCE_PO_MSGCTXT_TEXT=7 val SCE_PO_FUZZY=8 +val SCE_PO_PROGRAMMER_COMMENT=9 +val SCE_PO_REFERENCE=10 +val SCE_PO_FLAGS=11 +val SCE_PO_MSGID_TEXT_EOL=12 +val SCE_PO_MSGSTR_TEXT_EOL=13 +val SCE_PO_MSGCTXT_TEXT_EOL=14 +val SCE_PO_ERROR=15 # Lexical states for SCLEX_PASCAL lex Pascal=SCLEX_PASCAL SCE_PAS_ val SCE_PAS_DEFAULT=0 @@ -4092,7 +4219,6 @@ val SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR=18 val SCE_COFFEESCRIPT_GLOBALCLASS=19 val SCE_COFFEESCRIPT_STRINGRAW=20 val SCE_COFFEESCRIPT_TRIPLEVERBATIM=21 -val SCE_COFFEESCRIPT_HASHQUOTEDSTRING=22 val SCE_COFFEESCRIPT_COMMENTBLOCK=22 val SCE_COFFEESCRIPT_VERBOSE_REGEX=23 val SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT=24 @@ -4189,6 +4315,78 @@ val SCE_VISUALPROLOG_STRING_EOL_OPEN=19 val SCE_VISUALPROLOG_STRING_VERBATIM=20 val SCE_VISUALPROLOG_STRING_VERBATIM_SPECIAL=21 val SCE_VISUALPROLOG_STRING_VERBATIM_EOL=22 +# Lexical states for SCLEX_STTXT +lex StructuredText=SCLEX_STTXT SCE_STTXT_ +val SCE_STTXT_DEFAULT=0 +val SCE_STTXT_COMMENT=1 +val SCE_STTXT_COMMENTLINE=2 +val SCE_STTXT_KEYWORD=3 +val SCE_STTXT_TYPE=4 +val SCE_STTXT_FUNCTION=5 +val SCE_STTXT_FB=6 +val SCE_STTXT_NUMBER=7 +val SCE_STTXT_HEXNUMBER=8 +val SCE_STTXT_PRAGMA=9 +val SCE_STTXT_OPERATOR=10 +val SCE_STTXT_CHARACTER=11 +val SCE_STTXT_STRING1=12 +val SCE_STTXT_STRING2=13 +val SCE_STTXT_STRINGEOL=14 +val SCE_STTXT_IDENTIFIER=15 +val SCE_STTXT_DATETIME=16 +val SCE_STTXT_VARS=17 +val SCE_STTXT_PRAGMAS=18 +# Lexical states for SCLEX_KVIRC +lex KVIrc=SCLEX_KVIRC SCE_KVIRC_ +val SCE_KVIRC_DEFAULT=0 +val SCE_KVIRC_COMMENT=1 +val SCE_KVIRC_COMMENTBLOCK=2 +val SCE_KVIRC_STRING=3 +val SCE_KVIRC_WORD=4 +val SCE_KVIRC_KEYWORD=5 +val SCE_KVIRC_FUNCTION_KEYWORD=6 +val SCE_KVIRC_FUNCTION=7 +val SCE_KVIRC_VARIABLE=8 +val SCE_KVIRC_NUMBER=9 +val SCE_KVIRC_OPERATOR=10 +val SCE_KVIRC_STRING_FUNCTION=11 +val SCE_KVIRC_STRING_VARIABLE=12 +# Lexical states for SCLEX_RUST +lex Rust=SCLEX_RUST SCE_RUST_ +val SCE_RUST_DEFAULT=0 +val SCE_RUST_COMMENTBLOCK=1 +val SCE_RUST_COMMENTLINE=2 +val SCE_RUST_COMMENTBLOCKDOC=3 +val SCE_RUST_COMMENTLINEDOC=4 +val SCE_RUST_NUMBER=5 +val SCE_RUST_WORD=6 +val SCE_RUST_WORD2=7 +val SCE_RUST_WORD3=8 +val SCE_RUST_WORD4=9 +val SCE_RUST_WORD5=10 +val SCE_RUST_WORD6=11 +val SCE_RUST_WORD7=12 +val SCE_RUST_STRING=13 +val SCE_RUST_STRINGR=14 +val SCE_RUST_CHARACTER=15 +val SCE_RUST_OPERATOR=16 +val SCE_RUST_IDENTIFIER=17 +val SCE_RUST_LIFETIME=18 +val SCE_RUST_MACRO=19 +val SCE_RUST_LEXERROR=20 +# Lexical states for SCLEX_DMAP +lex DMAP=SCLEX_DMAP SCE_DMAP_ +val SCE_DMAP_DEFAULT=0 +val SCE_DMAP_COMMENT=1 +val SCE_DMAP_NUMBER=2 +val SCE_DMAP_STRING1=3 +val SCE_DMAP_STRING2=4 +val SCE_DMAP_STRINGEOL=5 +val SCE_DMAP_OPERATOR=6 +val SCE_DMAP_IDENTIFIER=7 +val SCE_DMAP_WORD=8 +val SCE_DMAP_WORD2=9 +val SCE_DMAP_WORD3=10 # Events @@ -4220,6 +4418,58 @@ evt void IndicatorRelease=2024(int modifiers, int position) evt void AutoCCancelled=2025(void) evt void AutoCCharDeleted=2026(void) evt void HotSpotReleaseClick=2027(int modifiers, int position) +evt void FocusIn=2028(void) +evt void FocusOut=2029(void) + +cat Provisional + +# Line end types which may be used in addition to LF, CR, and CRLF +# SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator, +# U+2029 Paragraph Separator, and U+0085 Next Line +enu LineEndType=SC_LINE_END_TYPE_ +val SC_LINE_END_TYPE_DEFAULT=0 +val SC_LINE_END_TYPE_UNICODE=1 + +# Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding. +set void SetLineEndTypesAllowed=2656(int lineEndBitSet,) + +# Get the line end types currently allowed. +get int GetLineEndTypesAllowed=2657(,) + +# Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation. +get int GetLineEndTypesActive=2658(,) + +# Bit set of LineEndType enumertion for which line ends beyond the standard +# LF, CR, and CRLF are supported by the lexer. +get int GetLineEndTypesSupported=4018(,) + +# Allocate a set of sub styles for a particular base style, returning start of range +fun int AllocateSubStyles=4020(int styleBase, int numberStyles) + +# The starting style number for the sub styles associated with a base style +get int GetSubStylesStart=4021(int styleBase,) + +# The number of sub styles associated with a base style +get int GetSubStylesLength=4022(int styleBase,) + +# For a sub style, return the base style, else return the argument. +get int GetStyleFromSubStyle=4027(int subStyle,) + +# For a secondary style, return the primary style, else return the argument. +get int GetPrimaryStyleFromStyle=4028(int style,) + +# Free allocated sub styles +fun void FreeSubStyles=4023(,) + +# Set the identifiers that are shown in a particular style +set void SetIdentifiers=4024(int style, string identifiers) + +# Where styles are duplicated by a feature such as active/inactive code +# return the distance between the two types. +get int DistanceToSecondaryStyles=4025(,) + +# Get the set of base styles that can be extended with sub styles +get int GetSubStyleBases=4026(, stringresult styles) cat Deprecated diff --git a/src/stc/scintilla/include/ScintillaWidget.h b/src/stc/scintilla/include/ScintillaWidget.h index 021af2a30e..f8cd212b02 100644 --- a/src/stc/scintilla/include/ScintillaWidget.h +++ b/src/stc/scintilla/include/ScintillaWidget.h @@ -16,8 +16,8 @@ extern "C" { #endif #define SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_CAST (obj, scintilla_get_type (), ScintillaObject) -#define SCINTILLA_CLASS(klass) GTK_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) -#define IS_SCINTILLA(obj) GTK_CHECK_TYPE (obj, scintilla_get_type ()) +#define SCINTILLA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass) +#define IS_SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, scintilla_get_type ()) typedef struct _ScintillaObject ScintillaObject; typedef struct _ScintillaClass ScintillaClass; diff --git a/src/stc/scintilla/lexers/LexA68k.cxx b/src/stc/scintilla/lexers/LexA68k.cxx index 970e429c64..6ab03bf0fa 100644 --- a/src/stc/scintilla/lexers/LexA68k.cxx +++ b/src/stc/scintilla/lexers/LexA68k.cxx @@ -117,13 +117,20 @@ static inline bool IsDoxygenChar (const int ch) static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) { + // Used to buffer a string, to be able to compare it using built-in functions + char Buffer[100]; + + + // Used to know the length of an operator + int OpType; + // Get references to keywords lists WordList &cpuInstruction = *keywordlists[0]; WordList ®isters = *keywordlists[1]; WordList &directive = *keywordlists[2]; WordList &extInstruction = *keywordlists[3]; - WordList &commentSpecial = *keywordlists[4]; + WordList &alert = *keywordlists[4]; WordList &doxygenKeyword = *keywordlists[5]; @@ -133,85 +140,69 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, /************************************************************ * - * Parse the text + * Parse the source * ************************************************************/ for ( ; sc.More(); sc.Forward()) { - char Buffer[100]; - int OpType; - - // Reset style at beginning of line - if (sc.atLineStart) + /************************************************************ + * + * A style always terminates at the end of a line, even for + * comments (no multi-lines comments) + * + ************************************************************/ + if (sc.atLineStart) { sc.SetState(SCE_A68K_DEFAULT); + } /************************************************************ * - * Handle current state if we are not in the "default style" + * If we are not in "default style", check if the style continues + * In this case, we just have to loop * ************************************************************/ if (sc.state != SCE_A68K_DEFAULT) { - // Check if current style continue. - // If this case, we loop because there is nothing else to do - if (((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number + if ( ((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number || ((sc.state == SCE_A68K_NUMBER_BIN) && IsBin(sc.ch)) // Binary number || ((sc.state == SCE_A68K_NUMBER_HEX) && isxdigit(sc.ch)) // Hexa number - || ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Arg of macro + || ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument || ((sc.state == SCE_A68K_STRING1) && (sc.ch != '\'')) // String single-quoted || ((sc.state == SCE_A68K_STRING2) && (sc.ch != '\"')) // String double-quoted - || ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument - // Label. ' ' and '\t' are needed to handle macro declarations - || ((sc.state == SCE_A68K_LABEL) && (sc.ch != ':') && (sc.ch != ' ') && (sc.ch != '\t')) - || ((sc.state == SCE_A68K_IDENTIFIER) && (sc.ch < 0x80) && IsIdentifierChar(sc.ch)) // Identifier - || ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && (sc.ch < 0x80) && IsDoxygenChar(sc.ch)) // Doxygen keyword - || ((sc.state == SCE_A68K_COMMENT_WORD) && (sc.ch < 0x80) && isalpha(sc.ch))) // Comment current word + || ((sc.state == SCE_A68K_MACRO_DECLARATION) && IsIdentifierChar(sc.ch)) // Macro declaration (or global label, we don't know at this point) + || ((sc.state == SCE_A68K_IDENTIFIER) && IsIdentifierChar(sc.ch)) // Identifier + || ((sc.state == SCE_A68K_LABEL) && IsIdentifierChar(sc.ch)) // Label (local) + || ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && IsDoxygenChar(sc.ch)) // Doxygen keyword + || ((sc.state == SCE_A68K_COMMENT_SPECIAL) && isalpha(sc.ch)) // Alert + || ((sc.state == SCE_A68K_COMMENT) && !isalpha(sc.ch) && (sc.ch != '\\'))) // Normal comment { continue; } - // Check if some states terminate at the current char: - // we must include this char in the current style context - else if (((sc.state == SCE_A68K_STRING1) && (sc.ch < 0x80) && (sc.ch == '\'')) // String single-quoted - || ((sc.state == SCE_A68K_STRING2) && (sc.ch < 0x80) && (sc.ch == '\"')) // String double-quoted - || ((sc.state == SCE_A68K_LABEL) && (sc.ch < 0x80) && (sc.ch == ':'))) // Label - { - sc.ForwardSetState(SCE_A68K_DEFAULT); + /************************************************************ + * + * Check if current state terminates + * + ************************************************************/ + + // Strings: include terminal ' or " in the current string by skipping it + if ((sc.state == SCE_A68K_STRING1) || (sc.state == SCE_A68K_STRING2)) { + sc.Forward(); + } + + + // If a macro declaration was terminated with ':', it was a label + else if ((sc.state == SCE_A68K_MACRO_DECLARATION) && (sc.chPrev == ':')) { + sc.ChangeState(SCE_A68K_LABEL); } - // Check for special words or Doxygen keywords in comments - else if (sc.state == SCE_A68K_COMMENT) - { - if (sc.ch == '\\') { - sc.SetState(SCE_A68K_COMMENT_DOXYGEN); - } - else if ((sc.ch < 0x80) && isalpha(sc.ch)) { - sc.SetState(SCE_A68K_COMMENT_WORD); - } - continue; - } - // Check for special words in comment - else if ((sc.state == SCE_A68K_COMMENT_WORD) && (sc.ch < 0x80) && !isalpha(sc.ch)) - { + // If it wasn't a Doxygen keyword, change it to normal comment + else if (sc.state == SCE_A68K_COMMENT_DOXYGEN) { sc.GetCurrent(Buffer, sizeof(Buffer)); - if (commentSpecial.InList(Buffer)) { - sc.ChangeState(SCE_A68K_COMMENT_SPECIAL); - } - else { - sc.ChangeState(SCE_A68K_COMMENT); - } - sc.SetState(SCE_A68K_COMMENT); - continue; - } - - // Check for Doxygen keywords - else if ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && (sc.ch < 0x80) && !IsDoxygenChar(sc.ch)) - { - sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context if (!doxygenKeyword.InList(Buffer)) { sc.ChangeState(SCE_A68K_COMMENT); } @@ -219,17 +210,39 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, continue; } - // Check if we are in the case of a label which terminates without ':' - // It should be a macro declaration, not a label - else if ((sc.state == SCE_A68K_LABEL) && (sc.ch < 0x80) && ((sc.ch == ' ') || (sc.ch == '\t'))) - { - sc.ChangeState(SCE_A68K_MACRO_DECLARATION); + + // If it wasn't an Alert, change it to normal comment + else if (sc.state == SCE_A68K_COMMENT_SPECIAL) { + sc.GetCurrent(Buffer, sizeof(Buffer)); + if (!alert.InList(Buffer)) { + sc.ChangeState(SCE_A68K_COMMENT); + } + // Reset style to normal comment, or to Doxygen keyword if it begins with '\' + if (sc.ch == '\\') { + sc.SetState(SCE_A68K_COMMENT_DOXYGEN); + } + else { + sc.SetState(SCE_A68K_COMMENT); + } + continue; } + + // If we are in a comment, it's a Doxygen keyword or an Alert + else if (sc.state == SCE_A68K_COMMENT) { + if (sc.ch == '\\') { + sc.SetState(SCE_A68K_COMMENT_DOXYGEN); + } + else { + sc.SetState(SCE_A68K_COMMENT_SPECIAL); + } + continue; + } + + // Check if we are at the end of an identifier // In this case, colourise it if was a keyword. - else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) - { + else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch)) { sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context if (cpuInstruction.InList(Buffer)) { // And check if it belongs to a keyword list sc.ChangeState(SCE_A68K_CPUINSTRUCTION); @@ -256,14 +269,30 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, * ************************************************************/ - // Label and macro identifiers start at the beginning of a line - // We set both as a label, but if it wasn't one (no ':' at the end), - // it will be changed as a macro identifier. - if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { + // Something which begins at the beginning of a line, and with + // - '\' + an identifier start char, or + // - '\\@' + an identifier start char + // is a local label (second case is used for macro local labels). We set it already as a label, it can't be a macro/equ declaration + if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.chNext) && (sc.ch == '\\')) { sc.SetState(SCE_A68K_LABEL); } - else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Comment - sc.SetState(SCE_A68K_COMMENT); + + if (sc.atLineStart && (sc.ch < 0x80) && (sc.ch == '\\') && (sc.chNext == '\\')) { + sc.Forward(2); + if ((sc.ch == '@') && IsIdentifierStart(sc.chNext)) { + sc.ChangeState(SCE_A68K_LABEL); + sc.SetState(SCE_A68K_LABEL); + } + } + + // Label and macro identifiers start at the beginning of a line + // We set both as a macro id, but if it wasn't one (':' at the end), + // it will be changed as a label. + if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { + sc.SetState(SCE_A68K_MACRO_DECLARATION); + } + else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Default: alert in a comment. If it doesn't match + sc.SetState(SCE_A68K_COMMENT); // with an alert, it will be toggle to a normal comment } else if ((sc.ch < 0x80) && isdigit(sc.ch)) { // Decimal numbers haven't prefix sc.SetState(SCE_A68K_NUMBER_DEC); @@ -280,7 +309,7 @@ static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, else if ((sc.ch < 0x80) && (sc.ch == '\"')) { // String (double-quoted) sc.SetState(SCE_A68K_STRING2); } - else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro + else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro are prefixed with '\' sc.SetState(SCE_A68K_MACRO_ARG); } else if ((sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { // An identifier: constant, label, etc... diff --git a/src/stc/scintilla/lexers/LexAU3.cxx b/src/stc/scintilla/lexers/LexAU3.cxx index e9ab75772f..68f1798d33 100644 --- a/src/stc/scintilla/lexers/LexAU3.cxx +++ b/src/stc/scintilla/lexers/LexAU3.cxx @@ -87,7 +87,7 @@ static inline bool IsAWordStart(const int ch) } static inline bool IsAOperator(char ch) { - if (isascii(ch) && isalnum(ch)) + if (IsASCII(ch) && isalnum(ch)) return false; if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '&' || ch == '^' || ch == '=' || ch == '<' || ch == '>' || @@ -228,7 +228,7 @@ static void ColouriseAU3Doc(unsigned int startPos, char si; // string indicator "=1 '=2 char ni; // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3 char ci; // comment indicator 0=not linecomment(;) - char s_save[100]; + char s_save[100] = ""; si=0; ni=0; ci=0; diff --git a/src/stc/scintilla/lexers/LexAVE.cxx b/src/stc/scintilla/lexers/LexAVE.cxx index 373173ca20..8f5729e3d8 100644 --- a/src/stc/scintilla/lexers/LexAVE.cxx +++ b/src/stc/scintilla/lexers/LexAVE.cxx @@ -45,7 +45,7 @@ inline bool IsAWordStart(const int ch) { } inline bool isAveOperator(char ch) { - if (isascii(ch) && isalnum(ch)) + if (IsASCII(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || @@ -167,7 +167,7 @@ static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, W char chNext = static_cast(tolower(styler[startPos])); bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; int styleNext = styler.StyleAt(startPos); - char s[10]; + char s[10] = ""; for (unsigned int i = startPos; i < lengthDoc; i++) { char ch = static_cast(tolower(chNext)); diff --git a/src/stc/scintilla/lexers/LexAbaqus.cxx b/src/stc/scintilla/lexers/LexAbaqus.cxx index 134170071a..d93aa503d9 100644 --- a/src/stc/scintilla/lexers/LexAbaqus.cxx +++ b/src/stc/scintilla/lexers/LexAbaqus.cxx @@ -30,10 +30,6 @@ using namespace Scintilla; #endif -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80 && (isalnum(ch) || (ch == '_'))); -} - static inline bool IsAKeywordChar(const int ch) { return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == ' '))); } @@ -42,17 +38,6 @@ static inline bool IsASetChar(const int ch) { return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-'))); } -static inline bool IsAnOperator(char ch) { - // '.' left out as it is used to make up numbers - if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || - ch == '(' || ch == ')' || ch == '=' || ch == '^' || - ch == '[' || ch == ']' || ch == '<' || ch == '&' || - ch == '>' || ch == ',' || ch == '|' || ch == '~' || - ch == '$' || ch == ':' || ch == '%') - return true; - return false; -} - static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */, Accessor &styler) { enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \ diff --git a/src/stc/scintilla/lexers/LexAda.cxx b/src/stc/scintilla/lexers/LexAda.cxx index 49eb2c68b0..7a7dea60f6 100644 --- a/src/stc/scintilla/lexers/LexAda.cxx +++ b/src/stc/scintilla/lexers/LexAda.cxx @@ -65,8 +65,6 @@ static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribut static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostropheStartsAttribute); static inline bool IsDelimiterCharacter(int ch); -static inline bool IsNumberStartCharacter(int ch); -static inline bool IsNumberCharacter(int ch); static inline bool IsSeparatorOrDelimiterCharacter(int ch); static bool IsValidIdentifier(const std::string& identifier); static bool IsValidNumber(const std::string& number); @@ -310,19 +308,6 @@ static inline bool IsDelimiterCharacter(int ch) { } } -static inline bool IsNumberCharacter(int ch) { - return IsNumberStartCharacter(ch) || - ch == '_' || - ch == '.' || - ch == '#' || - (ch >= 'a' && ch <= 'f') || - (ch >= 'A' && ch <= 'F'); -} - -static inline bool IsNumberStartCharacter(int ch) { - return IsADigit(ch); -} - static inline bool IsSeparatorOrDelimiterCharacter(int ch) { return IsASpace(ch) || IsDelimiterCharacter(ch); } @@ -526,5 +511,5 @@ static inline bool IsWordCharacter(int ch) { } static inline bool IsWordStartCharacter(int ch) { - return (isascii(ch) && isalpha(ch)) || ch == '_'; + return (IsASCII(ch) && isalpha(ch)) || ch == '_'; } diff --git a/src/stc/scintilla/lexers/LexAsm.cxx b/src/stc/scintilla/lexers/LexAsm.cxx index 78874de860..b327ce5f22 100644 --- a/src/stc/scintilla/lexers/LexAsm.cxx +++ b/src/stc/scintilla/lexers/LexAsm.cxx @@ -344,7 +344,7 @@ void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, if (sc.state == SCE_ASM_DEFAULT) { if (sc.ch == ';'){ sc.SetState(SCE_ASM_COMMENT); - } else if (isascii(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && isascii(sc.chNext) && isdigit(sc.chNext)))) { + } else if (IsASCII(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && IsASCII(sc.chNext) && isdigit(sc.chNext)))) { sc.SetState(SCE_ASM_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_ASM_IDENTIFIER); diff --git a/src/stc/scintilla/lexers/LexAsn1.cxx b/src/stc/scintilla/lexers/LexAsn1.cxx index 3545b3fa9a..120b8954b9 100644 --- a/src/stc/scintilla/lexers/LexAsn1.cxx +++ b/src/stc/scintilla/lexers/LexAsn1.cxx @@ -185,4 +185,4 @@ static const char * const asn1WordLists[] = { 0, }; -LexerModule lmAns1(SCLEX_ASN1, ColouriseAsn1Doc, "asn1", FoldAsn1Doc, asn1WordLists); +LexerModule lmAsn1(SCLEX_ASN1, ColouriseAsn1Doc, "asn1", FoldAsn1Doc, asn1WordLists); diff --git a/src/stc/scintilla/lexers/LexBash.cxx b/src/stc/scintilla/lexers/LexBash.cxx index 8cd6cc570e..b85d01a7dc 100644 --- a/src/stc/scintilla/lexers/LexBash.cxx +++ b/src/stc/scintilla/lexers/LexBash.cxx @@ -2,7 +2,7 @@ /** @file LexBash.cxx ** Lexer for Bash. **/ -// Copyright 2004-2010 by Neil Hodgson +// Copyright 2004-2012 by Neil Hodgson // Adapted from LexPerl by Kein-Hong Man 2004 // The License.txt file describes the conditions under which this software may be distributed. @@ -49,6 +49,17 @@ using namespace Scintilla; #define BASH_CMD_ARITH 4 #define BASH_CMD_DELIM 5 +// state constants for nested delimiter pairs, used by +// SCE_SH_STRING and SCE_SH_BACKTICKS processing +#define BASH_DELIM_LITERAL 0 +#define BASH_DELIM_STRING 1 +#define BASH_DELIM_CSTRING 2 +#define BASH_DELIM_LSTRING 3 +#define BASH_DELIM_COMMAND 4 +#define BASH_DELIM_BACKTICK 5 + +#define BASH_DELIM_STACK_MAX 7 + static inline int translateBashDigit(int ch) { if (ch >= '0' && ch <= '9') { return ch - '0'; @@ -97,6 +108,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, CharacterSet setWordStart(CharacterSet::setAlpha, "_"); // note that [+-] are often parts of identifiers in shell scripts CharacterSet setWord(CharacterSet::setAlphaNum, "._+-"); + CharacterSet setMetaCharacter(CharacterSet::setNone, "|&;()<> \t\r\n"); + setMetaCharacter.Add(0); CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/= BASH_DELIM_STACK_MAX) + return; + CountStack[Depth] = Count; + UpStack [Depth] = Up; + StyleStack[Depth] = Style; + Depth++; + Count = 1; + Up = u; + Down = opposite(Up); + Style = s; + } + void Pop(void) { + if (Depth <= 0) + return; + Depth--; + Count = CountStack[Depth]; + Up = UpStack [Depth]; + Style = StyleStack[Depth]; + Down = opposite(Up); + } + ~QuoteStackCls() { + delete []CountStack; + delete []UpStack; + delete []StyleStack; + } + }; + QuoteStackCls QuoteStack; + int numBase = 0; int digit; unsigned int endPos = startPos + length; @@ -163,6 +230,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, // Always backtracks to the start of a line that is not a continuation // of the previous line (i.e. start of a bash command segment) int ln = styler.GetLine(startPos); + if (ln > 0 && startPos == static_cast(styler.LineStart(ln))) + ln--; for (;;) { startPos = styler.LineStart(ln); if (ln == 0 || styler.GetLineState(ln) == BASH_CMD_START) @@ -370,13 +439,23 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, HereDoc.State = 1; } } else if (HereDoc.State == 1) { // collect the delimiter - if (setHereDoc2.Contains(sc.ch) || sc.chPrev == '\\') { + // * if single quoted, there's no escape + // * if double quoted, there are \\ and \" escapes + if ((HereDoc.Quote == '\'' && sc.ch != HereDoc.Quote) || + (HereDoc.Quoted && sc.ch != HereDoc.Quote && sc.ch != '\\') || + (HereDoc.Quote != '\'' && sc.chPrev == '\\') || + (setHereDoc2.Contains(sc.ch))) { HereDoc.Append(sc.ch); } else if (HereDoc.Quoted && sc.ch == HereDoc.Quote) { // closing quote => end of delimiter sc.ForwardSetState(SCE_SH_DEFAULT); } else if (sc.ch == '\\') { - // skip escape prefix - } else { + if (HereDoc.Quoted && sc.chNext != HereDoc.Quote && sc.chNext != '\\') { + // in quoted prefixes only \ and the quote eat the escape + HereDoc.Append(sc.ch); + } else { + // skip escape prefix + } + } else if (!HereDoc.Quoted) { sc.SetState(SCE_SH_DEFAULT); } if (HereDoc.DelimiterLength >= HERE_DELIM_MAX - 1) { // force blowup @@ -401,8 +480,11 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, } char s[HERE_DELIM_MAX]; sc.GetCurrent(s, sizeof(s)); - if (sc.LengthCurrent() == 0) + if (sc.LengthCurrent() == 0) { // '' or "" delimiters + if (prefixws == 0 && HereDoc.Quoted && HereDoc.DelimiterLength == 0) + sc.SetState(SCE_SH_DEFAULT); break; + } if (s[strlen(s) - 1] == '\r') s[strlen(s) - 1] = '\0'; if (strcmp(HereDoc.Delimiter, s) == 0) { @@ -424,9 +506,56 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, } } break; - case SCE_SH_STRING: // delimited styles + case SCE_SH_STRING: // delimited styles, can nest case SCE_SH_BACKTICKS: - case SCE_SH_PARAM: + if (sc.ch == '\\' && QuoteStack.Up != '\\') { + if (QuoteStack.Style != BASH_DELIM_LITERAL) + sc.Forward(); + } else if (sc.ch == QuoteStack.Down) { + QuoteStack.Count--; + if (QuoteStack.Count == 0) { + if (QuoteStack.Depth > 0) { + QuoteStack.Pop(); + } else + sc.ForwardSetState(SCE_SH_DEFAULT); + } + } else if (sc.ch == QuoteStack.Up) { + QuoteStack.Count++; + } else { + if (QuoteStack.Style == BASH_DELIM_STRING || + QuoteStack.Style == BASH_DELIM_LSTRING + ) { // do nesting for "string", $"locale-string" + if (sc.ch == '`') { + QuoteStack.Push(sc.ch, BASH_DELIM_BACKTICK); + } else if (sc.ch == '$' && sc.chNext == '(') { + sc.Forward(); + QuoteStack.Push(sc.ch, BASH_DELIM_COMMAND); + } + } else if (QuoteStack.Style == BASH_DELIM_COMMAND || + QuoteStack.Style == BASH_DELIM_BACKTICK + ) { // do nesting for $(command), `command` + if (sc.ch == '\'') { + QuoteStack.Push(sc.ch, BASH_DELIM_LITERAL); + } else if (sc.ch == '\"') { + QuoteStack.Push(sc.ch, BASH_DELIM_STRING); + } else if (sc.ch == '`') { + QuoteStack.Push(sc.ch, BASH_DELIM_BACKTICK); + } else if (sc.ch == '$') { + if (sc.chNext == '\'') { + sc.Forward(); + QuoteStack.Push(sc.ch, BASH_DELIM_CSTRING); + } else if (sc.chNext == '\"') { + sc.Forward(); + QuoteStack.Push(sc.ch, BASH_DELIM_LSTRING); + } else if (sc.chNext == '(') { + sc.Forward(); + QuoteStack.Push(sc.ch, BASH_DELIM_COMMAND); + } + } + } + } + break; + case SCE_SH_PARAM: // ${parameter} if (sc.ch == '\\' && Quote.Up != '\\') { sc.Forward(); } else if (sc.ch == Quote.Down) { @@ -461,8 +590,14 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.ChangeState(SCE_SH_ERROR); } // HereDoc.Quote always == '\'' + sc.SetState(SCE_SH_HERE_Q); + } else if (HereDoc.DelimiterLength == 0) { + // no delimiter, illegal (but '' and "" are legal) + sc.ChangeState(SCE_SH_ERROR); + sc.SetState(SCE_SH_DEFAULT); + } else { + sc.SetState(SCE_SH_HERE_Q); } - sc.SetState(SCE_SH_HERE_Q); } // update cmdState about the current command segment @@ -494,16 +629,21 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, } else if (setWordStart.Contains(sc.ch)) { sc.SetState(SCE_SH_WORD); } else if (sc.ch == '#') { - sc.SetState(SCE_SH_COMMENTLINE); + if (stylePrev != SCE_SH_WORD && stylePrev != SCE_SH_IDENTIFIER && + (sc.currentPos == 0 || setMetaCharacter.Contains(sc.chPrev))) { + sc.SetState(SCE_SH_COMMENTLINE); + } else { + sc.SetState(SCE_SH_WORD); + } } else if (sc.ch == '\"') { sc.SetState(SCE_SH_STRING); - Quote.Start(sc.ch); + QuoteStack.Start(sc.ch, BASH_DELIM_STRING); } else if (sc.ch == '\'') { sc.SetState(SCE_SH_CHARACTER); Quote.Start(sc.ch); } else if (sc.ch == '`') { sc.SetState(SCE_SH_BACKTICKS); - Quote.Start(sc.ch); + QuoteStack.Start(sc.ch, BASH_DELIM_BACKTICK); } else if (sc.ch == '$') { if (sc.Match("$((")) { sc.SetState(SCE_SH_OPERATOR); // handle '((' later @@ -513,17 +653,22 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, sc.Forward(); if (sc.ch == '{') { sc.ChangeState(SCE_SH_PARAM); + Quote.Start(sc.ch); } else if (sc.ch == '\'') { sc.ChangeState(SCE_SH_STRING); + QuoteStack.Start(sc.ch, BASH_DELIM_CSTRING); } else if (sc.ch == '"') { sc.ChangeState(SCE_SH_STRING); - } else if (sc.ch == '(' || sc.ch == '`') { + QuoteStack.Start(sc.ch, BASH_DELIM_LSTRING); + } else if (sc.ch == '(') { sc.ChangeState(SCE_SH_BACKTICKS); + QuoteStack.Start(sc.ch, BASH_DELIM_COMMAND); + } else if (sc.ch == '`') { // $` seen in a configure script, valid? + sc.ChangeState(SCE_SH_BACKTICKS); + QuoteStack.Start(sc.ch, BASH_DELIM_BACKTICK); } else { continue; // scalar has no delimiter pair } - // fallthrough, open delim for $[{'"(`] - Quote.Start(sc.ch); } else if (sc.Match('<', '<')) { sc.SetState(SCE_SH_HERE_DELIM); HereDoc.State = 0; @@ -597,6 +742,10 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle, }// sc.state } sc.Complete(); + if (sc.state == SCE_SH_HERE_Q) { + styler.ChangeLexerState(sc.currentPos, styler.Length()); + } + sc.Complete(); } static bool IsCommentLine(int line, Accessor &styler) { @@ -651,7 +800,7 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[], if (ch == '<' && chNext == '<') { levelCurrent++; } - } else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_PL_DEFAULT) { + } else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_SH_DEFAULT) { levelCurrent--; } if (atEOL) { diff --git a/src/stc/scintilla/lexers/LexBasic.cxx b/src/stc/scintilla/lexers/LexBasic.cxx index bc8fcee472..b73fac8b6e 100644 --- a/src/stc/scintilla/lexers/LexBasic.cxx +++ b/src/stc/scintilla/lexers/LexBasic.cxx @@ -49,17 +49,18 @@ using namespace Scintilla; * 8 - decimal digit * 16 - hex digit * 32 - bin digit + * 64 - letter */ static int character_classification[128] = { - 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 2, - 60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2, - 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4, - 2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4, - 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0 + 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0, + 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, + 1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 2, + 60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2, + 2, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 2, 2, 2, 2, 68, + 2, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68, + 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 2, 2, 2, 2, 0 }; static bool IsSpace(int c) { @@ -86,6 +87,10 @@ static bool IsBinDigit(int c) { return c < 128 && (character_classification[c] & 32); } +static bool IsLetter(int c) { + return c < 128 && (character_classification[c] & 64); +} + static int LowerCase(int c) { if (c >= 'A' && c <= 'Z') @@ -126,13 +131,23 @@ static int CheckPureFoldPoint(char const *token, int &level) { static int CheckFreeFoldPoint(char const *token, int &level) { if (!strcmp(token, "function") || !strcmp(token, "sub") || - !strcmp(token, "type")) { + !strcmp(token, "enum") || + !strcmp(token, "type") || + !strcmp(token, "union") || + !strcmp(token, "property") || + !strcmp(token, "destructor") || + !strcmp(token, "constructor")) { level |= SC_FOLDLEVELHEADERFLAG; return 1; } if (!strcmp(token, "end function") || !strcmp(token, "end sub") || - !strcmp(token, "end type")) { + !strcmp(token, "end enum") || + !strcmp(token, "end type") || + !strcmp(token, "end union") || + !strcmp(token, "end property") || + !strcmp(token, "end destructor") || + !strcmp(token, "end constructor")) { return -1; } return 0; @@ -219,9 +234,9 @@ class LexerBasic : public ILexer { OptionSetBasic osBasic; public: LexerBasic(char comment_char_, int (*CheckFoldPoint_)(char const *, int &), const char * const wordListDescriptions[]) : - comment_char(comment_char_), - CheckFoldPoint(CheckFoldPoint_), - osBasic(wordListDescriptions) { + comment_char(comment_char_), + CheckFoldPoint(CheckFoldPoint_), + osBasic(wordListDescriptions) { } virtual ~LexerBasic() { } @@ -302,6 +317,7 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle bool wasfirst = true, isfirst = true; // true if first token in a line styler.StartAt(startPos); + int styleBeforeKeyword = SCE_B_DEFAULT; StyleContext sc(startPos, length, initStyle, styler); @@ -367,14 +383,44 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle if (sc.atLineEnd) { sc.SetState(SCE_B_DEFAULT); } + } else if (sc.state == SCE_B_DOCLINE) { + if (sc.atLineEnd) { + sc.SetState(SCE_B_DEFAULT); + } else if (sc.ch == '\\' || sc.ch == '@') { + if (IsLetter(sc.chNext) && sc.chPrev != '\\') { + styleBeforeKeyword = sc.state; + sc.SetState(SCE_B_DOCKEYWORD); + }; + } + } else if (sc.state == SCE_B_DOCKEYWORD) { + if (IsSpace(sc.ch)) { + sc.SetState(styleBeforeKeyword); + } else if (sc.atLineEnd && styleBeforeKeyword == SCE_B_DOCLINE) { + sc.SetState(SCE_B_DEFAULT); + } + } else if (sc.state == SCE_B_COMMENTBLOCK) { + if (sc.Match("\'/")) { + sc.Forward(); + sc.ForwardSetState(SCE_B_DEFAULT); + } + } else if (sc.state == SCE_B_DOCBLOCK) { + if (sc.Match("\'/")) { + sc.Forward(); + sc.ForwardSetState(SCE_B_DEFAULT); + } else if (sc.ch == '\\' || sc.ch == '@') { + if (IsLetter(sc.chNext) && sc.chPrev != '\\') { + styleBeforeKeyword = sc.state; + sc.SetState(SCE_B_DOCKEYWORD); + }; + } } if (sc.atLineStart) isfirst = true; if (sc.state == SCE_B_DEFAULT || sc.state == SCE_B_ERROR) { - if (isfirst && sc.Match('.')) { - sc.SetState(SCE_B_LABEL); + if (isfirst && sc.Match('.') && comment_char != '\'') { + sc.SetState(SCE_B_LABEL); } else if (isfirst && sc.Match('#')) { wasfirst = isfirst; sc.SetState(SCE_B_IDENTIFIER); @@ -383,15 +429,25 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle // up in freebasic with SCE_B_PREPROCESSOR. if (comment_char == '\'' && sc.Match(comment_char, '$')) sc.SetState(SCE_B_PREPROCESSOR); - else + else if (sc.Match("\'*") || sc.Match("\'!")) { + sc.SetState(SCE_B_DOCLINE); + } else { sc.SetState(SCE_B_COMMENT); + } + } else if (sc.Match("/\'")) { + if (sc.Match("/\'*") || sc.Match("/\'!")) { // Support of gtk-doc/Doxygen doc. style + sc.SetState(SCE_B_DOCBLOCK); + } else { + sc.SetState(SCE_B_COMMENTBLOCK); + } + sc.Forward(); // Eat the ' so it isn't used for the end of the comment } else if (sc.Match('"')) { sc.SetState(SCE_B_STRING); } else if (IsDigit(sc.ch)) { sc.SetState(SCE_B_NUMBER); - } else if (sc.Match('$')) { + } else if (sc.Match('$') || sc.Match("&h") || sc.Match("&H") || sc.Match("&o") || sc.Match("&O")) { sc.SetState(SCE_B_HEXNUMBER); - } else if (sc.Match('%')) { + } else if (sc.Match('%') || sc.Match("&b") || sc.Match("&B")) { sc.SetState(SCE_B_BINNUMBER); } else if (sc.Match('#')) { sc.SetState(SCE_B_CONSTANT); diff --git a/src/stc/scintilla/lexers/LexBullant.cxx b/src/stc/scintilla/lexers/LexBullant.cxx index bb5c9c4a86..51d6bd8f08 100644 --- a/src/stc/scintilla/lexers/LexBullant.cxx +++ b/src/stc/scintilla/lexers/LexBullant.cxx @@ -116,7 +116,7 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle } blockChange=0; */ } - if (!(isascii(ch) && isspace(ch))) + if (!(IsASCII(ch) && isspace(ch))) visibleChars++; if (styler.IsLeadByte(ch)) { diff --git a/src/stc/scintilla/lexers/LexCOBOL.cxx b/src/stc/scintilla/lexers/LexCOBOL.cxx index b3bc011d60..a937690d85 100644 --- a/src/stc/scintilla/lexers/LexCOBOL.cxx +++ b/src/stc/scintilla/lexers/LexCOBOL.cxx @@ -44,13 +44,13 @@ inline bool isCOBOLoperator(char ch) inline bool isCOBOLwordchar(char ch) { - return isascii(ch) && (isalnum(ch) || ch == '-'); + return IsASCII(ch) && (isalnum(ch) || ch == '-'); } inline bool isCOBOLwordstart(char ch) { - return isascii(ch) && isalnum(ch); + return IsASCII(ch) && isalnum(ch); } static int CountBits(int nBits) @@ -90,6 +90,8 @@ static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &k WordList& c_keywords = *keywordlists[2]; char s[100]; + s[0] = '\0'; + s[1] = '\0'; getRange(start, end, styler, s, sizeof(s)); char chAttr = SCE_C_IDENTIFIER; @@ -205,7 +207,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, } if (state == SCE_C_DEFAULT) { - if (isCOBOLwordstart(ch) || (ch == '$' && isascii(chNext) && isalpha(chNext))) { + if (isCOBOLwordstart(ch) || (ch == '$' && IsASCII(chNext) && isalpha(chNext))) { ColourTo(styler, i-1, state); state = SCE_C_IDENTIFIER; } else if (column == 6 && ch == '*') { diff --git a/src/stc/scintilla/lexers/LexCPP.cxx b/src/stc/scintilla/lexers/LexCPP.cxx index d6efa7ee01..04628b4df7 100644 --- a/src/stc/scintilla/lexers/LexCPP.cxx +++ b/src/stc/scintilla/lexers/LexCPP.cxx @@ -30,6 +30,7 @@ #include "LexerModule.h" #include "OptionSet.h" #include "SparseState.h" +#include "SubStyles.h" #ifdef SCI_NAMESPACE using namespace Scintilla; @@ -65,9 +66,8 @@ static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) { int pos = (int) sc.currentPos; int currentLine = styler.GetLine(pos); int lineStartPos = styler.LineStart(currentLine); - char ch; while (--pos > lineStartPos) { - ch = styler.SafeGetCharAt(pos); + char ch = styler.SafeGetCharAt(pos); if (ch != ' ' && ch != '\t') { break; } @@ -87,11 +87,15 @@ static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace std::string restOfLine; int i =0; char ch = styler.SafeGetCharAt(start, '\n'); - while ((ch != '\r') && (ch != '\n')) { + int endLine = styler.LineEnd(styler.GetLine(start)); + while (((start+i) < endLine) && (ch != '\r')) { + char chNext = styler.SafeGetCharAt(start + i + 1, '\n'); + if (ch == '/' && (chNext == '/' || chNext == '*')) + break; if (allowSpace || (ch != ' ')) restOfLine += ch; i++; - ch = styler.SafeGetCharAt(start + i, '\n'); + ch = chNext; } return restOfLine; } @@ -127,8 +131,9 @@ struct PPDefinition { int line; std::string key; std::string value; - PPDefinition(int line_, const std::string &key_, const std::string &value_) : - line(line_), key(key_), value(value_) { + bool isUndef; + PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false) : + line(line_), key(key_), value(value_), isUndef(isUndef_) { } }; @@ -148,7 +153,7 @@ public: bool IsInactive() const { return state != 0; } - bool CurrentIfTaken() { + bool CurrentIfTaken() const { return (ifTaken & maskLevel()) != 0; } void StartSection(bool on) { @@ -183,7 +188,7 @@ public: class PPStates { std::vector vlls; public: - LinePPState ForLine(int line) { + LinePPState ForLine(int line) const { if ((line > 0) && (vlls.size() > static_cast(line))) { return vlls[line]; } else { @@ -307,7 +312,9 @@ struct OptionSetCPP : public OptionSet { } }; -class LexerCPP : public ILexer { +static const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0}; + +class LexerCPP : public ILexerWithSubStyles { bool caseSensitive; CharacterSet setWord; CharacterSet setNegationOp; @@ -326,14 +333,17 @@ class LexerCPP : public ILexer { OptionSetCPP osCPP; SparseState rawStringTerminators; enum { activeFlag = 0x40 }; + enum { ssIdentifier, ssDocKeyword }; + SubStyles subStyles; public: - LexerCPP(bool caseSensitive_) : + explicit LexerCPP(bool caseSensitive_) : caseSensitive(caseSensitive_), setWord(CharacterSet::setAlphaNum, "._", 0x80, true), setNegationOp(CharacterSet::setNone, "!"), setArithmethicOp(CharacterSet::setNone, "+-/*%"), setRelOp(CharacterSet::setNone, "=!<>"), - setLogicalOp(CharacterSet::setNone, "|&") { + setLogicalOp(CharacterSet::setNone, "|&"), + subStyles(styleSubable, 0x80, 0x40, activeFlag) { } virtual ~LexerCPP() { } @@ -341,7 +351,7 @@ public: delete this; } int SCI_METHOD Version() const { - return lvOriginal; + return lvSubStyles; } const char * SCI_METHOD PropertyNames() { return osCPP.PropertyNames(); @@ -364,6 +374,40 @@ public: return 0; } + int SCI_METHOD LineEndTypesSupported() { + return SC_LINE_END_TYPE_UNICODE; + } + + int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) { + return subStyles.Allocate(styleBase, numberStyles); + } + int SCI_METHOD SubStylesStart(int styleBase) { + return subStyles.Start(styleBase); + } + int SCI_METHOD SubStylesLength(int styleBase) { + return subStyles.Length(styleBase); + } + int SCI_METHOD StyleFromSubStyle(int subStyle) { + int styleBase = subStyles.BaseStyle(MaskActive(subStyle)); + int active = subStyle & activeFlag; + return styleBase | active; + } + int SCI_METHOD PrimaryStyleFromStyle(int style) { + return MaskActive(style); + } + void SCI_METHOD FreeSubStyles() { + subStyles.Free(); + } + void SCI_METHOD SetIdentifiers(int style, const char *identifiers) { + subStyles.SetIdentifiers(style, identifiers); + } + int SCI_METHOD DistanceToSecondaryStyles() { + return activeFlag; + } + const char * SCI_METHOD GetSubStyleBases() { + return styleSubable; + } + static ILexer *LexerFactoryCPP() { return new LexerCPP(true); } @@ -419,9 +463,9 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { if (n == 4) { // Rebuild preprocessorDefinitions preprocessorDefinitionsStart.clear(); - for (int nDefinition = 0; nDefinition < ppDefinitions.len; nDefinition++) { - char *cpDefinition = ppDefinitions.words[nDefinition]; - char *cpEquals = strchr(cpDefinition, '='); + for (int nDefinition = 0; nDefinition < ppDefinitions.Length(); nDefinition++) { + const char *cpDefinition = ppDefinitions.WordAt(nDefinition); + const char *cpEquals = strchr(cpDefinition, '='); if (cpEquals) { std::string name(cpDefinition, cpEquals - cpDefinition); std::string val(cpEquals+1); @@ -441,7 +485,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) { // Functor used to truncate history struct After { int line; - After(int line_) : line(line_) {} + explicit After(int line_) : line(line_) {} bool operator()(PPDefinition &p) const { return p.line > line; } @@ -457,6 +501,8 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true); + CharacterSet setInvalidRawFirst(CharacterSet::setNone, " )\\\t\v\f\n"); + if (options.identifiersAllowDollars) { setWordStart.Add('$'); } @@ -467,6 +513,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, int styleBeforeDCKeyword = SCE_C_DEFAULT; bool continuationLine = false; bool isIncludePreprocessor = false; + bool isStringInPreprocessor = false; + bool inRERange = false; + bool seenDocKeyBrace = false; int lineCurrent = styler.GetLine(startPos); if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) || @@ -474,15 +523,10 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, (MaskActive(initStyle) == SCE_C_COMMENTLINEDOC)) { // Set continuationLine if last character of previous line is '\' if (lineCurrent > 0) { - int chBack = styler.SafeGetCharAt(startPos-1, 0); - int chBack2 = styler.SafeGetCharAt(startPos-2, 0); - int lineEndChar = '!'; - if (chBack2 == '\r' && chBack == '\n') { - lineEndChar = styler.SafeGetCharAt(startPos-3, 0); - } else if (chBack == '\n' || chBack == '\r') { - lineEndChar = chBack2; + int endLinePrevious = styler.LineEnd(lineCurrent - 1); + if (endLinePrevious > 0) { + continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\'; } - continuationLine = lineEndChar == '\\'; } } @@ -496,7 +540,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, } } - StyleContext sc(startPos, length, initStyle, styler, 0x7f); + StyleContext sc(startPos, length, initStyle, styler, static_cast(0xff)); LinePPState preproc = vlls.ForLine(lineCurrent); bool definitionsChanged = false; @@ -514,7 +558,10 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, std::map preprocessorDefinitions = preprocessorDefinitionsStart; for (std::vector::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) { - preprocessorDefinitions[itDef->key] = itDef->value; + if (itDef->isUndef) + preprocessorDefinitions.erase(itDef->key); + else + preprocessorDefinitions[itDef->key] = itDef->value; } std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1); @@ -522,6 +569,11 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, int activitySet = preproc.IsInactive() ? activeFlag : 0; + const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER); + const WordClassifier &classifierDocKeyWords = subStyles.Classifier(SCE_C_COMMENTDOCKEYWORD); + + int lineEndNext = styler.LineEnd(lineCurrent); + for (; sc.More();) { if (sc.atLineStart) { @@ -540,6 +592,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, visibleChars = 0; lastWordWasUUID = false; isIncludePreprocessor = false; + inRERange = false; if (preproc.IsInactive()) { activitySet = activeFlag; sc.SetState(sc.state | activitySet); @@ -548,6 +601,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, if (sc.atLineEnd) { lineCurrent++; + lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); if (rawStringTerminator != "") { rawSTNew.Set(lineCurrent-1, rawStringTerminator); @@ -556,11 +610,13 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, // Handle line continuation generically. if (sc.ch == '\\') { - if (sc.chNext == '\n' || sc.chNext == '\r') { + if (static_cast((sc.currentPos+1)) >= lineEndNext) { lineCurrent++; + lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); sc.Forward(); if (sc.ch == '\r' && sc.chNext == '\n') { + // Even in UTF-8, \r and \n are separate sc.Forward(); } continuationLine = true; @@ -578,12 +634,21 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, break; case SCE_C_NUMBER: // We accept almost anything because of hex. and number suffixes - if (!(setWord.Contains(sc.ch) || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) { + if (sc.ch == '_') { + sc.ChangeState(SCE_C_USERLITERAL|activitySet); + } else if (!(setWord.Contains(sc.ch) + || (sc.ch == '\'') + || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E' || + sc.chPrev == 'p' || sc.chPrev == 'P')))) { sc.SetState(SCE_C_DEFAULT|activitySet); } break; + case SCE_C_USERLITERAL: + if (!(setWord.Contains(sc.ch))) + sc.SetState(SCE_C_DEFAULT|activitySet); + break; case SCE_C_IDENTIFIER: - if (!setWord.Contains(sc.ch) || (sc.ch == '.')) { + if (sc.atLineStart || sc.atLineEnd || !setWord.Contains(sc.ch) || (sc.ch == '.')) { char s[1000]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); @@ -597,11 +662,16 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, sc.ChangeState(SCE_C_WORD2|activitySet); } else if (keywords4.InList(s)) { sc.ChangeState(SCE_C_GLOBALCLASS|activitySet); + } else { + int subStyle = classifierIdentifiers.ValueFor(s); + if (subStyle >= 0) { + sc.ChangeState(subStyle|activitySet); + } } const bool literalString = sc.ch == '\"'; if (literalString || sc.ch == '\'') { size_t lenS = strlen(s); - const bool raw = literalString && sc.chPrev == 'R'; + const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext); if (raw) s[lenS--] = '\0'; bool valid = @@ -613,9 +683,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet); else sc.ChangeState(SCE_C_CHARACTER|activitySet); + } else { + sc.SetState(SCE_C_DEFAULT | activitySet); } + } else { + sc.SetState(SCE_C_DEFAULT|activitySet); } - sc.SetState(SCE_C_DEFAULT|activitySet); } break; case SCE_C_PREPROCESSOR: @@ -623,9 +696,17 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, if (IsASpace(sc.ch)) { sc.SetState(SCE_C_DEFAULT|activitySet); } - } else { - if (sc.Match('/', '*')) { - sc.SetState(SCE_C_PREPROCESSORCOMMENT|activitySet); + } else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"') || sc.atLineEnd)) { + isStringInPreprocessor = false; + } else if (!isStringInPreprocessor) { + if ((isIncludePreprocessor && sc.Match('<')) || sc.Match('\"')) { + isStringInPreprocessor = true; + } else if (sc.Match('/', '*')) { + if (sc.Match("/**") || sc.Match("/*!")) { + sc.SetState(SCE_C_PREPROCESSORCOMMENTDOC|activitySet); + } else { + sc.SetState(SCE_C_PREPROCESSORCOMMENT|activitySet); + } sc.Forward(); // Eat the * } else if (sc.Match('/', '/')) { sc.SetState(SCE_C_DEFAULT|activitySet); @@ -633,6 +714,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, } break; case SCE_C_PREPROCESSORCOMMENT: + case SCE_C_PREPROCESSORCOMMENTDOC: if (sc.Match('*', '/')) { sc.Forward(); sc.ForwardSetState(SCE_C_PREPROCESSOR|activitySet); @@ -678,17 +760,29 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); sc.Forward(); sc.ForwardSetState(SCE_C_DEFAULT|activitySet); - } else if (!setDoxygen.Contains(sc.ch)) { + seenDocKeyBrace = false; + } else if (sc.ch == '[' || sc.ch == '{') { + seenDocKeyBrace = true; + } else if (!setDoxygen.Contains(sc.ch) + && !(seenDocKeyBrace && (sc.ch == ',' || sc.ch == '.'))) { char s[100]; if (caseSensitive) { sc.GetCurrent(s, sizeof(s)); } else { sc.GetCurrentLowered(s, sizeof(s)); } - if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { + if (!(IsASpace(sc.ch) || (sc.ch == 0))) { sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet); + } else if (!keywords3.InList(s + 1)) { + int subStyleCDKW = classifierDocKeyWords.ValueFor(s+1); + if (subStyleCDKW >= 0) { + sc.ChangeState(subStyleCDKW|activitySet); + } else { + sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet); + } } sc.SetState(styleBeforeDCKeyword|activitySet); + seenDocKeyBrace = false; } break; case SCE_C_STRING: @@ -704,7 +798,11 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, sc.Forward(); } } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + if (sc.chNext == '_') { + sc.ChangeState(SCE_C_USERLITERAL|activitySet); + } else { + sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + } } break; case SCE_C_HASHQUOTEDSTRING: @@ -732,22 +830,28 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, sc.Forward(); } } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + if (sc.chNext == '_') { + sc.ChangeState(SCE_C_USERLITERAL|activitySet); + } else { + sc.ForwardSetState(SCE_C_DEFAULT|activitySet); + } } break; case SCE_C_REGEX: if (sc.atLineStart) { sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '/') { + } else if (! inRERange && sc.ch == '/') { sc.Forward(); while ((sc.ch < 0x80) && islower(sc.ch)) sc.Forward(); // gobble regex flags sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (sc.ch == '\\') { - // Gobble up the quoted character - if (sc.chNext == '\\' || sc.chNext == '/') { - sc.Forward(); - } + } else if (sc.ch == '\\' && (static_cast(sc.currentPos+1) < lineEndNext)) { + // Gobble up the escaped character + sc.Forward(); + } else if (sc.ch == '[') { + inRERange = true; + } else if (sc.ch == ']') { + inRERange = false; } break; case SCE_C_STRINGEOL: @@ -773,7 +877,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, } break; case SCE_C_UUID: - if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') { + if (sc.atLineEnd || sc.ch == ')') { sc.SetState(SCE_C_DEFAULT|activitySet); } } @@ -781,6 +885,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, if (sc.atLineEnd && !atLineEndBeforeSwitch) { // State exit processing consumed characters up to end of line. lineCurrent++; + lineEndNext = styler.LineEnd(lineCurrent); vlls.Add(lineCurrent, preproc); } @@ -802,7 +907,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, } else { sc.SetState(SCE_C_NUMBER|activitySet); } - } else if (setWordStart.Contains(sc.ch) || (sc.ch == '@')) { + } else if (!sc.atLineEnd && (setWordStart.Contains(sc.ch) || (sc.ch == '@'))) { if (lastWordWasUUID) { sc.SetState(SCE_C_UUID|activitySet); lastWordWasUUID = false; @@ -828,6 +933,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, && (!setCouldBePostOp.Contains(chPrevNonWhite) || !FollowsPostfixOperator(sc, styler))) { sc.SetState(SCE_C_REGEX|activitySet); // JavaScript's RegEx + inRERange = false; } else if (sc.ch == '\"') { if (sc.chPrev == 'R') { styler.Flush(); @@ -927,10 +1033,22 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, } } } + } else if (sc.Match("undef")) { + if (options.updatePreprocessor && !preproc.IsInactive()) { + std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, true); + std::vector tokens = Tokenize(restOfLine); + std::string key; + if (tokens.size() >= 1) { + key = tokens[0]; + preprocessorDefinitions.erase(key); + ppDefineHistory.push_back(PPDefinition(lineCurrent, key, "", true)); + definitionsChanged = true; + } + } } } } - } else if (isoperator(static_cast(sc.ch))) { + } else if (isoperator(sc.ch)) { sc.SetState(SCE_C_OPERATOR|activitySet); } } @@ -961,10 +1079,12 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, unsigned int endPos = startPos + length; int visibleChars = 0; + bool inLineComment = false; int lineCurrent = styler.GetLine(startPos); int levelCurrent = SC_FOLDLEVELBASE; if (lineCurrent > 0) levelCurrent = styler.LevelAt(lineCurrent-1) >> 16; + unsigned int lineStartNext = styler.LineStart(lineCurrent+1); int levelMinCurrent = levelCurrent; int levelNext = levelCurrent; char chNext = styler[startPos]; @@ -977,11 +1097,13 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, int stylePrev = style; style = styleNext; styleNext = MaskActive(styler.StyleAt(i + 1)); - bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); - if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style)) { - if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_C_COMMENTLINEDOC)) { + bool atEOL = i == (lineStartNext-1); + if ((style == SCE_C_COMMENTLINE) || (style == SCE_C_COMMENTLINEDOC)) + inLineComment = true; + if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) { + if (!IsStreamCommentStyle(stylePrev)) { levelNext++; - } else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) { + } else if (!IsStreamCommentStyle(styleNext) && !atEOL) { // Comments don't end at end of line and the next character may be unstyled. levelNext--; } @@ -1045,6 +1167,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, styler.SetLevel(lineCurrent, lev); } lineCurrent++; + lineStartNext = styler.LineStart(lineCurrent+1); levelCurrent = levelNext; levelMinCurrent = levelCurrent; if (atEOL && (i == static_cast(styler.Length()-1))) { @@ -1052,6 +1175,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG); } visibleChars = 0; + inLineComment = false; } } } @@ -1165,7 +1289,7 @@ bool LexerCPP::EvaluateExpression(const std::string &expr, const std::map tokens; const char *cp = expr.c_str(); for (;;) { - if (setWord.Contains(*cp)) { + if (setWord.Contains(static_cast(*cp))) { word += *cp; } else { std::map::const_iterator it = preprocessorDefinitions.find(word); @@ -1180,13 +1304,13 @@ bool LexerCPP::EvaluateExpression(const std::string &expr, const std::map(*cp))) { + if (setRelOp.Contains(static_cast(cp[1]))) { op += cp[1]; cp++; } - } else if (setLogicalOp.Contains(*cp)) { - if (setLogicalOp.Contains(cp[1])) { + } else if (setLogicalOp.Contains(static_cast(*cp))) { + if (setLogicalOp.Contains(static_cast(cp[1]))) { op += cp[1]; cp++; } diff --git a/src/stc/scintilla/lexers/LexCmake.cxx b/src/stc/scintilla/lexers/LexCmake.cxx index 70e9dee984..fb79abf264 100644 --- a/src/stc/scintilla/lexers/LexCmake.cxx +++ b/src/stc/scintilla/lexers/LexCmake.cxx @@ -226,14 +226,13 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList * break; case SCE_CMAKE_COMMENT: - if ( cNextChar == '\n' || cNextChar == '\r' ) { - // Special case: - if ( cCurrChar == '\\' ) { + if ( cCurrChar == '\n' || cCurrChar == '\r' ) { + if ( styler.SafeGetCharAt(i-1) == '\\' ) { styler.ColourTo(i-2,state); - styler.ColourTo(i,SCE_CMAKE_DEFAULT); + styler.ColourTo(i-1,SCE_CMAKE_DEFAULT); } else { - styler.ColourTo(i,state); + styler.ColourTo(i-1,state); state = SCE_CMAKE_DEFAULT; } } @@ -335,10 +334,7 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList * break; } - if ( state == SCE_CMAKE_COMMENT) { - styler.ColourTo(i,state); - } - else if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) { + if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) { bool bIngoreNextDollarSign = false; if ( bVarInString && cCurrChar == '$' ) { diff --git a/src/stc/scintilla/lexers/LexCoffeeScript.cxx b/src/stc/scintilla/lexers/LexCoffeeScript.cxx index 96d5d2d96f..9da531adb9 100644 --- a/src/stc/scintilla/lexers/LexCoffeeScript.cxx +++ b/src/stc/scintilla/lexers/LexCoffeeScript.cxx @@ -31,16 +31,16 @@ using namespace Scintilla; #endif static bool IsSpaceEquiv(int state) { - return (state <= SCE_C_COMMENTDOC - // including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE - || state == SCE_C_COMMENTLINEDOC - || state == SCE_C_COMMENTDOCKEYWORD - || state == SCE_C_COMMENTDOCKEYWORDERROR + return (state <= SCE_COFFEESCRIPT_COMMENTDOC + // including SCE_COFFEESCRIPT_DEFAULT, SCE_COFFEESCRIPT_COMMENT, SCE_COFFEESCRIPT_COMMENTLINE + || state == SCE_COFFEESCRIPT_COMMENTLINEDOC + || state == SCE_COFFEESCRIPT_COMMENTDOCKEYWORD + || state == SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR || state == SCE_COFFEESCRIPT_COMMENTBLOCK || state == SCE_COFFEESCRIPT_VERBOSE_REGEX || state == SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT - || state == SCE_C_WORD - || state == SCE_C_REGEX); + || state == SCE_COFFEESCRIPT_WORD + || state == SCE_COFFEESCRIPT_REGEX); } // Preconditions: sc.currentPos points to a character after '+' or '-'. @@ -115,11 +115,11 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init int chPrevNonWhite = ' '; int visibleChars = 0; bool lastWordWasUUID = false; - int styleBeforeDCKeyword = SCE_C_DEFAULT; + int styleBeforeDCKeyword = SCE_COFFEESCRIPT_DEFAULT; bool continuationLine = false; bool isIncludePreprocessor = false; - if (initStyle == SCE_C_PREPROCESSOR) { + if (initStyle == SCE_COFFEESCRIPT_PREPROCESSOR) { // Set continuationLine if last character of previous line is '\' int lineCurrent = styler.GetLine(startPos); if (lineCurrent > 0) { @@ -137,16 +137,19 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init // look back to set chPrevNonWhite properly for better regex colouring int endPos = startPos + length; - if (startPos > 0) { + if (startPos > 0 && IsSpaceEquiv(initStyle)) { unsigned int back = startPos; styler.Flush(); while (back > 0 && IsSpaceEquiv(styler.StyleAt(--back))) ; - if (styler.StyleAt(back) == SCE_C_OPERATOR) { + if (styler.StyleAt(back) == SCE_COFFEESCRIPT_OPERATOR) { chPrevNonWhite = styler.SafeGetCharAt(back); } if (startPos != back) { initStyle = styler.StyleAt(back); + if (IsSpaceEquiv(initStyle)) { + initStyle = SCE_COFFEESCRIPT_DEFAULT; + } } startPos = back; } @@ -177,95 +180,95 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init // Determine if the current state should terminate. switch (sc.state) { - case SCE_C_OPERATOR: - sc.SetState(SCE_C_DEFAULT); + case SCE_COFFEESCRIPT_OPERATOR: + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); break; - case SCE_C_NUMBER: + case SCE_COFFEESCRIPT_NUMBER: // We accept almost anything because of hex. and number suffixes if (!setWord.Contains(sc.ch)) { - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; - case SCE_C_IDENTIFIER: + case SCE_COFFEESCRIPT_IDENTIFIER: if (!setWord.Contains(sc.ch) || (sc.ch == '.') || (sc.ch == '$')) { char s[1000]; sc.GetCurrent(s, sizeof(s)); if (keywords.InList(s)) { lastWordWasUUID = strcmp(s, "uuid") == 0; - sc.ChangeState(SCE_C_WORD); + sc.ChangeState(SCE_COFFEESCRIPT_WORD); } else if (keywords2.InList(s)) { - sc.ChangeState(SCE_C_WORD2); + sc.ChangeState(SCE_COFFEESCRIPT_WORD2); } else if (keywords4.InList(s)) { - sc.ChangeState(SCE_C_GLOBALCLASS); + sc.ChangeState(SCE_COFFEESCRIPT_GLOBALCLASS); } - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; - case SCE_C_PREPROCESSOR: + case SCE_COFFEESCRIPT_PREPROCESSOR: if (sc.atLineStart && !continuationLine) { - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } else if (stylingWithinPreprocessor) { if (IsASpace(sc.ch)) { - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } } else { if (sc.Match('/', '*') || sc.Match('/', '/')) { - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } } break; - case SCE_C_COMMENT: + case SCE_COFFEESCRIPT_COMMENT: if (sc.Match('*', '/')) { sc.Forward(); - sc.ForwardSetState(SCE_C_DEFAULT); + sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } break; - case SCE_C_COMMENTDOC: + case SCE_COFFEESCRIPT_COMMENTDOC: if (sc.Match('*', '/')) { sc.Forward(); - sc.ForwardSetState(SCE_C_DEFAULT); + sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) { - styleBeforeDCKeyword = SCE_C_COMMENTDOC; - sc.SetState(SCE_C_COMMENTDOCKEYWORD); + styleBeforeDCKeyword = SCE_COFFEESCRIPT_COMMENTDOC; + sc.SetState(SCE_COFFEESCRIPT_COMMENTDOCKEYWORD); } } break; - case SCE_C_COMMENTLINE: + case SCE_COFFEESCRIPT_COMMENTLINE: if (sc.atLineStart) { - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; - case SCE_C_COMMENTLINEDOC: + case SCE_COFFEESCRIPT_COMMENTLINEDOC: if (sc.atLineStart) { - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support // Verify that we have the conditions to mark a comment-doc-keyword if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) { - styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC; - sc.SetState(SCE_C_COMMENTDOCKEYWORD); + styleBeforeDCKeyword = SCE_COFFEESCRIPT_COMMENTLINEDOC; + sc.SetState(SCE_COFFEESCRIPT_COMMENTDOCKEYWORD); } } break; - case SCE_C_COMMENTDOCKEYWORD: - if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) { - sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); + case SCE_COFFEESCRIPT_COMMENTDOCKEYWORD: + if ((styleBeforeDCKeyword == SCE_COFFEESCRIPT_COMMENTDOC) && sc.Match('*', '/')) { + sc.ChangeState(SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR); sc.Forward(); - sc.ForwardSetState(SCE_C_DEFAULT); + sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } else if (!setDoxygen.Contains(sc.ch)) { char s[100]; sc.GetCurrent(s, sizeof(s)); if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) { - sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR); + sc.ChangeState(SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR); } sc.SetState(styleBeforeDCKeyword); } break; - case SCE_C_STRING: + case SCE_COFFEESCRIPT_STRING: if (isIncludePreprocessor) { if (sc.ch == '>') { - sc.ForwardSetState(SCE_C_DEFAULT); + sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); isIncludePreprocessor = false; } } else if (sc.ch == '\\') { @@ -273,26 +276,26 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init sc.Forward(); } } else if (sc.ch == '\"') { - sc.ForwardSetState(SCE_C_DEFAULT); + sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } break; - case SCE_C_CHARACTER: + case SCE_COFFEESCRIPT_CHARACTER: if (sc.ch == '\\') { if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') { sc.Forward(); } } else if (sc.ch == '\'') { - sc.ForwardSetState(SCE_C_DEFAULT); + sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } break; - case SCE_C_REGEX: + case SCE_COFFEESCRIPT_REGEX: if (sc.atLineStart) { - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.ch == '/') { sc.Forward(); while ((sc.ch < 0x80) && islower(sc.ch)) sc.Forward(); // gobble regex flags - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.ch == '\\') { // Gobble up the quoted character if (sc.chNext == '\\' || sc.chNext == '/') { @@ -300,31 +303,30 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init } } break; - case SCE_C_STRINGEOL: + case SCE_COFFEESCRIPT_STRINGEOL: if (sc.atLineStart) { - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; - case SCE_C_VERBATIM: + case SCE_COFFEESCRIPT_VERBATIM: if (sc.ch == '\"') { if (sc.chNext == '\"') { sc.Forward(); } else { - sc.ForwardSetState(SCE_C_DEFAULT); + sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } } break; - case SCE_C_UUID: + case SCE_COFFEESCRIPT_UUID: if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') { - sc.SetState(SCE_C_DEFAULT); + sc.SetState(SCE_COFFEESCRIPT_DEFAULT); } break; case SCE_COFFEESCRIPT_COMMENTBLOCK: if (sc.Match("###")) { - sc.ChangeState(SCE_C_COMMENT); sc.Forward(); sc.Forward(); - sc.ForwardSetState(SCE_C_DEFAULT); + sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.ch == '\\') { sc.Forward(); } @@ -333,10 +335,8 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init if (sc.Match("///")) { sc.Forward(); sc.Forward(); - sc.ChangeState(SCE_C_REGEX); - sc.ForwardSetState(SCE_C_DEFAULT); + sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT); } else if (sc.Match('#')) { - sc.ChangeState(SCE_C_REGEX); sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT); } else if (sc.ch == '\\') { sc.Forward(); @@ -344,61 +344,65 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init break; case SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT: if (sc.atLineStart) { - sc.ChangeState(SCE_C_COMMENT); sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX); } break; } // Determine if a new state should be entered. - if (sc.state == SCE_C_DEFAULT) { + if (sc.state == SCE_COFFEESCRIPT_DEFAULT) { if (sc.Match('@', '\"')) { - sc.SetState(SCE_C_VERBATIM); + sc.SetState(SCE_COFFEESCRIPT_VERBATIM); sc.Forward(); } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) { if (lastWordWasUUID) { - sc.SetState(SCE_C_UUID); + sc.SetState(SCE_COFFEESCRIPT_UUID); lastWordWasUUID = false; } else { - sc.SetState(SCE_C_NUMBER); + sc.SetState(SCE_COFFEESCRIPT_NUMBER); } } else if (setWordStart.Contains(sc.ch) || (sc.ch == '@') || (sc.ch == '$')) { if (lastWordWasUUID) { - sc.SetState(SCE_C_UUID); + sc.SetState(SCE_COFFEESCRIPT_UUID); lastWordWasUUID = false; } else { - sc.SetState(SCE_C_IDENTIFIER); + sc.SetState(SCE_COFFEESCRIPT_IDENTIFIER); } } else if (sc.Match('/', '*')) { if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style - sc.SetState(SCE_C_COMMENTDOC); + sc.SetState(SCE_COFFEESCRIPT_COMMENTDOC); } else { - sc.SetState(SCE_C_COMMENT); + sc.SetState(SCE_COFFEESCRIPT_COMMENT); } sc.Forward(); // Eat the * so it isn't used for the end of the comment } else if (sc.Match("///")) { sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX); + sc.Forward(); + sc.Forward(); } else if (sc.ch == '/' && (setOKBeforeRE.Contains(chPrevNonWhite) || followsReturnKeyword(sc, styler)) && (!setCouldBePostOp.Contains(chPrevNonWhite) || !FollowsPostfixOperator(sc, styler))) { - sc.SetState(SCE_C_REGEX); // JavaScript's RegEx + sc.SetState(SCE_COFFEESCRIPT_REGEX); // JavaScript's RegEx } else if (sc.ch == '\"') { - sc.SetState(SCE_C_STRING); + sc.SetState(SCE_COFFEESCRIPT_STRING); isIncludePreprocessor = false; // ensure that '>' won't end the string } else if (isIncludePreprocessor && sc.ch == '<') { - sc.SetState(SCE_C_STRING); + sc.SetState(SCE_COFFEESCRIPT_STRING); } else if (sc.ch == '\'') { - sc.SetState(SCE_C_CHARACTER); + sc.SetState(SCE_COFFEESCRIPT_CHARACTER); } else if (sc.ch == '#') { - if (sc.Match("###")) { - sc.SetState(SCE_COFFEESCRIPT_COMMENTBLOCK); - } else { - sc.SetState(SCE_C_COMMENTLINE); - } + if (sc.Match("###")) { + sc.SetState(SCE_COFFEESCRIPT_COMMENTBLOCK); + sc.Forward(); + sc.Forward(); + + } else { + sc.SetState(SCE_COFFEESCRIPT_COMMENTLINE); + } } else if (isoperator(static_cast(sc.ch))) { - sc.SetState(SCE_C_OPERATOR); + sc.SetState(SCE_COFFEESCRIPT_OPERATOR); } } @@ -408,18 +412,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init } continuationLine = false; } - // Change temporary coffeescript states into standard C ones. - switch (sc.state) { - case SCE_COFFEESCRIPT_COMMENTBLOCK: - sc.ChangeState(SCE_C_COMMENT); - break; - case SCE_COFFEESCRIPT_VERBOSE_REGEX: - sc.ChangeState(SCE_C_REGEX); - break; - case SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT: - sc.ChangeState(SCE_C_COMMENTLINE); - break; - } sc.Complete(); } diff --git a/src/stc/scintilla/lexers/LexConf.cxx b/src/stc/scintilla/lexers/LexConf.cxx index 23ed5a6c83..6a1c8c018b 100644 --- a/src/stc/scintilla/lexers/LexConf.cxx +++ b/src/stc/scintilla/lexers/LexConf.cxx @@ -37,7 +37,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k char chNext = styler[startPos]; int lengthDoc = startPos + length; // create a buffer large enough to take the largest chunk... - char *buffer = new char[length]; + char *buffer = new char[length+1]; int bufferCount = 0; // this assumes that we have 2 keyword list in conf.properties @@ -74,17 +74,17 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k } else if( ch == '"') { state = SCE_CONF_STRING; styler.ColourTo(i,SCE_CONF_STRING); - } else if( isascii(ch) && ispunct(ch) ) { + } else if( IsASCII(ch) && ispunct(ch) ) { // signals an operator... // no state jump necessary for this // simple case... styler.ColourTo(i,SCE_CONF_OPERATOR); - } else if( isascii(ch) && isalpha(ch) ) { + } else if( IsASCII(ch) && isalpha(ch) ) { // signals the start of an identifier bufferCount = 0; buffer[bufferCount++] = static_cast(tolower(ch)); state = SCE_CONF_IDENTIFIER; - } else if( isascii(ch) && isdigit(ch) ) { + } else if( IsASCII(ch) && isdigit(ch) ) { // signals the start of a number bufferCount = 0; buffer[bufferCount++] = ch; @@ -111,7 +111,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k // if we find a non-alphanumeric char, // we simply go to default state // else we're still dealing with an extension... - if( (isascii(ch) && isalnum(ch)) || (ch == '_') || + if( (IsASCII(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '$') || (ch == '/') || (ch == '.') || (ch == '*') ) { @@ -133,7 +133,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k case SCE_CONF_IDENTIFIER: // stay in CONF_IDENTIFIER state until we find a non-alphanumeric - if( (isascii(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) { + if( (IsASCII(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) { buffer[bufferCount++] = static_cast(tolower(ch)); } else { state = SCE_CONF_DEFAULT; @@ -158,7 +158,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k case SCE_CONF_NUMBER: // stay in CONF_NUMBER state until we find a non-numeric - if( (isascii(ch) && isdigit(ch)) || ch == '.') { + if( (IsASCII(ch) && isdigit(ch)) || ch == '.') { buffer[bufferCount++] = ch; } else { state = SCE_CONF_DEFAULT; diff --git a/src/stc/scintilla/lexers/LexCrontab.cxx b/src/stc/scintilla/lexers/LexCrontab.cxx index 08abc71917..ad6668fa7b 100644 --- a/src/stc/scintilla/lexers/LexCrontab.cxx +++ b/src/stc/scintilla/lexers/LexCrontab.cxx @@ -36,7 +36,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi char chNext = styler[startPos]; int lengthDoc = startPos + length; // create a buffer large enough to take the largest chunk... - char *buffer = new char[length]; + char *buffer = new char[length+1]; int bufferCount = 0; // used when highliting environment variables inside quoted string: bool insideString = false; @@ -98,12 +98,12 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi // signals an asterisk // no state jump necessary for this simple case... styler.ColourTo(i,SCE_NNCRONTAB_ASTERISK); - } else if( (isascii(ch) && isalpha(ch)) || ch == '<' ) { + } else if( (IsASCII(ch) && isalpha(ch)) || ch == '<' ) { // signals the start of an identifier bufferCount = 0; buffer[bufferCount++] = ch; state = SCE_NNCRONTAB_IDENTIFIER; - } else if( isascii(ch) && isdigit(ch) ) { + } else if( IsASCII(ch) && isdigit(ch) ) { // signals the start of a number bufferCount = 0; buffer[bufferCount++] = ch; @@ -171,7 +171,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi case SCE_NNCRONTAB_IDENTIFIER: // stay in CONF_IDENTIFIER state until we find a non-alphanumeric - if( (isascii(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || + if( (IsASCII(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') || (ch == '@') ) { buffer[bufferCount++] = ch; @@ -200,7 +200,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi case SCE_NNCRONTAB_NUMBER: // stay in CONF_NUMBER state until we find a non-numeric - if( isascii(ch) && isdigit(ch) /* || ch == '.' */ ) { + if( IsASCII(ch) && isdigit(ch) /* || ch == '.' */ ) { buffer[bufferCount++] = ch; } else { state = SCE_NNCRONTAB_DEFAULT; diff --git a/src/stc/scintilla/lexers/LexCsound.cxx b/src/stc/scintilla/lexers/LexCsound.cxx index 8e5880c90f..da5bfeb8c6 100644 --- a/src/stc/scintilla/lexers/LexCsound.cxx +++ b/src/stc/scintilla/lexers/LexCsound.cxx @@ -39,7 +39,7 @@ static inline bool IsAWordStart(const int ch) { } static inline bool IsCsoundOperator(char ch) { - if (isascii(ch) && isalnum(ch)) + if (IsASCII(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '*' || ch == '/' || ch == '-' || ch == '+' || diff --git a/src/stc/scintilla/lexers/LexD.cxx b/src/stc/scintilla/lexers/LexD.cxx index 32e3c86efb..045c4cb73e 100644 --- a/src/stc/scintilla/lexers/LexD.cxx +++ b/src/stc/scintilla/lexers/LexD.cxx @@ -41,15 +41,15 @@ using namespace Scintilla; // Underscore, letter, digit and universal alphas from C99 Appendix D. static bool IsWordStart(int ch) { - return (isascii(ch) && (isalpha(ch) || ch == '_')) || !isascii(ch); + return (IsASCII(ch) && (isalpha(ch) || ch == '_')) || !IsASCII(ch); } static bool IsWord(int ch) { - return (isascii(ch) && (isalnum(ch) || ch == '_')) || !isascii(ch); + return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch); } static bool IsDoxygen(int ch) { - if (isascii(ch) && islower(ch)) + if (IsASCII(ch) && islower(ch)) return true; if (ch == '$' || ch == '@' || ch == '\\' || ch == '&' || ch == '#' || ch == '<' || ch == '>' || @@ -267,7 +267,7 @@ void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, ID break; case SCE_D_NUMBER: // We accept almost anything because of hex. and number suffixes - if (isascii(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) { + if (IsASCII(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) { continue; } else if (sc.ch == '.' && sc.chNext != '.' && !numFloat) { // Don't parse 0..2 as number. diff --git a/src/stc/scintilla/lexers/LexDMAP.cxx b/src/stc/scintilla/lexers/LexDMAP.cxx new file mode 100644 index 0000000000..431000a4e3 --- /dev/null +++ b/src/stc/scintilla/lexers/LexDMAP.cxx @@ -0,0 +1,228 @@ +// Scintilla source code edit control +/** @file LexDMAP.cxx + ** Lexer for MSC Nastran DMAP. + ** Written by Mark Robinson, based on the Fortran lexer by Chuan-jian Shen, Last changed Aug. 2013 + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. +/***************************************/ +#include +#include +#include +#include +#include +#include +/***************************************/ +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +/***************************************/ + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +/***********************************************/ +static inline bool IsAWordChar(const int ch) { + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%'); +} +/**********************************************/ +static inline bool IsAWordStart(const int ch) { + return (ch < 0x80) && (isalnum(ch)); +} +/***************************************/ +static void ColouriseDMAPDoc(unsigned int startPos, int length, int initStyle, + WordList *keywordlists[], Accessor &styler) { + WordList &keywords = *keywordlists[0]; + WordList &keywords2 = *keywordlists[1]; + WordList &keywords3 = *keywordlists[2]; + /***************************************/ + int posLineStart = 0, numNonBlank = 0; + int endPos = startPos + length; + /***************************************/ + // backtrack to the nearest keyword + while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_DMAP_WORD)) { + startPos--; + } + startPos = styler.LineStart(styler.GetLine(startPos)); + initStyle = styler.StyleAt(startPos - 1); + StyleContext sc(startPos, endPos-startPos, initStyle, styler); + /***************************************/ + for (; sc.More(); sc.Forward()) { + // remember the start position of the line + if (sc.atLineStart) { + posLineStart = sc.currentPos; + numNonBlank = 0; + sc.SetState(SCE_DMAP_DEFAULT); + } + if (!IsASpaceOrTab(sc.ch)) numNonBlank ++; + /***********************************************/ + // Handle data appearing after column 72; it is ignored + int toLineStart = sc.currentPos - posLineStart; + if (toLineStart >= 72 || sc.ch == '$') { + sc.SetState(SCE_DMAP_COMMENT); + while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end + continue; + } + /***************************************/ + // Determine if the current state should terminate. + if (sc.state == SCE_DMAP_OPERATOR) { + sc.SetState(SCE_DMAP_DEFAULT); + } else if (sc.state == SCE_DMAP_NUMBER) { + if (!(IsAWordChar(sc.ch) || sc.ch=='\'' || sc.ch=='\"' || sc.ch=='.')) { + sc.SetState(SCE_DMAP_DEFAULT); + } + } else if (sc.state == SCE_DMAP_IDENTIFIER) { + if (!IsAWordChar(sc.ch) || (sc.ch == '%')) { + char s[100]; + sc.GetCurrentLowered(s, sizeof(s)); + if (keywords.InList(s)) { + sc.ChangeState(SCE_DMAP_WORD); + } else if (keywords2.InList(s)) { + sc.ChangeState(SCE_DMAP_WORD2); + } else if (keywords3.InList(s)) { + sc.ChangeState(SCE_DMAP_WORD3); + } + sc.SetState(SCE_DMAP_DEFAULT); + } + } else if (sc.state == SCE_DMAP_COMMENT) { + if (sc.ch == '\r' || sc.ch == '\n') { + sc.SetState(SCE_DMAP_DEFAULT); + } + } else if (sc.state == SCE_DMAP_STRING1) { + if (sc.ch == '\'') { + if (sc.chNext == '\'') { + sc.Forward(); + } else { + sc.ForwardSetState(SCE_DMAP_DEFAULT); + } + } else if (sc.atLineEnd) { + sc.ChangeState(SCE_DMAP_STRINGEOL); + sc.ForwardSetState(SCE_DMAP_DEFAULT); + } + } else if (sc.state == SCE_DMAP_STRING2) { + if (sc.atLineEnd) { + sc.ChangeState(SCE_DMAP_STRINGEOL); + sc.ForwardSetState(SCE_DMAP_DEFAULT); + } else if (sc.ch == '\"') { + if (sc.chNext == '\"') { + sc.Forward(); + } else { + sc.ForwardSetState(SCE_DMAP_DEFAULT); + } + } + } + /***************************************/ + // Determine if a new state should be entered. + if (sc.state == SCE_DMAP_DEFAULT) { + if (sc.ch == '$') { + sc.SetState(SCE_DMAP_COMMENT); + } else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) || (sc.ch == '-' && IsADigit(sc.chNext))) { + sc.SetState(SCE_F_NUMBER); + } else if (IsAWordStart(sc.ch)) { + sc.SetState(SCE_DMAP_IDENTIFIER); + } else if (sc.ch == '\"') { + sc.SetState(SCE_DMAP_STRING2); + } else if (sc.ch == '\'') { + sc.SetState(SCE_DMAP_STRING1); + } else if (isoperator(static_cast(sc.ch))) { + sc.SetState(SCE_DMAP_OPERATOR); + } + } + } + sc.Complete(); +} +/***************************************/ +// To determine the folding level depending on keywords +static int classifyFoldPointDMAP(const char* s, const char* prevWord) { + int lev = 0; + if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "enddo") == 0 || strcmp(s, "endif") == 0) { + lev = -1; + } else if ((strcmp(prevWord, "do") == 0 && strcmp(s, "while") == 0) || strcmp(s, "then") == 0) { + lev = 1; + } + return lev; +} +// Folding the code +static void FoldDMAPDoc(unsigned int startPos, int length, int initStyle, + WordList *[], Accessor &styler) { + // + // bool foldComment = styler.GetPropertyInt("fold.comment") != 0; + // Do not know how to fold the comment at the moment. + // + bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; + unsigned int endPos = startPos + length; + int visibleChars = 0; + int lineCurrent = styler.GetLine(startPos); + int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + int levelCurrent = levelPrev; + char chNext = styler[startPos]; + int styleNext = styler.StyleAt(startPos); + int style = initStyle; + /***************************************/ + int lastStart = 0; + char prevWord[32] = ""; + /***************************************/ + 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_DMAP_DEFAULT || stylePrev == SCE_DMAP_OPERATOR || stylePrev == SCE_DMAP_COMMENT) && (style == SCE_DMAP_WORD)) { + // Store last word and label start point. + lastStart = i; + } + /***************************************/ + if (style == SCE_DMAP_WORD) { + if(iswordchar(ch) && !iswordchar(chNext)) { + char s[32]; + unsigned int k; + for(k=0; (k<31 ) && (k(tolower(styler[lastStart+k])); + } + s[k] = '\0'; + levelCurrent += classifyFoldPointDMAP(s, prevWord); + strcpy(prevWord, s); + } + } + if (atEOL) { + int lev = levelPrev; + if (visibleChars == 0 && foldCompact) + lev |= SC_FOLDLEVELWHITEFLAG; + if ((levelCurrent > levelPrev) && (visibleChars > 0)) + lev |= SC_FOLDLEVELHEADERFLAG; + if (lev != styler.LevelAt(lineCurrent)) { + styler.SetLevel(lineCurrent, lev); + } + lineCurrent++; + levelPrev = levelCurrent; + visibleChars = 0; + strcpy(prevWord, ""); + } + /***************************************/ + if (!isspacechar(ch)) visibleChars++; + } + /***************************************/ + // Fill in the real level of the next line, keeping the current flags as they will be filled in later + int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; + styler.SetLevel(lineCurrent, levelPrev | flagsNext); +} +/***************************************/ +static const char * const DMAPWordLists[] = { + "Primary keywords and identifiers", + "Intrinsic functions", + "Extended and user defined functions", + 0, +}; +/***************************************/ +LexerModule lmDMAP(SCLEX_DMAP, ColouriseDMAPDoc, "DMAP", FoldDMAPDoc, DMAPWordLists); diff --git a/src/stc/scintilla/lexers/LexECL.cxx b/src/stc/scintilla/lexers/LexECL.cxx index cf15a62a55..6a08d58c25 100644 --- a/src/stc/scintilla/lexers/LexECL.cxx +++ b/src/stc/scintilla/lexers/LexECL.cxx @@ -47,10 +47,19 @@ using namespace Scintilla; #endif static bool IsSpaceEquiv(int state) { - return (state <= SCE_ECL_COMMENTDOC) || - // including SCE_ECL_DEFAULT, SCE_ECL_COMMENT, SCE_ECL_COMMENTLINE - (state == SCE_ECL_COMMENTLINEDOC) || (state == SCE_ECL_COMMENTDOCKEYWORD) || - (state == SCE_ECL_COMMENTDOCKEYWORDERROR); + switch (state) { + case SCE_ECL_DEFAULT: + case SCE_ECL_COMMENT: + case SCE_ECL_COMMENTLINE: + case SCE_ECL_COMMENTLINEDOC: + case SCE_ECL_COMMENTDOCKEYWORD: + case SCE_ECL_COMMENTDOCKEYWORDERROR: + case SCE_ECL_COMMENTDOC: + return true; + + default: + return false; + } } static void ColouriseEclDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], diff --git a/src/stc/scintilla/lexers/LexForth.cxx b/src/stc/scintilla/lexers/LexForth.cxx index 0e9875cebb..7b41aaf8e7 100644 --- a/src/stc/scintilla/lexers/LexForth.cxx +++ b/src/stc/scintilla/lexers/LexForth.cxx @@ -27,15 +27,6 @@ using namespace Scintilla; #endif -static inline bool IsAWordChar(int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || - ch == '_' || ch == '?' || ch == '"' || ch == '@' || - ch == '!' || ch == '[' || ch == ']' || ch == '/' || - ch == '+' || ch == '-' || ch == '*' || ch == '<' || - ch == '>' || ch == '=' || ch == ';' || ch == '(' || - ch == ')' ); -} - static inline bool IsAWordStart(int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); } @@ -123,29 +114,29 @@ static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle, (sc.atLineStart || IsASpaceChar(sc.chPrev)) && (sc.atLineEnd || IsASpaceChar(sc.chNext))) { sc.SetState(SCE_FORTH_COMMENT_ML); - } else if ( (sc.ch == '$' && (isascii(sc.chNext) && isxdigit(sc.chNext))) ) { + } else if ( (sc.ch == '$' && (IsASCII(sc.chNext) && isxdigit(sc.chNext))) ) { // number starting with $ is a hex number sc.SetState(SCE_FORTH_NUMBER); - while(sc.More() && isascii(sc.chNext) && isxdigit(sc.chNext)) + while(sc.More() && IsASCII(sc.chNext) && isxdigit(sc.chNext)) sc.Forward(); - } else if ( (sc.ch == '%' && (isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))) ) { + } else if ( (sc.ch == '%' && (IsASCII(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))) ) { // number starting with % is binary sc.SetState(SCE_FORTH_NUMBER); - while(sc.More() && isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1')) + while(sc.More() && IsASCII(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1')) sc.Forward(); - } else if ( isascii(sc.ch) && - (isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && isascii(sc.chNext) && isxdigit(sc.chNext)) ) + } else if ( IsASCII(sc.ch) && + (isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && IsASCII(sc.chNext) && isxdigit(sc.chNext)) ) ){ sc.SetState(SCE_FORTH_NUMBER); } else if (IsAWordStart(sc.ch)) { sc.SetState(SCE_FORTH_IDENTIFIER); } else if (sc.ch == '{') { sc.SetState(SCE_FORTH_LOCALE); - } else if (sc.ch == ':' && isascii(sc.chNext) && isspace(sc.chNext)) { + } else if (sc.ch == ':' && IsASCII(sc.chNext) && isspace(sc.chNext)) { // highlight word definitions e.g. : GCD ( n n -- n ) ..... ; // ^ ^^^ sc.SetState(SCE_FORTH_DEFWORD); - while(sc.More() && isascii(sc.chNext) && isspace(sc.chNext)) + while(sc.More() && IsASCII(sc.chNext) && isspace(sc.chNext)) sc.Forward(); } else if (sc.ch == ';' && (sc.atLineStart || IsASpaceChar(sc.chPrev)) && diff --git a/src/stc/scintilla/lexers/LexFortran.cxx b/src/stc/scintilla/lexers/LexFortran.cxx index bfbe301a20..3410acb406 100644 --- a/src/stc/scintilla/lexers/LexFortran.cxx +++ b/src/stc/scintilla/lexers/LexFortran.cxx @@ -38,15 +38,15 @@ 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 inline bool IsABlank(unsigned int ch) { + return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ; } /***************************************/ -inline bool IsALineEnd(char ch) { - return ((ch == '\n') || (ch == '\r')) ; +static inline bool IsALineEnd(char ch) { + return ((ch == '\n') || (ch == '\r')) ; } /***************************************/ -unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) { +static 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; @@ -60,7 +60,7 @@ unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) { } /***************************************/ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler, bool isFixFormat) { + WordList *keywordlists[], Accessor &styler, bool isFixFormat) { WordList &keywords = *keywordlists[0]; WordList &keywords2 = *keywordlists[1]; WordList &keywords3 = *keywordlists[2]; @@ -89,11 +89,11 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle int toLineStart = sc.currentPos - posLineStart; if (isFixFormat && (toLineStart < 6 || toLineStart >= 72)) { if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') { - if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") || - sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") || - sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") || - sc.chNext == '$') { - sc.SetState(SCE_F_PREPROCESSOR); + if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") || + sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") || + sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") || + sc.chNext == '$') { + sc.SetState(SCE_F_PREPROCESSOR); } else { sc.SetState(SCE_F_COMMENT); } @@ -111,8 +111,8 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle //if (!IsASpace(sc.ch) && sc.ch != '0') { if (sc.ch != '\r' && sc.ch != '\n') { sc.SetState(SCE_F_CONTINUATION); - if (!IsASpace(sc.ch) && sc.ch != '0') - sc.ForwardSetState(prevState); + if (!IsASpace(sc.ch) && sc.ch != '0') + sc.ForwardSetState(prevState); } else sc.SetState(SCE_F_DEFAULT); } @@ -122,9 +122,9 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle // Hanndle preprocessor directives if (sc.ch == '#' && numNonBlank == 1) { - sc.SetState(SCE_F_PREPROCESSOR); - while (!sc.atLineEnd && sc.More()) - sc.Forward(); // Until line end + sc.SetState(SCE_F_PREPROCESSOR); + while (!sc.atLineEnd && sc.More()) + sc.Forward(); // Until line end } /***************************************/ // Handle line continuation generically. @@ -221,8 +221,8 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle // Determine if a new state should be entered. if (sc.state == SCE_F_DEFAULT) { if (sc.ch == '!') { - if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") || - sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') { + if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") || + sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') { sc.SetState(SCE_F_PREPROCESSOR); } else { sc.SetState(SCE_F_COMMENT); @@ -232,7 +232,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle } 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 == '\'')) { + tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) { sc.SetState(SCE_F_NUMBER); sc.Forward(); } else if (sc.ch == '.' && isalpha(sc.chNext)) { @@ -254,41 +254,48 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle // 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, "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, "function") == 0 || strcmp(s, "interface") == 0 - || strcmp(s, "module") == 0 || strcmp(s, "program") == 0 - || strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0 - || (strcmp(s, "type") == 0 && chNextNonBlank != '(') - || strcmp(s, "critical") == 0){ - if (strcmp(prevWord, "end") == 0) - lev = 0; - else - lev = 1; - } else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=') - || strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0 - || strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0 - || strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0 - || strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0 - || strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0 - || strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0 - || strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0 - || strcmp(s, "endwhere") == 0 || strcmp(s, "endcritical") == 0 - || (strcmp(s, "procedure") == 0 && strcmp(prevWord, "module") == 0) ) { // Take care of the "module procedure" statement - lev = -1; - } else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if + + if ((strcmp(prevWord, "module") == 0 && strcmp(s, "subroutine") == 0) + || (strcmp(prevWord, "module") == 0 && strcmp(s, "function") == 0)) { + lev = 0; + } else if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0 + || strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0 + || strcmp(s, "do") == 0 || strcmp(s, "enum") ==0 + || strcmp(s, "function") == 0 || strcmp(s, "interface") == 0 + || strcmp(s, "module") == 0 || strcmp(s, "program") == 0 + || strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0 + || (strcmp(s, "type") == 0 && chNextNonBlank != '(') + || strcmp(s, "critical") == 0 || strcmp(s, "submodule") == 0){ + if (strcmp(prevWord, "end") == 0) lev = 0; + else + lev = 1; + } else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=') + || strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0 + || strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0 + || strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0 + || strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0 + || strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0 + || strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0 + || strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0 + || strcmp(s, "endwhere") == 0 || strcmp(s, "endcritical") == 0 + || (strcmp(prevWord, "module") == 0 && strcmp(s, "procedure") == 0) // Take care of the "module procedure" statement + || strcmp(s, "endsubmodule") == 0) { + lev = -1; + } else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if + lev = 0; } else if (strcmp(prevWord, "type") == 0 && strcmp(s, "is") == 0){ // type is - lev = -1; - } + lev = -1; + } else if ((strcmp(prevWord, "end") == 0 && strcmp(s, "procedure") == 0) + || strcmp(s, "endprocedure") == 0) { + lev = 1; // level back to 0, because no folding support for "module procedure" in submodule + } return lev; } +/***************************************/ // Folding the code static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, - Accessor &styler, bool isFixFormat) { + Accessor &styler, bool isFixFormat) { // // bool foldComment = styler.GetPropertyInt("fold.comment") != 0; // Do not know how to fold the comment at the moment. @@ -297,12 +304,22 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, unsigned int endPos = startPos + length; int visibleChars = 0; int lineCurrent = styler.GetLine(startPos); - int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; - int levelCurrent = levelPrev; + int levelCurrent; + bool isPrevLine; + if (lineCurrent > 0) { + lineCurrent--; + startPos = styler.LineStart(lineCurrent); + levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + isPrevLine = true; + } else { + levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; + isPrevLine = false; + } char chNext = styler[startPos]; char chNextNonBlank; int styleNext = styler.StyleAt(startPos); int style = initStyle; + int levelDeltaNext = 0; /***************************************/ int lastStart = 0; char prevWord[32] = ""; @@ -315,17 +332,28 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle, char ch = chNext; chNext = styler.SafeGetCharAt(i + 1); chNextNonBlank = chNext; + bool nextEOL = false; + if (IsALineEnd(chNextNonBlank)) { + nextEOL = true; + } unsigned int j=i+1; while(IsABlank(chNextNonBlank) && j levelPrev) && (visibleChars > 0)) + if ((levelDeltaNext > 0) && (visibleChars > 0)) lev |= SC_FOLDLEVELHEADERFLAG; - if (lev != styler.LevelAt(lineCurrent)) { + if (lev != styler.LevelAt(lineCurrent)) styler.SetLevel(lineCurrent, lev); - } + lineCurrent++; - levelPrev = levelCurrent; + levelCurrent += levelDeltaNext; + levelDeltaNext = 0; visibleChars = 0; strcpy(prevWord, ""); + isPrevLine = false; } /***************************************/ if (!isspacechar(ch)) visibleChars++; } /***************************************/ - // Fill in the real level of the next line, keeping the current flags as they will be filled in later - int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK; - styler.SetLevel(lineCurrent, levelPrev | flagsNext); } /***************************************/ static const char * const FortranWordLists[] = { @@ -461,22 +516,22 @@ static const char * const FortranWordLists[] = { }; /***************************************/ static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { + Accessor &styler) { ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false); } /***************************************/ static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], - Accessor &styler) { + Accessor &styler) { ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true); } /***************************************/ static void FoldFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, - WordList *[], Accessor &styler) { + WordList *[], Accessor &styler) { FoldFortranDoc(startPos, length, initStyle,styler, false); } /***************************************/ static void FoldFortranDocFixFormat(unsigned int startPos, int length, int initStyle, - WordList *[], Accessor &styler) { + WordList *[], Accessor &styler) { FoldFortranDoc(startPos, length, initStyle,styler, true); } /***************************************/ diff --git a/src/stc/scintilla/lexers/LexGAP.cxx b/src/stc/scintilla/lexers/LexGAP.cxx index fb30660986..bc0bc2144b 100644 --- a/src/stc/scintilla/lexers/LexGAP.cxx +++ b/src/stc/scintilla/lexers/LexGAP.cxx @@ -29,7 +29,7 @@ using namespace Scintilla; #endif static inline bool IsGAPOperator(char ch) { - if (isascii(ch) && isalnum(ch)) return false; + if (IsASCII(ch) && isalnum(ch)) return false; if (ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '^' || ch == ',' || ch == '!' || ch == '.' || ch == '=' || ch == '<' || ch == '>' || ch == '(' || diff --git a/src/stc/scintilla/lexers/LexGui4Cli.cxx b/src/stc/scintilla/lexers/LexGui4Cli.cxx index 13cf9ea86f..0b33d2d7c8 100644 --- a/src/stc/scintilla/lexers/LexGui4Cli.cxx +++ b/src/stc/scintilla/lexers/LexGui4Cli.cxx @@ -6,8 +6,8 @@ This is the Lexer for Gui4Cli, included in SciLexer.dll To add to SciLexer.dll: 1. Add the values below to INCLUDE\Scintilla.iface -2. Run the include/HFacer.py script -3. Run the src/lexGen.py script +2. Run the scripts/HFacer.py script +3. Run the scripts/LexGen.py script val SCE_GC_DEFAULT=0 val SCE_GC_COMMENTLINE=1 @@ -49,10 +49,6 @@ static inline bool IsAWordChar(const int ch) { return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch =='\\'); } -static inline bool IsAWordStart(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'); -} - inline bool isGCOperator(int ch) { if (isalnum(ch)) return false; diff --git a/src/stc/scintilla/lexers/LexHTML.cxx b/src/stc/scintilla/lexers/LexHTML.cxx index fe5e8c8577..5ea24d481d 100644 --- a/src/stc/scintilla/lexers/LexHTML.cxx +++ b/src/stc/scintilla/lexers/LexHTML.cxx @@ -16,6 +16,7 @@ #include "Scintilla.h" #include "SciLexer.h" +#include "StringCopy.h" #include "WordList.h" #include "LexAccessor.h" #include "Accessor.h" @@ -43,7 +44,7 @@ static inline bool IsAWordStart(const int ch) { } inline bool IsOperator(int ch) { - if (isascii(ch) && isalnum(ch)) + if (IsASCII(ch) && isalnum(ch)) return false; // '.' left out as it is used to make up numbers if (ch == '%' || ch == '^' || ch == '&' || ch == '*' || @@ -297,7 +298,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end, if (allowScripts && 0 == strcmp(s, "script")) { // check to see if this is a self-closing tag by sniffing ahead bool isSelfClose = false; - for (unsigned int cPos = end; cPos <= end + 100; cPos++) { + for (unsigned int cPos = end; cPos <= end + 200; cPos++) { char ch = styler.SafeGetCharAt(cPos, '\0'); if (ch == '\0' || ch == '>') break; @@ -339,9 +340,9 @@ static void classifyWordHTJS(unsigned int start, unsigned int end, static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) { char chAttr = SCE_HB_IDENTIFIER; bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.'); - if (wordIsNumber) + if (wordIsNumber) { chAttr = SCE_HB_NUMBER; - else { + } else { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); if (keywords.InList(s)) { @@ -385,9 +386,9 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) { char chAttr = SCE_HPHP_DEFAULT; bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1])); - if (wordIsNumber) + if (wordIsNumber) { chAttr = SCE_HPHP_NUMBER; - else { + } else { char s[100]; GetTextSegment(styler, start, end, s, sizeof(s)); if (keywords.InList(s)) @@ -445,18 +446,13 @@ static int StateForScript(script_type scriptLanguage) { return Result; } -static inline bool ishtmlwordchar(int ch) { - return !isascii(ch) || - (isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#'); -} - static inline bool issgmlwordchar(int ch) { - return !isascii(ch) || + return !IsASCII(ch) || (isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '['); } static inline bool IsPhpWordStart(int ch) { - return (isascii(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f); + return (IsASCII(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f); } static inline bool IsPhpWordChar(int ch) { @@ -484,10 +480,6 @@ static bool isLineEnd(int ch) { return ch == '\r' || ch == '\n'; } -static bool isOKBeforeRE(int ch) { - return (ch == '(') || (ch == '=') || (ch == ','); -} - static bool isMakoBlockEnd(const int ch, const int chNext, const char *blockType) { if (strlen(blockType) == 0) { return ((ch == '%') && (chNext == '>')); @@ -691,6 +683,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", 0x80, true); const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", 0x80, true); const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", 0x80, true); + // TODO: also handle + and - (except if they're part of ++ or --) and return keywords + const CharacterSet setOKBeforeJSRE(CharacterSet::setNone, "([{=,:;!%^&*|?~"); int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK; int levelCurrent = levelPrev; @@ -830,14 +824,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (isMako && ch == '#' && chNext == '#') { makoComment = 1; } - + // handle end of Mako comment line else if (isMako && makoComment && (ch == '\r' || ch == '\n')) { makoComment = 0; styler.ColourTo(i, SCE_HP_COMMENTLINE); state = SCE_HP_DEFAULT; } - + // Allow falling through to mako handling code if newline is going to end a block if (((ch == '\r' && chNext != '\n') || (ch == '\n')) && (!isMako || (0 != strcmp(makoBlockType, "%")))) { @@ -905,7 +899,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty !IsScriptCommentState(state)) { beforeLanguage = scriptLanguage; scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 6, isXml ? eScriptXML : eScriptPHP); - if (scriptLanguage != eScriptPHP && isStringState(state)) continue; + if ((scriptLanguage != eScriptPHP) && (isStringState(state) || (state==SCE_H_COMMENT))) continue; styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; i++; @@ -936,9 +930,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty (ch == '$' && chNext == '{') || (ch == '<' && chNext == '/' && chNext2 == '%'))) { if (ch == '%' || ch == '/') - strcpy(makoBlockType, "%"); + StringCopy(makoBlockType, "%"); else if (ch == '$') - strcpy(makoBlockType, "{"); + StringCopy(makoBlockType, "{"); else if (chNext == '/') GetNextWord(styler, i+3, makoBlockType, sizeof(makoBlockType)); else @@ -1007,9 +1001,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty // handle the start Django template code else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' || chNext == '{'))) { if (chNext == '%') - strcpy(djangoBlockType, "%"); + StringCopy(djangoBlockType, "%"); else - strcpy(djangoBlockType, "{"); + StringCopy(djangoBlockType, "{"); styler.ColourTo(i - 1, StateToPrint); beforePreProc = state; if (inScriptType == eNonHtmlScript) @@ -1240,7 +1234,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty styler.ColourTo(i - 2, StateToPrint); } state = SCE_H_SGML_COMMENT; - } else if (isascii(ch) && isalpha(ch) && (chPrev == '%')) { + } else if (IsASCII(ch) && isalpha(ch) && (chPrev == '%')) { styler.ColourTo(i - 2, StateToPrint); state = SCE_H_SGML_ENTITY; } else if (ch == '#') { @@ -1319,6 +1313,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty styler.ColourTo(i - 2, StateToPrint); state = SCE_H_SGML_COMMENT; } + break; case SCE_H_SGML_DOUBLESTRING: if (ch == '\"') { styler.ColourTo(i, StateToPrint); @@ -1358,7 +1353,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } break; case SCE_H_SGML_SPECIAL: - if (!(isascii(ch) && isupper(ch))) { + if (!(IsASCII(ch) && isupper(ch))) { styler.ColourTo(i - 1, StateToPrint); if (isalnum(ch)) { state = SCE_H_SGML_ERROR; @@ -1371,7 +1366,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty if (ch == ';') { styler.ColourTo(i, StateToPrint); state = SCE_H_SGML_DEFAULT; - } else if (!(isascii(ch) && isalnum(ch)) && ch != '-' && ch != '.') { + } else if (!(IsASCII(ch) && isalnum(ch)) && ch != '-' && ch != '.') { styler.ColourTo(i, SCE_H_SGML_ERROR); state = SCE_H_SGML_DEFAULT; } @@ -1381,9 +1376,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty styler.ColourTo(i, StateToPrint); state = SCE_H_DEFAULT; } - if (ch != '#' && !(isascii(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway... + if (ch != '#' && !(IsASCII(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway... && ch != '.' && ch != '-' && ch != '_' && ch != ':') { // valid in XML - if (!isascii(ch)) // Possibly start of a multibyte character so don't allow this byte to be in entity style + if (!IsASCII(ch)) // Possibly start of a multibyte character so don't allow this byte to be in entity style styler.ColourTo(i-1, SCE_H_TAGUNKNOWN); else styler.ColourTo(i, SCE_H_TAGUNKNOWN); @@ -1592,7 +1587,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } else if (ch == '/' && chNext == '/') { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_COMMENTLINE; - } else if (ch == '/' && isOKBeforeRE(chPrevNonWhite)) { + } else if (ch == '/' && setOKBeforeJSRE.Contains(chPrevNonWhite)) { styler.ColourTo(i - 1, StateToPrint); state = SCE_HJ_REGEX; } else if (ch == '\"') { @@ -1709,7 +1704,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty case SCE_HJ_REGEX: if (ch == '\r' || ch == '\n' || ch == '/') { if (ch == '/') { - while (isascii(chNext) && islower(chNext)) { // gobble regex flags + while (IsASCII(chNext) && islower(chNext)) { // gobble regex flags i++; ch = chNext; chNext = static_cast(styler.SafeGetCharAt(i + 1)); @@ -1923,7 +1918,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty state = SCE_HPHP_COMMENTLINE; } else if (ch == '\"') { state = SCE_HPHP_HSTRING; - strcpy(phpStringDelimiter, "\""); + StringCopy(phpStringDelimiter, "\""); } else if (styler.Match(i, "<<<")) { bool isSimpleString = false; i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString); @@ -1933,7 +1928,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } } else if (ch == '\'') { state = SCE_HPHP_SIMPLESTRING; - strcpy(phpStringDelimiter, "\'"); + StringCopy(phpStringDelimiter, "\'"); } else if (ch == '$' && IsPhpWordStart(chNext)) { state = SCE_HPHP_VARIABLE; } else if (IsOperator(ch)) { @@ -2053,7 +2048,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty state = SCE_HPHP_COMMENTLINE; } else if (ch == '\"') { state = SCE_HPHP_HSTRING; - strcpy(phpStringDelimiter, "\""); + StringCopy(phpStringDelimiter, "\""); } else if (styler.Match(i, "<<<")) { bool isSimpleString = false; i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString); @@ -2063,7 +2058,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty } } else if (ch == '\'') { state = SCE_HPHP_SIMPLESTRING; - strcpy(phpStringDelimiter, "\'"); + StringCopy(phpStringDelimiter, "\'"); } else if (ch == '$' && IsPhpWordStart(chNext)) { state = SCE_HPHP_VARIABLE; } else if (IsOperator(ch)) { diff --git a/src/stc/scintilla/lexers/LexHaskell.cxx b/src/stc/scintilla/lexers/LexHaskell.cxx index 37d85d0cfb..e10cb8c810 100644 --- a/src/stc/scintilla/lexers/LexHaskell.cxx +++ b/src/stc/scintilla/lexers/LexHaskell.cxx @@ -4,19 +4,20 @@ * A haskell lexer for the scintilla code control. * Some stuff "lended" from LexPython.cxx and LexCPP.cxx. * External lexer stuff inspired from the caml external lexer. + * Folder copied from Python's. * * Written by Tobias Engvall - tumm at dtek dot chalmers dot se * * Several bug fixes by Krasimir Angelov - kr.angelov at gmail.com * - * TODO: - * * Implement a folder :) - * * Nice Character-lexing (stuff inside '\''), LexPython has - * this. + * Improved by kudah * + * TODO: + * * A proper lexical folder to fold group declarations, comments, pragmas, + * #ifdefs, explicit layout, lists, tuples, quasi-quotes, splces, etc, etc, + * etc. * *****************************************************************/ - #include #include #include @@ -24,6 +25,9 @@ #include #include +#include +#include + #include "ILexer.h" #include "Scintilla.h" #include "SciLexer.h" @@ -35,334 +39,1073 @@ #include "StyleContext.h" #include "CharacterSet.h" #include "LexerModule.h" +#include "OptionSet.h" +#include "CharacterCategory.h" #ifdef SCI_NAMESPACE using namespace Scintilla; #endif -#ifdef BUILD_AS_EXTERNAL_LEXER +// See https://github.com/ghc/ghc/blob/master/compiler/parser/Lexer.x#L1682 +// Note, letter modifiers are prohibited. -#include "ExternalLexer.h" -#include "WindowAccessor.h" - -#define BUILD_EXTERNAL_LEXER 0 - -#endif - -#define HA_MODE_DEFAULT 0 -#define HA_MODE_IMPORT1 1 -#define HA_MODE_IMPORT2 2 -#define HA_MODE_IMPORT3 3 -#define HA_MODE_MODULE 4 -#define HA_MODE_FFI 5 -#define HA_MODE_TYPE 6 - -static inline bool IsNewline(const int ch) { - return (ch == '\n' || ch == '\r'); +static int u_iswupper (int ch) { + CharacterCategory c = CategoriseCharacter(ch); + return c == ccLu || c == ccLt; } -static inline bool IsWhitespace(const int ch) { - return ( ch == ' ' - || ch == '\t' - || IsNewline(ch) ); +static int u_iswalpha (int ch) { + CharacterCategory c = CategoriseCharacter(ch); + return c == ccLl || c == ccLu || c == ccLt || c == ccLo; } -static inline bool IsAWordStart(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '_'); +static int u_iswalnum (int ch) { + CharacterCategory c = CategoriseCharacter(ch); + return c == ccLl || c == ccLu || c == ccLt || c == ccLo + || c == ccNd || c == ccNo; } -static inline bool IsAWordChar(const int ch) { - return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\''); +static int u_IsHaskellSymbol(int ch) { + CharacterCategory c = CategoriseCharacter(ch); + return c == ccPc || c == ccPd || c == ccPo + || c == ccSm || c == ccSc || c == ccSk || c == ccSo; } -static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle, - WordList *keywordlists[], Accessor &styler) { +static inline bool IsHaskellLetter(const int ch) { + if (IsASCII(ch)) { + return (ch >= 'a' && ch <= 'z') + || (ch >= 'A' && ch <= 'Z'); + } else { + return u_iswalpha(ch) != 0; + } +} - WordList &keywords = *keywordlists[0]; - WordList &ffi = *keywordlists[1]; +static inline bool IsHaskellAlphaNumeric(const int ch) { + if (IsASCII(ch)) { + return IsAlphaNumeric(ch); + } else { + return u_iswalnum(ch) != 0; + } +} + +static inline bool IsHaskellUpperCase(const int ch) { + if (IsASCII(ch)) { + return ch >= 'A' && ch <= 'Z'; + } else { + return u_iswupper(ch) != 0; + } +} + +static inline bool IsAnHaskellOperatorChar(const int ch) { + if (IsASCII(ch)) { + return + ( ch == '!' || ch == '#' || ch == '$' || ch == '%' + || ch == '&' || ch == '*' || ch == '+' || ch == '-' + || ch == '.' || ch == '/' || ch == ':' || ch == '<' + || ch == '=' || ch == '>' || ch == '?' || ch == '@' + || ch == '^' || ch == '|' || ch == '~' || ch == '\\'); + } else { + return u_IsHaskellSymbol(ch) != 0; + } +} + +static inline bool IsAHaskellWordStart(const int ch) { + return IsHaskellLetter(ch) || ch == '_'; +} + +static inline bool IsAHaskellWordChar(const int ch) { + return ( IsHaskellAlphaNumeric(ch) + || ch == '_' + || ch == '\''); +} + +static inline bool IsCommentBlockStyle(int style) { + return (style >= SCE_HA_COMMENTBLOCK && style <= SCE_HA_COMMENTBLOCK3); +} + +static inline bool IsCommentStyle(int style) { + return (style >= SCE_HA_COMMENTLINE && style <= SCE_HA_COMMENTBLOCK3) + || ( style == SCE_HA_LITERATE_COMMENT + || style == SCE_HA_LITERATE_CODEDELIM); +} + +// styles which do not belong to Haskell, but to external tools +static inline bool IsExternalStyle(int style) { + return ( style == SCE_HA_PREPROCESSOR + || style == SCE_HA_LITERATE_COMMENT + || style == SCE_HA_LITERATE_CODEDELIM); +} + +static inline int CommentBlockStyleFromNestLevel(const unsigned int nestLevel) { + return SCE_HA_COMMENTBLOCK + (nestLevel % 3); +} + +// Mangled version of lexlib/Accessor.cxx IndentAmount. +// Modified to treat comment blocks as whitespace +// plus special case for commentline/preprocessor. +static int HaskellIndentAmount(Accessor &styler, const int line) { + + // Determines the indentation level of the current line + // Comment blocks are treated as whitespace + + int pos = styler.LineStart(line); + int eol_pos = styler.LineStart(line + 1) - 1; + + char ch = styler[pos]; + int style = styler.StyleAt(pos); + + int indent = 0; + bool inPrevPrefix = line > 0; + + int posPrev = inPrevPrefix ? styler.LineStart(line-1) : 0; + + while (( ch == ' ' || ch == '\t' + || IsCommentBlockStyle(style) + || style == SCE_HA_LITERATE_CODEDELIM) + && (pos < eol_pos)) { + if (inPrevPrefix) { + char chPrev = styler[posPrev++]; + if (chPrev != ' ' && chPrev != '\t') { + inPrevPrefix = false; + } + } + if (ch == '\t') { + indent = (indent / 8 + 1) * 8; + } else { // Space or comment block + indent++; + } + pos++; + ch = styler[pos]; + style = styler.StyleAt(pos); + } + + indent += SC_FOLDLEVELBASE; + // if completely empty line or the start of a comment or preprocessor... + if ( styler.LineStart(line) == styler.Length() + || ch == ' ' + || ch == '\t' + || ch == '\n' + || ch == '\r' + || IsCommentStyle(style) + || style == SCE_HA_PREPROCESSOR) + return indent | SC_FOLDLEVELWHITEFLAG; + else + return indent; +} + +struct OptionsHaskell { + bool magicHash; + bool allowQuotes; + bool implicitParams; + bool highlightSafe; + bool cpp; + bool stylingWithinPreprocessor; + bool fold; + bool foldComment; + bool foldCompact; + bool foldImports; + OptionsHaskell() { + magicHash = true; // Widespread use, enabled by default. + allowQuotes = true; // Widespread use, enabled by default. + implicitParams = false; // Fell out of favor, seldom used, disabled. + highlightSafe = true; // Moderately used, doesn't hurt to enable. + cpp = true; // Widespread use, enabled by default; + stylingWithinPreprocessor = false; + fold = false; + foldComment = false; + foldCompact = false; + foldImports = false; + } +}; + +static const char * const haskellWordListDesc[] = { + "Keywords", + "FFI", + "Reserved operators", + 0 +}; + +struct OptionSetHaskell : public OptionSet { + OptionSetHaskell() { + DefineProperty("lexer.haskell.allow.hash", &OptionsHaskell::magicHash, + "Set to 0 to disallow the '#' character at the end of identifiers and " + "literals with the haskell lexer " + "(GHC -XMagicHash extension)"); + + DefineProperty("lexer.haskell.allow.quotes", &OptionsHaskell::allowQuotes, + "Set to 0 to disable highlighting of Template Haskell name quotations " + "and promoted constructors " + "(GHC -XTemplateHaskell and -XDataKinds extensions)"); + + DefineProperty("lexer.haskell.allow.questionmark", &OptionsHaskell::implicitParams, + "Set to 1 to allow the '?' character at the start of identifiers " + "with the haskell lexer " + "(GHC & Hugs -XImplicitParams extension)"); + + DefineProperty("lexer.haskell.import.safe", &OptionsHaskell::highlightSafe, + "Set to 0 to disallow \"safe\" keyword in imports " + "(GHC -XSafe, -XTrustworthy, -XUnsafe extensions)"); + + DefineProperty("lexer.haskell.cpp", &OptionsHaskell::cpp, + "Set to 0 to disable C-preprocessor highlighting " + "(-XCPP extension)"); + + DefineProperty("styling.within.preprocessor", &OptionsHaskell::stylingWithinPreprocessor, + "For Haskell code, determines whether all preprocessor code is styled in the " + "preprocessor style (0, the default) or only from the initial # to the end " + "of the command word(1)." + ); + + DefineProperty("fold", &OptionsHaskell::fold); + + DefineProperty("fold.comment", &OptionsHaskell::foldComment); + + DefineProperty("fold.compact", &OptionsHaskell::foldCompact); + + DefineProperty("fold.haskell.imports", &OptionsHaskell::foldImports, + "Set to 1 to enable folding of import declarations"); + + DefineWordListSets(haskellWordListDesc); + } +}; + +class LexerHaskell : public ILexer { + bool literate; + int firstImportLine; + int firstImportIndent; + WordList keywords; + WordList ffi; + WordList reserved_operators; + OptionsHaskell options; + OptionSetHaskell osHaskell; + + enum HashCount { + oneHash + ,twoHashes + ,unlimitedHashes + }; + + enum KeywordMode { + HA_MODE_DEFAULT = 0 + ,HA_MODE_IMPORT1 = 1 // after "import", before "qualified" or "safe" or package name or module name. + ,HA_MODE_IMPORT2 = 2 // after module name, before "as" or "hiding". + ,HA_MODE_IMPORT3 = 3 // after "as", before "hiding" + ,HA_MODE_MODULE = 4 // after "module", before module name. + ,HA_MODE_FFI = 5 // after "foreign", before FFI keywords + ,HA_MODE_TYPE = 6 // after "type" or "data", before "family" + }; + + enum LiterateMode { + LITERATE_BIRD = 0 // if '>' is the first character on the line, + // color '>' as a codedelim and the rest of + // the line as code. + // else if "\begin{code}" is the only word on the + // line except whitespace, switch to LITERATE_BLOCK + // otherwise color the line as a literate comment. + ,LITERATE_BLOCK = 1 // if the string "\end{code}" is encountered at column + // 0 ignoring all later characters, color the line + // as a codedelim and switch to LITERATE_BIRD + // otherwise color the line as code. + }; + + struct HaskellLineInfo { + unsigned int nestLevel; // 22 bits ought to be enough for anybody + unsigned int nonexternalStyle; // 5 bits, widen if number of styles goes + // beyond 31. + bool pragma; + LiterateMode lmode; + KeywordMode mode; + + HaskellLineInfo(int state) : + nestLevel (state >> 10) + , nonexternalStyle ((state >> 5) & 0x1F) + , pragma ((state >> 4) & 0x1) + , lmode (static_cast((state >> 3) & 0x1)) + , mode (static_cast(state & 0x7)) + {} + + int ToLineState() { + return + (nestLevel << 10) + | (nonexternalStyle << 5) + | (pragma << 4) + | (lmode << 3) + | mode; + } + }; + + inline void skipMagicHash(StyleContext &sc, const HashCount hashes) const { + if (options.magicHash && sc.ch == '#') { + sc.Forward(); + if (hashes == twoHashes && sc.ch == '#') { + sc.Forward(); + } else if (hashes == unlimitedHashes) { + while (sc.ch == '#') { + sc.Forward(); + } + } + } + } + + bool LineContainsImport(const int line, Accessor &styler) const { + if (options.foldImports) { + int currentPos = styler.LineStart(line); + int style = styler.StyleAt(currentPos); + + int eol_pos = styler.LineStart(line + 1) - 1; + + while (currentPos < eol_pos) { + int ch = styler[currentPos]; + style = styler.StyleAt(currentPos); + + if (ch == ' ' || ch == '\t' + || IsCommentBlockStyle(style) + || style == SCE_HA_LITERATE_CODEDELIM) { + currentPos++; + } else { + break; + } + } + + return (style == SCE_HA_KEYWORD + && styler.Match(currentPos, "import")); + } else { + return false; + } + } + + inline int IndentAmountWithOffset(Accessor &styler, const int line) const { + const int indent = HaskellIndentAmount(styler, line); + const int indentLevel = indent & SC_FOLDLEVELNUMBERMASK; + return indentLevel <= ((firstImportIndent - 1) + SC_FOLDLEVELBASE) + ? indent + : (indentLevel + firstImportIndent) | (indent & ~SC_FOLDLEVELNUMBERMASK); + } + + inline int IndentLevelRemoveIndentOffset(const int indentLevel) const { + return indentLevel <= ((firstImportIndent - 1) + SC_FOLDLEVELBASE) + ? indentLevel + : indentLevel - firstImportIndent; + } + +public: + LexerHaskell(bool literate_) + : literate(literate_) + , firstImportLine(-1) + , firstImportIndent(0) + {} + virtual ~LexerHaskell() {} + + void SCI_METHOD Release() { + delete this; + } + + int SCI_METHOD Version() const { + return lvOriginal; + } + + const char * SCI_METHOD PropertyNames() { + return osHaskell.PropertyNames(); + } + + int SCI_METHOD PropertyType(const char *name) { + return osHaskell.PropertyType(name); + } + + const char * SCI_METHOD DescribeProperty(const char *name) { + return osHaskell.DescribeProperty(name); + } + + int SCI_METHOD PropertySet(const char *key, const char *val); + + const char * SCI_METHOD DescribeWordListSets() { + return osHaskell.DescribeWordListSets(); + } + + int SCI_METHOD WordListSet(int n, const char *wl); + + void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + + void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + + void * SCI_METHOD PrivateCall(int, void *) { + return 0; + } + + static ILexer *LexerFactoryHaskell() { + return new LexerHaskell(false); + } + + static ILexer *LexerFactoryLiterateHaskell() { + return new LexerHaskell(true); + } +}; + +int SCI_METHOD LexerHaskell::PropertySet(const char *key, const char *val) { + if (osHaskell.PropertySet(&options, key, val)) { + return 0; + } + return -1; +} + +int SCI_METHOD LexerHaskell::WordListSet(int n, const char *wl) { + WordList *wordListN = 0; + switch (n) { + case 0: + wordListN = &keywords; + break; + case 1: + wordListN = &ffi; + break; + case 2: + wordListN = &reserved_operators; + break; + } + int firstModification = -1; + if (wordListN) { + WordList wlNew; + wlNew.Set(wl); + if (*wordListN != wlNew) { + wordListN->Set(wl); + firstModification = 0; + } + } + return firstModification; +} + +void SCI_METHOD LexerHaskell::Lex(unsigned int startPos, int length, int initStyle + ,IDocument *pAccess) { + LexAccessor styler(pAccess); + + int lineCurrent = styler.GetLine(startPos); + + HaskellLineInfo hs = HaskellLineInfo(lineCurrent ? styler.GetLineState(lineCurrent-1) : 0); + + // Do not leak onto next line + if (initStyle == SCE_HA_STRINGEOL) + initStyle = SCE_HA_DEFAULT; + else if (initStyle == SCE_HA_LITERATE_CODEDELIM) + initStyle = hs.nonexternalStyle; StyleContext sc(startPos, length, initStyle, styler); - int lineCurrent = styler.GetLine(startPos); - int state = lineCurrent ? styler.GetLineState(lineCurrent-1) - : HA_MODE_DEFAULT; - int mode = state & 0xF; - int xmode = state >> 4; + int base = 10; + bool dot = false; + + bool inDashes = false; + bool alreadyInTheMiddleOfOperator = false; + + assert(!(IsCommentBlockStyle(initStyle) && hs.nestLevel == 0)); while (sc.More()) { // Check for state end - // Operator - if (sc.state == SCE_HA_OPERATOR) { - if (isascii(sc.ch) && isoperator(static_cast(sc.ch))) { + if (!IsExternalStyle(sc.state)) { + hs.nonexternalStyle = sc.state; + } + + // For lexer to work, states should unconditionally forward at least one + // character. + // If they don't, they should still check if they are at line end and + // forward if so. + // If a state forwards more than one character, it should check every time + // that it is not a line end and cease forwarding otherwise. + if (sc.atLineEnd) { + // Remember the line state for future incremental lexing + styler.SetLineState(lineCurrent, hs.ToLineState()); + lineCurrent++; + } + + // Handle line continuation generically. + if (sc.ch == '\\' && (sc.chNext == '\n' || sc.chNext == '\r') + && ( sc.state == SCE_HA_STRING + || sc.state == SCE_HA_PREPROCESSOR)) { + // Remember the line state for future incremental lexing + styler.SetLineState(lineCurrent, hs.ToLineState()); + lineCurrent++; + + sc.Forward(); + if (sc.ch == '\r' && sc.chNext == '\n') { sc.Forward(); - } else { - styler.ColourTo(sc.currentPos - 1, sc.state); - sc.ChangeState(SCE_HA_DEFAULT); } + sc.Forward(); + + continue; + } + + if (sc.atLineStart) { + + if (sc.state == SCE_HA_STRING || sc.state == SCE_HA_CHARACTER) { + // Prevent SCE_HA_STRINGEOL from leaking back to previous line + sc.SetState(sc.state); + } + + if (literate && hs.lmode == LITERATE_BIRD) { + if (!IsExternalStyle(sc.state)) { + sc.SetState(SCE_HA_LITERATE_COMMENT); + } + } + } + + // External + // Literate + if ( literate && hs.lmode == LITERATE_BIRD && sc.atLineStart + && sc.ch == '>') { + sc.SetState(SCE_HA_LITERATE_CODEDELIM); + sc.ForwardSetState(hs.nonexternalStyle); + } + else if (literate && hs.lmode == LITERATE_BIRD && sc.atLineStart + && ( sc.ch == ' ' || sc.ch == '\t' + || sc.Match("\\begin{code}"))) { + sc.SetState(sc.state); + + while ((sc.ch == ' ' || sc.ch == '\t') && sc.More()) + sc.Forward(); + + if (sc.Match("\\begin{code}")) { + sc.Forward(static_cast(strlen("\\begin{code}"))); + + bool correct = true; + + while (!sc.atLineEnd && sc.More()) { + if (sc.ch != ' ' && sc.ch != '\t') { + correct = false; + } + sc.Forward(); + } + + if (correct) { + sc.ChangeState(SCE_HA_LITERATE_CODEDELIM); // color the line end + hs.lmode = LITERATE_BLOCK; + } + } + } + else if (literate && hs.lmode == LITERATE_BLOCK && sc.atLineStart + && sc.Match("\\end{code}")) { + sc.SetState(SCE_HA_LITERATE_CODEDELIM); + + sc.Forward(static_cast(strlen("\\end{code}"))); + + while (!sc.atLineEnd && sc.More()) { + sc.Forward(); + } + + sc.SetState(SCE_HA_LITERATE_COMMENT); + hs.lmode = LITERATE_BIRD; + } + // Preprocessor + else if (sc.atLineStart && sc.ch == '#' && options.cpp + && (!options.stylingWithinPreprocessor || sc.state == SCE_HA_DEFAULT)) { + sc.SetState(SCE_HA_PREPROCESSOR); + sc.Forward(); + } + // Literate + else if (sc.state == SCE_HA_LITERATE_COMMENT) { + sc.Forward(); + } + else if (sc.state == SCE_HA_LITERATE_CODEDELIM) { + sc.ForwardSetState(hs.nonexternalStyle); + } + // Preprocessor + else if (sc.state == SCE_HA_PREPROCESSOR) { + if (sc.atLineEnd) { + sc.SetState(options.stylingWithinPreprocessor + ? SCE_HA_DEFAULT + : hs.nonexternalStyle); + sc.Forward(); // prevent double counting a line + } else if (options.stylingWithinPreprocessor && !IsHaskellLetter(sc.ch)) { + sc.SetState(SCE_HA_DEFAULT); + } else { + sc.Forward(); + } + } + // Haskell + // Operator + else if (sc.state == SCE_HA_OPERATOR) { + int style = SCE_HA_OPERATOR; + + if ( sc.ch == ':' + && !alreadyInTheMiddleOfOperator + // except "::" + && !( sc.chNext == ':' + && !IsAnHaskellOperatorChar(sc.GetRelative(2)))) { + style = SCE_HA_CAPITAL; + } + + alreadyInTheMiddleOfOperator = false; + + while (IsAnHaskellOperatorChar(sc.ch)) + sc.Forward(); + + char s[100]; + sc.GetCurrent(s, sizeof(s)); + + if (reserved_operators.InList(s)) + style = SCE_HA_RESERVED_OPERATOR; + + sc.ChangeState(style); + sc.SetState(SCE_HA_DEFAULT); } // String else if (sc.state == SCE_HA_STRING) { - if (sc.ch == '\"') { - sc.Forward(); - styler.ColourTo(sc.currentPos-1, sc.state); - sc.ChangeState(SCE_HA_DEFAULT); + if (sc.atLineEnd) { + sc.ChangeState(SCE_HA_STRINGEOL); + sc.ForwardSetState(SCE_HA_DEFAULT); + } else if (sc.ch == '\"') { + sc.Forward(); + skipMagicHash(sc, oneHash); + sc.SetState(SCE_HA_DEFAULT); } else if (sc.ch == '\\') { sc.Forward(2); - } else if (sc.atLineEnd) { - styler.ColourTo(sc.currentPos-1, sc.state); - sc.ChangeState(SCE_HA_DEFAULT); - } else { - sc.Forward(); - } + } else { + sc.Forward(); + } } // Char else if (sc.state == SCE_HA_CHARACTER) { - if (sc.ch == '\'') { - sc.Forward(); - styler.ColourTo(sc.currentPos-1, sc.state); - sc.ChangeState(SCE_HA_DEFAULT); + if (sc.atLineEnd) { + sc.ChangeState(SCE_HA_STRINGEOL); + sc.ForwardSetState(SCE_HA_DEFAULT); + } else if (sc.ch == '\'') { + sc.Forward(); + skipMagicHash(sc, oneHash); + sc.SetState(SCE_HA_DEFAULT); } else if (sc.ch == '\\') { sc.Forward(2); - } else if (sc.atLineEnd) { - styler.ColourTo(sc.currentPos-1, sc.state); - sc.ChangeState(SCE_HA_DEFAULT); - } else { - sc.Forward(); - } + } else { + sc.Forward(); + } } // Number else if (sc.state == SCE_HA_NUMBER) { - if (IsADigit(sc.ch, xmode)) { + if (sc.atLineEnd) { + sc.SetState(SCE_HA_DEFAULT); + sc.Forward(); // prevent double counting a line + } else if (IsADigit(sc.ch, base)) { sc.Forward(); - } else if ((xmode == 10) && + } else if (sc.ch=='.' && dot && IsADigit(sc.chNext, base)) { + sc.Forward(2); + dot = false; + } else if ((base == 10) && (sc.ch == 'e' || sc.ch == 'E') && (IsADigit(sc.chNext) || sc.chNext == '+' || sc.chNext == '-')) { - sc.Forward(); - if (sc.ch == '+' || sc.ch == '-') - sc.Forward(); + sc.Forward(); + if (sc.ch == '+' || sc.ch == '-') + sc.Forward(); } else { - styler.ColourTo(sc.currentPos - 1, sc.state); - sc.ChangeState(SCE_HA_DEFAULT); + skipMagicHash(sc, twoHashes); + sc.SetState(SCE_HA_DEFAULT); } } - // Identifier + // Keyword or Identifier else if (sc.state == SCE_HA_IDENTIFIER) { - if (IsAWordChar(sc.ch)) { - sc.Forward(); - } else { - char s[100]; - sc.GetCurrent(s, sizeof(s)); - int style = sc.state; - int new_mode = 0; - if (keywords.InList(s)) { - style = SCE_HA_KEYWORD; - } else if (isupper(s[0])) { - if (mode >= HA_MODE_IMPORT1 && mode <= HA_MODE_IMPORT3) { - style = SCE_HA_MODULE; - new_mode = HA_MODE_IMPORT2; - } else if (mode == HA_MODE_MODULE) - style = SCE_HA_MODULE; - else + int style = IsHaskellUpperCase(sc.ch) ? SCE_HA_CAPITAL : SCE_HA_IDENTIFIER; + + assert(IsAHaskellWordStart(sc.ch)); + + sc.Forward(); + + while (sc.More()) { + if (IsAHaskellWordChar(sc.ch)) { + sc.Forward(); + } else if (sc.ch == '.' && style == SCE_HA_CAPITAL) { + if (IsHaskellUpperCase(sc.chNext)) { + sc.Forward(); style = SCE_HA_CAPITAL; - } else if (mode == HA_MODE_IMPORT1 && - strcmp(s,"qualified") == 0) { - style = SCE_HA_KEYWORD; - new_mode = HA_MODE_IMPORT1; - } else if (mode == HA_MODE_IMPORT2) { - if (strcmp(s,"as") == 0) { - style = SCE_HA_KEYWORD; - new_mode = HA_MODE_IMPORT3; - } else if (strcmp(s,"hiding") == 0) { - style = SCE_HA_KEYWORD; - } - } else if (mode == HA_MODE_FFI) { - if (ffi.InList(s)) { - style = SCE_HA_KEYWORD; - new_mode = HA_MODE_FFI; + } else if (IsAHaskellWordStart(sc.chNext)) { + sc.Forward(); + style = SCE_HA_IDENTIFIER; + } else if (IsAnHaskellOperatorChar(sc.chNext)) { + sc.Forward(); + style = sc.ch == ':' ? SCE_HA_CAPITAL : SCE_HA_OPERATOR; + while (IsAnHaskellOperatorChar(sc.ch)) + sc.Forward(); + break; + } else { + break; } + } else { + break; } - else if (mode == HA_MODE_TYPE) { - if (strcmp(s,"family") == 0) - style = SCE_HA_KEYWORD; - } - styler.ColourTo(sc.currentPos - 1, style); - if (strcmp(s,"import") == 0 && mode != HA_MODE_FFI) - new_mode = HA_MODE_IMPORT1; - else if (strcmp(s,"module") == 0) - new_mode = HA_MODE_MODULE; - else if (strcmp(s,"foreign") == 0) - new_mode = HA_MODE_FFI; - else if (strcmp(s,"type") == 0) - new_mode = HA_MODE_TYPE; - sc.ChangeState(SCE_HA_DEFAULT); - mode = new_mode; } + + skipMagicHash(sc, unlimitedHashes); + + char s[100]; + sc.GetCurrent(s, sizeof(s)); + + KeywordMode new_mode = HA_MODE_DEFAULT; + + if (keywords.InList(s)) { + style = SCE_HA_KEYWORD; + } else if (style == SCE_HA_CAPITAL) { + if (hs.mode == HA_MODE_IMPORT1 || hs.mode == HA_MODE_IMPORT3) { + style = SCE_HA_MODULE; + new_mode = HA_MODE_IMPORT2; + } else if (hs.mode == HA_MODE_MODULE) { + style = SCE_HA_MODULE; + } + } else if (hs.mode == HA_MODE_IMPORT1 && + strcmp(s,"qualified") == 0) { + style = SCE_HA_KEYWORD; + new_mode = HA_MODE_IMPORT1; + } else if (options.highlightSafe && + hs.mode == HA_MODE_IMPORT1 && + strcmp(s,"safe") == 0) { + style = SCE_HA_KEYWORD; + new_mode = HA_MODE_IMPORT1; + } else if (hs.mode == HA_MODE_IMPORT2) { + if (strcmp(s,"as") == 0) { + style = SCE_HA_KEYWORD; + new_mode = HA_MODE_IMPORT3; + } else if (strcmp(s,"hiding") == 0) { + style = SCE_HA_KEYWORD; + } + } else if (hs.mode == HA_MODE_TYPE) { + if (strcmp(s,"family") == 0) + style = SCE_HA_KEYWORD; + } + + if (hs.mode == HA_MODE_FFI) { + if (ffi.InList(s)) { + style = SCE_HA_KEYWORD; + new_mode = HA_MODE_FFI; + } + } + + sc.ChangeState(style); + sc.SetState(SCE_HA_DEFAULT); + + if (strcmp(s,"import") == 0 && hs.mode != HA_MODE_FFI) + new_mode = HA_MODE_IMPORT1; + else if (strcmp(s,"module") == 0) + new_mode = HA_MODE_MODULE; + else if (strcmp(s,"foreign") == 0) + new_mode = HA_MODE_FFI; + else if (strcmp(s,"type") == 0 + || strcmp(s,"data") == 0) + new_mode = HA_MODE_TYPE; + + hs.mode = new_mode; } // Comments // Oneliner else if (sc.state == SCE_HA_COMMENTLINE) { if (sc.atLineEnd) { - styler.ColourTo(sc.currentPos - 1, sc.state); - sc.ChangeState(SCE_HA_DEFAULT); + sc.SetState(hs.pragma ? SCE_HA_PRAGMA : SCE_HA_DEFAULT); + sc.Forward(); // prevent double counting a line + } else if (inDashes && sc.ch != '-' && !hs.pragma) { + inDashes = false; + if (IsAnHaskellOperatorChar(sc.ch)) { + alreadyInTheMiddleOfOperator = true; + sc.ChangeState(SCE_HA_OPERATOR); + } } else { sc.Forward(); } } // Nested - else if (sc.state == SCE_HA_COMMENTBLOCK) { - if (sc.Match("{-")) { + else if (IsCommentBlockStyle(sc.state)) { + if (sc.Match('{','-')) { + sc.SetState(CommentBlockStyleFromNestLevel(hs.nestLevel)); sc.Forward(2); - xmode++; - } - else if (sc.Match("-}")) { + hs.nestLevel++; + } else if (sc.Match('-','}')) { sc.Forward(2); - xmode--; - if (xmode == 0) { - styler.ColourTo(sc.currentPos - 1, sc.state); - sc.ChangeState(SCE_HA_DEFAULT); - } + assert(hs.nestLevel > 0); + if (hs.nestLevel > 0) + hs.nestLevel--; + sc.SetState( + hs.nestLevel == 0 + ? (hs.pragma ? SCE_HA_PRAGMA : SCE_HA_DEFAULT) + : CommentBlockStyleFromNestLevel(hs.nestLevel - 1)); } else { - if (sc.atLineEnd) { - // Remember the line state for future incremental lexing - styler.SetLineState(lineCurrent, (xmode << 4) | mode); - lineCurrent++; - } sc.Forward(); } } - // New state? - if (sc.state == SCE_HA_DEFAULT) { + // Pragma + else if (sc.state == SCE_HA_PRAGMA) { + if (sc.Match("#-}")) { + hs.pragma = false; + sc.Forward(3); + sc.SetState(SCE_HA_DEFAULT); + } else if (sc.Match('-','-')) { + sc.SetState(SCE_HA_COMMENTLINE); + sc.Forward(2); + inDashes = false; + } else if (sc.Match('{','-')) { + sc.SetState(CommentBlockStyleFromNestLevel(hs.nestLevel)); + sc.Forward(2); + hs.nestLevel = 1; + } else { + sc.Forward(); + } + } + // New state? + else if (sc.state == SCE_HA_DEFAULT) { // Digit - if (IsADigit(sc.ch) || - (sc.ch == '.' && IsADigit(sc.chNext)) || - (sc.ch == '-' && IsADigit(sc.chNext))) { - styler.ColourTo(sc.currentPos - 1, sc.state); - sc.ChangeState(SCE_HA_NUMBER); + if (IsADigit(sc.ch)) { + hs.mode = HA_MODE_DEFAULT; + + sc.SetState(SCE_HA_NUMBER); if (sc.ch == '0' && (sc.chNext == 'X' || sc.chNext == 'x')) { - // Match anything starting with "0x" or "0X", too - sc.Forward(2); - xmode = 16; + // Match anything starting with "0x" or "0X", too + sc.Forward(2); + base = 16; + dot = false; } else if (sc.ch == '0' && (sc.chNext == 'O' || sc.chNext == 'o')) { - // Match anything starting with "0x" or "0X", too - sc.Forward(2); - xmode = 8; + // Match anything starting with "0o" or "0O", too + sc.Forward(2); + base = 8; + dot = false; } else { - sc.Forward(); - xmode = 10; - } - mode = HA_MODE_DEFAULT; + sc.Forward(); + base = 10; + dot = true; + } + } + // Pragma + else if (sc.Match("{-#")) { + hs.pragma = true; + sc.SetState(SCE_HA_PRAGMA); + sc.Forward(3); } // Comment line - else if (sc.Match("--")) { - styler.ColourTo(sc.currentPos - 1, sc.state); + else if (sc.Match('-','-')) { + sc.SetState(SCE_HA_COMMENTLINE); sc.Forward(2); - sc.ChangeState(SCE_HA_COMMENTLINE); - // Comment block + inDashes = true; } - else if (sc.Match("{-")) { - styler.ColourTo(sc.currentPos - 1, sc.state); + // Comment block + else if (sc.Match('{','-')) { + sc.SetState(CommentBlockStyleFromNestLevel(hs.nestLevel)); sc.Forward(2); - sc.ChangeState(SCE_HA_COMMENTBLOCK); - xmode = 1; + hs.nestLevel = 1; } // String - else if (sc.Match('\"')) { - styler.ColourTo(sc.currentPos - 1, sc.state); + else if (sc.ch == '\"') { + sc.SetState(SCE_HA_STRING); sc.Forward(); - sc.ChangeState(SCE_HA_STRING); } - // Character - else if (sc.Match('\'')) { - styler.ColourTo(sc.currentPos - 1, sc.state); + // Character or quoted name or promoted term + else if (sc.ch == '\'') { + hs.mode = HA_MODE_DEFAULT; + + sc.SetState(SCE_HA_CHARACTER); sc.Forward(); - sc.ChangeState(SCE_HA_CHARACTER); + + if (options.allowQuotes) { + // Quoted type ''T + if (sc.ch=='\'' && IsAHaskellWordStart(sc.chNext)) { + sc.Forward(); + sc.ChangeState(SCE_HA_IDENTIFIER); + } else if (sc.chNext != '\'') { + // Quoted name 'n or promoted constructor 'N + if (IsAHaskellWordStart(sc.ch)) { + sc.ChangeState(SCE_HA_IDENTIFIER); + // Promoted constructor operator ':~> + } else if (sc.ch == ':') { + alreadyInTheMiddleOfOperator = false; + sc.ChangeState(SCE_HA_OPERATOR); + // Promoted list or tuple '[T] + } else if (sc.ch == '[' || sc.ch== '(') { + sc.ChangeState(SCE_HA_OPERATOR); + sc.ForwardSetState(SCE_HA_DEFAULT); + } + } + } + } + // Operator starting with '?' or an implicit parameter + else if (sc.ch == '?') { + hs.mode = HA_MODE_DEFAULT; + + alreadyInTheMiddleOfOperator = false; + sc.SetState(SCE_HA_OPERATOR); + + if ( options.implicitParams + && IsAHaskellWordStart(sc.chNext) + && !IsHaskellUpperCase(sc.chNext)) { + sc.Forward(); + sc.ChangeState(SCE_HA_IDENTIFIER); + } } - else if (sc.ch == '(' || sc.ch == ')' || - sc.ch == '{' || sc.ch == '}' || - sc.ch == '[' || sc.ch == ']') { - styler.ColourTo(sc.currentPos - 1, sc.state); - sc.Forward(); - styler.ColourTo(sc.currentPos - 1, SCE_HA_OPERATOR); - mode = HA_MODE_DEFAULT; - } // Operator - else if (isascii(sc.ch) && isoperator(static_cast(sc.ch))) { - styler.ColourTo(sc.currentPos - 1, sc.state); - sc.Forward(); - sc.ChangeState(SCE_HA_OPERATOR); - mode = HA_MODE_DEFAULT; + else if (IsAnHaskellOperatorChar(sc.ch)) { + hs.mode = HA_MODE_DEFAULT; + + sc.SetState(SCE_HA_OPERATOR); } - // Keyword - else if (IsAWordStart(sc.ch)) { - styler.ColourTo(sc.currentPos - 1, sc.state); - sc.Forward(); - sc.ChangeState(SCE_HA_IDENTIFIER); + // Braces and punctuation + else if (sc.ch == ',' || sc.ch == ';' + || sc.ch == '(' || sc.ch == ')' + || sc.ch == '[' || sc.ch == ']' + || sc.ch == '{' || sc.ch == '}') { + sc.SetState(SCE_HA_OPERATOR); + sc.ForwardSetState(SCE_HA_DEFAULT); + } + // Keyword or Identifier + else if (IsAHaskellWordStart(sc.ch)) { + sc.SetState(SCE_HA_IDENTIFIER); + // Something we don't care about } else { - if (sc.atLineEnd) { - // Remember the line state for future incremental lexing - styler.SetLineState(lineCurrent, (xmode << 4) | mode); - lineCurrent++; - } sc.Forward(); } + } + // This branch should never be reached. + else { + assert(false); + sc.Forward(); } } sc.Complete(); } -// External stuff - used for dynamic-loading, not implemented in wxStyledTextCtrl yet. -// Inspired by the caml external lexer - Credits to Robert Roessler - http://www.rftp.com -#ifdef BUILD_EXTERNAL_LEXER -static const char* LexerName = "haskell"; +void SCI_METHOD LexerHaskell::Fold(unsigned int startPos, int length, int // initStyle + ,IDocument *pAccess) { + if (!options.fold) + return; -void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, int initStyle, - char *words[], WindowID window, char *props) -{ - PropSetSimple ps; - ps.SetMultiple(props); - WindowAccessor wa(window, ps); + Accessor styler(pAccess, NULL); - int nWL = 0; - for (; words[nWL]; nWL++) ; - WordList** wl = new WordList* [nWL + 1]; - int i = 0; - for (; iSet(words[i]); + int lineCurrent = styler.GetLine(startPos); + + if (lineCurrent <= firstImportLine) { + firstImportLine = -1; // readjust first import position + firstImportIndent = 0; } - wl[i] = 0; - ColorizeHaskellDoc(startPos, length, initStyle, wl, wa); - wa.Flush(); - for (i=nWL-1;i>=0;i--) - delete wl[i]; - delete [] wl; -} + const int maxPos = startPos + length; + const int maxLines = + maxPos == styler.Length() + ? styler.GetLine(maxPos) + : styler.GetLine(maxPos - 1); // Requested last line + const int docLines = styler.GetLine(styler.Length()); // Available last line -void EXT_LEXER_DECL Fold (unsigned int lexer, unsigned int startPos, int length, int initStyle, - char *words[], WindowID window, char *props) -{ + // Backtrack to previous non-blank line so we can determine indent level + // for any white space lines + // and so we can fix any preceding fold level (which is why we go back + // at least one line in all cases) + bool importHere = LineContainsImport(lineCurrent, styler); + int indentCurrent = IndentAmountWithOffset(styler, lineCurrent); -} - -int EXT_LEXER_DECL GetLexerCount() -{ - return 1; -} - -void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength) -{ - if (buflength > 0) { - buflength--; - int n = strlen(LexerName); - if (n > buflength) - n = buflength; - memcpy(name, LexerName, n), name[n] = '\0'; + while (lineCurrent > 0) { + lineCurrent--; + importHere = LineContainsImport(lineCurrent, styler); + indentCurrent = IndentAmountWithOffset(styler, lineCurrent); + if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) + break; } -} -#endif -LexerModule lmHaskell(SCLEX_HASKELL, ColorizeHaskellDoc, "haskell"); + int indentCurrentLevel = indentCurrent & SC_FOLDLEVELNUMBERMASK; + + if (importHere) { + indentCurrentLevel = IndentLevelRemoveIndentOffset(indentCurrentLevel); + if (firstImportLine == -1) { + firstImportLine = lineCurrent; + firstImportIndent = (1 + indentCurrentLevel) - SC_FOLDLEVELBASE; + } + if (firstImportLine != lineCurrent) { + indentCurrentLevel++; + } + } + + indentCurrent = indentCurrentLevel | (indentCurrent & ~SC_FOLDLEVELNUMBERMASK); + + // Process all characters to end of requested range + //that hangs over the end of the range. Cap processing in all cases + // to end of document. + while (lineCurrent <= docLines && lineCurrent <= maxLines) { + + // Gather info + int lineNext = lineCurrent + 1; + importHere = false; + int indentNext = indentCurrent; + + if (lineNext <= docLines) { + // Information about next line is only available if not at end of document + importHere = LineContainsImport(lineNext, styler); + indentNext = IndentAmountWithOffset(styler, lineNext); + } + if (indentNext & SC_FOLDLEVELWHITEFLAG) + indentNext = SC_FOLDLEVELWHITEFLAG | indentCurrentLevel; + + // Skip past any blank lines for next indent level info; we skip also + // comments (all comments, not just those starting in column 0) + // which effectively folds them into surrounding code rather + // than screwing up folding. + + while (lineNext < docLines && (indentNext & SC_FOLDLEVELWHITEFLAG)) { + lineNext++; + importHere = LineContainsImport(lineNext, styler); + indentNext = IndentAmountWithOffset(styler, lineNext); + } + + int indentNextLevel = indentNext & SC_FOLDLEVELNUMBERMASK; + + if (importHere) { + indentNextLevel = IndentLevelRemoveIndentOffset(indentNextLevel); + if (firstImportLine == -1) { + firstImportLine = lineNext; + firstImportIndent = (1 + indentNextLevel) - SC_FOLDLEVELBASE; + } + if (firstImportLine != lineNext) { + indentNextLevel++; + } + } + + indentNext = indentNextLevel | (indentNext & ~SC_FOLDLEVELNUMBERMASK); + + const int levelBeforeComments = Maximum(indentCurrentLevel,indentNextLevel); + + // Now set all the indent levels on the lines we skipped + // Do this from end to start. Once we encounter one line + // which is indented more than the line after the end of + // the comment-block, use the level of the block before + + int skipLine = lineNext; + int skipLevel = indentNextLevel; + + while (--skipLine > lineCurrent) { + int skipLineIndent = IndentAmountWithOffset(styler, skipLine); + + if (options.foldCompact) { + if ((skipLineIndent & SC_FOLDLEVELNUMBERMASK) > indentNextLevel) { + skipLevel = levelBeforeComments; + } + + int whiteFlag = skipLineIndent & SC_FOLDLEVELWHITEFLAG; + + styler.SetLevel(skipLine, skipLevel | whiteFlag); + } else { + if ( (skipLineIndent & SC_FOLDLEVELNUMBERMASK) > indentNextLevel + && !(skipLineIndent & SC_FOLDLEVELWHITEFLAG)) { + skipLevel = levelBeforeComments; + } + + styler.SetLevel(skipLine, skipLevel); + } + } + + int lev = indentCurrent; + + if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) { + if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) + lev |= SC_FOLDLEVELHEADERFLAG; + } + + // Set fold level for this line and move to next line + styler.SetLevel(lineCurrent, options.foldCompact ? lev : lev & ~SC_FOLDLEVELWHITEFLAG); + + indentCurrent = indentNext; + indentCurrentLevel = indentNextLevel; + lineCurrent = lineNext; + } + + // NOTE: Cannot set level of last line here because indentCurrent doesn't have + // header flag set; the loop above is crafted to take care of this case! + //styler.SetLevel(lineCurrent, indentCurrent); +} + +LexerModule lmHaskell(SCLEX_HASKELL, LexerHaskell::LexerFactoryHaskell, "haskell", haskellWordListDesc); +LexerModule lmLiterateHaskell(SCLEX_LITERATEHASKELL, LexerHaskell::LexerFactoryLiterateHaskell, "literatehaskell", haskellWordListDesc); diff --git a/src/stc/scintilla/lexers/LexInno.cxx b/src/stc/scintilla/lexers/LexInno.cxx index a0f5b3271a..63fadf0ba6 100644 --- a/src/stc/scintilla/lexers/LexInno.cxx +++ b/src/stc/scintilla/lexers/LexInno.cxx @@ -104,7 +104,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k } else if (ch == '\'') { // Start of a single-quote string state = SCE_INNO_STRING_SINGLE; - } else if (isascii(ch) && (isalpha(ch) || (ch == '_'))) { + } else if (IsASCII(ch) && (isalpha(ch) || (ch == '_'))) { // Start of an identifier bufferCount = 0; buffer[bufferCount++] = static_cast(tolower(ch)); @@ -123,7 +123,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k break; case SCE_INNO_IDENTIFIER: - if (isascii(ch) && (isalnum(ch) || (ch == '_'))) { + if (IsASCII(ch) && (isalnum(ch) || (ch == '_'))) { buffer[bufferCount++] = static_cast(tolower(ch)); } else { state = SCE_INNO_DEFAULT; @@ -160,7 +160,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k } else { styler.ColourTo(i,SCE_INNO_DEFAULT); } - } else if (isascii(ch) && (isalnum(ch) || (ch == '_'))) { + } else if (IsASCII(ch) && (isalnum(ch) || (ch == '_'))) { buffer[bufferCount++] = static_cast(tolower(ch)); } else { state = SCE_INNO_DEFAULT; @@ -170,7 +170,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k case SCE_INNO_PREPROC: if (isWS || isEOL) { - if (isascii(chPrev) && isalpha(chPrev)) { + if (IsASCII(chPrev) && isalpha(chPrev)) { state = SCE_INNO_DEFAULT; buffer[bufferCount] = '\0'; @@ -185,7 +185,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k chNext = styler[i--]; ch = chPrev; } - } else if (isascii(ch) && isalpha(ch)) { + } else if (IsASCII(ch) && isalpha(ch)) { if (chPrev == '#' || chPrev == ' ' || chPrev == '\t') bufferCount = 0; buffer[bufferCount++] = static_cast(tolower(ch)); diff --git a/src/stc/scintilla/lexers/LexKVIrc.cxx b/src/stc/scintilla/lexers/LexKVIrc.cxx new file mode 100644 index 0000000000..67bcb43a6c --- /dev/null +++ b/src/stc/scintilla/lexers/LexKVIrc.cxx @@ -0,0 +1,473 @@ +// Scintilla source code edit control +/** @file LexKVIrc.cxx + ** Lexer for KVIrc script. + **/ +// Copyright 2013 by OmegaPhil , based in +// part from LexPython Copyright 1998-2002 by Neil Hodgson +// and LexCmake Copyright 2007 by Cristian Adam + +// The License.txt file describes the conditions under which this software may be distributed. + +#include +#include +#include +#include +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + + +/* KVIrc Script syntactic rules: http://www.kvirc.net/doc/doc_syntactic_rules.html */ + +/* Utility functions */ +static inline bool IsAWordChar(int ch) { + + /* Keyword list includes modules, i.e. words including '.', and + * alias namespaces include ':' */ + return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' + || ch == ':'); +} +static inline bool IsAWordStart(int ch) { + + /* Functions (start with '$') are treated separately to keywords */ + return (ch < 0x80) && (isalnum(ch) || ch == '_' ); +} + +/* Interface function called by Scintilla to request some text to be + syntax highlighted */ +static void ColouriseKVIrcDoc(unsigned int startPos, int length, + int initStyle, WordList *keywordlists[], + Accessor &styler) +{ + /* Fetching style context */ + StyleContext sc(startPos, length, initStyle, styler); + + /* Accessing keywords and function-marking keywords */ + WordList &keywords = *keywordlists[0]; + WordList &functionKeywords = *keywordlists[1]; + + /* Looping for all characters - only automatically moving forward + * when asked for (transitions leaving strings and keywords do this + * already) */ + bool next = true; + for( ; sc.More(); next ? sc.Forward() : (void)0 ) + { + /* Resetting next */ + next = true; + + /* Dealing with different states */ + switch (sc.state) + { + case SCE_KVIRC_DEFAULT: + + /* Detecting single-line comments + * Unfortunately KVIrc script allows raw '#' to be used, and appending # to an array returns + * its length... + * Going for a compromise where single line comments not + * starting on a newline are allowed in all cases except + * when they are preceeded with an opening bracket or comma + * (this will probably be the most common style a valid + * string-less channel name will be used with), with the + * array length case included + */ + if ( + (sc.ch == '#' && sc.atLineStart) || + (sc.ch == '#' && ( + sc.chPrev != '(' && sc.chPrev != ',' && + sc.chPrev != ']') + ) + ) + { + sc.SetState(SCE_KVIRC_COMMENT); + break; + } + + /* Detecting multi-line comments */ + if (sc.Match('/', '*')) + { + sc.SetState(SCE_KVIRC_COMMENTBLOCK); + break; + } + + /* Detecting strings */ + if (sc.ch == '"') + { + sc.SetState(SCE_KVIRC_STRING); + break; + } + + /* Detecting functions */ + if (sc.ch == '$') + { + sc.SetState(SCE_KVIRC_FUNCTION); + break; + } + + /* Detecting variables */ + if (sc.ch == '%') + { + sc.SetState(SCE_KVIRC_VARIABLE); + break; + } + + /* Detecting numbers - isdigit is unsafe as it does not + * validate, use CharacterSet.h functions */ + if (IsADigit(sc.ch)) + { + sc.SetState(SCE_KVIRC_NUMBER); + break; + } + + /* Detecting words */ + if (IsAWordStart(sc.ch) && IsAWordChar(sc.chNext)) + { + sc.SetState(SCE_KVIRC_WORD); + sc.Forward(); + break; + } + + /* Detecting operators */ + if (isoperator(sc.ch)) + { + sc.SetState(SCE_KVIRC_OPERATOR); + break; + } + + break; + + case SCE_KVIRC_COMMENT: + + /* Breaking out of single line comment when a newline + * is introduced */ + if (sc.ch == '\r' || sc.ch == '\n') + { + sc.SetState(SCE_KVIRC_DEFAULT); + break; + } + + break; + + case SCE_KVIRC_COMMENTBLOCK: + + /* Detecting end of multi-line comment */ + if (sc.Match('*', '/')) + { + // Moving the current position forward two characters + // so that '*/' is included in the comment + sc.Forward(2); + sc.SetState(SCE_KVIRC_DEFAULT); + + /* Comment has been exited and the current position + * moved forward, yet the new current character + * has yet to be defined - loop without moving + * forward again */ + next = false; + break; + } + + break; + + case SCE_KVIRC_STRING: + + /* Detecting end of string - closing speechmarks */ + if (sc.ch == '"') + { + /* Allowing escaped speechmarks to pass */ + if (sc.chPrev == '\\') + break; + + /* Moving the current position forward to capture the + * terminating speechmarks, and ending string */ + sc.ForwardSetState(SCE_KVIRC_DEFAULT); + + /* String has been exited and the current position + * moved forward, yet the new current character + * has yet to be defined - loop without moving + * forward again */ + next = false; + break; + } + + /* Functions and variables are now highlighted in strings + * Detecting functions */ + if (sc.ch == '$') + { + /* Allowing escaped functions to pass */ + if (sc.chPrev == '\\') + break; + + sc.SetState(SCE_KVIRC_STRING_FUNCTION); + break; + } + + /* Detecting variables */ + if (sc.ch == '%') + { + /* Allowing escaped variables to pass */ + if (sc.chPrev == '\\') + break; + + sc.SetState(SCE_KVIRC_STRING_VARIABLE); + break; + } + + /* Breaking out of a string when a newline is introduced */ + if (sc.ch == '\r' || sc.ch == '\n') + { + /* Allowing escaped newlines */ + if (sc.chPrev == '\\') + break; + + sc.SetState(SCE_KVIRC_DEFAULT); + break; + } + + break; + + case SCE_KVIRC_FUNCTION: + case SCE_KVIRC_VARIABLE: + + /* Detecting the end of a function/variable (word) */ + if (!IsAWordChar(sc.ch)) + { + sc.SetState(SCE_KVIRC_DEFAULT); + + /* Word has been exited yet the current character + * has yet to be defined - loop without moving + * forward again */ + next = false; + break; + } + + break; + + case SCE_KVIRC_STRING_FUNCTION: + case SCE_KVIRC_STRING_VARIABLE: + + /* A function or variable in a string + * Detecting the end of a function/variable (word) */ + if (!IsAWordChar(sc.ch)) + { + sc.SetState(SCE_KVIRC_STRING); + + /* Word has been exited yet the current character + * has yet to be defined - loop without moving + * forward again */ + next = false; + break; + } + + break; + + case SCE_KVIRC_NUMBER: + + /* Detecting the end of a number */ + if (!IsADigit(sc.ch)) + { + sc.SetState(SCE_KVIRC_DEFAULT); + + /* Number has been exited yet the current character + * has yet to be defined - loop without moving + * forward */ + next = false; + break; + } + + break; + + case SCE_KVIRC_OPERATOR: + + /* Because '%' is an operator but is also the marker for + * a variable, I need to always treat operators as single + * character strings and therefore redo their detection + * after every character */ + sc.SetState(SCE_KVIRC_DEFAULT); + + /* Operator has been exited yet the current character + * has yet to be defined - loop without moving + * forward */ + next = false; + break; + + case SCE_KVIRC_WORD: + + /* Detecting the end of a word */ + if (!IsAWordChar(sc.ch)) + { + /* Checking if the word was actually a keyword - + * fetching the current word, NULL-terminated like + * the keyword list */ + char s[100]; + int wordLen = sc.currentPos - styler.GetStartSegment(); + if (wordLen > 99) + wordLen = 99; /* Include '\0' in buffer */ + int i; + for( i = 0; i < wordLen; ++i ) + { + s[i] = styler.SafeGetCharAt( styler.GetStartSegment() + i ); + } + s[wordLen] = '\0'; + + /* Actually detecting keywords and fixing the state */ + if (keywords.InList(s)) + { + /* The SetState call actually commits the + * previous keyword state */ + sc.ChangeState(SCE_KVIRC_KEYWORD); + } + else if (functionKeywords.InList(s)) + { + // Detecting function keywords and fixing the state + sc.ChangeState(SCE_KVIRC_FUNCTION_KEYWORD); + } + + /* Transitioning to default and committing the previous + * word state */ + sc.SetState(SCE_KVIRC_DEFAULT); + + /* Word has been exited yet the current character + * has yet to be defined - loop without moving + * forward again */ + next = false; + break; + } + + break; + } + } + + /* Indicating processing is complete */ + sc.Complete(); +} + +static void FoldKVIrcDoc(unsigned int startPos, int length, int /*initStyle - unused*/, + WordList *[], Accessor &styler) +{ + /* Based on CMake's folder */ + + /* Exiting if folding isnt enabled */ + if ( styler.GetPropertyInt("fold") == 0 ) + return; + + /* Obtaining current line number*/ + int currentLine = styler.GetLine(startPos); + + /* Obtaining starting character - indentation is done on a line basis, + * not character */ + unsigned int safeStartPos = styler.LineStart( currentLine ); + + /* Initialising current level - this is defined as indentation level + * in the low 12 bits, with flag bits in the upper four bits. + * It looks like two indentation states are maintained in the returned + * 32bit value - 'nextLevel' in the most-significant bits, 'currentLevel' + * in the least-significant bits. Since the next level is the most + * up to date, this must refer to the current state of indentation. + * So the code bitshifts the old current level out of existence to + * get at the actual current state of indentation + * Based on the LexerCPP.cxx line 958 comment */ + int currentLevel = SC_FOLDLEVELBASE; + if (currentLine > 0) + currentLevel = styler.LevelAt(currentLine - 1) >> 16; + int nextLevel = currentLevel; + + // Looping for characters in range + for (unsigned int i = safeStartPos; i < startPos + length; ++i) + { + /* Folding occurs after syntax highlighting, meaning Scintilla + * already knows where the comments are + * Fetching the current state */ + int state = styler.StyleAt(i) & 31; + + switch( styler.SafeGetCharAt(i) ) + { + case '{': + + /* Indenting only when the braces are not contained in + * a comment */ + if (state != SCE_KVIRC_COMMENT && + state != SCE_KVIRC_COMMENTBLOCK) + ++nextLevel; + break; + + case '}': + + /* Outdenting only when the braces are not contained in + * a comment */ + if (state != SCE_KVIRC_COMMENT && + state != SCE_KVIRC_COMMENTBLOCK) + --nextLevel; + break; + + case '\n': + case '\r': + + /* Preparing indentation information to return - combining + * current and next level data */ + int lev = currentLevel | nextLevel << 16; + + /* If the next level increases the indent level, mark the + * current line as a fold point - current level data is + * in the least significant bits */ + if (nextLevel > currentLevel ) + lev |= SC_FOLDLEVELHEADERFLAG; + + /* Updating indentation level if needed */ + if (lev != styler.LevelAt(currentLine)) + styler.SetLevel(currentLine, lev); + + /* Updating variables */ + ++currentLine; + currentLevel = nextLevel; + + /* Dealing with problematic Windows newlines - + * incrementing to avoid the extra newline breaking the + * fold point */ + if (styler.SafeGetCharAt(i) == '\r' && + styler.SafeGetCharAt(i + 1) == '\n') + ++i; + break; + } + } + + /* At this point the data has ended, so presumably the end of the line? + * Preparing indentation information to return - combining current + * and next level data */ + int lev = currentLevel | nextLevel << 16; + + /* If the next level increases the indent level, mark the current + * line as a fold point - current level data is in the least + * significant bits */ + if (nextLevel > currentLevel ) + lev |= SC_FOLDLEVELHEADERFLAG; + + /* Updating indentation level if needed */ + if (lev != styler.LevelAt(currentLine)) + styler.SetLevel(currentLine, lev); +} + +/* Registering wordlists */ +static const char *const kvircWordListDesc[] = { + "primary", + "function_keywords", + 0 +}; + + +/* Registering functions and wordlists */ +LexerModule lmKVIrc(SCLEX_KVIRC, ColouriseKVIrcDoc, "kvirc", FoldKVIrcDoc, + kvircWordListDesc); diff --git a/src/stc/scintilla/lexers/LexLaTeX.cxx b/src/stc/scintilla/lexers/LexLaTeX.cxx new file mode 100644 index 0000000000..7cfa8a197f --- /dev/null +++ b/src/stc/scintilla/lexers/LexLaTeX.cxx @@ -0,0 +1,539 @@ +// Scintilla source code edit control +/** @file LexLaTeX.cxx + ** Lexer for LaTeX2e. + **/ +// Copyright 1998-2001 by Neil Hodgson +// The License.txt file describes the conditions under which this software may be distributed. + +// Modified by G. HU in 2013. Added folding, syntax highting inside math environments, and changed some minor behaviors. + +#include +#include +#include +#include +#include +#include +#include + +#include "ILexer.h" +#include "Scintilla.h" +#include "SciLexer.h" + +#include "PropSetSimple.h" +#include "WordList.h" +#include "LexAccessor.h" +#include "Accessor.h" +#include "StyleContext.h" +#include "CharacterSet.h" +#include "LexerModule.h" +#include "LexerBase.h" + +#ifdef SCI_NAMESPACE +using namespace Scintilla; +#endif + +using namespace std; + +struct latexFoldSave { + latexFoldSave() : structLev(0) { + for (int i = 0; i < 8; ++i) openBegins[i] = 0; + } + latexFoldSave(const latexFoldSave &save) : structLev(save.structLev) { + for (int i = 0; i < 8; ++i) openBegins[i] = save.openBegins[i]; + } + int openBegins[8]; + int structLev; +}; + +class LexerLaTeX : public LexerBase { +private: + vector modes; + void setMode(int line, int mode) { + if (line >= static_cast(modes.size())) modes.resize(line + 1, 0); + modes[line] = mode; + } + int getMode(int line) { + if (line >= 0 && line < static_cast(modes.size())) return modes[line]; + return 0; + } + void truncModes(int numLines) { + if (static_cast(modes.size()) > numLines * 2 + 256) + modes.resize(numLines + 128); + } + + vector saves; + void setSave(int line, const latexFoldSave &save) { + if (line >= static_cast(saves.size())) saves.resize(line + 1); + saves[line] = save; + } + void getSave(int line, latexFoldSave &save) { + if (line >= 0 && line < static_cast(saves.size())) save = saves[line]; + else { + save.structLev = 0; + for (int i = 0; i < 8; ++i) save.openBegins[i] = 0; + } + } + void truncSaves(int numLines) { + if (static_cast(saves.size()) > numLines * 2 + 256) + saves.resize(numLines + 128); + } +public: + static ILexer *LexerFactoryLaTeX() { + return new LexerLaTeX(); + } + void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess); + void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess); +}; + +static bool latexIsSpecial(int ch) { + return (ch == '#') || (ch == '$') || (ch == '%') || (ch == '&') || (ch == '_') || + (ch == '{') || (ch == '}') || (ch == ' '); +} + +static bool latexIsBlank(int ch) { + return (ch == ' ') || (ch == '\t'); +} + +static bool latexIsBlankAndNL(int ch) { + return (ch == ' ') || (ch == '\t') || (ch == '\r') || (ch == '\n'); +} + +static bool latexIsLetter(int ch) { + return IsASCII(ch) && isalpha(ch); +} + +static bool latexIsTagValid(int &i, int l, Accessor &styler) { + while (i < l) { + if (styler.SafeGetCharAt(i) == '{') { + while (i < l) { + i++; + if (styler.SafeGetCharAt(i) == '}') { + return true; + } else if (!latexIsLetter(styler.SafeGetCharAt(i)) && + styler.SafeGetCharAt(i)!='*') { + return false; + } + } + } else if (!latexIsBlank(styler.SafeGetCharAt(i))) { + return false; + } + i++; + } + return false; +} + +static bool latexNextNotBlankIs(int i, Accessor &styler, char needle) { + char ch; + while (i < styler.Length()) { + ch = styler.SafeGetCharAt(i); + if (!latexIsBlankAndNL(ch) && ch != '*') { + if (ch == needle) + return true; + else + return false; + } + i++; + } + return false; +} + +static bool latexLastWordIs(int start, Accessor &styler, const char *needle) { + unsigned int i = 0; + unsigned int l = static_cast(strlen(needle)); + int ini = start-l+1; + char s[32]; + + while (i < l && i < 31) { + s[i] = styler.SafeGetCharAt(ini + i); + i++; + } + s[i] = '\0'; + + return (strcmp(s, needle) == 0); +} + +static bool latexLastWordIsMathEnv(int pos, Accessor &styler) { + int i, j; + char s[32]; + const char *mathEnvs[] = { "align", "alignat", "flalign", "gather", + "multiline", "displaymath", "eqnarray", "equation" }; + if (styler.SafeGetCharAt(pos) != '}') return false; + for (i = pos - 1; i >= 0; --i) { + if (styler.SafeGetCharAt(i) == '{') break; + if (pos - i >= 20) return false; + } + if (i < 0 || i == pos - 1) return false; + ++i; + for (j = 0; i + j < pos; ++j) + s[j] = styler.SafeGetCharAt(i + j); + s[j] = '\0'; + if (j == 0) return false; + if (s[j - 1] == '*') s[--j] = '\0'; + for (i = 0; i < static_cast(sizeof(mathEnvs) / sizeof(const char *)); ++i) + if (strcmp(s, mathEnvs[i]) == 0) return true; + return false; +} + +static inline void latexStateReset(int &mode, int &state) { + switch (mode) { + case 1: state = SCE_L_MATH; break; + case 2: state = SCE_L_MATH2; break; + default: state = SCE_L_DEFAULT; break; + } +} + +// There are cases not handled correctly, like $abcd\textrm{what is $x+y$}z+w$. +// But I think it's already good enough. +void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) { + // startPos is assumed to be the first character of a line + Accessor styler(pAccess, &props); + styler.StartAt(startPos); + int mode = getMode(styler.GetLine(startPos) - 1); + int state = initStyle; + if (state == SCE_L_ERROR || state == SCE_L_SHORTCMD || state == SCE_L_SPECIAL) // should not happen + latexStateReset(mode, state); + + char chNext = styler.SafeGetCharAt(startPos); + char chVerbatimDelim = '\0'; + styler.StartSegment(startPos); + int lengthDoc = startPos + length; + + for (int i = startPos; i < lengthDoc; i++) { + char ch = chNext; + chNext = styler.SafeGetCharAt(i + 1); + + if (styler.IsLeadByte(ch)) { + i++; + chNext = styler.SafeGetCharAt(i + 1); + continue; + } + + if (ch == '\r' || ch == '\n') + setMode(styler.GetLine(i), mode); + + switch (state) { + case SCE_L_DEFAULT : + switch (ch) { + case '\\' : + styler.ColourTo(i - 1, state); + if (latexIsLetter(chNext)) { + state = SCE_L_COMMAND; + } else if (latexIsSpecial(chNext)) { + styler.ColourTo(i + 1, SCE_L_SPECIAL); + i++; + chNext = styler.SafeGetCharAt(i + 1); + } else if (chNext == '\r' || chNext == '\n') { + styler.ColourTo(i, SCE_L_ERROR); + } else if (IsASCII(chNext)) { + styler.ColourTo(i + 1, SCE_L_SHORTCMD); + if (chNext == '(') { + mode = 1; + state = SCE_L_MATH; + } else if (chNext == '[') { + mode = 2; + state = SCE_L_MATH2; + } + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case '$' : + styler.ColourTo(i - 1, state); + if (chNext == '$') { + styler.ColourTo(i + 1, SCE_L_SHORTCMD); + mode = 2; + state = SCE_L_MATH2; + i++; + chNext = styler.SafeGetCharAt(i + 1); + } else { + styler.ColourTo(i, SCE_L_SHORTCMD); + mode = 1; + state = SCE_L_MATH; + } + break; + case '%' : + styler.ColourTo(i - 1, state); + state = SCE_L_COMMENT; + break; + } + break; + // These 3 will never be reached. + case SCE_L_ERROR: + case SCE_L_SPECIAL: + case SCE_L_SHORTCMD: + break; + case SCE_L_COMMAND : + if (!latexIsLetter(chNext)) { + styler.ColourTo(i, state); + if (latexNextNotBlankIs(i + 1, styler, '[' )) { + state = SCE_L_CMDOPT; + } else if (latexLastWordIs(i, styler, "\\begin")) { + state = SCE_L_TAG; + } else if (latexLastWordIs(i, styler, "\\end")) { + state = SCE_L_TAG2; + } else if (latexLastWordIs(i, styler, "\\verb") && chNext != '*' && chNext != ' ') { + chVerbatimDelim = chNext; + state = SCE_L_VERBATIM; + } else { + latexStateReset(mode, state); + } + } + break; + case SCE_L_CMDOPT : + if (ch == ']') { + styler.ColourTo(i, state); + latexStateReset(mode, state); + } + break; + case SCE_L_TAG : + if (latexIsTagValid(i, lengthDoc, styler)) { + styler.ColourTo(i, state); + latexStateReset(mode, state); + if (latexLastWordIs(i, styler, "{verbatim}")) { + state = SCE_L_VERBATIM; + } else if (latexLastWordIs(i, styler, "{comment}")) { + state = SCE_L_COMMENT2; + } else if (latexLastWordIs(i, styler, "{math}") && mode == 0) { + mode = 1; + state = SCE_L_MATH; + } else if (latexLastWordIsMathEnv(i, styler) && mode == 0) { + mode = 2; + state = SCE_L_MATH2; + } + } else { + styler.ColourTo(i, SCE_L_ERROR); + latexStateReset(mode, state); + ch = styler.SafeGetCharAt(i); + if (ch == '\r' || ch == '\n') setMode(styler.GetLine(i), mode); + } + chNext = styler.SafeGetCharAt(i+1); + break; + case SCE_L_TAG2 : + if (latexIsTagValid(i, lengthDoc, styler)) { + styler.ColourTo(i, state); + latexStateReset(mode, state); + } else { + styler.ColourTo(i, SCE_L_ERROR); + latexStateReset(mode, state); + ch = styler.SafeGetCharAt(i); + if (ch == '\r' || ch == '\n') setMode(styler.GetLine(i), mode); + } + chNext = styler.SafeGetCharAt(i+1); + break; + case SCE_L_MATH : + switch (ch) { + case '\\' : + styler.ColourTo(i - 1, state); + if (latexIsLetter(chNext)) { + int match = i + 3; + if (latexLastWordIs(match, styler, "\\end")) { + match++; + if (latexIsTagValid(match, lengthDoc, styler)) { + if (latexLastWordIs(match, styler, "{math}")) + mode = 0; + } + } + state = SCE_L_COMMAND; + } else if (latexIsSpecial(chNext)) { + styler.ColourTo(i + 1, SCE_L_SPECIAL); + i++; + chNext = styler.SafeGetCharAt(i + 1); + } else if (chNext == '\r' || chNext == '\n') { + styler.ColourTo(i, SCE_L_ERROR); + } else if (IsASCII(chNext)) { + if (chNext == ')') { + mode = 0; + state = SCE_L_DEFAULT; + } + styler.ColourTo(i + 1, SCE_L_SHORTCMD); + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case '$' : + styler.ColourTo(i - 1, state); + styler.ColourTo(i, SCE_L_SHORTCMD); + mode = 0; + state = SCE_L_DEFAULT; + break; + case '%' : + styler.ColourTo(i - 1, state); + state = SCE_L_COMMENT; + break; + } + break; + case SCE_L_MATH2 : + switch (ch) { + case '\\' : + styler.ColourTo(i - 1, state); + if (latexIsLetter(chNext)) { + int match = i + 3; + if (latexLastWordIs(match, styler, "\\end")) { + match++; + if (latexIsTagValid(match, lengthDoc, styler)) { + if (latexLastWordIsMathEnv(match, styler)) + mode = 0; + } + } + state = SCE_L_COMMAND; + } else if (latexIsSpecial(chNext)) { + styler.ColourTo(i + 1, SCE_L_SPECIAL); + i++; + chNext = styler.SafeGetCharAt(i + 1); + } else if (chNext == '\r' || chNext == '\n') { + styler.ColourTo(i, SCE_L_ERROR); + } else if (IsASCII(chNext)) { + if (chNext == ']') { + mode = 0; + state = SCE_L_DEFAULT; + } + styler.ColourTo(i + 1, SCE_L_SHORTCMD); + i++; + chNext = styler.SafeGetCharAt(i + 1); + } + break; + case '$' : + styler.ColourTo(i - 1, state); + if (chNext == '$') { + styler.ColourTo(i + 1, SCE_L_SHORTCMD); + i++; + chNext = styler.SafeGetCharAt(i + 1); + mode = 0; + state = SCE_L_DEFAULT; + } else { // This may not be an error, e.g. \begin{equation}\text{$a$}\end{equation} + styler.ColourTo(i, SCE_L_SHORTCMD); + } + break; + case '%' : + styler.ColourTo(i - 1, state); + state = SCE_L_COMMENT; + break; + } + break; + case SCE_L_COMMENT : + if (ch == '\r' || ch == '\n') { + styler.ColourTo(i - 1, state); + latexStateReset(mode, state); + } + break; + case SCE_L_COMMENT2 : + if (ch == '\\') { + int match = i + 3; + if (latexLastWordIs(match, styler, "\\end")) { + match++; + if (latexIsTagValid(match, lengthDoc, styler)) { + if (latexLastWordIs(match, styler, "{comment}")) { + styler.ColourTo(i - 1, state); + state = SCE_L_COMMAND; + } + } + } + } + break; + case SCE_L_VERBATIM : + if (ch == '\\') { + int match = i + 3; + if (latexLastWordIs(match, styler, "\\end")) { + match++; + if (latexIsTagValid(match, lengthDoc, styler)) { + if (latexLastWordIs(match, styler, "{verbatim}")) { + styler.ColourTo(i - 1, state); + state = SCE_L_COMMAND; + } + } + } + } else if (chNext == chVerbatimDelim) { + styler.ColourTo(i + 1, state); + latexStateReset(mode, state); + chVerbatimDelim = '\0'; + i++; + chNext = styler.SafeGetCharAt(i + 1); + } else if (chVerbatimDelim != '\0' && (ch == '\n' || ch == '\r')) { + styler.ColourTo(i, SCE_L_ERROR); + latexStateReset(mode, state); + chVerbatimDelim = '\0'; + } + break; + } + } + if (lengthDoc == styler.Length()) truncModes(styler.GetLine(lengthDoc - 1)); + styler.ColourTo(lengthDoc - 1, state); + styler.Flush(); +} + +static int latexFoldSaveToInt(const latexFoldSave &save) { + int sum = 0; + for (int i = 0; i <= save.structLev; ++i) + sum += save.openBegins[i]; + return ((sum + save.structLev + SC_FOLDLEVELBASE) & SC_FOLDLEVELNUMBERMASK); +} + +// Change folding state while processing a line +// Return the level before the first relevant command +void SCI_METHOD LexerLaTeX::Fold(unsigned int startPos, int length, int, IDocument *pAccess) { + const char *structWords[7] = {"part", "chapter", "section", "subsection", + "subsubsection", "paragraph", "subparagraph"}; + Accessor styler(pAccess, &props); + unsigned int endPos = startPos + length; + int curLine = styler.GetLine(startPos); + latexFoldSave save; + getSave(curLine - 1, save); + do { + char ch, buf[16]; + int i, j, lev = -1; + bool needFold = false; + for (i = static_cast(startPos); i < static_cast(endPos); ++i) { + ch = styler.SafeGetCharAt(i); + if (ch == '\r' || ch == '\n') break; + if (ch != '\\' || styler.StyleAt(i) != SCE_L_COMMAND) continue; + for (j = 0; j < 15 && i + 1 < static_cast(endPos); ++j, ++i) { + buf[j] = styler.SafeGetCharAt(i + 1); + if (!latexIsLetter(buf[j])) break; + } + buf[j] = '\0'; + if (strcmp(buf, "begin") == 0) { + if (lev < 0) lev = latexFoldSaveToInt(save); + ++save.openBegins[save.structLev]; + needFold = true; + } + else if (strcmp(buf, "end") == 0) { + while (save.structLev > 0 && save.openBegins[save.structLev] == 0) + --save.structLev; + if (lev < 0) lev = latexFoldSaveToInt(save); + if (save.openBegins[save.structLev] > 0) --save.openBegins[save.structLev]; + } + else { + for (j = 0; j < 7; ++j) + if (strcmp(buf, structWords[j]) == 0) break; + if (j >= 7) continue; + save.structLev = j; // level before the command + for (j = save.structLev + 1; j < 8; ++j) { + save.openBegins[save.structLev] += save.openBegins[j]; + save.openBegins[j] = 0; + } + if (lev < 0) lev = latexFoldSaveToInt(save); + ++save.structLev; // level after the command + needFold = true; + } + } + if (lev < 0) lev = latexFoldSaveToInt(save); + if (needFold) lev |= SC_FOLDLEVELHEADERFLAG; + styler.SetLevel(curLine, lev); + setSave(curLine, save); + ++curLine; + startPos = styler.LineStart(curLine); + if (static_cast(startPos) == styler.Length()) { + lev = latexFoldSaveToInt(save); + styler.SetLevel(curLine, lev); + setSave(curLine, save); + truncSaves(curLine); + } + } while (startPos < endPos); + styler.Flush(); +} + +static const char *const emptyWordListDesc[] = { + 0 +}; + +LexerModule lmLatex(SCLEX_LATEX, LexerLaTeX::LexerFactoryLaTeX, "latex", emptyWordListDesc); diff --git a/src/stc/scintilla/lexers/LexLisp.cxx b/src/stc/scintilla/lexers/LexLisp.cxx index 08f765ad63..8dd6bd9c43 100644 --- a/src/stc/scintilla/lexers/LexLisp.cxx +++ b/src/stc/scintilla/lexers/LexLisp.cxx @@ -33,7 +33,7 @@ using namespace Scintilla; #define SCE_LISP_MACRO_DISPATCH 31 static inline bool isLispoperator(char ch) { - if (isascii(ch) && isalnum(ch)) + if (IsASCII(ch) && isalnum(ch)) return false; if (ch == '\'' || ch == '`' || ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == '{' || ch == '}') return true; @@ -41,7 +41,7 @@ static inline bool isLispoperator(char ch) { } static inline bool isLispwordstart(char ch) { - return isascii(ch) && ch != ';' && !isspacechar(ch) && !isLispoperator(ch) && + return IsASCII(ch) && ch != ';' && !isspacechar(ch) && !isLispoperator(ch) && ch != '\n' && ch != '\r' && ch != '\"'; } @@ -142,7 +142,7 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W } } } else if (state == SCE_LISP_MACRO_DISPATCH) { - if (!(isascii(ch) && isdigit(ch))) { + if (!(IsASCII(ch) && isdigit(ch))) { if (ch != 'r' && ch != 'R' && (i - styler.GetStartSegment()) > 1) { state = SCE_LISP_DEFAULT; } else { diff --git a/src/stc/scintilla/lexers/LexLout.cxx b/src/stc/scintilla/lexers/LexLout.cxx index 985b93b49c..83eb97ec89 100644 --- a/src/stc/scintilla/lexers/LexLout.cxx +++ b/src/stc/scintilla/lexers/LexLout.cxx @@ -151,7 +151,7 @@ static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[], char chNext = styler[startPos]; bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0; int styleNext = styler.StyleAt(startPos); - char s[10]; + char s[10] = ""; for (unsigned int i = startPos; i < endPos; i++) { char ch = chNext; diff --git a/src/stc/scintilla/lexers/LexLua.cxx b/src/stc/scintilla/lexers/LexLua.cxx index 9e48efcd92..62bb44dd1c 100644 --- a/src/stc/scintilla/lexers/LexLua.cxx +++ b/src/stc/scintilla/lexers/LexLua.cxx @@ -132,55 +132,38 @@ static void ColouriseLuaDoc( if (sc.state == SCE_LUA_OPERATOR) { if (sc.ch == ':' && sc.chPrev == ':') { // ::