$(OBJS)\stcdll_AutoComplete.obj \
$(OBJS)\stcdll_CallTip.obj \
$(OBJS)\stcdll_CellBuffer.obj \
+ $(OBJS)\stcdll_CharClassify.obj \
$(OBJS)\stcdll_ContractionState.obj \
$(OBJS)\stcdll_Document.obj \
$(OBJS)\stcdll_DocumentAccessor.obj \
$(OBJS)\stcdll_LexGui4Cli.obj \
$(OBJS)\stcdll_LexHTML.obj \
$(OBJS)\stcdll_LexHaskell.obj \
+ $(OBJS)\stcdll_LexInno.obj \
$(OBJS)\stcdll_LexKix.obj \
$(OBJS)\stcdll_LexLisp.obj \
$(OBJS)\stcdll_LexLout.obj \
$(OBJS)\stcdll_LexMatlab.obj \
$(OBJS)\stcdll_LexMetapost.obj \
$(OBJS)\stcdll_LexNsis.obj \
+ $(OBJS)\stcdll_LexOpal.obj \
$(OBJS)\stcdll_LexOthers.obj \
$(OBJS)\stcdll_LexPB.obj \
$(OBJS)\stcdll_LexPOV.obj \
$(OBJS)\stcdll_LexTADS3.obj \
$(OBJS)\stcdll_LexScriptol.obj \
$(OBJS)\stcdll_LexSpecman.obj \
+ $(OBJS)\stcdll_LexSpice.obj \
+ $(OBJS)\stcdll_LexTCL.obj \
$(OBJS)\stcdll_LexTeX.obj \
$(OBJS)\stcdll_LexVB.obj \
$(OBJS)\stcdll_LexVHDL.obj \
$(OBJS)\stclib_AutoComplete.obj \
$(OBJS)\stclib_CallTip.obj \
$(OBJS)\stclib_CellBuffer.obj \
+ $(OBJS)\stclib_CharClassify.obj \
$(OBJS)\stclib_ContractionState.obj \
$(OBJS)\stclib_Document.obj \
$(OBJS)\stclib_DocumentAccessor.obj \
$(OBJS)\stclib_LexGui4Cli.obj \
$(OBJS)\stclib_LexHTML.obj \
$(OBJS)\stclib_LexHaskell.obj \
+ $(OBJS)\stclib_LexInno.obj \
$(OBJS)\stclib_LexKix.obj \
$(OBJS)\stclib_LexLisp.obj \
$(OBJS)\stclib_LexLout.obj \
$(OBJS)\stclib_LexMatlab.obj \
$(OBJS)\stclib_LexMetapost.obj \
$(OBJS)\stclib_LexNsis.obj \
+ $(OBJS)\stclib_LexOpal.obj \
$(OBJS)\stclib_LexOthers.obj \
$(OBJS)\stclib_LexPB.obj \
$(OBJS)\stclib_LexPOV.obj \
$(OBJS)\stclib_LexTADS3.obj \
$(OBJS)\stclib_LexScriptol.obj \
$(OBJS)\stclib_LexSpecman.obj \
+ $(OBJS)\stclib_LexSpice.obj \
+ $(OBJS)\stclib_LexTCL.obj \
$(OBJS)\stclib_LexTeX.obj \
$(OBJS)\stclib_LexVB.obj \
$(OBJS)\stclib_LexVHDL.obj \
$(OBJS)\stcdll_CellBuffer.obj: ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
+$(OBJS)\stcdll_CharClassify.obj: ../../src/stc\scintilla\src\CharClassify.cxx
+ $(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
+
$(OBJS)\stcdll_ContractionState.obj: ../../src/stc\scintilla\src\ContractionState.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_LexInno.obj: ../../src/stc\scintilla\src\LexInno.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) $**
$(OBJS)\stcdll_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
+$(OBJS)\stcdll_LexOpal.obj: ../../src/stc\scintilla\src\LexOpal.cxx
+ $(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
+
$(OBJS)\stcdll_LexOthers.obj: ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexSpecman.obj: ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
+$(OBJS)\stcdll_LexSpice.obj: ../../src/stc\scintilla\src\LexSpice.cxx
+ $(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
+
+$(OBJS)\stcdll_LexTCL.obj: ../../src/stc\scintilla\src\LexTCL.cxx
+ $(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
+
$(OBJS)\stcdll_LexTeX.obj: ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) -q -c -P -o$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stclib_CellBuffer.obj: ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
+$(OBJS)\stclib_CharClassify.obj: ../../src/stc\scintilla\src\CharClassify.cxx
+ $(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
+
$(OBJS)\stclib_ContractionState.obj: ../../src/stc\scintilla\src\ContractionState.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_LexInno.obj: ../../src/stc\scintilla\src\LexInno.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) $**
$(OBJS)\stclib_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
+$(OBJS)\stclib_LexOpal.obj: ../../src/stc\scintilla\src\LexOpal.cxx
+ $(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
+
$(OBJS)\stclib_LexOthers.obj: ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexSpecman.obj: ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
+$(OBJS)\stclib_LexSpice.obj: ../../src/stc\scintilla\src\LexSpice.cxx
+ $(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
+
+$(OBJS)\stclib_LexTCL.obj: ../../src/stc\scintilla\src\LexTCL.cxx
+ $(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
+
$(OBJS)\stclib_LexTeX.obj: ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) -q -c -P -o$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stcdll_AutoComplete.o \
$(OBJS)\stcdll_CallTip.o \
$(OBJS)\stcdll_CellBuffer.o \
+ $(OBJS)\stcdll_CharClassify.o \
$(OBJS)\stcdll_ContractionState.o \
$(OBJS)\stcdll_Document.o \
$(OBJS)\stcdll_DocumentAccessor.o \
$(OBJS)\stcdll_LexGui4Cli.o \
$(OBJS)\stcdll_LexHTML.o \
$(OBJS)\stcdll_LexHaskell.o \
+ $(OBJS)\stcdll_LexInno.o \
$(OBJS)\stcdll_LexKix.o \
$(OBJS)\stcdll_LexLisp.o \
$(OBJS)\stcdll_LexLout.o \
$(OBJS)\stcdll_LexMatlab.o \
$(OBJS)\stcdll_LexMetapost.o \
$(OBJS)\stcdll_LexNsis.o \
+ $(OBJS)\stcdll_LexOpal.o \
$(OBJS)\stcdll_LexOthers.o \
$(OBJS)\stcdll_LexPB.o \
$(OBJS)\stcdll_LexPOV.o \
$(OBJS)\stcdll_LexTADS3.o \
$(OBJS)\stcdll_LexScriptol.o \
$(OBJS)\stcdll_LexSpecman.o \
+ $(OBJS)\stcdll_LexSpice.o \
+ $(OBJS)\stcdll_LexTCL.o \
$(OBJS)\stcdll_LexTeX.o \
$(OBJS)\stcdll_LexVB.o \
$(OBJS)\stcdll_LexVHDL.o \
$(OBJS)\stclib_AutoComplete.o \
$(OBJS)\stclib_CallTip.o \
$(OBJS)\stclib_CellBuffer.o \
+ $(OBJS)\stclib_CharClassify.o \
$(OBJS)\stclib_ContractionState.o \
$(OBJS)\stclib_Document.o \
$(OBJS)\stclib_DocumentAccessor.o \
$(OBJS)\stclib_LexGui4Cli.o \
$(OBJS)\stclib_LexHTML.o \
$(OBJS)\stclib_LexHaskell.o \
+ $(OBJS)\stclib_LexInno.o \
$(OBJS)\stclib_LexKix.o \
$(OBJS)\stclib_LexLisp.o \
$(OBJS)\stclib_LexLout.o \
$(OBJS)\stclib_LexMatlab.o \
$(OBJS)\stclib_LexMetapost.o \
$(OBJS)\stclib_LexNsis.o \
+ $(OBJS)\stclib_LexOpal.o \
$(OBJS)\stclib_LexOthers.o \
$(OBJS)\stclib_LexPB.o \
$(OBJS)\stclib_LexPOV.o \
$(OBJS)\stclib_LexTADS3.o \
$(OBJS)\stclib_LexScriptol.o \
$(OBJS)\stclib_LexSpecman.o \
+ $(OBJS)\stclib_LexSpice.o \
+ $(OBJS)\stclib_LexTCL.o \
$(OBJS)\stclib_LexTeX.o \
$(OBJS)\stclib_LexVB.o \
$(OBJS)\stclib_LexVHDL.o \
$(OBJS)\stcdll_CellBuffer.o: ../../src/stc/scintilla/src/CellBuffer.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\stcdll_CharClassify.o: ../../src/stc/scintilla/src/CharClassify.cxx
+ $(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\stcdll_ContractionState.o: ../../src/stc/scintilla/src/ContractionState.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_LexInno.o: ../../src/stc/scintilla/src/LexInno.cxx
+ $(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\stcdll_LexKix.o: ../../src/stc/scintilla/src/LexKix.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexNsis.o: ../../src/stc/scintilla/src/LexNsis.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\stcdll_LexOpal.o: ../../src/stc/scintilla/src/LexOpal.cxx
+ $(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\stcdll_LexOthers.o: ../../src/stc/scintilla/src/LexOthers.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_LexSpecman.o: ../../src/stc/scintilla/src/LexSpecman.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\stcdll_LexSpice.o: ../../src/stc/scintilla/src/LexSpice.cxx
+ $(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
+
+$(OBJS)\stcdll_LexTCL.o: ../../src/stc/scintilla/src/LexTCL.cxx
+ $(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\stcdll_LexTeX.o: ../../src/stc/scintilla/src/LexTeX.cxx
$(CXX) -c -o $@ $(STCDLL_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_CellBuffer.o: ../../src/stc/scintilla/src/CellBuffer.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\stclib_CharClassify.o: ../../src/stc/scintilla/src/CharClassify.cxx
+ $(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\stclib_ContractionState.o: ../../src/stc/scintilla/src/ContractionState.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_LexInno.o: ../../src/stc/scintilla/src/LexInno.cxx
+ $(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\stclib_LexKix.o: ../../src/stc/scintilla/src/LexKix.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexNsis.o: ../../src/stc/scintilla/src/LexNsis.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\stclib_LexOpal.o: ../../src/stc/scintilla/src/LexOpal.cxx
+ $(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\stclib_LexOthers.o: ../../src/stc/scintilla/src/LexOthers.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stclib_LexSpecman.o: ../../src/stc/scintilla/src/LexSpecman.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
+$(OBJS)\stclib_LexSpice.o: ../../src/stc/scintilla/src/LexSpice.cxx
+ $(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
+
+$(OBJS)\stclib_LexTCL.o: ../../src/stc/scintilla/src/LexTCL.cxx
+ $(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
+
$(OBJS)\stclib_LexTeX.o: ../../src/stc/scintilla/src/LexTeX.cxx
$(CXX) -c -o $@ $(STCLIB_CXXFLAGS) $(CPPDEPS) $<
$(OBJS)\stcdll_AutoComplete.obj \
$(OBJS)\stcdll_CallTip.obj \
$(OBJS)\stcdll_CellBuffer.obj \
+ $(OBJS)\stcdll_CharClassify.obj \
$(OBJS)\stcdll_ContractionState.obj \
$(OBJS)\stcdll_Document.obj \
$(OBJS)\stcdll_DocumentAccessor.obj \
$(OBJS)\stcdll_LexGui4Cli.obj \
$(OBJS)\stcdll_LexHTML.obj \
$(OBJS)\stcdll_LexHaskell.obj \
+ $(OBJS)\stcdll_LexInno.obj \
$(OBJS)\stcdll_LexKix.obj \
$(OBJS)\stcdll_LexLisp.obj \
$(OBJS)\stcdll_LexLout.obj \
$(OBJS)\stcdll_LexMatlab.obj \
$(OBJS)\stcdll_LexMetapost.obj \
$(OBJS)\stcdll_LexNsis.obj \
+ $(OBJS)\stcdll_LexOpal.obj \
$(OBJS)\stcdll_LexOthers.obj \
$(OBJS)\stcdll_LexPB.obj \
$(OBJS)\stcdll_LexPOV.obj \
$(OBJS)\stcdll_LexTADS3.obj \
$(OBJS)\stcdll_LexScriptol.obj \
$(OBJS)\stcdll_LexSpecman.obj \
+ $(OBJS)\stcdll_LexSpice.obj \
+ $(OBJS)\stcdll_LexTCL.obj \
$(OBJS)\stcdll_LexTeX.obj \
$(OBJS)\stcdll_LexVB.obj \
$(OBJS)\stcdll_LexVHDL.obj \
$(OBJS)\stclib_AutoComplete.obj \
$(OBJS)\stclib_CallTip.obj \
$(OBJS)\stclib_CellBuffer.obj \
+ $(OBJS)\stclib_CharClassify.obj \
$(OBJS)\stclib_ContractionState.obj \
$(OBJS)\stclib_Document.obj \
$(OBJS)\stclib_DocumentAccessor.obj \
$(OBJS)\stclib_LexGui4Cli.obj \
$(OBJS)\stclib_LexHTML.obj \
$(OBJS)\stclib_LexHaskell.obj \
+ $(OBJS)\stclib_LexInno.obj \
$(OBJS)\stclib_LexKix.obj \
$(OBJS)\stclib_LexLisp.obj \
$(OBJS)\stclib_LexLout.obj \
$(OBJS)\stclib_LexMatlab.obj \
$(OBJS)\stclib_LexMetapost.obj \
$(OBJS)\stclib_LexNsis.obj \
+ $(OBJS)\stclib_LexOpal.obj \
$(OBJS)\stclib_LexOthers.obj \
$(OBJS)\stclib_LexPB.obj \
$(OBJS)\stclib_LexPOV.obj \
$(OBJS)\stclib_LexTADS3.obj \
$(OBJS)\stclib_LexScriptol.obj \
$(OBJS)\stclib_LexSpecman.obj \
+ $(OBJS)\stclib_LexSpice.obj \
+ $(OBJS)\stclib_LexTCL.obj \
$(OBJS)\stclib_LexTeX.obj \
$(OBJS)\stclib_LexVB.obj \
$(OBJS)\stclib_LexVHDL.obj \
$(OBJS)\stcdll_CellBuffer.obj: ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
+$(OBJS)\stcdll_CharClassify.obj: ../../src/stc\scintilla\src\CharClassify.cxx
+ $(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
+
$(OBJS)\stcdll_ContractionState.obj: ../../src/stc\scintilla\src\ContractionState.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_LexInno.obj: ../../src/stc\scintilla\src\LexInno.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) $**
$(OBJS)\stcdll_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
+$(OBJS)\stcdll_LexOpal.obj: ../../src/stc\scintilla\src\LexOpal.cxx
+ $(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
+
$(OBJS)\stcdll_LexOthers.obj: ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stcdll_LexSpecman.obj: ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
+$(OBJS)\stcdll_LexSpice.obj: ../../src/stc\scintilla\src\LexSpice.cxx
+ $(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
+
+$(OBJS)\stcdll_LexTCL.obj: ../../src/stc\scintilla\src\LexTCL.cxx
+ $(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
+
$(OBJS)\stcdll_LexTeX.obj: ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCDLL_CXXFLAGS) $**
$(OBJS)\stclib_CellBuffer.obj: ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
+$(OBJS)\stclib_CharClassify.obj: ../../src/stc\scintilla\src\CharClassify.cxx
+ $(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
+
$(OBJS)\stclib_ContractionState.obj: ../../src/stc\scintilla\src\ContractionState.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_LexInno.obj: ../../src/stc\scintilla\src\LexInno.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) $**
$(OBJS)\stclib_LexNsis.obj: ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
+$(OBJS)\stclib_LexOpal.obj: ../../src/stc\scintilla\src\LexOpal.cxx
+ $(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
+
$(OBJS)\stclib_LexOthers.obj: ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stclib_LexSpecman.obj: ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
+$(OBJS)\stclib_LexSpice.obj: ../../src/stc\scintilla\src\LexSpice.cxx
+ $(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
+
+$(OBJS)\stclib_LexTCL.obj: ../../src/stc\scintilla\src\LexTCL.cxx
+ $(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
+
$(OBJS)\stclib_LexTeX.obj: ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) /c /nologo /TP /Fo$@ $(STCLIB_CXXFLAGS) $**
$(OBJS)\stcdll_AutoComplete.obj &
$(OBJS)\stcdll_CallTip.obj &
$(OBJS)\stcdll_CellBuffer.obj &
+ $(OBJS)\stcdll_CharClassify.obj &
$(OBJS)\stcdll_ContractionState.obj &
$(OBJS)\stcdll_Document.obj &
$(OBJS)\stcdll_DocumentAccessor.obj &
$(OBJS)\stcdll_LexGui4Cli.obj &
$(OBJS)\stcdll_LexHTML.obj &
$(OBJS)\stcdll_LexHaskell.obj &
+ $(OBJS)\stcdll_LexInno.obj &
$(OBJS)\stcdll_LexKix.obj &
$(OBJS)\stcdll_LexLisp.obj &
$(OBJS)\stcdll_LexLout.obj &
$(OBJS)\stcdll_LexMatlab.obj &
$(OBJS)\stcdll_LexMetapost.obj &
$(OBJS)\stcdll_LexNsis.obj &
+ $(OBJS)\stcdll_LexOpal.obj &
$(OBJS)\stcdll_LexOthers.obj &
$(OBJS)\stcdll_LexPB.obj &
$(OBJS)\stcdll_LexPOV.obj &
$(OBJS)\stcdll_LexTADS3.obj &
$(OBJS)\stcdll_LexScriptol.obj &
$(OBJS)\stcdll_LexSpecman.obj &
+ $(OBJS)\stcdll_LexSpice.obj &
+ $(OBJS)\stcdll_LexTCL.obj &
$(OBJS)\stcdll_LexTeX.obj &
$(OBJS)\stcdll_LexVB.obj &
$(OBJS)\stcdll_LexVHDL.obj &
$(OBJS)\stclib_AutoComplete.obj &
$(OBJS)\stclib_CallTip.obj &
$(OBJS)\stclib_CellBuffer.obj &
+ $(OBJS)\stclib_CharClassify.obj &
$(OBJS)\stclib_ContractionState.obj &
$(OBJS)\stclib_Document.obj &
$(OBJS)\stclib_DocumentAccessor.obj &
$(OBJS)\stclib_LexGui4Cli.obj &
$(OBJS)\stclib_LexHTML.obj &
$(OBJS)\stclib_LexHaskell.obj &
+ $(OBJS)\stclib_LexInno.obj &
$(OBJS)\stclib_LexKix.obj &
$(OBJS)\stclib_LexLisp.obj &
$(OBJS)\stclib_LexLout.obj &
$(OBJS)\stclib_LexMatlab.obj &
$(OBJS)\stclib_LexMetapost.obj &
$(OBJS)\stclib_LexNsis.obj &
+ $(OBJS)\stclib_LexOpal.obj &
$(OBJS)\stclib_LexOthers.obj &
$(OBJS)\stclib_LexPB.obj &
$(OBJS)\stclib_LexPOV.obj &
$(OBJS)\stclib_LexTADS3.obj &
$(OBJS)\stclib_LexScriptol.obj &
$(OBJS)\stclib_LexSpecman.obj &
+ $(OBJS)\stclib_LexSpice.obj &
+ $(OBJS)\stclib_LexTCL.obj &
$(OBJS)\stclib_LexTeX.obj &
$(OBJS)\stclib_LexVB.obj &
$(OBJS)\stclib_LexVHDL.obj &
$(OBJS)\stcdll_CellBuffer.obj : .AUTODEPEND ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
+$(OBJS)\stcdll_CharClassify.obj : .AUTODEPEND ../../src/stc\scintilla\src\CharClassify.cxx
+ $(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
+
$(OBJS)\stcdll_ContractionState.obj : .AUTODEPEND ../../src/stc\scintilla\src\ContractionState.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_LexInno.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexInno.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) $<
$(OBJS)\stcdll_LexNsis.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
+$(OBJS)\stcdll_LexOpal.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOpal.cxx
+ $(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
+
$(OBJS)\stcdll_LexOthers.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stcdll_LexSpecman.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
+$(OBJS)\stcdll_LexSpice.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSpice.cxx
+ $(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
+
+$(OBJS)\stcdll_LexTCL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTCL.cxx
+ $(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
+
$(OBJS)\stcdll_LexTeX.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCDLL_CXXFLAGS) $<
$(OBJS)\stclib_CellBuffer.obj : .AUTODEPEND ../../src/stc\scintilla\src\CellBuffer.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
+$(OBJS)\stclib_CharClassify.obj : .AUTODEPEND ../../src/stc\scintilla\src\CharClassify.cxx
+ $(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
+
$(OBJS)\stclib_ContractionState.obj : .AUTODEPEND ../../src/stc\scintilla\src\ContractionState.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_LexInno.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexInno.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) $<
$(OBJS)\stclib_LexNsis.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexNsis.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
+$(OBJS)\stclib_LexOpal.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOpal.cxx
+ $(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
+
$(OBJS)\stclib_LexOthers.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexOthers.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
$(OBJS)\stclib_LexSpecman.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSpecman.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
+$(OBJS)\stclib_LexSpice.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexSpice.cxx
+ $(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
+
+$(OBJS)\stclib_LexTCL.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTCL.cxx
+ $(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
+
$(OBJS)\stclib_LexTeX.obj : .AUTODEPEND ../../src/stc\scintilla\src\LexTeX.cxx
$(CXX) -bt=nt -zq -fo=$^@ $(STCLIB_CXXFLAGS) $<
scintilla/src/AutoComplete.cxx
scintilla/src/CallTip.cxx
scintilla/src/CellBuffer.cxx
+ scintilla/src/CharClassify.cxx
scintilla/src/ContractionState.cxx
scintilla/src/Document.cxx
scintilla/src/DocumentAccessor.cxx
scintilla/src/LexGui4Cli.cxx
scintilla/src/LexHTML.cxx
scintilla/src/LexHaskell.cxx
+ scintilla/src/LexInno.cxx
scintilla/src/LexKix.cxx
scintilla/src/LexLisp.cxx
scintilla/src/LexLout.cxx
scintilla/src/LexMatlab.cxx
scintilla/src/LexMetapost.cxx
scintilla/src/LexNsis.cxx
+ scintilla/src/LexOpal.cxx
scintilla/src/LexOthers.cxx
scintilla/src/LexPB.cxx
scintilla/src/LexPOV.cxx
scintilla/src/LexTADS3.cxx
scintilla/src/LexScriptol.cxx
scintilla/src/LexSpecman.cxx
+ scintilla/src/LexSpice.cxx
+ scintilla/src/LexTCL.cxx
scintilla/src/LexTeX.cxx
scintilla/src/LexVB.cxx
scintilla/src/LexVHDL.cxx
# End Source File
# Begin Source File
+SOURCE=../../src/stc\scintilla\src\CharClassify.cxx
+# End Source File
+# Begin Source File
+
SOURCE=../../src/stc\scintilla\src\ContractionState.cxx
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=../../src/stc\scintilla\src\LexInno.cxx
+# End Source File
+# Begin Source File
+
SOURCE=../../src/stc\scintilla\src\LexKix.cxx
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=../../src/stc\scintilla\src\LexOpal.cxx
+# End Source File
+# Begin Source File
+
SOURCE=../../src/stc\scintilla\src\LexOthers.cxx
# End Source File
# Begin Source File
# End Source File
# Begin Source File
+SOURCE=../../src/stc\scintilla\src\LexSpice.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\LexTCL.cxx
+# End Source File
+# Begin Source File
+
SOURCE=../../src/stc\scintilla\src\LexTeX.cxx
# End Source File
# Begin Source File
#define wxSTC_MASK_FOLDERS 0xFE000000
#define wxSTC_MARGIN_SYMBOL 0
#define wxSTC_MARGIN_NUMBER 1
+#define wxSTC_MARGIN_BACK 2
+#define wxSTC_MARGIN_FORE 3
-// Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
-// Styles 38 and 39 are for future use.
+// Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
+// Style 39 is for future use.
#define wxSTC_STYLE_DEFAULT 32
#define wxSTC_STYLE_LINENUMBER 33
#define wxSTC_STYLE_BRACELIGHT 34
#define wxSTC_STYLE_BRACEBAD 35
#define wxSTC_STYLE_CONTROLCHAR 36
#define wxSTC_STYLE_INDENTGUIDE 37
+#define wxSTC_STYLE_CALLTIP 38
#define wxSTC_STYLE_LASTPREDEFINED 39
#define wxSTC_STYLE_MAX 127
#define wxSTC_INDIC_STRIKE 4
#define wxSTC_INDIC_HIDDEN 5
#define wxSTC_INDIC_BOX 6
+#define wxSTC_INDIC_ROUNDBOX 7
#define wxSTC_INDIC0_MASK 0x20
#define wxSTC_INDIC1_MASK 0x40
#define wxSTC_INDIC2_MASK 0x80
#define wxSTC_SEL_STREAM 0
#define wxSTC_SEL_RECTANGLE 1
#define wxSTC_SEL_LINES 2
+#define wxSTC_ALPHA_TRANSPARENT 0
+#define wxSTC_ALPHA_OPAQUE 255
+#define wxSTC_ALPHA_NOALPHA 256
// Maximum value of keywordSet parameter of SetKeyWords.
#define wxSTC_KEYWORDSET_MAX 8
#define wxSTC_LEX_FLAGSHIP 73
#define wxSTC_LEX_CSOUND 74
#define wxSTC_LEX_FREEBASIC 75
-
-// These are deprecated, STC_LEX_HTML should be used instead.
-#define wxSTC_LEX_ASP 29
-#define wxSTC_LEX_PHP 30
+#define wxSTC_LEX_INNOSETUP 76
+#define wxSTC_LEX_OPAL 77
+#define wxSTC_LEX_SPICE 78
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1.
#define wxSTC_C_COMMENTDOCKEYWORDERROR 18
#define wxSTC_C_GLOBALCLASS 19
+// Lexical states for SCLEX_TCL
+#define wxSTC_TCL_DEFAULT 0
+#define wxSTC_TCL_COMMENT 1
+#define wxSTC_TCL_COMMENTLINE 2
+#define wxSTC_TCL_NUMBER 3
+#define wxSTC_TCL_WORD_IN_QUOTE 4
+#define wxSTC_TCL_IN_QUOTE 5
+#define wxSTC_TCL_OPERATOR 6
+#define wxSTC_TCL_IDENTIFIER 7
+#define wxSTC_TCL_SUBSTITUTION 8
+#define wxSTC_TCL_SUB_BRACE 9
+#define wxSTC_TCL_MODIFIER 10
+#define wxSTC_TCL_EXPAND 11
+#define wxSTC_TCL_WORD 12
+#define wxSTC_TCL_WORD2 13
+#define wxSTC_TCL_WORD3 14
+#define wxSTC_TCL_WORD4 15
+#define wxSTC_TCL_WORD5 16
+#define wxSTC_TCL_WORD6 17
+#define wxSTC_TCL_WORD7 18
+#define wxSTC_TCL_WORD8 19
+#define wxSTC_TCL_COMMENT_BOX 20
+#define wxSTC_TCL_BLOCK_COMMENT 21
+
// Lexical states for SCLEX_HTML, SCLEX_XML
#define wxSTC_H_DEFAULT 0
#define wxSTC_H_TAG 1
#define wxSTC_PROPS_SECTION 2
#define wxSTC_PROPS_ASSIGNMENT 3
#define wxSTC_PROPS_DEFVAL 4
+#define wxSTC_PROPS_KEY 5
// Lexical states for SCLEX_LATEX
#define wxSTC_L_DEFAULT 0
#define wxSTC_AU3_SPECIAL 12
#define wxSTC_AU3_EXPAND 13
#define wxSTC_AU3_COMOBJ 14
+#define wxSTC_AU3_UDF 15
// Lexical states for SCLEX_APDL
#define wxSTC_APDL_DEFAULT 0
#define wxSTC_CSOUND_GLOBAL_VAR 14
#define wxSTC_CSOUND_STRINGEOL 15
+// Lexical states for SCLEX_INNOSETUP
+#define wxSTC_INNO_DEFAULT 0
+#define wxSTC_INNO_COMMENT 1
+#define wxSTC_INNO_KEYWORD 2
+#define wxSTC_INNO_PARAMETER 3
+#define wxSTC_INNO_SECTION 4
+#define wxSTC_INNO_PREPROC 5
+#define wxSTC_INNO_PREPROC_INLINE 6
+#define wxSTC_INNO_COMMENT_PASCAL 7
+#define wxSTC_INNO_KEYWORD_PASCAL 8
+#define wxSTC_INNO_KEYWORD_USER 9
+#define wxSTC_INNO_STRING_DOUBLE 10
+#define wxSTC_INNO_STRING_SINGLE 11
+#define wxSTC_INNO_IDENTIFIER 12
+
+// Lexical states for SCLEX_OPAL
+#define wxSTC_OPAL_SPACE 0
+#define wxSTC_OPAL_COMMENT_BLOCK 1
+#define wxSTC_OPAL_COMMENT_LINE 2
+#define wxSTC_OPAL_INTEGER 3
+#define wxSTC_OPAL_KEYWORD 4
+#define wxSTC_OPAL_SORT 5
+#define wxSTC_OPAL_STRING 6
+#define wxSTC_OPAL_PAR 7
+#define wxSTC_OPAL_BOOL_CONST 8
+#define wxSTC_OPAL_DEFAULT 32
+
+// Lexical states for SCLEX_SPICE
+#define wxSTC_SPICE_DEFAULT 0
+#define wxSTC_SPICE_IDENTIFIER 1
+#define wxSTC_SPICE_KEYWORD 2
+#define wxSTC_SPICE_KEYWORD2 3
+#define wxSTC_SPICE_KEYWORD3 4
+#define wxSTC_SPICE_NUMBER 5
+#define wxSTC_SPICE_DELIMITER 6
+#define wxSTC_SPICE_VALUE 7
+#define wxSTC_SPICE_COMMENTLINE 8
+
//-----------------------------------------
// Commands that can be bound to keystrokes
// Add a set of markers to a line.
void MarkerAddSet(int line, int set);
+ // Set the alpha used for a marker that is drawn in the text area, not the margin.
+ void MarkerSetAlpha(int markerNumber, int alpha);
+
// Set a margin to be either numeric or symbolic.
void SetMarginType(int margin, int marginType);
// Set the background colour of the selection and whether to use this setting.
void SetSelBackground(bool useSetting, const wxColour& back);
+ // Get the alpha of the selection.
+ int GetSelAlpha();
+
+ // Set the alpha of the selection.
+ void SetSelAlpha(int alpha);
+
// Set the foreground colour of the caret.
void SetCaretForeground(const wxColour& fore);
// Set the foreground colour for the highlighted part of the call tip.
void CallTipSetForegroundHighlight(const wxColour& fore);
+ // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
+ void CallTipUseStyle(int tabSize);
+
// Find the display line of a document line taking hidden lines into account.
int VisibleFromDocLine(int line);
// Duplicate the selection. If selection empty duplicate the line containing the caret.
void SelectionDuplicate();
+ // Set background alpha of the caret line.
+ void SetCaretLineBackAlpha(int alpha);
+
+ // Get the background alpha of the caret line.
+ int GetCaretLineBackAlpha();
+
// Start notifying the container of all key presses and commands.
void StartRecord();
stcdll_AutoComplete.o \
stcdll_CallTip.o \
stcdll_CellBuffer.o \
+ stcdll_CharClassify.o \
stcdll_ContractionState.o \
stcdll_Document.o \
stcdll_DocumentAccessor.o \
stcdll_LexGui4Cli.o \
stcdll_LexHTML.o \
stcdll_LexHaskell.o \
+ stcdll_LexInno.o \
stcdll_LexKix.o \
stcdll_LexLisp.o \
stcdll_LexLout.o \
stcdll_LexMatlab.o \
stcdll_LexMetapost.o \
stcdll_LexNsis.o \
+ stcdll_LexOpal.o \
stcdll_LexOthers.o \
stcdll_LexPB.o \
stcdll_LexPOV.o \
stcdll_LexTADS3.o \
stcdll_LexScriptol.o \
stcdll_LexSpecman.o \
+ stcdll_LexSpice.o \
+ stcdll_LexTCL.o \
stcdll_LexTeX.o \
stcdll_LexVB.o \
stcdll_LexVHDL.o \
stclib_AutoComplete.o \
stclib_CallTip.o \
stclib_CellBuffer.o \
+ stclib_CharClassify.o \
stclib_ContractionState.o \
stclib_Document.o \
stclib_DocumentAccessor.o \
stclib_LexGui4Cli.o \
stclib_LexHTML.o \
stclib_LexHaskell.o \
+ stclib_LexInno.o \
stclib_LexKix.o \
stclib_LexLisp.o \
stclib_LexLout.o \
stclib_LexMatlab.o \
stclib_LexMetapost.o \
stclib_LexNsis.o \
+ stclib_LexOpal.o \
stclib_LexOthers.o \
stclib_LexPB.o \
stclib_LexPOV.o \
stclib_LexTADS3.o \
stclib_LexScriptol.o \
stclib_LexSpecman.o \
+ stclib_LexSpice.o \
+ stclib_LexTCL.o \
stclib_LexTeX.o \
stclib_LexVB.o \
stclib_LexVHDL.o \
stcdll_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/CellBuffer.cxx
+stcdll_CharClassify.o: $(srcdir)/scintilla/src/CharClassify.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/CharClassify.cxx
+
stcdll_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/ContractionState.cxx
stcdll_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
+stcdll_LexInno.o: $(srcdir)/scintilla/src/LexInno.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexInno.cxx
+
stcdll_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
stcdll_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexNsis.cxx
+stcdll_LexOpal.o: $(srcdir)/scintilla/src/LexOpal.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexOpal.cxx
+
stcdll_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexOthers.cxx
stcdll_LexSpecman.o: $(srcdir)/scintilla/src/LexSpecman.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSpecman.cxx
+stcdll_LexSpice.o: $(srcdir)/scintilla/src/LexSpice.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSpice.cxx
+
+stcdll_LexTCL.o: $(srcdir)/scintilla/src/LexTCL.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTCL.cxx
+
stcdll_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTeX.cxx
stclib_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/CellBuffer.cxx
+stclib_CharClassify.o: $(srcdir)/scintilla/src/CharClassify.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/CharClassify.cxx
+
stclib_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/ContractionState.cxx
stclib_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
+stclib_LexInno.o: $(srcdir)/scintilla/src/LexInno.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexInno.cxx
+
stclib_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
stclib_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexNsis.cxx
+stclib_LexOpal.o: $(srcdir)/scintilla/src/LexOpal.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexOpal.cxx
+
stclib_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexOthers.cxx
stclib_LexSpecman.o: $(srcdir)/scintilla/src/LexSpecman.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSpecman.cxx
+stclib_LexSpice.o: $(srcdir)/scintilla/src/LexSpice.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSpice.cxx
+
+stclib_LexTCL.o: $(srcdir)/scintilla/src/LexTCL.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTCL.cxx
+
stclib_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTeX.cxx
Palette::Palette() {
used = 0;
allowRealization = false;
+ size = 100;
+ entries = new ColourPair[size];
}
Palette::~Palette() {
Release();
+ delete [] entries;
+ entries = 0;
}
void Palette::Release() {
used = 0;
+ delete [] entries;
+ size = 100;
+ entries = new ColourPair[size];
}
// This method either adds a colour to the list of wanted colours (want==true)
return;
}
- if (used < numEntries) {
- entries[used].desired = cp.desired;
- entries[used].allocated.Set(cp.desired.AsLong());
- used++;
+ if (used >= size) {
+ int sizeNew = size * 2;
+ ColourPair *entriesNew = new ColourPair[sizeNew];
+ for (int j=0; j<size; j++) {
+ entriesNew[j] = entries[j];
+ }
+ delete []entries;
+ entries = entriesNew;
+ size = sizeNew;
}
+
+ entries[used].desired = cp.desired;
+ entries[used].allocated.Set(cp.desired.AsLong());
+ used++;
} else {
for (int i=0; i < used; i++) {
if (entries[i].desired == cp.desired) {
virtual void FillRectangle(PRectangle rc, ColourAllocated back);
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern);
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
+ virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
+ ColourAllocated outline, int alphaOutline, int flags);
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource);
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
}
+void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
+ ColourAllocated fill, int alphaFill,
+ ColourAllocated outline, int alphaOutline, int flags) {
+// ** TODO
+
+ RectangleDraw(rc, outline, fill);
+}
+
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
PenColour(fore);
BrushColour(back);
#include "Platform.h"
#include "Scintilla.h"
+#include "CharClassify.h"
#include "XPM.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
#include "Editor.h"
#include "ScintillaBase.h"
-
//----------------------------------------------------------------------
#ifdef WXMAKINGDLL_STC
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.67
+The current version of the Scintilla code is 1.70
*/
class Palette {
int used;
- enum {numEntries = 100};
- ColourPair entries[numEntries];
+ int size;
+ ColourPair *entries;
#if PLAT_GTK
void *allocatedPalette; // GdkColor *
int allocatedLen;
#endif
+ // Private so Palette objects can not be copied
+ Palette(const Palette &) {}
+ Palette &operator=(const Palette &) { return *this; }
public:
#if PLAT_WIN
void *hpal;
virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0;
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0;
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
+ virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
+ ColourAllocated outline, int alphaOutline, int flags)=0;
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;
#define SCLEX_FLAGSHIP 73
#define SCLEX_CSOUND 74
#define SCLEX_FREEBASIC 75
+#define SCLEX_INNOSETUP 76
+#define SCLEX_OPAL 77
+#define SCLEX_SPICE 78
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_C_COMMENTDOCKEYWORD 17
#define SCE_C_COMMENTDOCKEYWORDERROR 18
#define SCE_C_GLOBALCLASS 19
+#define SCE_TCL_DEFAULT 0
+#define SCE_TCL_COMMENT 1
+#define SCE_TCL_COMMENTLINE 2
+#define SCE_TCL_NUMBER 3
+#define SCE_TCL_WORD_IN_QUOTE 4
+#define SCE_TCL_IN_QUOTE 5
+#define SCE_TCL_OPERATOR 6
+#define SCE_TCL_IDENTIFIER 7
+#define SCE_TCL_SUBSTITUTION 8
+#define SCE_TCL_SUB_BRACE 9
+#define SCE_TCL_MODIFIER 10
+#define SCE_TCL_EXPAND 11
+#define SCE_TCL_WORD 12
+#define SCE_TCL_WORD2 13
+#define SCE_TCL_WORD3 14
+#define SCE_TCL_WORD4 15
+#define SCE_TCL_WORD5 16
+#define SCE_TCL_WORD6 17
+#define SCE_TCL_WORD7 18
+#define SCE_TCL_WORD8 19
+#define SCE_TCL_COMMENT_BOX 20
+#define SCE_TCL_BLOCK_COMMENT 21
#define SCE_H_DEFAULT 0
#define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2
#define SCE_PROPS_SECTION 2
#define SCE_PROPS_ASSIGNMENT 3
#define SCE_PROPS_DEFVAL 4
+#define SCE_PROPS_KEY 5
#define SCE_L_DEFAULT 0
#define SCE_L_COMMAND 1
#define SCE_L_TAG 2
#define SCE_AU3_SPECIAL 12
#define SCE_AU3_EXPAND 13
#define SCE_AU3_COMOBJ 14
+#define SCE_AU3_UDF 15
#define SCE_APDL_DEFAULT 0
#define SCE_APDL_COMMENT 1
#define SCE_APDL_COMMENTBLOCK 2
#define SCE_CSOUND_IRATE_VAR 13
#define SCE_CSOUND_GLOBAL_VAR 14
#define SCE_CSOUND_STRINGEOL 15
+#define SCE_INNO_DEFAULT 0
+#define SCE_INNO_COMMENT 1
+#define SCE_INNO_KEYWORD 2
+#define SCE_INNO_PARAMETER 3
+#define SCE_INNO_SECTION 4
+#define SCE_INNO_PREPROC 5
+#define SCE_INNO_PREPROC_INLINE 6
+#define SCE_INNO_COMMENT_PASCAL 7
+#define SCE_INNO_KEYWORD_PASCAL 8
+#define SCE_INNO_KEYWORD_USER 9
+#define SCE_INNO_STRING_DOUBLE 10
+#define SCE_INNO_STRING_SINGLE 11
+#define SCE_INNO_IDENTIFIER 12
+#define SCE_OPAL_SPACE 0
+#define SCE_OPAL_COMMENT_BLOCK 1
+#define SCE_OPAL_COMMENT_LINE 2
+#define SCE_OPAL_INTEGER 3
+#define SCE_OPAL_KEYWORD 4
+#define SCE_OPAL_SORT 5
+#define SCE_OPAL_STRING 6
+#define SCE_OPAL_PAR 7
+#define SCE_OPAL_BOOL_CONST 8
+#define SCE_OPAL_DEFAULT 32
+#define SCE_SPICE_DEFAULT 0
+#define SCE_SPICE_IDENTIFIER 1
+#define SCE_SPICE_KEYWORD 2
+#define SCE_SPICE_KEYWORD2 3
+#define SCE_SPICE_KEYWORD3 4
+#define SCE_SPICE_NUMBER 5
+#define SCE_SPICE_DELIMITER 6
+#define SCE_SPICE_VALUE 7
+#define SCE_SPICE_COMMENTLINE 8
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface
#define SCI_MARKERPREVIOUS 2048
#define SCI_MARKERDEFINEPIXMAP 2049
#define SCI_MARKERADDSET 2466
+#define SCI_MARKERSETALPHA 2476
#define SC_MARGIN_SYMBOL 0
#define SC_MARGIN_NUMBER 1
+#define SC_MARGIN_BACK 2
+#define SC_MARGIN_FORE 3
#define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242
#define STYLE_BRACEBAD 35
#define STYLE_CONTROLCHAR 36
#define STYLE_INDENTGUIDE 37
+#define STYLE_CALLTIP 38
#define STYLE_LASTPREDEFINED 39
#define STYLE_MAX 127
#define SC_CHARSET_ANSI 0
#define SCI_STYLESETHOTSPOT 2409
#define SCI_SETSELFORE 2067
#define SCI_SETSELBACK 2068
+#define SCI_GETSELALPHA 2477
+#define SCI_SETSELALPHA 2478
#define SCI_SETCARETFORE 2069
#define SCI_ASSIGNCMDKEY 2070
#define SCI_CLEARCMDKEY 2071
#define INDIC_STRIKE 4
#define INDIC_HIDDEN 5
#define INDIC_BOX 6
+#define INDIC_ROUNDBOX 7
#define INDIC0_MASK 0x20
#define INDIC1_MASK 0x40
#define INDIC2_MASK 0x80
#define SCI_CALLTIPSETBACK 2205
#define SCI_CALLTIPSETFORE 2206
#define SCI_CALLTIPSETFOREHLT 2207
+#define SCI_CALLTIPUSESTYLE 2212
#define SCI_VISIBLEFROMDOCLINE 2220
#define SCI_DOCLINEFROMVISIBLE 2221
#define SCI_WRAPCOUNT 2235
#define SCI_SETPASTECONVERTENDINGS 2467
#define SCI_GETPASTECONVERTENDINGS 2468
#define SCI_SELECTIONDUPLICATE 2469
+#define SC_ALPHA_TRANSPARENT 0
+#define SC_ALPHA_OPAQUE 255
+#define SC_ALPHA_NOALPHA 256
+#define SCI_SETCARETLINEBACKALPHA 2470
+#define SCI_GETCARETLINEBACKALPHA 2471
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
# Add a set of markers to a line.
fun void MarkerAddSet=2466(int line, int set)
+# Set the alpha used for a marker that is drawn in the text area, not the margin.
+fun void MarkerSetAlpha=2476(int markerNumber, int alpha)
+
enu MarginType=SC_MARGIN_
val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1
+val SC_MARGIN_BACK=2
+val SC_MARGIN_FORE=3
# Set a margin to be either numeric or symbolic.
set void SetMarginTypeN=2240(int margin, int marginType)
# Retrieve the mouse click sensitivity of a margin.
get bool GetMarginSensitiveN=2247(int margin,)
-# Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
-# Styles 38 and 39 are for future use.
+# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
+# Style 39 is for future use.
enu StylesCommon=STYLE_
val STYLE_DEFAULT=32
val STYLE_LINENUMBER=33
val STYLE_BRACEBAD=35
val STYLE_CONTROLCHAR=36
val STYLE_INDENTGUIDE=37
+val STYLE_CALLTIP=38
val STYLE_LASTPREDEFINED=39
val STYLE_MAX=127
# Set the background colour of the selection and whether to use this setting.
fun void SetSelBack=2068(bool useSetting, colour back)
+# Get the alpha of the selection.
+get int GetSelAlpha=2477(,)
+
+# Set the alpha of the selection.
+set void SetSelAlpha=2478(int alpha,)
+
# Set the foreground colour of the caret.
set void SetCaretFore=2069(colour fore,)
val INDIC_STRIKE=4
val INDIC_HIDDEN=5
val INDIC_BOX=6
+val INDIC_ROUNDBOX=7
val INDIC0_MASK=0x20
val INDIC1_MASK=0x40
val INDIC2_MASK=0x80
# Set the foreground colour for the highlighted part of the call tip.
set void CallTipSetForeHlt=2207(colour fore,)
+# Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
+set void CallTipUseStyle=2212(int tabSize,)
+
# Find the display line of a document line taking hidden lines into account.
fun int VisibleFromDocLine=2220(int line,)
fun void ChooseCaretX=2399(,)
# Set the focus to this Scintilla widget.
-# GTK+ Specific.
fun void GrabFocus=2400(,)
enu CaretPolicy = CARET_
# Duplicate the selection. If selection empty duplicate the line containing the caret.
fun void SelectionDuplicate=2469(,)
+val SC_ALPHA_TRANSPARENT=0
+val SC_ALPHA_OPAQUE=255
+val SC_ALPHA_NOALPHA=256
+
+# Set background alpha of the caret line.
+set void SetCaretLineBackAlpha=2470(int alpha,)
+
+# Get the background alpha of the caret line.
+get int GetCaretLineBackAlpha=2471(,)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
val SCLEX_FLAGSHIP=73
val SCLEX_CSOUND=74
val SCLEX_FREEBASIC=75
-
-# These are deprecated, STC_LEX_HTML should be used instead.
-val SCLEX_ASP=29
-val SCLEX_PHP=30
-
+val SCLEX_INNOSETUP=76
+val SCLEX_OPAL=77
+val SCLEX_SPICE=78
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
# Lexical states for SCLEX_CPP
lex Cpp=SCLEX_CPP SCE_C_
lex Pascal=SCLEX_PASCAL SCE_C_
-lex TCL=SCLEX_TCL SCE_C_
lex BullAnt=SCLEX_BULLANT SCE_C_
val SCE_C_DEFAULT=0
val SCE_C_COMMENT=1
val SCE_C_COMMENTDOCKEYWORD=17
val SCE_C_COMMENTDOCKEYWORDERROR=18
val SCE_C_GLOBALCLASS=19
+# Lexical states for SCLEX_TCL
+lex TCL=SCLEX_TCL SCE_TCL_
+val SCE_TCL_DEFAULT=0
+val SCE_TCL_COMMENT=1
+val SCE_TCL_COMMENTLINE=2
+val SCE_TCL_NUMBER=3
+val SCE_TCL_WORD_IN_QUOTE=4
+val SCE_TCL_IN_QUOTE=5
+val SCE_TCL_OPERATOR=6
+val SCE_TCL_IDENTIFIER=7
+val SCE_TCL_SUBSTITUTION=8
+val SCE_TCL_SUB_BRACE=9
+val SCE_TCL_MODIFIER=10
+val SCE_TCL_EXPAND=11
+val SCE_TCL_WORD=12
+val SCE_TCL_WORD2=13
+val SCE_TCL_WORD3=14
+val SCE_TCL_WORD4=15
+val SCE_TCL_WORD5=16
+val SCE_TCL_WORD6=17
+val SCE_TCL_WORD7=18
+val SCE_TCL_WORD8=19
+val SCE_TCL_COMMENT_BOX=20
+val SCE_TCL_BLOCK_COMMENT=21
# Lexical states for SCLEX_HTML, SCLEX_XML
lex HTML=SCLEX_HTML SCE_H
lex XML=SCLEX_XML SCE_H
val SCE_PROPS_SECTION=2
val SCE_PROPS_ASSIGNMENT=3
val SCE_PROPS_DEFVAL=4
+val SCE_PROPS_KEY=5
# Lexical states for SCLEX_LATEX
lex LaTeX=SCLEX_LATEX SCE_L_
val SCE_L_DEFAULT=0
val SCE_AU3_SPECIAL=12
val SCE_AU3_EXPAND=13
val SCE_AU3_COMOBJ=14
+val SCE_AU3_UDF=15
# Lexical states for SCLEX_APDL
lex APDL=SCLEX_APDL SCE_APDL_
val SCE_APDL_DEFAULT=0
val SCE_CSOUND_IRATE_VAR=13
val SCE_CSOUND_GLOBAL_VAR=14
val SCE_CSOUND_STRINGEOL=15
+# Lexical states for SCLEX_INNOSETUP
+lex Inno=SCLEX_INNOSETUP SCE_INNO_
+val SCE_INNO_DEFAULT=0
+val SCE_INNO_COMMENT=1
+val SCE_INNO_KEYWORD=2
+val SCE_INNO_PARAMETER=3
+val SCE_INNO_SECTION=4
+val SCE_INNO_PREPROC=5
+val SCE_INNO_PREPROC_INLINE=6
+val SCE_INNO_COMMENT_PASCAL=7
+val SCE_INNO_KEYWORD_PASCAL=8
+val SCE_INNO_KEYWORD_USER=9
+val SCE_INNO_STRING_DOUBLE=10
+val SCE_INNO_STRING_SINGLE=11
+val SCE_INNO_IDENTIFIER=12
+# Lexical states for SCLEX_OPAL
+lex Opal=SCLEX_OPAL SCE_OPAL_
+val SCE_OPAL_SPACE=0
+val SCE_OPAL_COMMENT_BLOCK=1
+val SCE_OPAL_COMMENT_LINE=2
+val SCE_OPAL_INTEGER=3
+val SCE_OPAL_KEYWORD=4
+val SCE_OPAL_SORT=5
+val SCE_OPAL_STRING=6
+val SCE_OPAL_PAR=7
+val SCE_OPAL_BOOL_CONST=8
+val SCE_OPAL_DEFAULT=32
+# Lexical states for SCLEX_SPICE
+lex Spice=SCLEX_SPICE SCE_SPICE_
+val SCE_SPICE_DEFAULT=0
+val SCE_SPICE_IDENTIFIER=1
+val SCE_SPICE_KEYWORD=2
+val SCE_SPICE_KEYWORD2=3
+val SCE_SPICE_KEYWORD3=4
+val SCE_SPICE_NUMBER=5
+val SCE_SPICE_DELIMITER=6
+val SCE_SPICE_VALUE=7
+val SCE_SPICE_COMMENTLINE=8
# Events
void (* notify) (ScintillaObject *ttt);
};
+#if GLIB_MAJOR_VERSION < 2
GtkType scintilla_get_type (void);
+#else
+GType scintilla_get_type (void);
+#endif
GtkWidget* scintilla_new (void);
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);
#include "Scintilla.h"
#include "CallTip.h"
+static const int insetX = 5; // text inset in x from calltip border
+static const int widthArrow = 14;
+
CallTip::CallTip() {
wCallTip = 0;
inCallTipMode = false;
lineHeight = 1;
startHighlight = 0;
endHighlight = 0;
+ tabSize = 0;
+ useStyleCallTip = false; // for backwards compatibility
colourBG.desired = ColourDesired(0xff, 0xff, 0xff);
colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80);
val = 0;
}
-const int widthArrow = 14;
-
void CallTip::RefreshColourPalette(Palette &pal, bool want) {
pal.WantFind(colourBG, want);
pal.WantFind(colourUnSel, want);
pal.WantFind(colourLight, want);
}
+// Although this test includes 0, we should never see a \0 character.
static bool IsArrowCharacter(char ch) {
return (ch == 0) || (ch == '\001') || (ch == '\002');
}
+// We ignore tabs unless a tab width has been set.
+bool CallTip::IsTabCharacter(char ch) {
+ return (tabSize > 0) && (ch == '\t');
+}
+
+int CallTip::NextTabPos(int x) {
+ if (tabSize > 0) { // paranoia... not called unless this is true
+ x -= insetX; // position relative to text
+ x = (x + tabSize) / tabSize; // tab "number"
+ return tabSize*x + insetX; // position of next tab
+ } else {
+ return x + 1; // arbitrary
+ }
+}
+
+// Draw a section of the call tip that does not include \n in one colour.
+// The text may include up to numEnds tabs or arrow characters.
void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw) {
s += posStart;
int len = posEnd - posStart;
+
+ // Divide the text into sections that are all text, or that are
+ // single arrows or single tab characters (if tabSize > 0).
int maxEnd = 0;
- int ends[10];
+ const int numEnds = 10;
+ int ends[numEnds + 2];
for (int i=0;i<len;i++) {
- if (IsArrowCharacter(s[i])) {
+ if ((maxEnd < numEnds) &&
+ (IsArrowCharacter(s[i]) || IsTabCharacter(s[i])) ) {
if (i > 0)
ends[maxEnd++] = i;
ends[maxEnd++] = i+1;
int endSeg = ends[seg];
if (endSeg > startSeg) {
if (IsArrowCharacter(s[startSeg])) {
- xEnd = x + widthArrow;
- offsetMain = xEnd;
+ bool upArrow = s[startSeg] == '\001';
rcClient.left = x;
- rcClient.right = xEnd;
+ rcClient.right = rcClient.left + widthArrow;
if (draw) {
const int halfWidth = widthArrow / 2 - 3;
- const int centreX = x + widthArrow / 2 - 1;
+ const int centreX = rcClient.left + widthArrow / 2 - 1;
const int centreY = (rcClient.top + rcClient.bottom) / 2;
surface->FillRectangle(rcClient, colourBG.allocated);
- PRectangle rcClientInner(rcClient.left+1, rcClient.top+1, rcClient.right-2, rcClient.bottom-1);
+ PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1,
+ rcClient.right - 2, rcClient.bottom - 1);
surface->FillRectangle(rcClientInner, colourUnSel.allocated);
- if (s[startSeg] == '\001') {
- // Up arrow
+ if (upArrow) { // Up arrow
Point pts[] = {
Point(centreX - halfWidth, centreY + halfWidth / 2),
Point(centreX + halfWidth, centreY + halfWidth / 2),
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
colourBG.allocated, colourBG.allocated);
- } else {
- // Down arrow
+ } else { // Down arrow
Point pts[] = {
Point(centreX - halfWidth, centreY - halfWidth / 2),
Point(centreX + halfWidth, centreY - halfWidth / 2),
colourBG.allocated, colourBG.allocated);
}
}
- if (s[startSeg] == '\001') {
+ xEnd = rcClient.right;
+ offsetMain = xEnd;
+ if (upArrow) {
rectUp = rcClient;
- } else if (s[startSeg] == '\002') {
+ } else {
rectDown = rcClient;
}
+ } else if (IsTabCharacter(s[startSeg])) {
+ xEnd = NextTabPos(x);
} else {
- xEnd = x + surface->WidthText(font, s+startSeg, endSeg - startSeg);
+ xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg);
if (draw) {
rcClient.left = x;
rcClient.right = xEnd;
- surface->DrawTextNoClip(rcClient, font, ytext,
+ surface->DrawTextTransparent(rcClient, font, ytext,
s+startSeg, endSeg - startSeg,
- highlight ? colourSel.allocated : colourUnSel.allocated,
- colourBG.allocated);
+ highlight ? colourSel.allocated : colourUnSel.allocated);
}
}
x = xEnd;
thisEndHighlight -= chunkOffset;
rcClient.top = ytext - ascent - 1;
- int x = 5;
+ int x = insetX; // start each line at this inset
DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight,
ytext, rcClient, false, draw);
surfaceWindow->FillRectangle(rcClient, colourBG.allocated);
- offsetMain = 5;
+ offsetMain = insetX; // initial alignment assuming no arrows
PaintContents(surfaceWindow, true);
// Draw a raised border around the edges of the window
const char *look = val;
rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
- offsetMain = 5;
- int width = PaintContents(surfaceMeasure, false) + 5;
+ offsetMain = insetX; // changed to right edge of any arrows
+ int width = PaintContents(surfaceMeasure, false) + insetX;
while ((newline = strchr(look, '\n')) != NULL) {
look = newline + 1;
numLines++;
}
lineHeight = surfaceMeasure->Height(font);
- // Extra line for border and an empty line at top and bottom
+
+ // Extra line for border and an empty line at top and bottom. The returned
+ // rectangle is aligned to the right edge of the last arrow encountered in
+ // the tip text, else to the tip text left edge.
int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + 2 + 2;
delete surfaceMeasure;
return PRectangle(pt.x - offsetMain, pt.y + 1, pt.x + width - offsetMain, pt.y + 1 + height);
}
}
}
+
+// Set the tab size (sizes > 0 enable the use of tabs). This also enables the
+// use of the STYLE_CALLTIP.
+void CallTip::SetTabSize(int tabSz) {
+ tabSize = tabSz;
+ useStyleCallTip = true;
+}
+
+// It might be better to have two access functions for this and to use
+// them for all settings of colours.
+void CallTip::SetForeBack(const ColourPair &fore, const ColourPair &back) {
+ colourBG = back;
+ colourUnSel = fore;
+}
/**
*/
class CallTip {
- int startHighlight;
- int endHighlight;
+ int startHighlight; // character offset to start and...
+ int endHighlight; // ...end of highlighted text
char *val;
Font font;
- PRectangle rectUp;
- PRectangle rectDown;
- int lineHeight;
- int offsetMain;
+ PRectangle rectUp; // rectangle of last up angle in the tip
+ PRectangle rectDown; // rectangle of last down arrow in the tip
+ int lineHeight; // vertical line spacing
+ int offsetMain; // The alignment point of the call tip
+ int tabSize; // Tab size in pixels, <=0 no TAB expand
+ bool useStyleCallTip; // if true, STYLE_CALLTIP should be used
+
// Private so CallTip objects can not be copied
CallTip(const CallTip &) {}
CallTip &operator=(const CallTip &) { return *this; }
int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw);
int PaintContents(Surface *surfaceWindow, bool draw);
+ bool IsTabCharacter(char c);
+ int NextTabPos(int x);
public:
Window wCallTip;
/// Set a range of characters to be displayed in a highlight style.
/// Commonly used to highlight the current parameter.
void SetHighlight(int start, int end);
+
+ /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand.
+ void SetTabSize(int tabSz);
+
+ /// Used to determine which STYLE_xxxx to use for call tip information
+ bool UseStyleCallTip() const { return useStyleCallTip;}
+
+ // Modify foreground and background colours
+ void SetForeBack(const ColourPair &fore, const ColourPair &back);
};
#endif
--- /dev/null
+// Scintilla source code edit control
+/** @file CharClassify.cxx
+ ** Character classifications used by Document and RESearch.
+ **/
+// Copyright 2006 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <ctype.h>
+
+#include "CharClassify.h"
+
+// Shut up annoying Visual C++ warnings:
+#ifdef _MSC_VER
+#pragma warning(disable: 4514)
+#endif
+
+CharClassify::CharClassify() {
+ SetDefaultCharClasses(true);
+}
+
+void CharClassify::SetDefaultCharClasses(bool includeWordClass) {
+ // Initialize all char classes to default values
+ for (int ch = 0; ch < 256; ch++) {
+ if (ch == '\r' || ch == '\n')
+ charClass[ch] = ccNewLine;
+ else if (ch < 0x20 || ch == ' ')
+ charClass[ch] = ccSpace;
+ else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_'))
+ charClass[ch] = ccWord;
+ else
+ charClass[ch] = ccPunctuation;
+ }
+}
+
+void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) {
+ // Apply the newCharClass to the specifed chars
+ if (chars) {
+ while (*chars) {
+ charClass[*chars] = static_cast<unsigned char>(newCharClass);
+ chars++;
+ }
+ }
+}
--- /dev/null
+// Scintilla source code edit control
+/** @file CharClassify.h
+ ** Character classifications used by Document and RESearch.
+ **/
+// Copyright 2006 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef CHARCLASSIFY_H
+#define CHARCLASSIFY_H
+
+class CharClassify {
+public:
+ CharClassify();
+
+ enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation };
+ void SetDefaultCharClasses(bool includeWordClass);
+ void SetCharClasses(const unsigned char *chars, cc newCharClass);
+ cc GetClass(unsigned char ch) const { return static_cast<cc>(charClass[ch]);}
+ bool IsWord(unsigned char ch) const { return static_cast<cc>(charClass[ch]) == ccWord;}
+
+private:
+ enum { maxChar=256 };
+ unsigned char charClass[maxChar]; // not type cc to save space
+};
+#endif
delete []lines;
lines = 0;
size = 0;
+
+ delete []docLines;
+ docLines = 0;
+ sizeDocLines = 0;
+
+ linesInDisplay = linesInDoc;
}
#include "Scintilla.h"
#include "SVector.h"
#include "CellBuffer.h"
+#include "CharClassify.h"
#include "Document.h"
#include "RESearch.h"
stylingBits = 5;
stylingBitsMask = 0x1F;
stylingMask = 0;
- SetDefaultCharClasses(true);
endStyled = 0;
styleClock = 0;
enteredCount = 0;
return LineEnd(line-1);
}
-Document::charClassification Document::WordCharClass(unsigned char ch) {
+CharClassify::cc Document::WordCharClass(unsigned char ch) {
if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80))
- return ccWord;
- return charClass[ch];
+ return CharClassify::ccWord;
+ return charClass.GetClass(ch);
}
/**
* Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0.
*/
int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
- charClassification ccStart = ccWord;
+ CharClassify::cc ccStart = CharClassify::ccWord;
if (delta < 0) {
if (!onlyWordCharacters)
ccStart = WordCharClass(cb.CharAt(pos-1));
*/
int Document::NextWordStart(int pos, int delta) {
if (delta < 0) {
- while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccSpace))
+ while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace))
pos--;
if (pos > 0) {
- charClassification ccStart = WordCharClass(cb.CharAt(pos-1));
+ CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1));
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) {
pos--;
}
}
} else {
- charClassification ccStart = WordCharClass(cb.CharAt(pos));
+ CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos));
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart))
pos++;
- while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccSpace))
+ while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace))
pos++;
}
return pos;
int Document::NextWordEnd(int pos, int delta) {
if (delta < 0) {
if (pos > 0) {
- charClassification ccStart = WordCharClass(cb.CharAt(pos-1));
- if (ccStart != ccSpace) {
+ CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1));
+ if (ccStart != CharClassify::ccSpace) {
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) {
pos--;
}
}
- while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccSpace) {
+ while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) {
pos--;
}
}
} else {
- while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccSpace) {
+ while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) {
pos++;
}
if (pos < Length()) {
- charClassification ccStart = WordCharClass(cb.CharAt(pos));
+ CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos));
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) {
pos++;
}
*/
bool Document::IsWordStartAt(int pos) {
if (pos > 0) {
- charClassification ccPos = WordCharClass(CharAt(pos));
- return (ccPos == ccWord || ccPos == ccPunctuation) &&
+ CharClassify::cc ccPos = WordCharClass(CharAt(pos));
+ return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) &&
(ccPos != WordCharClass(CharAt(pos - 1)));
}
return true;
*/
bool Document::IsWordEndAt(int pos) {
if (pos < Length()) {
- charClassification ccPrev = WordCharClass(CharAt(pos-1));
- return (ccPrev == ccWord || ccPrev == ccPunctuation) &&
+ CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1));
+ return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) &&
(ccPrev != WordCharClass(CharAt(pos)));
}
return true;
int *length) {
if (regExp) {
if (!pre)
- pre = new RESearch();
+ pre = new RESearch(&charClass);
if (!pre)
return -1;
}
void Document::SetDefaultCharClasses(bool includeWordClass) {
- // Initialize all char classes to default values
- for (int ch = 0; ch < 256; ch++) {
- if (ch == '\r' || ch == '\n')
- charClass[ch] = ccNewLine;
- else if (ch < 0x20 || ch == ' ')
- charClass[ch] = ccSpace;
- else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_'))
- charClass[ch] = ccWord;
- else
- charClass[ch] = ccPunctuation;
- }
+ charClass.SetDefaultCharClasses(includeWordClass);
}
-void Document::SetCharClasses(const unsigned char *chars, charClassification newCharClass) {
- // Apply the newCharClass to the specifed chars
- if (chars) {
- while (*chars) {
- charClass[*chars] = newCharClass;
- chars++;
- }
- }
+void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass) {
+ charClass.SetCharClasses(chars, newCharClass);
}
void Document::SetStylingBits(int bits) {
}
bool Document::IsWordPartSeparator(char ch) {
- return (WordCharClass(ch) == ccWord) && IsPunctuation(ch);
+ return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch);
}
int Document::WordPartLeft(int pos) {
private:
int refCount;
CellBuffer cb;
- charClassification charClass[256];
+ CharClassify charClass;
char stylingMask;
int endStyled;
int styleClock;
void ChangeCase(Range r, bool makeUpperCase);
void SetDefaultCharClasses(bool includeWordClass);
- void SetCharClasses(const unsigned char *chars, charClassification newCharClass);
+ void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
bool SetStyleFor(int length, char style);
private:
void CheckReadOnly();
- charClassification WordCharClass(unsigned char ch);
+ CharClassify::cc WordCharClass(unsigned char ch);
bool IsWordStartAt(int pos);
bool IsWordEndAt(int pos);
bool IsWordAt(int start, int end);
#include "DocumentAccessor.h"
#include "CellBuffer.h"
#include "Scintilla.h"
+#include "CharClassify.h"
#include "Document.h"
DocumentAccessor::~DocumentAccessor() {
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
+#include "CharClassify.h"
#include "Document.h"
#include "Editor.h"
}
void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
-// PLATFORM_ASSERT(useCount == 0);
+ PLATFORM_ASSERT(useCount == 0);
int lengthForLevel = 0;
if (level == llcCaret) {
lengthForLevel = 1;
}
void LineLayoutCache::Deallocate() {
-// PLATFORM_ASSERT(useCount == 0);
+ PLATFORM_ASSERT(useCount == 0);
for (int i = 0; i < length; i++)
delete cache[i];
delete []cache;
} else if (level == llcPage) {
if (lineNumber == lineCaret) {
pos = 0;
- } else {
+ } else if (length > 1) {
pos = 1 + (lineNumber % (length - 1));
}
} else if (level == llcDocument) {
delete ll;
} else {
useCount--;
- }
+ }
}
}
wrapState = eWrapNone;
wrapWidth = LineLayout::wrapWidthInfinite;
- docLineLastWrapped = -1;
- docLastLineToWrap = -1;
- backgroundWrapEnabled = true;
+ wrapStart = wrapLineLarge;
+ wrapEnd = wrapLineLarge;
wrapVisualFlags = 0;
wrapVisualFlagsLocation = 0;
wrapVisualStartIndent = 0;
return pdoc->MovePositionOutsideChar(i + posLineStart, 1);
}
}
+ if (pt.x < (ll->positions[lineEnd] - subLineStart)) {
+ return pdoc->MovePositionOutsideChar(lineEnd + posLineStart, 1);
+ }
}
}
void Editor::UpdateSystemCaret() {
}
-void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) {
- docLineStartWrapping = Platform::Minimum(docLineStartWrapping, pdoc->LinesTotal()-1);
- docLineEndWrapping = Platform::Minimum(docLineEndWrapping, pdoc->LinesTotal()-1);
- bool noWrap = (docLastLineToWrap == docLineLastWrapped);
- if (docLineLastWrapped > (docLineStartWrapping - 1)) {
- docLineLastWrapped = docLineStartWrapping - 1;
- if (docLineLastWrapped < -1)
- docLineLastWrapped = -1;
+void Editor::NeedWrapping(int docLineStart, int docLineEnd) {
+ docLineStart = Platform::Clamp(docLineStart, 0, pdoc->LinesTotal());
+ if (wrapStart > docLineStart) {
+ wrapStart = docLineStart;
llc.Invalidate(LineLayout::llPositions);
}
- if (noWrap) {
- docLastLineToWrap = docLineEndWrapping;
- } else if (docLastLineToWrap < docLineEndWrapping) {
- docLastLineToWrap = docLineEndWrapping + 1;
+ if (wrapEnd < docLineEnd) {
+ wrapEnd = docLineEnd;
}
- if (docLastLineToWrap < -1)
- docLastLineToWrap = -1;
- if (docLastLineToWrap >= pdoc->LinesTotal())
- docLastLineToWrap = pdoc->LinesTotal()-1;
+ wrapEnd = Platform::Clamp(wrapEnd, 0, pdoc->LinesTotal());
// Wrap lines during idle.
- if ((wrapState != eWrapNone) &&
- backgroundWrapEnabled &&
- (docLastLineToWrap != docLineLastWrapped)) {
+ if ((wrapState != eWrapNone) && (wrapEnd != wrapStart)) {
SetIdle(true);
}
}
// fullwrap: if true, all lines which need wrapping will be done,
// in this single call.
// priorityWrapLineStart: If greater than zero, all lines starting from
-// here to 100 lines past will be wrapped (even if there are
+// here to 1 page + 100 lines past will be wrapped (even if there are
// more lines under wrapping process in idle).
-// If it is neither fullwrap, nor priorityWrap, then 100 lines will be
+// If it is neither fullwrap, nor priorityWrap, then 1 page + 100 lines will be
// wrapped, if there are any wrapping going on in idle. (Generally this
// condition is called only from idler).
// Return true if wrapping occurred.
bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
// If there are any pending wraps, do them during idle if possible.
+ int linesInOneCall = LinesOnScreen() + 100;
if (wrapState != eWrapNone) {
- if (docLineLastWrapped < docLastLineToWrap) {
- if (!(backgroundWrapEnabled && SetIdle(true))) {
- // Background wrapping is disabled, or idle processing
- // not supported. A full wrap is required.
+ if (wrapStart < wrapEnd) {
+ if (!SetIdle(true)) {
+ // Idle processing not supported so full wrap required.
fullWrap = true;
}
}
if (!fullWrap && priorityWrapLineStart >= 0 &&
// .. and if the paint window is outside pending wraps
- (((priorityWrapLineStart + 100) < docLineLastWrapped) ||
- (priorityWrapLineStart > docLastLineToWrap))) {
+ (((priorityWrapLineStart + linesInOneCall) < wrapStart) ||
+ (priorityWrapLineStart > wrapEnd))) {
// No priority wrap pending
return false;
}
}
int goodTopLine = topLine;
bool wrapOccurred = false;
- if (docLineLastWrapped < pdoc->LinesTotal()) {
+ if (wrapStart <= pdoc->LinesTotal()) {
if (wrapState == eWrapNone) {
if (wrapWidth != LineLayout::wrapWidthInfinite) {
wrapWidth = LineLayout::wrapWidthInfinite;
}
wrapOccurred = true;
}
- docLineLastWrapped = 0x7ffffff;
+ wrapStart = wrapLineLarge;
+ wrapEnd = wrapLineLarge;
} else {
+ if (wrapEnd >= pdoc->LinesTotal())
+ wrapEnd = pdoc->LinesTotal();
//ElapsedTime et;
int lineDocTop = cs.DocFromDisplay(topLine);
int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop);
AutoSurface surface(this);
if (surface) {
bool priorityWrap = false;
- int lastLineToWrap = docLastLineToWrap;
- int firstLineToWrap = docLineLastWrapped;
+ int lastLineToWrap = wrapEnd;
+ int lineToWrap = wrapStart;
if (!fullWrap) {
if (priorityWrapLineStart >= 0) {
// This is a priority wrap.
- firstLineToWrap = priorityWrapLineStart;
- lastLineToWrap = firstLineToWrap + 100;
+ lineToWrap = priorityWrapLineStart;
+ lastLineToWrap = priorityWrapLineStart + linesInOneCall;
priorityWrap = true;
} else {
// This is idle wrap.
- lastLineToWrap = docLineLastWrapped + 100;
+ lastLineToWrap = wrapStart + linesInOneCall;
}
- if (lastLineToWrap >= docLastLineToWrap)
- lastLineToWrap = docLastLineToWrap;
+ if (lastLineToWrap >= wrapEnd)
+ lastLineToWrap = wrapEnd;
} // else do a fullWrap.
- // printf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, firstLineToWrap, lastLineToWrap);
- // printf("Pending wraps: %d to %d\n", docLineLastWrapped, docLastLineToWrap);
- while (firstLineToWrap < lastLineToWrap) {
- firstLineToWrap++;
- if (!priorityWrap)
- docLineLastWrapped++;
- if (firstLineToWrap < pdoc->LinesTotal()) {
- AutoLineLayout ll(llc, RetrieveLineLayout(firstLineToWrap));
+ // Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap);
+ // Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd);
+ while (lineToWrap < lastLineToWrap) {
+ AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap));
int linesWrapped = 1;
if (ll) {
- LayoutLine(firstLineToWrap, surface, vs, ll, wrapWidth);
+ LayoutLine(lineToWrap, surface, vs, ll, wrapWidth);
linesWrapped = ll->lines;
}
- if (cs.SetHeight(firstLineToWrap, linesWrapped)) {
+ if (cs.SetHeight(lineToWrap, linesWrapped)) {
wrapOccurred = true;
- }
}
+ lineToWrap++;
}
+ if (!priorityWrap)
+ wrapStart = lineToWrap;
// If wrapping is done, bring it to resting position
- if (docLineLastWrapped > docLastLineToWrap) {
- docLineLastWrapped = -1;
- docLastLineToWrap = -1;
+ if (wrapStart >= wrapEnd) {
+ wrapStart = wrapLineLarge;
+ wrapEnd = wrapLineLarge;
}
}
goodTopLine = cs.DisplayFromDoc(lineDocTop);
targetEnd += static_cast<int>(strlen(eol));
}
}
+ lineEnd = pdoc->LineFromPosition(targetEnd);
}
pdoc->EndUndoAction();
}
rcSelMargin.left = rcSelMargin.right;
rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width;
- if (vs.ms[margin].symbol) {
+ if (vs.ms[margin].style != SC_MARGIN_NUMBER) {
/* alternate scheme:
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated);
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
// Required because of special way brush is created for selection margin
surface->FillRectangle(rcSelMargin, *pixmapSelPattern);
- else
- surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated);
+ else {
+ ColourAllocated colour;
+ switch (vs.ms[margin].style) {
+ case SC_MARGIN_BACK:
+ colour = vs.styles[STYLE_DEFAULT].back.allocated;
+ break;
+ case SC_MARGIN_FORE:
+ colour = vs.styles[STYLE_DEFAULT].fore.allocated;
+ break;
+ default:
+ colour = vs.styles[STYLE_LINENUMBER].back.allocated;
+ break;
+ }
+ surface->FillRectangle(rcSelMargin, colour);
+ }
} else {
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated);
}
PRectangle rcMarker = rcSelMargin;
rcMarker.top = yposScreen;
rcMarker.bottom = yposScreen + vs.lineHeight;
- if (!vs.ms[margin].symbol) {
+ if (vs.ms[margin].style == SC_MARGIN_NUMBER) {
char number[100];
number[0] = '\0';
if (firstSubLine)
continue;
}
if (p > 0) {
- if (wrapState == eWrapChar){
+ if (wrapState == eWrapChar) {
lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1)
- posLineStart;
p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart;
}
}
+ColourAllocated Editor::SelectionBackground(ViewStyle &vsDraw) {
+ return primarySelection ? vsDraw.selbackground.allocated : vsDraw.selbackground2.allocated;
+}
+
ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,
ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) {
if (inSelection) {
- if (vsDraw.selbackset) {
- if (primarySelection)
- return vsDraw.selbackground.allocated;
- else
- return vsDraw.selbackground2.allocated;
+ if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
+ return SelectionBackground(vsDraw);
}
} else {
if ((vsDraw.edgeState == EDGE_BACKGROUND) &&
surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative);
}
};
- Relative rel = {surface, x0, xStraight?1:-1, y0, yStraight?1:-1};
+ Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1};
// arrow head
rel.MoveTo(xa, y);
y - 2 * dy);
}
+static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocated fill, int alpha) {
+ if (alpha != SC_ALPHA_NOALPHA) {
+ surface->AlphaRectangle(rc, 0, fill, alpha, fill, alpha, 0);
+ }
+}
+
void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
int line, int lineEnd, int xStart, int subLine, int subLineStart,
bool overrideBackground, ColourAllocated background,
bool eolInSelection = (subLine == (ll->lines - 1)) &&
(posLineEnd > ll->selStart) && (posLineEnd <= ll->selEnd) && (ll->selStart != ll->selEnd);
- if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1)) {
- if (primarySelection)
- surface->FillRectangle(rcSegment, vsDraw.selbackground.allocated);
- else
- surface->FillRectangle(rcSegment, vsDraw.selbackground2.allocated);
- } else if (overrideBackground) {
- surface->FillRectangle(rcSegment, background);
+ if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
+ surface->FillRectangle(rcSegment, SelectionBackground(vsDraw));
} else {
- surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated);
+ if (overrideBackground) {
+ surface->FillRectangle(rcSegment, background);
+ } else {
+ surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated);
+ }
+ if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha != SC_ALPHA_NOALPHA)) {
+ SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha);
+ }
}
rcSegment.left = xEol + vsDraw.aveCharWidth + xStart;
// the color for the highest numbered one is used.
bool overrideBackground = false;
ColourAllocated background;
- if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
+ if (caret.active && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) {
overrideBackground = true;
background = vsDraw.caretLineBackground.allocated;
}
if (!overrideBackground) {
int marks = pdoc->GetMark(line);
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
- if ((marks & 1) && vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) {
+ if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) &&
+ (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
background = vsDraw.markers[markBit].back.allocated;
overrideBackground = true;
}
}
if (!overrideBackground) {
if (vsDraw.maskInLine) {
- int marks = pdoc->GetMark(line) & vsDraw.maskInLine;
- if (marks) {
- for (int markBit = 0; (markBit < 32) && marks; markBit++) {
- if ((marks & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) {
+ int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
+ if (marksMasked) {
+ for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
+ if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) &&
+ (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
overrideBackground = true;
background = vsDraw.markers[markBit].back.allocated;
}
- marks >>= 1;
+ marksMasked >>= 1;
}
}
}
xStart, subLine, subLineStart, overrideBackground, background,
drawWrapMarkEnd, vsDraw.whitespaceForeground.allocated);
}
+ if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) && (ll->selStart >= 0) && (ll->selEnd >= 0)) {
+ int startPosSel = (ll->selStart < posLineStart) ? posLineStart : ll->selStart;
+ int endPosSel = (ll->selEnd < (lineEnd + posLineStart)) ? ll->selEnd : (lineEnd + posLineStart);
+ if (startPosSel < endPosSel) {
+ rcSegment.left = xStart + ll->positions[startPosSel - posLineStart] - subLineStart;
+ rcSegment.right = xStart + ll->positions[endPosSel - posLineStart] - subLineStart;
+ SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha);
+ }
+ }
if (vsDraw.edgeState == EDGE_LINE) {
int edgeX = theEdge * vsDraw.spaceWidth;
rcSegment.right = rcSegment.left + 1;
surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated);
}
+
+ // Draw any translucent whole line states
+ rcSegment.left = xStart;
+ rcSegment.right = rcLine.right - 1;
+ if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
+ SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha);
+ }
+ int marks = pdoc->GetMark(line);
+ for (int markBit = 0; (markBit < 32) && marks; markBit++) {
+ if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) {
+ SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
+ }
+ marks >>= 1;
+ }
+ if (vsDraw.maskInLine) {
+ int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
+ if (marksMasked) {
+ for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
+ if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) {
+ SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
+ }
+ marksMasked >>= 1;
+ }
+ }
+ }
}
void Editor::RefreshPixMaps(Surface *surfaceWindow) {
// paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
RefreshStyleData();
-
RefreshPixMaps(surfaceWindow);
PRectangle rcClient = GetClientRectangle();
if (needUpdateUI) {
NotifyUpdateUI();
needUpdateUI = false;
+ RefreshStyleData();
+ RefreshPixMaps(surfaceWindow);
}
// Call priority lines wrap on a window of lines which are likely
// Printing supports only the line number margin.
int lineNumberIndex = -1;
for (int margin = 0; margin < ViewStyle::margins; margin++) {
- if ((!vsPrint.ms[margin].symbol) && (vsPrint.ms[margin].width > 0)) {
+ if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) {
lineNumberIndex = margin;
} else {
vsPrint.ms[margin].width = 0;
// Don't show the selection when printing
vsPrint.selbackset = false;
vsPrint.selforeset = false;
+ vsPrint.selAlpha = SC_ALPHA_NOALPHA;
vsPrint.whitespaceBackgroundSet = false;
vsPrint.whitespaceForegroundSet = false;
vsPrint.showCaretLineBackground = false;
llc.Invalidate(LineLayout::llCheckTextAndStyle);
if (wrapState != eWrapNone) {
int lineDoc = pdoc->LineFromPosition(mh.position);
- if (mh.linesAdded <= 0) {
- AutoSurface surface(this);
- AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc));
- if (surface && ll) {
- LayoutLine(lineDoc, surface, vs, ll, wrapWidth);
- if (cs.GetHeight(lineDoc) != ll->lines) {
- NeedWrapping(lineDoc - 1, lineDoc + 1);
- Redraw();
- }
- }
- } else {
- NeedWrapping(lineDoc, lineDoc + 1 + mh.linesAdded);
- }
+ int lines = Platform::Maximum(0, mh.linesAdded);
+ NeedWrapping(lineDoc, lineDoc + lines + 1);
}
}
}
InvalidateRange(mh.position, mh.position + mh.length);
}
}
+ llc.Invalidate(LineLayout::llCheckTextAndStyle);
} else {
// Move selection and brace highlights
if (mh.modificationType & SC_MOD_INSERTTEXT) {
text[size] = '\0';
}
}
- ss->Set(text, size + 1, pdoc->dbcsCodePage,
+ ss->Set(text, size + 1, pdoc->dbcsCodePage,
vs.styles[STYLE_DEFAULT].characterSet, selType == selRectangle);
}
}
void Editor::CopyText(int length, const char *text) {
SelectionText selectedText;
- selectedText.Copy(text, length,
+ selectedText.Copy(text, length + 1,
pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false);
CopyToClipboard(selectedText);
}
}
void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
- //Platform::DebugPrintf("ButtonUp %d\n", HaveMouseCapture());
+ //Platform::DebugPrintf("ButtonUp %d\n", HaveMouseCapture());
if (HaveMouseCapture()) {
if (PointInSelMargin(pt)) {
DisplayCursor(Window::cursorReverseArrow);
bool idleDone;
- bool wrappingDone = (wrapState == eWrapNone) || (!backgroundWrapEnabled);
+ bool wrappingDone = wrapState == eWrapNone;
if (!wrappingDone) {
// Wrap lines during idle.
WrapLines(false, -1);
// No more wrapping
- if (docLineLastWrapped == docLastLineToWrap)
+ if (wrapStart == wrapEnd)
wrappingDone = true;
}
pdoc->SetDefaultCharClasses(false);
if (lParam == 0)
return 0;
- pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), Document::ccWord);
+ pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), CharClassify::ccWord);
}
break;
case SCI_SETWHITESPACECHARS: {
if (lParam == 0)
return 0;
- pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), Document::ccSpace);
+ pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), CharClassify::ccSpace);
}
break;
return pdoc->ExtendWordSelect(wParam, 1, lParam != 0);
case SCI_SETWRAPMODE:
- switch(wParam){
- case SC_WRAP_WORD:
- wrapState = eWrapWord;
- break;
- case SC_WRAP_CHAR:
- wrapState = eWrapChar;
- break;
- default:
- wrapState = eWrapNone;
- break;
+ switch (wParam) {
+ case SC_WRAP_WORD:
+ wrapState = eWrapWord;
+ break;
+ case SC_WRAP_CHAR:
+ wrapState = eWrapChar;
+ break;
+ default:
+ wrapState = eWrapNone;
+ break;
}
xOffset = 0;
InvalidateStyleRedraw();
return pdoc->LineEnd(wParam);
case SCI_SETCODEPAGE:
- pdoc->dbcsCodePage = wParam;
- InvalidateStyleRedraw();
+ if (ValidCodePage(wParam)) {
+ pdoc->dbcsCodePage = wParam;
+ InvalidateStyleRedraw();
+ }
break;
case SCI_GETCODEPAGE:
InvalidateStyleData();
RedrawSelMargin();
break;
+ case SCI_MARKERSETALPHA:
+ if (wParam <= MARKER_MAX)
+ vs.markers[wParam].alpha = lParam;
+ InvalidateStyleRedraw();
+ break;
case SCI_MARKERADD: {
int markerID = pdoc->AddMark(wParam, lParam);
return markerID;
case SCI_SETMARGINTYPEN:
if (ValidMargin(wParam)) {
- vs.ms[wParam].symbol = (lParam == SC_MARGIN_SYMBOL);
+ vs.ms[wParam].style = lParam;
InvalidateStyleRedraw();
}
break;
case SCI_GETMARGINTYPEN:
if (ValidMargin(wParam))
- return vs.ms[wParam].symbol ? SC_MARGIN_SYMBOL : SC_MARGIN_NUMBER;
+ return vs.ms[wParam].style;
else
return 0;
vs.caretLineBackground.desired = wParam;
InvalidateStyleRedraw();
break;
+ case SCI_GETCARETLINEBACKALPHA:
+ return vs.caretLineAlpha;
+ case SCI_SETCARETLINEBACKALPHA:
+ vs.caretLineAlpha = wParam;
+ InvalidateStyleRedraw();
+ break;
// Folding messages
InvalidateStyleRedraw();
break;
+ case SCI_SETSELALPHA:
+ vs.selAlpha = wParam;
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_GETSELALPHA:
+ return vs.selAlpha;
+
case SCI_SETWHITESPACEFORE:
vs.whitespaceForegroundSet = wParam != 0;
vs.whitespaceForeground.desired = ColourDesired(lParam);
// Wrapping support
enum { eWrapNone, eWrapWord, eWrapChar } wrapState;
- bool backgroundWrapEnabled;
+ enum { wrapLineLarge = 0x7ffffff };
int wrapWidth;
- int docLineLastWrapped;
- int docLastLineToWrap;
+ int wrapStart;
+ int wrapEnd;
int wrapVisualFlags;
int wrapVisualFlagsLocation;
int wrapVisualStartIndent;
void InvalidateCaret();
virtual void UpdateSystemCaret();
- void NeedWrapping(int docLineStartWrapping = 0, int docLineEndWrapping = 0x7ffffff);
+ void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge);
bool WrapLines(bool fullWrap, int priorityWrapLineStart);
void LinesJoin();
void LinesSplit(int pixelWidth);
LineLayout *RetrieveLineLayout(int lineNumber);
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite);
+ ColourAllocated SelectionBackground(ViewStyle &vsDraw);
ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll);
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour);
void GetHotSpotRange(int& hsStart, int& hsEnd);
int CodePage() const;
+ virtual bool ValidCodePage(int /* codePage */) const { return true; }
int WrapCount(int line);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
#include "Platform.h"
+#include "Scintilla.h"
+
#include "SciLexer.h"
#include "PropSet.h"
#include "Accessor.h"
if (lib->IsValid()) {
m_sModuleName = ModuleName;
//Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects
- GetLexerCountFn GetLexerCount = (GetLexerCountFn)lib->FindFunction("GetLexerCount");
+ GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount");
if (GetLexerCount) {
ExternalLexerModule *lex;
LexerMinder *lm;
// Find functions in the DLL
- GetLexerNameFn GetLexerName = (GetLexerNameFn)lib->FindFunction("GetLexerName");
- ExtLexerFunction Lexer = (ExtLexerFunction)lib->FindFunction("Lex");
- ExtFoldFunction Folder = (ExtFoldFunction)lib->FindFunction("Fold");
+ GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName");
+ ExtLexerFunction Lexer = (ExtLexerFunction)(sptr_t)lib->FindFunction("Lex");
+ ExtFoldFunction Folder = (ExtFoldFunction)(sptr_t)lib->FindFunction("Fold");
// Assign a buffer for the lexer name.
char lexname[100];
surface->LineTo(rc.right, rcLine.top+1);
surface->LineTo(rc.left, rcLine.top+1);
surface->LineTo(rc.left, ymid+1);
+ } else if (style == INDIC_ROUNDBOX) {
+ PRectangle rcBox = rcLine;
+ rcBox.top = rcLine.top + 1;
+ rcBox.left = rc.left;
+ rcBox.right = rc.right;
+ surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0);
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid);
LINK_LEXER(lmGui4Cli);
LINK_LEXER(lmHaskell);
LINK_LEXER(lmHTML);
+ LINK_LEXER(lmInno);
LINK_LEXER(lmKix);
LINK_LEXER(lmLatex);
LINK_LEXER(lmLISP);
LINK_LEXER(lmNsis);
LINK_LEXER(lmNull);
LINK_LEXER(lmOctave);
+ LINK_LEXER(lmOpal);
LINK_LEXER(lmPascal);
LINK_LEXER(lmPB);
LINK_LEXER(lmPerl);
LINK_LEXER(lmScriptol);
LINK_LEXER(lmSmalltalk);
LINK_LEXER(lmSpecman);
+ LINK_LEXER(lmSpice);
LINK_LEXER(lmSQL);
LINK_LEXER(lmTADS3);
LINK_LEXER(lmTCL);
// May 23, 2005 - Fixed the SentKey lexing in case of a missing }
// Aug 11, 2005 - Fixed possible bug with s_save length > 100.
// Aug 23, 2005 - Added Switch/endswitch support to the folding logic.
+// Sep 27, 2005 - Fixed the SentKey lexing logic in case of multiple sentkeys.
+// Mar 12, 2006 - Fixed issue with <> coloring as String in stead of Operator in rare occasions.
+// Apr 8, 2006 - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF)
//
// 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.
static int GetSendKey(const char *szLine, char *szKey)
{
int nFlag = 0;
+ int nStartFound = 0;
int nKeyPos = 0;
int nSpecPos= 0;
int nSpecNum= 1;
// split the portion of the sendkey in the part before and after the spaces
while ( ( (cTemp = szLine[nPos]) != '\0'))
{
- // skip leading Ctrl/Shift/ALt state
- if ((cTemp == '#' || 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.
- szKey[nKeyPos++] = '}';
- }
- else if (cTemp == ' ')
- {
- // skip other spaces
+ // skip leading Ctrl/Shift/Alt state
+ if (cTemp == '{') {
+ nStartFound = 1;
}
- else if (nFlag == 0)
- {
- // save first portion into var till space or } is hit
- szKey[nKeyPos++] = cTemp;
- }
- else if ((nFlag == 1) && (cTemp != '}'))
- {
- // Save second portion into var...
- szSpecial[nSpecPos++] = cTemp;
- // check if Second portion is all numbers for repeat fuction
- if (isdigit(cTemp) == false) {nSpecNum = 0;}
+ //
+ if (nStartFound == 1) {
+ if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space
+ {
+ nFlag = 1;
+ // Add } to the end of the first bit for table lookup later.
+ szKey[nKeyPos++] = '}';
+ }
+ else if (cTemp == ' ')
+ {
+ // skip other spaces
+ }
+ else if (nFlag == 0)
+ {
+ // save first portion into var till space or } is hit
+ szKey[nKeyPos++] = cTemp;
+ }
+ else if ((nFlag == 1) && (cTemp != '}'))
+ {
+ // Save second portion into var...
+ szSpecial[nSpecPos++] = cTemp;
+ // check if Second portion is all numbers for repeat fuction
+ if (isdigit(cTemp) == false) {nSpecNum = 0;}
+ }
}
nPos++; // skip to next char
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
+ WordList &keywords8 = *keywordlists[7];
// find the first previous line without continuation character at the end
int lineCurrent = styler.GetLine(startPos);
int s_startPos = startPos;
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_DEFAULT);
}
+ else if (keywords8.InList(s)) {
+ sc.ChangeState(SCE_AU3_UDF);
+ sc.SetState(SCE_AU3_DEFAULT);
+ }
else if (strcmp(s, "_") == 0) {
sc.ChangeState(SCE_AU3_OPERATOR);
sc.SetState(SCE_AU3_DEFAULT);
if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>'))
{
sc.ForwardSetState(SCE_AU3_DEFAULT);
+ si=0;
}
if (sc.atLineEnd)
{
+ si=0;
// at line end and not found a continuation char then reset to default
int lineCurrent = styler.GetLine(sc.currentPos);
if (!IsContinuationLine(lineCurrent,styler))
}
}
// find Sendkeys in a STRING
- if (sc.ch == '{') {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);}
- if (sc.ch == '#' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
+ if (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ) {
+ sc.SetState(SCE_AU3_SENT);}
break;
}
}
sc.SetState(SCE_AU3_STRING);
}
+ else
+ {
+ // check if the start is a valid SendKey start
+ int nPos = 0;
+ int nState = 1;
+ char cTemp;
+ while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
+ {
+ if (cTemp == '{' && nState == 1)
+ {
+ nState = 2;
+ }
+ if (nState == 1 && !(cTemp == '+' || cTemp == '!' || cTemp == '^' || cTemp == '#' ))
+ {
+ nState = 0;
+ }
+ nPos++;
+ }
+ //Verify characters infront of { ... if not assume regular string
+ if (nState == 1 && (!(sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ))) {
+ sc.ChangeState(SCE_AU3_STRING);
+ sc.SetState(SCE_AU3_STRING);
+ }
+ // If invalid character found then assume its a regular string
+ if (nState == 0) {
+ sc.ChangeState(SCE_AU3_STRING);
+ sc.SetState(SCE_AU3_STRING);
+ }
+ }
// check if next portion is again a sendkey
if (sc.atLineEnd)
{
sc.SetState(SCE_AU3_DEFAULT);
si = 0; // reset string indicator
}
- //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);}
- if (sc.ch == '#' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
+ //* check in next characters following a sentkey are again a sent key
+ // Need this test incase of 2 sentkeys like {F1}{ENTER} but not detect {{}
+ if (sc.state == SCE_AU3_STRING && (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' )) {
+ sc.SetState(SCE_AU3_SENT);}
// check to see if the string ended...
- // Sentkey string isn't complete but the string ended....
+ // Sendkey string isn't complete but the string ended....
if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\''))
{
sc.ChangeState(SCE_AU3_STRING);
else if (sc.ch == '$') {sc.SetState(SCE_AU3_VARIABLE);}
else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);}
else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);}
+ //else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);}
else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include
else if (sc.ch == '\"') {
sc.SetState(SCE_AU3_STRING);
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_EXPAND);
}
+ else if (keywords8.InList(s_save)) {
+ sc.ChangeState(SCE_AU3_UDF);
+ sc.SetState(SCE_AU3_UDF);
+ }
else {
sc.ChangeState(SCE_AU3_DEFAULT);
sc.SetState(SCE_AU3_DEFAULT);
"#autoit Pre-processors",
"#autoit Special",
"#autoit Expand",
+ "#autoit UDF",
0
};
LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists);
if (state == SCE_SH_DEFAULT) {
if (ch == '\\') { // escaped character
- i++;
+ if (i < lengthDoc - 1)
+ i++;
ch = chNext;
chNext = chNext2;
styler.ColourTo(i, SCE_SH_IDENTIFIER);
&& !IsCommentLine(lineCurrent+1, styler))
levelCurrent--;
}
- if (style == SCE_C_OPERATOR) {
+ if (style == SCE_SH_OPERATOR) {
if (ch == '{') {
levelCurrent++;
} else if (ch == '}') {
sc.ChangeState(SCE_B_ERROR);
sc.SetState(SCE_B_DEFAULT);
}
- } else if (sc.state == SCE_B_COMMENT) {
+ } else if (sc.state == SCE_B_COMMENT || sc.state == SCE_B_PREPROCESSOR) {
if (sc.atLineEnd) {
sc.SetState(SCE_B_DEFAULT);
}
wasfirst = isfirst;
sc.SetState(SCE_B_IDENTIFIER);
} else if (sc.Match(comment_char)) {
- sc.SetState(SCE_B_COMMENT);
+ // Hack to make deprecated QBASIC '$Include show
+ // up in freebasic with SCE_B_PREPROCESSOR.
+ if (comment_char == '\'' && sc.Match(comment_char, '$'))
+ sc.SetState(SCE_B_PREPROCESSOR);
+ else
+ sc.SetState(SCE_B_COMMENT);
} else if (sc.Match('"')) {
sc.SetState(SCE_B_STRING);
} else if (IsDigit(sc.ch)) {
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDocSensitive, "cpp", FoldCppDoc, cppWordLists);
LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, ColouriseCppDocInsensitive, "cppnocase", FoldCppDoc, cppWordLists);
-LexerModule lmTCL(SCLEX_TCL, ColouriseCppDocSensitive, "tcl", FoldCppDoc, cppWordLists);
}
static inline bool IsAWordChar(unsigned int ch) {
- return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+ return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
static inline bool IsAWordStart(unsigned int ch) {
case SCE_HB_STRING:
case SCE_HBA_STRING:
case SCE_HP_STRING:
+ case SCE_HP_CHARACTER:
+ case SCE_HP_TRIPLE:
+ case SCE_HP_TRIPLEDOUBLE:
case SCE_HPA_STRING:
+ case SCE_HPA_CHARACTER:
+ case SCE_HPA_TRIPLE:
+ case SCE_HPA_TRIPLEDOUBLE:
case SCE_HPHP_HSTRING:
case SCE_HPHP_SIMPLESTRING:
case SCE_HPHP_HSTRING_VARIABLE:
return bResult;
}
+static inline bool stateAllowsTermination(int state) {
+ bool allowTermination = !isStringState(state);
+ if (allowTermination) {
+ switch (state) {
+ case SCE_HPHP_COMMENT:
+ case SCE_HP_COMMENTLINE:
+ case SCE_HPA_COMMENTLINE:
+ allowTermination = false;
+ }
+ }
+ return allowTermination;
+}
+
// not really well done, since it's only comments that should lex the %> and <%
static inline bool isCommentASPState(int state) {
bool bResult;
(ch == '<') &&
(chNext == '?') &&
!IsScriptCommentState(state) ) {
- scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
+ scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 10, eScriptPHP);
if (scriptLanguage != eScriptPHP && isStringState(state)) continue;
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
else if ((
((inScriptType == eNonHtmlPreProc)
|| (inScriptType == eNonHtmlScriptPreProc)) && (
- ((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
- ((scriptLanguage != eScriptNone) && !isStringState(state) &&
- ((ch == '%') || (ch == '?')))
+ ((scriptLanguage != eScriptNone) && stateAllowsTermination(state) && ((ch == '%') || (ch == '?')))
) && (chNext == '>')) ||
((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) {
if (state == SCE_H_ASPAT) {
--- /dev/null
+// Scintilla source code edit control
+/** @file LexInno.cxx
+ ** Lexer for Inno Setup scripts.
+ **/
+// Written by Friedrich Vedder <fvedd@t-online.de>, using code from LexOthers.cxx.
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <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 void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
+ int state = SCE_INNO_DEFAULT;
+ char chPrev;
+ char ch = 0;
+ char chNext = styler[startPos];
+ int lengthDoc = startPos + length;
+ char *buffer = new char[length];
+ int bufferCount = 0;
+ bool isBOL, isEOL, isWS, isBOLWS = 0;
+
+ WordList §ionKeywords = *keywordLists[0];
+ WordList &standardKeywords = *keywordLists[1];
+ WordList ¶meterKeywords = *keywordLists[2];
+ WordList &preprocessorKeywords = *keywordLists[3];
+ WordList &pascalKeywords = *keywordLists[4];
+ WordList &userKeywords = *keywordLists[5];
+
+ // Go through all provided text segment
+ // using the hand-written state machine shown below
+ styler.StartAt(startPos);
+ styler.StartSegment(startPos);
+ for (int i = startPos; i < lengthDoc; i++) {
+ chPrev = ch;
+ ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+
+ if (styler.IsLeadByte(ch)) {
+ chNext = styler.SafeGetCharAt(i + 2);
+ i++;
+ continue;
+ }
+
+ isBOL = (chPrev == 0) || (chPrev == '\n') || (chPrev == '\r' && ch != '\n');
+ isBOLWS = (isBOL) ? 1 : (isBOLWS && (chPrev == ' ' || chPrev == '\t'));
+ isEOL = (ch == '\n' || ch == '\r');
+ isWS = (ch == ' ' || ch == '\t');
+
+ switch(state) {
+ case SCE_INNO_DEFAULT:
+ if (ch == ';' && isBOLWS) {
+ // Start of a comment
+ state = SCE_INNO_COMMENT;
+ } else if (ch == '[' && isBOLWS) {
+ // Start of a section name
+ bufferCount = 0;
+ state = SCE_INNO_SECTION;
+ } else if (ch == '#' && isBOLWS) {
+ // Start of a preprocessor directive
+ state = SCE_INNO_PREPROC;
+ } else if (ch == '{' && chNext == '#') {
+ // Start of a preprocessor inline directive
+ state = SCE_INNO_PREPROC_INLINE;
+ } else if ((ch == '{' && (chNext == ' ' || chNext == '\t'))
+ || (ch == '(' && chNext == '*')) {
+ // Start of a Pascal comment
+ state = SCE_INNO_COMMENT_PASCAL;
+ } else if (ch == '"') {
+ // Start of a double-quote string
+ state = SCE_INNO_STRING_DOUBLE;
+ } else if (ch == '\'') {
+ // Start of a single-quote string
+ state = SCE_INNO_STRING_SINGLE;
+ } else if (isascii(ch) && (isalpha(ch) || (ch == '_'))) {
+ // Start of an identifier
+ bufferCount = 0;
+ buffer[bufferCount++] = static_cast<char>(tolower(ch));
+ state = SCE_INNO_IDENTIFIER;
+ } else {
+ // Style it the default style
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_COMMENT:
+ if (isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_COMMENT);
+ }
+ break;
+
+ case SCE_INNO_IDENTIFIER:
+ if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
+ buffer[bufferCount++] = static_cast<char>(tolower(ch));
+ } else {
+ state = SCE_INNO_DEFAULT;
+ buffer[bufferCount] = '\0';
+
+ // Check if the buffer contains a keyword
+ if (standardKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_KEYWORD);
+ } else if (parameterKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_PARAMETER);
+ } else if (pascalKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_KEYWORD_PASCAL);
+ } else if (userKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_KEYWORD_USER);
+ } else {
+ styler.ColourTo(i-1,SCE_INNO_DEFAULT);
+ }
+
+ // Push back the faulty character
+ chNext = styler[i--];
+ ch = chPrev;
+ }
+ break;
+
+ case SCE_INNO_SECTION:
+ if (ch == ']') {
+ state = SCE_INNO_DEFAULT;
+ buffer[bufferCount] = '\0';
+
+ // Check if the buffer contains a section name
+ if (sectionKeywords.InList(buffer)) {
+ styler.ColourTo(i,SCE_INNO_SECTION);
+ } else {
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ } else if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
+ buffer[bufferCount++] = static_cast<char>(tolower(ch));
+ } else {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_PREPROC:
+ if (isWS || isEOL) {
+ if (isascii(chPrev) && isalpha(chPrev)) {
+ state = SCE_INNO_DEFAULT;
+ buffer[bufferCount] = '\0';
+
+ // Check if the buffer contains a preprocessor directive
+ if (preprocessorKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_PREPROC);
+ } else {
+ styler.ColourTo(i-1,SCE_INNO_DEFAULT);
+ }
+
+ // Push back the faulty character
+ chNext = styler[i--];
+ ch = chPrev;
+ }
+ } else if (isascii(ch) && isalpha(ch)) {
+ if (chPrev == '#' || chPrev == ' ' || chPrev == '\t')
+ bufferCount = 0;
+ buffer[bufferCount++] = static_cast<char>(tolower(ch));
+ }
+ break;
+
+ case SCE_INNO_STRING_DOUBLE:
+ if (ch == '"' || isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_STRING_SINGLE:
+ if (ch == '\'' || isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_PREPROC_INLINE:
+ if (ch == '}') {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_PREPROC_INLINE);
+ } else if (isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_COMMENT_PASCAL:
+ if (ch == '}' || (ch == ')' && chPrev == '*')) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL);
+ } else if (isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ }
+ }
+ delete []buffer;
+}
+
+static const char * const innoWordListDesc[] = {
+ "Sections",
+ "Keywords",
+ "Parameters",
+ "Preprocessor directives",
+ "Pascal keywords",
+ "User defined keywords",
+ 0
+};
+
+static void FoldInnoDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
+ bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+
+ unsigned int endPos = startPos + length;
+ int visibleChars = 0;
+ int lineCurrent = styler.GetLine(startPos);
+
+ char chNext = styler[startPos];
+ int styleNext = styler.StyleAt(startPos);
+ bool headerPoint = false;
+ int lev;
+
+ for (unsigned int i = startPos; i < endPos; i++) {
+ char ch = chNext;
+ chNext = styler[i+1];
+
+ int style = styleNext;
+ styleNext = styler.StyleAt(i + 1);
+ bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+
+ if (style == SCE_INNO_SECTION)
+ headerPoint = true;
+
+ if (atEOL) {
+ lev = SC_FOLDLEVELBASE;
+
+ if (lineCurrent > 0) {
+ int levelPrevious = styler.LevelAt(lineCurrent - 1);
+
+ if (levelPrevious & SC_FOLDLEVELHEADERFLAG)
+ lev = SC_FOLDLEVELBASE + 1;
+ else
+ lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
+ }
+
+ if (headerPoint)
+ lev = SC_FOLDLEVELBASE;
+
+ if (visibleChars == 0 && foldCompact)
+ lev |= SC_FOLDLEVELWHITEFLAG;
+
+ if (headerPoint)
+ lev |= SC_FOLDLEVELHEADERFLAG;
+
+ if (lev != styler.LevelAt(lineCurrent))
+ styler.SetLevel(lineCurrent, lev);
+
+ lineCurrent++;
+ visibleChars = 0;
+ headerPoint = false;
+ }
+ if (!isspacechar(ch))
+ visibleChars++;
+ }
+
+ if (lineCurrent > 0) {
+ int levelPrevious = styler.LevelAt(lineCurrent - 1);
+
+ if (levelPrevious & SC_FOLDLEVELHEADERFLAG)
+ lev = SC_FOLDLEVELBASE + 1;
+ else
+ lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
+ } else {
+ lev = SC_FOLDLEVELBASE;
+ }
+ int flagsNext = styler.LevelAt(lineCurrent);
+ styler.SetLevel(lineCurrent, lev | flagsNext & ~SC_FOLDLEVELNUMBERMASK);
+}
+
+LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc);
// but probably enough in most cases.
return (ch < 0x80) &&
(isdigit(ch) || toupper(ch) == 'E' ||
- ch == '.' || ch == '-' || ch == '+');
+ ch == '.' || ch == '-' || ch == '+' ||
+ (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'));
}
static inline bool IsLuaOperator(int ch) {
ch == '{' || ch == '}' || ch == '~' ||
ch == '[' || ch == ']' || ch == ';' ||
ch == '<' || ch == '>' || ch == ',' ||
- ch == '.' || ch == '^' || ch == '%' || ch == ':') {
+ ch == '.' || ch == '^' || ch == '%' || ch == ':' ||
+ ch == '#') {
return true;
}
return false;
if (sc.state == SCE_LUA_OPERATOR) {
sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.state == SCE_LUA_NUMBER) {
- // We stop the number definition on non-numerical non-dot non-eE non-sign char
+ // We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char
if (!IsANumberChar(sc.ch)) {
sc.SetState(SCE_LUA_DEFAULT);
}
if (sc.state == SCE_LUA_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_LUA_NUMBER);
+ if (sc.ch == '0' && toupper(sc.chNext) == 'X') {
+ sc.Forward(1);
+ }
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_LUA_IDENTIFIER);
} else if (sc.ch == '\"') {
** Lexer for MSSQL.
**/
// By Filip Yaghob <fyaghob@gmail.com>
-
+// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
--- /dev/null
+// Scintilla source code edit control
+/** @file LexOpal.cxx
+ ** Lexer for OPAL (functional language similar to Haskell)
+ ** Written by Sebastian Pipping <webmaster@hartwork.org>
+ **/
+
+#include <stdlib.h>
+#include <string.h>
+#include <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"
+
+inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len )
+{
+ unsigned int i = 0;
+ while( ( i < end - start + 1 ) && ( i < len - 1 ) )
+ {
+ s[i] = static_cast<char>( styler[ start + i ] );
+ i++;
+ }
+ s[ i ] = '\0';
+}
+
+inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+{
+ char ch;
+
+ // Wait for string to close
+ bool even_backslash_count = true; // Without gaps in between
+ cur++; // Skip initial quote
+ for( ; ; )
+ {
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_STRING );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( ( ch == '\015' ) || ( ch == '\012' ) ) // Deny multi-line strings
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_STRING );
+ styler.StartSegment( cur );
+ return true;
+ }
+ else
+ {
+ if( even_backslash_count )
+ {
+ if( ch == '"' )
+ {
+ styler.ColourTo( cur, SCE_OPAL_STRING );
+ cur++;
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else if( ch == '\\' )
+ {
+ even_backslash_count = false;
+ }
+ }
+ else
+ {
+ even_backslash_count = true;
+ }
+ }
+
+ cur++;
+ }
+}
+
+inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
+{
+ char ch;
+
+ if( could_fail )
+ {
+ cur++;
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( ch != '*' )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+
+ // Wait for comment close
+ cur++;
+ bool star_found = false;
+ for( ; ; )
+ {
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_BLOCK );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( star_found )
+ {
+ if( ch == '/' )
+ {
+ styler.ColourTo( cur, SCE_OPAL_COMMENT_BLOCK );
+ cur++;
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else if( ch != '*' )
+ {
+ star_found = false;
+ }
+ }
+ else if( ch == '*' )
+ {
+ star_found = true;
+ }
+ cur++;
+ }
+}
+
+inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
+{
+ char ch;
+
+ if( could_fail )
+ {
+ cur++;
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( ch != '-' )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ styler.StartSegment( cur );
+ return true;
+ }
+
+ cur++;
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( ( ch != ' ' ) && ( ch != '\t' ) )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+
+ // Wait for end of line
+ bool fifteen_found = false;
+
+ for( ; ; )
+ {
+ cur++;
+
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( fifteen_found )
+ {
+/*
+ if( ch == '\012' )
+ {
+ // One newline on Windows (015, 012)
+ }
+ else
+ {
+ // One newline on MAC (015) and another char
+ }
+*/
+ cur--;
+ styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
+ styler.StartSegment( cur );
+ return true;
+ }
+ else
+ {
+ if( ch == '\015' )
+ {
+ fifteen_found = true;
+ }
+ else if( ch == '\012' )
+ {
+ // One newline on Linux (012)
+ styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ }
+}
+
+inline bool HandlePar( unsigned int & cur, Accessor & styler )
+{
+ styler.ColourTo( cur, SCE_OPAL_PAR );
+
+ cur++;
+
+ styler.StartSegment( cur );
+ return true;
+}
+
+inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+{
+ char ch;
+
+ cur++;
+ for( ; ; )
+ {
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
+ return false;
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ switch( ch )
+ {
+ case ' ':
+ case '\t':
+ case '\015':
+ case '\012':
+ cur++;
+ break;
+
+ default:
+ styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+}
+
+inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+{
+ char ch;
+
+ for( ; ; )
+ {
+ cur++;
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( !isdigit( ch ) )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+}
+
+inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor & styler, WordList * keywordlists[] )
+{
+ char ch;
+ const unsigned int beg = cur;
+
+ cur++;
+ for( ; ; )
+ {
+ ch = styler.SafeGetCharAt( cur );
+ if( ( ch != '_' ) && ( ch != '-' ) &&
+ !islower( ch ) && !isupper( ch ) && !isdigit( ch ) ) break;
+
+ cur++;
+ if( cur >= one_too_much )
+ {
+ break;
+ }
+ }
+
+ const int ide_len = cur - beg + 1;
+ char * ide = new char[ ide_len ];
+ getRange( beg, cur, styler, ide, ide_len );
+
+ WordList & keywords = *keywordlists[ 0 ];
+ WordList & classwords = *keywordlists[ 1 ];
+
+ if( keywords.InList( ide ) ) // Keyword
+ {
+ delete [] ide;
+
+ styler.ColourTo( cur - 1, SCE_OPAL_KEYWORD );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else if( classwords.InList( ide ) ) // Sort
+ {
+ delete [] ide;
+
+ styler.ColourTo( cur - 1, SCE_OPAL_SORT );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else if( !strcmp( ide, "true" ) || !strcmp( ide, "false" ) ) // Bool const
+ {
+ delete [] ide;
+
+ styler.ColourTo( cur - 1, SCE_OPAL_BOOL_CONST );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else // Unknown keyword
+ {
+ delete [] ide;
+
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+
+}
+
+inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+{
+ cur++;
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+}
+
+static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor & styler )
+{
+ styler.StartAt( startPos );
+ styler.StartSegment( startPos );
+
+ unsigned int & cur = startPos;
+ const unsigned int one_too_much = startPos + length;
+
+ int state = initStyle;
+
+ for( ; ; )
+ {
+ switch( state )
+ {
+ case SCE_OPAL_KEYWORD:
+ case SCE_OPAL_SORT:
+ if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ case SCE_OPAL_INTEGER:
+ if( !HandleInteger( cur, one_too_much, styler ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ case SCE_OPAL_COMMENT_BLOCK:
+ if( !HandleCommentBlock( cur, one_too_much, styler, false ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ case SCE_OPAL_COMMENT_LINE:
+ if( !HandleCommentLine( cur, one_too_much, styler, false ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ case SCE_OPAL_STRING:
+ if( !HandleString( cur, one_too_much, styler ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ default: // SCE_OPAL_DEFAULT:
+ {
+ char ch = styler.SafeGetCharAt( cur );
+
+ switch( ch )
+ {
+ // String
+ case '"':
+ if( !HandleString( cur, one_too_much, styler ) ) return;
+ break;
+
+ // Comment block
+ case '/':
+ if( !HandleCommentBlock( cur, one_too_much, styler, true ) ) return;
+ break;
+
+ // Comment line
+ case '-':
+ if( !HandleCommentLine( cur, one_too_much, styler, true ) ) return;
+ break;
+
+ // Par
+ case '(':
+ case ')':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ if( !HandlePar( cur, styler ) ) return;
+ break;
+
+ // Whitespace
+ case ' ':
+ case '\t':
+ case '\015':
+ case '\012':
+ if( !HandleSpace( cur, one_too_much, styler ) ) return;
+ break;
+
+ default:
+ {
+ // Integer
+ if( isdigit( ch ) )
+ {
+ if( !HandleInteger( cur, one_too_much, styler ) ) return;
+ }
+
+ // Keyword
+ else if( islower( ch ) || isupper( ch ) )
+ {
+ if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;
+
+ }
+
+ // Skip
+ else
+ {
+ if( !HandleSkip( cur, one_too_much, styler ) ) return;
+ }
+ }
+ }
+
+ break;
+ }
+ }
+ }
+}
+
+static const char * const opalWordListDesc[] = {
+ "Keywords",
+ "Sorts",
+ 0
+};
+
+LexerModule lmOpal(SCLEX_OPAL, ColouriseOpalDoc, "opal", NULL, opalWordListDesc);
// Tests for BATCH Separators
static bool IsBSeparator(char ch) {
- return (ch == ':') || (ch == '\\') || (ch == '.') || (ch == ';') ||
+ return (ch == '\\') || (ch == '.') || (ch == ';') ||
(ch == '\"') || (ch == '\'') || (ch == '/') || (ch == ')');
}
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
- WordList &keywords,
+ WordList *keywordlists[],
Accessor &styler) {
unsigned int offset = 0; // Line Buffer Offset
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
+ WordList &keywords = *keywordlists[0]; // Internal Commands
+ WordList &keywords2 = *keywordlists[1]; // External Commands (optional)
+
// CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords
// Toggling Regular Keyword Checking off improves readability
// Other Regular Keywords and External Commands / Programs might also benefit from toggling
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Colorize External Command / Program
- styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ if (!keywords2) {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ } else if (keywords2.InList(wordBuffer)) {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ } else {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
+ }
// Reset External Command / Program Location
cmdLoc = offset;
} else {
// 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) ||
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;
}
}
}
- // Colorize External command / program
- styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ // Colorize External Command / Program
+ if (!keywords2) {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ } else if (keywords2.InList(wordBuffer)) {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ } else {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
+ }
// No need to Reset Offset
// Check for Default Text
} else {
// 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) &&
+ } else if (
(wordBuffer[1] == '%') &&
(wordBuffer[2] != '%') &&
(!IsBOperator(wordBuffer[2])) &&
Accessor &styler) {
char lineBuffer[1024];
- WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
styler.StartSegment(startPos);
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0';
- ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywords, styler);
+ ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0) { // Last line does not have ending characters
ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
- keywords, styler);
+ keywordlists, styler);
}
}
while ((i < lengthLine) && (lineBuffer[i] != '='))
i++;
if ((i < lengthLine) && (lineBuffer[i] == '=')) {
- styler.ColourTo(startLine + i - 1, SCE_PROPS_DEFAULT);
- styler.ColourTo(startLine + i, 3);
+ styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
+ styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
// CTags: \t<message>
// Lua 5 traceback: \t<filename>:<line>:<message>
bool initialTab = (lineBuffer[0] == '\t');
- enum { stInitial,
+ enum { stInitial,
stGccStart, stGccDigit, stGcc,
stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
stCtagsStart, stCtagsStartString, stCtagsStringDollar, stCtags,
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") ||
+ if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") ||
+ !CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") ||
!CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {
state = stMsVc;
} else
}
static const char * const batchWordListDesc[] = {
- "Keywords",
+ "Internal Commands",
+ "External Commands",
0
};
} else if (sc.state == SCE_P_DECORATOR) {
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_P_DEFAULT);
+ } else if (sc.ch == '#') {
+ sc.SetState((sc.chNext == '#') ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
}
} else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
if (sc.ch == '\\') {
ch == '.' || ch == '-' || ch == '+');
}
-
static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
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 styleBeforeDCKeyword = SCE_SQL_DEFAULT;
for (; sc.More(); sc.Forward()) {
- // Fold based on indentation
- if (sc.atLineStart) {
- int spaceFlags = 0;
- int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
- 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)) {
- level |= SC_FOLDLEVELHEADERFLAG;
- }
- }
- if (fold) {
- styler.SetLevel(lineCurrent, level);
- }
- }
-
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_SQL_OPERATOR:
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+ bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
+
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;
+ levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
}
int levelNext = levelCurrent;
char chNext = styler[startPos];
} else {
s[j] = '\0';
}
- if (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0) {
+ if ((!foldOnlyBegin) && (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0)) {
if (endFound) {
// ignore
endFound = false;
}
}
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);
+ int levelUse = levelCurrent;
+ int lev = levelUse | levelNext << 16;
+ if (visibleChars == 0 && foldCompact)
+ lev |= SC_FOLDLEVELWHITEFLAG;
+ if (levelUse < levelNext)
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ if (lev != styler.LevelAt(lineCurrent)) {
+ styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelCurrent = levelNext;
--- /dev/null
+// Scintilla source code edit control
+/** @file LexSpice.cxx
+ ** Lexer for Spice
+ **/
+// Copyright 2006 by Fabien Proriol
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "Platform.h"
+
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "PropSet.h"
+#include "KeyWords.h"
+#include "SciLexer.h"
+#include "SString.h"
+
+/*
+ * Interface
+ */
+
+static void ColouriseDocument(
+ unsigned int startPos,
+ int length,
+ int initStyle,
+ WordList *keywordlists[],
+ Accessor &styler);
+
+static const char * const spiceWordListDesc[] = {
+ "Keywords", // SPICE command
+ "Keywords2", // SPICE functions
+ "Keywords3", // SPICE params
+ 0
+};
+
+LexerModule lmSpice(SCLEX_SPICE, ColouriseDocument, "spice", NULL, spiceWordListDesc);
+
+/*
+ * Implementation
+ */
+
+static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute);
+
+static inline bool IsDelimiterCharacter(int ch);
+static inline bool IsNumberStartCharacter(int ch);
+static inline bool IsNumberCharacter(int ch);
+static inline bool IsSeparatorOrDelimiterCharacter(int ch);
+static inline bool IsWordStartCharacter(int ch);
+static inline bool IsWordCharacter(int ch);
+
+static void ColouriseComment(StyleContext& sc, bool&) {
+ sc.SetState(SCE_SPICE_COMMENTLINE);
+ while (!sc.atLineEnd) {
+ sc.Forward();
+ }
+}
+
+static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) {
+ apostropheStartsAttribute = sc.Match (')');
+ sc.SetState(SCE_SPICE_DELIMITER);
+ sc.ForwardSetState(SCE_SPICE_DEFAULT);
+}
+
+static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
+ apostropheStartsAttribute = true;
+ SString number;
+ sc.SetState(SCE_SPICE_NUMBER);
+ // Get all characters up to a delimiter or a separator, including points, but excluding
+ // double points (ranges).
+ while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) {
+ number += static_cast<char>(sc.ch);
+ sc.Forward();
+ }
+ // Special case: exponent with sign
+ if ((sc.chPrev == 'e' || sc.chPrev == 'E') &&
+ (sc.ch == '+' || sc.ch == '-')) {
+ number += static_cast<char>(sc.ch);
+ sc.Forward ();
+ while (!IsSeparatorOrDelimiterCharacter(sc.ch)) {
+ number += static_cast<char>(sc.ch);
+ sc.Forward();
+ }
+ }
+ sc.SetState(SCE_SPICE_DEFAULT);
+}
+
+static void ColouriseWhiteSpace(StyleContext& sc, bool& ) {
+ sc.SetState(SCE_SPICE_DEFAULT);
+ sc.ForwardSetState(SCE_SPICE_DEFAULT);
+}
+
+static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute) {
+ apostropheStartsAttribute = true;
+ sc.SetState(SCE_SPICE_IDENTIFIER);
+ SString word;
+ while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
+ word += static_cast<char>(tolower(sc.ch));
+ sc.Forward();
+ }
+ if (keywords.InList(word.c_str())) {
+ sc.ChangeState(SCE_SPICE_KEYWORD);
+ if (word != "all") {
+ apostropheStartsAttribute = false;
+ }
+ }
+ else if (keywords2.InList(word.c_str())) {
+ sc.ChangeState(SCE_SPICE_KEYWORD2);
+ if (word != "all") {
+ apostropheStartsAttribute = false;
+ }
+ }
+ else if (keywords3.InList(word.c_str())) {
+ sc.ChangeState(SCE_SPICE_KEYWORD3);
+ if (word != "all") {
+ apostropheStartsAttribute = false;
+ }
+ }
+ sc.SetState(SCE_SPICE_DEFAULT);
+}
+
+//
+// ColouriseDocument
+//
+static void ColouriseDocument(
+ unsigned int startPos,
+ int length,
+ int initStyle,
+ WordList *keywordlists[],
+ Accessor &styler) {
+ WordList &keywords = *keywordlists[0];
+ WordList &keywords2 = *keywordlists[1];
+ WordList &keywords3 = *keywordlists[2];
+ StyleContext sc(startPos, length, initStyle, styler);
+ int lineCurrent = styler.GetLine(startPos);
+ bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
+ while (sc.More()) {
+ if (sc.atLineEnd) {
+ // Go to the next line
+ sc.Forward();
+ lineCurrent++;
+ // Remember the line state for future incremental lexing
+ styler.SetLineState(lineCurrent, apostropheStartsAttribute);
+ // Don't continue any styles on the next line
+ sc.SetState(SCE_SPICE_DEFAULT);
+ }
+ // Comments
+ if ((sc.Match('*') && sc.atLineStart) || sc.Match('*','~')) {
+ ColouriseComment(sc, apostropheStartsAttribute);
+ // Whitespace
+ } else if (IsASpace(sc.ch)) {
+ ColouriseWhiteSpace(sc, apostropheStartsAttribute);
+ // Delimiters
+ } else if (IsDelimiterCharacter(sc.ch)) {
+ ColouriseDelimiter(sc, apostropheStartsAttribute);
+ // Numbers
+ } else if (IsADigit(sc.ch) || sc.ch == '#') {
+ ColouriseNumber(sc, apostropheStartsAttribute);
+ // Keywords or identifiers
+ } else {
+ ColouriseWord(sc, keywords, keywords2, keywords3, apostropheStartsAttribute);
+ }
+ }
+ sc.Complete();
+}
+
+static inline bool IsDelimiterCharacter(int ch) {
+ switch (ch) {
+ case '&':
+ case '\'':
+ case '(':
+ case ')':
+ case '*':
+ case '+':
+ case ',':
+ case '-':
+ case '.':
+ case '/':
+ case ':':
+ case ';':
+ case '<':
+ case '=':
+ case '>':
+ case '|':
+ return true;
+ default:
+ return false;
+ }
+}
+
+static inline bool IsNumberCharacter(int ch) {
+ return IsNumberStartCharacter(ch) ||
+ ch == '_' ||
+ ch == '.' ||
+ ch == '#' ||
+ (ch >= 'a' && ch <= 'f') ||
+ (ch >= 'A' && ch <= 'F');
+}
+
+static inline bool IsNumberStartCharacter(int ch) {
+ return IsADigit(ch);
+}
+
+static inline bool IsSeparatorOrDelimiterCharacter(int ch) {
+ return IsASpace(ch) || IsDelimiterCharacter(ch);
+}
+
+static inline bool IsWordCharacter(int ch) {
+ return IsWordStartCharacter(ch) || IsADigit(ch);
+}
+
+static inline bool IsWordStartCharacter(int ch) {
+ return (isascii(ch) && isalpha(ch)) || ch == '_';
+}
--- /dev/null
+// Scintilla source code edit control
+/** @file LexTCL.cxx
+ ** Lexer for TCL language.
+ **/
+// Copyright 1998-2001 by Andre Arpin <arpin@kingston.net>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "Platform.h"
+
+#include "PropSet.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+// Extended to accept accented characters
+static inline bool IsAWordChar(int ch) {
+ return ch >= 0x80 ||
+ (isalnum(ch) || ch == '_' || ch ==':' || ch=='.'); // : name space separator
+}
+
+static inline bool IsAWordStart(int ch) {
+ return ch >= 0x80 || (ch ==':' || isalpha(ch) || ch == '_');
+}
+
+static inline bool IsANumberChar(int ch) {
+ // Not exactly following number definition (several dots are seen as OK, etc.)
+ // but probably enough in most cases.
+ return (ch < 0x80) &&
+ (IsADigit(ch, 0x10) || toupper(ch) == 'E' ||
+ ch == '.' || ch == '-' || ch == '+');
+}
+
+static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *keywordlists[], Accessor &styler) {
+#define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT)
+ bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+ bool commentLevel = false;
+ bool subBrace = false; // substitution begin with a brace ${.....}
+ enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf,
+ LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32 } lineState = LS_DEFAULT;
+ bool prevSlash = false;
+ int currentLevel = 0;
+ bool expected = 0;
+ bool subParen = 0;
+
+ int currentLine = styler.GetLine(startPos);
+ if (currentLine > 0)
+ currentLine--;
+ length += startPos - styler.LineStart(currentLine);
+ // make sure lines overlap
+ startPos = styler.LineStart(currentLine);
+
+ WordList &keywords = *keywordlists[0];
+ WordList &keywords2 = *keywordlists[1];
+ WordList &keywords3 = *keywordlists[2];
+ WordList &keywords4 = *keywordlists[3];
+ WordList &keywords5 = *keywordlists[4];
+ WordList &keywords6 = *keywordlists[5];
+ WordList &keywords7 = *keywordlists[6];
+ WordList &keywords8 = *keywordlists[7];
+ WordList &keywords9 = *keywordlists[8];
+
+ if (currentLine > 0) {
+ int ls = styler.GetLineState(currentLine - 1);
+ lineState = tLineState(ls & LS_MASK_STATE);
+ expected = LS_COMMAND_EXPECTED == tLineState(ls & LS_COMMAND_EXPECTED);
+ subBrace = LS_BRACE_ONLY == tLineState(ls & LS_BRACE_ONLY);
+ currentLevel = styler.LevelAt(currentLine - 1) >> 17;
+ commentLevel = (styler.LevelAt(currentLine - 1) >> 16) & 1;
+ } else
+ styler.SetLevel(0, SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG);
+ bool visibleChars = false;
+
+ int previousLevel = currentLevel;
+ StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler);
+ for (; ; sc.Forward()) {
+next:
+ if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac
+ continue;
+ bool atEnd = !sc.More(); // make sure we coloured the last word
+ if (lineState != LS_DEFAULT) {
+ sc.SetState(SCE_TCL_DEFAULT);
+ if (lineState == LS_OPEN_COMMENT)
+ sc.SetState(SCE_TCL_COMMENTLINE);
+ else if (lineState == LS_OPEN_DOUBLE_QUOTE)
+ sc.SetState(SCE_TCL_IN_QUOTE);
+ else if (lineState == LS_COMMENT_BOX && (sc.ch == '#' || (sc.ch == ' ' && sc.chNext=='#')))
+ sc.SetState(SCE_TCL_COMMENT_BOX);
+ lineState = LS_DEFAULT;
+ }
+ if (subBrace) { // ${ overrides every thing even \ except }
+ if (sc.ch == '}') {
+ subBrace = false;
+ sc.SetState(SCE_TCL_OPERATOR);
+ sc.ForwardSetState(SCE_TCL_DEFAULT);
+ goto next;
+ }
+ else
+ sc.SetState(SCE_TCL_SUB_BRACE);
+ if (!sc.atLineEnd)
+ continue;
+ } else if (sc.state == SCE_TCL_DEFAULT || sc.state ==SCE_TCL_OPERATOR) {
+ expected &= isspacechar(static_cast<unsigned char>(sc.ch)) || IsAWordStart(sc.ch) || sc.ch =='#';
+ } else if (sc.state == SCE_TCL_SUBSTITUTION) {
+ switch(sc.ch) {
+ case '(':
+ subParen=true;
+ sc.SetState(SCE_TCL_OPERATOR);
+ sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
+ continue;
+ case ')':
+ sc.SetState(SCE_TCL_OPERATOR);
+ subParen=false;
+ continue;
+ case '$':
+ continue;
+ case ',':
+ sc.SetState(SCE_TCL_OPERATOR);
+ if (subParen)
+ sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
+ continue;
+ default :
+ // maybe spaces should be allowed ???
+ if (!IsAWordChar(sc.ch)) { // probably the code is wrong
+ sc.SetState(SCE_TCL_DEFAULT);
+ subParen = 0;
+ }
+ break;
+ }
+ } else if (isComment(sc.state)) {
+ } else if (!IsAWordChar(sc.ch)) {
+ if ((sc.state == SCE_TCL_IDENTIFIER && expected) || sc.state == SCE_TCL_MODIFIER) {
+ char w[100];
+ char *s=w;
+ sc.GetCurrent(w, sizeof(w));
+ if (w[strlen(w)-1]=='\r')
+ w[strlen(w)-1]=0;
+ while(*s == ':') // ignore leading : like in ::set a 10
+ ++s;
+ bool quote = sc.state == SCE_TCL_IN_QUOTE;
+ if (commentLevel || expected) {
+ if (keywords.InList(s)) {
+ sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD);
+ } else if (keywords2.InList(s)) {
+ sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD2);
+ } else if (keywords3.InList(s)) {
+ sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD3);
+ } else if (keywords4.InList(s)) {
+ sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD4);
+ } else if (sc.GetRelative(-static_cast<int>(strlen(s))-1) == '{' &&
+ keywords5.InList(s) && sc.ch == '}') { // {keyword} exactly no spaces
+ sc.ChangeState(SCE_TCL_EXPAND);
+ }
+ if (keywords6.InList(s)) {
+ sc.ChangeState(SCE_TCL_WORD5);
+ } else if (keywords7.InList(s)) {
+ sc.ChangeState(SCE_TCL_WORD6);
+ } else if (keywords8.InList(s)) {
+ sc.ChangeState(SCE_TCL_WORD7);
+ } else if (keywords9.InList(s)) {
+ sc.ChangeState(SCE_TCL_WORD8);
+ }
+ }
+ expected = false;
+ sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT);
+ } else if (sc.state == SCE_TCL_MODIFIER || sc.state == SCE_TCL_IDENTIFIER) {
+ sc.SetState(SCE_TCL_DEFAULT);
+ }
+ }
+ if (atEnd)
+ break;
+ if (sc.atLineEnd) {
+ lineState = LS_DEFAULT;
+ currentLine = styler.GetLine(sc.currentPos);
+ if (foldComment && sc.state!=SCE_TCL_COMMENT && isComment(sc.state)) {
+ if (currentLevel == 0) {
+ ++currentLevel;
+ commentLevel = true;
+ }
+ } else {
+ if (visibleChars && commentLevel) {
+ --currentLevel;
+ --previousLevel;
+ commentLevel = false;
+ }
+ }
+ int flag = 0;
+ if (!visibleChars)
+ flag = SC_FOLDLEVELWHITEFLAG;
+ if (currentLevel > previousLevel)
+ flag = SC_FOLDLEVELHEADERFLAG;
+ styler.SetLevel(currentLine, flag + previousLevel + SC_FOLDLEVELBASE + (currentLevel << 17) + (commentLevel << 16));
+
+ // Update the line state, so it can be seen by next line
+ if (sc.state == SCE_TCL_IN_QUOTE)
+ lineState = LS_OPEN_DOUBLE_QUOTE;
+ else {
+ if (prevSlash) {
+ if (isComment(sc.state))
+ lineState = LS_OPEN_COMMENT;
+ } else if (sc.state == SCE_TCL_COMMENT_BOX)
+ lineState = LS_COMMENT_BOX;
+ }
+ styler.SetLineState(currentLine,
+ (subBrace ? LS_BRACE_ONLY : 0) |
+ (expected ? LS_COMMAND_EXPECTED : 0) | lineState);
+ if (lineState == LS_COMMENT_BOX)
+ sc.ForwardSetState(SCE_TCL_COMMENT_BOX);
+ else if (lineState == LS_OPEN_DOUBLE_QUOTE)
+ sc.ForwardSetState(SCE_TCL_IN_QUOTE);
+ else
+ sc.ForwardSetState(SCE_TCL_DEFAULT);
+ prevSlash = false;
+ previousLevel = currentLevel;
+ goto next;
+ }
+
+ if (prevSlash) {
+ prevSlash = false;
+ if (sc.ch == '#' && IsANumberChar(sc.chNext))
+ sc.ForwardSetState(SCE_TCL_NUMBER);
+ continue;
+ }
+ prevSlash = sc.ch == '\\';
+ if (isComment(sc.state))
+ continue;
+ if (sc.atLineStart) {
+ visibleChars = false;
+ if (sc.state!=SCE_TCL_IN_QUOTE && !isComment(sc.state))
+ {
+ sc.SetState(SCE_TCL_DEFAULT);
+ expected = IsAWordStart(sc.ch)|| isspacechar(static_cast<unsigned char>(sc.ch));
+ }
+ }
+
+ switch (sc.state) {
+ case SCE_TCL_NUMBER:
+ if (!IsANumberChar(sc.ch))
+ sc.SetState(SCE_TCL_DEFAULT);
+ break;
+ case SCE_TCL_IN_QUOTE:
+ if (sc.ch == '"') {
+ sc.ForwardSetState(SCE_TCL_DEFAULT);
+ visibleChars = true; // necessary if a " is the first and only character on a line
+ goto next;
+ } else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$') {
+ sc.SetState(SCE_TCL_OPERATOR);
+ expected = sc.ch == '[';
+ sc.ForwardSetState(SCE_TCL_IN_QUOTE);
+ goto next;
+ }
+ continue;
+ case SCE_TCL_OPERATOR:
+ sc.SetState(SCE_TCL_DEFAULT);
+ break;
+ }
+
+ if (sc.ch == '#') {
+ if (visibleChars) {
+ if (sc.state != SCE_TCL_IN_QUOTE && expected)
+ sc.SetState(SCE_TCL_COMMENT);
+ } else {
+ sc.SetState(SCE_TCL_COMMENTLINE);
+ if (sc.chNext == '~')
+ sc.SetState(SCE_TCL_BLOCK_COMMENT);
+ if (sc.atLineStart && (sc.chNext == '#' || sc.chNext == '-'))
+ sc.SetState(SCE_TCL_COMMENT_BOX);
+ }
+ }
+
+ if (!isspacechar(static_cast<unsigned char>(sc.ch))) {
+ visibleChars = true;
+ }
+
+ if (sc.ch == '\\') {
+ prevSlash = true;
+ continue;
+ }
+
+ // Determine if a new state should be entered.
+ if (sc.state == SCE_TCL_DEFAULT) {
+ if (IsAWordStart(sc.ch)) {
+ sc.SetState(SCE_TCL_IDENTIFIER);
+ } else if (IsADigit(sc.ch) && !IsAWordChar(sc.chPrev)) {
+ sc.SetState(SCE_TCL_NUMBER);
+ } else {
+ switch (sc.ch) {
+ case '\"':
+ sc.SetState(SCE_TCL_IN_QUOTE);
+ break;
+ case '{':
+ sc.SetState(SCE_TCL_OPERATOR);
+ expected = true;
+ ++currentLevel;
+ break;
+ case '}':
+ sc.SetState(SCE_TCL_OPERATOR);
+ --currentLevel;
+ break;
+ case '[':
+ expected = true;
+ case ']':
+ case '(':
+ case ')':
+ sc.SetState(SCE_TCL_OPERATOR);
+ break;
+ case ';':
+ expected = true;
+ break;
+ case '$':
+ subParen = 0;
+ if (sc.chNext != '{') {
+ sc.SetState(SCE_TCL_SUBSTITUTION);
+ }
+ else {
+ sc.SetState(SCE_TCL_OPERATOR); // $
+ sc.Forward(); // {
+ sc.ForwardSetState(SCE_TCL_SUB_BRACE);
+ subBrace = true;
+ }
+ break;
+ case '#':
+ if ((isspacechar(static_cast<unsigned char>(sc.chPrev))||
+ isoperator(static_cast<char>(sc.chPrev))) && IsADigit(sc.chNext,0x10))
+ sc.SetState(SCE_TCL_NUMBER);
+ break;
+ case '-':
+ sc.SetState(IsADigit(sc.chNext)? SCE_TCL_NUMBER: SCE_TCL_MODIFIER);
+ break;
+ default:
+ if (isoperator(static_cast<char>(sc.ch))) {
+ sc.SetState(SCE_TCL_OPERATOR);
+ }
+ }
+ }
+ }
+ }
+ sc.Complete();
+}
+
+static const char * const tclWordListDesc[] = {
+ "TCL Keywords",
+ "TK Keywords",
+ "iTCL Keywords",
+ "tkCommands",
+ "expand"
+ "user1",
+ "user2",
+ "user3",
+ "user4",
+ 0
+ };
+
+// this code supports folding in the colourizer
+LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc);
int markType;
ColourPair fore;
ColourPair back;
+ int alpha;
XPM *pxpm;
LineMarker() {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
+ alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
}
LineMarker(const LineMarker &) {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
+ alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
}
~LineMarker() {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
+ alpha = SC_ALPHA_NOALPHA;
delete pxpm;
pxpm = NULL;
return *this;
**/
/*
- * regex - Regular expression pattern matching and replacement
+ * regex - Regular expression pattern matching and replacement
*
* By: Ozan S. Yigit (oz)
* Dept. of Computer Science
* Removed all use of register.
* Converted to modern function prototypes.
* Put all global/static variables into an object so this code can be
- * used from multiple threads etc.
+ * used from multiple threads, etc.
*
* These routines are the PUBLIC DOMAIN equivalents of regex
* routines as found in 4.nBSD UN*X, with minor extensions.
* Modification history removed.
*
* Interfaces:
- * RESearch::Compile: compile a regular expression into a NFA.
+ * RESearch::Compile: compile a regular expression into a NFA.
*
- * char *RESearch::Compile(s)
- * char *s;
+ * const char *RESearch::Compile(const char *pat, int length,
+ * bool caseSensitive, bool posix)
*
- * RESearch::Execute: execute the NFA to match a pattern.
+ * Returns a short error string if they fail.
*
- * int RESearch::Execute(s)
- * char *s;
+ * RESearch::Execute: execute the NFA to match a pattern.
*
- * RESearch::ModifyWord change RESearch::Execute's understanding of what a "word"
- * looks like (for \< and \>) by adding into the
- * hidden word-syntax table.
+ * int RESearch::Execute(characterIndexer &ci, int lp, int endp)
*
- * void RESearch::ModifyWord(s)
- * char *s;
+ * RESearch::Substitute: substitute the matched portions in a new string.
*
- * RESearch::Substitute: substitute the matched portions in a new string.
+ * int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst)
*
- * int RESearch::Substitute(src, dst)
- * char *src;
- * char *dst;
+ * re_fail: failure routine for RESearch::Execute. (no longer used)
*
- * re_fail: failure routine for RESearch::Execute.
- *
- * void re_fail(msg, op)
- * char *msg;
- * char op;
+ * void re_fail(char *msg, char op)
*
* Regular Expressions:
*
* [1] char matches itself, unless it is a special
* character (metachar): . \ [ ] * + ^ $
+ * and ( ) if posix option.
*
* [2] . matches any character.
*
- * [3] \ matches the character following it, except
- * when followed by a left or right round bracket,
- * a digit 1 to 9 or a left or right angle bracket.
- * (see [7], [8] and [9])
- * It is used as an escape character for all
- * other meta-characters, and itself. When used
- * in a set ([4]), it is treated as an ordinary
- * character.
+ * [3] \ matches the character following it, except:
+ * - \a, \b, \f, \n, \t, \v match the
+ * corresponding C escape char;
+ * - if not in posix mode, when followed by a
+ * left or right round bracket (see [7]);
+ * - when followed by a digit 1 to 9 (see [8]);
+ * - when followed by a left or right angle bracket
+ * (see [9]).
+ * It is used as an escape character for all
+ * other meta-characters, and itself. When used
+ * in a set ([4]), it is treated as an ordinary
+ * character (except for escape chars).
*
* [4] [set] matches one of the characters in the set.
* If the first character in the set is "^",
* it matches a character NOT in the set, i.e.
- * complements the set. A shorthand S-E is
- * used to specify a set of characters S upto
- * E, inclusive. The special characters "]" and
- * "-" have no special meaning if they appear
- * as the first chars in the set.
+ * complements the set. A shorthand S-E (start-end)
+ * is used to specify a set of characters S upto
+ * E, inclusive. The special characters "]" and
+ * "-" have no special meaning if they appear
+ * as the first chars in the set. To include both,
+ * put - first: [-]A-Z]:
+ * [-]|] matches these 2 chars,
+ * []-|] matches from ] to | chars.
* examples: match:
*
* [a-z] any lowercase alpha
*
- * [^]-] any char except ] and -
+ * [^-]] any char except - and ]
*
* [^A-Z] any char except uppercase
* alpha
* [6] + same as [5], except it matches one or more.
*
* [7] a regular expression in the form [1] to [10], enclosed
- * as \(form\) matches what form matches. The enclosure
- * creates a set of tags, used for [8] and for
- * pattern substution. The tagged forms are numbered
- * starting from 1.
+ * as \(form\) (or (form) with posix flag) matches what
+ * form matches. The enclosure creates a set of tags,
+ * used for [8] and for pattern substitution.
+ * The tagged forms are numbered starting from 1.
*
* [8] a \ followed by a digit 1 to 9 matches whatever a
* previously tagged regular expression ([7]) matched.
*
- * [9] \< a regular expression starting with a \< construct
- * \> and/or ending with a \> construct, restricts the
- * pattern matching to the beginning of a word, and/or
- * the end of a word. A word is defined to be a character
- * string beginning and/or ending with the characters
- * A-Z a-z 0-9 and _. It must also be preceded and/or
- * followed by any character outside those mentioned.
+ * [9] \< a regular expression starting with a \< construct
+ * \> and/or ending with a \> construct, restricts the
+ * pattern matching to the beginning of a word, and/or
+ * the end of a word. A word is defined to be a character
+ * string beginning and/or ending with the characters
+ * A-Z a-z 0-9 and _. It must also be preceded and/or
+ * followed by any character outside those mentioned.
*
* [10] a composite regular expression xy where x and y
* are in the form [1] to [10] matches the longest
* match of x followed by a match for y.
*
- * [11] ^ a regular expression starting with a ^ character
- * $ and/or ending with a $ character, restricts the
+ * [11] ^ a regular expression starting with a ^ character
+ * $ and/or ending with a $ character, restricts the
* pattern matching to the beginning of the line,
* or the end of line. [anchors] Elsewhere in the
- * pattern, ^ and $ are treated as ordinary characters.
+ * pattern, ^ and $ are treated as ordinary characters.
*
*
* Acknowledgements:
*
- * HCR's Hugh Redelmeier has been most helpful in various
- * stages of development. He convinced me to include BOW
- * and EOW constructs, originally invented by Rob Pike at
- * the University of Toronto.
+ * HCR's Hugh Redelmeier has been most helpful in various
+ * stages of development. He convinced me to include BOW
+ * and EOW constructs, originally invented by Rob Pike at
+ * the University of Toronto.
*
* References:
- * Software tools Kernighan & Plauger
+ * Software tools Kernighan & Plauger
* Software tools in Pascal Kernighan & Plauger
* Grep [rsx-11 C dist] David Conroy
- * ed - text editor Un*x Programmer's Manual
- * Advanced editing on Un*x B. W. Kernighan
- * RegExp routines Henry Spencer
+ * ed - text editor Un*x Programmer's Manual
+ * Advanced editing on Un*x B. W. Kernighan
+ * RegExp routines Henry Spencer
*
* Notes:
*
* This implementation uses a bit-set representation for character
* classes for speed and compactness. Each character is represented
- * by one bit in a 128-bit block. Thus, CCL always takes a
- * constant 16 bytes in the internal nfa, and RESearch::Execute does a single
+ * by one bit in a 256-bit block. Thus, CCL always takes a
+ * constant 32 bytes in the internal nfa, and RESearch::Execute does a single
* bit comparison to locate the character in the set.
*
* Examples:
*
- * pattern: foo*.*
- * compile: CHR f CHR o CLO CHR o END CLO ANY END END
- * matches: fo foo fooo foobar fobar foxx ...
+ * pattern: foo*.*
+ * compile: CHR f CHR o CLO CHR o END CLO ANY END END
+ * matches: fo foo fooo foobar fobar foxx ...
*
- * pattern: fo[ob]a[rz]
- * compile: CHR f CHR o CCL bitset CHR a CCL bitset END
- * matches: fobar fooar fobaz fooaz
+ * pattern: fo[ob]a[rz]
+ * compile: CHR f CHR o CCL bitset CHR a CCL bitset END
+ * matches: fobar fooar fobaz fooaz
*
- * pattern: foo\\+
- * compile: CHR f CHR o CHR o CHR \ CLO CHR \ END END
- * matches: foo\ foo\\ foo\\\ ...
+ * pattern: foo\\+
+ * compile: CHR f CHR o CHR o CHR \ CLO CHR \ END END
+ * matches: foo\ foo\\ foo\\\ ...
*
- * pattern: \(foo\)[1-3]\1 (same as foo[1-3]foo)
- * compile: BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END
- * matches: foo1foo foo2foo foo3foo
+ * pattern: \(foo\)[1-3]\1 (same as foo[1-3]foo)
+ * compile: BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END
+ * matches: foo1foo foo2foo foo3foo
*
- * pattern: \(fo.*\)-\1
- * compile: BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END
- * matches: foo-foo fo-fo fob-fob foobar-foobar ...
+ * pattern: \(fo.*\)-\1
+ * compile: BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END
+ * matches: foo-foo fo-fo fob-fob foobar-foobar ...
*/
+#include "CharClassify.h"
#include "RESearch.h"
+// Shut up annoying Visual C++ warnings:
+#ifdef _MSC_VER
+#pragma warning(disable: 4514)
+#endif
+
#define OKP 1
#define NOP 0
#define EOL 5
#define BOT 6
#define EOT 7
-#define BOW 8
-#define EOW 9
+#define BOW 8
+#define EOW 9
#define REF 10
#define CLO 11
* The following defines are not meant to be changeable.
* They are for readability only.
*/
-#define BLKIND 0370
-#define BITIND 07
-
-#define ASCIIB 0177
+#define BLKIND 0370
+#define BITIND 07
const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
#define badpat(x) (*nfa = END, x)
-RESearch::RESearch() {
+/*
+ * Character classification table for word boundary operators BOW
+ * and EOW is passed in by the creator of this object (Scintilla
+ * Document). The Document default state is that word chars are:
+ * 0-9,a-z, A-Z and _
+ */
+
+RESearch::RESearch(CharClassify *charClassTable) {
+ charClass = charClassTable;
Init();
}
}
void RESearch::Init() {
- sta = NOP; /* status of lastpat */
+ sta = NOP; /* status of lastpat */
bol = 0;
for (int i=0; i<MAXTAG; i++)
pat[i] = 0;
const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, bool posix) {
char *mp=nfa; /* nfa pointer */
- char *lp; /* saved pointer.. */
- char *sp=nfa; /* another one.. */
- char *mpMax = mp + MAXNFA - BITBLK - 10;
+ char *lp; /* saved pointer */
+ char *sp=nfa; /* another one */
+ char *mpMax = mp + MAXNFA - BITBLK - 10;
int tagi = 0; /* tag stack index */
int tagc = 1; /* actual tag count */
int n;
- char mask; /* xor mask -CCL/NCL */
+ char mask; /* xor mask -CCL/NCL */
int c1, c2;
if (!pat || !length)
return badpat("No previous regular expression");
sta = NOP;
- const char *p=pat; /* pattern pointer */
+ const char *p=pat; /* pattern pointer */
for (int i=0; i<length; i++, p++) {
if (mp > mpMax)
return badpat("Pattern too long");
lp = mp;
switch(*p) {
- case '.': /* match any char.. */
+ case '.': /* match any char */
*mp++ = ANY;
break;
- case '^': /* match beginning.. */
+ case '^': /* match beginning */
if (p == pat)
*mp++ = BOL;
else {
}
break;
- case '$': /* match endofline.. */
+ case '$': /* match endofline */
if (!*(p+1))
*mp++ = EOL;
else {
}
break;
- case '[': /* match char class..*/
+ case '[': /* match char class */
*mp++ = CCL;
i++;
} else
mask = 0;
- if (*p == '-') { /* real dash */
+ if (*p == '-') { /* real dash */
i++;
ChSet(*p++);
}
break;
- case '*': /* match 0 or more.. */
- case '+': /* match 1 or more.. */
+ case '*': /* match 0 or more... */
+ case '+': /* match 1 or more... */
if (p == pat)
return badpat("Empty closure");
lp = sp; /* previous opcode */
- if (*lp == CLO) /* equivalence.. */
+ if (*lp == CLO) /* equivalence... */
break;
switch(*lp) {
mp = sp;
break;
- case '\\': /* tags, backrefs .. */
+ case '\\': /* tags, backrefs... */
i++;
switch(*++p) {
}
break;
- default : /* an ordinary char */
+ default : /* an ordinary char */
if (posix && *p == '(') {
if (tagc < MAXTAG) {
tagstk[++tagi] = tagc;
/*
* RESearch::Execute:
- * execute nfa to find a match.
- *
- * special cases: (nfa[0])
- * BOL
- * Match only once, starting from the
- * beginning.
- * CHR
- * First locate the character without
- * calling PMatch, and if found, call
- * PMatch for the remaining string.
- * END
- * RESearch::Compile failed, poor luser did not
- * check for it. Fail fast.
- *
- * If a match is found, bopat[0] and eopat[0] are set
- * to the beginning and the end of the matched fragment,
- * respectively.
+ * execute nfa to find a match.
+ *
+ * special cases: (nfa[0])
+ * BOL
+ * Match only once, starting from the
+ * beginning.
+ * CHR
+ * First locate the character without
+ * calling PMatch, and if found, call
+ * PMatch for the remaining string.
+ * END
+ * RESearch::Compile failed, poor luser did not
+ * check for it. Fail fast.
+ *
+ * If a match is found, bopat[0] and eopat[0] are set
+ * to the beginning and the end of the matched fragment,
+ * respectively.
*
*/
c = *(ap+1);
while ((lp < endp) && (ci.CharAt(lp) != c))
lp++;
- if (lp >= endp) /* if EOS, fail, else fall thru. */
+ if (lp >= endp) /* if EOS, fail, else fall thru. */
return 0;
default: /* regular matching all the way. */
while (lp < endp) {
/*
* PMatch: internal routine for the hard part
*
- * This code is partly snarfed from an early grep written by
- * David Conroy. The backref and tag stuff, and various other
- * innovations are by oz.
- *
- * special case optimizations: (nfa[n], nfa[n+1])
- * CLO ANY
- * We KNOW .* will match everything upto the
- * end of line. Thus, directly go to the end of
- * line, without recursive PMatch calls. As in
- * the other closure cases, the remaining pattern
- * must be matched by moving backwards on the
- * string recursively, to find a match for xy
- * (x is ".*" and y is the remaining pattern)
- * where the match satisfies the LONGEST match for
- * x followed by a match for y.
- * CLO CHR
- * We can again scan the string forward for the
- * single char and at the point of failure, we
- * execute the remaining nfa recursively, same as
- * above.
- *
- * At the end of a successful match, bopat[n] and eopat[n]
- * are set to the beginning and end of subpatterns matched
- * by tagged expressions (n = 1 to 9).
- *
+ * This code is partly snarfed from an early grep written by
+ * David Conroy. The backref and tag stuff, and various other
+ * innovations are by oz.
+ *
+ * special case optimizations: (nfa[n], nfa[n+1])
+ * CLO ANY
+ * We KNOW .* will match everything upto the
+ * end of line. Thus, directly go to the end of
+ * line, without recursive PMatch calls. As in
+ * the other closure cases, the remaining pattern
+ * must be matched by moving backwards on the
+ * string recursively, to find a match for xy
+ * (x is ".*" and y is the remaining pattern)
+ * where the match satisfies the LONGEST match for
+ * x followed by a match for y.
+ * CLO CHR
+ * We can again scan the string forward for the
+ * single char and at the point of failure, we
+ * execute the remaining nfa recursively, same as
+ * above.
+ *
+ * At the end of a successful match, bopat[n] and eopat[n]
+ * are set to the beginning and end of subpatterns matched
+ * by tagged expressions (n = 1 to 9).
*/
extern void re_fail(char *,char);
-/*
- * character classification table for word boundary operators BOW
- * and EOW. the reason for not using ctype macros is that we can
- * let the user add into our own table. see RESearch::ModifyWord. This table
- * is not in the bitset form, since we may wish to extend it in the
- * future for other character classifications.
- *
- * TRUE for 0-9 A-Z a-z _
- */
-static char chrtyp[MAXCHR] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 0, 0, 0, 0, 0
- };
-
-#define inascii(x) (0177&(x))
-#define iswordc(x) chrtyp[inascii(x)]
-#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])
+#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])
/*
* skip values for CLO XXX to skip past the closure
*/
-#define ANYSKIP 2 /* [CLO] ANY END ... */
-#define CHRSKIP 3 /* [CLO] CHR chr END ... */
-#define CCLSKIP 34 /* [CLO] CCL 32bytes END ... */
+#define ANYSKIP 2 /* [CLO] ANY END */
+#define CHRSKIP 3 /* [CLO] CHR chr END */
+#define CCLSKIP 34 /* [CLO] CCL 32 bytes END */
int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
int op, c, n;
- int e; /* extra pointer for CLO */
- int bp; /* beginning of subpat.. */
- int ep; /* ending of subpat.. */
- int are; /* to save the line ptr. */
+ int e; /* extra pointer for CLO */
+ int bp; /* beginning of subpat... */
+ int ep; /* ending of subpat... */
+ int are; /* to save the line ptr. */
while ((op = *ap++) != END)
switch(op) {
return lp;
}
-/*
- * RESearch::ModifyWord:
- * add new characters into the word table to change RESearch::Execute's
- * understanding of what a word should look like. Note that we
- * only accept additions into the word definition.
- *
- * If the string parameter is 0 or null string, the table is
- * reset back to the default containing A-Z a-z 0-9 _. [We use
- * the compact bitset representation for the default table]
- */
-
-static char deftab[16] = {
- 0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',
- '\376', '\377', '\377', 007
-};
-
-void RESearch::ModifyWord(char *s) {
- int i;
-
- if (!s || !*s) {
- for (i = 0; i < MAXCHR; i++)
- if (!isinset(deftab,i))
- iswordc(i) = 0;
- }
- else
- while(*s)
- iswordc(*s++) = 1;
-}
-
/*
* RESearch::Substitute:
- * substitute the matched portions of the src in dst.
+ * substitute the matched portions of the src in dst.
*
- * & substitute the entire matched pattern.
+ * & substitute the entire matched pattern.
*
- * \digit substitute a subpattern, with the given tag number.
- * Tags are numbered from 1 to 9. If the particular
- * tagged subpattern does not exist, null is substituted.
+ * \digit substitute a subpattern, with the given tag number.
+ * Tags are numbered from 1 to 9. If the particular
+ * tagged subpattern does not exist, null is substituted.
*/
int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
char c;
#define BITBLK MAXCHR/CHRBIT
class CharacterIndexer {
-public:
+public:
virtual char CharAt(int index)=0;
virtual ~CharacterIndexer() {
}
class RESearch {
public:
- RESearch();
+ RESearch(CharClassify *charClassTable);
~RESearch();
- void Init();
- void Clear();
bool GrabMatches(CharacterIndexer &ci);
- void ChSet(char c);
- void ChSetWithCase(char c, bool caseSensitive);
const char *Compile(const char *pat, int length, bool caseSensitive, bool posix);
int Execute(CharacterIndexer &ci, int lp, int endp);
- void ModifyWord(char *s);
int Substitute(CharacterIndexer &ci, char *src, char *dst);
enum {MAXTAG=10};
char *pat[MAXTAG];
private:
+ void Init();
+ void Clear();
+ void ChSet(char c);
+ void ChSetWithCase(char c, bool caseSensitive);
+
int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
int bol;
- int tagstk[MAXTAG]; /* subpat tag stack..*/
- char nfa[MAXNFA]; /* automaton.. */
+ int tagstk[MAXTAG]; /* subpat tag stack */
+ char nfa[MAXNFA]; /* automaton */
int sta;
- char bittab[BITBLK]; /* bit table for CCL */
- /* pre-set bits... */
+ char bittab[BITBLK]; /* bit table for CCL pre-set bits */
int failure;
+ CharClassify *charClass;
+ bool iswordc(unsigned char x) {
+ return charClass->IsWord(x);
+ }
};
#endif
#include "Style.h"
#include "ViewStyle.h"
#include "AutoComplete.h"
+#include "CharClassify.h"
#include "Document.h"
#include "Editor.h"
#include "ScintillaBase.h"
void ScintillaBase::CallTipShow(Point pt, const char *defn) {
AutoCompleteCancel();
pt.y += vs.lineHeight;
+ // If container knows about STYLE_CALLTIP then use it in place of the
+ // STYLE_DEFAULT for the face name, size and character set. Also use it
+ // for the foreground and background colour.
+ int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
+ if (ct.UseStyleCallTip()) {
+ ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
+ }
PRectangle rc = ct.CallTipStart(currentPos, pt,
defn,
- vs.styles[STYLE_DEFAULT].fontName,
- vs.styles[STYLE_DEFAULT].sizeZoomed,
+ vs.styles[ctStyle].fontName,
+ vs.styles[ctStyle].sizeZoomed,
CodePage(),
- vs.styles[STYLE_DEFAULT].characterSet,
+ vs.styles[ctStyle].characterSet,
wMain);
// If the call-tip window would be out of the client
// space, adjust so it displays above the text.
int styleStart = 0;
if (start > 0)
- styleStart = styler.StyleAt(start - 1);
+ styleStart = styler.StyleAt(start - 1) & pdoc->stylingBitsMask;
styler.SetCodePage(pdoc->dbcsCodePage);
if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available
case SCI_CALLTIPSETBACK:
ct.colourBG = ColourDesired(wParam);
+ vs.styles[STYLE_CALLTIP].fore = ct.colourBG;
InvalidateStyleRedraw();
break;
case SCI_CALLTIPSETFORE:
ct.colourUnSel = ColourDesired(wParam);
+ vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
InvalidateStyleRedraw();
break;
InvalidateStyleRedraw();
break;
+ case SCI_CALLTIPUSESTYLE:
+ ct.SetTabSize((int)wParam);
+ InvalidateStyleRedraw();
+ break;
+
case SCI_USEPOPUP:
displayPopupMenu = wParam != 0;
break;
#include "ViewStyle.h"
MarginStyle::MarginStyle() :
- symbol(false), width(16), mask(0xffffffff), sensitive(false) {
+ style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) {
}
// A list of the fontnames - avoids wasting space in each style
selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired;
selbackground2.desired = source.selbackground2.desired;
+ selAlpha = source.selAlpha;
foldmarginColourSet = source.foldmarginColourSet;
foldmarginColour.desired = source.foldmarginColour.desired;
caretcolour.desired = source.caretcolour.desired;
showCaretLineBackground = source.showCaretLineBackground;
caretLineBackground.desired = source.caretLineBackground.desired;
+ caretLineAlpha = source.caretLineAlpha;
edgecolour.desired = source.edgecolour.desired;
edgeState = source.edgeState;
caretWidth = source.caretWidth;
selbackset = true;
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
+ selAlpha = SC_ALPHA_NOALPHA;
foldmarginColourSet = false;
foldmarginColour.desired = ColourDesired(0xff, 0, 0);
caretcolour.desired = ColourDesired(0, 0, 0);
showCaretLineBackground = false;
caretLineBackground.desired = ColourDesired(0xff, 0xff, 0);
+ caretLineAlpha = SC_ALPHA_NOALPHA;
edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);
edgeState = EDGE_NONE;
caretWidth = 1;
leftMarginWidth = 1;
rightMarginWidth = 1;
- ms[0].symbol = false;
+ ms[0].style = SC_MARGIN_NUMBER;
ms[0].width = 0;
ms[0].mask = 0;
- ms[1].symbol = true;
+ ms[1].style = SC_MARGIN_SYMBOL;
ms[1].width = 16;
ms[1].mask = ~SC_MASK_FOLDERS;
- ms[2].symbol = true;
+ ms[2].style = SC_MARGIN_SYMBOL;
ms[2].width = 0;
ms[2].mask = 0;
fixedColumnWidth = leftMarginWidth;
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
- symbolMargin = symbolMargin || ms[margin].symbol;
+ symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
- symbolMargin = symbolMargin || ms[margin].symbol;
+ symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
}
}
styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
+
+ // Set call tip fore/back to match the values previously set for call tips
+ styles[STYLE_CALLTIP].back.desired = ColourDesired(0xff, 0xff, 0xff);
+ styles[STYLE_CALLTIP].fore.desired = ColourDesired(0x80, 0x80, 0x80);
}
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
*/
class MarginStyle {
public:
- bool symbol;
+ int style;
int width;
int mask;
bool sensitive;
bool selbackset;
ColourPair selbackground;
ColourPair selbackground2;
+ int selAlpha;
bool whitespaceForegroundSet;
ColourPair whitespaceForeground;
bool whitespaceBackgroundSet;
bool hotspotUnderline;
bool hotspotSingleLine;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
- enum { margins=3 };
+ enum { margins=5 };
int leftMarginWidth; ///< Spacing margin on left of text
int rightMarginWidth; ///< Spacing margin on left of text
bool symbolMargin;
ColourPair caretcolour;
bool showCaretLineBackground;
ColourPair caretLineBackground;
+ int caretLineAlpha;
ColourPair edgecolour;
int edgeState;
int caretWidth;
SendMsg(2466, line, set);
}
+// Set the alpha used for a marker that is drawn in the text area, not the margin.
+void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber, int alpha) {
+ SendMsg(2476, markerNumber, alpha);
+}
+
// Set a margin to be either numeric or symbolic.
void wxStyledTextCtrl::SetMarginType(int margin, int marginType) {
SendMsg(2240, margin, marginType);
SendMsg(2068, useSetting, wxColourAsLong(back));
}
+// Get the alpha of the selection.
+int wxStyledTextCtrl::GetSelAlpha() {
+ return SendMsg(2477, 0, 0);
+}
+
+// Set the alpha of the selection.
+void wxStyledTextCtrl::SetSelAlpha(int alpha) {
+ SendMsg(2478, alpha, 0);
+}
+
// Set the foreground colour of the caret.
void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore) {
SendMsg(2069, wxColourAsLong(fore), 0);
SendMsg(2207, wxColourAsLong(fore), 0);
}
+// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
+void wxStyledTextCtrl::CallTipUseStyle(int tabSize) {
+ SendMsg(2212, tabSize, 0);
+}
+
// Find the display line of a document line taking hidden lines into account.
int wxStyledTextCtrl::VisibleFromDocLine(int line) {
return SendMsg(2220, line, 0);
SendMsg(2469, 0, 0);
}
+// Set background alpha of the caret line.
+void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha) {
+ SendMsg(2470, alpha, 0);
+}
+
+// Get the background alpha of the caret line.
+int wxStyledTextCtrl::GetCaretLineBackAlpha() {
+ return SendMsg(2471, 0, 0);
+}
+
// Start notifying the container of all key presses and commands.
void wxStyledTextCtrl::StartRecord() {
SendMsg(3001, 0, 0);
#define wxSTC_MASK_FOLDERS 0xFE000000
#define wxSTC_MARGIN_SYMBOL 0
#define wxSTC_MARGIN_NUMBER 1
+#define wxSTC_MARGIN_BACK 2
+#define wxSTC_MARGIN_FORE 3
-// Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
-// Styles 38 and 39 are for future use.
+// Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
+// Style 39 is for future use.
#define wxSTC_STYLE_DEFAULT 32
#define wxSTC_STYLE_LINENUMBER 33
#define wxSTC_STYLE_BRACELIGHT 34
#define wxSTC_STYLE_BRACEBAD 35
#define wxSTC_STYLE_CONTROLCHAR 36
#define wxSTC_STYLE_INDENTGUIDE 37
+#define wxSTC_STYLE_CALLTIP 38
#define wxSTC_STYLE_LASTPREDEFINED 39
#define wxSTC_STYLE_MAX 127
#define wxSTC_INDIC_STRIKE 4
#define wxSTC_INDIC_HIDDEN 5
#define wxSTC_INDIC_BOX 6
+#define wxSTC_INDIC_ROUNDBOX 7
#define wxSTC_INDIC0_MASK 0x20
#define wxSTC_INDIC1_MASK 0x40
#define wxSTC_INDIC2_MASK 0x80
#define wxSTC_SEL_STREAM 0
#define wxSTC_SEL_RECTANGLE 1
#define wxSTC_SEL_LINES 2
+#define wxSTC_ALPHA_TRANSPARENT 0
+#define wxSTC_ALPHA_OPAQUE 255
+#define wxSTC_ALPHA_NOALPHA 256
// Maximum value of keywordSet parameter of SetKeyWords.
#define wxSTC_KEYWORDSET_MAX 8
#define wxSTC_LEX_FLAGSHIP 73
#define wxSTC_LEX_CSOUND 74
#define wxSTC_LEX_FREEBASIC 75
-
-// These are deprecated, STC_LEX_HTML should be used instead.
-#define wxSTC_LEX_ASP 29
-#define wxSTC_LEX_PHP 30
+#define wxSTC_LEX_INNOSETUP 76
+#define wxSTC_LEX_OPAL 77
+#define wxSTC_LEX_SPICE 78
// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
// value assigned in sequence from SCLEX_AUTOMATIC+1.
#define wxSTC_C_COMMENTDOCKEYWORDERROR 18
#define wxSTC_C_GLOBALCLASS 19
+// Lexical states for SCLEX_TCL
+#define wxSTC_TCL_DEFAULT 0
+#define wxSTC_TCL_COMMENT 1
+#define wxSTC_TCL_COMMENTLINE 2
+#define wxSTC_TCL_NUMBER 3
+#define wxSTC_TCL_WORD_IN_QUOTE 4
+#define wxSTC_TCL_IN_QUOTE 5
+#define wxSTC_TCL_OPERATOR 6
+#define wxSTC_TCL_IDENTIFIER 7
+#define wxSTC_TCL_SUBSTITUTION 8
+#define wxSTC_TCL_SUB_BRACE 9
+#define wxSTC_TCL_MODIFIER 10
+#define wxSTC_TCL_EXPAND 11
+#define wxSTC_TCL_WORD 12
+#define wxSTC_TCL_WORD2 13
+#define wxSTC_TCL_WORD3 14
+#define wxSTC_TCL_WORD4 15
+#define wxSTC_TCL_WORD5 16
+#define wxSTC_TCL_WORD6 17
+#define wxSTC_TCL_WORD7 18
+#define wxSTC_TCL_WORD8 19
+#define wxSTC_TCL_COMMENT_BOX 20
+#define wxSTC_TCL_BLOCK_COMMENT 21
+
// Lexical states for SCLEX_HTML, SCLEX_XML
#define wxSTC_H_DEFAULT 0
#define wxSTC_H_TAG 1
#define wxSTC_PROPS_SECTION 2
#define wxSTC_PROPS_ASSIGNMENT 3
#define wxSTC_PROPS_DEFVAL 4
+#define wxSTC_PROPS_KEY 5
// Lexical states for SCLEX_LATEX
#define wxSTC_L_DEFAULT 0
#define wxSTC_AU3_SPECIAL 12
#define wxSTC_AU3_EXPAND 13
#define wxSTC_AU3_COMOBJ 14
+#define wxSTC_AU3_UDF 15
// Lexical states for SCLEX_APDL
#define wxSTC_APDL_DEFAULT 0
#define wxSTC_CSOUND_GLOBAL_VAR 14
#define wxSTC_CSOUND_STRINGEOL 15
+// Lexical states for SCLEX_INNOSETUP
+#define wxSTC_INNO_DEFAULT 0
+#define wxSTC_INNO_COMMENT 1
+#define wxSTC_INNO_KEYWORD 2
+#define wxSTC_INNO_PARAMETER 3
+#define wxSTC_INNO_SECTION 4
+#define wxSTC_INNO_PREPROC 5
+#define wxSTC_INNO_PREPROC_INLINE 6
+#define wxSTC_INNO_COMMENT_PASCAL 7
+#define wxSTC_INNO_KEYWORD_PASCAL 8
+#define wxSTC_INNO_KEYWORD_USER 9
+#define wxSTC_INNO_STRING_DOUBLE 10
+#define wxSTC_INNO_STRING_SINGLE 11
+#define wxSTC_INNO_IDENTIFIER 12
+
+// Lexical states for SCLEX_OPAL
+#define wxSTC_OPAL_SPACE 0
+#define wxSTC_OPAL_COMMENT_BLOCK 1
+#define wxSTC_OPAL_COMMENT_LINE 2
+#define wxSTC_OPAL_INTEGER 3
+#define wxSTC_OPAL_KEYWORD 4
+#define wxSTC_OPAL_SORT 5
+#define wxSTC_OPAL_STRING 6
+#define wxSTC_OPAL_PAR 7
+#define wxSTC_OPAL_BOOL_CONST 8
+#define wxSTC_OPAL_DEFAULT 32
+
+// Lexical states for SCLEX_SPICE
+#define wxSTC_SPICE_DEFAULT 0
+#define wxSTC_SPICE_IDENTIFIER 1
+#define wxSTC_SPICE_KEYWORD 2
+#define wxSTC_SPICE_KEYWORD2 3
+#define wxSTC_SPICE_KEYWORD3 4
+#define wxSTC_SPICE_NUMBER 5
+#define wxSTC_SPICE_DELIMITER 6
+#define wxSTC_SPICE_VALUE 7
+#define wxSTC_SPICE_COMMENTLINE 8
+
//-----------------------------------------
// Commands that can be bound to keystrokes
// Add a set of markers to a line.
void MarkerAddSet(int line, int set);
+ // Set the alpha used for a marker that is drawn in the text area, not the margin.
+ void MarkerSetAlpha(int markerNumber, int alpha);
+
// Set a margin to be either numeric or symbolic.
void SetMarginType(int margin, int marginType);
// Set the background colour of the selection and whether to use this setting.
void SetSelBackground(bool useSetting, const wxColour& back);
+ // Get the alpha of the selection.
+ int GetSelAlpha();
+
+ // Set the alpha of the selection.
+ void SetSelAlpha(int alpha);
+
// Set the foreground colour of the caret.
void SetCaretForeground(const wxColour& fore);
// Set the foreground colour for the highlighted part of the call tip.
void CallTipSetForegroundHighlight(const wxColour& fore);
+ // Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
+ void CallTipUseStyle(int tabSize);
+
// Find the display line of a document line taking hidden lines into account.
int VisibleFromDocLine(int line);
// Duplicate the selection. If selection empty duplicate the line containing the caret.
void SelectionDuplicate();
+ // Set background alpha of the caret line.
+ void SetCaretLineBackAlpha(int alpha);
+
+ // Get the background alpha of the caret line.
+ int GetCaretLineBackAlpha();
+
// Start notifying the container of all key presses and commands.
void StartRecord();
stcdll_AutoComplete.o \
stcdll_CallTip.o \
stcdll_CellBuffer.o \
+ stcdll_CharClassify.o \
stcdll_ContractionState.o \
stcdll_Document.o \
stcdll_DocumentAccessor.o \
stcdll_LexGui4Cli.o \
stcdll_LexHTML.o \
stcdll_LexHaskell.o \
+ stcdll_LexInno.o \
stcdll_LexKix.o \
stcdll_LexLisp.o \
stcdll_LexLout.o \
stcdll_LexMatlab.o \
stcdll_LexMetapost.o \
stcdll_LexNsis.o \
+ stcdll_LexOpal.o \
stcdll_LexOthers.o \
stcdll_LexPB.o \
stcdll_LexPOV.o \
stcdll_LexTADS3.o \
stcdll_LexScriptol.o \
stcdll_LexSpecman.o \
+ stcdll_LexSpice.o \
+ stcdll_LexTCL.o \
stcdll_LexTeX.o \
stcdll_LexVB.o \
stcdll_LexVHDL.o \
stclib_AutoComplete.o \
stclib_CallTip.o \
stclib_CellBuffer.o \
+ stclib_CharClassify.o \
stclib_ContractionState.o \
stclib_Document.o \
stclib_DocumentAccessor.o \
stclib_LexGui4Cli.o \
stclib_LexHTML.o \
stclib_LexHaskell.o \
+ stclib_LexInno.o \
stclib_LexKix.o \
stclib_LexLisp.o \
stclib_LexLout.o \
stclib_LexMatlab.o \
stclib_LexMetapost.o \
stclib_LexNsis.o \
+ stclib_LexOpal.o \
stclib_LexOthers.o \
stclib_LexPB.o \
stclib_LexPOV.o \
stclib_LexTADS3.o \
stclib_LexScriptol.o \
stclib_LexSpecman.o \
+ stclib_LexSpice.o \
+ stclib_LexTCL.o \
stclib_LexTeX.o \
stclib_LexVB.o \
stclib_LexVHDL.o \
stcdll_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/CellBuffer.cxx
+stcdll_CharClassify.o: $(srcdir)/scintilla/src/CharClassify.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/CharClassify.cxx
+
stcdll_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/ContractionState.cxx
stcdll_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
+stcdll_LexInno.o: $(srcdir)/scintilla/src/LexInno.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexInno.cxx
+
stcdll_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
stcdll_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexNsis.cxx
+stcdll_LexOpal.o: $(srcdir)/scintilla/src/LexOpal.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexOpal.cxx
+
stcdll_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexOthers.cxx
stcdll_LexSpecman.o: $(srcdir)/scintilla/src/LexSpecman.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSpecman.cxx
+stcdll_LexSpice.o: $(srcdir)/scintilla/src/LexSpice.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexSpice.cxx
+
+stcdll_LexTCL.o: $(srcdir)/scintilla/src/LexTCL.cxx
+ $(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTCL.cxx
+
stcdll_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $(srcdir)/scintilla/src/LexTeX.cxx
stclib_CellBuffer.o: $(srcdir)/scintilla/src/CellBuffer.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/CellBuffer.cxx
+stclib_CharClassify.o: $(srcdir)/scintilla/src/CharClassify.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/CharClassify.cxx
+
stclib_ContractionState.o: $(srcdir)/scintilla/src/ContractionState.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/ContractionState.cxx
stclib_LexHaskell.o: $(srcdir)/scintilla/src/LexHaskell.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexHaskell.cxx
+stclib_LexInno.o: $(srcdir)/scintilla/src/LexInno.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexInno.cxx
+
stclib_LexKix.o: $(srcdir)/scintilla/src/LexKix.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexKix.cxx
stclib_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexNsis.cxx
+stclib_LexOpal.o: $(srcdir)/scintilla/src/LexOpal.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexOpal.cxx
+
stclib_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexOthers.cxx
stclib_LexSpecman.o: $(srcdir)/scintilla/src/LexSpecman.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSpecman.cxx
+stclib_LexSpice.o: $(srcdir)/scintilla/src/LexSpice.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexSpice.cxx
+
+stclib_LexTCL.o: $(srcdir)/scintilla/src/LexTCL.cxx
+ $(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTCL.cxx
+
stclib_LexTeX.o: $(srcdir)/scintilla/src/LexTeX.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $(srcdir)/scintilla/src/LexTeX.cxx
Palette::Palette() {
used = 0;
allowRealization = false;
+ size = 100;
+ entries = new ColourPair[size];
}
Palette::~Palette() {
Release();
+ delete [] entries;
+ entries = 0;
}
void Palette::Release() {
used = 0;
+ delete [] entries;
+ size = 100;
+ entries = new ColourPair[size];
}
// This method either adds a colour to the list of wanted colours (want==true)
return;
}
- if (used < numEntries) {
- entries[used].desired = cp.desired;
- entries[used].allocated.Set(cp.desired.AsLong());
- used++;
+ if (used >= size) {
+ int sizeNew = size * 2;
+ ColourPair *entriesNew = new ColourPair[sizeNew];
+ for (int j=0; j<size; j++) {
+ entriesNew[j] = entries[j];
+ }
+ delete []entries;
+ entries = entriesNew;
+ size = sizeNew;
}
+
+ entries[used].desired = cp.desired;
+ entries[used].allocated.Set(cp.desired.AsLong());
+ used++;
} else {
for (int i=0; i < used; i++) {
if (entries[i].desired == cp.desired) {
virtual void FillRectangle(PRectangle rc, ColourAllocated back);
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern);
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back);
+ virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
+ ColourAllocated outline, int alphaOutline, int flags);
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back);
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource);
hdc->DrawRoundedRectangle(wxRectFromPRectangle(rc), 4);
}
+void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize,
+ ColourAllocated fill, int alphaFill,
+ ColourAllocated outline, int alphaOutline, int flags) {
+// ** TODO
+
+ RectangleDraw(rc, outline, fill);
+}
+
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
PenColour(fore);
BrushColour(back);
#include "Platform.h"
#include "Scintilla.h"
+#include "CharClassify.h"
#include "XPM.h"
#ifdef SCI_LEXER
#include "SciLexer.h"
#include "Editor.h"
#include "ScintillaBase.h"
-
//----------------------------------------------------------------------
#ifdef WXMAKINGDLL_STC
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.67
+The current version of the Scintilla code is 1.70
*/
class Palette {
int used;
- enum {numEntries = 100};
- ColourPair entries[numEntries];
+ int size;
+ ColourPair *entries;
#if PLAT_GTK
void *allocatedPalette; // GdkColor *
int allocatedLen;
#endif
+ // Private so Palette objects can not be copied
+ Palette(const Palette &) {}
+ Palette &operator=(const Palette &) { return *this; }
public:
#if PLAT_WIN
void *hpal;
virtual void FillRectangle(PRectangle rc, ColourAllocated back)=0;
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0;
virtual void RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
+ virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
+ ColourAllocated outline, int alphaOutline, int flags)=0;
virtual void Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back)=0;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;
#define SCLEX_FLAGSHIP 73
#define SCLEX_CSOUND 74
#define SCLEX_FREEBASIC 75
+#define SCLEX_INNOSETUP 76
+#define SCLEX_OPAL 77
+#define SCLEX_SPICE 78
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_C_COMMENTDOCKEYWORD 17
#define SCE_C_COMMENTDOCKEYWORDERROR 18
#define SCE_C_GLOBALCLASS 19
+#define SCE_TCL_DEFAULT 0
+#define SCE_TCL_COMMENT 1
+#define SCE_TCL_COMMENTLINE 2
+#define SCE_TCL_NUMBER 3
+#define SCE_TCL_WORD_IN_QUOTE 4
+#define SCE_TCL_IN_QUOTE 5
+#define SCE_TCL_OPERATOR 6
+#define SCE_TCL_IDENTIFIER 7
+#define SCE_TCL_SUBSTITUTION 8
+#define SCE_TCL_SUB_BRACE 9
+#define SCE_TCL_MODIFIER 10
+#define SCE_TCL_EXPAND 11
+#define SCE_TCL_WORD 12
+#define SCE_TCL_WORD2 13
+#define SCE_TCL_WORD3 14
+#define SCE_TCL_WORD4 15
+#define SCE_TCL_WORD5 16
+#define SCE_TCL_WORD6 17
+#define SCE_TCL_WORD7 18
+#define SCE_TCL_WORD8 19
+#define SCE_TCL_COMMENT_BOX 20
+#define SCE_TCL_BLOCK_COMMENT 21
#define SCE_H_DEFAULT 0
#define SCE_H_TAG 1
#define SCE_H_TAGUNKNOWN 2
#define SCE_PROPS_SECTION 2
#define SCE_PROPS_ASSIGNMENT 3
#define SCE_PROPS_DEFVAL 4
+#define SCE_PROPS_KEY 5
#define SCE_L_DEFAULT 0
#define SCE_L_COMMAND 1
#define SCE_L_TAG 2
#define SCE_AU3_SPECIAL 12
#define SCE_AU3_EXPAND 13
#define SCE_AU3_COMOBJ 14
+#define SCE_AU3_UDF 15
#define SCE_APDL_DEFAULT 0
#define SCE_APDL_COMMENT 1
#define SCE_APDL_COMMENTBLOCK 2
#define SCE_CSOUND_IRATE_VAR 13
#define SCE_CSOUND_GLOBAL_VAR 14
#define SCE_CSOUND_STRINGEOL 15
+#define SCE_INNO_DEFAULT 0
+#define SCE_INNO_COMMENT 1
+#define SCE_INNO_KEYWORD 2
+#define SCE_INNO_PARAMETER 3
+#define SCE_INNO_SECTION 4
+#define SCE_INNO_PREPROC 5
+#define SCE_INNO_PREPROC_INLINE 6
+#define SCE_INNO_COMMENT_PASCAL 7
+#define SCE_INNO_KEYWORD_PASCAL 8
+#define SCE_INNO_KEYWORD_USER 9
+#define SCE_INNO_STRING_DOUBLE 10
+#define SCE_INNO_STRING_SINGLE 11
+#define SCE_INNO_IDENTIFIER 12
+#define SCE_OPAL_SPACE 0
+#define SCE_OPAL_COMMENT_BLOCK 1
+#define SCE_OPAL_COMMENT_LINE 2
+#define SCE_OPAL_INTEGER 3
+#define SCE_OPAL_KEYWORD 4
+#define SCE_OPAL_SORT 5
+#define SCE_OPAL_STRING 6
+#define SCE_OPAL_PAR 7
+#define SCE_OPAL_BOOL_CONST 8
+#define SCE_OPAL_DEFAULT 32
+#define SCE_SPICE_DEFAULT 0
+#define SCE_SPICE_IDENTIFIER 1
+#define SCE_SPICE_KEYWORD 2
+#define SCE_SPICE_KEYWORD2 3
+#define SCE_SPICE_KEYWORD3 4
+#define SCE_SPICE_NUMBER 5
+#define SCE_SPICE_DELIMITER 6
+#define SCE_SPICE_VALUE 7
+#define SCE_SPICE_COMMENTLINE 8
#define SCLEX_ASP 29
#define SCLEX_PHP 30
//--Autogenerated -- end of section automatically generated from Scintilla.iface
#define SCI_MARKERPREVIOUS 2048
#define SCI_MARKERDEFINEPIXMAP 2049
#define SCI_MARKERADDSET 2466
+#define SCI_MARKERSETALPHA 2476
#define SC_MARGIN_SYMBOL 0
#define SC_MARGIN_NUMBER 1
+#define SC_MARGIN_BACK 2
+#define SC_MARGIN_FORE 3
#define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242
#define STYLE_BRACEBAD 35
#define STYLE_CONTROLCHAR 36
#define STYLE_INDENTGUIDE 37
+#define STYLE_CALLTIP 38
#define STYLE_LASTPREDEFINED 39
#define STYLE_MAX 127
#define SC_CHARSET_ANSI 0
#define SCI_STYLESETHOTSPOT 2409
#define SCI_SETSELFORE 2067
#define SCI_SETSELBACK 2068
+#define SCI_GETSELALPHA 2477
+#define SCI_SETSELALPHA 2478
#define SCI_SETCARETFORE 2069
#define SCI_ASSIGNCMDKEY 2070
#define SCI_CLEARCMDKEY 2071
#define INDIC_STRIKE 4
#define INDIC_HIDDEN 5
#define INDIC_BOX 6
+#define INDIC_ROUNDBOX 7
#define INDIC0_MASK 0x20
#define INDIC1_MASK 0x40
#define INDIC2_MASK 0x80
#define SCI_CALLTIPSETBACK 2205
#define SCI_CALLTIPSETFORE 2206
#define SCI_CALLTIPSETFOREHLT 2207
+#define SCI_CALLTIPUSESTYLE 2212
#define SCI_VISIBLEFROMDOCLINE 2220
#define SCI_DOCLINEFROMVISIBLE 2221
#define SCI_WRAPCOUNT 2235
#define SCI_SETPASTECONVERTENDINGS 2467
#define SCI_GETPASTECONVERTENDINGS 2468
#define SCI_SELECTIONDUPLICATE 2469
+#define SC_ALPHA_TRANSPARENT 0
+#define SC_ALPHA_OPAQUE 255
+#define SC_ALPHA_NOALPHA 256
+#define SCI_SETCARETLINEBACKALPHA 2470
+#define SCI_GETCARETLINEBACKALPHA 2471
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
# Add a set of markers to a line.
fun void MarkerAddSet=2466(int line, int set)
+# Set the alpha used for a marker that is drawn in the text area, not the margin.
+fun void MarkerSetAlpha=2476(int markerNumber, int alpha)
+
enu MarginType=SC_MARGIN_
val SC_MARGIN_SYMBOL=0
val SC_MARGIN_NUMBER=1
+val SC_MARGIN_BACK=2
+val SC_MARGIN_FORE=3
# Set a margin to be either numeric or symbolic.
set void SetMarginTypeN=2240(int margin, int marginType)
# Retrieve the mouse click sensitivity of a margin.
get bool GetMarginSensitiveN=2247(int margin,)
-# Styles in range 32..37 are predefined for parts of the UI and are not used as normal styles.
-# Styles 38 and 39 are for future use.
+# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
+# Style 39 is for future use.
enu StylesCommon=STYLE_
val STYLE_DEFAULT=32
val STYLE_LINENUMBER=33
val STYLE_BRACEBAD=35
val STYLE_CONTROLCHAR=36
val STYLE_INDENTGUIDE=37
+val STYLE_CALLTIP=38
val STYLE_LASTPREDEFINED=39
val STYLE_MAX=127
# Set the background colour of the selection and whether to use this setting.
fun void SetSelBack=2068(bool useSetting, colour back)
+# Get the alpha of the selection.
+get int GetSelAlpha=2477(,)
+
+# Set the alpha of the selection.
+set void SetSelAlpha=2478(int alpha,)
+
# Set the foreground colour of the caret.
set void SetCaretFore=2069(colour fore,)
val INDIC_STRIKE=4
val INDIC_HIDDEN=5
val INDIC_BOX=6
+val INDIC_ROUNDBOX=7
val INDIC0_MASK=0x20
val INDIC1_MASK=0x40
val INDIC2_MASK=0x80
# Set the foreground colour for the highlighted part of the call tip.
set void CallTipSetForeHlt=2207(colour fore,)
+# Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
+set void CallTipUseStyle=2212(int tabSize,)
+
# Find the display line of a document line taking hidden lines into account.
fun int VisibleFromDocLine=2220(int line,)
fun void ChooseCaretX=2399(,)
# Set the focus to this Scintilla widget.
-# GTK+ Specific.
fun void GrabFocus=2400(,)
enu CaretPolicy = CARET_
# Duplicate the selection. If selection empty duplicate the line containing the caret.
fun void SelectionDuplicate=2469(,)
+val SC_ALPHA_TRANSPARENT=0
+val SC_ALPHA_OPAQUE=255
+val SC_ALPHA_NOALPHA=256
+
+# Set background alpha of the caret line.
+set void SetCaretLineBackAlpha=2470(int alpha,)
+
+# Get the background alpha of the caret line.
+get int GetCaretLineBackAlpha=2471(,)
+
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
val SCLEX_FLAGSHIP=73
val SCLEX_CSOUND=74
val SCLEX_FREEBASIC=75
-
-# These are deprecated, STC_LEX_HTML should be used instead.
-val SCLEX_ASP=29
-val SCLEX_PHP=30
-
+val SCLEX_INNOSETUP=76
+val SCLEX_OPAL=77
+val SCLEX_SPICE=78
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
# Lexical states for SCLEX_CPP
lex Cpp=SCLEX_CPP SCE_C_
lex Pascal=SCLEX_PASCAL SCE_C_
-lex TCL=SCLEX_TCL SCE_C_
lex BullAnt=SCLEX_BULLANT SCE_C_
val SCE_C_DEFAULT=0
val SCE_C_COMMENT=1
val SCE_C_COMMENTDOCKEYWORD=17
val SCE_C_COMMENTDOCKEYWORDERROR=18
val SCE_C_GLOBALCLASS=19
+# Lexical states for SCLEX_TCL
+lex TCL=SCLEX_TCL SCE_TCL_
+val SCE_TCL_DEFAULT=0
+val SCE_TCL_COMMENT=1
+val SCE_TCL_COMMENTLINE=2
+val SCE_TCL_NUMBER=3
+val SCE_TCL_WORD_IN_QUOTE=4
+val SCE_TCL_IN_QUOTE=5
+val SCE_TCL_OPERATOR=6
+val SCE_TCL_IDENTIFIER=7
+val SCE_TCL_SUBSTITUTION=8
+val SCE_TCL_SUB_BRACE=9
+val SCE_TCL_MODIFIER=10
+val SCE_TCL_EXPAND=11
+val SCE_TCL_WORD=12
+val SCE_TCL_WORD2=13
+val SCE_TCL_WORD3=14
+val SCE_TCL_WORD4=15
+val SCE_TCL_WORD5=16
+val SCE_TCL_WORD6=17
+val SCE_TCL_WORD7=18
+val SCE_TCL_WORD8=19
+val SCE_TCL_COMMENT_BOX=20
+val SCE_TCL_BLOCK_COMMENT=21
# Lexical states for SCLEX_HTML, SCLEX_XML
lex HTML=SCLEX_HTML SCE_H
lex XML=SCLEX_XML SCE_H
val SCE_PROPS_SECTION=2
val SCE_PROPS_ASSIGNMENT=3
val SCE_PROPS_DEFVAL=4
+val SCE_PROPS_KEY=5
# Lexical states for SCLEX_LATEX
lex LaTeX=SCLEX_LATEX SCE_L_
val SCE_L_DEFAULT=0
val SCE_AU3_SPECIAL=12
val SCE_AU3_EXPAND=13
val SCE_AU3_COMOBJ=14
+val SCE_AU3_UDF=15
# Lexical states for SCLEX_APDL
lex APDL=SCLEX_APDL SCE_APDL_
val SCE_APDL_DEFAULT=0
val SCE_CSOUND_IRATE_VAR=13
val SCE_CSOUND_GLOBAL_VAR=14
val SCE_CSOUND_STRINGEOL=15
+# Lexical states for SCLEX_INNOSETUP
+lex Inno=SCLEX_INNOSETUP SCE_INNO_
+val SCE_INNO_DEFAULT=0
+val SCE_INNO_COMMENT=1
+val SCE_INNO_KEYWORD=2
+val SCE_INNO_PARAMETER=3
+val SCE_INNO_SECTION=4
+val SCE_INNO_PREPROC=5
+val SCE_INNO_PREPROC_INLINE=6
+val SCE_INNO_COMMENT_PASCAL=7
+val SCE_INNO_KEYWORD_PASCAL=8
+val SCE_INNO_KEYWORD_USER=9
+val SCE_INNO_STRING_DOUBLE=10
+val SCE_INNO_STRING_SINGLE=11
+val SCE_INNO_IDENTIFIER=12
+# Lexical states for SCLEX_OPAL
+lex Opal=SCLEX_OPAL SCE_OPAL_
+val SCE_OPAL_SPACE=0
+val SCE_OPAL_COMMENT_BLOCK=1
+val SCE_OPAL_COMMENT_LINE=2
+val SCE_OPAL_INTEGER=3
+val SCE_OPAL_KEYWORD=4
+val SCE_OPAL_SORT=5
+val SCE_OPAL_STRING=6
+val SCE_OPAL_PAR=7
+val SCE_OPAL_BOOL_CONST=8
+val SCE_OPAL_DEFAULT=32
+# Lexical states for SCLEX_SPICE
+lex Spice=SCLEX_SPICE SCE_SPICE_
+val SCE_SPICE_DEFAULT=0
+val SCE_SPICE_IDENTIFIER=1
+val SCE_SPICE_KEYWORD=2
+val SCE_SPICE_KEYWORD2=3
+val SCE_SPICE_KEYWORD3=4
+val SCE_SPICE_NUMBER=5
+val SCE_SPICE_DELIMITER=6
+val SCE_SPICE_VALUE=7
+val SCE_SPICE_COMMENTLINE=8
# Events
void (* notify) (ScintillaObject *ttt);
};
+#if GLIB_MAJOR_VERSION < 2
GtkType scintilla_get_type (void);
+#else
+GType scintilla_get_type (void);
+#endif
GtkWidget* scintilla_new (void);
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);
#include "Scintilla.h"
#include "CallTip.h"
+static const int insetX = 5; // text inset in x from calltip border
+static const int widthArrow = 14;
+
CallTip::CallTip() {
wCallTip = 0;
inCallTipMode = false;
lineHeight = 1;
startHighlight = 0;
endHighlight = 0;
+ tabSize = 0;
+ useStyleCallTip = false; // for backwards compatibility
colourBG.desired = ColourDesired(0xff, 0xff, 0xff);
colourUnSel.desired = ColourDesired(0x80, 0x80, 0x80);
val = 0;
}
-const int widthArrow = 14;
-
void CallTip::RefreshColourPalette(Palette &pal, bool want) {
pal.WantFind(colourBG, want);
pal.WantFind(colourUnSel, want);
pal.WantFind(colourLight, want);
}
+// Although this test includes 0, we should never see a \0 character.
static bool IsArrowCharacter(char ch) {
return (ch == 0) || (ch == '\001') || (ch == '\002');
}
+// We ignore tabs unless a tab width has been set.
+bool CallTip::IsTabCharacter(char ch) {
+ return (tabSize > 0) && (ch == '\t');
+}
+
+int CallTip::NextTabPos(int x) {
+ if (tabSize > 0) { // paranoia... not called unless this is true
+ x -= insetX; // position relative to text
+ x = (x + tabSize) / tabSize; // tab "number"
+ return tabSize*x + insetX; // position of next tab
+ } else {
+ return x + 1; // arbitrary
+ }
+}
+
+// Draw a section of the call tip that does not include \n in one colour.
+// The text may include up to numEnds tabs or arrow characters.
void CallTip::DrawChunk(Surface *surface, int &x, const char *s,
int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw) {
s += posStart;
int len = posEnd - posStart;
+
+ // Divide the text into sections that are all text, or that are
+ // single arrows or single tab characters (if tabSize > 0).
int maxEnd = 0;
- int ends[10];
+ const int numEnds = 10;
+ int ends[numEnds + 2];
for (int i=0;i<len;i++) {
- if (IsArrowCharacter(s[i])) {
+ if ((maxEnd < numEnds) &&
+ (IsArrowCharacter(s[i]) || IsTabCharacter(s[i])) ) {
if (i > 0)
ends[maxEnd++] = i;
ends[maxEnd++] = i+1;
int endSeg = ends[seg];
if (endSeg > startSeg) {
if (IsArrowCharacter(s[startSeg])) {
- xEnd = x + widthArrow;
- offsetMain = xEnd;
+ bool upArrow = s[startSeg] == '\001';
rcClient.left = x;
- rcClient.right = xEnd;
+ rcClient.right = rcClient.left + widthArrow;
if (draw) {
const int halfWidth = widthArrow / 2 - 3;
- const int centreX = x + widthArrow / 2 - 1;
+ const int centreX = rcClient.left + widthArrow / 2 - 1;
const int centreY = (rcClient.top + rcClient.bottom) / 2;
surface->FillRectangle(rcClient, colourBG.allocated);
- PRectangle rcClientInner(rcClient.left+1, rcClient.top+1, rcClient.right-2, rcClient.bottom-1);
+ PRectangle rcClientInner(rcClient.left + 1, rcClient.top + 1,
+ rcClient.right - 2, rcClient.bottom - 1);
surface->FillRectangle(rcClientInner, colourUnSel.allocated);
- if (s[startSeg] == '\001') {
- // Up arrow
+ if (upArrow) { // Up arrow
Point pts[] = {
Point(centreX - halfWidth, centreY + halfWidth / 2),
Point(centreX + halfWidth, centreY + halfWidth / 2),
};
surface->Polygon(pts, sizeof(pts) / sizeof(pts[0]),
colourBG.allocated, colourBG.allocated);
- } else {
- // Down arrow
+ } else { // Down arrow
Point pts[] = {
Point(centreX - halfWidth, centreY - halfWidth / 2),
Point(centreX + halfWidth, centreY - halfWidth / 2),
colourBG.allocated, colourBG.allocated);
}
}
- if (s[startSeg] == '\001') {
+ xEnd = rcClient.right;
+ offsetMain = xEnd;
+ if (upArrow) {
rectUp = rcClient;
- } else if (s[startSeg] == '\002') {
+ } else {
rectDown = rcClient;
}
+ } else if (IsTabCharacter(s[startSeg])) {
+ xEnd = NextTabPos(x);
} else {
- xEnd = x + surface->WidthText(font, s+startSeg, endSeg - startSeg);
+ xEnd = x + surface->WidthText(font, s + startSeg, endSeg - startSeg);
if (draw) {
rcClient.left = x;
rcClient.right = xEnd;
- surface->DrawTextNoClip(rcClient, font, ytext,
+ surface->DrawTextTransparent(rcClient, font, ytext,
s+startSeg, endSeg - startSeg,
- highlight ? colourSel.allocated : colourUnSel.allocated,
- colourBG.allocated);
+ highlight ? colourSel.allocated : colourUnSel.allocated);
}
}
x = xEnd;
thisEndHighlight -= chunkOffset;
rcClient.top = ytext - ascent - 1;
- int x = 5;
+ int x = insetX; // start each line at this inset
DrawChunk(surfaceWindow, x, chunkVal, 0, thisStartHighlight,
ytext, rcClient, false, draw);
surfaceWindow->FillRectangle(rcClient, colourBG.allocated);
- offsetMain = 5;
+ offsetMain = insetX; // initial alignment assuming no arrows
PaintContents(surfaceWindow, true);
// Draw a raised border around the edges of the window
const char *look = val;
rectUp = PRectangle(0,0,0,0);
rectDown = PRectangle(0,0,0,0);
- offsetMain = 5;
- int width = PaintContents(surfaceMeasure, false) + 5;
+ offsetMain = insetX; // changed to right edge of any arrows
+ int width = PaintContents(surfaceMeasure, false) + insetX;
while ((newline = strchr(look, '\n')) != NULL) {
look = newline + 1;
numLines++;
}
lineHeight = surfaceMeasure->Height(font);
- // Extra line for border and an empty line at top and bottom
+
+ // Extra line for border and an empty line at top and bottom. The returned
+ // rectangle is aligned to the right edge of the last arrow encountered in
+ // the tip text, else to the tip text left edge.
int height = lineHeight * numLines - surfaceMeasure->InternalLeading(font) + 2 + 2;
delete surfaceMeasure;
return PRectangle(pt.x - offsetMain, pt.y + 1, pt.x + width - offsetMain, pt.y + 1 + height);
}
}
}
+
+// Set the tab size (sizes > 0 enable the use of tabs). This also enables the
+// use of the STYLE_CALLTIP.
+void CallTip::SetTabSize(int tabSz) {
+ tabSize = tabSz;
+ useStyleCallTip = true;
+}
+
+// It might be better to have two access functions for this and to use
+// them for all settings of colours.
+void CallTip::SetForeBack(const ColourPair &fore, const ColourPair &back) {
+ colourBG = back;
+ colourUnSel = fore;
+}
/**
*/
class CallTip {
- int startHighlight;
- int endHighlight;
+ int startHighlight; // character offset to start and...
+ int endHighlight; // ...end of highlighted text
char *val;
Font font;
- PRectangle rectUp;
- PRectangle rectDown;
- int lineHeight;
- int offsetMain;
+ PRectangle rectUp; // rectangle of last up angle in the tip
+ PRectangle rectDown; // rectangle of last down arrow in the tip
+ int lineHeight; // vertical line spacing
+ int offsetMain; // The alignment point of the call tip
+ int tabSize; // Tab size in pixels, <=0 no TAB expand
+ bool useStyleCallTip; // if true, STYLE_CALLTIP should be used
+
// Private so CallTip objects can not be copied
CallTip(const CallTip &) {}
CallTip &operator=(const CallTip &) { return *this; }
int posStart, int posEnd, int ytext, PRectangle rcClient,
bool highlight, bool draw);
int PaintContents(Surface *surfaceWindow, bool draw);
+ bool IsTabCharacter(char c);
+ int NextTabPos(int x);
public:
Window wCallTip;
/// Set a range of characters to be displayed in a highlight style.
/// Commonly used to highlight the current parameter.
void SetHighlight(int start, int end);
+
+ /// Set the tab size in pixels for the call tip. 0 or -ve means no tab expand.
+ void SetTabSize(int tabSz);
+
+ /// Used to determine which STYLE_xxxx to use for call tip information
+ bool UseStyleCallTip() const { return useStyleCallTip;}
+
+ // Modify foreground and background colours
+ void SetForeBack(const ColourPair &fore, const ColourPair &back);
};
#endif
--- /dev/null
+// Scintilla source code edit control
+/** @file CharClassify.cxx
+ ** Character classifications used by Document and RESearch.
+ **/
+// Copyright 2006 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <ctype.h>
+
+#include "CharClassify.h"
+
+// Shut up annoying Visual C++ warnings:
+#ifdef _MSC_VER
+#pragma warning(disable: 4514)
+#endif
+
+CharClassify::CharClassify() {
+ SetDefaultCharClasses(true);
+}
+
+void CharClassify::SetDefaultCharClasses(bool includeWordClass) {
+ // Initialize all char classes to default values
+ for (int ch = 0; ch < 256; ch++) {
+ if (ch == '\r' || ch == '\n')
+ charClass[ch] = ccNewLine;
+ else if (ch < 0x20 || ch == ' ')
+ charClass[ch] = ccSpace;
+ else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_'))
+ charClass[ch] = ccWord;
+ else
+ charClass[ch] = ccPunctuation;
+ }
+}
+
+void CharClassify::SetCharClasses(const unsigned char *chars, cc newCharClass) {
+ // Apply the newCharClass to the specifed chars
+ if (chars) {
+ while (*chars) {
+ charClass[*chars] = static_cast<unsigned char>(newCharClass);
+ chars++;
+ }
+ }
+}
--- /dev/null
+// Scintilla source code edit control
+/** @file CharClassify.h
+ ** Character classifications used by Document and RESearch.
+ **/
+// Copyright 2006 by Neil Hodgson <neilh@scintilla.org>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#ifndef CHARCLASSIFY_H
+#define CHARCLASSIFY_H
+
+class CharClassify {
+public:
+ CharClassify();
+
+ enum cc { ccSpace, ccNewLine, ccWord, ccPunctuation };
+ void SetDefaultCharClasses(bool includeWordClass);
+ void SetCharClasses(const unsigned char *chars, cc newCharClass);
+ cc GetClass(unsigned char ch) const { return static_cast<cc>(charClass[ch]);}
+ bool IsWord(unsigned char ch) const { return static_cast<cc>(charClass[ch]) == ccWord;}
+
+private:
+ enum { maxChar=256 };
+ unsigned char charClass[maxChar]; // not type cc to save space
+};
+#endif
delete []lines;
lines = 0;
size = 0;
+
+ delete []docLines;
+ docLines = 0;
+ sizeDocLines = 0;
+
+ linesInDisplay = linesInDoc;
}
#include "Scintilla.h"
#include "SVector.h"
#include "CellBuffer.h"
+#include "CharClassify.h"
#include "Document.h"
#include "RESearch.h"
stylingBits = 5;
stylingBitsMask = 0x1F;
stylingMask = 0;
- SetDefaultCharClasses(true);
endStyled = 0;
styleClock = 0;
enteredCount = 0;
return LineEnd(line-1);
}
-Document::charClassification Document::WordCharClass(unsigned char ch) {
+CharClassify::cc Document::WordCharClass(unsigned char ch) {
if ((SC_CP_UTF8 == dbcsCodePage) && (ch >= 0x80))
- return ccWord;
- return charClass[ch];
+ return CharClassify::ccWord;
+ return charClass.GetClass(ch);
}
/**
* Finds the start of word at pos when delta < 0 or the end of the word when delta >= 0.
*/
int Document::ExtendWordSelect(int pos, int delta, bool onlyWordCharacters) {
- charClassification ccStart = ccWord;
+ CharClassify::cc ccStart = CharClassify::ccWord;
if (delta < 0) {
if (!onlyWordCharacters)
ccStart = WordCharClass(cb.CharAt(pos-1));
*/
int Document::NextWordStart(int pos, int delta) {
if (delta < 0) {
- while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccSpace))
+ while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace))
pos--;
if (pos > 0) {
- charClassification ccStart = WordCharClass(cb.CharAt(pos-1));
+ CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1));
while (pos > 0 && (WordCharClass(cb.CharAt(pos - 1)) == ccStart)) {
pos--;
}
}
} else {
- charClassification ccStart = WordCharClass(cb.CharAt(pos));
+ CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos));
while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccStart))
pos++;
- while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == ccSpace))
+ while (pos < (Length()) && (WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace))
pos++;
}
return pos;
int Document::NextWordEnd(int pos, int delta) {
if (delta < 0) {
if (pos > 0) {
- charClassification ccStart = WordCharClass(cb.CharAt(pos-1));
- if (ccStart != ccSpace) {
+ CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos-1));
+ if (ccStart != CharClassify::ccSpace) {
while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccStart) {
pos--;
}
}
- while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == ccSpace) {
+ while (pos > 0 && WordCharClass(cb.CharAt(pos - 1)) == CharClassify::ccSpace) {
pos--;
}
}
} else {
- while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccSpace) {
+ while (pos < Length() && WordCharClass(cb.CharAt(pos)) == CharClassify::ccSpace) {
pos++;
}
if (pos < Length()) {
- charClassification ccStart = WordCharClass(cb.CharAt(pos));
+ CharClassify::cc ccStart = WordCharClass(cb.CharAt(pos));
while (pos < Length() && WordCharClass(cb.CharAt(pos)) == ccStart) {
pos++;
}
*/
bool Document::IsWordStartAt(int pos) {
if (pos > 0) {
- charClassification ccPos = WordCharClass(CharAt(pos));
- return (ccPos == ccWord || ccPos == ccPunctuation) &&
+ CharClassify::cc ccPos = WordCharClass(CharAt(pos));
+ return (ccPos == CharClassify::ccWord || ccPos == CharClassify::ccPunctuation) &&
(ccPos != WordCharClass(CharAt(pos - 1)));
}
return true;
*/
bool Document::IsWordEndAt(int pos) {
if (pos < Length()) {
- charClassification ccPrev = WordCharClass(CharAt(pos-1));
- return (ccPrev == ccWord || ccPrev == ccPunctuation) &&
+ CharClassify::cc ccPrev = WordCharClass(CharAt(pos-1));
+ return (ccPrev == CharClassify::ccWord || ccPrev == CharClassify::ccPunctuation) &&
(ccPrev != WordCharClass(CharAt(pos)));
}
return true;
int *length) {
if (regExp) {
if (!pre)
- pre = new RESearch();
+ pre = new RESearch(&charClass);
if (!pre)
return -1;
}
void Document::SetDefaultCharClasses(bool includeWordClass) {
- // Initialize all char classes to default values
- for (int ch = 0; ch < 256; ch++) {
- if (ch == '\r' || ch == '\n')
- charClass[ch] = ccNewLine;
- else if (ch < 0x20 || ch == ' ')
- charClass[ch] = ccSpace;
- else if (includeWordClass && (ch >= 0x80 || isalnum(ch) || ch == '_'))
- charClass[ch] = ccWord;
- else
- charClass[ch] = ccPunctuation;
- }
+ charClass.SetDefaultCharClasses(includeWordClass);
}
-void Document::SetCharClasses(const unsigned char *chars, charClassification newCharClass) {
- // Apply the newCharClass to the specifed chars
- if (chars) {
- while (*chars) {
- charClass[*chars] = newCharClass;
- chars++;
- }
- }
+void Document::SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass) {
+ charClass.SetCharClasses(chars, newCharClass);
}
void Document::SetStylingBits(int bits) {
}
bool Document::IsWordPartSeparator(char ch) {
- return (WordCharClass(ch) == ccWord) && IsPunctuation(ch);
+ return (WordCharClass(ch) == CharClassify::ccWord) && IsPunctuation(ch);
}
int Document::WordPartLeft(int pos) {
private:
int refCount;
CellBuffer cb;
- charClassification charClass[256];
+ CharClassify charClass;
char stylingMask;
int endStyled;
int styleClock;
void ChangeCase(Range r, bool makeUpperCase);
void SetDefaultCharClasses(bool includeWordClass);
- void SetCharClasses(const unsigned char *chars, charClassification newCharClass);
+ void SetCharClasses(const unsigned char *chars, CharClassify::cc newCharClass);
void SetStylingBits(int bits);
void StartStyling(int position, char mask);
bool SetStyleFor(int length, char style);
private:
void CheckReadOnly();
- charClassification WordCharClass(unsigned char ch);
+ CharClassify::cc WordCharClass(unsigned char ch);
bool IsWordStartAt(int pos);
bool IsWordEndAt(int pos);
bool IsWordAt(int start, int end);
#include "DocumentAccessor.h"
#include "CellBuffer.h"
#include "Scintilla.h"
+#include "CharClassify.h"
#include "Document.h"
DocumentAccessor::~DocumentAccessor() {
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
+#include "CharClassify.h"
#include "Document.h"
#include "Editor.h"
}
void LineLayoutCache::AllocateForLevel(int linesOnScreen, int linesInDoc) {
-// PLATFORM_ASSERT(useCount == 0);
+ PLATFORM_ASSERT(useCount == 0);
int lengthForLevel = 0;
if (level == llcCaret) {
lengthForLevel = 1;
}
void LineLayoutCache::Deallocate() {
-// PLATFORM_ASSERT(useCount == 0);
+ PLATFORM_ASSERT(useCount == 0);
for (int i = 0; i < length; i++)
delete cache[i];
delete []cache;
} else if (level == llcPage) {
if (lineNumber == lineCaret) {
pos = 0;
- } else {
+ } else if (length > 1) {
pos = 1 + (lineNumber % (length - 1));
}
} else if (level == llcDocument) {
delete ll;
} else {
useCount--;
- }
+ }
}
}
wrapState = eWrapNone;
wrapWidth = LineLayout::wrapWidthInfinite;
- docLineLastWrapped = -1;
- docLastLineToWrap = -1;
- backgroundWrapEnabled = true;
+ wrapStart = wrapLineLarge;
+ wrapEnd = wrapLineLarge;
wrapVisualFlags = 0;
wrapVisualFlagsLocation = 0;
wrapVisualStartIndent = 0;
return pdoc->MovePositionOutsideChar(i + posLineStart, 1);
}
}
+ if (pt.x < (ll->positions[lineEnd] - subLineStart)) {
+ return pdoc->MovePositionOutsideChar(lineEnd + posLineStart, 1);
+ }
}
}
void Editor::UpdateSystemCaret() {
}
-void Editor::NeedWrapping(int docLineStartWrapping, int docLineEndWrapping) {
- docLineStartWrapping = Platform::Minimum(docLineStartWrapping, pdoc->LinesTotal()-1);
- docLineEndWrapping = Platform::Minimum(docLineEndWrapping, pdoc->LinesTotal()-1);
- bool noWrap = (docLastLineToWrap == docLineLastWrapped);
- if (docLineLastWrapped > (docLineStartWrapping - 1)) {
- docLineLastWrapped = docLineStartWrapping - 1;
- if (docLineLastWrapped < -1)
- docLineLastWrapped = -1;
+void Editor::NeedWrapping(int docLineStart, int docLineEnd) {
+ docLineStart = Platform::Clamp(docLineStart, 0, pdoc->LinesTotal());
+ if (wrapStart > docLineStart) {
+ wrapStart = docLineStart;
llc.Invalidate(LineLayout::llPositions);
}
- if (noWrap) {
- docLastLineToWrap = docLineEndWrapping;
- } else if (docLastLineToWrap < docLineEndWrapping) {
- docLastLineToWrap = docLineEndWrapping + 1;
+ if (wrapEnd < docLineEnd) {
+ wrapEnd = docLineEnd;
}
- if (docLastLineToWrap < -1)
- docLastLineToWrap = -1;
- if (docLastLineToWrap >= pdoc->LinesTotal())
- docLastLineToWrap = pdoc->LinesTotal()-1;
+ wrapEnd = Platform::Clamp(wrapEnd, 0, pdoc->LinesTotal());
// Wrap lines during idle.
- if ((wrapState != eWrapNone) &&
- backgroundWrapEnabled &&
- (docLastLineToWrap != docLineLastWrapped)) {
+ if ((wrapState != eWrapNone) && (wrapEnd != wrapStart)) {
SetIdle(true);
}
}
// fullwrap: if true, all lines which need wrapping will be done,
// in this single call.
// priorityWrapLineStart: If greater than zero, all lines starting from
-// here to 100 lines past will be wrapped (even if there are
+// here to 1 page + 100 lines past will be wrapped (even if there are
// more lines under wrapping process in idle).
-// If it is neither fullwrap, nor priorityWrap, then 100 lines will be
+// If it is neither fullwrap, nor priorityWrap, then 1 page + 100 lines will be
// wrapped, if there are any wrapping going on in idle. (Generally this
// condition is called only from idler).
// Return true if wrapping occurred.
bool Editor::WrapLines(bool fullWrap, int priorityWrapLineStart) {
// If there are any pending wraps, do them during idle if possible.
+ int linesInOneCall = LinesOnScreen() + 100;
if (wrapState != eWrapNone) {
- if (docLineLastWrapped < docLastLineToWrap) {
- if (!(backgroundWrapEnabled && SetIdle(true))) {
- // Background wrapping is disabled, or idle processing
- // not supported. A full wrap is required.
+ if (wrapStart < wrapEnd) {
+ if (!SetIdle(true)) {
+ // Idle processing not supported so full wrap required.
fullWrap = true;
}
}
if (!fullWrap && priorityWrapLineStart >= 0 &&
// .. and if the paint window is outside pending wraps
- (((priorityWrapLineStart + 100) < docLineLastWrapped) ||
- (priorityWrapLineStart > docLastLineToWrap))) {
+ (((priorityWrapLineStart + linesInOneCall) < wrapStart) ||
+ (priorityWrapLineStart > wrapEnd))) {
// No priority wrap pending
return false;
}
}
int goodTopLine = topLine;
bool wrapOccurred = false;
- if (docLineLastWrapped < pdoc->LinesTotal()) {
+ if (wrapStart <= pdoc->LinesTotal()) {
if (wrapState == eWrapNone) {
if (wrapWidth != LineLayout::wrapWidthInfinite) {
wrapWidth = LineLayout::wrapWidthInfinite;
}
wrapOccurred = true;
}
- docLineLastWrapped = 0x7ffffff;
+ wrapStart = wrapLineLarge;
+ wrapEnd = wrapLineLarge;
} else {
+ if (wrapEnd >= pdoc->LinesTotal())
+ wrapEnd = pdoc->LinesTotal();
//ElapsedTime et;
int lineDocTop = cs.DocFromDisplay(topLine);
int subLineTop = topLine - cs.DisplayFromDoc(lineDocTop);
AutoSurface surface(this);
if (surface) {
bool priorityWrap = false;
- int lastLineToWrap = docLastLineToWrap;
- int firstLineToWrap = docLineLastWrapped;
+ int lastLineToWrap = wrapEnd;
+ int lineToWrap = wrapStart;
if (!fullWrap) {
if (priorityWrapLineStart >= 0) {
// This is a priority wrap.
- firstLineToWrap = priorityWrapLineStart;
- lastLineToWrap = firstLineToWrap + 100;
+ lineToWrap = priorityWrapLineStart;
+ lastLineToWrap = priorityWrapLineStart + linesInOneCall;
priorityWrap = true;
} else {
// This is idle wrap.
- lastLineToWrap = docLineLastWrapped + 100;
+ lastLineToWrap = wrapStart + linesInOneCall;
}
- if (lastLineToWrap >= docLastLineToWrap)
- lastLineToWrap = docLastLineToWrap;
+ if (lastLineToWrap >= wrapEnd)
+ lastLineToWrap = wrapEnd;
} // else do a fullWrap.
- // printf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, firstLineToWrap, lastLineToWrap);
- // printf("Pending wraps: %d to %d\n", docLineLastWrapped, docLastLineToWrap);
- while (firstLineToWrap < lastLineToWrap) {
- firstLineToWrap++;
- if (!priorityWrap)
- docLineLastWrapped++;
- if (firstLineToWrap < pdoc->LinesTotal()) {
- AutoLineLayout ll(llc, RetrieveLineLayout(firstLineToWrap));
+ // Platform::DebugPrintf("Wraplines: full = %d, priorityStart = %d (wrapping: %d to %d)\n", fullWrap, priorityWrapLineStart, lineToWrap, lastLineToWrap);
+ // Platform::DebugPrintf("Pending wraps: %d to %d\n", wrapStart, wrapEnd);
+ while (lineToWrap < lastLineToWrap) {
+ AutoLineLayout ll(llc, RetrieveLineLayout(lineToWrap));
int linesWrapped = 1;
if (ll) {
- LayoutLine(firstLineToWrap, surface, vs, ll, wrapWidth);
+ LayoutLine(lineToWrap, surface, vs, ll, wrapWidth);
linesWrapped = ll->lines;
}
- if (cs.SetHeight(firstLineToWrap, linesWrapped)) {
+ if (cs.SetHeight(lineToWrap, linesWrapped)) {
wrapOccurred = true;
- }
}
+ lineToWrap++;
}
+ if (!priorityWrap)
+ wrapStart = lineToWrap;
// If wrapping is done, bring it to resting position
- if (docLineLastWrapped > docLastLineToWrap) {
- docLineLastWrapped = -1;
- docLastLineToWrap = -1;
+ if (wrapStart >= wrapEnd) {
+ wrapStart = wrapLineLarge;
+ wrapEnd = wrapLineLarge;
}
}
goodTopLine = cs.DisplayFromDoc(lineDocTop);
targetEnd += static_cast<int>(strlen(eol));
}
}
+ lineEnd = pdoc->LineFromPosition(targetEnd);
}
pdoc->EndUndoAction();
}
rcSelMargin.left = rcSelMargin.right;
rcSelMargin.right = rcSelMargin.left + vs.ms[margin].width;
- if (vs.ms[margin].symbol) {
+ if (vs.ms[margin].style != SC_MARGIN_NUMBER) {
/* alternate scheme:
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_DEFAULT].back.allocated);
if (vs.ms[margin].mask & SC_MASK_FOLDERS)
// Required because of special way brush is created for selection margin
surface->FillRectangle(rcSelMargin, *pixmapSelPattern);
- else
- surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated);
+ else {
+ ColourAllocated colour;
+ switch (vs.ms[margin].style) {
+ case SC_MARGIN_BACK:
+ colour = vs.styles[STYLE_DEFAULT].back.allocated;
+ break;
+ case SC_MARGIN_FORE:
+ colour = vs.styles[STYLE_DEFAULT].fore.allocated;
+ break;
+ default:
+ colour = vs.styles[STYLE_LINENUMBER].back.allocated;
+ break;
+ }
+ surface->FillRectangle(rcSelMargin, colour);
+ }
} else {
surface->FillRectangle(rcSelMargin, vs.styles[STYLE_LINENUMBER].back.allocated);
}
PRectangle rcMarker = rcSelMargin;
rcMarker.top = yposScreen;
rcMarker.bottom = yposScreen + vs.lineHeight;
- if (!vs.ms[margin].symbol) {
+ if (vs.ms[margin].style == SC_MARGIN_NUMBER) {
char number[100];
number[0] = '\0';
if (firstSubLine)
continue;
}
if (p > 0) {
- if (wrapState == eWrapChar){
+ if (wrapState == eWrapChar) {
lastGoodBreak = pdoc->MovePositionOutsideChar(p + posLineStart, -1)
- posLineStart;
p = pdoc->MovePositionOutsideChar(p + 1 + posLineStart, 1) - posLineStart;
}
}
+ColourAllocated Editor::SelectionBackground(ViewStyle &vsDraw) {
+ return primarySelection ? vsDraw.selbackground.allocated : vsDraw.selbackground2.allocated;
+}
+
ColourAllocated Editor::TextBackground(ViewStyle &vsDraw, bool overrideBackground,
ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll) {
if (inSelection) {
- if (vsDraw.selbackset) {
- if (primarySelection)
- return vsDraw.selbackground.allocated;
- else
- return vsDraw.selbackground2.allocated;
+ if (vsDraw.selbackset && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
+ return SelectionBackground(vsDraw);
}
} else {
if ((vsDraw.edgeState == EDGE_BACKGROUND) &&
surface->LineTo(xBase + xDir * xRelative, yBase + yDir * yRelative);
}
};
- Relative rel = {surface, x0, xStraight?1:-1, y0, yStraight?1:-1};
+ Relative rel = {surface, x0, xStraight ? 1 : -1, y0, yStraight ? 1 : -1};
// arrow head
rel.MoveTo(xa, y);
y - 2 * dy);
}
+static void SimpleAlphaRectangle(Surface *surface, PRectangle rc, ColourAllocated fill, int alpha) {
+ if (alpha != SC_ALPHA_NOALPHA) {
+ surface->AlphaRectangle(rc, 0, fill, alpha, fill, alpha, 0);
+ }
+}
+
void Editor::DrawEOL(Surface *surface, ViewStyle &vsDraw, PRectangle rcLine, LineLayout *ll,
int line, int lineEnd, int xStart, int subLine, int subLineStart,
bool overrideBackground, ColourAllocated background,
bool eolInSelection = (subLine == (ll->lines - 1)) &&
(posLineEnd > ll->selStart) && (posLineEnd <= ll->selEnd) && (ll->selStart != ll->selEnd);
- if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1)) {
- if (primarySelection)
- surface->FillRectangle(rcSegment, vsDraw.selbackground.allocated);
- else
- surface->FillRectangle(rcSegment, vsDraw.selbackground2.allocated);
- } else if (overrideBackground) {
- surface->FillRectangle(rcSegment, background);
+ if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha == SC_ALPHA_NOALPHA)) {
+ surface->FillRectangle(rcSegment, SelectionBackground(vsDraw));
} else {
- surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated);
+ if (overrideBackground) {
+ surface->FillRectangle(rcSegment, background);
+ } else {
+ surface->FillRectangle(rcSegment, vsDraw.styles[ll->styles[ll->numCharsInLine] & styleMask].back.allocated);
+ }
+ if (eolInSelection && vsDraw.selbackset && (line < pdoc->LinesTotal() - 1) && (vsDraw.selAlpha != SC_ALPHA_NOALPHA)) {
+ SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha);
+ }
}
rcSegment.left = xEol + vsDraw.aveCharWidth + xStart;
// the color for the highest numbered one is used.
bool overrideBackground = false;
ColourAllocated background;
- if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
+ if (caret.active && vsDraw.showCaretLineBackground && (vsDraw.caretLineAlpha == SC_ALPHA_NOALPHA) && ll->containsCaret) {
overrideBackground = true;
background = vsDraw.caretLineBackground.allocated;
}
if (!overrideBackground) {
int marks = pdoc->GetMark(line);
for (int markBit = 0; (markBit < 32) && marks; markBit++) {
- if ((marks & 1) && vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) {
+ if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND) &&
+ (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
background = vsDraw.markers[markBit].back.allocated;
overrideBackground = true;
}
}
if (!overrideBackground) {
if (vsDraw.maskInLine) {
- int marks = pdoc->GetMark(line) & vsDraw.maskInLine;
- if (marks) {
- for (int markBit = 0; (markBit < 32) && marks; markBit++) {
- if ((marks & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) {
+ int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
+ if (marksMasked) {
+ for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
+ if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY) &&
+ (vsDraw.markers[markBit].alpha == SC_ALPHA_NOALPHA)) {
overrideBackground = true;
background = vsDraw.markers[markBit].back.allocated;
}
- marks >>= 1;
+ marksMasked >>= 1;
}
}
}
xStart, subLine, subLineStart, overrideBackground, background,
drawWrapMarkEnd, vsDraw.whitespaceForeground.allocated);
}
+ if ((vsDraw.selAlpha != SC_ALPHA_NOALPHA) && (ll->selStart >= 0) && (ll->selEnd >= 0)) {
+ int startPosSel = (ll->selStart < posLineStart) ? posLineStart : ll->selStart;
+ int endPosSel = (ll->selEnd < (lineEnd + posLineStart)) ? ll->selEnd : (lineEnd + posLineStart);
+ if (startPosSel < endPosSel) {
+ rcSegment.left = xStart + ll->positions[startPosSel - posLineStart] - subLineStart;
+ rcSegment.right = xStart + ll->positions[endPosSel - posLineStart] - subLineStart;
+ SimpleAlphaRectangle(surface, rcSegment, SelectionBackground(vsDraw), vsDraw.selAlpha);
+ }
+ }
if (vsDraw.edgeState == EDGE_LINE) {
int edgeX = theEdge * vsDraw.spaceWidth;
rcSegment.right = rcSegment.left + 1;
surface->FillRectangle(rcSegment, vsDraw.edgecolour.allocated);
}
+
+ // Draw any translucent whole line states
+ rcSegment.left = xStart;
+ rcSegment.right = rcLine.right - 1;
+ if (caret.active && vsDraw.showCaretLineBackground && ll->containsCaret) {
+ SimpleAlphaRectangle(surface, rcSegment, vsDraw.caretLineBackground.allocated, vsDraw.caretLineAlpha);
+ }
+ int marks = pdoc->GetMark(line);
+ for (int markBit = 0; (markBit < 32) && marks; markBit++) {
+ if ((marks & 1) && (vsDraw.markers[markBit].markType == SC_MARK_BACKGROUND)) {
+ SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
+ }
+ marks >>= 1;
+ }
+ if (vsDraw.maskInLine) {
+ int marksMasked = pdoc->GetMark(line) & vsDraw.maskInLine;
+ if (marksMasked) {
+ for (int markBit = 0; (markBit < 32) && marksMasked; markBit++) {
+ if ((marksMasked & 1) && (vsDraw.markers[markBit].markType != SC_MARK_EMPTY)) {
+ SimpleAlphaRectangle(surface, rcSegment, vsDraw.markers[markBit].back.allocated, vsDraw.markers[markBit].alpha);
+ }
+ marksMasked >>= 1;
+ }
+ }
+ }
}
void Editor::RefreshPixMaps(Surface *surfaceWindow) {
// paintingAllText, rcArea.left, rcArea.top, rcArea.right, rcArea.bottom);
RefreshStyleData();
-
RefreshPixMaps(surfaceWindow);
PRectangle rcClient = GetClientRectangle();
if (needUpdateUI) {
NotifyUpdateUI();
needUpdateUI = false;
+ RefreshStyleData();
+ RefreshPixMaps(surfaceWindow);
}
// Call priority lines wrap on a window of lines which are likely
// Printing supports only the line number margin.
int lineNumberIndex = -1;
for (int margin = 0; margin < ViewStyle::margins; margin++) {
- if ((!vsPrint.ms[margin].symbol) && (vsPrint.ms[margin].width > 0)) {
+ if ((vsPrint.ms[margin].style == SC_MARGIN_NUMBER) && (vsPrint.ms[margin].width > 0)) {
lineNumberIndex = margin;
} else {
vsPrint.ms[margin].width = 0;
// Don't show the selection when printing
vsPrint.selbackset = false;
vsPrint.selforeset = false;
+ vsPrint.selAlpha = SC_ALPHA_NOALPHA;
vsPrint.whitespaceBackgroundSet = false;
vsPrint.whitespaceForegroundSet = false;
vsPrint.showCaretLineBackground = false;
llc.Invalidate(LineLayout::llCheckTextAndStyle);
if (wrapState != eWrapNone) {
int lineDoc = pdoc->LineFromPosition(mh.position);
- if (mh.linesAdded <= 0) {
- AutoSurface surface(this);
- AutoLineLayout ll(llc, RetrieveLineLayout(lineDoc));
- if (surface && ll) {
- LayoutLine(lineDoc, surface, vs, ll, wrapWidth);
- if (cs.GetHeight(lineDoc) != ll->lines) {
- NeedWrapping(lineDoc - 1, lineDoc + 1);
- Redraw();
- }
- }
- } else {
- NeedWrapping(lineDoc, lineDoc + 1 + mh.linesAdded);
- }
+ int lines = Platform::Maximum(0, mh.linesAdded);
+ NeedWrapping(lineDoc, lineDoc + lines + 1);
}
}
}
InvalidateRange(mh.position, mh.position + mh.length);
}
}
+ llc.Invalidate(LineLayout::llCheckTextAndStyle);
} else {
// Move selection and brace highlights
if (mh.modificationType & SC_MOD_INSERTTEXT) {
text[size] = '\0';
}
}
- ss->Set(text, size + 1, pdoc->dbcsCodePage,
+ ss->Set(text, size + 1, pdoc->dbcsCodePage,
vs.styles[STYLE_DEFAULT].characterSet, selType == selRectangle);
}
}
void Editor::CopyText(int length, const char *text) {
SelectionText selectedText;
- selectedText.Copy(text, length,
+ selectedText.Copy(text, length + 1,
pdoc->dbcsCodePage, vs.styles[STYLE_DEFAULT].characterSet, false);
CopyToClipboard(selectedText);
}
}
void Editor::ButtonUp(Point pt, unsigned int curTime, bool ctrl) {
- //Platform::DebugPrintf("ButtonUp %d\n", HaveMouseCapture());
+ //Platform::DebugPrintf("ButtonUp %d\n", HaveMouseCapture());
if (HaveMouseCapture()) {
if (PointInSelMargin(pt)) {
DisplayCursor(Window::cursorReverseArrow);
bool idleDone;
- bool wrappingDone = (wrapState == eWrapNone) || (!backgroundWrapEnabled);
+ bool wrappingDone = wrapState == eWrapNone;
if (!wrappingDone) {
// Wrap lines during idle.
WrapLines(false, -1);
// No more wrapping
- if (docLineLastWrapped == docLastLineToWrap)
+ if (wrapStart == wrapEnd)
wrappingDone = true;
}
pdoc->SetDefaultCharClasses(false);
if (lParam == 0)
return 0;
- pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), Document::ccWord);
+ pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), CharClassify::ccWord);
}
break;
case SCI_SETWHITESPACECHARS: {
if (lParam == 0)
return 0;
- pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), Document::ccSpace);
+ pdoc->SetCharClasses(reinterpret_cast<unsigned char *>(lParam), CharClassify::ccSpace);
}
break;
return pdoc->ExtendWordSelect(wParam, 1, lParam != 0);
case SCI_SETWRAPMODE:
- switch(wParam){
- case SC_WRAP_WORD:
- wrapState = eWrapWord;
- break;
- case SC_WRAP_CHAR:
- wrapState = eWrapChar;
- break;
- default:
- wrapState = eWrapNone;
- break;
+ switch (wParam) {
+ case SC_WRAP_WORD:
+ wrapState = eWrapWord;
+ break;
+ case SC_WRAP_CHAR:
+ wrapState = eWrapChar;
+ break;
+ default:
+ wrapState = eWrapNone;
+ break;
}
xOffset = 0;
InvalidateStyleRedraw();
return pdoc->LineEnd(wParam);
case SCI_SETCODEPAGE:
- pdoc->dbcsCodePage = wParam;
- InvalidateStyleRedraw();
+ if (ValidCodePage(wParam)) {
+ pdoc->dbcsCodePage = wParam;
+ InvalidateStyleRedraw();
+ }
break;
case SCI_GETCODEPAGE:
InvalidateStyleData();
RedrawSelMargin();
break;
+ case SCI_MARKERSETALPHA:
+ if (wParam <= MARKER_MAX)
+ vs.markers[wParam].alpha = lParam;
+ InvalidateStyleRedraw();
+ break;
case SCI_MARKERADD: {
int markerID = pdoc->AddMark(wParam, lParam);
return markerID;
case SCI_SETMARGINTYPEN:
if (ValidMargin(wParam)) {
- vs.ms[wParam].symbol = (lParam == SC_MARGIN_SYMBOL);
+ vs.ms[wParam].style = lParam;
InvalidateStyleRedraw();
}
break;
case SCI_GETMARGINTYPEN:
if (ValidMargin(wParam))
- return vs.ms[wParam].symbol ? SC_MARGIN_SYMBOL : SC_MARGIN_NUMBER;
+ return vs.ms[wParam].style;
else
return 0;
vs.caretLineBackground.desired = wParam;
InvalidateStyleRedraw();
break;
+ case SCI_GETCARETLINEBACKALPHA:
+ return vs.caretLineAlpha;
+ case SCI_SETCARETLINEBACKALPHA:
+ vs.caretLineAlpha = wParam;
+ InvalidateStyleRedraw();
+ break;
// Folding messages
InvalidateStyleRedraw();
break;
+ case SCI_SETSELALPHA:
+ vs.selAlpha = wParam;
+ InvalidateStyleRedraw();
+ break;
+
+ case SCI_GETSELALPHA:
+ return vs.selAlpha;
+
case SCI_SETWHITESPACEFORE:
vs.whitespaceForegroundSet = wParam != 0;
vs.whitespaceForeground.desired = ColourDesired(lParam);
// Wrapping support
enum { eWrapNone, eWrapWord, eWrapChar } wrapState;
- bool backgroundWrapEnabled;
+ enum { wrapLineLarge = 0x7ffffff };
int wrapWidth;
- int docLineLastWrapped;
- int docLastLineToWrap;
+ int wrapStart;
+ int wrapEnd;
int wrapVisualFlags;
int wrapVisualFlagsLocation;
int wrapVisualStartIndent;
void InvalidateCaret();
virtual void UpdateSystemCaret();
- void NeedWrapping(int docLineStartWrapping = 0, int docLineEndWrapping = 0x7ffffff);
+ void NeedWrapping(int docLineStart = 0, int docLineEnd = wrapLineLarge);
bool WrapLines(bool fullWrap, int priorityWrapLineStart);
void LinesJoin();
void LinesSplit(int pixelWidth);
LineLayout *RetrieveLineLayout(int lineNumber);
void LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayout *ll,
int width=LineLayout::wrapWidthInfinite);
+ ColourAllocated SelectionBackground(ViewStyle &vsDraw);
ColourAllocated TextBackground(ViewStyle &vsDraw, bool overrideBackground, ColourAllocated background, bool inSelection, bool inHotspot, int styleMain, int i, LineLayout *ll);
void DrawIndentGuide(Surface *surface, int lineVisible, int lineHeight, int start, PRectangle rcSegment, bool highlight);
void DrawWrapMarker(Surface *surface, PRectangle rcPlace, bool isEndMarker, ColourAllocated wrapColour);
void GetHotSpotRange(int& hsStart, int& hsEnd);
int CodePage() const;
+ virtual bool ValidCodePage(int /* codePage */) const { return true; }
int WrapCount(int line);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) = 0;
#include "Platform.h"
+#include "Scintilla.h"
+
#include "SciLexer.h"
#include "PropSet.h"
#include "Accessor.h"
if (lib->IsValid()) {
m_sModuleName = ModuleName;
//Cannot use reinterpret_cast because: ANSI C++ forbids casting between pointers to functions and objects
- GetLexerCountFn GetLexerCount = (GetLexerCountFn)lib->FindFunction("GetLexerCount");
+ GetLexerCountFn GetLexerCount = (GetLexerCountFn)(sptr_t)lib->FindFunction("GetLexerCount");
if (GetLexerCount) {
ExternalLexerModule *lex;
LexerMinder *lm;
// Find functions in the DLL
- GetLexerNameFn GetLexerName = (GetLexerNameFn)lib->FindFunction("GetLexerName");
- ExtLexerFunction Lexer = (ExtLexerFunction)lib->FindFunction("Lex");
- ExtFoldFunction Folder = (ExtFoldFunction)lib->FindFunction("Fold");
+ GetLexerNameFn GetLexerName = (GetLexerNameFn)(sptr_t)lib->FindFunction("GetLexerName");
+ ExtLexerFunction Lexer = (ExtLexerFunction)(sptr_t)lib->FindFunction("Lex");
+ ExtFoldFunction Folder = (ExtFoldFunction)(sptr_t)lib->FindFunction("Fold");
// Assign a buffer for the lexer name.
char lexname[100];
surface->LineTo(rc.right, rcLine.top+1);
surface->LineTo(rc.left, rcLine.top+1);
surface->LineTo(rc.left, ymid+1);
+ } else if (style == INDIC_ROUNDBOX) {
+ PRectangle rcBox = rcLine;
+ rcBox.top = rcLine.top + 1;
+ rcBox.left = rc.left;
+ rcBox.right = rc.right;
+ surface->AlphaRectangle(rcBox, 1, fore.allocated, 30, fore.allocated, 50, 0);
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid);
LINK_LEXER(lmGui4Cli);
LINK_LEXER(lmHaskell);
LINK_LEXER(lmHTML);
+ LINK_LEXER(lmInno);
LINK_LEXER(lmKix);
LINK_LEXER(lmLatex);
LINK_LEXER(lmLISP);
LINK_LEXER(lmNsis);
LINK_LEXER(lmNull);
LINK_LEXER(lmOctave);
+ LINK_LEXER(lmOpal);
LINK_LEXER(lmPascal);
LINK_LEXER(lmPB);
LINK_LEXER(lmPerl);
LINK_LEXER(lmScriptol);
LINK_LEXER(lmSmalltalk);
LINK_LEXER(lmSpecman);
+ LINK_LEXER(lmSpice);
LINK_LEXER(lmSQL);
LINK_LEXER(lmTADS3);
LINK_LEXER(lmTCL);
// May 23, 2005 - Fixed the SentKey lexing in case of a missing }
// Aug 11, 2005 - Fixed possible bug with s_save length > 100.
// Aug 23, 2005 - Added Switch/endswitch support to the folding logic.
+// Sep 27, 2005 - Fixed the SentKey lexing logic in case of multiple sentkeys.
+// Mar 12, 2006 - Fixed issue with <> coloring as String in stead of Operator in rare occasions.
+// Apr 8, 2006 - Added support for AutoIt3 Standard UDF library (SCE_AU3_UDF)
//
// 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.
static int GetSendKey(const char *szLine, char *szKey)
{
int nFlag = 0;
+ int nStartFound = 0;
int nKeyPos = 0;
int nSpecPos= 0;
int nSpecNum= 1;
// split the portion of the sendkey in the part before and after the spaces
while ( ( (cTemp = szLine[nPos]) != '\0'))
{
- // skip leading Ctrl/Shift/ALt state
- if ((cTemp == '#' || 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.
- szKey[nKeyPos++] = '}';
- }
- else if (cTemp == ' ')
- {
- // skip other spaces
+ // skip leading Ctrl/Shift/Alt state
+ if (cTemp == '{') {
+ nStartFound = 1;
}
- else if (nFlag == 0)
- {
- // save first portion into var till space or } is hit
- szKey[nKeyPos++] = cTemp;
- }
- else if ((nFlag == 1) && (cTemp != '}'))
- {
- // Save second portion into var...
- szSpecial[nSpecPos++] = cTemp;
- // check if Second portion is all numbers for repeat fuction
- if (isdigit(cTemp) == false) {nSpecNum = 0;}
+ //
+ if (nStartFound == 1) {
+ if ((cTemp == ' ') && (nFlag == 0) ) // get the stuff till first space
+ {
+ nFlag = 1;
+ // Add } to the end of the first bit for table lookup later.
+ szKey[nKeyPos++] = '}';
+ }
+ else if (cTemp == ' ')
+ {
+ // skip other spaces
+ }
+ else if (nFlag == 0)
+ {
+ // save first portion into var till space or } is hit
+ szKey[nKeyPos++] = cTemp;
+ }
+ else if ((nFlag == 1) && (cTemp != '}'))
+ {
+ // Save second portion into var...
+ szSpecial[nSpecPos++] = cTemp;
+ // check if Second portion is all numbers for repeat fuction
+ if (isdigit(cTemp) == false) {nSpecNum = 0;}
+ }
}
nPos++; // skip to next char
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
+ WordList &keywords8 = *keywordlists[7];
// find the first previous line without continuation character at the end
int lineCurrent = styler.GetLine(startPos);
int s_startPos = startPos;
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_DEFAULT);
}
+ else if (keywords8.InList(s)) {
+ sc.ChangeState(SCE_AU3_UDF);
+ sc.SetState(SCE_AU3_DEFAULT);
+ }
else if (strcmp(s, "_") == 0) {
sc.ChangeState(SCE_AU3_OPERATOR);
sc.SetState(SCE_AU3_DEFAULT);
if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\'') || (si == 3 && sc.ch == '>'))
{
sc.ForwardSetState(SCE_AU3_DEFAULT);
+ si=0;
}
if (sc.atLineEnd)
{
+ si=0;
// at line end and not found a continuation char then reset to default
int lineCurrent = styler.GetLine(sc.currentPos);
if (!IsContinuationLine(lineCurrent,styler))
}
}
// find Sendkeys in a STRING
- if (sc.ch == '{') {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);}
- if (sc.ch == '#' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
+ if (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ) {
+ sc.SetState(SCE_AU3_SENT);}
break;
}
}
sc.SetState(SCE_AU3_STRING);
}
+ else
+ {
+ // check if the start is a valid SendKey start
+ int nPos = 0;
+ int nState = 1;
+ char cTemp;
+ while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
+ {
+ if (cTemp == '{' && nState == 1)
+ {
+ nState = 2;
+ }
+ if (nState == 1 && !(cTemp == '+' || cTemp == '!' || cTemp == '^' || cTemp == '#' ))
+ {
+ nState = 0;
+ }
+ nPos++;
+ }
+ //Verify characters infront of { ... if not assume regular string
+ if (nState == 1 && (!(sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' ))) {
+ sc.ChangeState(SCE_AU3_STRING);
+ sc.SetState(SCE_AU3_STRING);
+ }
+ // If invalid character found then assume its a regular string
+ if (nState == 0) {
+ sc.ChangeState(SCE_AU3_STRING);
+ sc.SetState(SCE_AU3_STRING);
+ }
+ }
// check if next portion is again a sendkey
if (sc.atLineEnd)
{
sc.SetState(SCE_AU3_DEFAULT);
si = 0; // reset string indicator
}
- //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);}
- if (sc.ch == '#' && sc.chNext == '{') {sc.SetState(SCE_AU3_SENT);}
+ //* check in next characters following a sentkey are again a sent key
+ // Need this test incase of 2 sentkeys like {F1}{ENTER} but not detect {{}
+ if (sc.state == SCE_AU3_STRING && (sc.ch == '{' || sc.ch == '+' || sc.ch == '!' || sc.ch == '^' || sc.ch == '#' )) {
+ sc.SetState(SCE_AU3_SENT);}
// check to see if the string ended...
- // Sentkey string isn't complete but the string ended....
+ // Sendkey string isn't complete but the string ended....
if ((si == 1 && sc.ch == '\"') || (si == 2 && sc.ch == '\''))
{
sc.ChangeState(SCE_AU3_STRING);
else if (sc.ch == '$') {sc.SetState(SCE_AU3_VARIABLE);}
else if (sc.ch == '.' && !IsADigit(sc.chNext)) {sc.SetState(SCE_AU3_OPERATOR);}
else if (sc.ch == '@') {sc.SetState(SCE_AU3_KEYWORD);}
+ //else if (sc.ch == '_') {sc.SetState(SCE_AU3_KEYWORD);}
else if (sc.ch == '<' && si==3) {sc.SetState(SCE_AU3_STRING);} // string after #include
else if (sc.ch == '\"') {
sc.SetState(SCE_AU3_STRING);
sc.ChangeState(SCE_AU3_EXPAND);
sc.SetState(SCE_AU3_EXPAND);
}
+ else if (keywords8.InList(s_save)) {
+ sc.ChangeState(SCE_AU3_UDF);
+ sc.SetState(SCE_AU3_UDF);
+ }
else {
sc.ChangeState(SCE_AU3_DEFAULT);
sc.SetState(SCE_AU3_DEFAULT);
"#autoit Pre-processors",
"#autoit Special",
"#autoit Expand",
+ "#autoit UDF",
0
};
LexerModule lmAU3(SCLEX_AU3, ColouriseAU3Doc, "au3", FoldAU3Doc , AU3WordLists);
if (state == SCE_SH_DEFAULT) {
if (ch == '\\') { // escaped character
- i++;
+ if (i < lengthDoc - 1)
+ i++;
ch = chNext;
chNext = chNext2;
styler.ColourTo(i, SCE_SH_IDENTIFIER);
&& !IsCommentLine(lineCurrent+1, styler))
levelCurrent--;
}
- if (style == SCE_C_OPERATOR) {
+ if (style == SCE_SH_OPERATOR) {
if (ch == '{') {
levelCurrent++;
} else if (ch == '}') {
sc.ChangeState(SCE_B_ERROR);
sc.SetState(SCE_B_DEFAULT);
}
- } else if (sc.state == SCE_B_COMMENT) {
+ } else if (sc.state == SCE_B_COMMENT || sc.state == SCE_B_PREPROCESSOR) {
if (sc.atLineEnd) {
sc.SetState(SCE_B_DEFAULT);
}
wasfirst = isfirst;
sc.SetState(SCE_B_IDENTIFIER);
} else if (sc.Match(comment_char)) {
- sc.SetState(SCE_B_COMMENT);
+ // Hack to make deprecated QBASIC '$Include show
+ // up in freebasic with SCE_B_PREPROCESSOR.
+ if (comment_char == '\'' && sc.Match(comment_char, '$'))
+ sc.SetState(SCE_B_PREPROCESSOR);
+ else
+ sc.SetState(SCE_B_COMMENT);
} else if (sc.Match('"')) {
sc.SetState(SCE_B_STRING);
} else if (IsDigit(sc.ch)) {
LexerModule lmCPP(SCLEX_CPP, ColouriseCppDocSensitive, "cpp", FoldCppDoc, cppWordLists);
LexerModule lmCPPNoCase(SCLEX_CPPNOCASE, ColouriseCppDocInsensitive, "cppnocase", FoldCppDoc, cppWordLists);
-LexerModule lmTCL(SCLEX_TCL, ColouriseCppDocSensitive, "tcl", FoldCppDoc, cppWordLists);
}
static inline bool IsAWordChar(unsigned int ch) {
- return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
+ return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
static inline bool IsAWordStart(unsigned int ch) {
case SCE_HB_STRING:
case SCE_HBA_STRING:
case SCE_HP_STRING:
+ case SCE_HP_CHARACTER:
+ case SCE_HP_TRIPLE:
+ case SCE_HP_TRIPLEDOUBLE:
case SCE_HPA_STRING:
+ case SCE_HPA_CHARACTER:
+ case SCE_HPA_TRIPLE:
+ case SCE_HPA_TRIPLEDOUBLE:
case SCE_HPHP_HSTRING:
case SCE_HPHP_SIMPLESTRING:
case SCE_HPHP_HSTRING_VARIABLE:
return bResult;
}
+static inline bool stateAllowsTermination(int state) {
+ bool allowTermination = !isStringState(state);
+ if (allowTermination) {
+ switch (state) {
+ case SCE_HPHP_COMMENT:
+ case SCE_HP_COMMENTLINE:
+ case SCE_HPA_COMMENTLINE:
+ allowTermination = false;
+ }
+ }
+ return allowTermination;
+}
+
// not really well done, since it's only comments that should lex the %> and <%
static inline bool isCommentASPState(int state) {
bool bResult;
(ch == '<') &&
(chNext == '?') &&
!IsScriptCommentState(state) ) {
- scriptLanguage = segIsScriptingIndicator(styler, styler.GetStartSegment() + 2, i + 10, eScriptPHP);
+ scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 10, eScriptPHP);
if (scriptLanguage != eScriptPHP && isStringState(state)) continue;
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
else if ((
((inScriptType == eNonHtmlPreProc)
|| (inScriptType == eNonHtmlScriptPreProc)) && (
- ((scriptLanguage == eScriptPHP) && (ch == '?') && !isPHPStringState(state) && (state != SCE_HPHP_COMMENT)) ||
- ((scriptLanguage != eScriptNone) && !isStringState(state) &&
- ((ch == '%') || (ch == '?')))
+ ((scriptLanguage != eScriptNone) && stateAllowsTermination(state) && ((ch == '%') || (ch == '?')))
) && (chNext == '>')) ||
((scriptLanguage == eScriptSGML) && (ch == '>') && (state != SCE_H_SGML_COMMENT))) {
if (state == SCE_H_ASPAT) {
--- /dev/null
+// Scintilla source code edit control
+/** @file LexInno.cxx
+ ** Lexer for Inno Setup scripts.
+ **/
+// Written by Friedrich Vedder <fvedd@t-online.de>, using code from LexOthers.cxx.
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <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 void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler) {
+ int state = SCE_INNO_DEFAULT;
+ char chPrev;
+ char ch = 0;
+ char chNext = styler[startPos];
+ int lengthDoc = startPos + length;
+ char *buffer = new char[length];
+ int bufferCount = 0;
+ bool isBOL, isEOL, isWS, isBOLWS = 0;
+
+ WordList §ionKeywords = *keywordLists[0];
+ WordList &standardKeywords = *keywordLists[1];
+ WordList ¶meterKeywords = *keywordLists[2];
+ WordList &preprocessorKeywords = *keywordLists[3];
+ WordList &pascalKeywords = *keywordLists[4];
+ WordList &userKeywords = *keywordLists[5];
+
+ // Go through all provided text segment
+ // using the hand-written state machine shown below
+ styler.StartAt(startPos);
+ styler.StartSegment(startPos);
+ for (int i = startPos; i < lengthDoc; i++) {
+ chPrev = ch;
+ ch = chNext;
+ chNext = styler.SafeGetCharAt(i + 1);
+
+ if (styler.IsLeadByte(ch)) {
+ chNext = styler.SafeGetCharAt(i + 2);
+ i++;
+ continue;
+ }
+
+ isBOL = (chPrev == 0) || (chPrev == '\n') || (chPrev == '\r' && ch != '\n');
+ isBOLWS = (isBOL) ? 1 : (isBOLWS && (chPrev == ' ' || chPrev == '\t'));
+ isEOL = (ch == '\n' || ch == '\r');
+ isWS = (ch == ' ' || ch == '\t');
+
+ switch(state) {
+ case SCE_INNO_DEFAULT:
+ if (ch == ';' && isBOLWS) {
+ // Start of a comment
+ state = SCE_INNO_COMMENT;
+ } else if (ch == '[' && isBOLWS) {
+ // Start of a section name
+ bufferCount = 0;
+ state = SCE_INNO_SECTION;
+ } else if (ch == '#' && isBOLWS) {
+ // Start of a preprocessor directive
+ state = SCE_INNO_PREPROC;
+ } else if (ch == '{' && chNext == '#') {
+ // Start of a preprocessor inline directive
+ state = SCE_INNO_PREPROC_INLINE;
+ } else if ((ch == '{' && (chNext == ' ' || chNext == '\t'))
+ || (ch == '(' && chNext == '*')) {
+ // Start of a Pascal comment
+ state = SCE_INNO_COMMENT_PASCAL;
+ } else if (ch == '"') {
+ // Start of a double-quote string
+ state = SCE_INNO_STRING_DOUBLE;
+ } else if (ch == '\'') {
+ // Start of a single-quote string
+ state = SCE_INNO_STRING_SINGLE;
+ } else if (isascii(ch) && (isalpha(ch) || (ch == '_'))) {
+ // Start of an identifier
+ bufferCount = 0;
+ buffer[bufferCount++] = static_cast<char>(tolower(ch));
+ state = SCE_INNO_IDENTIFIER;
+ } else {
+ // Style it the default style
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_COMMENT:
+ if (isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_COMMENT);
+ }
+ break;
+
+ case SCE_INNO_IDENTIFIER:
+ if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
+ buffer[bufferCount++] = static_cast<char>(tolower(ch));
+ } else {
+ state = SCE_INNO_DEFAULT;
+ buffer[bufferCount] = '\0';
+
+ // Check if the buffer contains a keyword
+ if (standardKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_KEYWORD);
+ } else if (parameterKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_PARAMETER);
+ } else if (pascalKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_KEYWORD_PASCAL);
+ } else if (userKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_KEYWORD_USER);
+ } else {
+ styler.ColourTo(i-1,SCE_INNO_DEFAULT);
+ }
+
+ // Push back the faulty character
+ chNext = styler[i--];
+ ch = chPrev;
+ }
+ break;
+
+ case SCE_INNO_SECTION:
+ if (ch == ']') {
+ state = SCE_INNO_DEFAULT;
+ buffer[bufferCount] = '\0';
+
+ // Check if the buffer contains a section name
+ if (sectionKeywords.InList(buffer)) {
+ styler.ColourTo(i,SCE_INNO_SECTION);
+ } else {
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ } else if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
+ buffer[bufferCount++] = static_cast<char>(tolower(ch));
+ } else {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_PREPROC:
+ if (isWS || isEOL) {
+ if (isascii(chPrev) && isalpha(chPrev)) {
+ state = SCE_INNO_DEFAULT;
+ buffer[bufferCount] = '\0';
+
+ // Check if the buffer contains a preprocessor directive
+ if (preprocessorKeywords.InList(buffer)) {
+ styler.ColourTo(i-1,SCE_INNO_PREPROC);
+ } else {
+ styler.ColourTo(i-1,SCE_INNO_DEFAULT);
+ }
+
+ // Push back the faulty character
+ chNext = styler[i--];
+ ch = chPrev;
+ }
+ } else if (isascii(ch) && isalpha(ch)) {
+ if (chPrev == '#' || chPrev == ' ' || chPrev == '\t')
+ bufferCount = 0;
+ buffer[bufferCount++] = static_cast<char>(tolower(ch));
+ }
+ break;
+
+ case SCE_INNO_STRING_DOUBLE:
+ if (ch == '"' || isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_STRING_SINGLE:
+ if (ch == '\'' || isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_PREPROC_INLINE:
+ if (ch == '}') {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_PREPROC_INLINE);
+ } else if (isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ case SCE_INNO_COMMENT_PASCAL:
+ if (ch == '}' || (ch == ')' && chPrev == '*')) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_COMMENT_PASCAL);
+ } else if (isEOL) {
+ state = SCE_INNO_DEFAULT;
+ styler.ColourTo(i,SCE_INNO_DEFAULT);
+ }
+ break;
+
+ }
+ }
+ delete []buffer;
+}
+
+static const char * const innoWordListDesc[] = {
+ "Sections",
+ "Keywords",
+ "Parameters",
+ "Preprocessor directives",
+ "Pascal keywords",
+ "User defined keywords",
+ 0
+};
+
+static void FoldInnoDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
+ bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+
+ unsigned int endPos = startPos + length;
+ int visibleChars = 0;
+ int lineCurrent = styler.GetLine(startPos);
+
+ char chNext = styler[startPos];
+ int styleNext = styler.StyleAt(startPos);
+ bool headerPoint = false;
+ int lev;
+
+ for (unsigned int i = startPos; i < endPos; i++) {
+ char ch = chNext;
+ chNext = styler[i+1];
+
+ int style = styleNext;
+ styleNext = styler.StyleAt(i + 1);
+ bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
+
+ if (style == SCE_INNO_SECTION)
+ headerPoint = true;
+
+ if (atEOL) {
+ lev = SC_FOLDLEVELBASE;
+
+ if (lineCurrent > 0) {
+ int levelPrevious = styler.LevelAt(lineCurrent - 1);
+
+ if (levelPrevious & SC_FOLDLEVELHEADERFLAG)
+ lev = SC_FOLDLEVELBASE + 1;
+ else
+ lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
+ }
+
+ if (headerPoint)
+ lev = SC_FOLDLEVELBASE;
+
+ if (visibleChars == 0 && foldCompact)
+ lev |= SC_FOLDLEVELWHITEFLAG;
+
+ if (headerPoint)
+ lev |= SC_FOLDLEVELHEADERFLAG;
+
+ if (lev != styler.LevelAt(lineCurrent))
+ styler.SetLevel(lineCurrent, lev);
+
+ lineCurrent++;
+ visibleChars = 0;
+ headerPoint = false;
+ }
+ if (!isspacechar(ch))
+ visibleChars++;
+ }
+
+ if (lineCurrent > 0) {
+ int levelPrevious = styler.LevelAt(lineCurrent - 1);
+
+ if (levelPrevious & SC_FOLDLEVELHEADERFLAG)
+ lev = SC_FOLDLEVELBASE + 1;
+ else
+ lev = levelPrevious & SC_FOLDLEVELNUMBERMASK;
+ } else {
+ lev = SC_FOLDLEVELBASE;
+ }
+ int flagsNext = styler.LevelAt(lineCurrent);
+ styler.SetLevel(lineCurrent, lev | flagsNext & ~SC_FOLDLEVELNUMBERMASK);
+}
+
+LexerModule lmInno(SCLEX_INNOSETUP, ColouriseInnoDoc, "inno", FoldInnoDoc, innoWordListDesc);
// but probably enough in most cases.
return (ch < 0x80) &&
(isdigit(ch) || toupper(ch) == 'E' ||
- ch == '.' || ch == '-' || ch == '+');
+ ch == '.' || ch == '-' || ch == '+' ||
+ (ch >= 'a' && ch <= 'f') || (ch >= 'A' && ch <= 'F'));
}
static inline bool IsLuaOperator(int ch) {
ch == '{' || ch == '}' || ch == '~' ||
ch == '[' || ch == ']' || ch == ';' ||
ch == '<' || ch == '>' || ch == ',' ||
- ch == '.' || ch == '^' || ch == '%' || ch == ':') {
+ ch == '.' || ch == '^' || ch == '%' || ch == ':' ||
+ ch == '#') {
return true;
}
return false;
if (sc.state == SCE_LUA_OPERATOR) {
sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.state == SCE_LUA_NUMBER) {
- // We stop the number definition on non-numerical non-dot non-eE non-sign char
+ // We stop the number definition on non-numerical non-dot non-eE non-sign non-hexdigit char
if (!IsANumberChar(sc.ch)) {
sc.SetState(SCE_LUA_DEFAULT);
}
if (sc.state == SCE_LUA_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_LUA_NUMBER);
+ if (sc.ch == '0' && toupper(sc.chNext) == 'X') {
+ sc.Forward(1);
+ }
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_LUA_IDENTIFIER);
} else if (sc.ch == '\"') {
** Lexer for MSSQL.
**/
// By Filip Yaghob <fyaghob@gmail.com>
-
+// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
--- /dev/null
+// Scintilla source code edit control
+/** @file LexOpal.cxx
+ ** Lexer for OPAL (functional language similar to Haskell)
+ ** Written by Sebastian Pipping <webmaster@hartwork.org>
+ **/
+
+#include <stdlib.h>
+#include <string.h>
+#include <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"
+
+inline static void getRange( unsigned int start, unsigned int end, Accessor & styler, char * s, unsigned int len )
+{
+ unsigned int i = 0;
+ while( ( i < end - start + 1 ) && ( i < len - 1 ) )
+ {
+ s[i] = static_cast<char>( styler[ start + i ] );
+ i++;
+ }
+ s[ i ] = '\0';
+}
+
+inline bool HandleString( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+{
+ char ch;
+
+ // Wait for string to close
+ bool even_backslash_count = true; // Without gaps in between
+ cur++; // Skip initial quote
+ for( ; ; )
+ {
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_STRING );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( ( ch == '\015' ) || ( ch == '\012' ) ) // Deny multi-line strings
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_STRING );
+ styler.StartSegment( cur );
+ return true;
+ }
+ else
+ {
+ if( even_backslash_count )
+ {
+ if( ch == '"' )
+ {
+ styler.ColourTo( cur, SCE_OPAL_STRING );
+ cur++;
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else if( ch == '\\' )
+ {
+ even_backslash_count = false;
+ }
+ }
+ else
+ {
+ even_backslash_count = true;
+ }
+ }
+
+ cur++;
+ }
+}
+
+inline bool HandleCommentBlock( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
+{
+ char ch;
+
+ if( could_fail )
+ {
+ cur++;
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( ch != '*' )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+
+ // Wait for comment close
+ cur++;
+ bool star_found = false;
+ for( ; ; )
+ {
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_BLOCK );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( star_found )
+ {
+ if( ch == '/' )
+ {
+ styler.ColourTo( cur, SCE_OPAL_COMMENT_BLOCK );
+ cur++;
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else if( ch != '*' )
+ {
+ star_found = false;
+ }
+ }
+ else if( ch == '*' )
+ {
+ star_found = true;
+ }
+ cur++;
+ }
+}
+
+inline bool HandleCommentLine( unsigned int & cur, unsigned int one_too_much, Accessor & styler, bool could_fail )
+{
+ char ch;
+
+ if( could_fail )
+ {
+ cur++;
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( ch != '-' )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ styler.StartSegment( cur );
+ return true;
+ }
+
+ cur++;
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( ( ch != ' ' ) && ( ch != '\t' ) )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+
+ // Wait for end of line
+ bool fifteen_found = false;
+
+ for( ; ; )
+ {
+ cur++;
+
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( fifteen_found )
+ {
+/*
+ if( ch == '\012' )
+ {
+ // One newline on Windows (015, 012)
+ }
+ else
+ {
+ // One newline on MAC (015) and another char
+ }
+*/
+ cur--;
+ styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
+ styler.StartSegment( cur );
+ return true;
+ }
+ else
+ {
+ if( ch == '\015' )
+ {
+ fifteen_found = true;
+ }
+ else if( ch == '\012' )
+ {
+ // One newline on Linux (012)
+ styler.ColourTo( cur - 1, SCE_OPAL_COMMENT_LINE );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ }
+}
+
+inline bool HandlePar( unsigned int & cur, Accessor & styler )
+{
+ styler.ColourTo( cur, SCE_OPAL_PAR );
+
+ cur++;
+
+ styler.StartSegment( cur );
+ return true;
+}
+
+inline bool HandleSpace( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+{
+ char ch;
+
+ cur++;
+ for( ; ; )
+ {
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
+ return false;
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ switch( ch )
+ {
+ case ' ':
+ case '\t':
+ case '\015':
+ case '\012':
+ cur++;
+ break;
+
+ default:
+ styler.ColourTo( cur - 1, SCE_OPAL_SPACE );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+}
+
+inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+{
+ char ch;
+
+ for( ; ; )
+ {
+ cur++;
+ if( cur >= one_too_much )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
+ return false; // STOP
+ }
+
+ ch = styler.SafeGetCharAt( cur );
+ if( !isdigit( ch ) )
+ {
+ styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+}
+
+inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor & styler, WordList * keywordlists[] )
+{
+ char ch;
+ const unsigned int beg = cur;
+
+ cur++;
+ for( ; ; )
+ {
+ ch = styler.SafeGetCharAt( cur );
+ if( ( ch != '_' ) && ( ch != '-' ) &&
+ !islower( ch ) && !isupper( ch ) && !isdigit( ch ) ) break;
+
+ cur++;
+ if( cur >= one_too_much )
+ {
+ break;
+ }
+ }
+
+ const int ide_len = cur - beg + 1;
+ char * ide = new char[ ide_len ];
+ getRange( beg, cur, styler, ide, ide_len );
+
+ WordList & keywords = *keywordlists[ 0 ];
+ WordList & classwords = *keywordlists[ 1 ];
+
+ if( keywords.InList( ide ) ) // Keyword
+ {
+ delete [] ide;
+
+ styler.ColourTo( cur - 1, SCE_OPAL_KEYWORD );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else if( classwords.InList( ide ) ) // Sort
+ {
+ delete [] ide;
+
+ styler.ColourTo( cur - 1, SCE_OPAL_SORT );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else if( !strcmp( ide, "true" ) || !strcmp( ide, "false" ) ) // Bool const
+ {
+ delete [] ide;
+
+ styler.ColourTo( cur - 1, SCE_OPAL_BOOL_CONST );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+ else // Unknown keyword
+ {
+ delete [] ide;
+
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+ }
+
+}
+
+inline bool HandleSkip( unsigned int & cur, unsigned int one_too_much, Accessor & styler )
+{
+ cur++;
+ styler.ColourTo( cur - 1, SCE_OPAL_DEFAULT );
+ if( cur >= one_too_much )
+ {
+ return false; // STOP
+ }
+ else
+ {
+ styler.StartSegment( cur );
+ return true;
+ }
+}
+
+static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor & styler )
+{
+ styler.StartAt( startPos );
+ styler.StartSegment( startPos );
+
+ unsigned int & cur = startPos;
+ const unsigned int one_too_much = startPos + length;
+
+ int state = initStyle;
+
+ for( ; ; )
+ {
+ switch( state )
+ {
+ case SCE_OPAL_KEYWORD:
+ case SCE_OPAL_SORT:
+ if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ case SCE_OPAL_INTEGER:
+ if( !HandleInteger( cur, one_too_much, styler ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ case SCE_OPAL_COMMENT_BLOCK:
+ if( !HandleCommentBlock( cur, one_too_much, styler, false ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ case SCE_OPAL_COMMENT_LINE:
+ if( !HandleCommentLine( cur, one_too_much, styler, false ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ case SCE_OPAL_STRING:
+ if( !HandleString( cur, one_too_much, styler ) ) return;
+ state = SCE_OPAL_DEFAULT;
+ break;
+
+ default: // SCE_OPAL_DEFAULT:
+ {
+ char ch = styler.SafeGetCharAt( cur );
+
+ switch( ch )
+ {
+ // String
+ case '"':
+ if( !HandleString( cur, one_too_much, styler ) ) return;
+ break;
+
+ // Comment block
+ case '/':
+ if( !HandleCommentBlock( cur, one_too_much, styler, true ) ) return;
+ break;
+
+ // Comment line
+ case '-':
+ if( !HandleCommentLine( cur, one_too_much, styler, true ) ) return;
+ break;
+
+ // Par
+ case '(':
+ case ')':
+ case '[':
+ case ']':
+ case '{':
+ case '}':
+ if( !HandlePar( cur, styler ) ) return;
+ break;
+
+ // Whitespace
+ case ' ':
+ case '\t':
+ case '\015':
+ case '\012':
+ if( !HandleSpace( cur, one_too_much, styler ) ) return;
+ break;
+
+ default:
+ {
+ // Integer
+ if( isdigit( ch ) )
+ {
+ if( !HandleInteger( cur, one_too_much, styler ) ) return;
+ }
+
+ // Keyword
+ else if( islower( ch ) || isupper( ch ) )
+ {
+ if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;
+
+ }
+
+ // Skip
+ else
+ {
+ if( !HandleSkip( cur, one_too_much, styler ) ) return;
+ }
+ }
+ }
+
+ break;
+ }
+ }
+ }
+}
+
+static const char * const opalWordListDesc[] = {
+ "Keywords",
+ "Sorts",
+ 0
+};
+
+LexerModule lmOpal(SCLEX_OPAL, ColouriseOpalDoc, "opal", NULL, opalWordListDesc);
// Tests for BATCH Separators
static bool IsBSeparator(char ch) {
- return (ch == ':') || (ch == '\\') || (ch == '.') || (ch == ';') ||
+ return (ch == '\\') || (ch == '.') || (ch == ';') ||
(ch == '\"') || (ch == '\'') || (ch == '/') || (ch == ')');
}
unsigned int lengthLine,
unsigned int startLine,
unsigned int endPos,
- WordList &keywords,
+ WordList *keywordlists[],
Accessor &styler) {
unsigned int offset = 0; // Line Buffer Offset
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
+ WordList &keywords = *keywordlists[0]; // Internal Commands
+ WordList &keywords2 = *keywordlists[1]; // External Commands (optional)
+
// CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords
// Toggling Regular Keyword Checking off improves readability
// Other Regular Keywords and External Commands / Programs might also benefit from toggling
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Colorize External Command / Program
- styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ if (!keywords2) {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ } else if (keywords2.InList(wordBuffer)) {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ } else {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
+ }
// Reset External Command / Program Location
cmdLoc = offset;
} else {
// 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) ||
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;
}
}
}
- // Colorize External command / program
- styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ // Colorize External Command / Program
+ if (!keywords2) {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ } else if (keywords2.InList(wordBuffer)) {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
+ } else {
+ styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
+ }
// No need to Reset Offset
// Check for Default Text
} else {
// 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) &&
+ } else if (
(wordBuffer[1] == '%') &&
(wordBuffer[2] != '%') &&
(!IsBOperator(wordBuffer[2])) &&
Accessor &styler) {
char lineBuffer[1024];
- WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
styler.StartSegment(startPos);
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0';
- ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywords, styler);
+ ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0) { // Last line does not have ending characters
ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
- keywords, styler);
+ keywordlists, styler);
}
}
while ((i < lengthLine) && (lineBuffer[i] != '='))
i++;
if ((i < lengthLine) && (lineBuffer[i] == '=')) {
- styler.ColourTo(startLine + i - 1, SCE_PROPS_DEFAULT);
- styler.ColourTo(startLine + i, 3);
+ styler.ColourTo(startLine + i - 1, SCE_PROPS_KEY);
+ styler.ColourTo(startLine + i, SCE_PROPS_ASSIGNMENT);
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
} else {
styler.ColourTo(endPos, SCE_PROPS_DEFAULT);
// CTags: \t<message>
// Lua 5 traceback: \t<filename>:<line>:<message>
bool initialTab = (lineBuffer[0] == '\t');
- enum { stInitial,
+ enum { stInitial,
stGccStart, stGccDigit, stGcc,
stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
stCtagsStart, stCtagsStartString, stCtagsStringDollar, stCtags,
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") ||
+ if (!CompareCaseInsensitive(word, "error") || !CompareCaseInsensitive(word, "warning") ||
+ !CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") ||
!CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {
state = stMsVc;
} else
}
static const char * const batchWordListDesc[] = {
- "Keywords",
+ "Internal Commands",
+ "External Commands",
0
};
} else if (sc.state == SCE_P_DECORATOR) {
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_P_DEFAULT);
+ } else if (sc.ch == '#') {
+ sc.SetState((sc.chNext == '#') ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
}
} else if ((sc.state == SCE_P_STRING) || (sc.state == SCE_P_CHARACTER)) {
if (sc.ch == '\\') {
ch == '.' || ch == '-' || ch == '+');
}
-
static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
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 styleBeforeDCKeyword = SCE_SQL_DEFAULT;
for (; sc.More(); sc.Forward()) {
- // Fold based on indentation
- if (sc.atLineStart) {
- int spaceFlags = 0;
- int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags);
- 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)) {
- level |= SC_FOLDLEVELHEADERFLAG;
- }
- }
- if (fold) {
- styler.SetLevel(lineCurrent, level);
- }
- }
-
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_SQL_OPERATOR:
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
+ bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
+
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;
+ levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
}
int levelNext = levelCurrent;
char chNext = styler[startPos];
} else {
s[j] = '\0';
}
- if (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0) {
+ if ((!foldOnlyBegin) && (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0)) {
if (endFound) {
// ignore
endFound = false;
}
}
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);
+ int levelUse = levelCurrent;
+ int lev = levelUse | levelNext << 16;
+ if (visibleChars == 0 && foldCompact)
+ lev |= SC_FOLDLEVELWHITEFLAG;
+ if (levelUse < levelNext)
+ lev |= SC_FOLDLEVELHEADERFLAG;
+ if (lev != styler.LevelAt(lineCurrent)) {
+ styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelCurrent = levelNext;
--- /dev/null
+// Scintilla source code edit control
+/** @file LexSpice.cxx
+ ** Lexer for Spice
+ **/
+// Copyright 2006 by Fabien Proriol
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <ctype.h>
+#include <string.h>
+#include <stdio.h>
+
+#include "Platform.h"
+
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "PropSet.h"
+#include "KeyWords.h"
+#include "SciLexer.h"
+#include "SString.h"
+
+/*
+ * Interface
+ */
+
+static void ColouriseDocument(
+ unsigned int startPos,
+ int length,
+ int initStyle,
+ WordList *keywordlists[],
+ Accessor &styler);
+
+static const char * const spiceWordListDesc[] = {
+ "Keywords", // SPICE command
+ "Keywords2", // SPICE functions
+ "Keywords3", // SPICE params
+ 0
+};
+
+LexerModule lmSpice(SCLEX_SPICE, ColouriseDocument, "spice", NULL, spiceWordListDesc);
+
+/*
+ * Implementation
+ */
+
+static void ColouriseComment(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribute);
+static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute);
+
+static inline bool IsDelimiterCharacter(int ch);
+static inline bool IsNumberStartCharacter(int ch);
+static inline bool IsNumberCharacter(int ch);
+static inline bool IsSeparatorOrDelimiterCharacter(int ch);
+static inline bool IsWordStartCharacter(int ch);
+static inline bool IsWordCharacter(int ch);
+
+static void ColouriseComment(StyleContext& sc, bool&) {
+ sc.SetState(SCE_SPICE_COMMENTLINE);
+ while (!sc.atLineEnd) {
+ sc.Forward();
+ }
+}
+
+static void ColouriseDelimiter(StyleContext& sc, bool& apostropheStartsAttribute) {
+ apostropheStartsAttribute = sc.Match (')');
+ sc.SetState(SCE_SPICE_DELIMITER);
+ sc.ForwardSetState(SCE_SPICE_DEFAULT);
+}
+
+static void ColouriseNumber(StyleContext& sc, bool& apostropheStartsAttribute) {
+ apostropheStartsAttribute = true;
+ SString number;
+ sc.SetState(SCE_SPICE_NUMBER);
+ // Get all characters up to a delimiter or a separator, including points, but excluding
+ // double points (ranges).
+ while (!IsSeparatorOrDelimiterCharacter(sc.ch) || (sc.ch == '.' && sc.chNext != '.')) {
+ number += static_cast<char>(sc.ch);
+ sc.Forward();
+ }
+ // Special case: exponent with sign
+ if ((sc.chPrev == 'e' || sc.chPrev == 'E') &&
+ (sc.ch == '+' || sc.ch == '-')) {
+ number += static_cast<char>(sc.ch);
+ sc.Forward ();
+ while (!IsSeparatorOrDelimiterCharacter(sc.ch)) {
+ number += static_cast<char>(sc.ch);
+ sc.Forward();
+ }
+ }
+ sc.SetState(SCE_SPICE_DEFAULT);
+}
+
+static void ColouriseWhiteSpace(StyleContext& sc, bool& ) {
+ sc.SetState(SCE_SPICE_DEFAULT);
+ sc.ForwardSetState(SCE_SPICE_DEFAULT);
+}
+
+static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute) {
+ apostropheStartsAttribute = true;
+ sc.SetState(SCE_SPICE_IDENTIFIER);
+ SString word;
+ while (!sc.atLineEnd && !IsSeparatorOrDelimiterCharacter(sc.ch)) {
+ word += static_cast<char>(tolower(sc.ch));
+ sc.Forward();
+ }
+ if (keywords.InList(word.c_str())) {
+ sc.ChangeState(SCE_SPICE_KEYWORD);
+ if (word != "all") {
+ apostropheStartsAttribute = false;
+ }
+ }
+ else if (keywords2.InList(word.c_str())) {
+ sc.ChangeState(SCE_SPICE_KEYWORD2);
+ if (word != "all") {
+ apostropheStartsAttribute = false;
+ }
+ }
+ else if (keywords3.InList(word.c_str())) {
+ sc.ChangeState(SCE_SPICE_KEYWORD3);
+ if (word != "all") {
+ apostropheStartsAttribute = false;
+ }
+ }
+ sc.SetState(SCE_SPICE_DEFAULT);
+}
+
+//
+// ColouriseDocument
+//
+static void ColouriseDocument(
+ unsigned int startPos,
+ int length,
+ int initStyle,
+ WordList *keywordlists[],
+ Accessor &styler) {
+ WordList &keywords = *keywordlists[0];
+ WordList &keywords2 = *keywordlists[1];
+ WordList &keywords3 = *keywordlists[2];
+ StyleContext sc(startPos, length, initStyle, styler);
+ int lineCurrent = styler.GetLine(startPos);
+ bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
+ while (sc.More()) {
+ if (sc.atLineEnd) {
+ // Go to the next line
+ sc.Forward();
+ lineCurrent++;
+ // Remember the line state for future incremental lexing
+ styler.SetLineState(lineCurrent, apostropheStartsAttribute);
+ // Don't continue any styles on the next line
+ sc.SetState(SCE_SPICE_DEFAULT);
+ }
+ // Comments
+ if ((sc.Match('*') && sc.atLineStart) || sc.Match('*','~')) {
+ ColouriseComment(sc, apostropheStartsAttribute);
+ // Whitespace
+ } else if (IsASpace(sc.ch)) {
+ ColouriseWhiteSpace(sc, apostropheStartsAttribute);
+ // Delimiters
+ } else if (IsDelimiterCharacter(sc.ch)) {
+ ColouriseDelimiter(sc, apostropheStartsAttribute);
+ // Numbers
+ } else if (IsADigit(sc.ch) || sc.ch == '#') {
+ ColouriseNumber(sc, apostropheStartsAttribute);
+ // Keywords or identifiers
+ } else {
+ ColouriseWord(sc, keywords, keywords2, keywords3, apostropheStartsAttribute);
+ }
+ }
+ sc.Complete();
+}
+
+static inline bool IsDelimiterCharacter(int ch) {
+ switch (ch) {
+ case '&':
+ case '\'':
+ case '(':
+ case ')':
+ case '*':
+ case '+':
+ case ',':
+ case '-':
+ case '.':
+ case '/':
+ case ':':
+ case ';':
+ case '<':
+ case '=':
+ case '>':
+ case '|':
+ return true;
+ default:
+ return false;
+ }
+}
+
+static inline bool IsNumberCharacter(int ch) {
+ return IsNumberStartCharacter(ch) ||
+ ch == '_' ||
+ ch == '.' ||
+ ch == '#' ||
+ (ch >= 'a' && ch <= 'f') ||
+ (ch >= 'A' && ch <= 'F');
+}
+
+static inline bool IsNumberStartCharacter(int ch) {
+ return IsADigit(ch);
+}
+
+static inline bool IsSeparatorOrDelimiterCharacter(int ch) {
+ return IsASpace(ch) || IsDelimiterCharacter(ch);
+}
+
+static inline bool IsWordCharacter(int ch) {
+ return IsWordStartCharacter(ch) || IsADigit(ch);
+}
+
+static inline bool IsWordStartCharacter(int ch) {
+ return (isascii(ch) && isalpha(ch)) || ch == '_';
+}
--- /dev/null
+// Scintilla source code edit control
+/** @file LexTCL.cxx
+ ** Lexer for TCL language.
+ **/
+// Copyright 1998-2001 by Andre Arpin <arpin@kingston.net>
+// The License.txt file describes the conditions under which this software may be distributed.
+
+#include <stdlib.h>
+#include <string.h>
+#include <ctype.h>
+#include <stdarg.h>
+#include <stdio.h>
+
+#include "Platform.h"
+
+#include "PropSet.h"
+#include "Accessor.h"
+#include "StyleContext.h"
+#include "KeyWords.h"
+#include "Scintilla.h"
+#include "SciLexer.h"
+
+// Extended to accept accented characters
+static inline bool IsAWordChar(int ch) {
+ return ch >= 0x80 ||
+ (isalnum(ch) || ch == '_' || ch ==':' || ch=='.'); // : name space separator
+}
+
+static inline bool IsAWordStart(int ch) {
+ return ch >= 0x80 || (ch ==':' || isalpha(ch) || ch == '_');
+}
+
+static inline bool IsANumberChar(int ch) {
+ // Not exactly following number definition (several dots are seen as OK, etc.)
+ // but probably enough in most cases.
+ return (ch < 0x80) &&
+ (IsADigit(ch, 0x10) || toupper(ch) == 'E' ||
+ ch == '.' || ch == '-' || ch == '+');
+}
+
+static void ColouriseTCLDoc(unsigned int startPos, int length, int , WordList *keywordlists[], Accessor &styler) {
+#define isComment(s) (s==SCE_TCL_COMMENT || s==SCE_TCL_COMMENTLINE || s==SCE_TCL_COMMENT_BOX || s==SCE_TCL_BLOCK_COMMENT)
+ bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
+ bool commentLevel = false;
+ bool subBrace = false; // substitution begin with a brace ${.....}
+ enum tLineState {LS_DEFAULT, LS_OPEN_COMMENT, LS_OPEN_DOUBLE_QUOTE, LS_COMMENT_BOX, LS_MASK_STATE = 0xf,
+ LS_COMMAND_EXPECTED = 16, LS_BRACE_ONLY = 32 } lineState = LS_DEFAULT;
+ bool prevSlash = false;
+ int currentLevel = 0;
+ bool expected = 0;
+ bool subParen = 0;
+
+ int currentLine = styler.GetLine(startPos);
+ if (currentLine > 0)
+ currentLine--;
+ length += startPos - styler.LineStart(currentLine);
+ // make sure lines overlap
+ startPos = styler.LineStart(currentLine);
+
+ WordList &keywords = *keywordlists[0];
+ WordList &keywords2 = *keywordlists[1];
+ WordList &keywords3 = *keywordlists[2];
+ WordList &keywords4 = *keywordlists[3];
+ WordList &keywords5 = *keywordlists[4];
+ WordList &keywords6 = *keywordlists[5];
+ WordList &keywords7 = *keywordlists[6];
+ WordList &keywords8 = *keywordlists[7];
+ WordList &keywords9 = *keywordlists[8];
+
+ if (currentLine > 0) {
+ int ls = styler.GetLineState(currentLine - 1);
+ lineState = tLineState(ls & LS_MASK_STATE);
+ expected = LS_COMMAND_EXPECTED == tLineState(ls & LS_COMMAND_EXPECTED);
+ subBrace = LS_BRACE_ONLY == tLineState(ls & LS_BRACE_ONLY);
+ currentLevel = styler.LevelAt(currentLine - 1) >> 17;
+ commentLevel = (styler.LevelAt(currentLine - 1) >> 16) & 1;
+ } else
+ styler.SetLevel(0, SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG);
+ bool visibleChars = false;
+
+ int previousLevel = currentLevel;
+ StyleContext sc(startPos, length, SCE_TCL_DEFAULT, styler);
+ for (; ; sc.Forward()) {
+next:
+ if (sc.ch=='\r' && sc.chNext == '\n') // only ignore \r on PC process on the mac
+ continue;
+ bool atEnd = !sc.More(); // make sure we coloured the last word
+ if (lineState != LS_DEFAULT) {
+ sc.SetState(SCE_TCL_DEFAULT);
+ if (lineState == LS_OPEN_COMMENT)
+ sc.SetState(SCE_TCL_COMMENTLINE);
+ else if (lineState == LS_OPEN_DOUBLE_QUOTE)
+ sc.SetState(SCE_TCL_IN_QUOTE);
+ else if (lineState == LS_COMMENT_BOX && (sc.ch == '#' || (sc.ch == ' ' && sc.chNext=='#')))
+ sc.SetState(SCE_TCL_COMMENT_BOX);
+ lineState = LS_DEFAULT;
+ }
+ if (subBrace) { // ${ overrides every thing even \ except }
+ if (sc.ch == '}') {
+ subBrace = false;
+ sc.SetState(SCE_TCL_OPERATOR);
+ sc.ForwardSetState(SCE_TCL_DEFAULT);
+ goto next;
+ }
+ else
+ sc.SetState(SCE_TCL_SUB_BRACE);
+ if (!sc.atLineEnd)
+ continue;
+ } else if (sc.state == SCE_TCL_DEFAULT || sc.state ==SCE_TCL_OPERATOR) {
+ expected &= isspacechar(static_cast<unsigned char>(sc.ch)) || IsAWordStart(sc.ch) || sc.ch =='#';
+ } else if (sc.state == SCE_TCL_SUBSTITUTION) {
+ switch(sc.ch) {
+ case '(':
+ subParen=true;
+ sc.SetState(SCE_TCL_OPERATOR);
+ sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
+ continue;
+ case ')':
+ sc.SetState(SCE_TCL_OPERATOR);
+ subParen=false;
+ continue;
+ case '$':
+ continue;
+ case ',':
+ sc.SetState(SCE_TCL_OPERATOR);
+ if (subParen)
+ sc.ForwardSetState(SCE_TCL_SUBSTITUTION);
+ continue;
+ default :
+ // maybe spaces should be allowed ???
+ if (!IsAWordChar(sc.ch)) { // probably the code is wrong
+ sc.SetState(SCE_TCL_DEFAULT);
+ subParen = 0;
+ }
+ break;
+ }
+ } else if (isComment(sc.state)) {
+ } else if (!IsAWordChar(sc.ch)) {
+ if ((sc.state == SCE_TCL_IDENTIFIER && expected) || sc.state == SCE_TCL_MODIFIER) {
+ char w[100];
+ char *s=w;
+ sc.GetCurrent(w, sizeof(w));
+ if (w[strlen(w)-1]=='\r')
+ w[strlen(w)-1]=0;
+ while(*s == ':') // ignore leading : like in ::set a 10
+ ++s;
+ bool quote = sc.state == SCE_TCL_IN_QUOTE;
+ if (commentLevel || expected) {
+ if (keywords.InList(s)) {
+ sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD);
+ } else if (keywords2.InList(s)) {
+ sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD2);
+ } else if (keywords3.InList(s)) {
+ sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD3);
+ } else if (keywords4.InList(s)) {
+ sc.ChangeState(quote ? SCE_TCL_WORD_IN_QUOTE : SCE_TCL_WORD4);
+ } else if (sc.GetRelative(-static_cast<int>(strlen(s))-1) == '{' &&
+ keywords5.InList(s) && sc.ch == '}') { // {keyword} exactly no spaces
+ sc.ChangeState(SCE_TCL_EXPAND);
+ }
+ if (keywords6.InList(s)) {
+ sc.ChangeState(SCE_TCL_WORD5);
+ } else if (keywords7.InList(s)) {
+ sc.ChangeState(SCE_TCL_WORD6);
+ } else if (keywords8.InList(s)) {
+ sc.ChangeState(SCE_TCL_WORD7);
+ } else if (keywords9.InList(s)) {
+ sc.ChangeState(SCE_TCL_WORD8);
+ }
+ }
+ expected = false;
+ sc.SetState(quote ? SCE_TCL_IN_QUOTE : SCE_TCL_DEFAULT);
+ } else if (sc.state == SCE_TCL_MODIFIER || sc.state == SCE_TCL_IDENTIFIER) {
+ sc.SetState(SCE_TCL_DEFAULT);
+ }
+ }
+ if (atEnd)
+ break;
+ if (sc.atLineEnd) {
+ lineState = LS_DEFAULT;
+ currentLine = styler.GetLine(sc.currentPos);
+ if (foldComment && sc.state!=SCE_TCL_COMMENT && isComment(sc.state)) {
+ if (currentLevel == 0) {
+ ++currentLevel;
+ commentLevel = true;
+ }
+ } else {
+ if (visibleChars && commentLevel) {
+ --currentLevel;
+ --previousLevel;
+ commentLevel = false;
+ }
+ }
+ int flag = 0;
+ if (!visibleChars)
+ flag = SC_FOLDLEVELWHITEFLAG;
+ if (currentLevel > previousLevel)
+ flag = SC_FOLDLEVELHEADERFLAG;
+ styler.SetLevel(currentLine, flag + previousLevel + SC_FOLDLEVELBASE + (currentLevel << 17) + (commentLevel << 16));
+
+ // Update the line state, so it can be seen by next line
+ if (sc.state == SCE_TCL_IN_QUOTE)
+ lineState = LS_OPEN_DOUBLE_QUOTE;
+ else {
+ if (prevSlash) {
+ if (isComment(sc.state))
+ lineState = LS_OPEN_COMMENT;
+ } else if (sc.state == SCE_TCL_COMMENT_BOX)
+ lineState = LS_COMMENT_BOX;
+ }
+ styler.SetLineState(currentLine,
+ (subBrace ? LS_BRACE_ONLY : 0) |
+ (expected ? LS_COMMAND_EXPECTED : 0) | lineState);
+ if (lineState == LS_COMMENT_BOX)
+ sc.ForwardSetState(SCE_TCL_COMMENT_BOX);
+ else if (lineState == LS_OPEN_DOUBLE_QUOTE)
+ sc.ForwardSetState(SCE_TCL_IN_QUOTE);
+ else
+ sc.ForwardSetState(SCE_TCL_DEFAULT);
+ prevSlash = false;
+ previousLevel = currentLevel;
+ goto next;
+ }
+
+ if (prevSlash) {
+ prevSlash = false;
+ if (sc.ch == '#' && IsANumberChar(sc.chNext))
+ sc.ForwardSetState(SCE_TCL_NUMBER);
+ continue;
+ }
+ prevSlash = sc.ch == '\\';
+ if (isComment(sc.state))
+ continue;
+ if (sc.atLineStart) {
+ visibleChars = false;
+ if (sc.state!=SCE_TCL_IN_QUOTE && !isComment(sc.state))
+ {
+ sc.SetState(SCE_TCL_DEFAULT);
+ expected = IsAWordStart(sc.ch)|| isspacechar(static_cast<unsigned char>(sc.ch));
+ }
+ }
+
+ switch (sc.state) {
+ case SCE_TCL_NUMBER:
+ if (!IsANumberChar(sc.ch))
+ sc.SetState(SCE_TCL_DEFAULT);
+ break;
+ case SCE_TCL_IN_QUOTE:
+ if (sc.ch == '"') {
+ sc.ForwardSetState(SCE_TCL_DEFAULT);
+ visibleChars = true; // necessary if a " is the first and only character on a line
+ goto next;
+ } else if (sc.ch == '[' || sc.ch == ']' || sc.ch == '$') {
+ sc.SetState(SCE_TCL_OPERATOR);
+ expected = sc.ch == '[';
+ sc.ForwardSetState(SCE_TCL_IN_QUOTE);
+ goto next;
+ }
+ continue;
+ case SCE_TCL_OPERATOR:
+ sc.SetState(SCE_TCL_DEFAULT);
+ break;
+ }
+
+ if (sc.ch == '#') {
+ if (visibleChars) {
+ if (sc.state != SCE_TCL_IN_QUOTE && expected)
+ sc.SetState(SCE_TCL_COMMENT);
+ } else {
+ sc.SetState(SCE_TCL_COMMENTLINE);
+ if (sc.chNext == '~')
+ sc.SetState(SCE_TCL_BLOCK_COMMENT);
+ if (sc.atLineStart && (sc.chNext == '#' || sc.chNext == '-'))
+ sc.SetState(SCE_TCL_COMMENT_BOX);
+ }
+ }
+
+ if (!isspacechar(static_cast<unsigned char>(sc.ch))) {
+ visibleChars = true;
+ }
+
+ if (sc.ch == '\\') {
+ prevSlash = true;
+ continue;
+ }
+
+ // Determine if a new state should be entered.
+ if (sc.state == SCE_TCL_DEFAULT) {
+ if (IsAWordStart(sc.ch)) {
+ sc.SetState(SCE_TCL_IDENTIFIER);
+ } else if (IsADigit(sc.ch) && !IsAWordChar(sc.chPrev)) {
+ sc.SetState(SCE_TCL_NUMBER);
+ } else {
+ switch (sc.ch) {
+ case '\"':
+ sc.SetState(SCE_TCL_IN_QUOTE);
+ break;
+ case '{':
+ sc.SetState(SCE_TCL_OPERATOR);
+ expected = true;
+ ++currentLevel;
+ break;
+ case '}':
+ sc.SetState(SCE_TCL_OPERATOR);
+ --currentLevel;
+ break;
+ case '[':
+ expected = true;
+ case ']':
+ case '(':
+ case ')':
+ sc.SetState(SCE_TCL_OPERATOR);
+ break;
+ case ';':
+ expected = true;
+ break;
+ case '$':
+ subParen = 0;
+ if (sc.chNext != '{') {
+ sc.SetState(SCE_TCL_SUBSTITUTION);
+ }
+ else {
+ sc.SetState(SCE_TCL_OPERATOR); // $
+ sc.Forward(); // {
+ sc.ForwardSetState(SCE_TCL_SUB_BRACE);
+ subBrace = true;
+ }
+ break;
+ case '#':
+ if ((isspacechar(static_cast<unsigned char>(sc.chPrev))||
+ isoperator(static_cast<char>(sc.chPrev))) && IsADigit(sc.chNext,0x10))
+ sc.SetState(SCE_TCL_NUMBER);
+ break;
+ case '-':
+ sc.SetState(IsADigit(sc.chNext)? SCE_TCL_NUMBER: SCE_TCL_MODIFIER);
+ break;
+ default:
+ if (isoperator(static_cast<char>(sc.ch))) {
+ sc.SetState(SCE_TCL_OPERATOR);
+ }
+ }
+ }
+ }
+ }
+ sc.Complete();
+}
+
+static const char * const tclWordListDesc[] = {
+ "TCL Keywords",
+ "TK Keywords",
+ "iTCL Keywords",
+ "tkCommands",
+ "expand"
+ "user1",
+ "user2",
+ "user3",
+ "user4",
+ 0
+ };
+
+// this code supports folding in the colourizer
+LexerModule lmTCL(SCLEX_TCL, ColouriseTCLDoc, "tcl", 0, tclWordListDesc);
int markType;
ColourPair fore;
ColourPair back;
+ int alpha;
XPM *pxpm;
LineMarker() {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
+ alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
}
LineMarker(const LineMarker &) {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
+ alpha = SC_ALPHA_NOALPHA;
pxpm = NULL;
}
~LineMarker() {
markType = SC_MARK_CIRCLE;
fore = ColourDesired(0,0,0);
back = ColourDesired(0xff,0xff,0xff);
+ alpha = SC_ALPHA_NOALPHA;
delete pxpm;
pxpm = NULL;
return *this;
**/
/*
- * regex - Regular expression pattern matching and replacement
+ * regex - Regular expression pattern matching and replacement
*
* By: Ozan S. Yigit (oz)
* Dept. of Computer Science
* Removed all use of register.
* Converted to modern function prototypes.
* Put all global/static variables into an object so this code can be
- * used from multiple threads etc.
+ * used from multiple threads, etc.
*
* These routines are the PUBLIC DOMAIN equivalents of regex
* routines as found in 4.nBSD UN*X, with minor extensions.
* Modification history removed.
*
* Interfaces:
- * RESearch::Compile: compile a regular expression into a NFA.
+ * RESearch::Compile: compile a regular expression into a NFA.
*
- * char *RESearch::Compile(s)
- * char *s;
+ * const char *RESearch::Compile(const char *pat, int length,
+ * bool caseSensitive, bool posix)
*
- * RESearch::Execute: execute the NFA to match a pattern.
+ * Returns a short error string if they fail.
*
- * int RESearch::Execute(s)
- * char *s;
+ * RESearch::Execute: execute the NFA to match a pattern.
*
- * RESearch::ModifyWord change RESearch::Execute's understanding of what a "word"
- * looks like (for \< and \>) by adding into the
- * hidden word-syntax table.
+ * int RESearch::Execute(characterIndexer &ci, int lp, int endp)
*
- * void RESearch::ModifyWord(s)
- * char *s;
+ * RESearch::Substitute: substitute the matched portions in a new string.
*
- * RESearch::Substitute: substitute the matched portions in a new string.
+ * int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst)
*
- * int RESearch::Substitute(src, dst)
- * char *src;
- * char *dst;
+ * re_fail: failure routine for RESearch::Execute. (no longer used)
*
- * re_fail: failure routine for RESearch::Execute.
- *
- * void re_fail(msg, op)
- * char *msg;
- * char op;
+ * void re_fail(char *msg, char op)
*
* Regular Expressions:
*
* [1] char matches itself, unless it is a special
* character (metachar): . \ [ ] * + ^ $
+ * and ( ) if posix option.
*
* [2] . matches any character.
*
- * [3] \ matches the character following it, except
- * when followed by a left or right round bracket,
- * a digit 1 to 9 or a left or right angle bracket.
- * (see [7], [8] and [9])
- * It is used as an escape character for all
- * other meta-characters, and itself. When used
- * in a set ([4]), it is treated as an ordinary
- * character.
+ * [3] \ matches the character following it, except:
+ * - \a, \b, \f, \n, \t, \v match the
+ * corresponding C escape char;
+ * - if not in posix mode, when followed by a
+ * left or right round bracket (see [7]);
+ * - when followed by a digit 1 to 9 (see [8]);
+ * - when followed by a left or right angle bracket
+ * (see [9]).
+ * It is used as an escape character for all
+ * other meta-characters, and itself. When used
+ * in a set ([4]), it is treated as an ordinary
+ * character (except for escape chars).
*
* [4] [set] matches one of the characters in the set.
* If the first character in the set is "^",
* it matches a character NOT in the set, i.e.
- * complements the set. A shorthand S-E is
- * used to specify a set of characters S upto
- * E, inclusive. The special characters "]" and
- * "-" have no special meaning if they appear
- * as the first chars in the set.
+ * complements the set. A shorthand S-E (start-end)
+ * is used to specify a set of characters S upto
+ * E, inclusive. The special characters "]" and
+ * "-" have no special meaning if they appear
+ * as the first chars in the set. To include both,
+ * put - first: [-]A-Z]:
+ * [-]|] matches these 2 chars,
+ * []-|] matches from ] to | chars.
* examples: match:
*
* [a-z] any lowercase alpha
*
- * [^]-] any char except ] and -
+ * [^-]] any char except - and ]
*
* [^A-Z] any char except uppercase
* alpha
* [6] + same as [5], except it matches one or more.
*
* [7] a regular expression in the form [1] to [10], enclosed
- * as \(form\) matches what form matches. The enclosure
- * creates a set of tags, used for [8] and for
- * pattern substution. The tagged forms are numbered
- * starting from 1.
+ * as \(form\) (or (form) with posix flag) matches what
+ * form matches. The enclosure creates a set of tags,
+ * used for [8] and for pattern substitution.
+ * The tagged forms are numbered starting from 1.
*
* [8] a \ followed by a digit 1 to 9 matches whatever a
* previously tagged regular expression ([7]) matched.
*
- * [9] \< a regular expression starting with a \< construct
- * \> and/or ending with a \> construct, restricts the
- * pattern matching to the beginning of a word, and/or
- * the end of a word. A word is defined to be a character
- * string beginning and/or ending with the characters
- * A-Z a-z 0-9 and _. It must also be preceded and/or
- * followed by any character outside those mentioned.
+ * [9] \< a regular expression starting with a \< construct
+ * \> and/or ending with a \> construct, restricts the
+ * pattern matching to the beginning of a word, and/or
+ * the end of a word. A word is defined to be a character
+ * string beginning and/or ending with the characters
+ * A-Z a-z 0-9 and _. It must also be preceded and/or
+ * followed by any character outside those mentioned.
*
* [10] a composite regular expression xy where x and y
* are in the form [1] to [10] matches the longest
* match of x followed by a match for y.
*
- * [11] ^ a regular expression starting with a ^ character
- * $ and/or ending with a $ character, restricts the
+ * [11] ^ a regular expression starting with a ^ character
+ * $ and/or ending with a $ character, restricts the
* pattern matching to the beginning of the line,
* or the end of line. [anchors] Elsewhere in the
- * pattern, ^ and $ are treated as ordinary characters.
+ * pattern, ^ and $ are treated as ordinary characters.
*
*
* Acknowledgements:
*
- * HCR's Hugh Redelmeier has been most helpful in various
- * stages of development. He convinced me to include BOW
- * and EOW constructs, originally invented by Rob Pike at
- * the University of Toronto.
+ * HCR's Hugh Redelmeier has been most helpful in various
+ * stages of development. He convinced me to include BOW
+ * and EOW constructs, originally invented by Rob Pike at
+ * the University of Toronto.
*
* References:
- * Software tools Kernighan & Plauger
+ * Software tools Kernighan & Plauger
* Software tools in Pascal Kernighan & Plauger
* Grep [rsx-11 C dist] David Conroy
- * ed - text editor Un*x Programmer's Manual
- * Advanced editing on Un*x B. W. Kernighan
- * RegExp routines Henry Spencer
+ * ed - text editor Un*x Programmer's Manual
+ * Advanced editing on Un*x B. W. Kernighan
+ * RegExp routines Henry Spencer
*
* Notes:
*
* This implementation uses a bit-set representation for character
* classes for speed and compactness. Each character is represented
- * by one bit in a 128-bit block. Thus, CCL always takes a
- * constant 16 bytes in the internal nfa, and RESearch::Execute does a single
+ * by one bit in a 256-bit block. Thus, CCL always takes a
+ * constant 32 bytes in the internal nfa, and RESearch::Execute does a single
* bit comparison to locate the character in the set.
*
* Examples:
*
- * pattern: foo*.*
- * compile: CHR f CHR o CLO CHR o END CLO ANY END END
- * matches: fo foo fooo foobar fobar foxx ...
+ * pattern: foo*.*
+ * compile: CHR f CHR o CLO CHR o END CLO ANY END END
+ * matches: fo foo fooo foobar fobar foxx ...
*
- * pattern: fo[ob]a[rz]
- * compile: CHR f CHR o CCL bitset CHR a CCL bitset END
- * matches: fobar fooar fobaz fooaz
+ * pattern: fo[ob]a[rz]
+ * compile: CHR f CHR o CCL bitset CHR a CCL bitset END
+ * matches: fobar fooar fobaz fooaz
*
- * pattern: foo\\+
- * compile: CHR f CHR o CHR o CHR \ CLO CHR \ END END
- * matches: foo\ foo\\ foo\\\ ...
+ * pattern: foo\\+
+ * compile: CHR f CHR o CHR o CHR \ CLO CHR \ END END
+ * matches: foo\ foo\\ foo\\\ ...
*
- * pattern: \(foo\)[1-3]\1 (same as foo[1-3]foo)
- * compile: BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END
- * matches: foo1foo foo2foo foo3foo
+ * pattern: \(foo\)[1-3]\1 (same as foo[1-3]foo)
+ * compile: BOT 1 CHR f CHR o CHR o EOT 1 CCL bitset REF 1 END
+ * matches: foo1foo foo2foo foo3foo
*
- * pattern: \(fo.*\)-\1
- * compile: BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END
- * matches: foo-foo fo-fo fob-fob foobar-foobar ...
+ * pattern: \(fo.*\)-\1
+ * compile: BOT 1 CHR f CHR o CLO ANY END EOT 1 CHR - REF 1 END
+ * matches: foo-foo fo-fo fob-fob foobar-foobar ...
*/
+#include "CharClassify.h"
#include "RESearch.h"
+// Shut up annoying Visual C++ warnings:
+#ifdef _MSC_VER
+#pragma warning(disable: 4514)
+#endif
+
#define OKP 1
#define NOP 0
#define EOL 5
#define BOT 6
#define EOT 7
-#define BOW 8
-#define EOW 9
+#define BOW 8
+#define EOW 9
#define REF 10
#define CLO 11
* The following defines are not meant to be changeable.
* They are for readability only.
*/
-#define BLKIND 0370
-#define BITIND 07
-
-#define ASCIIB 0177
+#define BLKIND 0370
+#define BITIND 07
const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
#define badpat(x) (*nfa = END, x)
-RESearch::RESearch() {
+/*
+ * Character classification table for word boundary operators BOW
+ * and EOW is passed in by the creator of this object (Scintilla
+ * Document). The Document default state is that word chars are:
+ * 0-9,a-z, A-Z and _
+ */
+
+RESearch::RESearch(CharClassify *charClassTable) {
+ charClass = charClassTable;
Init();
}
}
void RESearch::Init() {
- sta = NOP; /* status of lastpat */
+ sta = NOP; /* status of lastpat */
bol = 0;
for (int i=0; i<MAXTAG; i++)
pat[i] = 0;
const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, bool posix) {
char *mp=nfa; /* nfa pointer */
- char *lp; /* saved pointer.. */
- char *sp=nfa; /* another one.. */
- char *mpMax = mp + MAXNFA - BITBLK - 10;
+ char *lp; /* saved pointer */
+ char *sp=nfa; /* another one */
+ char *mpMax = mp + MAXNFA - BITBLK - 10;
int tagi = 0; /* tag stack index */
int tagc = 1; /* actual tag count */
int n;
- char mask; /* xor mask -CCL/NCL */
+ char mask; /* xor mask -CCL/NCL */
int c1, c2;
if (!pat || !length)
return badpat("No previous regular expression");
sta = NOP;
- const char *p=pat; /* pattern pointer */
+ const char *p=pat; /* pattern pointer */
for (int i=0; i<length; i++, p++) {
if (mp > mpMax)
return badpat("Pattern too long");
lp = mp;
switch(*p) {
- case '.': /* match any char.. */
+ case '.': /* match any char */
*mp++ = ANY;
break;
- case '^': /* match beginning.. */
+ case '^': /* match beginning */
if (p == pat)
*mp++ = BOL;
else {
}
break;
- case '$': /* match endofline.. */
+ case '$': /* match endofline */
if (!*(p+1))
*mp++ = EOL;
else {
}
break;
- case '[': /* match char class..*/
+ case '[': /* match char class */
*mp++ = CCL;
i++;
} else
mask = 0;
- if (*p == '-') { /* real dash */
+ if (*p == '-') { /* real dash */
i++;
ChSet(*p++);
}
break;
- case '*': /* match 0 or more.. */
- case '+': /* match 1 or more.. */
+ case '*': /* match 0 or more... */
+ case '+': /* match 1 or more... */
if (p == pat)
return badpat("Empty closure");
lp = sp; /* previous opcode */
- if (*lp == CLO) /* equivalence.. */
+ if (*lp == CLO) /* equivalence... */
break;
switch(*lp) {
mp = sp;
break;
- case '\\': /* tags, backrefs .. */
+ case '\\': /* tags, backrefs... */
i++;
switch(*++p) {
}
break;
- default : /* an ordinary char */
+ default : /* an ordinary char */
if (posix && *p == '(') {
if (tagc < MAXTAG) {
tagstk[++tagi] = tagc;
/*
* RESearch::Execute:
- * execute nfa to find a match.
- *
- * special cases: (nfa[0])
- * BOL
- * Match only once, starting from the
- * beginning.
- * CHR
- * First locate the character without
- * calling PMatch, and if found, call
- * PMatch for the remaining string.
- * END
- * RESearch::Compile failed, poor luser did not
- * check for it. Fail fast.
- *
- * If a match is found, bopat[0] and eopat[0] are set
- * to the beginning and the end of the matched fragment,
- * respectively.
+ * execute nfa to find a match.
+ *
+ * special cases: (nfa[0])
+ * BOL
+ * Match only once, starting from the
+ * beginning.
+ * CHR
+ * First locate the character without
+ * calling PMatch, and if found, call
+ * PMatch for the remaining string.
+ * END
+ * RESearch::Compile failed, poor luser did not
+ * check for it. Fail fast.
+ *
+ * If a match is found, bopat[0] and eopat[0] are set
+ * to the beginning and the end of the matched fragment,
+ * respectively.
*
*/
c = *(ap+1);
while ((lp < endp) && (ci.CharAt(lp) != c))
lp++;
- if (lp >= endp) /* if EOS, fail, else fall thru. */
+ if (lp >= endp) /* if EOS, fail, else fall thru. */
return 0;
default: /* regular matching all the way. */
while (lp < endp) {
/*
* PMatch: internal routine for the hard part
*
- * This code is partly snarfed from an early grep written by
- * David Conroy. The backref and tag stuff, and various other
- * innovations are by oz.
- *
- * special case optimizations: (nfa[n], nfa[n+1])
- * CLO ANY
- * We KNOW .* will match everything upto the
- * end of line. Thus, directly go to the end of
- * line, without recursive PMatch calls. As in
- * the other closure cases, the remaining pattern
- * must be matched by moving backwards on the
- * string recursively, to find a match for xy
- * (x is ".*" and y is the remaining pattern)
- * where the match satisfies the LONGEST match for
- * x followed by a match for y.
- * CLO CHR
- * We can again scan the string forward for the
- * single char and at the point of failure, we
- * execute the remaining nfa recursively, same as
- * above.
- *
- * At the end of a successful match, bopat[n] and eopat[n]
- * are set to the beginning and end of subpatterns matched
- * by tagged expressions (n = 1 to 9).
- *
+ * This code is partly snarfed from an early grep written by
+ * David Conroy. The backref and tag stuff, and various other
+ * innovations are by oz.
+ *
+ * special case optimizations: (nfa[n], nfa[n+1])
+ * CLO ANY
+ * We KNOW .* will match everything upto the
+ * end of line. Thus, directly go to the end of
+ * line, without recursive PMatch calls. As in
+ * the other closure cases, the remaining pattern
+ * must be matched by moving backwards on the
+ * string recursively, to find a match for xy
+ * (x is ".*" and y is the remaining pattern)
+ * where the match satisfies the LONGEST match for
+ * x followed by a match for y.
+ * CLO CHR
+ * We can again scan the string forward for the
+ * single char and at the point of failure, we
+ * execute the remaining nfa recursively, same as
+ * above.
+ *
+ * At the end of a successful match, bopat[n] and eopat[n]
+ * are set to the beginning and end of subpatterns matched
+ * by tagged expressions (n = 1 to 9).
*/
extern void re_fail(char *,char);
-/*
- * character classification table for word boundary operators BOW
- * and EOW. the reason for not using ctype macros is that we can
- * let the user add into our own table. see RESearch::ModifyWord. This table
- * is not in the bitset form, since we may wish to extend it in the
- * future for other character classifications.
- *
- * TRUE for 0-9 A-Z a-z _
- */
-static char chrtyp[MAXCHR] = {
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
- 0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
- 1, 1, 1, 0, 0, 0, 0, 0
- };
-
-#define inascii(x) (0177&(x))
-#define iswordc(x) chrtyp[inascii(x)]
-#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])
+#define isinset(x,y) ((x)[((y)&BLKIND)>>3] & bitarr[(y)&BITIND])
/*
* skip values for CLO XXX to skip past the closure
*/
-#define ANYSKIP 2 /* [CLO] ANY END ... */
-#define CHRSKIP 3 /* [CLO] CHR chr END ... */
-#define CCLSKIP 34 /* [CLO] CCL 32bytes END ... */
+#define ANYSKIP 2 /* [CLO] ANY END */
+#define CHRSKIP 3 /* [CLO] CHR chr END */
+#define CCLSKIP 34 /* [CLO] CCL 32 bytes END */
int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
int op, c, n;
- int e; /* extra pointer for CLO */
- int bp; /* beginning of subpat.. */
- int ep; /* ending of subpat.. */
- int are; /* to save the line ptr. */
+ int e; /* extra pointer for CLO */
+ int bp; /* beginning of subpat... */
+ int ep; /* ending of subpat... */
+ int are; /* to save the line ptr. */
while ((op = *ap++) != END)
switch(op) {
return lp;
}
-/*
- * RESearch::ModifyWord:
- * add new characters into the word table to change RESearch::Execute's
- * understanding of what a word should look like. Note that we
- * only accept additions into the word definition.
- *
- * If the string parameter is 0 or null string, the table is
- * reset back to the default containing A-Z a-z 0-9 _. [We use
- * the compact bitset representation for the default table]
- */
-
-static char deftab[16] = {
- 0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',
- '\376', '\377', '\377', 007
-};
-
-void RESearch::ModifyWord(char *s) {
- int i;
-
- if (!s || !*s) {
- for (i = 0; i < MAXCHR; i++)
- if (!isinset(deftab,i))
- iswordc(i) = 0;
- }
- else
- while(*s)
- iswordc(*s++) = 1;
-}
-
/*
* RESearch::Substitute:
- * substitute the matched portions of the src in dst.
+ * substitute the matched portions of the src in dst.
*
- * & substitute the entire matched pattern.
+ * & substitute the entire matched pattern.
*
- * \digit substitute a subpattern, with the given tag number.
- * Tags are numbered from 1 to 9. If the particular
- * tagged subpattern does not exist, null is substituted.
+ * \digit substitute a subpattern, with the given tag number.
+ * Tags are numbered from 1 to 9. If the particular
+ * tagged subpattern does not exist, null is substituted.
*/
int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
char c;
#define BITBLK MAXCHR/CHRBIT
class CharacterIndexer {
-public:
+public:
virtual char CharAt(int index)=0;
virtual ~CharacterIndexer() {
}
class RESearch {
public:
- RESearch();
+ RESearch(CharClassify *charClassTable);
~RESearch();
- void Init();
- void Clear();
bool GrabMatches(CharacterIndexer &ci);
- void ChSet(char c);
- void ChSetWithCase(char c, bool caseSensitive);
const char *Compile(const char *pat, int length, bool caseSensitive, bool posix);
int Execute(CharacterIndexer &ci, int lp, int endp);
- void ModifyWord(char *s);
int Substitute(CharacterIndexer &ci, char *src, char *dst);
enum {MAXTAG=10};
char *pat[MAXTAG];
private:
+ void Init();
+ void Clear();
+ void ChSet(char c);
+ void ChSetWithCase(char c, bool caseSensitive);
+
int PMatch(CharacterIndexer &ci, int lp, int endp, char *ap);
int bol;
- int tagstk[MAXTAG]; /* subpat tag stack..*/
- char nfa[MAXNFA]; /* automaton.. */
+ int tagstk[MAXTAG]; /* subpat tag stack */
+ char nfa[MAXNFA]; /* automaton */
int sta;
- char bittab[BITBLK]; /* bit table for CCL */
- /* pre-set bits... */
+ char bittab[BITBLK]; /* bit table for CCL pre-set bits */
int failure;
+ CharClassify *charClass;
+ bool iswordc(unsigned char x) {
+ return charClass->IsWord(x);
+ }
};
#endif
#include "Style.h"
#include "ViewStyle.h"
#include "AutoComplete.h"
+#include "CharClassify.h"
#include "Document.h"
#include "Editor.h"
#include "ScintillaBase.h"
void ScintillaBase::CallTipShow(Point pt, const char *defn) {
AutoCompleteCancel();
pt.y += vs.lineHeight;
+ // If container knows about STYLE_CALLTIP then use it in place of the
+ // STYLE_DEFAULT for the face name, size and character set. Also use it
+ // for the foreground and background colour.
+ int ctStyle = ct.UseStyleCallTip() ? STYLE_CALLTIP : STYLE_DEFAULT;
+ if (ct.UseStyleCallTip()) {
+ ct.SetForeBack(vs.styles[STYLE_CALLTIP].fore, vs.styles[STYLE_CALLTIP].back);
+ }
PRectangle rc = ct.CallTipStart(currentPos, pt,
defn,
- vs.styles[STYLE_DEFAULT].fontName,
- vs.styles[STYLE_DEFAULT].sizeZoomed,
+ vs.styles[ctStyle].fontName,
+ vs.styles[ctStyle].sizeZoomed,
CodePage(),
- vs.styles[STYLE_DEFAULT].characterSet,
+ vs.styles[ctStyle].characterSet,
wMain);
// If the call-tip window would be out of the client
// space, adjust so it displays above the text.
int styleStart = 0;
if (start > 0)
- styleStart = styler.StyleAt(start - 1);
+ styleStart = styler.StyleAt(start - 1) & pdoc->stylingBitsMask;
styler.SetCodePage(pdoc->dbcsCodePage);
if (lexCurrent && (len > 0)) { // Should always succeed as null lexer should always be available
case SCI_CALLTIPSETBACK:
ct.colourBG = ColourDesired(wParam);
+ vs.styles[STYLE_CALLTIP].fore = ct.colourBG;
InvalidateStyleRedraw();
break;
case SCI_CALLTIPSETFORE:
ct.colourUnSel = ColourDesired(wParam);
+ vs.styles[STYLE_CALLTIP].fore = ct.colourUnSel;
InvalidateStyleRedraw();
break;
InvalidateStyleRedraw();
break;
+ case SCI_CALLTIPUSESTYLE:
+ ct.SetTabSize((int)wParam);
+ InvalidateStyleRedraw();
+ break;
+
case SCI_USEPOPUP:
displayPopupMenu = wParam != 0;
break;
#include "ViewStyle.h"
MarginStyle::MarginStyle() :
- symbol(false), width(16), mask(0xffffffff), sensitive(false) {
+ style(SC_MARGIN_SYMBOL), width(0), mask(0), sensitive(false) {
}
// A list of the fontnames - avoids wasting space in each style
selbackset = source.selbackset;
selbackground.desired = source.selbackground.desired;
selbackground2.desired = source.selbackground2.desired;
+ selAlpha = source.selAlpha;
foldmarginColourSet = source.foldmarginColourSet;
foldmarginColour.desired = source.foldmarginColour.desired;
caretcolour.desired = source.caretcolour.desired;
showCaretLineBackground = source.showCaretLineBackground;
caretLineBackground.desired = source.caretLineBackground.desired;
+ caretLineAlpha = source.caretLineAlpha;
edgecolour.desired = source.edgecolour.desired;
edgeState = source.edgeState;
caretWidth = source.caretWidth;
selbackset = true;
selbackground.desired = ColourDesired(0xc0, 0xc0, 0xc0);
selbackground2.desired = ColourDesired(0xb0, 0xb0, 0xb0);
+ selAlpha = SC_ALPHA_NOALPHA;
foldmarginColourSet = false;
foldmarginColour.desired = ColourDesired(0xff, 0, 0);
caretcolour.desired = ColourDesired(0, 0, 0);
showCaretLineBackground = false;
caretLineBackground.desired = ColourDesired(0xff, 0xff, 0);
+ caretLineAlpha = SC_ALPHA_NOALPHA;
edgecolour.desired = ColourDesired(0xc0, 0xc0, 0xc0);
edgeState = EDGE_NONE;
caretWidth = 1;
leftMarginWidth = 1;
rightMarginWidth = 1;
- ms[0].symbol = false;
+ ms[0].style = SC_MARGIN_NUMBER;
ms[0].width = 0;
ms[0].mask = 0;
- ms[1].symbol = true;
+ ms[1].style = SC_MARGIN_SYMBOL;
ms[1].width = 16;
ms[1].mask = ~SC_MASK_FOLDERS;
- ms[2].symbol = true;
+ ms[2].style = SC_MARGIN_SYMBOL;
ms[2].width = 0;
ms[2].mask = 0;
fixedColumnWidth = leftMarginWidth;
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
- symbolMargin = symbolMargin || ms[margin].symbol;
+ symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
maskInLine = 0xffffffff;
for (int margin=0; margin < margins; margin++) {
fixedColumnWidth += ms[margin].width;
- symbolMargin = symbolMargin || ms[margin].symbol;
+ symbolMargin = symbolMargin || (ms[margin].style != SC_MARGIN_NUMBER);
if (ms[margin].width > 0)
maskInLine &= ~ms[margin].mask;
}
}
}
styles[STYLE_LINENUMBER].back.desired = Platform::Chrome();
+
+ // Set call tip fore/back to match the values previously set for call tips
+ styles[STYLE_CALLTIP].back.desired = ColourDesired(0xff, 0xff, 0xff);
+ styles[STYLE_CALLTIP].fore.desired = ColourDesired(0x80, 0x80, 0x80);
}
void ViewStyle::SetStyleFontName(int styleIndex, const char *name) {
*/
class MarginStyle {
public:
- bool symbol;
+ int style;
int width;
int mask;
bool sensitive;
bool selbackset;
ColourPair selbackground;
ColourPair selbackground2;
+ int selAlpha;
bool whitespaceForegroundSet;
ColourPair whitespaceForeground;
bool whitespaceBackgroundSet;
bool hotspotUnderline;
bool hotspotSingleLine;
/// Margins are ordered: Line Numbers, Selection Margin, Spacing Margin
- enum { margins=3 };
+ enum { margins=5 };
int leftMarginWidth; ///< Spacing margin on left of text
int rightMarginWidth; ///< Spacing margin on left of text
bool symbolMargin;
ColourPair caretcolour;
bool showCaretLineBackground;
ColourPair caretLineBackground;
+ int caretLineAlpha;
ColourPair edgecolour;
int edgeState;
int caretWidth;
SendMsg(2466, line, set);
}
+// Set the alpha used for a marker that is drawn in the text area, not the margin.
+void wxStyledTextCtrl::MarkerSetAlpha(int markerNumber, int alpha) {
+ SendMsg(2476, markerNumber, alpha);
+}
+
// Set a margin to be either numeric or symbolic.
void wxStyledTextCtrl::SetMarginType(int margin, int marginType) {
SendMsg(2240, margin, marginType);
SendMsg(2068, useSetting, wxColourAsLong(back));
}
+// Get the alpha of the selection.
+int wxStyledTextCtrl::GetSelAlpha() {
+ return SendMsg(2477, 0, 0);
+}
+
+// Set the alpha of the selection.
+void wxStyledTextCtrl::SetSelAlpha(int alpha) {
+ SendMsg(2478, alpha, 0);
+}
+
// Set the foreground colour of the caret.
void wxStyledTextCtrl::SetCaretForeground(const wxColour& fore) {
SendMsg(2069, wxColourAsLong(fore), 0);
SendMsg(2207, wxColourAsLong(fore), 0);
}
+// Enable use of STYLE_CALLTIP and set call tip tab size in pixels.
+void wxStyledTextCtrl::CallTipUseStyle(int tabSize) {
+ SendMsg(2212, tabSize, 0);
+}
+
// Find the display line of a document line taking hidden lines into account.
int wxStyledTextCtrl::VisibleFromDocLine(int line) {
return SendMsg(2220, line, 0);
SendMsg(2469, 0, 0);
}
+// Set background alpha of the caret line.
+void wxStyledTextCtrl::SetCaretLineBackAlpha(int alpha) {
+ SendMsg(2470, alpha, 0);
+}
+
+// Get the background alpha of the caret line.
+int wxStyledTextCtrl::GetCaretLineBackAlpha() {
+ return SendMsg(2471, 0, 0);
+}
+
// Start notifying the container of all key presses and commands.
void wxStyledTextCtrl::StartRecord() {
SendMsg(3001, 0, 0);
DocStr(wxStyledTextCtrl::MarkerAddSet,
"Add a set of markers to a line.", "");
+DocStr(wxStyledTextCtrl::MarkerSetAlpha,
+"Set the alpha used for a marker that is drawn in the text area, not the margin.", "");
+
DocStr(wxStyledTextCtrl::SetMarginType,
"Set a margin to be either numeric or symbolic.", "");
DocStr(wxStyledTextCtrl::SetSelBackground,
"Set the background colour of the selection and whether to use this setting.", "");
+DocStr(wxStyledTextCtrl::GetSelAlpha,
+"Get the alpha of the selection.", "");
+
+DocStr(wxStyledTextCtrl::SetSelAlpha,
+"Set the alpha of the selection.", "");
+
DocStr(wxStyledTextCtrl::SetCaretForeground,
"Set the foreground colour of the caret.", "");
DocStr(wxStyledTextCtrl::CallTipSetForegroundHighlight,
"Set the foreground colour for the highlighted part of the call tip.", "");
+DocStr(wxStyledTextCtrl::CallTipUseStyle,
+"Enable use of STYLE_CALLTIP and set call tip tab size in pixels.", "");
+
DocStr(wxStyledTextCtrl::VisibleFromDocLine,
"Find the display line of a document line taking hidden lines into account.", "");
DocStr(wxStyledTextCtrl::SelectionDuplicate,
"Duplicate the selection. If selection empty duplicate the line containing the caret.", "");
+DocStr(wxStyledTextCtrl::SetCaretLineBackAlpha,
+"Set background alpha of the caret line.", "");
+
+DocStr(wxStyledTextCtrl::GetCaretLineBackAlpha,
+"Get the background alpha of the caret line.", "");
+
DocStr(wxStyledTextCtrl::StartRecord,
"Start notifying the container of all key presses and commands.", "");
2.7.0.0
-------
+*
The following deprecated items have been removed:
Added the PseudoDC class from Paul Lanier. It provides a way to
record operations on a DC and then play them back later.
+Upgraded to Scintilla 1.70 for wx.stc.StyledTextCtrl.
+2.6.3.3
+-------
+* 15-July-2006
+
+wx.lib.pubsub updates from Oliver Schoenborn:
+ - fixed the hash problem with non-hashable objects
+ - now supports listeners that use \*args as an argument
+ (listener(\*args) was not passing the validity test)
+ - corrected some mistakes in documentation
+ - added some clarifications (hopefully useful for first time
+ users)
+ - changed the way singleton is implemented since old way prevented
+ pydoc etc from extracting docs for Publisher
+
+DocView and ActiveGrid IDE updates from Morgan Hua:
+ New Features: In Tab-View mode, Ctrl-number will take the user to
+ the numbered tab view. Modified files now show an '*' astrisk in
+ the view title. Debugger framework can now support PHP debugging.
+ Not important for python development, but at least that means the
+ debugger framework is more generalized.
+
+wx.lib.mixins.listctrl.TextEditMixin: Fixed the double END_LABEL_EDIT
+event problem in TextEditMixin by checking if the editor was already
+hidden before continuing with the CloseEditor method. Also added code
+to OpenEditor to send the BEGIN_LABEL_EDIT event and to not allow the
+opening of the editor to continue if the event handler doesn't allow
+it.
+
+Undeprecated wx.GetNumberFromUser and added wx.NumberEntryDialog.
+
+Made necessaary changes for building wxPython for Python 2.5. There
+may still be some issues related to the new Py_ssize_t type and 64-bit
+machines, but at least all compile errors and warnings related to it
+have been resolved.
+
+
+
2.6.3.2
-------