Updated to Scintilla 1.54

Applied most of patch #806092
Added new wxSTC sample from Otto Wyss


git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@23654 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Robin Dunn
2003-09-18 05:05:52 +00:00
parent a47ae718e2
commit 88a8b04e9c
136 changed files with 9108 additions and 1232 deletions

View File

@@ -80,14 +80,18 @@ STCDLL_OBJECTS = \
stcdll_LexLisp.o \
stcdll_LexLout.o \
stcdll_LexLua.o \
stcdll_LexMMIXAL.o \
stcdll_LexMatlab.o \
stcdll_LexNsis.o \
stcdll_LexOthers.o \
stcdll_LexPOV.o \
stcdll_LexPS.o \
stcdll_LexPascal.o \
stcdll_LexPerl.o \
stcdll_LexPython.o \
stcdll_LexRuby.o \
stcdll_LexSQL.o \
stcdll_LexScriptol.o \
stcdll_LexVB.o \
stcdll_LineMarker.o \
stcdll_PropSet.o \
@@ -134,14 +138,18 @@ STCLIB_OBJECTS = \
stclib_LexLisp.o \
stclib_LexLout.o \
stclib_LexLua.o \
stclib_LexMMIXAL.o \
stclib_LexMatlab.o \
stclib_LexNsis.o \
stclib_LexOthers.o \
stclib_LexPOV.o \
stclib_LexPS.o \
stclib_LexPascal.o \
stclib_LexPerl.o \
stclib_LexPython.o \
stclib_LexRuby.o \
stclib_LexSQL.o \
stclib_LexScriptol.o \
stclib_LexVB.o \
stclib_LineMarker.o \
stclib_PropSet.o \
@@ -378,15 +386,24 @@ stcdll_LexLout.o: $(srcdir)/scintilla/src/LexLout.cxx
stcdll_LexLua.o: $(srcdir)/scintilla/src/LexLua.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
stcdll_LexMMIXAL.o: $(srcdir)/scintilla/src/LexMMIXAL.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
stcdll_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
stcdll_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
stcdll_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
stcdll_LexPOV.o: $(srcdir)/scintilla/src/LexPOV.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
stcdll_LexPS.o: $(srcdir)/scintilla/src/LexPS.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
stcdll_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
@@ -402,6 +419,9 @@ stcdll_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
stcdll_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
stcdll_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
stcdll_LexVB.o: $(srcdir)/scintilla/src/LexVB.cxx
$(CXXC) -c -o $@ $(STCDLL_CXXFLAGS) $<
@@ -530,15 +550,24 @@ stclib_LexLout.o: $(srcdir)/scintilla/src/LexLout.cxx
stclib_LexLua.o: $(srcdir)/scintilla/src/LexLua.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
stclib_LexMMIXAL.o: $(srcdir)/scintilla/src/LexMMIXAL.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
stclib_LexMatlab.o: $(srcdir)/scintilla/src/LexMatlab.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
stclib_LexNsis.o: $(srcdir)/scintilla/src/LexNsis.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
stclib_LexOthers.o: $(srcdir)/scintilla/src/LexOthers.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
stclib_LexPOV.o: $(srcdir)/scintilla/src/LexPOV.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
stclib_LexPS.o: $(srcdir)/scintilla/src/LexPS.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
stclib_LexPascal.o: $(srcdir)/scintilla/src/LexPascal.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
@@ -554,6 +583,9 @@ stclib_LexRuby.o: $(srcdir)/scintilla/src/LexRuby.cxx
stclib_LexSQL.o: $(srcdir)/scintilla/src/LexSQL.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
stclib_LexScriptol.o: $(srcdir)/scintilla/src/LexScriptol.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<
stclib_LexVB.o: $(srcdir)/scintilla/src/LexVB.cxx
$(CXXC) -c -o $@ $(STCLIB_CXXFLAGS) $<

View File

@@ -288,7 +288,7 @@ void SurfaceImpl::Init(SurfaceID hdc_, WindowID) {
hdc = (wxDC*)hdc_;
}
void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID) {
void SurfaceImpl::InitPixMap(int width, int height, Surface *WXUNUSED(surface_), WindowID) {
Release();
hdc = new wxMemoryDC();
hdcOwned = true;
@@ -542,7 +542,7 @@ int SurfaceImpl::Descent(Font &font) {
return d;
}
int SurfaceImpl::InternalLeading(Font &font) {
int SurfaceImpl::InternalLeading(Font &WXUNUSED(font)) {
return 0;
}
@@ -563,7 +563,7 @@ int SurfaceImpl::AverageCharWidth(Font &font) {
return hdc->GetCharWidth();
}
int SurfaceImpl::SetPalette(Palette *pal, bool inBackGround) {
int SurfaceImpl::SetPalette(Palette *WXUNUSED(pal), bool WXUNUSED(inBackGround)) {
return 0;
}
@@ -578,7 +578,7 @@ void SurfaceImpl::SetUnicodeMode(bool unicodeMode_) {
unicodeMode=unicodeMode_;
}
void SurfaceImpl::SetDBCSMode(int codePage) {
void SurfaceImpl::SetDBCSMode(int WXUNUSED(codePage)) {
// dbcsMode = codePage == SC_CP_DBCS;
}
@@ -969,7 +969,7 @@ int ListBoxImpl::GetSelection() {
}
int ListBoxImpl::Find(const char *prefix) {
int ListBoxImpl::Find(const char *WXUNUSED(prefix)) {
// No longer used
return -1;
}
@@ -1063,7 +1063,7 @@ void Menu::Show(Point pt, Window &w) {
//----------------------------------------------------------------------
DynamicLibrary *DynamicLibrary::Load(const char *modulePath) {
DynamicLibrary *DynamicLibrary::Load(const char *WXUNUSED(modulePath)) {
wxFAIL_MSG(wxT("Dynamic lexer loading not implemented yet"));
return NULL;
}
@@ -1103,7 +1103,7 @@ void Platform::DebugDisplay(const char *s) {
wxLogDebug(stc2wx(s));
}
bool Platform::IsKeyDown(int key) {
bool Platform::IsKeyDown(int WXUNUSED(key)) {
return false; // I don't think we'll need this.
}
@@ -1196,11 +1196,11 @@ int Platform::Clamp(int val, int minVal, int maxVal) {
}
bool Platform::IsDBCSLeadByte(int codePage, char ch) {
bool Platform::IsDBCSLeadByte(int WXUNUSED(codePage), char WXUNUSED(ch)) {
return false;
}
int Platform::DBCSCharLength(int codePage, const char *s) {
int Platform::DBCSCharLength(int WXUNUSED(codePage), const char *WXUNUSED(s)) {
return 1;
}

View File

@@ -383,7 +383,8 @@ bool ScintillaWX::CanPaste() {
bool didOpen;
if (Editor::CanPaste()) {
if ( (didOpen = !wxTheClipboard->IsOpened()) )
didOpen = !wxTheClipboard->IsOpened();
if ( didOpen )
wxTheClipboard->Open();
if (wxTheClipboard->IsOpened()) {
@@ -597,7 +598,7 @@ void ScintillaWX::DoMouseWheel(int rotation, int delta,
}
void ScintillaWX::DoSize(int width, int height) {
void ScintillaWX::DoSize(int WXUNUSED(width), int WXUNUSED(height)) {
// PRectangle rcClient(0,0,width,height);
// SetScrollBarsTo(rcClient);
// DropGraphics();
@@ -628,8 +629,8 @@ void ScintillaWX::DoLeftButtonMove(Point pt) {
ButtonMove(pt);
}
void ScintillaWX::DoMiddleButtonUp(Point pt) {
#ifdef __WXGTK__
void ScintillaWX::DoMiddleButtonUp(Point pt) {
// Set the current position to the mouse click point and
// then paste in the PRIMARY selection, if any. wxGTK only.
int newPos = PositionFromLocation(pt);
@@ -656,8 +657,11 @@ void ScintillaWX::DoMiddleButtonUp(Point pt) {
ShowCaretAtCurrentPosition();
EnsureCaretVisible();
#endif
}
#else
void ScintillaWX::DoMiddleButtonUp(Point WXUNUSED(pt)) {
}
#endif
void ScintillaWX::DoAddChar(int key) {
@@ -673,9 +677,10 @@ void ScintillaWX::DoAddChar(int key) {
}
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed) {
int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool meta, bool* consumed) {
#if defined(__WXGTK__) || defined(__WXMAC__)
// Ctrl chars (A-Z) end up with the wrong keycode on wxGTK...
// Ctrl chars (A-Z) end up with the wrong keycode on wxGTK
// TODO: Check this, it shouldn't be true any longer.
if (ctrl && key >= 1 && key <= 26)
key += 'A' - 1;
#endif
@@ -709,6 +714,21 @@ int ScintillaWX::DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* cons
case WXK_MENU: key = 0; break;
}
#ifdef __WXMAC__
if ( meta ) {
// check for a few common Mac Meta-key combos and remap them to Ctrl
// for Scintilla
switch ( key ) {
case 'Z': // Undo
case 'X': // Cut
case 'C': // Copy
case 'V': // Paste
case 'A': // Select All
ctrl = true;
break;
}
#endif
int rv = KeyDown(key, shift, ctrl, alt, consumed);
if (key)
@@ -760,7 +780,7 @@ bool ScintillaWX::DoDropText(long x, long y, const wxString& data) {
}
wxDragResult ScintillaWX::DoDragEnter(wxCoord x, wxCoord y, wxDragResult def) {
wxDragResult ScintillaWX::DoDragEnter(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxDragResult def) {
dragResult = def;
return dragResult;
}
@@ -817,8 +837,8 @@ void ScintillaWX::DoScrollToColumn(int column) {
HorizontalScrollTo(column * vs.spaceWidth);
}
void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
#ifdef __WXGTK__
void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
wxRegion rgn(wxRectFromPRectangle(rect));
if (ac.Active()) {
wxRect childRect = ((wxWindow*)ac.lb->GetID())->GetRect();
@@ -830,9 +850,11 @@ void ScintillaWX::ClipChildren(wxDC& dc, PRectangle rect) {
}
dc.SetClippingRegion(rgn);
#endif
}
#else
void ScintillaWX::ClipChildren(wxDC& WXUNUSED(dc), PRectangle WXUNUSED(rect)) {
}
#endif
//----------------------------------------------------------------------
//----------------------------------------------------------------------

View File

@@ -139,7 +139,7 @@ public:
void DoMiddleButtonUp(Point pt);
void DoMouseWheel(int rotation, int delta, int linesPerAction, int ctrlDown, bool isPageScroll);
void DoAddChar(int key);
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool* consumed);
int DoKeyDown(int key, bool shift, bool ctrl, bool alt, bool meta, bool* consumed);
void DoTick() { Tick(); }
#if wxUSE_DRAG_AND_DROP

View File

@@ -547,9 +547,12 @@ methodOverrideMap = {
'GrabFocus' : (None, 0, 0, 0),
# Rename some that woudl otherwise hid the wxWindow methods
'SetFocus' : ('SetSTCFocus', 0, 0, 0),
'GetFocus' : ('GetSTCFocus', 0, 0, 0),
'SetCursor' : ('SetSTCCursor', 0, 0, 0),
'GetCursor' : ('GetSTCCursor', 0, 0, 0),
'LoadLexerLibrary' : (None, 0,0,0),

View File

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

View File

@@ -25,7 +25,7 @@ protected:
char buf[bufferSize+1];
int startPos;
int endPos;
int codePage;
int codePage;
virtual bool InternalIsLeadByte(char ch)=0;
virtual void Fill(int position)=0;
@@ -44,7 +44,7 @@ public:
if (position < startPos || position >= endPos) {
Fill(position);
if (position < startPos || position >= endPos) {
// Position is outside range of document
// Position is outside range of document
return chDefault;
}
}

View File

@@ -7,7 +7,7 @@
typedef void (*LexerFunction)(unsigned int startPos, int lengthDoc, int initStyle,
WordList *keywordlists[], Accessor &styler);
/**
* A LexerModule is responsible for lexing and folding a particular language.
* The class maintains a list of LexerModules which can be searched to find a
@@ -26,7 +26,7 @@ protected:
public:
const char *languageName;
LexerModule(int language_, LexerFunction fnLexer_,
LexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_=0, LexerFunction fnFolder_=0,
const char * const wordListDescriptions_[] = NULL);
int GetLanguage() const { return language; }

View File

@@ -24,11 +24,21 @@ struct Property {
/**
*/
class PropSet {
private:
protected:
enum { hashRoots=31 };
Property *props[hashRoots];
Property *enumnext;
int enumhash;
static unsigned int HashString(const char *s, size_t len) {
unsigned int ret = 0;
while (len--) {
ret <<= 4;
ret ^= *s;
s++;
}
return ret;
}
static bool IncludesVar(const char *value, const char *key);
public:
PropSet *superPS;
PropSet();

View File

@@ -56,6 +56,9 @@
#define SCLEX_POV 39
#define SCLEX_LOUT 40
#define SCLEX_ESCRIPT 41
#define SCLEX_PS 42
#define SCLEX_NSIS 43
#define SCLEX_MMIXAL 44
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@@ -268,6 +271,8 @@
#define SCE_LUA_WORD4 15
#define SCE_LUA_WORD5 16
#define SCE_LUA_WORD6 17
#define SCE_LUA_WORD7 18
#define SCE_LUA_WORD8 19
#define SCE_ERR_DEFAULT 0
#define SCE_ERR_PYTHON 1
#define SCE_ERR_GCC 2
@@ -455,14 +460,20 @@
#define SCE_POV_DEFAULT 0
#define SCE_POV_COMMENT 1
#define SCE_POV_COMMENTLINE 2
#define SCE_POV_COMMENTDOC 3
#define SCE_POV_NUMBER 4
#define SCE_POV_WORD 5
#define SCE_POV_NUMBER 3
#define SCE_POV_OPERATOR 4
#define SCE_POV_IDENTIFIER 5
#define SCE_POV_STRING 6
#define SCE_POV_OPERATOR 7
#define SCE_POV_IDENTIFIER 8
#define SCE_POV_BRACE 9
#define SCE_POV_STRINGEOL 7
#define SCE_POV_DIRECTIVE 8
#define SCE_POV_BADDIRECTIVE 9
#define SCE_POV_WORD2 10
#define SCE_POV_WORD3 11
#define SCE_POV_WORD4 12
#define SCE_POV_WORD5 13
#define SCE_POV_WORD6 14
#define SCE_POV_WORD7 15
#define SCE_POV_WORD8 16
#define SCE_LOUT_DEFAULT 0
#define SCE_LOUT_COMMENT 1
#define SCE_LOUT_NUMBER 2
@@ -486,6 +497,54 @@
#define SCE_ESCRIPT_BRACE 9
#define SCE_ESCRIPT_WORD2 10
#define SCE_ESCRIPT_WORD3 11
#define SCE_PS_DEFAULT 0
#define SCE_PS_COMMENT 1
#define SCE_PS_DSC_COMMENT 2
#define SCE_PS_DSC_VALUE 3
#define SCE_PS_NUMBER 4
#define SCE_PS_NAME 5
#define SCE_PS_KEYWORD 6
#define SCE_PS_LITERAL 7
#define SCE_PS_IMMEVAL 8
#define SCE_PS_PAREN_ARRAY 9
#define SCE_PS_PAREN_DICT 10
#define SCE_PS_PAREN_PROC 11
#define SCE_PS_TEXT 12
#define SCE_PS_HEXSTRING 13
#define SCE_PS_BASE85STRING 14
#define SCE_PS_BADSTRINGCHAR 15
#define SCE_NSIS_DEFAULT 0
#define SCE_NSIS_COMMENT 1
#define SCE_NSIS_STRINGDQ 2
#define SCE_NSIS_STRINGLQ 3
#define SCE_NSIS_STRINGRQ 4
#define SCE_NSIS_FUNCTION 5
#define SCE_NSIS_VARIABLE 6
#define SCE_NSIS_LABEL 7
#define SCE_NSIS_USERDEFINED 8
#define SCE_NSIS_SECTIONDEF 9
#define SCE_NSIS_SUBSECTIONDEF 10
#define SCE_NSIS_IFDEFINEDEF 11
#define SCE_NSIS_MACRODEF 12
#define SCE_NSIS_STRINGVAR 13
#define SCE_MMIXAL_LEADWS 0
#define SCE_MMIXAL_COMMENT 1
#define SCE_MMIXAL_LABEL 2
#define SCE_MMIXAL_OPCODE 3
#define SCE_MMIXAL_OPCODE_PRE 4
#define SCE_MMIXAL_OPCODE_VALID 5
#define SCE_MMIXAL_OPCODE_UNKNOWN 6
#define SCE_MMIXAL_OPCODE_POST 7
#define SCE_MMIXAL_OPERANDS 8
#define SCE_MMIXAL_NUMBER 9
#define SCE_MMIXAL_REF 10
#define SCE_MMIXAL_CHAR 11
#define SCE_MMIXAL_STRING 12
#define SCE_MMIXAL_REGISTER 13
#define SCE_MMIXAL_HEX 14
#define SCE_MMIXAL_OPERATOR 15
#define SCE_MMIXAL_SYMBOL 16
#define SCE_MMIXAL_INCLUDE 17
//--Autogenerated -- end of section automatically generated from Scintilla.iface
#endif

View File

@@ -204,6 +204,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define INDIC_TT 2
#define INDIC_DIAGONAL 3
#define INDIC_STRIKE 4
#define INDIC_HIDDEN 5
#define INDIC0_MASK 0x20
#define INDIC1_MASK 0x40
#define INDIC2_MASK 0x80
@@ -546,6 +547,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETLEXER 4002
#define SCI_COLOURISE 4003
#define SCI_SETPROPERTY 4004
#define KEYWORDSET_MAX 8
#define SCI_SETKEYWORDS 4005
#define SCI_SETLEXERLANGUAGE 4006
#define SCI_LOADLEXERLIBRARY 4007

View File

@@ -462,6 +462,7 @@ val INDIC_SQUIGGLE=1
val INDIC_TT=2
val INDIC_DIAGONAL=3
val INDIC_STRIKE=4
val INDIC_HIDDEN=5
val INDIC0_MASK=0x20
val INDIC1_MASK=0x40
val INDIC2_MASK=0x80
@@ -1476,6 +1477,9 @@ fun void Colourise=4003(position start, position end)
# Set up a value that may be used by a lexer for some optional feature.
set void SetProperty=4004(string key, string value)
# Maximum value of keywordSet parameter of SetKeyWords.
val KEYWORDSET_MAX=8
# Set up the key words used by the lexer.
set void SetKeyWords=4005(int keywordSet, string keyWords)
@@ -1584,6 +1588,9 @@ val SCLEX_CSS=38
val SCLEX_POV=39
val SCLEX_LOUT=40
val SCLEX_ESCRIPT=41
val SCLEX_PS=42
val SCLEX_NSIS=43
val SCLEX_MMIXAL=44
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@@ -1835,6 +1842,8 @@ val SCE_LUA_WORD3=14
val SCE_LUA_WORD4=15
val SCE_LUA_WORD5=16
val SCE_LUA_WORD6=17
val SCE_LUA_WORD7=18
val SCE_LUA_WORD8=19
# Lexical states for SCLEX_ERRORLIST
lex ErrorList=SCLEX_ERRORLIST SCE_ERR_
val SCE_ERR_DEFAULT=0
@@ -2058,14 +2067,20 @@ lex POV=SCLEX_POV SCE_POV_
val SCE_POV_DEFAULT=0
val SCE_POV_COMMENT=1
val SCE_POV_COMMENTLINE=2
val SCE_POV_COMMENTDOC=3
val SCE_POV_NUMBER=4
val SCE_POV_WORD=5
val SCE_POV_NUMBER=3
val SCE_POV_OPERATOR=4
val SCE_POV_IDENTIFIER=5
val SCE_POV_STRING=6
val SCE_POV_OPERATOR=7
val SCE_POV_IDENTIFIER=8
val SCE_POV_BRACE=9
val SCE_POV_STRINGEOL=7
val SCE_POV_DIRECTIVE=8
val SCE_POV_BADDIRECTIVE=9
val SCE_POV_WORD2=10
val SCE_POV_WORD3=11
val SCE_POV_WORD4=12
val SCE_POV_WORD5=13
val SCE_POV_WORD6=14
val SCE_POV_WORD7=15
val SCE_POV_WORD8=16
# Lexical states for SCLEX_LOUT
lex LOUT=SCLEX_LOUT SCE_LOUT_
val SCE_LOUT_DEFAULT=0
@@ -2093,6 +2108,60 @@ val SCE_ESCRIPT_IDENTIFIER=8
val SCE_ESCRIPT_BRACE=9
val SCE_ESCRIPT_WORD2=10
val SCE_ESCRIPT_WORD3=11
# Lexical states for SCLEX_PS
lex PS=SCLEX_PS SCE_PS_
val SCE_PS_DEFAULT=0
val SCE_PS_COMMENT=1
val SCE_PS_DSC_COMMENT=2
val SCE_PS_DSC_VALUE=3
val SCE_PS_NUMBER=4
val SCE_PS_NAME=5
val SCE_PS_KEYWORD=6
val SCE_PS_LITERAL=7
val SCE_PS_IMMEVAL=8
val SCE_PS_PAREN_ARRAY=9
val SCE_PS_PAREN_DICT=10
val SCE_PS_PAREN_PROC=11
val SCE_PS_TEXT=12
val SCE_PS_HEXSTRING=13
val SCE_PS_BASE85STRING=14
val SCE_PS_BADSTRINGCHAR=15
# Lexical states for SCLEX_NSIS
lex NSIS=SCLEX_NSIS SCE_NSIS_
val SCE_NSIS_DEFAULT=0
val SCE_NSIS_COMMENT=1
val SCE_NSIS_STRINGDQ=2
val SCE_NSIS_STRINGLQ=3
val SCE_NSIS_STRINGRQ=4
val SCE_NSIS_FUNCTION=5
val SCE_NSIS_VARIABLE=6
val SCE_NSIS_LABEL=7
val SCE_NSIS_USERDEFINED=8
val SCE_NSIS_SECTIONDEF=9
val SCE_NSIS_SUBSECTIONDEF=10
val SCE_NSIS_IFDEFINEDEF=11
val SCE_NSIS_MACRODEF=12
val SCE_NSIS_STRINGVAR=13
# Lexical states for SCLEX_MMIXAL
lex MMIXAL=SCLEX_MMIXAL SCE_MMIXAL_
val SCE_MMIXAL_LEADWS=0
val SCE_MMIXAL_COMMENT=1
val SCE_MMIXAL_LABEL=2
val SCE_MMIXAL_OPCODE=3
val SCE_MMIXAL_OPCODE_PRE=4
val SCE_MMIXAL_OPCODE_VALID=5
val SCE_MMIXAL_OPCODE_UNKNOWN=6
val SCE_MMIXAL_OPCODE_POST=7
val SCE_MMIXAL_OPERANDS=8
val SCE_MMIXAL_NUMBER=9
val SCE_MMIXAL_REF=10
val SCE_MMIXAL_CHAR=11
val SCE_MMIXAL_STRING=12
val SCE_MMIXAL_REGISTER=13
val SCE_MMIXAL_HEX=14
val SCE_MMIXAL_OPERATOR=15
val SCE_MMIXAL_SYMBOL=16
val SCE_MMIXAL_INCLUDE=17
# Events

View File

@@ -26,8 +26,8 @@ protected:
bool InternalIsLeadByte(char ch);
void Fill(int position);
public:
WindowAccessor(WindowID id_, PropSet &props_) :
Accessor(), id(id_), props(props_),
WindowAccessor(WindowID id_, PropSet &props_) :
Accessor(), id(id_), props(props_),
lenDoc(-1), validLen(0), chFlags(0), chWhile(0) {
}
~WindowAccessor();
@@ -40,8 +40,8 @@ public:
void Flush();
int GetLineState(int line);
int SetLineState(int line, int state);
int GetPropertyInt(const char *key, int defaultValue=0) {
return props.GetInt(key, defaultValue);
int GetPropertyInt(const char *key, int defaultValue=0) {
return props.GetInt(key, defaultValue);
}
char *GetProperties() {
return props.ToString();

View File

@@ -103,9 +103,9 @@ void MarkerHandleSet::RemoveNumber(int markerNum) {
if (mhn->number == markerNum) {
*pmhn = mhn->next;
delete mhn;
return ;
} else {
pmhn = &((*pmhn)->next);
}
pmhn = &((*pmhn)->next);
}
}

View File

@@ -212,7 +212,7 @@ public:
int GetMark(int line);
void DeleteAllMarks(int markerNum);
int LineFromHandle(int markerHandle);
/// Actions without undo
void BasicInsertString(int position, char *s, int insertLength);
void BasicDeleteChars(int position, int deleteLength);

View File

@@ -394,7 +394,7 @@ bool Document::InsertStyledString(int position, char *s, int insertLength) {
DocModification(
SC_MOD_BEFOREINSERT | SC_PERFORMED_USER,
position / 2, insertLength / 2,
0, 0));
0, s));
int prevLinesTotal = LinesTotal();
bool startSavePoint = cb.IsSavePoint();
const char *text = cb.InsertString(position, s, insertLength);
@@ -926,7 +926,7 @@ long Document::FindText(int minPos, int maxPos, const char *s,
if (line == lineRangeStart) {
if ((startPos != endOfLine) && (searchEnd == '$'))
continue; // Can't match end of line if start position before end of line
endOfLine = startPos;
endOfLine = startPos+1;
}
}
@@ -938,10 +938,10 @@ long Document::FindText(int minPos, int maxPos, const char *s,
if (increment == -1) {
// Check for the last match on this line.
int repetitions = 1000; // Break out of infinite loop
while (success && (pre->eopat[0] < endOfLine) && (repetitions--)) {
success = pre->Execute(di, pre->eopat[0], endOfLine);
while (success && (pre->eopat[0] <= (endOfLine+1)) && (repetitions--)) {
success = pre->Execute(di, pos+1, endOfLine+1);
if (success) {
if (pre->eopat[0] <= minPos) {
if (pre->eopat[0] <= (minPos+1)) {
pos = pre->bopat[0];
lenRet = pre->eopat[0] - pre->bopat[0];
} else {

View File

@@ -130,8 +130,8 @@ void DocumentAccessor::Flush() {
lenDoc = -1;
if (validLen > 0) {
pdoc->SetStyles(validLen, styleBuf);
validLen = 0;
startPosStyling += validLen;
validLen = 0;
}
}

View File

@@ -32,9 +32,9 @@ protected:
void Fill(int position);
public:
DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) :
DocumentAccessor(Document *pdoc_, PropSet &props_, WindowID id_=0) :
Accessor(), pdoc(pdoc_), props(props_), id(id_),
lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
lenDoc(-1), validLen(0), chFlags(0), chWhile(0),
startSeg(0), startPosStyling(0) {
}
~DocumentAccessor();
@@ -47,8 +47,8 @@ public:
void Flush();
int GetLineState(int line);
int SetLineState(int line, int state);
int GetPropertyInt(const char *key, int defaultValue=0) {
return props.GetInt(key, defaultValue);
int GetPropertyInt(const char *key, int defaultValue=0) {
return props.GetInt(key, defaultValue);
}
char *GetProperties() {
return props.ToString();

View File

@@ -1414,7 +1414,7 @@ void Editor::LinesSplit(int pixelWidth) {
for (int subLine = 1; subLine < ll->lines; subLine++) {
pdoc->InsertString(posLineStart + (subLine - 1) * strlen(eol) +
ll->LineStart(subLine), eol);
targetEnd += strlen(eol);
targetEnd += static_cast<int>(strlen(eol));
}
}
}
@@ -1428,6 +1428,12 @@ int Editor::SubstituteMarkerIfEmpty(int markerCheck, int markerDefault) {
return markerCheck;
}
// Avoid 64 bit compiler warnings.
// Scintilla does not support text buffers larger than 2**31
static int istrlen(const char *s) {
return static_cast<int>(strlen(s));
}
void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
if (vs.fixedColumnWidth == 0)
return;
@@ -1589,11 +1595,11 @@ void Editor::PaintSelMargin(Surface *surfWindow, PRectangle &rc) {
}
PRectangle rcNumber = rcMarker;
// Right justify
int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, strlen(number));
int width = surface->WidthText(vs.styles[STYLE_LINENUMBER].font, number, istrlen(number));
int xpos = rcNumber.right - width - 3;
rcNumber.left = xpos;
surface->DrawTextNoClip(rcNumber, vs.styles[STYLE_LINENUMBER].font,
rcNumber.top + vs.maxAscent, number, strlen(number),
rcNumber.top + vs.maxAscent, number, istrlen(number),
vs.styles[STYLE_LINENUMBER].fore.allocated,
vs.styles[STYLE_LINENUMBER].back.allocated);
}
@@ -1770,7 +1776,7 @@ void Editor::LayoutLine(int line, Surface *surface, ViewStyle &vstyle, LineLayou
} else if (controlCharSymbol < 32) {
const char *ctrlChar = ControlCharacterString(ll->chars[charInLine]);
// +3 For a blank on front and rounded edge each side:
ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, strlen(ctrlChar)) + 3;
ll->positions[charInLine + 1] = surface->WidthText(ctrlCharsFont, ctrlChar, istrlen(ctrlChar)) + 3;
} else {
char cc[2] = { static_cast<char>(controlCharSymbol), '\0' };
surface->MeasureWidths(ctrlCharsFont, cc, 1,
@@ -2135,7 +2141,7 @@ void Editor::DrawLine(Surface *surface, ViewStyle &vsDraw, int line, int lineVis
rcChar.left++;
rcChar.right--;
surface->DrawTextClipped(rcChar, ctrlCharsFont,
rcSegment.top + vsDraw.maxAscent, ctrlChar, strlen(ctrlChar),
rcSegment.top + vsDraw.maxAscent, ctrlChar, istrlen(ctrlChar),
textBack, textFore);
} else {
char cc[2] = { static_cast<char>(controlCharSymbol), '\0' };
@@ -2360,7 +2366,9 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
if (AbandonPaint()) {
return;
}
RefreshPixMaps(surfaceWindow); // In case pixmaps invalidated by scrollbar change
}
PLATFORM_ASSERT(pixmapSelPattern->Initialised());
PRectangle rcRightMargin = rcClient;
rcRightMargin.left = rcRightMargin.right - vs.rightMarginWidth;
@@ -2389,6 +2397,7 @@ void Editor::Paint(Surface *surfaceWindow, PRectangle rcArea) {
Surface *surface = surfaceWindow;
if (bufferedDraw) {
surface = pixmapLine;
PLATFORM_ASSERT(pixmapLine->Initialised());
}
surface->SetUnicodeMode(IsUnicodeMode());
surface->SetDBCSMode(CodePage());
@@ -2680,7 +2689,7 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
int lineNumberWidth = 0;
if (lineNumberIndex >= 0) {
lineNumberWidth = surfaceMeasure->WidthText(vsPrint.styles[STYLE_LINENUMBER].font,
"99999" lineNumberPrintSpace, 5 + strlen(lineNumberPrintSpace));
"99999" lineNumberPrintSpace, 5 + istrlen(lineNumberPrintSpace));
vsPrint.ms[lineNumberIndex].width = lineNumberWidth;
}
@@ -2760,10 +2769,10 @@ long Editor::FormatRange(bool draw, RangeToFormat *pfr) {
rcNumber.right = rcNumber.left + lineNumberWidth;
// Right justify
rcNumber.left -= surfaceMeasure->WidthText(
vsPrint.styles[STYLE_LINENUMBER].font, number, strlen(number));
vsPrint.styles[STYLE_LINENUMBER].font, number, istrlen(number));
surface->FlushCachedState();
surface->DrawTextNoClip(rcNumber, vsPrint.styles[STYLE_LINENUMBER].font,
ypos + vsPrint.maxAscent, number, strlen(number),
ypos + vsPrint.maxAscent, number, istrlen(number),
vsPrint.styles[STYLE_LINENUMBER].fore.allocated,
vsPrint.styles[STYLE_LINENUMBER].back.allocated);
}
@@ -2799,7 +2808,7 @@ int Editor::TextWidth(int style, const char *text) {
RefreshStyleData();
AutoSurface surface(this);
if (surface) {
return surface->WidthText(vs.styles[style].font, text, strlen(text));
return surface->WidthText(vs.styles[style].font, text, istrlen(text));
} else {
return 1;
}
@@ -3553,7 +3562,7 @@ void Editor::LineDuplicate() {
char *thisLine = CopyRange(start, end);
const char *eol = StringFromEOLMode(pdoc->eolMode);
pdoc->InsertString(end, eol);
pdoc->InsertString(end + strlen(eol), thisLine, end - start);
pdoc->InsertString(end + istrlen(eol), thisLine, end - start);
delete []thisLine;
}
@@ -3568,7 +3577,7 @@ void Editor::NewLine() {
eol = "\r";
} // else SC_EOL_LF -> "\n" already set
if (pdoc->InsertString(currentPos, eol)) {
SetEmptySelection(currentPos + strlen(eol));
SetEmptySelection(currentPos + istrlen(eol));
while (*eol) {
NotifyChar(*eol);
eol++;
@@ -4069,7 +4078,7 @@ long Editor::FindText(
sptr_t lParam) { ///< @c TextToFind structure: The text to search for in the given range.
TextToFind *ft = reinterpret_cast<TextToFind *>(lParam);
int lengthFound = strlen(ft->lpstrText);
int lengthFound = istrlen(ft->lpstrText);
int pos = pdoc->FindText(ft->chrg.cpMin, ft->chrg.cpMax, ft->lpstrText,
(wParam & SCFIND_MATCHCASE) != 0,
(wParam & SCFIND_WHOLEWORD) != 0,
@@ -4112,7 +4121,7 @@ long Editor::SearchText(
const char *txt = reinterpret_cast<char *>(lParam);
int pos;
int lengthFound = strlen(txt);
int lengthFound = istrlen(txt);
if (iMessage == SCI_SEARCHNEXT) {
pos = pdoc->FindText(searchAnchor, pdoc->Length(), txt,
(wParam & SCFIND_MATCHCASE) != 0,
@@ -4315,14 +4324,14 @@ void Editor::DropAt(int position, const char *value, bool moving, bool rectangul
position = positionAfterDeletion;
if (rectangular) {
PasteRectangular(position, value, strlen(value));
PasteRectangular(position, value, istrlen(value));
pdoc->EndUndoAction();
// Should try to select new rectangle but it may not be a rectangle now so just select the drop position
SetSelection(position, position);
} else {
position = MovePositionOutsideChar(position, currentPos - position);
if (pdoc->InsertString(position, value)) {
SetSelection(position + strlen(value), position);
SetSelection(position + istrlen(value), position);
}
pdoc->EndUndoAction();
}
@@ -4990,7 +4999,7 @@ void Editor::EnsureLineVisible(int lineDoc, bool enforcePolicy) {
int Editor::ReplaceTarget(bool replacePatterns, const char *text, int length) {
pdoc->BeginUndoAction();
if (length == -1)
length = strlen(text);
length = istrlen(text);
if (replacePatterns) {
text = pdoc->SubstituteByPosition(text, &length);
if (!text)
@@ -5186,7 +5195,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
char *replacement = CharPtrFromSPtr(lParam);
pdoc->InsertString(currentPos, replacement);
pdoc->EndUndoAction();
SetEmptySelection(currentPos + strlen(replacement));
SetEmptySelection(currentPos + istrlen(replacement));
EnsureCaretVisible();
}
break;
@@ -5357,7 +5366,7 @@ sptr_t Editor::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) {
char *sz = CharPtrFromSPtr(lParam);
pdoc->InsertString(insertPos, sz);
if (newCurrent > insertPos)
newCurrent += strlen(sz);
newCurrent += istrlen(sz);
SetEmptySelection(newCurrent);
return 0;
}

View File

@@ -10,16 +10,8 @@
#if PLAT_WIN
#define EXT_LEXER_DECL __stdcall
#elif PLAT_GTK
#define EXT_LEXER_DECL
#endif
#if PLAT_WX
#ifdef __WXMSW__
#define EXT_LEXER_DECL __stdcall
#else
#define EXT_LEXER_DECL
#endif
#define EXT_LEXER_DECL
#endif
// External Lexer function definitions...
@@ -41,7 +33,7 @@ protected:
int externalLanguage;
char name[100];
public:
ExternalLexerModule(int language_, LexerFunction fnLexer_,
ExternalLexerModule(int language_, LexerFunction fnLexer_,
const char *languageName_=0, LexerFunction fnFolder_=0) : LexerModule(language_, fnLexer_, 0, fnFolder_){
strncpy(name, languageName_, sizeof(name));
languageName = name;
@@ -70,7 +62,7 @@ public:
LexerLibrary(const char* ModuleName);
~LexerLibrary();
void Release();
LexerLibrary *next;
SString m_sModuleName;
};
@@ -79,10 +71,10 @@ public:
class LexerManager {
public:
~LexerManager();
static LexerManager *GetInstance();
static void DeleteInstance();
void Load(const char* path);
void Clear();

View File

@@ -55,6 +55,8 @@ void Indicator::Draw(Surface *surface, PRectangle &rc) {
} else if (style == INDIC_STRIKE) {
surface->MoveTo(rc.left, rc.top - 4);
surface->LineTo(rc.right, rc.top - 4);
} else if (style == INDIC_HIDDEN) {
// Draw nothing
} else { // Either INDIC_PLAIN or unknown
surface->MoveTo(rc.left, ymid);
surface->LineTo(rc.right, ymid);

View File

@@ -153,6 +153,8 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmLout);
LINK_LEXER(lmLua);
LINK_LEXER(lmMatlab);
LINK_LEXER(lmMMIXAL);
LINK_LEXER(lmNsis);
LINK_LEXER(lmBatch);
LINK_LEXER(lmDiff);
LINK_LEXER(lmProps);
@@ -163,8 +165,10 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmPascal);
LINK_LEXER(lmPerl);
LINK_LEXER(lmPOV);
LINK_LEXER(lmPS);
LINK_LEXER(lmPython);
LINK_LEXER(lmRuby);
LINK_LEXER(lmScriptol);
LINK_LEXER(lmSQL);
LINK_LEXER(lmVB);
LINK_LEXER(lmVBScript);

View File

@@ -321,7 +321,7 @@ static bool IsValidIdentifier(const SString& identifier) {
// First character can't be '_', so initialize the flag to true
bool lastWasUnderscore = true;
int length = identifier.length();
size_t length = identifier.length();
// Zero-length identifiers are not valid (these can occur inside labels)
if (length == 0) {
@@ -334,7 +334,7 @@ static bool IsValidIdentifier(const SString& identifier) {
}
// Check for only valid characters and no double underscores
for (int i = 0; i < length; i++) {
for (size_t i = 0; i < length; i++) {
if (!IsWordCharacter(identifier[i]) ||
(identifier[i] == '_' && lastWasUnderscore)) {
return false;
@@ -355,8 +355,8 @@ static bool IsValidNumber(const SString& number) {
int hashPos = number.search("#");
bool seenDot = false;
int i = 0;
int length = number.length();
size_t i = 0;
size_t length = number.length();
if (length == 0)
return false; // Just in case

View File

@@ -108,7 +108,8 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.SetState(SCE_CSS_DEFAULT);
break;
case ':':
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT || lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID)
if (lastState == SCE_CSS_TAG || lastState == SCE_CSS_PSEUDOCLASS || lastState == SCE_CSS_DEFAULT ||
lastState == SCE_CSS_CLASS || lastState == SCE_CSS_ID || lastState == SCE_CSS_UNKNOWN_PSEUDOCLASS)
sc.SetState(SCE_CSS_PSEUDOCLASS);
else if (lastState == SCE_CSS_IDENTIFIER || lastState == SCE_CSS_UNKNOWN_IDENTIFIER)
sc.SetState(SCE_CSS_VALUE);

View File

@@ -195,7 +195,7 @@ static void FoldESCRIPTDoc(unsigned int startPos, int length, int initStyle, Wor
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) {
levelCurrent++;

View File

@@ -127,7 +127,7 @@ static int stateForPrintState(int StateToPrint) {
}
static inline bool IsNumber(unsigned int start, Accessor &styler) {
return isdigit(styler[start]) || (styler[start] == '.') ||
return IsADigit(styler[start]) || (styler[start] == '.') ||
(styler[start] == '-') || (styler[start] == '#');
}
@@ -246,7 +246,7 @@ static int classifyTagHTML(unsigned int start, unsigned int end,
static void classifyWordHTJS(unsigned int start, unsigned int end,
WordList &keywords, Accessor &styler, script_mode inScriptType) {
char chAttr = SCE_HJ_WORD;
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
if (wordIsNumber)
chAttr = SCE_HJ_NUMBER;
else {
@@ -264,7 +264,7 @@ static void classifyWordHTJS(unsigned int start, unsigned int end,
static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) {
char chAttr = SCE_HB_IDENTIFIER;
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
if (wordIsNumber)
chAttr = SCE_HB_NUMBER;
else {
@@ -288,7 +288,7 @@ static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keyw
}
static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord, script_mode inScriptType) {
bool wordIsNumber = isdigit(styler[start]) != 0;
bool wordIsNumber = IsADigit(styler[start]);
char s[30 + 1];
unsigned int i = 0;
for (; i < end - start + 1 && i < 30; i++) {
@@ -312,7 +312,7 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key
// Called when in a PHP word
static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char chAttr = SCE_HPHP_DEFAULT;
bool wordIsNumber = isdigit(styler[start]) != 0;
bool wordIsNumber = IsADigit(styler[start]);
if (wordIsNumber)
chAttr = SCE_HPHP_NUMBER;
else {
@@ -375,19 +375,21 @@ static int StateForScript(script_type scriptLanguage) {
}
static inline bool ishtmlwordchar(char ch) {
return isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#';
return !isascii(ch) ||
(isalnum(ch) || ch == '.' || ch == '-' || ch == '_' || ch == ':' || ch == '!' || ch == '#');
}
static inline bool issgmlwordchar(char ch) {
return isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[';
return !isascii(ch) ||
(isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[');
}
static inline bool IsPhpWordStart(const unsigned char ch) {
return isalpha(ch) || (ch == '_') || (ch >= 0x7f);
return (isascii(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f);
}
static inline bool IsPhpWordChar(char ch) {
return isdigit(ch) || IsPhpWordStart(ch);
return IsADigit(ch) || IsPhpWordStart(ch);
}
static bool InTagState(int state) {
@@ -787,7 +789,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
} else if ((ch == '-') && (chPrev == '-')) {
styler.ColourTo(i - 2, StateToPrint);
state = SCE_H_SGML_COMMENT;
} else if (isalpha(ch) && (chPrev == '%')) {
} else if (isascii(ch) && isalpha(ch) && (chPrev == '%')) {
styler.ColourTo(i - 2, StateToPrint);
state = SCE_H_SGML_ENTITY;
} else if (ch == '#') {
@@ -905,7 +907,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_H_SGML_SPECIAL:
if (!isupper(ch)) {
if (!(isascii(ch) && isupper(ch))) {
styler.ColourTo(i - 1, StateToPrint);
if (isalnum(ch)) {
state = SCE_H_SGML_ERROR;
@@ -918,7 +920,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (ch == ';') {
styler.ColourTo(i, StateToPrint);
state = SCE_H_SGML_DEFAULT;
} else if (!isalnum(ch) && ch != '-' && ch != '.') {
} else if (!(isascii(ch) && isalnum(ch)) && ch != '-' && ch != '.') {
styler.ColourTo(i, SCE_H_SGML_ERROR);
state = SCE_H_SGML_DEFAULT;
}
@@ -928,7 +930,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i, StateToPrint);
state = SCE_H_DEFAULT;
}
if (ch != '#' && !isalnum(ch)) { // Should check that '#' follows '&', but it is unlikely anyway...
if (ch != '#' && !(isascii(ch) && isalnum(ch))) { // Should check that '#' follows '&', but it is unlikely anyway...
styler.ColourTo(i, SCE_H_TAGUNKNOWN);
state = SCE_H_DEFAULT;
}
@@ -1464,7 +1466,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_HPHP_NUMBER:
if (!isdigit(ch)) {
if (!IsADigit(ch)) {
styler.ColourTo(i - 1, SCE_HPHP_NUMBER);
if (isoperator(ch))
state = SCE_HPHP_OPERATOR;
@@ -1524,7 +1526,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HPHP_OPERATOR:
case SCE_HPHP_DEFAULT:
styler.ColourTo(i - 1, StateToPrint);
if (isdigit(ch)) {
if (IsADigit(ch)) {
state = SCE_HPHP_NUMBER;
} else if (iswordstart(ch)) {
state = SCE_HPHP_WORD;

View File

@@ -24,7 +24,7 @@
#include "SciLexer.h"
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
}
inline bool IsAWordStart(const int ch) {
@@ -58,6 +58,8 @@ static void ColouriseLuaDoc(
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
int currentLine = styler.GetLine(startPos);
// Initialize the literal string [[ ... ]] nesting level, if we are inside such a string.
@@ -121,11 +123,15 @@ static void ColouriseLuaDoc(
if (sc.state == SCE_LUA_OPERATOR) {
sc.SetState(SCE_LUA_DEFAULT);
} else if (sc.state == SCE_LUA_NUMBER) {
if (!IsAWordChar(sc.ch)) {
sc.SetState(SCE_LUA_DEFAULT);
// We stop the number definition on non-numerical non-dot non-eE non-sign char
if (!(isdigit(sc.ch) || sc.ch == '.' ||
toupper(sc.ch) == 'E' || sc.ch == '-' || sc.ch == '+')) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
sc.SetState(SCE_LUA_DEFAULT);
}
} else if (sc.state == SCE_LUA_IDENTIFIER) {
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
if (!IsAWordChar(sc.ch)) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) {
@@ -140,6 +146,12 @@ static void ColouriseLuaDoc(
sc.ChangeState(SCE_LUA_WORD5);
} else if (keywords6.InList(s)) {
sc.ChangeState(SCE_LUA_WORD6);
} else if (keywords6.InList(s)) {
sc.ChangeState(SCE_LUA_WORD6);
} else if (keywords7.InList(s)) {
sc.ChangeState(SCE_LUA_WORD7);
} else if (keywords8.InList(s)) {
sc.ChangeState(SCE_LUA_WORD8);
}
sc.SetState(SCE_LUA_DEFAULT);
}
@@ -300,8 +312,8 @@ static void FoldLuaDoc(unsigned int startPos, int length, int /* initStyle */, W
static const char * const luaWordListDesc[] = {
"Keywords",
"Basic functions",
"String & math functions",
"I/O & system facilities",
"String, (table) & math functions",
"(coroutines), I/O & system facilities",
"XXX",
"XXX",
0

View File

@@ -0,0 +1,183 @@
// Scintilla source code edit control
/** @file LexMMIXAL.cxx
** Lexer for MMIX Assembler Language.
** Written by Christoph H<>sler <christoph.hoesler@student.uni-tuebingen.de>
** For information about MMIX visit http://www-cs-faculty.stanford.edu/~knuth/mmix.html
**/
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == ':' || ch == '_');
}
inline bool isMMIXALOperator(char ch) {
if (isalnum(ch))
return false;
if (ch == '+' || ch == '-' || ch == '|' || ch == '^' ||
ch == '*' || ch == '/' || ch == '/' ||
ch == '%' || ch == '<' || ch == '>' || ch == '&' ||
ch == '~' || ch == '$' ||
ch == ',' || ch == '(' || ch == ')' ||
ch == '[' || ch == ']')
return true;
return false;
}
static void ColouriseMMIXALDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &opcodes = *keywordlists[0];
WordList &special_register = *keywordlists[1];
WordList &predef_symbols = *keywordlists[2];
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward())
{
// No EOL continuation
if (sc.atLineStart) {
if (sc.ch == '@' && sc.chNext == 'i') {
sc.SetState(SCE_MMIXAL_INCLUDE);
} else {
sc.SetState(SCE_MMIXAL_LEADWS);
}
}
// Check if first non whitespace character in line is alphanumeric
if (sc.state == SCE_MMIXAL_LEADWS && !isspace(sc.ch)) { // LEADWS
if(!IsAWordChar(sc.ch)) {
sc.SetState(SCE_MMIXAL_COMMENT);
} else {
if(sc.atLineStart) {
sc.SetState(SCE_MMIXAL_LABEL);
} else {
sc.SetState(SCE_MMIXAL_OPCODE_PRE);
}
}
}
// Determine if the current state should terminate.
if (sc.state == SCE_MMIXAL_OPERATOR) { // OPERATOR
sc.SetState(SCE_MMIXAL_OPERANDS);
} else if (sc.state == SCE_MMIXAL_NUMBER) { // NUMBER
if (!isdigit(sc.ch)) {
if (IsAWordChar(sc.ch)) {
char s[100];
sc.GetCurrent(s, sizeof(s));
sc.ChangeState(SCE_MMIXAL_REF);
sc.SetState(SCE_MMIXAL_REF);
} else {
sc.SetState(SCE_MMIXAL_OPERANDS);
}
}
} else if (sc.state == SCE_MMIXAL_LABEL) { // LABEL
if (!IsAWordChar(sc.ch) ) {
sc.SetState(SCE_MMIXAL_OPCODE_PRE);
}
} else if (sc.state == SCE_MMIXAL_REF) { // REF
if (!IsAWordChar(sc.ch) ) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (*s == ':') { // ignore base prefix for match
for (size_t i = 0; i != sizeof(s); ++i) {
*(s+i) = *(s+i+1);
}
}
if (special_register.InList(s)) {
sc.ChangeState(SCE_MMIXAL_REGISTER);
} else if (predef_symbols.InList(s)) {
sc.ChangeState(SCE_MMIXAL_SYMBOL);
}
sc.SetState(SCE_MMIXAL_OPERANDS);
}
} else if (sc.state == SCE_MMIXAL_OPCODE_PRE) { // OPCODE_PRE
if (!isspace(sc.ch)) {
sc.SetState(SCE_MMIXAL_OPCODE);
}
} else if (sc.state == SCE_MMIXAL_OPCODE) { // OPCODE
if (!IsAWordChar(sc.ch) ) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (opcodes.InList(s)) {
sc.ChangeState(SCE_MMIXAL_OPCODE_VALID);
} else {
sc.ChangeState(SCE_MMIXAL_OPCODE_UNKNOWN);
}
sc.SetState(SCE_MMIXAL_OPCODE_POST);
}
} else if (sc.state == SCE_MMIXAL_STRING) { // STRING
if (sc.ch == '\"') {
sc.ForwardSetState(SCE_MMIXAL_OPERANDS);
} else if (sc.atLineEnd) {
sc.ForwardSetState(SCE_MMIXAL_OPERANDS);
}
} else if (sc.state == SCE_MMIXAL_CHAR) { // CHAR
if (sc.ch == '\'') {
sc.ForwardSetState(SCE_MMIXAL_OPERANDS);
} else if (sc.atLineEnd) {
sc.ForwardSetState(SCE_MMIXAL_OPERANDS);
}
} else if (sc.state == SCE_MMIXAL_REGISTER) { // REGISTER
if (!isdigit(sc.ch)) {
sc.SetState(SCE_MMIXAL_OPERANDS);
}
} else if (sc.state == SCE_MMIXAL_HEX) { // HEX
if (!isxdigit(sc.ch)) {
sc.SetState(SCE_MMIXAL_OPERANDS);
}
}
// Determine if a new state should be entered.
if (sc.state == SCE_MMIXAL_OPCODE_POST || // OPCODE_POST
sc.state == SCE_MMIXAL_OPERANDS) { // OPERANDS
if (sc.state == SCE_MMIXAL_OPERANDS && isspace(sc.ch)) {
if (!sc.atLineEnd) {
sc.SetState(SCE_MMIXAL_COMMENT);
}
} else if (isdigit(sc.ch)) {
sc.SetState(SCE_MMIXAL_NUMBER);
} else if (IsAWordChar(sc.ch) || sc.Match('@')) {
sc.SetState(SCE_MMIXAL_REF);
} else if (sc.Match('\"')) {
sc.SetState(SCE_MMIXAL_STRING);
} else if (sc.Match('\'')) {
sc.SetState(SCE_MMIXAL_CHAR);
} else if (sc.Match('$')) {
sc.SetState(SCE_MMIXAL_REGISTER);
} else if (sc.Match('#')) {
sc.SetState(SCE_MMIXAL_HEX);
} else if (isMMIXALOperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_MMIXAL_OPERATOR);
}
}
}
sc.Complete();
}
static const char * const MMIXALWordListDesc[] = {
"Operation Codes",
"Special Register",
"Predefined Symbols",
0
};
LexerModule lmMMIXAL(SCLEX_MMIXAL, ColouriseMMIXALDoc, "mmixal", 0, MMIXALWordListDesc);

View File

@@ -0,0 +1,346 @@
// Scintilla source code edit control
/** @file LexNsis.cxx
** Lexer for NSIS
**/
// Copyright 2003 by Angelo Mandato <angelo@spaceblue.com>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
/*
// Put in SciLexer.h
#define SCLEX_NSIS 34
#define SCE_NSIS_DEFAULT 0
#define SCE_NSIS_COMMENT 1
#define SCE_NSIS_STRINGDQ 2
#define SCE_NSIS_STRINGLQ 3
#define SCE_NSIS_STRINGRQ 4
#define SCE_NSIS_FUNCTION 5
#define SCE_NSIS_VARIABLE 6
#define SCE_NSIS_LABEL 7
#define SCE_NSIS_USERDEFINED 8
#define SCE_NSIS_SECTIONDEF 9
#define SCE_NSIS_SUBSECTIONDEF 10
#define SCE_NSIS_IFDEFINEDEF 11
#define SCE_NSIS_MACRODEF 12
#define SCE_NSIS_STRINGVAR 13
*/
static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler)
{
char s[100];
WordList &Functions = *keywordLists[0];
WordList &Variables = *keywordLists[1];
WordList &Lables = *keywordLists[2];
WordList &UserDefined = *keywordLists[3];
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
{
s[i] = static_cast<char>( styler[ start + i ] );
s[i + 1] = '\0';
}
// Check for special words...
if( strcmp(s, "!macro") == 0 || strcmp(s, "!macroend") == 0 ) // Covers !micro and !microend
return SCE_NSIS_MACRODEF;
if( strcmp(s, "!ifdef") == 0 || strcmp(s, "!ifndef") == 0 || strcmp(s, "!endif") == 0 )
return SCE_NSIS_IFDEFINEDEF;
if( strcmp(s, "Section") == 0 || strcmp(s, "SectionEnd") == 0 ) // Covers Section and SectionEnd
return SCE_NSIS_SECTIONDEF;
if( strcmp(s, "SubSection") == 0 || strcmp(s, "SubSectionEnd") == 0 ) // Covers SubSection and SubSectionEnd
return SCE_NSIS_SUBSECTIONDEF;
if( strcmp(s, "Function") == 0 || strcmp(s, "FunctionEnd") == 0 ) // Covers SubSection and SubSectionEnd
return SCE_NSIS_FUNCTION;
if ( Functions.InList(s) )
return SCE_NSIS_FUNCTION;
if ( Variables.InList(s) )
return SCE_NSIS_VARIABLE;
if ( Lables.InList(s) )
return SCE_NSIS_LABEL;
if( UserDefined.InList(s) )
return SCE_NSIS_USERDEFINED;
if( strlen(s) > 2 )
{
if( s[1] == '{' && s[strlen(s)-1] == '}' )
return SCE_NSIS_VARIABLE;
}
return SCE_NSIS_DEFAULT;
}
static void ColouriseNsisDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
{
int state = SCE_NSIS_DEFAULT;
styler.StartAt( startPos );
styler.GetLine( startPos );
unsigned int nLengthDoc = startPos + length;
styler.StartSegment( startPos );
char cCurrChar;
bool bVarInString = true;
unsigned int i;
for( i = startPos; i < nLengthDoc; i++ )
{
cCurrChar = styler.SafeGetCharAt( i );
char cNextChar = styler.SafeGetCharAt( i+1, EOF );
switch(state)
{
case SCE_NSIS_DEFAULT:
if( cNextChar == EOF )
{
styler.ColourTo(i,SCE_NSIS_DEFAULT);
break;
}
if( cCurrChar == ';' || cCurrChar == '#' ) // we have a comment line
{
styler.ColourTo(i-1, state );
state = SCE_NSIS_COMMENT;
break;
}
if( cCurrChar == '"' )
{
styler.ColourTo(i-1, state );
state = SCE_NSIS_STRINGDQ;
bVarInString = false;
break;
}
if( cCurrChar == '\'' )
{
styler.ColourTo(i-1, state );
state = SCE_NSIS_STRINGRQ;
bVarInString = false;
break;
}
if( cCurrChar == '`' )
{
styler.ColourTo(i-1, state );
state = SCE_NSIS_STRINGLQ;
bVarInString = false;
break;
}
// NSIS KeyWord,Function, Variable, UserDefined:
if( cCurrChar == '$' || iswordchar(cCurrChar) || cCurrChar == '!' )
{
styler.ColourTo(i-1,state);
state = SCE_NSIS_FUNCTION;
break;
}
break;
case SCE_NSIS_COMMENT:
if( cNextChar == '\n' || cNextChar == '\r' || cNextChar == EOF )
{
styler.ColourTo(i,state);
state = SCE_NSIS_DEFAULT;
}
break;
case SCE_NSIS_STRINGDQ:
if( cCurrChar == '"' || cNextChar == '\r' || cNextChar == '\n' )
{
styler.ColourTo(i,SCE_NSIS_STRINGDQ);
state = SCE_NSIS_DEFAULT;
}
break;
case SCE_NSIS_STRINGLQ:
if( cCurrChar == '`' || cNextChar == '\r' || cNextChar == '\n' )
{
styler.ColourTo(i,SCE_NSIS_STRINGLQ);
state = SCE_NSIS_DEFAULT;
}
break;
case SCE_NSIS_STRINGRQ:
if( cCurrChar == '\'' || cNextChar == '\r' || cNextChar == '\n' )
{
styler.ColourTo(i,SCE_NSIS_STRINGRQ);
state = SCE_NSIS_DEFAULT;
}
break;
case SCE_NSIS_FUNCTION:
// NSIS KeyWord:
if( (iswordchar(cCurrChar) && !iswordchar( cNextChar) && cNextChar != '}') || cCurrChar == '}' )
{
state = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler);
styler.ColourTo( i, state);
state = SCE_NSIS_DEFAULT; // Everything after goes back to the default state
}
else if( !iswordchar( cCurrChar ) && cCurrChar != '{' && cCurrChar != '}' )
{
state = SCE_NSIS_DEFAULT;
if( cCurrChar == '"' ) // Next
{
state = SCE_NSIS_STRINGDQ;
bVarInString = false;
}
if( cCurrChar == '`' )
{
state = SCE_NSIS_STRINGLQ;
bVarInString = false;
}
if( cCurrChar == '\'' )
{
state = SCE_NSIS_STRINGRQ;
bVarInString = false;
}
if( cCurrChar == '#' || cCurrChar == ';' )
state = SCE_NSIS_COMMENT;
styler.ColourTo( i, state);
}
break;
}
if( state == SCE_NSIS_COMMENT )
{
styler.ColourTo(i,state);
}
else if( state == SCE_NSIS_STRINGDQ || state == SCE_NSIS_STRINGLQ || state == SCE_NSIS_STRINGRQ )
{
// Check for var in String..
if( bVarInString && (iswordchar(cCurrChar) || cCurrChar == '}') ) // || cCurrChar == '{' ) )
{
int nWordState = classifyWordNsis( styler.GetStartSegment(), i, keywordLists, styler);
if( nWordState == SCE_NSIS_VARIABLE )
{
styler.ColourTo( i, SCE_NSIS_STRINGVAR);
bVarInString = false;
}
}
if( cCurrChar == '$' )
{
styler.ColourTo( i-1, state);
bVarInString = true;
}
}
}
}
static void FoldNsisDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
{
// No folding enabled, no reason to continue...
if( styler.GetPropertyInt("fold") == 0 )
return;
unsigned int endPos = startPos + length;
int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style;
for (unsigned int i = startPos; i < endPos; i++)
{
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
// Functions Start: Function, Section, SubSection
// Functions End: FunctionEnd, SectionEnd, SubSectionEnd
// Label Start: !ifdef, !ifndef
// Label End: !endif
if( style == SCE_NSIS_FUNCTION )
{
if( styler.Match(i, "FunctionEnd") )
levelNext--;
else if( styler.Match(i, "Function") )
levelNext++;
}
else if( style == SCE_NSIS_SECTIONDEF )
{
if( styler.Match(i, "SectionEnd") )
levelNext--;
else if( styler.Match(i, "Section") )
levelNext++;
}
else if( style == SCE_NSIS_SUBSECTIONDEF )
{
if( styler.Match(i, "SubSectionEnd") )
levelNext--;
else if( styler.Match(i, "SubSection") )
levelNext++;
}
else if( style == SCE_NSIS_IFDEFINEDEF )
{
if( styler.Match(i, "!endif") )
levelNext--;
else if( styler.Match(i, "!ifdef") || styler.Match(i, "!ifndef"))
levelNext++;
}
else if( style == SCE_NSIS_MACRODEF )
{
if( styler.Match(i, "!macroend") )
levelNext--;
else if( styler.Match(i, "!macro") )
levelNext++;
}
if( atEOL )
{
int levelUse = levelCurrent;
int lev = levelUse | levelNext << 16;
if (levelUse < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent))
{
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelCurrent = levelNext;
}
}
int levelUse = levelCurrent;
int lev = levelUse | levelNext << 16;
if (levelUse < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent))
{
styler.SetLevel(lineCurrent, lev);
}
}
static const char * const nsisWordLists[] = {
"Functions",
"Variables",
"Lables",
"UserDefined",
0, };
LexerModule lmNsis(SCLEX_NSIS, ColouriseNsisDoc, "nsis", FoldNsisDoc, nsisWordLists);

View File

@@ -268,6 +268,59 @@ static void ColourisePropsDoc(unsigned int startPos, int length, int, WordList *
}
}
// adaption by ksc, using the "} else {" trick of 1.53
// 030721
static void FoldPropsDoc(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;
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==2) {
headerPoint = true;
}
if (atEOL) {
int lev = SC_FOLDLEVELBASE+1;
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++;
}
int lev = headerPoint ? SC_FOLDLEVELBASE : SC_FOLDLEVELBASE+1;
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, lev | flagsNext);
}
static void ColouriseMakeLine(
char *lineBuffer,
unsigned int lengthLine,
@@ -638,7 +691,7 @@ static void ColouriseNullDoc(unsigned int startPos, int length, int, WordList *[
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);
LexerModule lmDiff(SCLEX_DIFF, ColouriseDiffDoc, "diff", 0, emptyWordListDesc);
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", 0, emptyWordListDesc);
LexerModule lmProps(SCLEX_PROPERTIES, ColourisePropsDoc, "props", FoldPropsDoc, emptyWordListDesc);
LexerModule lmMake(SCLEX_MAKEFILE, ColouriseMakeDoc, "makefile", 0, emptyWordListDesc);
LexerModule lmErrorList(SCLEX_ERRORLIST, ColouriseErrorListDoc, "errorlist", 0, emptyWordListDesc);
LexerModule lmLatex(SCLEX_LATEX, ColouriseLatexDoc, "latex", 0, emptyWordListDesc);

View File

@@ -1,10 +1,19 @@
// Scintilla source code edit control
/** @file LexPOV.cxx
** Lexer for POV-Ray, based on lexer for C++.
** Lexer for POV-Ray SDL (Persistance of Vision Raytracer, Scene Description Language).
** Written by Philippe Lhoste but this is mostly a derivative of LexCPP...
**/
// Copyright 2003 by Steven te Brinke <steven.t.b@zonnet.nl>
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
// Some points that distinguish from a simple C lexer:
// Identifiers start only by a character.
// No line continuation character.
// Strings are limited to 256 characters.
// Directives are similar to preprocessor commands,
// but we match directive keywords and colorize incorrect ones.
// Block comments can be nested (code stolen from my code in LexLua).
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
@@ -20,101 +29,152 @@
#include "Scintilla.h"
#include "SciLexer.h"
#define KEYWORD_BOXHEADER 1
#define KEYWORD_FOLDCONTRACTED 2
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
return ch < 0x80 && (isalnum(ch) || ch == '_');
}
static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
inline bool IsAWordStart(const int ch) {
return ch < 0x80 && isalpha(ch);
}
static inline bool IsStateComment(const int state) {
return ((state == SCE_POV_COMMENT) ||
(state == SCE_POV_COMMENTLINE) ||
(state == SCE_POV_COMMENTDOC));
}
static void ColourisePovDoc(
unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
static inline bool IsStateString(const int state) {
return ((state == SCE_POV_STRING));
}
static void ColourisePOVDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords1 = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
int currentLine = styler.GetLine(startPos);
// Initialize the block comment /* */ nesting level, if we are inside such a comment.
int blockCommentLevel = 0;
if (initStyle == SCE_POV_COMMENT) {
blockCommentLevel = styler.GetLineState(currentLine - 1);
}
// Do not leak onto next line
/*if (initStyle == SCE_POV_STRINGEOL)
initStyle = SCE_POV_DEFAULT;*/
if (initStyle == SCE_POV_STRINGEOL) {
initStyle = SCE_POV_DEFAULT;
}
StyleContext sc(startPos, length, initStyle, styler);
bool caseSensitive = styler.GetPropertyInt("pov.case.sensitive", 1) != 0;
short stringLen = 0;
for (; sc.More(); sc.Forward()) {
/*if (sc.atLineStart && (sc.state == SCE_POV_STRING)) {
// Prevent SCE_POV_STRINGEOL from leaking back to previous line
sc.SetState(SCE_POV_STRING);
}*/
// Handle line continuation generically.
if (sc.ch == '\\') {
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
continue;
if (sc.atLineEnd) {
// Update the line state, so it can be seen by next line
currentLine = styler.GetLine(sc.currentPos);
if (sc.state == SCE_POV_COMMENT) {
// Inside a block comment, we set the line state
styler.SetLineState(currentLine, blockCommentLevel);
} else {
// Reset the line state
styler.SetLineState(currentLine, 0);
}
}
if (sc.atLineStart && (sc.state == SCE_POV_STRING)) {
// Prevent SCE_POV_STRINGEOL from leaking back to previous line
sc.SetState(SCE_POV_STRING);
}
// Determine if the current state should terminate.
if (sc.state == SCE_POV_OPERATOR || sc.state == SCE_POV_BRACE) {
if (sc.state == SCE_POV_OPERATOR) {
sc.SetState(SCE_POV_DEFAULT);
} else if (sc.state == SCE_POV_NUMBER) {
if (!IsADigit(sc.ch) || sc.ch != '.') {
sc.SetState(SCE_POV_DEFAULT);
// We stop the number definition on non-numerical non-dot non-eE non-sign char
if (!(isdigit(sc.ch) || sc.ch == '.' ||
toupper(sc.ch) == 'E' || sc.ch == '-' || sc.ch == '+')) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
sc.SetState(SCE_POV_DEFAULT);
}
} else if (sc.state == SCE_POV_IDENTIFIER) {
if (!IsAWordChar(sc.ch) || (sc.ch == '.')) {
if (!IsAWordChar(sc.ch)) {
char s[100];
if (caseSensitive) {
sc.GetCurrent(s, sizeof(s));
} else {
sc.GetCurrentLowered(s, sizeof(s));
}
if (keywords.InList(s)) {
sc.ChangeState(SCE_POV_WORD);
} else if (keywords2.InList(s)) {
sc.GetCurrent(s, sizeof(s));
if (keywords2.InList(s)) {
sc.ChangeState(SCE_POV_WORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_POV_WORD3);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_POV_WORD4);
} else if (keywords5.InList(s)) {
sc.ChangeState(SCE_POV_WORD5);
} else if (keywords6.InList(s)) {
sc.ChangeState(SCE_POV_WORD6);
} else if (keywords7.InList(s)) {
sc.ChangeState(SCE_POV_WORD7);
} else if (keywords8.InList(s)) {
sc.ChangeState(SCE_POV_WORD8);
}
sc.SetState(SCE_POV_DEFAULT);
}
} else if (sc.state == SCE_POV_DIRECTIVE) {
if (!IsAWordChar(sc.ch)) {
char s[100], *p;
sc.GetCurrent(s, sizeof(s));
p = s;
// Skip # and whitespace between # and directive word
do {
p++;
} while ((*p == ' ' || *p == '\t') && *p != '\0');
if (!keywords1.InList(p)) {
sc.ChangeState(SCE_POV_BADDIRECTIVE);
}
sc.SetState(SCE_POV_DEFAULT);
}
} else if (sc.state == SCE_POV_COMMENT) {
if (sc.Match('*', '/')) {
if (sc.Match('/', '*')) {
blockCommentLevel++;
sc.Forward();
sc.ForwardSetState(SCE_POV_DEFAULT);
}
} else if (sc.state == SCE_POV_COMMENTDOC) {
if (sc.Match('*', '/')) {
} else if (sc.Match('*', '/') && blockCommentLevel > 0) {
blockCommentLevel--;
sc.Forward();
sc.ForwardSetState(SCE_POV_DEFAULT);
if (blockCommentLevel == 0) {
sc.ForwardSetState(SCE_POV_DEFAULT);
}
}
} else if (sc.state == SCE_POV_COMMENTLINE) {
if (sc.atLineEnd) {
sc.SetState(SCE_POV_DEFAULT);
}
} else if (sc.state == SCE_POV_STRING) {
if (sc.ch == '\\') {
stringLen++;
if (strchr("abfnrtuv0'\"", sc.chNext)) {
// Compound characters are counted as one.
// Note: for Unicode chars \u, we shouldn't count the next 4 digits...
sc.Forward();
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_POV_DEFAULT);
} else if (sc.atLineEnd) {
sc.ChangeState(SCE_POV_STRINGEOL);
sc.ForwardSetState(SCE_POV_DEFAULT);
} else {
stringLen++;
}
if (stringLen > 256) {
// Strings are limited to 256 chars
sc.SetState(SCE_POV_STRINGEOL);
}
} else if (sc.state == SCE_POV_STRINGEOL) {
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_C_DEFAULT);
} else if (sc.atLineEnd) {
sc.ForwardSetState(SCE_POV_DEFAULT);
}
}
@@ -123,35 +183,43 @@ static void ColourisePOVDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.state == SCE_POV_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_POV_NUMBER);
} else if (IsAWordStart(sc.ch) || (sc.ch == '#')) {
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_POV_IDENTIFIER);
} else if (sc.Match('/', '*')) {
blockCommentLevel = 1;
sc.SetState(SCE_POV_COMMENT);
sc.Forward(); // Eat the * so it isn't used for the end of the comment
} else if (sc.Match('/', '/')) {
sc.SetState(SCE_POV_COMMENTLINE);
} else if (sc.ch == '\"') {
sc.SetState(SCE_POV_STRING);
//} else if (isoperator(static_cast<char>(sc.ch))) {
} else if (sc.ch == '+' || sc.ch == '-' || sc.ch == '*' || sc.ch == '/' || sc.ch == '=' || sc.ch == '<' || sc.ch == '>' || sc.ch == '&' || sc.ch == '|' || sc.ch == '!' || sc.ch == '?' || sc.ch == ':') {
stringLen = 0;
} else if (sc.ch == '#') {
sc.SetState(SCE_POV_DIRECTIVE);
// Skip whitespace between # and directive word
do {
sc.Forward();
} while ((sc.ch == ' ' || sc.ch == '\t') && sc.More());
if (sc.atLineEnd) {
sc.SetState(SCE_POV_DEFAULT);
}
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_POV_OPERATOR);
} else if (sc.ch == '{' || sc.ch == '}') {
sc.SetState(SCE_POV_BRACE);
}
}
}
sc.Complete();
}
static bool IsStreamCommentStyle(int style) {
return style == SCE_POV_COMMENT ||
style == SCE_POV_COMMENTDOC;
}
static void FoldPovDoc(
unsigned int startPos,
int length,
int initStyle,
WordList *[],
Accessor &styler) {
static void FoldNoBoxPOVDoc(unsigned int startPos, int length, int initStyle,
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment", 1) != 0;
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldDirective = styler.GetPropertyInt("fold.directive") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
@@ -168,15 +236,33 @@ static void FoldNoBoxPOVDoc(unsigned int startPos, int length, int initStyle,
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (foldComment && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) {
if (foldComment && (style == SCE_POV_COMMENT)) {
if (stylePrev != SCE_POV_COMMENT) {
levelCurrent++;
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
} else if ((styleNext != SCE_POV_COMMENT) && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelCurrent--;
}
}
if (style == SCE_POV_BRACE) {
if (foldComment && (style == SCE_POV_COMMENTLINE)) {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelCurrent++;
} else if (chNext2 == '}') {
levelCurrent--;
}
}
}
if (foldDirective && (style == SCE_POV_DIRECTIVE)) {
if (ch == '#') {
unsigned int j=i+1;
while ((j<endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
}
}
if (style == SCE_POV_OPERATOR) {
if (ch == '{') {
levelCurrent++;
} else if (ch == '}') {
@@ -204,19 +290,16 @@ static void FoldNoBoxPOVDoc(unsigned int startPos, int length, int initStyle,
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
static void FoldPOVDoc(unsigned int startPos, int length, int initStyle, WordList *[], Accessor &styler) {
FoldNoBoxPOVDoc(startPos, length, initStyle, styler);
}
static const char * const povWordLists[] = {
"Language directives",
"Objects & CSG & Appearance",
"Types & Modifiers & Items",
"Predefined Identifiers",
"Predefined Functions",
"User defined 1",
"User defined 2",
"User defined 3",
0,
};
static const char * const POVWordLists[] = {
"Primary keywords and identifiers",
"Secondary keywords and identifiers",
0,
};
static void ColourisePOVDocSensitive(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
ColourisePOVDoc(startPos, length, initStyle, keywordlists, styler);
}
LexerModule lmPOV(SCLEX_POV, ColourisePOVDocSensitive, "pov", FoldPOVDoc, POVWordLists);
LexerModule lmPOV(SCLEX_POV, ColourisePovDoc, "pov", FoldPovDoc, povWordLists);

View File

@@ -0,0 +1,344 @@
// Scintilla source code edit control
/** @file LexPS.cxx
** Lexer for PostScript
**
** Written by Nigel Hathaway <nigel@bprj.co.uk>.
** 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 <fcntl.h>
#include "Platform.h"
#include "PropSet.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "KeyWords.h"
#include "Scintilla.h"
#include "SciLexer.h"
static inline bool IsASelfDelimitingChar(const int ch) {
return (ch == '[' || ch == ']' || ch == '{' || ch == '}' ||
ch == '/' || ch == '<' || ch == '>' ||
ch == '(' || ch == ')' || ch == '%');
}
static inline bool IsAWhitespaceChar(const int ch) {
return (ch == ' ' || ch == '\t' || ch == '\r' ||
ch == '\n' || ch == '\f' || ch == '\0');
}
static bool IsABaseNDigit(const int ch, const int base) {
int maxdig = '9';
int letterext = -1;
if (base <= 10)
maxdig = '0' + base - 1;
else
letterext = base - 11;
return ((ch >= '0' && ch <= maxdig) ||
(ch >= 'A' && ch <= ('A' + letterext)) ||
(ch >= 'a' && ch <= ('a' + letterext)));
}
static inline bool IsABase85Char(const int ch) {
return ((ch >= '!' && ch <= 'u') || ch == 'z');
}
static void ColourisePSDoc(
unsigned int startPos,
int length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
WordList &keywords1 = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
StyleContext sc(startPos, length, initStyle, styler);
bool tokenizing = styler.GetPropertyInt("ps.tokenize") != 0;
int pslevel = styler.GetPropertyInt("ps.level", 3);
int lineCurrent = styler.GetLine(startPos);
int nestTextCurrent = 0;
if (lineCurrent > 0 && initStyle == SCE_PS_TEXT)
nestTextCurrent = styler.GetLineState(lineCurrent - 1);
int numRadix = 0;
bool numHasPoint = false;
bool numHasExponent = false;
bool numHasSign = false;
// Clear out existing tokenization
if (tokenizing && length > 0) {
styler.StartAt(startPos, static_cast<char>(INDIC2_MASK));
styler.ColourTo(startPos + length-1, 0);
styler.Flush();
styler.StartAt(startPos);
styler.StartSegment(startPos);
}
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart)
lineCurrent = styler.GetLine(sc.currentPos);
// Determine if the current state should terminate.
if (sc.state == SCE_PS_COMMENT || sc.state == SCE_PS_DSC_VALUE) {
if (sc.atLineEnd) {
sc.SetState(SCE_C_DEFAULT);
}
} else if (sc.state == SCE_PS_DSC_COMMENT) {
if (sc.ch == ':') {
sc.Forward();
if (!sc.atLineEnd)
sc.SetState(SCE_PS_DSC_VALUE);
else
sc.SetState(SCE_C_DEFAULT);
} else if (sc.atLineEnd) {
sc.SetState(SCE_C_DEFAULT);
} else if (IsAWhitespaceChar(sc.ch)) {
sc.ChangeState(SCE_PS_COMMENT);
}
} else if (sc.state == SCE_PS_NUMBER) {
if (IsASelfDelimitingChar(sc.ch) || IsAWhitespaceChar(sc.ch)) {
if ((sc.chPrev == '+' || sc.chPrev == '-' ||
sc.chPrev == 'E' || sc.chPrev == 'e') && numRadix == 0)
sc.ChangeState(SCE_PS_NAME);
sc.SetState(SCE_C_DEFAULT);
} else if (sc.ch == '#') {
if (numHasPoint || numHasExponent || numHasSign || numRadix != 0) {
sc.ChangeState(SCE_PS_NAME);
} else {
char szradix[5];
sc.GetCurrent(szradix, 4);
numRadix = atoi(szradix);
if (numRadix < 2 || numRadix > 36)
sc.ChangeState(SCE_PS_NAME);
}
} else if ((sc.ch == 'E' || sc.ch == 'e') && numRadix == 0) {
if (numHasExponent) {
sc.ChangeState(SCE_PS_NAME);
} else {
numHasExponent = true;
if (sc.chNext == '+' || sc.chNext == '-')
sc.Forward();
}
} else if (sc.ch == '.') {
if (numHasPoint || numHasExponent || numRadix != 0) {
sc.ChangeState(SCE_PS_NAME);
} else {
numHasPoint = true;
}
} else if (numRadix == 0) {
if (!IsABaseNDigit(sc.ch, 10))
sc.ChangeState(SCE_PS_NAME);
} else {
if (!IsABaseNDigit(sc.ch, numRadix))
sc.ChangeState(SCE_PS_NAME);
}
} else if (sc.state == SCE_PS_NAME || sc.state == SCE_PS_KEYWORD) {
if (IsASelfDelimitingChar(sc.ch) || IsAWhitespaceChar(sc.ch)) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if ((pslevel >= 1 && keywords1.InList(s)) ||
(pslevel >= 2 && keywords2.InList(s)) ||
(pslevel >= 3 && keywords3.InList(s)) ||
keywords4.InList(s) || keywords5.InList(s)) {
sc.ChangeState(SCE_PS_KEYWORD);
}
sc.SetState(SCE_C_DEFAULT);
}
} else if (sc.state == SCE_PS_LITERAL || sc.state == SCE_PS_IMMEVAL) {
if (IsASelfDelimitingChar(sc.ch) || IsAWhitespaceChar(sc.ch))
sc.SetState(SCE_C_DEFAULT);
} else if (sc.state == SCE_PS_PAREN_ARRAY || sc.state == SCE_PS_PAREN_DICT ||
sc.state == SCE_PS_PAREN_PROC) {
sc.SetState(SCE_C_DEFAULT);
} else if (sc.state == SCE_PS_TEXT) {
if (sc.ch == '(') {
nestTextCurrent++;
} else if (sc.ch == ')') {
if (--nestTextCurrent == 0)
sc.ForwardSetState(SCE_PS_DEFAULT);
} else if (sc.ch == '\\') {
sc.Forward();
}
} else if (sc.state == SCE_PS_HEXSTRING) {
if (sc.ch == '>') {
sc.ForwardSetState(SCE_PS_DEFAULT);
} else if (!IsABaseNDigit(sc.ch, 16) && !IsAWhitespaceChar(sc.ch)) {
sc.SetState(SCE_PS_HEXSTRING);
styler.ColourTo(sc.currentPos, SCE_PS_BADSTRINGCHAR);
}
} else if (sc.state == SCE_PS_BASE85STRING) {
if (sc.Match('~', '>')) {
sc.Forward();
sc.ForwardSetState(SCE_PS_DEFAULT);
} else if (!IsABase85Char(sc.ch) && !IsAWhitespaceChar(sc.ch)) {
sc.SetState(SCE_PS_BASE85STRING);
styler.ColourTo(sc.currentPos, SCE_PS_BADSTRINGCHAR);
}
}
// Determine if a new state should be entered.
if (sc.state == SCE_C_DEFAULT) {
unsigned int tokenpos = sc.currentPos;
if (sc.ch == '[' || sc.ch == ']') {
sc.SetState(SCE_PS_PAREN_ARRAY);
} else if (sc.ch == '{' || sc.ch == '}') {
sc.SetState(SCE_PS_PAREN_PROC);
} else if (sc.ch == '/') {
if (sc.chNext == '/') {
sc.SetState(SCE_PS_IMMEVAL);
sc.Forward();
} else {
sc.SetState(SCE_PS_LITERAL);
}
} else if (sc.ch == '<') {
if (sc.chNext == '<') {
sc.SetState(SCE_PS_PAREN_DICT);
sc.Forward();
} else if (sc.chNext == '~') {
sc.SetState(SCE_PS_BASE85STRING);
sc.Forward();
} else {
sc.SetState(SCE_PS_HEXSTRING);
}
} else if (sc.ch == '>' && sc.chNext == '>') {
sc.SetState(SCE_PS_PAREN_DICT);
sc.Forward();
} else if (sc.ch == '>' || sc.ch == ')') {
sc.SetState(SCE_C_DEFAULT);
styler.ColourTo(sc.currentPos, SCE_PS_BADSTRINGCHAR);
} else if (sc.ch == '(') {
sc.SetState(SCE_PS_TEXT);
nestTextCurrent = 1;
} else if (sc.ch == '%') {
if (sc.chNext == '%' && sc.atLineStart) {
sc.SetState(SCE_PS_DSC_COMMENT);
sc.Forward();
if (sc.chNext == '+') {
sc.Forward();
sc.ForwardSetState(SCE_PS_DSC_VALUE);
}
} else {
sc.SetState(SCE_PS_COMMENT);
}
} else if ((sc.ch == '+' || sc.ch == '-' || sc.ch == '.') &&
IsABaseNDigit(sc.chNext, 10)) {
sc.SetState(SCE_PS_NUMBER);
numRadix = 0;
numHasPoint = (sc.ch == '.');
numHasExponent = false;
numHasSign = (sc.ch == '+' || sc.ch == '-');
} else if ((sc.ch == '+' || sc.ch == '-') && sc.chNext == '.' &&
IsABaseNDigit(sc.GetRelative(2), 10)) {
sc.SetState(SCE_PS_NUMBER);
numRadix = 0;
numHasPoint = false;
numHasExponent = false;
numHasSign = true;
} else if (IsABaseNDigit(sc.ch, 10)) {
sc.SetState(SCE_PS_NUMBER);
numRadix = 0;
numHasPoint = false;
numHasExponent = false;
numHasSign = false;
} else if (!IsAWhitespaceChar(sc.ch)) {
sc.SetState(SCE_PS_NAME);
}
// Mark the start of tokens
if (tokenizing && sc.state != SCE_C_DEFAULT && sc.state != SCE_PS_COMMENT &&
sc.state != SCE_PS_DSC_COMMENT && sc.state != SCE_PS_DSC_VALUE) {
styler.Flush();
styler.StartAt(tokenpos, static_cast<char>(INDIC2_MASK));
styler.ColourTo(tokenpos, INDIC2_MASK);
styler.Flush();
styler.StartAt(tokenpos);
styler.StartSegment(tokenpos);
}
}
if (sc.atLineEnd)
styler.SetLineState(lineCurrent, nestTextCurrent);
}
sc.Complete();
}
static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
int levelMinCurrent = levelCurrent;
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); //mac??
if ((style & 31) == SCE_PS_PAREN_PROC) {
if (ch == '{') {
// Measure the minimum before a '{' to allow
// folding on "} {"
if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
} else if (ch == '}') {
levelNext--;
}
}
if (atEOL) {
int levelUse = levelCurrent;
if (foldAtElse) {
levelUse = levelMinCurrent;
}
int lev = levelUse | levelNext << 16;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (levelUse < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelCurrent = levelNext;
levelMinCurrent = levelCurrent;
visibleChars = 0;
}
if (!isspacechar(ch))
visibleChars++;
}
}
static const char * const psWordListDesc[] = {
"PS Level 1 operators",
"PS Level 2 operators",
"PS Level 3 operators",
"RIP-specific operators",
"User-defined operators",
0
};
LexerModule lmPS(SCLEX_PS, ColourisePSDoc, "ps", FoldPSDoc, psWordListDesc);

View File

@@ -3,6 +3,7 @@
** Lexer for Pascal.
** Written by Laurent le Tynevez
** Updated by Simon Steele <s.steele@pnotepad.org> September 2002
** Updated by Mathias Rauen <scite@madshi.net> May 2003 (Delphi adjustments)
**/
#include <stdlib.h>
@@ -40,12 +41,15 @@ static bool IsStreamCommentStyle(int style) {
style == SCE_C_COMMENTDOCKEYWORDERROR;
}
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr, bool bInAsm) {
if ((bInAsm) && (attr == SCE_C_OPERATOR || attr == SCE_C_NUMBER || attr == SCE_C_DEFAULT || attr == SCE_C_WORD || attr == SCE_C_IDENTIFIER)) {
styler.ColourTo(end, SCE_C_REGEX);
} else
styler.ColourTo(end, attr);
}
// returns 1 if the item starts a class definition, and -1 if the word is "end".
static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass) {
// returns 1 if the item starts a class definition, and -1 if the word is "end", and 2 if the word is "asm"
static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, bool bInClass, bool bInAsm) {
int ret = 0;
WordList& keywords = *keywordlists[0];
@@ -55,24 +59,34 @@ static int classifyWordPascal(unsigned int start, unsigned int end, /*WordList &
getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
if (isdigit(s[0]) || (s[0] == '.')) {
if (isdigit(s[0]) || (s[0] == '.') ||(s[0] == '$')) {
chAttr = SCE_C_NUMBER;
}
else {
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
if(strcmp(s, "class") == 0)
ret = 1;
else if(strcmp(s, "end") == 0)
ret = -1;
} else if (bInClass) {
if (classwords.InList(s)) {
if (s[0] == '#') {
chAttr = SCE_C_CHARACTER;
}
else {
if (keywords.InList(s)) {
chAttr = SCE_C_WORD;
if(strcmp(s, "class") == 0) {
ret = 1;
}
else if (strcmp(s, "asm") == 0) {
ret = 2;
}
else if (strcmp(s, "end") == 0) {
ret = -1;
}
} else if (bInClass) {
if (classwords.InList(s)) {
chAttr = SCE_C_WORD;
}
}
}
}
styler.ColourTo(end, chAttr);
ColourTo(styler, end, chAttr, (bInAsm && ret != -1));
return ret;
}
@@ -99,14 +113,14 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
styler.StartAt(startPos);
int state = initStyle;
if (state == SCE_C_STRINGEOL) // Does not leak onto next line
if (state == SCE_C_CHARACTER) // Does not leak onto next line
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
int visibleChars = 0;
bool bInClassDefinition;
int currentLine = styler.GetLine(startPos);
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
@@ -116,6 +130,10 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
bInClassDefinition = false;
}
bool bInAsm = (state == SCE_C_REGEX);
if (bInAsm)
state = SCE_C_DEFAULT;
styler.StartSegment(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = chNext;
@@ -126,16 +144,13 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
// Trigger on CR only (Mac style) or either on LF from CR+LF (Dos/Win) or on LF alone (Unix)
// Avoid triggering two times on Dos/Win
// End of line
if (state == SCE_C_STRINGEOL) {
styler.ColourTo(i, state);
if (state == SCE_C_CHARACTER) {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
visibleChars = 0;
currentLine++;
styler.SetLineState(currentLine, (bInClassDefinition ? 1 : 0));
}
if (!isspacechar(ch))
visibleChars++;
if (styler.IsLeadByte(ch)) {
chNext = styler.SafeGetCharAt(i + 2);
@@ -145,41 +160,50 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
}
if (state == SCE_C_DEFAULT) {
if (iswordstart(ch) || (ch == '@')) {
styler.ColourTo(i-1, state);
if (iswordstart(ch) || ch == '#' || ch == '$' || (ch == '@' && bInAsm)) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_IDENTIFIER;
} else if (ch == '{' && chNext != '$' && chNext != '&') {
styler.ColourTo(i-1, state);
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENT;
} else if (ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) != '$'
&& styler.SafeGetCharAt(i + 2) != '&') {
styler.ColourTo(i-1, state);
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
styler.ColourTo(i-1, state);
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
styler.ColourTo(i-1, state);
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_CHARACTER;
} else if (ch == '{' && (chNext == '$' || chNext=='&') && visibleChars == 1) {
styler.ColourTo(i-1, state);
} else if (ch == '{' && (chNext == '$' || chNext=='&')) {
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_PREPROCESSOR;
} else if (isoperator(ch)) {
styler.ColourTo(i-1, state);
styler.ColourTo(i, SCE_C_OPERATOR);
ColourTo(styler, i-1, state, bInAsm);
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
}
} else if (state == SCE_C_IDENTIFIER) {
if (!iswordchar(ch)) {
int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition);
bool bDoublePoint = ((ch == '.') && (chPrev == '.'));
if ((!iswordchar(ch) && ch != '$' && ch != '#' && (ch != '@' || !bInAsm)) || bDoublePoint) {
if (bDoublePoint) i--;
int lStateChange = classifyWordPascal(styler.GetStartSegment(), i - 1, keywordlists, styler, bInClassDefinition, bInAsm);
if(lStateChange == 1) {
styler.SetLineState(currentLine, 1);
bInClassDefinition = true;
} else if(lStateChange == 2) {
bInAsm = true;
} else if(lStateChange == -1) {
styler.SetLineState(currentLine, 0);
bInClassDefinition = false;
bInAsm = false;
}
if (bDoublePoint) {
i++;
ColourTo(styler, i-1, SCE_C_DEFAULT, bInAsm);
}
state = SCE_C_DEFAULT;
@@ -189,30 +213,30 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
} else if (ch == '(' && chNext == '*'
&& styler.SafeGetCharAt(i + 2) != '$'
&& styler.SafeGetCharAt(i + 2) != '&') {
styler.ColourTo(i-1, state);
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_COMMENTDOC;
} else if (ch == '/' && chNext == '/') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
state = SCE_C_CHARACTER;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
ColourTo(styler, i, SCE_C_OPERATOR, bInAsm);
}
}
} else {
if (state == SCE_C_PREPROCESSOR) {
if (ch=='}'){
styler.ColourTo(i, state);
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
} else {
if ((ch == '\r' || ch == '\n') && !(chPrev == '\\' || chPrev == '\r')) {
styler.ColourTo(i-1, state);
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENT) {
if (ch == '}' ) {
styler.ColourTo(i, state);
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_COMMENTDOC) {
@@ -220,28 +244,25 @@ static void ColourisePascalDoc(unsigned int startPos, int length, int initStyle,
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
styler.ColourTo(i, state);
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
}
} else if (state == SCE_C_COMMENTLINE) {
if (ch == '\r' || ch == '\n') {
styler.ColourTo(i-1, state);
ColourTo(styler, i-1, state, bInAsm);
state = SCE_C_DEFAULT;
}
} else if (state == SCE_C_CHARACTER) {
if ((ch == '\r' || ch == '\n')) {
styler.ColourTo(i-1, SCE_C_STRINGEOL);
state = SCE_C_STRINGEOL;
} else if (ch == '\'') {
styler.ColourTo(i, state);
if (ch == '\'') {
ColourTo(styler, i, state, bInAsm);
state = SCE_C_DEFAULT;
}
}
}
chPrev = ch;
}
styler.ColourTo(lengthDoc - 1, state);
ColourTo(styler, lengthDoc - 1, state, bInAsm);
}
static void FoldPascalDoc(unsigned int startPos, int length, int initStyle, WordList *[],

View File

@@ -23,7 +23,7 @@ static void classifyWordSQL(unsigned int start, unsigned int end, WordList &keyw
char s[100];
bool wordIsNumber = isdigit(styler[start]) || (styler[start] == '.');
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(toupper(styler[start + i]));
s[i] = static_cast<char>(tolower(styler[start + i]));
s[i + 1] = '\0';
}
char chAttr = SCE_C_IDENTIFIER;
@@ -88,7 +88,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
} else if (ch == '-' && chNext == '-') {
styler.ColourTo(i - 1, state);
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
} else if ((ch == '\'') || (ch == '"')) {
styler.ColourTo(i - 1, state);
state = SCE_C_STRING;
} else if (isoperator(ch)) {
@@ -103,7 +103,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
} else if ((ch == '\'') || (ch == '"')) {
state = SCE_C_STRING;
} else if (isoperator(ch)) {
styler.ColourTo(i, SCE_C_OPERATOR);
@@ -134,6 +134,16 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
}
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
} else if (ch == '"') {
if (chNext == '"') {
i++;
} else {
styler.ColourTo(i, state);
state = SCE_C_DEFAULT;
i++;
}
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
if (state == SCE_C_DEFAULT) { // One of the above succeeded
@@ -141,7 +151,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length,
state = SCE_C_COMMENT;
} else if (ch == '-' && chNext == '-') {
state = SCE_C_COMMENTLINE;
} else if (ch == '\'') {
} else if ((ch == '\'') || (ch == '"')) {
state = SCE_C_STRING;
} else if (iswordstart(ch)) {
state = SCE_C_WORD;

View File

@@ -0,0 +1,427 @@
// Scintilla source code edit control
/** @file LexScriptol.cxx
** Lexer for Scriptol.
**/
#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"
static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord)
{
char s[100];
bool wordIsNumber = isdigit(styler[start]) != 0;
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
{
s[i] = styler[start + i];
s[i + 1] = '\0';
}
char chAttr = SCE_P_IDENTIFIER;
if (0 == strcmp(prevWord, "class")) chAttr = SCE_P_CLASSNAME;
else if (wordIsNumber) chAttr = SCE_P_NUMBER;
else if (keywords.InList(s)) chAttr = SCE_P_WORD;
else for (unsigned int i = 0; i < end - start + 1; i++) // test dotted idents
{
if (styler[start + i] == '.')
{
styler.ColourTo(start + i - 1, chAttr);
styler.ColourTo(start + i, SCE_P_OPERATOR);
}
}
styler.ColourTo(end, chAttr);
strcpy(prevWord, s);
}
static bool IsSolComment(Accessor &styler, int pos, int len)
{
// return len > 0 && styler[pos]=='`';
char c;
if(len > 0)
{
c = styler[pos];
if(c == '`') return true;
if(len > 1)
{
if(c == '/')
{
c = styler[pos + 1];
if(c == '/') return true;
if(c == '*') return true;
}
}
}
return false;
}
static bool IsSolStringStart(char ch, char /*chNext*/)
{
if (ch == '\'' || ch == '"') return true;
//chNext = chNext; // for future use
return false;
}
static bool IsSolWordStart(char ch, char chNext)
{
return (iswordchar(ch) && !IsSolStringStart(ch, chNext));
}
/* Return the state to use for the string starting at i; *nextIndex will be set to the first index following the quote(s) */
static int GetSolStringState(Accessor &styler, int i, int *nextIndex)
{
char ch = styler.SafeGetCharAt(i);
char chNext = styler.SafeGetCharAt(i + 1);
if (ch != '"' && ch != '\'') {
*nextIndex = i + 1;
return SCE_P_DEFAULT;
}
if (ch == chNext && ch == styler.SafeGetCharAt(i + 2))
{
*nextIndex = i + 3;
if (ch == '"') return SCE_P_TRIPLEDOUBLE;
else return SCE_P_TRIPLE;
}
else
{
*nextIndex = i + 1;
if (ch == '"') return SCE_P_STRING;
else return SCE_P_CHARACTER;
}
}
static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler)
{
int lengthDoc = startPos + length;
// Backtrack to previous line in case need to fix its tab whinging
if (startPos > 0)
{
int lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0)
{
startPos = styler.LineStart(lineCurrent-1);
if (startPos == 0) initStyle = SCE_P_DEFAULT;
else initStyle = styler.StyleAt(startPos-1);
}
}
styler.StartAt(startPos, 127);
WordList &keywords = *keywordlists[0];
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
char prevWord[200];
prevWord[0] = '\0';
if (length == 0) return ;
int state = initStyle & 31;
int nextIndex = 0;
char chPrev = ' ';
//char chPrev2 = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
bool atStartLine = true;
int spaceFlags = 0;
for (int i = startPos; i < lengthDoc; i++)
{
if (atStartLine)
{
char chBad = static_cast<char>(64);
char chGood = static_cast<char>(0);
char chFlags = chGood;
if (whingeLevel == 1)
{
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
}
else if (whingeLevel == 2)
{
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
}
else if (whingeLevel == 3)
{
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
}
else if (whingeLevel == 4)
{
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
}
styler.SetFlags(chFlags, static_cast<char>(state));
atStartLine = false;
}
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc))
{
if ((state == SCE_P_DEFAULT) || (state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
{
styler.ColourTo(i, state);
}
atStartLine = true;
}
if (styler.IsLeadByte(ch))
{
chNext = styler.SafeGetCharAt(i + 2);
chPrev = ' ';
//chPrev2 = ' ';
i += 1;
continue;
}
if (state == SCE_P_STRINGEOL)
{
if (ch != '\r' && ch != '\n')
{
styler.ColourTo(i - 1, state);
state = SCE_P_DEFAULT;
}
}
if (state == SCE_P_DEFAULT)
{
if (IsSolWordStart(ch, chNext))
{
styler.ColourTo(i - 1, state);
state = SCE_P_WORD;
}
else if (ch == '`')
{
styler.ColourTo(i - 1, state);
state = SCE_P_COMMENTLINE;
}
else if (ch == '/')
{
styler.ColourTo(i - 1, state);
if(chNext == '/') state = SCE_P_COMMENTLINE;
if(chNext == '*') state = SCE_P_COMMENTBLOCK;
}
else if (ch == '=' && chNext == 'b')
{
// =begin indicates the start of a comment (doc) block
if(styler.SafeGetCharAt(i + 2) == 'e' && styler.SafeGetCharAt(i + 3) == 'g' && styler.SafeGetCharAt(i + 4) == 'i' && styler.SafeGetCharAt(i + 5) == 'n')
{
styler.ColourTo(i - 1, state);
state = SCE_P_TRIPLEDOUBLE; //SCE_C_COMMENT;
}
}
else if (IsSolStringStart(ch, chNext))
{
styler.ColourTo(i - 1, state);
state = GetSolStringState(styler, i, &nextIndex);
if (nextIndex != i + 1)
{
i = nextIndex - 1;
ch = ' ';
//chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
}
}
else if (isoperator(ch))
{
styler.ColourTo(i - 1, state);
styler.ColourTo(i, SCE_P_OPERATOR);
}
}
else if (state == SCE_P_WORD)
{
if (!iswordchar(ch))
{
ClassifyWordSol(styler.GetStartSegment(), i - 1, keywords, styler, prevWord);
state = SCE_P_DEFAULT;
if (ch == '`')
{
state = chNext == '`' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE;
}
else if (IsSolStringStart(ch, chNext))
{
styler.ColourTo(i - 1, state);
state = GetSolStringState(styler, i, &nextIndex);
if (nextIndex != i + 1)
{
i = nextIndex - 1;
ch = ' ';
//chPrev = ' ';
chNext = styler.SafeGetCharAt(i + 1);
}
}
else if (isoperator(ch))
{
styler.ColourTo(i, SCE_P_OPERATOR);
}
}
}
else
{
if (state == SCE_P_COMMENTLINE)
{
if (ch == '\r' || ch == '\n')
{
styler.ColourTo(i - 1, state);
state = SCE_P_DEFAULT;
}
}
else if(state == SCE_P_COMMENTBLOCK)
{
if(ch == '*' && chNext == '/') state = SCE_P_DEFAULT;
}
else if (state == SCE_P_STRING)
{
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
{
styler.ColourTo(i - 1, state);
state = SCE_P_STRINGEOL;
}
else if (ch == '\\')
{
if (chNext == '\"' || chNext == '\'' || chNext == '\\')
{
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
else if (ch == '\"')
{
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
}
else if (state == SCE_P_CHARACTER)
{
if ((ch == '\r' || ch == '\n') && (chPrev != '\\'))
{
styler.ColourTo(i - 1, state);
state = SCE_P_STRINGEOL;
}
else if (ch == '\\')
{
if (chNext == '\"' || chNext == '\'' || chNext == '\\')
{
i++;
ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
}
}
else if (ch == '\'')
{
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
}
/*
else if (state == SCE_P_TRIPLE)
{
if (ch == '\'' && chPrev == '\'' && chPrev2 == '\'')
{
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
}
else if (state == SCE_P_TRIPLEDOUBLE)
{
// =end terminates the comment block
if (ch == 'd' && chPrev == 'n' && chPrev2 == 'e')
{
if (styler.SafeGetCharAt(i - 3) == '=')
{
styler.ColourTo(i, state);
state = SCE_P_DEFAULT;
}
}
}
*/
}
//chPrev2 = chPrev;
chPrev = ch;
}
if (state == SCE_P_WORD)
{
ClassifyWordSol(styler.GetStartSegment(), lengthDoc-1, keywords, styler, prevWord);
}
else
{
styler.ColourTo(lengthDoc-1, state);
}
}
static void FoldSolDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler)
{
int lengthDoc = startPos + length;
// Backtrack to previous line in case need to fix its fold status
int lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0)
{
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
if (startPos == 0)
initStyle = SCE_P_DEFAULT;
else
initStyle = styler.StyleAt(startPos-1);
}
}
int state = initStyle & 31;
int spaceFlags = 0;
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, IsSolComment);
if ((state == SCE_P_TRIPLE) || (state == SCE_P_TRIPLEDOUBLE))
indentCurrent |= SC_FOLDLEVELWHITEFLAG;
char chNext = styler[startPos];
for (int i = startPos; i < lengthDoc; i++)
{
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i) & 31;
if ((ch == '\r' && chNext != '\n') || (ch == '\n') || (i == lengthDoc))
{
int lev = indentCurrent;
int indentNext = styler.IndentAmount(lineCurrent + 1, &spaceFlags, IsSolComment);
if ((style == SCE_P_TRIPLE) || (style== SCE_P_TRIPLEDOUBLE))
indentNext |= SC_FOLDLEVELWHITEFLAG;
if (!(indentCurrent & SC_FOLDLEVELWHITEFLAG))
{
// Only non whitespace lines can be headers
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext & SC_FOLDLEVELNUMBERMASK))
{
lev |= SC_FOLDLEVELHEADERFLAG;
} else if (indentNext & SC_FOLDLEVELWHITEFLAG)
{
// Line after is blank so check the next - maybe should continue further?
int spaceFlags2 = 0;
int indentNext2 = styler.IndentAmount(lineCurrent + 2, &spaceFlags2, IsSolComment);
if ((indentCurrent & SC_FOLDLEVELNUMBERMASK) < (indentNext2 & SC_FOLDLEVELNUMBERMASK))
{
lev |= SC_FOLDLEVELHEADERFLAG;
}
}
}
indentCurrent = indentNext;
styler.SetLevel(lineCurrent, lev);
lineCurrent++;
}
}
}
LexerModule lmScriptol(SCLEX_SCRIPTOL, ColouriseSolDoc, "scriptol", FoldSolDoc);

View File

@@ -71,16 +71,6 @@ bool EqualCaseInsensitive(const char *a, const char *b) {
return 0 == CompareCaseInsensitive(a, b);
}
inline unsigned int HashString(const char *s, size_t len) {
unsigned int ret = 0;
while (len--) {
ret <<= 4;
ret ^= *s;
s++;
}
return ret;
}
PropSet::PropSet() {
superPS = 0;
for (int root = 0; root < hashRoots; root++)
@@ -160,7 +150,7 @@ SString PropSet::Get(const char *key) {
}
}
static bool IncludesVar(const char *value, const char *key) {
bool PropSet::IncludesVar(const char *value, const char *key) {
const char *var = strstr(value, "$(");
while (var) {
if (isprefix(var + 2, key) && (var[2 + strlen(key)] == ')')) {

View File

@@ -10,11 +10,11 @@
* Dept. of Computer Science
* York University
*
* Original code available from http://www.cs.yorku.ca/~oz/
* Original code available from http://www.cs.yorku.ca/~oz/
* Translation to C++ by Neil Hodgson neilh@scintilla.org
* Removed all use of register.
* Converted to modern function prototypes.
* Put all global/static variables into an object so this code can be
* Put all global/static variables into an object so this code can be
* used from multiple threads etc.
*
* These routines are the PUBLIC DOMAIN equivalents of regex
@@ -30,8 +30,10 @@
* Modification history:
*
* $Log$
* Revision 1.7 2003/07/18 06:43:23 RD
* Update to Scintilla 1.53
* Revision 1.8 2003/09/18 05:05:38 RD
* Updated to Scintilla 1.54
* Applied most of patch #806092
* Added new wxSTC sample from Otto Wyss
*
* Revision 1.9 2003/03/21 10:36:08 nyamatongwe
* Detect patterns too long in regular expression search.
@@ -82,17 +84,17 @@
*
* Revision 1.2 88/08/28 15:36:04 oz
* Use a complement bitmap to represent NCL.
* This removes the need to have seperate
* code in the PMatch case block - it is
* This removes the need to have seperate
* code in the PMatch case block - it is
* just CCL code now.
*
*
* Use the actual CCL code in the CLO
* section of PMatch. No need for a recursive
* PMatch call.
*
*
* Use a bitmap table to set char bits in an
* 8-bit chunk.
*
*
* Interfaces:
* RESearch::Compile: compile a regular expression into a NFA.
*
@@ -122,7 +124,7 @@
* void re_fail(msg, op)
* char *msg;
* char op;
*
*
* Regular Expressions:
*
* [1] char matches itself, unless it is a special
@@ -132,20 +134,20 @@
*
* [3] \ matches the character following it, except
* when followed by a left or right round bracket,
* a digit 1 to 9 or a left or right angle bracket.
* a digit 1 to 9 or a left or right angle bracket.
* (see [7], [8] and [9])
* It is used as an escape character for all
* It is used as an escape character for all
* other meta-characters, and itself. When used
* in a set ([4]), it is treated as an ordinary
* character.
*
* [4] [set] matches one of the characters in the set.
* If the first character in the set is "^",
* it matches a character NOT in the set, i.e.
* complements the set. A shorthand S-E is
* used to specify a set of characters S upto
* E, inclusive. The special characters "]" and
* "-" have no special meaning if they appear
* it matches a character NOT in the set, i.e.
* complements the set. A shorthand S-E is
* used to specify a set of characters S upto
* E, inclusive. The special characters "]" and
* "-" have no special meaning if they appear
* as the first chars in the set.
* examples: match:
*
@@ -210,8 +212,8 @@
* Notes:
*
* This implementation uses a bit-set representation for character
* classes for speed and compactness. Each character is represented
* by one bit in a 128-bit block. Thus, CCL always takes a
* classes for speed and compactness. Each character is represented
* by one bit in a 128-bit block. Thus, CCL always takes a
* constant 16 bytes in the internal nfa, and RESearch::Execute does a single
* bit comparison to locate the character in the set.
*
@@ -221,7 +223,7 @@
* compile: CHR f CHR o CLO CHR o END CLO ANY END END
* matches: fo foo fooo foobar fobar foxx ...
*
* pattern: fo[ob]a[rz]
* pattern: fo[ob]a[rz]
* compile: CHR f CHR o CCL bitset CHR a CCL bitset END
* matches: fobar fooar fobaz fooaz
*
@@ -269,7 +271,7 @@
const char bitarr[] = {1,2,4,8,16,32,64,'\200'};
#define badpat(x) (*nfa = END, x)
RESearch::RESearch() {
Init();
}
@@ -359,7 +361,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
int n;
char mask; /* xor mask -CCL/NCL */
int c1, c2;
if (!pat || !length)
if (sta)
return 0;
@@ -401,7 +403,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
i++;
if (*++p == '^') {
mask = '\377';
mask = '\377';
i++;
p++;
} else
@@ -445,7 +447,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
for (n = 0; n < BITBLK; bittab[n++] = (char) 0)
*mp++ = static_cast<char>(mask ^ bittab[n]);
break;
case '*': /* match 0 or more.. */
@@ -590,7 +592,7 @@ const char *RESearch::Compile(const char *pat, int length, bool caseSensitive, b
* RESearch::Execute:
* execute nfa to find a match.
*
* special cases: (nfa[0])
* special cases: (nfa[0])
* BOL
* Match only once, starting from the
* beginning.
@@ -615,7 +617,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
bol = lp;
failure = 0;
Clear();
switch(*ap) {
@@ -656,7 +658,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
return 1;
}
/*
/*
* PMatch: internal routine for the hard part
*
* This code is partly snarfed from an early grep written by
@@ -682,7 +684,7 @@ int RESearch::Execute(CharacterIndexer &ci, int lp, int endp) {
*
* At the end of a successful match, bopat[n] and eopat[n]
* are set to the beginning and end of subpatterns matched
* by tagged expressions (n = 1 to 9).
* by tagged expressions (n = 1 to 9).
*
*/
@@ -693,23 +695,23 @@ extern void re_fail(char *,char);
* and EOW. the reason for not using ctype macros is that we can
* let the user add into our own table. see RESearch::ModifyWord. This table
* is not in the bitset form, since we may wish to extend it in the
* future for other character classifications.
* future for other character classifications.
*
* TRUE for 0-9 A-Z a-z _
*/
static char chrtyp[MAXCHR] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 0, 0,
0, 0, 0, 0, 0, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 0, 0, 0, 0, 1, 0, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 0, 0, 0, 0, 0
};
@@ -831,10 +833,10 @@ int RESearch::PMatch(CharacterIndexer &ci, int lp, int endp, char *ap) {
* the compact bitset representation for the default table]
*/
static char deftab[16] = {
0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',
'\376', '\377', '\377', 007
};
static char deftab[16] = {
0, 0, 0, 0, 0, 0, '\377', 003, '\376', '\377', '\377', '\207',
'\376', '\377', '\377', 007
};
void RESearch::ModifyWord(char *s) {
int i;
@@ -881,7 +883,7 @@ int RESearch::Substitute(CharacterIndexer &ci, char *src, char *dst) {
pin = c - '0';
break;
}
default:
*dst++ = c;
continue;

View File

@@ -18,7 +18,7 @@
#define BITBLK MAXCHR/CHRBIT
class CharacterIndexer {
public:
public:
virtual char CharAt(int index)=0;
};

View File

@@ -15,18 +15,18 @@
*/
class SVector {
enum { allocSize = 4000 };
int *v; ///< The vector
unsigned int size; ///< Number of elements allocated
unsigned int len; ///< Number of elements used in vector
bool allocFailure; ///< A memory allocation call has failed
/** Internally allocate more elements than the user wants
* to avoid thrashing the memory allocator. */
void SizeTo(int newSize) {
if (newSize < allocSize)
newSize += allocSize;
else
else
newSize = (newSize * 3) / 2;
int* newv = new int[newSize];
if (!newv) {
@@ -44,7 +44,7 @@ class SVector {
delete []v;
v = newv;
}
public:
SVector() {
allocFailure = false;

View File

@@ -203,11 +203,11 @@ void ScintillaBase::AutoCompleteStart(int lenEntered, const char *list) {
pdoc->DeleteChars(currentPos, lenEntered);
SetEmptySelection(currentPos);
pdoc->InsertString(currentPos, list);
SetEmptySelection(currentPos + strlen(list));
SetEmptySelection(currentPos + static_cast<int>(strlen(list)));
} else {
SetEmptySelection(currentPos);
pdoc->InsertString(currentPos, list + lenEntered);
SetEmptySelection(currentPos + strlen(list + lenEntered));
SetEmptySelection(currentPos + static_cast<int>(strlen(list + lenEntered)));
}
return;
}
@@ -340,7 +340,7 @@ void ScintillaBase::AutoCompleteCompleted() {
if (item != -1) {
SString piece = selected;
pdoc->InsertString(firstPos, piece.c_str());
SetEmptySelection(firstPos + piece.length());
SetEmptySelection(firstPos + static_cast<int>(piece.length()));
}
pdoc->EndUndoAction();
}
@@ -557,7 +557,7 @@ sptr_t ScintillaBase::WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lPara
return ac.GetTypesep();
case SCI_CALLTIPSHOW:
CallTipShow(LocationFromPosition(wParam),
CallTipShow(LocationFromPosition(wParam),
reinterpret_cast<const char *>(lParam));
break;

View File

@@ -43,7 +43,7 @@ protected:
int lexLanguage;
const LexerModule *lexCurrent;
PropSet props;
enum {numWordLists=9};
enum {numWordLists=KEYWORDSET_MAX+1};
WordList *keyWordLists[numWordLists+1];
void SetLexer(uptr_t wParam);
void SetLexerLanguage(const char *languageName);

View File

@@ -67,8 +67,8 @@ Style &Style::operator=(const Style &source) {
void Style::Clear(ColourDesired fore_, ColourDesired back_, int size_,
const char *fontName_, int characterSet_,
bool bold_, bool italic_, bool eolFilled_,
bool underline_, ecaseForced caseForce_,
bool bold_, bool italic_, bool eolFilled_,
bool underline_, ecaseForced caseForce_,
bool visible_, bool changeable_, bool hotspot_) {
fore.desired = fore_;
back.desired = back_;
@@ -102,7 +102,7 @@ void Style::ClearTo(const Style &source) {
source.eolFilled,
source.underline,
source.caseForce,
source.visible,
source.visible,
source.changeable,
source.hotspot);
}

View File

@@ -44,8 +44,8 @@ public:
void Clear(ColourDesired fore_, ColourDesired back_,
int size_,
const char *fontName_, int characterSet_,
bool bold_, bool italic_, bool eolFilled_,
bool underline_, ecaseForced caseForce_,
bool bold_, bool italic_, bool eolFilled_,
bool underline_, ecaseForced caseForce_,
bool visible_, bool changeable_, bool hotspot_);
void ClearTo(const Style &source);
bool EquivalentFontTo(const Style *other) const;

View File

@@ -7,7 +7,7 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <ctype.h>
#include <stdio.h>
#include "Platform.h"
@@ -24,7 +24,7 @@ bool WindowAccessor::InternalIsLeadByte(char ch) {
if (SC_CP_UTF8 == codePage)
// For lexing, all characters >= 0x80 are treated the
// same so none is considered a lead byte.
return false;
return false;
else
return Platform::IsDBCSLeadByte(codePage, ch);
}
@@ -71,10 +71,10 @@ int WindowAccessor::LevelAt(int line) {
return Platform::SendScintilla(id, SCI_GETFOLDLEVEL, line, 0);
}
int WindowAccessor::Length() {
if (lenDoc == -1)
int WindowAccessor::Length() {
if (lenDoc == -1)
lenDoc = Platform::SendScintilla(id, SCI_GETTEXTLENGTH, 0, 0);
return lenDoc;
return lenDoc;
}
int WindowAccessor::GetLineState(int line) {
@@ -125,7 +125,7 @@ void WindowAccessor::Flush() {
startPos = extremePosition;
lenDoc = -1;
if (validLen > 0) {
Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
Platform::SendScintillaPointer(id, SCI_SETSTYLINGEX, validLen,
styleBuf);
validLen = 0;
}
@@ -134,12 +134,12 @@ void WindowAccessor::Flush() {
int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsCommentLeader) {
int end = Length();
int spaceFlags = 0;
// Determines the indentation level of the current line and also checks for consistent
// Determines the indentation level of the current line and also checks for consistent
// indentation compared to the previous line.
// Indentation is judged consistent when the indentation whitespace of each line lines
// Indentation is judged consistent when the indentation whitespace of each line lines
// the same or the indentation of one line is a prefix of the other.
int pos = LineStart(line);
char ch = (*this)[pos];
int indent = 0;
@@ -166,7 +166,7 @@ int WindowAccessor::IndentAmount(int line, int *flags, PFNIsCommentLeader pfnIsC
}
ch = (*this)[++pos];
}
*flags = spaceFlags;
indent += SC_FOLDLEVELBASE;
// if completely empty line or the start of a comment...

View File

@@ -49,7 +49,7 @@ void XPM::FillRun(Surface *surface, int code, int startX, int y, int x) {
}
}
XPM::XPM(const char *textForm) :
XPM::XPM(const char *textForm) :
data(0), codes(0), colours(0), lines(0) {
Init(textForm);
}
@@ -102,7 +102,7 @@ void XPM::Init(const char * const *linesForm) {
int strings = 1+height+nColours;
lines = new char *[strings];
int allocation = 0;
size_t allocation = 0;
for (int i=0; i<strings; i++) {
allocation += MeasureLength(linesForm[i]) + 1;
}

View File

@@ -475,7 +475,7 @@ void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp)
buff[len] = 0;
SendMsg(2049, markerNumber, (long)buff);
delete [] buff;
}
// Set a margin to be either numeric or symbolic.
@@ -858,7 +858,7 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) {
buff[len] = 0;
SendMsg(2405, type, (long)buff);
delete [] buff;
}
// Clear all the registered images.
@@ -1802,12 +1802,12 @@ bool wxStyledTextCtrl::GetMouseDownCaptures() {
}
// Sets the cursor to one of the SC_CURSOR* values.
void wxStyledTextCtrl::SetCursor(int cursorType) {
void wxStyledTextCtrl::SetSTCCursor(int cursorType) {
SendMsg(2386, cursorType, 0);
}
// Get cursor type.
int wxStyledTextCtrl::GetCursor() {
int wxStyledTextCtrl::GetSTCCursor() {
return SendMsg(2387, 0, 0);
}
@@ -2115,11 +2115,11 @@ bool wxStyledTextCtrl::SaveFile(const wxString& filename)
if (!file.IsOpened())
return FALSE;
bool success = file.Write(GetText());
bool success = file.Write(GetText(), *wxConvCurrent);
if (success)
if (success) {
SetSavePoint();
}
return success;
}
@@ -2131,13 +2131,23 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
if (file.IsOpened())
{
wxString contents;
#if wxUSE_UNICODE
wxMemoryBuffer buffer;
#else
wxString buffer;
#endif
off_t len = file.Length();
if (len > 0)
{
wxChar *buf = contents.GetWriteBuf(len);
success = (file.Read(buf, len) == len);
contents.UngetWriteBuf();
void *bufptr = buffer.GetWriteBuf(len);
success = (file.Read(bufptr, len) == len);
buffer.UngetWriteBuf(len);
#if wxUSE_UNICODE
contents = wxString(buffer, *wxConvCurrent);
#else
contents = buffer;
#endif
}
else
success = true; // empty file is ok
@@ -2157,7 +2167,7 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
//----------------------------------------------------------------------
// Event handlers
void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
wxPaintDC dc(this);
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
}
@@ -2179,7 +2189,7 @@ void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
}
}
void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
wxSize sz = GetClientSize();
m_swx->DoSize(sz.x, sz.y);
}
@@ -2257,9 +2267,10 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
int key = evt.GetKeyCode();
bool shift = evt.ShiftDown(),
ctrl = evt.ControlDown(),
alt = evt.AltDown();
alt = evt.AltDown(),
meta = evt.MetaDown();
int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, &m_lastKeyDownConsumed);
int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, meta, &m_lastKeyDownConsumed);
// printf("KeyDn key:%d shift:%d ctrl:%d alt:%d processed:%d consumed:%d\n",
// key, shift, ctrl, alt, processed, m_lastKeyDownConsumed);
@@ -2269,22 +2280,22 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
}
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& WXUNUSED(evt)) {
m_swx->DoLoseFocus();
}
void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& WXUNUSED(evt)) {
m_swx->DoGainFocus();
}
void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) {
void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
m_swx->DoSysColourChange();
}
void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) {
void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) {
// do nothing to help avoid flashing
}
@@ -2295,7 +2306,7 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) {
}
void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) {
void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
m_swx->DoOnListBox();
}

View File

@@ -362,7 +362,7 @@ bool wxStyledTextCtrl::LoadFile(const wxString& filename)
//----------------------------------------------------------------------
// Event handlers
void wxStyledTextCtrl::OnPaint(wxPaintEvent& evt) {
void wxStyledTextCtrl::OnPaint(wxPaintEvent& WXUNUSED(evt)) {
wxPaintDC dc(this);
m_swx->DoPaint(&dc, GetUpdateRegion().GetBox());
}
@@ -384,7 +384,7 @@ void wxStyledTextCtrl::OnScroll(wxScrollEvent& evt) {
}
}
void wxStyledTextCtrl::OnSize(wxSizeEvent& evt) {
void wxStyledTextCtrl::OnSize(wxSizeEvent& WXUNUSED(evt)) {
wxSize sz = GetClientSize();
m_swx->DoSize(sz.x, sz.y);
}
@@ -462,9 +462,10 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
int key = evt.GetKeyCode();
bool shift = evt.ShiftDown(),
ctrl = evt.ControlDown(),
alt = evt.AltDown();
alt = evt.AltDown(),
meta = evt.MetaDown();
int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, &m_lastKeyDownConsumed);
int processed = m_swx->DoKeyDown(key, shift, ctrl, alt, meta, &m_lastKeyDownConsumed);
// printf("KeyDn key:%%d shift:%%d ctrl:%%d alt:%%d processed:%%d consumed:%%d\n",
// key, shift, ctrl, alt, processed, m_lastKeyDownConsumed);
@@ -474,22 +475,22 @@ void wxStyledTextCtrl::OnKeyDown(wxKeyEvent& evt) {
}
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& evt) {
void wxStyledTextCtrl::OnLoseFocus(wxFocusEvent& WXUNUSED(evt)) {
m_swx->DoLoseFocus();
}
void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& evt) {
void wxStyledTextCtrl::OnGainFocus(wxFocusEvent& WXUNUSED(evt)) {
m_swx->DoGainFocus();
}
void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& evt) {
void wxStyledTextCtrl::OnSysColourChanged(wxSysColourChangedEvent& WXUNUSED(evt)) {
m_swx->DoSysColourChange();
}
void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& evt) {
void wxStyledTextCtrl::OnEraseBackground(wxEraseEvent& WXUNUSED(evt)) {
// do nothing to help avoid flashing
}
@@ -500,7 +501,7 @@ void wxStyledTextCtrl::OnMenu(wxCommandEvent& evt) {
}
void wxStyledTextCtrl::OnListBox(wxCommandEvent& evt) {
void wxStyledTextCtrl::OnListBox(wxCommandEvent& WXUNUSED(evt)) {
m_swx->DoOnListBox();
}

View File

@@ -52,6 +52,7 @@
//-----------------------------------------
// Commands that can be bound to keystrokes
%(CMDS)s