Updated to Scintilla 1.67

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@37898 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn 2006-03-08 01:48:03 +00:00
parent 728f972bce
commit 1e9bafca0f
149 changed files with 19069 additions and 3677 deletions

View File

@ -59,19 +59,24 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexAsn1.obj \
$(OBJS)\stcdll_LexBaan.obj \
$(OBJS)\stcdll_LexBash.obj \
$(OBJS)\stcdll_LexBasic.obj \
$(OBJS)\stcdll_LexBullant.obj \
$(OBJS)\stcdll_LexCLW.obj \
$(OBJS)\stcdll_LexCPP.obj \
$(OBJS)\stcdll_LexCSS.obj \
$(OBJS)\stcdll_LexCaml.obj \
$(OBJS)\stcdll_LexCsound.obj \
$(OBJS)\stcdll_LexConf.obj \
$(OBJS)\stcdll_LexCrontab.obj \
$(OBJS)\stcdll_LexEScript.obj \
$(OBJS)\stcdll_LexEiffel.obj \
$(OBJS)\stcdll_LexErlang.obj \
$(OBJS)\stcdll_LexFlagship.obj \
$(OBJS)\stcdll_LexForth.obj \
$(OBJS)\stcdll_LexFortran.obj \
$(OBJS)\stcdll_LexGui4Cli.obj \
$(OBJS)\stcdll_LexHTML.obj \
$(OBJS)\stcdll_LexHaskell.obj \
$(OBJS)\stcdll_LexKix.obj \
$(OBJS)\stcdll_LexLisp.obj \
$(OBJS)\stcdll_LexLout.obj \
@ -89,8 +94,11 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexPascal.obj \
$(OBJS)\stcdll_LexPerl.obj \
$(OBJS)\stcdll_LexPython.obj \
$(OBJS)\stcdll_LexRebol.obj \
$(OBJS)\stcdll_LexRuby.obj \
$(OBJS)\stcdll_LexSQL.obj \
$(OBJS)\stcdll_LexSmalltalk.obj \
$(OBJS)\stcdll_LexTADS3.obj \
$(OBJS)\stcdll_LexScriptol.obj \
$(OBJS)\stcdll_LexSpecman.obj \
$(OBJS)\stcdll_LexTeX.obj \
@ -139,19 +147,24 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexAsn1.obj \
$(OBJS)\stclib_LexBaan.obj \
$(OBJS)\stclib_LexBash.obj \
$(OBJS)\stclib_LexBasic.obj \
$(OBJS)\stclib_LexBullant.obj \
$(OBJS)\stclib_LexCLW.obj \
$(OBJS)\stclib_LexCPP.obj \
$(OBJS)\stclib_LexCSS.obj \
$(OBJS)\stclib_LexCaml.obj \
$(OBJS)\stclib_LexCsound.obj \
$(OBJS)\stclib_LexConf.obj \
$(OBJS)\stclib_LexCrontab.obj \
$(OBJS)\stclib_LexEScript.obj \
$(OBJS)\stclib_LexEiffel.obj \
$(OBJS)\stclib_LexErlang.obj \
$(OBJS)\stclib_LexFlagship.obj \
$(OBJS)\stclib_LexForth.obj \
$(OBJS)\stclib_LexFortran.obj \
$(OBJS)\stclib_LexGui4Cli.obj \
$(OBJS)\stclib_LexHTML.obj \
$(OBJS)\stclib_LexHaskell.obj \
$(OBJS)\stclib_LexKix.obj \
$(OBJS)\stclib_LexLisp.obj \
$(OBJS)\stclib_LexLout.obj \
@ -169,8 +182,11 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexPascal.obj \
$(OBJS)\stclib_LexPerl.obj \
$(OBJS)\stclib_LexPython.obj \
$(OBJS)\stclib_LexRebol.obj \
$(OBJS)\stclib_LexRuby.obj \
$(OBJS)\stclib_LexSQL.obj \
$(OBJS)\stclib_LexSmalltalk.obj \
$(OBJS)\stclib_LexTADS3.obj \
$(OBJS)\stclib_LexScriptol.obj \
$(OBJS)\stclib_LexSpecman.obj \
$(OBJS)\stclib_LexTeX.obj \
@ -460,6 +476,9 @@ $(OBJS)\stcdll_LexBaan.obj: ../../src/stc\scintilla\src\LexBaan.cxx
$(OBJS)\stcdll_LexBash.obj: ../../src/stc\scintilla\src\LexBash.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexBasic.obj: ../../src/stc\scintilla\src\LexBasic.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexBullant.obj: ../../src/stc\scintilla\src\LexBullant.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
@ -472,6 +491,12 @@ $(OBJS)\stcdll_LexCPP.obj: ../../src/stc\scintilla\src\LexCPP.cxx
$(OBJS)\stcdll_LexCSS.obj: ../../src/stc\scintilla\src\LexCSS.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexCaml.obj: ../../src/stc\scintilla\src\LexCaml.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexCsound.obj: ../../src/stc\scintilla\src\LexCsound.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexConf.obj: ../../src/stc\scintilla\src\LexConf.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
@ -487,6 +512,9 @@ $(OBJS)\stcdll_LexEiffel.obj: ../../src/stc\scintilla\src\LexEiffel.cxx
$(OBJS)\stcdll_LexErlang.obj: ../../src/stc\scintilla\src\LexErlang.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexFlagship.obj: ../../src/stc\scintilla\src\LexFlagship.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexForth.obj: ../../src/stc\scintilla\src\LexForth.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
@ -499,6 +527,9 @@ $(OBJS)\stcdll_LexGui4Cli.obj: ../../src/stc\scintilla\src\LexGui4Cli.cxx
$(OBJS)\stcdll_LexHTML.obj: ../../src/stc\scintilla\src\LexHTML.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexHaskell.obj: ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexKix.obj: ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
@ -550,12 +581,21 @@ $(OBJS)\stcdll_LexPerl.obj: ../../src/stc\scintilla\src\LexPerl.cxx
$(OBJS)\stcdll_LexPython.obj: ../../src/stc\scintilla\src\LexPython.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexRebol.obj: ../../src/stc\scintilla\src\LexRebol.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexRuby.obj: ../../src/stc\scintilla\src\LexRuby.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexSQL.obj: ../../src/stc\scintilla\src\LexSQL.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexSmalltalk.obj: ../../src/stc\scintilla\src\LexSmalltalk.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexTADS3.obj: ../../src/stc\scintilla\src\LexTADS3.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
@ -673,6 +713,9 @@ $(OBJS)\stclib_LexBaan.obj: ../../src/stc\scintilla\src\LexBaan.cxx
$(OBJS)\stclib_LexBash.obj: ../../src/stc\scintilla\src\LexBash.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexBasic.obj: ../../src/stc\scintilla\src\LexBasic.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexBullant.obj: ../../src/stc\scintilla\src\LexBullant.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
@ -685,6 +728,12 @@ $(OBJS)\stclib_LexCPP.obj: ../../src/stc\scintilla\src\LexCPP.cxx
$(OBJS)\stclib_LexCSS.obj: ../../src/stc\scintilla\src\LexCSS.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexCaml.obj: ../../src/stc\scintilla\src\LexCaml.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexCsound.obj: ../../src/stc\scintilla\src\LexCsound.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexConf.obj: ../../src/stc\scintilla\src\LexConf.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
@ -700,6 +749,9 @@ $(OBJS)\stclib_LexEiffel.obj: ../../src/stc\scintilla\src\LexEiffel.cxx
$(OBJS)\stclib_LexErlang.obj: ../../src/stc\scintilla\src\LexErlang.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexFlagship.obj: ../../src/stc\scintilla\src\LexFlagship.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexForth.obj: ../../src/stc\scintilla\src\LexForth.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
@ -712,6 +764,9 @@ $(OBJS)\stclib_LexGui4Cli.obj: ../../src/stc\scintilla\src\LexGui4Cli.cxx
$(OBJS)\stclib_LexHTML.obj: ../../src/stc\scintilla\src\LexHTML.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexHaskell.obj: ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexKix.obj: ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
@ -763,12 +818,21 @@ $(OBJS)\stclib_LexPerl.obj: ../../src/stc\scintilla\src\LexPerl.cxx
$(OBJS)\stclib_LexPython.obj: ../../src/stc\scintilla\src\LexPython.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexRebol.obj: ../../src/stc\scintilla\src\LexRebol.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexRuby.obj: ../../src/stc\scintilla\src\LexRuby.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexSQL.obj: ../../src/stc\scintilla\src\LexSQL.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexSmalltalk.obj: ../../src/stc\scintilla\src\LexSmalltalk.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexTADS3.obj: ../../src/stc\scintilla\src\LexTADS3.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**

View File

@ -52,19 +52,24 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexAsn1.o \
$(OBJS)\stcdll_LexBaan.o \
$(OBJS)\stcdll_LexBash.o \
$(OBJS)\stcdll_LexBasic.o \
$(OBJS)\stcdll_LexBullant.o \
$(OBJS)\stcdll_LexCLW.o \
$(OBJS)\stcdll_LexCPP.o \
$(OBJS)\stcdll_LexCSS.o \
$(OBJS)\stcdll_LexCaml.o \
$(OBJS)\stcdll_LexCsound.o \
$(OBJS)\stcdll_LexConf.o \
$(OBJS)\stcdll_LexCrontab.o \
$(OBJS)\stcdll_LexEScript.o \
$(OBJS)\stcdll_LexEiffel.o \
$(OBJS)\stcdll_LexErlang.o \
$(OBJS)\stcdll_LexFlagship.o \
$(OBJS)\stcdll_LexForth.o \
$(OBJS)\stcdll_LexFortran.o \
$(OBJS)\stcdll_LexGui4Cli.o \
$(OBJS)\stcdll_LexHTML.o \
$(OBJS)\stcdll_LexHaskell.o \
$(OBJS)\stcdll_LexKix.o \
$(OBJS)\stcdll_LexLisp.o \
$(OBJS)\stcdll_LexLout.o \
@ -82,8 +87,11 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexPascal.o \
$(OBJS)\stcdll_LexPerl.o \
$(OBJS)\stcdll_LexPython.o \
$(OBJS)\stcdll_LexRebol.o \
$(OBJS)\stcdll_LexRuby.o \
$(OBJS)\stcdll_LexSQL.o \
$(OBJS)\stcdll_LexSmalltalk.o \
$(OBJS)\stcdll_LexTADS3.o \
$(OBJS)\stcdll_LexScriptol.o \
$(OBJS)\stcdll_LexSpecman.o \
$(OBJS)\stcdll_LexTeX.o \
@ -132,19 +140,24 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexAsn1.o \
$(OBJS)\stclib_LexBaan.o \
$(OBJS)\stclib_LexBash.o \
$(OBJS)\stclib_LexBasic.o \
$(OBJS)\stclib_LexBullant.o \
$(OBJS)\stclib_LexCLW.o \
$(OBJS)\stclib_LexCPP.o \
$(OBJS)\stclib_LexCSS.o \
$(OBJS)\stclib_LexCaml.o \
$(OBJS)\stclib_LexCsound.o \
$(OBJS)\stclib_LexConf.o \
$(OBJS)\stclib_LexCrontab.o \
$(OBJS)\stclib_LexEScript.o \
$(OBJS)\stclib_LexEiffel.o \
$(OBJS)\stclib_LexErlang.o \
$(OBJS)\stclib_LexFlagship.o \
$(OBJS)\stclib_LexForth.o \
$(OBJS)\stclib_LexFortran.o \
$(OBJS)\stclib_LexGui4Cli.o \
$(OBJS)\stclib_LexHTML.o \
$(OBJS)\stclib_LexHaskell.o \
$(OBJS)\stclib_LexKix.o \
$(OBJS)\stclib_LexLisp.o \
$(OBJS)\stclib_LexLout.o \
@ -162,8 +175,11 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexPascal.o \
$(OBJS)\stclib_LexPerl.o \
$(OBJS)\stclib_LexPython.o \
$(OBJS)\stclib_LexRebol.o \
$(OBJS)\stclib_LexRuby.o \
$(OBJS)\stclib_LexSQL.o \
$(OBJS)\stclib_LexSmalltalk.o \
$(OBJS)\stclib_LexTADS3.o \
$(OBJS)\stclib_LexScriptol.o \
$(OBJS)\stclib_LexSpecman.o \
$(OBJS)\stclib_LexTeX.o \
@ -450,6 +466,9 @@ $(OBJS)\stcdll_LexBaan.o: ../../src/stc/scintilla/src/LexBaan.cxx
$(OBJS)\stcdll_LexBash.o: ../../src/stc/scintilla/src/LexBash.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexBasic.o: ../../src/stc/scintilla/src/LexBasic.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexBullant.o: ../../src/stc/scintilla/src/LexBullant.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
@ -462,6 +481,12 @@ $(OBJS)\stcdll_LexCPP.o: ../../src/stc/scintilla/src/LexCPP.cxx
$(OBJS)\stcdll_LexCSS.o: ../../src/stc/scintilla/src/LexCSS.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexCaml.o: ../../src/stc/scintilla/src/LexCaml.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexCsound.o: ../../src/stc/scintilla/src/LexCsound.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexConf.o: ../../src/stc/scintilla/src/LexConf.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
@ -477,6 +502,9 @@ $(OBJS)\stcdll_LexEiffel.o: ../../src/stc/scintilla/src/LexEiffel.cxx
$(OBJS)\stcdll_LexErlang.o: ../../src/stc/scintilla/src/LexErlang.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexFlagship.o: ../../src/stc/scintilla/src/LexFlagship.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexForth.o: ../../src/stc/scintilla/src/LexForth.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
@ -489,6 +517,9 @@ $(OBJS)\stcdll_LexGui4Cli.o: ../../src/stc/scintilla/src/LexGui4Cli.cxx
$(OBJS)\stcdll_LexHTML.o: ../../src/stc/scintilla/src/LexHTML.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexHaskell.o: ../../src/stc/scintilla/src/LexHaskell.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexKix.o: ../../src/stc/scintilla/src/LexKix.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
@ -540,12 +571,21 @@ $(OBJS)\stcdll_LexPerl.o: ../../src/stc/scintilla/src/LexPerl.cxx
$(OBJS)\stcdll_LexPython.o: ../../src/stc/scintilla/src/LexPython.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexRebol.o: ../../src/stc/scintilla/src/LexRebol.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexRuby.o: ../../src/stc/scintilla/src/LexRuby.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexSQL.o: ../../src/stc/scintilla/src/LexSQL.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexSmalltalk.o: ../../src/stc/scintilla/src/LexSmalltalk.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexTADS3.o: ../../src/stc/scintilla/src/LexTADS3.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexScriptol.o: ../../src/stc/scintilla/src/LexScriptol.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
@ -663,6 +703,9 @@ $(OBJS)\stclib_LexBaan.o: ../../src/stc/scintilla/src/LexBaan.cxx
$(OBJS)\stclib_LexBash.o: ../../src/stc/scintilla/src/LexBash.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexBasic.o: ../../src/stc/scintilla/src/LexBasic.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexBullant.o: ../../src/stc/scintilla/src/LexBullant.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
@ -675,6 +718,12 @@ $(OBJS)\stclib_LexCPP.o: ../../src/stc/scintilla/src/LexCPP.cxx
$(OBJS)\stclib_LexCSS.o: ../../src/stc/scintilla/src/LexCSS.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexCaml.o: ../../src/stc/scintilla/src/LexCaml.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexCsound.o: ../../src/stc/scintilla/src/LexCsound.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexConf.o: ../../src/stc/scintilla/src/LexConf.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
@ -690,6 +739,9 @@ $(OBJS)\stclib_LexEiffel.o: ../../src/stc/scintilla/src/LexEiffel.cxx
$(OBJS)\stclib_LexErlang.o: ../../src/stc/scintilla/src/LexErlang.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexFlagship.o: ../../src/stc/scintilla/src/LexFlagship.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexForth.o: ../../src/stc/scintilla/src/LexForth.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
@ -702,6 +754,9 @@ $(OBJS)\stclib_LexGui4Cli.o: ../../src/stc/scintilla/src/LexGui4Cli.cxx
$(OBJS)\stclib_LexHTML.o: ../../src/stc/scintilla/src/LexHTML.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexHaskell.o: ../../src/stc/scintilla/src/LexHaskell.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexKix.o: ../../src/stc/scintilla/src/LexKix.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
@ -753,12 +808,21 @@ $(OBJS)\stclib_LexPerl.o: ../../src/stc/scintilla/src/LexPerl.cxx
$(OBJS)\stclib_LexPython.o: ../../src/stc/scintilla/src/LexPython.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexRebol.o: ../../src/stc/scintilla/src/LexRebol.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexRuby.o: ../../src/stc/scintilla/src/LexRuby.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexSQL.o: ../../src/stc/scintilla/src/LexSQL.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexSmalltalk.o: ../../src/stc/scintilla/src/LexSmalltalk.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexTADS3.o: ../../src/stc/scintilla/src/LexTADS3.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexScriptol.o: ../../src/stc/scintilla/src/LexScriptol.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<

View File

@ -55,19 +55,24 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexAsn1.obj \
$(OBJS)\stcdll_LexBaan.obj \
$(OBJS)\stcdll_LexBash.obj \
$(OBJS)\stcdll_LexBasic.obj \
$(OBJS)\stcdll_LexBullant.obj \
$(OBJS)\stcdll_LexCLW.obj \
$(OBJS)\stcdll_LexCPP.obj \
$(OBJS)\stcdll_LexCSS.obj \
$(OBJS)\stcdll_LexCaml.obj \
$(OBJS)\stcdll_LexCsound.obj \
$(OBJS)\stcdll_LexConf.obj \
$(OBJS)\stcdll_LexCrontab.obj \
$(OBJS)\stcdll_LexEScript.obj \
$(OBJS)\stcdll_LexEiffel.obj \
$(OBJS)\stcdll_LexErlang.obj \
$(OBJS)\stcdll_LexFlagship.obj \
$(OBJS)\stcdll_LexForth.obj \
$(OBJS)\stcdll_LexFortran.obj \
$(OBJS)\stcdll_LexGui4Cli.obj \
$(OBJS)\stcdll_LexHTML.obj \
$(OBJS)\stcdll_LexHaskell.obj \
$(OBJS)\stcdll_LexKix.obj \
$(OBJS)\stcdll_LexLisp.obj \
$(OBJS)\stcdll_LexLout.obj \
@ -85,8 +90,11 @@ STCDLL_OBJECTS = \
$(OBJS)\stcdll_LexPascal.obj \
$(OBJS)\stcdll_LexPerl.obj \
$(OBJS)\stcdll_LexPython.obj \
$(OBJS)\stcdll_LexRebol.obj \
$(OBJS)\stcdll_LexRuby.obj \
$(OBJS)\stcdll_LexSQL.obj \
$(OBJS)\stcdll_LexSmalltalk.obj \
$(OBJS)\stcdll_LexTADS3.obj \
$(OBJS)\stcdll_LexScriptol.obj \
$(OBJS)\stcdll_LexSpecman.obj \
$(OBJS)\stcdll_LexTeX.obj \
@ -137,19 +145,24 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexAsn1.obj \
$(OBJS)\stclib_LexBaan.obj \
$(OBJS)\stclib_LexBash.obj \
$(OBJS)\stclib_LexBasic.obj \
$(OBJS)\stclib_LexBullant.obj \
$(OBJS)\stclib_LexCLW.obj \
$(OBJS)\stclib_LexCPP.obj \
$(OBJS)\stclib_LexCSS.obj \
$(OBJS)\stclib_LexCaml.obj \
$(OBJS)\stclib_LexCsound.obj \
$(OBJS)\stclib_LexConf.obj \
$(OBJS)\stclib_LexCrontab.obj \
$(OBJS)\stclib_LexEScript.obj \
$(OBJS)\stclib_LexEiffel.obj \
$(OBJS)\stclib_LexErlang.obj \
$(OBJS)\stclib_LexFlagship.obj \
$(OBJS)\stclib_LexForth.obj \
$(OBJS)\stclib_LexFortran.obj \
$(OBJS)\stclib_LexGui4Cli.obj \
$(OBJS)\stclib_LexHTML.obj \
$(OBJS)\stclib_LexHaskell.obj \
$(OBJS)\stclib_LexKix.obj \
$(OBJS)\stclib_LexLisp.obj \
$(OBJS)\stclib_LexLout.obj \
@ -167,8 +180,11 @@ STCLIB_OBJECTS = \
$(OBJS)\stclib_LexPascal.obj \
$(OBJS)\stclib_LexPerl.obj \
$(OBJS)\stclib_LexPython.obj \
$(OBJS)\stclib_LexRebol.obj \
$(OBJS)\stclib_LexRuby.obj \
$(OBJS)\stclib_LexSQL.obj \
$(OBJS)\stclib_LexSmalltalk.obj \
$(OBJS)\stclib_LexTADS3.obj \
$(OBJS)\stclib_LexScriptol.obj \
$(OBJS)\stclib_LexSpecman.obj \
$(OBJS)\stclib_LexTeX.obj \
@ -544,6 +560,9 @@ $(OBJS)\stcdll_LexBaan.obj: ../../src/stc\scintilla\src\LexBaan.cxx
$(OBJS)\stcdll_LexBash.obj: ../../src/stc\scintilla\src\LexBash.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexBasic.obj: ../../src/stc\scintilla\src\LexBasic.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexBullant.obj: ../../src/stc\scintilla\src\LexBullant.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
@ -556,6 +575,12 @@ $(OBJS)\stcdll_LexCPP.obj: ../../src/stc\scintilla\src\LexCPP.cxx
$(OBJS)\stcdll_LexCSS.obj: ../../src/stc\scintilla\src\LexCSS.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexCaml.obj: ../../src/stc\scintilla\src\LexCaml.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexCsound.obj: ../../src/stc\scintilla\src\LexCsound.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexConf.obj: ../../src/stc\scintilla\src\LexConf.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
@ -571,6 +596,9 @@ $(OBJS)\stcdll_LexEiffel.obj: ../../src/stc\scintilla\src\LexEiffel.cxx
$(OBJS)\stcdll_LexErlang.obj: ../../src/stc\scintilla\src\LexErlang.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexFlagship.obj: ../../src/stc\scintilla\src\LexFlagship.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexForth.obj: ../../src/stc\scintilla\src\LexForth.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
@ -583,6 +611,9 @@ $(OBJS)\stcdll_LexGui4Cli.obj: ../../src/stc\scintilla\src\LexGui4Cli.cxx
$(OBJS)\stcdll_LexHTML.obj: ../../src/stc\scintilla\src\LexHTML.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexHaskell.obj: ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexKix.obj: ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
@ -634,12 +665,21 @@ $(OBJS)\stcdll_LexPerl.obj: ../../src/stc\scintilla\src\LexPerl.cxx
$(OBJS)\stcdll_LexPython.obj: ../../src/stc\scintilla\src\LexPython.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexRebol.obj: ../../src/stc\scintilla\src\LexRebol.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexRuby.obj: ../../src/stc\scintilla\src\LexRuby.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexSQL.obj: ../../src/stc\scintilla\src\LexSQL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexSmalltalk.obj: ../../src/stc\scintilla\src\LexSmalltalk.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexTADS3.obj: ../../src/stc\scintilla\src\LexTADS3.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
@ -757,6 +797,9 @@ $(OBJS)\stclib_LexBaan.obj: ../../src/stc\scintilla\src\LexBaan.cxx
$(OBJS)\stclib_LexBash.obj: ../../src/stc\scintilla\src\LexBash.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexBasic.obj: ../../src/stc\scintilla\src\LexBasic.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexBullant.obj: ../../src/stc\scintilla\src\LexBullant.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
@ -769,6 +812,12 @@ $(OBJS)\stclib_LexCPP.obj: ../../src/stc\scintilla\src\LexCPP.cxx
$(OBJS)\stclib_LexCSS.obj: ../../src/stc\scintilla\src\LexCSS.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexCaml.obj: ../../src/stc\scintilla\src\LexCaml.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexCsound.obj: ../../src/stc\scintilla\src\LexCsound.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexConf.obj: ../../src/stc\scintilla\src\LexConf.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
@ -784,6 +833,9 @@ $(OBJS)\stclib_LexEiffel.obj: ../../src/stc\scintilla\src\LexEiffel.cxx
$(OBJS)\stclib_LexErlang.obj: ../../src/stc\scintilla\src\LexErlang.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexFlagship.obj: ../../src/stc\scintilla\src\LexFlagship.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexForth.obj: ../../src/stc\scintilla\src\LexForth.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
@ -796,6 +848,9 @@ $(OBJS)\stclib_LexGui4Cli.obj: ../../src/stc\scintilla\src\LexGui4Cli.cxx
$(OBJS)\stclib_LexHTML.obj: ../../src/stc\scintilla\src\LexHTML.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexHaskell.obj: ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexKix.obj: ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
@ -847,12 +902,21 @@ $(OBJS)\stclib_LexPerl.obj: ../../src/stc\scintilla\src\LexPerl.cxx
$(OBJS)\stclib_LexPython.obj: ../../src/stc\scintilla\src\LexPython.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexRebol.obj: ../../src/stc\scintilla\src\LexRebol.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexRuby.obj: ../../src/stc\scintilla\src\LexRuby.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexSQL.obj: ../../src/stc\scintilla\src\LexSQL.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexSmalltalk.obj: ../../src/stc\scintilla\src\LexSmalltalk.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexTADS3.obj: ../../src/stc\scintilla\src\LexTADS3.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexScriptol.obj: ../../src/stc\scintilla\src\LexScriptol.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**

View File

@ -252,19 +252,24 @@ STCDLL_OBJECTS = &
$(OBJS)\stcdll_LexAsn1.obj &
$(OBJS)\stcdll_LexBaan.obj &
$(OBJS)\stcdll_LexBash.obj &
$(OBJS)\stcdll_LexBasic.obj &
$(OBJS)\stcdll_LexBullant.obj &
$(OBJS)\stcdll_LexCLW.obj &
$(OBJS)\stcdll_LexCPP.obj &
$(OBJS)\stcdll_LexCSS.obj &
$(OBJS)\stcdll_LexCaml.obj &
$(OBJS)\stcdll_LexCsound.obj &
$(OBJS)\stcdll_LexConf.obj &
$(OBJS)\stcdll_LexCrontab.obj &
$(OBJS)\stcdll_LexEScript.obj &
$(OBJS)\stcdll_LexEiffel.obj &
$(OBJS)\stcdll_LexErlang.obj &
$(OBJS)\stcdll_LexFlagship.obj &
$(OBJS)\stcdll_LexForth.obj &
$(OBJS)\stcdll_LexFortran.obj &
$(OBJS)\stcdll_LexGui4Cli.obj &
$(OBJS)\stcdll_LexHTML.obj &
$(OBJS)\stcdll_LexHaskell.obj &
$(OBJS)\stcdll_LexKix.obj &
$(OBJS)\stcdll_LexLisp.obj &
$(OBJS)\stcdll_LexLout.obj &
@ -282,8 +287,11 @@ STCDLL_OBJECTS = &
$(OBJS)\stcdll_LexPascal.obj &
$(OBJS)\stcdll_LexPerl.obj &
$(OBJS)\stcdll_LexPython.obj &
$(OBJS)\stcdll_LexRebol.obj &
$(OBJS)\stcdll_LexRuby.obj &
$(OBJS)\stcdll_LexSQL.obj &
$(OBJS)\stcdll_LexSmalltalk.obj &
$(OBJS)\stcdll_LexTADS3.obj &
$(OBJS)\stcdll_LexScriptol.obj &
$(OBJS)\stcdll_LexSpecman.obj &
$(OBJS)\stcdll_LexTeX.obj &
@ -332,19 +340,24 @@ STCLIB_OBJECTS = &
$(OBJS)\stclib_LexAsn1.obj &
$(OBJS)\stclib_LexBaan.obj &
$(OBJS)\stclib_LexBash.obj &
$(OBJS)\stclib_LexBasic.obj &
$(OBJS)\stclib_LexBullant.obj &
$(OBJS)\stclib_LexCLW.obj &
$(OBJS)\stclib_LexCPP.obj &
$(OBJS)\stclib_LexCSS.obj &
$(OBJS)\stclib_LexCaml.obj &
$(OBJS)\stclib_LexCsound.obj &
$(OBJS)\stclib_LexConf.obj &
$(OBJS)\stclib_LexCrontab.obj &
$(OBJS)\stclib_LexEScript.obj &
$(OBJS)\stclib_LexEiffel.obj &
$(OBJS)\stclib_LexErlang.obj &
$(OBJS)\stclib_LexFlagship.obj &
$(OBJS)\stclib_LexForth.obj &
$(OBJS)\stclib_LexFortran.obj &
$(OBJS)\stclib_LexGui4Cli.obj &
$(OBJS)\stclib_LexHTML.obj &
$(OBJS)\stclib_LexHaskell.obj &
$(OBJS)\stclib_LexKix.obj &
$(OBJS)\stclib_LexLisp.obj &
$(OBJS)\stclib_LexLout.obj &
@ -362,8 +375,11 @@ STCLIB_OBJECTS = &
$(OBJS)\stclib_LexPascal.obj &
$(OBJS)\stclib_LexPerl.obj &
$(OBJS)\stclib_LexPython.obj &
$(OBJS)\stclib_LexRebol.obj &
$(OBJS)\stclib_LexRuby.obj &
$(OBJS)\stclib_LexSQL.obj &
$(OBJS)\stclib_LexSmalltalk.obj &
$(OBJS)\stclib_LexTADS3.obj &
$(OBJS)\stclib_LexScriptol.obj &
$(OBJS)\stclib_LexSpecman.obj &
$(OBJS)\stclib_LexTeX.obj &
@ -492,6 +508,9 @@ $(OBJS)\stcdll_LexBaan.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexBaan.cx
$(OBJS)\stcdll_LexBash.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexBash.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexBasic.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexBasic.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexBullant.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexBullant.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
@ -504,6 +523,12 @@ $(OBJS)\stcdll_LexCPP.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexCPP.cxx
$(OBJS)\stcdll_LexCSS.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexCSS.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexCaml.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexCaml.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexCsound.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexCsound.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexConf.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexConf.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
@ -519,6 +544,9 @@ $(OBJS)\stcdll_LexEiffel.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexEiffe
$(OBJS)\stcdll_LexErlang.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexErlang.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexFlagship.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexFlagship.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexForth.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexForth.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
@ -531,6 +559,9 @@ $(OBJS)\stcdll_LexGui4Cli.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexGui4
$(OBJS)\stcdll_LexHTML.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexHTML.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexHaskell.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexKix.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
@ -582,12 +613,21 @@ $(OBJS)\stcdll_LexPerl.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPerl.cx
$(OBJS)\stcdll_LexPython.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPython.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexRebol.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexRebol.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexRuby.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexRuby.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexSQL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSQL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexSmalltalk.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSmalltalk.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexTADS3.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTADS3.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexScriptol.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexScriptol.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
@ -705,6 +745,9 @@ $(OBJS)\stclib_LexBaan.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexBaan.cx
$(OBJS)\stclib_LexBash.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexBash.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexBasic.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexBasic.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexBullant.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexBullant.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
@ -717,6 +760,12 @@ $(OBJS)\stclib_LexCPP.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexCPP.cxx
$(OBJS)\stclib_LexCSS.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexCSS.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexCaml.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexCaml.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexCsound.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexCsound.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexConf.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexConf.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
@ -732,6 +781,9 @@ $(OBJS)\stclib_LexEiffel.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexEiffe
$(OBJS)\stclib_LexErlang.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexErlang.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexFlagship.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexFlagship.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexForth.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexForth.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
@ -744,6 +796,9 @@ $(OBJS)\stclib_LexGui4Cli.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexGui4
$(OBJS)\stclib_LexHTML.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexHTML.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexHaskell.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexHaskell.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexKix.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexKix.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
@ -795,12 +850,21 @@ $(OBJS)\stclib_LexPerl.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPerl.cx
$(OBJS)\stclib_LexPython.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexPython.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexRebol.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexRebol.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexRuby.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexRuby.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexSQL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSQL.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexSmalltalk.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSmalltalk.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexTADS3.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTADS3.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexScriptol.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexScriptol.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<

View File

@ -31,19 +31,24 @@
scintilla/src/LexAsn1.cxx
scintilla/src/LexBaan.cxx
scintilla/src/LexBash.cxx
scintilla/src/LexBasic.cxx
scintilla/src/LexBullant.cxx
scintilla/src/LexCLW.cxx
scintilla/src/LexCPP.cxx
scintilla/src/LexCSS.cxx
scintilla/src/LexCaml.cxx
scintilla/src/LexCsound.cxx
scintilla/src/LexConf.cxx
scintilla/src/LexCrontab.cxx
scintilla/src/LexEScript.cxx
scintilla/src/LexEiffel.cxx
scintilla/src/LexErlang.cxx
scintilla/src/LexFlagship.cxx
scintilla/src/LexForth.cxx
scintilla/src/LexFortran.cxx
scintilla/src/LexGui4Cli.cxx
scintilla/src/LexHTML.cxx
scintilla/src/LexHaskell.cxx
scintilla/src/LexKix.cxx
scintilla/src/LexLisp.cxx
scintilla/src/LexLout.cxx
@ -61,8 +66,11 @@
scintilla/src/LexPascal.cxx
scintilla/src/LexPerl.cxx
scintilla/src/LexPython.cxx
scintilla/src/LexRebol.cxx
scintilla/src/LexRuby.cxx
scintilla/src/LexSQL.cxx
scintilla/src/LexSmalltalk.cxx
scintilla/src/LexTADS3.cxx
scintilla/src/LexScriptol.cxx
scintilla/src/LexSpecman.cxx
scintilla/src/LexTeX.cxx

View File

@ -528,6 +528,10 @@ SOURCE=../../src/stc\scintilla\src\LexBash.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexBasic.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexBullant.cxx
# End Source File
# Begin Source File
@ -544,6 +548,10 @@ SOURCE=../../src/stc\scintilla\src\LexCSS.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexCaml.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexConf.cxx
# End Source File
# Begin Source File
@ -552,6 +560,10 @@ SOURCE=../../src/stc\scintilla\src\LexCrontab.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexCsound.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexEScript.cxx
# End Source File
# Begin Source File
@ -564,6 +576,10 @@ SOURCE=../../src/stc\scintilla\src\LexErlang.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexFlagship.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexForth.cxx
# End Source File
# Begin Source File
@ -580,6 +596,10 @@ SOURCE=../../src/stc\scintilla\src\LexHTML.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexHaskell.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexKix.cxx
# End Source File
# Begin Source File
@ -648,6 +668,10 @@ SOURCE=../../src/stc\scintilla\src\LexPython.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexRebol.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexRuby.cxx
# End Source File
# Begin Source File
@ -660,10 +684,18 @@ SOURCE=../../src/stc\scintilla\src\LexScriptol.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexSmalltalk.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexSpecman.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexTADS3.cxx
# End Source File
# Begin Source File
SOURCE=../../src/stc\scintilla\src\LexTeX.cxx
# End Source File
# Begin Source File

View File

@ -106,6 +106,7 @@
#define wxSTC_MARK_DOTDOTDOT 23
#define wxSTC_MARK_ARROWS 24
#define wxSTC_MARK_PIXMAP 25
#define wxSTC_MARK_FULLRECT 26
#define wxSTC_MARK_CHARACTER 10000
// Markers used for outlining column.
@ -144,6 +145,7 @@
#define wxSTC_CHARSET_MAC 77
#define wxSTC_CHARSET_OEM 255
#define wxSTC_CHARSET_RUSSIAN 204
#define wxSTC_CHARSET_CYRILLIC 1251
#define wxSTC_CHARSET_SHIFTJIS 128
#define wxSTC_CHARSET_SYMBOL 2
#define wxSTC_CHARSET_TURKISH 162
@ -152,6 +154,7 @@
#define wxSTC_CHARSET_ARABIC 178
#define wxSTC_CHARSET_VIETNAMESE 163
#define wxSTC_CHARSET_THAI 222
#define wxSTC_CHARSET_8859_15 1000
#define wxSTC_CASE_MIXED 0
#define wxSTC_CASE_UPPER 1
#define wxSTC_CASE_LOWER 2
@ -204,6 +207,7 @@
#define wxSTC_TIME_FOREVER 10000000
#define wxSTC_WRAP_NONE 0
#define wxSTC_WRAP_WORD 1
#define wxSTC_WRAP_CHAR 2
#define wxSTC_WRAPVISUALFLAG_NONE 0x0000
#define wxSTC_WRAPVISUALFLAG_END 0x0001
#define wxSTC_WRAPVISUALFLAG_START 0x0002
@ -269,11 +273,13 @@
#define wxSTC_PERFORMED_USER 0x10
#define wxSTC_PERFORMED_UNDO 0x20
#define wxSTC_PERFORMED_REDO 0x40
#define wxSTC_MULTISTEPUNDOREDO 0x80
#define wxSTC_LASTSTEPINUNDOREDO 0x100
#define wxSTC_MOD_CHANGEMARKER 0x200
#define wxSTC_MOD_BEFOREINSERT 0x400
#define wxSTC_MOD_BEFOREDELETE 0x800
#define wxSTC_MODEVENTMASKALL 0xF77
#define wxSTC_MULTILINEUNDOREDO 0x1000
#define wxSTC_MODEVENTMASKALL 0x1FFF
// Symbolic key codes and modifier flags.
// ASCII and other printable characters below 256.
@ -295,6 +301,7 @@
#define wxSTC_KEY_ADD 310
#define wxSTC_KEY_SUBTRACT 311
#define wxSTC_KEY_DIVIDE 312
#define wxSTC_SCMOD_NORM 0
#define wxSTC_SCMOD_SHIFT 1
#define wxSTC_SCMOD_CTRL 2
#define wxSTC_SCMOD_ALT 4
@ -329,8 +336,6 @@
#define wxSTC_LEX_NNCRONTAB 26
#define wxSTC_LEX_BULLANT 27
#define wxSTC_LEX_VBSCRIPT 28
#define wxSTC_LEX_ASP 29
#define wxSTC_LEX_PHP 30
#define wxSTC_LEX_BAAN 31
#define wxSTC_LEX_MATLAB 32
#define wxSTC_LEX_SCRIPTOL 33
@ -365,6 +370,17 @@
#define wxSTC_LEX_BASH 62
#define wxSTC_LEX_ASN1 63
#define wxSTC_LEX_VHDL 64
#define wxSTC_LEX_CAML 65
#define wxSTC_LEX_BLITZBASIC 66
#define wxSTC_LEX_PUREBASIC 67
#define wxSTC_LEX_HASKELL 68
#define wxSTC_LEX_PHPSCRIPT 69
#define wxSTC_LEX_TADS3 70
#define wxSTC_LEX_REBOL 71
#define wxSTC_LEX_SMALLTALK 72
#define wxSTC_LEX_FLAGSHIP 73
#define wxSTC_LEX_CSOUND 74
#define wxSTC_LEX_FREEBASIC 75
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -385,6 +401,8 @@
#define wxSTC_P_IDENTIFIER 11
#define wxSTC_P_COMMENTBLOCK 12
#define wxSTC_P_STRINGEOL 13
#define wxSTC_P_WORD2 14
#define wxSTC_P_DECORATOR 15
// Lexical states for SCLEX_CPP
#define wxSTC_C_DEFAULT 0
@ -562,6 +580,7 @@
#define wxSTC_PL_ARRAY 13
#define wxSTC_PL_HASH 14
#define wxSTC_PL_SYMBOLTABLE 15
#define wxSTC_PL_VARIABLE_INDEXER 16
#define wxSTC_PL_REGEX 17
#define wxSTC_PL_REGSUBST 18
#define wxSTC_PL_LONGQUOTE 19
@ -576,6 +595,43 @@
#define wxSTC_PL_STRING_QX 28
#define wxSTC_PL_STRING_QR 29
#define wxSTC_PL_STRING_QW 30
#define wxSTC_PL_POD_VERB 31
// Lexical states for SCLEX_RUBY
#define wxSTC_RB_DEFAULT 0
#define wxSTC_RB_ERROR 1
#define wxSTC_RB_COMMENTLINE 2
#define wxSTC_RB_POD 3
#define wxSTC_RB_NUMBER 4
#define wxSTC_RB_WORD 5
#define wxSTC_RB_STRING 6
#define wxSTC_RB_CHARACTER 7
#define wxSTC_RB_CLASSNAME 8
#define wxSTC_RB_DEFNAME 9
#define wxSTC_RB_OPERATOR 10
#define wxSTC_RB_IDENTIFIER 11
#define wxSTC_RB_REGEX 12
#define wxSTC_RB_GLOBAL 13
#define wxSTC_RB_SYMBOL 14
#define wxSTC_RB_MODULE_NAME 15
#define wxSTC_RB_INSTANCE_VAR 16
#define wxSTC_RB_CLASS_VAR 17
#define wxSTC_RB_BACKTICKS 18
#define wxSTC_RB_DATASECTION 19
#define wxSTC_RB_HERE_DELIM 20
#define wxSTC_RB_HERE_Q 21
#define wxSTC_RB_HERE_QQ 22
#define wxSTC_RB_HERE_QX 23
#define wxSTC_RB_STRING_Q 24
#define wxSTC_RB_STRING_QQ 25
#define wxSTC_RB_STRING_QX 26
#define wxSTC_RB_STRING_QR 27
#define wxSTC_RB_STRING_QW 28
#define wxSTC_RB_WORD_DEMOTED 29
#define wxSTC_RB_STDIN 30
#define wxSTC_RB_STDOUT 31
#define wxSTC_RB_STDERR 40
#define wxSTC_RB_UPPER_BOUND 41
// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC
#define wxSTC_B_DEFAULT 0
@ -593,6 +649,10 @@
#define wxSTC_B_KEYWORD4 12
#define wxSTC_B_CONSTANT 13
#define wxSTC_B_ASM 14
#define wxSTC_B_LABEL 15
#define wxSTC_B_ERROR 16
#define wxSTC_B_HEXNUMBER 17
#define wxSTC_B_BINNUMBER 18
// Lexical states for SCLEX_PROPERTIES
#define wxSTC_PROPS_DEFAULT 0
@ -742,10 +802,14 @@
#define wxSTC_LISP_COMMENT 1
#define wxSTC_LISP_NUMBER 2
#define wxSTC_LISP_KEYWORD 3
#define wxSTC_LISP_KEYWORD_KW 4
#define wxSTC_LISP_SYMBOL 5
#define wxSTC_LISP_STRING 6
#define wxSTC_LISP_STRINGEOL 8
#define wxSTC_LISP_IDENTIFIER 9
#define wxSTC_LISP_OPERATOR 10
#define wxSTC_LISP_SPECIAL 11
#define wxSTC_LISP_MULTI_COMMENT 12
// Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
#define wxSTC_EIFFEL_DEFAULT 0
@ -867,6 +931,7 @@
#define wxSTC_CSS_DOUBLESTRING 13
#define wxSTC_CSS_SINGLESTRING 14
#define wxSTC_CSS_IDENTIFIER2 15
#define wxSTC_CSS_ATTRIBUTE 16
// Lexical states for SCLEX_POV
#define wxSTC_POV_DEFAULT 0
@ -948,6 +1013,10 @@
#define wxSTC_NSIS_MACRODEF 12
#define wxSTC_NSIS_STRINGVAR 13
#define wxSTC_NSIS_NUMBER 14
#define wxSTC_NSIS_SECTIONGROUP 15
#define wxSTC_NSIS_PAGEEX 16
#define wxSTC_NSIS_FUNCTIONDEF 17
#define wxSTC_NSIS_COMMENTBOX 18
// Lexical states for SCLEX_MMIXAL
#define wxSTC_MMIXAL_LEADWS 0
@ -980,11 +1049,13 @@
#define wxSTC_CLW_PICTURE_STRING 7
#define wxSTC_CLW_KEYWORD 8
#define wxSTC_CLW_COMPILER_DIRECTIVE 9
#define wxSTC_CLW_BUILTIN_PROCEDURES_FUNCTION 10
#define wxSTC_CLW_STRUCTURE_DATA_TYPE 11
#define wxSTC_CLW_ATTRIBUTE 12
#define wxSTC_CLW_STANDARD_EQUATE 13
#define wxSTC_CLW_ERROR 14
#define wxSTC_CLW_RUNTIME_EXPRESSIONS 10
#define wxSTC_CLW_BUILTIN_PROCEDURES_FUNCTION 11
#define wxSTC_CLW_STRUCTURE_DATA_TYPE 12
#define wxSTC_CLW_ATTRIBUTE 13
#define wxSTC_CLW_STANDARD_EQUATE 14
#define wxSTC_CLW_ERROR 15
#define wxSTC_CLW_DEPRECATED 16
// Lexical states for SCLEX_LOT
#define wxSTC_LOT_DEFAULT 0
@ -1131,6 +1202,8 @@
#define wxSTC_AU3_SENT 10
#define wxSTC_AU3_PREPROCESSOR 11
#define wxSTC_AU3_SPECIAL 12
#define wxSTC_AU3_EXPAND 13
#define wxSTC_AU3_COMOBJ 14
// Lexical states for SCLEX_APDL
#define wxSTC_APDL_DEFAULT 0
@ -1193,6 +1266,182 @@
#define wxSTC_VHDL_STDTYPE 13
#define wxSTC_VHDL_USERWORD 14
// Lexical states for SCLEX_CAML
#define wxSTC_CAML_DEFAULT 0
#define wxSTC_CAML_IDENTIFIER 1
#define wxSTC_CAML_TAGNAME 2
#define wxSTC_CAML_KEYWORD 3
#define wxSTC_CAML_KEYWORD2 4
#define wxSTC_CAML_KEYWORD3 5
#define wxSTC_CAML_LINENUM 6
#define wxSTC_CAML_OPERATOR 7
#define wxSTC_CAML_NUMBER 8
#define wxSTC_CAML_CHAR 9
#define wxSTC_CAML_STRING 11
#define wxSTC_CAML_COMMENT 12
#define wxSTC_CAML_COMMENT1 13
#define wxSTC_CAML_COMMENT2 14
#define wxSTC_CAML_COMMENT3 15
// Lexical states for SCLEX_HASKELL
#define wxSTC_HA_DEFAULT 0
#define wxSTC_HA_IDENTIFIER 1
#define wxSTC_HA_KEYWORD 2
#define wxSTC_HA_NUMBER 3
#define wxSTC_HA_STRING 4
#define wxSTC_HA_CHARACTER 5
#define wxSTC_HA_CLASS 6
#define wxSTC_HA_MODULE 7
#define wxSTC_HA_CAPITAL 8
#define wxSTC_HA_DATA 9
#define wxSTC_HA_IMPORT 10
#define wxSTC_HA_OPERATOR 11
#define wxSTC_HA_INSTANCE 12
#define wxSTC_HA_COMMENTLINE 13
#define wxSTC_HA_COMMENTBLOCK 14
#define wxSTC_HA_COMMENTBLOCK2 15
#define wxSTC_HA_COMMENTBLOCK3 16
// Lexical states of SCLEX_TADS3
#define wxSTC_T3_DEFAULT 0
#define wxSTC_T3_X_DEFAULT 1
#define wxSTC_T3_PREPROCESSOR 2
#define wxSTC_T3_BLOCK_COMMENT 3
#define wxSTC_T3_LINE_COMMENT 4
#define wxSTC_T3_OPERATOR 5
#define wxSTC_T3_KEYWORD 6
#define wxSTC_T3_NUMBER 7
#define wxSTC_T3_IDENTIFIER 8
#define wxSTC_T3_S_STRING 9
#define wxSTC_T3_D_STRING 10
#define wxSTC_T3_X_STRING 11
#define wxSTC_T3_LIB_DIRECTIVE 12
#define wxSTC_T3_MSG_PARAM 13
#define wxSTC_T3_HTML_TAG 14
#define wxSTC_T3_HTML_DEFAULT 15
#define wxSTC_T3_HTML_STRING 16
#define wxSTC_T3_USER1 17
#define wxSTC_T3_USER2 18
#define wxSTC_T3_USER3 19
// Lexical states for SCLEX_REBOL
#define wxSTC_REBOL_DEFAULT 0
#define wxSTC_REBOL_COMMENTLINE 1
#define wxSTC_REBOL_COMMENTBLOCK 2
#define wxSTC_REBOL_PREFACE 3
#define wxSTC_REBOL_OPERATOR 4
#define wxSTC_REBOL_CHARACTER 5
#define wxSTC_REBOL_QUOTEDSTRING 6
#define wxSTC_REBOL_BRACEDSTRING 7
#define wxSTC_REBOL_NUMBER 8
#define wxSTC_REBOL_PAIR 9
#define wxSTC_REBOL_TUPLE 10
#define wxSTC_REBOL_BINARY 11
#define wxSTC_REBOL_MONEY 12
#define wxSTC_REBOL_ISSUE 13
#define wxSTC_REBOL_TAG 14
#define wxSTC_REBOL_FILE 15
#define wxSTC_REBOL_EMAIL 16
#define wxSTC_REBOL_URL 17
#define wxSTC_REBOL_DATE 18
#define wxSTC_REBOL_TIME 19
#define wxSTC_REBOL_IDENTIFIER 20
#define wxSTC_REBOL_WORD 21
#define wxSTC_REBOL_WORD2 22
#define wxSTC_REBOL_WORD3 23
#define wxSTC_REBOL_WORD4 24
#define wxSTC_REBOL_WORD5 25
#define wxSTC_REBOL_WORD6 26
#define wxSTC_REBOL_WORD7 27
#define wxSTC_REBOL_WORD8 28
// Lexical states for SCLEX_SQL
#define wxSTC_SQL_DEFAULT 0
#define wxSTC_SQL_COMMENT 1
#define wxSTC_SQL_COMMENTLINE 2
#define wxSTC_SQL_COMMENTDOC 3
#define wxSTC_SQL_NUMBER 4
#define wxSTC_SQL_WORD 5
#define wxSTC_SQL_STRING 6
#define wxSTC_SQL_CHARACTER 7
#define wxSTC_SQL_SQLPLUS 8
#define wxSTC_SQL_SQLPLUS_PROMPT 9
#define wxSTC_SQL_OPERATOR 10
#define wxSTC_SQL_IDENTIFIER 11
#define wxSTC_SQL_SQLPLUS_COMMENT 13
#define wxSTC_SQL_COMMENTLINEDOC 15
#define wxSTC_SQL_WORD2 16
#define wxSTC_SQL_COMMENTDOCKEYWORD 17
#define wxSTC_SQL_COMMENTDOCKEYWORDERROR 18
#define wxSTC_SQL_USER1 19
#define wxSTC_SQL_USER2 20
#define wxSTC_SQL_USER3 21
#define wxSTC_SQL_USER4 22
#define wxSTC_SQL_QUOTEDIDENTIFIER 23
// Lexical states for SCLEX_SMALLTALK
#define wxSTC_ST_DEFAULT 0
#define wxSTC_ST_STRING 1
#define wxSTC_ST_NUMBER 2
#define wxSTC_ST_COMMENT 3
#define wxSTC_ST_SYMBOL 4
#define wxSTC_ST_BINARY 5
#define wxSTC_ST_BOOL 6
#define wxSTC_ST_SELF 7
#define wxSTC_ST_SUPER 8
#define wxSTC_ST_NIL 9
#define wxSTC_ST_GLOBAL 10
#define wxSTC_ST_RETURN 11
#define wxSTC_ST_SPECIAL 12
#define wxSTC_ST_KWSEND 13
#define wxSTC_ST_ASSIGN 14
#define wxSTC_ST_CHARACTER 15
#define wxSTC_ST_SPEC_SEL 16
// Lexical states for SCLEX_FLAGSHIP (clipper)
#define wxSTC_FS_DEFAULT 0
#define wxSTC_FS_COMMENT 1
#define wxSTC_FS_COMMENTLINE 2
#define wxSTC_FS_COMMENTDOC 3
#define wxSTC_FS_COMMENTLINEDOC 4
#define wxSTC_FS_COMMENTDOCKEYWORD 5
#define wxSTC_FS_COMMENTDOCKEYWORDERROR 6
#define wxSTC_FS_KEYWORD 7
#define wxSTC_FS_KEYWORD2 8
#define wxSTC_FS_KEYWORD3 9
#define wxSTC_FS_KEYWORD4 10
#define wxSTC_FS_NUMBER 11
#define wxSTC_FS_STRING 12
#define wxSTC_FS_PREPROCESSOR 13
#define wxSTC_FS_OPERATOR 14
#define wxSTC_FS_IDENTIFIER 15
#define wxSTC_FS_DATE 16
#define wxSTC_FS_STRINGEOL 17
#define wxSTC_FS_CONSTANT 18
#define wxSTC_FS_ASM 19
#define wxSTC_FS_LABEL 20
#define wxSTC_FS_ERROR 21
#define wxSTC_FS_HEXNUMBER 22
#define wxSTC_FS_BINNUMBER 23
// Lexical states for SCLEX_CSOUND
#define wxSTC_CSOUND_DEFAULT 0
#define wxSTC_CSOUND_COMMENT 1
#define wxSTC_CSOUND_NUMBER 2
#define wxSTC_CSOUND_OPERATOR 3
#define wxSTC_CSOUND_INSTR 4
#define wxSTC_CSOUND_IDENTIFIER 5
#define wxSTC_CSOUND_OPCODE 6
#define wxSTC_CSOUND_HEADERSTMT 7
#define wxSTC_CSOUND_USERKEYWORD 8
#define wxSTC_CSOUND_COMMENTBLOCK 9
#define wxSTC_CSOUND_PARAM 10
#define wxSTC_CSOUND_ARATE_VAR 11
#define wxSTC_CSOUND_KRATE_VAR 12
#define wxSTC_CSOUND_IRATE_VAR 13
#define wxSTC_CSOUND_GLOBAL_VAR 14
#define wxSTC_CSOUND_STRINGEOL 15
//-----------------------------------------
// Commands that can be bound to keystrokes
@ -1679,6 +1928,9 @@ public:
// Define a marker from a bitmap
void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
// Add a set of markers to a line.
void MarkerAddSet(int line, int set);
// Set a margin to be either numeric or symbolic.
void SetMarginType(int margin, int marginType);
@ -1914,6 +2166,20 @@ public:
// Default is '?' but can be changed if items contain '?'.
void AutoCompSetTypeSeparator(int separatorCharacter);
// Set the maximum width, in characters, of auto-completion and user lists.
// Set to 0 to autosize to fit longest item, which is the default.
void AutoCompSetMaxWidth(int characterCount);
// Get the maximum width, in characters, of auto-completion and user lists.
int AutoCompGetMaxWidth();
// Set the maximum height, in rows, of auto-completion and user lists.
// The default is 5 rows.
void AutoCompSetMaxHeight(int rowCount);
// Set the maximum height, in rows, of auto-completion and user lists.
int AutoCompGetMaxHeight();
// Set the number of spaces used for one level of indentation.
void SetIndent(int indentSize);
@ -2176,6 +2442,9 @@ public:
// Find the document line of a display line taking hidden lines into account.
int DocLineFromVisible(int lineDisplay);
// The number of display lines needed to wrap a document line
int WrapCount(int line);
// Set the fold level of a line.
// This encodes an integer level along with flags indicating whether the
// line is a header and whether it is effectively white space.
@ -2290,7 +2559,7 @@ public:
// Retrieve whether the maximum scroll position has the last
// line at the bottom of the view.
int GetEndAtLastLine();
bool GetEndAtLastLine();
// Retrieve the height of a particular line of text in pixels.
int TextHeight(int line);
@ -2773,10 +3042,28 @@ public:
// Enlarge the document to a particular size of text bytes.
void Allocate(int bytes);
// Find the position of a column on a line taking into account tabs and
// Find the position of a column on a line taking into account tabs and
// multi-byte characters. If beyond end of line, return line end position.
int FindColumn(int line, int column);
// Can the caret preferred x position only be changed by explicit movement commands?
bool GetCaretSticky();
// Stop the caret preferred x position changing when the user types.
void SetCaretSticky(bool useCaretStickyBehaviour);
// Switch between sticky and non-sticky: meant to be bound to a key.
void ToggleCaretSticky();
// Enable/Disable convert-on-paste for line endings
void SetPasteConvertEndings(bool convert);
// Get convert-on-paste setting
bool GetPasteConvertEndings();
// Duplicate the selection. If selection empty duplicate the line containing the caret.
void SelectionDuplicate();
// Start notifying the container of all key presses and commands.
void StartRecord();
@ -2801,6 +3088,20 @@ public:
// Set the lexing language of the document based on string name.
void SetLexerLanguage(const wxString& language);
// Retrieve a 'property' value previously set with SetProperty.
wxString GetProperty(const wxString& key);
// Retrieve a 'property' value previously set with SetProperty,
// with '$()' variable replacement on returned buffer.
wxString GetPropertyExpanded(const wxString& key);
// Retrieve a 'property' value previously set with SetProperty,
// interpreted as an int AFTER any '$()' variable replacement.
int GetPropertyInt(const wxString& key);
// Retrieve the number of bits the current lexer needs for styling.
int GetStyleBitsNeeded();
// END of generated section
//----------------------------------------------------------------------
// Others...
@ -3131,6 +3432,7 @@ BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_CLICK, 1673)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_DCLICK, 1674)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, 1675)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, 1676)
END_DECLARE_EVENT_TYPES()
#else
enum {
@ -3158,7 +3460,8 @@ END_DECLARE_EVENT_TYPES()
wxEVT_STC_ZOOM,
wxEVT_STC_HOTSPOT_CLICK,
wxEVT_STC_HOTSPOT_DCLICK,
wxEVT_STC_CALLTIP_CLICK
wxEVT_STC_CALLTIP_CLICK,
wxEVT_STC_AUTOCOMP_SELECTION
};
#endif
@ -3192,7 +3495,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#define EVT_STC_HOTSPOT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#define EVT_STC_HOTSPOT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#define EVT_STC_CALLTIP_CLICK(id, fn)) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_SELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#endif
//----------------------------------------------------------------------

View File

@ -82,19 +82,24 @@ STCDLL_OBJECTS = \
stcdll_LexAsn1.o \
stcdll_LexBaan.o \
stcdll_LexBash.o \
stcdll_LexBasic.o \
stcdll_LexBullant.o \
stcdll_LexCLW.o \
stcdll_LexCPP.o \
stcdll_LexCSS.o \
stcdll_LexCaml.o \
stcdll_LexCsound.o \
stcdll_LexConf.o \
stcdll_LexCrontab.o \
stcdll_LexEScript.o \
stcdll_LexEiffel.o \
stcdll_LexErlang.o \
stcdll_LexFlagship.o \
stcdll_LexForth.o \
stcdll_LexFortran.o \
stcdll_LexGui4Cli.o \
stcdll_LexHTML.o \
stcdll_LexHaskell.o \
stcdll_LexKix.o \
stcdll_LexLisp.o \
stcdll_LexLout.o \
@ -112,8 +117,11 @@ STCDLL_OBJECTS = \
stcdll_LexPascal.o \
stcdll_LexPerl.o \
stcdll_LexPython.o \
stcdll_LexRebol.o \
stcdll_LexRuby.o \
stcdll_LexSQL.o \
stcdll_LexSmalltalk.o \
stcdll_LexTADS3.o \
stcdll_LexScriptol.o \
stcdll_LexSpecman.o \
stcdll_LexTeX.o \
@ -159,19 +167,24 @@ STCLIB_OBJECTS = \
stclib_LexAsn1.o \
stclib_LexBaan.o \
stclib_LexBash.o \
stclib_LexBasic.o \
stclib_LexBullant.o \
stclib_LexCLW.o \
stclib_LexCPP.o \
stclib_LexCSS.o \
stclib_LexCaml.o \
stclib_LexCsound.o \
stclib_LexConf.o \
stclib_LexCrontab.o \
stclib_LexEScript.o \
stclib_LexEiffel.o \
stclib_LexErlang.o \
stclib_LexFlagship.o \
stclib_LexForth.o \
stclib_LexFortran.o \
stclib_LexGui4Cli.o \
stclib_LexHTML.o \
stclib_LexHaskell.o \
stclib_LexKix.o \
stclib_LexLisp.o \
stclib_LexLout.o \
@ -189,8 +202,11 @@ STCLIB_OBJECTS = \
stclib_LexPascal.o \
stclib_LexPerl.o \
stclib_LexPython.o \
stclib_LexRebol.o \
stclib_LexRuby.o \
stclib_LexSQL.o \
stclib_LexSmalltalk.o \
stclib_LexTADS3.o \
stclib_LexScriptol.o \
stclib_LexSpecman.o \
stclib_LexTeX.o \
@ -447,6 +463,9 @@ stcdll_LexBaan.o: $(srcdir)/scintilla/src/LexBaan.cxx
stcdll_LexBash.o: $(srcdir)/scintilla/src/LexBash.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexBash.cxx
stcdll_LexBasic.o: $(srcdir)/scintilla/src/LexBasic.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexBasic.cxx
stcdll_LexBullant.o: $(srcdir)/scintilla/src/LexBullant.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexBullant.cxx
@ -459,6 +478,12 @@ stcdll_LexCPP.o: $(srcdir)/scintilla/src/LexCPP.cxx
stcdll_LexCSS.o: $(srcdir)/scintilla/src/LexCSS.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexCSS.cxx
stcdll_LexCaml.o: $(srcdir)/scintilla/src/LexCaml.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexCaml.cxx
stcdll_LexCsound.o: $(srcdir)/scintilla/src/LexCsound.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexCsound.cxx
stcdll_LexConf.o: $(srcdir)/scintilla/src/LexConf.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexConf.cxx
@ -474,6 +499,9 @@ stcdll_LexEiffel.o: $(srcdir)/scintilla/src/LexEiffel.cxx
stcdll_LexErlang.o: $(srcdir)/scintilla/src/LexErlang.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexErlang.cxx
stcdll_LexFlagship.o: $(srcdir)/scintilla/src/LexFlagship.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexFlagship.cxx
stcdll_LexForth.o: $(srcdir)/scintilla/src/LexForth.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexForth.cxx
@ -486,6 +514,9 @@ stcdll_LexGui4Cli.o: $(srcdir)/scintilla/src/LexGui4Cli.cxx
stcdll_LexHTML.o: $(srcdir)/scintilla/src/LexHTML.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexHTML.cxx
stcdll_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
stcdll_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
@ -537,12 +568,21 @@ stcdll_LexPerl.o: $(srcdir)/scintilla/src/LexPerl.cxx
stcdll_LexPython.o: $(srcdir)/scintilla/src/LexPython.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexPython.cxx
stcdll_LexRebol.o: $(srcdir)/scintilla/src/LexRebol.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexRebol.cxx
stcdll_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexRuby.cxx
stcdll_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSQL.cxx
stcdll_LexSmalltalk.o: $(srcdir)/scintilla/src/LexSmalltalk.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSmalltalk.cxx
stcdll_LexTADS3.o: $(srcdir)/scintilla/src/LexTADS3.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTADS3.cxx
stcdll_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexScriptol.cxx
@ -660,6 +700,9 @@ stclib_LexBaan.o: $(srcdir)/scintilla/src/LexBaan.cxx
stclib_LexBash.o: $(srcdir)/scintilla/src/LexBash.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexBash.cxx
stclib_LexBasic.o: $(srcdir)/scintilla/src/LexBasic.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexBasic.cxx
stclib_LexBullant.o: $(srcdir)/scintilla/src/LexBullant.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexBullant.cxx
@ -672,6 +715,12 @@ stclib_LexCPP.o: $(srcdir)/scintilla/src/LexCPP.cxx
stclib_LexCSS.o: $(srcdir)/scintilla/src/LexCSS.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexCSS.cxx
stclib_LexCaml.o: $(srcdir)/scintilla/src/LexCaml.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexCaml.cxx
stclib_LexCsound.o: $(srcdir)/scintilla/src/LexCsound.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexCsound.cxx
stclib_LexConf.o: $(srcdir)/scintilla/src/LexConf.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexConf.cxx
@ -687,6 +736,9 @@ stclib_LexEiffel.o: $(srcdir)/scintilla/src/LexEiffel.cxx
stclib_LexErlang.o: $(srcdir)/scintilla/src/LexErlang.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexErlang.cxx
stclib_LexFlagship.o: $(srcdir)/scintilla/src/LexFlagship.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexFlagship.cxx
stclib_LexForth.o: $(srcdir)/scintilla/src/LexForth.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexForth.cxx
@ -699,6 +751,9 @@ stclib_LexGui4Cli.o: $(srcdir)/scintilla/src/LexGui4Cli.cxx
stclib_LexHTML.o: $(srcdir)/scintilla/src/LexHTML.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexHTML.cxx
stclib_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
stclib_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
@ -750,12 +805,21 @@ stclib_LexPerl.o: $(srcdir)/scintilla/src/LexPerl.cxx
stclib_LexPython.o: $(srcdir)/scintilla/src/LexPython.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexPython.cxx
stclib_LexRebol.o: $(srcdir)/scintilla/src/LexRebol.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexRebol.cxx
stclib_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexRuby.cxx
stclib_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSQL.cxx
stclib_LexSmalltalk.o: $(srcdir)/scintilla/src/LexSmalltalk.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSmalltalk.cxx
stclib_LexTADS3.o: $(srcdir)/scintilla/src/LexTADS3.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTADS3.cxx
stclib_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexScriptol.cxx

View File

@ -12,6 +12,7 @@
#include "wx/mstream.h"
#include "wx/image.h"
#include "wx/imaglist.h"
#include "wx/tokenzr.h"
#include "Platform.h"
#include "PlatWX.h"
@ -686,7 +687,7 @@ private:
CallBackAction doubleClickAction;
void* doubleClickActionData;
public:
wxSTCListBoxWin(wxWindow* parent, wxWindowID id) :
wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point location) :
wxPopupWindow(parent, wxBORDER_NONE)
{
SetBackgroundColour(*wxBLACK); // for our simple border
@ -804,8 +805,8 @@ private:
CallBackAction doubleClickAction;
void* doubleClickActionData;
public:
wxSTCListBoxWin(wxWindow* parent, wxWindowID id) :
wxWindow(parent, id, wxDefaultPosition, wxSize(0,0), wxSIMPLE_BORDER )
wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point location) :
wxWindow(parent, id, wxPoint(location.x, location.y), wxSize(0,0), wxSIMPLE_BORDER )
{
lv = new wxSTCListBox(this, id, wxDefaultPosition, wxDefaultSize,
@ -919,6 +920,7 @@ private:
int desiredVisibleRows;
int aveCharWidth;
int maxStrWidth;
Point location; // Caret location at which the list is opened
wxImageList* imgList;
wxArrayInt* imgTypeMap;
@ -927,13 +929,15 @@ public:
~ListBoxImpl();
virtual void SetFont(Font &font);
virtual void Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_);
virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_);
virtual void SetAverageCharWidth(int width);
virtual void SetVisibleRows(int rows);
virtual int GetVisibleRows() const;
virtual PRectangle GetDesiredRect();
virtual int CaretFromEdge();
virtual void Clear();
virtual void Append(char *s, int type = -1);
void Append(const wxString& text, int type);
virtual int Length();
virtual void Select(int n);
virtual int GetSelection();
@ -942,7 +946,7 @@ public:
virtual void RegisterImage(int type, const char *xpm_data);
virtual void ClearRegisteredImages();
virtual void SetDoubleClickAction(CallBackAction, void *);
virtual void SetList(const char* list, char separator, char typesep);
};
@ -970,11 +974,12 @@ void ListBoxImpl::SetFont(Font &font) {
}
void ListBoxImpl::Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_) {
void ListBoxImpl::Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_) {
location = location_;
lineHeight = lineHeight_;
unicodeMode = unicodeMode_;
maxStrWidth = 0;
id = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID);
id = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID, location);
if (imgList != NULL)
GETLB(id)->SetImageList(imgList, wxIMAGE_LIST_SMALL);
}
@ -990,10 +995,14 @@ void ListBoxImpl::SetVisibleRows(int rows) {
}
int ListBoxImpl::GetVisibleRows() const {
return desiredVisibleRows;
}
PRectangle ListBoxImpl::GetDesiredRect() {
// wxListCtrl doesn't have a DoGetBestSize, so instead we kept track of
// the max size in Append and calculate it here...
int maxw = maxStrWidth;
int maxw = maxStrWidth * aveCharWidth;
int maxh ;
// give it a default if there are no lines, and/or add a bit more
@ -1039,13 +1048,14 @@ void ListBoxImpl::Clear() {
void ListBoxImpl::Append(char *s, int type) {
wxString text = stc2wx(s);
Append(stc2wx(s), type);
}
void ListBoxImpl::Append(const wxString& text, int type) {
long count = GETLB(id)->GetItemCount();
long itemID = GETLB(id)->InsertItem(count, wxEmptyString);
GETLB(id)->SetItem(itemID, 1, text);
int itemWidth = 0;
GETLB(id)->GetTextExtent(text, &itemWidth, NULL);
maxStrWidth = wxMax(maxStrWidth, itemWidth);
maxStrWidth = wxMax(maxStrWidth, text.Length());
if (type != -1) {
wxCHECK_RET(imgTypeMap, wxT("Unexpected NULL imgTypeMap"));
long idx = imgTypeMap->Item(type);
@ -1053,6 +1063,23 @@ void ListBoxImpl::Append(char *s, int type) {
}
}
void ListBoxImpl::SetList(const char* list, char separator, char typesep) {
GETLB(id)->Freeze();
Clear();
wxStringTokenizer tkzr(stc2wx(list), (wxChar)separator);
while ( tkzr.HasMoreTokens() ) {
wxString token = tkzr.GetNextToken();
long type = -1;
int pos = token.Find(typesep);
if (pos != -1) {
token.Mid(pos+1).ToLong(&type);
token.Truncate(pos);
}
Append(token, (int)type);
}
GETLB(id)->Thaw();
}
int ListBoxImpl::Length() {
return GETLB(id)->GetItemCount();
@ -1133,7 +1160,6 @@ void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data) {
}
ListBox::ListBox() {
}

View File

@ -293,7 +293,12 @@ methodOverrideMap = {
'AutoCGetTypeSeparator' : ('AutoCompGetTypeSeparator', 0, 0, 0),
'AutoCSetTypeSeparator' : ('AutoCompSetTypeSeparator', 0, 0, 0),
'AutoCGetCurrent' : ('AutoCompGetCurrent', 0, 0, 0),
'AutoCSetMaxWidth' : ('AutoCompSetMaxWidth', 0, 0, 0),
'AutoCGetMaxWidth' : ('AutoCompGetMaxWidth', 0, 0, 0),
'AutoCSetMaxHeight' : ('AutoCompSetMaxHeight', 0, 0, 0),
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
'RegisterImage' :
(0,
'''void %s(int type, const wxBitmap& bmp);''',
@ -519,7 +524,45 @@ methodOverrideMap = {
'TargetAsUTF8' : ( None, 0, 0, 0),
'SetLengthForEncode' : ( None, 0, 0, 0),
'EncodedFromUTF8' : ( None, 0, 0, 0),
'GetProperty' :
(0,
'wxString %s(const wxString& key);',
'''wxString %s(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTY, (long)(const char*)wx2stc(key), NULL);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(%s, (long)(const char*)wx2stc(key), (long)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
("Retrieve a 'property' value previously set with SetProperty.",)),
'GetPropertyExpanded' :
(0,
'wxString %s(const wxString& key);',
'''wxString %s(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTYEXPANDED, (long)(const char*)wx2stc(key), NULL);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(%s, (long)(const char*)wx2stc(key), (long)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
("Retrieve a 'property' value previously set with SetProperty,",
"with '$()' variable replacement on returned buffer.")),
'GetPropertyInt' : (0, 0, 0,
("Retrieve a 'property' value previously set with SetProperty,",
"interpreted as an int AFTER any '$()' variable replacement.")),
'GetDocPointer' :
(0,

View File

@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source
distribution. All other code needed to implement Scintilla on top of
wxWindows is located in the directory above this one.
The current version of the Scintilla code is 1.62
The current version of the Scintilla code is 1.67

View File

@ -20,21 +20,29 @@ protected:
LexerFunction fnLexer;
LexerFunction fnFolder;
const char * const * wordListDescriptions;
int styleBits;
static const LexerModule *base;
static int nextLanguage;
public:
const char *languageName;
LexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_=0, LexerFunction fnFolder_=0,
const char * const wordListDescriptions_[] = NULL);
LexerModule(int language_,
LexerFunction fnLexer_,
const char *languageName_=0,
LexerFunction fnFolder_=0,
const char * const wordListDescriptions_[] = NULL,
int styleBits_=5);
virtual ~LexerModule() {
}
int GetLanguage() const { return language; }
// -1 is returned if no WordList information is available
int GetNumWordLists() const;
const char *GetWordListDescription(int index) const;
int GetStyleBitsNeeded() const;
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const;
virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,

View File

@ -393,9 +393,10 @@ public:
static ListBox *Allocate();
virtual void SetFont(Font &font)=0;
virtual void Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_)=0;
virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_)=0;
virtual void SetAverageCharWidth(int width)=0;
virtual void SetVisibleRows(int rows)=0;
virtual int GetVisibleRows() const=0;
virtual PRectangle GetDesiredRect()=0;
virtual int CaretFromEdge()=0;
virtual void Clear()=0;
@ -408,6 +409,7 @@ public:
virtual void RegisterImage(int type, const char *xpm_data)=0;
virtual void ClearRegisteredImages()=0;
virtual void SetDoubleClickAction(CallBackAction, void *)=0;
virtual void SetList(const char* list, char separator, char typesep)=0;
};
/**

View File

@ -29,6 +29,7 @@ protected:
Property *props[hashRoots];
Property *enumnext;
int enumhash;
static bool caseSensitiveFilenames;
static unsigned int HashString(const char *s, size_t len) {
unsigned int ret = 0;
while (len--) {
@ -58,9 +59,12 @@ public:
char *ToString(); // Caller must delete[] the return value
bool GetFirst(char **key, char **val);
bool GetNext(char **key, char **val);
static void SetCaseSensitiveFilenames(bool caseSensitiveFilenames_) {
caseSensitiveFilenames = caseSensitiveFilenames_;
}
private:
// copy-value semantics not implemented
// copy-value semantics not implemented
PropSet(const PropSet &copy);
void operator=(const PropSet &assign);
};
@ -76,9 +80,11 @@ public:
int len;
bool onlyLineEnds; ///< Delimited by any white space or only line ends
bool sorted;
bool sortedNoCase;
int starts[256];
WordList(bool onlyLineEnds_ = false) :
words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), sorted(false) {}
words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
sorted(false), sortedNoCase(false) {}
~WordList() { Clear(); }
operator bool() { return len ? true : false; }
char *operator[](int ind) { return words[ind]; }
@ -87,6 +93,7 @@ public:
char *Allocate(int size);
void SetFromAllocated();
bool InList(const char *s);
bool InListAbbreviated(const char *s, const char marker);
const char *GetNearestWord(const char *wordStart, int searchLen,
bool ignoreCase = false, SString wordCharacters="", int wordIndex = -1);
char *GetNearestWords(const char *wordStart, int searchLen,

View File

@ -197,7 +197,7 @@ public:
bool operator!=(const char *sOther) const {
return !operator==(sOther);
}
bool contains(char ch) {
bool contains(char ch) const {
return (s && *s) ? strchr(s, ch) != 0 : false;
}
void setsizegrowth(lenpos_t sizeGrowth_) {
@ -253,7 +253,7 @@ public:
bool startswith(const char *prefix);
bool endswith(const char *suffix);
int search(const char *sFind, lenpos_t start=0) const;
bool contains(const char *sFind) {
bool contains(const char *sFind) const {
return search(sFind) >= 0;
}
int substitute(char chFind, char chReplace);

View File

@ -43,8 +43,6 @@
#define SCLEX_NNCRONTAB 26
#define SCLEX_BULLANT 27
#define SCLEX_VBSCRIPT 28
#define SCLEX_ASP 29
#define SCLEX_PHP 30
#define SCLEX_BAAN 31
#define SCLEX_MATLAB 32
#define SCLEX_SCRIPTOL 33
@ -79,6 +77,17 @@
#define SCLEX_BASH 62
#define SCLEX_ASN1 63
#define SCLEX_VHDL 64
#define SCLEX_CAML 65
#define SCLEX_BLITZBASIC 66
#define SCLEX_PUREBASIC 67
#define SCLEX_HASKELL 68
#define SCLEX_PHPSCRIPT 69
#define SCLEX_TADS3 70
#define SCLEX_REBOL 71
#define SCLEX_SMALLTALK 72
#define SCLEX_FLAGSHIP 73
#define SCLEX_CSOUND 74
#define SCLEX_FREEBASIC 75
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@ -94,6 +103,8 @@
#define SCE_P_IDENTIFIER 11
#define SCE_P_COMMENTBLOCK 12
#define SCE_P_STRINGEOL 13
#define SCE_P_WORD2 14
#define SCE_P_DECORATOR 15
#define SCE_C_DEFAULT 0
#define SCE_C_COMMENT 1
#define SCE_C_COMMENTLINE 2
@ -241,6 +252,7 @@
#define SCE_PL_ARRAY 13
#define SCE_PL_HASH 14
#define SCE_PL_SYMBOLTABLE 15
#define SCE_PL_VARIABLE_INDEXER 16
#define SCE_PL_REGEX 17
#define SCE_PL_REGSUBST 18
#define SCE_PL_LONGQUOTE 19
@ -255,6 +267,41 @@
#define SCE_PL_STRING_QX 28
#define SCE_PL_STRING_QR 29
#define SCE_PL_STRING_QW 30
#define SCE_PL_POD_VERB 31
#define SCE_RB_DEFAULT 0
#define SCE_RB_ERROR 1
#define SCE_RB_COMMENTLINE 2
#define SCE_RB_POD 3
#define SCE_RB_NUMBER 4
#define SCE_RB_WORD 5
#define SCE_RB_STRING 6
#define SCE_RB_CHARACTER 7
#define SCE_RB_CLASSNAME 8
#define SCE_RB_DEFNAME 9
#define SCE_RB_OPERATOR 10
#define SCE_RB_IDENTIFIER 11
#define SCE_RB_REGEX 12
#define SCE_RB_GLOBAL 13
#define SCE_RB_SYMBOL 14
#define SCE_RB_MODULE_NAME 15
#define SCE_RB_INSTANCE_VAR 16
#define SCE_RB_CLASS_VAR 17
#define SCE_RB_BACKTICKS 18
#define SCE_RB_DATASECTION 19
#define SCE_RB_HERE_DELIM 20
#define SCE_RB_HERE_Q 21
#define SCE_RB_HERE_QQ 22
#define SCE_RB_HERE_QX 23
#define SCE_RB_STRING_Q 24
#define SCE_RB_STRING_QQ 25
#define SCE_RB_STRING_QX 26
#define SCE_RB_STRING_QR 27
#define SCE_RB_STRING_QW 28
#define SCE_RB_WORD_DEMOTED 29
#define SCE_RB_STDIN 30
#define SCE_RB_STDOUT 31
#define SCE_RB_STDERR 40
#define SCE_RB_UPPER_BOUND 41
#define SCE_B_DEFAULT 0
#define SCE_B_COMMENT 1
#define SCE_B_NUMBER 2
@ -270,6 +317,10 @@
#define SCE_B_KEYWORD4 12
#define SCE_B_CONSTANT 13
#define SCE_B_ASM 14
#define SCE_B_LABEL 15
#define SCE_B_ERROR 16
#define SCE_B_HEXNUMBER 17
#define SCE_B_BINNUMBER 18
#define SCE_PROPS_DEFAULT 0
#define SCE_PROPS_COMMENT 1
#define SCE_PROPS_SECTION 2
@ -395,10 +446,14 @@
#define SCE_LISP_COMMENT 1
#define SCE_LISP_NUMBER 2
#define SCE_LISP_KEYWORD 3
#define SCE_LISP_KEYWORD_KW 4
#define SCE_LISP_SYMBOL 5
#define SCE_LISP_STRING 6
#define SCE_LISP_STRINGEOL 8
#define SCE_LISP_IDENTIFIER 9
#define SCE_LISP_OPERATOR 10
#define SCE_LISP_SPECIAL 11
#define SCE_LISP_MULTI_COMMENT 12
#define SCE_EIFFEL_DEFAULT 0
#define SCE_EIFFEL_COMMENTLINE 1
#define SCE_EIFFEL_NUMBER 2
@ -502,6 +557,7 @@
#define SCE_CSS_DOUBLESTRING 13
#define SCE_CSS_SINGLESTRING 14
#define SCE_CSS_IDENTIFIER2 15
#define SCE_CSS_ATTRIBUTE 16
#define SCE_POV_DEFAULT 0
#define SCE_POV_COMMENT 1
#define SCE_POV_COMMENTLINE 2
@ -573,6 +629,10 @@
#define SCE_NSIS_MACRODEF 12
#define SCE_NSIS_STRINGVAR 13
#define SCE_NSIS_NUMBER 14
#define SCE_NSIS_SECTIONGROUP 15
#define SCE_NSIS_PAGEEX 16
#define SCE_NSIS_FUNCTIONDEF 17
#define SCE_NSIS_COMMENTBOX 18
#define SCE_MMIXAL_LEADWS 0
#define SCE_MMIXAL_COMMENT 1
#define SCE_MMIXAL_LABEL 2
@ -601,11 +661,13 @@
#define SCE_CLW_PICTURE_STRING 7
#define SCE_CLW_KEYWORD 8
#define SCE_CLW_COMPILER_DIRECTIVE 9
#define SCE_CLW_BUILTIN_PROCEDURES_FUNCTION 10
#define SCE_CLW_STRUCTURE_DATA_TYPE 11
#define SCE_CLW_ATTRIBUTE 12
#define SCE_CLW_STANDARD_EQUATE 13
#define SCE_CLW_ERROR 14
#define SCE_CLW_RUNTIME_EXPRESSIONS 10
#define SCE_CLW_BUILTIN_PROCEDURES_FUNCTION 11
#define SCE_CLW_STRUCTURE_DATA_TYPE 12
#define SCE_CLW_ATTRIBUTE 13
#define SCE_CLW_STANDARD_EQUATE 14
#define SCE_CLW_ERROR 15
#define SCE_CLW_DEPRECATED 16
#define SCE_LOT_DEFAULT 0
#define SCE_LOT_HEADER 1
#define SCE_LOT_BREAK 2
@ -731,6 +793,8 @@
#define SCE_AU3_SENT 10
#define SCE_AU3_PREPROCESSOR 11
#define SCE_AU3_SPECIAL 12
#define SCE_AU3_EXPAND 13
#define SCE_AU3_COMOBJ 14
#define SCE_APDL_DEFAULT 0
#define SCE_APDL_COMMENT 1
#define SCE_APDL_COMMENTBLOCK 2
@ -784,6 +848,168 @@
#define SCE_VHDL_STDPACKAGE 12
#define SCE_VHDL_STDTYPE 13
#define SCE_VHDL_USERWORD 14
#define SCE_CAML_DEFAULT 0
#define SCE_CAML_IDENTIFIER 1
#define SCE_CAML_TAGNAME 2
#define SCE_CAML_KEYWORD 3
#define SCE_CAML_KEYWORD2 4
#define SCE_CAML_KEYWORD3 5
#define SCE_CAML_LINENUM 6
#define SCE_CAML_OPERATOR 7
#define SCE_CAML_NUMBER 8
#define SCE_CAML_CHAR 9
#define SCE_CAML_STRING 11
#define SCE_CAML_COMMENT 12
#define SCE_CAML_COMMENT1 13
#define SCE_CAML_COMMENT2 14
#define SCE_CAML_COMMENT3 15
#define SCE_HA_DEFAULT 0
#define SCE_HA_IDENTIFIER 1
#define SCE_HA_KEYWORD 2
#define SCE_HA_NUMBER 3
#define SCE_HA_STRING 4
#define SCE_HA_CHARACTER 5
#define SCE_HA_CLASS 6
#define SCE_HA_MODULE 7
#define SCE_HA_CAPITAL 8
#define SCE_HA_DATA 9
#define SCE_HA_IMPORT 10
#define SCE_HA_OPERATOR 11
#define SCE_HA_INSTANCE 12
#define SCE_HA_COMMENTLINE 13
#define SCE_HA_COMMENTBLOCK 14
#define SCE_HA_COMMENTBLOCK2 15
#define SCE_HA_COMMENTBLOCK3 16
#define SCE_T3_DEFAULT 0
#define SCE_T3_X_DEFAULT 1
#define SCE_T3_PREPROCESSOR 2
#define SCE_T3_BLOCK_COMMENT 3
#define SCE_T3_LINE_COMMENT 4
#define SCE_T3_OPERATOR 5
#define SCE_T3_KEYWORD 6
#define SCE_T3_NUMBER 7
#define SCE_T3_IDENTIFIER 8
#define SCE_T3_S_STRING 9
#define SCE_T3_D_STRING 10
#define SCE_T3_X_STRING 11
#define SCE_T3_LIB_DIRECTIVE 12
#define SCE_T3_MSG_PARAM 13
#define SCE_T3_HTML_TAG 14
#define SCE_T3_HTML_DEFAULT 15
#define SCE_T3_HTML_STRING 16
#define SCE_T3_USER1 17
#define SCE_T3_USER2 18
#define SCE_T3_USER3 19
#define SCE_REBOL_DEFAULT 0
#define SCE_REBOL_COMMENTLINE 1
#define SCE_REBOL_COMMENTBLOCK 2
#define SCE_REBOL_PREFACE 3
#define SCE_REBOL_OPERATOR 4
#define SCE_REBOL_CHARACTER 5
#define SCE_REBOL_QUOTEDSTRING 6
#define SCE_REBOL_BRACEDSTRING 7
#define SCE_REBOL_NUMBER 8
#define SCE_REBOL_PAIR 9
#define SCE_REBOL_TUPLE 10
#define SCE_REBOL_BINARY 11
#define SCE_REBOL_MONEY 12
#define SCE_REBOL_ISSUE 13
#define SCE_REBOL_TAG 14
#define SCE_REBOL_FILE 15
#define SCE_REBOL_EMAIL 16
#define SCE_REBOL_URL 17
#define SCE_REBOL_DATE 18
#define SCE_REBOL_TIME 19
#define SCE_REBOL_IDENTIFIER 20
#define SCE_REBOL_WORD 21
#define SCE_REBOL_WORD2 22
#define SCE_REBOL_WORD3 23
#define SCE_REBOL_WORD4 24
#define SCE_REBOL_WORD5 25
#define SCE_REBOL_WORD6 26
#define SCE_REBOL_WORD7 27
#define SCE_REBOL_WORD8 28
#define SCE_SQL_DEFAULT 0
#define SCE_SQL_COMMENT 1
#define SCE_SQL_COMMENTLINE 2
#define SCE_SQL_COMMENTDOC 3
#define SCE_SQL_NUMBER 4
#define SCE_SQL_WORD 5
#define SCE_SQL_STRING 6
#define SCE_SQL_CHARACTER 7
#define SCE_SQL_SQLPLUS 8
#define SCE_SQL_SQLPLUS_PROMPT 9
#define SCE_SQL_OPERATOR 10
#define SCE_SQL_IDENTIFIER 11
#define SCE_SQL_SQLPLUS_COMMENT 13
#define SCE_SQL_COMMENTLINEDOC 15
#define SCE_SQL_WORD2 16
#define SCE_SQL_COMMENTDOCKEYWORD 17
#define SCE_SQL_COMMENTDOCKEYWORDERROR 18
#define SCE_SQL_USER1 19
#define SCE_SQL_USER2 20
#define SCE_SQL_USER3 21
#define SCE_SQL_USER4 22
#define SCE_SQL_QUOTEDIDENTIFIER 23
#define SCE_ST_DEFAULT 0
#define SCE_ST_STRING 1
#define SCE_ST_NUMBER 2
#define SCE_ST_COMMENT 3
#define SCE_ST_SYMBOL 4
#define SCE_ST_BINARY 5
#define SCE_ST_BOOL 6
#define SCE_ST_SELF 7
#define SCE_ST_SUPER 8
#define SCE_ST_NIL 9
#define SCE_ST_GLOBAL 10
#define SCE_ST_RETURN 11
#define SCE_ST_SPECIAL 12
#define SCE_ST_KWSEND 13
#define SCE_ST_ASSIGN 14
#define SCE_ST_CHARACTER 15
#define SCE_ST_SPEC_SEL 16
#define SCE_FS_DEFAULT 0
#define SCE_FS_COMMENT 1
#define SCE_FS_COMMENTLINE 2
#define SCE_FS_COMMENTDOC 3
#define SCE_FS_COMMENTLINEDOC 4
#define SCE_FS_COMMENTDOCKEYWORD 5
#define SCE_FS_COMMENTDOCKEYWORDERROR 6
#define SCE_FS_KEYWORD 7
#define SCE_FS_KEYWORD2 8
#define SCE_FS_KEYWORD3 9
#define SCE_FS_KEYWORD4 10
#define SCE_FS_NUMBER 11
#define SCE_FS_STRING 12
#define SCE_FS_PREPROCESSOR 13
#define SCE_FS_OPERATOR 14
#define SCE_FS_IDENTIFIER 15
#define SCE_FS_DATE 16
#define SCE_FS_STRINGEOL 17
#define SCE_FS_CONSTANT 18
#define SCE_FS_ASM 19
#define SCE_FS_LABEL 20
#define SCE_FS_ERROR 21
#define SCE_FS_HEXNUMBER 22
#define SCE_FS_BINNUMBER 23
#define SCE_CSOUND_DEFAULT 0
#define SCE_CSOUND_COMMENT 1
#define SCE_CSOUND_NUMBER 2
#define SCE_CSOUND_OPERATOR 3
#define SCE_CSOUND_INSTR 4
#define SCE_CSOUND_IDENTIFIER 5
#define SCE_CSOUND_OPCODE 6
#define SCE_CSOUND_HEADERSTMT 7
#define SCE_CSOUND_USERKEYWORD 8
#define SCE_CSOUND_COMMENTBLOCK 9
#define SCE_CSOUND_PARAM 10
#define SCE_CSOUND_ARATE_VAR 11
#define SCE_CSOUND_KRATE_VAR 12
#define SCE_CSOUND_IRATE_VAR 13
#define SCE_CSOUND_GLOBAL_VAR 14
#define SCE_CSOUND_STRINGEOL 15
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface
#endif

View File

@ -11,23 +11,23 @@
#ifndef SCINTILLA_H
#define SCINTILLA_H
#ifdef PLAT_WIN
#if LCCWIN
typedef BOOL bool;
#endif
#if PLAT_WIN
// Return false on failure:
bool Scintilla_RegisterClasses(void *hInstance);
bool Scintilla_ReleaseResources();
#endif
#endif
int Scintilla_LinkLexers();
// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
// hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
// May need to be changed for 64 bit platforms.
#ifdef _MSC_VER
#if _MSC_VER >= 1300
#include <BaseTsd.h>
#endif
#endif
#ifdef MAXULONG_PTR
typedef ULONG_PTR uptr_t;
typedef LONG_PTR sptr_t;
@ -117,6 +117,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARK_DOTDOTDOT 23
#define SC_MARK_ARROWS 24
#define SC_MARK_PIXMAP 25
#define SC_MARK_FULLRECT 26
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
@ -136,6 +137,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_MARKERNEXT 2047
#define SCI_MARKERPREVIOUS 2048
#define SCI_MARKERDEFINEPIXMAP 2049
#define SCI_MARKERADDSET 2466
#define SC_MARGIN_SYMBOL 0
#define SC_MARGIN_NUMBER 1
#define SCI_SETMARGINTYPEN 2240
@ -165,6 +167,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_CHARSET_MAC 77
#define SC_CHARSET_OEM 255
#define SC_CHARSET_RUSSIAN 204
#define SC_CHARSET_CYRILLIC 1251
#define SC_CHARSET_SHIFTJIS 128
#define SC_CHARSET_SYMBOL 2
#define SC_CHARSET_TURKISH 162
@ -173,6 +176,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_CHARSET_ARABIC 178
#define SC_CHARSET_VIETNAMESE 163
#define SC_CHARSET_THAI 222
#define SC_CHARSET_8859_15 1000
#define SCI_STYLECLEARALL 2050
#define SCI_STYLESETFORE 2051
#define SCI_STYLESETBACK 2052
@ -255,6 +259,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_CLEARREGISTEREDIMAGES 2408
#define SCI_AUTOCGETTYPESEPARATOR 2285
#define SCI_AUTOCSETTYPESEPARATOR 2286
#define SCI_AUTOCSETMAXWIDTH 2208
#define SCI_AUTOCGETMAXWIDTH 2209
#define SCI_AUTOCSETMAXHEIGHT 2210
#define SCI_AUTOCGETMAXHEIGHT 2211
#define SCI_SETINDENT 2122
#define SCI_GETINDENT 2123
#define SCI_SETUSETABS 2124
@ -352,6 +360,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_CALLTIPSETFOREHLT 2207
#define SCI_VISIBLEFROMDOCLINE 2220
#define SCI_DOCLINEFROMVISIBLE 2221
#define SCI_WRAPCOUNT 2235
#define SC_FOLDLEVELBASE 0x400
#define SC_FOLDLEVELWHITEFLAG 0x1000
#define SC_FOLDLEVELHEADERFLAG 0x2000
@ -390,6 +399,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_WORDENDPOSITION 2267
#define SC_WRAP_NONE 0
#define SC_WRAP_WORD 1
#define SC_WRAP_CHAR 2
#define SCI_SETWRAPMODE 2268
#define SCI_GETWRAPMODE 2269
#define SC_WRAPVISUALFLAG_NONE 0x0000
@ -591,6 +601,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETLENGTHFORENCODE 2448
#define SCI_ENCODEDFROMUTF8 2449
#define SCI_FINDCOLUMN 2456
#define SCI_GETCARETSTICKY 2457
#define SCI_SETCARETSTICKY 2458
#define SCI_TOGGLECARETSTICKY 2459
#define SCI_SETPASTECONVERTENDINGS 2467
#define SCI_GETPASTECONVERTENDINGS 2468
#define SCI_SELECTIONDUPLICATE 2469
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
@ -601,6 +617,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETKEYWORDS 4005
#define SCI_SETLEXERLANGUAGE 4006
#define SCI_LOADLEXERLIBRARY 4007
#define SCI_GETPROPERTY 4008
#define SCI_GETPROPERTYEXPANDED 4009
#define SCI_GETPROPERTYINT 4010
#define SCI_GETSTYLEBITSNEEDED 4011
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
@ -608,11 +628,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_PERFORMED_USER 0x10
#define SC_PERFORMED_UNDO 0x20
#define SC_PERFORMED_REDO 0x40
#define SC_MULTISTEPUNDOREDO 0x80
#define SC_LASTSTEPINUNDOREDO 0x100
#define SC_MOD_CHANGEMARKER 0x200
#define SC_MOD_BEFOREINSERT 0x400
#define SC_MOD_BEFOREDELETE 0x800
#define SC_MODEVENTMASKALL 0xF77
#define SC_MULTILINEUNDOREDO 0x1000
#define SC_MODEVENTMASKALL 0x1FFF
#define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512
#define SCEN_KILLFOCUS 256
@ -633,6 +655,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCK_ADD 310
#define SCK_SUBTRACT 311
#define SCK_DIVIDE 312
#define SCMOD_NORM 0
#define SCMOD_SHIFT 1
#define SCMOD_CTRL 2
#define SCMOD_ALT 4
@ -657,6 +680,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCN_HOTSPOTCLICK 2019
#define SCN_HOTSPOTDOUBLECLICK 2020
#define SCN_CALLTIPCLICK 2021
#define SCN_AUTOCSELECTION 2022
//--Autogenerated -- end of section automatically generated from Scintilla.iface
// These structures are defined to be exactly the same shape as the Win32
@ -695,11 +719,11 @@ struct RangeToFormat {
#endif
struct NotifyHeader {
// hwndFrom is really an environment specifc window handle or pointer
// Compatible with Windows NMHDR.
// hwndFrom is really an environment specific window handle or pointer
// but most clients of Scintilla.h do not have this type visible.
//WindowID hwndFrom;
void *hwndFrom;
unsigned int idFrom;
uptr_t idFrom;
unsigned int code;
};
@ -709,7 +733,7 @@ struct SCNotification {
int ch; // SCN_CHARADDED, SCN_KEY
int modifiers; // SCN_KEY
int modificationType; // SCN_MODIFIED
const char *text; // SCN_MODIFIED
const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION
int length; // SCN_MODIFIED
int linesAdded; // SCN_MODIFIED
int message; // SCN_MACRORECORD

View File

@ -267,6 +267,7 @@ val SC_MARK_BACKGROUND=22
val SC_MARK_DOTDOTDOT=23
val SC_MARK_ARROWS=24
val SC_MARK_PIXMAP=25
val SC_MARK_FULLRECT=26
val SC_MARK_CHARACTER=10000
@ -312,6 +313,9 @@ fun int MarkerPrevious=2048(int lineStart, int markerMask)
# Define a marker from a pixmap.
fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap)
# Add a set of markers to a line.
fun void MarkerAddSet=2466(int line, int set)
enu MarginType=SC_MARGIN_
val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1
@ -366,6 +370,7 @@ val SC_CHARSET_HANGUL=129
val SC_CHARSET_MAC=77
val SC_CHARSET_OEM=255
val SC_CHARSET_RUSSIAN=204
val SC_CHARSET_CYRILLIC=1251
val SC_CHARSET_SHIFTJIS=128
val SC_CHARSET_SYMBOL=2
val SC_CHARSET_TURKISH=162
@ -374,6 +379,7 @@ val SC_CHARSET_HEBREW=177
val SC_CHARSET_ARABIC=178
val SC_CHARSET_VIETNAMESE=163
val SC_CHARSET_THAI=222
val SC_CHARSET_8859_15=1000
# Clear all the styles and make equivalent to the global default style.
set void StyleClearAll=2050(,)
@ -607,6 +613,20 @@ get int AutoCGetTypeSeparator=2285(,)
# Default is '?' but can be changed if items contain '?'.
set void AutoCSetTypeSeparator=2286(int separatorCharacter,)
# Set the maximum width, in characters, of auto-completion and user lists.
# Set to 0 to autosize to fit longest item, which is the default.
set void AutoCSetMaxWidth=2208(int characterCount,)
# Get the maximum width, in characters, of auto-completion and user lists.
get int AutoCGetMaxWidth=2209(,)
# Set the maximum height, in rows, of auto-completion and user lists.
# The default is 5 rows.
set void AutoCSetMaxHeight=2210(int rowCount,)
# Set the maximum height, in rows, of auto-completion and user lists.
get int AutoCGetMaxHeight=2211(,)
# Set the number of spaces used for one level of indentation.
set void SetIndent=2122(int indentSize,)
@ -905,6 +925,9 @@ fun int VisibleFromDocLine=2220(int line,)
# Find the document line of a display line taking hidden lines into account.
fun int DocLineFromVisible=2221(int lineDisplay,)
# The number of display lines needed to wrap a document line
fun int WrapCount=2235(int line,)
enu FoldLevel=SC_FOLDLEVEL
val SC_FOLDLEVELBASE=0x400
val SC_FOLDLEVELWHITEFLAG=0x1000
@ -994,6 +1017,7 @@ fun int WordEndPosition=2267(position pos, bool onlyWordCharacters)
enu Wrap=SC_WRAP_
val SC_WRAP_NONE=0
val SC_WRAP_WORD=1
val SC_WRAP_CHAR=2
# Sets whether text is word wrapped.
set void SetWrapMode=2268(int mode,)
@ -1059,7 +1083,7 @@ set void SetEndAtLastLine=2277(bool endAtLastLine,)
# Retrieve whether the maximum scroll position has the last
# line at the bottom of the view.
get int GetEndAtLastLine=2278(,)
get bool GetEndAtLastLine=2278(,)
# Retrieve the height of a particular line of text in pixels.
fun int TextHeight=2279(int line,)
@ -1588,7 +1612,7 @@ fun void Allocate=2446(int bytes,)
fun int TargetAsUTF8=2447(, stringresult s)
# Set the length of the utf8 argument for calling EncodedFromUTF8.
# Set to 0 and the string will be measured to the first nul.
# Set to -1 and the string will be measured to the first nul.
fun void SetLengthForEncode=2448(int bytes,)
# Translates a UTF8 string into the document encoding.
@ -1596,10 +1620,28 @@ fun void SetLengthForEncode=2448(int bytes,)
# On error return 0.
fun int EncodedFromUTF8=2449(string utf8, stringresult encoded)
# Find the position of a column on a line taking into account tabs and
# Find the position of a column on a line taking into account tabs and
# multi-byte characters. If beyond end of line, return line end position.
fun int FindColumn=2456(int line, int column)
# Can the caret preferred x position only be changed by explicit movement commands?
get bool GetCaretSticky=2457(,)
# Stop the caret preferred x position changing when the user types.
set void SetCaretSticky=2458(bool useCaretStickyBehaviour,)
# Switch between sticky and non-sticky: meant to be bound to a key.
fun void ToggleCaretSticky=2459(,)
# Enable/Disable convert-on-paste for line endings
set void SetPasteConvertEndings=2467(bool convert,)
# Get convert-on-paste setting
get bool GetPasteConvertEndings=2468(,)
# Duplicate the selection. If selection empty duplicate the line containing the caret.
fun void SelectionDuplicate=2469(,)
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@ -1630,6 +1672,20 @@ set void SetLexerLanguage=4006(, string language)
# Load a lexer library (dll / so).
fun void LoadLexerLibrary=4007(, string path)
# Retrieve a "property" value previously set with SetProperty.
fun int GetProperty=4008(string key, stringresult buf)
# Retrieve a "property" value previously set with SetProperty,
# with "$()" variable replacement on returned buffer.
fun int GetPropertyExpanded=4009(string key, stringresult buf)
# Retrieve a "property" value previously set with SetProperty,
# interpreted as an int AFTER any "$()" variable replacement.
get int GetPropertyInt=4010(string key,)
# Retrieve the number of bits the current lexer needs for styling.
get int GetStyleBitsNeeded=4011(,)
# Notifications
# Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted.
@ -1642,11 +1698,13 @@ val SC_MOD_CHANGEFOLD=0x8
val SC_PERFORMED_USER=0x10
val SC_PERFORMED_UNDO=0x20
val SC_PERFORMED_REDO=0x40
val SC_MULTISTEPUNDOREDO=0x80
val SC_LASTSTEPINUNDOREDO=0x100
val SC_MOD_CHANGEMARKER=0x200
val SC_MOD_BEFOREINSERT=0x400
val SC_MOD_BEFOREDELETE=0x800
val SC_MODEVENTMASKALL=0xF77
val SC_MULTILINEUNDOREDO=0x1000
val SC_MODEVENTMASKALL=0x1FFF
# For compatibility, these go through the COMMAND notification rather than NOTIFY
# and should have had exactly the same values as the EN_* constants.
@ -1680,6 +1738,7 @@ val SCK_SUBTRACT=311
val SCK_DIVIDE=312
enu KeyMod=SCMOD_
val SCMOD_NORM=0
val SCMOD_SHIFT=1
val SCMOD_CTRL=2
val SCMOD_ALT=4
@ -1716,8 +1775,6 @@ val SCLEX_TCL=25
val SCLEX_NNCRONTAB=26
val SCLEX_BULLANT=27
val SCLEX_VBSCRIPT=28
val SCLEX_ASP=29
val SCLEX_PHP=30
val SCLEX_BAAN=31
val SCLEX_MATLAB=32
val SCLEX_SCRIPTOL=33
@ -1752,13 +1809,23 @@ val SCLEX_APDL=61
val SCLEX_BASH=62
val SCLEX_ASN1=63
val SCLEX_VHDL=64
val SCLEX_CAML=65
val SCLEX_BLITZBASIC=66
val SCLEX_PUREBASIC=67
val SCLEX_HASKELL=68
val SCLEX_PHPSCRIPT=69
val SCLEX_TADS3=70
val SCLEX_REBOL=71
val SCLEX_SMALLTALK=72
val SCLEX_FLAGSHIP=73
val SCLEX_CSOUND=74
val SCLEX_FREEBASIC=75
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
val SCLEX_AUTOMATIC=1000
# Lexical states for SCLEX_PYTHON
lex Python=SCLEX_PYTHON SCE_P_
lex Ruby=SCLEX_RUBY SCE_P_
val SCE_P_DEFAULT=0
val SCE_P_COMMENTLINE=1
val SCE_P_NUMBER=2
@ -1773,9 +1840,10 @@ val SCE_P_OPERATOR=10
val SCE_P_IDENTIFIER=11
val SCE_P_COMMENTBLOCK=12
val SCE_P_STRINGEOL=13
val SCE_P_WORD2=14
val SCE_P_DECORATOR=15
# Lexical states for SCLEX_CPP
lex Cpp=SCLEX_CPP SCE_C_
lex SQL=SCLEX_SQL SCE_C_
lex Pascal=SCLEX_PASCAL SCE_C_
lex TCL=SCLEX_TCL SCE_C_
lex BullAnt=SCLEX_BULLANT SCE_C_
@ -1945,6 +2013,7 @@ val SCE_PL_SCALAR=12
val SCE_PL_ARRAY=13
val SCE_PL_HASH=14
val SCE_PL_SYMBOLTABLE=15
val SCE_PL_VARIABLE_INDEXER=16
val SCE_PL_REGEX=17
val SCE_PL_REGSUBST=18
val SCE_PL_LONGQUOTE=19
@ -1959,6 +2028,43 @@ val SCE_PL_STRING_QQ=27
val SCE_PL_STRING_QX=28
val SCE_PL_STRING_QR=29
val SCE_PL_STRING_QW=30
val SCE_PL_POD_VERB=31
# Lexical states for SCLEX_RUBY
lex Ruby=SCLEX_RUBY SCE_RB_
val SCE_RB_DEFAULT=0
val SCE_RB_ERROR=1
val SCE_RB_COMMENTLINE=2
val SCE_RB_POD=3
val SCE_RB_NUMBER=4
val SCE_RB_WORD=5
val SCE_RB_STRING=6
val SCE_RB_CHARACTER=7
val SCE_RB_CLASSNAME=8
val SCE_RB_DEFNAME=9
val SCE_RB_OPERATOR=10
val SCE_RB_IDENTIFIER=11
val SCE_RB_REGEX=12
val SCE_RB_GLOBAL=13
val SCE_RB_SYMBOL=14
val SCE_RB_MODULE_NAME=15
val SCE_RB_INSTANCE_VAR=16
val SCE_RB_CLASS_VAR=17
val SCE_RB_BACKTICKS=18
val SCE_RB_DATASECTION=19
val SCE_RB_HERE_DELIM=20
val SCE_RB_HERE_Q=21
val SCE_RB_HERE_QQ=22
val SCE_RB_HERE_QX=23
val SCE_RB_STRING_Q=24
val SCE_RB_STRING_QQ=25
val SCE_RB_STRING_QX=26
val SCE_RB_STRING_QR=27
val SCE_RB_STRING_QW=28
val SCE_RB_WORD_DEMOTED=29
val SCE_RB_STDIN=30
val SCE_RB_STDOUT=31
val SCE_RB_STDERR=40
val SCE_RB_UPPER_BOUND=41
# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC
lex VB=SCLEX_VB SCE_B_
lex VBScript=SCLEX_VBSCRIPT SCE_B_
@ -1978,6 +2084,10 @@ val SCE_B_KEYWORD3=11
val SCE_B_KEYWORD4=12
val SCE_B_CONSTANT=13
val SCE_B_ASM=14
val SCE_B_LABEL=15
val SCE_B_ERROR=16
val SCE_B_HEXNUMBER=17
val SCE_B_BINNUMBER=18
# Lexical states for SCLEX_PROPERTIES
lex Properties=SCLEX_PROPERTIES SCE_PROPS_
val SCE_PROPS_DEFAULT=0
@ -2127,10 +2237,14 @@ val SCE_LISP_DEFAULT=0
val SCE_LISP_COMMENT=1
val SCE_LISP_NUMBER=2
val SCE_LISP_KEYWORD=3
val SCE_LISP_KEYWORD_KW=4
val SCE_LISP_SYMBOL=5
val SCE_LISP_STRING=6
val SCE_LISP_STRINGEOL=8
val SCE_LISP_IDENTIFIER=9
val SCE_LISP_OPERATOR=10
val SCE_LISP_SPECIAL=11
val SCE_LISP_MULTI_COMMENT=12
# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_
lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_
@ -2253,6 +2367,7 @@ val SCE_CSS_DIRECTIVE=12
val SCE_CSS_DOUBLESTRING=13
val SCE_CSS_SINGLESTRING=14
val SCE_CSS_IDENTIFIER2=15
val SCE_CSS_ATTRIBUTE=16
# Lexical states for SCLEX_POV
lex POV=SCLEX_POV SCE_POV_
val SCE_POV_DEFAULT=0
@ -2334,6 +2449,10 @@ val SCE_NSIS_IFDEFINEDEF=11
val SCE_NSIS_MACRODEF=12
val SCE_NSIS_STRINGVAR=13
val SCE_NSIS_NUMBER=14
val SCE_NSIS_SECTIONGROUP=15
val SCE_NSIS_PAGEEX=16
val SCE_NSIS_FUNCTIONDEF=17
val SCE_NSIS_COMMENTBOX=18
# Lexical states for SCLEX_MMIXAL
lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_
val SCE_MMIXAL_LEADWS=0
@ -2366,11 +2485,13 @@ val SCE_CLW_REAL_CONSTANT=6
val SCE_CLW_PICTURE_STRING=7
val SCE_CLW_KEYWORD=8
val SCE_CLW_COMPILER_DIRECTIVE=9
val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=10
val SCE_CLW_STRUCTURE_DATA_TYPE=11
val SCE_CLW_ATTRIBUTE=12
val SCE_CLW_STANDARD_EQUATE=13
val SCE_CLW_ERROR=14
val SCE_CLW_RUNTIME_EXPRESSIONS=10
val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=11
val SCE_CLW_STRUCTURE_DATA_TYPE=12
val SCE_CLW_ATTRIBUTE=13
val SCE_CLW_STANDARD_EQUATE=14
val SCE_CLW_ERROR=15
val SCE_CLW_DEPRECATED=16
# Lexical states for SCLEX_LOT
lex LOT=SCLEX_LOT SCE_LOT_
val SCE_LOT_DEFAULT=0
@ -2518,6 +2639,8 @@ val SCE_AU3_VARIABLE=9
val SCE_AU3_SENT=10
val SCE_AU3_PREPROCESSOR=11
val SCE_AU3_SPECIAL=12
val SCE_AU3_EXPAND=13
val SCE_AU3_COMOBJ=14
# Lexical states for SCLEX_APDL
lex APDL=SCLEX_APDL SCE_APDL_
val SCE_APDL_DEFAULT=0
@ -2579,6 +2702,182 @@ val SCE_VHDL_STDFUNCTION=11
val SCE_VHDL_STDPACKAGE=12
val SCE_VHDL_STDTYPE=13
val SCE_VHDL_USERWORD=14
# Lexical states for SCLEX_CAML
lex Caml=SCLEX_CAML SCE_CAML_
val SCE_CAML_DEFAULT=0
val SCE_CAML_IDENTIFIER=1
val SCE_CAML_TAGNAME=2
val SCE_CAML_KEYWORD=3
val SCE_CAML_KEYWORD2=4
val SCE_CAML_KEYWORD3=5
val SCE_CAML_LINENUM=6
val SCE_CAML_OPERATOR=7
val SCE_CAML_NUMBER=8
val SCE_CAML_CHAR=9
val SCE_CAML_STRING=11
val SCE_CAML_COMMENT=12
val SCE_CAML_COMMENT1=13
val SCE_CAML_COMMENT2=14
val SCE_CAML_COMMENT3=15
# Lexical states for SCLEX_HASKELL
lex Haskell=SCLEX_HASKELL SCE_HA_
val SCE_HA_DEFAULT=0
val SCE_HA_IDENTIFIER=1
val SCE_HA_KEYWORD=2
val SCE_HA_NUMBER=3
val SCE_HA_STRING=4
val SCE_HA_CHARACTER=5
val SCE_HA_CLASS=6
val SCE_HA_MODULE=7
val SCE_HA_CAPITAL=8
val SCE_HA_DATA=9
val SCE_HA_IMPORT=10
val SCE_HA_OPERATOR=11
val SCE_HA_INSTANCE=12
val SCE_HA_COMMENTLINE=13
val SCE_HA_COMMENTBLOCK=14
val SCE_HA_COMMENTBLOCK2=15
val SCE_HA_COMMENTBLOCK3=16
# Lexical states of SCLEX_TADS3
lex TADS3=SCLEX_TADS3 SCE_T3_
val SCE_T3_DEFAULT=0
val SCE_T3_X_DEFAULT=1
val SCE_T3_PREPROCESSOR=2
val SCE_T3_BLOCK_COMMENT=3
val SCE_T3_LINE_COMMENT=4
val SCE_T3_OPERATOR=5
val SCE_T3_KEYWORD=6
val SCE_T3_NUMBER=7
val SCE_T3_IDENTIFIER=8
val SCE_T3_S_STRING=9
val SCE_T3_D_STRING=10
val SCE_T3_X_STRING=11
val SCE_T3_LIB_DIRECTIVE=12
val SCE_T3_MSG_PARAM=13
val SCE_T3_HTML_TAG=14
val SCE_T3_HTML_DEFAULT=15
val SCE_T3_HTML_STRING=16
val SCE_T3_USER1=17
val SCE_T3_USER2=18
val SCE_T3_USER3=19
# Lexical states for SCLEX_REBOL
lex Rebol=SCLEX_REBOL SCE_REBOL_
val SCE_REBOL_DEFAULT=0
val SCE_REBOL_COMMENTLINE=1
val SCE_REBOL_COMMENTBLOCK=2
val SCE_REBOL_PREFACE=3
val SCE_REBOL_OPERATOR=4
val SCE_REBOL_CHARACTER=5
val SCE_REBOL_QUOTEDSTRING=6
val SCE_REBOL_BRACEDSTRING=7
val SCE_REBOL_NUMBER=8
val SCE_REBOL_PAIR=9
val SCE_REBOL_TUPLE=10
val SCE_REBOL_BINARY=11
val SCE_REBOL_MONEY=12
val SCE_REBOL_ISSUE=13
val SCE_REBOL_TAG=14
val SCE_REBOL_FILE=15
val SCE_REBOL_EMAIL=16
val SCE_REBOL_URL=17
val SCE_REBOL_DATE=18
val SCE_REBOL_TIME=19
val SCE_REBOL_IDENTIFIER=20
val SCE_REBOL_WORD=21
val SCE_REBOL_WORD2=22
val SCE_REBOL_WORD3=23
val SCE_REBOL_WORD4=24
val SCE_REBOL_WORD5=25
val SCE_REBOL_WORD6=26
val SCE_REBOL_WORD7=27
val SCE_REBOL_WORD8=28
# Lexical states for SCLEX_SQL
lex SQL=SCLEX_SQL SCE_SQL_
val SCE_SQL_DEFAULT=0
val SCE_SQL_COMMENT=1
val SCE_SQL_COMMENTLINE=2
val SCE_SQL_COMMENTDOC=3
val SCE_SQL_NUMBER=4
val SCE_SQL_WORD=5
val SCE_SQL_STRING=6
val SCE_SQL_CHARACTER=7
val SCE_SQL_SQLPLUS=8
val SCE_SQL_SQLPLUS_PROMPT=9
val SCE_SQL_OPERATOR=10
val SCE_SQL_IDENTIFIER=11
val SCE_SQL_SQLPLUS_COMMENT=13
val SCE_SQL_COMMENTLINEDOC=15
val SCE_SQL_WORD2=16
val SCE_SQL_COMMENTDOCKEYWORD=17
val SCE_SQL_COMMENTDOCKEYWORDERROR=18
val SCE_SQL_USER1=19
val SCE_SQL_USER2=20
val SCE_SQL_USER3=21
val SCE_SQL_USER4=22
val SCE_SQL_QUOTEDIDENTIFIER=23
# Lexical states for SCLEX_SMALLTALK
lex Smalltalk=SCLEX_SMALLTALK SCE_ST_
val SCE_ST_DEFAULT=0
val SCE_ST_STRING=1
val SCE_ST_NUMBER=2
val SCE_ST_COMMENT=3
val SCE_ST_SYMBOL=4
val SCE_ST_BINARY=5
val SCE_ST_BOOL=6
val SCE_ST_SELF=7
val SCE_ST_SUPER=8
val SCE_ST_NIL=9
val SCE_ST_GLOBAL=10
val SCE_ST_RETURN=11
val SCE_ST_SPECIAL=12
val SCE_ST_KWSEND=13
val SCE_ST_ASSIGN=14
val SCE_ST_CHARACTER=15
val SCE_ST_SPEC_SEL=16
# Lexical states for SCLEX_FLAGSHIP (clipper)
lex FlagShip=SCLEX_FLAGSHIP SCE_B_
val SCE_FS_DEFAULT=0
val SCE_FS_COMMENT=1
val SCE_FS_COMMENTLINE=2
val SCE_FS_COMMENTDOC=3
val SCE_FS_COMMENTLINEDOC=4
val SCE_FS_COMMENTDOCKEYWORD=5
val SCE_FS_COMMENTDOCKEYWORDERROR=6
val SCE_FS_KEYWORD=7
val SCE_FS_KEYWORD2=8
val SCE_FS_KEYWORD3=9
val SCE_FS_KEYWORD4=10
val SCE_FS_NUMBER=11
val SCE_FS_STRING=12
val SCE_FS_PREPROCESSOR=13
val SCE_FS_OPERATOR=14
val SCE_FS_IDENTIFIER=15
val SCE_FS_DATE=16
val SCE_FS_STRINGEOL=17
val SCE_FS_CONSTANT=18
val SCE_FS_ASM=19
val SCE_FS_LABEL=20
val SCE_FS_ERROR=21
val SCE_FS_HEXNUMBER=22
val SCE_FS_BINNUMBER=23
# Lexical states for SCLEX_CSOUND
lex Csound=SCLEX_CSOUND SCE_CSOUND_
val SCE_CSOUND_DEFAULT=0
val SCE_CSOUND_COMMENT=1
val SCE_CSOUND_NUMBER=2
val SCE_CSOUND_OPERATOR=3
val SCE_CSOUND_INSTR=4
val SCE_CSOUND_IDENTIFIER=5
val SCE_CSOUND_OPCODE=6
val SCE_CSOUND_HEADERSTMT=7
val SCE_CSOUND_USERKEYWORD=8
val SCE_CSOUND_COMMENTBLOCK=9
val SCE_CSOUND_PARAM=10
val SCE_CSOUND_ARATE_VAR=11
val SCE_CSOUND_KRATE_VAR=12
val SCE_CSOUND_IRATE_VAR=13
val SCE_CSOUND_GLOBAL_VAR=14
val SCE_CSOUND_STRINGEOL=15
# Events
@ -2604,6 +2903,7 @@ evt void Zoom=2018(void)
evt void HotSpotClick=2019(int modifiers, int position)
evt void HotSpotDoubleClick=2020(int modifiers, int position)
evt void CallTipClick=2021(int position)
evt void AutoCSelection=2022(string text)
cat Deprecated
@ -2617,3 +2917,6 @@ val CARET_XJUMPS=0x10
val SCN_CHECKBRACE=2007
evt void PosChanged=2012(int position)
# SCLEX_HTML should be used in preference to these.
val SCLEX_ASP=29
val SCLEX_PHP=30

View File

@ -34,9 +34,9 @@ struct _ScintillaClass {
void (* notify) (ScintillaObject *ttt);
};
guint scintilla_get_type (void);
GtkType scintilla_get_type (void);
GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci,int id);
void scintilla_set_id (ScintillaObject *sci, uptr_t id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void scintilla_release_resources(void);

View File

@ -43,12 +43,13 @@ bool AutoComplete::Active() {
return active;
}
void AutoComplete::Start(Window &parent, int ctrlID, int position,
int startLen_, int lineHeight, bool unicodeMode) {
void AutoComplete::Start(Window &parent, int ctrlID,
int position, Point location, int startLen_,
int lineHeight, bool unicodeMode) {
if (active) {
Cancel();
}
lb->Create(parent, ctrlID, lineHeight, unicodeMode);
lb->Create(parent, ctrlID, location, lineHeight, unicodeMode);
lb->Clear();
active = true;
startLen = startLen_;
@ -90,41 +91,18 @@ char AutoComplete::GetTypesep() {
}
void AutoComplete::SetList(const char *list) {
lb->Clear();
char *words = new char[strlen(list) + 1];
if (words) {
strcpy(words, list);
char *startword = words;
char *numword = NULL;
int i = 0;
for (; words && words[i]; i++) {
if (words[i] == separator) {
words[i] = '\0';
if (numword)
*numword = '\0';
lb->Append(startword, numword?atoi(numword + 1):-1);
startword = words + i + 1;
numword = NULL;
} else if (words[i] == typesep) {
numword = words + i;
}
}
if (startword) {
if (numword)
*numword = '\0';
lb->Append(startword, numword?atoi(numword + 1):-1);
}
delete []words;
}
lb->SetList(list, separator, typesep);
}
void AutoComplete::Show() {
lb->Show();
lb->Select(0);
void AutoComplete::Show(bool show) {
lb->Show(show);
if (show)
lb->Select(0);
}
void AutoComplete::Cancel() {
if (lb->Created()) {
lb->Clear();
lb->Destroy();
active = false;
}
@ -170,6 +148,18 @@ void AutoComplete::Select(const char *word) {
--pivot;
}
location = pivot;
if (ignoreCase) {
// Check for exact-case match
for (; pivot <= end; pivot++) {
lb->GetValue(pivot, item, maxItemLen);
if (!strncmp(word, item, lenWord)) {
location = pivot;
break;
}
if (CompareNCaseInsensitive(word, item, lenWord))
break;
}
}
} else if (cond < 0) {
end = pivot - 1;
} else if (cond > 0) {

View File

@ -15,7 +15,7 @@ class AutoComplete {
char stopChars[256];
char fillUpChars[256];
char separator;
char typesep; // Type separator
char typesep; // Type seperator
public:
bool ignoreCase;
@ -35,7 +35,7 @@ public:
bool Active();
/// Display the auto completion list positioned to be near a character position
void Start(Window &parent, int ctrlID, int position,
void Start(Window &parent, int ctrlID, int position, Point location,
int startLen_, int lineHeight, bool unicodeMode);
/// The stop chars are characters which, when typed, cause the auto completion list to disappear
@ -50,14 +50,14 @@ public:
void SetSeparator(char separator_);
char GetSeparator();
/// The typesep character is used for separating the word from the type
/// The typesep character is used for seperating the word from the type
void SetTypesep(char separator_);
char GetTypesep();
/// The list string contains a sequence of words separated by the separator character
void SetList(const char *list);
void Show();
void Show(bool show);
void Cancel();
/// Move the current list element by delta, scrolling appropriately

View File

@ -18,8 +18,8 @@ CallTip::CallTip() {
inCallTipMode = false;
posStartCallTip = 0;
val = 0;
xUp = -100;
xDown = -100;
rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
lineHeight = 1;
startHighlight = 0;
endHighlight = 0;
@ -75,12 +75,12 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
if (IsArrowCharacter(s[startSeg])) {
xEnd = x + widthArrow;
offsetMain = xEnd;
rcClient.left = x;
rcClient.right = xEnd;
if (draw) {
const int halfWidth = widthArrow / 2 - 3;
const int centreX = x + widthArrow / 2 - 1;
const int centreY = (rcClient.top + rcClient.bottom) / 2;
rcClient.left = x;
rcClient.right = xEnd;
surface->FillRectangle(rcClient, colourBG.allocated);
PRectangle rcClientInner(rcClient.left+1, rcClient.top+1, rcClient.right-2, rcClient.bottom-1);
surface->FillRectangle(rcClientInner, colourUnSel.allocated);
@ -104,12 +104,11 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
colourBG.allocated, colourBG.allocated);
}
} else {
if (s[startSeg] == '\001') {
xUp = x+1;
} else {
xDown = x+1;
}
}
if (s[startSeg] == '\001') {
rectUp = rcClient;
} else if (s[startSeg] == '\002') {
rectDown = rcClient;
}
} else {
xEnd = x + surface->WidthText(font, s+startSeg, endSeg - startSeg);
@ -203,13 +202,10 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
void CallTip::MouseClick(Point pt) {
clickPlace = 0;
if (pt.y < lineHeight) {
if ((pt.x > xUp) && (pt.x < xUp + widthArrow - 2)) {
clickPlace = 1;
} else if ((pt.x > xDown) && (pt.x < xDown + widthArrow - 2)) {
clickPlace = 2;
}
}
if (rectUp.Contains(pt))
clickPlace = 1;
if (rectDown.Contains(pt))
clickPlace = 2;
}
PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
@ -240,8 +236,8 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
int numLines = 1;
const char *newline;
const char *look = val;
xUp = -100;
xDown = -100;
rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
offsetMain = 5;
int width = PaintContents(surfaceMeasure, false) + 5;
while ((newline = strchr(look, '\n')) != NULL) {

View File

@ -15,8 +15,8 @@ class CallTip {
int endHighlight;
char *val;
Font font;
int xUp;
int xDown;
PRectangle rectUp;
PRectangle rectDown;
int lineHeight;
int offsetMain;
// Private so CallTip objects can not be copied

View File

@ -254,13 +254,14 @@ void LineVector::Remove(int pos) {
linesData[i] = linesData[i + 1];
}
if (levels) {
// Level information merges back onto previous line
int posAbove = pos - 1;
if (posAbove < 0)
posAbove = 0;
for (int j = posAbove; j < lines; j++) {
// Move up following lines but merge header flag from this line
// to line before to avoid a temporary disappearence causing expansion.
int firstHeader = levels[pos] & SC_FOLDLEVELHEADERFLAG;
for (int j = pos; j < lines; j++) {
levels[j] = levels[j + 1];
}
if (pos > 0)
levels[pos-1] |= firstHeader;
}
lines--;
}
@ -464,7 +465,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
} else if (currentAction == savePoint) {
currentAction++;
} else if ((at == insertAction) &&
(position != (actPrevious.position + actPrevious.lenData*2))) {
(position != (actPrevious.position + actPrevious.lenData))) {
// Insertions must be immediately after to coalesce
currentAction++;
} else if (!actions[currentAction].mayCoalesce) {
@ -472,7 +473,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
currentAction++;
} else if (at == removeAction) {
if ((lengthData == 1) || (lengthData == 2)){
if ((position + lengthData * 2) == actPrevious.position) {
if ((position + lengthData) == actPrevious.position) {
; // Backspace -> OK
} else if (position == actPrevious.position) {
; // Delete -> OK
@ -724,7 +725,7 @@ const char *CellBuffer::InsertString(int position, char *s, int insertLength) {
for (int i = 0; i < insertLength / 2; i++) {
data[i] = s[i * 2];
}
uh.AppendAction(insertAction, position, data, insertLength / 2);
uh.AppendAction(insertAction, position / 2, data, insertLength / 2);
}
BasicInsertString(position, s, insertLength);
@ -732,13 +733,6 @@ const char *CellBuffer::InsertString(int position, char *s, int insertLength) {
return data;
}
void CellBuffer::InsertCharStyle(int position, char ch, char style) {
char s[2];
s[0] = ch;
s[1] = style;
InsertString(position*2, s, 2);
}
bool CellBuffer::SetStyleAt(int position, char style, char mask) {
style &= mask;
char curVal = ByteAt(position * 2 + 1);
@ -768,6 +762,7 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mas
const char *CellBuffer::DeleteChars(int position, int deleteLength) {
// InsertString and DeleteChars are the bottleneck though which all changes occur
PLATFORM_ASSERT(deleteLength > 0);
char *data = 0;
if (!readOnly) {
if (collectingUndo) {
@ -776,7 +771,7 @@ const char *CellBuffer::DeleteChars(int position, int deleteLength) {
for (int i = 0; i < deleteLength / 2; i++) {
data[i] = ByteAt(position + i * 2);
}
uh.AppendAction(removeAction, position, data, deleteLength / 2);
uh.AppendAction(removeAction, position / 2, data, deleteLength / 2);
}
BasicDeleteChars(position, deleteLength);
@ -874,6 +869,7 @@ void CellBuffer::BasicInsertString(int position, char *s, int insertLength) {
//Platform::DebugPrintf("Inserting at %d for %d\n", position, insertLength);
if (insertLength == 0)
return ;
PLATFORM_ASSERT(insertLength > 0);
RoomFor(insertLength);
GapTo(position);
@ -1028,7 +1024,7 @@ void CellBuffer::DeleteUndoHistory() {
}
bool CellBuffer::CanUndo() {
return (!readOnly) && (uh.CanUndo());
return uh.CanUndo();
}
int CellBuffer::StartUndo() {
@ -1042,21 +1038,21 @@ const Action &CellBuffer::GetUndoStep() const {
void CellBuffer::PerformUndoStep() {
const Action &actionStep = uh.GetUndoStep();
if (actionStep.at == insertAction) {
BasicDeleteChars(actionStep.position, actionStep.lenData*2);
BasicDeleteChars(actionStep.position*2, actionStep.lenData*2);
} else if (actionStep.at == removeAction) {
char *styledData = new char[actionStep.lenData * 2];
for (int i = 0; i < actionStep.lenData; i++) {
styledData[i*2] = actionStep.data[i];
styledData[i*2 + 1] = 0;
}
BasicInsertString(actionStep.position, styledData, actionStep.lenData*2);
BasicInsertString(actionStep.position*2, styledData, actionStep.lenData*2);
delete []styledData;
}
uh.CompletedUndoStep();
}
bool CellBuffer::CanRedo() {
return (!readOnly) && (uh.CanRedo());
return uh.CanRedo();
}
int CellBuffer::StartRedo() {
@ -1075,10 +1071,10 @@ void CellBuffer::PerformRedoStep() {
styledData[i*2] = actionStep.data[i];
styledData[i*2 + 1] = 0;
}
BasicInsertString(actionStep.position, styledData, actionStep.lenData*2);
BasicInsertString(actionStep.position*2, styledData, actionStep.lenData*2);
delete []styledData;
} else if (actionStep.at == removeAction) {
BasicDeleteChars(actionStep.position, actionStep.lenData*2);
BasicDeleteChars(actionStep.position*2, actionStep.lenData*2);
}
uh.CompletedRedoStep();
}

View File

@ -191,7 +191,6 @@ public:
int LineStart(int line);
int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
const char *InsertString(int position, char *s, int insertLength);
void InsertCharStyle(int position, char ch, char style);
/// Setting styles for positions outside the range of the buffer is safe and has no effect.
/// @return true if the style of a character is changed.

View File

@ -103,26 +103,40 @@ void Document::SetSavePoint() {
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
mh.line = line;
NotifyModified(mh);
return prev;
}
void Document::AddMarkSet(int line, int valueSet) {
unsigned int m = valueSet;
for (int i = 0; m; i++, m >>= 1)
if (m & 1)
cb.AddMark(line, i);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
mh.line = line;
NotifyModified(mh);
}
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
mh.line = line;
NotifyModified(mh);
}
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1;
NotifyModified(mh);
}
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1;
NotifyModified(mh);
}
@ -266,7 +280,7 @@ int Document::LenChar(int pos) {
return 1;
}
}
#include <assert.h>
// Normalise a position so that it is not halfway through a two byte character.
// This can occur in two situations -
// When lines are terminated with \r\n pairs which should be treated as one character.
@ -280,7 +294,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
if (pos >= Length())
return Length();
// assert pos > 0 && pos < Length()
// PLATFORM_ASSERT(pos > 0 && pos < Length());
if (checkLineEnd && IsCrLf(pos - 1)) {
if (moveDir > 0)
return pos + 1;
@ -336,6 +350,14 @@ void Document::ModifiedAt(int pos) {
endStyled = pos;
}
void Document::CheckReadOnly() {
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
}
// Document only modified by gateways DeleteChars, InsertStyledString, Undo, Redo, and SetStyleAt.
// SetStyleAt does not change the persistent state of a document
@ -345,11 +367,7 @@ bool Document::DeleteChars(int pos, int len) {
return false;
if ((pos + len) > Length())
return false;
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
CheckReadOnly();
if (enteredCount != 0) {
return false;
} else {
@ -384,11 +402,7 @@ bool Document::DeleteChars(int pos, int len) {
* Insert a styled string (char/style pairs) with a length.
*/
bool Document::InsertStyledString(int position, char *s, int insertLength) {
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
CheckReadOnly();
if (enteredCount != 0) {
return false;
} else {
@ -417,86 +431,110 @@ bool Document::InsertStyledString(int position, char *s, int insertLength) {
}
int Document::Undo() {
int newPos = 0;
int newPos = -1;
CheckReadOnly();
if (enteredCount == 0) {
enteredCount++;
bool startSavePoint = cb.IsSavePoint();
int steps = cb.StartUndo();
//Platform::DebugPrintf("Steps=%d\n", steps);
for (int step = 0; step < steps; step++) {
int prevLinesTotal = LinesTotal();
const Action &action = cb.GetUndoStep();
if (action.at == removeAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
}
cb.PerformUndoStep();
int cellPosition = action.position / 2;
ModifiedAt(cellPosition);
newPos = cellPosition;
if (!cb.IsReadOnly()) {
bool startSavePoint = cb.IsSavePoint();
bool multiLine = false;
int steps = cb.StartUndo();
//Platform::DebugPrintf("Steps=%d\n", steps);
for (int step = 0; step < steps; step++) {
const int prevLinesTotal = LinesTotal();
const Action &action = cb.GetUndoStep();
if (action.at == removeAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
}
cb.PerformUndoStep();
int cellPosition = action.position;
ModifiedAt(cellPosition);
newPos = cellPosition;
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
}
if (steps > 1)
modFlags |= SC_MULTISTEPUNDOREDO;
const int linesAdded = LinesTotal() - prevLinesTotal;
if (linesAdded != 0)
multiLine = true;
if (step == steps - 1) {
modFlags |= SC_LASTSTEPINUNDOREDO;
if (multiLine)
modFlags |= SC_MULTILINEUNDOREDO;
}
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
linesAdded, action.data));
}
if (step == steps - 1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
enteredCount--;
}
return newPos;
}
int Document::Redo() {
int newPos = 0;
int newPos = -1;
CheckReadOnly();
if (enteredCount == 0) {
enteredCount++;
bool startSavePoint = cb.IsSavePoint();
int steps = cb.StartRedo();
for (int step = 0; step < steps; step++) {
int prevLinesTotal = LinesTotal();
const Action &action = cb.GetRedoStep();
if (action.at == insertAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
}
cb.PerformRedoStep();
ModifiedAt(action.position / 2);
newPos = action.position / 2;
if (!cb.IsReadOnly()) {
bool startSavePoint = cb.IsSavePoint();
bool multiLine = false;
int steps = cb.StartRedo();
for (int step = 0; step < steps; step++) {
const int prevLinesTotal = LinesTotal();
const Action &action = cb.GetRedoStep();
if (action.at == insertAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
}
cb.PerformRedoStep();
ModifiedAt(action.position);
newPos = action.position;
int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
}
if (steps > 1)
modFlags |= SC_MULTISTEPUNDOREDO;
const int linesAdded = LinesTotal() - prevLinesTotal;
if (linesAdded != 0)
multiLine = true;
if (step == steps - 1) {
modFlags |= SC_LASTSTEPINUNDOREDO;
if (multiLine)
modFlags |= SC_MULTILINEUNDOREDO;
}
NotifyModified(
DocModification(modFlags, action.position, action.lenData,
linesAdded, action.data));
}
if (step == steps - 1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(
DocModification(modFlags, action.position / 2, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
enteredCount--;
}
return newPos;
@ -524,15 +562,17 @@ bool Document::InsertString(int position, const char *s) {
*/
bool Document::InsertString(int position, const char *s, size_t insertLength) {
bool changed = false;
char *sWithStyle = new char[insertLength * 2];
if (sWithStyle) {
for (size_t i = 0; i < insertLength; i++) {
sWithStyle[i*2] = s[i];
sWithStyle[i*2 + 1] = 0;
if (insertLength > 0) {
char *sWithStyle = new char[insertLength * 2];
if (sWithStyle) {
for (size_t i = 0; i < insertLength; i++) {
sWithStyle[i*2] = s[i];
sWithStyle[i*2 + 1] = 0;
}
changed = InsertStyledString(position*2, sWithStyle,
static_cast<int>(insertLength*2));
delete []sWithStyle;
}
changed = InsertStyledString(position*2, sWithStyle,
static_cast<int>(insertLength*2));
delete []sWithStyle;
}
return changed;
}
@ -611,8 +651,10 @@ void Document::SetLineIndentation(int line, int indent) {
CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs);
int thisLineStart = LineStart(line);
int indentPos = GetLineIndentPosition(line);
BeginUndoAction();
DeleteChars(thisLineStart, indentPos - thisLineStart);
InsertString(thisLineStart, linebuf);
EndUndoAction();
}
}
@ -675,10 +717,13 @@ void Document::Indent(bool forwards, int lineBottom, int lineTop) {
// Dedent - suck white space off the front of the line to dedent by equivalent of a tab
for (int line = lineBottom; line >= lineTop; line--) {
int indentOfLine = GetLineIndentation(line);
if (forwards)
SetLineIndentation(line, indentOfLine + IndentSize());
else
if (forwards) {
if (LineStart(line) < LineEnd(line)) {
SetLineIndentation(line, indentOfLine + IndentSize());
}
} else {
SetLineIndentation(line, indentOfLine - IndentSize());
}
}
}
@ -718,7 +763,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
for (int pos = 0; pos < Length(); pos++) {
if (cb.CharAt(pos) == '\r') {
if (cb.CharAt(pos + 1) == '\n') {
if (cb.CharAt(pos + 1) == '\n') {
// CRLF
if (eolModeSet == SC_EOL_CR) {
DeleteChars(pos + 1, 1); // Delete the LF
@ -727,7 +772,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
} else {
pos++;
}
} else {
} else {
// CR
if (eolModeSet == SC_EOL_CRLF) {
InsertString(pos + 1, "\n", 1); // Insert LF
@ -752,12 +797,37 @@ void Document::ConvertLineEnds(int eolModeSet) {
EndUndoAction();
}
bool Document::IsWhiteLine(int line) {
int currentChar = LineStart(line);
int endLine = LineEnd(line);
while (currentChar < endLine) {
if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') {
return false;
}
++currentChar;
}
return true;
}
int Document::ParaUp(int pos) {
int line = LineFromPosition(pos);
line--;
while (line >= 0 && IsWhiteLine(line)) { // skip empty lines
line--;
}
while (line >= 0 && !IsWhiteLine(line)) { // skip non-empty lines
line--;
}
line++;
return LineStart(line);
}
int Document::ParaDown(int pos) {
int line = LineFromPosition(pos);
while (line < LinesTotal() && LineStart(line) != LineEnd(line)) { // skip non-empty lines
while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines
line++;
}
while (line < LinesTotal() && LineStart(line) == LineEnd(line)) { // skip empty lines
while (line < LinesTotal() && IsWhiteLine(line)) { // skip empty lines
line++;
}
if (line < LinesTotal())
@ -766,19 +836,6 @@ int Document::ParaDown(int pos) {
return LineEnd(line-1);
}
int Document::ParaUp(int pos) {
int line = LineFromPosition(pos);
line--;
while (line >= 0 && LineStart(line) == LineEnd(line)) { // skip empty lines
line--;
}
while (line >= 0 && LineStart(line) != LineEnd(line)) { // skip non-empty lines
line--;
}
line++;
return LineStart(line);
}
Document::charClassification Document::WordCharClass(unsigned char ch) {
if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80))
return ccWord;
@ -926,6 +983,9 @@ public:
pdoc(pdoc_), end(end_) {
}
virtual ~DocumentIndexer() {
}
virtual char CharAt(int index) {
if (index < 0 || index >= end)
return 0;
@ -1001,7 +1061,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
if (line == lineRangeStart) {
if ((startPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if start position before end of line
endOfLine = startPos+1;
endOfLine = startPos;
}
}
@ -1013,10 +1073,10 @@ long Document::FindText(int minPos, int maxPos, const char *s,
if (increment == -1) {
// Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop
while (success && (pre->eopat[0] <= (endOfLine+1)) && (repetitions--)) {
success = pre->Execute(di, pos+1, endOfLine+1);
while (success && (pre->eopat[0] <= endOfLine) && (repetitions--)) {
success = pre->Execute(di, pos+1, endOfLine);
if (success) {
if (pre->eopat[0] <= (minPos+1)) {
if (pre->eopat[0] <= minPos) {
pos = pre->bopat[0];
lenRet = pre->eopat[0] - pre->bopat[0];
} else {
@ -1052,12 +1112,13 @@ long Document::FindText(int minPos, int maxPos, const char *s,
char firstChar = s[0];
if (!caseSensitive)
firstChar = static_cast<char>(MakeUpperCase(firstChar));
int pos = startPos;
int pos = forward ? startPos : (startPos - 1);
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
char ch = CharAt(pos);
if (caseSensitive) {
if (ch == firstChar) {
bool found = true;
if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (ch != s[posMatch])
@ -1073,6 +1134,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
} else {
if (MakeUpperCase(ch) == firstChar) {
bool found = true;
if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch]))
@ -1185,11 +1247,9 @@ int Document::LinesTotal() {
}
void Document::ChangeCase(Range r, bool makeUpperCase) {
for (int pos = r.start; pos < r.end; pos++) {
for (int pos = r.start; pos < r.end;) {
int len = LenChar(pos);
if (dbcsCodePage && (len > 1)) {
pos += len;
} else {
if (len == 1) {
char ch = CharAt(pos);
if (makeUpperCase) {
if (IsLowerCase(ch)) {
@ -1201,6 +1261,7 @@ void Document::ChangeCase(Range r, bool makeUpperCase) {
}
}
}
pos += len;
}
}
@ -1265,19 +1326,22 @@ bool Document::SetStyles(int length, char *styles) {
return false;
} else {
enteredCount++;
int prevEndStyled = endStyled;
bool didChange = false;
int lastChange = 0;
int startMod = 0;
int endMod = 0;
for (int iPos = 0; iPos < length; iPos++, endStyled++) {
PLATFORM_ASSERT(endStyled < Length());
if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
if (!didChange) {
startMod = endStyled;
}
didChange = true;
lastChange = iPos;
endMod = endStyled;
}
}
if (didChange) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, lastChange);
startMod, endMod - startMod + 1);
NotifyModified(mh);
}
enteredCount--;
@ -1475,3 +1539,55 @@ int Document::ExtendStyleRange(int pos, int delta, bool singleLine) {
}
return pos;
}
static char BraceOpposite(char ch) {
switch (ch) {
case '(':
return ')';
case ')':
return '(';
case '[':
return ']';
case ']':
return '[';
case '{':
return '}';
case '}':
return '{';
case '<':
return '>';
case '>':
return '<';
default:
return '\0';
}
}
// TODO: should be able to extend styled region to find matching brace
int Document::BraceMatch(int position, int /*maxReStyle*/) {
char chBrace = CharAt(position);
char chSeek = BraceOpposite(chBrace);
if (chSeek == '\0')
return - 1;
char styBrace = static_cast<char>(StyleAt(position) & stylingBitsMask);
int direction = -1;
if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
direction = 1;
int depth = 1;
position = position + direction;
while ((position >= 0) && (position < Length())) {
position = MovePositionOutsideChar(position, direction);
char chAtPos = CharAt(position);
char styAtPos = static_cast<char>(StyleAt(position) & stylingBitsMask);
if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
if (chAtPos == chBrace)
depth++;
if (chAtPos == chSeek)
depth--;
if (depth == 0)
return position;
}
position = position + direction;
}
return - 1;
}

View File

@ -134,6 +134,7 @@ public:
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
// Gateways to modifying document
void ModifiedAt(int pos);
bool DeleteChars(int pos, int len);
bool InsertStyledString(int position, char *s, int insertLength);
int Undo();
@ -175,6 +176,7 @@ public:
char StyleAt(int position) { return cb.StyleAt(position); }
int GetMark(int line) { return cb.GetMark(line); }
int AddMark(int line, int markerNum);
void AddMarkSet(int line, int valueSet);
void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle);
void DeleteAllMarks(int markerNum);
@ -228,16 +230,19 @@ public:
int WordPartLeft(int pos);
int WordPartRight(int pos);
int ExtendStyleRange(int pos, int delta, bool singleLine = false);
bool IsWhiteLine(int line);
int ParaUp(int pos);
int ParaDown(int pos);
int IndentSize() { return actualIndentInChars; }
int BraceMatch(int position, int maxReStyle);
private:
void CheckReadOnly();
charClassification WordCharClass(unsigned char ch);
bool IsWordStartAt(int pos);
bool IsWordEndAt(int pos);
bool IsWordAt(int start, int end);
void ModifiedAt(int pos);
void NotifyModifyAttempt();
void NotifySavePoint(bool atSavePoint);
@ -261,19 +266,19 @@ public:
int foldLevelPrev;
DocModification(int modificationType_, int position_=0, int length_=0,
int linesAdded_=0, const char *text_=0) :
int linesAdded_=0, const char *text_=0, int line_=0) :
modificationType(modificationType_),
position(position_),
length(length_),
linesAdded(linesAdded_),
text(text_),
line(0),
line(line_),
foldLevelNow(0),
foldLevelPrev(0) {}
DocModification(int modificationType_, const Action &act, int linesAdded_=0) :
DocModification(int modificationType_, const Action &act, int linesAdded_=0) :
modificationType(modificationType_),
position(act.position / 2),
position(act.position),
length(act.lenData),
linesAdded(linesAdded_),
text(act.data),

View File

@ -58,7 +58,8 @@ bool DocumentAccessor::Match(int pos, const char *s) {
}
char DocumentAccessor::StyleAt(int position) {
return pdoc->StyleAt(position);
// Mask off all bits which aren't in the 'mask'.
return static_cast<char>(pdoc->StyleAt(position) & mask);
}
int DocumentAccessor::GetLine(int position) {
@ -88,6 +89,8 @@ int DocumentAccessor::SetLineState(int line, int state) {
}
void DocumentAccessor::StartAt(unsigned int start, char chMask) {
// Store the mask specified for use with StyleAt.
mask = chMask;
pdoc->StartStyling(start, chMask);
startPosStyling = start;
}

View File

@ -27,6 +27,7 @@ protected:
char chWhile;
unsigned int startSeg;
int startPosStyling;
int mask;
bool InternalIsLeadByte(char ch);
void Fill(int position);
@ -35,7 +36,8 @@ public:
DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) :
Accessor(), pdoc(pdoc_), props(props_), id(id_),
lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
startSeg(0), startPosStyling(0) {
startSeg(0), startPosStyling(0),
mask(127) { // Initialize the mask to be big enough for any lexer.
}
~DocumentAccessor();
bool Match(int pos, const char *s);

File diff suppressed because it is too large Load Diff

View File

@ -64,6 +64,7 @@ public:
int edgeColumn;
char *chars;
unsigned char *styles;
int styleBitsSet;
char *indicators;
int *positions;
char bracePreviousStyles[2];
@ -105,6 +106,7 @@ class LineLayoutCache {
LineLayout **cache;
bool allInvalidated;
int styleClock;
int useCount;
void Allocate(int length_);
void AllocateForLevel(int linesOnScreen, int linesInDoc);
public:
@ -218,6 +220,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
int scrollWidth;
bool verticalScrollBarVisible;
bool endAtLastLine;
bool caretSticky;
Surface *pixmapLine;
Surface *pixmapSelMargin;
@ -301,7 +304,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
int hsEnd;
// Wrapping support
enum { eWrapNone, eWrapWord } wrapState;
enum { eWrapNone, eWrapWord, eWrapChar } wrapState;
bool backgroundWrapEnabled;
int wrapWidth;
int docLineLastWrapped;
@ -311,6 +314,8 @@ protected: // ScintillaBase subclass needs access to much of Editor
int wrapVisualStartIndent;
int actualWrapVisualStartIndent;
bool convertPastes;
Document *pdoc;
Editor();
@ -341,7 +346,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool AbandonPaint();
void RedrawRect(PRectangle rc);
void Redraw();
void RedrawSelMargin();
void RedrawSelMargin(int line=-1);
PRectangle RectangleFromRange(int start, int end);
void InvalidateRange(int start, int end);
@ -349,6 +354,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
bool SelectionEmpty();
int SelectionStart();
int SelectionEnd();
void SetRectangularRange();
void InvalidateSelection(int currentPos_, int anchor_);
void SetSelection(int currentPos_, int anchor_);
void SetSelection(int currentPos_);
@ -450,10 +456,11 @@ protected: // ScintillaBase subclass needs access to much of Editor
void PageMove(int direction, selTypes sel=noSel, bool stuttered = false);
void ChangeCaseOfSelection(bool makeUpperCase);
void LineTranspose();
void LineDuplicate();
void Duplicate(bool forLine);
virtual void CancelModes();
void NewLine();
void CursorUpOrDown(int direction, selTypes sel=noSel);
void ParaUpOrDown(int direction, selTypes sel=noSel);
int StartEndDisplayLine(int pos, bool start);
virtual int KeyCommand(unsigned int iMessage);
virtual int KeyDefault(int /* key */, int /*modifiers*/);
@ -499,8 +506,9 @@ protected: // ScintillaBase subclass needs access to much of Editor
virtual bool HaveMouseCapture() = 0;
void SetFocusState(bool focusState);
virtual bool PaintContains(PRectangle rc);
bool PaintContainsMargin();
void CheckForChangeOutsidePaint(Range r);
int BraceMatch(int position, int maxReStyle);
void SetBraceHighlight(Position pos0, Position pos1, int matchStyle);
void SetDocPointer(Document *document);
@ -516,6 +524,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void GetHotSpotRange(int& hsStart, int& hsEnd);
int CodePage() const;
int WrapCount(int line);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;

View File

@ -140,7 +140,7 @@ const KeyToCommand KeyMap::MapDefault[] = {
{'L', SCI_CSHIFT, SCI_LINEDELETE},
{'T', SCI_CSHIFT, SCI_LINECOPY},
{'T', SCI_CTRL, SCI_LINETRANSPOSE},
{'D', SCI_CTRL, SCI_LINEDUPLICATE},
{'D', SCI_CTRL, SCI_SELECTIONDUPLICATE},
{'U', SCI_CTRL, SCI_LOWERCASE},
{'U', SCI_CSHIFT, SCI_UPPERCASE},
{0,0,0},

View File

@ -22,13 +22,17 @@
const LexerModule *LexerModule::base = 0;
int LexerModule::nextLanguage = SCLEX_AUTOMATIC+1;
LexerModule::LexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_, LexerFunction fnFolder_,
const char * const wordListDescriptions_[]) :
LexerModule::LexerModule(int language_,
LexerFunction fnLexer_,
const char *languageName_,
LexerFunction fnFolder_,
const char * const wordListDescriptions_[],
int styleBits_) :
language(language_),
fnLexer(fnLexer_),
fnFolder(fnFolder_),
wordListDescriptions(wordListDescriptions_),
styleBits(styleBits_),
languageName(languageName_) {
next = base;
base = this;
@ -52,7 +56,7 @@ int LexerModule::GetNumWordLists() const {
}
}
const char * LexerModule::GetWordListDescription(int index) const {
const char *LexerModule::GetWordListDescription(int index) const {
static const char *emptyStr = "";
PLATFORM_ASSERT(index < GetNumWordLists());
@ -63,6 +67,10 @@ const char * LexerModule::GetWordListDescription(int index) const {
}
}
int LexerModule::GetStyleBitsNeeded() const {
return styleBits;
}
const LexerModule *LexerModule::Find(int language) {
const LexerModule *lm = base;
while (lm) {
@ -130,67 +138,78 @@ int Scintilla_LinkLexers() {
//++Autogenerated -- run src/LexGen.py to regenerate
//**\(\tLINK_LEXER(\*);\n\)
LINK_LEXER(lmAda);
LINK_LEXER(lmAns1);
LINK_LEXER(lmAPDL);
LINK_LEXER(lmAsm);
LINK_LEXER(lmAsn1);
LINK_LEXER(lmASP);
LINK_LEXER(lmAU3);
LINK_LEXER(lmAVE);
LINK_LEXER(lmBaan);
LINK_LEXER(lmBash);
LINK_LEXER(lmBatch);
LINK_LEXER(lmBlitzBasic);
LINK_LEXER(lmBullant);
LINK_LEXER(lmCaml);
LINK_LEXER(lmClw);
LINK_LEXER(lmClwNoCase);
LINK_LEXER(lmConf);
LINK_LEXER(lmCPP);
LINK_LEXER(lmCPPNoCase);
LINK_LEXER(lmTCL);
LINK_LEXER(lmNncrontab);
LINK_LEXER(lmCsound);
LINK_LEXER(lmCss);
LINK_LEXER(lmDiff);
LINK_LEXER(lmEiffel);
LINK_LEXER(lmEiffelkw);
LINK_LEXER(lmErlang);
LINK_LEXER(lmErrorList);
LINK_LEXER(lmESCRIPT);
LINK_LEXER(lmF77);
LINK_LEXER(lmFlagShip);
LINK_LEXER(lmForth);
LINK_LEXER(lmFortran);
LINK_LEXER(lmF77);
LINK_LEXER(lmFreeBasic);
LINK_LEXER(lmGui4Cli);
LINK_LEXER(lmHaskell);
LINK_LEXER(lmHTML);
LINK_LEXER(lmXML);
LINK_LEXER(lmASP);
LINK_LEXER(lmPHP);
LINK_LEXER(lmKix);
LINK_LEXER(lmLatex);
LINK_LEXER(lmLISP);
LINK_LEXER(lmLot);
LINK_LEXER(lmLout);
LINK_LEXER(lmLua);
LINK_LEXER(lmMake);
LINK_LEXER(lmMatlab);
LINK_LEXER(lmOctave);
LINK_LEXER(lmMETAPOST);
LINK_LEXER(lmMMIXAL);
LINK_LEXER(lmLot);
LINK_LEXER(lmMSSQL);
LINK_LEXER(lmNncrontab);
LINK_LEXER(lmNsis);
LINK_LEXER(lmBatch);
LINK_LEXER(lmDiff);
LINK_LEXER(lmProps);
LINK_LEXER(lmMake);
LINK_LEXER(lmErrorList);
LINK_LEXER(lmLatex);
LINK_LEXER(lmNull);
LINK_LEXER(lmOctave);
LINK_LEXER(lmPascal);
LINK_LEXER(lmPB);
LINK_LEXER(lmPerl);
LINK_LEXER(lmPHP);
LINK_LEXER(lmPHPSCRIPT);
LINK_LEXER(lmPOV);
LINK_LEXER(lmProps);
LINK_LEXER(lmPS);
LINK_LEXER(lmPureBasic);
LINK_LEXER(lmPython);
LINK_LEXER(lmREBOL);
LINK_LEXER(lmRuby);
LINK_LEXER(lmScriptol);
LINK_LEXER(lmSmalltalk);
LINK_LEXER(lmSpecman);
LINK_LEXER(lmSQL);
LINK_LEXER(lmTADS3);
LINK_LEXER(lmTCL);
LINK_LEXER(lmTeX);
LINK_LEXER(lmVB);
LINK_LEXER(lmVBScript);
LINK_LEXER(lmVerilog);
LINK_LEXER(lmVHDL);
LINK_LEXER(lmXML);
LINK_LEXER(lmYAML);
//--Autogenerated -- end of automatically generated section

View File

@ -25,7 +25,21 @@
// Added fold.compact support set with fold.compact=1
// Changed folding inside of #cs-#ce. Default is no keyword folding inside comment blocks when fold.comment=1
// it will now only happen when fold.comment=2.
//
// Sep 5, 2004 - Added logic to handle colourizing words on the last line.
// Typed Characters now show as "default" till they match any table.
// Oct 10, 2004 - Added logic to show Comments in "Special" directives.
// Nov 1, 2004 - Added better testing for Numbers supporting x and e notation.
// Nov 28, 2004 - Added logic to handle continuation lines for syntax highlighting.
// Jan 10, 2005 - Added Abbreviations Keyword used for expansion
// Mar 24, 2005 - Updated Abbreviations Keywords to fix when followed by Operator.
// Apr 18, 2005 - Updated #CE/#Comment-End logic to take a linecomment ";" into account
// - Added folding support for With...EndWith
// - Added support for a DOT in variable names
// - Fixed Underscore in CommentBlock
// May 23, 2005 - Fixed the SentKey lexing in case of a missing }
// Aug 11, 2005 - Fixed possible bug with s_save length > 100.
// Aug 23, 2005 - Added Switch/endswitch support to the folding logic.
//
// Copyright for Scintilla: 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Scintilla source code edit control
@ -56,7 +70,7 @@ static inline bool IsAWordChar(const int ch)
static inline bool IsAWordStart(const int ch)
{
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '@' || ch == '#' || ch == '$');
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '@' || ch == '#' || ch == '$' || ch == '.');
}
static inline bool IsAOperator(char ch) {
@ -88,7 +102,11 @@ static int GetSendKey(const char *szLine, char *szKey)
// split the portion of the sendkey in the part before and after the spaces
while ( ( (cTemp = szLine[nPos]) != '\0'))
{
if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space
// skip leading Ctrl/Shift/ALt state
if ((cTemp == '#' || cTemp == '!' || cTemp == '^') && (szLine[nPos+1] == '{') )
{
}
else if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space
{
nFlag = 1;
// Add } to the end of the first bit for table lookup later.
@ -132,6 +150,34 @@ static int GetSendKey(const char *szLine, char *szKey)
} // GetSendKey()
//
// Routine to check the last "none comment" character on a line to see if its a continuation
//
static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
int nePos = styler.LineStart(szLine+1) - 2;
//int stylech = styler.StyleAt(nsPos);
while (nsPos < nePos)
{
//stylech = styler.StyleAt(nePos);
int stylech = styler.StyleAt(nsPos);
if (!(stylech == SCE_AU3_COMMENT)) {
char ch = styler.SafeGetCharAt(nePos);
if (!isspacechar(ch)) {
if (ch == '_')
return true;
else
return false;
}
}
nePos--; // skip to next char
} // End While
return false;
} // IsContinuationLine()
//
// syntax highlighting logic
static void ColouriseAU3Doc(unsigned int startPos,
int length, int initStyle,
WordList *keywordlists[],
@ -143,25 +189,78 @@ static void ColouriseAU3Doc(unsigned int startPos,
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
// find the first previous line without continuation character at the end
int lineCurrent = styler.GetLine(startPos);
int s_startPos = startPos;
// When not inside a Block comment: find First line without _
if (!(initStyle==SCE_AU3_COMMENTBLOCK)) {
while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) ||
(lineCurrent > 1 && IsContinuationLine(lineCurrent-1,styler))) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent); // get start position
initStyle = 0; // reset the start style to 0
}
}
// Set the new length to include it from the start and set the start position
length = length + s_startPos - startPos; // correct the total length to process
styler.StartAt(startPos);
StyleContext sc(startPos, length, initStyle, styler);
char si; // string indicator "=1 '=2
si=0;
char ni; // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3
char ci; // comment indicator 0=not linecomment(;)
char s_save[100];
si=0;
ni=0;
ci=0;
//$$$
for (; sc.More(); sc.Forward()) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
// **********************************************
// save the total current word for eof processing
if (IsAWordChar(sc.ch) || sc.ch == '}')
{
strcpy(s_save,s);
int tp = strlen(s_save);
if (tp < 99) {
s_save[tp] = static_cast<char>(tolower(sc.ch));
s_save[tp+1] = '\0';
}
}
// **********************************************
//
switch (sc.state)
{
case SCE_AU3_COMMENTBLOCK:
{
if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && strcmp(s, "#comments") == 0)))
{
//Reset at line end
if (sc.atLineEnd) {
ci=0;
sc.SetState(SCE_AU3_COMMENTBLOCK);
}
//skip rest of line when a ; is encountered
if (sc.chPrev == ';') {
ci=2;
sc.SetState(SCE_AU3_COMMENTBLOCK);
}
// skip rest of the line
if (ci==2)
break;
// check when first character is detected on the line
if (ci==0) {
if (IsAWordStart(static_cast<char>(sc.ch)) || IsAOperator(static_cast<char>(sc.ch))) {
ci=1;
sc.SetState(SCE_AU3_COMMENTBLOCK);
}
break;
}
if (!(IsAWordChar(sc.ch) || (sc.ch == '-' && strcmp(s, "#comments") == 0))) {
if ((strcmp(s, "#ce")== 0 || strcmp(s, "#comments-end")== 0))
{sc.SetState(SCE_AU3_COMMENT);} // set to comment line for the rest of the line
sc.SetState(SCE_AU3_COMMENT); // set to comment line for the rest of the line
else
{sc.SetState(SCE_AU3_COMMENTBLOCK);}
ci=2; // line doesn't begin with #CE so skip the rest of the line
}
break;
}
@ -172,12 +271,19 @@ static void ColouriseAU3Doc(unsigned int startPos,
}
case SCE_AU3_OPERATOR:
{
sc.SetState(SCE_AU3_DEFAULT);
// check if its a COMobject
if (sc.chPrev == '.' && IsAWordChar(sc.ch)) {
sc.SetState(SCE_AU3_COMOBJ);
}
else {
sc.SetState(SCE_AU3_DEFAULT);
}
break;
}
case SCE_AU3_SPECIAL:
{
if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);}
if (sc.ch == ';') {sc.SetState(SCE_AU3_COMMENT);}
if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);}
break;
}
case SCE_AU3_KEYWORD:
@ -215,6 +321,10 @@ static void ColouriseAU3Doc(unsigned int startPos,
sc.ChangeState(SCE_AU3_SPECIAL);
sc.SetState(SCE_AU3_SPECIAL);
}
else if ((keywords7.InList(s)) && (!IsAOperator(static_cast<char>(sc.ch)))) {
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_DEFAULT);
}
else if (strcmp(s, "_") == 0) {
sc.ChangeState(SCE_AU3_OPERATOR);
sc.SetState(SCE_AU3_DEFAULT);
@ -225,18 +335,74 @@ static void ColouriseAU3Doc(unsigned int startPos,
}
}
}
if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);}
if (sc.atLineEnd) {
sc.SetState(SCE_AU3_DEFAULT);}
break;
}
case SCE_AU3_NUMBER:
case SCE_AU3_NUMBER:
{
if (!IsAWordChar(sc.ch)) {sc.SetState(SCE_AU3_DEFAULT);}
break;
// Numeric indicator error=9 normal=0 normal+dec=1 hex=2 E-not=3
//
// test for Hex notation
if (strcmp(s, "0") == 0 && (sc.ch == 'x' || sc.ch == 'X') && ni == 0)
{
ni = 2;
break;
}
// test for E notation
if (IsADigit(sc.chPrev) && (sc.ch == 'e' || sc.ch == 'E') && ni <= 1)
{
ni = 3;
break;
}
// Allow Hex characters inside hex numeric strings
if ((ni == 2) &&
(sc.ch == 'a' || sc.ch == 'b' || sc.ch == 'c' || sc.ch == 'd' || sc.ch == 'e' || sc.ch == 'f' ||
sc.ch == 'A' || sc.ch == 'B' || sc.ch == 'C' || sc.ch == 'D' || sc.ch == 'E' || sc.ch == 'F' ))
{
break;
}
// test for 1 dec point only
if (sc.ch == '.')
{
if (ni==0)
{
ni=1;
}
else
{
ni=9;
}
break;
}
// end of numeric string ?
if (!(IsADigit(sc.ch)))
{
if (ni==9)
{
sc.ChangeState(SCE_AU3_DEFAULT);
}
sc.SetState(SCE_AU3_DEFAULT);
}
break;
}
case SCE_AU3_VARIABLE:
{
// Check if its a COMObject
if (sc.ch == '.' && !IsADigit(sc.chNext)) {
sc.SetState(SCE_AU3_OPERATOR);
}
else if (!IsAWordChar(sc.ch)) {
sc.SetState(SCE_AU3_DEFAULT);
}
break;
}
case SCE_AU3_VARIABLE:
{
if (!IsAWordChar(sc.ch)) {sc.SetState(SCE_AU3_DEFAULT);}
break;
case SCE_AU3_COMOBJ:
{
if (!(IsAWordChar(sc.ch))) {
sc.SetState(SCE_AU3_DEFAULT);
}
break;
}
case SCE_AU3_STRING:
{
@ -246,7 +412,15 @@ static void ColouriseAU3Doc(unsigned int startPos,
{
sc.ForwardSetState(SCE_AU3_DEFAULT);
}
if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);}
if (sc.atLineEnd)
{
// at line end and not found a continuation char then reset to default
int lineCurrent = styler.GetLine(sc.currentPos);
if (!IsContinuationLine(lineCurrent,styler))
{
sc.SetState(SCE_AU3_DEFAULT);
}
}
// find Sendkeys in a STRING
if (sc.ch == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '+' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
@ -288,10 +462,11 @@ static void ColouriseAU3Doc(unsigned int startPos,
// check if next portion is again a sendkey
if (sc.atLineEnd)
{
sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_DEFAULT);
si = 0; // reset string indicator
}
if (sc.ch == '{' && sc.chPrev != '{') {sc.SetState(SCE_AU3_SENT);}
//if (sc.ch == '{' && sc.chPrev != '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '+' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '!' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
if (sc.ch == '^' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
@ -314,6 +489,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
if (sc.ch == ';') {sc.SetState(SCE_AU3_COMMENT);}
else if (sc.ch == '#') {sc.SetState(SCE_AU3_KEYWORD);}
else if (sc.ch == '$') {sc.SetState(SCE_AU3_VARIABLE);}
else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);}
else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);}
else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include
else if (sc.ch == '\"') {
@ -322,13 +498,94 @@ static void ColouriseAU3Doc(unsigned int startPos,
else if (sc.ch == '\'') {
sc.SetState(SCE_AU3_STRING);
si = 2; }
else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {sc.SetState(SCE_AU3_NUMBER);}
else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)))
{
sc.SetState(SCE_AU3_NUMBER);
ni = 0;
}
else if (IsAWordStart(sc.ch)) {sc.SetState(SCE_AU3_KEYWORD);}
else if (IsAOperator(static_cast<char>(sc.ch))) {sc.SetState(SCE_AU3_OPERATOR);}
else if (sc.atLineEnd) {sc.SetState(SCE_AU3_DEFAULT);}
}
} //for (; sc.More(); sc.Forward())
sc.Complete();
//*************************************
// Colourize the last word correctly
//*************************************
if (sc.state == SCE_AU3_KEYWORD)
{
if (strcmp(s_save, "#cs")== 0 || strcmp(s_save, "#comments-start")== 0 )
{
sc.ChangeState(SCE_AU3_COMMENTBLOCK);
sc.SetState(SCE_AU3_COMMENTBLOCK);
}
else if (keywords.InList(s_save)) {
sc.ChangeState(SCE_AU3_KEYWORD);
sc.SetState(SCE_AU3_KEYWORD);
}
else if (keywords2.InList(s_save)) {
sc.ChangeState(SCE_AU3_FUNCTION);
sc.SetState(SCE_AU3_FUNCTION);
}
else if (keywords3.InList(s_save)) {
sc.ChangeState(SCE_AU3_MACRO);
sc.SetState(SCE_AU3_MACRO);
}
else if (keywords5.InList(s_save)) {
sc.ChangeState(SCE_AU3_PREPROCESSOR);
sc.SetState(SCE_AU3_PREPROCESSOR);
}
else if (keywords6.InList(s_save)) {
sc.ChangeState(SCE_AU3_SPECIAL);
sc.SetState(SCE_AU3_SPECIAL);
}
else if (keywords7.InList(s_save) && sc.atLineEnd) {
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_EXPAND);
}
else {
sc.ChangeState(SCE_AU3_DEFAULT);
sc.SetState(SCE_AU3_DEFAULT);
}
}
if (sc.state == SCE_AU3_SENT)
{
// Send key string ended
if (sc.chPrev == '}' && sc.ch != '}')
{
// set color to SENDKEY when valid sendkey .. else set back to regular string
char sk[100];
// split {111 222} and return {111} and check if 222 is valid.
// if return code = 1 then invalid 222 so must be string
if (GetSendKey(s_save,sk))
{
sc.ChangeState(SCE_AU3_STRING);
}
// if single char between {?} then its ok as sendkey for a single character
else if (strlen(sk) == 3)
{
sc.ChangeState(SCE_AU3_SENT);
}
// if sendkey {111} is in table then ok as sendkey
else if (keywords4.InList(sk))
{
sc.ChangeState(SCE_AU3_SENT);
}
else
{
sc.ChangeState(SCE_AU3_STRING);
}
sc.SetState(SCE_AU3_STRING);
}
// check if next portion is again a sendkey
if (sc.atLineEnd)
{
sc.ChangeState(SCE_AU3_STRING);
sc.SetState(SCE_AU3_DEFAULT);
}
}
//*************************************
sc.Complete();
}
//
@ -352,32 +609,6 @@ static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)
} // GetStyleFirstWord()
//
// Routine to check the last "none comment" character on a line to see if its a continuation
//
static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
int nePos = styler.LineStart(szLine+1) - 2;
//int stylech = styler.StyleAt(nsPos);
while (nsPos < nePos)
{
//stylech = styler.StyleAt(nePos);
int stylech = styler.StyleAt(nsPos);
if (!(stylech == SCE_AU3_COMMENT)) {
char ch = styler.SafeGetCharAt(nePos);
if (!isspacechar(ch)) {
if (ch == '_')
return true;
else
return false;
}
}
nePos--; // skip to next char
} // End While
return false;
} // IsContinuationLine()
//
static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
@ -496,18 +727,18 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc
// create new fold for these words
if (strcmp(szKeyword,"do") == 0 || strcmp(szKeyword,"for") == 0 ||
strcmp(szKeyword,"func") == 0 || strcmp(szKeyword,"while") == 0||
strcmp(szKeyword,"#region") == 0 ) {
strcmp(szKeyword,"with") == 0 || strcmp(szKeyword,"#region") == 0 ) {
levelNext++;
}
// create double Fold for select because Case will subtract one of the current level
if (strcmp(szKeyword,"select") == 0) {
// create double Fold for select&switch because Case will subtract one of the current level
if (strcmp(szKeyword,"select") == 0 || strcmp(szKeyword,"switch") == 0) {
levelNext++;
levelNext++;
}
// end the fold for these words before the current line
if (strcmp(szKeyword,"endfunc") == 0 || strcmp(szKeyword,"endif") == 0 ||
strcmp(szKeyword,"next") == 0 || strcmp(szKeyword,"until") == 0 ||
strcmp(szKeyword,"wend") == 0){
strcmp(szKeyword,"endwith") == 0 ||strcmp(szKeyword,"wend") == 0){
levelNext--;
levelCurrent--;
}
@ -517,7 +748,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc
levelCurrent--;
}
// end the double fold for this word before the current line
if (strcmp(szKeyword,"endselect") == 0 ) {
if (strcmp(szKeyword,"endselect") == 0 || strcmp(szKeyword,"endswitch") == 0 ) {
levelNext--;
levelNext--;
levelCurrent--;
@ -609,6 +840,7 @@ static const char * const AU3WordLists[] = {
"#autoit Sent keys",
"#autoit Pre-processors",
"#autoit Special",
"#autoit Expand",
0
};
LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists);

View File

@ -12,7 +12,6 @@
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <fcntl.h>
#include "Platform.h"
@ -183,7 +182,9 @@ static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, W
if ((strcmp(s, "then") == 0) || (strcmp(s, "for") == 0) || (strcmp(s, "while") == 0)) {
levelCurrent++;
}
if ((strcmp(s, "end") == 0)) {
if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) {
// Normally "elseif" and "then" will be on the same line and will cancel
// each other out. // As implemented, this does not support fold.at.else.
levelCurrent--;
}
}

View File

@ -178,4 +178,4 @@ static const char * const asn1WordLists[] = {
0, };
LexerModule lmAsn1(SCLEX_ASN1, ColouriseAsn1Doc, "asn1", FoldAsn1Doc, asn1WordLists);
LexerModule lmAns1(SCLEX_ASN1, ColouriseAsn1Doc, "asn1", FoldAsn1Doc, asn1WordLists);

View File

@ -2,7 +2,7 @@
/** @file LexBash.cxx
** Lexer for Bash.
**/
// Copyright 2004 by Neil Hodgson <neilh@scintilla.org>
// Copyright 2004-2005 by Neil Hodgson <neilh@scintilla.org>
// Adapted from LexPerl by Kein-Hong Man <mkh@pl.jaring.my> 2004
// The License.txt file describes the conditions under which this software may be distributed.
@ -144,6 +144,9 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf
HereDocCls() {
State = 0;
Quote = 0;
Quoted = false;
Indent = 0;
DelimiterLength = 0;
Delimiter = new char[HERE_DELIM_MAX];
Delimiter[0] = '\0';
@ -442,7 +445,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
HereDoc.Quoted = false;
HereDoc.DelimiterLength = 0;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
if (chNext == '\'') { // a quoted here-doc delimiter (' only)
if (chNext == '\'' || chNext == '\"') { // a quoted here-doc delimiter (' or ")
i++;
ch = chNext;
chNext = chNext2;
@ -451,8 +454,9 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
HereDoc.Indent = true;
HereDoc.State = 0;
} else if (isalpha(chNext) || chNext == '_' || chNext == '\\'
|| chNext == '-' || chNext == '+') {
|| chNext == '-' || chNext == '+' || chNext == '!') {
// an unquoted here-doc delimiter, no special handling
// TODO check what exactly bash considers part of the delim
} else if (chNext == '<') { // HERE string <<<
i++;
ch = chNext;
@ -486,7 +490,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
}
} else { // an unquoted here-doc delimiter
if (isalnum(ch) || ch == '_' || ch == '-' || ch == '+') {
if (isalnum(ch) || ch == '_' || ch == '-' || ch == '+' || ch == '!') {
HereDoc.Delimiter[HereDoc.DelimiterLength++] = ch;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
} else if (ch == '\\') {
@ -582,6 +586,19 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(lengthDoc - 1, state);
}
static bool IsCommentLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
else if (ch != ' ' && ch != '\t')
return false;
}
return false;
}
static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
@ -599,16 +616,16 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment && (style == SCE_SH_COMMENTLINE)) {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelCurrent++;
} else if (chNext2 == '}') {
levelCurrent--;
}
}
}
// Comment folding
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
{
if (!IsCommentLine(lineCurrent - 1, styler)
&& IsCommentLine(lineCurrent + 1, styler))
levelCurrent++;
else if (IsCommentLine(lineCurrent - 1, styler)
&& !IsCommentLine(lineCurrent+1, styler))
levelCurrent--;
}
if (style == SCE_C_OPERATOR) {
if (ch == '{') {
levelCurrent++;

View File

@ -0,0 +1,364 @@
// Scintilla source code edit control
/** @file LexBasic.cxx
** Lexer for BlitzBasic and PureBasic.
**/
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// This tries to be a unified Lexer/Folder for all the BlitzBasic/BlitzMax/PurBasic basics
// and derivatives. Once they diverge enough, might want to split it into multiple
// lexers for more code clearity.
//
// Mail me (elias <at> users <dot> sf <dot> net) for any bugs.
// Folding only works for simple things like functions or types.
// You may want to have a look at my ctags lexer as well, if you additionally to coloring
// and folding need to extract things like label tags in your editor.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <ctype.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
/* Bits:
* 1 - whitespace
* 2 - operator
* 4 - identifier
* 8 - decimal digit
* 16 - hex digit
* 32 - bin digit
*/
static int character_classification[128] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 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
};
static bool IsSpace(int c) {
return c < 128 && (character_classification[c] & 1);
}
static bool IsOperator(int c) {
return c < 128 && (character_classification[c] & 2);
}
static bool IsIdentifier(int c) {
return c < 128 && (character_classification[c] & 4);
}
static bool IsDigit(int c) {
return c < 128 && (character_classification[c] & 8);
}
static bool IsHexDigit(int c) {
return c < 128 && (character_classification[c] & 16);
}
static bool IsBinDigit(int c) {
return c < 128 && (character_classification[c] & 32);
}
static int LowerCase(int c)
{
if (c >= 'A' && c <= 'Z')
return 'a' + c - 'A';
return c;
}
static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler, char comment_char) {
bool wasfirst = true, isfirst = true; // true if first token in a line
styler.StartAt(startPos);
StyleContext sc(startPos, length, initStyle, styler);
// Can't use sc.More() here else we miss the last character
for (; ; sc.Forward()) {
if (sc.state == SCE_B_IDENTIFIER) {
if (!IsIdentifier(sc.ch)) {
// Labels
if (wasfirst && sc.Match(':')) {
sc.ChangeState(SCE_B_LABEL);
sc.ForwardSetState(SCE_B_DEFAULT);
} else {
char s[100];
int kstates[4] = {
SCE_B_KEYWORD,
SCE_B_KEYWORD2,
SCE_B_KEYWORD3,
SCE_B_KEYWORD4,
};
sc.GetCurrentLowered(s, sizeof(s));
for (int i = 0; i < 4; i++) {
if (keywordlists[i]->InList(s)) {
sc.ChangeState(kstates[i]);
}
}
// Types, must set them as operator else they will be
// matched as number/constant
if (sc.Match('.') || sc.Match('$') || sc.Match('%') ||
sc.Match('#')) {
sc.SetState(SCE_B_OPERATOR);
} else {
sc.SetState(SCE_B_DEFAULT);
}
}
}
} else if (sc.state == SCE_B_OPERATOR) {
if (!IsOperator(sc.ch) || sc.Match('#'))
sc.SetState(SCE_B_DEFAULT);
} else if (sc.state == SCE_B_LABEL) {
if (!IsIdentifier(sc.ch))
sc.SetState(SCE_B_DEFAULT);
} else if (sc.state == SCE_B_CONSTANT) {
if (!IsIdentifier(sc.ch))
sc.SetState(SCE_B_DEFAULT);
} else if (sc.state == SCE_B_NUMBER) {
if (!IsDigit(sc.ch))
sc.SetState(SCE_B_DEFAULT);
} else if (sc.state == SCE_B_HEXNUMBER) {
if (!IsHexDigit(sc.ch))
sc.SetState(SCE_B_DEFAULT);
} else if (sc.state == SCE_B_BINNUMBER) {
if (!IsBinDigit(sc.ch))
sc.SetState(SCE_B_DEFAULT);
} else if (sc.state == SCE_B_STRING) {
if (sc.ch == '"') {
sc.ForwardSetState(SCE_B_DEFAULT);
}
if (sc.atLineEnd) {
sc.ChangeState(SCE_B_ERROR);
sc.SetState(SCE_B_DEFAULT);
}
} else if (sc.state == SCE_B_COMMENT) {
if (sc.atLineEnd) {
sc.SetState(SCE_B_DEFAULT);
}
}
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);
} else if (isfirst && sc.Match('#')) {
wasfirst = isfirst;
sc.SetState(SCE_B_IDENTIFIER);
} else if (sc.Match(comment_char)) {
sc.SetState(SCE_B_COMMENT);
} else if (sc.Match('"')) {
sc.SetState(SCE_B_STRING);
} else if (IsDigit(sc.ch)) {
sc.SetState(SCE_B_NUMBER);
} else if (sc.Match('$')) {
sc.SetState(SCE_B_HEXNUMBER);
} else if (sc.Match('%')) {
sc.SetState(SCE_B_BINNUMBER);
} else if (sc.Match('#')) {
sc.SetState(SCE_B_CONSTANT);
} else if (IsOperator(sc.ch)) {
sc.SetState(SCE_B_OPERATOR);
} else if (IsIdentifier(sc.ch)) {
wasfirst = isfirst;
sc.SetState(SCE_B_IDENTIFIER);
} else if (!IsSpace(sc.ch)) {
sc.SetState(SCE_B_ERROR);
}
}
if (!IsSpace(sc.ch))
isfirst = false;
if (!sc.More())
break;
}
sc.Complete();
}
static int CheckBlitzFoldPoint(char const *token, int &level) {
if (!strcmp(token, "function") ||
!strcmp(token, "type")) {
level |= SC_FOLDLEVELHEADERFLAG;
return 1;
}
if (!strcmp(token, "end function") ||
!strcmp(token, "end type")) {
return -1;
}
return 0;
}
static int CheckPureFoldPoint(char const *token, int &level) {
if (!strcmp(token, "procedure") ||
!strcmp(token, "enumeration") ||
!strcmp(token, "interface") ||
!strcmp(token, "structure")) {
level |= SC_FOLDLEVELHEADERFLAG;
return 1;
}
if (!strcmp(token, "endprocedure") ||
!strcmp(token, "endenumeration") ||
!strcmp(token, "endinterface") ||
!strcmp(token, "endstructure")) {
return -1;
}
return 0;
}
static int CheckFreeFoldPoint(char const *token, int &level) {
if (!strcmp(token, "function") ||
!strcmp(token, "sub") ||
!strcmp(token, "type")) {
level |= SC_FOLDLEVELHEADERFLAG;
return 1;
}
if (!strcmp(token, "end function") ||
!strcmp(token, "end sub") ||
!strcmp(token, "end type")) {
return -1;
}
return 0;
}
static void FoldBasicDoc(unsigned int startPos, int length,
Accessor &styler, int (*CheckFoldPoint)(char const *, int &)) {
int line = styler.GetLine(startPos);
int level = styler.LevelAt(line);
int go = 0, done = 0;
int endPos = startPos + length;
char word[256];
int wordlen = 0;
int i;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// Scan for tokens at the start of the line (they may include
// whitespace, for tokens like "End Function"
for (i = startPos; i < endPos; i++) {
int c = styler.SafeGetCharAt(i);
if (!done && !go) {
if (wordlen) { // are we scanning a token already?
word[wordlen] = static_cast<char>(LowerCase(c));
if (!IsIdentifier(c)) { // done with token
word[wordlen] = '\0';
go = CheckFoldPoint(word, level);
if (!go) {
// Treat any whitespace as single blank, for
// things like "End Function".
if (IsSpace(c) && IsIdentifier(word[wordlen - 1])) {
word[wordlen] = ' ';
if (wordlen < 255)
wordlen++;
}
else // done with this line
done = 1;
}
} else if (wordlen < 255) {
wordlen++;
}
} else { // start scanning at first non-whitespace character
if (!IsSpace(c)) {
if (IsIdentifier(c)) {
word[0] = static_cast<char>(LowerCase(c));
wordlen = 1;
} else // done with this line
done = 1;
}
}
}
if (c == '\n') { // line end
if (!done && wordlen == 0 && foldCompact) // line was only space
level |= SC_FOLDLEVELWHITEFLAG;
if (level != styler.LevelAt(line))
styler.SetLevel(line, level);
level += go;
line++;
// reset state
wordlen = 0;
level &= ~SC_FOLDLEVELHEADERFLAG;
level &= ~SC_FOLDLEVELWHITEFLAG;
go = 0;
done = 0;
}
}
}
static void ColouriseBlitzBasicDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, ';');
}
static void ColourisePureBasicDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, ';');
}
static void ColouriseFreeBasicDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, '\'');
}
static void FoldBlitzBasicDoc(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) {
FoldBasicDoc(startPos, length, styler, CheckBlitzFoldPoint);
}
static void FoldPureBasicDoc(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) {
FoldBasicDoc(startPos, length, styler, CheckPureFoldPoint);
}
static void FoldFreeBasicDoc(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) {
FoldBasicDoc(startPos, length, styler, CheckFreeFoldPoint);
}
static const char * const blitzbasicWordListDesc[] = {
"BlitzBasic Keywords",
"user1",
"user2",
"user3",
0
};
static const char * const purebasicWordListDesc[] = {
"PureBasic Keywords",
"PureBasic PreProcessor Keywords",
"user defined 1",
"user defined 2",
0
};
static const char * const freebasicWordListDesc[] = {
"FreeBasic Keywords",
"FreeBasic PreProcessor Keywords",
"user defined 1",
"user defined 2",
0
};
LexerModule lmBlitzBasic(SCLEX_BLITZBASIC, ColouriseBlitzBasicDoc, "blitzbasic",
FoldBlitzBasicDoc, blitzbasicWordListDesc);
LexerModule lmPureBasic(SCLEX_PUREBASIC, ColourisePureBasicDoc, "purebasic",
FoldPureBasicDoc, purebasicWordListDesc);
LexerModule lmFreeBasic(SCLEX_FREEBASIC, ColouriseFreeBasicDoc, "freebasic",
FoldFreeBasicDoc, freebasicWordListDesc);

View File

@ -1,15 +1,16 @@
// Scintilla source code edit control
/** @file LexClw.cxx
** Lexer for Clarion.
** 2004/12/17 Updated Lexer
**/
// Copyright 2003 by Ron Schofield <ron@schofieldcomputer.com>
// Copyright 2003-2004 by Ron Schofield <ron@schofieldcomputer.com>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <ctype.h>
#include "Platform.h"
@ -20,37 +21,53 @@
#include "Scintilla.h"
#include "SciLexer.h"
static char MakeUpperCase(char ch) {
if (ch < 'a' || ch > 'z')
return ch;
else
return static_cast<char>(ch - 'a' + 'A');
// Is an end of line character
inline bool IsEOL(const int ch) {
return(ch == '\n');
}
static void MakeUpperCaseString(char *s) {
while (*s) {
*s = MakeUpperCase(*s);
s++;
// Convert character to uppercase
static char CharacterUpper(char chChar) {
if (chChar < 'a' || chChar > 'z') {
return(chChar);
}
else {
return(static_cast<char>(chChar - 'a' + 'A'));
}
}
// Convert string to uppercase
static void StringUpper(char *szString) {
while (*szString) {
*szString = CharacterUpper(*szString);
szString++;
}
}
// Is a label start character
inline bool IsALabelStart(const int iChar) {
return(isalpha(iChar) || iChar == '_');
}
// Is a label character
inline bool IsALabelCharacter(const int iChar) {
return(isalnum(iChar) || iChar == '_' || iChar == ':');
return(isalnum(iChar) || iChar == '_' || iChar == ':');
}
// Is the character is a ! and the the next character is not a !
inline bool IsACommentStart(StyleContext &scDoc) {
return(scDoc.ch == '!' && scDoc.chNext != '!');
// Is the character is a ! and the the next character is not a !
inline bool IsACommentStart(const int iChar) {
return(iChar == '!');
}
// Is the character a Clarion hex character (ABCDEF)
inline bool IsAHexCharacter(const int iChar, bool bCaseSensitive) {
// Case insensitive.
if (!bCaseSensitive) {
if (strchr("ABCDEFabcdef", iChar) != NULL) {
@ -68,6 +85,7 @@ inline bool IsAHexCharacter(const int iChar, bool bCaseSensitive) {
// Is the character a Clarion base character (B=Binary, O=Octal, H=Hex)
inline bool IsANumericBaseCharacter(const int iChar, bool bCaseSensitive) {
// Case insensitive.
if (!bCaseSensitive) {
// If character is a numeric base character
@ -87,8 +105,9 @@ inline bool IsANumericBaseCharacter(const int iChar, bool bCaseSensitive) {
// Set the correct numeric constant state
inline bool SetNumericConstantState(StyleContext &scDoc) {
int iPoints = 0; // Point counter
char cNumericString[100]; // Numeric string buffer
char cNumericString[512]; // Numeric string buffer
// Buffer the current numberic string
scDoc.GetCurrent(cNumericString, sizeof(cNumericString));
@ -103,7 +122,7 @@ inline bool SetNumericConstantState(StyleContext &scDoc) {
break;
default :
break;
}
}
}
// If points found (can be more than one for improper formatted number
if (iPoints > 0) {
@ -115,18 +134,68 @@ inline bool SetNumericConstantState(StyleContext &scDoc) {
}
}
// Get the next word in uppercase from the current position (keyword lookahead)
inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLength, char *cWord) {
unsigned int iIndex = 0; // Buffer Index
// Loop through the remaining string from the current position
for (int iOffset = uiStartPos; iOffset < iLength; iOffset++) {
// Get the character from the buffer using the offset
char cCharacter = styler[iOffset];
if (IsEOL(cCharacter)) {
break;
}
// If the character is alphabet character
if (isalpha(cCharacter)) {
// Add UPPERCASE character to the word buffer
cWord[iIndex++] = CharacterUpper(cCharacter);
}
}
// Add null termination
cWord[iIndex] = '\0';
// If no word was found
if (iIndex == 0) {
// Return failure
return(false);
}
// Else word was found
else {
// Return success
return(true);
}
}
// Clarion Language Colouring Procedure
static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
int iParenthesesLevel=0; // Parenthese Level
int iParenthesesLevel = 0; // Parenthese Level
int iColumn1Label = false; // Label starts in Column 1
WordList &wlClarionKeywords = *wlKeywords[0]; // Clarion Keywords
WordList &wlCompilerDirectives = *wlKeywords[1]; // Compiler Directives
WordList &wlBuiltInProcsFuncs = *wlKeywords[2]; // Builtin Procedures and Functions
WordList &wlStructsDataTypes = *wlKeywords[3]; // Structures and Data Types
WordList &wlAttributes = *wlKeywords[4]; // Procedure Attributes
WordList &wlStandardEquates = *wlKeywords[5]; // Standard Equates
WordList &wlReservedWords = *wlKeywords[6]; // Clarion Reserved Keywords
WordList &wlClarionKeywords = *wlKeywords[0]; // Clarion Keywords
WordList &wlCompilerDirectives = *wlKeywords[1]; // Compiler Directives
WordList &wlRuntimeExpressions = *wlKeywords[2]; // Runtime Expressions
WordList &wlBuiltInProcsFuncs = *wlKeywords[3]; // Builtin Procedures and Functions
WordList &wlStructsDataTypes = *wlKeywords[4]; // Structures and Data Types
WordList &wlAttributes = *wlKeywords[5]; // Procedure Attributes
WordList &wlStandardEquates = *wlKeywords[6]; // Standard Equates
WordList &wlLabelReservedWords = *wlKeywords[7]; // Clarion Reserved Keywords (Labels)
WordList &wlProcLabelReservedWords = *wlKeywords[8]; // Clarion Reserved Keywords (Procedure Labels)
const char wlProcReservedKeywordList[] =
"PROCEDURE FUNCTION";
WordList wlProcReservedKeywords;
wlProcReservedKeywords.Set(wlProcReservedKeywordList);
const char wlCompilerKeywordList[] =
"COMPILE OMIT";
WordList wlCompilerKeywords;
wlCompilerKeywords.Set(wlCompilerKeywordList);
const char wlLegacyStatementsList[] =
"BOF EOF FUNCTION POINTER SHARE";
WordList wlLegacyStatements;
wlLegacyStatements.Set(wlLegacyStatementsList);
StyleContext scDoc(uiStartPos, iLength, iInitStyle, accStyler);
@ -143,26 +212,45 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
if (!IsALabelCharacter(scDoc.ch)) {
// If the character is a . (dot syntax)
if (scDoc.ch == '.') {
// Turn off column 1 label flag as label now cannot be reserved work
iColumn1Label = false;
// Uncolour the . (dot) to default state, move forward one character,
// and change back to the label state.
scDoc.SetState(SCE_CLW_DEFAULT);
scDoc.Forward();
scDoc.SetState(SCE_CLW_LABEL);
}
// Else terminate the label state
// Else check label
else {
char cLabel[100]; // Label buffer
char cLabel[512]; // Label buffer
// Buffer the current label string
scDoc.GetCurrent(cLabel,sizeof(cLabel));
// If case insensitive, convert string to UPPERCASE to match passed keywords.
if (!bCaseSensitive) {
MakeUpperCaseString(cLabel);
StringUpper(cLabel);
}
// If label string is in the Clarion reserved keyword list
if (wlReservedWords.InList(cLabel)){
// change to error state
// Else if UPPERCASE label string is in the Clarion compiler keyword list
if (wlCompilerKeywords.InList(cLabel) && iColumn1Label){
// change the label to error state
scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE);
}
// Else if UPPERCASE label string is in the Clarion reserved keyword list
else if (wlLabelReservedWords.InList(cLabel) && iColumn1Label){
// change the label to error state
scDoc.ChangeState(SCE_CLW_ERROR);
}
// Else if UPPERCASE label string is
else if (wlProcLabelReservedWords.InList(cLabel) && iColumn1Label) {
char cWord[512]; // Word buffer
// Get the next word from the current position
if (GetNextWordUpper(accStyler,scDoc.currentPos,uiStartPos+iLength,cWord)) {
// If the next word is a procedure reserved word
if (wlProcReservedKeywords.InList(cWord)) {
// Change the label to error state
scDoc.ChangeState(SCE_CLW_ERROR);
}
}
}
// Else if label string is in the compiler directive keyword list
else if (wlCompilerDirectives.InList(cLabel)) {
// change the state to compiler directive state
@ -177,14 +265,14 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
else if (scDoc.state == SCE_CLW_KEYWORD) {
// If character is : (colon)
if (scDoc.ch == ':') {
char cEquate[100]; // Equate buffer
char cEquate[512]; // Equate buffer
// Move forward to include : (colon) in buffer
scDoc.Forward();
// Buffer the equate string
scDoc.GetCurrent(cEquate,sizeof(cEquate));
// If case insensitive, convert string to UPPERCASE to match passed keywords.
if (!bCaseSensitive) {
MakeUpperCaseString(cEquate);
StringUpper(cEquate);
}
// If statement string is in the equate list
if (wlStandardEquates.InList(cEquate)) {
@ -194,43 +282,58 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
}
// If the character is not a valid label character
else if (!IsALabelCharacter(scDoc.ch)) {
char cStatement[100]; // Statement buffer
char cStatement[512]; // Statement buffer
// Buffer the statement string
scDoc.GetCurrent(cStatement,sizeof(cStatement));
// If case insensitive, convert string to UPPERCASE to match passed keywords.
if (!bCaseSensitive) {
MakeUpperCaseString(cStatement);
StringUpper(cStatement);
}
// If statement string is in the Clarion keyword list
if (wlClarionKeywords.InList(cStatement)) {
// Set to the Clarion keyword state
// Change the statement string to the Clarion keyword state
scDoc.ChangeState(SCE_CLW_KEYWORD);
}
// Else if statement string is in the compiler directive keyword list
else if (wlCompilerDirectives.InList(cStatement)) {
// Set to the compiler directive state
// Change the statement string to the compiler directive state
scDoc.ChangeState(SCE_CLW_COMPILER_DIRECTIVE);
}
// Else if statement string is in the runtime expressions keyword list
else if (wlRuntimeExpressions.InList(cStatement)) {
// Change the statement string to the runtime expressions state
scDoc.ChangeState(SCE_CLW_RUNTIME_EXPRESSIONS);
}
// Else if statement string is in the builtin procedures and functions keyword list
else if (wlBuiltInProcsFuncs.InList(cStatement)) {
// Set to the builtin procedures and functions state
// Change the statement string to the builtin procedures and functions state
scDoc.ChangeState(SCE_CLW_BUILTIN_PROCEDURES_FUNCTION);
}
// Else if statement string is in the tructures and data types keyword list
else if (wlStructsDataTypes.InList(cStatement)) {
// Set to the structures and data types state
// Change the statement string to the structures and data types state
scDoc.ChangeState(SCE_CLW_STRUCTURE_DATA_TYPE);
}
// Else if statement string is in the procedure attribute keyword list
else if (wlAttributes.InList(cStatement)) {
// Set to the procedure attribute state
// Change the statement string to the procedure attribute state
scDoc.ChangeState(SCE_CLW_ATTRIBUTE);
}
// Else if statement string is in the standard equate keyword list
else if (wlStandardEquates.InList(cStatement)) {
// Set to the standard equate state
// Change the statement string to the standard equate state
scDoc.ChangeState(SCE_CLW_STANDARD_EQUATE);
}
// Else if statement string is in the deprecated or legacy keyword list
else if (wlLegacyStatements.InList(cStatement)) {
// Change the statement string to the standard equate state
scDoc.ChangeState(SCE_CLW_DEPRECATED);
}
// Else the statement string doesn't match any work list
else {
// Change the statement string to the default state
scDoc.ChangeState(SCE_CLW_DEFAULT);
}
// Terminate the keyword state and set to default state
scDoc.SetState(SCE_CLW_DEFAULT);
}
@ -261,13 +364,13 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
// Increment the parenthese level
iParenthesesLevel++;
}
// Else if the character is a ) (close parenthese)
// Else if the character is a ) (close parenthese)
else if (scDoc.ch == ')') {
// If the parenthese level is set to zero
// parentheses matched
if (!iParenthesesLevel) {
scDoc.SetState(SCE_CLW_DEFAULT);
}
}
// Else parenthese level is greater than zero
// still looking for matching parentheses
else {
@ -292,7 +395,7 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
|| IsAHexCharacter(scDoc.ch, bCaseSensitive)
|| scDoc.ch == '.'
|| IsANumericBaseCharacter(scDoc.ch, bCaseSensitive))) {
// If the number was a real
// If the number was a real
if (SetNumericConstantState(scDoc)) {
// Colour the matched string to the real constant state
scDoc.ChangeState(SCE_CLW_REAL_CONSTANT);
@ -313,8 +416,13 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
// Beginning of Line Handling
if (scDoc.atLineStart) {
// Reset the column 1 label flag
iColumn1Label = false;
// If column 1 character is a label start character
if (IsALabelStart(scDoc.ch)) {
// Label character is found in column 1
// so set column 1 label flag and clear last column 1 label
iColumn1Label = true;
// Set the state to label
scDoc.SetState(SCE_CLW_LABEL);
}
@ -323,8 +431,8 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
// Set to default state
scDoc.SetState(SCE_CLW_DEFAULT);
}
// else if the start of a comment or is an * (asterisk)
else if (IsACommentStart(scDoc) || scDoc.ch == '*' ) {
// else if comment start (!) or is an * (asterisk)
else if (IsACommentStart(scDoc.ch) || scDoc.ch == '*' ) {
// then set the state to comment.
scDoc.SetState(SCE_CLW_COMMENT);
}
@ -349,7 +457,7 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
}
// Default Handling
else {
// If in default state
// If in default state
if (scDoc.state == SCE_CLW_DEFAULT) {
// If is a letter could be a possible statement
if (isalpha(scDoc.ch)) {
@ -362,13 +470,13 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
scDoc.SetState(SCE_CLW_INTEGER_CONSTANT);
}
// else if the start of a comment or a | (line continuation)
else if (IsACommentStart(scDoc) || scDoc.ch == '|') {
else if (IsACommentStart(scDoc.ch) || scDoc.ch == '|') {
// then set the state to comment.
scDoc.SetState(SCE_CLW_COMMENT);
}
}
// else if the character is a ' (single quote)
else if (scDoc.ch == '\'') {
// If the character is also a ' (single quote)
// If the character is also a ' (single quote)
// Embedded Apostrophe
if (scDoc.chNext == '\'') {
// Move forward colouring it as default state
@ -378,8 +486,8 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
// move to the next character and then set the state to comment.
scDoc.ForwardSetState(SCE_CLW_STRING);
}
}
// else the character is an @ (apersand)
}
// else the character is an @ (ampersand)
else if (scDoc.ch == '@') {
// Case insensitive.
if (!bCaseSensitive) {
@ -397,7 +505,7 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
scDoc.SetState(SCE_CLW_PICTURE_STRING);
}
}
}
}
}
}
}
@ -406,36 +514,162 @@ static void ColouriseClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle
}
// Clarion Language Case Sensitive Colouring Procedure
static void ColouriseClwDocSensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
ColouriseClwDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, true);
static void ColouriseClarionDocSensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, true);
}
// Clarion Language Case Insensitive Colouring Procedure
static void ColouriseClwDocInsensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
ColouriseClwDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, false);
static void ColouriseClarionDocInsensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, false);
}
// Fill Buffer
static void FillBuffer(unsigned int uiStart, unsigned int uiEnd, Accessor &accStyler, char *szBuffer, unsigned int uiLength) {
unsigned int uiPos = 0;
while ((uiPos < uiEnd - uiStart + 1) && (uiPos < uiLength-1)) {
szBuffer[uiPos] = static_cast<char>(toupper(accStyler[uiStart + uiPos]));
uiPos++;
}
szBuffer[uiPos] = '\0';
}
// Classify Clarion Fold Point
static int ClassifyClarionFoldPoint(int iLevel, const char* szString) {
if (!(isdigit(szString[0]) || (szString[0] == '.'))) {
if (strcmp(szString, "PROCEDURE") == 0) {
// iLevel = SC_FOLDLEVELBASE + 1;
}
else if (strcmp(szString, "MAP") == 0 ||
strcmp(szString,"ACCEPT") == 0 ||
strcmp(szString,"BEGIN") == 0 ||
strcmp(szString,"CASE") == 0 ||
strcmp(szString,"EXECUTE") == 0 ||
strcmp(szString,"IF") == 0 ||
strcmp(szString,"ITEMIZE") == 0 ||
strcmp(szString,"INTERFACE") == 0 ||
strcmp(szString,"JOIN") == 0 ||
strcmp(szString,"LOOP") == 0 ||
strcmp(szString,"MODULE") == 0 ||
strcmp(szString,"RECORD") == 0) {
iLevel++;
}
else if (strcmp(szString, "APPLICATION") == 0 ||
strcmp(szString, "CLASS") == 0 ||
strcmp(szString, "DETAIL") == 0 ||
strcmp(szString, "FILE") == 0 ||
strcmp(szString, "FOOTER") == 0 ||
strcmp(szString, "FORM") == 0 ||
strcmp(szString, "GROUP") == 0 ||
strcmp(szString, "HEADER") == 0 ||
strcmp(szString, "INTERFACE") == 0 ||
strcmp(szString, "MENU") == 0 ||
strcmp(szString, "MENUBAR") == 0 ||
strcmp(szString, "OLE") == 0 ||
strcmp(szString, "OPTION") == 0 ||
strcmp(szString, "QUEUE") == 0 ||
strcmp(szString, "REPORT") == 0 ||
strcmp(szString, "SHEET") == 0 ||
strcmp(szString, "TAB") == 0 ||
strcmp(szString, "TOOLBAR") == 0 ||
strcmp(szString, "VIEW") == 0 ||
strcmp(szString, "WINDOW") == 0) {
iLevel++;
}
else if (strcmp(szString, "END") == 0 ||
strcmp(szString, "UNTIL") == 0 ||
strcmp(szString, "WHILE") == 0) {
iLevel--;
}
}
return(iLevel);
}
// Clarion Language Folding Procedure
#ifdef FOLDING_IMPLEMENTED
static void FoldClwDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *[], Accessor &accStyler) {
unsigned int uiEndPos = uiStartPos + iLength;
int iLineCurrent = accStyler.GetLine(uiStartPos);
int iLevelPrev = accStyler.LevelAt(iLineCurrent) & SC_FOLDLEVELNUMBERMASK;
int iLevelCurrent = iLevelPrev;
char chNext = accStyler[uiStartPos];
int iStyle = iInitStyle;
int iStyleNext = accStyler.StyleAt(uiStartPos);
int iVisibleChars = 0;
int iLastStart = 0;
for (unsigned int uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) {
char chChar = chNext;
chNext = accStyler.SafeGetCharAt(uiPos + 1);
int iStylePrev = iStyle;
iStyle = iStyleNext;
iStyleNext = accStyler.StyleAt(uiPos + 1);
bool bEOL = (chChar == '\r' && chNext != '\n') || (chChar == '\n');
if (iStylePrev == SCE_CLW_DEFAULT) {
if (iStyle == SCE_CLW_KEYWORD || iStyle == SCE_CLW_STRUCTURE_DATA_TYPE) {
// Store last word start point.
iLastStart = uiPos;
}
}
if (iStylePrev == SCE_CLW_KEYWORD || iStylePrev == SCE_CLW_STRUCTURE_DATA_TYPE) {
if(iswordchar(chChar) && !iswordchar(chNext)) {
char chBuffer[100];
FillBuffer(iLastStart, uiPos, accStyler, chBuffer, sizeof(chBuffer));
iLevelCurrent = ClassifyClarionFoldPoint(iLevelCurrent,chBuffer);
// if ((iLevelCurrent == SC_FOLDLEVELBASE + 1) && iLineCurrent > 1) {
// accStyler.SetLevel(iLineCurrent-1,SC_FOLDLEVELBASE);
// iLevelPrev = SC_FOLDLEVELBASE;
// }
}
}
if (bEOL) {
int iLevel = iLevelPrev;
if ((iLevelCurrent > iLevelPrev) && (iVisibleChars > 0))
iLevel |= SC_FOLDLEVELHEADERFLAG;
if (iLevel != accStyler.LevelAt(iLineCurrent)) {
accStyler.SetLevel(iLineCurrent,iLevel);
}
iLineCurrent++;
iLevelPrev = iLevelCurrent;
iVisibleChars = 0;
}
if (!isspacechar(chChar))
iVisibleChars++;
}
// Fill in the real level of the next line, keeping the current flags
// as they will be filled in later.
int iFlagsNext = accStyler.LevelAt(iLineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
accStyler.SetLevel(iLineCurrent, iLevelPrev | iFlagsNext);
}
#endif
// Word List Descriptions
static const char * const rgWordListDescriptions[] = {
"Clarion Keywords",
"Compiler Directives",
"Built-in Procedures and Functions",
"Runtime Expressions",
"Structure and Data Types",
"Attributes",
"Standard Equates",
"Reserved Words",
"Reserved Words (Labels)",
"Reserved Words (Procedure Labels)",
0,
};
// Case Sensitive Clarion Language Lexer
LexerModule lmClw(SCLEX_CLW, ColouriseClwDocSensitive, "clw", NULL, rgWordListDescriptions);
LexerModule lmClw(SCLEX_CLW, ColouriseClarionDocSensitive, "clarion", FoldClarionDoc, rgWordListDescriptions);
// Case Insensitive Clarion Language Lexer
LexerModule lmClwNoCase(SCLEX_CLWNOCASE, ColouriseClwDocInsensitive, "clwnocase", NULL, rgWordListDescriptions);
LexerModule lmClwNoCase(SCLEX_CLWNOCASE, ColouriseClarionDocInsensitive, "clarionnocase", FoldClarionDoc, rgWordListDescriptions);

View File

@ -1,8 +1,8 @@
// Scintilla source code edit control
/** @file LexCPP.cxx
** Lexer for C++, C, Java, and Javascript.
** Lexer for C++, C, Java, and JavaScript.
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
@ -23,35 +23,30 @@
#define KEYWORD_BOXHEADER 1
#define KEYWORD_FOLDCONTRACTED 2
static bool IsOKBeforeRE(const int ch) {
static bool IsOKBeforeRE(int ch) {
return (ch == '(') || (ch == '=') || (ch == ',');
}
static inline bool IsAWordChar(const int ch) {
static inline bool IsAWordChar(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
}
static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
static inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalpha(ch) || ch == '_');
}
static inline bool IsADoxygenChar(const int ch) {
return (islower(ch) || ch == '$' || ch == '@' ||
ch == '\\' || ch == '&' || ch == '<' ||
ch == '>' || ch == '#' || ch == '{' ||
ch == '}' || ch == '[' || ch == ']');
static inline bool IsADoxygenChar(int ch) {
return (ch < 0x80 && islower(ch)) || ch == '$' || ch == '@' ||
ch == '\\' || ch == '&' || ch == '<' ||
ch == '>' || ch == '#' || ch == '{' ||
ch == '}' || ch == '[' || ch == ']';
}
static inline bool IsStateComment(const int state) {
return ((state == SCE_C_COMMENT) ||
(state == SCE_C_COMMENTLINE) ||
(state == SCE_C_COMMENTDOC) ||
(state == SCE_C_COMMENTDOCKEYWORD) ||
(state == SCE_C_COMMENTDOCKEYWORDERROR));
}
static inline bool IsStateString(const int state) {
return ((state == SCE_C_STRING) || (state == SCE_C_VERBATIM));
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);
}
static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
@ -64,21 +59,52 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
// Do not leak onto next line
if (initStyle == SCE_C_STRINGEOL)
initStyle = SCE_C_DEFAULT;
int chPrevNonWhite = ' ';
int visibleChars = 0;
bool lastWordWasUUID = false;
int styleBeforeDCKeyword = SCE_C_DEFAULT;
bool continuationLine = false;
if (initStyle == SCE_C_PREPROCESSOR) {
// Set continuationLine if last character of previous line is '\'
int lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0) {
int chBack = styler.SafeGetCharAt(startPos-1, 0);
int chBack2 = styler.SafeGetCharAt(startPos-2, 0);
int lineEndChar = '!';
if (chBack2 == '\r' && chBack == '\n') {
lineEndChar = styler.SafeGetCharAt(startPos-3, 0);
} else if (chBack == '\n' || chBack == '\r') {
lineEndChar = chBack2;
}
continuationLine = lineEndChar == '\\';
}
}
// look back to set chPrevNonWhite properly for better regex colouring
if (startPos > 0) {
int back = startPos;
while (--back && IsSpaceEquiv(styler.StyleAt(back)))
;
if (styler.StyleAt(back) == SCE_C_OPERATOR) {
chPrevNonWhite = styler.SafeGetCharAt(back);
}
}
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart && (sc.state == SCE_C_STRING)) {
// Prevent SCE_C_STRINGEOL from leaking back to previous line
sc.SetState(SCE_C_STRING);
if (sc.atLineStart) {
if (sc.state == SCE_C_STRING) {
// Prevent SCE_C_STRINGEOL from leaking back to previous line which
// ends with a line continuation by locking in the state upto this position.
sc.SetState(SCE_C_STRING);
}
// Reset states to begining of colourise so no surprises
// if different sets of lines lexed.
visibleChars = 0;
lastWordWasUUID = false;
}
// Handle line continuation generically.
@ -88,124 +114,161 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
continuationLine = true;
continue;
}
}
// Determine if the current state should terminate.
if (sc.state == SCE_C_OPERATOR) {
sc.SetState(SCE_C_DEFAULT);
} else if (sc.state == SCE_C_NUMBER) {
if (!IsAWordChar(sc.ch)) {
switch (sc.state) {
case SCE_C_OPERATOR:
sc.SetState(SCE_C_DEFAULT);
}
} else if (sc.state == SCE_C_IDENTIFIER) {
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
char s[100];
if (caseSensitive) {
sc.GetCurrent(s, sizeof(s));
} else {
sc.GetCurrentLowered(s, sizeof(s));
}
if (keywords.InList(s)) {
lastWordWasUUID = strcmp(s, "uuid") == 0;
sc.ChangeState(SCE_C_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_C_WORD2);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_C_GLOBALCLASS);
}
sc.SetState(SCE_C_DEFAULT);
}
} else if (sc.state == SCE_C_PREPROCESSOR) {
if (stylingWithinPreprocessor) {
if (IsASpace(sc.ch)) {
break;
case SCE_C_NUMBER:
// We accept almost anything because of hex. and number suffixes
if (!IsAWordChar(sc.ch)) {
sc.SetState(SCE_C_DEFAULT);
}
} else {
if ((sc.ch == '\r') || (sc.ch == '\n') || (sc.Match('/', '*')) || (sc.Match('/', '/'))) {
break;
case SCE_C_IDENTIFIER:
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
char s[1000];
if (caseSensitive) {
sc.GetCurrent(s, sizeof(s));
} else {
sc.GetCurrentLowered(s, sizeof(s));
}
if (keywords.InList(s)) {
lastWordWasUUID = strcmp(s, "uuid") == 0;
sc.ChangeState(SCE_C_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_C_WORD2);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_C_GLOBALCLASS);
}
sc.SetState(SCE_C_DEFAULT);
}
}
} else if (sc.state == SCE_C_COMMENT) {
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
}
} else if (sc.state == SCE_C_COMMENTDOC) {
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
} else if (sc.ch == '@' || sc.ch == '\\') {
sc.SetState(SCE_C_COMMENTDOCKEYWORD);
}
} else if (sc.state == SCE_C_COMMENTLINE || sc.state == SCE_C_COMMENTLINEDOC) {
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_C_DEFAULT);
visibleChars = 0;
}
} else if (sc.state == SCE_C_COMMENTDOCKEYWORD) {
if (sc.Match('*', '/')) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
} else if (!IsADoxygenChar(sc.ch)) {
char s[100];
if (caseSensitive) {
sc.GetCurrent(s, sizeof(s));
break;
case SCE_C_PREPROCESSOR:
if (sc.atLineStart && !continuationLine) {
sc.SetState(SCE_C_DEFAULT);
} else if (stylingWithinPreprocessor) {
if (IsASpace(sc.ch)) {
sc.SetState(SCE_C_DEFAULT);
}
} else {
sc.GetCurrentLowered(s, sizeof(s));
if (sc.Match('/', '*') || sc.Match('/', '/')) {
sc.SetState(SCE_C_DEFAULT);
}
}
if (!isspace(sc.ch) || !keywords3.InList(s + 1)) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
}
sc.SetState(SCE_C_COMMENTDOC);
}
} else if (sc.state == SCE_C_STRING) {
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
break;
case SCE_C_COMMENT:
if (sc.Match('*', '/')) {
sc.Forward();
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_C_DEFAULT);
} else if (sc.atLineEnd) {
sc.ChangeState(SCE_C_STRINGEOL);
sc.ForwardSetState(SCE_C_DEFAULT);
visibleChars = 0;
}
} else if (sc.state == SCE_C_CHARACTER) {
if (sc.atLineEnd) {
sc.ChangeState(SCE_C_STRINGEOL);
sc.ForwardSetState(SCE_C_DEFAULT);
visibleChars = 0;
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_C_DEFAULT);
}
} else if (sc.state == SCE_C_REGEX) {
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == '/') {
sc.ForwardSetState(SCE_C_DEFAULT);
} else if (sc.ch == '\\') {
// Gobble up the quoted character
if (sc.chNext == '\\' || sc.chNext == '/') {
sc.Forward();
}
}
} else if (sc.state == SCE_C_VERBATIM) {
if (sc.ch == '\"') {
if (sc.chNext == '\"') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_C_DEFAULT);
}
}
} else if (sc.state == SCE_C_UUID) {
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
sc.SetState(SCE_C_DEFAULT);
}
break;
case SCE_C_COMMENTDOC:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_C_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);
}
}
break;
case SCE_C_COMMENTLINE:
if (sc.atLineStart) {
sc.SetState(SCE_C_DEFAULT);
}
break;
case SCE_C_COMMENTLINEDOC:
if (sc.atLineStart) {
sc.SetState(SCE_C_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);
}
}
break;
case SCE_C_COMMENTDOCKEYWORD:
if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
} else if (!IsADoxygenChar(sc.ch)) {
char s[100];
if (caseSensitive) {
sc.GetCurrent(s, sizeof(s));
} else {
sc.GetCurrentLowered(s, sizeof(s));
}
if (!isspace(sc.ch) || !keywords3.InList(s + 1)) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
}
sc.SetState(styleBeforeDCKeyword);
}
break;
case SCE_C_STRING:
if (sc.atLineEnd) {
sc.ChangeState(SCE_C_STRINGEOL);
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_C_DEFAULT);
}
break;
case SCE_C_CHARACTER:
if (sc.atLineEnd) {
sc.ChangeState(SCE_C_STRINGEOL);
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_C_DEFAULT);
}
break;
case SCE_C_REGEX:
if (sc.atLineStart) {
sc.SetState(SCE_C_DEFAULT);
} else if (sc.ch == '/') {
sc.Forward();
while ((sc.ch < 0x80) && islower(sc.ch))
sc.Forward(); // gobble regex flags
sc.SetState(SCE_C_DEFAULT);
} else if (sc.ch == '\\') {
// Gobble up the quoted character
if (sc.chNext == '\\' || sc.chNext == '/') {
sc.Forward();
}
}
break;
case SCE_C_STRINGEOL:
if (sc.atLineStart) {
sc.SetState(SCE_C_DEFAULT);
}
break;
case SCE_C_VERBATIM:
if (sc.ch == '\"') {
if (sc.chNext == '\"') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_C_DEFAULT);
}
}
break;
case SCE_C_UUID:
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
sc.SetState(SCE_C_DEFAULT);
}
}
// Determine if a new state should be entered.
@ -241,7 +304,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
else
sc.SetState(SCE_C_COMMENTLINE);
} else if (sc.ch == '/' && IsOKBeforeRE(chPrevNonWhite)) {
sc.SetState(SCE_C_REGEX);
sc.SetState(SCE_C_REGEX); // JavaScript's RegEx
} else if (sc.ch == '\"') {
sc.SetState(SCE_C_STRING);
} else if (sc.ch == '\'') {
@ -253,7 +316,7 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
do {
sc.Forward();
} while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
if (sc.ch == '\r' || sc.ch == '\n') {
if (sc.atLineEnd) {
sc.SetState(SCE_C_DEFAULT);
}
} else if (isoperator(static_cast<char>(sc.ch))) {
@ -261,26 +324,20 @@ static void ColouriseCppDoc(unsigned int startPos, int length, int initStyle, Wo
}
}
if (sc.atLineEnd) {
// Reset states to begining of colourise so no surprises
// if different sets of lines lexed.
chPrevNonWhite = ' ';
visibleChars = 0;
lastWordWasUUID = false;
}
if (!IsASpace(sc.ch)) {
if (!IsASpace(sc.ch) && !IsSpaceEquiv(sc.state)) {
chPrevNonWhite = sc.ch;
visibleChars++;
}
continuationLine = false;
}
sc.Complete();
}
static bool IsStreamCommentStyle(int style) {
return style == SCE_C_COMMENT ||
style == SCE_C_COMMENTDOC ||
style == SCE_C_COMMENTDOCKEYWORD ||
style == SCE_C_COMMENTDOCKEYWORDERROR;
style == SCE_C_COMMENTDOC ||
style == SCE_C_COMMENTDOCKEYWORD ||
style == SCE_C_COMMENTDOCKEYWORDERROR;
}
// Store both the current line's fold level and the next lines in the

View File

@ -107,6 +107,25 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (lastState == SCE_CSS_DEFAULT)
sc.SetState(SCE_CSS_DIRECTIVE);
break;
case '*':
if (lastState == SCE_CSS_DEFAULT)
sc.SetState(SCE_CSS_TAG);
break;
case '>':
case '+':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_CLASS
|| lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_DEFAULT);
break;
case '[':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_ATTRIBUTE);
break;
case ']':
if (lastState == SCE_CSS_ATTRIBUTE)
sc.SetState(SCE_CSS_TAG);
break;
case '{':
if (lastState == SCE_CSS_DIRECTIVE)
sc.SetState(SCE_CSS_DEFAULT);
@ -126,11 +145,13 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_CSS_VALUE);
break;
case '.':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT)
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_CLASS);
break;
case '#':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_DEFAULT)
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_ID);
break;
case ',':
@ -208,6 +229,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
} else if (sc.state == SCE_CSS_VALUE && (sc.ch == '\"' || sc.ch == '\'')) {
sc.SetState((sc.ch == '\"' ? SCE_CSS_DOUBLESTRING : SCE_CSS_SINGLESTRING));
} else if (IsCssOperator(static_cast<char>(sc.ch))
&& (sc.state != SCE_CSS_ATTRIBUTE || sc.ch == ']')
&& (sc.state != SCE_CSS_VALUE || sc.ch == ';' || sc.ch == '}' || sc.ch == '!')
&& (sc.state != SCE_CSS_DIRECTIVE || sc.ch == ';' || sc.ch == '{')
) {

View File

@ -0,0 +1,399 @@
// Scintilla source code edit control
/** @file LexCaml.cxx
** Lexer for Objective Caml.
**/
// Copyright 2005 by Robert Roessler <robertr@rftp.com>
// The License.txt file describes the conditions under which this software may be distributed.
/* Release History
20050204 Initial release.
20050205 Quick compiler standards/"cleanliness" adjustment.
20050206 Added cast for IsLeadByte().
20050209 Changes to "external" build support.
20050306 Fix for 1st-char-in-doc "corner" case.
20050502 Fix for [harmless] one-past-the-end coloring.
20050515 Refined numeric token recognition logic.
20051125 Added 2nd "optional" keywords class.
20051129 Support "magic" (read-only) comments for RCaml.
20051204 Swtich to using StyleContext infrastructure.
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
// Since the Microsoft __iscsym[f] funcs are not ANSI...
inline int iscaml(int c) {return isalnum(c) || c == '_';}
inline int iscamlf(int c) {return isalpha(c) || c == '_';}
inline int iscamld(int c) {return isdigit(c) || c == '_';}
static const int baseT[24] = {
0, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, /* A - L */
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,16 /* M - X */
};
#ifdef BUILD_AS_EXTERNAL_LEXER
/*
(actually seems to work!)
*/
#include "WindowAccessor.h"
#include "ExternalLexer.h"
#if PLAT_WIN
#include <windows.h>
#endif
static void ColouriseCamlDoc(
unsigned int startPos, int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
static void FoldCamlDoc(
unsigned int startPos, int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
static void InternalLexOrFold(int lexOrFold, unsigned int startPos, int length,
int initStyle, char *words[], WindowID window, char *props);
static const char* LexerName = "caml";
#ifdef TRACE
void Platform::DebugPrintf(const char *format, ...) {
char buffer[2000];
va_list pArguments;
va_start(pArguments, format);
vsprintf(buffer,format,pArguments);
va_end(pArguments);
Platform::DebugDisplay(buffer);
}
#else
void Platform::DebugPrintf(const char *, ...) {
}
#endif
bool Platform::IsDBCSLeadByte(int codePage, char ch) {
return ::IsDBCSLeadByteEx(codePage, ch) != 0;
}
long Platform::SendScintilla(WindowID w, unsigned int msg, unsigned long wParam, long lParam) {
return ::SendMessage(reinterpret_cast<HWND>(w), msg, wParam, lParam);
}
long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long wParam, void *lParam) {
return ::SendMessage(reinterpret_cast<HWND>(w), msg, wParam,
reinterpret_cast<LPARAM>(lParam));
}
void EXT_LEXER_DECL Fold(unsigned int lexer, unsigned int startPos, int length,
int initStyle, char *words[], WindowID window, char *props)
{
// below useless evaluation(s) to supress "not used" warnings
lexer;
// build expected data structures and do the Fold
InternalLexOrFold(1, startPos, length, initStyle, words, window, props);
}
int EXT_LEXER_DECL GetLexerCount()
{
return 1; // just us [Objective] Caml lexers here!
}
void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength)
{
// below useless evaluation(s) to supress "not used" warnings
Index;
// return as much of our lexer name as will fit (what's up with Index?)
if (buflength > 0) {
buflength--;
int n = strlen(LexerName);
if (n > buflength)
n = buflength;
memcpy(name, LexerName, n), name[n] = '\0';
}
}
void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length,
int initStyle, char *words[], WindowID window, char *props)
{
// below useless evaluation(s) to supress "not used" warnings
lexer;
// build expected data structures and do the Lex
InternalLexOrFold(0, startPos, length, initStyle, words, window, props);
}
static void InternalLexOrFold(int foldOrLex, unsigned int startPos, int length,
int initStyle, char *words[], WindowID window, char *props)
{
// create and initialize a WindowAccessor (including contained PropSet)
PropSet ps;
ps.SetMultiple(props);
WindowAccessor wa(window, ps);
// create and initialize WordList(s)
int nWL = 0;
for (; words[nWL]; nWL++) ; // count # of WordList PTRs needed
WordList** wl = new WordList* [nWL + 1];// alloc WordList PTRs
int i = 0;
for (; i < nWL; i++) {
wl[i] = new WordList(); // (works or THROWS bad_alloc EXCEPTION)
wl[i]->Set(words[i]);
}
wl[i] = 0;
// call our "internal" folder/lexer (... then do Flush!)
if (foldOrLex)
FoldCamlDoc(startPos, length, initStyle, wl, wa);
else
ColouriseCamlDoc(startPos, length, initStyle, wl, wa);
wa.Flush();
// clean up before leaving
for (i = nWL - 1; i >= 0; i--)
delete wl[i];
delete [] wl;
}
static
#endif /* BUILD_AS_EXTERNAL_LEXER */
void ColouriseCamlDoc(
unsigned int startPos, int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
{
// initialize styler
StyleContext sc(startPos, length, initStyle, styler);
// set up [initial] state info (terminating states that shouldn't "bleed")
int nesting = 0;
if (sc.state < SCE_CAML_STRING)
sc.state = SCE_CAML_DEFAULT;
if (sc.state >= SCE_CAML_COMMENT)
nesting = (sc.state & 0x0f) - SCE_CAML_COMMENT;
int chBase = 0, chToken = 0, chLit = 0;
WordList& keywords = *keywordlists[0];
WordList& keywords2 = *keywordlists[1];
WordList& keywords3 = *keywordlists[2];
const int useMagic = styler.GetPropertyInt("lexer.caml.magic", 0);
// foreach char in range...
while (sc.More()) {
// set up [per-char] state info
int state2 = -1; // (ASSUME no state change)
int chColor = sc.currentPos - 1;// (ASSUME standard coloring range)
bool advance = true; // (ASSUME scanner "eats" 1 char)
// step state machine
switch (sc.state & 0x0f) {
case SCE_CAML_DEFAULT:
chToken = sc.currentPos; // save [possible] token start (JIC)
// it's wide open; what do we have?
if (iscamlf(sc.ch))
state2 = SCE_CAML_IDENTIFIER;
else if (sc.Match('`') && iscamlf(sc.chNext))
state2 = SCE_CAML_TAGNAME;
else if (sc.Match('#') && isdigit(sc.chNext))
state2 = SCE_CAML_LINENUM;
else if (isdigit(sc.ch)) {
state2 = SCE_CAML_NUMBER, chBase = 10;
if (sc.Match('0') && strchr("bBoOxX", sc.chNext))
chBase = baseT[tolower(sc.chNext) - 'a'], sc.Forward();
} else if (sc.Match('\'')) /* (char literal?) */
state2 = SCE_CAML_CHAR, chLit = 0;
else if (sc.Match('\"'))
state2 = SCE_CAML_STRING;
else if (sc.Match('(', '*'))
state2 = SCE_CAML_COMMENT,
sc.ch = ' ', // (make SURE "(*)" isn't seen as a closed comment)
sc.Forward();
else if (strchr("!?~" /* Caml "prefix-symbol" */
"=<>@^|&+-*/$%" /* Caml "infix-symbol" */
"()[]{};,:.#", sc.ch)) /* Caml "bracket" or ;,:.# */
state2 = SCE_CAML_OPERATOR;
break;
case SCE_CAML_IDENTIFIER:
// [try to] interpret as [additional] identifier char
if (!(iscaml(sc.ch) || sc.Match('\''))) {
const int n = sc.currentPos - chToken;
if (n < 24) {
// length is believable as keyword, [re-]construct token
char t[24];
for (int i = -n; i < 0; i++)
t[n + i] = static_cast<char>(sc.GetRelative(i));
t[n] = '\0';
// special-case "_" token as KEYWORD
if ((n == 1 && sc.chPrev == '_') || keywords.InList(t))
sc.ChangeState(SCE_CAML_KEYWORD);
else if (keywords2.InList(t))
sc.ChangeState(SCE_CAML_KEYWORD2);
else if (keywords3.InList(t))
sc.ChangeState(SCE_CAML_KEYWORD3);
}
state2 = SCE_CAML_DEFAULT, advance = false;
}
break;
case SCE_CAML_TAGNAME:
// [try to] interpret as [additional] tagname char
if (!(iscaml(sc.ch) || sc.Match('\'')))
state2 = SCE_CAML_DEFAULT, advance = false;
break;
/*case SCE_CAML_KEYWORD:
case SCE_CAML_KEYWORD2:
case SCE_CAML_KEYWORD3:
// [try to] interpret as [additional] keyword char
if (!iscaml(ch))
state2 = SCE_CAML_DEFAULT, advance = false;
break;*/
case SCE_CAML_LINENUM:
// [try to] interpret as [additional] linenum directive char
if (!isdigit(sc.ch))
state2 = SCE_CAML_DEFAULT, advance = false;
break;
case SCE_CAML_OPERATOR: {
// [try to] interpret as [additional] operator char
const char* o = 0;
if (iscaml(sc.ch) || isspace(sc.ch) /* ident or whitespace */
|| (o = strchr(")]};,\'\"`#", sc.ch),o)/* "termination" chars */
|| !strchr("!$%&*+-./:<=>?@^|~", sc.ch)/* "operator" chars */) {
// check for INCLUSIVE termination
if (o && strchr(")]};,", sc.ch)) {
if ((sc.Match(')') && sc.chPrev == '(')
|| (sc.Match(']') && sc.chPrev == '['))
// special-case "()" and "[]" tokens as KEYWORDS
sc.ChangeState(SCE_CAML_KEYWORD);
chColor++;
} else
advance = false;
state2 = SCE_CAML_DEFAULT;
}
break;
}
case SCE_CAML_NUMBER:
// [try to] interpret as [additional] numeric literal char
// N.B. - improperly accepts "extra" digits in base 2 or 8 literals
if (iscamld(sc.ch) || IsADigit(sc.ch, chBase))
break;
// how about an integer suffix?
if ((sc.Match('l') || sc.Match('L') || sc.Match('n'))
&& (iscamld(sc.chPrev) || IsADigit(sc.chPrev, chBase)))
break;
// or a floating-point literal?
if (chBase == 10) {
// with a decimal point?
if (sc.Match('.') && iscamld(sc.chPrev))
break;
// with an exponent? (I)
if ((sc.Match('e') || sc.Match('E'))
&& (iscamld(sc.chPrev) || sc.chPrev == '.'))
break;
// with an exponent? (II)
if ((sc.Match('+') || sc.Match('-'))
&& (sc.chPrev == 'e' || sc.chPrev == 'E'))
break;
}
// it looks like we have run out of number
state2 = SCE_CAML_DEFAULT, advance = false;
break;
case SCE_CAML_CHAR:
// [try to] interpret as [additional] char literal char
if (sc.Match('\\')) {
chLit = 1; // (definitely IS a char literal)
if (sc.chPrev == '\\')
sc.ch = ' '; // (so termination test isn't fooled)
// should we be terminating - one way or another?
} else if ((sc.Match('\'') && sc.chPrev != '\\') || sc.atLineEnd) {
state2 = SCE_CAML_DEFAULT;
if (sc.Match('\''))
chColor++;
else
sc.ChangeState(SCE_CAML_IDENTIFIER);
// ... maybe a char literal, maybe not
} else if (chLit < 1 && sc.currentPos - chToken >= 2)
sc.ChangeState(SCE_CAML_IDENTIFIER), advance = false;
break;
case SCE_CAML_STRING:
// [try to] interpret as [additional] string literal char
if (sc.Match('\\') && sc.chPrev == '\\')
sc.ch = ' '; // (so '\\' doesn't cause us trouble)
else if (sc.Match('\"') && sc.chPrev != '\\')
state2 = SCE_CAML_DEFAULT, chColor++;
break;
case SCE_CAML_COMMENT:
case SCE_CAML_COMMENT1:
case SCE_CAML_COMMENT2:
case SCE_CAML_COMMENT3:
// we're IN a comment - does this start a NESTED comment?
if (sc.Match('(', '*'))
state2 = sc.state + 1, chToken = sc.currentPos,
sc.ch = ' ', // (make SURE "(*)" isn't seen as a closed comment)
sc.Forward(), nesting++;
// [try to] interpret as [additional] comment char
else if (sc.Match(')') && sc.chPrev == '*') {
if (nesting)
state2 = (sc.state & 0x0f) - 1, chToken = 0, nesting--;
else
state2 = SCE_CAML_DEFAULT;
chColor++;
// enable "magic" (read-only) comment AS REQUIRED
} else if (useMagic && sc.currentPos - chToken == 4
&& sc.Match('c') && sc.chPrev == 'r' && sc.GetRelative(-2) == '@')
sc.state |= 0x10; // (switch to read-only comment style)
break;
}
// handle state change and char coloring as required
if (state2 >= 0)
styler.ColourTo(chColor, sc.state), sc.ChangeState(state2);
// move to next char UNLESS re-scanning current char
if (advance)
sc.Forward();
}
// do any required terminal char coloring (JIC)
sc.Complete();
}
#ifdef BUILD_AS_EXTERNAL_LEXER
static
#endif /* BUILD_AS_EXTERNAL_LEXER */
void FoldCamlDoc(
unsigned int startPos, int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
{
// below useless evaluation(s) to supress "not used" warnings
startPos || length || initStyle || keywordlists[0] || styler.Length();
}
static const char * const camlWordListDesc[] = {
"Keywords", // primary Objective Caml keywords
"Keywords2", // "optional" keywords (typically from Pervasives)
"Keywords3", // "optional" keywords (typically typenames)
0
};
#ifndef BUILD_AS_EXTERNAL_LEXER
LexerModule lmCaml(SCLEX_CAML, ColouriseCamlDoc, "caml", FoldCamlDoc, camlWordListDesc);
#endif /* BUILD_AS_EXTERNAL_LEXER */

View File

@ -0,0 +1,207 @@
// Scintilla source code edit control
/** @file LexCsound.cxx
** Lexer for Csound (Orchestra & Score)
** Written by Georg Ritter - <ritterfuture A T gmail D O T com>
**/
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
ch == '_' || ch == '?');
}
static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.' ||
ch == '%' || ch == '@' || ch == '$' || ch == '?');
}
static inline bool IsCsoundOperator(char ch) {
if (isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
ch == '(' || ch == ')' || ch == '=' || ch == '^' ||
ch == '[' || ch == ']' || ch == '<' || ch == '&' ||
ch == '>' || ch == ',' || ch == '|' || ch == '~' ||
ch == '%' || ch == ':')
return true;
return false;
}
static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &opcode = *keywordlists[0];
WordList &headerStmt = *keywordlists[1];
WordList &otherKeyword = *keywordlists[2];
// Do not leak onto next line
if (initStyle == SCE_CSOUND_STRINGEOL)
initStyle = SCE_CSOUND_DEFAULT;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward())
{
// Handle line continuation generically.
if (sc.ch == '\\') {
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
continue;
}
}
// Determine if the current state should terminate.
if (sc.state == SCE_CSOUND_OPERATOR) {
if (!IsCsoundOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_CSOUND_DEFAULT);
}
}else if (sc.state == SCE_CSOUND_NUMBER) {
if (!IsAWordChar(sc.ch)) {
sc.SetState(SCE_CSOUND_DEFAULT);
}
} else if (sc.state == SCE_CSOUND_IDENTIFIER) {
if (!IsAWordChar(sc.ch) ) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (opcode.InList(s)) {
sc.ChangeState(SCE_CSOUND_OPCODE);
} else if (headerStmt.InList(s)) {
sc.ChangeState(SCE_CSOUND_HEADERSTMT);
} else if (otherKeyword.InList(s)) {
sc.ChangeState(SCE_CSOUND_USERKEYWORD);
} else if (s[0] == 'p') {
sc.ChangeState(SCE_CSOUND_PARAM);
} else if (s[0] == 'a') {
sc.ChangeState(SCE_CSOUND_ARATE_VAR);
} else if (s[0] == 'k') {
sc.ChangeState(SCE_CSOUND_KRATE_VAR);
} else if (s[0] == 'i') { // covers both i-rate variables and i-statements
sc.ChangeState(SCE_CSOUND_IRATE_VAR);
} else if (s[0] == 'g') {
sc.ChangeState(SCE_CSOUND_GLOBAL_VAR);
}
sc.SetState(SCE_CSOUND_DEFAULT);
}
}
else if (sc.state == SCE_CSOUND_COMMENT ) {
if (sc.atLineEnd) {
sc.SetState(SCE_CSOUND_DEFAULT);
}
}
else if ((sc.state == SCE_CSOUND_ARATE_VAR) ||
(sc.state == SCE_CSOUND_KRATE_VAR) ||
(sc.state == SCE_CSOUND_IRATE_VAR)) {
if (!IsAWordChar(sc.ch)) {
sc.SetState(SCE_CSOUND_DEFAULT);
}
}
// Determine if a new state should be entered.
if (sc.state == SCE_CSOUND_DEFAULT) {
if (sc.ch == ';'){
sc.SetState(SCE_CSOUND_COMMENT);
} else if (isdigit(sc.ch) || (sc.ch == '.' && isdigit(sc.chNext))) {
sc.SetState(SCE_CSOUND_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_CSOUND_IDENTIFIER);
} else if (IsCsoundOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_CSOUND_OPERATOR);
} else if (sc.ch == 'p') {
sc.SetState(SCE_CSOUND_PARAM);
} else if (sc.ch == 'a') {
sc.SetState(SCE_CSOUND_ARATE_VAR);
} else if (sc.ch == 'k') {
sc.SetState(SCE_CSOUND_KRATE_VAR);
} else if (sc.ch == 'i') { // covers both i-rate variables and i-statements
sc.SetState(SCE_CSOUND_IRATE_VAR);
} else if (sc.ch == 'g') {
sc.SetState(SCE_CSOUND_GLOBAL_VAR);
}
}
}
sc.Complete();
}
static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[],
Accessor &styler) {
unsigned int lengthDoc = 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 stylePrev = 0;
int styleNext = styler.StyleAt(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if ((stylePrev != SCE_CSOUND_OPCODE) && (style == SCE_CSOUND_OPCODE)) {
char s[20];
unsigned int j = 0;
while ((j < (sizeof(s) - 1)) && (iswordchar(styler[i + j]))) {
s[j] = styler[i + j];
j++;
}
s[j] = '\0';
if (strcmp(s, "instr") == 0)
levelCurrent++;
if (strcmp(s, "endin") == 0)
levelCurrent--;
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
stylePrev = style;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
static const char * const csoundWordListDesc[] = {
"Opcodes",
"Header Statements",
"User keywords",
0
};
LexerModule lmCsound(SCLEX_CSOUND, ColouriseCsoundDoc, "csound", FoldCsoundInstruments, csoundWordListDesc);

View File

@ -10,7 +10,6 @@
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <fcntl.h>
#include "Platform.h"

View File

@ -0,0 +1,226 @@
// Scintilla source code edit control
/** @file LexFlagShip.cxx
** Lexer for FlagShip
** (Syntactically compatible to other XBase dialects, like dBase, Clipper, Fox etc.)
**/
// Copyright 2005 by Randy Butler
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static bool IsFlagShipComment(Accessor &styler, int pos, int len) {
return len>0 && styler[pos]=='\'';
}
static inline bool IsTypeCharacter(int ch) {
return ch == '%' || ch == '&' || ch == '@' || ch == '!' || ch == '#' || ch == '$';
}
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
return ch >= 0x80 ||
(isalnum(ch) || ch == '.' || ch == '_');
}
static inline bool IsAWordStart(int ch) {
return ch >= 0x80 ||
(isalnum(ch) || ch == '_');
}
static inline bool IsADateCharacter(const int ch) {
return (ch < 0x80) &&
(isalnum(ch) || ch == '|' || ch == '-' || ch == '/' || ch == ':' || ch == ' ' || ch == '\t');
}
static void ColouriseFlagShipDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
//bool FSScriptSyntax = true;
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
styler.StartAt(startPos);
int visibleChars = 0;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
if (sc.state == SCE_FS_OPERATOR) {
sc.SetState(SCE_FS_DEFAULT);
} else if (sc.state == SCE_FS_IDENTIFIER) {
if (!IsAWordChar(sc.ch)) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (keywords.InList(s)) {
sc.ChangeState(SCE_FS_KEYWORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_FS_KEYWORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_FS_KEYWORD3);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_FS_KEYWORD4);
}// Else, it is really an identifier...
sc.SetState(SCE_FS_DEFAULT);
}
} else if (sc.state == SCE_FS_NUMBER) {
if (!IsAWordChar(sc.ch)) {
sc.SetState(SCE_FS_DEFAULT);
}
} else if (sc.state == SCE_FS_STRING) {
// VB doubles quotes to preserve them, so just end this string
// state now as a following quote will start again
if (sc.ch == '\"') {
if (tolower(sc.chNext) == 'c') {
sc.Forward();
}
sc.ForwardSetState(SCE_FS_DEFAULT);
} else if (sc.atLineEnd) {
sc.ChangeState(SCE_FS_STRINGEOL);
sc.ForwardSetState(SCE_FS_DEFAULT);
}
} else if (sc.state == SCE_FS_COMMENT) {
if (sc.Match('*', '/')) { // new code
sc.Forward();
sc.ForwardSetState(SCE_FS_DEFAULT);
//if (sc.atLineEnd) { // old code
// sc.SetState(SCE_FS_DEFAULT);
}
} else if (sc.state == SCE_FS_COMMENTLINE) { //new code
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_FS_DEFAULT);
visibleChars = 0;
}
} else if (sc.state == SCE_FS_PREPROCESSOR) {
if (sc.atLineEnd) {
sc.SetState(SCE_FS_DEFAULT);
}
} else if (sc.state == SCE_FS_DATE) {
if (sc.ch == '#' || !IsADateCharacter(sc.chNext)) {
sc.ForwardSetState(SCE_FS_DEFAULT);
}
}
// Determine if a new state should be entered.
if (sc.state == SCE_FS_DEFAULT) {
if (sc.Match('/', '*')) { // New code
sc.SetState(SCE_FS_COMMENT);
sc.Forward(); // Eat the * so it isn't used for the end of the comment
//if (sc.ch == '\'') { // Old code
// sc.SetState(SCE_FS_COMMENT); // old code
} else if (sc.Match('/', '/')) { // New code
sc.SetState(SCE_FS_COMMENTLINE);
} else if (sc.ch == '\"') {
sc.SetState(SCE_FS_STRING);
} else if (sc.ch == '#' && visibleChars == 0) {
// Preprocessor commands are alone on their line
sc.SetState(SCE_FS_PREPROCESSOR);
} else if (sc.ch == '#') {
int n = 1;
int chSeek = ' ';
while ((n < 100) && (chSeek == ' ' || chSeek == '\t')) {
chSeek = sc.GetRelative(n);
n++;
}
if (IsADigit(chSeek)) {
sc.SetState(SCE_FS_DATE);
} else {
sc.SetState(SCE_FS_OPERATOR);
}
} else if (sc.ch == '&' && tolower(sc.chNext) == 'h') {
sc.SetState(SCE_FS_NUMBER);
} else if (sc.ch == '&' && tolower(sc.chNext) == 'o') {
sc.SetState(SCE_FS_NUMBER);
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_FS_NUMBER);
} else if (IsAWordStart(sc.ch) || (sc.ch == '[')) {
sc.SetState(SCE_FS_IDENTIFIER);
} else if (isoperator(static_cast<char>(sc.ch)) || (sc.ch == '\\')) {
sc.SetState(SCE_FS_OPERATOR);
}
}
if (sc.atLineEnd) {
visibleChars = 0;
}
if (!IsASpace(sc.ch)) {
visibleChars++;
}
}
sc.Complete();
}
static void FoldFlagShipDoc(unsigned int startPos, int length, int,
WordList *[], Accessor &styler) {
int endPos = startPos + length;
// Backtrack to previous line in case need to fix its fold status
int lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
}
}
int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsFlagShipComment);
char chNext = styler[startPos];
for (int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == endPos)) {
int lev = indentCurrent;
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsFlagShipComment);
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (indentNext & SC_FOLDLEVELWHITEFLAG) {
// Line after is blank so check the next - maybe should continue further?
int spaceFlags2 = 0;
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsFlagShipComment);
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK)) {
lev |= SC_FOLDLEVELHEADERFLAG;
}
}
}
indentCurrent = indentNext;
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
}
}
}
static const char * const FSWordListDesc[] = {
"Keywords",
"functions",
"user2",
"user3",
0
};
LexerModule lmFlagShip(SCLEX_FLAGSHIP, ColouriseFlagShipDoc, "flagship", FoldFlagShipDoc, FSWordListDesc);

View File

@ -273,9 +273,11 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
int style = initStyle;
/***************************************/
int lastStart = 0;
char prevWord[32] = "", Label[6] = "";
char prevWord[32] = "";
char Label[6] = "";
// Variables for do label folding.
static int doLabels[100], posLabel=-1;
static int doLabels[100];
static int posLabel=-1;
/***************************************/
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;

View File

@ -236,7 +236,7 @@ ColouriseGui4CliDoc(unsigned int startPos, int length, int initStyle,
if (!noforward) sc.Forward();
}
styler.ColourTo(sc.currentPos, sc.state);
sc.Complete();
}
// Main folding function called by Scintilla - (based on props (.ini) files function)

View File

@ -2,7 +2,7 @@
/** @file LexHTML.cxx
** Lexer for HTML.
**/
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
@ -35,13 +35,24 @@ static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) {
char s[30 + 1];
unsigned int i = 0;
for (; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
static inline int MakeLowerCase(int ch) {
if (ch < 'A' || ch > 'Z')
return ch;
else
return ch - 'A' + 'a';
}
static void GetTextSegment(Accessor &styler, unsigned int start, unsigned int end, char *s, size_t len) {
size_t i = 0;
for (; (i < end - start + 1) && (i < len-1); i++) {
s[i] = static_cast<char>(MakeLowerCase(styler[start + i]));
}
s[i] = '\0';
}
static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start, unsigned int end, script_type prevValue) {
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
//Platform::DebugPrintf("Scripting indicator [%s]\n", s);
if (strstr(s, "src")) // External script
return eScriptNone;
@ -63,12 +74,8 @@ static script_type segIsScriptingIndicator(Accessor &styler, unsigned int start,
static int PrintScriptingIndicatorOffset(Accessor &styler, unsigned int start, unsigned int end) {
int iResult = 0;
char s[30 + 1];
unsigned int i = 0;
for (; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
}
s[i] = '\0';
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
if (0 == strncmp(s, "php", 3)) {
iResult = 3;
}
@ -183,12 +190,8 @@ static void classifyAttribHTML(unsigned int start, unsigned int end, WordList &k
if (wordIsNumber) {
chAttr = SCE_H_NUMBER;
} else {
char s[30 + 1];
unsigned int i = 0;
for (; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
}
s[i] = '\0';
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
if (keywords.InList(s))
chAttr = SCE_H_ATTRIBUTE;
}
@ -207,7 +210,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
for (unsigned int cPos = start; cPos <= end && i < 30; cPos++) {
char ch = styler[cPos];
if ((ch != '<') && (ch != '/')) {
s[i++] = caseSensitive ? ch : static_cast<char>(tolower(ch));
s[i++] = caseSensitive ? ch : static_cast<char>(MakeLowerCase(ch));
}
}
@ -270,12 +273,8 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw
if (wordIsNumber)
chAttr = SCE_HB_NUMBER;
else {
char s[30 + 1];
unsigned int i = 0;
for (; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
}
s[i] = '\0';
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
if (keywords.InList(s)) {
chAttr = SCE_HB_WORD;
if (strcmp(s, "rem") == 0)
@ -318,12 +317,8 @@ static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &ke
if (wordIsNumber)
chAttr = SCE_HPHP_NUMBER;
else {
char s[100 + 1];
unsigned int i = 0;
for (; i < end - start + 1 && i < 100; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
}
s[i] = '\0';
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
if (keywords.InList(s))
chAttr = SCE_HPHP_WORD;
}
@ -406,6 +401,11 @@ static bool IsCommentState(const int state) {
return state == SCE_H_COMMENT || state == SCE_H_SGML_COMMENT;
}
static bool IsScriptCommentState(const int state) {
return state == SCE_HJ_COMMENT || state == SCE_HJ_COMMENTLINE || state == SCE_HJA_COMMENT ||
state == SCE_HJA_COMMENTLINE || state == SCE_HB_COMMENTLINE || state == SCE_HBA_COMMENTLINE;
}
static bool isLineEnd(char ch) {
return ch == '\r' || ch == '\n';
}
@ -424,6 +424,8 @@ static bool isPHPStringState(int state) {
static int FindPhpStringDelimiter(char *phpStringDelimiter, const int phpStringDelimiterSize, int i, const int lengthDoc, Accessor &styler) {
int j;
while (i < lengthDoc && (styler[i] == ' ' || styler[i] == '\t'))
i++;
phpStringDelimiter[0] = '\n';
for (j = i; j < lengthDoc && styler[j] != '\n' && styler[j] != '\r'; j++) {
if (j - i < phpStringDelimiterSize - 2)
@ -501,12 +503,28 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
char chPrev = ' ';
char ch = ' ';
char chPrevNonWhite = ' ';
// look back to set chPrevNonWhite properly for better regex colouring
if (scriptLanguage == eScriptJS && startPos > 0) {
int back = startPos;
int style = 0;
while (--back) {
style = styler.StyleAt(back);
if (style < SCE_HJ_DEFAULT || style > SCE_HJ_COMMENTDOC)
// includes SCE_HJ_COMMENT & SCE_HJ_COMMENTLINE
break;
}
if (style == SCE_HJ_SYMBOLS) {
chPrevNonWhite = styler.SafeGetCharAt(back);
}
}
styler.StartSegment(startPos);
const int lengthDoc = startPos + length;
for (int i = startPos; i < lengthDoc; i++) {
const char chPrev2 = chPrev;
chPrev = ch;
if (ch != ' ' && ch != '\t')
if (!isspacechar(ch) && state != SCE_HJ_COMMENT &&
state != SCE_HJ_COMMENTLINE && state != SCE_HJ_COMMENTDOC)
chPrevNonWhite = ch;
ch = styler[i];
char chNext = styler.SafeGetCharAt(i + 1);
@ -605,9 +623,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_H_SINGLESTRING:
case SCE_HJ_COMMENT:
case SCE_HJ_COMMENTDOC:
// SCE_HJ_COMMENTLINE removed as this is a common thing done to hide
// the end of script marker from some JS interpreters.
//case SCE_HJ_COMMENTLINE:
//case SCE_HJ_COMMENTLINE: // removed as this is a common thing done to hide
// the end of script marker from some JS interpreters.
case SCE_HJ_DOUBLESTRING:
case SCE_HJ_SINGLESTRING:
case SCE_HJ_REGEX:
@ -617,6 +634,19 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HP_TRIPLEDOUBLE:
break;
default :
// check if the closing tag is a script tag
if (state == SCE_HJ_COMMENTLINE) {
char tag[7]; // room for the <script> tag
char chr; // current char
int j=0;
chr = styler.SafeGetCharAt(i+2);
while (j < 6 && !isspacechar(chr)) {
tag[j++] = static_cast<char>(MakeLowerCase(chr));
chr = styler.SafeGetCharAt(i+2+j);
}
tag[j] = '\0';
if (strcmp(tag, "script") != 0) break;
}
// closing tag of the script (it's a closing HTML tag anyway)
styler.ColourTo(i - 1, StateToPrint);
state = SCE_H_TAGUNKNOWN;
@ -636,7 +666,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
!isPHPStringState(state) &&
(state != SCE_HPHP_COMMENT) &&
(ch == '<') &&
(chNext == '?')) {
(chNext == '?') &&
!IsScriptCommentState(state) ) {
scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
if (scriptLanguage != eScriptPHP && isStringState(state)) continue;
styler.ColourTo(i - 1, StateToPrint);
@ -653,11 +684,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
inScriptType = eNonHtmlScriptPreProc;
else
inScriptType = eNonHtmlPreProc;
// fold whole script
if (foldHTMLPreprocessor){
// Fold whole script, but not if the XML first tag (all XML-like tags in this case)
if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) {
levelCurrent++;
if (scriptLanguage == eScriptXML)
levelCurrent--; // no folding of the XML first tag (all XML-like tags in this case)
}
// should be better
ch = styler.SafeGetCharAt(i);
@ -665,7 +694,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
// handle the start of ASP pre-processor = Non-HTML
else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%')) {
else if (!isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) {
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
if (inScriptType == eNonHtmlScript)
@ -706,15 +735,18 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
/////////////////////////////////////
// handle the start of SGML language (DTD)
else if (((scriptLanguage == eScriptNone) || (scriptLanguage == eScriptXML)) &&
(chPrev == '<') &&
(ch == '!') &&
(StateToPrint != SCE_H_CDATA) && (!IsCommentState(StateToPrint))) {
(chPrev == '<') &&
(ch == '!') &&
(StateToPrint != SCE_H_CDATA) &&
(!IsCommentState(StateToPrint)) &&
(!IsScriptCommentState(StateToPrint)) ) {
beforePreProc = state;
styler.ColourTo(i - 2, StateToPrint);
if ((chNext == '-') && (chNext2 == '-')) {
state = SCE_H_COMMENT; // wait for a pending command
}
else if (isWordCdata(i + 1, i + 7, styler)) {
styler.ColourTo(i + 2, SCE_H_COMMENT);
i += 2; // follow styling after the --
} else if (isWordCdata(i + 1, i + 7, styler)) {
state = SCE_H_CDATA;
} else {
styler.ColourTo(i, SCE_H_SGML_DEFAULT); // <! is default
@ -733,7 +765,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|| (inScriptType == eNonHtmlScriptPreProc)) && (
((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
((scriptLanguage != eScriptNone) && !isStringState(state) &&
(ch == '%'))
((ch == '%') || (ch == '?')))
) && (chNext == '>')) ||
((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) {
if (state == SCE_H_ASPAT) {
@ -778,10 +810,11 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
inScriptType = eNonHtmlScript;
else
inScriptType = eHtml;
scriptLanguage = eScriptNone;
// unfold all scripting languages
if (foldHTMLPreprocessor)
// Unfold all scripting languages, except for XML tag
if (foldHTMLPreprocessor && (scriptLanguage != eScriptXML)) {
levelCurrent--;
}
scriptLanguage = eScriptNone;
continue;
}
/////////////////////////////////////
@ -1219,12 +1252,14 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (ch == '/' && chPrev == '*') {
styler.ColourTo(i, StateToPrint);
state = SCE_HJ_DEFAULT;
ch = ' ';
}
break;
case SCE_HJ_COMMENTLINE:
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, statePrintForState(SCE_HJ_COMMENTLINE, inScriptType));
state = SCE_HJ_DEFAULT;
ch = ' ';
}
break;
case SCE_HJ_DOUBLESTRING:
@ -1272,6 +1307,13 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
break;
case SCE_HJ_REGEX:
if (ch == '\r' || ch == '\n' || ch == '/') {
if (ch == '/') {
while (isascii(chNext) && islower(chNext)) { // gobble regex flags
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
styler.ColourTo(i, StateToPrint);
state = SCE_HJ_DEFAULT;
} else if (ch == '\\') {
@ -1496,7 +1538,10 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_HPHP_NUMBER:
if (!IsADigit(ch) && ch != '.' && ch != 'e' && ch != 'E' && (ch != '-' || (chPrev != 'e' && chPrev != 'E'))) {
// recognize bases 8,10 or 16 integers OR floating-point numbers
if (!IsADigit(ch)
&& strchr(".xXabcdefABCDEF", ch) == NULL
&& ((ch != '-' && ch != '+') || (chPrev != 'e' && chPrev != 'E'))) {
styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
if (isoperator(ch))
state = SCE_HPHP_OPERATOR;
@ -1946,6 +1991,12 @@ static void ColourisePHPDoc(unsigned int startPos, int length, int initStyle, Wo
sc.Complete();
}
static void ColourisePHPScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
if(startPos == 0) initStyle = SCE_HPHP_DEFAULT;
ColouriseHyperTextDoc(startPos,length,initStyle,keywordlists,styler);
}
static const char * const htmlWordListDesc[] = {
"HTML elements and attributes",
"JavaScript keywords",
@ -1956,7 +2007,19 @@ static const char * const htmlWordListDesc[] = {
0,
};
LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc);
LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc);
LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc);
LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc);
static const char * const phpscriptWordListDesc[] = {
"", //Unused
"", //Unused
"", //Unused
"", //Unused
"PHP keywords",
"", //Unused
0,
};
LexerModule lmHTML(SCLEX_HTML, ColouriseHyperTextDoc, "hypertext", 0, htmlWordListDesc, 7);
LexerModule lmXML(SCLEX_XML, ColouriseHyperTextDoc, "xml", 0, htmlWordListDesc, 7);
// SCLEX_ASP and SCLEX_PHP should not be used in new code: use SCLEX_HTML instead.
LexerModule lmASP(SCLEX_ASP, ColouriseASPDoc, "asp", 0, htmlWordListDesc, 7);
LexerModule lmPHP(SCLEX_PHP, ColourisePHPDoc, "php", 0, htmlWordListDesc, 7);
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 7);

View File

@ -0,0 +1,263 @@
/******************************************************************
* LexHaskell.cxx
*
* A haskell lexer for the scintilla code control.
* Some stuff "lended" from LexPython.cxx and LexCPP.cxx.
* External lexer stuff inspired from the caml external lexer.
*
* Written by Tobias Engvall - tumm at dtek dot chalmers dot se
*
*
* TODO:
* * Implement a folder :)
* * Nice Character-lexing (stuff inside '\''), LexPython has
* this.
*
*
*****************************************************************/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#ifdef BUILD_AS_EXTERNAL_LEXER
#include "ExternalLexer.h"
#include "WindowAccessor.h"
#define BUILD_EXTERNAL_LEXER 0
#endif
// Max level of nested comments
#define SCE_HA_COMMENTMAX SCE_HA_COMMENTBLOCK3
enum kwType { kwOther, kwClass, kwData, kwInstance, kwImport, kwModule, kwType};
static inline bool IsNewline(const int ch) {
return (ch == '\n' || ch == '\r');
}
static inline bool IsWhitespace(const int ch) {
return ( ch == ' '
|| ch == '\t'
|| IsNewline(ch) );
}
static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch == '\'');
}
static void ColorizeHaskellDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
int kwLast = kwOther;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
// Check for state end
// Operator
if (sc.state == SCE_HA_OPERATOR) {
kwLast = kwOther;
sc.SetState(SCE_HA_DEFAULT);
}
// String
else if (sc.state == SCE_HA_STRING) {
if (sc.ch == '\"') {
sc.ForwardSetState(SCE_HA_DEFAULT);
}
}
// Char
else if (sc.state == SCE_HA_CHARACTER) {
if (sc.ch == '\'') {
sc.ForwardSetState(SCE_HA_DEFAULT);
}
}
// Number
else if (sc.state == SCE_HA_NUMBER) {
if (!IsADigit(sc.ch)) {
sc.SetState(SCE_HA_DEFAULT);
}
}
// Types, constructors, etc.
else if (sc.state == SCE_HA_CAPITAL) {
if (!IsAWordChar(sc.ch) || sc.ch == '.') {
sc.SetState(SCE_HA_DEFAULT);
}
}
// Identifier
else if (sc.state == SCE_HA_IDENTIFIER) {
if (!IsAWordChar(sc.ch)) {
char s[100];
sc.GetCurrent(s, sizeof(s));
int style = SCE_HA_IDENTIFIER;
if ((kwLast == kwImport) || (strcmp(s,"qualified") == 0) || (strcmp(s,"as") == 0)) {
style = SCE_HA_IMPORT;
} else if (keywords.InList(s)) {
style = SCE_HA_KEYWORD;
} else if (kwLast == kwData) {
style = SCE_HA_DATA;
} else if (kwLast == kwClass) {
style = SCE_HA_CLASS;
} else if (kwLast == kwModule) {
style = SCE_HA_MODULE;
} else if (isupper(s[0])) {
style = SCE_HA_CAPITAL;
}
sc.ChangeState(style);
sc.SetState(SCE_HA_DEFAULT);
if (style == SCE_HA_KEYWORD) {
if (0 == strcmp(s, "class"))
kwLast = kwClass;
else if (0 == strcmp(s, "data"))
kwLast = kwData;
else if (0 == strcmp(s, "instance"))
kwLast = kwInstance;
else if (0 == strcmp(s, "import"))
kwLast = kwImport;
else if (0 == strcmp(s, "module"))
kwLast = kwModule;
else
kwLast = kwOther;
} else if (style == SCE_HA_CLASS || style == SCE_HA_IMPORT ||
style == SCE_HA_MODULE || style == SCE_HA_CAPITAL ||
style == SCE_HA_DATA || style == SCE_HA_INSTANCE) {
kwLast = kwOther;
}
}
}
// Comments
// Oneliner
else if (sc.state == SCE_HA_COMMENTLINE) {
if (IsNewline(sc.ch))
sc.SetState(SCE_HA_DEFAULT);
}
// Nested
else if (sc.state >= SCE_HA_COMMENTBLOCK) {
if (sc.Match("{-")) {
if (sc.state < SCE_HA_COMMENTMAX)
sc.SetState(sc.state + 1);
}
else if (sc.Match("-}")) {
sc.Forward();
if (sc.state == SCE_HA_COMMENTBLOCK)
sc.ForwardSetState(SCE_HA_DEFAULT);
else
sc.ForwardSetState(sc.state - 1);
}
}
// New state?
if (sc.state == SCE_HA_DEFAULT) {
// Digit
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_HA_NUMBER);
}
// Comment line
else if (sc.Match("--")) {
sc.SetState(SCE_HA_COMMENTLINE);
// Comment block
}
else if (sc.Match("{-")) {
sc.SetState(SCE_HA_COMMENTBLOCK);
}
// String
else if (sc.Match('\"')) {
sc.SetState(SCE_HA_STRING);
}
// Character
else if (sc.Match('\'') && IsWhitespace(sc.GetRelative(-1)) ) {
sc.SetState(SCE_HA_CHARACTER);
}
// Stringstart
else if (sc.Match('\"')) {
sc.SetState(SCE_HA_STRING);
}
// Operator
else if (isascii(sc.ch) && isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_HA_OPERATOR);
}
// Keyword
else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_HA_IDENTIFIER);
}
}
}
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 EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length, int initStyle,
char *words[], WindowID window, char *props)
{
PropSet ps;
ps.SetMultiple(props);
WindowAccessor wa(window, ps);
int nWL = 0;
for (; words[nWL]; nWL++) ;
WordList** wl = new WordList* [nWL + 1];
int i = 0;
for (; i<nWL; i++)
{
wl[i] = new WordList();
wl[i]->Set(words[i]);
}
wl[i] = 0;
ColorizeHaskellDoc(startPos, length, initStyle, wl, wa);
wa.Flush();
for (i=nWL-1;i>=0;i--)
delete wl[i];
delete [] wl;
}
void EXT_LEXER_DECL Fold (unsigned int lexer, unsigned int startPos, int length, int initStyle,
char *words[], WindowID window, char *props)
{
}
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';
}
}
#endif
LexerModule lmHaskell(SCLEX_HASKELL, ColorizeHaskellDoc, "haskell");

View File

@ -19,12 +19,16 @@
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"
#define SCE_LISP_CHARACTER 29
#define SCE_LISP_MACRO 30
#define SCE_LISP_MACRO_DISPATCH 31
static inline bool isLispoperator(char ch) {
if (isascii(ch) && isalnum(ch))
return false;
if (ch == '\'' || ch == '(' || ch == ')' )
if (ch == '\'' || ch == '`' || ch == '(' || ch == ')' )
return true;
return false;
}
@ -35,7 +39,7 @@ static inline bool isLispwordstart(char ch) {
}
static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
static void classifyWordLisp(unsigned int start, unsigned int end, WordList &keywords, WordList &keywords_kw, Accessor &styler) {
PLATFORM_ASSERT(end >= start);
char s[100];
unsigned int i;
@ -51,6 +55,11 @@ static void classifyWordLisp(unsigned int start, unsigned int end, WordList &key
else {
if (keywords.InList(s)) {
chAttr = SCE_LISP_KEYWORD;
} else if (keywords_kw.InList(s)) {
chAttr = SCE_LISP_KEYWORD_KW;
} else if ((s[0] == '*' && s[i-1] == '*') ||
(s[0] == '+' && s[i-1] == '+')) {
chAttr = SCE_LISP_SPECIAL;
}
}
styler.ColourTo(end, chAttr);
@ -62,10 +71,11 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W
Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords_kw = *keywordlists[1];
styler.StartAt(startPos);
int state = initStyle;
int state = initStyle, radix = -1;
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
styler.StartSegment(startPos);
@ -82,7 +92,11 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W
}
if (state == SCE_LISP_DEFAULT) {
if (isLispwordstart(ch)) {
if (ch == '#') {
styler.ColourTo(i - 1, state);
radix = -1;
state = SCE_LISP_MACRO_DISPATCH;
} else if (isLispwordstart(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_LISP_IDENTIFIER;
}
@ -93,27 +107,105 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W
else if (isLispoperator(ch) || ch=='\'') {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_LISP_OPERATOR);
if (ch=='\'' && isLispwordstart(chNext)) {
state = SCE_LISP_SYMBOL;
}
}
else if (ch == '\"') {
styler.ColourTo(i - 1, state);
state = SCE_LISP_STRING;
}
} else if (state == SCE_LISP_IDENTIFIER) {
} else if (state == SCE_LISP_IDENTIFIER || state == SCE_LISP_SYMBOL) {
if (!isLispwordstart(ch)) {
classifyWordLisp(styler.GetStartSegment(), i - 1, keywords, styler);
if (state == SCE_LISP_IDENTIFIER) {
classifyWordLisp(styler.GetStartSegment(), i - 1, keywords, keywords_kw, styler);
} else {
styler.ColourTo(i - 1, state);
}
state = SCE_LISP_DEFAULT;
} /*else*/
if (isLispoperator(ch) || ch=='\'') {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_LISP_OPERATOR);
if (ch=='\'' && isLispwordstart(chNext)) {
state = SCE_LISP_SYMBOL;
}
}
} else if (state == SCE_LISP_MACRO_DISPATCH) {
if (!isdigit(ch)) {
if (ch != 'r' && ch != 'R' && (i - styler.GetStartSegment()) > 1) {
state = SCE_LISP_DEFAULT;
} else {
switch (ch) {
case '|': state = SCE_LISP_MULTI_COMMENT; break;
case 'o':
case 'O': radix = 8; state = SCE_LISP_MACRO; break;
case 'x':
case 'X': radix = 16; state = SCE_LISP_MACRO; break;
case 'b':
case 'B': radix = 2; state = SCE_LISP_MACRO; break;
case '\\': state = SCE_LISP_CHARACTER; break;
case ':':
case '-':
case '+': state = SCE_LISP_MACRO; break;
case '\'': if (isLispwordstart(chNext)) {
state = SCE_LISP_SPECIAL;
} else {
styler.ColourTo(i - 1, SCE_LISP_DEFAULT);
styler.ColourTo(i, SCE_LISP_OPERATOR);
state = SCE_LISP_DEFAULT;
}
break;
default: if (isLispoperator(ch)) {
styler.ColourTo(i - 1, SCE_LISP_DEFAULT);
styler.ColourTo(i, SCE_LISP_OPERATOR);
}
state = SCE_LISP_DEFAULT;
break;
}
}
}
} else if (state == SCE_LISP_MACRO) {
if (isLispwordstart(ch) && (radix == -1 || IsADigit(ch, radix))) {
state = SCE_LISP_SPECIAL;
} else {
state = SCE_LISP_DEFAULT;
}
} else if (state == SCE_LISP_CHARACTER) {
if (isLispoperator(ch)) {
styler.ColourTo(i, SCE_LISP_SPECIAL);
state = SCE_LISP_DEFAULT;
} else if (isLispwordstart(ch)) {
styler.ColourTo(i, SCE_LISP_SPECIAL);
state = SCE_LISP_SPECIAL;
} else {
state = SCE_LISP_DEFAULT;
}
} else if (state == SCE_LISP_SPECIAL) {
if (!isLispwordstart(ch) || (radix != -1 && !IsADigit(ch, radix))) {
styler.ColourTo(i - 1, state);
state = SCE_LISP_DEFAULT;
}
if (isLispoperator(ch) || ch=='\'') {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_LISP_OPERATOR);
if (ch=='\'' && isLispwordstart(chNext)) {
state = SCE_LISP_SYMBOL;
}
}
} else {
if (state == SCE_LISP_COMMENT) {
if (atEOL) {
styler.ColourTo(i - 1, state);
state = SCE_LISP_DEFAULT;
}
} else if (state == SCE_LISP_MULTI_COMMENT) {
if (ch == '|' && chNext == '#') {
i++;
chNext = styler.SafeGetCharAt(i + 1);
styler.ColourTo(i, state);
state = SCE_LISP_DEFAULT;
}
} else if (state == SCE_LISP_STRING) {
if (ch == '\\') {
if (chNext == '\"' || chNext == '\'' || chNext == '\\') {
@ -175,6 +267,7 @@ static void FoldLispDoc(unsigned int startPos, int length, int /* initStyle */,
}
static const char * const lispWordListDesc[] = {
"Functions and special operators",
"Keywords",
0
};

View File

@ -12,7 +12,6 @@
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <fcntl.h>
#include "Platform.h"
@ -23,15 +22,18 @@
#include "Scintilla.h"
#include "SciLexer.h"
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
return ch >= 0x80 ||
(isalnum(ch) || ch == '.' || ch == '_');
}
static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
static inline bool IsAWordStart(int ch) {
return ch >= 0x80 ||
(isalpha(ch) || ch == '_');
}
static inline bool IsANumberChar(const int ch) {
static inline bool IsANumberChar(int ch) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
@ -55,6 +57,18 @@ static inline bool IsLuaOperator(int ch) {
return false;
}
// Test for [=[ ... ]=] delimiters, returns 0 if it's only a [ or ],
// return 1 for [[ or ]], returns >=2 for [=[ or ]=] and so on.
// The maximum number of '=' characters allowed is 254.
static int LongDelimCheck(StyleContext &sc) {
int sep = 1;
while (sc.GetRelative(sep) == '=' && sep < 0xFF)
sep++;
if (sc.GetRelative(sep) == sc.ch)
return sep;
return 0;
}
static void ColouriseLuaDoc(
unsigned int startPos,
int length,
@ -72,19 +86,19 @@ static void ColouriseLuaDoc(
WordList &keywords8 = *keywordlists[7];
int currentLine = styler.GetLine(startPos);
// Initialize the literal string [[ ... ]] nesting level, if we are inside such a string.
int literalStringLevel = 0;
if (initStyle == SCE_LUA_LITERALSTRING) {
literalStringLevel = styler.GetLineState(currentLine - 1);
}
// Initialize the block comment --[[ ... ]] nesting level, if we are inside such a comment
int blockCommentLevel = 0;
if (initStyle == SCE_LUA_COMMENT) {
blockCommentLevel = styler.GetLineState(currentLine - 1);
// Initialize long string [[ ... ]] or block comment --[[ ... ]] nesting level,
// if we are inside such a string. Block comment was introduced in Lua 5.0,
// blocks with separators [=[ ... ]=] in Lua 5.1.
int nestLevel = 0;
int sepCount = 0;
if (initStyle == SCE_LUA_LITERALSTRING || initStyle == SCE_LUA_COMMENT) {
int lineState = styler.GetLineState(currentLine - 1);
nestLevel = lineState >> 8;
sepCount = lineState & 0xFF;
}
// Do not leak onto next line
if (initStyle == SCE_LUA_STRINGEOL) {
if (initStyle == SCE_LUA_STRINGEOL || initStyle == SCE_LUA_COMMENTLINE || initStyle == SCE_LUA_PREPROCESSOR) {
initStyle = SCE_LUA_DEFAULT;
}
@ -99,12 +113,9 @@ static void ColouriseLuaDoc(
currentLine = styler.GetLine(sc.currentPos);
switch (sc.state) {
case SCE_LUA_LITERALSTRING:
// Inside a literal string, we set the line state
styler.SetLineState(currentLine, literalStringLevel);
break;
case SCE_LUA_COMMENT: // Block comment
// Inside a block comment, we set the line state
styler.SetLineState(currentLine, blockCommentLevel);
case SCE_LUA_COMMENT:
// Inside a literal string or block comment, we set the line state
styler.SetLineState(currentLine, (nestLevel << 8) | sepCount);
break;
default:
// Reset the line state
@ -162,13 +173,9 @@ static void ColouriseLuaDoc(
}
sc.SetState(SCE_LUA_DEFAULT);
}
} else if (sc.state == SCE_LUA_COMMENTLINE ) {
} else if (sc.state == SCE_LUA_COMMENTLINE || sc.state == SCE_LUA_PREPROCESSOR) {
if (sc.atLineEnd) {
sc.SetState(SCE_LUA_DEFAULT);
}
} else if (sc.state == SCE_LUA_PREPROCESSOR ) {
if (sc.atLineEnd) {
sc.SetState(SCE_LUA_DEFAULT);
sc.ForwardSetState(SCE_LUA_DEFAULT);
}
} else if (sc.state == SCE_LUA_STRING) {
if (sc.ch == '\\') {
@ -192,26 +199,23 @@ static void ColouriseLuaDoc(
sc.ChangeState(SCE_LUA_STRINGEOL);
sc.ForwardSetState(SCE_LUA_DEFAULT);
}
} else if (sc.state == SCE_LUA_LITERALSTRING) {
if (sc.Match('[', '[')) {
literalStringLevel++;
sc.Forward();
sc.SetState(SCE_LUA_LITERALSTRING);
} else if (sc.Match(']', ']') && literalStringLevel > 0) {
literalStringLevel--;
sc.Forward();
if (literalStringLevel == 0) {
sc.ForwardSetState(SCE_LUA_DEFAULT);
} else if (sc.state == SCE_LUA_LITERALSTRING || sc.state == SCE_LUA_COMMENT) {
if (sc.ch == '[') {
int sep = LongDelimCheck(sc);
if (sep == 1 && sepCount == 1) { // [[-only allowed to nest
nestLevel++;
sc.Forward();
}
}
} else if (sc.state == SCE_LUA_COMMENT) { // Lua 5.0's block comment
if (sc.Match('[', '[')) {
blockCommentLevel++;
sc.Forward();
} else if (sc.Match(']', ']') && blockCommentLevel > 0) {
blockCommentLevel--;
sc.Forward();
if (blockCommentLevel == 0) {
} else if (sc.ch == ']') {
int sep = LongDelimCheck(sc);
if (sep == 1 && sepCount == 1) { // un-nest with ]]-only
nestLevel--;
sc.Forward();
if (nestLevel == 0) {
sc.ForwardSetState(SCE_LUA_DEFAULT);
}
} else if (sep > 1 && sep == sepCount) { // ]=]-style delim
sc.Forward(sep);
sc.ForwardSetState(SCE_LUA_DEFAULT);
}
}
@ -223,21 +227,32 @@ static void ColouriseLuaDoc(
sc.SetState(SCE_LUA_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_LUA_IDENTIFIER);
} else if (sc.Match('\"')) {
} else if (sc.ch == '\"') {
sc.SetState(SCE_LUA_STRING);
} else if (sc.Match('\'')) {
} else if (sc.ch == '\'') {
sc.SetState(SCE_LUA_CHARACTER);
} else if (sc.Match('[', '[')) {
literalStringLevel = 1;
sc.SetState(SCE_LUA_LITERALSTRING);
sc.Forward();
} else if (sc.Match("--[[")) { // Lua 5.0's block comment
blockCommentLevel = 1;
sc.SetState(SCE_LUA_COMMENT);
sc.Forward(3);
} else if (sc.ch == '[') {
sepCount = LongDelimCheck(sc);
if (sepCount == 0) {
sc.SetState(SCE_LUA_OPERATOR);
} else {
nestLevel = 1;
sc.SetState(SCE_LUA_LITERALSTRING);
sc.Forward(sepCount);
}
} else if (sc.Match('-', '-')) {
sc.SetState(SCE_LUA_COMMENTLINE);
sc.Forward();
if (sc.Match("--[")) {
sc.Forward(2);
sepCount = LongDelimCheck(sc);
if (sepCount > 0) {
nestLevel = 1;
sc.ChangeState(SCE_LUA_COMMENT);
sc.Forward(sepCount);
}
} else {
sc.Forward();
}
} else if (sc.atLineStart && sc.Match('$')) {
sc.SetState(SCE_LUA_PREPROCESSOR); // Obsolete since Lua 4.0, but still in old code
} else if (IsLuaOperator(static_cast<char>(sc.ch))) {
@ -267,7 +282,7 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_LUA_WORD) {
if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e') {
if (ch == 'i' || ch == 'd' || ch == 'f' || ch == 'e' || ch == 'r' || ch == 'u') {
for (unsigned int j = 0; j < 8; j++) {
if (!iswordchar(styler[i + j])) {
break;
@ -276,10 +291,10 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
s[j + 1] = '\0';
}
if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0)) {
if ((strcmp(s, "if") == 0) || (strcmp(s, "do") == 0) || (strcmp(s, "function") == 0) || (strcmp(s, "repeat") == 0)) {
levelCurrent++;
}
if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0)) {
if ((strcmp(s, "end") == 0) || (strcmp(s, "elseif") == 0) || (strcmp(s, "until") == 0)) {
levelCurrent--;
}
}
@ -289,6 +304,12 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
} else if (ch == '}' || ch == ')') {
levelCurrent--;
}
} else if (style == SCE_LUA_LITERALSTRING || style == SCE_LUA_COMMENT) {
if (ch == '[') {
levelCurrent++;
} else if (ch == ']') {
levelCurrent--;
}
}
if (atEOL) {
@ -321,8 +342,10 @@ static const char * const luaWordListDesc[] = {
"Basic functions",
"String, (table) & math functions",
"(coroutines), I/O & system facilities",
"XXX",
"XXX",
"user1",
"user2",
"user3",
"user4",
0
};

View File

@ -2,7 +2,7 @@
/** @file LexMSSQL.cxx
** Lexer for MSSQL.
**/
// Copyright 1998-2002 by Filip Yaghob <fy@eg.cz>
// By Filip Yaghob <fyaghob@gmail.com>
#include <stdlib.h>
@ -27,24 +27,6 @@
#define KW_MSSQL_STORED_PROCEDURES 5
#define KW_MSSQL_OPERATORS 6
//~ val SCE_MSSQL_DEFAULT=0
//~ val SCE_MSSQL_COMMENT=1
//~ val SCE_MSSQL_LINE_COMMENT=2
//~ val SCE_MSSQL_NUMBER=3
//~ val SCE_MSSQL_STRING=4
//~ val SCE_MSSQL_OPERATOR=5
//~ val SCE_MSSQL_IDENTIFIER=6
//~ val SCE_MSSQL_VARIABLE=7
//~ val SCE_MSSQL_COLUMN_NAME=8
//~ val SCE_MSSQL_STATEMENT=9
//~ val SCE_MSSQL_DATATYPE=10
//~ val SCE_MSSQL_SYSTABLE=11
//~ val SCE_MSSQL_GLOBAL_VARIABLE=12
//~ val SCE_MSSQL_FUNCTION=13
//~ val SCE_MSSQL_STORED_PROCEDURE=14
//~ val SCE_MSSQL_DEFAULT_PREF_DATATYPE 15
//~ val SCE_MSSQL_COLUMN_NAME_2 16
static bool isMSSQLOperator(char ch) {
if (isascii(ch) && isalnum(ch))
return false;
@ -133,22 +115,7 @@ static void ColouriseMSSQLDoc(unsigned int startPos, int length,
bool fold = styler.GetPropertyInt("fold") != 0;
int lineCurrent = styler.GetLine(startPos);
int spaceFlags = 0;
/*
WordList &kwStatements = *keywordlists[KW_MSSQL_STATEMENTS];
WordList &kwDataTypes = *keywordlists[KW_MSSQL_DATA_TYPES];
WordList &kwSystemTables = *keywordlists[KW_MSSQL_SYSTEM_TABLES];
WordList &kwGlobalVariables = *keywordlists[KW_MSSQL_GLOBAL_VARIABLES];
WordList &kwFunctions = *keywordlists[KW_MSSQL_FUNCTIONS];
char s[100];
int iixx = 0;
s[0] = 's'; s[1] = 'e'; s[2] = 'l'; s[3] = 'e'; s[4] = 'c'; s[5] = 't'; s[6] = 0;
if (kwStatements.InList(s))
iixx = 1;
s[0] = 's'; s[1] = 'e'; s[2] = 'r'; s[3] = 'v'; s[4] = 'e'; s[5] = 'r'; s[6] = 'n'; s[7] = 'a'; s[8] = 'm'; s[9] = 'e'; s[10] = 0;
if (kwGlobalVariables.InList(s))
iixx += 2;
*/
int state = initStyle;
int prevState = initStyle;
char chPrev = ' ';
@ -315,6 +282,69 @@ static void ColouriseMSSQLDoc(unsigned int startPos, int length,
styler.ColourTo(lengthDoc - 1, state);
}
static void FoldMSSQLDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
bool inComment = (styler.StyleAt(startPos-1) == SCE_MSSQL_COMMENT);
char s[10];
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
// Comment folding
if (foldComment) {
if (!inComment && (style == SCE_MSSQL_COMMENT))
levelCurrent++;
else if (inComment && (style != SCE_MSSQL_COMMENT))
levelCurrent--;
inComment = (style == SCE_MSSQL_COMMENT);
}
if (style == SCE_MSSQL_STATEMENT) {
// Folding between begin and end
if (ch == 'b' || ch == 'e') {
for (unsigned int j = 0; j < 5; j++) {
if (!iswordchar(styler[i + j])) {
break;
}
s[j] = styler[i + j];
s[j + 1] = '\0';
}
if (strcmp(s, "begin") == 0) {
levelCurrent++;
}
if (strcmp(s, "end") == 0) {
levelCurrent--;
}
}
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
static const char * const sqlWordListDesc[] = {
"Statements",
"Data Types",
@ -326,4 +356,4 @@ static const char * const sqlWordListDesc[] = {
0,
};
LexerModule lmMSSQL(SCLEX_MSSQL, ColouriseMSSQLDoc, "mssql", 0, sqlWordListDesc);
LexerModule lmMSSQL(SCLEX_MSSQL, ColouriseMSSQLDoc, "mssql", FoldMSSQLDoc, sqlWordListDesc);

View File

@ -160,8 +160,8 @@ static void ColouriseMETAPOSTDoc(
int currentInterface = CheckMETAPOSTInterface(startPos,length,styler,defaultInterface) ;
// 0 no keyword highlighting
// 1 metapost keyword highlighting
// 2+ metafun keyword highlighting
// 1 metapost keyword hightlighting
// 2+ metafun keyword hightlighting
int extraInterface = 0 ;

View File

@ -2,8 +2,8 @@
/** @file LexNsis.cxx
** Lexer for NSIS
**/
// Copyright 2003, 2004 by Angelo Mandato <angelo [at] spaceblue [dot] com>
// Last Updated: 02/22/2004
// Copyright 2003 - 2005 by Angelo Mandato <angelo [at] spaceblue [dot] com>
// Last Updated: 03/13/2005
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
@ -38,6 +38,11 @@
#define SCE_NSIS_MACRODEF 12
#define SCE_NSIS_STRINGVAR 13
#define SCE_NSIS_NUMBER 14
// ADDED for Scintilla v1.63
#define SCE_NSIS_SECTIONGROUP 15
#define SCE_NSIS_PAGEEX 16
#define SCE_NSIS_FUNCTIONDEF 17
#define SCE_NSIS_COMMENTBOX 18
*/
static bool isNsisNumber(char ch)
@ -55,6 +60,40 @@ static bool isNsisLetter(char ch)
return (ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}
static bool NsisNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler)
{
int nNextLine = -1;
for( unsigned int i = start; i < end; i++ )
{
char cNext = styler.SafeGetCharAt( i );
if( cNext == '\n' )
{
nNextLine = i+1;
break;
}
}
if( nNextLine == -1 ) // We never foudn the next line...
return false;
for( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ )
{
char cNext = styler.SafeGetCharAt( firstChar );
if( cNext == ' ' )
continue;
if( cNext == '\t' )
continue;
if( cNext == '!' )
{
if( styler.Match(firstChar, "!else") )
return true;
}
break;
}
return false;
}
static int NsisCmp( char *s1, char *s2, bool bIgnoreCase )
{
if( bIgnoreCase )
@ -63,25 +102,38 @@ static int NsisCmp( char *s1, char *s2, bool bIgnoreCase )
return strcmp( s1, s2 );
}
static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel, Accessor &styler )
static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse, bool foldUtilityCmd )
{
int style = styler.StyleAt(end);
// If the word is too long, it is not what we are looking for
if( end - start > 13 )
if( end - start > 20 )
return foldlevel;
// Check the style at this point, if it is not valid, then return zero
if( styler.StyleAt(end) != SCE_NSIS_FUNCTION && styler.StyleAt(end) != SCE_NSIS_SECTIONDEF &&
styler.StyleAt(end) != SCE_NSIS_SUBSECTIONDEF && styler.StyleAt(end) != SCE_NSIS_IFDEFINEDEF &&
styler.StyleAt(end) != SCE_NSIS_MACRODEF )
return foldlevel;
if( foldUtilityCmd )
{
// Check the style at this point, if it is not valid, then return zero
if( style != SCE_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF &&
style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_IFDEFINEDEF &&
style != SCE_NSIS_MACRODEF && style != SCE_NSIS_SECTIONGROUP &&
style != SCE_NSIS_PAGEEX )
return foldlevel;
}
else
{
if( style != SCE_NSIS_FUNCTIONDEF && style != SCE_NSIS_SECTIONDEF &&
style != SCE_NSIS_SUBSECTIONDEF && style != SCE_NSIS_SECTIONGROUP &&
style != SCE_NSIS_PAGEEX )
return foldlevel;
}
int newFoldlevel = foldlevel;
bool bIgnoreCase = false;
if( styler.GetPropertyInt("nsis.ignorecase") == 1 )
bIgnoreCase = true;
char s[15]; // The key word we are looking for has atmost 13 characters
for (unsigned int i = 0; i < end - start + 1 && i < 14; i++)
char s[20]; // The key word we are looking for has atmost 13 characters
for (unsigned int i = 0; i < end - start + 1 && i < 19; i++)
{
s[i] = static_cast<char>( styler[ start + i ] );
s[i + 1] = '\0';
@ -93,15 +145,17 @@ static int calculateFoldNsis(unsigned int start, unsigned int end, int foldlevel
newFoldlevel++;
else if( NsisCmp(s, "!endif", bIgnoreCase) == 0 || NsisCmp(s, "!macroend", bIgnoreCase ) == 0 )
newFoldlevel--;
else if( bElse && NsisCmp(s, "!else", bIgnoreCase) == 0 )
newFoldlevel++;
}
else
{
if( NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "Section", bIgnoreCase ) == 0 || NsisCmp(s, "SubSection", bIgnoreCase ) == 0 )
if( NsisCmp(s, "Section", bIgnoreCase ) == 0 || NsisCmp(s, "SectionGroup", bIgnoreCase ) == 0 || NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "SubSection", bIgnoreCase ) == 0 || NsisCmp(s, "PageEx", bIgnoreCase ) == 0 )
newFoldlevel++;
else if( NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase ) == 0 )
else if( NsisCmp(s, "SectionGroupEnd", bIgnoreCase ) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase ) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase ) == 0 )
newFoldlevel--;
}
return newFoldlevel;
}
@ -138,14 +192,23 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
if( NsisCmp(s, "!ifdef", bIgnoreCase ) == 0 || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 )
return SCE_NSIS_IFDEFINEDEF;
if( NsisCmp(s, "!else", bIgnoreCase ) == 0 ) // || NsisCmp(s, "!ifndef", bIgnoreCase) == 0 || NsisCmp(s, "!endif", bIgnoreCase) == 0 )
return SCE_NSIS_IFDEFINEDEF;
if( NsisCmp(s, "SectionGroup", bIgnoreCase) == 0 || NsisCmp(s, "SectionGroupEnd", bIgnoreCase) == 0 ) // Covers SectionGroup and SectionGroupEnd
return SCE_NSIS_SECTIONGROUP;
if( NsisCmp(s, "Section", bIgnoreCase ) == 0 || NsisCmp(s, "SectionEnd", bIgnoreCase) == 0 ) // Covers Section and SectionEnd
return SCE_NSIS_SECTIONDEF;
if( NsisCmp(s, "SubSection", bIgnoreCase) == 0 || NsisCmp(s, "SubSectionEnd", bIgnoreCase) == 0 ) // Covers SubSection and SubSectionEnd
return SCE_NSIS_SUBSECTIONDEF;
if( NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 ) // Covers SubSection and SubSectionEnd
return SCE_NSIS_FUNCTION;
if( NsisCmp(s, "PageEx", bIgnoreCase) == 0 || NsisCmp(s, "PageExEnd", bIgnoreCase) == 0 ) // Covers PageEx and PageExEnd
return SCE_NSIS_PAGEEX;
if( NsisCmp(s, "Function", bIgnoreCase) == 0 || NsisCmp(s, "FunctionEnd", bIgnoreCase) == 0 ) // Covers Function and FunctionEnd
return SCE_NSIS_FUNCTIONDEF;
if ( Functions.InList(s) )
return SCE_NSIS_FUNCTION;
@ -188,9 +251,6 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
bool bHasSimpleNsisNumber = true;
for (unsigned int j = 1; j < end - start + 1 && j < 99; j++)
{
if( s[j] == '\0' || s[j] == '\r' || s[j] == '\n' )
break;
if( !isNsisNumber( s[j] ) )
{
bHasSimpleNsisNumber = false;
@ -208,6 +268,9 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
{
int state = SCE_NSIS_DEFAULT;
if( startPos > 0 )
state = styler.StyleAt(startPos-1); // Use the style from the previous line, usually default, but could be commentbox
styler.StartAt( startPos );
styler.GetLine( startPos );
@ -270,35 +333,96 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k
break;
}
if( cCurrChar == '/' && cNextChar == '*' )
{
styler.ColourTo(i-1,state);
state = SCE_NSIS_COMMENTBOX;
break;
}
break;
case SCE_NSIS_COMMENT:
if( cNextChar == '\n' || cNextChar == '\r' )
{
styler.ColourTo(i,state);
state = SCE_NSIS_DEFAULT;
// Special case:
if( cCurrChar == '\\' )
{
styler.ColourTo(i-2,state);
styler.ColourTo(i,SCE_NSIS_DEFAULT);
}
else
{
styler.ColourTo(i,state);
state = SCE_NSIS_DEFAULT;
}
}
break;
case SCE_NSIS_STRINGDQ:
if( cCurrChar == '"' || cNextChar == '\r' || cNextChar == '\n' )
case SCE_NSIS_STRINGLQ:
case SCE_NSIS_STRINGRQ:
if( styler.SafeGetCharAt(i-1) == '\\' && styler.SafeGetCharAt(i-2) == '$' )
break; // Ignore the next character, even if it is a quote of some sort
if( cCurrChar == '"' && state == SCE_NSIS_STRINGDQ )
{
styler.ColourTo(i,SCE_NSIS_STRINGDQ);
styler.ColourTo(i,state);
state = SCE_NSIS_DEFAULT;
break;
}
break;
case SCE_NSIS_STRINGLQ:
if( cCurrChar == '`' || cNextChar == '\r' || cNextChar == '\n' )
if( cCurrChar == '`' && state == SCE_NSIS_STRINGLQ )
{
styler.ColourTo(i,state);
state = SCE_NSIS_DEFAULT;
break;
}
if( cCurrChar == '\'' && state == SCE_NSIS_STRINGRQ )
{
styler.ColourTo(i,SCE_NSIS_STRINGLQ);
state = SCE_NSIS_DEFAULT;
}
break;
case SCE_NSIS_STRINGRQ:
if( cCurrChar == '\'' || cNextChar == '\r' || cNextChar == '\n' )
{
styler.ColourTo(i,SCE_NSIS_STRINGRQ);
styler.ColourTo(i,state);
state = SCE_NSIS_DEFAULT;
break;
}
if( cNextChar == '\r' || cNextChar == '\n' )
{
int nCurLine = styler.GetLine(i+1);
int nBack = i;
// We need to check if the previous line has a \ in it...
bool bNextLine = false;
while( nBack > 0 )
{
if( styler.GetLine(nBack) != nCurLine )
break;
char cTemp = styler.SafeGetCharAt(nBack, 'a'); // Letter 'a' is safe here
if( cTemp == '\\' )
{
bNextLine = true;
break;
}
if( cTemp != '\r' && cTemp != '\n' && cTemp != '\t' && cTemp != ' ' )
break;
nBack--;
}
if( bNextLine )
{
styler.ColourTo(i+1,state);
}
if( bNextLine == false )
{
styler.ColourTo(i,state);
state = SCE_NSIS_DEFAULT;
}
}
break;
case SCE_NSIS_FUNCTION:
// NSIS KeyWord:
@ -308,7 +432,7 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k
state = SCE_NSIS_DEFAULT;
else if( (isNsisChar(cCurrChar) && !isNsisChar( cNextChar) && cNextChar != '}') || cCurrChar == '}' )
{
state = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler);
state = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler );
styler.ColourTo( i, state);
state = SCE_NSIS_DEFAULT;
}
@ -343,9 +467,17 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k
}
}
break;
case SCE_NSIS_COMMENTBOX:
if( styler.SafeGetCharAt(i-1) == '*' && cCurrChar == '/' )
{
styler.ColourTo(i,state);
state = SCE_NSIS_DEFAULT;
}
break;
}
if( state == SCE_NSIS_COMMENT )
if( state == SCE_NSIS_COMMENT || state == SCE_NSIS_COMMENTBOX )
{
styler.ColourTo(i,state);
}
@ -361,10 +493,11 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k
bVarInString = false;
bIngoreNextDollarSign = true;
}
else if( bVarInString && cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' ) )
else if( bVarInString && cCurrChar == '\\' && (cNextChar == 'n' || cNextChar == 'r' || cNextChar == 't' || cNextChar == '"' || cNextChar == '`' || cNextChar == '\'' ) )
{
styler.ColourTo( i+1, SCE_NSIS_STRINGVAR);
bVarInString = false;
bIngoreNextDollarSign = true;
bIngoreNextDollarSign = false;
}
// Covers "$INSTDIR and user vars like $MYVAR"
@ -401,19 +534,7 @@ static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *k
}
// Colourise remaining document
switch( state )
{
case SCE_NSIS_COMMENT:
case SCE_NSIS_STRINGDQ:
case SCE_NSIS_STRINGLQ:
case SCE_NSIS_STRINGRQ:
case SCE_NSIS_VARIABLE:
case SCE_NSIS_STRINGVAR:
styler.ColourTo(nLengthDoc-1,state); break;
default:
styler.ColourTo(nLengthDoc-1,SCE_NSIS_DEFAULT); break;
}
styler.ColourTo(nLengthDoc-1,state);
}
static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
@ -422,6 +543,10 @@ static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Ac
if( styler.GetPropertyInt("fold") == 0 )
return;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1;
bool foldUtilityCmd = styler.GetPropertyInt("nsis.foldutilcmd", 1) == 1;
bool blockComment = false;
int lineCurrent = styler.GetLine(startPos);
unsigned int safeStartPos = styler.LineStart( lineCurrent );
@ -432,19 +557,48 @@ static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Ac
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
int levelNext = levelCurrent;
int style = styler.StyleAt(safeStartPos);
if( style == SCE_NSIS_COMMENTBOX )
{
if( styler.SafeGetCharAt(safeStartPos) == '/' && styler.SafeGetCharAt(safeStartPos+1) == '*' )
levelNext++;
blockComment = true;
}
for (unsigned int i = safeStartPos; i < startPos + length; i++)
{
char chCurr = styler.SafeGetCharAt(i);
style = styler.StyleAt(i);
if( blockComment && style != SCE_NSIS_COMMENTBOX )
{
levelNext--;
blockComment = false;
}
else if( !blockComment && style == SCE_NSIS_COMMENTBOX )
{
levelNext++;
blockComment = true;
}
if( bArg1 ) //&& chCurr != '\n' )
if( bArg1 && !blockComment)
{
if( nWordStart == -1 && (isNsisLetter(chCurr) || chCurr == '!') )
nWordStart = i;
else if( !isNsisLetter(chCurr) && nWordStart > -1 )
{
int newLevel = calculateFoldNsis( nWordStart, i-1, levelNext, styler );
if( newLevel != levelNext )
nWordStart = i;
}
else if( isNsisLetter(chCurr) == false && nWordStart > -1 )
{
int newLevel = calculateFoldNsis( nWordStart, i-1, levelNext, styler, foldAtElse, foldUtilityCmd );
if( newLevel == levelNext )
{
if( foldAtElse && foldUtilityCmd )
{
if( NsisNextLineHasElse(i, startPos + length, styler) )
levelNext--;
}
}
else
levelNext = newLevel;
bArg1 = false;
}
@ -452,10 +606,16 @@ static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Ac
if( chCurr == '\n' )
{
if( bArg1 && foldAtElse && foldUtilityCmd && !blockComment )
{
if( NsisNextLineHasElse(i, startPos + length, styler) )
levelNext--;
}
// If we are on a new line...
int levelUse = levelCurrent;
int lev = levelUse | levelNext << 16;
if (levelUse < levelNext)
if (levelUse < levelNext )
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent))
styler.SetLevel(lineCurrent, lev);
@ -484,3 +644,4 @@ static const char * const nsisWordLists[] = {
LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists);

View File

@ -30,7 +30,19 @@ static bool Is1To9(char ch) {
static inline bool AtEOL(Accessor &styler, unsigned int i) {
return (styler[i] == '\n') ||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
}
// Tests for BATCH Operators
static bool IsBOperator(char ch) {
return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') ||
(ch == '|') || (ch == '?') || (ch == '*');
}
// Tests for BATCH Separators
static bool IsBSeparator(char ch) {
return (ch == ':') || (ch == '\\') || (ch == '.') || (ch == ';') ||
(ch == '\"') || (ch == '\'') || (ch == '/') || (ch == ')');
}
static void ColouriseBatchLine(
@ -41,95 +53,391 @@ static void ColouriseBatchLine(
WordList &keywords,
Accessor &styler) {
unsigned int i = 0;
unsigned int state = SCE_BAT_DEFAULT;
unsigned int offset = 0; // Line Buffer Offset
unsigned int enVarEnd; // Environment Variable End point
unsigned int cmdLoc; // External Command / Program Location
char wordBuffer[81]; // Word Buffer - large to catch long paths
unsigned int wbl; // Word Buffer Length
unsigned int wbo; // Word Buffer Offset - also Special Keyword Buffer Length
bool forFound = false; // No Local Variable without FOR statement
// CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords
// Toggling Regular Keyword Checking off improves readability
// Other Regular Keywords and External Commands / Programs might also benefit from toggling
// Need a more robust algorithm to properly toggle Regular Keyword Checking
bool continueProcessing = true; // Used to toggle Regular Keyword Checking
// Special Keywords are those that allow certain characters without whitespace after the command
// Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path=
// Special Keyword Buffer used to determine if the first n characters is a Keyword
char sKeywordBuffer[10]; // Special Keyword Buffer
bool sKeywordFound; // Exit Special Keyword for-loop if found
while ((i < lengthLine) && isspacechar(lineBuffer[i])) { // Skip initial spaces
i++;
// Skip initial spaces
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
offset++;
}
if (lineBuffer[i] == '@') { // Hide command (ECHO OFF)
styler.ColourTo(startLine + i, SCE_BAT_HIDE);
i++;
while ((i < lengthLine) && isspacechar(lineBuffer[i])) { // Skip next spaces
i++;
}
}
if (lineBuffer[i] == ':') {
// Label
if (lineBuffer[i + 1] == ':') {
// :: is a fake label, similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
// Colorize Default Text
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
// Set External Command / Program Location
cmdLoc = offset;
// Check for Fake Label (Comment) or Real Label - return if found
if (lineBuffer[offset] == ':') {
if (lineBuffer[offset + 1] == ':') {
// Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
styler.ColourTo(endPos, SCE_BAT_COMMENT);
} else { // Real label
} else {
// Colorize Real Label
styler.ColourTo(endPos, SCE_BAT_LABEL);
}
} else {
// Check if initial word is a keyword
char wordBuffer[21];
unsigned int wbl = 0, offset = i;
// Copy word in buffer
for (; offset < lengthLine && wbl < 20 &&
return;
// Check for Drive Change (Drive Change is internal command) - return if found
} else if ((isalpha(lineBuffer[offset])) &&
(lineBuffer[offset + 1] == ':') &&
((isspacechar(lineBuffer[offset + 2])) ||
(((lineBuffer[offset + 2] == '\\')) &&
(isspacechar(lineBuffer[offset + 3]))))) {
// Colorize Regular Keyword
styler.ColourTo(endPos, SCE_BAT_WORD);
return;
}
// Check for Hide Command (@ECHO OFF/ON)
if (lineBuffer[offset] == '@') {
styler.ColourTo(startLine + offset, SCE_BAT_HIDE);
offset++;
// Check for Argument (%n) or Environment Variable (%x...%)
} else if (lineBuffer[offset] == '%') {
enVarEnd = offset + 1;
// Search end of word for second % (can be a long path)
while ((enVarEnd < lengthLine) &&
(!isspacechar(lineBuffer[enVarEnd])) &&
(lineBuffer[enVarEnd] != '%') &&
(!IsBOperator(lineBuffer[enVarEnd])) &&
(!IsBSeparator(lineBuffer[enVarEnd]))) {
enVarEnd++;
}
// Check for Argument (%n)
if ((Is0To9(lineBuffer[offset + 1])) &&
(lineBuffer[enVarEnd] != '%')) {
// Colorize Argument
styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
offset += 2;
// Check for External Command / Program
if (!isspacechar(lineBuffer[offset])) {
cmdLoc = offset;
}
// Check for Environment Variable (%x...%)
} else if ((lineBuffer[offset + 1] != '%') &&
(lineBuffer[enVarEnd] == '%')) {
offset = enVarEnd;
// Colorize Environment Variable
styler.ColourTo(startLine + offset, SCE_BAT_IDENTIFIER);
offset++;
// Check for External Command / Program
if (!isspacechar(lineBuffer[offset])) {
cmdLoc = offset;
}
}
}
// Skip next spaces
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
offset++;
}
// Read remainder of line word-at-a-time or remainder-of-word-at-a-time
while (offset < lengthLine) {
if (offset > startLine) {
// Colorize Default Text
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
// Copy word from Line Buffer into Word Buffer
wbl = 0;
for (; offset < lengthLine && wbl < 80 &&
!isspacechar(lineBuffer[offset]); wbl++, offset++) {
wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset]));
}
wordBuffer[wbl] = '\0';
// Check if it is a comment
wbo = 0;
// Check for Comment - return if found
if (CompareCaseInsensitive(wordBuffer, "rem") == 0) {
styler.ColourTo(endPos, SCE_BAT_COMMENT);
return ;
return;
}
// Check if it is in the list
if (keywords.InList(wordBuffer)) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD); // Regular keyword
} else {
// Search end of word (can be a long path)
while (offset < lengthLine &&
!isspacechar(lineBuffer[offset])) {
offset++;
// Check for Separator
if (IsBSeparator(wordBuffer[0])) {
// Check for External Command / Program
if ((cmdLoc == offset - wbl) &&
((wordBuffer[0] == ':') ||
(wordBuffer[0] == '\\') ||
(wordBuffer[0] == '.'))) {
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Colorize External Command / Program
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
// Reset External Command / Program Location
cmdLoc = offset;
} else {
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Colorize Default Text
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND); // External command / program
}
// Remainder of the line: colourise the variables.
while (offset < lengthLine) {
if (state == SCE_BAT_DEFAULT && lineBuffer[offset] == '%') {
styler.ColourTo(startLine + offset - 1, state);
if (Is0To9(lineBuffer[offset + 1])) {
styler.ColourTo(startLine + offset + 1, SCE_BAT_IDENTIFIER);
offset += 2;
} else if (lineBuffer[offset + 1] == '%' &&
!isspacechar(lineBuffer[offset + 2])) {
// Should be safe, as there is CRLF at the end of the line...
styler.ColourTo(startLine + offset + 2, SCE_BAT_IDENTIFIER);
offset += 3;
} else {
state = SCE_BAT_IDENTIFIER;
// Check for Regular Keyword in list
} else if ((keywords.InList(wordBuffer)) &&
(continueProcessing)) {
// Local Variables do not exist if no FOR statement
if (CompareCaseInsensitive(wordBuffer, "for") == 0) {
forFound = true;
}
// ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking
if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) ||
(CompareCaseInsensitive(wordBuffer, "goto") == 0) ||
(CompareCaseInsensitive(wordBuffer, "prompt") == 0) ||
(CompareCaseInsensitive(wordBuffer, "set") == 0)) {
continueProcessing = false;
}
// Identify External Command / Program Location for ERRORLEVEL, and EXIST
if ((CompareCaseInsensitive(wordBuffer, "errorlevel") == 0) ||
(CompareCaseInsensitive(wordBuffer, "exist") == 0)) {
// Reset External Command / Program Location
cmdLoc = offset;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Skip comparison
while ((cmdLoc < lengthLine) &&
(!isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Identify External Command / Program Location for CALL, DO, LOADHIGH and LH
} else if ((CompareCaseInsensitive(wordBuffer, "call") == 0) ||
(CompareCaseInsensitive(wordBuffer, "do") == 0) ||
(CompareCaseInsensitive(wordBuffer, "loadhigh") == 0) ||
(CompareCaseInsensitive(wordBuffer, "lh") == 0)) {
// Reset External Command / Program Location
cmdLoc = offset;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
} else if (state == SCE_BAT_IDENTIFIER && lineBuffer[offset] == '%') {
styler.ColourTo(startLine + offset, state);
state = SCE_BAT_DEFAULT;
} else if (state == SCE_BAT_DEFAULT &&
(lineBuffer[offset] == '*' ||
lineBuffer[offset] == '?' ||
lineBuffer[offset] == '=' ||
lineBuffer[offset] == '<' ||
lineBuffer[offset] == '>' ||
lineBuffer[offset] == '|')) {
styler.ColourTo(startLine + offset - 1, state);
styler.ColourTo(startLine + offset, SCE_BAT_OPERATOR);
}
// Colorize Regular keyword
styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD);
// No need to Reset Offset
// Check for Special Keyword in list, External Command / Program, or Default Text
} else if ((wordBuffer[0] != '%') &&
(!IsBOperator(wordBuffer[0])) &&
(continueProcessing)) {
// Check for Special Keyword
// Affected Commands are in Length range 2-6
// Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected
sKeywordFound = false;
for (unsigned int keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) {
wbo = 0;
// Copy Keyword Length from Word Buffer into Special Keyword Buffer
for (; wbo < keywordLength; wbo++) {
sKeywordBuffer[wbo] = static_cast<char>(wordBuffer[wbo]);
}
sKeywordBuffer[wbo] = '\0';
// Check for Special Keyword in list
if ((keywords.InList(sKeywordBuffer)) &&
((IsBOperator(wordBuffer[wbo])) ||
(IsBSeparator(wordBuffer[wbo])))) {
sKeywordFound = true;
// ECHO requires no further Regular Keyword Checking
if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) {
continueProcessing = false;
}
// Colorize Special Keyword as Regular Keyword
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
}
}
// Check for External Command / Program or Default Text
if (!sKeywordFound) {
wbo = 0;
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
// Read up to %, Operator or Separator
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
// Reset External Command / Program Location
cmdLoc = offset - (wbl - wbo);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
// CHOICE requires no further Regular Keyword Checking
if (CompareCaseInsensitive(wordBuffer, "choice") == 0) {
continueProcessing = false;
}
// Check for START (and its switches) - What follows is External Command \ Program
if (CompareCaseInsensitive(wordBuffer, "start") == 0) {
// Reset External Command / Program Location
cmdLoc = offset;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Reset External Command / Program Location if command switch detected
if (lineBuffer[cmdLoc] == '/') {
// Skip command switch
while ((cmdLoc < lengthLine) &&
(!isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
}
}
// Colorize External command / program
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
// No need to Reset Offset
// Check for Default Text
} else {
// Read up to %, Operator or Separator
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
// Colorize Default Text
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
}
}
// Check for Argument (%n), Environment Variable (%x...%) or Local Variable (%%a)
} else if (wordBuffer[0] == '%') {
// Colorize Default Text
styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
wbo++;
// Search to end of word for second % (can be a long path)
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
// Check for Argument (%n)
if ((Is0To9(wordBuffer[1])) &&
(wordBuffer[wbo] != '%')) {
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
cmdLoc = offset - (wbl - 2);
}
// Colorize Argument
styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER);
// Reset Offset to re-process remainder of word
offset -= (wbl - 2);
// Check for Environment Variable (%x...%)
} else if ((wordBuffer[1] != '%') &&
(wordBuffer[wbo] == '%')) {
wbo++;
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
cmdLoc = offset - (wbl - wbo);
}
// Colorize Environment Variable
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
// Check for Local Variable (%%a)
} else if ((forFound) &&
(wordBuffer[1] == '%') &&
(wordBuffer[2] != '%') &&
(!IsBOperator(wordBuffer[2])) &&
(!IsBSeparator(wordBuffer[2]))) {
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
cmdLoc = offset - (wbl - 3);
}
// Colorize Local Variable
styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER);
// Reset Offset to re-process remainder of word
offset -= (wbl - 3);
}
// Check for Operator
} else if (IsBOperator(wordBuffer[0])) {
// Colorize Default Text
styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
// Check for Comparison Operator
if ((wordBuffer[0] == '=') && (wordBuffer[1] == '=')) {
// Identify External Command / Program Location for IF
cmdLoc = offset;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Colorize Comparison Operator
styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_OPERATOR);
// Reset Offset to re-process remainder of word
offset -= (wbl - 2);
// Check for Pipe Operator
} else if (wordBuffer[0] == '|') {
// Reset External Command / Program Location
cmdLoc = offset - wbl + 1;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Colorize Pipe Operator
styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR);
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Check for Other Operator
} else {
// Check for > Operator
if (wordBuffer[0] == '>') {
// Turn Keyword and External Command / Program checking back on
continueProcessing = true;
}
// Colorize Other Operator
styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR);
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
}
// Check for Default Text
} else {
// Read up to %, Operator or Separator
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
// Colorize Default Text
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
}
// Skip next spaces - nothing happens if Offset was Reset
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
offset++;
}
// if (endPos > startLine + offset - 1) {
styler.ColourTo(endPos, SCE_BAT_DEFAULT); // Remainder of line, currently not lexed
// }
}
// Colorize Default Text for remainder of line - currently not lexed
styler.ColourTo(endPos, SCE_BAT_DEFAULT);
}
// ToDo: (not necessarily at beginning of line) GOTO, [IF] NOT, ERRORLEVEL
// IF [NO] (test) (command) -- test is EXIST (filename) | (string1)==(string2) | ERRORLEVEL (number)
// FOR %%(variable) IN (set) DO (command) -- variable is [a-zA-Z] -- eg for %%X in (*.txt) do type %%X
// ToDo: %n (parameters), %EnvironmentVariable% colourising
// ToDo: Colourise = > >> < | "
static void ColouriseBatchDoc(
unsigned int startPos,
@ -240,7 +548,7 @@ static void FoldDiffDoc(unsigned int startPos, int length, int, WordList*[], Acc
int nextLevel = prevLevel;
if (prevLevel & SC_FOLDLEVELHEADERFLAG)
nextLevel = (prevLevel & SC_FOLDLEVELNUMBERMASK) + 1;
int lineType = styler.StyleAt(curLineStart);
if (lineType == SCE_DIFF_COMMAND)
nextLevel = (SC_FOLDLEVELBASE + 1) | SC_FOLDLEVELHEADERFLAG;
@ -248,13 +556,13 @@ static void FoldDiffDoc(unsigned int startPos, int length, int, WordList*[], Acc
nextLevel = (SC_FOLDLEVELBASE + 2) | SC_FOLDLEVELHEADERFLAG;
} else if (lineType == SCE_DIFF_POSITION)
nextLevel = (SC_FOLDLEVELBASE + 3) | SC_FOLDLEVELHEADERFLAG;
if ((nextLevel & SC_FOLDLEVELHEADERFLAG) && (nextLevel == prevLevel))
styler.SetLevel(curLine-1, prevLevel & ~SC_FOLDLEVELHEADERFLAG);
styler.SetLevel(curLine, nextLevel);
prevLevel = nextLevel;
curLineStart = styler.LineStart(++curLine);
} while (static_cast<int>(startPos) + length > curLineStart);
}
@ -372,7 +680,7 @@ static void FoldPropsDoc(unsigned int startPos, int length, int, WordList *[], A
lineCurrent++;
visibleChars = 0;
headerPoint=false;
headerPoint = false;
}
if (!isspacechar(ch))
visibleChars++;
@ -475,172 +783,207 @@ static void ColouriseMakeDoc(unsigned int startPos, int length, int, WordList *[
}
}
static bool strstart(char *haystack, char *needle) {
static bool strstart(const char *haystack, const char *needle) {
return strncmp(haystack, needle, strlen(needle)) == 0;
}
static void ColouriseErrorListLine(
char *lineBuffer,
unsigned int lengthLine,
// unsigned int startLine,
unsigned int endPos,
Accessor &styler) {
const int unRecognized = 99;
static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLine) {
if (lineBuffer[0] == '>') {
// Command or return status
styler.ColourTo(endPos, SCE_ERR_CMD);
return SCE_ERR_CMD;
} else if (lineBuffer[0] == '<') {
// Diff removal, but not interested. Trapped to avoid hitting CTAG cases.
styler.ColourTo(endPos, SCE_ERR_DEFAULT);
return SCE_ERR_DEFAULT;
} else if (lineBuffer[0] == '!') {
styler.ColourTo(endPos, SCE_ERR_DIFF_CHANGED);
return SCE_ERR_DIFF_CHANGED;
} else if (lineBuffer[0] == '+') {
styler.ColourTo(endPos, SCE_ERR_DIFF_ADDITION);
} else if (lineBuffer[0] == '-' && lineBuffer[1] == '-' && lineBuffer[2] == '-') {
styler.ColourTo(endPos, SCE_ERR_DIFF_MESSAGE);
if (strstart(lineBuffer, "+++ ")) {
return SCE_ERR_DIFF_MESSAGE;
} else {
return SCE_ERR_DIFF_ADDITION;
}
} else if (lineBuffer[0] == '-') {
styler.ColourTo(endPos, SCE_ERR_DIFF_DELETION);
if (strstart(lineBuffer, "--- ")) {
return SCE_ERR_DIFF_MESSAGE;
} else {
return SCE_ERR_DIFF_DELETION;
}
} else if (strstart(lineBuffer, "cf90-")) {
// Absoft Pro Fortran 90/95 v8.2 error and/or warning message
styler.ColourTo(endPos, SCE_ERR_ABSF);
return SCE_ERR_ABSF;
} else if (strstart(lineBuffer, "fortcom:")) {
// Intel Fortran Compiler v8.0 error/warning message
styler.ColourTo(endPos, SCE_ERR_IFORT);
return SCE_ERR_IFORT;
} else if (strstr(lineBuffer, "File \"") && strstr(lineBuffer, ", line ")) {
styler.ColourTo(endPos, SCE_ERR_PYTHON);
return SCE_ERR_PYTHON;
} else if (strstr(lineBuffer, " in ") && strstr(lineBuffer, " on line ")) {
styler.ColourTo(endPos, SCE_ERR_PHP);
return SCE_ERR_PHP;
} else if ((strstart(lineBuffer, "Error ") ||
strstart(lineBuffer, "Warning ")) &&
strstr(lineBuffer, " at (") &&
strstr(lineBuffer, ") : ") &&
(strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) {
strstart(lineBuffer, "Warning ")) &&
strstr(lineBuffer, " at (") &&
strstr(lineBuffer, ") : ") &&
(strstr(lineBuffer, " at (") < strstr(lineBuffer, ") : "))) {
// Intel Fortran Compiler error/warning message
styler.ColourTo(endPos, SCE_ERR_IFC);
return SCE_ERR_IFC;
} else if (strstart(lineBuffer, "Error ")) {
// Borland error message
styler.ColourTo(endPos, SCE_ERR_BORLAND);
return SCE_ERR_BORLAND;
} else if (strstart(lineBuffer, "Warning ")) {
// Borland warning message
styler.ColourTo(endPos, SCE_ERR_BORLAND);
return SCE_ERR_BORLAND;
} else if (strstr(lineBuffer, "at line " ) &&
(strstr(lineBuffer, "at line " ) < (lineBuffer + lengthLine)) &&
strstr(lineBuffer, "file ") &&
(strstr(lineBuffer, "file ") < (lineBuffer + lengthLine))) {
// Lua 4 error message
styler.ColourTo(endPos, SCE_ERR_LUA);
return SCE_ERR_LUA;
} else if (strstr(lineBuffer, " at " ) &&
(strstr(lineBuffer, " at " ) < (lineBuffer + lengthLine)) &&
strstr(lineBuffer, " line ") &&
(strstr(lineBuffer, " line ") < (lineBuffer + lengthLine)) &&
(strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) {
(strstr(lineBuffer, " at " ) < (strstr(lineBuffer, " line ")))) {
// perl error message
styler.ColourTo(endPos, SCE_ERR_PERL);
return SCE_ERR_PERL;
} else if ((memcmp(lineBuffer, " at ", 6) == 0) &&
strstr(lineBuffer, ":line ")) {
strstr(lineBuffer, ":line ")) {
// A .NET traceback
styler.ColourTo(endPos, SCE_ERR_NET);
return SCE_ERR_NET;
} else if (strstart(lineBuffer, "Line ") &&
strstr(lineBuffer, ", file ")) {
strstr(lineBuffer, ", file ")) {
// Essential Lahey Fortran error message
styler.ColourTo(endPos, SCE_ERR_ELF);
return SCE_ERR_ELF;
} else if (strstart(lineBuffer, "line ") &&
strstr(lineBuffer, " column ")) {
strstr(lineBuffer, " column ")) {
// HTML tidy style: line 42 column 1
styler.ColourTo(endPos, SCE_ERR_TIDY);
return SCE_ERR_TIDY;
} else if (strstart(lineBuffer, "\tat ") &&
strstr(lineBuffer, "(") &&
strstr(lineBuffer, ".java:")) {
strstr(lineBuffer, "(") &&
strstr(lineBuffer, ".java:")) {
// Java stack back trace
styler.ColourTo(endPos, SCE_ERR_JAVA_STACK);
return SCE_ERR_JAVA_STACK;
} else {
// Look for GCC <filename>:<line>:message
// Look for Microsoft <filename>(line) :message
// Look for Microsoft <filename>(line,pos)message
// Look for CTags \tmessage
// Look for Lua 5 traceback \t<filename>:<line>:message
// Look for one of the following formats:
// GCC: <filename>:<line>:<message>
// Microsoft: <filename>(<line>) :<message>
// Common: <filename>(<line>): warning|error|note|remark|catastrophic|fatal
// Common: <filename>(<line>) warning|error|note|remark|catastrophic|fatal
// Microsoft: <filename>(<line>,<column>)<message>
// CTags: \t<message>
// Lua 5 traceback: \t<filename>:<line>:<message>
bool initialTab = (lineBuffer[0] == '\t');
int state = 0;
enum { stInitial,
stGccStart, stGccDigit, stGcc,
stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
stCtagsStart, stCtagsStartString, stCtagsStringDollar, stCtags,
stUnrecognized
} state = stInitial;
for (unsigned int i = 0; i < lengthLine; i++) {
char ch = lineBuffer[i];
char chNext = ' ';
if ((i+1) < lengthLine)
chNext = lineBuffer[i+1];
if (state == 0) {
if ((i + 1) < lengthLine)
chNext = lineBuffer[i + 1];
if (state == stInitial) {
if (ch == ':') {
// May be GCC, or might be Lua 5 (Lua traceback same but with tab prefix)
if ((chNext != '\\') && (chNext != '/')) {
// This check is not completely accurate as may be on
// GTK+ with a file name that includes ':'.
state = 1;
state = stGccStart;
}
} else if ((ch == '(') && Is1To9(chNext) && (!initialTab)) {
// May be Microsoft
// Check against '0' often removes phone numbers
state = 10;
state = stMsStart;
} else if ((ch == '\t') && (!initialTab)) {
// May be CTags
state = 20;
state = stCtagsStart;
}
} else if (state == 1) {
state = Is1To9(ch) ? 2 : unRecognized;
} else if (state == 2) {
} else if (state == stGccStart) { // <filename>:
state = Is1To9(ch) ? stGccDigit : stUnrecognized;
} else if (state == stGccDigit) { // <filename>:<line>
if (ch == ':') {
state = 3; // :9.*: is GCC
state = stGcc; // :9.*: is GCC
break;
} else if (!Is0To9(ch)) {
state = unRecognized;
state = stUnrecognized;
}
} else if (state == 10) {
state = Is0To9(ch) ? 11 : unRecognized;
} else if (state == 11) {
} else if (state == stMsStart) { // <filename>(
state = Is0To9(ch) ? stMsDigit : stUnrecognized;
} else if (state == stMsDigit) { // <filename>(<line>
if (ch == ',') {
state = 14;
state = stMsDigitComma;
} else if (ch == ')') {
state = 12;
state = stMsBracket;
} else if ((ch != ' ') && !Is0To9(ch)) {
state = unRecognized;
state = stUnrecognized;
}
} else if (state == 12) {
} else if (state == stMsBracket) { // <filename>(<line>)
if ((ch == ' ') && (chNext == ':')) {
state = 13;
state = stMsVc;
} else if ((ch == ':' && chNext == ' ') || (ch == ' ')) {
// Possibly Delphi.. don't test against chNext as it's one of the strings below.
char word[512];
unsigned int j, chPos;
unsigned numstep;
chPos = 0;
if (ch == ' ')
numstep = 1; // ch was ' ', handle as if it's a delphi errorline, only add 1 to i.
else
numstep = 2; // otherwise add 2.
for (j = i + numstep; j < lengthLine && isalpha(lineBuffer[j]) && chPos < sizeof(word) - 1; j++)
word[chPos++] = lineBuffer[j];
word[chPos] = 0;
if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") ||
!CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") ||
!CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {
state = stMsVc;
} else
state = stUnrecognized;
} else {
state = unRecognized;
state = stUnrecognized;
}
} else if (state == 14) {
} else if (state == stMsDigitComma) { // <filename>(<line>,
if (ch == ')') {
state = 15;
state = stMsDotNet;
break;
} else if ((ch != ' ') && !Is0To9(ch)) {
state = unRecognized;
state = stUnrecognized;
}
} else if (state == 20) {
if ((lineBuffer[i-1] == '\t') &&
((ch == '/' && lineBuffer[i+1] == '^') || Is0To9(ch))) {
state = 24;
} else if (state == stCtagsStart) {
if ((lineBuffer[i - 1] == '\t') &&
((ch == '/' && lineBuffer[i + 1] == '^') || Is0To9(ch))) {
state = stCtags;
break;
} else if ((ch == '/') && (lineBuffer[i+1] == '^')) {
state = 21;
} else if ((ch == '/') && (lineBuffer[i + 1] == '^')) {
state = stCtagsStartString;
}
} else if ((state == 21) && ((lineBuffer[i] == '$') && (lineBuffer[i+1] == '/'))) {
state = 22;
} else if ((state == stCtagsStartString) && ((lineBuffer[i] == '$') && (lineBuffer[i + 1] == '/'))) {
state = stCtagsStringDollar;
break;
}
}
if (state == 3) {
styler.ColourTo(endPos, SCE_ERR_GCC);
} else if ((state == 13) || (state == 14) || (state == 15)) {
styler.ColourTo(endPos, SCE_ERR_MS);
} else if ((state == 22) || (state == 24)) {
styler.ColourTo(endPos, SCE_ERR_CTAG);
if (state == stGcc) {
return SCE_ERR_GCC;
} else if ((state == stMsVc) || (state == stMsDotNet)) {
return SCE_ERR_MS;
} else if ((state == stCtagsStringDollar) || (state == stCtags)) {
return SCE_ERR_CTAG;
} else {
styler.ColourTo(endPos, SCE_ERR_DEFAULT);
return SCE_ERR_DEFAULT;
}
}
}
static void ColouriseErrorListLine(
char *lineBuffer,
unsigned int lengthLine,
unsigned int endPos,
Accessor &styler) {
styler.ColourTo(endPos, RecogniseErrorListLine(lineBuffer, lengthLine));
}
static void ColouriseErrorListDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
char lineBuffer[1024];
char lineBuffer[10000];
styler.StartAt(startPos);
styler.StartSegment(startPos);
unsigned int linePos = 0;

View File

@ -3,7 +3,7 @@
** Lexer for POV-Ray SDL (Persistance of Vision Raytracer, Scene Description Language).
** Written by Philippe Lhoste but this is mostly a derivative of LexCPP...
**/
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Some points that distinguish from a simple C lexer:
@ -29,15 +29,15 @@
#include "Scintilla.h"
#include "SciLexer.h"
static inline bool IsAWordChar(const int ch) {
static inline bool IsAWordChar(int ch) {
return ch < 0x80 && (isalnum(ch) || ch == '_');
}
static inline bool IsAWordStart(const int ch) {
static inline bool IsAWordStart(int ch) {
return ch < 0x80 && isalpha(ch);
}
static inline bool IsANumberChar(const int ch) {
static inline bool IsANumberChar(int ch) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
@ -69,13 +69,14 @@ static void ColourisePovDoc(
}
// Do not leak onto next line
if (initStyle == SCE_POV_STRINGEOL) {
if (initStyle == SCE_POV_STRINGEOL || initStyle == SCE_POV_COMMENTLINE) {
initStyle = SCE_POV_DEFAULT;
}
StyleContext sc(startPos, length, initStyle, styler);
short stringLen = 0;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
if (sc.atLineEnd) {
// Update the line state, so it can be seen by next line
@ -125,7 +126,8 @@ static void ColourisePovDoc(
}
} else if (sc.state == SCE_POV_DIRECTIVE) {
if (!IsAWordChar(sc.ch)) {
char s[100], *p;
char s[100];
char *p;
sc.GetCurrent(s, sizeof(s));
p = s;
// Skip # and whitespace between # and directive word
@ -150,7 +152,7 @@ static void ColourisePovDoc(
}
} else if (sc.state == SCE_POV_COMMENTLINE) {
if (sc.atLineEnd) {
sc.SetState(SCE_POV_DEFAULT);
sc.ForwardSetState(SCE_POV_DEFAULT);
}
} else if (sc.state == SCE_POV_STRING) {
if (sc.ch == '\\') {

View File

@ -11,7 +11,6 @@
#include <ctype.h>
#include <stdarg.h>
#include <stdio.h>
#include <fcntl.h>
#include "Platform.h"

View File

@ -2,8 +2,8 @@
/** @file LexPerl.cxx
** Lexer for subset of Perl.
**/
// Lexical analysis fixes by Kein-Hong Man <mkh@pl.jaring.my> 2003-2004
// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// Lexical analysis fixes by Kein-Hong Man <mkh@pl.jaring.my>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
@ -20,11 +20,18 @@
#include "Scintilla.h"
#include "SciLexer.h"
#define PERLNUM_DECIMAL 1
#define PERLNUM_NON_DEC 2
#define PERLNUM_FLOAT 3
#define PERLNUM_VECTOR 4
#define PERLNUM_V_VECTOR 5
#define PERLNUM_BINARY 1 // order is significant: 1-4 cannot have a dot
#define PERLNUM_HEX 2
#define PERLNUM_OCTAL 3
#define PERLNUM_FLOAT 4 // actually exponent part
#define PERLNUM_DECIMAL 5 // 1-5 are numbers; 6-7 are strings
#define PERLNUM_VECTOR 6
#define PERLNUM_V_VECTOR 7
#define PERLNUM_BAD 8
#define BACK_NONE 0 // lookback state for bareword disambiguation:
#define BACK_OPERATOR 1 // whitespace/comments are insignificant
#define BACK_KEYWORD 2 // operators/keywords are needed for disambiguation
#define HERE_DELIM_MAX 256
@ -44,7 +51,7 @@ static inline bool isPerlOperator(char ch) {
ch == '(' || ch == ')' || ch == '-' || ch == '+' ||
ch == '=' || ch == '|' || ch == '{' || ch == '}' ||
ch == '[' || ch == ']' || ch == ':' || ch == ';' ||
ch == '>' || ch == ',' ||
ch == '>' || ch == ',' ||
ch == '?' || ch == '!' || ch == '.' || ch == '~')
return true;
// these chars are already tested before this call
@ -52,17 +59,13 @@ static inline bool isPerlOperator(char ch) {
return false;
}
static int classifyWordPerl(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
static bool isPerlKeyword(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char s[100];
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = styler[start + i];
s[i + 1] = '\0';
}
char chAttr = SCE_PL_IDENTIFIER;
if (keywords.InList(s))
chAttr = SCE_PL_WORD;
styler.ColourTo(end, chAttr);
return chAttr;
unsigned int i, len = end - start;
if (len > 30) { len = 30; }
for (i = 0; i < len; i++, start++) s[i] = styler[start];
s[i] = '\0';
return keywords.InList(s);
}
static inline bool isEndVar(char ch) {
@ -76,16 +79,12 @@ static inline bool isNonQuote(char ch) {
}
static inline char actualNumStyle(int numberStyle) {
switch (numberStyle) {
case PERLNUM_VECTOR:
case PERLNUM_V_VECTOR:
return SCE_PL_STRING;
case PERLNUM_DECIMAL:
case PERLNUM_NON_DEC:
case PERLNUM_FLOAT:
default:
return SCE_PL_NUMBER;
}
if (numberStyle == PERLNUM_VECTOR || numberStyle == PERLNUM_V_VECTOR) {
return SCE_PL_STRING;
} else if (numberStyle == PERLNUM_BAD) {
return SCE_PL_ERROR;
}
return SCE_PL_NUMBER;
}
static bool isMatch(Accessor &styler, int lengthDoc, int pos, const char *val) {
@ -133,6 +132,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf
HereDocCls() {
State = 0;
Quote = 0;
Quoted = false;
DelimiterLength = 0;
Delimiter = new char[HERE_DELIM_MAX];
Delimiter[0] = '\0';
@ -196,6 +197,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|| state == SCE_PL_CHARACTER
|| state == SCE_PL_NUMBER
|| state == SCE_PL_IDENTIFIER
|| state == SCE_PL_ERROR
) {
while ((startPos > 1) && (styler.StyleAt(startPos - 1) == state)) {
startPos--;
@ -203,6 +205,22 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
state = SCE_PL_DEFAULT;
}
// lookback at start of lexing to set proper state for backflag
// after this, they are updated when elements are lexed
int backflag = BACK_NONE;
unsigned int backPos = startPos;
if (backPos > 0) {
backPos--;
int sty = SCE_PL_DEFAULT;
while ((backPos > 0) && (sty = styler.StyleAt(backPos),
sty == SCE_PL_DEFAULT || sty == SCE_PL_COMMENTLINE))
backPos--;
if (sty == SCE_PL_OPERATOR)
backflag = BACK_OPERATOR;
else if (sty == SCE_PL_WORD)
backflag = BACK_KEYWORD;
}
styler.StartAt(startPos);
char chPrev = styler.SafeGetCharAt(startPos - 1);
if (startPos == 0)
@ -269,25 +287,34 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
if (isdigit(ch) || (isdigit(chNext) &&
(ch == '.' || ch == 'v'))) {
state = SCE_PL_NUMBER;
backflag = BACK_NONE;
numState = PERLNUM_DECIMAL;
dotCount = 0;
if (ch == '0') { // hex,bin,octal
if (chNext == 'x' || chNext == 'b' || isdigit(chNext)) {
numState = PERLNUM_NON_DEC;
}
if (chNext == 'x') {
numState = PERLNUM_HEX;
} else if (chNext == 'b') {
numState = PERLNUM_BINARY;
} else if (isdigit(chNext)) {
numState = PERLNUM_OCTAL;
}
if (numState != PERLNUM_DECIMAL) {
i++;
ch = chNext;
chNext = chNext2;
}
} else if (ch == 'v') { // vector
numState = PERLNUM_V_VECTOR;
}
} else if (iswordstart(ch)) {
if (chPrev == '>' && styler.SafeGetCharAt(i - 2) == '-') {
state = SCE_PL_IDENTIFIER; // part of "->" expr
if ((!iswordchar(chNext) && chNext != '\'')
|| (chNext == '.' && chNext2 == '.')) {
// We need that if length of word == 1!
styler.ColourTo(i, SCE_PL_IDENTIFIER);
state = SCE_PL_DEFAULT;
}
} else if (ch == 's' && !isNonQuote(chNext)) {
// if immediately prefixed by '::', always a bareword
state = SCE_PL_WORD;
if (chPrev == ':' && styler.SafeGetCharAt(i - 2) == ':') {
state = SCE_PL_IDENTIFIER;
}
unsigned int kw = i + 1;
// first check for possible quote-like delimiter
if (ch == 's' && !isNonQuote(chNext)) {
state = SCE_PL_REGSUBST;
Quote.New(2);
} else if (ch == 'm' && !isNonQuote(chNext)) {
@ -302,36 +329,119 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
} else if (ch == 't' && chNext == 'r' && !isNonQuote(chNext2)) {
state = SCE_PL_REGSUBST;
Quote.New(2);
i++;
chNext = chNext2;
kw++;
} else if (ch == 'q' && (chNext == 'q' || chNext == 'r' || chNext == 'w' || chNext == 'x') && !isNonQuote(chNext2)) {
if (chNext == 'q') state = SCE_PL_STRING_QQ;
else if (chNext == 'x') state = SCE_PL_STRING_QX;
else if (chNext == 'r') state = SCE_PL_STRING_QR;
else if (chNext == 'w') state = SCE_PL_STRING_QW;
i++;
chNext = chNext2;
Quote.New(1);
kw++;
} else if (ch == 'x' && (chNext == '=' || // repetition
(chNext != '_' && !isalnum(chNext)) ||
(isdigit(chPrev) && isdigit(chNext)))) {
styler.ColourTo(i, SCE_PL_OPERATOR);
} else {
state = SCE_PL_WORD;
if ((!iswordchar(chNext) && chNext != '\'')
|| (chNext == '.' && chNext2 == '.')) {
// We need that if length of word == 1!
// This test is copied from the SCE_PL_WORD handler.
classifyWordPerl(styler.GetStartSegment(), i, keywords, styler);
state = SCE_PL_DEFAULT;
}
}
(chNext != '_' && !isalnum(chNext)) ||
(isdigit(chPrev) && isdigit(chNext)))) {
state = SCE_PL_OPERATOR;
}
// if potentially a keyword, scan forward and grab word, then check
// if it's really one; if yes, disambiguation test is performed
// otherwise it is always a bareword and we skip a lot of scanning
// note: keywords assumed to be limited to [_a-zA-Z] only
if (state == SCE_PL_WORD) {
while (iswordstart(styler.SafeGetCharAt(kw))) kw++;
if (!isPerlKeyword(styler.GetStartSegment(), kw, keywords, styler)) {
state = SCE_PL_IDENTIFIER;
}
}
// if already SCE_PL_IDENTIFIER, then no ambiguity, skip this
// for quote-like delimiters/keywords, attempt to disambiguate
// to select for bareword, change state -> SCE_PL_IDENTIFIER
if (state != SCE_PL_IDENTIFIER && i > 0) {
unsigned int j = i;
bool moreback = false; // true if passed newline/comments
bool brace = false; // true if opening brace found
char ch2;
// first look backwards past whitespace/comments for EOLs
// if BACK_NONE, neither operator nor keyword, so skip test
if (backflag != BACK_NONE) {
while (--j > backPos) {
if (isEOLChar(styler.SafeGetCharAt(j)))
moreback = true;
}
ch2 = styler.SafeGetCharAt(j);
if (ch2 == '{' && !moreback) {
// {bareword: possible variable spec
brace = true;
} else if ((ch2 == '&')
// &bareword: subroutine call
|| (ch2 == '>' && styler.SafeGetCharAt(j - 1) == '-')
// ->bareword: part of variable spec
|| (ch2 == 'b' && styler.Match(j - 2, "su"))) {
// sub bareword: subroutine declaration
// (implied BACK_KEYWORD, no keywords end in 'sub'!)
state = SCE_PL_IDENTIFIER;
}
// if status still ambiguous, look forward after word past
// tabs/spaces only; if ch2 isn't one of '[{(,' it can never
// match anything, so skip the whole thing
j = kw;
if (state != SCE_PL_IDENTIFIER
&& (ch2 == '{' || ch2 == '(' || ch2 == '['|| ch2 == ',')
&& kw < lengthDoc) {
while (ch2 = styler.SafeGetCharAt(j),
(ch2 == ' ' || ch2 == '\t') && j < lengthDoc) {
j++;
}
if ((ch2 == '}' && brace)
// {bareword}: variable spec
|| (ch2 == '=' && styler.SafeGetCharAt(j + 1) == '>')) {
// [{(, bareword=>: hash literal
state = SCE_PL_IDENTIFIER;
}
}
}
}
backflag = BACK_NONE;
// an identifier or bareword
if (state == SCE_PL_IDENTIFIER) {
if ((!iswordchar(chNext) && chNext != '\'')
|| (chNext == '.' && chNext2 == '.')) {
// We need that if length of word == 1!
// This test is copied from the SCE_PL_WORD handler.
styler.ColourTo(i, SCE_PL_IDENTIFIER);
state = SCE_PL_DEFAULT;
}
// a keyword
} else if (state == SCE_PL_WORD) {
i = kw - 1;
if (ch == '_' && chNext == '_' &&
(isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")
|| isMatch(styler, lengthDoc, styler.GetStartSegment(), "__END__"))) {
styler.ColourTo(i, SCE_PL_DATASECTION);
state = SCE_PL_DATASECTION;
} else {
styler.ColourTo(i, SCE_PL_WORD);
state = SCE_PL_DEFAULT;
backflag = BACK_KEYWORD;
backPos = i;
}
ch = styler.SafeGetCharAt(i);
chNext = styler.SafeGetCharAt(i + 1);
// a repetition operator 'x'
} else if (state == SCE_PL_OPERATOR) {
styler.ColourTo(i, SCE_PL_OPERATOR);
state = SCE_PL_DEFAULT;
// quote-like delimiter, skip one char if double-char delimiter
} else {
i = kw - 1;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (ch == '#') {
state = SCE_PL_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_PL_STRING;
Quote.New(1);
Quote.Open(ch);
backflag = BACK_NONE;
} else if (ch == '\'') {
if (chPrev == '&') {
// Archaic call
@ -341,10 +451,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
Quote.New(1);
Quote.Open(ch);
}
backflag = BACK_NONE;
} else if (ch == '`') {
state = SCE_PL_BACKTICKS;
Quote.New(1);
Quote.Open(ch);
backflag = BACK_NONE;
} else if (ch == '$') {
if ((chNext == '{') || isspacechar(chNext)) {
styler.ColourTo(i, SCE_PL_SCALAR);
@ -360,28 +472,42 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
chNext = chNext2;
}
}
backflag = BACK_NONE;
} else if (ch == '@') {
if (isalpha(chNext) || chNext == '#' || chNext == '$'
|| chNext == '_' || chNext == '+') {
|| chNext == '_' || chNext == '+' || chNext == '-') {
state = SCE_PL_ARRAY;
} else if (chNext != '{' && chNext != '[') {
styler.ColourTo(i, SCE_PL_ARRAY);
i++;
ch = ' ';
} else {
styler.ColourTo(i, SCE_PL_ARRAY);
}
backflag = BACK_NONE;
} else if (ch == '%') {
if (isalpha(chNext) || chNext == '#' || chNext == '$' || chNext == '_') {
if (isalpha(chNext) || chNext == '#' || chNext == '$'
|| chNext == '_' || chNext == '!' || chNext == '^') {
state = SCE_PL_HASH;
i++;
ch = chNext;
chNext = chNext2;
} else if (chNext == '{') {
styler.ColourTo(i, SCE_PL_HASH);
} else {
styler.ColourTo(i, SCE_PL_OPERATOR);
}
backflag = BACK_NONE;
} else if (ch == '*') {
if (isalpha(chNext) || chNext == '_' || chNext == '{') {
char strch[2];
strch[0] = chNext;
strch[1] = '\0';
if (isalpha(chNext) || chNext == '_' ||
NULL != strstr("^/|,\\\";#%^:?<>)[]", strch)) {
state = SCE_PL_SYMBOLTABLE;
i++;
ch = chNext;
chNext = chNext2;
} else if (chNext == '{') {
styler.ColourTo(i, SCE_PL_SYMBOLTABLE);
} else {
if (chNext == '*') { // exponentiation
i++;
@ -390,14 +516,22 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
}
styler.ColourTo(i, SCE_PL_OPERATOR);
}
} else if (ch == '/') {
backflag = BACK_NONE;
} else if (ch == '/' || (ch == '<' && chNext == '<')) {
// Explicit backward peeking to set a consistent preferRE for
// any slash found, so no longer need to track preferRE state.
// Find first previous significant lexed element and interpret.
// Test for HERE doc start '<<' shares this code, helps to
// determine if it should be an operator.
bool preferRE = false;
bool isHereDoc = (ch == '<');
bool hereDocSpace = false; // these are for corner case:
bool hereDocScalar = false; // SCALAR [whitespace] '<<'
unsigned int bk = (i > 0)? i - 1: 0;
char bkch;
styler.Flush();
if (styler.StyleAt(bk) == SCE_PL_DEFAULT)
hereDocSpace = true;
while ((bk > 0) && (styler.StyleAt(bk) == SCE_PL_DEFAULT ||
styler.StyleAt(bk) == SCE_PL_COMMENTLINE)) {
bk--;
@ -494,9 +628,13 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
bk--;
}
break;
case SCE_PL_SCALAR: // for $var<< case
hereDocScalar = true;
break;
// other styles uses the default, preferRE=false
case SCE_PL_WORD:
case SCE_PL_POD:
case SCE_PL_POD_VERB:
case SCE_PL_HERE_Q:
case SCE_PL_HERE_QQ:
case SCE_PL_HERE_QX:
@ -504,24 +642,39 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
break;
}
}
if (preferRE) {
state = SCE_PL_REGEX;
Quote.New(1);
Quote.Open(ch);
} else {
styler.ColourTo(i, SCE_PL_OPERATOR);
}
} else if (ch == '<' && chNext == '<') {
state = SCE_PL_HERE_DELIM;
HereDoc.State = 0;
if (isHereDoc) { // handle HERE doc
// if SCALAR whitespace '<<', *always* a HERE doc
if (preferRE || (hereDocSpace && hereDocScalar)) {
state = SCE_PL_HERE_DELIM;
HereDoc.State = 0;
} else { // << operator
i++;
ch = chNext;
chNext = chNext2;
styler.ColourTo(i, SCE_PL_OPERATOR);
}
} else { // handle regexp
if (preferRE) {
state = SCE_PL_REGEX;
Quote.New(1);
Quote.Open(ch);
} else { // / operator
styler.ColourTo(i, SCE_PL_OPERATOR);
}
}
backflag = BACK_NONE;
} else if (ch == '<') {
// looks forward for matching > on same line
unsigned int fw = i + 1;
while (fw < lengthDoc) {
char fwch = styler.SafeGetCharAt(fw);
if (isEOLChar(fwch) || isspacechar(fwch))
if (fwch == ' ') {
if (styler.SafeGetCharAt(fw-1) != '\\' ||
styler.SafeGetCharAt(fw-2) != '\\')
break;
else if (fwch == '>') {
} else if (isEOLChar(fwch) || isspacechar(fwch)) {
break;
} else if (fwch == '>') {
if ((fw - i) == 2 && // '<=>' case
styler.SafeGetCharAt(fw-1) == '=') {
styler.ColourTo(fw, SCE_PL_OPERATOR);
@ -535,10 +688,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
fw++;
}
styler.ColourTo(i, SCE_PL_OPERATOR);
backflag = BACK_NONE;
} else if (ch == '=' // POD
&& isalpha(chNext)
&& (isEOLChar(chPrev))) {
state = SCE_PL_POD;
backflag = BACK_NONE;
//sookedpos = 0;
//sooked[sookedpos] = '\0';
} else if (ch == '-' // file test operators
@ -549,6 +704,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
i++;
ch = chNext;
chNext = chNext2;
backflag = BACK_NONE;
} else if (isPerlOperator(ch)) {
if (ch == '.' && chNext == '.') { // .. and ...
i++;
@ -558,6 +714,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
chNext = styler.SafeGetCharAt(i + 1);
}
styler.ColourTo(i, SCE_PL_OPERATOR);
backflag = BACK_OPERATOR;
backPos = i;
} else {
// keep colouring defaults to make restart easier
styler.ColourTo(i, SCE_PL_DEFAULT);
@ -567,7 +725,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
if (chNext == '.') {
// double dot is always an operator
goto numAtEnd;
} else if (numState == PERLNUM_NON_DEC || numState == PERLNUM_FLOAT) {
} else if (numState <= PERLNUM_FLOAT) {
// non-decimal number or float exponent, consume next dot
styler.ColourTo(i - 1, SCE_PL_NUMBER);
styler.ColourTo(i, SCE_PL_OPERATOR);
@ -594,7 +752,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
if (numState == PERLNUM_VECTOR || numState == PERLNUM_V_VECTOR) {
if (isalpha(ch)) {
if (dotCount == 0) { // change to word
state = SCE_PL_WORD;
state = SCE_PL_IDENTIFIER;
} else { // vector then word
goto numAtEnd;
}
@ -614,9 +772,24 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
if (!isdigit(ch)) { // float then word
goto numAtEnd;
}
} else {// (numState == PERLNUM_NON_DEC)
// allow alphanum for bin,hex,oct for now
}
} else if (numState == PERLNUM_OCTAL) {
if (!isdigit(ch))
goto numAtEnd;
else if (ch > '7')
numState = PERLNUM_BAD;
} else if (numState == PERLNUM_BINARY) {
if (!isdigit(ch))
goto numAtEnd;
else if (ch > '1')
numState = PERLNUM_BAD;
} else if (numState == PERLNUM_HEX) {
int ch2 = toupper(ch);
if (!isdigit(ch) && !(ch2 >= 'A' && ch2 <= 'F'))
goto numAtEnd;
} else {//(numState == PERLNUM_BAD) {
if (!isdigit(ch))
goto numAtEnd;
}
} else {
// complete current number or vector
numAtEnd:
@ -624,25 +797,8 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
state = SCE_PL_DEFAULT;
goto restartLexer;
}
} else if (state == SCE_PL_WORD) {
if ((!iswordchar(chNext) && chNext != '\'')
|| chNext == '.') {
// ".." is always an operator if preceded by a SCE_PL_WORD.
// "." never used in Perl variable names
// Archaic Perl has quotes inside names
if (isMatch(styler, lengthDoc, styler.GetStartSegment(), "__DATA__")
|| isMatch(styler, lengthDoc, styler.GetStartSegment(), "__END__")) {
styler.ColourTo(i, SCE_PL_DATASECTION);
state = SCE_PL_DATASECTION;
} else {
classifyWordPerl(styler.GetStartSegment(), i, keywords, styler);
state = SCE_PL_DEFAULT;
ch = ' ';
}
}
} else if (state == SCE_PL_IDENTIFIER) {
if ((!iswordchar(chNext) && chNext != '\'')
|| chNext == '.') {
if (!iswordstart(chNext) && chNext != '\'') {
styler.ColourTo(i, SCE_PL_IDENTIFIER);
state = SCE_PL_DEFAULT;
ch = ' ';
@ -685,29 +841,46 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
// Whitespace acceptable after <<[-] operator.
//
if (HereDoc.State == 0) { // '<<' encountered
bool gotspace = false;
unsigned int oldi = i;
if (chNext == ' ' || chNext == '\t') {
// skip whitespace; legal for quoted delimiters
gotspace = true;
do {
i++;
chNext = styler.SafeGetCharAt(i + 1);
} while ((i + 1 < lengthDoc) && (chNext == ' ' || chNext == '\t'));
chNext2 = styler.SafeGetCharAt(i + 2);
}
HereDoc.State = 1;
HereDoc.Quote = chNext;
HereDoc.Quoted = false;
HereDoc.DelimiterLength = 0;
HereDoc.Delimiter[HereDoc.DelimiterLength] = '\0';
if (chNext == '\'' || chNext == '"' || chNext == '`') { // a quoted here-doc delimiter
if (chNext == '\'' || chNext == '"' || chNext == '`') {
// a quoted here-doc delimiter
i++;
ch = chNext;
chNext = chNext2;
HereDoc.Quoted = true;
} else if (isalpha(chNext) || chNext == '_') {
// an unquoted here-doc delimiter, no special handling
} else if (isspacechar(chNext) || isdigit(chNext) || chNext == '\\'
|| chNext == '=' || chNext == '$' || chNext == '@') {
|| chNext == '=' || chNext == '$' || chNext == '@'
|| ((isalpha(chNext) || chNext == '_') && gotspace)) {
// left shift << or <<= operator cases
// restore position if operator
i = oldi;
styler.ColourTo(i, SCE_PL_OPERATOR);
state = SCE_PL_DEFAULT;
HereDoc.State = 0;
goto restartLexer;
} else {
// an unquoted here-doc delimiter, no special handling
// (cannot be prefixed by spaces/tabs), or
// symbols terminates; deprecated zero-length delimiter
}
} else if (HereDoc.State == 1) { // collect the delimiter
backflag = BACK_NONE;
if (HereDoc.Quoted) { // a quoted here-doc delimiter
if (ch == HereDoc.Quote) { // closing quote => end of delimiter
styler.ColourTo(i, state);
@ -746,20 +919,31 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
if (isEOLChar(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_PL_DEFAULT;
backflag = BACK_NONE;
HereDoc.State = 0;
goto restartLexer;
}
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_PL_POD) {
if (ch == '=' && isEOLChar(chPrev)) {
if (isMatch(styler, lengthDoc, i, "=cut")) {
styler.ColourTo(i - 1 + 4, state);
i += 4;
state = SCE_PL_DEFAULT;
ch = styler.SafeGetCharAt(i);
//chNext = styler.SafeGetCharAt(i + 1);
goto restartLexer;
} else if (state == SCE_PL_POD
|| state == SCE_PL_POD_VERB) {
if (isEOLChar(chPrev)) {
if (ch == ' ' || ch == '\t') {
styler.ColourTo(i - 1, state);
state = SCE_PL_POD_VERB;
} else {
styler.ColourTo(i - 1, state);
state = SCE_PL_POD;
if (ch == '=') {
if (isMatch(styler, lengthDoc, i, "=cut")) {
styler.ColourTo(i - 1 + 4, state);
i += 4;
state = SCE_PL_DEFAULT;
ch = styler.SafeGetCharAt(i);
//chNext = styler.SafeGetCharAt(i + 1);
goto restartLexer;
}
}
}
}
} else if (state == SCE_PL_SCALAR // variable names
@ -772,8 +956,7 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
chNext = chNext2;
}
else if (isEndVar(ch)) {
if ((state == SCE_PL_SCALAR || state == SCE_PL_ARRAY)
&& i == (styler.GetStartSegment() + 1)) {
if (i == (styler.GetStartSegment() + 1)) {
// Special variable: $(, $_ etc.
styler.ColourTo(i, state);
state = SCE_PL_DEFAULT;
@ -917,33 +1100,57 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
styler.ColourTo(lengthDoc - 1, state);
}
static bool IsCommentLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eol_pos; i++) {
char ch = styler[i];
int style = styler.StyleAt(i);
if (ch == '#' && style == SCE_PL_COMMENTLINE)
return true;
else if (ch != ' ' && ch != '\t')
return false;
}
return false;
}
static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// Custom folding of POD and packages
bool foldPOD = styler.GetPropertyInt("fold.perl.pod", 1) != 0;
bool foldPackage = styler.GetPropertyInt("fold.perl.package", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelPrev = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelPrev = styler.LevelAt(lineCurrent - 1) >> 16;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
char chPrev = styler.SafeGetCharAt(startPos - 1);
int styleNext = styler.StyleAt(startPos);
// Used at end of line to determine if the line was a package definition
bool isPackageLine = false;
bool isPodHeading = false;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment && (style == SCE_PL_COMMENTLINE)) {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelCurrent++;
} else if (chNext2 == '}') {
levelCurrent--;
}
}
}
bool atLineStart = isEOLChar(chPrev) || i == 0;
// Comment folding
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
{
if (!IsCommentLine(lineCurrent - 1, styler)
&& IsCommentLine(lineCurrent + 1, styler))
levelCurrent++;
else if (IsCommentLine(lineCurrent - 1, styler)
&& !IsCommentLine(lineCurrent+1, styler))
levelCurrent--;
}
if (style == SCE_C_OPERATOR) {
if (ch == '{') {
levelCurrent++;
@ -951,8 +1158,51 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
levelCurrent--;
}
}
// Custom POD folding
if (foldPOD && atLineStart) {
int stylePrevCh = (i) ? styler.StyleAt(i - 1):SCE_PL_DEFAULT;
if (style == SCE_PL_POD) {
if (stylePrevCh != SCE_PL_POD && stylePrevCh != SCE_PL_POD_VERB)
levelCurrent++;
else if (styler.Match(i, "=cut"))
levelCurrent--;
else if (styler.Match(i, "=head"))
isPodHeading = true;
} else if (style == SCE_PL_DATASECTION) {
if (ch == '=' && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE)
levelCurrent++;
else if (styler.Match(i, "=cut") && levelCurrent > SC_FOLDLEVELBASE)
levelCurrent--;
else if (styler.Match(i, "=head"))
isPodHeading = true;
// if package used or unclosed brace, level > SC_FOLDLEVELBASE!
// reset needed as level test is vs. SC_FOLDLEVELBASE
else if (styler.Match(i, "__END__"))
levelCurrent = SC_FOLDLEVELBASE;
}
}
// Custom package folding
if (foldPackage && atLineStart) {
if (style == SCE_PL_WORD && styler.Match(i, "package")) {
isPackageLine = true;
}
}
if (atEOL) {
int lev = levelPrev;
if (isPodHeading) {
lev = levelPrev - 1;
lev |= SC_FOLDLEVELHEADERFLAG;
isPodHeading = false;
}
// Check if line was a package declaration
// because packages need "special" treatment
if (isPackageLine) {
lev = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
levelCurrent = SC_FOLDLEVELBASE + 1;
isPackageLine = false;
}
lev |= levelCurrent << 16;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
@ -966,6 +1216,7 @@ static void FoldPerlDoc(unsigned int startPos, int length, int, WordList *[],
}
if (!isspacechar(ch))
visibleChars++;
chPrev = ch;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;

View File

@ -109,6 +109,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
}
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
const int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
@ -186,6 +187,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
style = SCE_P_CLASSNAME;
} else if (kwLast == kwDef) {
style = SCE_P_DEFNAME;
} else if (keywords2.InList(s)) {
style = SCE_P_WORD2;
}
sc.ChangeState(style);
sc.SetState(SCE_P_DEFAULT);
@ -198,9 +201,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
kwLast = kwImport;
else
kwLast = kwOther;
} else if (style == SCE_P_CLASSNAME) {
kwLast = kwOther;
} else if (style == SCE_P_DEFNAME) {
} else {
kwLast = kwOther;
}
}
@ -208,6 +209,10 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_P_DEFAULT);
}
} else if (sc.state == SCE_P_DECORATOR) {
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_P_DEFAULT);
}
} else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
if (sc.ch == '\\') {
if ((sc.chNext == '\r') && (sc.GetRelative(2) == '\n')) {
@ -262,6 +267,8 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
sc.SetState(SCE_P_OPERATOR);
} else if (sc.ch == '#') {
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
} else if (sc.ch == '@') {
sc.SetState(SCE_P_DECORATOR);
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2))) {
unsigned int nextIndex = 0;
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex));
@ -432,6 +439,7 @@ static void FoldPyDoc(unsigned int startPos, int length, int /*initStyle - unuse
static const char * const pythonWordListDesc[] = {
"Keywords",
"Highlighted identifiers",
0
};

View File

@ -0,0 +1,319 @@
// Scintilla source code edit control
/** @file LexRebol.cxx
** Lexer for REBOL.
** Written by Pascal Hurni, inspired from LexLua by Paul Winwood & Marcos E. Wurzius & Philippe Lhoste
**
** History:
** 2005-04-07 First release.
** 2005-04-10 Closing parens and brackets go now in default style
** String and comment nesting should be more safe
**/
// Copyright 2005 by Pascal Hurni <pascal_hurni@fastmail.fm>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StyleContext.h"
static inline bool IsAWordChar(const int ch) {
return (isalnum(ch) || ch == '?' || ch == '!' || ch == '.' || ch == '\'' || ch == '+' || ch == '-' || ch == '*' || ch == '&' || ch == '|' || ch == '=' || ch == '_' || ch == '~');
}
static inline bool IsAWordStart(const int ch, const int ch2) {
return ((ch == '+' || ch == '-' || ch == '.') && !isdigit(ch2)) ||
(isalpha(ch) || ch == '?' || ch == '!' || ch == '\'' || ch == '*' || ch == '&' || ch == '|' || ch == '=' || ch == '_' || ch == '~');
}
static inline bool IsAnOperator(const int ch, const int ch2, const int ch3) {
// One char operators
if (IsASpaceOrTab(ch2)) {
return ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '<' || ch == '>' || ch == '=' || ch == '?';
}
// Two char operators
if (IsASpaceOrTab(ch3)) {
return (ch == '*' && ch2 == '*') ||
(ch == '/' && ch2 == '/') ||
(ch == '<' && (ch2 == '=' || ch2 == '>')) ||
(ch == '>' && ch2 == '=') ||
(ch == '=' && (ch2 == '=' || ch2 == '?')) ||
(ch == '?' && ch2 == '?');
}
return false;
}
static inline bool IsBinaryStart(const int ch, const int ch2, const int ch3, const int ch4) {
return (ch == '#' && ch2 == '{') ||
(IsADigit(ch) && ch2 == '#' && ch3 == '{' ) ||
(IsADigit(ch) && IsADigit(ch2) && ch3 == '#' && ch4 == '{' );
}
static void ColouriseRebolDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
int currentLine = styler.GetLine(startPos);
// Initialize the braced string {.. { ... } ..} nesting level, if we are inside such a string.
int stringLevel = 0;
if (initStyle == SCE_REBOL_BRACEDSTRING || initStyle == SCE_REBOL_COMMENTBLOCK) {
stringLevel = styler.GetLineState(currentLine - 1);
}
bool blockComment = initStyle == SCE_REBOL_COMMENTBLOCK;
int dotCount = 0;
// Do not leak onto next line
if (initStyle == SCE_REBOL_COMMENTLINE) {
initStyle = SCE_REBOL_DEFAULT;
}
StyleContext sc(startPos, length, initStyle, styler);
if (startPos == 0) {
sc.SetState(SCE_REBOL_PREFACE);
}
for (; sc.More(); sc.Forward()) {
//--- What to do at line end ?
if (sc.atLineEnd) {
// Can be either inside a {} string or simply at eol
if (sc.state != SCE_REBOL_BRACEDSTRING && sc.state != SCE_REBOL_COMMENTBLOCK &&
sc.state != SCE_REBOL_BINARY && sc.state != SCE_REBOL_PREFACE)
sc.SetState(SCE_REBOL_DEFAULT);
// Update the line state, so it can be seen by next line
currentLine = styler.GetLine(sc.currentPos);
switch (sc.state) {
case SCE_REBOL_BRACEDSTRING:
case SCE_REBOL_COMMENTBLOCK:
// Inside a braced string, we set the line state
styler.SetLineState(currentLine, stringLevel);
break;
default:
// Reset the line state
styler.SetLineState(currentLine, 0);
break;
}
// continue with next char
continue;
}
//--- What to do on white-space ?
if (IsASpaceOrTab(sc.ch))
{
// Return to default if any of these states
if (sc.state == SCE_REBOL_OPERATOR || sc.state == SCE_REBOL_CHARACTER ||
sc.state == SCE_REBOL_NUMBER || sc.state == SCE_REBOL_PAIR ||
sc.state == SCE_REBOL_TUPLE || sc.state == SCE_REBOL_FILE ||
sc.state == SCE_REBOL_DATE || sc.state == SCE_REBOL_TIME ||
sc.state == SCE_REBOL_MONEY || sc.state == SCE_REBOL_ISSUE ||
sc.state == SCE_REBOL_URL || sc.state == SCE_REBOL_EMAIL) {
sc.SetState(SCE_REBOL_DEFAULT);
}
}
//--- Specialize state ?
// URL, Email look like identifier
if (sc.state == SCE_REBOL_IDENTIFIER)
{
if (sc.ch == ':' && !IsASpace(sc.chNext)) {
sc.ChangeState(SCE_REBOL_URL);
} else if (sc.ch == '@') {
sc.ChangeState(SCE_REBOL_EMAIL);
} else if (sc.ch == '$') {
sc.ChangeState(SCE_REBOL_MONEY);
}
}
// Words look like identifiers
if (sc.state == SCE_REBOL_IDENTIFIER || (sc.state >= SCE_REBOL_WORD && sc.state <= SCE_REBOL_WORD8)) {
// Keywords ?
if (!IsAWordChar(sc.ch) || sc.Match('/')) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
blockComment = strcmp(s, "comment") == 0;
if (keywords8.InList(s)) {
sc.ChangeState(SCE_REBOL_WORD8);
} else if (keywords7.InList(s)) {
sc.ChangeState(SCE_REBOL_WORD7);
} else if (keywords6.InList(s)) {
sc.ChangeState(SCE_REBOL_WORD6);
} else if (keywords5.InList(s)) {
sc.ChangeState(SCE_REBOL_WORD5);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_REBOL_WORD4);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_REBOL_WORD3);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_REBOL_WORD2);
} else if (keywords.InList(s)) {
sc.ChangeState(SCE_REBOL_WORD);
}
// Keep same style if there are refinements
if (!sc.Match('/')) {
sc.SetState(SCE_REBOL_DEFAULT);
}
}
// special numbers
} else if (sc.state == SCE_REBOL_NUMBER) {
switch (sc.ch) {
case 'x': sc.ChangeState(SCE_REBOL_PAIR);
break;
case ':': sc.ChangeState(SCE_REBOL_TIME);
break;
case '-':
case '/': sc.ChangeState(SCE_REBOL_DATE);
break;
case '.': if (++dotCount >= 2) sc.ChangeState(SCE_REBOL_TUPLE);
break;
}
}
//--- Determine if the current state should terminate
if (sc.state == SCE_REBOL_QUOTEDSTRING || sc.state == SCE_REBOL_CHARACTER) {
if (sc.ch == '^' && sc.chNext == '\"') {
sc.Forward();
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_REBOL_DEFAULT);
}
} else if (sc.state == SCE_REBOL_BRACEDSTRING || sc.state == SCE_REBOL_COMMENTBLOCK) {
if (sc.ch == '}') {
if (--stringLevel == 0) {
sc.ForwardSetState(SCE_REBOL_DEFAULT);
}
} else if (sc.ch == '{') {
stringLevel++;
}
} else if (sc.state == SCE_REBOL_BINARY) {
if (sc.ch == '}') {
sc.ForwardSetState(SCE_REBOL_DEFAULT);
}
} else if (sc.state == SCE_REBOL_TAG) {
if (sc.ch == '>') {
sc.ForwardSetState(SCE_REBOL_DEFAULT);
}
} else if (sc.state == SCE_REBOL_PREFACE) {
if (sc.MatchIgnoreCase("rebol"))
{
int i;
for (i=5; IsASpaceOrTab(styler.SafeGetCharAt(sc.currentPos+i, 0)); i++);
if (sc.GetRelative(i) == '[')
sc.SetState(SCE_REBOL_DEFAULT);
}
}
//--- Parens and bracket changes to default style when the current is a number
if (sc.state == SCE_REBOL_NUMBER || sc.state == SCE_REBOL_PAIR || sc.state == SCE_REBOL_TUPLE ||
sc.state == SCE_REBOL_MONEY || sc.state == SCE_REBOL_ISSUE || sc.state == SCE_REBOL_EMAIL ||
sc.state == SCE_REBOL_URL || sc.state == SCE_REBOL_DATE || sc.state == SCE_REBOL_TIME) {
if (sc.ch == '(' || sc.ch == '[' || sc.ch == ')' || sc.ch == ']') {
sc.SetState(SCE_REBOL_DEFAULT);
}
}
//--- Determine if a new state should be entered.
if (sc.state == SCE_REBOL_DEFAULT) {
if (IsAnOperator(sc.ch, sc.chNext, sc.GetRelative(2))) {
sc.SetState(SCE_REBOL_OPERATOR);
} else if (IsBinaryStart(sc.ch, sc.chNext, sc.GetRelative(2), sc.GetRelative(3))) {
sc.SetState(SCE_REBOL_BINARY);
} else if (IsAWordStart(sc.ch, sc.chNext)) {
sc.SetState(SCE_REBOL_IDENTIFIER);
} else if (IsADigit(sc.ch) || sc.ch == '+' || sc.ch == '-' || /*Decimal*/ sc.ch == '.' || sc.ch == ',') {
dotCount = 0;
sc.SetState(SCE_REBOL_NUMBER);
} else if (sc.ch == '\"') {
sc.SetState(SCE_REBOL_QUOTEDSTRING);
} else if (sc.ch == '{') {
sc.SetState(blockComment ? SCE_REBOL_COMMENTBLOCK : SCE_REBOL_BRACEDSTRING);
++stringLevel;
} else if (sc.ch == ';') {
sc.SetState(SCE_REBOL_COMMENTLINE);
} else if (sc.ch == '$') {
sc.SetState(SCE_REBOL_MONEY);
} else if (sc.ch == '%') {
sc.SetState(SCE_REBOL_FILE);
} else if (sc.ch == '<') {
sc.SetState(SCE_REBOL_TAG);
} else if (sc.ch == '#' && sc.chNext == '"') {
sc.SetState(SCE_REBOL_CHARACTER);
sc.Forward();
} else if (sc.ch == '#' && sc.chNext != '"' && sc.chNext != '{' ) {
sc.SetState(SCE_REBOL_ISSUE);
}
}
}
sc.Complete();
}
static void FoldRebolDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
Accessor &styler) {
unsigned int lengthDoc = 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);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_REBOL_DEFAULT) {
if (ch == '[') {
levelCurrent++;
} else if (ch == ']') {
levelCurrent--;
}
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
}
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
static const char * const rebolWordListDesc[] = {
"Keywords",
0
};
LexerModule lmREBOL(SCLEX_REBOL, ColouriseRebolDoc, "rebol", FoldRebolDoc, rebolWordListDesc);

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,8 @@
// Scintilla source code edit control
/** @file LexSQL.cxx
** Lexer for SQL.
** Lexer for SQL, including PL/SQL and SQL*Plus.
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
@ -15,180 +15,349 @@
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char s[100];
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
s[i + 1] = '\0';
}
char chAttr = SCE_C_IDENTIFIER;
if (wordIsNumber)
chAttr = SCE_C_NUMBER;
else {
if (keywords.InList(s))
chAttr = SCE_C_WORD;
}
styler.ColourTo(end, chAttr);
static inline bool IsAWordChar(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
}
static void ColouriseSQLDoc(unsigned int startPos, int length,
int initStyle, WordList *keywordlists[], Accessor &styler) {
static inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalpha(ch) || ch == '_');
}
WordList &keywords = *keywordlists[0];
static inline bool IsADoxygenChar(int ch) {
return (islower(ch) || ch == '$' || ch == '@' ||
ch == '\\' || ch == '&' || ch == '<' ||
ch == '>' || ch == '#' || ch == '{' ||
ch == '}' || ch == '[' || ch == ']');
}
styler.StartAt(startPos);
static inline bool IsANumberChar(int ch) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
(isdigit(ch) || toupper(ch) == 'E' ||
ch == '.' || ch == '-' || ch == '+');
}
static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords1 = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &kw_pldoc = *keywordlists[2];
WordList &kw_sqlplus = *keywordlists[3];
WordList &kw_user1 = *keywordlists[4];
WordList &kw_user2 = *keywordlists[5];
WordList &kw_user3 = *keywordlists[6];
WordList &kw_user4 = *keywordlists[7];
StyleContext sc(startPos, length, initStyle, styler);
bool fold = styler.GetPropertyInt("fold") != 0;
bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0;
int styleBeforeDCKeyword = SCE_C_DEFAULT;
bool fold = styler.GetPropertyInt("fold") != 0;
int lineCurrent = styler.GetLine(startPos);
int spaceFlags = 0;
int state = initStyle;
char chPrev = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
unsigned int lengthDoc = startPos + length;
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n')) {
for (; sc.More(); sc.Forward()) {
// Fold based on indentation
if (sc.atLineStart) {
int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
int lev = indentCurrent;
int level = indentCurrent;
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG)) {
// Only non whitespace lines can be headers
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags);
if (indentCurrent < (indentNext & ~SC_FOLDLEVELWHITEFLAG)) {
lev |= SC_FOLDLEVELHEADERFLAG;
level |= SC_FOLDLEVELHEADERFLAG;
}
}
if (fold) {
styler.SetLevel(lineCurrent, lev);
styler.SetLevel(lineCurrent, level);
}
}
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
i += 1;
continue;
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_SQL_OPERATOR:
sc.SetState(SCE_SQL_DEFAULT);
break;
case SCE_SQL_NUMBER:
// We stop the number definition on non-numerical non-dot non-eE non-sign char
if (!IsANumberChar(sc.ch)) {
sc.SetState(SCE_SQL_DEFAULT);
}
break;
case SCE_SQL_IDENTIFIER:
if (!IsAWordChar(sc.ch)) {
int nextState = SCE_SQL_DEFAULT;
char s[1000];
sc.GetCurrentLowered(s, sizeof(s));
if (keywords1.InList(s)) {
sc.ChangeState(SCE_SQL_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_SQL_WORD2);
} else if (kw_sqlplus.InListAbbreviated(s, '~')) {
sc.ChangeState(SCE_SQL_SQLPLUS);
if (strncmp(s, "rem", 3) == 0) {
nextState = SCE_SQL_SQLPLUS_COMMENT;
} else if (strncmp(s, "pro", 3) == 0) {
nextState = SCE_SQL_SQLPLUS_PROMPT;
}
} else if (kw_user1.InList(s)) {
sc.ChangeState(SCE_SQL_USER1);
} else if (kw_user2.InList(s)) {
sc.ChangeState(SCE_SQL_USER2);
} else if (kw_user3.InList(s)) {
sc.ChangeState(SCE_SQL_USER3);
} else if (kw_user4.InList(s)) {
sc.ChangeState(SCE_SQL_USER4);
}
sc.SetState(nextState);
}
break;
case SCE_SQL_QUOTEDIDENTIFIER:
if (sc.ch == 0x60) {
if (sc.chNext == 0x60) {
sc.Forward(); // Ignore it
} else {
sc.ForwardSetState(SCE_SQL_DEFAULT);
}
}
break;
case SCE_SQL_COMMENT:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_SQL_DEFAULT);
}
break;
case SCE_SQL_COMMENTDOC:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_SQL_DEFAULT);
} else if (sc.ch == '@' || sc.ch == '\\') { // Doxygen support
// Verify that we have the conditions to mark a comment-doc-keyword
if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) {
styleBeforeDCKeyword = SCE_SQL_COMMENTDOC;
sc.SetState(SCE_SQL_COMMENTDOCKEYWORD);
}
}
break;
case SCE_SQL_COMMENTLINE:
case SCE_SQL_COMMENTLINEDOC:
case SCE_SQL_SQLPLUS_COMMENT:
case SCE_SQL_SQLPLUS_PROMPT:
if (sc.atLineStart) {
sc.SetState(SCE_SQL_DEFAULT);
}
break;
case SCE_SQL_COMMENTDOCKEYWORD:
if ((styleBeforeDCKeyword == SCE_SQL_COMMENTDOC) && sc.Match('*', '/')) {
sc.ChangeState(SCE_SQL_COMMENTDOCKEYWORDERROR);
sc.Forward();
sc.ForwardSetState(SCE_SQL_DEFAULT);
} else if (!IsADoxygenChar(sc.ch)) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (!isspace(sc.ch) || !kw_pldoc.InList(s + 1)) {
sc.ChangeState(SCE_SQL_COMMENTDOCKEYWORDERROR);
}
sc.SetState(styleBeforeDCKeyword);
}
break;
case SCE_SQL_CHARACTER:
if (sqlBackslashEscapes && sc.ch == '\\') {
sc.Forward();
} else if (sc.ch == '\'') {
if (sc.chNext == '\"') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_SQL_DEFAULT);
}
}
break;
case SCE_SQL_STRING:
if (sc.ch == '\\') {
// Escape sequence
sc.Forward();
} else if (sc.ch == '\"') {
if (sc.chNext == '\"') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_SQL_DEFAULT);
}
}
break;
}
if (state == SCE_C_DEFAULT) {
if (iswordstart(ch)) {
styler.ColourTo(i - 1, state);
state = SCE_C_WORD;
} else if (ch == '/' && chNext == '*') {
styler.ColourTo(i - 1, state);
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
styler.ColourTo(i - 1, state);
state = SCE_C_COMMENTLINE;
} else if (ch == '#') {
styler.ColourTo(i - 1, state);
state = SCE_C_COMMENTLINEDOC;
} else if (ch == '\'') {
styler.ColourTo(i - 1, state);
state = SCE_C_CHARACTER;
} else if (ch == '"') {
styler.ColourTo(i - 1, state);
state = SCE_C_STRING;
} else if (isoperator(ch)) {
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_C_OPERATOR);
}
} else if (state == SCE_C_WORD) {
if (!iswordchar(ch)) {
classifyWordSQL(styler.GetStartSegment(), i - 1, keywords, styler);
state = SCE_C_DEFAULT;
if (ch == '/' && chNext == '*') {
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
state = SCE_C_COMMENTLINE;
} else if (ch == '#') {
state = SCE_C_COMMENTLINEDOC;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (ch == '"') {
state = SCE_C_STRING;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
}
}
} else {
if (state == SCE_C_COMMENT) {
if (ch == '/' && chPrev == '*') {
if (((i > (styler.GetStartSegment() + 2)) || ((initStyle == SCE_C_COMMENT) &&
(styler.GetStartSegment() == startPos)))) {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE || state == SCE_C_COMMENTLINEDOC) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i - 1, state);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_CHARACTER) {
if (sqlBackslashEscapes && ch == '\\') {
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else if (ch == '\'') {
if (chNext == '\'') {
i++;
} else {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
i++;
}
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
} else if (state == SCE_C_STRING) {
if (ch == '"') {
if (chNext == '"') {
i++;
} else {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
i++;
}
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
if (state == SCE_C_DEFAULT) { // One of the above succeeded
if (ch == '/' && chNext == '*') {
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
state = SCE_C_COMMENTLINE;
} else if (ch == '#') {
state = SCE_C_COMMENTLINEDOC;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (ch == '"') {
state = SCE_C_STRING;
} else if (iswordstart(ch)) {
state = SCE_C_WORD;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
// Determine if a new state should be entered.
if (sc.state == SCE_SQL_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_SQL_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_SQL_IDENTIFIER);
} else if (sc.ch == 0x60 && sqlBackticksIdentifier) {
sc.SetState(SCE_SQL_QUOTEDIDENTIFIER);
} else if (sc.Match('/', '*')) {
if (sc.Match("/**") || sc.Match("/*!")) { // Support of Doxygen doc. style
sc.SetState(SCE_SQL_COMMENTDOC);
} else {
sc.SetState(SCE_SQL_COMMENT);
}
sc.Forward(); // Eat the * so it isn't used for the end of the comment
} else if (sc.Match('-', '-')) {
// MySQL requires a space or control char after --
// http://dev.mysql.com/doc/mysql/en/ansi-diff-comments.html
// Perhaps we should enforce that with proper property:
//~ } else if (sc.Match("-- ")) {
sc.SetState(SCE_SQL_COMMENTLINE);
} else if (sc.ch == '#') {
sc.SetState(SCE_SQL_COMMENTLINEDOC);
} else if (sc.ch == '\'') {
sc.SetState(SCE_SQL_CHARACTER);
} else if (sc.ch == '\"') {
sc.SetState(SCE_SQL_STRING);
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_SQL_OPERATOR);
}
}
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
sc.Complete();
}
static bool IsStreamCommentStyle(int style) {
return style == SCE_SQL_COMMENT ||
style == SCE_SQL_COMMENTDOC ||
style == SCE_SQL_COMMENTDOCKEYWORD ||
style == SCE_SQL_COMMENTDOCKEYWORDERROR;
}
// Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment.
static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0) {
levelCurrent = styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK;
}
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
bool endFound = false;
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 (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) {
levelNext++;
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelNext--;
}
}
if (foldComment && (style == SCE_SQL_COMMENTLINE)) {
// MySQL needs -- comments to be followed by space or control char
if ((ch == '-') && (chNext == '-')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
char chNext3 = styler.SafeGetCharAt(i + 3);
if (chNext2 == '{' || chNext3 == '{') {
levelNext++;
} else if (chNext2 == '}' || chNext3 == '}') {
levelNext--;
}
}
}
if (style == SCE_SQL_OPERATOR) {
if (ch == '(') {
levelNext++;
} else if (ch == ')') {
levelNext--;
}
}
// If new keyword (cannot trigger on elseif or nullif, does less tests)
if (style == SCE_SQL_WORD && stylePrev != SCE_SQL_WORD) {
const int MAX_KW_LEN = 6; // Maximum length of folding keywords
char s[MAX_KW_LEN + 2];
unsigned int j = 0;
for (; j < MAX_KW_LEN + 1; j++) {
if (!iswordchar(styler[i + j])) {
break;
}
s[j] = static_cast<char>(tolower(styler[i + j]));
}
if (j == MAX_KW_LEN + 1) {
// Keyword too long, don't test it
s[0] = '\0';
} else {
s[j] = '\0';
}
if (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0) {
if (endFound) {
// ignore
endFound = false;
} else {
levelNext++;
}
} else if (strcmp(s, "begin") == 0) {
levelNext++;
} else if (strcmp(s, "end") == 0 ||
// DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS
strcmp(s, "exists") == 0) {
endFound = true;
levelNext--;
if (levelNext < SC_FOLDLEVELBASE) {
levelNext = SC_FOLDLEVELBASE;
}
}
}
if (atEOL) {
int level = levelCurrent;
if (visibleChars == 0 && foldCompact) {
// Empty line
level |= SC_FOLDLEVELWHITEFLAG;
}
if (visibleChars > 0 && levelNext > levelCurrent) {
level |= SC_FOLDLEVELHEADERFLAG;
}
if (level != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, level);
}
lineCurrent++;
levelCurrent = levelNext;
visibleChars = 0;
endFound = false;
}
if (!isspacechar(ch)) {
visibleChars++;
}
}
}
static const char * const sqlWordListDesc[] = {
"Keywords",
"Database Objects",
"PLDoc",
"SQL*Plus",
"User Keywords 1",
"User Keywords 2",
"User Keywords 3",
"User Keywords 4",
0
};
LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc, "sql", 0, sqlWordListDesc);
LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc, "sql", FoldSQLDoc, sqlWordListDesc);

View File

@ -0,0 +1,317 @@
// Scintilla source code edit control
/** @file LexSmalltalk.cxx
** Lexer for Smalltalk language.
** Written by Sergey Philippov, sphilippov-at-gmail-dot-com
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
/*
| lexTable classificationBlock charClasses |
charClasses := #(#DecDigit #Letter #Special #Upper #BinSel).
lexTable := ByteArray new: 128.
classificationBlock := [ :charClass :chars |
| flag |
flag := 1 bitShift: (charClasses indexOf: charClass) - 1.
chars do: [ :char | lexTable at: char codePoint + 1 put: ((lexTable at: char codePoint + 1) bitOr: flag)]].
classificationBlock
value: #DecDigit value: '0123456789';
value: #Letter value: '_abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ';
value: #Special value: '()[]{};.^:';
value: #BinSel value: '~@%&*-+=|\/,<>?!';
value: #Upper value: 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'.
((String new: 500) streamContents: [ :stream |
stream crLf; nextPutAll: 'static int ClassificationTable[256] = {'.
lexTable keysAndValuesDo: [ :index :value |
((index - 1) rem: 16) == 0 ifTrue: [
stream crLf; tab]
ifFalse: [
stream space].
stream print: value.
index ~= 256 ifTrue: [
stream nextPut: $,]].
stream crLf; nextPutAll: '};'; crLf.
charClasses keysAndValuesDo: [ :index :name |
stream
crLf;
nextPutAll: (
('static inline bool is<1s>(int ch) {return (ch > 0) && (ch %< 0x80) && ((ClassificationTable[ch] & <2p>) != 0);}')
expandMacrosWith: name with: (1 bitShift: (index - 1)))
]]) edit
*/
// autogenerated {{{{
static int ClassificationTable[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 16, 0, 0, 0, 16, 16, 0, 4, 4, 16, 16, 16, 16, 4, 16,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 4, 4, 16, 16, 16, 16,
16, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10,
10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 10, 4, 16, 4, 4, 2,
0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 4, 16, 4, 16, 0,
};
static inline bool isDecDigit(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 1) != 0);}
static inline bool isLetter(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 2) != 0);}
static inline bool isSpecial(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 4) != 0);}
static inline bool isUpper(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 8) != 0);}
static inline bool isBinSel(int ch) {return (ch > 0) && (ch < 0x80) && ((ClassificationTable[ch] & 16) != 0);}
// autogenerated }}}}
static inline bool isAlphaNumeric(int ch) {
return isDecDigit(ch) || isLetter(ch);
}
static inline bool isDigitOfRadix(int ch, int radix)
{
if (isDecDigit(ch))
return (ch - '0') < radix;
else if (!isUpper(ch))
return false;
else
return (ch - 'A' + 10) < radix;
}
static inline void skipComment(StyleContext& sc)
{
while (sc.More() && sc.ch != '\"')
sc.Forward();
}
static inline void skipString(StyleContext& sc)
{
while (sc.More()) {
if (sc.ch == '\'') {
if (sc.chNext != '\'')
return;
sc.Forward();
}
sc.Forward();
}
}
static void handleHash(StyleContext& sc)
{
if (isSpecial(sc.chNext)) {
sc.SetState(SCE_ST_SPECIAL);
return;
}
sc.SetState(SCE_ST_SYMBOL);
sc.Forward();
if (sc.ch == '\'') {
sc.Forward();
skipString(sc);
}
else {
if (isLetter(sc.ch)) {
while (isAlphaNumeric(sc.chNext) || sc.chNext == ':')
sc.Forward();
}
else if (isBinSel(sc.ch)) {
while (isBinSel(sc.chNext))
sc.Forward();
}
}
}
static inline void handleSpecial(StyleContext& sc)
{
if (sc.ch == ':' && sc.chNext == '=') {
sc.SetState(SCE_ST_ASSIGN);
sc.Forward();
}
else {
if (sc.ch == '^')
sc.SetState(SCE_ST_RETURN);
else
sc.SetState(SCE_ST_SPECIAL);
}
}
static inline void skipInt(StyleContext& sc, int radix)
{
while (isDigitOfRadix(sc.chNext, radix))
sc.Forward();
}
static void handleNumeric(StyleContext& sc)
{
char num[256];
int nl;
int radix;
sc.SetState(SCE_ST_NUMBER);
num[0] = static_cast<char>(sc.ch);
nl = 1;
while (isDecDigit(sc.chNext)) {
num[nl++] = static_cast<char>(sc.chNext);
sc.Forward();
if (nl+1 == sizeof(num)/sizeof(num[0])) // overrun check
break;
}
if (sc.chNext == 'r') {
num[nl] = 0;
if (num[0] == '-')
radix = atoi(num + 1);
else
radix = atoi(num);
sc.Forward();
if (sc.chNext == '-')
sc.Forward();
skipInt(sc, radix);
}
else
radix = 10;
if (sc.chNext != '.' || !isDigitOfRadix(sc.GetRelative(2), radix))
return;
sc.Forward();
skipInt(sc, radix);
if (sc.chNext == 's') {
// ScaledDecimal
sc.Forward();
while (isDecDigit(sc.chNext))
sc.Forward();
return;
}
else if (sc.chNext != 'e' && sc.chNext != 'd' && sc.chNext != 'q')
return;
sc.Forward();
if (sc.chNext == '+' || sc.chNext == '-')
sc.Forward();
skipInt(sc, radix);
}
static inline void handleBinSel(StyleContext& sc)
{
sc.SetState(SCE_ST_BINARY);
while (isBinSel(sc.chNext))
sc.Forward();
}
static void handleLetter(StyleContext& sc, WordList* specialSelectorList)
{
char ident[256];
int il;
int state;
bool doubleColonPresent;
sc.SetState(SCE_ST_DEFAULT);
ident[0] = static_cast<char>(sc.ch);
il = 1;
while (isAlphaNumeric(sc.chNext)) {
ident[il++] = static_cast<char>(sc.chNext);
sc.Forward();
if (il+2 == sizeof(ident)/sizeof(ident[0])) // overrun check
break;
}
if (sc.chNext == ':') {
doubleColonPresent = true;
ident[il++] = ':';
sc.Forward();
}
else
doubleColonPresent = false;
ident[il] = 0;
if (specialSelectorList->InList(ident))
state = SCE_ST_SPEC_SEL;
else if (doubleColonPresent)
state = SCE_ST_KWSEND;
else if (isUpper(ident[0]))
state = SCE_ST_GLOBAL;
else {
if (!strcmp(ident, "self"))
state = SCE_ST_SELF;
else if (!strcmp(ident, "super"))
state = SCE_ST_SUPER;
else if (!strcmp(ident, "nil"))
state = SCE_ST_NIL;
else if (!strcmp(ident, "true") || !strcmp(ident, "false"))
state = SCE_ST_BOOL;
else
state = SCE_ST_DEFAULT;
}
sc.ChangeState(state);
}
static void colorizeSmalltalkDoc(unsigned int startPos, int length, int initStyle, WordList *wordLists[], Accessor &styler)
{
StyleContext sc(startPos, length, initStyle, styler);
if (initStyle == SCE_ST_COMMENT) {
skipComment(sc);
if (sc.More())
sc.Forward();
}
else if (initStyle == SCE_ST_STRING) {
skipString(sc);
if (sc.More())
sc.Forward();
}
for (; sc.More(); sc.Forward()) {
int ch;
ch = sc.ch;
if (ch == '\"') {
sc.SetState(SCE_ST_COMMENT);
sc.Forward();
skipComment(sc);
}
else if (ch == '\'') {
sc.SetState(SCE_ST_STRING);
sc.Forward();
skipString(sc);
}
else if (ch == '#')
handleHash(sc);
else if (ch == '$') {
sc.SetState(SCE_ST_CHARACTER);
sc.Forward();
}
else if (isSpecial(ch))
handleSpecial(sc);
else if (isDecDigit(ch))
handleNumeric(sc);
else if (isLetter(ch))
handleLetter(sc, wordLists[0]);
else if (isBinSel(ch)) {
if (ch == '-' && isDecDigit(sc.chNext))
handleNumeric(sc);
else
handleBinSel(sc);
}
else
sc.SetState(SCE_ST_DEFAULT);
}
sc.Complete();
}
static const char* const smalltalkWordListDesc[] = {
"Special selectors",
0
};
LexerModule lmSmalltalk(SCLEX_SMALLTALK, colorizeSmalltalkDoc, "smalltalk", NULL, smalltalkWordListDesc);

View File

@ -0,0 +1,837 @@
// Scintilla source code edit control
/** @file LexTADS3.cxx
** Lexer for TADS3.
**/
/* Copyright 2005 by Michael Cartmell
* Parts copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
* In particular FoldTADS3Doc is derived from FoldCppDoc
* The License.txt file describes the conditions under which this software may
* be distributed.
*/
/*
* TADS3 is a language designed by Michael J. Roberts for the writing of text
* based games. TADS comes from Text Adventure Development System. It has good
* support for the processing and outputting of formatted text and much of a
* TADS program listing consists of strings.
*
* TADS has two types of strings, those enclosed in single quotes (') and those
* enclosed in double quotes ("). These strings have different symantics and
* can be given different highlighting if desired.
*
* There can be embedded within both types of strings html tags
* ( <tag key=value> ), library directives ( <.directive> ), and message
* parameters ( {The doctor's/his} ).
*
* Double quoted strings can also contain interpolated expressions
* ( << rug.moved ? ' and a hole in the floor. ' : nil >> ). These expressions
* may themselves contain single or double quoted strings, although the double
* quoted strings may not contain interpolated expressions.
*
* These embedded constructs influence the output and formatting and are an
* important part of a program and require highlighting.
*
* LINKS
* http://www.tads.org/
*/
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static const int T3_SINGLE_QUOTE = 1;
static const int T3_INT_EXPRESSION = 2;
static inline bool IsEOL(const int ch, const int chNext) {
return (ch == '\r' && chNext != '\n') || (ch == '\n');
}
static inline bool IsASpaceOrTab(const int ch) {
return ch == ' ' || ch == '\t';
}
static inline bool IsATADS3Operator(const int ch) {
return ch == '=' || ch == '{' || ch == '}' || ch == '(' || ch == ')'
|| ch == '[' || ch == ']' || ch == ',' || ch == ':' || ch == ';'
|| ch == '+' || ch == '-' || ch == '*' || ch == '/' || ch == '%'
|| ch == '?' || ch == '!' || ch == '<' || ch == '>' || ch == '|'
|| ch == '@' || ch == '&' || ch == '~';
}
static inline bool IsAWordChar(const int ch) {
return isalnum(ch) || ch == '_' || ch == '.';
}
static inline bool IsAWordStart(const int ch) {
return isalpha(ch) || ch == '_';
}
static inline bool IsAHexDigit(const int ch) {
int lch = tolower(ch);
return isdigit(lch) || lch == 'a' || lch == 'b' || lch == 'c'
|| lch == 'd' || lch == 'e' || lch == 'f';
}
static inline bool IsAnHTMLChar(int ch) {
return isalnum(ch) || ch == '-' || ch == '_' || ch == '.';
}
static inline bool IsADirectiveChar(int ch) {
return isalnum(ch) || isspace(ch) || ch == '-' || ch == '/';
}
static inline bool IsANumberStart(StyleContext &sc) {
return isdigit(sc.ch)
|| (!isdigit(sc.chPrev) && sc.ch == '.' && isdigit(sc.chNext));
}
inline static void ColouriseTADS3Operator(StyleContext &sc) {
int initState = sc.state;
sc.SetState(SCE_T3_OPERATOR);
sc.ForwardSetState(initState);
}
static void ColouriseTADSHTMLString(StyleContext &sc, int &lineState) {
int endState = sc.state;
int chQuote = sc.ch;
if (endState == SCE_T3_HTML_STRING) {
if (lineState&T3_SINGLE_QUOTE) {
endState = SCE_T3_S_STRING;
chQuote = '"';
} else if (lineState&T3_INT_EXPRESSION) {
endState = SCE_T3_X_STRING;
chQuote = '\'';
} else {
endState = SCE_T3_D_STRING;
chQuote = '\'';
}
} else {
sc.SetState(SCE_T3_HTML_STRING);
sc.Forward();
}
int chString = chQuote == '"'? '\'': '"';
while (sc.More()) {
if (IsEOL(sc.ch, sc.chNext)) {
return;
}
if (sc.ch == chQuote) {
sc.ForwardSetState(endState);
return;
}
if (sc.ch == chString) {
sc.SetState(endState);
return;
}
if (sc.Match('\\', static_cast<char>(chQuote))
|| sc.Match('\\', static_cast<char>(chString))) {
sc.Forward(2);
} else {
sc.Forward();
}
}
}
static void ColouriseTADS3HTMLTagStart(StyleContext &sc) {
sc.SetState(SCE_T3_HTML_TAG);
sc.Forward();
if (sc.ch == '/') {
sc.Forward();
}
while (IsAnHTMLChar(sc.ch)) {
sc.Forward();
}
}
static void ColouriseTADS3HTMLTag(StyleContext &sc, int &lineState) {
int endState = sc.state;
int chQuote = '"';
int chString = '\'';
switch (endState) {
case SCE_T3_S_STRING:
ColouriseTADS3HTMLTagStart(sc);
sc.SetState(SCE_T3_HTML_DEFAULT);
chQuote = '\'';
chString = '"';
break;
case SCE_T3_D_STRING:
case SCE_T3_X_STRING:
ColouriseTADS3HTMLTagStart(sc);
sc.SetState(SCE_T3_HTML_DEFAULT);
break;
case SCE_T3_HTML_DEFAULT:
if (lineState&T3_SINGLE_QUOTE) {
endState = SCE_T3_S_STRING;
chQuote = '\'';
chString = '"';
} else if (lineState&T3_INT_EXPRESSION) {
endState = SCE_T3_X_STRING;
} else {
endState = SCE_T3_D_STRING;
}
break;
}
while (sc.More()) {
if (IsEOL(sc.ch, sc.chNext)) {
return;
}
if (sc.Match('/', '>')) {
sc.SetState(SCE_T3_HTML_TAG);
sc.Forward(2);
sc.SetState(endState);
return;
}
if (sc.ch == '>') {
sc.SetState(SCE_T3_HTML_TAG);
sc.ForwardSetState(endState);
return;
}
if (sc.ch == chQuote) {
sc.SetState(endState);
return;
}
if (sc.ch == chString) {
ColouriseTADSHTMLString(sc, lineState);
} else if (sc.ch == '=') {
ColouriseTADS3Operator(sc);
} else {
sc.Forward();
}
}
}
static void ColouriseTADS3Keyword(StyleContext &sc,
WordList *keywordlists[], unsigned int endPos) {
char s[250];
WordList &keywords = *keywordlists[0];
WordList &userwords1 = *keywordlists[1];
WordList &userwords2 = *keywordlists[2];
WordList &userwords3 = *keywordlists[3];
int initState = sc.state;
sc.SetState(SCE_T3_IDENTIFIER);
while (sc.More() && (IsAWordChar(sc.ch))) {
sc.Forward();
}
sc.GetCurrent(s, sizeof(s));
if ( strcmp(s, "is") == 0 || strcmp(s, "not") == 0) {
// have to find if "in" is next
int n = 1;
while (n + sc.currentPos < endPos && IsASpaceOrTab(sc.GetRelative(n)))
n++;
if (sc.GetRelative(n) == 'i' && sc.GetRelative(n+1) == 'n') {
sc.Forward(n+2);
sc.ChangeState(SCE_T3_KEYWORD);
}
} else if (keywords.InList(s)) {
sc.ChangeState(SCE_T3_KEYWORD);
} else if (userwords3.InList(s)) {
sc.ChangeState(SCE_T3_USER3);
} else if (userwords2.InList(s)) {
sc.ChangeState(SCE_T3_USER2);
} else if (userwords1.InList(s)) {
sc.ChangeState(SCE_T3_USER1);
}
sc.SetState(initState);
}
static void ColouriseTADS3MsgParam(StyleContext &sc, int &lineState) {
int endState = sc.state;
int chQuote = '"';
switch (endState) {
case SCE_T3_S_STRING:
sc.SetState(SCE_T3_MSG_PARAM);
sc.Forward();
chQuote = '\'';
break;
case SCE_T3_D_STRING:
case SCE_T3_X_STRING:
sc.SetState(SCE_T3_MSG_PARAM);
sc.Forward();
break;
case SCE_T3_MSG_PARAM:
if (lineState&T3_SINGLE_QUOTE) {
endState = SCE_T3_S_STRING;
chQuote = '\'';
} else if (lineState&T3_INT_EXPRESSION) {
endState = SCE_T3_X_STRING;
} else {
endState = SCE_T3_D_STRING;
}
break;
}
while (sc.More() && sc.ch != '}' && sc.ch != chQuote) {
if (IsEOL(sc.ch, sc.chNext)) {
return;
}
if (sc.ch == '\\') {
sc.Forward();
}
sc.Forward();
}
if (sc.ch == chQuote) {
sc.SetState(endState);
} else {
sc.ForwardSetState(endState);
}
}
static void ColouriseTADS3LibDirective(StyleContext &sc, int &lineState) {
int initState = sc.state;
int chQuote = '"';
switch (initState) {
case SCE_T3_S_STRING:
sc.SetState(SCE_T3_LIB_DIRECTIVE);
sc.Forward(2);
chQuote = '\'';
break;
case SCE_T3_D_STRING:
sc.SetState(SCE_T3_LIB_DIRECTIVE);
sc.Forward(2);
break;
case SCE_T3_LIB_DIRECTIVE:
if (lineState&T3_SINGLE_QUOTE) {
initState = SCE_T3_S_STRING;
chQuote = '\'';
} else {
initState = SCE_T3_D_STRING;
}
break;
}
while (sc.More() && IsADirectiveChar(sc.ch)) {
if (IsEOL(sc.ch, sc.chNext)) {
return;
}
sc.Forward();
};
if (sc.ch == '>' || !sc.More()) {
sc.ForwardSetState(initState);
} else if (sc.ch == chQuote) {
sc.SetState(initState);
} else {
sc.ChangeState(initState);
sc.Forward();
}
}
static void ColouriseTADS3String(StyleContext &sc, int &lineState) {
int chQuote = sc.ch;
int endState = sc.state;
switch (sc.state) {
case SCE_T3_DEFAULT:
case SCE_T3_X_DEFAULT:
if (chQuote == '"') {
if (sc.state == SCE_T3_DEFAULT) {
sc.SetState(SCE_T3_D_STRING);
} else {
sc.SetState(SCE_T3_X_STRING);
}
lineState &= ~T3_SINGLE_QUOTE;
} else {
sc.SetState(SCE_T3_S_STRING);
lineState |= T3_SINGLE_QUOTE;
}
sc.Forward();
break;
case SCE_T3_S_STRING:
chQuote = '\'';
endState = lineState&T3_INT_EXPRESSION ?
SCE_T3_X_DEFAULT : SCE_T3_DEFAULT;
break;
case SCE_T3_D_STRING:
chQuote = '"';
endState = SCE_T3_DEFAULT;
break;
case SCE_T3_X_STRING:
chQuote = '"';
endState = SCE_T3_X_DEFAULT;
break;
}
while (sc.More()) {
if (IsEOL(sc.ch, sc.chNext)) {
return;
}
if (sc.ch == chQuote) {
sc.ForwardSetState(endState);
return;
}
if (sc.state == SCE_T3_D_STRING && sc.Match('<', '<')) {
lineState |= T3_INT_EXPRESSION;
sc.SetState(SCE_T3_X_DEFAULT);
sc.Forward(2);
return;
}
if (sc.Match('\\', static_cast<char>(chQuote))) {
sc.Forward(2);
} else if (sc.ch == '{') {
ColouriseTADS3MsgParam(sc, lineState);
} else if (sc.Match('<', '.')) {
ColouriseTADS3LibDirective(sc, lineState);
} else if (sc.ch == '<') {
ColouriseTADS3HTMLTag(sc, lineState);
} else {
sc.Forward();
}
}
}
static void ColouriseTADS3Comment(StyleContext &sc, int endState) {
sc.SetState(SCE_T3_BLOCK_COMMENT);
while (sc.More()) {
if (IsEOL(sc.ch, sc.chNext)) {
return;
}
if (sc.Match('*', '/')) {
sc.Forward(2);
sc.SetState(endState);
return;
}
sc.Forward();
}
}
static void ColouriseToEndOfLine(StyleContext &sc, int initState, int endState) {
sc.SetState(initState);
while (sc.More()) {
if (sc.ch == '\\') {
sc.Forward();
if (IsEOL(sc.ch, sc.chNext)) {
return;
}
}
if (IsEOL(sc.ch, sc.chNext)) {
sc.SetState(endState);
return;
}
sc.Forward();
}
}
static void ColouriseTADS3Number(StyleContext &sc) {
int endState = sc.state;
bool inHexNumber = false;
bool seenE = false;
bool seenDot = sc.ch == '.';
sc.SetState(SCE_T3_NUMBER);
if (sc.More()) {
sc.Forward();
}
if (sc.chPrev == '0' && tolower(sc.ch) == 'x') {
inHexNumber = true;
sc.Forward();
}
while (sc.More()) {
if (inHexNumber) {
if (!IsAHexDigit(sc.ch)) {
break;
}
} else if (!isdigit(sc.ch)) {
if (!seenE && tolower(sc.ch) == 'e') {
seenE = true;
seenDot = true;
if (sc.chNext == '+' || sc.chNext == '-') {
sc.Forward();
}
} else if (!seenDot && sc.ch == '.') {
seenDot = true;
} else {
break;
}
}
sc.Forward();
}
sc.SetState(endState);
}
static void ColouriseTADS3Doc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
int visibleChars = 0;
int bracketLevel = 0;
int lineState = 0;
unsigned int endPos = startPos + length;
int lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0) {
lineState = styler.GetLineState(lineCurrent-1);
}
StyleContext sc(startPos, length, initStyle, styler);
while (sc.More()) {
if (IsEOL(sc.ch, sc.chNext)) {
styler.SetLineState(lineCurrent, lineState);
lineCurrent++;
visibleChars = 0;
sc.Forward();
if (sc.ch == '\n') {
sc.Forward();
}
}
switch(sc.state) {
case SCE_T3_PREPROCESSOR:
case SCE_T3_LINE_COMMENT:
ColouriseToEndOfLine(sc, sc.state, lineState&T3_INT_EXPRESSION ?
SCE_T3_X_DEFAULT : SCE_T3_DEFAULT);
break;
case SCE_T3_S_STRING:
case SCE_T3_D_STRING:
case SCE_T3_X_STRING:
ColouriseTADS3String(sc, lineState);
visibleChars++;
break;
case SCE_T3_MSG_PARAM:
ColouriseTADS3MsgParam(sc, lineState);
break;
case SCE_T3_LIB_DIRECTIVE:
ColouriseTADS3LibDirective(sc, lineState);
break;
case SCE_T3_HTML_DEFAULT:
ColouriseTADS3HTMLTag(sc, lineState);
break;
case SCE_T3_HTML_STRING:
ColouriseTADSHTMLString(sc, lineState);
break;
case SCE_T3_BLOCK_COMMENT:
ColouriseTADS3Comment(sc, lineState&T3_INT_EXPRESSION ?
SCE_T3_X_DEFAULT : SCE_T3_DEFAULT);
break;
case SCE_T3_DEFAULT:
case SCE_T3_X_DEFAULT:
if (IsASpaceOrTab(sc.ch)) {
sc.Forward();
} else if (sc.ch == '#' && visibleChars == 0) {
ColouriseToEndOfLine(sc, SCE_T3_PREPROCESSOR, sc.state);
} else if (sc.Match('/', '*')) {
ColouriseTADS3Comment(sc, sc.state);
visibleChars++;
} else if (sc.Match('/', '/')) {
ColouriseToEndOfLine(sc, SCE_T3_LINE_COMMENT, sc.state);
} else if (sc.ch == '"') {
bracketLevel = 0;
ColouriseTADS3String(sc, lineState);
visibleChars++;
} else if (sc.ch == '\'') {
ColouriseTADS3String(sc, lineState);
visibleChars++;
} else if (sc.state == SCE_T3_X_DEFAULT && bracketLevel == 0
&& sc.Match('>', '>')) {
sc.Forward(2);
sc.SetState(SCE_T3_D_STRING);
lineState &= ~(T3_SINGLE_QUOTE|T3_INT_EXPRESSION);
} else if (IsATADS3Operator(sc.ch)) {
if (sc.state == SCE_T3_X_DEFAULT) {
if (sc.ch == '(') {
bracketLevel++;
} else if (sc.ch == ')') {
bracketLevel--;
}
}
ColouriseTADS3Operator(sc);
visibleChars++;
} else if (IsANumberStart(sc)) {
ColouriseTADS3Number(sc);
visibleChars++;
} else if (IsAWordStart(sc.ch)) {
ColouriseTADS3Keyword(sc, keywordlists, endPos);
visibleChars++;
} else if (sc.Match("...")) {
sc.SetState(SCE_T3_IDENTIFIER);
sc.Forward(3);
sc.SetState(SCE_T3_DEFAULT);
} else {
sc.Forward();
visibleChars++;
}
break;
default:
sc.SetState(SCE_T3_DEFAULT);
sc.Forward();
}
}
sc.Complete();
}
/*
TADS3 has two styles of top level block (TLB). Eg
// default style
silverKey : Key 'small silver key' 'small silver key'
"A small key glints in the sunlight. "
;
and
silverKey : Key {
'small silver key'
'small silver key'
"A small key glints in the sunlight. "
}
Some constructs mandate one or the other, but usually the author has may choose
either.
T3_SEENSTART is used to indicate that a braceless TLB has been (potentially)
seen and is also used to match the closing ';' of the default style.
T3_EXPECTINGIDENTIFIER and T3_EXPECTINGPUNCTUATION are used to keep track of
what characters may be seen without incrementing the block level. The general
pattern is identifier <punc> identifier, acceptable punctuation characters
are ':', ',', '(' and ')'. No attempt is made to ensure that punctuation
characters are syntactically correct, eg parentheses match. A ')' always
signifies the start of a block. We just need to check if it is followed by a
'{', in which case we let the brace handling code handle the folding level.
expectingIdentifier == false && expectingIdentifier == false
Before the start of a TLB.
expectingIdentifier == true && expectingIdentifier == true
Currently in an identifier. Will accept identifier or punctuation.
expectingIdentifier == true && expectingIdentifier == false
Just seen a punctuation character & now waiting for an identifier to start.
expectingIdentifier == false && expectingIdentifier == truee
We were in an identifier and have seen space. Now waiting to see a punctuation
character
Space, comments & preprocessor directives are always acceptable and are
equivalent.
*/
static const int T3_SEENSTART = 1 << 12;
static const int T3_EXPECTINGIDENTIFIER = 1 << 13;
static const int T3_EXPECTINGPUNCTUATION = 1 << 14;
static inline bool IsStringTransition(int s1, int s2) {
return s1 != s2
&& (s1 == SCE_T3_S_STRING || s1 == SCE_T3_X_STRING
|| s1 == SCE_T3_D_STRING && s2 != SCE_T3_X_DEFAULT)
&& s2 != SCE_T3_LIB_DIRECTIVE
&& s2 != SCE_T3_MSG_PARAM
&& s2 != SCE_T3_HTML_TAG
&& s2 != SCE_T3_HTML_STRING;
}
static inline bool IsATADS3Punctuation(const int ch) {
return ch == ':' || ch == ',' || ch == '(' || ch == ')';
}
static inline bool IsAnIdentifier(const int style) {
return style == SCE_T3_IDENTIFIER
|| style == SCE_T3_USER1
|| style == SCE_T3_USER2
|| style == SCE_T3_USER3;
}
static inline bool IsSpaceEquivalent(const int ch, const int style) {
return isspace(ch)
|| style == SCE_T3_BLOCK_COMMENT
|| style == SCE_T3_LINE_COMMENT
|| style == SCE_T3_PREPROCESSOR;
}
static char peekAhead(unsigned int startPos, unsigned int endPos,
Accessor &styler) {
for (unsigned int i = startPos; i < endPos; i++) {
int style = styler.StyleAt(i);
char ch = styler[i];
if (!IsSpaceEquivalent(ch, style)) {
if (IsAnIdentifier(style)) {
return 'a';
}
if (IsATADS3Punctuation(ch)) {
return ':';
}
if (ch == '{') {
return '{';
}
return '*';
}
}
return ' ';
}
static void FoldTADS3Doc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
unsigned int endPos = startPos + length;
int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
int seenStart = levelCurrent & T3_SEENSTART;
int expectingIdentifier = levelCurrent & T3_EXPECTINGIDENTIFIER;
int expectingPunctuation = levelCurrent & T3_EXPECTINGPUNCTUATION;
levelCurrent &= SC_FOLDLEVELNUMBERMASK;
int levelMinCurrent = levelCurrent;
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
char ch = chNext;
int stylePrev = style;
bool redo = false;
for (unsigned int i = startPos; i < endPos; i++) {
if (redo) {
redo = false;
i--;
} else {
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
}
bool atEOL = IsEOL(ch, chNext);
if (levelNext == SC_FOLDLEVELBASE) {
if (IsSpaceEquivalent(ch, style)) {
if (expectingPunctuation) {
expectingIdentifier = 0;
}
if (style == SCE_T3_BLOCK_COMMENT) {
levelNext++;
}
} else if (ch == '{') {
levelNext++;
seenStart = 0;
} else if (ch == '\'' || ch == '"' || ch == '[') {
levelNext++;
if (seenStart) {
redo = true;
}
} else if (ch == ';') {
seenStart = 0;
expectingIdentifier = 0;
expectingPunctuation = 0;
} else if (expectingIdentifier && expectingPunctuation) {
if (IsATADS3Punctuation(ch)) {
if (ch == ')' && peekAhead(i+1, endPos, styler) != '{') {
levelNext++;
} else {
expectingPunctuation = 0;
}
} else if (!IsAnIdentifier(style)) {
levelNext++;
}
} else if (expectingIdentifier && !expectingPunctuation) {
if (!IsAnIdentifier(style)) {
levelNext++;
} else {
expectingPunctuation = T3_EXPECTINGPUNCTUATION;
}
} else if (!expectingIdentifier && expectingPunctuation) {
if (!IsATADS3Punctuation(ch)) {
levelNext++;
} else {
if (ch == ')' && peekAhead(i+1, endPos, styler) != '{') {
levelNext++;
} else {
expectingIdentifier = T3_EXPECTINGIDENTIFIER;
expectingPunctuation = 0;
}
}
} else if (!expectingIdentifier && !expectingPunctuation) {
if (IsAnIdentifier(style)) {
seenStart = T3_SEENSTART;
expectingIdentifier = T3_EXPECTINGIDENTIFIER;
expectingPunctuation = T3_EXPECTINGPUNCTUATION;
}
}
if (levelNext != SC_FOLDLEVELBASE && style != SCE_T3_BLOCK_COMMENT) {
expectingIdentifier = 0;
expectingPunctuation = 0;
}
} else if (levelNext == SC_FOLDLEVELBASE+1 && seenStart
&& ch == ';' && style == SCE_T3_OPERATOR ) {
levelNext--;
seenStart = 0;
} else if (style == SCE_T3_BLOCK_COMMENT) {
if (stylePrev != SCE_T3_BLOCK_COMMENT) {
levelNext++;
} else if (styleNext != SCE_T3_BLOCK_COMMENT && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelNext--;
}
} else if (ch == '\'' || ch == '"') {
if (IsStringTransition(style, stylePrev)) {
if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
} else if (IsStringTransition(style, styleNext)) {
levelNext--;
}
} else if (style == SCE_T3_OPERATOR) {
if (ch == '{' || ch == '[') {
// Measure the minimum before a '{' to allow
// folding on "} else {"
if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
} else if (ch == '}' || ch == ']') {
levelNext--;
}
}
if (atEOL) {
if (seenStart && levelNext == SC_FOLDLEVELBASE) {
switch (peekAhead(i+1, endPos, styler)) {
case ' ':
case '{':
break;
case '*':
levelNext++;
break;
case 'a':
if (expectingPunctuation) {
levelNext++;
}
break;
case ':':
if (expectingIdentifier) {
levelNext++;
}
break;
}
if (levelNext != SC_FOLDLEVELBASE) {
expectingIdentifier = 0;
expectingPunctuation = 0;
}
}
int lev = levelMinCurrent | (levelNext | expectingIdentifier
| expectingPunctuation | seenStart) << 16;
if (levelMinCurrent < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelCurrent = levelNext;
levelMinCurrent = levelCurrent;
}
}
}
static const char * const tads3WordList[] = {
"TADS3 Keywords",
"User defined 1",
"User defined 2",
"User defined 3",
0
};
LexerModule lmTADS3(SCLEX_TADS3, ColouriseTADS3Doc, "tads3", FoldTADS3Doc, tads3WordList);

View File

@ -275,7 +275,7 @@ static void ColouriseTeXDoc(
// Hooks into the system:
static const char * const texWordListDesc[] = {
"TeX, eTeX, pdfTeX, Omega"
"TeX, eTeX, pdfTeX, Omega",
"ConTeXt Dutch",
"ConTeXt English",
"ConTeXt German",

View File

@ -2,7 +2,7 @@
/** @file LexVB.cxx
** Lexer for Visual Basic and VBScript.
**/
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
@ -20,8 +20,12 @@
#include "Scintilla.h"
#include "SciLexer.h"
// Internal state, highlighted as number
#define SCE_B_FILENUMBER SCE_B_DEFAULT+100
static bool IsVBComment(Accessor &styler, int pos, int len) {
return len>0 && styler[pos]=='\'';
return len > 0 && styler[pos] == '\'';
}
static inline bool IsTypeCharacter(int ch) {
@ -36,12 +40,15 @@ static inline bool IsAWordChar(int ch) {
static inline bool IsAWordStart(int ch) {
return ch >= 0x80 ||
(isalnum(ch) || ch == '_');
(isalpha(ch) || ch == '_');
}
static inline bool IsADateCharacter(const int ch) {
static inline bool IsANumberChar(int ch) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
(isalnum(ch) || ch == '|' || ch == '-' || ch == '/' || ch == ':' || ch == ' ' || ch == '\t');
(isdigit(ch) || toupper(ch) == 'E' ||
ch == '.' || ch == '-' || ch == '+');
}
static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
@ -55,6 +62,12 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
styler.StartAt(startPos);
int visibleChars = 0;
int fileNbDigits = 0;
// Do not leak onto next line
if (initStyle == SCE_B_STRINGEOL || initStyle == SCE_B_COMMENT || initStyle == SCE_B_PREPROCESSOR) {
initStyle = SCE_B_DEFAULT;
}
StyleContext sc(startPos, length, initStyle, styler);
@ -96,7 +109,9 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
}
}
} else if (sc.state == SCE_B_NUMBER) {
if (!IsAWordChar(sc.ch)) {
// We stop the number definition on non-numerical non-dot non-eE non-sign char
// Also accepts A-F for hex. numbers
if (!IsANumberChar(sc.ch) && !(tolower(sc.ch) >= 'a' && tolower(sc.ch) <= 'f')) {
sc.SetState(SCE_B_DEFAULT);
}
} else if (sc.state == SCE_B_STRING) {
@ -113,14 +128,38 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
}
} else if (sc.state == SCE_B_COMMENT) {
if (sc.atLineEnd) {
sc.SetState(SCE_B_DEFAULT);
sc.ForwardSetState(SCE_B_DEFAULT);
}
} else if (sc.state == SCE_B_PREPROCESSOR) {
if (sc.atLineEnd) {
sc.ForwardSetState(SCE_B_DEFAULT);
}
} else if (sc.state == SCE_B_FILENUMBER) {
if (IsADigit(sc.ch)) {
fileNbDigits++;
if (fileNbDigits > 3) {
sc.ChangeState(SCE_B_DATE);
}
} else if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ',') {
// Regular uses: Close #1; Put #1, ...; Get #1, ... etc.
// Too bad if date is format #27, Oct, 2003# or something like that...
// Use regular number state
sc.ChangeState(SCE_B_NUMBER);
sc.SetState(SCE_B_DEFAULT);
} else if (sc.ch == '#') {
sc.ChangeState(SCE_B_DATE);
sc.ForwardSetState(SCE_B_DEFAULT);
} else {
sc.ChangeState(SCE_B_DATE);
}
if (sc.state != SCE_B_FILENUMBER) {
fileNbDigits = 0;
}
} else if (sc.state == SCE_B_DATE) {
if (sc.ch == '#' || !IsADateCharacter(sc.chNext)) {
if (sc.atLineEnd) {
sc.ChangeState(SCE_B_STRINGEOL);
sc.ForwardSetState(SCE_B_DEFAULT);
} else if (sc.ch == '#') {
sc.ForwardSetState(SCE_B_DEFAULT);
}
}
@ -134,26 +173,24 @@ static void ColouriseVBDoc(unsigned int startPos, int length, int initStyle,
// Preprocessor commands are alone on their line
sc.SetState(SCE_B_PREPROCESSOR);
} else if (sc.ch == '#') {
int n = 1;
int chSeek = ' ';
while ((n < 100) && (chSeek == ' ' || chSeek == '\t')) {
chSeek = sc.GetRelative(n);
n++;
}
if (IsADigit(chSeek)) {
sc.SetState(SCE_B_DATE);
} else {
sc.SetState(SCE_B_OPERATOR);
}
// It can be a date literal, ending with #, or a file number, from 1 to 511
// The date literal depends on the locale, so anything can go between #'s.
// Can be #January 1, 1993# or #1 Jan 93# or #05/11/2003#, etc.
// So we set the FILENUMBER state, and switch to DATE if it isn't a file number
sc.SetState(SCE_B_FILENUMBER);
} else if (sc.ch == '&' && tolower(sc.chNext) == 'h') {
// Hexadecimal number
sc.SetState(SCE_B_NUMBER);
sc.Forward();
} else if (sc.ch == '&' && tolower(sc.chNext) == 'o') {
// Octal number
sc.SetState(SCE_B_NUMBER);
sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_B_NUMBER);
} else if (IsAWordStart(sc.ch) || (sc.ch == '[')) {
sc.SetState(SCE_B_IDENTIFIER);
} else if (isoperator(static_cast<char>(sc.ch)) || (sc.ch == '\\')) {
} else if (isoperator(static_cast<char>(sc.ch)) || (sc.ch == '\\')) { // Integer division
sc.SetState(SCE_B_OPERATOR);
}
}

View File

@ -282,7 +282,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
surface->LineTo(right - 5, centreY + 5);
right += 4;
}
} else { // SC_MARK_SHORTARROW
} else if (markType == SC_MARK_SHORTARROW) {
Point pts[] = {
Point(centreX, centreY + dimOn2),
Point(centreX + dimOn2, centreY),
@ -295,5 +295,7 @@ void LineMarker::Draw(Surface *surface, PRectangle &rcWhole, Font &fontForCharac
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
fore.allocated, back.allocated);
} else { // SC_MARK_FULLRECT
surface->FillRectangle(rcWhole, back.allocated);
}
}

View File

@ -329,6 +329,8 @@ char *SContainer::StringAllocate(const char *s, lenpos_t len) {
// End SString functions
bool PropSet::caseSensitiveFilenames = false;
PropSet::PropSet() {
superPS = 0;
for (int root = 0; root < hashRoots; root++)
@ -459,7 +461,7 @@ struct VarChain {
VarChain(const char*var_=NULL, const VarChain *link_=NULL): var(var_), link(link_) {}
bool contains(const char *testVar) const {
return (var && (0 == strcmp(var, testVar)))
return (var && (0 == strcmp(var, testVar)))
|| (link && link->contains(testVar));
}
@ -536,16 +538,23 @@ bool isprefix(const char *target, const char *prefix) {
return true;
}
static bool IsSuffixCaseInsensitive(const char *target, const char *suffix) {
static bool IsSuffix(const char *target, const char *suffix, bool caseSensitive) {
size_t lentarget = strlen(target);
size_t lensuffix = strlen(suffix);
if (lensuffix > lentarget)
return false;
if (caseSensitive) {
for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) {
if (target[i + lentarget - lensuffix] != suffix[i])
return false;
}
} else {
for (int i = static_cast<int>(lensuffix) - 1; i >= 0; i--) {
if (MakeUpperCase(target[i + lentarget - lensuffix]) !=
MakeUpperCase(suffix[i]))
return false;
}
}
return true;
}
@ -577,7 +586,7 @@ SString PropSet::GetWild(const char *keybase, const char *filename) {
char delchr = *del;
*del = '\0';
if (*keyfile == '*') {
if (IsSuffixCaseInsensitive(filename, keyfile + 1)) {
if (IsSuffix(filename, keyfile + 1, caseSensitiveFilenames)) {
*del = delchr;
delete []keyptr;
return p->val;
@ -790,11 +799,13 @@ void WordList::Clear() {
list = 0;
len = 0;
sorted = false;
sortedNoCase = false;
}
void WordList::Set(const char *s) {
list = StringDup(s);
sorted = false;
sortedNoCase = false;
words = ArrayFromWordList(list, &len, onlyLineEnds);
wordsNoCase = new char * [len + 1];
memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
@ -808,6 +819,7 @@ char *WordList::Allocate(int size) {
void WordList::SetFromAllocated() {
sorted = false;
sortedNoCase = false;
words = ArrayFromWordList(list, &len, onlyLineEnds);
wordsNoCase = new char * [len + 1];
memcpy(wordsNoCase, words, (len + 1) * sizeof (*words));
@ -823,9 +835,12 @@ int cmpStringNoCase(const void *a1, const void *a2) {
return CompareCaseInsensitive(*(char**)(a1), *(char**)(a2));
}
static void SortWordList(char **words, char **wordsNoCase, unsigned int len) {
static void SortWordList(char **words, unsigned int len) {
qsort(reinterpret_cast<void*>(words), len, sizeof(*words),
cmpString);
}
static void SortWordListNoCase(char **wordsNoCase, unsigned int len) {
qsort(reinterpret_cast<void*>(wordsNoCase), len, sizeof(*wordsNoCase),
cmpStringNoCase);
}
@ -835,7 +850,7 @@ bool WordList::InList(const char *s) {
return false;
if (!sorted) {
sorted = true;
SortWordList(words, wordsNoCase, len);
SortWordList(words, len);
for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
starts[k] = -1;
for (int l = len - 1; l >= 0; l--) {
@ -877,6 +892,68 @@ bool WordList::InList(const char *s) {
return false;
}
/** similar to InList, but word s can be a substring of keyword.
* eg. the keyword define is defined as def~ine. This means the word must start
* with def to be a keyword, but also defi, defin and define are valid.
* The marker is ~ in this case.
*/
bool WordList::InListAbbreviated(const char *s, const char marker) {
if (0 == words)
return false;
if (!sorted) {
sorted = true;
SortWordList(words, len);
for (unsigned int k = 0; k < (sizeof(starts) / sizeof(starts[0])); k++)
starts[k] = -1;
for (int l = len - 1; l >= 0; l--) {
unsigned char indexChar = words[l][0];
starts[indexChar] = l;
}
}
unsigned char firstChar = s[0];
int j = starts[firstChar];
if (j >= 0) {
while (words[j][0] == firstChar) {
bool isSubword = false;
int start = 1;
if (words[j][1] == marker) {
isSubword = true;
start++;
}
if (s[1] == words[j][start]) {
const char *a = words[j] + start;
const char *b = s + 1;
while (*a && *a == *b) {
a++;
if (*a == marker) {
isSubword = true;
a++;
}
b++;
}
if ((!*a || isSubword) && !*b)
return true;
}
j++;
}
}
j = starts['^'];
if (j >= 0) {
while (words[j][0] == '^') {
const char *a = words[j] + 1;
const char *b = s;
while (*a && *a == *b) {
a++;
b++;
}
if (!*a)
return true;
j++;
}
}
return false;
}
/**
* Returns an element (complete) of the wordlist array which has
* the same beginning as the passed string.
@ -892,11 +969,11 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen, bool
if (0 == words)
return NULL;
if (!sorted) {
sorted = true;
SortWordList(words, wordsNoCase, len);
}
if (ignoreCase) {
if (!sortedNoCase) {
sortedNoCase = true;
SortWordListNoCase(wordsNoCase, len);
}
while (start <= end) { // binary searching loop
pivot = (start + end) >> 1;
word = wordsNoCase[pivot];
@ -912,7 +989,7 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen, bool
while (end < len-1 && !CompareNCaseInsensitive(wordStart, wordsNoCase[end+1], searchLen)) {
end++;
}
// Finds first word in a series of equal words
for (pivot = start; pivot <= end; pivot++) {
word = wordsNoCase[pivot];
@ -930,6 +1007,10 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen, bool
end = pivot - 1;
}
} else { // preserve the letter case
if (!sorted) {
sorted = true;
SortWordList(words, len);
}
while (start <= end) { // binary searching loop
pivot = (start + end) >> 1;
word = words[pivot];
@ -945,7 +1026,7 @@ const char *WordList::GetNearestWord(const char *wordStart, int searchLen, bool
while (end < len-1 && !strncmp(wordStart, words[end+1], searchLen)) {
end++;
}
// Finds first word in a series of equal words
pivot = start;
while (pivot <= end) {
@ -1020,11 +1101,11 @@ char *WordList::GetNearestWords(
if (0 == words)
return NULL;
if (!sorted) {
sorted = true;
SortWordList(words, wordsNoCase, len);
}
if (ignoreCase) {
if (!sortedNoCase) {
sortedNoCase = true;
SortWordListNoCase(wordsNoCase, len);
}
while (start <= end) { // Binary searching loop
pivot = (start + end) / 2;
cond = CompareNCaseInsensitive(wordStart, wordsNoCase[pivot], searchLen);
@ -1053,6 +1134,10 @@ char *WordList::GetNearestWords(
}
}
} else { // Preserve the letter case
if (!sorted) {
sorted = true;
SortWordList(words, len);
}
while (start <= end) { // Binary searching loop
pivot = (start + end) / 2;
cond = strncmp(wordStart, words[pivot], searchLen);

View File

@ -20,6 +20,8 @@
class CharacterIndexer {
public:
virtual char CharAt(int index)=0;
virtual ~CharacterIndexer() {
}
};
class RESearch {

View File

@ -38,8 +38,10 @@
ScintillaBase::ScintillaBase() {
displayPopupMenu = true;
listType = 0;
maxListWidth = 0;
#ifdef SCI_LEXER
lexLanguage = SCLEX_CONTAINER;
performingStyle = false;
lexCurrent = 0;
for (int wl = 0;wl < numWordLists;wl++)
keyWordLists[wl] = new WordList;
@ -214,7 +216,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
return;
}
}
ac.Start(wMain, idAutoComplete, currentPos, lenEntered, vs.lineHeight, IsUnicodeMode());
ac.Start(wMain, idAutoComplete, currentPos, LocationFromPosition(currentPos),
lenEntered, vs.lineHeight, IsUnicodeMode());
PRectangle rcClient = GetClientRectangle();
Point pt = LocationFromPosition(currentPos - lenEntered);
@ -242,7 +245,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
rcac.bottom = Platform::Minimum(rcac.top + heightLB, rcClient.bottom);
ac.lb->SetPositionRelative(rcac, wMain);
ac.lb->SetFont(vs.styles[STYLE_DEFAULT].font);
ac.lb->SetAverageCharWidth(vs.styles[STYLE_DEFAULT].aveCharWidth);
unsigned int aveCharWidth = vs.styles[STYLE_DEFAULT].aveCharWidth;
ac.lb->SetAverageCharWidth(aveCharWidth);
ac.lb->SetDoubleClickAction(AutoCompleteDoubleClick, this);
ac.SetList(list);
@ -251,6 +255,8 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
PRectangle rcList = ac.lb->GetDesiredRect();
int heightAlloced = rcList.bottom - rcList.top;
widthLB = Platform::Maximum(widthLB, rcList.right - rcList.left);
if (maxListWidth != 0)
widthLB = Platform::Minimum(widthLB, aveCharWidth*maxListWidth);
// Make an allowance for large strings in list
rcList.left = pt.x - ac.lb->CaretFromEdge();
rcList.right = rcList.left + widthLB;
@ -262,7 +268,7 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
}
rcList.bottom = rcList.top + heightAlloced;
ac.lb->SetPositionRelative(rcList, wMain);
ac.Show();
ac.Show(true);
if (lenEntered != 0) {
AutoCompleteMoveToCurrentWord();
}
@ -312,25 +318,31 @@ void ScintillaBase::AutoCompleteCompleted() {
selected[0] = '\0';
if (item != -1) {
ac.lb->GetValue(item, selected, sizeof(selected));
}
ac.Cancel();
if (item == -1)
return;
if (listType > 0) {
userListSelected = selected;
SCNotification scn;
scn.nmhdr.code = SCN_USERLISTSELECTION;
scn.message = 0;
scn.wParam = listType;
scn.listType = listType;
scn.lParam = 0;
scn.text = userListSelected.c_str();
NotifyParent(scn);
} else {
ac.Cancel();
return;
}
ac.Show(false);
listSelected = selected;
SCNotification scn = {0};
scn.nmhdr.code = listType > 0 ? SCN_USERLISTSELECTION : SCN_AUTOCSELECTION;
scn.message = 0;
scn.wParam = listType;
scn.listType = listType;
Position firstPos = ac.posStart - ac.startLen;
scn.lParam = firstPos;
scn.text = listSelected.c_str();
NotifyParent(scn);
if (!ac.Active())
return;
ac.Cancel();
if (listType > 0)
return;
Position endPos = currentPos;
if (ac.dropRestOfWord)
endPos = pdoc->ExtendWordSelect(endPos, 1, true);
@ -378,7 +390,7 @@ void ScintillaBase::CallTipShow(Point pt, const char *defn) {
}
void ScintillaBase::CallTipClick() {
SCNotification scn;
SCNotification scn = {0};
scn.nmhdr.code = SCN_CALLTIPCLICK;
scn.position = ct.clickPlace;
NotifyParent(scn);
@ -430,29 +442,38 @@ void ScintillaBase::SetLexerLanguage(const char *languageName) {
}
void ScintillaBase::Colourise(int start, int end) {
int lengthDoc = pdoc->Length();
if (end == -1)
end = lengthDoc;
int len = end - start;
if (!performingStyle) {
// Protect against reentrance, which may occur, for example, when
// fold points are discovered while performing styling and the folding
// code looks for child lines which may trigger styling.
performingStyle = true;
PLATFORM_ASSERT(len >= 0);
PLATFORM_ASSERT(start + len <= lengthDoc);
int lengthDoc = pdoc->Length();
if (end == -1)
end = lengthDoc;
int len = end - start;
//WindowAccessor styler(wMain.GetID(), props);
DocumentAccessor styler(pdoc, props, wMain.GetID());
PLATFORM_ASSERT(len >= 0);
PLATFORM_ASSERT(start + len <= lengthDoc);
int styleStart = 0;
if (start > 0)
styleStart = styler.StyleAt(start - 1);
styler.SetCodePage(pdoc->dbcsCodePage);
//WindowAccessor styler(wMain.GetID(), props);
DocumentAccessor styler(pdoc, props, wMain.GetID());
if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available
lexCurrent->Lex(start, len, styleStart, keyWordLists, styler);
styler.Flush();
if (styler.GetPropertyInt("fold")) {
lexCurrent->Fold(start, len, styleStart, keyWordLists, styler);
int styleStart = 0;
if (start > 0)
styleStart = styler.StyleAt(start - 1);
styler.SetCodePage(pdoc->dbcsCodePage);
if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available
lexCurrent->Lex(start, len, styleStart, keyWordLists, styler);
styler.Flush();
if (styler.GetPropertyInt("fold")) {
lexCurrent->Fold(start, len, styleStart, keyWordLists, styler);
styler.Flush();
}
}
performingStyle = false;
}
}
#endif
@ -553,6 +574,20 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
case SCI_AUTOCGETDROPRESTOFWORD:
return ac.dropRestOfWord;
case SCI_AUTOCSETMAXHEIGHT:
ac.lb->SetVisibleRows(wParam);
break;
case SCI_AUTOCGETMAXHEIGHT:
return ac.lb->GetVisibleRows();
case SCI_AUTOCSETMAXWIDTH:
maxListWidth = wParam;
break;
case SCI_AUTOCGETMAXWIDTH:
return maxListWidth;
case SCI_REGISTERIMAGE:
ac.lb->RegisterImage(wParam, reinterpret_cast<const char *>(lParam));
break;
@ -616,7 +651,12 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
return lexLanguage;
case SCI_COLOURISE:
Colourise(wParam, lParam);
if (lexLanguage == SCLEX_CONTAINER) {
pdoc->ModifiedAt(wParam);
NotifyStyleToNeeded((lParam == -1) ? pdoc->Length() : lParam);
} else {
Colourise(wParam, lParam);
}
Redraw();
break;
@ -625,6 +665,31 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
reinterpret_cast<const char *>(lParam));
break;
case SCI_GETPROPERTY: {
SString val = props.Get(reinterpret_cast<const char *>(wParam));
const int n = val.length();
if (lParam != 0) {
char *ptr = reinterpret_cast<char *>(lParam);
memcpy(ptr, val.c_str(), n);
ptr[n] = '\0'; // terminate
}
return n; // Not including NUL
}
case SCI_GETPROPERTYEXPANDED: {
SString val = props.GetExpanded(reinterpret_cast<const char *>(wParam));
const int n = val.length();
if (lParam != 0) {
char *ptr = reinterpret_cast<char *>(lParam);
memcpy(ptr, val.c_str(), n);
ptr[n] = '\0'; // terminate
}
return n; // Not including NUL
}
case SCI_GETPROPERTYINT:
return props.GetInt(reinterpret_cast<const char *>(wParam), lParam);
case SCI_SETKEYWORDS:
if (wParam < numWordLists) {
keyWordLists[wParam]->Clear();
@ -636,6 +701,8 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
SetLexerLanguage(reinterpret_cast<const char *>(lParam));
break;
case SCI_GETSTYLEBITSNEEDED:
return lexCurrent ? lexCurrent->GetStyleBitsNeeded() : 5;
#endif
default:

View File

@ -37,7 +37,10 @@ protected:
CallTip ct;
int listType; ///< 0 is an autocomplete list
SString userListSelected; ///< Receives listbox selected string
SString listSelected; ///< Receives listbox selected string
int maxListWidth; /// Maximum width of list, in average character widths
bool performingStyle; ///< Prevent reentrance
#ifdef SCI_LEXER
int lexLanguage;

View File

@ -45,7 +45,7 @@ public:
currentPos(startPos),
atLineStart(true),
atLineEnd(false),
state(initStyle),
state(initStyle & chMask), // Mask off all bits which aren't in the chMask.
chPrev(0),
ch(0),
chNext(0) {
@ -104,7 +104,7 @@ public:
return currentPos - styler.GetStartSegment();
}
int GetRelative(int n) {
return styler.SafeGetCharAt(currentPos+n);
return static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n));
}
bool Match(char ch0) {
return ch == ch0;
@ -134,7 +134,8 @@ public:
return false;
s++;
for (int n=2; *s; n++) {
if (*s != tolower((styler.SafeGetCharAt(currentPos+n))))
if (*s !=
tolower(static_cast<unsigned char>(styler.SafeGetCharAt(currentPos+n))))
return false;
s++;
}

View File

@ -103,6 +103,11 @@ void XPM::Init(const char * const *linesForm) {
height = atoi(line0);
line0 = NextField(line0);
nColours = atoi(line0);
line0 = NextField(line0);
if (atoi(line0) != 1) {
// Only one char per pixel is supported
return;
}
codes = new char[nColours];
colours = new ColourPair[nColours];
@ -261,6 +266,7 @@ void XPMSet::Add(int id, const char *textForm) {
for (int i = 0; i < len; i++) {
if (set[i]->GetId() == id) {
set[i]->Init(textForm);
set[i]->CopyDesiredColours();
return;
}
}

View File

@ -96,6 +96,7 @@ DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION )
@ -529,6 +530,11 @@ void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp)
}
// Add a set of markers to a line.
void wxStyledTextCtrl::MarkerAddSet(int line, int set) {
SendMsg(2466, line, set);
}
// Set a margin to be either numeric or symbolic.
void wxStyledTextCtrl::SetMarginType(int margin, int marginType) {
SendMsg(2240, margin, marginType);
@ -926,6 +932,28 @@ void wxStyledTextCtrl::AutoCompSetTypeSeparator(int separatorCharacter) {
SendMsg(2286, separatorCharacter, 0);
}
// Set the maximum width, in characters, of auto-completion and user lists.
// Set to 0 to autosize to fit longest item, which is the default.
void wxStyledTextCtrl::AutoCompSetMaxWidth(int characterCount) {
SendMsg(2208, characterCount, 0);
}
// Get the maximum width, in characters, of auto-completion and user lists.
int wxStyledTextCtrl::AutoCompGetMaxWidth() {
return SendMsg(2209, 0, 0);
}
// Set the maximum height, in rows, of auto-completion and user lists.
// The default is 5 rows.
void wxStyledTextCtrl::AutoCompSetMaxHeight(int rowCount) {
SendMsg(2210, rowCount, 0);
}
// Set the maximum height, in rows, of auto-completion and user lists.
int wxStyledTextCtrl::AutoCompGetMaxHeight() {
return SendMsg(2211, 0, 0);
}
// Set the number of spaces used for one level of indentation.
void wxStyledTextCtrl::SetIndent(int indentSize) {
SendMsg(2122, indentSize, 0);
@ -1427,6 +1455,11 @@ int wxStyledTextCtrl::DocLineFromVisible(int lineDisplay) {
return SendMsg(2221, lineDisplay, 0);
}
// The number of display lines needed to wrap a document line
int wxStyledTextCtrl::WrapCount(int line) {
return SendMsg(2235, line, 0);
}
// Set the fold level of a line.
// This encodes an integer level along with flags indicating whether the
// line is a header and whether it is effectively white space.
@ -1611,8 +1644,8 @@ void wxStyledTextCtrl::SetEndAtLastLine(bool endAtLastLine) {
// Retrieve whether the maximum scroll position has the last
// line at the bottom of the view.
int wxStyledTextCtrl::GetEndAtLastLine() {
return SendMsg(2278, 0, 0);
bool wxStyledTextCtrl::GetEndAtLastLine() {
return SendMsg(2278, 0, 0) != 0;
}
// Retrieve the height of a particular line of text in pixels.
@ -2412,12 +2445,42 @@ void wxStyledTextCtrl::Allocate(int bytes) {
SendMsg(2446, bytes, 0);
}
// Find the position of a column on a line taking into account tabs and
// Find the position of a column on a line taking into account tabs and
// multi-byte characters. If beyond end of line, return line end position.
int wxStyledTextCtrl::FindColumn(int line, int column) {
return SendMsg(2456, line, column);
}
// Can the caret preferred x position only be changed by explicit movement commands?
bool wxStyledTextCtrl::GetCaretSticky() {
return SendMsg(2457, 0, 0) != 0;
}
// Stop the caret preferred x position changing when the user types.
void wxStyledTextCtrl::SetCaretSticky(bool useCaretStickyBehaviour) {
SendMsg(2458, useCaretStickyBehaviour, 0);
}
// Switch between sticky and non-sticky: meant to be bound to a key.
void wxStyledTextCtrl::ToggleCaretSticky() {
SendMsg(2459, 0, 0);
}
// Enable/Disable convert-on-paste for line endings
void wxStyledTextCtrl::SetPasteConvertEndings(bool convert) {
SendMsg(2467, convert, 0);
}
// Get convert-on-paste setting
bool wxStyledTextCtrl::GetPasteConvertEndings() {
return SendMsg(2468, 0, 0) != 0;
}
// Duplicate the selection. If selection empty duplicate the line containing the caret.
void wxStyledTextCtrl::SelectionDuplicate() {
SendMsg(2469, 0, 0);
}
// Start notifying the container of all key presses and commands.
void wxStyledTextCtrl::StartRecord() {
SendMsg(3001, 0, 0);
@ -2458,6 +2521,44 @@ void wxStyledTextCtrl::SetLexerLanguage(const wxString& language) {
SendMsg(4006, 0, (long)(const char*)wx2stc(language));
}
// Retrieve a 'property' value previously set with SetProperty.
wxString wxStyledTextCtrl::GetProperty(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTY, (long)(const char*)wx2stc(key), NULL);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(4008, (long)(const char*)wx2stc(key), (long)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
}
// Retrieve a 'property' value previously set with SetProperty,
// with '$()' variable replacement on returned buffer.
wxString wxStyledTextCtrl::GetPropertyExpanded(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTYEXPANDED, (long)(const char*)wx2stc(key), NULL);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(4009, (long)(const char*)wx2stc(key), (long)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);
}
// Retrieve a 'property' value previously set with SetProperty,
// interpreted as an int AFTER any '$()' variable replacement.
int wxStyledTextCtrl::GetPropertyInt(const wxString& key) {
return SendMsg(4010, (long)(const char*)wx2stc(key), 0);
}
// Retrieve the number of bits the current lexer needs for styling.
int wxStyledTextCtrl::GetStyleBitsNeeded() {
return SendMsg(4011, 0, 0);
}
// END of generated section
//----------------------------------------------------------------------
@ -2634,6 +2735,14 @@ void wxStyledTextCtrl::StyleSetCharacterSet(int style, int characterSet)
case wxSTC_CHARSET_THAI:
encoding = wxFONTENCODING_ISO8859_11;
break;
case wxSTC_CHARSET_CYRILLIC:
encoding = wxFONTENCODING_ISO8859_5;
break;
case wxSTC_CHARSET_8859_15:
encoding = wxFONTENCODING_ISO8859_15;;
break;
}
// We just have Scintilla track the wxFontEncoding for us. It gets used
@ -3199,6 +3308,10 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
break;
case SCN_AUTOCSELECTION:
evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION);
break;
default:
return;
}

View File

@ -96,6 +96,7 @@ DEFINE_EVENT_TYPE( wxEVT_STC_ZOOM )
DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_CLICK )
DEFINE_EVENT_TYPE( wxEVT_STC_HOTSPOT_DCLICK )
DEFINE_EVENT_TYPE( wxEVT_STC_CALLTIP_CLICK )
DEFINE_EVENT_TYPE( wxEVT_STC_AUTOCOMP_SELECTION )
@ -402,6 +403,14 @@ void wxStyledTextCtrl::StyleSetCharacterSet(int style, int characterSet)
case wxSTC_CHARSET_THAI:
encoding = wxFONTENCODING_ISO8859_11;
break;
case wxSTC_CHARSET_CYRILLIC:
encoding = wxFONTENCODING_ISO8859_5;
break;
case wxSTC_CHARSET_8859_15:
encoding = wxFONTENCODING_ISO8859_15;;
break;
}
// We just have Scintilla track the wxFontEncoding for us. It gets used
@ -967,6 +976,10 @@ void wxStyledTextCtrl::NotifyParent(SCNotification* _scn) {
evt.SetEventType(wxEVT_STC_CALLTIP_CLICK);
break;
case SCN_AUTOCSELECTION:
evt.SetEventType(wxEVT_STC_AUTOCOMP_SELECTION);
break;
default:
return;
}

View File

@ -445,6 +445,7 @@ BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_CLICK, 1673)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_DCLICK, 1674)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, 1675)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, 1676)
END_DECLARE_EVENT_TYPES()
#else
enum {
@ -472,7 +473,8 @@ END_DECLARE_EVENT_TYPES()
wxEVT_STC_ZOOM,
wxEVT_STC_HOTSPOT_CLICK,
wxEVT_STC_HOTSPOT_DCLICK,
wxEVT_STC_CALLTIP_CLICK
wxEVT_STC_CALLTIP_CLICK,
wxEVT_STC_AUTOCOMP_SELECTION
};
#endif
@ -506,7 +508,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#define EVT_STC_HOTSPOT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#define EVT_STC_HOTSPOT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#define EVT_STC_CALLTIP_CLICK(id, fn)) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_SELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#endif
//----------------------------------------------------------------------
@ -515,9 +517,9 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#ifndef SWIG
#if wxUSE_UNICODE
wxString stc2wx(const char* str);
wxString stc2wx(const char* str, size_t len);
const wxWX2MBbuf wx2stc(const wxString& str);
WXDLLIMPEXP_STC wxString stc2wx(const char* str);
WXDLLIMPEXP_STC wxString stc2wx(const char* str, size_t len);
WXDLLIMPEXP_STC const wxWX2MBbuf wx2stc(const wxString& str);
#else // not UNICODE

View File

@ -106,6 +106,7 @@
#define wxSTC_MARK_DOTDOTDOT 23
#define wxSTC_MARK_ARROWS 24
#define wxSTC_MARK_PIXMAP 25
#define wxSTC_MARK_FULLRECT 26
#define wxSTC_MARK_CHARACTER 10000
// Markers used for outlining column.
@ -144,6 +145,7 @@
#define wxSTC_CHARSET_MAC 77
#define wxSTC_CHARSET_OEM 255
#define wxSTC_CHARSET_RUSSIAN 204
#define wxSTC_CHARSET_CYRILLIC 1251
#define wxSTC_CHARSET_SHIFTJIS 128
#define wxSTC_CHARSET_SYMBOL 2
#define wxSTC_CHARSET_TURKISH 162
@ -152,6 +154,7 @@
#define wxSTC_CHARSET_ARABIC 178
#define wxSTC_CHARSET_VIETNAMESE 163
#define wxSTC_CHARSET_THAI 222
#define wxSTC_CHARSET_8859_15 1000
#define wxSTC_CASE_MIXED 0
#define wxSTC_CASE_UPPER 1
#define wxSTC_CASE_LOWER 2
@ -204,6 +207,7 @@
#define wxSTC_TIME_FOREVER 10000000
#define wxSTC_WRAP_NONE 0
#define wxSTC_WRAP_WORD 1
#define wxSTC_WRAP_CHAR 2
#define wxSTC_WRAPVISUALFLAG_NONE 0x0000
#define wxSTC_WRAPVISUALFLAG_END 0x0001
#define wxSTC_WRAPVISUALFLAG_START 0x0002
@ -269,11 +273,13 @@
#define wxSTC_PERFORMED_USER 0x10
#define wxSTC_PERFORMED_UNDO 0x20
#define wxSTC_PERFORMED_REDO 0x40
#define wxSTC_MULTISTEPUNDOREDO 0x80
#define wxSTC_LASTSTEPINUNDOREDO 0x100
#define wxSTC_MOD_CHANGEMARKER 0x200
#define wxSTC_MOD_BEFOREINSERT 0x400
#define wxSTC_MOD_BEFOREDELETE 0x800
#define wxSTC_MODEVENTMASKALL 0xF77
#define wxSTC_MULTILINEUNDOREDO 0x1000
#define wxSTC_MODEVENTMASKALL 0x1FFF
// Symbolic key codes and modifier flags.
// ASCII and other printable characters below 256.
@ -295,6 +301,7 @@
#define wxSTC_KEY_ADD 310
#define wxSTC_KEY_SUBTRACT 311
#define wxSTC_KEY_DIVIDE 312
#define wxSTC_SCMOD_NORM 0
#define wxSTC_SCMOD_SHIFT 1
#define wxSTC_SCMOD_CTRL 2
#define wxSTC_SCMOD_ALT 4
@ -329,8 +336,6 @@
#define wxSTC_LEX_NNCRONTAB 26
#define wxSTC_LEX_BULLANT 27
#define wxSTC_LEX_VBSCRIPT 28
#define wxSTC_LEX_ASP 29
#define wxSTC_LEX_PHP 30
#define wxSTC_LEX_BAAN 31
#define wxSTC_LEX_MATLAB 32
#define wxSTC_LEX_SCRIPTOL 33
@ -365,6 +370,17 @@
#define wxSTC_LEX_BASH 62
#define wxSTC_LEX_ASN1 63
#define wxSTC_LEX_VHDL 64
#define wxSTC_LEX_CAML 65
#define wxSTC_LEX_BLITZBASIC 66
#define wxSTC_LEX_PUREBASIC 67
#define wxSTC_LEX_HASKELL 68
#define wxSTC_LEX_PHPSCRIPT 69
#define wxSTC_LEX_TADS3 70
#define wxSTC_LEX_REBOL 71
#define wxSTC_LEX_SMALLTALK 72
#define wxSTC_LEX_FLAGSHIP 73
#define wxSTC_LEX_CSOUND 74
#define wxSTC_LEX_FREEBASIC 75
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -385,6 +401,8 @@
#define wxSTC_P_IDENTIFIER 11
#define wxSTC_P_COMMENTBLOCK 12
#define wxSTC_P_STRINGEOL 13
#define wxSTC_P_WORD2 14
#define wxSTC_P_DECORATOR 15
// Lexical states for SCLEX_CPP
#define wxSTC_C_DEFAULT 0
@ -562,6 +580,7 @@
#define wxSTC_PL_ARRAY 13
#define wxSTC_PL_HASH 14
#define wxSTC_PL_SYMBOLTABLE 15
#define wxSTC_PL_VARIABLE_INDEXER 16
#define wxSTC_PL_REGEX 17
#define wxSTC_PL_REGSUBST 18
#define wxSTC_PL_LONGQUOTE 19
@ -576,6 +595,43 @@
#define wxSTC_PL_STRING_QX 28
#define wxSTC_PL_STRING_QR 29
#define wxSTC_PL_STRING_QW 30
#define wxSTC_PL_POD_VERB 31
// Lexical states for SCLEX_RUBY
#define wxSTC_RB_DEFAULT 0
#define wxSTC_RB_ERROR 1
#define wxSTC_RB_COMMENTLINE 2
#define wxSTC_RB_POD 3
#define wxSTC_RB_NUMBER 4
#define wxSTC_RB_WORD 5
#define wxSTC_RB_STRING 6
#define wxSTC_RB_CHARACTER 7
#define wxSTC_RB_CLASSNAME 8
#define wxSTC_RB_DEFNAME 9
#define wxSTC_RB_OPERATOR 10
#define wxSTC_RB_IDENTIFIER 11
#define wxSTC_RB_REGEX 12
#define wxSTC_RB_GLOBAL 13
#define wxSTC_RB_SYMBOL 14
#define wxSTC_RB_MODULE_NAME 15
#define wxSTC_RB_INSTANCE_VAR 16
#define wxSTC_RB_CLASS_VAR 17
#define wxSTC_RB_BACKTICKS 18
#define wxSTC_RB_DATASECTION 19
#define wxSTC_RB_HERE_DELIM 20
#define wxSTC_RB_HERE_Q 21
#define wxSTC_RB_HERE_QQ 22
#define wxSTC_RB_HERE_QX 23
#define wxSTC_RB_STRING_Q 24
#define wxSTC_RB_STRING_QQ 25
#define wxSTC_RB_STRING_QX 26
#define wxSTC_RB_STRING_QR 27
#define wxSTC_RB_STRING_QW 28
#define wxSTC_RB_WORD_DEMOTED 29
#define wxSTC_RB_STDIN 30
#define wxSTC_RB_STDOUT 31
#define wxSTC_RB_STDERR 40
#define wxSTC_RB_UPPER_BOUND 41
// Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC
#define wxSTC_B_DEFAULT 0
@ -593,6 +649,10 @@
#define wxSTC_B_KEYWORD4 12
#define wxSTC_B_CONSTANT 13
#define wxSTC_B_ASM 14
#define wxSTC_B_LABEL 15
#define wxSTC_B_ERROR 16
#define wxSTC_B_HEXNUMBER 17
#define wxSTC_B_BINNUMBER 18
// Lexical states for SCLEX_PROPERTIES
#define wxSTC_PROPS_DEFAULT 0
@ -742,10 +802,14 @@
#define wxSTC_LISP_COMMENT 1
#define wxSTC_LISP_NUMBER 2
#define wxSTC_LISP_KEYWORD 3
#define wxSTC_LISP_KEYWORD_KW 4
#define wxSTC_LISP_SYMBOL 5
#define wxSTC_LISP_STRING 6
#define wxSTC_LISP_STRINGEOL 8
#define wxSTC_LISP_IDENTIFIER 9
#define wxSTC_LISP_OPERATOR 10
#define wxSTC_LISP_SPECIAL 11
#define wxSTC_LISP_MULTI_COMMENT 12
// Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
#define wxSTC_EIFFEL_DEFAULT 0
@ -867,6 +931,7 @@
#define wxSTC_CSS_DOUBLESTRING 13
#define wxSTC_CSS_SINGLESTRING 14
#define wxSTC_CSS_IDENTIFIER2 15
#define wxSTC_CSS_ATTRIBUTE 16
// Lexical states for SCLEX_POV
#define wxSTC_POV_DEFAULT 0
@ -948,6 +1013,10 @@
#define wxSTC_NSIS_MACRODEF 12
#define wxSTC_NSIS_STRINGVAR 13
#define wxSTC_NSIS_NUMBER 14
#define wxSTC_NSIS_SECTIONGROUP 15
#define wxSTC_NSIS_PAGEEX 16
#define wxSTC_NSIS_FUNCTIONDEF 17
#define wxSTC_NSIS_COMMENTBOX 18
// Lexical states for SCLEX_MMIXAL
#define wxSTC_MMIXAL_LEADWS 0
@ -980,11 +1049,13 @@
#define wxSTC_CLW_PICTURE_STRING 7
#define wxSTC_CLW_KEYWORD 8
#define wxSTC_CLW_COMPILER_DIRECTIVE 9
#define wxSTC_CLW_BUILTIN_PROCEDURES_FUNCTION 10
#define wxSTC_CLW_STRUCTURE_DATA_TYPE 11
#define wxSTC_CLW_ATTRIBUTE 12
#define wxSTC_CLW_STANDARD_EQUATE 13
#define wxSTC_CLW_ERROR 14
#define wxSTC_CLW_RUNTIME_EXPRESSIONS 10
#define wxSTC_CLW_BUILTIN_PROCEDURES_FUNCTION 11
#define wxSTC_CLW_STRUCTURE_DATA_TYPE 12
#define wxSTC_CLW_ATTRIBUTE 13
#define wxSTC_CLW_STANDARD_EQUATE 14
#define wxSTC_CLW_ERROR 15
#define wxSTC_CLW_DEPRECATED 16
// Lexical states for SCLEX_LOT
#define wxSTC_LOT_DEFAULT 0
@ -1131,6 +1202,8 @@
#define wxSTC_AU3_SENT 10
#define wxSTC_AU3_PREPROCESSOR 11
#define wxSTC_AU3_SPECIAL 12
#define wxSTC_AU3_EXPAND 13
#define wxSTC_AU3_COMOBJ 14
// Lexical states for SCLEX_APDL
#define wxSTC_APDL_DEFAULT 0
@ -1193,6 +1266,182 @@
#define wxSTC_VHDL_STDTYPE 13
#define wxSTC_VHDL_USERWORD 14
// Lexical states for SCLEX_CAML
#define wxSTC_CAML_DEFAULT 0
#define wxSTC_CAML_IDENTIFIER 1
#define wxSTC_CAML_TAGNAME 2
#define wxSTC_CAML_KEYWORD 3
#define wxSTC_CAML_KEYWORD2 4
#define wxSTC_CAML_KEYWORD3 5
#define wxSTC_CAML_LINENUM 6
#define wxSTC_CAML_OPERATOR 7
#define wxSTC_CAML_NUMBER 8
#define wxSTC_CAML_CHAR 9
#define wxSTC_CAML_STRING 11
#define wxSTC_CAML_COMMENT 12
#define wxSTC_CAML_COMMENT1 13
#define wxSTC_CAML_COMMENT2 14
#define wxSTC_CAML_COMMENT3 15
// Lexical states for SCLEX_HASKELL
#define wxSTC_HA_DEFAULT 0
#define wxSTC_HA_IDENTIFIER 1
#define wxSTC_HA_KEYWORD 2
#define wxSTC_HA_NUMBER 3
#define wxSTC_HA_STRING 4
#define wxSTC_HA_CHARACTER 5
#define wxSTC_HA_CLASS 6
#define wxSTC_HA_MODULE 7
#define wxSTC_HA_CAPITAL 8
#define wxSTC_HA_DATA 9
#define wxSTC_HA_IMPORT 10
#define wxSTC_HA_OPERATOR 11
#define wxSTC_HA_INSTANCE 12
#define wxSTC_HA_COMMENTLINE 13
#define wxSTC_HA_COMMENTBLOCK 14
#define wxSTC_HA_COMMENTBLOCK2 15
#define wxSTC_HA_COMMENTBLOCK3 16
// Lexical states of SCLEX_TADS3
#define wxSTC_T3_DEFAULT 0
#define wxSTC_T3_X_DEFAULT 1
#define wxSTC_T3_PREPROCESSOR 2
#define wxSTC_T3_BLOCK_COMMENT 3
#define wxSTC_T3_LINE_COMMENT 4
#define wxSTC_T3_OPERATOR 5
#define wxSTC_T3_KEYWORD 6
#define wxSTC_T3_NUMBER 7
#define wxSTC_T3_IDENTIFIER 8
#define wxSTC_T3_S_STRING 9
#define wxSTC_T3_D_STRING 10
#define wxSTC_T3_X_STRING 11
#define wxSTC_T3_LIB_DIRECTIVE 12
#define wxSTC_T3_MSG_PARAM 13
#define wxSTC_T3_HTML_TAG 14
#define wxSTC_T3_HTML_DEFAULT 15
#define wxSTC_T3_HTML_STRING 16
#define wxSTC_T3_USER1 17
#define wxSTC_T3_USER2 18
#define wxSTC_T3_USER3 19
// Lexical states for SCLEX_REBOL
#define wxSTC_REBOL_DEFAULT 0
#define wxSTC_REBOL_COMMENTLINE 1
#define wxSTC_REBOL_COMMENTBLOCK 2
#define wxSTC_REBOL_PREFACE 3
#define wxSTC_REBOL_OPERATOR 4
#define wxSTC_REBOL_CHARACTER 5
#define wxSTC_REBOL_QUOTEDSTRING 6
#define wxSTC_REBOL_BRACEDSTRING 7
#define wxSTC_REBOL_NUMBER 8
#define wxSTC_REBOL_PAIR 9
#define wxSTC_REBOL_TUPLE 10
#define wxSTC_REBOL_BINARY 11
#define wxSTC_REBOL_MONEY 12
#define wxSTC_REBOL_ISSUE 13
#define wxSTC_REBOL_TAG 14
#define wxSTC_REBOL_FILE 15
#define wxSTC_REBOL_EMAIL 16
#define wxSTC_REBOL_URL 17
#define wxSTC_REBOL_DATE 18
#define wxSTC_REBOL_TIME 19
#define wxSTC_REBOL_IDENTIFIER 20
#define wxSTC_REBOL_WORD 21
#define wxSTC_REBOL_WORD2 22
#define wxSTC_REBOL_WORD3 23
#define wxSTC_REBOL_WORD4 24
#define wxSTC_REBOL_WORD5 25
#define wxSTC_REBOL_WORD6 26
#define wxSTC_REBOL_WORD7 27
#define wxSTC_REBOL_WORD8 28
// Lexical states for SCLEX_SQL
#define wxSTC_SQL_DEFAULT 0
#define wxSTC_SQL_COMMENT 1
#define wxSTC_SQL_COMMENTLINE 2
#define wxSTC_SQL_COMMENTDOC 3
#define wxSTC_SQL_NUMBER 4
#define wxSTC_SQL_WORD 5
#define wxSTC_SQL_STRING 6
#define wxSTC_SQL_CHARACTER 7
#define wxSTC_SQL_SQLPLUS 8
#define wxSTC_SQL_SQLPLUS_PROMPT 9
#define wxSTC_SQL_OPERATOR 10
#define wxSTC_SQL_IDENTIFIER 11
#define wxSTC_SQL_SQLPLUS_COMMENT 13
#define wxSTC_SQL_COMMENTLINEDOC 15
#define wxSTC_SQL_WORD2 16
#define wxSTC_SQL_COMMENTDOCKEYWORD 17
#define wxSTC_SQL_COMMENTDOCKEYWORDERROR 18
#define wxSTC_SQL_USER1 19
#define wxSTC_SQL_USER2 20
#define wxSTC_SQL_USER3 21
#define wxSTC_SQL_USER4 22
#define wxSTC_SQL_QUOTEDIDENTIFIER 23
// Lexical states for SCLEX_SMALLTALK
#define wxSTC_ST_DEFAULT 0
#define wxSTC_ST_STRING 1
#define wxSTC_ST_NUMBER 2
#define wxSTC_ST_COMMENT 3
#define wxSTC_ST_SYMBOL 4
#define wxSTC_ST_BINARY 5
#define wxSTC_ST_BOOL 6
#define wxSTC_ST_SELF 7
#define wxSTC_ST_SUPER 8
#define wxSTC_ST_NIL 9
#define wxSTC_ST_GLOBAL 10
#define wxSTC_ST_RETURN 11
#define wxSTC_ST_SPECIAL 12
#define wxSTC_ST_KWSEND 13
#define wxSTC_ST_ASSIGN 14
#define wxSTC_ST_CHARACTER 15
#define wxSTC_ST_SPEC_SEL 16
// Lexical states for SCLEX_FLAGSHIP (clipper)
#define wxSTC_FS_DEFAULT 0
#define wxSTC_FS_COMMENT 1
#define wxSTC_FS_COMMENTLINE 2
#define wxSTC_FS_COMMENTDOC 3
#define wxSTC_FS_COMMENTLINEDOC 4
#define wxSTC_FS_COMMENTDOCKEYWORD 5
#define wxSTC_FS_COMMENTDOCKEYWORDERROR 6
#define wxSTC_FS_KEYWORD 7
#define wxSTC_FS_KEYWORD2 8
#define wxSTC_FS_KEYWORD3 9
#define wxSTC_FS_KEYWORD4 10
#define wxSTC_FS_NUMBER 11
#define wxSTC_FS_STRING 12
#define wxSTC_FS_PREPROCESSOR 13
#define wxSTC_FS_OPERATOR 14
#define wxSTC_FS_IDENTIFIER 15
#define wxSTC_FS_DATE 16
#define wxSTC_FS_STRINGEOL 17
#define wxSTC_FS_CONSTANT 18
#define wxSTC_FS_ASM 19
#define wxSTC_FS_LABEL 20
#define wxSTC_FS_ERROR 21
#define wxSTC_FS_HEXNUMBER 22
#define wxSTC_FS_BINNUMBER 23
// Lexical states for SCLEX_CSOUND
#define wxSTC_CSOUND_DEFAULT 0
#define wxSTC_CSOUND_COMMENT 1
#define wxSTC_CSOUND_NUMBER 2
#define wxSTC_CSOUND_OPERATOR 3
#define wxSTC_CSOUND_INSTR 4
#define wxSTC_CSOUND_IDENTIFIER 5
#define wxSTC_CSOUND_OPCODE 6
#define wxSTC_CSOUND_HEADERSTMT 7
#define wxSTC_CSOUND_USERKEYWORD 8
#define wxSTC_CSOUND_COMMENTBLOCK 9
#define wxSTC_CSOUND_PARAM 10
#define wxSTC_CSOUND_ARATE_VAR 11
#define wxSTC_CSOUND_KRATE_VAR 12
#define wxSTC_CSOUND_IRATE_VAR 13
#define wxSTC_CSOUND_GLOBAL_VAR 14
#define wxSTC_CSOUND_STRINGEOL 15
//-----------------------------------------
// Commands that can be bound to keystrokes
@ -1679,6 +1928,9 @@ public:
// Define a marker from a bitmap
void MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp);
// Add a set of markers to a line.
void MarkerAddSet(int line, int set);
// Set a margin to be either numeric or symbolic.
void SetMarginType(int margin, int marginType);
@ -1914,6 +2166,20 @@ public:
// Default is '?' but can be changed if items contain '?'.
void AutoCompSetTypeSeparator(int separatorCharacter);
// Set the maximum width, in characters, of auto-completion and user lists.
// Set to 0 to autosize to fit longest item, which is the default.
void AutoCompSetMaxWidth(int characterCount);
// Get the maximum width, in characters, of auto-completion and user lists.
int AutoCompGetMaxWidth();
// Set the maximum height, in rows, of auto-completion and user lists.
// The default is 5 rows.
void AutoCompSetMaxHeight(int rowCount);
// Set the maximum height, in rows, of auto-completion and user lists.
int AutoCompGetMaxHeight();
// Set the number of spaces used for one level of indentation.
void SetIndent(int indentSize);
@ -2176,6 +2442,9 @@ public:
// Find the document line of a display line taking hidden lines into account.
int DocLineFromVisible(int lineDisplay);
// The number of display lines needed to wrap a document line
int WrapCount(int line);
// Set the fold level of a line.
// This encodes an integer level along with flags indicating whether the
// line is a header and whether it is effectively white space.
@ -2290,7 +2559,7 @@ public:
// Retrieve whether the maximum scroll position has the last
// line at the bottom of the view.
int GetEndAtLastLine();
bool GetEndAtLastLine();
// Retrieve the height of a particular line of text in pixels.
int TextHeight(int line);
@ -2773,10 +3042,28 @@ public:
// Enlarge the document to a particular size of text bytes.
void Allocate(int bytes);
// Find the position of a column on a line taking into account tabs and
// Find the position of a column on a line taking into account tabs and
// multi-byte characters. If beyond end of line, return line end position.
int FindColumn(int line, int column);
// Can the caret preferred x position only be changed by explicit movement commands?
bool GetCaretSticky();
// Stop the caret preferred x position changing when the user types.
void SetCaretSticky(bool useCaretStickyBehaviour);
// Switch between sticky and non-sticky: meant to be bound to a key.
void ToggleCaretSticky();
// Enable/Disable convert-on-paste for line endings
void SetPasteConvertEndings(bool convert);
// Get convert-on-paste setting
bool GetPasteConvertEndings();
// Duplicate the selection. If selection empty duplicate the line containing the caret.
void SelectionDuplicate();
// Start notifying the container of all key presses and commands.
void StartRecord();
@ -2801,6 +3088,20 @@ public:
// Set the lexing language of the document based on string name.
void SetLexerLanguage(const wxString& language);
// Retrieve a 'property' value previously set with SetProperty.
wxString GetProperty(const wxString& key);
// Retrieve a 'property' value previously set with SetProperty,
// with '$()' variable replacement on returned buffer.
wxString GetPropertyExpanded(const wxString& key);
// Retrieve a 'property' value previously set with SetProperty,
// interpreted as an int AFTER any '$()' variable replacement.
int GetPropertyInt(const wxString& key);
// Retrieve the number of bits the current lexer needs for styling.
int GetStyleBitsNeeded();
// END of generated section
//----------------------------------------------------------------------
// Others...
@ -3131,6 +3432,7 @@ BEGIN_DECLARE_EVENT_TYPES()
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_CLICK, 1673)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_HOTSPOT_DCLICK, 1674)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_CALLTIP_CLICK, 1675)
DECLARE_EXPORTED_EVENT_TYPE(WXDLLIMPEXP_STC, wxEVT_STC_AUTOCOMP_SELECTION, 1676)
END_DECLARE_EVENT_TYPES()
#else
enum {
@ -3158,7 +3460,8 @@ END_DECLARE_EVENT_TYPES()
wxEVT_STC_ZOOM,
wxEVT_STC_HOTSPOT_CLICK,
wxEVT_STC_HOTSPOT_DCLICK,
wxEVT_STC_CALLTIP_CLICK
wxEVT_STC_CALLTIP_CLICK,
wxEVT_STC_AUTOCOMP_SELECTION
};
#endif
@ -3192,7 +3495,7 @@ typedef void (wxEvtHandler::*wxStyledTextEventFunction)(wxStyledTextEvent&);
#define EVT_STC_HOTSPOT_CLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_CLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#define EVT_STC_HOTSPOT_DCLICK(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_HOTSPOT_DCLICK, id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#define EVT_STC_CALLTIP_CLICK(id, fn)) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_CALLTIP_CLICK id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#define EVT_STC_AUTOCOMP_SELECTION(id, fn) DECLARE_EVENT_TABLE_ENTRY( wxEVT_STC_AUTOCOMP_SELECTION id, wxID_ANY, (wxObjectEventFunction) (wxEventFunction) wxStaticCastEvent( wxStyledTextEventFunction, & fn ), (wxObject *) NULL ),
#endif
//----------------------------------------------------------------------

View File

@ -82,19 +82,24 @@ STCDLL_OBJECTS = \
stcdll_LexAsn1.o \
stcdll_LexBaan.o \
stcdll_LexBash.o \
stcdll_LexBasic.o \
stcdll_LexBullant.o \
stcdll_LexCLW.o \
stcdll_LexCPP.o \
stcdll_LexCSS.o \
stcdll_LexCaml.o \
stcdll_LexCsound.o \
stcdll_LexConf.o \
stcdll_LexCrontab.o \
stcdll_LexEScript.o \
stcdll_LexEiffel.o \
stcdll_LexErlang.o \
stcdll_LexFlagship.o \
stcdll_LexForth.o \
stcdll_LexFortran.o \
stcdll_LexGui4Cli.o \
stcdll_LexHTML.o \
stcdll_LexHaskell.o \
stcdll_LexKix.o \
stcdll_LexLisp.o \
stcdll_LexLout.o \
@ -112,8 +117,11 @@ STCDLL_OBJECTS = \
stcdll_LexPascal.o \
stcdll_LexPerl.o \
stcdll_LexPython.o \
stcdll_LexRebol.o \
stcdll_LexRuby.o \
stcdll_LexSQL.o \
stcdll_LexSmalltalk.o \
stcdll_LexTADS3.o \
stcdll_LexScriptol.o \
stcdll_LexSpecman.o \
stcdll_LexTeX.o \
@ -159,19 +167,24 @@ STCLIB_OBJECTS = \
stclib_LexAsn1.o \
stclib_LexBaan.o \
stclib_LexBash.o \
stclib_LexBasic.o \
stclib_LexBullant.o \
stclib_LexCLW.o \
stclib_LexCPP.o \
stclib_LexCSS.o \
stclib_LexCaml.o \
stclib_LexCsound.o \
stclib_LexConf.o \
stclib_LexCrontab.o \
stclib_LexEScript.o \
stclib_LexEiffel.o \
stclib_LexErlang.o \
stclib_LexFlagship.o \
stclib_LexForth.o \
stclib_LexFortran.o \
stclib_LexGui4Cli.o \
stclib_LexHTML.o \
stclib_LexHaskell.o \
stclib_LexKix.o \
stclib_LexLisp.o \
stclib_LexLout.o \
@ -189,8 +202,11 @@ STCLIB_OBJECTS = \
stclib_LexPascal.o \
stclib_LexPerl.o \
stclib_LexPython.o \
stclib_LexRebol.o \
stclib_LexRuby.o \
stclib_LexSQL.o \
stclib_LexSmalltalk.o \
stclib_LexTADS3.o \
stclib_LexScriptol.o \
stclib_LexSpecman.o \
stclib_LexTeX.o \
@ -447,6 +463,9 @@ stcdll_LexBaan.o: $(srcdir)/scintilla/src/LexBaan.cxx
stcdll_LexBash.o: $(srcdir)/scintilla/src/LexBash.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexBash.cxx
stcdll_LexBasic.o: $(srcdir)/scintilla/src/LexBasic.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexBasic.cxx
stcdll_LexBullant.o: $(srcdir)/scintilla/src/LexBullant.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexBullant.cxx
@ -459,6 +478,12 @@ stcdll_LexCPP.o: $(srcdir)/scintilla/src/LexCPP.cxx
stcdll_LexCSS.o: $(srcdir)/scintilla/src/LexCSS.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexCSS.cxx
stcdll_LexCaml.o: $(srcdir)/scintilla/src/LexCaml.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexCaml.cxx
stcdll_LexCsound.o: $(srcdir)/scintilla/src/LexCsound.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexCsound.cxx
stcdll_LexConf.o: $(srcdir)/scintilla/src/LexConf.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexConf.cxx
@ -474,6 +499,9 @@ stcdll_LexEiffel.o: $(srcdir)/scintilla/src/LexEiffel.cxx
stcdll_LexErlang.o: $(srcdir)/scintilla/src/LexErlang.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexErlang.cxx
stcdll_LexFlagship.o: $(srcdir)/scintilla/src/LexFlagship.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexFlagship.cxx
stcdll_LexForth.o: $(srcdir)/scintilla/src/LexForth.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexForth.cxx
@ -486,6 +514,9 @@ stcdll_LexGui4Cli.o: $(srcdir)/scintilla/src/LexGui4Cli.cxx
stcdll_LexHTML.o: $(srcdir)/scintilla/src/LexHTML.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexHTML.cxx
stcdll_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
stcdll_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
@ -537,12 +568,21 @@ stcdll_LexPerl.o: $(srcdir)/scintilla/src/LexPerl.cxx
stcdll_LexPython.o: $(srcdir)/scintilla/src/LexPython.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexPython.cxx
stcdll_LexRebol.o: $(srcdir)/scintilla/src/LexRebol.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexRebol.cxx
stcdll_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexRuby.cxx
stcdll_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSQL.cxx
stcdll_LexSmalltalk.o: $(srcdir)/scintilla/src/LexSmalltalk.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSmalltalk.cxx
stcdll_LexTADS3.o: $(srcdir)/scintilla/src/LexTADS3.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTADS3.cxx
stcdll_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexScriptol.cxx
@ -660,6 +700,9 @@ stclib_LexBaan.o: $(srcdir)/scintilla/src/LexBaan.cxx
stclib_LexBash.o: $(srcdir)/scintilla/src/LexBash.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexBash.cxx
stclib_LexBasic.o: $(srcdir)/scintilla/src/LexBasic.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexBasic.cxx
stclib_LexBullant.o: $(srcdir)/scintilla/src/LexBullant.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexBullant.cxx
@ -672,6 +715,12 @@ stclib_LexCPP.o: $(srcdir)/scintilla/src/LexCPP.cxx
stclib_LexCSS.o: $(srcdir)/scintilla/src/LexCSS.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexCSS.cxx
stclib_LexCaml.o: $(srcdir)/scintilla/src/LexCaml.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexCaml.cxx
stclib_LexCsound.o: $(srcdir)/scintilla/src/LexCsound.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexCsound.cxx
stclib_LexConf.o: $(srcdir)/scintilla/src/LexConf.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexConf.cxx
@ -687,6 +736,9 @@ stclib_LexEiffel.o: $(srcdir)/scintilla/src/LexEiffel.cxx
stclib_LexErlang.o: $(srcdir)/scintilla/src/LexErlang.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexErlang.cxx
stclib_LexFlagship.o: $(srcdir)/scintilla/src/LexFlagship.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexFlagship.cxx
stclib_LexForth.o: $(srcdir)/scintilla/src/LexForth.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexForth.cxx
@ -699,6 +751,9 @@ stclib_LexGui4Cli.o: $(srcdir)/scintilla/src/LexGui4Cli.cxx
stclib_LexHTML.o: $(srcdir)/scintilla/src/LexHTML.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexHTML.cxx
stclib_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
stclib_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
@ -750,12 +805,21 @@ stclib_LexPerl.o: $(srcdir)/scintilla/src/LexPerl.cxx
stclib_LexPython.o: $(srcdir)/scintilla/src/LexPython.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexPython.cxx
stclib_LexRebol.o: $(srcdir)/scintilla/src/LexRebol.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexRebol.cxx
stclib_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexRuby.cxx
stclib_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSQL.cxx
stclib_LexSmalltalk.o: $(srcdir)/scintilla/src/LexSmalltalk.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSmalltalk.cxx
stclib_LexTADS3.o: $(srcdir)/scintilla/src/LexTADS3.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTADS3.cxx
stclib_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexScriptol.cxx

View File

@ -12,6 +12,7 @@
#include "wx/mstream.h"
#include "wx/image.h"
#include "wx/imaglist.h"
#include "wx/tokenzr.h"
#include "Platform.h"
#include "PlatWX.h"
@ -686,7 +687,7 @@ private:
CallBackAction doubleClickAction;
void* doubleClickActionData;
public:
wxSTCListBoxWin(wxWindow* parent, wxWindowID id) :
wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point location) :
wxPopupWindow(parent, wxBORDER_NONE)
{
SetBackgroundColour(*wxBLACK); // for our simple border
@ -804,8 +805,8 @@ private:
CallBackAction doubleClickAction;
void* doubleClickActionData;
public:
wxSTCListBoxWin(wxWindow* parent, wxWindowID id) :
wxWindow(parent, id, wxDefaultPosition, wxSize(0,0), wxSIMPLE_BORDER )
wxSTCListBoxWin(wxWindow* parent, wxWindowID id, Point location) :
wxWindow(parent, id, wxPoint(location.x, location.y), wxSize(0,0), wxSIMPLE_BORDER )
{
lv = new wxSTCListBox(this, id, wxDefaultPosition, wxDefaultSize,
@ -919,6 +920,7 @@ private:
int desiredVisibleRows;
int aveCharWidth;
int maxStrWidth;
Point location; // Caret location at which the list is opened
wxImageList* imgList;
wxArrayInt* imgTypeMap;
@ -927,13 +929,15 @@ public:
~ListBoxImpl();
virtual void SetFont(Font &font);
virtual void Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_);
virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_);
virtual void SetAverageCharWidth(int width);
virtual void SetVisibleRows(int rows);
virtual int GetVisibleRows() const;
virtual PRectangle GetDesiredRect();
virtual int CaretFromEdge();
virtual void Clear();
virtual void Append(char *s, int type = -1);
void Append(const wxString& text, int type);
virtual int Length();
virtual void Select(int n);
virtual int GetSelection();
@ -942,7 +946,7 @@ public:
virtual void RegisterImage(int type, const char *xpm_data);
virtual void ClearRegisteredImages();
virtual void SetDoubleClickAction(CallBackAction, void *);
virtual void SetList(const char* list, char separator, char typesep);
};
@ -970,11 +974,12 @@ void ListBoxImpl::SetFont(Font &font) {
}
void ListBoxImpl::Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_) {
void ListBoxImpl::Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_) {
location = location_;
lineHeight = lineHeight_;
unicodeMode = unicodeMode_;
maxStrWidth = 0;
id = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID);
id = new wxSTCListBoxWin(GETWIN(parent.GetID()), ctrlID, location);
if (imgList != NULL)
GETLB(id)->SetImageList(imgList, wxIMAGE_LIST_SMALL);
}
@ -990,10 +995,14 @@ void ListBoxImpl::SetVisibleRows(int rows) {
}
int ListBoxImpl::GetVisibleRows() const {
return desiredVisibleRows;
}
PRectangle ListBoxImpl::GetDesiredRect() {
// wxListCtrl doesn't have a DoGetBestSize, so instead we kept track of
// the max size in Append and calculate it here...
int maxw = maxStrWidth;
int maxw = maxStrWidth * aveCharWidth;
int maxh ;
// give it a default if there are no lines, and/or add a bit more
@ -1039,13 +1048,14 @@ void ListBoxImpl::Clear() {
void ListBoxImpl::Append(char *s, int type) {
wxString text = stc2wx(s);
Append(stc2wx(s), type);
}
void ListBoxImpl::Append(const wxString& text, int type) {
long count = GETLB(id)->GetItemCount();
long itemID = GETLB(id)->InsertItem(count, wxEmptyString);
GETLB(id)->SetItem(itemID, 1, text);
int itemWidth = 0;
GETLB(id)->GetTextExtent(text, &itemWidth, NULL);
maxStrWidth = wxMax(maxStrWidth, itemWidth);
maxStrWidth = wxMax(maxStrWidth, text.Length());
if (type != -1) {
wxCHECK_RET(imgTypeMap, wxT("Unexpected NULL imgTypeMap"));
long idx = imgTypeMap->Item(type);
@ -1053,6 +1063,23 @@ void ListBoxImpl::Append(char *s, int type) {
}
}
void ListBoxImpl::SetList(const char* list, char separator, char typesep) {
GETLB(id)->Freeze();
Clear();
wxStringTokenizer tkzr(stc2wx(list), (wxChar)separator);
while ( tkzr.HasMoreTokens() ) {
wxString token = tkzr.GetNextToken();
long type = -1;
int pos = token.Find(typesep);
if (pos != -1) {
token.Mid(pos+1).ToLong(&type);
token.Truncate(pos);
}
Append(token, (int)type);
}
GETLB(id)->Thaw();
}
int ListBoxImpl::Length() {
return GETLB(id)->GetItemCount();
@ -1133,7 +1160,6 @@ void ListBoxImpl::SetDoubleClickAction(CallBackAction action, void *data) {
}
ListBox::ListBox() {
}

View File

@ -293,7 +293,12 @@ methodOverrideMap = {
'AutoCGetTypeSeparator' : ('AutoCompGetTypeSeparator', 0, 0, 0),
'AutoCSetTypeSeparator' : ('AutoCompSetTypeSeparator', 0, 0, 0),
'AutoCGetCurrent' : ('AutoCompGetCurrent', 0, 0, 0),
'AutoCSetMaxWidth' : ('AutoCompSetMaxWidth', 0, 0, 0),
'AutoCGetMaxWidth' : ('AutoCompGetMaxWidth', 0, 0, 0),
'AutoCSetMaxHeight' : ('AutoCompSetMaxHeight', 0, 0, 0),
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
'AutoCGetMaxHeight' : ('AutoCompGetMaxHeight', 0, 0, 0),
'RegisterImage' :
(0,
'''void %s(int type, const wxBitmap& bmp);''',
@ -519,7 +524,45 @@ methodOverrideMap = {
'TargetAsUTF8' : ( None, 0, 0, 0),
'SetLengthForEncode' : ( None, 0, 0, 0),
'EncodedFromUTF8' : ( None, 0, 0, 0),
'GetProperty' :
(0,
'wxString %s(const wxString& key);',
'''wxString %s(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTY, (long)(const char*)wx2stc(key), NULL);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(%s, (long)(const char*)wx2stc(key), (long)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
("Retrieve a 'property' value previously set with SetProperty.",)),
'GetPropertyExpanded' :
(0,
'wxString %s(const wxString& key);',
'''wxString %s(const wxString& key) {
int len = SendMsg(SCI_GETPROPERTYEXPANDED, (long)(const char*)wx2stc(key), NULL);
if (!len) return wxEmptyString;
wxMemoryBuffer mbuf(len+1);
char* buf = (char*)mbuf.GetWriteBuf(len+1);
SendMsg(%s, (long)(const char*)wx2stc(key), (long)buf);
mbuf.UngetWriteBuf(len);
mbuf.AppendByte(0);
return stc2wx(buf);''',
("Retrieve a 'property' value previously set with SetProperty,",
"with '$()' variable replacement on returned buffer.")),
'GetPropertyInt' : (0, 0, 0,
("Retrieve a 'property' value previously set with SetProperty,",
"interpreted as an int AFTER any '$()' variable replacement.")),
'GetDocPointer' :
(0,

View File

@ -3,5 +3,5 @@ scintilla/include directories from the Scintilla/SCiTE source
distribution. All other code needed to implement Scintilla on top of
wxWindows is located in the directory above this one.
The current version of the Scintilla code is 1.62
The current version of the Scintilla code is 1.67

View File

@ -20,21 +20,29 @@ protected:
LexerFunction fnLexer;
LexerFunction fnFolder;
const char * const * wordListDescriptions;
int styleBits;
static const LexerModule *base;
static int nextLanguage;
public:
const char *languageName;
LexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_=0, LexerFunction fnFolder_=0,
const char * const wordListDescriptions_[] = NULL);
LexerModule(int language_,
LexerFunction fnLexer_,
const char *languageName_=0,
LexerFunction fnFolder_=0,
const char * const wordListDescriptions_[] = NULL,
int styleBits_=5);
virtual ~LexerModule() {
}
int GetLanguage() const { return language; }
// -1 is returned if no WordList information is available
int GetNumWordLists() const;
const char *GetWordListDescription(int index) const;
int GetStyleBitsNeeded() const;
virtual void Lex(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler) const;
virtual void Fold(unsigned int startPos, int lengthDoc, int initStyle,

View File

@ -393,9 +393,10 @@ public:
static ListBox *Allocate();
virtual void SetFont(Font &font)=0;
virtual void Create(Window &parent, int ctrlID, int lineHeight_, bool unicodeMode_)=0;
virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_)=0;
virtual void SetAverageCharWidth(int width)=0;
virtual void SetVisibleRows(int rows)=0;
virtual int GetVisibleRows() const=0;
virtual PRectangle GetDesiredRect()=0;
virtual int CaretFromEdge()=0;
virtual void Clear()=0;
@ -408,6 +409,7 @@ public:
virtual void RegisterImage(int type, const char *xpm_data)=0;
virtual void ClearRegisteredImages()=0;
virtual void SetDoubleClickAction(CallBackAction, void *)=0;
virtual void SetList(const char* list, char separator, char typesep)=0;
};
/**

View File

@ -29,6 +29,7 @@ protected:
Property *props[hashRoots];
Property *enumnext;
int enumhash;
static bool caseSensitiveFilenames;
static unsigned int HashString(const char *s, size_t len) {
unsigned int ret = 0;
while (len--) {
@ -58,9 +59,12 @@ public:
char *ToString(); // Caller must delete[] the return value
bool GetFirst(char **key, char **val);
bool GetNext(char **key, char **val);
static void SetCaseSensitiveFilenames(bool caseSensitiveFilenames_) {
caseSensitiveFilenames = caseSensitiveFilenames_;
}
private:
// copy-value semantics not implemented
// copy-value semantics not implemented
PropSet(const PropSet &copy);
void operator=(const PropSet &assign);
};
@ -76,9 +80,11 @@ public:
int len;
bool onlyLineEnds; ///< Delimited by any white space or only line ends
bool sorted;
bool sortedNoCase;
int starts[256];
WordList(bool onlyLineEnds_ = false) :
words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_), sorted(false) {}
words(0), wordsNoCase(0), list(0), len(0), onlyLineEnds(onlyLineEnds_),
sorted(false), sortedNoCase(false) {}
~WordList() { Clear(); }
operator bool() { return len ? true : false; }
char *operator[](int ind) { return words[ind]; }
@ -87,6 +93,7 @@ public:
char *Allocate(int size);
void SetFromAllocated();
bool InList(const char *s);
bool InListAbbreviated(const char *s, const char marker);
const char *GetNearestWord(const char *wordStart, int searchLen,
bool ignoreCase = false, SString wordCharacters="", int wordIndex = -1);
char *GetNearestWords(const char *wordStart, int searchLen,

View File

@ -197,7 +197,7 @@ public:
bool operator!=(const char *sOther) const {
return !operator==(sOther);
}
bool contains(char ch) {
bool contains(char ch) const {
return (s && *s) ? strchr(s, ch) != 0 : false;
}
void setsizegrowth(lenpos_t sizeGrowth_) {
@ -253,7 +253,7 @@ public:
bool startswith(const char *prefix);
bool endswith(const char *suffix);
int search(const char *sFind, lenpos_t start=0) const;
bool contains(const char *sFind) {
bool contains(const char *sFind) const {
return search(sFind) >= 0;
}
int substitute(char chFind, char chReplace);

View File

@ -43,8 +43,6 @@
#define SCLEX_NNCRONTAB 26
#define SCLEX_BULLANT 27
#define SCLEX_VBSCRIPT 28
#define SCLEX_ASP 29
#define SCLEX_PHP 30
#define SCLEX_BAAN 31
#define SCLEX_MATLAB 32
#define SCLEX_SCRIPTOL 33
@ -79,6 +77,17 @@
#define SCLEX_BASH 62
#define SCLEX_ASN1 63
#define SCLEX_VHDL 64
#define SCLEX_CAML 65
#define SCLEX_BLITZBASIC 66
#define SCLEX_PUREBASIC 67
#define SCLEX_HASKELL 68
#define SCLEX_PHPSCRIPT 69
#define SCLEX_TADS3 70
#define SCLEX_REBOL 71
#define SCLEX_SMALLTALK 72
#define SCLEX_FLAGSHIP 73
#define SCLEX_CSOUND 74
#define SCLEX_FREEBASIC 75
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@ -94,6 +103,8 @@
#define SCE_P_IDENTIFIER 11
#define SCE_P_COMMENTBLOCK 12
#define SCE_P_STRINGEOL 13
#define SCE_P_WORD2 14
#define SCE_P_DECORATOR 15
#define SCE_C_DEFAULT 0
#define SCE_C_COMMENT 1
#define SCE_C_COMMENTLINE 2
@ -241,6 +252,7 @@
#define SCE_PL_ARRAY 13
#define SCE_PL_HASH 14
#define SCE_PL_SYMBOLTABLE 15
#define SCE_PL_VARIABLE_INDEXER 16
#define SCE_PL_REGEX 17
#define SCE_PL_REGSUBST 18
#define SCE_PL_LONGQUOTE 19
@ -255,6 +267,41 @@
#define SCE_PL_STRING_QX 28
#define SCE_PL_STRING_QR 29
#define SCE_PL_STRING_QW 30
#define SCE_PL_POD_VERB 31
#define SCE_RB_DEFAULT 0
#define SCE_RB_ERROR 1
#define SCE_RB_COMMENTLINE 2
#define SCE_RB_POD 3
#define SCE_RB_NUMBER 4
#define SCE_RB_WORD 5
#define SCE_RB_STRING 6
#define SCE_RB_CHARACTER 7
#define SCE_RB_CLASSNAME 8
#define SCE_RB_DEFNAME 9
#define SCE_RB_OPERATOR 10
#define SCE_RB_IDENTIFIER 11
#define SCE_RB_REGEX 12
#define SCE_RB_GLOBAL 13
#define SCE_RB_SYMBOL 14
#define SCE_RB_MODULE_NAME 15
#define SCE_RB_INSTANCE_VAR 16
#define SCE_RB_CLASS_VAR 17
#define SCE_RB_BACKTICKS 18
#define SCE_RB_DATASECTION 19
#define SCE_RB_HERE_DELIM 20
#define SCE_RB_HERE_Q 21
#define SCE_RB_HERE_QQ 22
#define SCE_RB_HERE_QX 23
#define SCE_RB_STRING_Q 24
#define SCE_RB_STRING_QQ 25
#define SCE_RB_STRING_QX 26
#define SCE_RB_STRING_QR 27
#define SCE_RB_STRING_QW 28
#define SCE_RB_WORD_DEMOTED 29
#define SCE_RB_STDIN 30
#define SCE_RB_STDOUT 31
#define SCE_RB_STDERR 40
#define SCE_RB_UPPER_BOUND 41
#define SCE_B_DEFAULT 0
#define SCE_B_COMMENT 1
#define SCE_B_NUMBER 2
@ -270,6 +317,10 @@
#define SCE_B_KEYWORD4 12
#define SCE_B_CONSTANT 13
#define SCE_B_ASM 14
#define SCE_B_LABEL 15
#define SCE_B_ERROR 16
#define SCE_B_HEXNUMBER 17
#define SCE_B_BINNUMBER 18
#define SCE_PROPS_DEFAULT 0
#define SCE_PROPS_COMMENT 1
#define SCE_PROPS_SECTION 2
@ -395,10 +446,14 @@
#define SCE_LISP_COMMENT 1
#define SCE_LISP_NUMBER 2
#define SCE_LISP_KEYWORD 3
#define SCE_LISP_KEYWORD_KW 4
#define SCE_LISP_SYMBOL 5
#define SCE_LISP_STRING 6
#define SCE_LISP_STRINGEOL 8
#define SCE_LISP_IDENTIFIER 9
#define SCE_LISP_OPERATOR 10
#define SCE_LISP_SPECIAL 11
#define SCE_LISP_MULTI_COMMENT 12
#define SCE_EIFFEL_DEFAULT 0
#define SCE_EIFFEL_COMMENTLINE 1
#define SCE_EIFFEL_NUMBER 2
@ -502,6 +557,7 @@
#define SCE_CSS_DOUBLESTRING 13
#define SCE_CSS_SINGLESTRING 14
#define SCE_CSS_IDENTIFIER2 15
#define SCE_CSS_ATTRIBUTE 16
#define SCE_POV_DEFAULT 0
#define SCE_POV_COMMENT 1
#define SCE_POV_COMMENTLINE 2
@ -573,6 +629,10 @@
#define SCE_NSIS_MACRODEF 12
#define SCE_NSIS_STRINGVAR 13
#define SCE_NSIS_NUMBER 14
#define SCE_NSIS_SECTIONGROUP 15
#define SCE_NSIS_PAGEEX 16
#define SCE_NSIS_FUNCTIONDEF 17
#define SCE_NSIS_COMMENTBOX 18
#define SCE_MMIXAL_LEADWS 0
#define SCE_MMIXAL_COMMENT 1
#define SCE_MMIXAL_LABEL 2
@ -601,11 +661,13 @@
#define SCE_CLW_PICTURE_STRING 7
#define SCE_CLW_KEYWORD 8
#define SCE_CLW_COMPILER_DIRECTIVE 9
#define SCE_CLW_BUILTIN_PROCEDURES_FUNCTION 10
#define SCE_CLW_STRUCTURE_DATA_TYPE 11
#define SCE_CLW_ATTRIBUTE 12
#define SCE_CLW_STANDARD_EQUATE 13
#define SCE_CLW_ERROR 14
#define SCE_CLW_RUNTIME_EXPRESSIONS 10
#define SCE_CLW_BUILTIN_PROCEDURES_FUNCTION 11
#define SCE_CLW_STRUCTURE_DATA_TYPE 12
#define SCE_CLW_ATTRIBUTE 13
#define SCE_CLW_STANDARD_EQUATE 14
#define SCE_CLW_ERROR 15
#define SCE_CLW_DEPRECATED 16
#define SCE_LOT_DEFAULT 0
#define SCE_LOT_HEADER 1
#define SCE_LOT_BREAK 2
@ -731,6 +793,8 @@
#define SCE_AU3_SENT 10
#define SCE_AU3_PREPROCESSOR 11
#define SCE_AU3_SPECIAL 12
#define SCE_AU3_EXPAND 13
#define SCE_AU3_COMOBJ 14
#define SCE_APDL_DEFAULT 0
#define SCE_APDL_COMMENT 1
#define SCE_APDL_COMMENTBLOCK 2
@ -784,6 +848,168 @@
#define SCE_VHDL_STDPACKAGE 12
#define SCE_VHDL_STDTYPE 13
#define SCE_VHDL_USERWORD 14
#define SCE_CAML_DEFAULT 0
#define SCE_CAML_IDENTIFIER 1
#define SCE_CAML_TAGNAME 2
#define SCE_CAML_KEYWORD 3
#define SCE_CAML_KEYWORD2 4
#define SCE_CAML_KEYWORD3 5
#define SCE_CAML_LINENUM 6
#define SCE_CAML_OPERATOR 7
#define SCE_CAML_NUMBER 8
#define SCE_CAML_CHAR 9
#define SCE_CAML_STRING 11
#define SCE_CAML_COMMENT 12
#define SCE_CAML_COMMENT1 13
#define SCE_CAML_COMMENT2 14
#define SCE_CAML_COMMENT3 15
#define SCE_HA_DEFAULT 0
#define SCE_HA_IDENTIFIER 1
#define SCE_HA_KEYWORD 2
#define SCE_HA_NUMBER 3
#define SCE_HA_STRING 4
#define SCE_HA_CHARACTER 5
#define SCE_HA_CLASS 6
#define SCE_HA_MODULE 7
#define SCE_HA_CAPITAL 8
#define SCE_HA_DATA 9
#define SCE_HA_IMPORT 10
#define SCE_HA_OPERATOR 11
#define SCE_HA_INSTANCE 12
#define SCE_HA_COMMENTLINE 13
#define SCE_HA_COMMENTBLOCK 14
#define SCE_HA_COMMENTBLOCK2 15
#define SCE_HA_COMMENTBLOCK3 16
#define SCE_T3_DEFAULT 0
#define SCE_T3_X_DEFAULT 1
#define SCE_T3_PREPROCESSOR 2
#define SCE_T3_BLOCK_COMMENT 3
#define SCE_T3_LINE_COMMENT 4
#define SCE_T3_OPERATOR 5
#define SCE_T3_KEYWORD 6
#define SCE_T3_NUMBER 7
#define SCE_T3_IDENTIFIER 8
#define SCE_T3_S_STRING 9
#define SCE_T3_D_STRING 10
#define SCE_T3_X_STRING 11
#define SCE_T3_LIB_DIRECTIVE 12
#define SCE_T3_MSG_PARAM 13
#define SCE_T3_HTML_TAG 14
#define SCE_T3_HTML_DEFAULT 15
#define SCE_T3_HTML_STRING 16
#define SCE_T3_USER1 17
#define SCE_T3_USER2 18
#define SCE_T3_USER3 19
#define SCE_REBOL_DEFAULT 0
#define SCE_REBOL_COMMENTLINE 1
#define SCE_REBOL_COMMENTBLOCK 2
#define SCE_REBOL_PREFACE 3
#define SCE_REBOL_OPERATOR 4
#define SCE_REBOL_CHARACTER 5
#define SCE_REBOL_QUOTEDSTRING 6
#define SCE_REBOL_BRACEDSTRING 7
#define SCE_REBOL_NUMBER 8
#define SCE_REBOL_PAIR 9
#define SCE_REBOL_TUPLE 10
#define SCE_REBOL_BINARY 11
#define SCE_REBOL_MONEY 12
#define SCE_REBOL_ISSUE 13
#define SCE_REBOL_TAG 14
#define SCE_REBOL_FILE 15
#define SCE_REBOL_EMAIL 16
#define SCE_REBOL_URL 17
#define SCE_REBOL_DATE 18
#define SCE_REBOL_TIME 19
#define SCE_REBOL_IDENTIFIER 20
#define SCE_REBOL_WORD 21
#define SCE_REBOL_WORD2 22
#define SCE_REBOL_WORD3 23
#define SCE_REBOL_WORD4 24
#define SCE_REBOL_WORD5 25
#define SCE_REBOL_WORD6 26
#define SCE_REBOL_WORD7 27
#define SCE_REBOL_WORD8 28
#define SCE_SQL_DEFAULT 0
#define SCE_SQL_COMMENT 1
#define SCE_SQL_COMMENTLINE 2
#define SCE_SQL_COMMENTDOC 3
#define SCE_SQL_NUMBER 4
#define SCE_SQL_WORD 5
#define SCE_SQL_STRING 6
#define SCE_SQL_CHARACTER 7
#define SCE_SQL_SQLPLUS 8
#define SCE_SQL_SQLPLUS_PROMPT 9
#define SCE_SQL_OPERATOR 10
#define SCE_SQL_IDENTIFIER 11
#define SCE_SQL_SQLPLUS_COMMENT 13
#define SCE_SQL_COMMENTLINEDOC 15
#define SCE_SQL_WORD2 16
#define SCE_SQL_COMMENTDOCKEYWORD 17
#define SCE_SQL_COMMENTDOCKEYWORDERROR 18
#define SCE_SQL_USER1 19
#define SCE_SQL_USER2 20
#define SCE_SQL_USER3 21
#define SCE_SQL_USER4 22
#define SCE_SQL_QUOTEDIDENTIFIER 23
#define SCE_ST_DEFAULT 0
#define SCE_ST_STRING 1
#define SCE_ST_NUMBER 2
#define SCE_ST_COMMENT 3
#define SCE_ST_SYMBOL 4
#define SCE_ST_BINARY 5
#define SCE_ST_BOOL 6
#define SCE_ST_SELF 7
#define SCE_ST_SUPER 8
#define SCE_ST_NIL 9
#define SCE_ST_GLOBAL 10
#define SCE_ST_RETURN 11
#define SCE_ST_SPECIAL 12
#define SCE_ST_KWSEND 13
#define SCE_ST_ASSIGN 14
#define SCE_ST_CHARACTER 15
#define SCE_ST_SPEC_SEL 16
#define SCE_FS_DEFAULT 0
#define SCE_FS_COMMENT 1
#define SCE_FS_COMMENTLINE 2
#define SCE_FS_COMMENTDOC 3
#define SCE_FS_COMMENTLINEDOC 4
#define SCE_FS_COMMENTDOCKEYWORD 5
#define SCE_FS_COMMENTDOCKEYWORDERROR 6
#define SCE_FS_KEYWORD 7
#define SCE_FS_KEYWORD2 8
#define SCE_FS_KEYWORD3 9
#define SCE_FS_KEYWORD4 10
#define SCE_FS_NUMBER 11
#define SCE_FS_STRING 12
#define SCE_FS_PREPROCESSOR 13
#define SCE_FS_OPERATOR 14
#define SCE_FS_IDENTIFIER 15
#define SCE_FS_DATE 16
#define SCE_FS_STRINGEOL 17
#define SCE_FS_CONSTANT 18
#define SCE_FS_ASM 19
#define SCE_FS_LABEL 20
#define SCE_FS_ERROR 21
#define SCE_FS_HEXNUMBER 22
#define SCE_FS_BINNUMBER 23
#define SCE_CSOUND_DEFAULT 0
#define SCE_CSOUND_COMMENT 1
#define SCE_CSOUND_NUMBER 2
#define SCE_CSOUND_OPERATOR 3
#define SCE_CSOUND_INSTR 4
#define SCE_CSOUND_IDENTIFIER 5
#define SCE_CSOUND_OPCODE 6
#define SCE_CSOUND_HEADERSTMT 7
#define SCE_CSOUND_USERKEYWORD 8
#define SCE_CSOUND_COMMENTBLOCK 9
#define SCE_CSOUND_PARAM 10
#define SCE_CSOUND_ARATE_VAR 11
#define SCE_CSOUND_KRATE_VAR 12
#define SCE_CSOUND_IRATE_VAR 13
#define SCE_CSOUND_GLOBAL_VAR 14
#define SCE_CSOUND_STRINGEOL 15
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface
#endif

View File

@ -11,23 +11,23 @@
#ifndef SCINTILLA_H
#define SCINTILLA_H
#ifdef PLAT_WIN
#if LCCWIN
typedef BOOL bool;
#endif
#if PLAT_WIN
// Return false on failure:
bool Scintilla_RegisterClasses(void *hInstance);
bool Scintilla_ReleaseResources();
#endif
#endif
int Scintilla_LinkLexers();
// Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
// hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
// May need to be changed for 64 bit platforms.
#ifdef _MSC_VER
#if _MSC_VER >= 1300
#include <BaseTsd.h>
#endif
#endif
#ifdef MAXULONG_PTR
typedef ULONG_PTR uptr_t;
typedef LONG_PTR sptr_t;
@ -117,6 +117,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARK_DOTDOTDOT 23
#define SC_MARK_ARROWS 24
#define SC_MARK_PIXMAP 25
#define SC_MARK_FULLRECT 26
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
@ -136,6 +137,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_MARKERNEXT 2047
#define SCI_MARKERPREVIOUS 2048
#define SCI_MARKERDEFINEPIXMAP 2049
#define SCI_MARKERADDSET 2466
#define SC_MARGIN_SYMBOL 0
#define SC_MARGIN_NUMBER 1
#define SCI_SETMARGINTYPEN 2240
@ -165,6 +167,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_CHARSET_MAC 77
#define SC_CHARSET_OEM 255
#define SC_CHARSET_RUSSIAN 204
#define SC_CHARSET_CYRILLIC 1251
#define SC_CHARSET_SHIFTJIS 128
#define SC_CHARSET_SYMBOL 2
#define SC_CHARSET_TURKISH 162
@ -173,6 +176,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_CHARSET_ARABIC 178
#define SC_CHARSET_VIETNAMESE 163
#define SC_CHARSET_THAI 222
#define SC_CHARSET_8859_15 1000
#define SCI_STYLECLEARALL 2050
#define SCI_STYLESETFORE 2051
#define SCI_STYLESETBACK 2052
@ -255,6 +259,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_CLEARREGISTEREDIMAGES 2408
#define SCI_AUTOCGETTYPESEPARATOR 2285
#define SCI_AUTOCSETTYPESEPARATOR 2286
#define SCI_AUTOCSETMAXWIDTH 2208
#define SCI_AUTOCGETMAXWIDTH 2209
#define SCI_AUTOCSETMAXHEIGHT 2210
#define SCI_AUTOCGETMAXHEIGHT 2211
#define SCI_SETINDENT 2122
#define SCI_GETINDENT 2123
#define SCI_SETUSETABS 2124
@ -352,6 +360,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_CALLTIPSETFOREHLT 2207
#define SCI_VISIBLEFROMDOCLINE 2220
#define SCI_DOCLINEFROMVISIBLE 2221
#define SCI_WRAPCOUNT 2235
#define SC_FOLDLEVELBASE 0x400
#define SC_FOLDLEVELWHITEFLAG 0x1000
#define SC_FOLDLEVELHEADERFLAG 0x2000
@ -390,6 +399,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_WORDENDPOSITION 2267
#define SC_WRAP_NONE 0
#define SC_WRAP_WORD 1
#define SC_WRAP_CHAR 2
#define SCI_SETWRAPMODE 2268
#define SCI_GETWRAPMODE 2269
#define SC_WRAPVISUALFLAG_NONE 0x0000
@ -591,6 +601,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETLENGTHFORENCODE 2448
#define SCI_ENCODEDFROMUTF8 2449
#define SCI_FINDCOLUMN 2456
#define SCI_GETCARETSTICKY 2457
#define SCI_SETCARETSTICKY 2458
#define SCI_TOGGLECARETSTICKY 2459
#define SCI_SETPASTECONVERTENDINGS 2467
#define SCI_GETPASTECONVERTENDINGS 2468
#define SCI_SELECTIONDUPLICATE 2469
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
@ -601,6 +617,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETKEYWORDS 4005
#define SCI_SETLEXERLANGUAGE 4006
#define SCI_LOADLEXERLIBRARY 4007
#define SCI_GETPROPERTY 4008
#define SCI_GETPROPERTYEXPANDED 4009
#define SCI_GETPROPERTYINT 4010
#define SCI_GETSTYLEBITSNEEDED 4011
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
@ -608,11 +628,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_PERFORMED_USER 0x10
#define SC_PERFORMED_UNDO 0x20
#define SC_PERFORMED_REDO 0x40
#define SC_MULTISTEPUNDOREDO 0x80
#define SC_LASTSTEPINUNDOREDO 0x100
#define SC_MOD_CHANGEMARKER 0x200
#define SC_MOD_BEFOREINSERT 0x400
#define SC_MOD_BEFOREDELETE 0x800
#define SC_MODEVENTMASKALL 0xF77
#define SC_MULTILINEUNDOREDO 0x1000
#define SC_MODEVENTMASKALL 0x1FFF
#define SCEN_CHANGE 768
#define SCEN_SETFOCUS 512
#define SCEN_KILLFOCUS 256
@ -633,6 +655,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCK_ADD 310
#define SCK_SUBTRACT 311
#define SCK_DIVIDE 312
#define SCMOD_NORM 0
#define SCMOD_SHIFT 1
#define SCMOD_CTRL 2
#define SCMOD_ALT 4
@ -657,6 +680,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCN_HOTSPOTCLICK 2019
#define SCN_HOTSPOTDOUBLECLICK 2020
#define SCN_CALLTIPCLICK 2021
#define SCN_AUTOCSELECTION 2022
//--Autogenerated -- end of section automatically generated from Scintilla.iface
// These structures are defined to be exactly the same shape as the Win32
@ -695,11 +719,11 @@ struct RangeToFormat {
#endif
struct NotifyHeader {
// hwndFrom is really an environment specifc window handle or pointer
// Compatible with Windows NMHDR.
// hwndFrom is really an environment specific window handle or pointer
// but most clients of Scintilla.h do not have this type visible.
//WindowID hwndFrom;
void *hwndFrom;
unsigned int idFrom;
uptr_t idFrom;
unsigned int code;
};
@ -709,7 +733,7 @@ struct SCNotification {
int ch; // SCN_CHARADDED, SCN_KEY
int modifiers; // SCN_KEY
int modificationType; // SCN_MODIFIED
const char *text; // SCN_MODIFIED
const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION
int length; // SCN_MODIFIED
int linesAdded; // SCN_MODIFIED
int message; // SCN_MACRORECORD

View File

@ -267,6 +267,7 @@ val SC_MARK_BACKGROUND=22
val SC_MARK_DOTDOTDOT=23
val SC_MARK_ARROWS=24
val SC_MARK_PIXMAP=25
val SC_MARK_FULLRECT=26
val SC_MARK_CHARACTER=10000
@ -312,6 +313,9 @@ fun int MarkerPrevious=2048(int lineStart, int markerMask)
# Define a marker from a pixmap.
fun void MarkerDefinePixmap=2049(int markerNumber, string pixmap)
# Add a set of markers to a line.
fun void MarkerAddSet=2466(int line, int set)
enu MarginType=SC_MARGIN_
val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1
@ -366,6 +370,7 @@ val SC_CHARSET_HANGUL=129
val SC_CHARSET_MAC=77
val SC_CHARSET_OEM=255
val SC_CHARSET_RUSSIAN=204
val SC_CHARSET_CYRILLIC=1251
val SC_CHARSET_SHIFTJIS=128
val SC_CHARSET_SYMBOL=2
val SC_CHARSET_TURKISH=162
@ -374,6 +379,7 @@ val SC_CHARSET_HEBREW=177
val SC_CHARSET_ARABIC=178
val SC_CHARSET_VIETNAMESE=163
val SC_CHARSET_THAI=222
val SC_CHARSET_8859_15=1000
# Clear all the styles and make equivalent to the global default style.
set void StyleClearAll=2050(,)
@ -607,6 +613,20 @@ get int AutoCGetTypeSeparator=2285(,)
# Default is '?' but can be changed if items contain '?'.
set void AutoCSetTypeSeparator=2286(int separatorCharacter,)
# Set the maximum width, in characters, of auto-completion and user lists.
# Set to 0 to autosize to fit longest item, which is the default.
set void AutoCSetMaxWidth=2208(int characterCount,)
# Get the maximum width, in characters, of auto-completion and user lists.
get int AutoCGetMaxWidth=2209(,)
# Set the maximum height, in rows, of auto-completion and user lists.
# The default is 5 rows.
set void AutoCSetMaxHeight=2210(int rowCount,)
# Set the maximum height, in rows, of auto-completion and user lists.
get int AutoCGetMaxHeight=2211(,)
# Set the number of spaces used for one level of indentation.
set void SetIndent=2122(int indentSize,)
@ -905,6 +925,9 @@ fun int VisibleFromDocLine=2220(int line,)
# Find the document line of a display line taking hidden lines into account.
fun int DocLineFromVisible=2221(int lineDisplay,)
# The number of display lines needed to wrap a document line
fun int WrapCount=2235(int line,)
enu FoldLevel=SC_FOLDLEVEL
val SC_FOLDLEVELBASE=0x400
val SC_FOLDLEVELWHITEFLAG=0x1000
@ -994,6 +1017,7 @@ fun int WordEndPosition=2267(position pos, bool onlyWordCharacters)
enu Wrap=SC_WRAP_
val SC_WRAP_NONE=0
val SC_WRAP_WORD=1
val SC_WRAP_CHAR=2
# Sets whether text is word wrapped.
set void SetWrapMode=2268(int mode,)
@ -1059,7 +1083,7 @@ set void SetEndAtLastLine=2277(bool endAtLastLine,)
# Retrieve whether the maximum scroll position has the last
# line at the bottom of the view.
get int GetEndAtLastLine=2278(,)
get bool GetEndAtLastLine=2278(,)
# Retrieve the height of a particular line of text in pixels.
fun int TextHeight=2279(int line,)
@ -1588,7 +1612,7 @@ fun void Allocate=2446(int bytes,)
fun int TargetAsUTF8=2447(, stringresult s)
# Set the length of the utf8 argument for calling EncodedFromUTF8.
# Set to 0 and the string will be measured to the first nul.
# Set to -1 and the string will be measured to the first nul.
fun void SetLengthForEncode=2448(int bytes,)
# Translates a UTF8 string into the document encoding.
@ -1596,10 +1620,28 @@ fun void SetLengthForEncode=2448(int bytes,)
# On error return 0.
fun int EncodedFromUTF8=2449(string utf8, stringresult encoded)
# Find the position of a column on a line taking into account tabs and
# Find the position of a column on a line taking into account tabs and
# multi-byte characters. If beyond end of line, return line end position.
fun int FindColumn=2456(int line, int column)
# Can the caret preferred x position only be changed by explicit movement commands?
get bool GetCaretSticky=2457(,)
# Stop the caret preferred x position changing when the user types.
set void SetCaretSticky=2458(bool useCaretStickyBehaviour,)
# Switch between sticky and non-sticky: meant to be bound to a key.
fun void ToggleCaretSticky=2459(,)
# Enable/Disable convert-on-paste for line endings
set void SetPasteConvertEndings=2467(bool convert,)
# Get convert-on-paste setting
get bool GetPasteConvertEndings=2468(,)
# Duplicate the selection. If selection empty duplicate the line containing the caret.
fun void SelectionDuplicate=2469(,)
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@ -1630,6 +1672,20 @@ set void SetLexerLanguage=4006(, string language)
# Load a lexer library (dll / so).
fun void LoadLexerLibrary=4007(, string path)
# Retrieve a "property" value previously set with SetProperty.
fun int GetProperty=4008(string key, stringresult buf)
# Retrieve a "property" value previously set with SetProperty,
# with "$()" variable replacement on returned buffer.
fun int GetPropertyExpanded=4009(string key, stringresult buf)
# Retrieve a "property" value previously set with SetProperty,
# interpreted as an int AFTER any "$()" variable replacement.
get int GetPropertyInt=4010(string key,)
# Retrieve the number of bits the current lexer needs for styling.
get int GetStyleBitsNeeded=4011(,)
# Notifications
# Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted.
@ -1642,11 +1698,13 @@ val SC_MOD_CHANGEFOLD=0x8
val SC_PERFORMED_USER=0x10
val SC_PERFORMED_UNDO=0x20
val SC_PERFORMED_REDO=0x40
val SC_MULTISTEPUNDOREDO=0x80
val SC_LASTSTEPINUNDOREDO=0x100
val SC_MOD_CHANGEMARKER=0x200
val SC_MOD_BEFOREINSERT=0x400
val SC_MOD_BEFOREDELETE=0x800
val SC_MODEVENTMASKALL=0xF77
val SC_MULTILINEUNDOREDO=0x1000
val SC_MODEVENTMASKALL=0x1FFF
# For compatibility, these go through the COMMAND notification rather than NOTIFY
# and should have had exactly the same values as the EN_* constants.
@ -1680,6 +1738,7 @@ val SCK_SUBTRACT=311
val SCK_DIVIDE=312
enu KeyMod=SCMOD_
val SCMOD_NORM=0
val SCMOD_SHIFT=1
val SCMOD_CTRL=2
val SCMOD_ALT=4
@ -1716,8 +1775,6 @@ val SCLEX_TCL=25
val SCLEX_NNCRONTAB=26
val SCLEX_BULLANT=27
val SCLEX_VBSCRIPT=28
val SCLEX_ASP=29
val SCLEX_PHP=30
val SCLEX_BAAN=31
val SCLEX_MATLAB=32
val SCLEX_SCRIPTOL=33
@ -1752,13 +1809,23 @@ val SCLEX_APDL=61
val SCLEX_BASH=62
val SCLEX_ASN1=63
val SCLEX_VHDL=64
val SCLEX_CAML=65
val SCLEX_BLITZBASIC=66
val SCLEX_PUREBASIC=67
val SCLEX_HASKELL=68
val SCLEX_PHPSCRIPT=69
val SCLEX_TADS3=70
val SCLEX_REBOL=71
val SCLEX_SMALLTALK=72
val SCLEX_FLAGSHIP=73
val SCLEX_CSOUND=74
val SCLEX_FREEBASIC=75
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
val SCLEX_AUTOMATIC=1000
# Lexical states for SCLEX_PYTHON
lex Python=SCLEX_PYTHON SCE_P_
lex Ruby=SCLEX_RUBY SCE_P_
val SCE_P_DEFAULT=0
val SCE_P_COMMENTLINE=1
val SCE_P_NUMBER=2
@ -1773,9 +1840,10 @@ val SCE_P_OPERATOR=10
val SCE_P_IDENTIFIER=11
val SCE_P_COMMENTBLOCK=12
val SCE_P_STRINGEOL=13
val SCE_P_WORD2=14
val SCE_P_DECORATOR=15
# Lexical states for SCLEX_CPP
lex Cpp=SCLEX_CPP SCE_C_
lex SQL=SCLEX_SQL SCE_C_
lex Pascal=SCLEX_PASCAL SCE_C_
lex TCL=SCLEX_TCL SCE_C_
lex BullAnt=SCLEX_BULLANT SCE_C_
@ -1945,6 +2013,7 @@ val SCE_PL_SCALAR=12
val SCE_PL_ARRAY=13
val SCE_PL_HASH=14
val SCE_PL_SYMBOLTABLE=15
val SCE_PL_VARIABLE_INDEXER=16
val SCE_PL_REGEX=17
val SCE_PL_REGSUBST=18
val SCE_PL_LONGQUOTE=19
@ -1959,6 +2028,43 @@ val SCE_PL_STRING_QQ=27
val SCE_PL_STRING_QX=28
val SCE_PL_STRING_QR=29
val SCE_PL_STRING_QW=30
val SCE_PL_POD_VERB=31
# Lexical states for SCLEX_RUBY
lex Ruby=SCLEX_RUBY SCE_RB_
val SCE_RB_DEFAULT=0
val SCE_RB_ERROR=1
val SCE_RB_COMMENTLINE=2
val SCE_RB_POD=3
val SCE_RB_NUMBER=4
val SCE_RB_WORD=5
val SCE_RB_STRING=6
val SCE_RB_CHARACTER=7
val SCE_RB_CLASSNAME=8
val SCE_RB_DEFNAME=9
val SCE_RB_OPERATOR=10
val SCE_RB_IDENTIFIER=11
val SCE_RB_REGEX=12
val SCE_RB_GLOBAL=13
val SCE_RB_SYMBOL=14
val SCE_RB_MODULE_NAME=15
val SCE_RB_INSTANCE_VAR=16
val SCE_RB_CLASS_VAR=17
val SCE_RB_BACKTICKS=18
val SCE_RB_DATASECTION=19
val SCE_RB_HERE_DELIM=20
val SCE_RB_HERE_Q=21
val SCE_RB_HERE_QQ=22
val SCE_RB_HERE_QX=23
val SCE_RB_STRING_Q=24
val SCE_RB_STRING_QQ=25
val SCE_RB_STRING_QX=26
val SCE_RB_STRING_QR=27
val SCE_RB_STRING_QW=28
val SCE_RB_WORD_DEMOTED=29
val SCE_RB_STDIN=30
val SCE_RB_STDOUT=31
val SCE_RB_STDERR=40
val SCE_RB_UPPER_BOUND=41
# Lexical states for SCLEX_VB, SCLEX_VBSCRIPT, SCLEX_POWERBASIC
lex VB=SCLEX_VB SCE_B_
lex VBScript=SCLEX_VBSCRIPT SCE_B_
@ -1978,6 +2084,10 @@ val SCE_B_KEYWORD3=11
val SCE_B_KEYWORD4=12
val SCE_B_CONSTANT=13
val SCE_B_ASM=14
val SCE_B_LABEL=15
val SCE_B_ERROR=16
val SCE_B_HEXNUMBER=17
val SCE_B_BINNUMBER=18
# Lexical states for SCLEX_PROPERTIES
lex Properties=SCLEX_PROPERTIES SCE_PROPS_
val SCE_PROPS_DEFAULT=0
@ -2127,10 +2237,14 @@ val SCE_LISP_DEFAULT=0
val SCE_LISP_COMMENT=1
val SCE_LISP_NUMBER=2
val SCE_LISP_KEYWORD=3
val SCE_LISP_KEYWORD_KW=4
val SCE_LISP_SYMBOL=5
val SCE_LISP_STRING=6
val SCE_LISP_STRINGEOL=8
val SCE_LISP_IDENTIFIER=9
val SCE_LISP_OPERATOR=10
val SCE_LISP_SPECIAL=11
val SCE_LISP_MULTI_COMMENT=12
# Lexical states for SCLEX_EIFFEL and SCLEX_EIFFELKW
lex Eiffel=SCLEX_EIFFEL SCE_EIFFEL_
lex EiffelKW=SCLEX_EIFFELKW SCE_EIFFEL_
@ -2253,6 +2367,7 @@ val SCE_CSS_DIRECTIVE=12
val SCE_CSS_DOUBLESTRING=13
val SCE_CSS_SINGLESTRING=14
val SCE_CSS_IDENTIFIER2=15
val SCE_CSS_ATTRIBUTE=16
# Lexical states for SCLEX_POV
lex POV=SCLEX_POV SCE_POV_
val SCE_POV_DEFAULT=0
@ -2334,6 +2449,10 @@ val SCE_NSIS_IFDEFINEDEF=11
val SCE_NSIS_MACRODEF=12
val SCE_NSIS_STRINGVAR=13
val SCE_NSIS_NUMBER=14
val SCE_NSIS_SECTIONGROUP=15
val SCE_NSIS_PAGEEX=16
val SCE_NSIS_FUNCTIONDEF=17
val SCE_NSIS_COMMENTBOX=18
# Lexical states for SCLEX_MMIXAL
lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_
val SCE_MMIXAL_LEADWS=0
@ -2366,11 +2485,13 @@ val SCE_CLW_REAL_CONSTANT=6
val SCE_CLW_PICTURE_STRING=7
val SCE_CLW_KEYWORD=8
val SCE_CLW_COMPILER_DIRECTIVE=9
val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=10
val SCE_CLW_STRUCTURE_DATA_TYPE=11
val SCE_CLW_ATTRIBUTE=12
val SCE_CLW_STANDARD_EQUATE=13
val SCE_CLW_ERROR=14
val SCE_CLW_RUNTIME_EXPRESSIONS=10
val SCE_CLW_BUILTIN_PROCEDURES_FUNCTION=11
val SCE_CLW_STRUCTURE_DATA_TYPE=12
val SCE_CLW_ATTRIBUTE=13
val SCE_CLW_STANDARD_EQUATE=14
val SCE_CLW_ERROR=15
val SCE_CLW_DEPRECATED=16
# Lexical states for SCLEX_LOT
lex LOT=SCLEX_LOT SCE_LOT_
val SCE_LOT_DEFAULT=0
@ -2518,6 +2639,8 @@ val SCE_AU3_VARIABLE=9
val SCE_AU3_SENT=10
val SCE_AU3_PREPROCESSOR=11
val SCE_AU3_SPECIAL=12
val SCE_AU3_EXPAND=13
val SCE_AU3_COMOBJ=14
# Lexical states for SCLEX_APDL
lex APDL=SCLEX_APDL SCE_APDL_
val SCE_APDL_DEFAULT=0
@ -2579,6 +2702,182 @@ val SCE_VHDL_STDFUNCTION=11
val SCE_VHDL_STDPACKAGE=12
val SCE_VHDL_STDTYPE=13
val SCE_VHDL_USERWORD=14
# Lexical states for SCLEX_CAML
lex Caml=SCLEX_CAML SCE_CAML_
val SCE_CAML_DEFAULT=0
val SCE_CAML_IDENTIFIER=1
val SCE_CAML_TAGNAME=2
val SCE_CAML_KEYWORD=3
val SCE_CAML_KEYWORD2=4
val SCE_CAML_KEYWORD3=5
val SCE_CAML_LINENUM=6
val SCE_CAML_OPERATOR=7
val SCE_CAML_NUMBER=8
val SCE_CAML_CHAR=9
val SCE_CAML_STRING=11
val SCE_CAML_COMMENT=12
val SCE_CAML_COMMENT1=13
val SCE_CAML_COMMENT2=14
val SCE_CAML_COMMENT3=15
# Lexical states for SCLEX_HASKELL
lex Haskell=SCLEX_HASKELL SCE_HA_
val SCE_HA_DEFAULT=0
val SCE_HA_IDENTIFIER=1
val SCE_HA_KEYWORD=2
val SCE_HA_NUMBER=3
val SCE_HA_STRING=4
val SCE_HA_CHARACTER=5
val SCE_HA_CLASS=6
val SCE_HA_MODULE=7
val SCE_HA_CAPITAL=8
val SCE_HA_DATA=9
val SCE_HA_IMPORT=10
val SCE_HA_OPERATOR=11
val SCE_HA_INSTANCE=12
val SCE_HA_COMMENTLINE=13
val SCE_HA_COMMENTBLOCK=14
val SCE_HA_COMMENTBLOCK2=15
val SCE_HA_COMMENTBLOCK3=16
# Lexical states of SCLEX_TADS3
lex TADS3=SCLEX_TADS3 SCE_T3_
val SCE_T3_DEFAULT=0
val SCE_T3_X_DEFAULT=1
val SCE_T3_PREPROCESSOR=2
val SCE_T3_BLOCK_COMMENT=3
val SCE_T3_LINE_COMMENT=4
val SCE_T3_OPERATOR=5
val SCE_T3_KEYWORD=6
val SCE_T3_NUMBER=7
val SCE_T3_IDENTIFIER=8
val SCE_T3_S_STRING=9
val SCE_T3_D_STRING=10
val SCE_T3_X_STRING=11
val SCE_T3_LIB_DIRECTIVE=12
val SCE_T3_MSG_PARAM=13
val SCE_T3_HTML_TAG=14
val SCE_T3_HTML_DEFAULT=15
val SCE_T3_HTML_STRING=16
val SCE_T3_USER1=17
val SCE_T3_USER2=18
val SCE_T3_USER3=19
# Lexical states for SCLEX_REBOL
lex Rebol=SCLEX_REBOL SCE_REBOL_
val SCE_REBOL_DEFAULT=0
val SCE_REBOL_COMMENTLINE=1
val SCE_REBOL_COMMENTBLOCK=2
val SCE_REBOL_PREFACE=3
val SCE_REBOL_OPERATOR=4
val SCE_REBOL_CHARACTER=5
val SCE_REBOL_QUOTEDSTRING=6
val SCE_REBOL_BRACEDSTRING=7
val SCE_REBOL_NUMBER=8
val SCE_REBOL_PAIR=9
val SCE_REBOL_TUPLE=10
val SCE_REBOL_BINARY=11
val SCE_REBOL_MONEY=12
val SCE_REBOL_ISSUE=13
val SCE_REBOL_TAG=14
val SCE_REBOL_FILE=15
val SCE_REBOL_EMAIL=16
val SCE_REBOL_URL=17
val SCE_REBOL_DATE=18
val SCE_REBOL_TIME=19
val SCE_REBOL_IDENTIFIER=20
val SCE_REBOL_WORD=21
val SCE_REBOL_WORD2=22
val SCE_REBOL_WORD3=23
val SCE_REBOL_WORD4=24
val SCE_REBOL_WORD5=25
val SCE_REBOL_WORD6=26
val SCE_REBOL_WORD7=27
val SCE_REBOL_WORD8=28
# Lexical states for SCLEX_SQL
lex SQL=SCLEX_SQL SCE_SQL_
val SCE_SQL_DEFAULT=0
val SCE_SQL_COMMENT=1
val SCE_SQL_COMMENTLINE=2
val SCE_SQL_COMMENTDOC=3
val SCE_SQL_NUMBER=4
val SCE_SQL_WORD=5
val SCE_SQL_STRING=6
val SCE_SQL_CHARACTER=7
val SCE_SQL_SQLPLUS=8
val SCE_SQL_SQLPLUS_PROMPT=9
val SCE_SQL_OPERATOR=10
val SCE_SQL_IDENTIFIER=11
val SCE_SQL_SQLPLUS_COMMENT=13
val SCE_SQL_COMMENTLINEDOC=15
val SCE_SQL_WORD2=16
val SCE_SQL_COMMENTDOCKEYWORD=17
val SCE_SQL_COMMENTDOCKEYWORDERROR=18
val SCE_SQL_USER1=19
val SCE_SQL_USER2=20
val SCE_SQL_USER3=21
val SCE_SQL_USER4=22
val SCE_SQL_QUOTEDIDENTIFIER=23
# Lexical states for SCLEX_SMALLTALK
lex Smalltalk=SCLEX_SMALLTALK SCE_ST_
val SCE_ST_DEFAULT=0
val SCE_ST_STRING=1
val SCE_ST_NUMBER=2
val SCE_ST_COMMENT=3
val SCE_ST_SYMBOL=4
val SCE_ST_BINARY=5
val SCE_ST_BOOL=6
val SCE_ST_SELF=7
val SCE_ST_SUPER=8
val SCE_ST_NIL=9
val SCE_ST_GLOBAL=10
val SCE_ST_RETURN=11
val SCE_ST_SPECIAL=12
val SCE_ST_KWSEND=13
val SCE_ST_ASSIGN=14
val SCE_ST_CHARACTER=15
val SCE_ST_SPEC_SEL=16
# Lexical states for SCLEX_FLAGSHIP (clipper)
lex FlagShip=SCLEX_FLAGSHIP SCE_B_
val SCE_FS_DEFAULT=0
val SCE_FS_COMMENT=1
val SCE_FS_COMMENTLINE=2
val SCE_FS_COMMENTDOC=3
val SCE_FS_COMMENTLINEDOC=4
val SCE_FS_COMMENTDOCKEYWORD=5
val SCE_FS_COMMENTDOCKEYWORDERROR=6
val SCE_FS_KEYWORD=7
val SCE_FS_KEYWORD2=8
val SCE_FS_KEYWORD3=9
val SCE_FS_KEYWORD4=10
val SCE_FS_NUMBER=11
val SCE_FS_STRING=12
val SCE_FS_PREPROCESSOR=13
val SCE_FS_OPERATOR=14
val SCE_FS_IDENTIFIER=15
val SCE_FS_DATE=16
val SCE_FS_STRINGEOL=17
val SCE_FS_CONSTANT=18
val SCE_FS_ASM=19
val SCE_FS_LABEL=20
val SCE_FS_ERROR=21
val SCE_FS_HEXNUMBER=22
val SCE_FS_BINNUMBER=23
# Lexical states for SCLEX_CSOUND
lex Csound=SCLEX_CSOUND SCE_CSOUND_
val SCE_CSOUND_DEFAULT=0
val SCE_CSOUND_COMMENT=1
val SCE_CSOUND_NUMBER=2
val SCE_CSOUND_OPERATOR=3
val SCE_CSOUND_INSTR=4
val SCE_CSOUND_IDENTIFIER=5
val SCE_CSOUND_OPCODE=6
val SCE_CSOUND_HEADERSTMT=7
val SCE_CSOUND_USERKEYWORD=8
val SCE_CSOUND_COMMENTBLOCK=9
val SCE_CSOUND_PARAM=10
val SCE_CSOUND_ARATE_VAR=11
val SCE_CSOUND_KRATE_VAR=12
val SCE_CSOUND_IRATE_VAR=13
val SCE_CSOUND_GLOBAL_VAR=14
val SCE_CSOUND_STRINGEOL=15
# Events
@ -2604,6 +2903,7 @@ evt void Zoom=2018(void)
evt void HotSpotClick=2019(int modifiers, int position)
evt void HotSpotDoubleClick=2020(int modifiers, int position)
evt void CallTipClick=2021(int position)
evt void AutoCSelection=2022(string text)
cat Deprecated
@ -2617,3 +2917,6 @@ val CARET_XJUMPS=0x10
val SCN_CHECKBRACE=2007
evt void PosChanged=2012(int position)
# SCLEX_HTML should be used in preference to these.
val SCLEX_ASP=29
val SCLEX_PHP=30

View File

@ -34,9 +34,9 @@ struct _ScintillaClass {
void (* notify) (ScintillaObject *ttt);
};
guint scintilla_get_type (void);
GtkType scintilla_get_type (void);
GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci,int id);
void scintilla_set_id (ScintillaObject *sci, uptr_t id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void scintilla_release_resources(void);

View File

@ -43,12 +43,13 @@ bool AutoComplete::Active() {
return active;
}
void AutoComplete::Start(Window &parent, int ctrlID, int position,
int startLen_, int lineHeight, bool unicodeMode) {
void AutoComplete::Start(Window &parent, int ctrlID,
int position, Point location, int startLen_,
int lineHeight, bool unicodeMode) {
if (active) {
Cancel();
}
lb->Create(parent, ctrlID, lineHeight, unicodeMode);
lb->Create(parent, ctrlID, location, lineHeight, unicodeMode);
lb->Clear();
active = true;
startLen = startLen_;
@ -90,41 +91,18 @@ char AutoComplete::GetTypesep() {
}
void AutoComplete::SetList(const char *list) {
lb->Clear();
char *words = new char[strlen(list) + 1];
if (words) {
strcpy(words, list);
char *startword = words;
char *numword = NULL;
int i = 0;
for (; words && words[i]; i++) {
if (words[i] == separator) {
words[i] = '\0';
if (numword)
*numword = '\0';
lb->Append(startword, numword?atoi(numword + 1):-1);
startword = words + i + 1;
numword = NULL;
} else if (words[i] == typesep) {
numword = words + i;
}
}
if (startword) {
if (numword)
*numword = '\0';
lb->Append(startword, numword?atoi(numword + 1):-1);
}
delete []words;
}
lb->SetList(list, separator, typesep);
}
void AutoComplete::Show() {
lb->Show();
lb->Select(0);
void AutoComplete::Show(bool show) {
lb->Show(show);
if (show)
lb->Select(0);
}
void AutoComplete::Cancel() {
if (lb->Created()) {
lb->Clear();
lb->Destroy();
active = false;
}
@ -170,6 +148,18 @@ void AutoComplete::Select(const char *word) {
--pivot;
}
location = pivot;
if (ignoreCase) {
// Check for exact-case match
for (; pivot <= end; pivot++) {
lb->GetValue(pivot, item, maxItemLen);
if (!strncmp(word, item, lenWord)) {
location = pivot;
break;
}
if (CompareNCaseInsensitive(word, item, lenWord))
break;
}
}
} else if (cond < 0) {
end = pivot - 1;
} else if (cond > 0) {

View File

@ -15,7 +15,7 @@ class AutoComplete {
char stopChars[256];
char fillUpChars[256];
char separator;
char typesep; // Type separator
char typesep; // Type seperator
public:
bool ignoreCase;
@ -35,7 +35,7 @@ public:
bool Active();
/// Display the auto completion list positioned to be near a character position
void Start(Window &parent, int ctrlID, int position,
void Start(Window &parent, int ctrlID, int position, Point location,
int startLen_, int lineHeight, bool unicodeMode);
/// The stop chars are characters which, when typed, cause the auto completion list to disappear
@ -50,14 +50,14 @@ public:
void SetSeparator(char separator_);
char GetSeparator();
/// The typesep character is used for separating the word from the type
/// The typesep character is used for seperating the word from the type
void SetTypesep(char separator_);
char GetTypesep();
/// The list string contains a sequence of words separated by the separator character
void SetList(const char *list);
void Show();
void Show(bool show);
void Cancel();
/// Move the current list element by delta, scrolling appropriately

View File

@ -18,8 +18,8 @@ CallTip::CallTip() {
inCallTipMode = false;
posStartCallTip = 0;
val = 0;
xUp = -100;
xDown = -100;
rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
lineHeight = 1;
startHighlight = 0;
endHighlight = 0;
@ -75,12 +75,12 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
if (IsArrowCharacter(s[startSeg])) {
xEnd = x + widthArrow;
offsetMain = xEnd;
rcClient.left = x;
rcClient.right = xEnd;
if (draw) {
const int halfWidth = widthArrow / 2 - 3;
const int centreX = x + widthArrow / 2 - 1;
const int centreY = (rcClient.top + rcClient.bottom) / 2;
rcClient.left = x;
rcClient.right = xEnd;
surface->FillRectangle(rcClient, colourBG.allocated);
PRectangle rcClientInner(rcClient.left+1, rcClient.top+1, rcClient.right-2, rcClient.bottom-1);
surface->FillRectangle(rcClientInner, colourUnSel.allocated);
@ -104,12 +104,11 @@ void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
colourBG.allocated, colourBG.allocated);
}
} else {
if (s[startSeg] == '\001') {
xUp = x+1;
} else {
xDown = x+1;
}
}
if (s[startSeg] == '\001') {
rectUp = rcClient;
} else if (s[startSeg] == '\002') {
rectDown = rcClient;
}
} else {
xEnd = x + surface->WidthText(font, s+startSeg, endSeg - startSeg);
@ -203,13 +202,10 @@ void CallTip::PaintCT(Surface *surfaceWindow) {
void CallTip::MouseClick(Point pt) {
clickPlace = 0;
if (pt.y < lineHeight) {
if ((pt.x > xUp) && (pt.x < xUp + widthArrow - 2)) {
clickPlace = 1;
} else if ((pt.x > xDown) && (pt.x < xDown + widthArrow - 2)) {
clickPlace = 2;
}
}
if (rectUp.Contains(pt))
clickPlace = 1;
if (rectDown.Contains(pt))
clickPlace = 2;
}
PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
@ -240,8 +236,8 @@ PRectangle CallTip::CallTipStart(int pos, Point pt, const char *defn,
int numLines = 1;
const char *newline;
const char *look = val;
xUp = -100;
xDown = -100;
rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
offsetMain = 5;
int width = PaintContents(surfaceMeasure, false) + 5;
while ((newline = strchr(look, '\n')) != NULL) {

View File

@ -15,8 +15,8 @@ class CallTip {
int endHighlight;
char *val;
Font font;
int xUp;
int xDown;
PRectangle rectUp;
PRectangle rectDown;
int lineHeight;
int offsetMain;
// Private so CallTip objects can not be copied

View File

@ -254,13 +254,14 @@ void LineVector::Remove(int pos) {
linesData[i] = linesData[i + 1];
}
if (levels) {
// Level information merges back onto previous line
int posAbove = pos - 1;
if (posAbove < 0)
posAbove = 0;
for (int j = posAbove; j < lines; j++) {
// Move up following lines but merge header flag from this line
// to line before to avoid a temporary disappearence causing expansion.
int firstHeader = levels[pos] & SC_FOLDLEVELHEADERFLAG;
for (int j = pos; j < lines; j++) {
levels[j] = levels[j + 1];
}
if (pos > 0)
levels[pos-1] |= firstHeader;
}
lines--;
}
@ -464,7 +465,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
} else if (currentAction == savePoint) {
currentAction++;
} else if ((at == insertAction) &&
(position != (actPrevious.position + actPrevious.lenData*2))) {
(position != (actPrevious.position + actPrevious.lenData))) {
// Insertions must be immediately after to coalesce
currentAction++;
} else if (!actions[currentAction].mayCoalesce) {
@ -472,7 +473,7 @@ void UndoHistory::AppendAction(actionType at, int position, char *data, int leng
currentAction++;
} else if (at == removeAction) {
if ((lengthData == 1) || (lengthData == 2)){
if ((position + lengthData * 2) == actPrevious.position) {
if ((position + lengthData) == actPrevious.position) {
; // Backspace -> OK
} else if (position == actPrevious.position) {
; // Delete -> OK
@ -724,7 +725,7 @@ const char *CellBuffer::InsertString(int position, char *s, int insertLength) {
for (int i = 0; i < insertLength / 2; i++) {
data[i] = s[i * 2];
}
uh.AppendAction(insertAction, position, data, insertLength / 2);
uh.AppendAction(insertAction, position / 2, data, insertLength / 2);
}
BasicInsertString(position, s, insertLength);
@ -732,13 +733,6 @@ const char *CellBuffer::InsertString(int position, char *s, int insertLength) {
return data;
}
void CellBuffer::InsertCharStyle(int position, char ch, char style) {
char s[2];
s[0] = ch;
s[1] = style;
InsertString(position*2, s, 2);
}
bool CellBuffer::SetStyleAt(int position, char style, char mask) {
style &= mask;
char curVal = ByteAt(position * 2 + 1);
@ -768,6 +762,7 @@ bool CellBuffer::SetStyleFor(int position, int lengthStyle, char style, char mas
const char *CellBuffer::DeleteChars(int position, int deleteLength) {
// InsertString and DeleteChars are the bottleneck though which all changes occur
PLATFORM_ASSERT(deleteLength > 0);
char *data = 0;
if (!readOnly) {
if (collectingUndo) {
@ -776,7 +771,7 @@ const char *CellBuffer::DeleteChars(int position, int deleteLength) {
for (int i = 0; i < deleteLength / 2; i++) {
data[i] = ByteAt(position + i * 2);
}
uh.AppendAction(removeAction, position, data, deleteLength / 2);
uh.AppendAction(removeAction, position / 2, data, deleteLength / 2);
}
BasicDeleteChars(position, deleteLength);
@ -874,6 +869,7 @@ void CellBuffer::BasicInsertString(int position, char *s, int insertLength) {
//Platform::DebugPrintf("Inserting at %d for %d\n", position, insertLength);
if (insertLength == 0)
return ;
PLATFORM_ASSERT(insertLength > 0);
RoomFor(insertLength);
GapTo(position);
@ -1028,7 +1024,7 @@ void CellBuffer::DeleteUndoHistory() {
}
bool CellBuffer::CanUndo() {
return (!readOnly) && (uh.CanUndo());
return uh.CanUndo();
}
int CellBuffer::StartUndo() {
@ -1042,21 +1038,21 @@ const Action &CellBuffer::GetUndoStep() const {
void CellBuffer::PerformUndoStep() {
const Action &actionStep = uh.GetUndoStep();
if (actionStep.at == insertAction) {
BasicDeleteChars(actionStep.position, actionStep.lenData*2);
BasicDeleteChars(actionStep.position*2, actionStep.lenData*2);
} else if (actionStep.at == removeAction) {
char *styledData = new char[actionStep.lenData * 2];
for (int i = 0; i < actionStep.lenData; i++) {
styledData[i*2] = actionStep.data[i];
styledData[i*2 + 1] = 0;
}
BasicInsertString(actionStep.position, styledData, actionStep.lenData*2);
BasicInsertString(actionStep.position*2, styledData, actionStep.lenData*2);
delete []styledData;
}
uh.CompletedUndoStep();
}
bool CellBuffer::CanRedo() {
return (!readOnly) && (uh.CanRedo());
return uh.CanRedo();
}
int CellBuffer::StartRedo() {
@ -1075,10 +1071,10 @@ void CellBuffer::PerformRedoStep() {
styledData[i*2] = actionStep.data[i];
styledData[i*2 + 1] = 0;
}
BasicInsertString(actionStep.position, styledData, actionStep.lenData*2);
BasicInsertString(actionStep.position*2, styledData, actionStep.lenData*2);
delete []styledData;
} else if (actionStep.at == removeAction) {
BasicDeleteChars(actionStep.position, actionStep.lenData*2);
BasicDeleteChars(actionStep.position*2, actionStep.lenData*2);
}
uh.CompletedRedoStep();
}

View File

@ -191,7 +191,6 @@ public:
int LineStart(int line);
int LineFromPosition(int pos) { return lv.LineFromPosition(pos); }
const char *InsertString(int position, char *s, int insertLength);
void InsertCharStyle(int position, char ch, char style);
/// Setting styles for positions outside the range of the buffer is safe and has no effect.
/// @return true if the style of a character is changed.

View File

@ -103,26 +103,40 @@ void Document::SetSavePoint() {
int Document::AddMark(int line, int markerNum) {
int prev = cb.AddMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
mh.line = line;
NotifyModified(mh);
return prev;
}
void Document::AddMarkSet(int line, int valueSet) {
unsigned int m = valueSet;
for (int i = 0; m; i++, m >>= 1)
if (m & 1)
cb.AddMark(line, i);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
mh.line = line;
NotifyModified(mh);
}
void Document::DeleteMark(int line, int markerNum) {
cb.DeleteMark(line, markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0);
DocModification mh(SC_MOD_CHANGEMARKER, LineStart(line), 0, 0, 0, line);
mh.line = line;
NotifyModified(mh);
}
void Document::DeleteMarkFromHandle(int markerHandle) {
cb.DeleteMarkFromHandle(markerHandle);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1;
NotifyModified(mh);
}
void Document::DeleteAllMarks(int markerNum) {
cb.DeleteAllMarks(markerNum);
DocModification mh(SC_MOD_CHANGEMARKER, 0, 0, 0, 0);
mh.line = -1;
NotifyModified(mh);
}
@ -266,7 +280,7 @@ int Document::LenChar(int pos) {
return 1;
}
}
#include <assert.h>
// Normalise a position so that it is not halfway through a two byte character.
// This can occur in two situations -
// When lines are terminated with \r\n pairs which should be treated as one character.
@ -280,7 +294,7 @@ int Document::MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd) {
if (pos >= Length())
return Length();
// assert pos > 0 && pos < Length()
// PLATFORM_ASSERT(pos > 0 && pos < Length());
if (checkLineEnd && IsCrLf(pos - 1)) {
if (moveDir > 0)
return pos + 1;
@ -336,6 +350,14 @@ void Document::ModifiedAt(int pos) {
endStyled = pos;
}
void Document::CheckReadOnly() {
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
}
// Document only modified by gateways DeleteChars, InsertStyledString, Undo, Redo, and SetStyleAt.
// SetStyleAt does not change the persistent state of a document
@ -345,11 +367,7 @@ bool Document::DeleteChars(int pos, int len) {
return false;
if ((pos + len) > Length())
return false;
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
CheckReadOnly();
if (enteredCount != 0) {
return false;
} else {
@ -384,11 +402,7 @@ bool Document::DeleteChars(int pos, int len) {
* Insert a styled string (char/style pairs) with a length.
*/
bool Document::InsertStyledString(int position, char *s, int insertLength) {
if (cb.IsReadOnly() && enteredReadOnlyCount == 0) {
enteredReadOnlyCount++;
NotifyModifyAttempt();
enteredReadOnlyCount--;
}
CheckReadOnly();
if (enteredCount != 0) {
return false;
} else {
@ -417,86 +431,110 @@ bool Document::InsertStyledString(int position, char *s, int insertLength) {
}
int Document::Undo() {
int newPos = 0;
int newPos = -1;
CheckReadOnly();
if (enteredCount == 0) {
enteredCount++;
bool startSavePoint = cb.IsSavePoint();
int steps = cb.StartUndo();
//Platform::DebugPrintf("Steps=%d\n", steps);
for (int step = 0; step < steps; step++) {
int prevLinesTotal = LinesTotal();
const Action &action = cb.GetUndoStep();
if (action.at == removeAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
}
cb.PerformUndoStep();
int cellPosition = action.position / 2;
ModifiedAt(cellPosition);
newPos = cellPosition;
if (!cb.IsReadOnly()) {
bool startSavePoint = cb.IsSavePoint();
bool multiLine = false;
int steps = cb.StartUndo();
//Platform::DebugPrintf("Steps=%d\n", steps);
for (int step = 0; step < steps; step++) {
const int prevLinesTotal = LinesTotal();
const Action &action = cb.GetUndoStep();
if (action.at == removeAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_UNDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_UNDO, action));
}
cb.PerformUndoStep();
int cellPosition = action.position;
ModifiedAt(cellPosition);
newPos = cellPosition;
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
int modFlags = SC_PERFORMED_UNDO;
// With undo, an insertion action becomes a deletion notification
if (action.at == removeAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
}
if (steps > 1)
modFlags |= SC_MULTISTEPUNDOREDO;
const int linesAdded = LinesTotal() - prevLinesTotal;
if (linesAdded != 0)
multiLine = true;
if (step == steps - 1) {
modFlags |= SC_LASTSTEPINUNDOREDO;
if (multiLine)
modFlags |= SC_MULTILINEUNDOREDO;
}
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
linesAdded, action.data));
}
if (step == steps - 1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(DocModification(modFlags, cellPosition, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
enteredCount--;
}
return newPos;
}
int Document::Redo() {
int newPos = 0;
int newPos = -1;
CheckReadOnly();
if (enteredCount == 0) {
enteredCount++;
bool startSavePoint = cb.IsSavePoint();
int steps = cb.StartRedo();
for (int step = 0; step < steps; step++) {
int prevLinesTotal = LinesTotal();
const Action &action = cb.GetRedoStep();
if (action.at == insertAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
}
cb.PerformRedoStep();
ModifiedAt(action.position / 2);
newPos = action.position / 2;
if (!cb.IsReadOnly()) {
bool startSavePoint = cb.IsSavePoint();
bool multiLine = false;
int steps = cb.StartRedo();
for (int step = 0; step < steps; step++) {
const int prevLinesTotal = LinesTotal();
const Action &action = cb.GetRedoStep();
if (action.at == insertAction) {
NotifyModified(DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_REDO, action));
} else {
NotifyModified(DocModification(
SC_MOD_BEFOREDELETE | SC_PERFORMED_REDO, action));
}
cb.PerformRedoStep();
ModifiedAt(action.position);
newPos = action.position;
int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
int modFlags = SC_PERFORMED_REDO;
if (action.at == insertAction) {
newPos += action.lenData;
modFlags |= SC_MOD_INSERTTEXT;
} else {
modFlags |= SC_MOD_DELETETEXT;
}
if (steps > 1)
modFlags |= SC_MULTISTEPUNDOREDO;
const int linesAdded = LinesTotal() - prevLinesTotal;
if (linesAdded != 0)
multiLine = true;
if (step == steps - 1) {
modFlags |= SC_LASTSTEPINUNDOREDO;
if (multiLine)
modFlags |= SC_MULTILINEUNDOREDO;
}
NotifyModified(
DocModification(modFlags, action.position, action.lenData,
linesAdded, action.data));
}
if (step == steps - 1)
modFlags |= SC_LASTSTEPINUNDOREDO;
NotifyModified(
DocModification(modFlags, action.position / 2, action.lenData,
LinesTotal() - prevLinesTotal, action.data));
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
}
bool endSavePoint = cb.IsSavePoint();
if (startSavePoint != endSavePoint)
NotifySavePoint(endSavePoint);
enteredCount--;
}
return newPos;
@ -524,15 +562,17 @@ bool Document::InsertString(int position, const char *s) {
*/
bool Document::InsertString(int position, const char *s, size_t insertLength) {
bool changed = false;
char *sWithStyle = new char[insertLength * 2];
if (sWithStyle) {
for (size_t i = 0; i < insertLength; i++) {
sWithStyle[i*2] = s[i];
sWithStyle[i*2 + 1] = 0;
if (insertLength > 0) {
char *sWithStyle = new char[insertLength * 2];
if (sWithStyle) {
for (size_t i = 0; i < insertLength; i++) {
sWithStyle[i*2] = s[i];
sWithStyle[i*2 + 1] = 0;
}
changed = InsertStyledString(position*2, sWithStyle,
static_cast<int>(insertLength*2));
delete []sWithStyle;
}
changed = InsertStyledString(position*2, sWithStyle,
static_cast<int>(insertLength*2));
delete []sWithStyle;
}
return changed;
}
@ -611,8 +651,10 @@ void Document::SetLineIndentation(int line, int indent) {
CreateIndentation(linebuf, sizeof(linebuf), indent, tabInChars, !useTabs);
int thisLineStart = LineStart(line);
int indentPos = GetLineIndentPosition(line);
BeginUndoAction();
DeleteChars(thisLineStart, indentPos - thisLineStart);
InsertString(thisLineStart, linebuf);
EndUndoAction();
}
}
@ -675,10 +717,13 @@ void Document::Indent(bool forwards, int lineBottom, int lineTop) {
// Dedent - suck white space off the front of the line to dedent by equivalent of a tab
for (int line = lineBottom; line >= lineTop; line--) {
int indentOfLine = GetLineIndentation(line);
if (forwards)
SetLineIndentation(line, indentOfLine + IndentSize());
else
if (forwards) {
if (LineStart(line) < LineEnd(line)) {
SetLineIndentation(line, indentOfLine + IndentSize());
}
} else {
SetLineIndentation(line, indentOfLine - IndentSize());
}
}
}
@ -718,7 +763,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
for (int pos = 0; pos < Length(); pos++) {
if (cb.CharAt(pos) == '\r') {
if (cb.CharAt(pos + 1) == '\n') {
if (cb.CharAt(pos + 1) == '\n') {
// CRLF
if (eolModeSet == SC_EOL_CR) {
DeleteChars(pos + 1, 1); // Delete the LF
@ -727,7 +772,7 @@ void Document::ConvertLineEnds(int eolModeSet) {
} else {
pos++;
}
} else {
} else {
// CR
if (eolModeSet == SC_EOL_CRLF) {
InsertString(pos + 1, "\n", 1); // Insert LF
@ -752,12 +797,37 @@ void Document::ConvertLineEnds(int eolModeSet) {
EndUndoAction();
}
bool Document::IsWhiteLine(int line) {
int currentChar = LineStart(line);
int endLine = LineEnd(line);
while (currentChar < endLine) {
if (cb.CharAt(currentChar) != ' ' && cb.CharAt(currentChar) != '\t') {
return false;
}
++currentChar;
}
return true;
}
int Document::ParaUp(int pos) {
int line = LineFromPosition(pos);
line--;
while (line >= 0 && IsWhiteLine(line)) { // skip empty lines
line--;
}
while (line >= 0 && !IsWhiteLine(line)) { // skip non-empty lines
line--;
}
line++;
return LineStart(line);
}
int Document::ParaDown(int pos) {
int line = LineFromPosition(pos);
while (line < LinesTotal() && LineStart(line) != LineEnd(line)) { // skip non-empty lines
while (line < LinesTotal() && !IsWhiteLine(line)) { // skip non-empty lines
line++;
}
while (line < LinesTotal() && LineStart(line) == LineEnd(line)) { // skip empty lines
while (line < LinesTotal() && IsWhiteLine(line)) { // skip empty lines
line++;
}
if (line < LinesTotal())
@ -766,19 +836,6 @@ int Document::ParaDown(int pos) {
return LineEnd(line-1);
}
int Document::ParaUp(int pos) {
int line = LineFromPosition(pos);
line--;
while (line >= 0 && LineStart(line) == LineEnd(line)) { // skip empty lines
line--;
}
while (line >= 0 && LineStart(line) != LineEnd(line)) { // skip non-empty lines
line--;
}
line++;
return LineStart(line);
}
Document::charClassification Document::WordCharClass(unsigned char ch) {
if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80))
return ccWord;
@ -926,6 +983,9 @@ public:
pdoc(pdoc_), end(end_) {
}
virtual ~DocumentIndexer() {
}
virtual char CharAt(int index) {
if (index < 0 || index >= end)
return 0;
@ -1001,7 +1061,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
if (line == lineRangeStart) {
if ((startPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if start position before end of line
endOfLine = startPos+1;
endOfLine = startPos;
}
}
@ -1013,10 +1073,10 @@ long Document::FindText(int minPos, int maxPos, const char *s,
if (increment == -1) {
// Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop
while (success && (pre->eopat[0] <= (endOfLine+1)) && (repetitions--)) {
success = pre->Execute(di, pos+1, endOfLine+1);
while (success && (pre->eopat[0] <= endOfLine) && (repetitions--)) {
success = pre->Execute(di, pos+1, endOfLine);
if (success) {
if (pre->eopat[0] <= (minPos+1)) {
if (pre->eopat[0] <= minPos) {
pos = pre->bopat[0];
lenRet = pre->eopat[0] - pre->bopat[0];
} else {
@ -1052,12 +1112,13 @@ long Document::FindText(int minPos, int maxPos, const char *s,
char firstChar = s[0];
if (!caseSensitive)
firstChar = static_cast<char>(MakeUpperCase(firstChar));
int pos = startPos;
int pos = forward ? startPos : (startPos - 1);
while (forward ? (pos < endSearch) : (pos >= endSearch)) {
char ch = CharAt(pos);
if (caseSensitive) {
if (ch == firstChar) {
bool found = true;
if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (ch != s[posMatch])
@ -1073,6 +1134,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
} else {
if (MakeUpperCase(ch) == firstChar) {
bool found = true;
if (pos + lengthFind > Platform::Maximum(startPos, endPos)) found = false;
for (int posMatch = 1; posMatch < lengthFind && found; posMatch++) {
ch = CharAt(pos + posMatch);
if (MakeUpperCase(ch) != MakeUpperCase(s[posMatch]))
@ -1185,11 +1247,9 @@ int Document::LinesTotal() {
}
void Document::ChangeCase(Range r, bool makeUpperCase) {
for (int pos = r.start; pos < r.end; pos++) {
for (int pos = r.start; pos < r.end;) {
int len = LenChar(pos);
if (dbcsCodePage && (len > 1)) {
pos += len;
} else {
if (len == 1) {
char ch = CharAt(pos);
if (makeUpperCase) {
if (IsLowerCase(ch)) {
@ -1201,6 +1261,7 @@ void Document::ChangeCase(Range r, bool makeUpperCase) {
}
}
}
pos += len;
}
}
@ -1265,19 +1326,22 @@ bool Document::SetStyles(int length, char *styles) {
return false;
} else {
enteredCount++;
int prevEndStyled = endStyled;
bool didChange = false;
int lastChange = 0;
int startMod = 0;
int endMod = 0;
for (int iPos = 0; iPos < length; iPos++, endStyled++) {
PLATFORM_ASSERT(endStyled < Length());
if (cb.SetStyleAt(endStyled, styles[iPos], stylingMask)) {
if (!didChange) {
startMod = endStyled;
}
didChange = true;
lastChange = iPos;
endMod = endStyled;
}
}
if (didChange) {
DocModification mh(SC_MOD_CHANGESTYLE | SC_PERFORMED_USER,
prevEndStyled, lastChange);
startMod, endMod - startMod + 1);
NotifyModified(mh);
}
enteredCount--;
@ -1475,3 +1539,55 @@ int Document::ExtendStyleRange(int pos, int delta, bool singleLine) {
}
return pos;
}
static char BraceOpposite(char ch) {
switch (ch) {
case '(':
return ')';
case ')':
return '(';
case '[':
return ']';
case ']':
return '[';
case '{':
return '}';
case '}':
return '{';
case '<':
return '>';
case '>':
return '<';
default:
return '\0';
}
}
// TODO: should be able to extend styled region to find matching brace
int Document::BraceMatch(int position, int /*maxReStyle*/) {
char chBrace = CharAt(position);
char chSeek = BraceOpposite(chBrace);
if (chSeek == '\0')
return - 1;
char styBrace = static_cast<char>(StyleAt(position) & stylingBitsMask);
int direction = -1;
if (chBrace == '(' || chBrace == '[' || chBrace == '{' || chBrace == '<')
direction = 1;
int depth = 1;
position = position + direction;
while ((position >= 0) && (position < Length())) {
position = MovePositionOutsideChar(position, direction);
char chAtPos = CharAt(position);
char styAtPos = static_cast<char>(StyleAt(position) & stylingBitsMask);
if ((position > GetEndStyled()) || (styAtPos == styBrace)) {
if (chAtPos == chBrace)
depth++;
if (chAtPos == chSeek)
depth--;
if (depth == 0)
return position;
}
position = position + direction;
}
return - 1;
}

View File

@ -134,6 +134,7 @@ public:
int MovePositionOutsideChar(int pos, int moveDir, bool checkLineEnd=true);
// Gateways to modifying document
void ModifiedAt(int pos);
bool DeleteChars(int pos, int len);
bool InsertStyledString(int position, char *s, int insertLength);
int Undo();
@ -175,6 +176,7 @@ public:
char StyleAt(int position) { return cb.StyleAt(position); }
int GetMark(int line) { return cb.GetMark(line); }
int AddMark(int line, int markerNum);
void AddMarkSet(int line, int valueSet);
void DeleteMark(int line, int markerNum);
void DeleteMarkFromHandle(int markerHandle);
void DeleteAllMarks(int markerNum);
@ -228,16 +230,19 @@ public:
int WordPartLeft(int pos);
int WordPartRight(int pos);
int ExtendStyleRange(int pos, int delta, bool singleLine = false);
bool IsWhiteLine(int line);
int ParaUp(int pos);
int ParaDown(int pos);
int IndentSize() { return actualIndentInChars; }
int BraceMatch(int position, int maxReStyle);
private:
void CheckReadOnly();
charClassification WordCharClass(unsigned char ch);
bool IsWordStartAt(int pos);
bool IsWordEndAt(int pos);
bool IsWordAt(int start, int end);
void ModifiedAt(int pos);
void NotifyModifyAttempt();
void NotifySavePoint(bool atSavePoint);
@ -261,19 +266,19 @@ public:
int foldLevelPrev;
DocModification(int modificationType_, int position_=0, int length_=0,
int linesAdded_=0, const char *text_=0) :
int linesAdded_=0, const char *text_=0, int line_=0) :
modificationType(modificationType_),
position(position_),
length(length_),
linesAdded(linesAdded_),
text(text_),
line(0),
line(line_),
foldLevelNow(0),
foldLevelPrev(0) {}
DocModification(int modificationType_, const Action &act, int linesAdded_=0) :
DocModification(int modificationType_, const Action &act, int linesAdded_=0) :
modificationType(modificationType_),
position(act.position / 2),
position(act.position),
length(act.lenData),
linesAdded(linesAdded_),
text(act.data),

View File

@ -58,7 +58,8 @@ bool DocumentAccessor::Match(int pos, const char *s) {
}
char DocumentAccessor::StyleAt(int position) {
return pdoc->StyleAt(position);
// Mask off all bits which aren't in the 'mask'.
return static_cast<char>(pdoc->StyleAt(position) & mask);
}
int DocumentAccessor::GetLine(int position) {
@ -88,6 +89,8 @@ int DocumentAccessor::SetLineState(int line, int state) {
}
void DocumentAccessor::StartAt(unsigned int start, char chMask) {
// Store the mask specified for use with StyleAt.
mask = chMask;
pdoc->StartStyling(start, chMask);
startPosStyling = start;
}

View File

@ -27,6 +27,7 @@ protected:
char chWhile;
unsigned int startSeg;
int startPosStyling;
int mask;
bool InternalIsLeadByte(char ch);
void Fill(int position);
@ -35,7 +36,8 @@ public:
DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) :
Accessor(), pdoc(pdoc_), props(props_), id(id_),
lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
startSeg(0), startPosStyling(0) {
startSeg(0), startPosStyling(0),
mask(127) { // Initialize the mask to be big enough for any lexer.
}
~DocumentAccessor();
bool Match(int pos, const char *s);

File diff suppressed because it is too large Load Diff

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