[UPDATE] Scintilla update from 2.21 to 2.25
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository/trunk@742 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
8b7e0b76c4
commit
0152ded3ff
@ -40,27 +40,23 @@ The current make file only supports static linking between SciTE and Scintilla.
|
||||
|
||||
*** Windows version ***
|
||||
|
||||
A C++ compiler is required. Visual Studio .NET 2008 is the development system
|
||||
A C++ compiler is required. Visual Studio .NET 2010 is the development system
|
||||
used for most development although TDM Mingw32 4.4.1 is also supported.
|
||||
For older versions of Borland C++ such as version 5.02, add the -l option.
|
||||
|
||||
To build Scintilla, make in the scintilla/win32 directory
|
||||
cd scintilla\win32
|
||||
GCC: mingw32-make
|
||||
VS .NET: nmake -f scintilla.mak
|
||||
VC++ 6: nmake -f scintilla_vc6.mak
|
||||
Borland: make -fscintilla.mak
|
||||
cd ..\..
|
||||
|
||||
To build SciTE, use the makefiles located in the scite/win32 directory
|
||||
cd scite\win32
|
||||
GCC: mingw32-make
|
||||
VS .NET: nmake -f scite.mak
|
||||
Borland: make -fscite.mak
|
||||
|
||||
An executable SciTE will now be in scite\bin.
|
||||
|
||||
The Visual C++ 6.0 project (.dsp) files are no longer supported but are left
|
||||
The Visual C++ 6.0 project (.dsp) and make files are no longer supported but are left
|
||||
in the download for people that are prepared to update them.
|
||||
|
||||
*** GTK+/Windows version ***
|
||||
|
@ -6,19 +6,10 @@ INST_NAME=-install_name \
|
||||
|
||||
LD=gcc $(ARCH) -dynamiclib -framework Cocoa $(INST_NAME)
|
||||
|
||||
SCI_LEXERS=LexAPDL.o LexASY.o LexAU3.o LexAVE.o LexAbaqus.o LexAda.o \
|
||||
LexAsm.o LexAsn1.o LexBaan.o LexBash.o LexBasic.o LexBullant.o LexCLW.o \
|
||||
LexCOBOL.o LexCPP.o LexCSS.o LexCaml.o LexCmake.o LexConf.o LexCrontab.o \
|
||||
LexCsound.o LexD.o LexEScript.o LexEiffel.o LexErlang.o LexFlagship.o \
|
||||
LexForth.o LexFortran.o LexGAP.o LexGui4Cli.o LexHTML.o LexHaskell.o \
|
||||
LexInno.o LexKix.o LexLisp.o LexLout.o LexLua.o LexMMIXAL.o LexMPT.o \
|
||||
LexMSSQL.o LexMagik.o LexMarkdown.o LexMatlab.o LexMetapost.o LexMySQL.o \
|
||||
LexNimrod.o LexNsis.o LexOpal.o LexOthers.o LexPB.o LexPLM.o LexPOV.o \
|
||||
LexPS.o LexPascal.o LexPerl.o LexPowerPro.o LexPowerShell.o LexProgress.o \
|
||||
LexPython.o LexR.o LexRebol.o LexRuby.o LexSML.o LexSQL.o LexScriptol.o \
|
||||
LexSmalltalk.o LexSorcus.o LexSpecman.o LexSpice.o LexTACL.o LexTADS3.o \
|
||||
LexTAL.o LexTCL.o LexTeX.o LexVB.o LexVHDL.o LexVerilog.o LexYAML.o \
|
||||
LexTxt2tags.o LexerBase.o LexerModule.o LexerSimple.o Accessor.o
|
||||
LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx))))
|
||||
|
||||
SCI_LEXERS=$(LEXOBJS) \
|
||||
LexerBase.o LexerModule.o LexerSimple.o Accessor.o
|
||||
|
||||
SCI_OBJ=AutoComplete.o CallTip.o CellBuffer.o CharClassify.o \
|
||||
ContractionState.o Decoration.o Document.o Editor.o \
|
||||
@ -77,4 +68,4 @@ $(FRM_BLD):
|
||||
#$(FRM_BLD)/CallTip.o : ../src/CallTip.cxx ../src/CallTip.h \
|
||||
# ../include/Platform.h
|
||||
|
||||
### end targets ###
|
||||
### end targets ###
|
||||
|
@ -626,7 +626,7 @@ void Scintilla::SurfaceImpl::AlphaRectangle(PRectangle rc, int /*cornerSize*/, C
|
||||
ColourDesired colour( fill.AsLong() );
|
||||
|
||||
// Set the Fill color to match
|
||||
CGContextSetRGBFillColor( gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, colour.GetBlue() / 255.0, alphaFill / 100.0 );
|
||||
CGContextSetRGBFillColor( gc, colour.GetRed() / 255.0, colour.GetGreen() / 255.0, colour.GetBlue() / 255.0, alphaFill / 255.0 );
|
||||
CGRect rect = PRectangleToCGRect( rc );
|
||||
CGContextFillRect( gc, rect );
|
||||
}
|
||||
|
@ -220,7 +220,8 @@ ScintillaCocoa::~ScintillaCocoa()
|
||||
void ScintillaCocoa::Initialise()
|
||||
{
|
||||
static bool initedLexers = false;
|
||||
if (!initedLexers) {
|
||||
if (!initedLexers)
|
||||
{
|
||||
initedLexers = true;
|
||||
Scintilla_LinkLexers();
|
||||
}
|
||||
@ -525,7 +526,7 @@ void ScintillaCocoa::Paste(bool forceRectangular)
|
||||
return;
|
||||
|
||||
pdoc->BeginUndoAction();
|
||||
ClearSelection();
|
||||
ClearSelection(false);
|
||||
int length = selectedText.len - 1; // One less to avoid inserting the terminating 0 character.
|
||||
if (selectedText.rectangular)
|
||||
{
|
||||
@ -1105,25 +1106,29 @@ void ScintillaCocoa::DoScroll(float position, NSScrollerPart part, bool horizont
|
||||
}
|
||||
else
|
||||
{
|
||||
// VerticalScrolling is by line.
|
||||
int topLine = (int) (position * MaxScrollPos());
|
||||
int page = LinesOnScreen();
|
||||
// VerticalScrolling is by line. If the user is scrolling using the knob we can directly
|
||||
// set the new scroll position. Otherwise we have to compute it first.
|
||||
if (part == NSScrollerKnob)
|
||||
ScrollTo(position * MaxScrollPos(), false);
|
||||
else
|
||||
{
|
||||
switch (part)
|
||||
{
|
||||
case NSScrollerDecrementLine:
|
||||
topLine--;
|
||||
ScrollTo(topLine - 1, true);
|
||||
break;
|
||||
case NSScrollerDecrementPage:
|
||||
topLine -= page;
|
||||
ScrollTo(topLine - LinesOnScreen(), true);
|
||||
break;
|
||||
case NSScrollerIncrementLine:
|
||||
topLine++;
|
||||
ScrollTo(topLine + 1, true);
|
||||
break;
|
||||
case NSScrollerIncrementPage:
|
||||
topLine += page;
|
||||
ScrollTo(topLine + LinesOnScreen(), true);
|
||||
break;
|
||||
};
|
||||
ScrollTo(topLine, true);
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1232,7 +1237,7 @@ void ScintillaCocoa::IdleTimerFired()
|
||||
/**
|
||||
* Main entry point for drawing the control.
|
||||
*
|
||||
* @param rect The area to paint, given in the sender's coordinate.
|
||||
* @param rect The area to paint, given in the sender's coordinate system.
|
||||
* @param gc The context we can use to paint.
|
||||
*/
|
||||
void ScintillaCocoa::Draw(NSRect rect, CGContextRef gc)
|
||||
|
@ -157,6 +157,8 @@
|
||||
114B6FEB11FA7645004FB6AB /* PropSetSimple.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FE011FA7645004FB6AB /* PropSetSimple.h */; };
|
||||
114B6FEC11FA7645004FB6AB /* StyleContext.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FE111FA7645004FB6AB /* StyleContext.h */; };
|
||||
114B6FED11FA7645004FB6AB /* WordList.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FE211FA7645004FB6AB /* WordList.h */; };
|
||||
11BB124D12FF9C1300F6BCF7 /* LexModula.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */; };
|
||||
11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11F35FDA12AEFAF100F0236D /* LexA68k.cxx */; };
|
||||
2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59D0FC168A100E85C33 /* InfoBar.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A30FC168A100E85C33 /* ScintillaView.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
2744E5AC0FC168B200E85C33 /* InfoBarCommunicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5AB0FC168B200E85C33 /* InfoBarCommunicator.h */; settings = {ATTRIBUTES = (Public, ); }; };
|
||||
@ -334,6 +336,8 @@
|
||||
114B6FE011FA7645004FB6AB /* PropSetSimple.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = PropSetSimple.h; path = ../../lexlib/PropSetSimple.h; sourceTree = SOURCE_ROOT; };
|
||||
114B6FE111FA7645004FB6AB /* StyleContext.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StyleContext.h; path = ../../lexlib/StyleContext.h; sourceTree = SOURCE_ROOT; };
|
||||
114B6FE211FA7645004FB6AB /* WordList.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = WordList.h; path = ../../lexlib/WordList.h; sourceTree = SOURCE_ROOT; };
|
||||
11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexModula.cxx; path = ../../lexers/LexModula.cxx; sourceTree = SOURCE_ROOT; };
|
||||
11F35FDA12AEFAF100F0236D /* LexA68k.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexA68k.cxx; path = ../../lexers/LexA68k.cxx; sourceTree = SOURCE_ROOT; };
|
||||
2744E4850FC1678600E85C33 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Platform.h; path = ../../include/Platform.h; sourceTree = SOURCE_ROOT; };
|
||||
2744E4870FC1678600E85C33 /* SciLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SciLexer.h; path = ../../include/SciLexer.h; sourceTree = SOURCE_ROOT; };
|
||||
2744E4880FC1678600E85C33 /* Scintilla.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Scintilla.h; path = ../../include/Scintilla.h; sourceTree = SOURCE_ROOT; };
|
||||
@ -450,6 +454,8 @@
|
||||
2744E47D0FC1674E00E85C33 /* Lexers */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */,
|
||||
11F35FDA12AEFAF100F0236D /* LexA68k.cxx */,
|
||||
114B6EBE11FA7526004FB6AB /* LexAbaqus.cxx */,
|
||||
114B6EBF11FA7526004FB6AB /* LexAda.cxx */,
|
||||
114B6EC011FA7526004FB6AB /* LexAPDL.cxx */,
|
||||
@ -755,7 +761,14 @@
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ScintillaFramework" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 0867D691FE84028FC02AAC07 /* Scintilla */;
|
||||
productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
|
||||
projectDirPath = "";
|
||||
@ -900,6 +913,8 @@
|
||||
114B6F9D11FA75BE004FB6AB /* PropSetSimple.cxx in Sources */,
|
||||
114B6F9E11FA75BE004FB6AB /* StyleContext.cxx in Sources */,
|
||||
114B6F9F11FA75BE004FB6AB /* WordList.cxx in Sources */,
|
||||
11F35FDB12AEFAF100F0236D /* LexA68k.cxx in Sources */,
|
||||
11BB124D12FF9C1300F6BCF7 /* LexModula.cxx in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
@ -924,6 +939,7 @@
|
||||
COPY_PHASE_STRIP = NO;
|
||||
DYLIB_COMPATIBILITY_VERSION = 1;
|
||||
DYLIB_CURRENT_VERSION = 1;
|
||||
EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = ".bzr *.nib *.lproj *.framework *.gch (*) CVS .svn *.xcodeproj *.xcode *.pbproj *.pbxproj";
|
||||
FRAMEWORK_VERSION = A;
|
||||
GCC_DYNAMIC_NO_PIC = NO;
|
||||
GCC_ENABLE_FIX_AND_CONTINUE = YES;
|
||||
|
@ -100,7 +100,7 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL.
|
||||
// alternatively: [mEditor setEditorProperty: SCI_SETLEXERLANGUAGE parameter: nil value: (sptr_t) "mysql"];
|
||||
|
||||
// Number of styles we use with this lexer.
|
||||
[mEditor setGeneralProperty: SCI_SETSTYLEBITS parameter: 5 value: 0];
|
||||
[mEditor setGeneralProperty: SCI_SETSTYLEBITS value: [mEditor getGeneralProperty: SCI_GETSTYLEBITSNEEDED]];
|
||||
|
||||
// Keywords to highlight. Indices are:
|
||||
// 0 - Major keywords (reserved keywords)
|
||||
|
@ -192,7 +192,14 @@
|
||||
isa = PBXProject;
|
||||
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ScintillaTest" */;
|
||||
compatibilityVersion = "Xcode 3.1";
|
||||
developmentRegion = English;
|
||||
hasScannedForEncodings = 1;
|
||||
knownRegions = (
|
||||
English,
|
||||
Japanese,
|
||||
French,
|
||||
German,
|
||||
);
|
||||
mainGroup = 29B97314FDCFA39411CA2CEA /* ScintillaTest */;
|
||||
projectDirPath = "";
|
||||
projectReferences = (
|
||||
|
@ -43,6 +43,9 @@ extern NSString *SCIUpdateUINotification;
|
||||
- (void) removeMarkedText;
|
||||
- (void) setCursor: (Scintilla::Window::Cursor) cursor;
|
||||
|
||||
- (BOOL) canUndo;
|
||||
- (BOOL) canRedo;
|
||||
|
||||
@property (retain) ScintillaView* owner;
|
||||
@end
|
||||
|
||||
@ -76,6 +79,8 @@ extern NSString *SCIUpdateUINotification;
|
||||
value: (float) value;
|
||||
- (void) setCallback: (id <InfoBarCommunicator>) callback;
|
||||
|
||||
- (void) suspendDrawing: (BOOL) suspend;
|
||||
|
||||
// Scroller handling
|
||||
- (BOOL) setVerticalScrollRange: (int) range page: (int) page;
|
||||
- (void) setVerticalScrollPosition: (float) position;
|
||||
@ -106,6 +111,8 @@ extern NSString *SCIUpdateUINotification;
|
||||
|
||||
// Back end properties getters and setters.
|
||||
- (void) setGeneralProperty: (int) property parameter: (long) parameter value: (long) value;
|
||||
- (void) setGeneralProperty: (int) property value: (long) value;
|
||||
|
||||
- (long) getGeneralProperty: (int) property;
|
||||
- (long) getGeneralProperty: (int) property parameter: (long) parameter;
|
||||
- (long) getGeneralProperty: (int) property parameter: (long) parameter extra: (long) extra;
|
||||
|
@ -179,7 +179,10 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
|
||||
*/
|
||||
- (NSMenu*) menuForEvent: (NSEvent*) theEvent
|
||||
{
|
||||
return mOwner.backend->CreateContextMenu(theEvent);
|
||||
if (![mOwner respondsToSelector: @selector(menuForEvent:)])
|
||||
return mOwner.backend->CreateContextMenu(theEvent);
|
||||
else
|
||||
return [mOwner menuForEvent: theEvent];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -279,11 +282,9 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
|
||||
{
|
||||
// We have already marked text. Replace that.
|
||||
[mOwner setGeneralProperty: SCI_SETSELECTIONSTART
|
||||
parameter: mMarkedTextRange.location
|
||||
value: 0];
|
||||
value: mMarkedTextRange.location];
|
||||
[mOwner setGeneralProperty: SCI_SETSELECTIONEND
|
||||
parameter: mMarkedTextRange.location + mMarkedTextRange.length
|
||||
value: 0];
|
||||
value: mMarkedTextRange.location + mMarkedTextRange.length];
|
||||
currentPosition = mMarkedTextRange.location;
|
||||
}
|
||||
|
||||
@ -296,7 +297,7 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
|
||||
mMarkedTextRange.length = raw_text.size();
|
||||
|
||||
// Mark the just inserted text. Keep the marked range for later reset.
|
||||
[mOwner setGeneralProperty: SCI_SETINDICATORCURRENT parameter: INPUT_INDICATOR value: 0];
|
||||
[mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INPUT_INDICATOR];
|
||||
[mOwner setGeneralProperty: SCI_INDICATORFILLRANGE
|
||||
parameter: mMarkedTextRange.location
|
||||
value: mMarkedTextRange.length];
|
||||
@ -305,11 +306,9 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
|
||||
if (range.length > 0)
|
||||
{
|
||||
[mOwner setGeneralProperty: SCI_SETSELECTIONSTART
|
||||
parameter: currentPosition + range.location
|
||||
value: 0];
|
||||
value: currentPosition + range.location];
|
||||
[mOwner setGeneralProperty: SCI_SETSELECTIONEND
|
||||
parameter: currentPosition + range.location + range.length
|
||||
value: 0];
|
||||
value: currentPosition + range.location + range.length];
|
||||
}
|
||||
}
|
||||
|
||||
@ -319,7 +318,7 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
|
||||
{
|
||||
if (mMarkedTextRange.length > 0)
|
||||
{
|
||||
[mOwner setGeneralProperty: SCI_SETINDICATORCURRENT parameter: INPUT_INDICATOR value: 0];
|
||||
[mOwner setGeneralProperty: SCI_SETINDICATORCURRENT value: INPUT_INDICATOR];
|
||||
[mOwner setGeneralProperty: SCI_INDICATORCLEARRANGE
|
||||
parameter: mMarkedTextRange.location
|
||||
value: mMarkedTextRange.length];
|
||||
@ -338,11 +337,9 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
|
||||
{
|
||||
// We have already marked text. Replace that.
|
||||
[mOwner setGeneralProperty: SCI_SETSELECTIONSTART
|
||||
parameter: mMarkedTextRange.location
|
||||
value: 0];
|
||||
value: mMarkedTextRange.location];
|
||||
[mOwner setGeneralProperty: SCI_SETSELECTIONEND
|
||||
parameter: mMarkedTextRange.location + mMarkedTextRange.length
|
||||
value: 0];
|
||||
value: mMarkedTextRange.location + mMarkedTextRange.length];
|
||||
mOwner.backend->InsertText(@"");
|
||||
mMarkedTextRange = NSMakeRange(NSNotFound, 0);
|
||||
}
|
||||
@ -546,6 +543,22 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
|
||||
mOwner.backend->Redo();
|
||||
}
|
||||
|
||||
- (BOOL) canUndo
|
||||
{
|
||||
return mOwner.backend->CanUndo();
|
||||
}
|
||||
|
||||
- (BOOL) canRedo
|
||||
{
|
||||
return mOwner.backend->CanRedo();
|
||||
}
|
||||
|
||||
|
||||
- (BOOL) isEditable
|
||||
{
|
||||
return mOwner.backend->WndProc(SCI_GETREADONLY, 0, 0) == 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
- (void) dealloc
|
||||
@ -621,7 +634,7 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
|
||||
// Compute point increase/decrease based on default font size.
|
||||
int fontSize = [self getGeneralProperty: SCI_STYLEGETSIZE parameter: STYLE_DEFAULT];
|
||||
int zoom = (int) (fontSize * (value - 1));
|
||||
[self setGeneralProperty: SCI_SETZOOM parameter: zoom value: 0];
|
||||
[self setGeneralProperty: SCI_SETZOOM value: zoom];
|
||||
break;
|
||||
}
|
||||
};
|
||||
@ -636,6 +649,20 @@ NSString *SCIUpdateUINotification = @"SCIUpdateUI";
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Prevents drawing of the inner view to avoid flickering when doing many visual updates
|
||||
* (like clearing all marks and setting new ones etc.).
|
||||
*/
|
||||
- (void) suspendDrawing: (BOOL) suspend
|
||||
{
|
||||
if (suspend)
|
||||
[[self window] disableFlushWindow];
|
||||
else
|
||||
[[self window] enableFlushWindow];
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* Notification function used by Scintilla to call us back (e.g. for handling clicks on the
|
||||
* folder margin or changes in the editor).
|
||||
@ -660,7 +687,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
|
||||
{
|
||||
// Click on the folder margin. Toggle the current line if possible.
|
||||
int line = [editor getGeneralProperty: SCI_LINEFROMPOSITION parameter: scn->position];
|
||||
[editor setGeneralProperty: SCI_TOGGLEFOLD parameter: line value: 0];
|
||||
[editor setGeneralProperty: SCI_TOGGLEFOLD value: line];
|
||||
}
|
||||
break;
|
||||
};
|
||||
@ -688,6 +715,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
|
||||
NSPoint caretPosition = editor->mBackend->GetCaretPosition();
|
||||
[editor->mInfoBar notify: IBNCaretChanged message: nil location: caretPosition value: 0];
|
||||
[editor sendNotification: SCIUpdateUINotification];
|
||||
[editor sendNotification: NSTextViewDidChangeSelectionNotification];
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -984,7 +1012,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
|
||||
*/
|
||||
- (void) scrollerAction: (id) sender
|
||||
{
|
||||
float position = [sender floatValue];
|
||||
float position = [sender doubleValue];
|
||||
mBackend->DoScroll(position, [sender hitPart], sender == mHorizontalScroller);
|
||||
}
|
||||
|
||||
@ -1095,7 +1123,7 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
|
||||
|
||||
- (BOOL) isEditable
|
||||
{
|
||||
return mBackend->WndProc(SCI_GETREADONLY, 0, 0) != 0;
|
||||
return mBackend->WndProc(SCI_GETREADONLY, 0, 0) == 0;
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
@ -1134,6 +1162,19 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* A simplified version for setting properties which only require one parameter.
|
||||
*
|
||||
* @param property Main property like SCI_STYLESETFORE for which a value is to be set.
|
||||
* @param value The actual value. It depends on the property what this parameter means.
|
||||
*/
|
||||
- (void) setGeneralProperty: (int) property value: (long) value
|
||||
{
|
||||
mBackend->WndProc(property, value, 0);
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
|
||||
/**
|
||||
* This is a helper method to get a property in the backend, with native parameters.
|
||||
*
|
||||
@ -1417,14 +1458,12 @@ static void notification(intptr_t windowid, unsigned int iMessage, uintptr_t wPa
|
||||
{
|
||||
// Highlight the found text.
|
||||
[self setGeneralProperty: SCI_SETSELECTIONSTART
|
||||
parameter: position
|
||||
value: 0];
|
||||
value: position];
|
||||
[self setGeneralProperty: SCI_SETSELECTIONEND
|
||||
parameter: position + [searchText length]
|
||||
value: 0];
|
||||
value: position + [searchText length]];
|
||||
|
||||
if (scrollTo)
|
||||
[self setGeneralProperty: SCI_SCROLLCARET parameter: 0 value: 0];
|
||||
[self setGeneralProperty: SCI_SCROLLCARET value: 0];
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -79,7 +79,7 @@
|
||||
|
||||
<h1>Scintilla Documentation</h1>
|
||||
|
||||
<p>Last edited 16/July/2010 NH</p>
|
||||
<p>Last edited 19/January/2011 NH</p>
|
||||
|
||||
<p>There is <a class="jump" href="Design.html">an overview of the internal design of
|
||||
Scintilla</a>.<br />
|
||||
@ -937,6 +937,7 @@ struct Sci_TextToFind {
|
||||
<code>SCI_GETSTATUS</code>.
|
||||
To clear the error status call <code>SCI_SETSTATUS(0)</code>.
|
||||
The currently defined statuses are:
|
||||
</p>
|
||||
|
||||
<table cellpadding="1" cellspacing="2" border="0" summary="Status values">
|
||||
<tbody valign="top">
|
||||
@ -961,8 +962,6 @@ struct Sci_TextToFind {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</p>
|
||||
|
||||
<h2 id="UndoAndRedo">Undo and Redo</h2>
|
||||
|
||||
<p>Scintilla has multiple level undo and redo. It will continue to collect undoable actions
|
||||
@ -1257,7 +1256,8 @@ struct Sci_TextToFind {
|
||||
the line not including any end of line characters, use <a class="message"
|
||||
href="#SCI_GETLINEENDPOSITION"><code>SCI_GETLINEENDPOSITION(line)</code></a> - <a class="message"
|
||||
href="#SCI_POSITIONFROMLINE"><code>SCI_POSITIONFROMLINE(line)</code></a>.</p>
|
||||
<b id="SCI_GETSELTEXT">SCI_GETSELTEXT(<unused>, char *text)</b><br />
|
||||
|
||||
<p><b id="SCI_GETSELTEXT">SCI_GETSELTEXT(<unused>, char *text)</b><br />
|
||||
This copies the currently selected text and a terminating 0 byte to the <code>text</code>
|
||||
buffer. The buffer size should be determined by calling with a NULL pointer for the <code>text</code> argument
|
||||
<code>SCI_GETSELTEXT(0,0)</code>.
|
||||
@ -1507,9 +1507,9 @@ struct Sci_TextToFind {
|
||||
|
||||
<a class="message" href="#SCI_SETADDITIONALSELALPHA">SCI_SETADDITIONALSELALPHA(int alpha)</a><br />
|
||||
<a class="message" href="#SCI_GETADDITIONALSELALPHA">SCI_GETADDITIONALSELALPHA</a><br />
|
||||
<a class="message" href="#SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int <a class="jump" href="#colour">colour<a>)</a><br />
|
||||
<a class="message" href="#SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int <a class="jump" href="#colour">colour<a>)</a><br />
|
||||
<a class="message" href="#SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int <a class="jump" href="#colour">colour<a>)</a><br />
|
||||
<a class="message" href="#SCI_SETADDITIONALSELFORE">SCI_SETADDITIONALSELFORE(int colour)</a><br />
|
||||
<a class="message" href="#SCI_SETADDITIONALSELBACK">SCI_SETADDITIONALSELBACK(int colour)</a><br />
|
||||
<a class="message" href="#SCI_SETADDITIONALCARETFORE">SCI_SETADDITIONALCARETFORE(int colour)</a><br />
|
||||
<a class="message" href="#SCI_GETADDITIONALCARETFORE">SCI_GETADDITIONALCARETFORE</a><br />
|
||||
<a class="message" href="#SCI_SETADDITIONALCARETSBLINK">SCI_SETADDITIONALCARETSBLINK(bool additionalCaretsBlink)</a><br />
|
||||
<a class="message" href="#SCI_GETADDITIONALCARETSBLINK">SCI_GETADDITIONALCARETSBLINK</a><br />
|
||||
@ -1661,7 +1661,7 @@ struct Sci_TextToFind {
|
||||
<p>
|
||||
<b id="SCI_SETADDITIONALCARETSVISIBLE">SCI_SETADDITIONALCARETSVISIBLE(bool additionalCaretsVisible)</b><br />
|
||||
<b id="SCI_GETADDITIONALCARETSVISIBLE">SCI_GETADDITIONALCARETSVISIBLE</b><br />
|
||||
Determine whether to show additional carets (defaults to <code>true</code>).
|
||||
Determine whether to show additional carets (defaults to <code>true</code>).</p>
|
||||
|
||||
<p>
|
||||
<b id="SCI_SWAPMAINANCHORCARET">SCI_SWAPMAINANCHORCARET</b><br />
|
||||
@ -2076,11 +2076,11 @@ struct Sci_TextToFind {
|
||||
the lexer's colours with <code>SCI_SETWHITESPACEFORE</code> and
|
||||
<code>SCI_SETWHITESPACEBACK</code>.</p>
|
||||
|
||||
<b id="SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int size)</b><br />
|
||||
<p><b id="SCI_SETWHITESPACESIZE">SCI_SETWHITESPACESIZE(int size)</b><br />
|
||||
<b id="SCI_GETWHITESPACESIZE">SCI_GETWHITESPACESIZE</b><br />
|
||||
<code>SCI_SETWHITESPACESIZE</code> sets the size of the dots used for mark space characters.
|
||||
The <code>SCI_GETWHITESPACESIZE</code> message retrieves the current size.
|
||||
<p>
|
||||
</p>
|
||||
|
||||
<p>
|
||||
<b id="SCI_SETEXTRAASCENT">SCI_SETEXTRAASCENT(int extraAscent)</b><br />
|
||||
@ -2093,7 +2093,7 @@ struct Sci_TextToFind {
|
||||
Space may be added to the maximum ascent (<code>SCI_SETEXTRAASCENT</code>) and the
|
||||
maximum descent (<code>SCI_SETEXTRADESCENT</code>) to allow for more space between lines.
|
||||
This may done to make the text easier to read or to accomodate underlines or highlights.
|
||||
<p>
|
||||
</p>
|
||||
|
||||
<h2 id="Cursor">Cursor</h2>
|
||||
|
||||
@ -2531,18 +2531,15 @@ struct Sci_TextToFind {
|
||||
it was not selected. When there is no selection, the current insertion point is marked by the
|
||||
text caret. This is a vertical line that is normally blinking on and off to attract the users
|
||||
attention.</p>
|
||||
<code><a class="message" href="#SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour,
|
||||
int <a class="jump" href="#colour">colour<a>)</a><br />
|
||||
<a class="message" href="#SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour,
|
||||
int <a class="jump" href="#colour">colour<a>)</a><br />
|
||||
<code><a class="message" href="#SCI_SETSELFORE">SCI_SETSELFORE(bool useSelectionForeColour, int colour)</a><br />
|
||||
<a class="message" href="#SCI_SETSELBACK">SCI_SETSELBACK(bool useSelectionBackColour, int colour)</a><br />
|
||||
<a class="message" href="#SCI_SETSELALPHA">SCI_SETSELALPHA(int alpha)</a><br />
|
||||
<a class="message" href="#SCI_GETSELALPHA">SCI_GETSELALPHA</a><br />
|
||||
<a class="message" href="#SCI_SETSELEOLFILLED">SCI_SETSELEOLFILLED(bool filled)</a><br />
|
||||
<a class="message" href="#SCI_GETSELEOLFILLED">SCI_GETSELEOLFILLED</a><br />
|
||||
<a class="message" href="#SCI_SETCARETFORE">SCI_SETCARETFORE(int colour)</a><br />
|
||||
<a class="message" href="#SCI_GETCARETFORE">SCI_GETCARETFORE</a><br />
|
||||
<a class="message" href="#SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool
|
||||
show)</a><br />
|
||||
<a class="message" href="#SCI_SETCARETLINEVISIBLE">SCI_SETCARETLINEVISIBLE(bool show)</a><br />
|
||||
<a class="message" href="#SCI_GETCARETLINEVISIBLE">SCI_GETCARETLINEVISIBLE</a><br />
|
||||
<a class="message" href="#SCI_SETCARETLINEBACK">SCI_SETCARETLINEBACK(int colour)</a><br />
|
||||
<a class="message" href="#SCI_GETCARETLINEBACK">SCI_GETCARETLINEBACK</a><br />
|
||||
@ -2554,18 +2551,15 @@ struct Sci_TextToFind {
|
||||
<a class="message" href="#SCI_GETCARETSTYLE">SCI_GETCARETSTYLE</a><br />
|
||||
<a class="message" href="#SCI_SETCARETWIDTH">SCI_SETCARETWIDTH(int pixels)</a><br />
|
||||
<a class="message" href="#SCI_GETCARETWIDTH">SCI_GETCARETWIDTH</a><br />
|
||||
<a class="message" href="#SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useSetting,
|
||||
int <a class="jump" href="#colour">colour<a>)</a><br />
|
||||
<a class="message" href="#SCI_SETHOTSPOTACTIVEFORE">SCI_SETHOTSPOTACTIVEFORE(bool useSetting, int colour)</a><br />
|
||||
<a class="message" href="#SCI_GETHOTSPOTACTIVEFORE">SCI_GETHOTSPOTACTIVEFORE</a><br />
|
||||
<a class="message" href="#SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useSetting,
|
||||
int <a class="jump" href="#colour">colour<a>)</a><br />
|
||||
<a class="message" href="#SCI_SETHOTSPOTACTIVEBACK">SCI_SETHOTSPOTACTIVEBACK(bool useSetting, int colour)</a><br />
|
||||
<a class="message" href="#SCI_GETHOTSPOTACTIVEBACK">SCI_GETHOTSPOTACTIVEBACK</a><br />
|
||||
<a class="message" href="#SCI_SETHOTSPOTACTIVEUNDERLINE">SCI_SETHOTSPOTACTIVEUNDERLINE(bool underline)</a><br />
|
||||
<a class="message" href="#SCI_GETHOTSPOTACTIVEUNDERLINE">SCI_GETHOTSPOTACTIVEUNDERLINE</a><br />
|
||||
<a class="message" href="#SCI_SETHOTSPOTSINGLELINE">SCI_SETHOTSPOTSINGLELINE(bool singleLine)</a><br />
|
||||
<a class="message" href="#SCI_GETHOTSPOTSINGLELINE">SCI_GETHOTSPOTSINGLELINE</a><br />
|
||||
<a class="message" href="#SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int
|
||||
symbol)</a><br />
|
||||
<a class="message" href="#SCI_SETCONTROLCHARSYMBOL">SCI_SETCONTROLCHARSYMBOL(int symbol)</a><br />
|
||||
<a class="message" href="#SCI_GETCONTROLCHARSYMBOL">SCI_GETCONTROLCHARSYMBOL</a><br />
|
||||
<a class="message" href="#SCI_SETCARETSTICKY">SCI_SETCARETSTICKY(int useCaretStickyBehaviour)</a><br />
|
||||
<a class="message" href="#SCI_GETCARETSTICKY">SCI_GETCARETSTICKY</a><br />
|
||||
@ -2726,6 +2720,10 @@ struct Sci_TextToFind {
|
||||
<a class="message" href="#SCI_SETMARGINSENSITIVEN">SCI_SETMARGINSENSITIVEN(int margin, bool
|
||||
sensitive)</a><br />
|
||||
<a class="message" href="#SCI_GETMARGINSENSITIVEN">SCI_GETMARGINSENSITIVEN(int
|
||||
margin)</a><br />
|
||||
<a class="message" href="#SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
|
||||
cursor)</a><br />
|
||||
<a class="message" href="#SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int
|
||||
margin)</a><br />
|
||||
<a class="message" href="#SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(<unused>, int
|
||||
pixels)</a><br />
|
||||
@ -2804,6 +2802,14 @@ struct Sci_TextToFind {
|
||||
selection margins which make it easy to select ranges of lines. By default, all margins are
|
||||
insensitive.</p>
|
||||
|
||||
<p><b id="SCI_SETMARGINCURSORN">SCI_SETMARGINCURSORN(int margin, int
|
||||
cursor)</b><br />
|
||||
<b id="SCI_GETMARGINCURSORN">SCI_GETMARGINCURSORN(int margin)</b><br />
|
||||
A reversed arrow cursor is normally shown over all margins. This may be changed to a normal arrow with
|
||||
<code>SCI_SETMARGINCURSORN(margin, SC_CURSORARROW)</code> or restored to a
|
||||
reversed arrow with
|
||||
<code>SCI_SETMARGINCURSORN(margin, SC_CURSORREVERSEARROW)</code>.</p>
|
||||
|
||||
<p><b id="SCI_SETMARGINLEFT">SCI_SETMARGINLEFT(<unused>, int pixels)</b><br />
|
||||
<b id="SCI_GETMARGINLEFT">SCI_GETMARGINLEFT</b><br />
|
||||
<b id="SCI_SETMARGINRIGHT">SCI_SETMARGINRIGHT(<unused>, int pixels)</b><br />
|
||||
@ -2928,7 +2934,6 @@ struct Sci_TextToFind {
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</p>
|
||||
<p>
|
||||
<b id="SCI_ANNOTATIONSETSTYLEOFFSET">SCI_ANNOTATIONSETSTYLEOFFSET(int style)</b><br />
|
||||
<b id="SCI_ANNOTATIONGETSTYLEOFFSET">SCI_ANNOTATIONGETSTYLEOFFSET</b><br />
|
||||
@ -3199,7 +3204,7 @@ struct Sci_TextToFind {
|
||||
|
||||
<p>There are 4 indentation guide views.
|
||||
SC_IV_NONE turns the feature off but the other 3 states determine how far the guides appear on
|
||||
empty lines.
|
||||
empty lines. </p>
|
||||
<table border="0" summary="Search flags">
|
||||
<tbody>
|
||||
<tr>
|
||||
@ -3227,8 +3232,8 @@ struct Sci_TextToFind {
|
||||
This setting is good for most languages.</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<p><b id="SCI_SETHIGHLIGHTGUIDE">SCI_SETHIGHLIGHTGUIDE(int column)</b><br />
|
||||
<b id="SCI_GETHIGHLIGHTGUIDE">SCI_GETHIGHLIGHTGUIDE</b><br />
|
||||
@ -3445,8 +3450,8 @@ struct Sci_TextToFind {
|
||||
is limited to pixmaps that use one character per pixel with no named colours.
|
||||
The transparent colour may be named 'None'.
|
||||
The data should be null terminated.
|
||||
Pixmaps use the <code>SC_MARK_PIXMAP</code> marker symbol. You can find the full description of
|
||||
the XPM format <a class="jump" href="http://koala.ilog.fr/lehors/xpm.html">here</a>.</p>
|
||||
Pixmaps use the <code>SC_MARK_PIXMAP</code> marker symbol. You can find descriptions of
|
||||
the XPM format <a class="jump" href="http://en.wikipedia.org/wiki/X_PixMap">from here</a>.</p>
|
||||
|
||||
<p><b id="SCI_MARKERSYMBOLDEFINED">SCI_MARKERSYMBOLDEFINED(int markerNumber)</b><br />
|
||||
Returns the symbol defined for a markerNumber with <code>SCI_MARKERDEFINE</code>
|
||||
@ -3631,6 +3636,7 @@ struct Sci_TextToFind {
|
||||
interior more transparent than the border. You can use
|
||||
<a class="message" href="#SCI_INDICSETALPHA">SCI_INDICSETALPHA</a>
|
||||
to control the alpha transparency value. The default alpha value is 30.
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -3640,8 +3646,7 @@ struct Sci_TextToFind {
|
||||
<code>SCI_INDICSETSTYLE(1, INDIC_TT);</code><br />
|
||||
<code>SCI_INDICSETSTYLE(2, INDIC_PLAIN);</code></p>
|
||||
|
||||
<p><b id="SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int <a class="jump"
|
||||
href="#colour">colour</a>)</b><br />
|
||||
<p><b id="SCI_INDICSETFORE">SCI_INDICSETFORE(int indicatorNumber, int <a class="jump" href="#colour">colour</a>)</b><br />
|
||||
<b id="SCI_INDICGETFORE">SCI_INDICGETFORE(int indicatorNumber)</b><br />
|
||||
These two messages set and get the colour used to draw an indicator. The default indicator
|
||||
colours are equivalent to:<br />
|
||||
@ -3662,7 +3667,7 @@ struct Sci_TextToFind {
|
||||
Drawing under text works only for modern indicators when <a class="message" href="#SCI_SETTWOPHASEDRAW">two phase drawing</a>
|
||||
is enabled.</p>
|
||||
|
||||
<h3 id="Modern Indicators">Modern Indicators</h3>
|
||||
<h3 id="ModernIndicators">Modern Indicators</h3>
|
||||
|
||||
<p>Modern indicators are stored in a format similar to run length encoding which is efficient in both
|
||||
speed and storage for sparse information.</p>
|
||||
@ -3708,7 +3713,7 @@ struct Sci_TextToFind {
|
||||
Can be used to iterate through the document to discover all the indicator positions.
|
||||
</p>
|
||||
|
||||
<h3 id="Style Byte Indicators">Style Byte Indicators (deprecated)</h3>
|
||||
<h3 id="StyleByteIndicators">Style Byte Indicators (deprecated)</h3>
|
||||
<p>By default, Scintilla organizes the style byte associated with each text byte as 5 bits of
|
||||
style information (for 32 styles) and 3 bits of indicator information for 3 independent
|
||||
indicators so that, for example, syntax errors, deprecated names and bad indentation could all
|
||||
@ -3806,8 +3811,7 @@ struct Sci_TextToFind {
|
||||
and <a class="message"
|
||||
href="#SCI_AUTOCGETSEPARATOR"><code>SCI_AUTOCGETSEPARATOR</code></a>.</p>
|
||||
|
||||
<p>The list of words should be in sorted order. If set to ignore case mode with <a
|
||||
class="message" href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>, then
|
||||
<p>The list of words should be in sorted order. If set to ignore case mode with <a class="message" href="#SCI_AUTOCSETIGNORECASE"><code>SCI_AUTOCSETIGNORECASE</code></a>, then
|
||||
strings are matched after being converted to upper case. One result of this is that the list
|
||||
should be sorted with the punctuation characters '[', '\', ']', '^', '_', and '`' sorted after
|
||||
letters.</p>
|
||||
@ -3858,7 +3862,7 @@ struct Sci_TextToFind {
|
||||
<a class="message" href="#SCN_AUTOCSELECTION"><code>SCN_AUTOCSELECTION</code></a> notification
|
||||
is used instead.</p>
|
||||
|
||||
<p></p>The value is copied to the <code>text</code> buffer, returning the length (not including the
|
||||
<p>The value is copied to the <code>text</code> buffer, returning the length (not including the
|
||||
terminating 0). If not found, an empty string is copied to the buffer and 0 is returned.</p>
|
||||
|
||||
<p>If the value argument is 0 then the length that should be allocated to store the value is
|
||||
@ -3866,7 +3870,7 @@ struct Sci_TextToFind {
|
||||
|
||||
<p><b id="SCI_AUTOCSETCANCELATSTART">SCI_AUTOCSETCANCELATSTART(bool cancel)</b><br />
|
||||
<b id="SCI_AUTOCGETCANCELATSTART">SCI_AUTOCGETCANCELATSTART</b><br />
|
||||
The default behavior is for the list to be cancelled if the caret moves before the location it
|
||||
The default behavior is for the list to be cancelled if the caret moves to the location it
|
||||
was at when the list was displayed. By calling this message with a <code>false</code> argument,
|
||||
the list is not cancelled until the caret moves before the first character of the word being
|
||||
completed.</p>
|
||||
@ -4295,6 +4299,8 @@ struct Sci_TextToFind {
|
||||
<tr>
|
||||
<td><code>SCI_SELECTIONDUPLICATE</code></td>
|
||||
|
||||
<td><code>SCI_VERTICALCENTRECARET</code></td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
@ -4699,6 +4705,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
<a class="message" href="#SCI_SETFOLDEXPANDED">SCI_SETFOLDEXPANDED(int line, bool
|
||||
expanded)</a><br />
|
||||
<a class="message" href="#SCI_GETFOLDEXPANDED">SCI_GETFOLDEXPANDED(int line)</a><br />
|
||||
<a class="message" href="#SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</a><br />
|
||||
<a class="message" href="#SCI_TOGGLEFOLD">SCI_TOGGLEFOLD(int line)</a><br />
|
||||
<a class="message" href="#SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</a><br />
|
||||
<a class="message" href="#SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int
|
||||
@ -4849,6 +4856,13 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
until you had finished. See <code>SciTEBase::FoldAll()</code> and
|
||||
<code>SciTEBase::Expand()</code> for examples of the use of these messages.</p>
|
||||
|
||||
<p><b id="SCI_CONTRACTEDFOLDNEXT">SCI_CONTRACTEDFOLDNEXT(int lineStart)</b><br />
|
||||
Search efficiently for lines that are contracted fold headers.
|
||||
This is useful when saving the user's folding when switching documents or saving folding with a file.
|
||||
The search starts at line number <code>lineStart</code> and continues forwards to the end of the file.
|
||||
<code>lineStart</code> is returned if it is a contracted fold header otherwise the next contracted
|
||||
fold header is returned. If there are no more contracted fold headers then -1 is returned.</p>
|
||||
|
||||
<p><b id="SCI_ENSUREVISIBLE">SCI_ENSUREVISIBLE(int line)</b><br />
|
||||
<b id="SCI_ENSUREVISIBLEENFORCEPOLICY">SCI_ENSUREVISIBLEENFORCEPOLICY(int line)</b><br />
|
||||
A line may be hidden because more than one of its parent lines is contracted. Both these
|
||||
@ -4922,7 +4936,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
<b id="SCI_GETWRAPVISUALFLAGS">SCI_GETWRAPVISUALFLAGS</b><br />
|
||||
You can enable the drawing of visual flags to indicate a line is wrapped. Bits set in
|
||||
wrapVisualFlags determine which visual flags are drawn.
|
||||
|
||||
</p>
|
||||
<table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags">
|
||||
<tbody>
|
||||
<tr>
|
||||
@ -4959,6 +4973,7 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
<b id="SCI_GETWRAPVISUALFLAGSLOCATION">SCI_GETWRAPVISUALFLAGSLOCATION</b><br />
|
||||
You can set whether the visual flags to indicate a line is wrapped are drawn near the border or near the text.
|
||||
Bits set in wrapVisualFlagsLocation set the location to near the text for the corresponding visual flag.
|
||||
</p>
|
||||
|
||||
<table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
|
||||
<tbody>
|
||||
@ -4989,13 +5004,13 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<p><b id="SCI_SETWRAPINDENTMODE">SCI_SETWRAPINDENTMODE(int indentMode)</b><br />
|
||||
<b id="SCI_GETWRAPINDENTMODE">SCI_GETWRAPINDENTMODE</b><br />
|
||||
Wrapped sublines can be indented to the position of their first subline or one more indent level.
|
||||
The default is <code>SC_WRAPINDENT_FIXED</code>.
|
||||
The modes are:
|
||||
</p>
|
||||
|
||||
<table cellpadding="1" cellspacing="2" border="0" summary="Wrap visual flags locations">
|
||||
<tbody>
|
||||
@ -5027,7 +5042,6 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<p><b id="SCI_SETWRAPSTARTINDENT">SCI_SETWRAPSTARTINDENT(int indent)</b><br />
|
||||
<b id="SCI_GETWRAPSTARTINDENT">SCI_GETWRAPSTARTINDENT</b><br />
|
||||
@ -5089,7 +5103,6 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</p>
|
||||
|
||||
<p><b id="SCI_SETPOSITIONCACHE">SCI_SETPOSITIONCACHE(int size)</b><br />
|
||||
<b id="SCI_GETPOSITIONCACHE">SCI_GETPOSITIONCACHE</b><br />
|
||||
@ -5401,17 +5414,17 @@ sptr_t CallScintilla(unsigned int iMessage, uptr_t wParam, sptr_t lParam){
|
||||
<h4>ILexer</h4>
|
||||
|
||||
<div class="highlighted">
|
||||
<span class="S5">class</span><span class="S0"> </span>ILexer<span class="S0"> </span><span class="S10">{</span><br>
|
||||
<span class="S5">public</span><span class="S10">:</span><br>
|
||||
<span class="S5">class</span><span class="S0"> </span>ILexer<span class="S0"> </span><span class="S10">{</span><br />
|
||||
<span class="S5">public</span><span class="S10">:</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
|
||||
<span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>Release<span class="S10">()</span><span class="S0"> </span>
|
||||
<span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>
|
||||
<span class="S5">const</span><span class="S0"> </span>
|
||||
<span class="S5">char</span><span class="S0"> </span>
|
||||
@ -5430,7 +5443,7 @@ SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span>
|
||||
<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
|
||||
<span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>val<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>
|
||||
<span class="S5">const</span><span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>
|
||||
<span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0"> </span>DescribeWordListSets<span class="S10">()</span>
|
||||
@ -5443,7 +5456,7 @@ SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span>
|
||||
<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
|
||||
<span class="S5">char</span><span class="S0"> </span><span class="S10">*</span>wl<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>Lex<span class="S10">(</span><span class="S5">unsigned</span>
|
||||
@ -5455,7 +5468,7 @@ SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span>
|
||||
<span class="S0"> </span>IDocument<span class="S0">
|
||||
</span><span class="S10">*</span>pAccess<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
|
||||
<span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>Fold<span class="S10">(</span><span class="S5">unsigned</span>
|
||||
@ -5466,7 +5479,7 @@ SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span>
|
||||
<span class="S0"> </span>IDocument<span class="S0">
|
||||
</span><span class="S10">*</span>pAccess<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
|
||||
<span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>
|
||||
<span class="S10">*</span><span class="S0"> </span>SCI_METHOD<span class="S0">
|
||||
@ -5474,8 +5487,8 @@ SCI_METHOD<span class="S0"> </span>PropertyNames<span class="S10">()</span>
|
||||
<span class="S0"> </span>operation<span class="S10">,</span><span class="S0">
|
||||
</span><span class="S5">void</span><span class="S0"> </span>
|
||||
<span class="S10">*</span>pointer<span class="S10">)</span><span class="S0"> </span>
|
||||
<span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S10">};</span><br>
|
||||
<span class="S10">=</span><span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S10">};</span><br />
|
||||
</div>
|
||||
|
||||
<p>
|
||||
@ -5501,24 +5514,24 @@ invoked with the <code>SCI_PRIVATELEXERCALL</code> API.</p>
|
||||
|
||||
<div class="highlighted">
|
||||
<span class="S5">class</span><span class="S0"> </span>IDocument
|
||||
<span class="S0"> </span><span class="S10">{</span><br>
|
||||
<span class="S5">public</span><span class="S10">:</span><br>
|
||||
<span class="S0"> </span><span class="S10">{</span><br />
|
||||
<span class="S5">public</span><span class="S10">:</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>Version<span class="S10">()</span><span class="S0"> </span>
|
||||
<span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>SetErrorStatus<span class="S10">(</span><span class="S5">int</span>
|
||||
<span class="S0"> </span>status<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
|
||||
<span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>Length<span class="S10">()</span><span class="S0"> </span>
|
||||
<span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>GetCharRange<span class="S10">(</span><span class="S5">char</span>
|
||||
@ -5528,64 +5541,64 @@ position<span class="S10">,</span><span class="S0"> </span>
|
||||
<span class="S5">int</span><span class="S0"> </span>lengthRetrieve<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S5">const</span>
|
||||
<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
|
||||
<span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>StyleAt<span class="S10">(</span><span class="S5">int</span>
|
||||
<span class="S0"> </span>position<span class="S10">)</span><span class="S0"> </span>
|
||||
<span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>LineFromPosition<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>position<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>
|
||||
<span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>LineStart<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>
|
||||
<span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>GetLevel<span class="S10">(</span><span class="S5">int</span><span class="S0"> </span>line<span class="S10">)</span>
|
||||
<span class="S0"> </span>
|
||||
<span class="S5">const</span><span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
|
||||
<span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span>
|
||||
<span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>SetLevel<span class="S10">(</span><span class="S5">int</span>
|
||||
<span class="S0"> </span>line<span class="S10">,</span><span class="S0"> </span>
|
||||
<span class="S5">int</span><span class="S0"> </span>level<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
|
||||
<span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>GetLineState<span class="S10">(</span><span class="S5">int</span>
|
||||
<span class="S0"> </span>line<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span>
|
||||
<span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
|
||||
<span class="S10">;</span><br>
|
||||
<span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>SetLineState<span class="S10">(</span><span class="S5">int</span>
|
||||
<span class="S0"> </span>line<span class="S10">,</span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>state<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>StartStyling<span class="S10">(</span><span class="S5">int</span>
|
||||
<span class="S0"> </span>position<span class="S10">,</span>
|
||||
<span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>mask<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
|
||||
<span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>SetStyleFor<span class="S10">(</span><span class="S5">int</span>
|
||||
<span class="S0"> </span>length<span class="S10">,</span>
|
||||
<span class="S0"> </span><span class="S5">char</span><span class="S0"> </span>style<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
|
||||
<span class="S10">;</span><br>
|
||||
<span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">bool</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>SetStyles<span class="S10">(</span><span class="S5">int</span>
|
||||
@ -5593,13 +5606,13 @@ position<span class="S10">,</span><span class="S0"> </span>
|
||||
<span class="S5">const</span><span class="S0"> </span><span class="S5">char</span>
|
||||
<span class="S0"> </span><span class="S10">*</span>styles<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span><span class="S0"> </span>
|
||||
<span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">void</span>
|
||||
<span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>DecorationSetCurrentIndicator<span class="S10">(</span><span class="S5">int</span>
|
||||
<span class="S0"> </span>indicator<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>DecorationFillRange<span class="S10">(</span><span class="S5">int</span>
|
||||
@ -5608,27 +5621,27 @@ position<span class="S10">,</span><span class="S0"> </span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>fillLength<span class="S10">)</span>
|
||||
<span class="S0">
|
||||
</span><span class="S10">=</span><span class="S0"> </span>
|
||||
<span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">void</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>ChangeLexerState<span class="S10">(</span><span class="S5">int</span>
|
||||
<span class="S0"> </span>start<span class="S10">,</span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>end<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span>
|
||||
<span class="S0"> </span><span class="S5">int</span><span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>CodePage<span class="S10">()</span><span class="S0">
|
||||
</span><span class="S5">const</span><span class="S0"> </span>
|
||||
<span class="S10">=</span><span class="S0"> </span><span class="S4">0</span>
|
||||
<span class="S10">;</span><br>
|
||||
<span class="S10">;</span><br />
|
||||
<span class="S0"> </span><span class="S5">virtual</span><span class="S0"> </span><span class="S5">bool</span>
|
||||
<span class="S0"> </span>SCI_METHOD
|
||||
<span class="S0"> </span>IsDBCSLeadByte<span class="S10">(</span><span class="S5">char</span>
|
||||
<span class="S0"> </span>ch<span class="S10">)</span>
|
||||
<span class="S0"> </span><span class="S5">const</span><span class="S0"> </span><span class="S10">=</span>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br>
|
||||
<span class="S10">};</span><br>
|
||||
<span class="S0"> </span><span class="S4">0</span><span class="S10">;</span><br />
|
||||
<span class="S10">};</span><br />
|
||||
</div>
|
||||
|
||||
<p>Scintilla tries to minimize the consequences of modifying text to
|
||||
@ -5668,9 +5681,10 @@ struct SCNotification {
|
||||
int position;
|
||||
// SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_DWELLSTART,
|
||||
// SCN_DWELLEND, SCN_CALLTIPCLICK,
|
||||
// SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK
|
||||
// SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK
|
||||
int ch; // SCN_CHARADDED, SCN_KEY
|
||||
int modifiers; // SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK
|
||||
int modifiers;
|
||||
// SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK
|
||||
int modificationType; // SCN_MODIFIED
|
||||
const char *text; // SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION
|
||||
int length; // SCN_MODIFIED
|
||||
@ -5685,6 +5699,9 @@ struct SCNotification {
|
||||
int listType; // SCN_USERLISTSELECTION, SCN_AUTOCSELECTION
|
||||
int x; // SCN_DWELLSTART, SCN_DWELLEND
|
||||
int y; // SCN_DWELLSTART, SCN_DWELLEND
|
||||
int token; // SCN_MODIFIED with SC_MOD_CONTAINER
|
||||
int annotationLinesAdded; // SC_MOD_CHANGEANNOTATION
|
||||
int updated; // SCN_UPDATEUI
|
||||
};
|
||||
</pre>
|
||||
|
||||
@ -5710,6 +5727,7 @@ struct SCNotification {
|
||||
<a class="message" href="#SCN_ZOOM">SCN_ZOOM</a><br />
|
||||
<a class="message" href="#SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</a><br />
|
||||
<a class="message" href="#SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</a><br />
|
||||
<a class="message" href="#SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</a><br />
|
||||
<a class="message" href="#SCN_INDICATORCLICK">SCN_INDICATORCLICK</a><br />
|
||||
<a class="message" href="#SCN_INDICATORRELEASE">SCN_INDICATORRELEASE</a><br />
|
||||
<a class="message" href="#SCN_CALLTIPCLICK">SCN_CALLTIPCLICK</a><br />
|
||||
@ -5784,13 +5802,59 @@ href="#SCI_POSITIONFROMLINE">SCI_POSITIONFROMLINE</a>(lineNumber);
|
||||
double click and the <code>line</code> field is set to the line of the double click.</p>
|
||||
|
||||
<p><b id="SCN_UPDATEUI">SCN_UPDATEUI</b><br />
|
||||
Either the text or styling of the document has changed or the selection range has changed. Now
|
||||
would be a good time to update any container UI elements that depend on document or view state.
|
||||
This was previously called <code><a class="message"
|
||||
href="#SCN_CHECKBRACE">SCN_CHECKBRACE</a></code> because a common use is to check whether the
|
||||
caret is next to a brace and set highlights on this brace and its corresponding matching brace.
|
||||
This also replaces <a class="message" href="#SCN_POSCHANGED"><code>SCN_POSCHANGED</code></a>,
|
||||
which is now deprecated.</p>
|
||||
Either the text or styling of the document has changed or the selection range or scroll position has changed.
|
||||
Now would be a good time to update any container UI elements that depend on document or view state.
|
||||
The <code>updated</code> field is set to the bit set of things changed since the previous notiication.</p>
|
||||
<table cellpadding="1" cellspacing="2" border="0" summary="Modify notification type flags">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th align="left">Symbol</th>
|
||||
|
||||
<th>Value</th>
|
||||
|
||||
<th align="left">Meaning</th>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
|
||||
<tbody valign="top">
|
||||
<tr>
|
||||
<td align="left"><code>SC_UPDATE_CONTENT</code></td>
|
||||
|
||||
<td align="center">0x01</td>
|
||||
|
||||
<td>Contents, styling or markers have been changed.</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="left"><code>SC_UPDATE_SELECTION</code></td>
|
||||
|
||||
<td align="center">0x02</td>
|
||||
|
||||
<td>Selection has been changed.</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="left"><code>SC_UPDATE_V_SCROLL</code></td>
|
||||
|
||||
<td align="center">0x04</td>
|
||||
|
||||
<td>Scrolled vertically.</td>
|
||||
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td align="left"><code>SC_UPDATE_H_SCROLL</code></td>
|
||||
|
||||
<td align="center">0x08</td>
|
||||
|
||||
<td>Scrolled horizontally.</td>
|
||||
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<p><b id="SCN_MODIFIED">SCN_MODIFIED</b><br />
|
||||
This notification is sent when the text or styling of the document changes or is about to
|
||||
@ -6341,12 +6405,14 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
|
||||
<p>
|
||||
<b id="SCN_HOTSPOTCLICK">SCN_HOTSPOTCLICK</b><br />
|
||||
<b id="SCN_HOTSPOTDOUBLECLICK">SCN_HOTSPOTDOUBLECLICK</b><br />
|
||||
<b id="SCN_HOTSPOTRELEASECLICK">SCN_HOTSPOTRELEASECLICK</b><br />
|
||||
These notifications are generated when the user clicks or double clicks on
|
||||
text that is in a style with the hotspot attribute set.
|
||||
This notification can be used to link to variable definitions or web pages.
|
||||
The <code>position</code> field is set the text position of the click or
|
||||
double click and the <code>modifiers</code> field set to the key modifiers
|
||||
held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.</p>
|
||||
held down in a similar manner to <a class="message" href="#SCN_KEY">SCN_KEY</a>.
|
||||
Only the state of the Ctrl key is reported for <code>SCN_HOTSPOTRELEASECLICK</code>.</p>
|
||||
|
||||
<p>
|
||||
<b id="SCN_INDICATORCLICK">SCN_INDICATORCLICK</b><br />
|
||||
@ -6410,11 +6476,11 @@ for line = lineStart to lineEnd do SCI_ENSUREVISIBLE(line) next
|
||||
<a class="message" href="#scintilla_release_resources">void scintilla_release_resources()</a><br />
|
||||
</code>
|
||||
|
||||
<p><b id="scintilla_new">GtkWidget *scintilla_new()</b></b><br />
|
||||
<p><b id="scintilla_new">GtkWidget *scintilla_new()</b><br />
|
||||
Create a new Scintilla widget. The returned pointer can be added to a container and displayed in the same way as other
|
||||
widgets.</p>
|
||||
|
||||
<p><b id="scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</b></b><br />
|
||||
<p><b id="scintilla_set_id">void scintilla_set_id(ScintillaObject *sci, uptr_t id)</b><br />
|
||||
Set the control ID which will be used in the idFrom field of the NotifyHeader structure of all
|
||||
notifications for this instance. When an application creates multiple Scintilla widgets, this allows
|
||||
the source of each notification to be found. The value should be small, preferrably less than 16 bits,
|
||||
@ -6542,11 +6608,7 @@ EM_SETTARGETDEVICE
|
||||
<code>Scintilla_RegisterClasses</code> called. <code>STATIC_BUILD</code> prevents compiling the
|
||||
<code>DllMain</code> function which will conflict with any <code>DllMain</code> defined in your
|
||||
code. <code>Scintilla_RegisterClasses</code> takes the <code>HINSTANCE</code> of your
|
||||
application and ensures that the "Scintilla" window class is registered. To make sure that the
|
||||
right pointing arrow cursor used in the margin is displayed by Scintilla add the
|
||||
<code>scintilla/win32/Margin.cur</code> file to your application's resources with the ID
|
||||
<code>IDC_MARGIN</code> which is defined in <code>scintilla/win32/platfromRes.h</code> as
|
||||
400.</p>
|
||||
application and ensures that the "Scintilla" window class is registered.</p>
|
||||
|
||||
<h3>Ensuring lexers are linked into Scintilla</h3>
|
||||
|
||||
|
@ -25,9 +25,9 @@
|
||||
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
|
||||
<tr>
|
||||
<td>
|
||||
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla221.zip?download">
|
||||
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla225.zip?download">
|
||||
Windows</a>
|
||||
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla221.tgz?download">
|
||||
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla225.tgz?download">
|
||||
GTK+/Linux</a>
|
||||
</font>
|
||||
</td>
|
||||
@ -41,7 +41,7 @@
|
||||
containing very few restrictions.
|
||||
</p>
|
||||
<h3>
|
||||
Release 2.21
|
||||
Release 2.25
|
||||
</h3>
|
||||
<h4>
|
||||
Source Code
|
||||
@ -49,8 +49,8 @@
|
||||
The source code package contains all of the source code for Scintilla but no binary
|
||||
executable code and is available in
|
||||
<ul>
|
||||
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla221.zip?download">zip format</a> (1160K) commonly used on Windows</li>
|
||||
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla221.tgz?download">tgz format</a> (1080K) commonly used on Linux and compatible operating systems</li>
|
||||
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla225.zip?download">zip format</a> (1200K) commonly used on Windows</li>
|
||||
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla225.tgz?download">tgz format</a> (1080K) commonly used on Linux and compatible operating systems</li>
|
||||
</ul>
|
||||
Instructions for building on both Windows and Linux are included in the readme file.
|
||||
<h4>
|
||||
|
@ -350,6 +350,24 @@
|
||||
<td>Toby Inkster</td>
|
||||
<td>Eric Forgeot</td>
|
||||
<td>Colomban Wendling</td>
|
||||
</tr><tr>
|
||||
<td>Neo</td>
|
||||
<td>Jordan Russell</td>
|
||||
<td>Farshid Lashkari</td>
|
||||
<td>Sam Rawlins</td>
|
||||
</tr><tr>
|
||||
<td>Michael Mullin</td>
|
||||
<td>Carlos SS</td>
|
||||
<td>vim</td>
|
||||
<td>Martial Demolins</td>
|
||||
</tr><tr>
|
||||
<td>Tino Weinkauf</td>
|
||||
<td>Jérôme Laforge</td>
|
||||
<td>Udo Lechner</td>
|
||||
<td>Marco Falda</td>
|
||||
</tr><tr>
|
||||
<td>Dariusz Knociński</td>
|
||||
<td>Ben Fisher</td>
|
||||
</tr>
|
||||
</table>
|
||||
<p>
|
||||
@ -361,6 +379,336 @@
|
||||
Icons</a> Copyright(C) 1998 by Dean S. Jones<br />
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="http://prdownloads.sourceforge.net/scintilla/scite225.zip?download">Release 2.25</a>
|
||||
</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Released 21 March 2011.
|
||||
</li>
|
||||
<li>
|
||||
SparseState class makes it easier to write lexers which have to remember complex state between lines.
|
||||
</li>
|
||||
<li>
|
||||
Visual Studio project (.dsp) files removed. The make files should be used instead as described in the README.
|
||||
</li>
|
||||
<li>
|
||||
Modula 3 lexer added along with SciTE support.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3173374&group_id=2439">Feature #3173374.</a>
|
||||
</li>
|
||||
<li>
|
||||
Asm, Basic, and D lexers add extra folding properties.
|
||||
</li>
|
||||
<li>
|
||||
Raw string literals for C++0x supported in C++ lexer.
|
||||
</li>
|
||||
<li>
|
||||
Triple-quoted strings used in Vala language supported in C++ lexer.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3177601&group_id=2439">Feature #3177601.</a>
|
||||
</li>
|
||||
<li>
|
||||
The errorlist lexer used in SciTE's output pane colours lines that start with '<' as diff deletions.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3172878&group_id=2439">Feature #3172878.</a>
|
||||
</li>
|
||||
<li>
|
||||
The Fortran lexer correctly folds type-bound procedures from Fortran 2003.
|
||||
</li>
|
||||
<li>
|
||||
LPeg lexer support improved in SciTE.
|
||||
</li>
|
||||
<li>
|
||||
SciTE on Windows-64 fixes for menu localisation and Lua scripts.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3204502&group_id=2439">Bug #3204502.</a>
|
||||
</li>
|
||||
<li>
|
||||
SciTE on Windows avoids locking folders when using the open or save dialogs.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=1795484&group_id=2439">Bug #1795484.</a>
|
||||
</li>
|
||||
<li>
|
||||
Diff lexer fixes problem where diffs of diffs producing lines that start with "----".
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3197952&group_id=2439">Bug #3197952.</a>
|
||||
</li>
|
||||
<li>
|
||||
Bug fixed when searching upwards in Chinese code page 936.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3176271&group_id=2439">Bug #3176271.</a>
|
||||
</li>
|
||||
<li>
|
||||
On Cocoa, translucent drawing performed as on other platforms instead of 2.5 times less translucent.
|
||||
</li>
|
||||
<li>
|
||||
Performance issue and potential bug fixed on GTK+ with caret line for long lines.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="http://prdownloads.sourceforge.net/scintilla/scite224.zip?download">Release 2.24</a>
|
||||
</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Released 3 February 2011.
|
||||
</li>
|
||||
<li>
|
||||
Fixed memory leak in GTK+ Cairo code.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3157655&group_id=2439">Feature #3157655.</a>
|
||||
</li>
|
||||
<li>
|
||||
Insert Abbreviation dialog added to SciTE on GTK+.
|
||||
</li>
|
||||
<li>
|
||||
SCN_UPDATEUI notifications received when window scrolled. An 'updated' bit mask indicates which
|
||||
types of update have occurred from SC_UPDATE_SELECTION, SC_UPDATE_CONTENT, SC_UPDATE_H_SCROLL
|
||||
or SC_UPDATE_V_SCROLL.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3125977&group_id=2439">Feature #3125977.</a>
|
||||
</li>
|
||||
<li>
|
||||
On Windows, to ensure reverse arrow cursor matches platform default, it is now generated by
|
||||
reflecting the platform arrow cursor.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3143968&group_id=2439">Feature #3143968.</a>
|
||||
</li>
|
||||
<li>
|
||||
Can choose mouse cursor used in margins.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3161326&group_id=2439">Feature #3161326.</a>
|
||||
</li>
|
||||
<li>
|
||||
On GTK+, SciTE sets a mime type of text/plain in its .desktop file so that it will appear in the shell context menu.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3137126&group_id=2439">Feature #3137126.</a>
|
||||
</li>
|
||||
<li>
|
||||
Bash folder handles here docs.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3118223&group_id=2439">Feature #3118223.</a>
|
||||
</li>
|
||||
<li>
|
||||
C++ folder adds fold.cpp.syntax.based, fold.cpp.comment.multiline, fold.cpp.explicit.start, fold.cpp.explicit.end,
|
||||
and fold.cpp.explicit.anywhere properties to allow more control over folding and choice of explicit fold markers.
|
||||
</li>
|
||||
<li>
|
||||
C++ lexer fixed to always handle single quote strings continued past a line end.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3150522&group_id=2439">Bug #3150522.</a>
|
||||
</li>
|
||||
<li>
|
||||
Ruby folder handles here docs.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3118224&group_id=2439">Feature #3118224.</a>
|
||||
</li>
|
||||
<li>
|
||||
SQL lexer allows '.' to be part of words.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3103129&group_id=2439">Feature #3103129.</a>
|
||||
</li>
|
||||
<li>
|
||||
SQL folder handles case statements in more situations.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3135027&group_id=2439">Feature #3135027.</a>
|
||||
</li>
|
||||
<li>
|
||||
SQL folder adds fold points inside expressions based on bracket structure.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3165488&group_id=2439">Feature #3165488.</a>
|
||||
</li>
|
||||
<li>
|
||||
SQL folder drops fold.sql.exists property as 'exists' is handled automatically.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3164194&group_id=2439">Bug #3164194.</a>
|
||||
</li>
|
||||
<li>
|
||||
SciTE only forwards properties to lexers when they have been explicitly set so the defaults set by lexers are used
|
||||
rather than 0.
|
||||
</li>
|
||||
<li>
|
||||
Mouse double click word selection chooses the word around the character under the mouse rather than
|
||||
the inter-character position under the mouse. This makes double clicking select what the user is pointing
|
||||
at and avoids selecting adjacent non-word characters.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3111174&group_id=2439">Bug #3111174.</a>
|
||||
</li>
|
||||
<li>
|
||||
Fixed mouse double click to always perform word select, not line select.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3143635&group_id=2439">Bug #3143635.</a>
|
||||
</li>
|
||||
<li>
|
||||
Right click cancels autocompletion.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3144531&group_id=2439">Bug #3144531.</a>
|
||||
</li>
|
||||
<li>
|
||||
Fixed multiPaste to work when additionalSelectionTyping off.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3126221&group_id=2439">Bug #3126221.</a>
|
||||
</li>
|
||||
<li>
|
||||
Fixed virtual space problems when text modified at caret.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3154986&group_id=2439">Bug #3154986.</a>
|
||||
</li>
|
||||
<li>
|
||||
Fixed memory leak in lexer object code.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3133672&group_id=2439">Bug #3133672.</a>
|
||||
</li>
|
||||
<li>
|
||||
Fixed SciTE on GTK+ search failure when using regular expression.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3156217&group_id=2439">Bug #3156217.</a>
|
||||
</li>
|
||||
<li>
|
||||
Avoid unnecessary full window redraw for SCI_GOTOPOS.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3146650&group_id=2439">Feature #3146650.</a>
|
||||
</li>
|
||||
<li>
|
||||
Avoid unnecessary redraw when indicator fill range makes no real change.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="http://prdownloads.sourceforge.net/scintilla/scite223.zip?download">Release 2.23</a>
|
||||
</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Released 7 December 2010.
|
||||
</li>
|
||||
<li>
|
||||
On GTK+ version 2.22 and later, drawing is performed with Cairo rather than GDK.
|
||||
This is in preparation for GTK+ 3.0 which will no longer support GDK drawing.
|
||||
The appearance of some elements will be different with Cairo as it is anti-aliased and uses sub-pixel positioning.
|
||||
Cairo may be turned on for GTK+ versions before 2.22 by defining USE_CAIRO although this has not
|
||||
been extensively tested.
|
||||
</li>
|
||||
<li>
|
||||
New lexer a68k for Motorola 68000 assembler.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3101598&group_id=2439">Feature #3101598.</a>
|
||||
</li>
|
||||
<li>
|
||||
Borland C++ is no longer supported for building Scintilla or SciTE on Windows.
|
||||
</li>
|
||||
<li>
|
||||
Performance improved when creating large rectangular selections.
|
||||
</li>
|
||||
<li>
|
||||
PHP folder recognizes #region and #endregion comments.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3101624&group_id=2439">Feature #3101624.</a>
|
||||
</li>
|
||||
<li>
|
||||
SQL lexer has a lexer.sql.numbersign.comment option to turn off use of '#' comments
|
||||
as these are a non-standard feature only available in some implementations.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3098071&group_id=2439">Feature #3098071.</a>
|
||||
</li>
|
||||
<li>
|
||||
SQL folder recognizes case statements and understands the fold.at.else property.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3104091&group_id=2439">Bug #3104091.</a>
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3107362&group_id=2439">Bug #3107362.</a>
|
||||
</li>
|
||||
<li>
|
||||
SQL folder fixes bugs with end statements when fold.sql.only.begin=1.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3104091&group_id=2439">Bug #3104091.</a>
|
||||
</li>
|
||||
<li>
|
||||
SciTE on Windows bug fixed with multi-line tab bar not adjusting correctly when maximizing and demaximizing.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3097517&group_id=2439">Bug #3097517.</a>
|
||||
</li>
|
||||
<li>
|
||||
Crash fixed on GTK+ when Scintilla widget destroyed while it still has an outstanding style idle pending.
|
||||
</li>
|
||||
<li>
|
||||
Bug fixed where searching backwards in DBCS text (code page 936 or similar) failed to find occurrences at the start of the line.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3103936&group_id=2439">Bug #3103936.</a>
|
||||
</li>
|
||||
<li>
|
||||
SciTE on Windows supports Unicode file names when executing help applications with winhelp and htmlhelp subsystems.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="http://prdownloads.sourceforge.net/scintilla/scite222.zip?download">Release 2.22</a>
|
||||
</h3>
|
||||
<ul>
|
||||
<li>
|
||||
Released 27 October 2010.
|
||||
</li>
|
||||
<li>
|
||||
SciTE includes support for integrating with Scintillua which allows lexers to be implemented in Lua as a
|
||||
Parsing Expression Grammar (PEG).
|
||||
</li>
|
||||
<li>
|
||||
Regular expressions allow use of '?' for non-greedy matches or to match 0 or 1 instances of an item.
|
||||
</li>
|
||||
<li>
|
||||
SCI_CONTRACTEDFOLDNEXT added to allow rapid retrieval of folding state.
|
||||
</li>
|
||||
<li>
|
||||
SCN_HOTSPOTRELEASECLICK notification added which is similar to SCN_HOTSPOTCLICK but occurs
|
||||
when the mouse is released.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3082409&group_id=2439">Feature #3082409.</a>
|
||||
</li>
|
||||
<li>
|
||||
Command added for centring current line in window.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3064696&group_id=2439">Feature #3064696.</a>
|
||||
</li>
|
||||
<li>
|
||||
SciTE performance improved by not examining document for line ends when switching buffers and not
|
||||
storing folds when folding turned off.
|
||||
</li>
|
||||
<li>
|
||||
Bug fixed where scrolling to ensure the caret is visible did not take into account all pixels of the line.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3081721&group_id=2439">Bug #3081721.</a>
|
||||
</li>
|
||||
<li>
|
||||
Bug fixed for autocompletion list overlapping text when WS_EX_CLIENTEDGE used.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3079778&group_id=2439">Bug #3079778.</a>
|
||||
</li>
|
||||
<li>
|
||||
After autocompletion, the caret's X is updated.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3079114&group_id=2439">Bug #3079114.</a>
|
||||
</li>
|
||||
<li>
|
||||
On Windows, default to the system caret blink time.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=352439&aid=3079784&group_id=2439">Feature #3079784.</a>
|
||||
</li>
|
||||
<li>
|
||||
PgUp/PgDn fixed to allow virtual space.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3077452&group_id=2439">Bug #3077452.</a>
|
||||
</li>
|
||||
<li>
|
||||
Crash fixed when AddMark and AddMarkSet called with negative argument.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3075074&group_id=2439">Bug #3075074.</a>
|
||||
</li>
|
||||
<li>
|
||||
Dwell notifications fixed so that they do not occur when the mouse is outside Scintilla.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3073481&group_id=2439">Bug #3073481.</a>
|
||||
</li>
|
||||
<li>
|
||||
Bash lexer bug fixed for here docs starting with <<-.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3063822&group_id=2439">Bug #3063822.</a>
|
||||
</li>
|
||||
<li>
|
||||
C++ lexer bug fixed for // comments that are continued onto a second line by a \.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3066031&group_id=2439">Bug #3066031.</a>
|
||||
</li>
|
||||
<li>
|
||||
C++ lexer fixes wrong highlighting for float literals containing +/-.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3058924&group_id=2439">Bug #3058924.</a>
|
||||
</li>
|
||||
<li>
|
||||
JavaScript lexer recognize regexes following return keyword.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3062287&group_id=2439">Bug #3062287.</a>
|
||||
</li>
|
||||
<li>
|
||||
Ruby lexer handles % quoting better and treats range dots as operators in 1..2 and 1...2.
|
||||
Ruby folder handles "if" keyword used as a modifier even when it is separated from the modified statement by an escaped new line.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2093767&group_id=2439">Bug #2093767.</a>
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3058496&group_id=2439">Bug #3058496.</a>
|
||||
</li>
|
||||
<li>
|
||||
Bug fixed where upwards search failed with DBCS code pages.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=3065912&group_id=2439">Bug #3065912.</a>
|
||||
</li>
|
||||
<li>
|
||||
SciTE has a default Lua startup script name distributed in SciTEGlobal.properties.
|
||||
No error message is displayed if this file does not exist.
|
||||
</li>
|
||||
<li>
|
||||
SciTE on Windows tab control height is calculated better.
|
||||
<a href="https://sourceforge.net/tracker/?func=detail&atid=102439&aid=2635702&group_id=2439">Bug #2635702.</a>
|
||||
</li>
|
||||
<li>
|
||||
SciTE on Windows uses better themed check buttons in find and replace strips.
|
||||
</li>
|
||||
<li>
|
||||
SciTE on Windows fixes bug with Find strip appearing along with Incremental Find strip.
|
||||
</li>
|
||||
<li>
|
||||
SciTE setting find.close.on.find added to allow preventing the Find dialog from closing.
|
||||
</li>
|
||||
<li>
|
||||
SciTE on Windows attempts to rerun commands that fail by prepending them with "cmd.exe /c".
|
||||
This allows commands built in to the command processor like "dir" to run.
|
||||
</li>
|
||||
</ul>
|
||||
<h3>
|
||||
<a href="http://prdownloads.sourceforge.net/scintilla/scite221.zip?download">Release 2.21</a>
|
||||
</h3>
|
||||
|
@ -111,6 +111,10 @@
|
||||
<h3>
|
||||
Projects using Scintilla
|
||||
</h3>
|
||||
<p>
|
||||
<a href="http://manoscoder.gr/phpBB3/viewtopic.php?f=25&t=103">Coder's Studio</a>
|
||||
is an IDE for Assembly programming similar to Visual Studio 6.0.
|
||||
</p>
|
||||
<p>
|
||||
<a href="http://www.sparxsystems.com/products/ea/index.html">Enterprise Architect</a>
|
||||
is a UML 2.1 analysis and design tool.
|
||||
|
@ -87,8 +87,7 @@
|
||||
</p>
|
||||
<p>
|
||||
Flow diagrams inside editor similar to
|
||||
<a href="http://www.eng.auburn.edu/grasp/grasp_main.shtml">
|
||||
GRASP</a>.
|
||||
GRASP.
|
||||
</p>
|
||||
<p>
|
||||
A VCL component wrapper around Scintilla so it can be used with Delphi or
|
||||
|
@ -9,7 +9,7 @@
|
||||
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
|
||||
<meta name="Description"
|
||||
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
|
||||
<meta name="Date.Modified" content="20100901" />
|
||||
<meta name="Date.Modified" content="20110321" />
|
||||
<style type="text/css">
|
||||
#versionlist {
|
||||
margin: 0;
|
||||
@ -55,8 +55,8 @@
|
||||
GTK+</font>
|
||||
</td>
|
||||
<td width="40%" align="right">
|
||||
<font color="#FFCC99" size="3"> Release version 2.21<br />
|
||||
Site last modified September 1 2010</font>
|
||||
<font color="#FFCC99" size="3"> Release version 2.25<br />
|
||||
Site last modified March 21 2011</font>
|
||||
</td>
|
||||
<td width="20%">
|
||||
|
||||
@ -65,19 +65,19 @@
|
||||
</table>
|
||||
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
|
||||
<tr>
|
||||
<td width="100%" alt="Sci Break" style="background: url(http://www.scintilla.org/SciBreak.jpg) no-repeat;height:150px;">
|
||||
<td width="100%" style="background: url(http://www.scintilla.org/SciBreak.jpg) no-repeat;height:150px;">
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
<ul id="versionlist">
|
||||
<li>Version 2.25 improves ability of lexers to remember complex state between lines.</li>
|
||||
<li>Version 2.24 fixes a memory leak on GTK+ with Cairo.</li>
|
||||
<li>Version 2.23 uses Cairo for drawing on GTK+ 2.22+ rather than GDK.</li>
|
||||
<li>Version 2.22 fixes bugs and adds minor improvements.</li>
|
||||
<li>Version 2.21 performs much faster for Asian Double Byte Character Sets.</li>
|
||||
<li>Version 2.20 implements lexers as objects so they may retain additional state.
|
||||
The C++ lexer understands the preprocessor enough to grey-out code that is inactive due to conditional compilation.</li>
|
||||
<li>Version 2.12 improves drawing speed and fixes bugs.</li>
|
||||
<li>Version 2.11 fixes compatibility with the C language.</li>
|
||||
<li>Version 2.10 performs case insensitive search and upper and lower casing for non-ASCII characters.
|
||||
Support for version 1.x of GTK+ removed.</li>
|
||||
</ul>
|
||||
<ul id="menu">
|
||||
<li id="remote1"><a href="http://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
|
||||
@ -130,8 +130,8 @@ if (!IsRemote()) { //if NOT remote...
|
||||
</p>
|
||||
<p>
|
||||
Scintilla and SciTE are currently available for Intel Win32 and Linux compatible operating
|
||||
systems with GTK+. They have been run on Windows XP, Windows 7, and on Ubuntu 9.10
|
||||
with GTK+ 2.18. <a href="http://www.scintilla.org/SciTEImage.html">Here is a screenshot of
|
||||
systems with GTK+. They have been run on Windows XP, Windows 7, and on Ubuntu 10.10
|
||||
with GTK+ 2.20. <a href="http://www.scintilla.org/SciTEImage.html">Here is a screenshot of
|
||||
SciTE.</a><br />
|
||||
</p>
|
||||
<p>
|
||||
|
@ -7,6 +7,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <stddef.h>
|
||||
#include <math.h>
|
||||
|
||||
#include <glib.h>
|
||||
#include <gmodule.h>
|
||||
@ -39,6 +40,14 @@
|
||||
#define IS_WIDGET_FOCUSSED(w) (GTK_WIDGET_HAS_FOCUS(w))
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,22,0)
|
||||
#define USE_CAIRO 1
|
||||
#endif
|
||||
|
||||
#ifdef USE_CAIRO
|
||||
#define DISABLE_GDK_FONT 1
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Ignore unreferenced local functions in GTK+ headers
|
||||
#pragma warning(disable: 4505)
|
||||
@ -688,9 +697,14 @@ namespace Scintilla {
|
||||
#endif
|
||||
class SurfaceImpl : public Surface {
|
||||
encodingType et;
|
||||
#ifdef USE_CAIRO
|
||||
cairo_t *context;
|
||||
cairo_surface_t *psurf;
|
||||
#else
|
||||
GdkDrawable *drawable;
|
||||
GdkGC *gc;
|
||||
GdkPixmap *ppixmap;
|
||||
#endif
|
||||
int x;
|
||||
int y;
|
||||
bool inited;
|
||||
@ -806,7 +820,15 @@ void SurfaceImpl::SetConverter(int characterSet_) {
|
||||
}
|
||||
}
|
||||
|
||||
SurfaceImpl::SurfaceImpl() : et(singleByte), drawable(0), gc(0), ppixmap(0),
|
||||
SurfaceImpl::SurfaceImpl() : et(singleByte),
|
||||
#ifdef USE_CAIRO
|
||||
context(0),
|
||||
psurf(0),
|
||||
#else
|
||||
drawable(0),
|
||||
gc(0),
|
||||
ppixmap(0),
|
||||
#endif
|
||||
x(0), y(0), inited(false), createdGC(false)
|
||||
, pcontext(0), layout(0), characterSet(-1) {
|
||||
}
|
||||
@ -817,15 +839,28 @@ SurfaceImpl::~SurfaceImpl() {
|
||||
|
||||
void SurfaceImpl::Release() {
|
||||
et = singleByte;
|
||||
#ifndef USE_CAIRO
|
||||
drawable = 0;
|
||||
#endif
|
||||
if (createdGC) {
|
||||
createdGC = false;
|
||||
#ifdef USE_CAIRO
|
||||
cairo_destroy(context);
|
||||
#else
|
||||
g_object_unref(gc);
|
||||
#endif
|
||||
}
|
||||
#ifdef USE_CAIRO
|
||||
context = 0;
|
||||
if (psurf)
|
||||
cairo_surface_destroy(psurf);
|
||||
psurf = 0;
|
||||
#else
|
||||
gc = 0;
|
||||
if (ppixmap)
|
||||
g_object_unref(ppixmap);
|
||||
ppixmap = 0;
|
||||
#endif
|
||||
if (layout)
|
||||
g_object_unref(layout);
|
||||
layout = 0;
|
||||
@ -847,10 +882,28 @@ bool SurfaceImpl::Initialised() {
|
||||
void SurfaceImpl::Init(WindowID wid) {
|
||||
Release();
|
||||
PLATFORM_ASSERT(wid);
|
||||
#ifdef USE_CAIRO
|
||||
GdkDrawable *drawable_ = GDK_DRAWABLE(PWidget(wid)->window);
|
||||
if (drawable_) {
|
||||
context = gdk_cairo_create(drawable_);
|
||||
PLATFORM_ASSERT(context);
|
||||
} else {
|
||||
// Shouldn't happen with valid window but may when calls made before
|
||||
// window completely allocated and mapped.
|
||||
psurf = cairo_image_surface_create(CAIRO_FORMAT_RGB24, 1, 1);
|
||||
context = cairo_create(psurf);
|
||||
}
|
||||
createdGC = true;
|
||||
pcontext = pango_cairo_create_context(context);
|
||||
PLATFORM_ASSERT(pcontext);
|
||||
layout = pango_cairo_create_layout(context);
|
||||
PLATFORM_ASSERT(layout);
|
||||
#else
|
||||
pcontext = gtk_widget_create_pango_context(PWidget(wid));
|
||||
PLATFORM_ASSERT(pcontext);
|
||||
layout = pango_layout_new(pcontext);
|
||||
PLATFORM_ASSERT(layout);
|
||||
#endif
|
||||
inited = true;
|
||||
}
|
||||
|
||||
@ -859,12 +912,27 @@ void SurfaceImpl::Init(SurfaceID sid, WindowID wid) {
|
||||
GdkDrawable *drawable_ = reinterpret_cast<GdkDrawable *>(sid);
|
||||
Release();
|
||||
PLATFORM_ASSERT(wid);
|
||||
#ifdef USE_CAIRO
|
||||
context = gdk_cairo_create(drawable_);
|
||||
#else
|
||||
gc = gdk_gc_new(drawable_);
|
||||
#endif
|
||||
#ifdef USE_CAIRO
|
||||
pcontext = pango_cairo_create_context(context);
|
||||
PLATFORM_ASSERT(pcontext);
|
||||
layout = pango_cairo_create_layout(context);
|
||||
PLATFORM_ASSERT(layout);
|
||||
#else
|
||||
pcontext = gtk_widget_create_pango_context(PWidget(wid));
|
||||
layout = pango_layout_new(pcontext);
|
||||
drawable = drawable_;
|
||||
gc = gdk_gc_new(drawable_);
|
||||
#endif
|
||||
#ifdef USE_CAIRO
|
||||
cairo_set_line_width(context, 1);
|
||||
#else
|
||||
// Ask for lines that do not paint the last pixel so is like Win32
|
||||
gdk_gc_set_line_attributes(gc, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
|
||||
#endif
|
||||
createdGC = true;
|
||||
inited = true;
|
||||
}
|
||||
@ -873,8 +941,23 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID
|
||||
PLATFORM_ASSERT(surface_);
|
||||
Release();
|
||||
SurfaceImpl *surfImpl = static_cast<SurfaceImpl *>(surface_);
|
||||
PLATFORM_ASSERT(surfImpl->drawable);
|
||||
PLATFORM_ASSERT(wid);
|
||||
#ifdef USE_CAIRO
|
||||
context = cairo_reference(surfImpl->context);
|
||||
#else
|
||||
PLATFORM_ASSERT(surfImpl->drawable);
|
||||
gc = gdk_gc_new(surfImpl->drawable);
|
||||
#endif
|
||||
#ifdef USE_CAIRO
|
||||
pcontext = pango_cairo_create_context(context);
|
||||
PLATFORM_ASSERT(pcontext);
|
||||
layout = pango_cairo_create_layout(context);
|
||||
PLATFORM_ASSERT(layout);
|
||||
if (height > 0 && width > 0)
|
||||
psurf = gdk_window_create_similar_surface(
|
||||
gtk_widget_get_window(PWidget(wid)),
|
||||
CAIRO_CONTENT_COLOR_ALPHA, width, height);
|
||||
#else
|
||||
pcontext = gtk_widget_create_pango_context(PWidget(wid));
|
||||
PLATFORM_ASSERT(pcontext);
|
||||
layout = pango_layout_new(pcontext);
|
||||
@ -882,19 +965,42 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID
|
||||
if (height > 0 && width > 0)
|
||||
ppixmap = gdk_pixmap_new(surfImpl->drawable, width, height, -1);
|
||||
drawable = ppixmap;
|
||||
gc = gdk_gc_new(surfImpl->drawable);
|
||||
#endif
|
||||
#ifdef USE_CAIRO
|
||||
cairo_destroy(context);
|
||||
context = cairo_create(psurf);
|
||||
cairo_rectangle(context, 0, 0, width, height);
|
||||
cairo_set_source_rgb(context, 1.0, 0, 0);
|
||||
cairo_fill(context);
|
||||
// This produces sharp drawing more similar to GDK:
|
||||
//cairo_set_antialias(context, CAIRO_ANTIALIAS_NONE);
|
||||
#endif
|
||||
#ifdef USE_CAIRO
|
||||
cairo_set_line_width(context, 1);
|
||||
#else
|
||||
// Ask for lines that do not paint the last pixel so is like Win32
|
||||
gdk_gc_set_line_attributes(gc, 0, GDK_LINE_SOLID, GDK_CAP_NOT_LAST, GDK_JOIN_MITER);
|
||||
#endif
|
||||
createdGC = true;
|
||||
inited = true;
|
||||
}
|
||||
|
||||
void SurfaceImpl::PenColour(ColourAllocated fore) {
|
||||
#ifdef USE_CAIRO
|
||||
if (context) {
|
||||
ColourDesired cdFore(fore.AsLong());
|
||||
cairo_set_source_rgb(context,
|
||||
cdFore.GetBlue() / 255.0,
|
||||
cdFore.GetGreen() / 255.0,
|
||||
cdFore.GetRed() / 255.0);
|
||||
}
|
||||
#else
|
||||
if (gc) {
|
||||
GdkColor co;
|
||||
co.pixel = fore.AsLong();
|
||||
gdk_gc_set_foreground(gc, &co);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
int SurfaceImpl::LogPixelsY() {
|
||||
@ -911,18 +1017,71 @@ void SurfaceImpl::MoveTo(int x_, int y_) {
|
||||
y = y_;
|
||||
}
|
||||
|
||||
#ifdef USE_CAIRO
|
||||
static int Delta(int difference) {
|
||||
if (difference < 0)
|
||||
return -1;
|
||||
else if (difference > 0)
|
||||
return 1;
|
||||
else
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
void SurfaceImpl::LineTo(int x_, int y_) {
|
||||
#ifdef USE_CAIRO
|
||||
// cairo_line_to draws the end position, unlike Win32 or GDK with GDK_CAP_NOT_LAST.
|
||||
// For simple cases, move back one pixel from end.
|
||||
if (context) {
|
||||
int xDiff = x_ - x;
|
||||
int xDelta = Delta(xDiff);
|
||||
int yDiff = y_ - y;
|
||||
int yDelta = Delta(yDiff);
|
||||
if ((xDiff == 0) || (yDiff == 0)) {
|
||||
// Horizontal or vertical lines can be more precisely drawn as a filled rectangle
|
||||
int xEnd = x_ - xDelta;
|
||||
int left = Platform::Minimum(x, xEnd);
|
||||
int width = abs(x - xEnd) + 1;
|
||||
int yEnd = y_ - yDelta;
|
||||
int top = Platform::Minimum(y, yEnd);
|
||||
int height = abs(y - yEnd) + 1;
|
||||
cairo_rectangle(context, left, top, width, height);
|
||||
cairo_fill(context);
|
||||
} else if ((abs(xDiff) == abs(yDiff))) {
|
||||
// 45 degree slope
|
||||
cairo_move_to(context, x + 0.5, y + 0.5);
|
||||
cairo_line_to(context, x_ + 0.5 - xDelta, y_ + 0.5 - yDelta);
|
||||
} else {
|
||||
// Line has a different slope so difficult to avoid last pixel
|
||||
cairo_move_to(context, x + 0.5, y + 0.5);
|
||||
cairo_line_to(context, x_ + 0.5, y_ + 0.5);
|
||||
}
|
||||
cairo_stroke(context);
|
||||
}
|
||||
#else
|
||||
if (drawable && gc) {
|
||||
gdk_draw_line(drawable, gc,
|
||||
x, y,
|
||||
x_, y_);
|
||||
}
|
||||
#endif
|
||||
x = x_;
|
||||
y = y_;
|
||||
}
|
||||
|
||||
void SurfaceImpl::Polygon(Point *pts, int npts, ColourAllocated fore,
|
||||
ColourAllocated back) {
|
||||
#ifdef USE_CAIRO
|
||||
PenColour(back);
|
||||
cairo_move_to(context, pts[0].x + 0.5, pts[0].y + 0.5);
|
||||
for (int i = 1;i < npts;i++) {
|
||||
cairo_line_to(context, pts[i].x + 0.5, pts[i].y + 0.5);
|
||||
}
|
||||
cairo_close_path(context);
|
||||
cairo_fill_preserve(context);
|
||||
PenColour(fore);
|
||||
cairo_stroke(context);
|
||||
#else
|
||||
GdkPoint gpts[20];
|
||||
if (npts < static_cast<int>((sizeof(gpts) / sizeof(gpts[0])))) {
|
||||
for (int i = 0;i < npts;i++) {
|
||||
@ -934,35 +1093,62 @@ void SurfaceImpl::Polygon(Point *pts, int npts, ColourAllocated fore,
|
||||
PenColour(fore);
|
||||
gdk_draw_polygon(drawable, gc, 0, gpts, npts);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SurfaceImpl::RectangleDraw(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
|
||||
#ifdef USE_CAIRO
|
||||
if (context) {
|
||||
#else
|
||||
if (gc && drawable) {
|
||||
#endif
|
||||
#ifdef USE_CAIRO
|
||||
cairo_rectangle(context, rc.left + 0.5, rc.top + 0.5,
|
||||
rc.right - rc.left - 1, rc.bottom - rc.top - 1);
|
||||
PenColour(back);
|
||||
cairo_fill_preserve(context);
|
||||
PenColour(fore);
|
||||
cairo_stroke(context);
|
||||
#else
|
||||
PenColour(back);
|
||||
gdk_draw_rectangle(drawable, gc, 1,
|
||||
rc.left + 1, rc.top + 1,
|
||||
rc.right - rc.left - 2, rc.bottom - rc.top - 2);
|
||||
|
||||
PenColour(fore);
|
||||
// The subtraction of 1 off the width and height here shouldn't be needed but
|
||||
// otherwise a different rectangle is drawn than would be done if the fill parameter == 1
|
||||
gdk_draw_rectangle(drawable, gc, 0,
|
||||
rc.left, rc.top,
|
||||
rc.right - rc.left - 1, rc.bottom - rc.top - 1);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
void SurfaceImpl::FillRectangle(PRectangle rc, ColourAllocated back) {
|
||||
PenColour(back);
|
||||
#ifdef USE_CAIRO
|
||||
if (context && (rc.left < maxCoordinate)) { // Protect against out of range
|
||||
cairo_rectangle(context, rc.left, rc.top,
|
||||
rc.right - rc.left, rc.bottom - rc.top);
|
||||
cairo_fill(context);
|
||||
}
|
||||
#else
|
||||
if (drawable && (rc.left < maxCoordinate)) { // Protect against out of range
|
||||
gdk_draw_rectangle(drawable, gc, 1,
|
||||
rc.left, rc.top,
|
||||
rc.right - rc.left, rc.bottom - rc.top);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) {
|
||||
if (static_cast<SurfaceImpl &>(surfacePattern).drawable) {
|
||||
SurfaceImpl &surfi = static_cast<SurfaceImpl &>(surfacePattern);
|
||||
#ifdef USE_CAIRO
|
||||
bool canDraw = surfi.psurf;
|
||||
#else
|
||||
bool canDraw = surfi.drawable;
|
||||
#endif
|
||||
if (canDraw) {
|
||||
// Tile pattern over rectangle
|
||||
// Currently assumes 8x8 pattern
|
||||
int widthPat = 8;
|
||||
@ -971,12 +1157,18 @@ void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) {
|
||||
int widthx = (xTile + widthPat > rc.right) ? rc.right - xTile : widthPat;
|
||||
for (int yTile = rc.top; yTile < rc.bottom; yTile += heightPat) {
|
||||
int heighty = (yTile + heightPat > rc.bottom) ? rc.bottom - yTile : heightPat;
|
||||
#ifdef USE_CAIRO
|
||||
cairo_set_source_surface(context, surfi.psurf, xTile, yTile);
|
||||
cairo_rectangle(context, xTile, yTile, widthx, heighty);
|
||||
cairo_fill(context);
|
||||
#else
|
||||
gdk_draw_drawable(drawable,
|
||||
gc,
|
||||
static_cast<SurfaceImpl &>(surfacePattern).drawable,
|
||||
0, 0,
|
||||
xTile, yTile,
|
||||
widthx, heighty);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
} else {
|
||||
@ -1005,6 +1197,21 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourAllocated fore, ColourAl
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef USE_CAIRO
|
||||
|
||||
static void PathRoundRectangle(cairo_t *context, double left, double top, double width, double height, int radius) {
|
||||
double degrees = M_PI / 180.0;
|
||||
|
||||
cairo_new_sub_path(context);
|
||||
cairo_arc(context, left + width - radius, top + radius, radius, -90 * degrees, 0 * degrees);
|
||||
cairo_arc(context, left + width - radius, top + height - radius, radius, 0 * degrees, 90 * degrees);
|
||||
cairo_arc(context, left + radius, top + height - radius, radius, 90 * degrees, 180 * degrees);
|
||||
cairo_arc(context, left + radius, top + radius, radius, 180 * degrees, 270 * degrees);
|
||||
cairo_close_path(context);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
// Plot a point into a guint32 buffer symetrically to all 4 qudrants
|
||||
static void AllFour(guint32 *pixels, int stride, int width, int height, int x, int y, guint32 val) {
|
||||
pixels[y*stride+x] = val;
|
||||
@ -1013,18 +1220,6 @@ static void AllFour(guint32 *pixels, int stride, int width, int height, int x, i
|
||||
pixels[(height-1-y)*stride+width-1-x] = val;
|
||||
}
|
||||
|
||||
static unsigned int GetRValue(unsigned int co) {
|
||||
return (co >> 16) & 0xff;
|
||||
}
|
||||
|
||||
static unsigned int GetGValue(unsigned int co) {
|
||||
return (co >> 8) & 0xff;
|
||||
}
|
||||
|
||||
static unsigned int GetBValue(unsigned int co) {
|
||||
return co & 0xff;
|
||||
}
|
||||
|
||||
static guint32 u32FromRGBA(guint8 r, guint8 g, guint8 b, guint8 a) {
|
||||
union {
|
||||
guint8 pixVal[4];
|
||||
@ -1037,8 +1232,41 @@ static guint32 u32FromRGBA(guint8 r, guint8 g, guint8 b, guint8 a) {
|
||||
return converter.val;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
static unsigned int GetRValue(unsigned int co) {
|
||||
return (co >> 16) & 0xff;
|
||||
}
|
||||
|
||||
static unsigned int GetGValue(unsigned int co) {
|
||||
return (co >> 8) & 0xff;
|
||||
}
|
||||
|
||||
static unsigned int GetBValue(unsigned int co) {
|
||||
return co & 0xff;
|
||||
}
|
||||
|
||||
void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated fill, int alphaFill,
|
||||
ColourAllocated outline, int alphaOutline, int flags) {
|
||||
#ifdef USE_CAIRO
|
||||
if (context && rc.Width() > 0) {
|
||||
cairo_set_source_rgba(context,
|
||||
GetRValue(fill.AsLong()) / 255.0,
|
||||
GetGValue(fill.AsLong()) / 255.0,
|
||||
GetBValue(fill.AsLong()) / 255.0,
|
||||
alphaFill / 255.0);
|
||||
PathRoundRectangle(context, rc.left + 1.0, rc.top+1.0, rc.right - rc.left - 2.0, rc.bottom - rc.top - 2.0, cornerSize);
|
||||
cairo_fill(context);
|
||||
|
||||
cairo_set_source_rgba(context,
|
||||
GetRValue(outline.AsLong()) / 255.0,
|
||||
GetGValue(outline.AsLong()) / 255.0,
|
||||
GetBValue(outline.AsLong()) / 255.0,
|
||||
alphaOutline / 255.0);
|
||||
PathRoundRectangle(context, rc.left +0.5, rc.top+0.5, rc.right - rc.left - 1, rc.bottom - rc.top - 1, cornerSize);
|
||||
cairo_stroke(context);
|
||||
}
|
||||
#else
|
||||
if (gc && drawable && rc.Width() > 0) {
|
||||
int width = rc.Width();
|
||||
int height = rc.Height();
|
||||
@ -1078,10 +1306,18 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourAllocated
|
||||
|
||||
g_object_unref(pixalpha);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated back) {
|
||||
PenColour(back);
|
||||
#ifdef USE_CAIRO
|
||||
cairo_arc(context, (rc.left + rc.right) / 2 + 0.5, (rc.top + rc.bottom) / 2 + 0.5,
|
||||
Platform::Minimum(rc.Width(), rc.Height()) / 2, 0, 2*M_PI);
|
||||
cairo_fill_preserve(context);
|
||||
PenColour(fore);
|
||||
cairo_stroke(context);
|
||||
#else
|
||||
gdk_draw_arc(drawable, gc, 1,
|
||||
rc.left + 1, rc.top + 1,
|
||||
rc.right - rc.left - 2, rc.bottom - rc.top - 2,
|
||||
@ -1093,16 +1329,30 @@ void SurfaceImpl::Ellipse(PRectangle rc, ColourAllocated fore, ColourAllocated b
|
||||
rc.left, rc.top,
|
||||
rc.right - rc.left - 1, rc.bottom - rc.top - 1,
|
||||
0, 32767);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) {
|
||||
if (static_cast<SurfaceImpl &>(surfaceSource).drawable) {
|
||||
SurfaceImpl &surfi = static_cast<SurfaceImpl &>(surfaceSource);
|
||||
#ifdef USE_CAIRO
|
||||
bool canDraw = surfi.psurf;
|
||||
#else
|
||||
bool canDraw = surfi.drawable;
|
||||
#endif
|
||||
if (canDraw) {
|
||||
#ifdef USE_CAIRO
|
||||
cairo_set_source_surface(context, surfi.psurf,
|
||||
rc.left - from.x, rc.top - from.y);
|
||||
cairo_rectangle(context, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);
|
||||
cairo_fill(context);
|
||||
#else
|
||||
gdk_draw_drawable(drawable,
|
||||
gc,
|
||||
static_cast<SurfaceImpl &>(surfaceSource).drawable,
|
||||
from.x, from.y,
|
||||
rc.left, rc.top,
|
||||
rc.right - rc.left, rc.bottom - rc.top);
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
@ -1232,7 +1482,11 @@ const int maxLengthTextRun = 10000;
|
||||
void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char *s, int len,
|
||||
ColourAllocated fore) {
|
||||
PenColour(fore);
|
||||
#ifdef USE_CAIRO
|
||||
if (context) {
|
||||
#else
|
||||
if (gc && drawable) {
|
||||
#endif
|
||||
int xText = rc.left;
|
||||
if (PFont(font_)->pfd) {
|
||||
char *utfForm = 0;
|
||||
@ -1256,12 +1510,20 @@ void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, int ybase, const char
|
||||
pango_layout_set_text(layout, utfForm, len);
|
||||
}
|
||||
pango_layout_set_font_description(layout, PFont(font_)->pfd);
|
||||
#ifdef USE_CAIRO
|
||||
pango_cairo_update_layout(context, layout);
|
||||
#endif
|
||||
#ifdef PANGO_VERSION
|
||||
PangoLayoutLine *pll = pango_layout_get_line_readonly(layout,0);
|
||||
#else
|
||||
PangoLayoutLine *pll = pango_layout_get_line(layout,0);
|
||||
#endif
|
||||
#ifdef USE_CAIRO
|
||||
cairo_move_to(context, xText, ybase);
|
||||
pango_cairo_show_layout_line(context, pll);
|
||||
#else
|
||||
gdk_draw_layout_line(drawable, gc, xText, ybase, pll);
|
||||
#endif
|
||||
if (useGFree) {
|
||||
g_free(utfForm);
|
||||
} else {
|
||||
@ -1717,9 +1979,14 @@ int SurfaceImpl::SetPalette(Palette *, bool) {
|
||||
}
|
||||
|
||||
void SurfaceImpl::SetClip(PRectangle rc) {
|
||||
#ifdef USE_CAIRO
|
||||
cairo_rectangle(context, rc.left, rc.top, rc.right, rc.bottom);
|
||||
cairo_clip(context);
|
||||
#else
|
||||
GdkRectangle area = {rc.left, rc.top,
|
||||
rc.right - rc.left, rc.bottom - rc.top};
|
||||
gdk_gc_set_clip_rectangle(gc, &area);
|
||||
#endif
|
||||
}
|
||||
|
||||
void SurfaceImpl::FlushCachedState() {}
|
||||
@ -1875,7 +2142,6 @@ void Window::SetTitle(const char *s) {
|
||||
gdk window coordinates */
|
||||
PRectangle Window::GetMonitorRect(Point pt) {
|
||||
gint x_offset, y_offset;
|
||||
pt = pt;
|
||||
|
||||
gdk_window_get_origin(PWidget(wid)->window, &x_offset, &y_offset);
|
||||
|
||||
@ -1894,6 +2160,7 @@ PRectangle Window::GetMonitorRect(Point pt) {
|
||||
return PRectangle(rect.x, rect.y, rect.x + rect.width, rect.y + rect.height);
|
||||
}
|
||||
#else
|
||||
pt = pt;
|
||||
return PRectangle(-x_offset, -y_offset, (-x_offset) + gdk_screen_width(),
|
||||
(-y_offset) + gdk_screen_height());
|
||||
#endif
|
||||
@ -1936,7 +2203,7 @@ public:
|
||||
CallBackAction doubleClickAction;
|
||||
void *doubleClickActionData;
|
||||
|
||||
ListBoxX() : list(0), pixhash(NULL), pixbuf_renderer(0),
|
||||
ListBoxX() : list(0), scroller(0), pixhash(NULL), pixbuf_renderer(0),
|
||||
desiredVisibleRows(5), maxItemCharacters(0),
|
||||
aveCharWidth(1), doubleClickAction(NULL), doubleClickActionData(NULL) {
|
||||
}
|
||||
|
@ -75,6 +75,10 @@
|
||||
#define IS_WIDGET_VISIBLE(w) (GTK_WIDGET_VISIBLE(w))
|
||||
#endif
|
||||
|
||||
#if GTK_CHECK_VERSION(2,22,0)
|
||||
#define USE_CAIRO 1
|
||||
#endif
|
||||
|
||||
#ifdef _MSC_VER
|
||||
// Constant conditional expressions are because of GTK+ headers
|
||||
#pragma warning(disable: 4127)
|
||||
@ -363,11 +367,16 @@ ScintillaGTK::ScintillaGTK(_ScintillaObject *sci_) :
|
||||
}
|
||||
|
||||
ScintillaGTK::~ScintillaGTK() {
|
||||
g_idle_remove_by_data(this);
|
||||
}
|
||||
|
||||
void ScintillaGTK::RealizeThis(GtkWidget *widget) {
|
||||
//Platform::DebugPrintf("ScintillaGTK::realize this\n");
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
gtk_widget_set_realized(widget, TRUE);
|
||||
#else
|
||||
GTK_WIDGET_SET_FLAGS(widget, GTK_REALIZED);
|
||||
#endif
|
||||
GdkWindowAttr attrs;
|
||||
attrs.window_type = GDK_WINDOW_CHILD;
|
||||
attrs.x = widget->allocation.x;
|
||||
@ -423,7 +432,11 @@ void ScintillaGTK::UnRealizeThis(GtkWidget *widget) {
|
||||
if (IS_WIDGET_MAPPED(widget)) {
|
||||
gtk_widget_unmap(widget);
|
||||
}
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
gtk_widget_set_realized(widget, FALSE);
|
||||
#else
|
||||
GTK_WIDGET_UNSET_FLAGS(widget, GTK_REALIZED);
|
||||
#endif
|
||||
gtk_widget_unrealize(PWidget(wText));
|
||||
gtk_widget_unrealize(PWidget(scrollbarv));
|
||||
gtk_widget_unrealize(PWidget(scrollbarh));
|
||||
@ -456,7 +469,11 @@ static void MapWidget(GtkWidget *widget) {
|
||||
void ScintillaGTK::MapThis() {
|
||||
try {
|
||||
//Platform::DebugPrintf("ScintillaGTK::map this\n");
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
gtk_widget_set_mapped(PWidget(wMain), TRUE);
|
||||
#else
|
||||
GTK_WIDGET_SET_FLAGS(PWidget(wMain), GTK_MAPPED);
|
||||
#endif
|
||||
MapWidget(PWidget(wText));
|
||||
MapWidget(PWidget(scrollbarh));
|
||||
MapWidget(PWidget(scrollbarv));
|
||||
@ -478,7 +495,11 @@ void ScintillaGTK::Map(GtkWidget *widget) {
|
||||
void ScintillaGTK::UnMapThis() {
|
||||
try {
|
||||
//Platform::DebugPrintf("ScintillaGTK::unmap this\n");
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
gtk_widget_set_mapped(PWidget(wMain), FALSE);
|
||||
#else
|
||||
GTK_WIDGET_UNSET_FLAGS(PWidget(wMain), GTK_MAPPED);
|
||||
#endif
|
||||
DropGraphics();
|
||||
gdk_window_hide(PWidget(wMain)->window);
|
||||
gtk_widget_unmap(PWidget(wText));
|
||||
@ -514,7 +535,6 @@ void ScintillaGTK::MainForAll(GtkContainer *container, gboolean include_internal
|
||||
|
||||
gint ScintillaGTK::FocusInThis(GtkWidget *widget) {
|
||||
try {
|
||||
GTK_WIDGET_SET_FLAGS(widget, GTK_HAS_FOCUS);
|
||||
SetFocusState(true);
|
||||
if (im_context != NULL) {
|
||||
gchar *str = NULL;
|
||||
@ -545,7 +565,6 @@ gint ScintillaGTK::FocusIn(GtkWidget *widget, GdkEventFocus * /*event*/) {
|
||||
|
||||
gint ScintillaGTK::FocusOutThis(GtkWidget *widget) {
|
||||
try {
|
||||
GTK_WIDGET_UNSET_FLAGS(widget, GTK_HAS_FOCUS);
|
||||
SetFocusState(false);
|
||||
|
||||
if (PWidget(wPreedit) != NULL)
|
||||
@ -596,8 +615,13 @@ void ScintillaGTK::Initialise() {
|
||||
parentClass = reinterpret_cast<GtkWidgetClass *>(
|
||||
g_type_class_ref(gtk_container_get_type()));
|
||||
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
gtk_widget_set_can_focus(PWidget(wMain), TRUE);
|
||||
gtk_widget_set_sensitive(PWidget(wMain), TRUE);
|
||||
#else
|
||||
GTK_WIDGET_SET_FLAGS(PWidget(wMain), GTK_CAN_FOCUS);
|
||||
GTK_WIDGET_SET_FLAGS(GTK_WIDGET(PWidget(wMain)), GTK_SENSITIVE);
|
||||
#endif
|
||||
gtk_widget_set_events(PWidget(wMain),
|
||||
GDK_EXPOSURE_MASK
|
||||
| GDK_STRUCTURE_MASK
|
||||
@ -622,7 +646,11 @@ void ScintillaGTK::Initialise() {
|
||||
gtk_widget_set_size_request(widtxt, 100, 100);
|
||||
adjustmentv = gtk_adjustment_new(0.0, 0.0, 201.0, 1.0, 20.0, 20.0);
|
||||
scrollbarv = gtk_vscrollbar_new(GTK_ADJUSTMENT(adjustmentv));
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
gtk_widget_set_can_focus(PWidget(scrollbarv), FALSE);
|
||||
#else
|
||||
GTK_WIDGET_UNSET_FLAGS(PWidget(scrollbarv), GTK_CAN_FOCUS);
|
||||
#endif
|
||||
g_signal_connect(G_OBJECT(adjustmentv), "value_changed",
|
||||
G_CALLBACK(ScrollSignal), this);
|
||||
gtk_widget_set_parent(PWidget(scrollbarv), PWidget(wMain));
|
||||
@ -630,7 +658,11 @@ void ScintillaGTK::Initialise() {
|
||||
|
||||
adjustmenth = gtk_adjustment_new(0.0, 0.0, 101.0, 1.0, 20.0, 20.0);
|
||||
scrollbarh = gtk_hscrollbar_new(GTK_ADJUSTMENT(adjustmenth));
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
gtk_widget_set_can_focus(PWidget(scrollbarh), FALSE);
|
||||
#else
|
||||
GTK_WIDGET_UNSET_FLAGS(PWidget(scrollbarh), GTK_CAN_FOCUS);
|
||||
#endif
|
||||
g_signal_connect(G_OBJECT(adjustmenth), "value_changed",
|
||||
G_CALLBACK(ScrollHSignal), this);
|
||||
gtk_widget_set_parent(PWidget(scrollbarh), PWidget(wMain));
|
||||
@ -1392,7 +1424,7 @@ void ScintillaGTK::ReceivedSelection(GtkSelectionData *selection_data) {
|
||||
|
||||
UndoGroup ug(pdoc);
|
||||
if (selection_data->selection != GDK_SELECTION_PRIMARY) {
|
||||
ClearSelection();
|
||||
ClearSelection(multiPasteMode == SC_MULTIPASTE_EACH);
|
||||
}
|
||||
SelectionPosition selStart = sel.IsRectangular() ?
|
||||
sel.Rectangular().Start() :
|
||||
@ -1953,6 +1985,7 @@ gboolean ScintillaGTK::ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose)
|
||||
PangoLayout *layout = gtk_widget_create_pango_layout(PWidget(wText), str);
|
||||
pango_layout_set_attributes(layout, attrs);
|
||||
|
||||
#ifndef USE_CAIRO
|
||||
GdkGC *gc = gdk_gc_new(widget->window);
|
||||
GdkColor color[2] = { {0, 0x0000, 0x0000, 0x0000},
|
||||
{0, 0xffff, 0xffff, 0xffff}
|
||||
@ -1967,8 +2000,8 @@ gboolean ScintillaGTK::ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose)
|
||||
gdk_gc_set_foreground(gc, color);
|
||||
gdk_gc_set_background(gc, color + 1);
|
||||
gdk_draw_layout(widget->window, gc, 0, 0, layout);
|
||||
|
||||
g_object_unref(gc);
|
||||
#endif
|
||||
g_free(str);
|
||||
pango_attr_list_unref(attrs);
|
||||
g_object_unref(layout);
|
||||
@ -2524,7 +2557,11 @@ static void scintilla_class_init(ScintillaClass *klass) {
|
||||
|
||||
static void scintilla_init(ScintillaObject *sci) {
|
||||
try {
|
||||
#if GTK_CHECK_VERSION(2,20,0)
|
||||
gtk_widget_set_can_focus(GTK_WIDGET(sci), TRUE);
|
||||
#else
|
||||
GTK_WIDGET_SET_FLAGS(sci, GTK_CAN_FOCUS);
|
||||
#endif
|
||||
sci->pscin = new ScintillaGTK(sci);
|
||||
} catch (...) {
|
||||
}
|
||||
|
@ -17,13 +17,21 @@ endif
|
||||
AR = ar
|
||||
RANLIB = touch
|
||||
|
||||
# Environment variable windir always defined on Win32
|
||||
|
||||
ifndef windir
|
||||
ifeq ($(shell uname),Darwin)
|
||||
RANLIB = ranlib
|
||||
endif
|
||||
endif
|
||||
|
||||
ifdef windir
|
||||
DEL = del /q
|
||||
COMPLIB=..\bin\scintilla.a
|
||||
else
|
||||
DEL = rm -f
|
||||
COMPLIB=../bin/scintilla.a
|
||||
endif
|
||||
|
||||
vpath %.h ../src ../include ../lexlib
|
||||
vpath %.cxx ../src ../lexlib ../lexers
|
||||
@ -57,7 +65,7 @@ LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx))))
|
||||
all: $(COMPLIB)
|
||||
|
||||
clean:
|
||||
rm -f *.o $(COMPLIB)
|
||||
$(DEL) *.o $(COMPLIB)
|
||||
|
||||
deps:
|
||||
$(CC) -MM $(CONFIGFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak
|
||||
|
@ -1,3 +1,4 @@
|
||||
#!/usr/bin/env python
|
||||
# HFacer.py - regenerate the Scintilla.h and SciLexer.h files from the Scintilla.iface interface
|
||||
# definition file.
|
||||
# The header files are copied to a temporary file apart from the section between a /* ++Autogenerated*/
|
||||
|
@ -255,8 +255,8 @@ class Palette {
|
||||
int allocatedLen;
|
||||
#endif
|
||||
// Private so Palette objects can not be copied
|
||||
Palette(const Palette &) {}
|
||||
Palette &operator=(const Palette &) { return *this; }
|
||||
Palette(const Palette &);
|
||||
Palette &operator=(const Palette &);
|
||||
public:
|
||||
#if PLAT_WIN
|
||||
void *hpal;
|
||||
@ -288,8 +288,8 @@ protected:
|
||||
int ascent;
|
||||
#endif
|
||||
// Private so Font objects can not be copied
|
||||
Font(const Font &) {}
|
||||
Font &operator=(const Font &) { fid=0; return *this; }
|
||||
Font(const Font &);
|
||||
Font &operator=(const Font &);
|
||||
public:
|
||||
Font();
|
||||
virtual ~Font();
|
||||
|
@ -112,6 +112,8 @@
|
||||
#define SCLEX_SML 97
|
||||
#define SCLEX_MARKDOWN 98
|
||||
#define SCLEX_TXT2TAGS 99
|
||||
#define SCLEX_A68K 100
|
||||
#define SCLEX_MODULA 101
|
||||
#define SCLEX_SEARCHRESULT 150
|
||||
#define SCLEX_OBJC 151
|
||||
#define SCLEX_USER 152
|
||||
@ -163,6 +165,8 @@
|
||||
#define SCE_C_COMMENTDOCKEYWORD 17
|
||||
#define SCE_C_COMMENTDOCKEYWORDERROR 18
|
||||
#define SCE_C_GLOBALCLASS 19
|
||||
#define SCE_C_STRINGRAW 20
|
||||
#define SCE_C_TRIPLEVERBATIM 21
|
||||
#define SCE_D_DEFAULT 0
|
||||
#define SCE_D_COMMENT 1
|
||||
#define SCE_D_COMMENTLINE 2
|
||||
@ -639,6 +643,7 @@
|
||||
#define SCE_ASM_CHARACTER 12
|
||||
#define SCE_ASM_STRINGEOL 13
|
||||
#define SCE_ASM_EXTINSTRUCTION 14
|
||||
#define SCE_ASM_COMMENTDIRECTIVE 15
|
||||
#define SCE_F_DEFAULT 0
|
||||
#define SCE_F_COMMENT 1
|
||||
#define SCE_F_NUMBER 2
|
||||
@ -1453,6 +1458,43 @@
|
||||
#define SCE_TXT2TAGS_OPTION 23
|
||||
#define SCE_TXT2TAGS_PREPROC 24
|
||||
#define SCE_TXT2TAGS_POSTPROC 25
|
||||
#define SCE_A68K_DEFAULT 0
|
||||
#define SCE_A68K_COMMENT 1
|
||||
#define SCE_A68K_NUMBER_DEC 2
|
||||
#define SCE_A68K_NUMBER_BIN 3
|
||||
#define SCE_A68K_NUMBER_HEX 4
|
||||
#define SCE_A68K_STRING1 5
|
||||
#define SCE_A68K_OPERATOR 6
|
||||
#define SCE_A68K_CPUINSTRUCTION 7
|
||||
#define SCE_A68K_EXTINSTRUCTION 8
|
||||
#define SCE_A68K_REGISTER 9
|
||||
#define SCE_A68K_DIRECTIVE 10
|
||||
#define SCE_A68K_MACRO_ARG 11
|
||||
#define SCE_A68K_LABEL 12
|
||||
#define SCE_A68K_STRING2 13
|
||||
#define SCE_A68K_IDENTIFIER 14
|
||||
#define SCE_A68K_MACRO_DECLARATION 15
|
||||
#define SCE_A68K_COMMENT_WORD 16
|
||||
#define SCE_A68K_COMMENT_SPECIAL 17
|
||||
#define SCE_A68K_COMMENT_DOXYGEN 18
|
||||
#define SCE_MODULA_DEFAULT 0
|
||||
#define SCE_MODULA_COMMENT 1
|
||||
#define SCE_MODULA_DOXYCOMM 2
|
||||
#define SCE_MODULA_DOXYKEY 3
|
||||
#define SCE_MODULA_KEYWORD 4
|
||||
#define SCE_MODULA_RESERVED 5
|
||||
#define SCE_MODULA_NUMBER 6
|
||||
#define SCE_MODULA_BASENUM 7
|
||||
#define SCE_MODULA_FLOAT 8
|
||||
#define SCE_MODULA_STRING 9
|
||||
#define SCE_MODULA_STRSPEC 10
|
||||
#define SCE_MODULA_CHAR 11
|
||||
#define SCE_MODULA_CHARSPEC 12
|
||||
#define SCE_MODULA_PROC 13
|
||||
#define SCE_MODULA_PRAGMA 14
|
||||
#define SCE_MODULA_PRGKEY 15
|
||||
#define SCE_MODULA_OPERATOR 16
|
||||
#define SCE_MODULA_BADSTR 17
|
||||
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
|
||||
|
||||
#endif
|
||||
|
@ -159,6 +159,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_GETMARGINMASKN 2245
|
||||
#define SCI_SETMARGINSENSITIVEN 2246
|
||||
#define SCI_GETMARGINSENSITIVEN 2247
|
||||
#define SCI_SETMARGINCURSORN 2248
|
||||
#define SCI_GETMARGINCURSORN 2249
|
||||
#define STYLE_DEFAULT 32
|
||||
#define STYLE_LINENUMBER 33
|
||||
#define STYLE_BRACELIGHT 34
|
||||
@ -592,7 +594,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_SETMOUSEDOWNCAPTURES 2384
|
||||
#define SCI_GETMOUSEDOWNCAPTURES 2385
|
||||
#define SC_CURSORNORMAL -1
|
||||
#define SC_CURSORARROW 2
|
||||
#define SC_CURSORWAIT 4
|
||||
#define SC_CURSORREVERSEARROW 7
|
||||
#define SCI_SETCURSOR 2386
|
||||
#define SCI_GETCURSOR 2387
|
||||
#define SCI_SETCONTROLCHARSYMBOL 2388
|
||||
@ -788,6 +792,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCI_ROTATESELECTION 2606
|
||||
#define SCI_SWAPMAINANCHORCARET 2607
|
||||
#define SCI_CHANGELEXERSTATE 2617
|
||||
#define SCI_CONTRACTEDFOLDNEXT 2618
|
||||
#define SCI_VERTICALCENTRECARET 2619
|
||||
#define SCI_STARTRECORD 3001
|
||||
#define SCI_STOPRECORD 3002
|
||||
#define SCI_SETLEXER 4001
|
||||
@ -833,6 +839,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SC_MOD_LEXERSTATE 0x80000
|
||||
#define SC_MODEVENTMASKALL 0xFFFFF
|
||||
#define SC_SEARCHRESULT_LINEBUFFERMAXLENGTH 1024
|
||||
#define SC_UPDATE_CONTENT 0x1
|
||||
#define SC_UPDATE_SELECTION 0x2
|
||||
#define SC_UPDATE_V_SCROLL 0x4
|
||||
#define SC_UPDATE_H_SCROLL 0x8
|
||||
#define SCEN_CHANGE 768
|
||||
#define SCEN_SETFOCUS 512
|
||||
#define SCEN_KILLFOCUS 256
|
||||
@ -887,6 +897,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
|
||||
#define SCN_INDICATORRELEASE 2024
|
||||
#define SCN_AUTOCCANCELLED 2025
|
||||
#define SCN_AUTOCCHARDELETED 2026
|
||||
#define SCN_HOTSPOTRELEASECLICK 2027
|
||||
#define SCN_SCROLLED 2080
|
||||
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
|
||||
|
||||
@ -972,6 +983,7 @@ struct SCNotification {
|
||||
int y; /* SCN_DWELLSTART, SCN_DWELLEND */
|
||||
int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
|
||||
int annotationLinesAdded; /* SC_MOD_CHANGEANNOTATION */
|
||||
int updated; /* SCN_UPDATEUI */
|
||||
};
|
||||
|
||||
struct SearchResultMarking {
|
||||
@ -984,6 +996,7 @@ struct SearchResultMarkings {
|
||||
SearchResultMarking *_markings;
|
||||
};
|
||||
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
}
|
||||
#endif
|
||||
|
@ -259,7 +259,7 @@ val SC_MARK_CIRCLEPLUSCONNECTED=19
|
||||
val SC_MARK_CIRCLEMINUS=20
|
||||
val SC_MARK_CIRCLEMINUSCONNECTED=21
|
||||
|
||||
# Invisible mark that only sets the line background color.
|
||||
# Invisible mark that only sets the line background colour.
|
||||
val SC_MARK_BACKGROUND=22
|
||||
val SC_MARK_DOTDOTDOT=23
|
||||
val SC_MARK_ARROWS=24
|
||||
@ -304,7 +304,8 @@ fun void MarkerDeleteAll=2045(int markerNumber,)
|
||||
# Get a bit mask of all the markers set on a line.
|
||||
fun int MarkerGet=2046(int line,)
|
||||
|
||||
# Find the next line after lineStart that includes a marker in mask.
|
||||
# Find the next line at or after lineStart that includes a marker in mask.
|
||||
# Return -1 when no more lines.
|
||||
fun int MarkerNext=2047(int lineStart, int markerMask)
|
||||
|
||||
# Find the previous line before lineStart that includes a marker in mask.
|
||||
@ -351,6 +352,12 @@ set void SetMarginSensitiveN=2246(int margin, bool sensitive)
|
||||
# Retrieve the mouse click sensitivity of a margin.
|
||||
get bool GetMarginSensitiveN=2247(int margin,)
|
||||
|
||||
# Set the cursor shown when the mouse is inside a margin.
|
||||
set void SetMarginCursorN=2248(int margin, int cursor)
|
||||
|
||||
# Retrieve the cursor shown in a margin.
|
||||
get int GetMarginCursorN=2249(int margin,)
|
||||
|
||||
# Styles in range 32..38 are predefined for parts of the UI and are not used as normal styles.
|
||||
# Style 39 is for future use.
|
||||
enu StylesCommon=STYLE_
|
||||
@ -1539,7 +1546,9 @@ get bool GetMouseDownCaptures=2385(,)
|
||||
|
||||
enu CursorShape=SC_CURSOR
|
||||
val SC_CURSORNORMAL=-1
|
||||
val SC_CURSORARROW=2
|
||||
val SC_CURSORWAIT=4
|
||||
val SC_CURSORREVERSEARROW=7
|
||||
# Sets the cursor to one of the SC_CURSOR* values.
|
||||
set void SetCursor=2386(int cursorType,)
|
||||
# Get cursor type.
|
||||
@ -2090,6 +2099,13 @@ fun void SwapMainAnchorCaret=2607(,)
|
||||
# there may be a need to redraw.
|
||||
fun int ChangeLexerState=2617(position start, position end)
|
||||
|
||||
# Find the next line at or after lineStart that is a contracted fold header line.
|
||||
# Return -1 when no more lines.
|
||||
fun int ContractedFoldNext=2618(int lineStart,)
|
||||
|
||||
# Centre current line in window.
|
||||
fun void VerticalCentreCaret=2619(,)
|
||||
|
||||
# Start notifying the container of all key presses and commands.
|
||||
fun void StartRecord=3001(,)
|
||||
|
||||
@ -2185,6 +2201,12 @@ val SC_MOD_CONTAINER=0x40000
|
||||
val SC_MOD_LEXERSTATE=0x80000
|
||||
val SC_MODEVENTMASKALL=0xFFFFF
|
||||
|
||||
enu Update=SC_UPDATE_
|
||||
val SC_UPDATE_CONTENT=0x1
|
||||
val SC_UPDATE_SELECTION=0x2
|
||||
val SC_UPDATE_V_SCROLL=0x4
|
||||
val SC_UPDATE_H_SCROLL=0x8
|
||||
|
||||
# For compatibility, these go through the COMMAND notification rather than NOTIFY
|
||||
# and should have had exactly the same values as the EN_* constants.
|
||||
# Unfortunately the SETFOCUS and KILLFOCUS are flipped over from EN_*
|
||||
@ -2327,6 +2349,8 @@ val SCLEX_NIMROD=96
|
||||
val SCLEX_SML=97
|
||||
val SCLEX_MARKDOWN=98
|
||||
val SCLEX_TXT2TAGS=99
|
||||
val SCLEX_A68K=100
|
||||
val SCLEX_MODULA=101
|
||||
|
||||
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
|
||||
# value assigned in sequence from SCLEX_AUTOMATIC+1.
|
||||
@ -2373,6 +2397,8 @@ val SCE_C_WORD2=16
|
||||
val SCE_C_COMMENTDOCKEYWORD=17
|
||||
val SCE_C_COMMENTDOCKEYWORDERROR=18
|
||||
val SCE_C_GLOBALCLASS=19
|
||||
val SCE_C_STRINGRAW=20
|
||||
val SCE_C_TRIPLEVERBATIM=21
|
||||
# Lexical states for SCLEX_D
|
||||
lex D=SCLEX_D SCE_D_
|
||||
val SCE_D_DEFAULT=0
|
||||
@ -2892,6 +2918,7 @@ val SCE_ASM_COMMENTBLOCK=11
|
||||
val SCE_ASM_CHARACTER=12
|
||||
val SCE_ASM_STRINGEOL=13
|
||||
val SCE_ASM_EXTINSTRUCTION=14
|
||||
val SCE_ASM_COMMENTDIRECTIVE=15
|
||||
# Lexical states for SCLEX_FORTRAN
|
||||
lex Fortran=SCLEX_FORTRAN SCE_F_
|
||||
lex F77=SCLEX_F77 SCE_F_
|
||||
@ -3811,6 +3838,47 @@ val SCE_TXT2TAGS_COMMENT=22
|
||||
val SCE_TXT2TAGS_OPTION=23
|
||||
val SCE_TXT2TAGS_PREPROC=24
|
||||
val SCE_TXT2TAGS_POSTPROC=25
|
||||
# Lexical states for SCLEX_A68K
|
||||
lex A68k=SCLEX_A68K SCE_A68K_
|
||||
val SCE_A68K_DEFAULT=0
|
||||
val SCE_A68K_COMMENT=1
|
||||
val SCE_A68K_NUMBER_DEC=2
|
||||
val SCE_A68K_NUMBER_BIN=3
|
||||
val SCE_A68K_NUMBER_HEX=4
|
||||
val SCE_A68K_STRING1=5
|
||||
val SCE_A68K_OPERATOR=6
|
||||
val SCE_A68K_CPUINSTRUCTION=7
|
||||
val SCE_A68K_EXTINSTRUCTION=8
|
||||
val SCE_A68K_REGISTER=9
|
||||
val SCE_A68K_DIRECTIVE=10
|
||||
val SCE_A68K_MACRO_ARG=11
|
||||
val SCE_A68K_LABEL=12
|
||||
val SCE_A68K_STRING2=13
|
||||
val SCE_A68K_IDENTIFIER=14
|
||||
val SCE_A68K_MACRO_DECLARATION=15
|
||||
val SCE_A68K_COMMENT_WORD=16
|
||||
val SCE_A68K_COMMENT_SPECIAL=17
|
||||
val SCE_A68K_COMMENT_DOXYGEN=18
|
||||
# Lexical states for SCLEX_MODULA
|
||||
lex Modula=SCLEX_MODULA SCE_MODULA_
|
||||
val SCE_MODULA_DEFAULT=0
|
||||
val SCE_MODULA_COMMENT=1
|
||||
val SCE_MODULA_DOXYCOMM=2
|
||||
val SCE_MODULA_DOXYKEY=3
|
||||
val SCE_MODULA_KEYWORD=4
|
||||
val SCE_MODULA_RESERVED=5
|
||||
val SCE_MODULA_NUMBER=6
|
||||
val SCE_MODULA_BASENUM=7
|
||||
val SCE_MODULA_FLOAT=8
|
||||
val SCE_MODULA_STRING=9
|
||||
val SCE_MODULA_STRSPEC=10
|
||||
val SCE_MODULA_CHAR=11
|
||||
val SCE_MODULA_CHARSPEC=12
|
||||
val SCE_MODULA_PROC=13
|
||||
val SCE_MODULA_PRAGMA=14
|
||||
val SCE_MODULA_PRGKEY=15
|
||||
val SCE_MODULA_OPERATOR=16
|
||||
val SCE_MODULA_BADSTR=17
|
||||
|
||||
# Events
|
||||
|
||||
@ -3841,6 +3909,7 @@ evt void IndicatorClick=2023(int modifiers, int position)
|
||||
evt void IndicatorRelease=2024(int modifiers, int position)
|
||||
evt void AutoCCancelled=2025(void)
|
||||
evt void AutoCCharDeleted=2026(void)
|
||||
evt void HotSpotReleaseClick=2027(int modifiers, int position)
|
||||
|
||||
cat Deprecated
|
||||
|
||||
|
318
scintilla/lexers/LexA68k.cxx
Normal file
318
scintilla/lexers/LexA68k.cxx
Normal file
@ -0,0 +1,318 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexA68k.cxx
|
||||
** Lexer for Assembler, just for the MASM syntax
|
||||
** Written by Martial Demolins AKA Folco
|
||||
**/
|
||||
// Copyright 2010 Martial Demolins <mdemolins(a)gmail.com>
|
||||
// The License.txt file describes the conditions under which this software
|
||||
// may be distributed.
|
||||
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
|
||||
// Return values for GetOperatorType
|
||||
#define NO_OPERATOR 0
|
||||
#define OPERATOR_1CHAR 1
|
||||
#define OPERATOR_2CHAR 2
|
||||
|
||||
|
||||
/**
|
||||
* IsIdentifierStart
|
||||
*
|
||||
* Return true if the given char is a valid identifier first char
|
||||
*/
|
||||
|
||||
static inline bool IsIdentifierStart (const int ch)
|
||||
{
|
||||
return (isalpha(ch) || (ch == '_') || (ch == '\\'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IsIdentifierChar
|
||||
*
|
||||
* Return true if the given char is a valid identifier char
|
||||
*/
|
||||
|
||||
static inline bool IsIdentifierChar (const int ch)
|
||||
{
|
||||
return (isalnum(ch) || (ch == '_') || (ch == '@') || (ch == ':') || (ch == '.'));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* GetOperatorType
|
||||
*
|
||||
* Return:
|
||||
* NO_OPERATOR if char is not an operator
|
||||
* OPERATOR_1CHAR if the operator is one char long
|
||||
* OPERATOR_2CHAR if the operator is two chars long
|
||||
*/
|
||||
|
||||
static inline int GetOperatorType (const int ch1, const int ch2)
|
||||
{
|
||||
int OpType = NO_OPERATOR;
|
||||
|
||||
if ((ch1 == '+') || (ch1 == '-') || (ch1 == '*') || (ch1 == '/') || (ch1 == '#') ||
|
||||
(ch1 == '(') || (ch1 == ')') || (ch1 == '~') || (ch1 == '&') || (ch1 == '|') || (ch1 == ','))
|
||||
OpType = OPERATOR_1CHAR;
|
||||
|
||||
else if ((ch1 == ch2) && (ch1 == '<' || ch1 == '>'))
|
||||
OpType = OPERATOR_2CHAR;
|
||||
|
||||
return OpType;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IsBin
|
||||
*
|
||||
* Return true if the given char is 0 or 1
|
||||
*/
|
||||
|
||||
static inline bool IsBin (const int ch)
|
||||
{
|
||||
return (ch == '0') || (ch == '1');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* IsDoxygenChar
|
||||
*
|
||||
* Return true if the char may be part of a Doxygen keyword
|
||||
*/
|
||||
|
||||
static inline bool IsDoxygenChar (const int ch)
|
||||
{
|
||||
return isalpha(ch) || (ch == '$') || (ch == '[') || (ch == ']') || (ch == '{') || (ch == '}');
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* ColouriseA68kDoc
|
||||
*
|
||||
* Main function, which colourises a 68k source
|
||||
*/
|
||||
|
||||
static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler)
|
||||
{
|
||||
|
||||
// Get references to keywords lists
|
||||
WordList &cpuInstruction = *keywordlists[0];
|
||||
WordList ®isters = *keywordlists[1];
|
||||
WordList &directive = *keywordlists[2];
|
||||
WordList &extInstruction = *keywordlists[3];
|
||||
WordList &commentSpecial = *keywordlists[4];
|
||||
WordList &doxygenKeyword = *keywordlists[5];
|
||||
|
||||
|
||||
// Instanciate a context for our source
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* Parse the text
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
for ( ; sc.More(); sc.Forward())
|
||||
{
|
||||
char Buffer[100];
|
||||
int OpType;
|
||||
|
||||
// Reset style at beginning of line
|
||||
if (sc.atLineStart)
|
||||
sc.SetState(SCE_A68K_DEFAULT);
|
||||
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* Handle current state if we are not in the "default style"
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
if (sc.state != SCE_A68K_DEFAULT)
|
||||
{
|
||||
// Check if current style continue.
|
||||
// If this case, we loop because there is nothing else to do
|
||||
if (((sc.state == SCE_A68K_NUMBER_DEC) && isdigit(sc.ch)) // Decimal number
|
||||
|| ((sc.state == SCE_A68K_NUMBER_BIN) && IsBin(sc.ch)) // Binary number
|
||||
|| ((sc.state == SCE_A68K_NUMBER_HEX) && isxdigit(sc.ch)) // Hexa number
|
||||
|| ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Arg of macro
|
||||
|| ((sc.state == SCE_A68K_STRING1) && (sc.ch != '\'')) // String single-quoted
|
||||
|| ((sc.state == SCE_A68K_STRING2) && (sc.ch != '\"')) // String double-quoted
|
||||
|| ((sc.state == SCE_A68K_MACRO_ARG) && isdigit(sc.ch)) // Macro argument
|
||||
// Label. ' ' and '\t' are needed to handle macro declarations
|
||||
|| ((sc.state == SCE_A68K_LABEL) && (sc.ch != ':') && (sc.ch != ' ') && (sc.ch != '\t'))
|
||||
|| ((sc.state == SCE_A68K_IDENTIFIER) && (sc.ch < 0x80) && IsIdentifierChar(sc.ch)) // Identifier
|
||||
|| ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && (sc.ch < 0x80) && IsDoxygenChar(sc.ch)) // Doxygen keyword
|
||||
|| ((sc.state == SCE_A68K_COMMENT_WORD) && (sc.ch < 0x80) && isalpha(sc.ch))) // Comment current word
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if some states terminate at the current char:
|
||||
// we must include this char in the current style context
|
||||
else if (((sc.state == SCE_A68K_STRING1) && (sc.ch < 0x80) && (sc.ch == '\'')) // String single-quoted
|
||||
|| ((sc.state == SCE_A68K_STRING2) && (sc.ch < 0x80) && (sc.ch == '\"')) // String double-quoted
|
||||
|| ((sc.state == SCE_A68K_LABEL) && (sc.ch < 0x80) && (sc.ch == ':'))) // Label
|
||||
{
|
||||
sc.ForwardSetState(SCE_A68K_DEFAULT);
|
||||
}
|
||||
|
||||
// Check for special words or Doxygen keywords in comments
|
||||
else if (sc.state == SCE_A68K_COMMENT)
|
||||
{
|
||||
if (sc.ch == '\\') {
|
||||
sc.SetState(SCE_A68K_COMMENT_DOXYGEN);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && isalpha(sc.ch)) {
|
||||
sc.SetState(SCE_A68K_COMMENT_WORD);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for special words in comment
|
||||
else if ((sc.state == SCE_A68K_COMMENT_WORD) && (sc.ch < 0x80) && !isalpha(sc.ch))
|
||||
{
|
||||
sc.GetCurrent(Buffer, sizeof(Buffer));
|
||||
if (commentSpecial.InList(Buffer)) {
|
||||
sc.ChangeState(SCE_A68K_COMMENT_SPECIAL);
|
||||
}
|
||||
else {
|
||||
sc.ChangeState(SCE_A68K_COMMENT);
|
||||
}
|
||||
sc.SetState(SCE_A68K_COMMENT);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check for Doxygen keywords
|
||||
else if ((sc.state == SCE_A68K_COMMENT_DOXYGEN) && (sc.ch < 0x80) && !IsDoxygenChar(sc.ch))
|
||||
{
|
||||
sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context
|
||||
if (!doxygenKeyword.InList(Buffer)) {
|
||||
sc.ChangeState(SCE_A68K_COMMENT);
|
||||
}
|
||||
sc.SetState(SCE_A68K_COMMENT);
|
||||
continue;
|
||||
}
|
||||
|
||||
// Check if we are in the case of a label which terminates without ':'
|
||||
// It should be a macro declaration, not a label
|
||||
else if ((sc.state == SCE_A68K_LABEL) && (sc.ch < 0x80) && ((sc.ch == ' ') || (sc.ch == '\t')))
|
||||
{
|
||||
sc.ChangeState(SCE_A68K_MACRO_DECLARATION);
|
||||
}
|
||||
|
||||
// Check if we are at the end of an identifier
|
||||
// In this case, colourise it if was a keyword.
|
||||
else if ((sc.state == SCE_A68K_IDENTIFIER) && !IsIdentifierChar(sc.ch))
|
||||
{
|
||||
sc.GetCurrentLowered(Buffer, sizeof(Buffer)); // Buffer the string of the current context
|
||||
if (cpuInstruction.InList(Buffer)) { // And check if it belongs to a keyword list
|
||||
sc.ChangeState(SCE_A68K_CPUINSTRUCTION);
|
||||
}
|
||||
else if (extInstruction.InList(Buffer)) {
|
||||
sc.ChangeState(SCE_A68K_EXTINSTRUCTION);
|
||||
}
|
||||
else if (registers.InList(Buffer)) {
|
||||
sc.ChangeState(SCE_A68K_REGISTER);
|
||||
}
|
||||
else if (directive.InList(Buffer)) {
|
||||
sc.ChangeState(SCE_A68K_DIRECTIVE);
|
||||
}
|
||||
}
|
||||
|
||||
// All special contexts are now handled.Come back to default style
|
||||
sc.SetState(SCE_A68K_DEFAULT);
|
||||
}
|
||||
|
||||
|
||||
/************************************************************
|
||||
*
|
||||
* Check if we must enter a new state
|
||||
*
|
||||
************************************************************/
|
||||
|
||||
// Label and macro identifiers start at the beginning of a line
|
||||
// We set both as a label, but if it wasn't one (no ':' at the end),
|
||||
// it will be changed as a macro identifier.
|
||||
if (sc.atLineStart && (sc.ch < 0x80) && IsIdentifierStart(sc.ch)) {
|
||||
sc.SetState(SCE_A68K_LABEL);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == ';')) { // Comment
|
||||
sc.SetState(SCE_A68K_COMMENT);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && isdigit(sc.ch)) { // Decimal numbers haven't prefix
|
||||
sc.SetState(SCE_A68K_NUMBER_DEC);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '%')) { // Binary numbers are prefixed with '%'
|
||||
sc.SetState(SCE_A68K_NUMBER_BIN);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '$')) { // Hexadecimal numbers are prefixed with '$'
|
||||
sc.SetState(SCE_A68K_NUMBER_HEX);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '\'')) { // String (single-quoted)
|
||||
sc.SetState(SCE_A68K_STRING1);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '\"')) { // String (double-quoted)
|
||||
sc.SetState(SCE_A68K_STRING2);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && (sc.ch == '\\') && (isdigit(sc.chNext))) { // Replacement symbols in macro
|
||||
sc.SetState(SCE_A68K_MACRO_ARG);
|
||||
}
|
||||
else if ((sc.ch < 0x80) && IsIdentifierStart(sc.ch)) { // An identifier: constant, label, etc...
|
||||
sc.SetState(SCE_A68K_IDENTIFIER);
|
||||
}
|
||||
else {
|
||||
if (sc.ch < 0x80) {
|
||||
OpType = GetOperatorType(sc.ch, sc.chNext); // Check if current char is an operator
|
||||
if (OpType != NO_OPERATOR) {
|
||||
sc.SetState(SCE_A68K_OPERATOR);
|
||||
if (OpType == OPERATOR_2CHAR) { // Check if the operator is 2 bytes long
|
||||
sc.ForwardSetState(SCE_A68K_OPERATOR); // (>> or <<)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} // End of for()
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
|
||||
// Names of the keyword lists
|
||||
|
||||
static const char * const a68kWordListDesc[] =
|
||||
{
|
||||
"CPU instructions",
|
||||
"Registers",
|
||||
"Directives",
|
||||
"Extended instructions",
|
||||
"Comment special words",
|
||||
"Doxygen keywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmA68k(SCLEX_A68K, ColouriseA68kDoc, "a68k", 0, a68kWordListDesc);
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -61,7 +61,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -4,6 +4,7 @@
|
||||
** Written by The Black Horus
|
||||
** Enhancements and NASM stuff by Kein-Hong Man, 2003-10
|
||||
** SCE_ASM_COMMENTBLOCK and SCE_ASM_CHARACTER are for future GNU as colouring
|
||||
** Converted to lexer object and added further folding features/properties by "Udo Lechner" <dlchnr(at)gmx(dot)net>
|
||||
**/
|
||||
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
@ -15,17 +16,24 @@
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4786)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
#include <set>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
#include "OptionSet.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
@ -54,15 +62,184 @@ static inline bool IsAsmOperator(const int ch) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
static bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_ASM_COMMENTDIRECTIVE || style == SCE_ASM_COMMENTBLOCK;
|
||||
}
|
||||
|
||||
WordList &cpuInstruction = *keywordlists[0];
|
||||
WordList &mathInstruction = *keywordlists[1];
|
||||
WordList ®isters = *keywordlists[2];
|
||||
WordList &directive = *keywordlists[3];
|
||||
WordList &directiveOperand = *keywordlists[4];
|
||||
WordList &extInstruction = *keywordlists[5];
|
||||
static inline int LowerCase(int c) {
|
||||
if (c >= 'A' && c <= 'Z')
|
||||
return 'a' + c - 'A';
|
||||
return c;
|
||||
}
|
||||
|
||||
// An individual named option for use in an OptionSet
|
||||
|
||||
// Options used for LexerAsm
|
||||
struct OptionsAsm {
|
||||
std::string delimiter;
|
||||
bool fold;
|
||||
bool foldSyntaxBased;
|
||||
bool foldCommentMultiline;
|
||||
bool foldCommentExplicit;
|
||||
std::string foldExplicitStart;
|
||||
std::string foldExplicitEnd;
|
||||
bool foldExplicitAnywhere;
|
||||
bool foldCompact;
|
||||
OptionsAsm() {
|
||||
delimiter = "";
|
||||
fold = false;
|
||||
foldSyntaxBased = true;
|
||||
foldCommentMultiline = false;
|
||||
foldCommentExplicit = false;
|
||||
foldExplicitStart = "";
|
||||
foldExplicitEnd = "";
|
||||
foldExplicitAnywhere = false;
|
||||
foldCompact = true;
|
||||
}
|
||||
};
|
||||
|
||||
static const char * const asmWordListDesc[] = {
|
||||
"CPU instructions",
|
||||
"FPU instructions",
|
||||
"Registers",
|
||||
"Directives",
|
||||
"Directive operands",
|
||||
"Extended instructions",
|
||||
"Directives4Foldstart",
|
||||
"Directives4Foldend",
|
||||
0
|
||||
};
|
||||
|
||||
struct OptionSetAsm : public OptionSet<OptionsAsm> {
|
||||
OptionSetAsm() {
|
||||
DefineProperty("lexer.asm.comment.delimiter", &OptionsAsm::delimiter,
|
||||
"Character used for COMMENT directive's delimiter, replacing the standard \"~\".");
|
||||
|
||||
DefineProperty("fold", &OptionsAsm::fold);
|
||||
|
||||
DefineProperty("fold.asm.syntax.based", &OptionsAsm::foldSyntaxBased,
|
||||
"Set this property to 0 to disable syntax based folding.");
|
||||
|
||||
DefineProperty("fold.asm.comment.multiline", &OptionsAsm::foldCommentMultiline,
|
||||
"Set this property to 1 to enable folding multi-line comments.");
|
||||
|
||||
DefineProperty("fold.asm.comment.explicit", &OptionsAsm::foldCommentExplicit,
|
||||
"This option enables folding explicit fold points when using the Asm lexer. "
|
||||
"Explicit fold points allows adding extra folding by placing a ;{ comment at the start and a ;} "
|
||||
"at the end of a section that should fold.");
|
||||
|
||||
DefineProperty("fold.asm.explicit.start", &OptionsAsm::foldExplicitStart,
|
||||
"The string to use for explicit fold start points, replacing the standard ;{.");
|
||||
|
||||
DefineProperty("fold.asm.explicit.end", &OptionsAsm::foldExplicitEnd,
|
||||
"The string to use for explicit fold end points, replacing the standard ;}.");
|
||||
|
||||
DefineProperty("fold.asm.explicit.anywhere", &OptionsAsm::foldExplicitAnywhere,
|
||||
"Set this property to 1 to enable explicit fold points anywhere, not just in line comments.");
|
||||
|
||||
DefineProperty("fold.compact", &OptionsAsm::foldCompact);
|
||||
|
||||
DefineWordListSets(asmWordListDesc);
|
||||
}
|
||||
};
|
||||
|
||||
class LexerAsm : public ILexer {
|
||||
WordList cpuInstruction;
|
||||
WordList mathInstruction;
|
||||
WordList registers;
|
||||
WordList directive;
|
||||
WordList directiveOperand;
|
||||
WordList extInstruction;
|
||||
WordList directives4foldstart;
|
||||
WordList directives4foldend;
|
||||
OptionsAsm options;
|
||||
OptionSetAsm osAsm;
|
||||
public:
|
||||
LexerAsm() {
|
||||
}
|
||||
~LexerAsm() {
|
||||
}
|
||||
void SCI_METHOD Release() {
|
||||
delete this;
|
||||
}
|
||||
int SCI_METHOD Version() const {
|
||||
return lvOriginal;
|
||||
}
|
||||
const char * SCI_METHOD PropertyNames() {
|
||||
return osAsm.PropertyNames();
|
||||
}
|
||||
int SCI_METHOD PropertyType(const char *name) {
|
||||
return osAsm.PropertyType(name);
|
||||
}
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osAsm.DescribeProperty(name);
|
||||
}
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osAsm.DescribeWordListSets();
|
||||
}
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ILexer *LexerFactoryAsm() {
|
||||
return new LexerAsm();
|
||||
}
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) {
|
||||
if (osAsm.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
wordListN = &cpuInstruction;
|
||||
break;
|
||||
case 1:
|
||||
wordListN = &mathInstruction;
|
||||
break;
|
||||
case 2:
|
||||
wordListN = ®isters;
|
||||
break;
|
||||
case 3:
|
||||
wordListN = &directive;
|
||||
break;
|
||||
case 4:
|
||||
wordListN = &directiveOperand;
|
||||
break;
|
||||
case 5:
|
||||
wordListN = &extInstruction;
|
||||
break;
|
||||
case 6:
|
||||
wordListN = &directives4foldstart;
|
||||
break;
|
||||
case 7:
|
||||
wordListN = &directives4foldend;
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
if (*wordListN != wlNew) {
|
||||
wordListN->Set(wl);
|
||||
firstModification = 0;
|
||||
}
|
||||
}
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
// Do not leak onto next line
|
||||
if (initStyle == SCE_ASM_STRINGEOL)
|
||||
@ -96,7 +273,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
if (!IsAsmOperator(sc.ch)) {
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
}else if (sc.state == SCE_ASM_NUMBER) {
|
||||
} else if (sc.state == SCE_ASM_NUMBER) {
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
@ -104,6 +281,7 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
if (!IsAWordChar(sc.ch) ) {
|
||||
char s[100];
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
bool IsDirective = false;
|
||||
|
||||
if (cpuInstruction.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_CPUINSTRUCTION);
|
||||
@ -113,15 +291,32 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
sc.ChangeState(SCE_ASM_REGISTER);
|
||||
} else if (directive.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_DIRECTIVE);
|
||||
IsDirective = true;
|
||||
} else if (directiveOperand.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_DIRECTIVEOPERAND);
|
||||
} else if (extInstruction.InList(s)) {
|
||||
sc.ChangeState(SCE_ASM_EXTINSTRUCTION);
|
||||
}
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
if (IsDirective && !strcmp(s, "comment")) {
|
||||
char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0];
|
||||
while (IsASpaceOrTab(sc.ch) && !sc.atLineEnd) {
|
||||
sc.ForwardSetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
if (sc.ch == delimiter) {
|
||||
sc.SetState(SCE_ASM_COMMENTDIRECTIVE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (sc.state == SCE_ASM_COMMENT ) {
|
||||
} else if (sc.state == SCE_ASM_COMMENTDIRECTIVE) {
|
||||
char delimiter = options.delimiter.empty() ? '~' : options.delimiter.c_str()[0];
|
||||
if (sc.ch == delimiter) {
|
||||
while (!sc.atLineEnd) {
|
||||
sc.Forward();
|
||||
}
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
} else if (sc.state == SCE_ASM_COMMENT ) {
|
||||
if (sc.atLineEnd) {
|
||||
sc.SetState(SCE_ASM_DEFAULT);
|
||||
}
|
||||
@ -170,15 +365,100 @@ static void ColouriseAsmDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static const char * const asmWordListDesc[] = {
|
||||
"CPU instructions",
|
||||
"FPU instructions",
|
||||
"Registers",
|
||||
"Directives",
|
||||
"Directive operands",
|
||||
"Extended instructions",
|
||||
0
|
||||
};
|
||||
// Store both the current line's fold level and the next lines in the
|
||||
// level store to make it easy to pick up with each increment
|
||||
// and to make it possible to fiddle the current level for "else".
|
||||
|
||||
LexerModule lmAsm(SCLEX_ASM, ColouriseAsmDoc, "asm", 0, asmWordListDesc);
|
||||
void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
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 levelNext = levelCurrent;
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
char word[100];
|
||||
int wordlen = 0;
|
||||
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
int stylePrev = style;
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
if (options.foldCommentMultiline && IsStreamCommentStyle(style)) {
|
||||
if (!IsStreamCommentStyle(stylePrev)) {
|
||||
levelNext++;
|
||||
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
|
||||
// Comments don't end at end of line and the next character may be unstyled.
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
if (options.foldCommentExplicit && ((style == SCE_ASM_COMMENT) || options.foldExplicitAnywhere)) {
|
||||
if (userDefinedFoldMarkers) {
|
||||
if (styler.Match(i, options.foldExplicitStart.c_str())) {
|
||||
levelNext++;
|
||||
} else if (styler.Match(i, options.foldExplicitEnd.c_str())) {
|
||||
levelNext--;
|
||||
}
|
||||
} else {
|
||||
if (ch == ';') {
|
||||
if (chNext == '{') {
|
||||
levelNext++;
|
||||
} else if (chNext == '}') {
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options.foldSyntaxBased && (style == SCE_ASM_DIRECTIVE)) {
|
||||
word[wordlen++] = static_cast<char>(LowerCase(ch));
|
||||
if (wordlen == 100) { // prevent overflow
|
||||
word[0] = '\0';
|
||||
wordlen = 1;
|
||||
}
|
||||
if (styleNext != SCE_ASM_DIRECTIVE) { // reading directive ready
|
||||
word[wordlen] = '\0';
|
||||
wordlen = 0;
|
||||
if (directives4foldstart.InList(word)) {
|
||||
levelNext++;
|
||||
} else if (directives4foldend.InList(word)){
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (!IsASpace(ch))
|
||||
visibleChars++;
|
||||
if (atEOL || (i == endPos-1)) {
|
||||
int levelUse = levelCurrent;
|
||||
int lev = levelUse | levelNext << 16;
|
||||
if (visibleChars == 0 && options.foldCompact)
|
||||
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||
if (levelUse < levelNext)
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
if (lev != styler.LevelAt(lineCurrent)) {
|
||||
styler.SetLevel(lineCurrent, lev);
|
||||
}
|
||||
lineCurrent++;
|
||||
levelCurrent = levelNext;
|
||||
if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
|
||||
// There is an empty line at end of file so give it same level and empty
|
||||
styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
|
||||
}
|
||||
visibleChars = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
LexerModule lmAsm(SCLEX_ASM, LexerAsm::LexerFactoryAsm, "asm", asmWordListDesc);
|
||||
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
@ -407,8 +406,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
|
||||
if (s[strlen(s) - 1] == '\r')
|
||||
s[strlen(s) - 1] = '\0';
|
||||
if (strcmp(HereDoc.Delimiter, s) == 0) {
|
||||
if ((prefixws > 0 && HereDoc.Indent) || // indentation rule
|
||||
(prefixws == 0 && !HereDoc.Indent)) {
|
||||
if ((prefixws == 0) || // indentation rule
|
||||
(prefixws > 0 && HereDoc.Indent)) {
|
||||
sc.SetState(SCE_SH_DEFAULT);
|
||||
break;
|
||||
}
|
||||
@ -640,6 +639,14 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
// Here Document folding
|
||||
if (style == SCE_SH_HERE_DELIM) {
|
||||
if (ch == '<' && chNext == '<') {
|
||||
levelCurrent++;
|
||||
}
|
||||
} else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_PL_DEFAULT) {
|
||||
levelCurrent--;
|
||||
}
|
||||
if (atEOL) {
|
||||
int lev = levelPrev;
|
||||
if (visibleChars == 0 && foldCompact)
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexBasic.cxx
|
||||
** Lexer for BlitzBasic and PureBasic.
|
||||
** Converted to lexer object and added further folding features/properties by "Udo Lechner" <dlchnr(at)gmx(dot)net>
|
||||
**/
|
||||
// Copyright 1998-2003 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
@ -21,18 +22,25 @@
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4786)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
#include "OptionSet.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
@ -89,8 +97,213 @@ static int LowerCase(int c)
|
||||
return c;
|
||||
}
|
||||
|
||||
static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler, char comment_char) {
|
||||
static int CheckBlitzFoldPoint(char const *token, int &level) {
|
||||
if (!strcmp(token, "function") ||
|
||||
!strcmp(token, "type")) {
|
||||
level |= SC_FOLDLEVELHEADERFLAG;
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(token, "end function") ||
|
||||
!strcmp(token, "end type")) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int CheckPureFoldPoint(char const *token, int &level) {
|
||||
if (!strcmp(token, "procedure") ||
|
||||
!strcmp(token, "enumeration") ||
|
||||
!strcmp(token, "interface") ||
|
||||
!strcmp(token, "structure")) {
|
||||
level |= SC_FOLDLEVELHEADERFLAG;
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(token, "endprocedure") ||
|
||||
!strcmp(token, "endenumeration") ||
|
||||
!strcmp(token, "endinterface") ||
|
||||
!strcmp(token, "endstructure")) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int CheckFreeFoldPoint(char const *token, int &level) {
|
||||
if (!strcmp(token, "function") ||
|
||||
!strcmp(token, "sub") ||
|
||||
!strcmp(token, "type")) {
|
||||
level |= SC_FOLDLEVELHEADERFLAG;
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(token, "end function") ||
|
||||
!strcmp(token, "end sub") ||
|
||||
!strcmp(token, "end type")) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
// An individual named option for use in an OptionSet
|
||||
|
||||
// Options used for LexerBasic
|
||||
struct OptionsBasic {
|
||||
bool fold;
|
||||
bool foldSyntaxBased;
|
||||
bool foldCommentExplicit;
|
||||
std::string foldExplicitStart;
|
||||
std::string foldExplicitEnd;
|
||||
bool foldExplicitAnywhere;
|
||||
bool foldCompact;
|
||||
OptionsBasic() {
|
||||
fold = false;
|
||||
foldSyntaxBased = true;
|
||||
foldCommentExplicit = false;
|
||||
foldExplicitStart = "";
|
||||
foldExplicitEnd = "";
|
||||
foldExplicitAnywhere = false;
|
||||
foldCompact = true;
|
||||
}
|
||||
};
|
||||
|
||||
static const char * const blitzbasicWordListDesc[] = {
|
||||
"BlitzBasic Keywords",
|
||||
"user1",
|
||||
"user2",
|
||||
"user3",
|
||||
0
|
||||
};
|
||||
|
||||
static const char * const purebasicWordListDesc[] = {
|
||||
"PureBasic Keywords",
|
||||
"PureBasic PreProcessor Keywords",
|
||||
"user defined 1",
|
||||
"user defined 2",
|
||||
0
|
||||
};
|
||||
|
||||
static const char * const freebasicWordListDesc[] = {
|
||||
"FreeBasic Keywords",
|
||||
"FreeBasic PreProcessor Keywords",
|
||||
"user defined 1",
|
||||
"user defined 2",
|
||||
0
|
||||
};
|
||||
|
||||
struct OptionSetBasic : public OptionSet<OptionsBasic> {
|
||||
OptionSetBasic(const char * const wordListDescriptions[]) {
|
||||
DefineProperty("fold", &OptionsBasic::fold);
|
||||
|
||||
DefineProperty("fold.basic.syntax.based", &OptionsBasic::foldSyntaxBased,
|
||||
"Set this property to 0 to disable syntax based folding.");
|
||||
|
||||
DefineProperty("fold.basic.comment.explicit", &OptionsBasic::foldCommentExplicit,
|
||||
"This option enables folding explicit fold points when using the Basic lexer. "
|
||||
"Explicit fold points allows adding extra folding by placing a ;{ (BB/PB) or '{ (FB) comment at the start "
|
||||
"and a ;} (BB/PB) or '} (FB) at the end of a section that should be folded.");
|
||||
|
||||
DefineProperty("fold.basic.explicit.start", &OptionsBasic::foldExplicitStart,
|
||||
"The string to use for explicit fold start points, replacing the standard ;{ (BB/PB) or '{ (FB).");
|
||||
|
||||
DefineProperty("fold.basic.explicit.end", &OptionsBasic::foldExplicitEnd,
|
||||
"The string to use for explicit fold end points, replacing the standard ;} (BB/PB) or '} (FB).");
|
||||
|
||||
DefineProperty("fold.basic.explicit.anywhere", &OptionsBasic::foldExplicitAnywhere,
|
||||
"Set this property to 1 to enable explicit fold points anywhere, not just in line comments.");
|
||||
|
||||
DefineProperty("fold.compact", &OptionsBasic::foldCompact);
|
||||
|
||||
DefineWordListSets(wordListDescriptions);
|
||||
}
|
||||
};
|
||||
|
||||
class LexerBasic : public ILexer {
|
||||
char comment_char;
|
||||
int (*CheckFoldPoint)(char const *, int &);
|
||||
WordList keywordlists[4];
|
||||
OptionsBasic options;
|
||||
OptionSetBasic osBasic;
|
||||
public:
|
||||
LexerBasic(char comment_char_, int (*CheckFoldPoint_)(char const *, int &), const char * const wordListDescriptions[]) :
|
||||
comment_char(comment_char_),
|
||||
CheckFoldPoint(CheckFoldPoint_),
|
||||
osBasic(wordListDescriptions) {
|
||||
}
|
||||
~LexerBasic() {
|
||||
}
|
||||
void SCI_METHOD Release() {
|
||||
delete this;
|
||||
}
|
||||
int SCI_METHOD Version() const {
|
||||
return lvOriginal;
|
||||
}
|
||||
const char * SCI_METHOD PropertyNames() {
|
||||
return osBasic.PropertyNames();
|
||||
}
|
||||
int SCI_METHOD PropertyType(const char *name) {
|
||||
return osBasic.PropertyType(name);
|
||||
}
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osBasic.DescribeProperty(name);
|
||||
}
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osBasic.DescribeWordListSets();
|
||||
}
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
}
|
||||
static ILexer *LexerFactoryBlitzBasic() {
|
||||
return new LexerBasic(';', CheckBlitzFoldPoint, blitzbasicWordListDesc);
|
||||
}
|
||||
static ILexer *LexerFactoryPureBasic() {
|
||||
return new LexerBasic(';', CheckPureFoldPoint, purebasicWordListDesc);
|
||||
}
|
||||
static ILexer *LexerFactoryFreeBasic() {
|
||||
return new LexerBasic('\'', CheckFreeFoldPoint, freebasicWordListDesc );
|
||||
}
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) {
|
||||
if (osBasic.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
wordListN = &keywordlists[0];
|
||||
break;
|
||||
case 1:
|
||||
wordListN = &keywordlists[1];
|
||||
break;
|
||||
case 2:
|
||||
wordListN = &keywordlists[2];
|
||||
break;
|
||||
case 3:
|
||||
wordListN = &keywordlists[3];
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
if (*wordListN != wlNew) {
|
||||
wordListN->Set(wl);
|
||||
firstModification = 0;
|
||||
}
|
||||
}
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
bool wasfirst = true, isfirst = true; // true if first token in a line
|
||||
styler.StartAt(startPos);
|
||||
|
||||
@ -114,7 +327,7 @@ static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle,
|
||||
};
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
for (int i = 0; i < 4; i++) {
|
||||
if (keywordlists[i]->InList(s)) {
|
||||
if (keywordlists[i].InList(s)) {
|
||||
sc.ChangeState(kstates[i]);
|
||||
}
|
||||
}
|
||||
@ -205,66 +418,30 @@ static void ColouriseBasicDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static int CheckBlitzFoldPoint(char const *token, int &level) {
|
||||
if (!strcmp(token, "function") ||
|
||||
!strcmp(token, "type")) {
|
||||
level |= SC_FOLDLEVELHEADERFLAG;
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(token, "end function") ||
|
||||
!strcmp(token, "end type")) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int CheckPureFoldPoint(char const *token, int &level) {
|
||||
if (!strcmp(token, "procedure") ||
|
||||
!strcmp(token, "enumeration") ||
|
||||
!strcmp(token, "interface") ||
|
||||
!strcmp(token, "structure")) {
|
||||
level |= SC_FOLDLEVELHEADERFLAG;
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(token, "endprocedure") ||
|
||||
!strcmp(token, "endenumeration") ||
|
||||
!strcmp(token, "endinterface") ||
|
||||
!strcmp(token, "endstructure")) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initStyle */, IDocument *pAccess) {
|
||||
|
||||
static int CheckFreeFoldPoint(char const *token, int &level) {
|
||||
if (!strcmp(token, "function") ||
|
||||
!strcmp(token, "sub") ||
|
||||
!strcmp(token, "type")) {
|
||||
level |= SC_FOLDLEVELHEADERFLAG;
|
||||
return 1;
|
||||
}
|
||||
if (!strcmp(token, "end function") ||
|
||||
!strcmp(token, "end sub") ||
|
||||
!strcmp(token, "end type")) {
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
static void FoldBasicDoc(unsigned int startPos, int length,
|
||||
Accessor &styler, int (*CheckFoldPoint)(char const *, int &)) {
|
||||
int line = styler.GetLine(startPos);
|
||||
int level = styler.LevelAt(line);
|
||||
int go = 0, done = 0;
|
||||
int endPos = startPos + length;
|
||||
char word[256];
|
||||
int wordlen = 0;
|
||||
int i;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
|
||||
int cNext = styler[startPos];
|
||||
|
||||
// Scan for tokens at the start of the line (they may include
|
||||
// whitespace, for tokens like "End Function"
|
||||
for (i = startPos; i < endPos; i++) {
|
||||
int c = styler.SafeGetCharAt(i);
|
||||
if (!done && !go) {
|
||||
for (int i = startPos; i < endPos; i++) {
|
||||
int c = cNext;
|
||||
cNext = styler.SafeGetCharAt(i + 1);
|
||||
bool atEOL = (c == '\r' && cNext != '\n') || (c == '\n');
|
||||
if (options.foldSyntaxBased && !done && !go) {
|
||||
if (wordlen) { // are we scanning a token already?
|
||||
word[wordlen] = static_cast<char>(LowerCase(c));
|
||||
if (!IsIdentifier(c)) { // done with token
|
||||
@ -294,8 +471,27 @@ static void FoldBasicDoc(unsigned int startPos, int length,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (c == '\n') { // line end
|
||||
if (!done && wordlen == 0 && foldCompact) // line was only space
|
||||
if (options.foldCommentExplicit && ((styler.StyleAt(i) == SCE_B_COMMENT) || options.foldExplicitAnywhere)) {
|
||||
if (userDefinedFoldMarkers) {
|
||||
if (styler.Match(i, options.foldExplicitStart.c_str())) {
|
||||
level |= SC_FOLDLEVELHEADERFLAG;
|
||||
go = 1;
|
||||
} else if (styler.Match(i, options.foldExplicitEnd.c_str())) {
|
||||
go = -1;
|
||||
}
|
||||
} else {
|
||||
if (c == comment_char) {
|
||||
if (cNext == '{') {
|
||||
level |= SC_FOLDLEVELHEADERFLAG;
|
||||
go = 1;
|
||||
} else if (cNext == '}') {
|
||||
go = -1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (atEOL) { // line end
|
||||
if (!done && wordlen == 0 && options.foldCompact) // line was only space
|
||||
level |= SC_FOLDLEVELWHITEFLAG;
|
||||
if (level != styler.LevelAt(line))
|
||||
styler.SetLevel(line, level);
|
||||
@ -311,66 +507,8 @@ static void FoldBasicDoc(unsigned int startPos, int length,
|
||||
}
|
||||
}
|
||||
|
||||
static void ColouriseBlitzBasicDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, ';');
|
||||
}
|
||||
LexerModule lmBlitzBasic(SCLEX_BLITZBASIC, LexerBasic::LexerFactoryBlitzBasic, "blitzbasic", blitzbasicWordListDesc);
|
||||
|
||||
static void ColourisePureBasicDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, ';');
|
||||
}
|
||||
|
||||
static void ColouriseFreeBasicDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler) {
|
||||
ColouriseBasicDoc(startPos, length, initStyle, keywordlists, styler, '\'');
|
||||
}
|
||||
|
||||
static void FoldBlitzBasicDoc(unsigned int startPos, int length, int,
|
||||
WordList *[], Accessor &styler) {
|
||||
FoldBasicDoc(startPos, length, styler, CheckBlitzFoldPoint);
|
||||
}
|
||||
|
||||
static void FoldPureBasicDoc(unsigned int startPos, int length, int,
|
||||
WordList *[], Accessor &styler) {
|
||||
FoldBasicDoc(startPos, length, styler, CheckPureFoldPoint);
|
||||
}
|
||||
|
||||
static void FoldFreeBasicDoc(unsigned int startPos, int length, int,
|
||||
WordList *[], Accessor &styler) {
|
||||
FoldBasicDoc(startPos, length, styler, CheckFreeFoldPoint);
|
||||
}
|
||||
|
||||
static const char * const blitzbasicWordListDesc[] = {
|
||||
"BlitzBasic Keywords",
|
||||
"user1",
|
||||
"user2",
|
||||
"user3",
|
||||
0
|
||||
};
|
||||
|
||||
static const char * const purebasicWordListDesc[] = {
|
||||
"PureBasic Keywords",
|
||||
"PureBasic PreProcessor Keywords",
|
||||
"user defined 1",
|
||||
"user defined 2",
|
||||
0
|
||||
};
|
||||
|
||||
static const char * const freebasicWordListDesc[] = {
|
||||
"FreeBasic Keywords",
|
||||
"FreeBasic PreProcessor Keywords",
|
||||
"user defined 1",
|
||||
"user defined 2",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmBlitzBasic(SCLEX_BLITZBASIC, ColouriseBlitzBasicDoc, "blitzbasic",
|
||||
FoldBlitzBasicDoc, blitzbasicWordListDesc);
|
||||
|
||||
LexerModule lmPureBasic(SCLEX_PUREBASIC, ColourisePureBasicDoc, "purebasic",
|
||||
FoldPureBasicDoc, purebasicWordListDesc);
|
||||
|
||||
LexerModule lmFreeBasic(SCLEX_FREEBASIC, ColouriseFreeBasicDoc, "freebasic",
|
||||
FoldFreeBasicDoc, freebasicWordListDesc);
|
||||
LexerModule lmPureBasic(SCLEX_PUREBASIC, LexerBasic::LexerFactoryPureBasic, "purebasic", purebasicWordListDesc);
|
||||
|
||||
LexerModule lmFreeBasic(SCLEX_FREEBASIC, LexerBasic::LexerFactoryFreeBasic, "freebasic", freebasicWordListDesc);
|
||||
|
@ -12,7 +12,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -1,6 +1,7 @@
|
||||
// Scintilla source code edit control
|
||||
/** @file LexCPP.cxx
|
||||
** Lexer for C++, C, Java, and JavaScript.
|
||||
** Further folding features and configuration properties added by "Udo Lechner" <dlchnr(at)gmx(dot)net>
|
||||
**/
|
||||
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
@ -15,10 +16,6 @@
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4786)
|
||||
#endif
|
||||
#ifdef __BORLANDC__
|
||||
// Borland C++ displays warnings in vector header without this
|
||||
#pragma option -w-ccc -w-rch
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
@ -29,7 +26,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
@ -37,6 +33,7 @@
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
#include "OptionSet.h"
|
||||
#include "SparseState.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
@ -67,6 +64,29 @@ static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
|
||||
return false;
|
||||
}
|
||||
|
||||
static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
|
||||
// Don't look at styles, so no need to flush.
|
||||
int pos = (int) sc.currentPos;
|
||||
int currentLine = styler.GetLine(pos);
|
||||
int lineStartPos = styler.LineStart(currentLine);
|
||||
char ch;
|
||||
while (--pos > lineStartPos) {
|
||||
ch = styler.SafeGetCharAt(pos);
|
||||
if (ch != ' ' && ch != '\t') {
|
||||
break;
|
||||
}
|
||||
}
|
||||
const char *retBack = "nruter";
|
||||
const char *s = retBack;
|
||||
while (*s
|
||||
&& pos >= lineStartPos
|
||||
&& styler.SafeGetCharAt(pos) == *s) {
|
||||
s++;
|
||||
pos--;
|
||||
}
|
||||
return !*s;
|
||||
}
|
||||
|
||||
static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
|
||||
std::string restOfLine;
|
||||
int i =0;
|
||||
@ -189,8 +209,13 @@ struct OptionsCPP {
|
||||
bool trackPreprocessor;
|
||||
bool updatePreprocessor;
|
||||
bool fold;
|
||||
bool foldSyntaxBased;
|
||||
bool foldComment;
|
||||
bool foldCommentMultiline;
|
||||
bool foldCommentExplicit;
|
||||
std::string foldExplicitStart;
|
||||
std::string foldExplicitEnd;
|
||||
bool foldExplicitAnywhere;
|
||||
bool foldPreprocessor;
|
||||
bool foldCompact;
|
||||
bool foldAtElse;
|
||||
@ -200,8 +225,13 @@ struct OptionsCPP {
|
||||
trackPreprocessor = true;
|
||||
updatePreprocessor = true;
|
||||
fold = false;
|
||||
foldSyntaxBased = true;
|
||||
foldComment = false;
|
||||
foldCommentMultiline = true;
|
||||
foldCommentExplicit = true;
|
||||
foldExplicitStart = "";
|
||||
foldExplicitEnd = "";
|
||||
foldExplicitAnywhere = false;
|
||||
foldPreprocessor = false;
|
||||
foldCompact = false;
|
||||
foldAtElse = false;
|
||||
@ -235,14 +265,29 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
|
||||
|
||||
DefineProperty("fold", &OptionsCPP::fold);
|
||||
|
||||
DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased,
|
||||
"Set this property to 0 to disable syntax based folding.");
|
||||
|
||||
DefineProperty("fold.comment", &OptionsCPP::foldComment,
|
||||
"This option enables folding multi-line comments and explicit fold points when using the C++ lexer. "
|
||||
"Explicit fold points allows adding extra folding by placing a //{ comment at the start and a //} "
|
||||
"at the end of a section that should fold.");
|
||||
|
||||
DefineProperty("fold.cpp.comment.multiline", &OptionsCPP::foldCommentMultiline,
|
||||
"Set this property to 0 to disable folding multi-line comments when fold.comment=1.");
|
||||
|
||||
DefineProperty("fold.cpp.comment.explicit", &OptionsCPP::foldCommentExplicit,
|
||||
"Set this property to 0 to disable folding explicit fold points when fold.comment=1.");
|
||||
|
||||
DefineProperty("fold.cpp.explicit.start", &OptionsCPP::foldExplicitStart,
|
||||
"The string to use for explicit fold start points, replacing the standard //{.");
|
||||
|
||||
DefineProperty("fold.cpp.explicit.end", &OptionsCPP::foldExplicitEnd,
|
||||
"The string to use for explicit fold end points, replacing the standard //}.");
|
||||
|
||||
DefineProperty("fold.cpp.explicit.anywhere", &OptionsCPP::foldExplicitAnywhere,
|
||||
"Set this property to 1 to enable explicit fold points anywhere, not just in line comments.");
|
||||
|
||||
DefineProperty("fold.preprocessor", &OptionsCPP::foldPreprocessor,
|
||||
"This option enables folding preprocessor directives when using the C++ lexer. "
|
||||
"Includes C#'s explicit #region and #endregion folding directives.");
|
||||
@ -265,7 +310,6 @@ class LexerCPP : public ILexer {
|
||||
CharacterSet setLogicalOp;
|
||||
PPStates vlls;
|
||||
std::vector<PPDefinition> ppDefineHistory;
|
||||
PropSetSimple props;
|
||||
WordList keywords;
|
||||
WordList keywords2;
|
||||
WordList keywords3;
|
||||
@ -274,6 +318,7 @@ class LexerCPP : public ILexer {
|
||||
std::map<std::string, std::string> preprocessorDefinitionsStart;
|
||||
OptionsCPP options;
|
||||
OptionSetCPP osCPP;
|
||||
SparseState<std::string> rawStringTerminators;
|
||||
public:
|
||||
LexerCPP(bool caseSensitive_) :
|
||||
caseSensitive(caseSensitive_),
|
||||
@ -396,7 +441,6 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
|
||||
|
||||
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
|
||||
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
|
||||
|
||||
if (options.identifiersAllowDollars) {
|
||||
setWordStart.Add('$');
|
||||
@ -411,7 +455,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
bool isIncludePreprocessor = false;
|
||||
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
if (initStyle == SCE_C_PREPROCESSOR) {
|
||||
if ((initStyle == SCE_C_PREPROCESSOR) ||
|
||||
(initStyle == SCE_C_COMMENTLINE) ||
|
||||
(initStyle == SCE_C_COMMENTLINEDOC)) {
|
||||
// Set continuationLine if last character of previous line is '\'
|
||||
if (lineCurrent > 0) {
|
||||
int chBack = styler.SafeGetCharAt(startPos-1, 0);
|
||||
@ -458,16 +504,18 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
|
||||
const int maskActivity = 0x3F;
|
||||
std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1);
|
||||
SparseState<std::string> rawSTNew(lineCurrent);
|
||||
|
||||
int activitySet = preproc.IsInactive() ? 0x40 : 0;
|
||||
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
|
||||
if (sc.atLineStart) {
|
||||
if (sc.state == SCE_C_STRING) {
|
||||
if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) {
|
||||
// Prevent SCE_C_STRINGEOL from leaking back to previous line which
|
||||
// ends with a line continuation by locking in the state upto this position.
|
||||
sc.SetState(SCE_C_STRING);
|
||||
sc.SetState(sc.state);
|
||||
}
|
||||
// Reset states to begining of colourise so no surprises
|
||||
// if different sets of lines lexed.
|
||||
@ -490,6 +538,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
if (sc.atLineEnd) {
|
||||
lineCurrent++;
|
||||
vlls.Add(lineCurrent, preproc);
|
||||
if (rawStringTerminator != "") {
|
||||
rawSTNew.Set(lineCurrent-1, rawStringTerminator);
|
||||
}
|
||||
}
|
||||
|
||||
// Handle line continuation generically.
|
||||
@ -513,7 +564,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
break;
|
||||
case SCE_C_NUMBER:
|
||||
// We accept almost anything because of hex. and number suffixes
|
||||
if (!setWord.Contains(sc.ch)) {
|
||||
if (!(setWord.Contains(sc.ch) || ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E')))) {
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
}
|
||||
break;
|
||||
@ -533,6 +584,23 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
} else if (keywords4.InList(s)) {
|
||||
sc.ChangeState(SCE_C_GLOBALCLASS|activitySet);
|
||||
}
|
||||
const bool literalString = sc.ch == '\"';
|
||||
if (literalString || sc.ch == '\'') {
|
||||
size_t lenS = strlen(s);
|
||||
const bool raw = literalString && sc.chPrev == 'R';
|
||||
if (raw)
|
||||
s[lenS--] = '\0';
|
||||
bool valid =
|
||||
(lenS == 0) ||
|
||||
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
|
||||
((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
|
||||
if (valid) {
|
||||
if (literalString)
|
||||
sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet);
|
||||
else
|
||||
sc.ChangeState(SCE_C_CHARACTER|activitySet);
|
||||
}
|
||||
}
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
}
|
||||
break;
|
||||
@ -568,12 +636,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
break;
|
||||
case SCE_C_COMMENTLINE:
|
||||
if (sc.atLineStart) {
|
||||
if (sc.atLineStart && !continuationLine) {
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
}
|
||||
break;
|
||||
case SCE_C_COMMENTLINEDOC:
|
||||
if (sc.atLineStart) {
|
||||
if (sc.atLineStart && !continuationLine) {
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
} else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
|
||||
// Verify that we have the conditions to mark a comment-doc-keyword
|
||||
@ -617,6 +685,14 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
|
||||
}
|
||||
break;
|
||||
case SCE_C_STRINGRAW:
|
||||
if (sc.Match(rawStringTerminator.c_str())) {
|
||||
for (size_t termPos=rawStringTerminator.size(); termPos; termPos--)
|
||||
sc.Forward();
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
rawStringTerminator = "";
|
||||
}
|
||||
break;
|
||||
case SCE_C_CHARACTER:
|
||||
if (sc.atLineEnd) {
|
||||
sc.ChangeState(SCE_C_STRINGEOL|activitySet);
|
||||
@ -657,6 +733,14 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
break;
|
||||
case SCE_C_TRIPLEVERBATIM:
|
||||
if (sc.Match ("\"\"\"")) {
|
||||
while (sc.Match('"')) {
|
||||
sc.Forward();
|
||||
}
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
}
|
||||
break;
|
||||
case SCE_C_UUID:
|
||||
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
|
||||
sc.SetState(SCE_C_DEFAULT|activitySet);
|
||||
@ -674,6 +758,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
if (sc.Match('@', '\"')) {
|
||||
sc.SetState(SCE_C_VERBATIM|activitySet);
|
||||
sc.Forward();
|
||||
} else if (sc.Match("\"\"\"")) {
|
||||
sc.SetState(SCE_C_TRIPLEVERBATIM|activitySet);
|
||||
sc.Forward(2);
|
||||
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
|
||||
if (lastWordWasUUID) {
|
||||
sc.SetState(SCE_C_UUID|activitySet);
|
||||
@ -701,11 +788,26 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
sc.SetState(SCE_C_COMMENTLINEDOC|activitySet);
|
||||
else
|
||||
sc.SetState(SCE_C_COMMENTLINE|activitySet);
|
||||
} else if (sc.ch == '/' && setOKBeforeRE.Contains(chPrevNonWhite) &&
|
||||
(!setCouldBePostOp.Contains(chPrevNonWhite) || !FollowsPostfixOperator(sc, styler))) {
|
||||
} else if (sc.ch == '/'
|
||||
&& (setOKBeforeRE.Contains(chPrevNonWhite)
|
||||
|| followsReturnKeyword(sc, styler))
|
||||
&& (!setCouldBePostOp.Contains(chPrevNonWhite)
|
||||
|| !FollowsPostfixOperator(sc, styler))) {
|
||||
sc.SetState(SCE_C_REGEX|activitySet); // JavaScript's RegEx
|
||||
} else if (sc.ch == '\"') {
|
||||
sc.SetState(SCE_C_STRING|activitySet);
|
||||
if (sc.chPrev == 'R') {
|
||||
sc.SetState(SCE_C_STRINGRAW|activitySet);
|
||||
rawStringTerminator = ")";
|
||||
for (int termPos = sc.currentPos + 1;;termPos++) {
|
||||
char chTerminator = styler.SafeGetCharAt(termPos, '(');
|
||||
if (chTerminator == '(')
|
||||
break;
|
||||
rawStringTerminator += chTerminator;
|
||||
}
|
||||
rawStringTerminator += '\"';
|
||||
} else {
|
||||
sc.SetState(SCE_C_STRING|activitySet);
|
||||
}
|
||||
isIncludePreprocessor = false; // ensure that '>' won't end the string
|
||||
} else if (isIncludePreprocessor && sc.ch == '<') {
|
||||
sc.SetState(SCE_C_STRING|activitySet);
|
||||
@ -800,10 +902,10 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
continuationLine = false;
|
||||
}
|
||||
if (definitionsChanged)
|
||||
const bool rawStringsChanged = rawStringTerminators.Merge(rawSTNew, lineCurrent);
|
||||
if (definitionsChanged || rawStringsChanged)
|
||||
styler.ChangeLexerState(startPos, startPos + length);
|
||||
sc.Complete();
|
||||
styler.Flush();
|
||||
}
|
||||
|
||||
// Store both the current line's fold level and the next lines in the
|
||||
@ -828,6 +930,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -835,7 +938,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
if (options.foldComment && IsStreamCommentStyle(style)) {
|
||||
if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style)) {
|
||||
if (!IsStreamCommentStyle(stylePrev) && (stylePrev != SCE_C_COMMENTLINEDOC)) {
|
||||
levelNext++;
|
||||
} else if (!IsStreamCommentStyle(styleNext) && (styleNext != SCE_C_COMMENTLINEDOC) && !atEOL) {
|
||||
@ -843,14 +946,22 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
if (options.foldComment && options.foldCommentExplicit && (style == SCE_C_COMMENTLINE)) {
|
||||
if ((ch == '/') && (chNext == '/')) {
|
||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||
if (chNext2 == '{') {
|
||||
if (options.foldComment && options.foldCommentExplicit && ((style == SCE_C_COMMENTLINE) || options.foldExplicitAnywhere)) {
|
||||
if (userDefinedFoldMarkers) {
|
||||
if (styler.Match(i, options.foldExplicitStart.c_str())) {
|
||||
levelNext++;
|
||||
} else if (chNext2 == '}') {
|
||||
} else if (styler.Match(i, options.foldExplicitEnd.c_str())) {
|
||||
levelNext--;
|
||||
}
|
||||
} else {
|
||||
if ((ch == '/') && (chNext == '/')) {
|
||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||
if (chNext2 == '{') {
|
||||
levelNext++;
|
||||
} else if (chNext2 == '}') {
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
|
||||
@ -866,7 +977,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
}
|
||||
if (style == SCE_C_OPERATOR) {
|
||||
if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) {
|
||||
if (ch == '{') {
|
||||
// Measure the minimum before a '{' to allow
|
||||
// folding on "} else {"
|
||||
@ -882,7 +993,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
|
||||
visibleChars++;
|
||||
if (atEOL || (i == endPos-1)) {
|
||||
int levelUse = levelCurrent;
|
||||
if (options.foldAtElse) {
|
||||
if (options.foldSyntaxBased && options.foldAtElse) {
|
||||
levelUse = levelMinCurrent;
|
||||
}
|
||||
int lev = levelUse | levelNext << 16;
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -20,7 +20,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -2,6 +2,7 @@
|
||||
** Lexer for D.
|
||||
**
|
||||
** Copyright (c) 2006 by Waldemar Augustyn <waldemar@wdmsys.com>
|
||||
** Converted to lexer object and added further folding features/properties by "Udo Lechner" <dlchnr(at)gmx(dot)net>
|
||||
**/
|
||||
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
@ -13,17 +14,23 @@
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4786)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <map>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
#include "OptionSet.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
@ -59,17 +66,187 @@ static bool IsStringSuffix(int ch) {
|
||||
return ch == 'c' || ch == 'w' || ch == 'd';
|
||||
}
|
||||
|
||||
static bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_D_COMMENT ||
|
||||
style == SCE_D_COMMENTDOC ||
|
||||
style == SCE_D_COMMENTDOCKEYWORD ||
|
||||
style == SCE_D_COMMENTDOCKEYWORDERROR;
|
||||
}
|
||||
|
||||
static void ColouriseDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *keywordlists[], Accessor &styler, bool caseSensitive) {
|
||||
// An individual named option for use in an OptionSet
|
||||
|
||||
WordList &keywords = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
WordList &keywords3 = *keywordlists[2]; //doxygen
|
||||
WordList &keywords4 = *keywordlists[3];
|
||||
WordList &keywords5 = *keywordlists[4];
|
||||
WordList &keywords6 = *keywordlists[5];
|
||||
WordList &keywords7 = *keywordlists[6];
|
||||
// Options used for LexerD
|
||||
struct OptionsD {
|
||||
bool fold;
|
||||
bool foldSyntaxBased;
|
||||
bool foldComment;
|
||||
bool foldCommentMultiline;
|
||||
bool foldCommentExplicit;
|
||||
std::string foldExplicitStart;
|
||||
std::string foldExplicitEnd;
|
||||
bool foldExplicitAnywhere;
|
||||
bool foldCompact;
|
||||
int foldAtElseInt;
|
||||
bool foldAtElse;
|
||||
OptionsD() {
|
||||
fold = false;
|
||||
foldSyntaxBased = true;
|
||||
foldComment = false;
|
||||
foldCommentMultiline = true;
|
||||
foldCommentExplicit = true;
|
||||
foldExplicitStart = "";
|
||||
foldExplicitEnd = "";
|
||||
foldExplicitAnywhere = false;
|
||||
foldCompact = true;
|
||||
foldAtElseInt = -1;
|
||||
foldAtElse = false;
|
||||
}
|
||||
};
|
||||
|
||||
static const char * const dWordLists[] = {
|
||||
"Primary keywords and identifiers",
|
||||
"Secondary keywords and identifiers",
|
||||
"Documentation comment keywords",
|
||||
"Type definitions and aliases",
|
||||
"Keywords 5",
|
||||
"Keywords 6",
|
||||
"Keywords 7",
|
||||
0,
|
||||
};
|
||||
|
||||
struct OptionSetD : public OptionSet<OptionsD> {
|
||||
OptionSetD() {
|
||||
DefineProperty("fold", &OptionsD::fold);
|
||||
|
||||
DefineProperty("fold.d.syntax.based", &OptionsD::foldSyntaxBased,
|
||||
"Set this property to 0 to disable syntax based folding.");
|
||||
|
||||
DefineProperty("fold.comment", &OptionsD::foldComment);
|
||||
|
||||
DefineProperty("fold.d.comment.multiline", &OptionsD::foldCommentMultiline,
|
||||
"Set this property to 0 to disable folding multi-line comments when fold.comment=1.");
|
||||
|
||||
DefineProperty("fold.d.comment.explicit", &OptionsD::foldCommentExplicit,
|
||||
"Set this property to 0 to disable folding explicit fold points when fold.comment=1.");
|
||||
|
||||
DefineProperty("fold.d.explicit.start", &OptionsD::foldExplicitStart,
|
||||
"The string to use for explicit fold start points, replacing the standard //{.");
|
||||
|
||||
DefineProperty("fold.d.explicit.end", &OptionsD::foldExplicitEnd,
|
||||
"The string to use for explicit fold end points, replacing the standard //}.");
|
||||
|
||||
DefineProperty("fold.d.explicit.anywhere", &OptionsD::foldExplicitAnywhere,
|
||||
"Set this property to 1 to enable explicit fold points anywhere, not just in line comments.");
|
||||
|
||||
DefineProperty("fold.compact", &OptionsD::foldCompact);
|
||||
|
||||
DefineProperty("lexer.d.fold.at.else", &OptionsD::foldAtElseInt,
|
||||
"This option enables D folding on a \"} else {\" line of an if statement.");
|
||||
|
||||
DefineProperty("fold.at.else", &OptionsD::foldAtElse);
|
||||
|
||||
DefineWordListSets(dWordLists);
|
||||
}
|
||||
};
|
||||
|
||||
class LexerD : public ILexer {
|
||||
bool caseSensitive;
|
||||
WordList keywords;
|
||||
WordList keywords2;
|
||||
WordList keywords3;
|
||||
WordList keywords4;
|
||||
WordList keywords5;
|
||||
WordList keywords6;
|
||||
WordList keywords7;
|
||||
OptionsD options;
|
||||
OptionSetD osD;
|
||||
public:
|
||||
LexerD(bool caseSensitive_) :
|
||||
caseSensitive(caseSensitive_) {
|
||||
}
|
||||
~LexerD() {
|
||||
}
|
||||
void SCI_METHOD Release() {
|
||||
delete this;
|
||||
}
|
||||
int SCI_METHOD Version() const {
|
||||
return lvOriginal;
|
||||
}
|
||||
const char * SCI_METHOD PropertyNames() {
|
||||
return osD.PropertyNames();
|
||||
}
|
||||
int SCI_METHOD PropertyType(const char *name) {
|
||||
return osD.PropertyType(name);
|
||||
}
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osD.DescribeProperty(name);
|
||||
}
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val);
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osD.DescribeWordListSets();
|
||||
}
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ILexer *LexerFactoryD() {
|
||||
return new LexerD(true);
|
||||
}
|
||||
static ILexer *LexerFactoryDInsensitive() {
|
||||
return new LexerD(false);
|
||||
}
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerD::PropertySet(const char *key, const char *val) {
|
||||
if (osD.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
int SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
wordListN = &keywords;
|
||||
break;
|
||||
case 1:
|
||||
wordListN = &keywords2;
|
||||
break;
|
||||
case 2:
|
||||
wordListN = &keywords3;
|
||||
break;
|
||||
case 3:
|
||||
wordListN = &keywords4;
|
||||
break;
|
||||
case 4:
|
||||
wordListN = &keywords5;
|
||||
break;
|
||||
case 5:
|
||||
wordListN = &keywords6;
|
||||
break;
|
||||
case 6:
|
||||
wordListN = &keywords7;
|
||||
break;
|
||||
}
|
||||
int firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
if (*wordListN != wlNew) {
|
||||
wordListN->Set(wl);
|
||||
firstModification = 0;
|
||||
}
|
||||
}
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
int styleBeforeDCKeyword = SCE_D_DEFAULT;
|
||||
|
||||
@ -294,24 +471,17 @@ static void ColouriseDoc(unsigned int startPos, int length, int initStyle,
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_D_COMMENT ||
|
||||
style == SCE_D_COMMENTDOC ||
|
||||
style == SCE_D_COMMENTDOCKEYWORD ||
|
||||
style == SCE_D_COMMENTDOCKEYWORDERROR;
|
||||
}
|
||||
|
||||
// Store both the current line's fold level and the next lines in the
|
||||
// level store to make it easy to pick up with each increment
|
||||
// and to make it possible to fiddle the current level for "} else {".
|
||||
static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
|
||||
// property lexer.d.fold.at.else
|
||||
// This option enables D folding on a "} else {" line of an if statement.
|
||||
bool foldAtElse = styler.GetPropertyInt("lexer.d.fold.at.else",
|
||||
styler.GetPropertyInt("fold.at.else", 0)) != 0;
|
||||
void SCI_METHOD LexerD::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
|
||||
if (!options.fold)
|
||||
return;
|
||||
|
||||
LexAccessor styler(pAccess);
|
||||
|
||||
unsigned int endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
@ -323,6 +493,8 @@ static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &
|
||||
char chNext = styler[startPos];
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
bool foldAtElse = options.foldAtElseInt >= 0 ? options.foldAtElseInt != 0 : options.foldAtElse;
|
||||
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -330,7 +502,7 @@ static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &
|
||||
style = styleNext;
|
||||
styleNext = styler.StyleAt(i + 1);
|
||||
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
|
||||
if (foldComment && IsStreamCommentStyle(style)) {
|
||||
if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style)) {
|
||||
if (!IsStreamCommentStyle(stylePrev)) {
|
||||
levelNext++;
|
||||
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
|
||||
@ -338,7 +510,25 @@ static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
if (style == SCE_D_OPERATOR) {
|
||||
if (options.foldComment && options.foldCommentExplicit && ((style == SCE_D_COMMENTLINE) || options.foldExplicitAnywhere)) {
|
||||
if (userDefinedFoldMarkers) {
|
||||
if (styler.Match(i, options.foldExplicitStart.c_str())) {
|
||||
levelNext++;
|
||||
} else if (styler.Match(i, options.foldExplicitEnd.c_str())) {
|
||||
levelNext--;
|
||||
}
|
||||
} else {
|
||||
if ((ch == '/') && (chNext == '/')) {
|
||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||
if (chNext2 == '{') {
|
||||
levelNext++;
|
||||
} else if (chNext2 == '}') {
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (options.foldSyntaxBased && (style == SCE_D_OPERATOR)) {
|
||||
if (ch == '{') {
|
||||
// Measure the minimum before a '{' to allow
|
||||
// folding on "} else {"
|
||||
@ -350,19 +540,19 @@ static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
if (atEOL) {
|
||||
if (foldComment) { // Handle nested comments
|
||||
if (atEOL || (i == endPos-1)) {
|
||||
if (options.foldComment && options.foldCommentMultiline) { // Handle nested comments
|
||||
int nc;
|
||||
nc = styler.GetLineState(lineCurrent);
|
||||
nc -= lineCurrent>0? styler.GetLineState(lineCurrent-1): 0;
|
||||
levelNext += nc;
|
||||
}
|
||||
int levelUse = levelCurrent;
|
||||
if (foldAtElse) {
|
||||
if (options.foldSyntaxBased && foldAtElse) {
|
||||
levelUse = levelMinCurrent;
|
||||
}
|
||||
int lev = levelUse | levelNext << 16;
|
||||
if (visibleChars == 0 && foldCompact)
|
||||
if (visibleChars == 0 && options.foldCompact)
|
||||
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||
if (levelUse < levelNext)
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
@ -379,25 +569,4 @@ static void FoldDoc(unsigned int startPos, int length, int initStyle, Accessor &
|
||||
}
|
||||
}
|
||||
|
||||
static void FoldDDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
FoldDoc(startPos, length, initStyle, styler);
|
||||
}
|
||||
|
||||
static const char * const dWordLists[] = {
|
||||
"Primary keywords and identifiers",
|
||||
"Secondary keywords and identifiers",
|
||||
"Documentation comment keywords",
|
||||
"Type definitions and aliases",
|
||||
"Keywords 5",
|
||||
"Keywords 6",
|
||||
"Keywords 7",
|
||||
0,
|
||||
};
|
||||
|
||||
static void ColouriseDDoc(unsigned int startPos, int length,
|
||||
int initStyle, WordList *keywordlists[], Accessor &styler) {
|
||||
ColouriseDoc(startPos, length, initStyle, keywordlists, styler, true);
|
||||
}
|
||||
|
||||
LexerModule lmD(SCLEX_D, ColouriseDDoc, "d", FoldDDoc, dWordLists);
|
||||
LexerModule lmD(SCLEX_D, LexerD::LexerFactoryD, "d", dWordLists);
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
@ -267,7 +266,7 @@ static int classifyFoldPointFortran(const char* s, const char* prevWord, const c
|
||||
|| strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0
|
||||
|| strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0
|
||||
|| strcmp(s, "endwhere") == 0
|
||||
|| strcmp(s, "procedure") == 0 ) { // Take care of the module procedure statement
|
||||
|| (strcmp(s, "procedure") == 0 && strcmp(prevWord,"module")==0) ) { // Take care of the module procedure statement
|
||||
lev = -1;
|
||||
} else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if
|
||||
lev = 0;
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -32,7 +32,6 @@ val SCE_GC_OPERATOR=9
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
@ -418,7 +417,7 @@ static bool isWordCdata(unsigned int start, unsigned int end, Accessor &styler)
|
||||
static int StateForScript(script_type scriptLanguage) {
|
||||
int Result;
|
||||
switch (scriptLanguage) {
|
||||
case eScriptJS:
|
||||
case eScriptJS:
|
||||
Result = SCE_HJ_START;
|
||||
break;
|
||||
case eScriptPython:
|
||||
@ -745,8 +744,18 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
|
||||
if ((state != SCE_HPHP_COMMENT) && (state != SCE_HPHP_COMMENTLINE) && (state != SCE_HJ_COMMENT) && (state != SCE_HJ_COMMENTLINE) && (state != SCE_HJ_COMMENTDOC) && (!isStringState(state))) {
|
||||
//Platform::DebugPrintf("state=%d, StateToPrint=%d, initStyle=%d\n", state, StateToPrint, initStyle);
|
||||
//if ((state == SCE_HPHP_OPERATOR) || (state == SCE_HPHP_DEFAULT) || (state == SCE_HJ_SYMBOLS) || (state == SCE_HJ_START) || (state == SCE_HJ_DEFAULT)) {
|
||||
if ((ch == '{') || (ch == '}') || (foldComment && (ch == '/') && (chNext == '*'))) {
|
||||
levelCurrent += ((ch == '{') || (ch == '/')) ? 1 : -1;
|
||||
if (ch == '#') {
|
||||
int j = i + 1;
|
||||
while ((j < lengthDoc) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
|
||||
j++;
|
||||
}
|
||||
if (styler.Match(j, "region") || styler.Match(j, "if")) {
|
||||
levelCurrent++;
|
||||
} else if (styler.Match(j, "end")) {
|
||||
levelCurrent--;
|
||||
}
|
||||
} else if ((ch == '{') || (ch == '}') || (foldComment && (ch == '/') && (chNext == '*')) ) {
|
||||
levelCurrent += ((ch == '{') || (ch == '/') ) ? 1 : -1;
|
||||
}
|
||||
} else if (((state == SCE_HPHP_COMMENT) || (state == SCE_HJ_COMMENT)) && foldComment && (ch == '*') && (chNext == '/')) {
|
||||
levelCurrent--;
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -23,7 +23,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
743
scintilla/lexers/LexModula.cxx
Normal file
743
scintilla/lexers/LexModula.cxx
Normal file
@ -0,0 +1,743 @@
|
||||
// -*- coding: utf-8 -*-
|
||||
// Scintilla source code edit control
|
||||
/**
|
||||
* @file LexModula.cxx
|
||||
* @author Dariusz "DKnoto" Knociński
|
||||
* @date 2011/02/03
|
||||
* @brief Lexer for Modula-2/3 documents.
|
||||
*/
|
||||
// The License.txt file describes the conditions under which this software may
|
||||
// be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <stdarg.h>
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_LEX_MODULA
|
||||
#define DEBUG_STATE( p, c )\
|
||||
fprintf( stderr, "Unknown state: currentPos = %d, char = '%c'\n", p, c );
|
||||
#else
|
||||
#define DEBUG_STATE( p, c )
|
||||
#endif
|
||||
|
||||
static inline bool IsDigitOfBase( unsigned ch, unsigned base ) {
|
||||
if( ch < '0' || ch > 'f' ) return false;
|
||||
if( base <= 10 ) {
|
||||
if( ch >= ( '0' + base ) ) return false;
|
||||
} else {
|
||||
if( ch > '9' ) {
|
||||
unsigned nb = base - 10;
|
||||
if( ( ch < 'A' ) || ( ch >= ( 'A' + nb ) ) ) {
|
||||
if( ( ch < 'a' ) || ( ch >= ( 'a' + nb ) ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline unsigned IsOperator( StyleContext & sc, WordList & op ) {
|
||||
int i;
|
||||
char s[3];
|
||||
|
||||
s[0] = sc.ch;
|
||||
s[1] = sc.chNext;
|
||||
s[2] = 0;
|
||||
for( i = 0; i < op.len; i++ ) {
|
||||
if( ( strlen( op.words[i] ) == 2 ) &&
|
||||
( s[0] == op.words[i][0] && s[1] == op.words[i][1] ) ) {
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
s[1] = 0;
|
||||
for( i = 0; i < op.len; i++ ) {
|
||||
if( ( strlen( op.words[i] ) == 1 ) &&
|
||||
( s[0] == op.words[i][0] ) ) {
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static inline bool IsEOL( Accessor &styler, unsigned curPos ) {
|
||||
unsigned ch = styler.SafeGetCharAt( curPos );
|
||||
if( ( ch == '\r' && styler.SafeGetCharAt( curPos + 1 ) == '\n' ) ||
|
||||
( ch == '\n' ) ) {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
static inline bool checkStatement(
|
||||
Accessor &styler,
|
||||
int &curPos,
|
||||
const char *stt, bool spaceAfter = true ) {
|
||||
int len = strlen( stt );
|
||||
int i;
|
||||
for( i = 0; i < len; i++ ) {
|
||||
if( styler.SafeGetCharAt( curPos + i ) != stt[i] ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
if( spaceAfter ) {
|
||||
if( ! isspace( styler.SafeGetCharAt( curPos + i ) ) ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
curPos += ( len - 1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool checkEndSemicolon(
|
||||
Accessor &styler,
|
||||
int &curPos, int endPos )
|
||||
{
|
||||
const char *stt = "END";
|
||||
int len = strlen( stt );
|
||||
int i;
|
||||
for( i = 0; i < len; i++ ) {
|
||||
if( styler.SafeGetCharAt( curPos + i ) != stt[i] ) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
while( isspace( styler.SafeGetCharAt( curPos + i ) ) ) {
|
||||
i++;
|
||||
if( ( curPos + i ) >= endPos ) return false;
|
||||
}
|
||||
if( styler.SafeGetCharAt( curPos + i ) != ';' ) {
|
||||
return false;
|
||||
}
|
||||
curPos += ( i - 1 );
|
||||
return true;
|
||||
}
|
||||
|
||||
static inline bool checkKeyIdentOper(
|
||||
|
||||
Accessor &styler,
|
||||
int &curPos, int endPos,
|
||||
const char *stt, const char etk ) {
|
||||
int newPos = curPos;
|
||||
if( ! checkStatement( styler, newPos, stt ) )
|
||||
return false;
|
||||
newPos++;
|
||||
if( newPos >= endPos )
|
||||
return false;
|
||||
if( ! isspace( styler.SafeGetCharAt( newPos ) ) )
|
||||
return false;
|
||||
newPos++;
|
||||
if( newPos >= endPos )
|
||||
return false;
|
||||
while( isspace( styler.SafeGetCharAt( newPos ) ) ) {
|
||||
newPos++;
|
||||
if( newPos >= endPos )
|
||||
return false;
|
||||
}
|
||||
if( ! isalpha( styler.SafeGetCharAt( newPos ) ) )
|
||||
return false;
|
||||
newPos++;
|
||||
if( newPos >= endPos )
|
||||
return false;
|
||||
char ch;
|
||||
ch = styler.SafeGetCharAt( newPos );
|
||||
while( isalpha( ch ) || isdigit( ch ) || ch == '_' ) {
|
||||
newPos++;
|
||||
if( newPos >= endPos ) return false;
|
||||
ch = styler.SafeGetCharAt( newPos );
|
||||
}
|
||||
while( isspace( styler.SafeGetCharAt( newPos ) ) ) {
|
||||
newPos++;
|
||||
if( newPos >= endPos ) return false;
|
||||
}
|
||||
if( styler.SafeGetCharAt( newPos ) != etk )
|
||||
return false;
|
||||
curPos = newPos;
|
||||
return true;
|
||||
}
|
||||
|
||||
static void FoldModulaDoc( unsigned int startPos,
|
||||
int length,
|
||||
int , WordList *[],
|
||||
Accessor &styler)
|
||||
{
|
||||
int curLine = styler.GetLine(startPos);
|
||||
int curLevel = SC_FOLDLEVELBASE;
|
||||
int endPos = startPos + length;
|
||||
if( curLine > 0 )
|
||||
curLevel = styler.LevelAt( curLine - 1 ) >> 16;
|
||||
int curPos = startPos;
|
||||
int style = styler.StyleAt( curPos );
|
||||
int visChars = 0;
|
||||
int nextLevel = curLevel;
|
||||
|
||||
while( curPos < endPos ) {
|
||||
if( ! isspace( styler.SafeGetCharAt( curPos ) ) ) visChars++;
|
||||
|
||||
switch( style ) {
|
||||
case SCE_MODULA_COMMENT:
|
||||
if( checkStatement( styler, curPos, "(*" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "*)" ) )
|
||||
nextLevel--;
|
||||
break;
|
||||
|
||||
case SCE_MODULA_DOXYCOMM:
|
||||
if( checkStatement( styler, curPos, "(**", false ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "*)" ) )
|
||||
nextLevel--;
|
||||
break;
|
||||
|
||||
case SCE_MODULA_KEYWORD:
|
||||
if( checkStatement( styler, curPos, "IF" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "BEGIN" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "TRY" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "LOOP" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "FOR" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "WHILE" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "REPEAT" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "UNTIL" ) )
|
||||
nextLevel--;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "WITH" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "CASE" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "TYPECASE" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkStatement( styler, curPos, "LOCK" ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkKeyIdentOper( styler, curPos, endPos, "PROCEDURE", '(' ) )
|
||||
nextLevel++;
|
||||
else
|
||||
if( checkKeyIdentOper( styler, curPos, endPos, "END", ';' ) ) {
|
||||
int cln = curLine;
|
||||
int clv_old = curLevel;
|
||||
int pos;
|
||||
char ch;
|
||||
int clv_new;
|
||||
while( cln > 0 ) {
|
||||
clv_new = styler.LevelAt( cln - 1 ) >> 16;
|
||||
if( clv_new < clv_old ) {
|
||||
nextLevel--;
|
||||
pos = styler.LineStart( cln );
|
||||
while( ( ch = styler.SafeGetCharAt( pos ) ) != '\n' ) {
|
||||
if( ch == 'P' ) {
|
||||
if( styler.StyleAt(pos) == SCE_MODULA_KEYWORD ) {
|
||||
if( checkKeyIdentOper( styler, pos, endPos,
|
||||
"PROCEDURE", '(' ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
pos++;
|
||||
}
|
||||
clv_old = clv_new;
|
||||
}
|
||||
cln--;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( checkKeyIdentOper( styler, curPos, endPos, "END", '.' ) )
|
||||
nextLevel--;
|
||||
else
|
||||
if( checkEndSemicolon( styler, curPos, endPos ) )
|
||||
nextLevel--;
|
||||
else {
|
||||
while( styler.StyleAt( curPos + 1 ) == SCE_MODULA_KEYWORD )
|
||||
curPos++;
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
if( IsEOL( styler, curPos ) || ( curPos == endPos - 1 ) ) {
|
||||
int efectiveLevel = curLevel | nextLevel << 16;
|
||||
if( visChars == 0 )
|
||||
efectiveLevel |= SC_FOLDLEVELWHITEFLAG;
|
||||
if( curLevel < nextLevel )
|
||||
efectiveLevel |= SC_FOLDLEVELHEADERFLAG;
|
||||
if( efectiveLevel != styler.LevelAt(curLine) ) {
|
||||
styler.SetLevel(curLine, efectiveLevel );
|
||||
}
|
||||
curLine++;
|
||||
curLevel = nextLevel;
|
||||
if( IsEOL( styler, curPos ) && ( curPos == endPos - 1 ) ) {
|
||||
styler.SetLevel( curLine, ( curLevel | curLevel << 16)
|
||||
| SC_FOLDLEVELWHITEFLAG);
|
||||
}
|
||||
visChars = 0;
|
||||
}
|
||||
curPos++;
|
||||
style = styler.StyleAt( curPos );
|
||||
}
|
||||
}
|
||||
|
||||
static inline bool skipWhiteSpaces( StyleContext & sc ) {
|
||||
while( isspace( sc.ch ) ) {
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
if( sc.More() )
|
||||
sc.Forward();
|
||||
else
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
static void ColouriseModulaDoc( unsigned int startPos,
|
||||
int length,
|
||||
int initStyle,
|
||||
WordList *wl[],
|
||||
Accessor &styler ) {
|
||||
WordList& keyWords = *wl[0];
|
||||
WordList& reservedWords = *wl[1];
|
||||
WordList& operators = *wl[2];
|
||||
WordList& pragmaWords = *wl[3];
|
||||
WordList& escapeCodes = *wl[4];
|
||||
WordList& doxyKeys = *wl[5];
|
||||
|
||||
const int BUFLEN = 128;
|
||||
|
||||
char buf[BUFLEN];
|
||||
int i, kl;
|
||||
|
||||
int charPos = 0;
|
||||
|
||||
StyleContext sc( startPos, length, initStyle, styler );
|
||||
|
||||
while( sc.More() ) {
|
||||
switch( sc.state ) {
|
||||
case SCE_MODULA_DEFAULT:
|
||||
if( ! skipWhiteSpaces( sc ) ) break;
|
||||
|
||||
if( sc.ch == '(' && sc.chNext == '*' ) {
|
||||
if( sc.GetRelative(2) == '*' ) {
|
||||
sc.SetState( SCE_MODULA_DOXYCOMM );
|
||||
sc.Forward();
|
||||
} else {
|
||||
sc.SetState( SCE_MODULA_COMMENT );
|
||||
}
|
||||
sc.Forward();
|
||||
}
|
||||
else
|
||||
if( isalpha( sc.ch ) ) {
|
||||
if( isupper( sc.ch ) && isupper( sc.chNext ) ) {
|
||||
for( i = 0; i < BUFLEN - 1; i++ ) {
|
||||
buf[i] = sc.GetRelative(i);
|
||||
if( !isalpha( buf[i] ) && !(buf[i] == '_') )
|
||||
break;
|
||||
}
|
||||
kl = i;
|
||||
buf[kl] = 0;
|
||||
|
||||
if( keyWords.InList( buf ) ) {
|
||||
sc.SetState( SCE_MODULA_KEYWORD );
|
||||
sc.Forward( kl );
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if( reservedWords.InList( buf ) ) {
|
||||
sc.SetState( SCE_MODULA_RESERVED );
|
||||
sc.Forward( kl );
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
} else {
|
||||
/** check procedure identifier */
|
||||
}
|
||||
} else {
|
||||
for( i = 0; i < BUFLEN - 1; i++ ) {
|
||||
buf[i] = sc.GetRelative(i);
|
||||
if( !isalpha( buf[i] ) &&
|
||||
!isdigit( buf[i] ) &&
|
||||
!(buf[i] == '_') )
|
||||
break;
|
||||
}
|
||||
kl = i;
|
||||
buf[kl] = 0;
|
||||
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
sc.Forward( kl );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
else
|
||||
if( isdigit( sc.ch ) ) {
|
||||
sc.SetState( SCE_MODULA_NUMBER );
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if( sc.ch == '\"' ) {
|
||||
sc.SetState( SCE_MODULA_STRING );
|
||||
}
|
||||
else
|
||||
if( sc.ch == '\'' ) {
|
||||
charPos = sc.currentPos;
|
||||
sc.SetState( SCE_MODULA_CHAR );
|
||||
}
|
||||
else
|
||||
if( sc.ch == '<' && sc.chNext == '*' ) {
|
||||
sc.SetState( SCE_MODULA_PRAGMA );
|
||||
sc.Forward();
|
||||
} else {
|
||||
unsigned len = IsOperator( sc, operators );
|
||||
if( len > 0 ) {
|
||||
sc.SetState( SCE_MODULA_OPERATOR );
|
||||
sc.Forward( len );
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
} else {
|
||||
DEBUG_STATE( sc.currentPos, sc.ch );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SCE_MODULA_COMMENT:
|
||||
if( sc.ch == '*' && sc.chNext == ')' ) {
|
||||
sc.Forward( 2 );
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCE_MODULA_DOXYCOMM:
|
||||
switch( sc.ch ) {
|
||||
case '*':
|
||||
if( sc.chNext == ')' ) {
|
||||
sc.Forward( 2 );
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case '@':
|
||||
if( islower( sc.chNext ) ) {
|
||||
for( i = 0; i < BUFLEN - 1; i++ ) {
|
||||
buf[i] = sc.GetRelative(i+1);
|
||||
if( isspace( buf[i] ) ) break;
|
||||
}
|
||||
buf[i] = 0;
|
||||
kl = i;
|
||||
|
||||
if( doxyKeys.InList( buf ) ) {
|
||||
sc.SetState( SCE_MODULA_DOXYKEY );
|
||||
sc.Forward( kl + 1 );
|
||||
sc.SetState( SCE_MODULA_DOXYCOMM );
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCE_MODULA_NUMBER:
|
||||
{
|
||||
buf[0] = sc.ch;
|
||||
for( i = 1; i < BUFLEN - 1; i++ ) {
|
||||
buf[i] = sc.GetRelative(i);
|
||||
if( ! isdigit( buf[i] ) )
|
||||
break;
|
||||
}
|
||||
kl = i;
|
||||
buf[kl] = 0;
|
||||
|
||||
switch( sc.GetRelative(kl) ) {
|
||||
case '_':
|
||||
{
|
||||
int base = atoi( buf );
|
||||
if( base < 2 || base > 16 ) {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
} else {
|
||||
int imax;
|
||||
|
||||
kl++;
|
||||
for( i = 0; i < BUFLEN - 1; i++ ) {
|
||||
buf[i] = sc.GetRelative(kl+i);
|
||||
if( ! IsDigitOfBase( buf[i], 16 ) ) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
imax = i;
|
||||
for( i = 0; i < imax; i++ ) {
|
||||
if( ! IsDigitOfBase( buf[i], base ) ) {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
break;
|
||||
}
|
||||
}
|
||||
kl += imax;
|
||||
}
|
||||
sc.SetState( SCE_MODULA_BASENUM );
|
||||
for( i = 0; i < kl; i++ ) {
|
||||
sc.Forward();
|
||||
}
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case '.':
|
||||
if( sc.GetRelative(kl+1) == '.' ) {
|
||||
kl--;
|
||||
for( i = 0; i < kl; i++ ) {
|
||||
sc.Forward();
|
||||
}
|
||||
sc.Forward();
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
} else {
|
||||
bool doNext = false;
|
||||
|
||||
kl++;
|
||||
|
||||
buf[0] = sc.GetRelative(kl);
|
||||
if( isdigit( buf[0] ) ) {
|
||||
for( i = 0;; i++ ) {
|
||||
if( !isdigit(sc.GetRelative(kl+i)) )
|
||||
break;
|
||||
}
|
||||
kl += i;
|
||||
buf[0] = sc.GetRelative(kl);
|
||||
|
||||
switch( buf[0] )
|
||||
{
|
||||
case 'E':
|
||||
case 'e':
|
||||
case 'D':
|
||||
case 'd':
|
||||
case 'X':
|
||||
case 'x':
|
||||
kl++;
|
||||
buf[0] = sc.GetRelative(kl);
|
||||
if( buf[0] == '-' || buf[0] == '+' ) {
|
||||
kl++;
|
||||
}
|
||||
buf[0] = sc.GetRelative(kl);
|
||||
if( isdigit( buf[0] ) ) {
|
||||
for( i = 0;; i++ ) {
|
||||
if( !isdigit(sc.GetRelative(kl+i)) ) {
|
||||
buf[0] = sc.GetRelative(kl+i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
kl += i;
|
||||
doNext = true;
|
||||
} else {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
doNext = true;
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
}
|
||||
|
||||
if( doNext ) {
|
||||
if( ! isspace( buf[0] ) &&
|
||||
buf[0] != ')' &&
|
||||
buf[0] != '>' &&
|
||||
buf[0] != '<' &&
|
||||
buf[0] != '=' &&
|
||||
buf[0] != '#' &&
|
||||
buf[0] != '+' &&
|
||||
buf[0] != '-' &&
|
||||
buf[0] != '*' &&
|
||||
buf[0] != '/' &&
|
||||
buf[0] != ',' &&
|
||||
buf[0] != ';'
|
||||
) {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
} else {
|
||||
kl--;
|
||||
}
|
||||
}
|
||||
}
|
||||
sc.SetState( SCE_MODULA_FLOAT );
|
||||
for( i = 0; i < kl; i++ ) {
|
||||
sc.Forward();
|
||||
}
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
break;
|
||||
|
||||
default:
|
||||
for( i = 0; i < kl; i++ ) {
|
||||
sc.Forward();
|
||||
}
|
||||
break;
|
||||
}
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCE_MODULA_STRING:
|
||||
if( sc.ch == '\"' ) {
|
||||
sc.Forward();
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
} else {
|
||||
if( sc.ch == '\\' ) {
|
||||
i = 1;
|
||||
if( IsDigitOfBase( sc.chNext, 8 ) ) {
|
||||
for( i = 1; i < BUFLEN - 1; i++ ) {
|
||||
if( ! IsDigitOfBase(sc.GetRelative(i+1), 8 ) )
|
||||
break;
|
||||
}
|
||||
if( i == 3 ) {
|
||||
sc.SetState( SCE_MODULA_STRSPEC );
|
||||
} else {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
}
|
||||
} else {
|
||||
buf[0] = sc.chNext;
|
||||
buf[1] = 0;
|
||||
|
||||
if( escapeCodes.InList( buf ) ) {
|
||||
sc.SetState( SCE_MODULA_STRSPEC );
|
||||
} else {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
}
|
||||
}
|
||||
sc.Forward(i+1);
|
||||
sc.SetState( SCE_MODULA_STRING );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
case SCE_MODULA_CHAR:
|
||||
if( sc.ch == '\'' ) {
|
||||
sc.Forward();
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if( ( sc.currentPos - charPos ) == 1 ) {
|
||||
if( sc.ch == '\\' ) {
|
||||
i = 1;
|
||||
if( IsDigitOfBase( sc.chNext, 8 ) ) {
|
||||
for( i = 1; i < BUFLEN - 1; i++ ) {
|
||||
if( ! IsDigitOfBase(sc.GetRelative(i+1), 8 ) )
|
||||
break;
|
||||
}
|
||||
if( i == 3 ) {
|
||||
sc.SetState( SCE_MODULA_CHARSPEC );
|
||||
} else {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
}
|
||||
} else {
|
||||
buf[0] = sc.chNext;
|
||||
buf[1] = 0;
|
||||
|
||||
if( escapeCodes.InList( buf ) ) {
|
||||
sc.SetState( SCE_MODULA_CHARSPEC );
|
||||
} else {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
}
|
||||
}
|
||||
sc.Forward(i+1);
|
||||
sc.SetState( SCE_MODULA_CHAR );
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
sc.SetState( SCE_MODULA_BADSTR );
|
||||
sc.Forward();
|
||||
sc.SetState( SCE_MODULA_CHAR );
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
|
||||
case SCE_MODULA_PRAGMA:
|
||||
if( sc.ch == '*' && sc.chNext == '>' ) {
|
||||
sc.Forward();
|
||||
sc.Forward();
|
||||
sc.SetState( SCE_MODULA_DEFAULT );
|
||||
continue;
|
||||
}
|
||||
else
|
||||
if( isupper( sc.ch ) && isupper( sc.chNext ) ) {
|
||||
buf[0] = sc.ch;
|
||||
buf[1] = sc.chNext;
|
||||
for( i = 2; i < BUFLEN - 1; i++ ) {
|
||||
buf[i] = sc.GetRelative(i);
|
||||
if( !isupper( buf[i] ) )
|
||||
break;
|
||||
}
|
||||
kl = i;
|
||||
buf[kl] = 0;
|
||||
if( pragmaWords.InList( buf ) ) {
|
||||
sc.SetState( SCE_MODULA_PRGKEY );
|
||||
sc.Forward( kl );
|
||||
sc.SetState( SCE_MODULA_PRAGMA );
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
sc.Forward();
|
||||
}
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static const char *const modulaWordListDesc[] =
|
||||
{
|
||||
"Keywords",
|
||||
"ReservedKeywords",
|
||||
"Operators",
|
||||
"PragmaKeyswords",
|
||||
"EscapeCodes",
|
||||
"DoxygeneKeywords",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmModula( SCLEX_MODULA, ColouriseModulaDoc, "modula", FoldModulaDoc,
|
||||
modulaWordListDesc);
|
@ -21,7 +21,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -15,7 +15,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
@ -510,7 +509,7 @@ static void ColouriseDiffLine(char *lineBuffer, int endLine, Accessor &styler) {
|
||||
styler.ColourTo(endLine, SCE_DIFF_COMMAND);
|
||||
} else if (0 == strncmp(lineBuffer, "Index: ", 7)) { // For subversion's diff
|
||||
styler.ColourTo(endLine, SCE_DIFF_COMMAND);
|
||||
} else if (0 == strncmp(lineBuffer, "---", 3)) {
|
||||
} else if (0 == strncmp(lineBuffer, "---", 3) && lineBuffer[3] != '-') {
|
||||
// In a context diff, --- appears in both the header and the position markers
|
||||
if (lineBuffer[3] == ' ' && atoi(lineBuffer + 4) && !strchr(lineBuffer, '/'))
|
||||
styler.ColourTo(endLine, SCE_DIFF_POSITION);
|
||||
@ -930,8 +929,8 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
|
||||
// Command or return status
|
||||
return SCE_ERR_CMD;
|
||||
} else if (lineBuffer[0] == '<') {
|
||||
// Diff removal, but not interested. Trapped to avoid hitting CTAG cases.
|
||||
return SCE_ERR_DEFAULT;
|
||||
// Diff removal.
|
||||
return SCE_ERR_DIFF_DELETION;
|
||||
} else if (lineBuffer[0] == '!') {
|
||||
return SCE_ERR_DIFF_CHANGED;
|
||||
} else if (lineBuffer[0] == '+') {
|
||||
@ -1170,7 +1169,7 @@ static int isTag(int start, Accessor &styler) {
|
||||
while (i < 5 && e) {
|
||||
s[i] = styler[start + i];
|
||||
i++;
|
||||
e = styler[start + i] != '{';
|
||||
e = (strchr("{ \t", styler[start + i]) == NULL);
|
||||
}
|
||||
s[i] = '\0';
|
||||
return (strcmp(s, "begin") == 0) || (strcmp(s, "end") == 0);
|
||||
|
@ -44,7 +44,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -13,7 +13,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -25,7 +25,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -118,7 +118,6 @@ contains requires
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
@ -1168,6 +1167,12 @@ static void ColourisePerlDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
sc.Complete();
|
||||
if (sc.state == SCE_PL_HERE_Q
|
||||
|| sc.state == SCE_PL_HERE_QQ
|
||||
|| sc.state == SCE_PL_HERE_QX
|
||||
|| sc.state == SCE_PL_FORMAT) {
|
||||
styler.ChangeLexerState(sc.currentPos, styler.Length());
|
||||
}
|
||||
}
|
||||
|
||||
static bool IsCommentLine(int line, Accessor &styler) {
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -22,7 +22,6 @@ Support more than 6 comments levels
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -22,7 +22,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
@ -978,6 +977,15 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else if (preferRE && !isSafeWordcharOrHigh(chNext)) {
|
||||
// Ruby doesn't allow high bit chars here,
|
||||
// but the editor host might
|
||||
Quote.New();
|
||||
state = SCE_RB_STRING_QQ;
|
||||
Quote.Open(chNext);
|
||||
advance_char(i, ch, chNext, chNext2); // pass by ref
|
||||
have_string = true;
|
||||
} else if (!isSafeWordcharOrHigh(chNext) && !iswhitespace(chNext) && !isEOLChar(chNext)) {
|
||||
// Ruby doesn't allow high bit chars here,
|
||||
// but the editor host might
|
||||
Quote.New();
|
||||
state = SCE_RB_STRING_QQ;
|
||||
Quote.Open(chNext);
|
||||
advance_char(i, ch, chNext, chNext2); // pass by ref
|
||||
@ -1129,6 +1137,10 @@ static void ColouriseRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
} else if (isSafeAlnumOrHigh(ch) || ch == '_') {
|
||||
// Keep going
|
||||
} else if (ch == '.' && chNext == '.') {
|
||||
++numDots;
|
||||
styler.ColourTo(i - 1, state);
|
||||
redo_char(i, ch, chNext, chNext2, state); // pass by ref
|
||||
} else if (ch == '.' && ++numDots == 1) {
|
||||
// Keep going
|
||||
} else {
|
||||
@ -1444,10 +1456,32 @@ static bool keywordIsModifier(const char *word,
|
||||
if (word[0] == 'd' && word[1] == 'o' && !word[2]) {
|
||||
return keywordDoStartsLoop(pos, styler);
|
||||
}
|
||||
char ch;
|
||||
char ch, chPrev, chPrev2;
|
||||
int style = SCE_RB_DEFAULT;
|
||||
int lineStart = styler.GetLine(pos);
|
||||
int lineStartPosn = styler.LineStart(lineStart);
|
||||
// We want to step backwards until we don't care about the current
|
||||
// position. But first move lineStartPosn back behind any
|
||||
// continuations immediately above word.
|
||||
while (lineStartPosn > 0) {
|
||||
ch = styler[lineStartPosn-1];
|
||||
if (ch == '\n' || ch == '\r') {
|
||||
chPrev = styler.SafeGetCharAt(lineStartPosn-2);
|
||||
chPrev2 = styler.SafeGetCharAt(lineStartPosn-3);
|
||||
lineStart = styler.GetLine(lineStartPosn-1);
|
||||
// If we find a continuation line, include it in our analysis.
|
||||
if (chPrev == '\\') {
|
||||
lineStartPosn = styler.LineStart(lineStart);
|
||||
} else if (ch == '\n' && chPrev == '\r' && chPrev2 == '\\') {
|
||||
lineStartPosn = styler.LineStart(lineStart);
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
styler.Flush();
|
||||
while (--pos >= lineStartPosn) {
|
||||
style = actual_style(styler.StyleAt(pos));
|
||||
@ -1458,14 +1492,27 @@ static bool keywordIsModifier(const char *word,
|
||||
// Scintilla's LineStart() and GetLine() routines aren't
|
||||
// platform-independent, so if we have text prepared with
|
||||
// a different system we can't rely on it.
|
||||
return false;
|
||||
|
||||
// Also, lineStartPosn may have been moved to more than one
|
||||
// line above word's line while pushing past continuations.
|
||||
chPrev = styler.SafeGetCharAt(pos - 1);
|
||||
chPrev2 = styler.SafeGetCharAt(pos - 2);
|
||||
if (chPrev == '\\') {
|
||||
pos-=1; // gloss over the "\\"
|
||||
//continue
|
||||
} else if (ch == '\n' && chPrev == '\r' && chPrev2 == '\\') {
|
||||
pos-=2; // gloss over the "\\\r"
|
||||
//continue
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (pos < lineStartPosn) {
|
||||
return false; //XXX not quite right if the prev line is a continuation
|
||||
return false;
|
||||
}
|
||||
// First things where the action is unambiguous
|
||||
switch (style) {
|
||||
@ -1681,7 +1728,13 @@ static void FoldRbDoc(unsigned int startPos, int length, int initStyle,
|
||||
) {
|
||||
levelCurrent++;
|
||||
}
|
||||
}
|
||||
} else if (style == SCE_RB_HERE_DELIM) {
|
||||
if (styler.SafeGetCharAt(i-2) == '<' && styler.SafeGetCharAt(i-1) == '<') {
|
||||
levelCurrent++;
|
||||
} else if (styleNext == SCE_RB_DEFAULT) {
|
||||
levelCurrent--;
|
||||
}
|
||||
}
|
||||
if (atEOL) {
|
||||
int lev = levelPrev;
|
||||
if (visibleChars == 0 && foldCompact)
|
||||
@ -1717,4 +1770,4 @@ static const char * const rubyWordListDesc[] = {
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc);
|
||||
LexerModule lmRuby(SCLEX_RUBY, ColouriseRbDoc, "ruby", FoldRbDoc, rubyWordListDesc, 6);
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -2,7 +2,7 @@
|
||||
/** @file LexSQL.cxx
|
||||
** Lexer for SQL, including PL/SQL and SQL*Plus.
|
||||
**/
|
||||
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
|
||||
// Copyright 1998-2011 by Neil Hodgson <neilh@scintilla.org>
|
||||
// The License.txt file describes the conditions under which this software may be distributed.
|
||||
|
||||
#include <stdlib.h>
|
||||
@ -12,24 +12,36 @@
|
||||
#include <assert.h>
|
||||
#include <ctype.h>
|
||||
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(disable: 4786)
|
||||
#endif
|
||||
|
||||
#include <string>
|
||||
#include <vector>
|
||||
#include <map>
|
||||
#include <algorithm>
|
||||
|
||||
#include "ILexer.h"
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
#include "StyleContext.h"
|
||||
#include "CharacterSet.h"
|
||||
#include "LexerModule.h"
|
||||
#include "OptionSet.h"
|
||||
|
||||
#ifdef SCI_NAMESPACE
|
||||
using namespace Scintilla;
|
||||
#endif
|
||||
|
||||
static inline bool IsAWordChar(int ch) {
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
static inline bool IsAWordChar(int ch, bool sqlAllowDottedWord) {
|
||||
if (!sqlAllowDottedWord)
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_');
|
||||
else
|
||||
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
|
||||
}
|
||||
|
||||
static inline bool IsAWordStart(int ch) {
|
||||
@ -47,31 +59,289 @@ static inline bool IsANumberChar(int ch) {
|
||||
// Not exactly following number definition (several dots are seen as OK, etc.)
|
||||
// but probably enough in most cases.
|
||||
return (ch < 0x80) &&
|
||||
(isdigit(ch) || toupper(ch) == 'E' ||
|
||||
ch == '.' || ch == '-' || ch == '+');
|
||||
(isdigit(ch) || toupper(ch) == 'E' ||
|
||||
ch == '.' || ch == '-' || ch == '+');
|
||||
}
|
||||
|
||||
static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
|
||||
Accessor &styler) {
|
||||
|
||||
WordList &keywords1 = *keywordlists[0];
|
||||
WordList &keywords2 = *keywordlists[1];
|
||||
WordList &kw_pldoc = *keywordlists[2];
|
||||
WordList &kw_sqlplus = *keywordlists[3];
|
||||
WordList &kw_user1 = *keywordlists[4];
|
||||
WordList &kw_user2 = *keywordlists[5];
|
||||
WordList &kw_user3 = *keywordlists[6];
|
||||
WordList &kw_user4 = *keywordlists[7];
|
||||
class SQLStates {
|
||||
public :
|
||||
void Set(int lineNumber, unsigned short int sqlStatesLine) {
|
||||
if (!sqlStatement.size() == 0 || !sqlStatesLine == 0) {
|
||||
sqlStatement.resize(lineNumber + 1, 0);
|
||||
sqlStatement[lineNumber] = sqlStatesLine;
|
||||
}
|
||||
}
|
||||
|
||||
unsigned short int IgnoreWhen (unsigned short int sqlStatesLine, bool enable) {
|
||||
if (enable)
|
||||
sqlStatesLine |= MASK_IGNORE_WHEN;
|
||||
else
|
||||
sqlStatesLine &= ~MASK_IGNORE_WHEN;
|
||||
|
||||
return sqlStatesLine;
|
||||
}
|
||||
|
||||
unsigned short int IntoCondition (unsigned short int sqlStatesLine, bool enable) {
|
||||
if (enable)
|
||||
sqlStatesLine |= MASK_INTO_CONDITION;
|
||||
else
|
||||
sqlStatesLine &= ~MASK_INTO_CONDITION;
|
||||
|
||||
return sqlStatesLine;
|
||||
}
|
||||
|
||||
unsigned short int IntoExceptionBlock (unsigned short int sqlStatesLine, bool enable) {
|
||||
if (enable)
|
||||
sqlStatesLine |= MASK_INTO_EXCEPTION;
|
||||
else
|
||||
sqlStatesLine &= ~MASK_INTO_EXCEPTION;
|
||||
|
||||
return sqlStatesLine;
|
||||
}
|
||||
|
||||
unsigned short int IntoDeclareBlock (unsigned short int sqlStatesLine, bool enable) {
|
||||
if (enable)
|
||||
sqlStatesLine |= MASK_INTO_DECLARE;
|
||||
else
|
||||
sqlStatesLine &= ~MASK_INTO_DECLARE;
|
||||
|
||||
return sqlStatesLine;
|
||||
}
|
||||
|
||||
unsigned short int BeginCaseBlock (unsigned short int sqlStatesLine) {
|
||||
if ((sqlStatesLine & MASK_NESTED_CASES) < MASK_NESTED_CASES) {
|
||||
sqlStatesLine++;
|
||||
}
|
||||
return sqlStatesLine;
|
||||
}
|
||||
|
||||
unsigned short int EndCaseBlock (unsigned short int sqlStatesLine) {
|
||||
if ((sqlStatesLine & MASK_NESTED_CASES) > 0) {
|
||||
sqlStatesLine--;
|
||||
}
|
||||
return sqlStatesLine;
|
||||
}
|
||||
|
||||
bool IsIgnoreWhen (unsigned short int sqlStatesLine) {
|
||||
return (sqlStatesLine & MASK_IGNORE_WHEN) != 0;
|
||||
}
|
||||
|
||||
bool IsIntoCondition (unsigned short int sqlStatesLine) {
|
||||
return (sqlStatesLine & MASK_INTO_CONDITION) != 0;
|
||||
}
|
||||
|
||||
bool IsIntoCaseBlock (unsigned short int sqlStatesLine) {
|
||||
return (sqlStatesLine & MASK_NESTED_CASES) != 0;
|
||||
}
|
||||
|
||||
bool IsIntoExceptionBlock (unsigned short int sqlStatesLine) {
|
||||
return (sqlStatesLine & MASK_INTO_EXCEPTION) != 0;
|
||||
}
|
||||
|
||||
bool IsIntoDeclareBlock (unsigned short int sqlStatesLine) {
|
||||
return (sqlStatesLine & MASK_INTO_DECLARE) != 0;
|
||||
}
|
||||
|
||||
unsigned short int ForLine(int lineNumber) {
|
||||
if ((lineNumber > 0) && (sqlStatement.size() > static_cast<size_t>(lineNumber))) {
|
||||
return sqlStatement[lineNumber];
|
||||
} else {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
SQLStates() {}
|
||||
|
||||
private :
|
||||
std::vector <unsigned short int> sqlStatement;
|
||||
enum {
|
||||
MASK_INTO_DECLARE = 0x1000,
|
||||
MASK_INTO_EXCEPTION = 0x2000,
|
||||
MASK_INTO_CONDITION = 0x4000,
|
||||
MASK_IGNORE_WHEN = 0x8000,
|
||||
MASK_NESTED_CASES = 0x0FFF
|
||||
};
|
||||
};
|
||||
|
||||
// Options used for LexerSQL
|
||||
struct OptionsSQL {
|
||||
bool fold;
|
||||
bool foldAtElse;
|
||||
bool foldComment;
|
||||
bool foldCompact;
|
||||
bool foldOnlyBegin;
|
||||
bool sqlBackticksIdentifier;
|
||||
bool sqlNumbersignComment;
|
||||
bool sqlBackslashEscapes;
|
||||
bool sqlAllowDottedWord;
|
||||
OptionsSQL() {
|
||||
fold = false;
|
||||
foldAtElse = false;
|
||||
foldComment = false;
|
||||
foldCompact = false;
|
||||
foldOnlyBegin = false;
|
||||
sqlBackticksIdentifier = false;
|
||||
sqlNumbersignComment = false;
|
||||
sqlBackslashEscapes = false;
|
||||
sqlAllowDottedWord = false;
|
||||
}
|
||||
};
|
||||
|
||||
static const char * const sqlWordListDesc[] = {
|
||||
"Keywords",
|
||||
"Database Objects",
|
||||
"PLDoc",
|
||||
"SQL*Plus",
|
||||
"User Keywords 1",
|
||||
"User Keywords 2",
|
||||
"User Keywords 3",
|
||||
"User Keywords 4",
|
||||
0
|
||||
};
|
||||
|
||||
struct OptionSetSQL : public OptionSet<OptionsSQL> {
|
||||
OptionSetSQL() {
|
||||
DefineProperty("fold", &OptionsSQL::fold);
|
||||
|
||||
DefineProperty("lexer.sql.fold.at.else", &OptionsSQL::foldAtElse,
|
||||
"This option enables SQL folding on a \"ELSE\" and \"ELSIF\"line of an IF statement.");
|
||||
|
||||
DefineProperty("fold.comment", &OptionsSQL::foldComment);
|
||||
|
||||
DefineProperty("fold.compact", &OptionsSQL::foldCompact);
|
||||
|
||||
DefineProperty("fold.sql.only.begin", &OptionsSQL::foldOnlyBegin);
|
||||
|
||||
DefineProperty("lexer.sql.backticks.identifier", &OptionsSQL::sqlBackticksIdentifier);
|
||||
|
||||
DefineProperty("lexer.sql.numbersign.comment", &OptionsSQL::sqlNumbersignComment,
|
||||
"If \"lexer.sql.numbersign.comment\" property is set to 0 a line beginning with '#' will not be a comment.");
|
||||
|
||||
DefineProperty("sql.backslash.escapes", &OptionsSQL::sqlBackslashEscapes,
|
||||
"Enables backslash as an escape character in SQL.");
|
||||
|
||||
DefineProperty("lexer.sql.allow.dotted.word", &OptionsSQL::sqlAllowDottedWord,
|
||||
"Set to 1 to colourise recognized words with dots "
|
||||
"(recommended for Oracle PL/SQL objects).");
|
||||
|
||||
DefineWordListSets(sqlWordListDesc);
|
||||
}
|
||||
};
|
||||
|
||||
class LexerSQL : public ILexer {
|
||||
public :
|
||||
LexerSQL() {}
|
||||
|
||||
int SCI_METHOD Version () const {
|
||||
return lvOriginal;
|
||||
}
|
||||
|
||||
void SCI_METHOD Release() {
|
||||
delete this;
|
||||
}
|
||||
|
||||
const char * SCI_METHOD PropertyNames() {
|
||||
return osSQL.PropertyNames();
|
||||
}
|
||||
|
||||
int SCI_METHOD PropertyType(const char *name) {
|
||||
return osSQL.PropertyType(name);
|
||||
}
|
||||
|
||||
const char * SCI_METHOD DescribeProperty(const char *name) {
|
||||
return osSQL.DescribeProperty(name);
|
||||
}
|
||||
|
||||
int SCI_METHOD PropertySet(const char *key, const char *val) {
|
||||
if (osSQL.PropertySet(&options, key, val)) {
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
const char * SCI_METHOD DescribeWordListSets() {
|
||||
return osSQL.DescribeWordListSets();
|
||||
}
|
||||
|
||||
int SCI_METHOD WordListSet(int n, const char *wl);
|
||||
void SCI_METHOD Lex (unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
|
||||
void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
|
||||
|
||||
void * SCI_METHOD PrivateCall(int, void *) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static ILexer *LexerFactorySQL() {
|
||||
return new LexerSQL();
|
||||
}
|
||||
private:
|
||||
bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_SQL_COMMENT ||
|
||||
style == SCE_SQL_COMMENTDOC ||
|
||||
style == SCE_SQL_COMMENTDOCKEYWORD ||
|
||||
style == SCE_SQL_COMMENTDOCKEYWORDERROR;
|
||||
}
|
||||
|
||||
OptionsSQL options;
|
||||
OptionSetSQL osSQL;
|
||||
SQLStates sqlStates;
|
||||
|
||||
WordList keywords1;
|
||||
WordList keywords2;
|
||||
WordList kw_pldoc;
|
||||
WordList kw_sqlplus;
|
||||
WordList kw_user1;
|
||||
WordList kw_user2;
|
||||
WordList kw_user3;
|
||||
WordList kw_user4;
|
||||
};
|
||||
|
||||
int SCI_METHOD LexerSQL::WordListSet(int n, const char *wl) {
|
||||
WordList *wordListN = 0;
|
||||
switch (n) {
|
||||
case 0:
|
||||
wordListN = &keywords1;
|
||||
break;
|
||||
case 1:
|
||||
wordListN = &keywords2;
|
||||
break;
|
||||
case 2:
|
||||
wordListN = &kw_pldoc;
|
||||
break;
|
||||
case 3:
|
||||
wordListN = &kw_sqlplus;
|
||||
break;
|
||||
case 4:
|
||||
wordListN = &kw_user1;
|
||||
break;
|
||||
case 5:
|
||||
wordListN = &kw_user2;
|
||||
break;
|
||||
case 6:
|
||||
wordListN = &kw_user3;
|
||||
break;
|
||||
case 7:
|
||||
wordListN = &kw_user4;
|
||||
}
|
||||
int firstModification = -1;
|
||||
if (wordListN) {
|
||||
WordList wlNew;
|
||||
wlNew.Set(wl);
|
||||
if (*wordListN != wlNew) {
|
||||
wordListN->Set(wl);
|
||||
firstModification = 0;
|
||||
}
|
||||
}
|
||||
return firstModification;
|
||||
}
|
||||
|
||||
void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
LexAccessor styler(pAccess);
|
||||
StyleContext sc(startPos, length, initStyle, styler);
|
||||
|
||||
// property sql.backslash.escapes
|
||||
// Enables backslash as an escape character in SQL.
|
||||
bool sqlBackslashEscapes = styler.GetPropertyInt("sql.backslash.escapes", 0) != 0;
|
||||
|
||||
bool sqlBackticksIdentifier = styler.GetPropertyInt("lexer.sql.backticks.identifier", 0) != 0;
|
||||
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
|
||||
for (; sc.More(); sc.Forward()) {
|
||||
int offset = 0;
|
||||
for (; sc.More(); sc.Forward(), offset++) {
|
||||
// Determine if the current state should terminate.
|
||||
switch (sc.state) {
|
||||
case SCE_SQL_OPERATOR:
|
||||
@ -84,7 +354,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
}
|
||||
break;
|
||||
case SCE_SQL_IDENTIFIER:
|
||||
if (!IsAWordChar(sc.ch)) {
|
||||
if (!IsAWordChar(sc.ch, options.sqlAllowDottedWord)) {
|
||||
int nextState = SCE_SQL_DEFAULT;
|
||||
char s[1000];
|
||||
sc.GetCurrentLowered(s, sizeof(s));
|
||||
@ -161,7 +431,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
}
|
||||
break;
|
||||
case SCE_SQL_CHARACTER:
|
||||
if (sqlBackslashEscapes && sc.ch == '\\') {
|
||||
if (options.sqlBackslashEscapes && sc.ch == '\\') {
|
||||
sc.Forward();
|
||||
} else if (sc.ch == '\'') {
|
||||
if (sc.chNext == '\"') {
|
||||
@ -191,7 +461,7 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
sc.SetState(SCE_SQL_NUMBER);
|
||||
} else if (IsAWordStart(sc.ch)) {
|
||||
sc.SetState(SCE_SQL_IDENTIFIER);
|
||||
} else if (sc.ch == 0x60 && sqlBackticksIdentifier) {
|
||||
} else if (sc.ch == 0x60 && options.sqlBackticksIdentifier) {
|
||||
sc.SetState(SCE_SQL_QUOTEDIDENTIFIER);
|
||||
} else if (sc.Match('/', '*')) {
|
||||
if (sc.Match("/**") || sc.Match("/*!")) { // Support of Doxygen doc. style
|
||||
@ -204,9 +474,9 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
// MySQL requires a space or control char after --
|
||||
// http://dev.mysql.com/doc/mysql/en/ansi-diff-comments.html
|
||||
// Perhaps we should enforce that with proper property:
|
||||
//~ } else if (sc.Match("-- ")) {
|
||||
//~ } else if (sc.Match("-- ")) {
|
||||
sc.SetState(SCE_SQL_COMMENTLINE);
|
||||
} else if (sc.ch == '#') {
|
||||
} else if (sc.ch == '#' && options.sqlNumbersignComment) {
|
||||
sc.SetState(SCE_SQL_COMMENTLINEDOC);
|
||||
} else if (sc.ch == '\'') {
|
||||
sc.SetState(SCE_SQL_CHARACTER);
|
||||
@ -220,25 +490,10 @@ static void ColouriseSQLDoc(unsigned int startPos, int length, int initStyle, Wo
|
||||
sc.Complete();
|
||||
}
|
||||
|
||||
static bool IsStreamCommentStyle(int style) {
|
||||
return style == SCE_SQL_COMMENT ||
|
||||
style == SCE_SQL_COMMENTDOC ||
|
||||
style == SCE_SQL_COMMENTDOCKEYWORD ||
|
||||
style == SCE_SQL_COMMENTDOCKEYWORDERROR;
|
||||
}
|
||||
|
||||
// Store both the current line's fold level and the next lines in the
|
||||
// level store to make it easy to pick up with each increment.
|
||||
static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
|
||||
WordList *[], Accessor &styler) {
|
||||
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
|
||||
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
|
||||
bool foldOnlyBegin = styler.GetPropertyInt("fold.sql.only.begin", 0) != 0;
|
||||
|
||||
// property fold.sql.exists
|
||||
// Enables "EXISTS" to end a fold as is started by "IF" in "DROP TABLE IF EXISTS".
|
||||
bool foldSqlExists = styler.GetPropertyInt("fold.sql.exists", 1) != 0;
|
||||
|
||||
void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
|
||||
if (!options.fold)
|
||||
return;
|
||||
LexAccessor styler(pAccess);
|
||||
unsigned int endPos = startPos + length;
|
||||
int visibleChars = 0;
|
||||
int lineCurrent = styler.GetLine(startPos);
|
||||
@ -251,6 +506,14 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
|
||||
int styleNext = styler.StyleAt(startPos);
|
||||
int style = initStyle;
|
||||
bool endFound = false;
|
||||
bool isUnfoldingIgnored = false;
|
||||
// this statementFound flag avoids to fold when the statement is on only one line by ignoring ELSE or ELSIF
|
||||
// eg. "IF condition1 THEN ... ELSIF condition2 THEN ... ELSE ... END IF;"
|
||||
bool statementFound = false;
|
||||
unsigned short int sqlStatesCurrentLine = 0;
|
||||
if (!options.foldOnlyBegin) {
|
||||
sqlStatesCurrentLine = sqlStates.ForLine(lineCurrent);
|
||||
}
|
||||
for (unsigned int i = startPos; i < endPos; i++) {
|
||||
char ch = chNext;
|
||||
chNext = styler.SafeGetCharAt(i + 1);
|
||||
@ -258,7 +521,16 @@ static void FoldSQLDoc(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 (atEOL || (ch == ';')) {
|
||||
if (endFound) {
|
||||
//Maybe this is the end of "EXCEPTION" BLOCK (eg. "BEGIN ... EXCEPTION ... END;")
|
||||
sqlStatesCurrentLine = sqlStates.IntoExceptionBlock(sqlStatesCurrentLine, false);
|
||||
}
|
||||
// set endFound and isUnfoldingIgnored to false if EOL is reached or ';' is found
|
||||
endFound = false;
|
||||
isUnfoldingIgnored = false;
|
||||
}
|
||||
if (options.foldComment && IsStreamCommentStyle(style)) {
|
||||
if (!IsStreamCommentStyle(stylePrev)) {
|
||||
levelNext++;
|
||||
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
|
||||
@ -266,7 +538,7 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
|
||||
levelNext--;
|
||||
}
|
||||
}
|
||||
if (foldComment && (style == SCE_SQL_COMMENTLINE)) {
|
||||
if (options.foldComment && (style == SCE_SQL_COMMENTLINE)) {
|
||||
// MySQL needs -- comments to be followed by space or control char
|
||||
if ((ch == '-') && (chNext == '-')) {
|
||||
char chNext2 = styler.SafeGetCharAt(i + 2);
|
||||
@ -280,14 +552,18 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
if (style == SCE_SQL_OPERATOR) {
|
||||
if (ch == '(') {
|
||||
levelNext++;
|
||||
if (levelCurrent > levelNext)
|
||||
levelCurrent--;
|
||||
levelNext++;
|
||||
} else if (ch == ')') {
|
||||
levelNext--;
|
||||
} else if ((!options.foldOnlyBegin) && ch == ';') {
|
||||
sqlStatesCurrentLine = sqlStates.IgnoreWhen(sqlStatesCurrentLine, false);
|
||||
}
|
||||
}
|
||||
// If new keyword (cannot trigger on elseif or nullif, does less tests)
|
||||
if (style == SCE_SQL_WORD && stylePrev != SCE_SQL_WORD) {
|
||||
const int MAX_KW_LEN = 6; // Maximum length of folding keywords
|
||||
const int MAX_KW_LEN = 9; // Maximum length of folding keywords
|
||||
char s[MAX_KW_LEN + 2];
|
||||
unsigned int j = 0;
|
||||
for (; j < MAX_KW_LEN + 1; j++) {
|
||||
@ -302,33 +578,133 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
|
||||
} else {
|
||||
s[j] = '\0';
|
||||
}
|
||||
if ((!foldOnlyBegin) && (strcmp(s, "if") == 0 || strcmp(s, "loop") == 0)) {
|
||||
|
||||
if (strcmp(s, "if") == 0) {
|
||||
if (endFound) {
|
||||
// ignore
|
||||
endFound = false;
|
||||
if (options.foldOnlyBegin && !isUnfoldingIgnored) {
|
||||
// this end isn't for begin block, but for if block ("end if;")
|
||||
// so ignore previous "end" by increment levelNext.
|
||||
levelNext++;
|
||||
}
|
||||
} else {
|
||||
levelNext++;
|
||||
if (!options.foldOnlyBegin)
|
||||
sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, true);
|
||||
if (levelCurrent > levelNext) {
|
||||
// doesn't include this line into the folding block
|
||||
// because doesn't hide IF (eg "END; IF")
|
||||
levelCurrent = levelNext;
|
||||
}
|
||||
}
|
||||
} else if (!options.foldOnlyBegin &&
|
||||
strcmp(s, "then") == 0 &&
|
||||
sqlStates.IsIntoCondition(sqlStatesCurrentLine)) {
|
||||
sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, false);
|
||||
if (!options.foldOnlyBegin) {
|
||||
if (levelCurrent > levelNext) {
|
||||
levelCurrent = levelNext;
|
||||
}
|
||||
if (!statementFound)
|
||||
levelNext++;
|
||||
|
||||
statementFound = true;
|
||||
} else if (levelCurrent > levelNext) {
|
||||
// doesn't include this line into the folding block
|
||||
// because doesn't hide LOOP or CASE (eg "END; LOOP" or "END; CASE")
|
||||
levelCurrent = levelNext;
|
||||
}
|
||||
} else if (strcmp(s, "loop") == 0 ||
|
||||
strcmp(s, "case") == 0) {
|
||||
if (endFound) {
|
||||
endFound = false;
|
||||
if (options.foldOnlyBegin && !isUnfoldingIgnored) {
|
||||
// this end isn't for begin block, but for loop block ("end loop;") or case block ("end case;")
|
||||
// so ignore previous "end" by increment levelNext.
|
||||
levelNext++;
|
||||
}
|
||||
if ((!options.foldOnlyBegin) && strcmp(s, "case") == 0) {
|
||||
sqlStatesCurrentLine = sqlStates.EndCaseBlock(sqlStatesCurrentLine);
|
||||
levelNext--; //again for the "end case;" and block when
|
||||
}
|
||||
} else if (!options.foldOnlyBegin) {
|
||||
if (strcmp(s, "case") == 0) {
|
||||
sqlStatesCurrentLine = sqlStates.BeginCaseBlock(sqlStatesCurrentLine);
|
||||
|
||||
//for case block increment 2 times
|
||||
if (!statementFound)
|
||||
levelNext++;
|
||||
}
|
||||
|
||||
if (levelCurrent > levelNext) {
|
||||
levelCurrent = levelNext;
|
||||
}
|
||||
if (!statementFound)
|
||||
levelNext++;
|
||||
|
||||
statementFound = true;
|
||||
} else if (levelCurrent > levelNext) {
|
||||
// doesn't include this line into the folding block
|
||||
// because doesn't hide LOOP or CASE (eg "END; LOOP" or "END; CASE")
|
||||
levelCurrent = levelNext;
|
||||
}
|
||||
} else if ((!options.foldOnlyBegin) && (
|
||||
// folding for ELSE and ELSIF block only if foldAtElse is set
|
||||
// and IF or CASE aren't on only one line with ELSE or ELSIF (with flag statementFound)
|
||||
options.foldAtElse && !statementFound) && strcmp(s, "elsif") == 0) {
|
||||
sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, true);
|
||||
levelCurrent--;
|
||||
levelNext--;
|
||||
} else if ((!options.foldOnlyBegin) && (
|
||||
// folding for ELSE and ELSIF block only if foldAtElse is set
|
||||
// and IF or CASE aren't on only one line with ELSE or ELSIF (with flag statementFound)
|
||||
options.foldAtElse && !statementFound) && strcmp(s, "else") == 0) {
|
||||
// prevent also ELSE is on the same line (eg. "ELSE ... END IF;")
|
||||
statementFound = true;
|
||||
// we are in same case "} ELSE {" in C language
|
||||
levelCurrent--;
|
||||
|
||||
} else if (strcmp(s, "begin") == 0) {
|
||||
levelNext++;
|
||||
sqlStatesCurrentLine = sqlStates.IntoDeclareBlock(sqlStatesCurrentLine, false);
|
||||
} else if ((strcmp(s, "end") == 0) ||
|
||||
// // DROP TABLE IF EXISTS or CREATE TABLE IF NOT EXISTS
|
||||
(foldSqlExists && (strcmp(s, "exists") == 0)) ||
|
||||
// // SQL Anywhere permits IF ... ELSE ... ENDIF
|
||||
// // will only be active if "endif" appears in the
|
||||
// // keyword list.
|
||||
(strcmp(s, "endif") == 0)) {
|
||||
// SQL Anywhere permits IF ... ELSE ... ENDIF
|
||||
// will only be active if "endif" appears in the
|
||||
// keyword list.
|
||||
(strcmp(s, "endif") == 0)) {
|
||||
endFound = true;
|
||||
levelNext--;
|
||||
if (levelNext < SC_FOLDLEVELBASE) {
|
||||
levelNext = SC_FOLDLEVELBASE;
|
||||
isUnfoldingIgnored = true;
|
||||
}
|
||||
} else if ((!options.foldOnlyBegin) &&
|
||||
strcmp(s, "when") == 0 &&
|
||||
!sqlStates.IsIgnoreWhen(sqlStatesCurrentLine) &&
|
||||
!sqlStates.IsIntoExceptionBlock(sqlStatesCurrentLine) &&
|
||||
sqlStates.IsIntoCaseBlock(sqlStatesCurrentLine)) {
|
||||
sqlStatesCurrentLine = sqlStates.IntoCondition(sqlStatesCurrentLine, true);
|
||||
|
||||
// Don't foldind when CASE and WHEN are on the same line (with flag statementFound) (eg. "CASE selector WHEN expression1 THEN sequence_of_statements1;\n")
|
||||
if (!statementFound) {
|
||||
levelCurrent--;
|
||||
levelNext--;
|
||||
}
|
||||
} else if ((!options.foldOnlyBegin) && strcmp(s, "exit") == 0) {
|
||||
sqlStatesCurrentLine = sqlStates.IgnoreWhen(sqlStatesCurrentLine, true);
|
||||
} else if ((!options.foldOnlyBegin) && !sqlStates.IsIntoDeclareBlock(sqlStatesCurrentLine) && strcmp(s, "exception") == 0) {
|
||||
sqlStatesCurrentLine = sqlStates.IntoExceptionBlock(sqlStatesCurrentLine, true);
|
||||
} else if ((!options.foldOnlyBegin) &&
|
||||
(strcmp(s, "declare") == 0 ||
|
||||
strcmp(s, "function") == 0 ||
|
||||
strcmp(s, "procedure") == 0 ||
|
||||
strcmp(s, "package") == 0)) {
|
||||
sqlStatesCurrentLine = sqlStates.IntoDeclareBlock(sqlStatesCurrentLine, true);
|
||||
}
|
||||
}
|
||||
if (atEOL) {
|
||||
int levelUse = levelCurrent;
|
||||
int lev = levelUse | levelNext << 16;
|
||||
if (visibleChars == 0 && foldCompact)
|
||||
if (visibleChars == 0 && options.foldCompact)
|
||||
lev |= SC_FOLDLEVELWHITEFLAG;
|
||||
if (levelUse < levelNext)
|
||||
lev |= SC_FOLDLEVELHEADERFLAG;
|
||||
@ -338,7 +714,9 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
|
||||
lineCurrent++;
|
||||
levelCurrent = levelNext;
|
||||
visibleChars = 0;
|
||||
endFound = false;
|
||||
statementFound = false;
|
||||
if (!options.foldOnlyBegin)
|
||||
sqlStates.Set(lineCurrent, sqlStatesCurrentLine);
|
||||
}
|
||||
if (!isspacechar(ch)) {
|
||||
visibleChars++;
|
||||
@ -346,16 +724,4 @@ static void FoldSQLDoc(unsigned int startPos, int length, int initStyle,
|
||||
}
|
||||
}
|
||||
|
||||
static const char * const sqlWordListDesc[] = {
|
||||
"Keywords",
|
||||
"Database Objects",
|
||||
"PLDoc",
|
||||
"SQL*Plus",
|
||||
"User Keywords 1",
|
||||
"User Keywords 2",
|
||||
"User Keywords 3",
|
||||
"User Keywords 4",
|
||||
0
|
||||
};
|
||||
|
||||
LexerModule lmSQL(SCLEX_SQL, ColouriseSQLDoc, "sql", FoldSQLDoc, sqlWordListDesc);
|
||||
LexerModule lmSQL(SCLEX_SQL, LexerSQL::LexerFactorySQL, "sql", sqlWordListDesc);
|
||||
|
@ -14,7 +14,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -18,7 +18,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -42,7 +42,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -19,7 +19,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -27,7 +27,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -16,7 +16,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -21,7 +21,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
@ -17,7 +17,6 @@
|
||||
#include "Scintilla.h"
|
||||
#include "SciLexer.h"
|
||||
|
||||
#include "PropSetSimple.h"
|
||||
#include "WordList.h"
|
||||
#include "LexAccessor.h"
|
||||
#include "Accessor.h"
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user