Upgrade Scintilla from v3.56 to v4.14

This commit is contained in:
Don HO 2019-05-04 21:14:48 +03:00
parent b2191e9e6f
commit 37c4b894cc
No known key found for this signature in database
GPG Key ID: 6C429F1D8D84F46E
362 changed files with 53784 additions and 34736 deletions

20
scintilla/CONTRIBUTING Normal file
View File

@ -0,0 +1,20 @@
Fixes should be posted to the Bug Tracker
http://sourceforge.net/p/scintilla/bugs/
Features should be posted to the Feature Request Tracker
http://sourceforge.net/p/scintilla/feature-requests/
Either send unified diffs (or patch files) or zip archives with whole files.
Mercurial patch files are best as they include author information and commit
messages.
Questions should go to the scintilla-interest mailing list
https://groups.google.com/forum/#!forum/scintilla-interest
Code should follow the guidelines at
http://www.scintilla.org/SciCoding.html
Do not use SourceForge's Merge Request mechanism or message sending
feature as no one is monitoring these.
The neilh @ scintilla.org account receives much spam and is only checked
occasionally. Almost all Scintilla mail should go to the mailing list.

View File

@ -6,9 +6,11 @@ To build SciTE, Scintilla must first be built.
*** GTK+/Linux version ***
You must first have GTK+ 2.0 or later and GCC (4.1 or better) installed.
GTK+ 1.x will not work.
You must first have GTK+ 2.24 or later and GCC (7.1 or better) installed.
Clang may be used by adding CLANG=1 to the make command line.
Other C++ compilers may work but may require tweaking the make file.
Either GTK+ 2.x or 3.x may be used with 2.x the default and 3.x
chosen with the make argument GTK3=1.
To build Scintilla, use the makefile located in the scintilla/gtk directory
cd scintilla/gtk
@ -18,7 +20,7 @@ To build Scintilla, use the makefile located in the scintilla/gtk directory
To build and install SciTE, use the makefile located in the scite/gtk directory
cd scite/gtk
make
make install
sudo make install
This installs SciTE into $prefix/bin. The value of $prefix is determined from
the location of Gnome if it is installed. This is usually /usr if installed
@ -30,7 +32,7 @@ properties file is installed at $prefix/share/scite/SciTEGlobal.properties.
The language specific properties files are also installed into this directory.
To remove SciTE
make uninstall
sudo make uninstall
To clean the object files which may be needed to change $prefix
make clean
@ -40,28 +42,44 @@ The current make file only supports static linking between SciTE and Scintilla.
*** Windows version ***
A C++ compiler is required. Visual Studio 2010 is the development system
used for most development although TDM Mingw32 4.7.1 is also supported.
A C++ 17 compiler is required.
Visual Studio 2017 is the development system used for most development
although Mingw-w64 7.1 is also supported.
To build Scintilla, make in the scintilla/win32 directory
cd scintilla\win32
GCC: mingw32-make
VS .NET: nmake -f scintilla.mak
Visual C++: nmake -f scintilla.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
Visual C++: nmake -f scite.mak
An executable SciTE will now be in scite/bin.
*** GTK+/Windows version ***
Mingw32 is known to work. Other compilers will probably not work.
Mingw-w64 is known to work. Other compilers will probably not work.
Only Scintilla will build with GTK+ on Windows. SciTE will not work.
To build Scintilla, make in the scintilla/gtk directory
cd scintilla\gtk
mingw32-make
*** macOS Cocoa version ***
Xcode 9.2 or later may be used to build Scintilla on macOS.
There is no open source version of SciTE for macOS but there is a commercial
version available through the App Store.
To build Scintilla, run xcodebuild in the scintilla/cocoa/ScintillaFramework directory
cd cocoa/ScintillaFramework
xcodebuild
*** Qt version ***
See the qt/README file to build Scintilla with Qt.

Binary file not shown.

View File

@ -1,9 +1,7 @@
#ifndef ANSIDOCUMENTITERATOR_H_12481491281240
#define ANSIDOCUMENTITERATOR_H_12481491281240
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
class AnsiDocumentIterator : public std::iterator<std::bidirectional_iterator_tag, char>
{
@ -94,9 +92,6 @@ private:
int m_end;
Document* m_doc;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -4,17 +4,26 @@
* Converted from boost::xpressive to boost::regex and performance improvements
* (principally caching the compiled regex), and support for UTF8 encoded text
* (c) 2012 Dave Brotherstone - Changes for boost::regex
* (c) 2013 Francois-R.Boyer@PolyMtl.ca - Empty match modes and best match backward search.
* (c) 2013 Francois-R.Boyer@PolyMtl.ca - Empty match modes and best match backward search
* (c) 2019 Don Ho - Adapt for upgrading Scitilla (to version 4.1.4) and boost (to version 1.70)
*
*/
#include <stdlib.h>
#include <iterator>
#include <vector>
#include "scintilla.h"
#include "Scintilla.h"
#include "Platform.h"
#include "ILoader.h"
#include "ILexer.h"
#include "Position.h"
#include "UniqueString.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "ContractionState.h"
#include "CellBuffer.h"
#include "CharClassify.h"
#include "Decoration.h"
@ -29,12 +38,9 @@
#define CP_UTF8 65001
#define SC_CP_UTF8 65001
#define _SILENCE_ALL_CXX17_DEPRECATION_WARNI
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
using namespace boost;
class BoostRegexSearch : public RegexSearchBase
@ -48,7 +54,7 @@ public:
_substituted = NULL;
}
virtual long FindText(Document* doc, int startPosition, int endPosition, const char *regex,
virtual Sci::Position FindText(Document* doc, Sci::Position minPos, Sci::Position maxPos, const char *regex,
bool caseSensitive, bool word, bool wordStart, int sciSearchFlags, int *lengthRet);
virtual const char *SubstituteByPosition(Document* doc, const char *text, int *length);
@ -139,7 +145,7 @@ private:
}
}
virtual void NotifyDeleted(Document* deletedDocument, void* /*userData*/)
virtual void NotifyDeleted(Document* deletedDocument, void* /*userData*/) noexcept
{
if (deletedDocument == _document)
{
@ -236,28 +242,22 @@ private:
int _lastDirection;
};
#ifdef SCI_NAMESPACE
namespace Scintilla
{
#endif
#ifdef SCI_OWNREGEX
RegexSearchBase *CreateRegexSearch(CharClassify* /* charClassTable */)
{
return new BoostRegexSearch();
}
#endif
#ifdef SCI_NAMESPACE
}
#endif
/**
* Find text in document, supporting both forward and backward
* searches (just pass startPosition > endPosition to do a backward search).
*/
long BoostRegexSearch::FindText(Document* doc, int startPosition, int endPosition, const char *regexString,
Sci::Position BoostRegexSearch::FindText(Document* doc, Sci::Position startPosition, Sci::Position endPosition, const char *regexString,
bool caseSensitive, bool /*word*/, bool /*wordStart*/, int sciSearchFlags, int *lengthRet)
{
try {
@ -453,19 +453,21 @@ char *BoostRegexSearch::EncodingDependent<CharT, CharacterIterator>::SubstituteB
wchar_t *BoostRegexSearch::utf8ToWchar(const char *utf8)
{
size_t utf8Size = strlen(utf8);
size_t wcharSize = UTF16Length(utf8, utf8Size);
std::string s(utf8, utf8Size);
size_t wcharSize = UTF16Length(s);
wchar_t *w = new wchar_t[wcharSize + 1];
UTF16FromUTF8(utf8, utf8Size, w, wcharSize + 1);
UTF16FromUTF8(s, w, wcharSize + 1);
w[wcharSize] = 0;
return w;
}
char *BoostRegexSearch::wcharToUtf8(const wchar_t *w)
{
int wcharSize = static_cast<int>(wcslen(w));
int charSize = UTF8Length(w, wcharSize);
//int wcharSize = static_cast<int>(wcslen(w));
std::wstring ws(w);
int charSize = UTF8Length(ws);
char *c = new char[charSize + 1];
UTF8FromUTF16(w, wcharSize, c, charSize);
UTF8FromUTF16(ws, c, charSize);
c[charSize] = 0;
return c;
}

View File

@ -1,8 +1,84 @@
#include "UTF8DocumentIterator.h"
#ifdef SCI_NAMESPACE
#include "ILoader.h"
#include "ILexer.h"
#include "Scintilla.h"
#include "CharacterCategory.h"
#include "Position.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "CellBuffer.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "CaseFolder.h"
#include "Document.h"
using namespace Scintilla;
#endif
UTF8DocumentIterator::UTF8DocumentIterator(Document* doc, int pos, int end) :
m_doc(doc),
m_pos(pos),
m_end(end),
m_characterIndex(0)
{
// Check for debug builds
PLATFORM_ASSERT(m_pos <= m_end);
// Ensure for release.
if (m_pos > m_end)
{
m_pos = m_end;
}
readCharacter();
}
UTF8DocumentIterator::UTF8DocumentIterator(const UTF8DocumentIterator& copy) :
m_doc(copy.m_doc),
m_pos(copy.m_pos),
m_end(copy.m_end),
m_characterIndex(copy.m_characterIndex),
m_utf8Length(copy.m_utf8Length),
m_utf16Length(copy.m_utf16Length)
{
// Check for debug builds
PLATFORM_ASSERT(m_pos <= m_end);
m_character[0] = copy.m_character[0];
m_character[1] = copy.m_character[1];
// Ensure for release.
if (m_pos > m_end)
{
m_pos = m_end;
}
}
UTF8DocumentIterator& UTF8DocumentIterator::operator -- ()
{
if (m_utf16Length == 2 && m_characterIndex == 1)
{
m_characterIndex = 0;
}
else
{
--m_pos;
// Skip past the UTF-8 extension bytes
while (0x80 == (m_doc->CharAt(m_pos) & 0xC0) && m_pos > 0)
--m_pos;
readCharacter();
if (m_utf16Length == 2)
{
m_characterIndex = 1;
}
}
return *this;
}
void UTF8DocumentIterator::readCharacter()
{

View File

@ -5,21 +5,10 @@
#include <iterator>
#include <vector>
#include "Platform.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
#include "CellBuffer.h"
#include "CharClassify.h"
#include "Decoration.h"
#include <ILexer.h>
#include "CaseFolder.h"
#include <Document.h>
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
class Document;
class UTF8DocumentIterator : public std::iterator<std::bidirectional_iterator_tag, wchar_t>
{
@ -34,42 +23,8 @@ public:
{
}
UTF8DocumentIterator(Document* doc, int pos, int end) :
m_doc(doc),
m_pos(pos),
m_end(end),
m_characterIndex(0)
{
// Check for debug builds
PLATFORM_ASSERT(m_pos <= m_end);
// Ensure for release.
if (m_pos > m_end)
{
m_pos = m_end;
}
readCharacter();
}
UTF8DocumentIterator(const UTF8DocumentIterator& copy) :
m_doc(copy.m_doc),
m_pos(copy.m_pos),
m_end(copy.m_end),
m_characterIndex(copy.m_characterIndex),
m_utf8Length(copy.m_utf8Length),
m_utf16Length(copy.m_utf16Length)
{
// Check for debug builds
PLATFORM_ASSERT(m_pos <= m_end);
m_character[0] = copy.m_character[0];
m_character[1] = copy.m_character[1];
// Ensure for release.
if (m_pos > m_end)
{
m_pos = m_end;
}
}
UTF8DocumentIterator(Document* doc, int pos, int end);
UTF8DocumentIterator(const UTF8DocumentIterator& copy);
bool operator == (const UTF8DocumentIterator& other) const
{
@ -113,27 +68,7 @@ public:
return *this;
}
UTF8DocumentIterator& operator -- ()
{
if (m_utf16Length == 2 && m_characterIndex == 1)
{
m_characterIndex = 0;
}
else
{
--m_pos;
// Skip past the UTF-8 extension bytes
while (0x80 == (m_doc->CharAt(m_pos) & 0xC0) && m_pos > 0)
--m_pos;
readCharacter();
if (m_utf16Length == 2)
{
m_characterIndex = 1;
}
}
return *this;
}
UTF8DocumentIterator& operator -- ();
int pos() const
{
@ -159,8 +94,6 @@ private:
static const unsigned char m_firstByteMask[];
};
#ifdef SCI_NAMESPACE
}
#endif
#endif // UTF8DOCUMENTITERATOR_H_3452843291318441149

View File

@ -0,0 +1,42 @@
# This makefile should be included in the main scintilla.mak file,
# just after where LOBJS is defined (around line
#
# The following line should be added around line 211 of scintilla.mak
# !INCLUDE nppSpecifics.mak
# Set your boost path (the root of where you've unpacked your boost zip).
# Boost is available from www.boost.org
!IFDEF BOOSTPATH
!IFDEF BOOSTREGEXLIBPATH
SOBJS=\
$(SOBJS)\
$(DIR_O)\BoostRegexSearch.obj\
$(DIR_O)\UTF8DocumentIterator.obj
SCILEXOBJS=\
$(SCILEXOBJS)\
$(DIR_O)\BoostRegexSearch.obj\
$(DIR_O)\UTF8DocumentIterator.obj
LOBJS=\
$(LOBJS)\
$(DIR_O)\BoostRegexSearch.obj\
$(DIR_O)\UTF8DocumentIterator.obj
INCLUDEDIRS=$(INCLUDEDIRS) -I$(BOOSTPATH)
CXXFLAGS=$(CXXFLAGS) -DSCI_OWNREGEX -arch:IA32
LDFLAGS=$(LDFLAGS) -LIBPATH:$(BOOSTREGEXLIBPATH)
$(DIR_O)\UTF8DocumentIterator.obj:: ../boostregex/UTF8DocumentIterator.cxx
$(CC) $(CXXFLAGS) -c ../boostregex/UTF8DocumentIterator.cxx
$(DIR_O)\BoostRegexSearch.obj:: ../boostregex/BoostRegexSearch.cxx ../src/CharClassify.h ../src/RESearch.h
$(CC) $(CXXFLAGS) -c ../boostregex/BoostRegexSearch.cxx
!ENDIF
!ENDIF

View File

@ -16,31 +16,29 @@
/**
* Extended text cell for vertically aligned text.
*/
@interface VerticallyCenteredTextFieldCell : NSTextFieldCell
{
@interface VerticallyCenteredTextFieldCell : NSTextFieldCell {
BOOL mIsEditingOrSelecting;
}
@end
@interface InfoBar : NSView <InfoBarCommunicator>
{
@interface InfoBar : NSView <InfoBarCommunicator> {
@private
NSImage* mBackground;
NSImage *mBackground;
IBDisplay mDisplayMask;
float mScaleFactor;
NSPopUpButton* mZoomPopup;
NSPopUpButton *mZoomPopup;
int mCurrentCaretX;
int mCurrentCaretY;
NSTextField* mCaretPositionLabel;
NSTextField* mStatusTextLabel;
NSTextField *mCaretPositionLabel;
NSTextField *mStatusTextLabel;
id <InfoBarCommunicator> mCallback;
}
- (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location
- (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location
value: (float) value;
- (void) setCallback: (id <InfoBarCommunicator>) callback;

View File

@ -18,23 +18,20 @@
// Inspired by code from Daniel Jalkut, Red Sweater Software.
- (NSRect) drawingRectForBounds: (NSRect) theRect
{
- (NSRect) drawingRectForBounds: (NSRect) theRect {
// Get the parent's idea of where we should draw
NSRect newRect = [super drawingRectForBounds: theRect];
// When the text field is being edited or selected, we have to turn off the magic because it
// screws up the configuration of the field editor. We sneak around this by intercepting
// selectWithFrame and editWithFrame and sneaking a reduced, centered rect in at the last minute.
if (mIsEditingOrSelecting == NO)
{
if (mIsEditingOrSelecting == NO) {
// Get our ideal size for current text
NSSize textSize = [self cellSizeForBounds: theRect];
// Center that in the proposed rect
CGFloat heightDelta = newRect.size.height - textSize.height;
if (heightDelta > 0)
{
if (heightDelta > 0) {
newRect.size.height -= heightDelta;
newRect.origin.y += ceil(heightDelta / 2);
}
@ -45,9 +42,8 @@
//--------------------------------------------------------------------------------------------------
- (void) selectWithFrame: (NSRect) aRect inView: (NSView*) controlView editor: (NSText*) textObj
delegate:(id) anObject start: (NSInteger) selStart length: (NSInteger) selLength
{
- (void) selectWithFrame: (NSRect) aRect inView: (NSView *) controlView editor: (NSText *) textObj
delegate: (id) anObject start: (NSInteger) selStart length: (NSInteger) selLength {
aRect = [self drawingRectForBounds: aRect];
mIsEditingOrSelecting = YES;
[super selectWithFrame: aRect
@ -61,9 +57,8 @@
//--------------------------------------------------------------------------------------------------
- (void) editWithFrame: (NSRect) aRect inView: (NSView*) controlView editor: (NSText*) textObj
delegate: (id) anObject event: (NSEvent*) theEvent
{
- (void) editWithFrame: (NSRect) aRect inView: (NSView *) controlView editor: (NSText *) textObj
delegate: (id) anObject event: (NSEvent *) theEvent {
aRect = [self drawingRectForBounds: aRect];
mIsEditingOrSelecting = YES;
[super editWithFrame: aRect
@ -80,16 +75,18 @@
@implementation InfoBar
- (id) initWithFrame: (NSRect) frame
{
- (instancetype) initWithFrame: (NSRect) frame {
self = [super initWithFrame: frame];
if (self)
{
NSBundle* bundle = [NSBundle bundleForClass: [InfoBar class]];
if (self) {
NSBundle *bundle = [NSBundle bundleForClass: [InfoBar class]];
NSString* path = [bundle pathForResource: @"info_bar_bg" ofType: @"tiff" inDirectory: nil];
NSString *path = [bundle pathForResource: @"info_bar_bg" ofType: @"tiff" inDirectory: nil];
// macOS 10.13 introduced bug where pathForResource: fails on SMB share
if (path == nil) {
path = [bundle.bundlePath stringByAppendingPathComponent: @"Resources/info_bar_bg.tiff"];
}
mBackground = [[NSImage alloc] initWithContentsOfFile: path];
if (![mBackground isValid])
if (!mBackground.valid)
NSLog(@"Background image for info bar is invalid.");
mScaleFactor = 1.0;
@ -110,11 +107,9 @@
* @param location Carries the new location (e.g. caret) if the type is a caret change or similar type.
* @param value Carries the new zoom value if the type is a zoom change.
*/
- (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location
value: (float) value
{
switch (type)
{
- (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location
value: (float) value {
switch (type) {
case IBNZoomChanged:
[self setScaleFactor: value adjustPopup: YES];
break;
@ -122,7 +117,7 @@
[self setCaretPosition: location];
break;
case IBNStatusChanged:
[mStatusTextLabel setStringValue: message];
mStatusTextLabel.stringValue = message;
break;
}
}
@ -132,8 +127,7 @@
/**
* Used to set a protocol object we can use to send change notifications to.
*/
- (void) setCallback: (id <InfoBarCommunicator>) callback
{
- (void) setCallback: (id <InfoBarCommunicator>) callback {
mCallback = callback;
}
@ -148,34 +142,32 @@ static float DefaultScaleMenuFactors[] = {
static unsigned DefaultScaleMenuSelectedItemIndex = 4;
static float BarFontSize = 10.0;
- (void) createItems
{
- (void) createItems {
// 1) The zoom popup.
unsigned numberOfDefaultItems = sizeof(DefaultScaleMenuLabels) / sizeof(NSString *);
// Create the popup button.
mZoomPopup = [[NSPopUpButton allocWithZone:[self zone]] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0) pullsDown: NO];
mZoomPopup = [[NSPopUpButton alloc] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0) pullsDown: NO];
// No border or background please.
[[mZoomPopup cell] setBordered: NO];
[[mZoomPopup cell] setArrowPosition: NSPopUpArrowAtBottom];
[mZoomPopup.cell setBordered: NO];
[mZoomPopup.cell setArrowPosition: NSPopUpArrowAtBottom];
// Fill it.
for (unsigned count = 0; count < numberOfDefaultItems; count++)
{
for (unsigned count = 0; count < numberOfDefaultItems; count++) {
[mZoomPopup addItemWithTitle: NSLocalizedStringFromTable(DefaultScaleMenuLabels[count], @"ZoomValues", nil)];
id currentItem = [mZoomPopup itemAtIndex: count];
if (DefaultScaleMenuFactors[count] != 0.0)
[currentItem setRepresentedObject: [NSNumber numberWithFloat: DefaultScaleMenuFactors[count]]];
[currentItem setRepresentedObject: @(DefaultScaleMenuFactors[count])];
}
[mZoomPopup selectItemAtIndex: DefaultScaleMenuSelectedItemIndex];
// Hook it up.
[mZoomPopup setTarget: self];
[mZoomPopup setAction: @selector(zoomItemAction:)];
mZoomPopup.target = self;
mZoomPopup.action = @selector(zoomItemAction:);
// Set a suitable font.
[mZoomPopup setFont: [NSFont menuBarFontOfSize: BarFontSize]];
mZoomPopup.font = [NSFont menuBarFontOfSize: BarFontSize];
// Make sure the popup is big enough to fit the cells.
[mZoomPopup sizeToFit];
@ -185,7 +177,6 @@ static float BarFontSize = 10.0;
// put it in the scrollview.
[self addSubview: mZoomPopup];
[mZoomPopup release];
// 2) The caret position label.
Class oldCellClass = [NSTextField cellClass];
@ -197,14 +188,13 @@ static float BarFontSize = 10.0;
[mCaretPositionLabel setEditable: NO];
[mCaretPositionLabel setSelectable: NO];
[mCaretPositionLabel setDrawsBackground: NO];
[mCaretPositionLabel setFont: [NSFont menuBarFontOfSize: BarFontSize]];
mCaretPositionLabel.font = [NSFont menuBarFontOfSize: BarFontSize];
NSTextFieldCell* cell = [mCaretPositionLabel cell];
[cell setPlaceholderString: @"0:0"];
[cell setAlignment: NSCenterTextAlignment];
NSTextFieldCell *cell = mCaretPositionLabel.cell;
cell.placeholderString = @"0:0";
cell.alignment = NSTextAlignmentCenter;
[self addSubview: mCaretPositionLabel];
[mCaretPositionLabel release];
// 3) The status text.
mStatusTextLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0)];
@ -213,13 +203,12 @@ static float BarFontSize = 10.0;
[mStatusTextLabel setEditable: NO];
[mStatusTextLabel setSelectable: NO];
[mStatusTextLabel setDrawsBackground: NO];
[mStatusTextLabel setFont: [NSFont menuBarFontOfSize: BarFontSize]];
mStatusTextLabel.font = [NSFont menuBarFontOfSize: BarFontSize];
cell = [mStatusTextLabel cell];
[cell setPlaceholderString: @""];
cell = mStatusTextLabel.cell;
cell.placeholderString = @"";
[self addSubview: mStatusTextLabel];
[mStatusTextLabel release];
// Restore original cell class so that everything else doesn't get broken
[NSTextField setCellClass: oldCellClass];
@ -227,52 +216,46 @@ static float BarFontSize = 10.0;
//--------------------------------------------------------------------------------------------------
- (void) dealloc
{
[mBackground release];
[super dealloc];
}
//--------------------------------------------------------------------------------------------------
/**
* Fill the background.
*/
- (void) drawRect: (NSRect) rect
{
- (void) drawRect: (NSRect) rect {
[[NSColor controlBackgroundColor] set];
[NSBezierPath fillRect: rect];
// Since the background is seamless, we don't need to take care for the proper offset.
// Simply tile the background over the invalid rectangle.
if (mBackground.size.width != 0) {
NSPoint target = {rect.origin.x, 0};
while (target.x < rect.origin.x + rect.size.width)
{
[mBackground drawAtPoint: target fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1];
while (target.x < rect.origin.x + rect.size.width) {
[mBackground drawAtPoint: target fromRect: NSZeroRect operation: NSCompositingOperationSourceOver fraction: 1];
target.x += mBackground.size.width;
}
}
// Draw separator lines between items.
NSRect verticalLineRect;
CGFloat component = 190.0 / 255.0;
NSColor* lineColor = [NSColor colorWithDeviceRed: component green: component blue: component alpha: 1];
NSColor *lineColor = [NSColor colorWithDeviceRed: component green: component blue: component alpha: 1];
if (mDisplayMask & IBShowZoom)
{
verticalLineRect = [mZoomPopup frame];
if (mDisplayMask & IBShowZoom) {
verticalLineRect = mZoomPopup.frame;
verticalLineRect.origin.x += verticalLineRect.size.width + 1.0;
verticalLineRect.size.width = 1.0;
if (NSIntersectsRect(rect, verticalLineRect))
{
if (NSIntersectsRect(rect, verticalLineRect)) {
[lineColor set];
NSRectFill(verticalLineRect);
}
}
if (mDisplayMask & IBShowCaretPosition)
{
verticalLineRect = [mCaretPositionLabel frame];
if (mDisplayMask & IBShowCaretPosition) {
verticalLineRect = mCaretPositionLabel.frame;
verticalLineRect.origin.x += verticalLineRect.size.width + 1.0;
verticalLineRect.size.width = 1.0;
if (NSIntersectsRect(rect, verticalLineRect))
{
if (NSIntersectsRect(rect, verticalLineRect)) {
[lineColor set];
NSRectFill(verticalLineRect);
}
@ -281,8 +264,7 @@ static float BarFontSize = 10.0;
//--------------------------------------------------------------------------------------------------
- (BOOL) isOpaque
{
- (BOOL) isOpaque {
return YES;
}
@ -291,45 +273,37 @@ static float BarFontSize = 10.0;
/**
* Used to reposition our content depending on the size of the view.
*/
- (void) setFrame: (NSRect) newFrame
{
[super setFrame: newFrame];
- (void) setFrame: (NSRect) newFrame {
super.frame = newFrame;
[self positionSubViews];
}
//--------------------------------------------------------------------------------------------------
- (void) positionSubViews
{
NSRect currentBounds = {{0, 0}, {0, [self frame].size.height}};
if (mDisplayMask & IBShowZoom)
{
- (void) positionSubViews {
NSRect currentBounds = {{0, 0}, {0, self.frame.size.height}};
if (mDisplayMask & IBShowZoom) {
[mZoomPopup setHidden: NO];
currentBounds.size.width = [mZoomPopup frame].size.width;
[mZoomPopup setFrame: currentBounds];
currentBounds.size.width = mZoomPopup.frame.size.width;
mZoomPopup.frame = currentBounds;
currentBounds.origin.x += currentBounds.size.width + 1; // Add 1 for the separator.
}
else
} else
[mZoomPopup setHidden: YES];
if (mDisplayMask & IBShowCaretPosition)
{
if (mDisplayMask & IBShowCaretPosition) {
[mCaretPositionLabel setHidden: NO];
currentBounds.size.width = [mCaretPositionLabel frame].size.width;
[mCaretPositionLabel setFrame: currentBounds];
currentBounds.size.width = mCaretPositionLabel.frame.size.width;
mCaretPositionLabel.frame = currentBounds;
currentBounds.origin.x += currentBounds.size.width + 1;
}
else
} else
[mCaretPositionLabel setHidden: YES];
if (mDisplayMask & IBShowStatusText)
{
if (mDisplayMask & IBShowStatusText) {
// The status text always takes the rest of the available space.
[mStatusTextLabel setHidden: NO];
currentBounds.size.width = [self frame].size.width - currentBounds.origin.x;
[mStatusTextLabel setFrame: currentBounds];
}
else
currentBounds.size.width = self.frame.size.width - currentBounds.origin.x;
mStatusTextLabel.frame = currentBounds;
} else
[mStatusTextLabel setHidden: YES];
}
@ -340,13 +314,11 @@ static float BarFontSize = 10.0;
*
* @param display Bitwise ORed IBDisplay values which determine what to show on the bar.
*/
- (void) setDisplay: (IBDisplay) display
{
if (mDisplayMask != display)
{
- (void) setDisplay: (IBDisplay) display {
if (mDisplayMask != display) {
mDisplayMask = display;
[self positionSubViews];
[self needsDisplay];
self.needsDisplay = YES;
}
}
@ -355,30 +327,23 @@ static float BarFontSize = 10.0;
/**
* Handler for selection changes in the zoom menu.
*/
- (void) zoomItemAction: (id) sender
{
NSNumber* selectedFactorObject = [[sender selectedCell] representedObject];
- (void) zoomItemAction: (id) sender {
NSNumber *selectedFactorObject = [[sender selectedCell] representedObject];
if (selectedFactorObject == nil)
{
if (selectedFactorObject == nil) {
NSLog(@"Scale popup action: setting arbitrary zoom factors is not yet supported.");
return;
}
else
{
[self setScaleFactor: [selectedFactorObject floatValue] adjustPopup: NO];
} else {
[self setScaleFactor: selectedFactorObject.floatValue adjustPopup: NO];
}
}
//--------------------------------------------------------------------------------------------------
- (void) setScaleFactor: (float) newScaleFactor adjustPopup: (BOOL) flag
{
if (mScaleFactor != newScaleFactor)
{
- (void) setScaleFactor: (float) newScaleFactor adjustPopup: (BOOL) flag {
if (mScaleFactor != newScaleFactor) {
mScaleFactor = newScaleFactor;
if (flag)
{
if (flag) {
unsigned count = 0;
unsigned numberOfDefaultItems = sizeof(DefaultScaleMenuFactors) / sizeof(float);
@ -388,16 +353,13 @@ static float BarFontSize = 10.0;
count++;
if (count == numberOfDefaultItems)
[mZoomPopup selectItemAtIndex: -1];
else
{
else {
[mZoomPopup selectItemAtIndex: count];
// Set scale factor to found preset value if it comes close.
mScaleFactor = DefaultScaleMenuFactors[count];
}
}
else
{
} else {
// Internally set. Notify owner.
[mCallback notify: IBNZoomChanged message: nil location: NSZeroPoint value: newScaleFactor];
}
@ -409,18 +371,16 @@ static float BarFontSize = 10.0;
/**
* Called from the notification method to update the caret position display.
*/
- (void) setCaretPosition: (NSPoint) position
{
- (void) setCaretPosition: (NSPoint) position {
// Make the position one-based.
int newX = (int) position.x + 1;
int newY = (int) position.y + 1;
if (mCurrentCaretX != newX || mCurrentCaretY != newY)
{
if (mCurrentCaretX != newX || mCurrentCaretY != newY) {
mCurrentCaretX = newX;
mCurrentCaretY = newY;
[mCaretPositionLabel setStringValue: [NSString stringWithFormat: @"%d:%d", newX, newY]];
mCaretPositionLabel.stringValue = [NSString stringWithFormat: @"%d:%d", newX, newY];
}
}
@ -429,20 +389,19 @@ static float BarFontSize = 10.0;
/**
* Makes the bar resize to the smallest width that can accommodate the currently enabled items.
*/
- (void) sizeToFit
{
NSRect frame = [self frame];
- (void) sizeToFit {
NSRect frame = self.frame;
frame.size.width = 0;
if (mDisplayMask & IBShowZoom)
frame.size.width += [mZoomPopup frame].size.width;
frame.size.width += mZoomPopup.frame.size.width;
if (mDisplayMask & IBShowCaretPosition)
frame.size.width += [mCaretPositionLabel frame].size.width;
frame.size.width += mCaretPositionLabel.frame.size.width;
if (mDisplayMask & IBShowStatusText)
frame.size.width += [mStatusTextLabel frame].size.width;
frame.size.width += mStatusTextLabel.frame.size.width;
[self setFrame: frame];
self.frame = frame;
}
@end

View File

@ -28,7 +28,7 @@ typedef NS_ENUM(NSInteger, NotificationType) {
};
@protocol InfoBarCommunicator
- (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location
- (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location
value: (float) value;
- (void) setCallback: (id <InfoBarCommunicator>) callback;
@end

View File

@ -7,38 +7,36 @@
#ifndef PLATCOCOA_H
#define PLATCOCOA_H
#include <assert.h>
#include <sys/time.h>
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cstdio>
#include <sys/time.h>
#include <Cocoa/Cocoa.h>
#include "QuartzTextLayout.h"
#include "Platform.h"
#include "Scintilla.h"
NSRect PRectangleToNSRect(Scintilla::PRectangle& rc);
Scintilla::PRectangle NSRectToPRectangle(NSRect& rc);
#include "QuartzTextLayout.h"
NSRect PRectangleToNSRect(const Scintilla::PRectangle &rc);
Scintilla::PRectangle NSRectToPRectangle(NSRect &rc);
CFStringEncoding EncodingFromCharacterSet(bool unicode, int characterSet);
@interface ScintillaContextMenu : NSMenu
{
Scintilla::ScintillaCocoa* owner;
@interface ScintillaContextMenu : NSMenu {
Scintilla::ScintillaCocoa *owner;
}
- (void) handleCommand: (NSMenuItem*) sender;
- (void) setOwner: (Scintilla::ScintillaCocoa*) newOwner;
- (void) handleCommand: (NSMenuItem *) sender;
- (void) setOwner: (Scintilla::ScintillaCocoa *) newOwner;
@end
namespace Scintilla {
// A class to do the actual text rendering for us using Quartz 2D.
class SurfaceImpl : public Surface
{
class SurfaceImpl : public Surface {
private:
bool unicodeMode;
float x;
@ -47,75 +45,79 @@ private:
CGContextRef gc;
/** The text layout instance */
QuartzTextLayout* textLayout;
std::unique_ptr<QuartzTextLayout> textLayout;
int codePage;
int verticalDeviceResolution;
/** If the surface is a bitmap context, contains a reference to the bitmap data. */
uint8_t* bitmapData;
std::unique_ptr<uint8_t[]> bitmapData;
/** If the surface is a bitmap context, stores the dimensions of the bitmap. */
int bitmapWidth;
int bitmapHeight;
/** Set the CGContext's fill colour to the specified desired colour. */
void FillColour( const ColourDesired& back );
void FillColour(const ColourDesired &back);
// 24-bit RGB+A bitmap data constants
static const int BITS_PER_COMPONENT = 8;
static const int BITS_PER_PIXEL = BITS_PER_COMPONENT * 4;
static const int BYTES_PER_PIXEL = BITS_PER_PIXEL / 8;
void Clear();
public:
SurfaceImpl();
~SurfaceImpl();
~SurfaceImpl() override;
void Init(WindowID wid);
void Init(SurfaceID sid, WindowID wid);
void InitPixMap(int width, int height, Surface *surface_, WindowID wid);
void Init(WindowID wid) override;
void Init(SurfaceID sid, WindowID wid) override;
void InitPixMap(int width, int height, Surface *surface_, WindowID wid) override;
CGContextRef GetContext() { return gc; }
void Release();
bool Initialised();
void PenColour(ColourDesired fore);
void Release() override;
bool Initialised() override;
void PenColour(ColourDesired fore) override;
/** Returns a CGImageRef that represents the surface. Returns NULL if this is not possible. */
CGImageRef GetImage();
void CopyImageRectangle(Surface &surfaceSource, PRectangle srcRect, PRectangle dstRect);
int LogPixelsY();
int DeviceHeightFont(int points);
void MoveTo(int x_, int y_);
void LineTo(int x_, int y_);
void Polygon(Scintilla::Point *pts, int npts, ColourDesired fore, ColourDesired back);
void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back);
void FillRectangle(PRectangle rc, ColourDesired back);
void FillRectangle(PRectangle rc, Surface &surfacePattern);
void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back);
int LogPixelsY() override;
int DeviceHeightFont(int points) override;
void MoveTo(int x_, int y_) override;
void LineTo(int x_, int y_) override;
void Polygon(Scintilla::Point *pts, size_t npts, ColourDesired fore, ColourDesired back) override;
void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void FillRectangle(PRectangle rc, ColourDesired back) override;
void FillRectangle(PRectangle rc, Surface &surfacePattern) override;
void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,
ColourDesired outline, int alphaOutline, int flags);
void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage);
void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back);
void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource);
void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore,
ColourDesired back);
void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore,
ColourDesired back);
void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore);
void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions);
XYPOSITION WidthText(Font &font_, const char *s, int len);
XYPOSITION WidthChar(Font &font_, char ch);
XYPOSITION Ascent(Font &font_);
XYPOSITION Descent(Font &font_);
XYPOSITION InternalLeading(Font &font_);
XYPOSITION ExternalLeading(Font &font_);
XYPOSITION Height(Font &font_);
XYPOSITION AverageCharWidth(Font &font_);
ColourDesired outline, int alphaOutline, int flags) override;
void GradientRectangle(PRectangle rc, const std::vector<ColourStop> &stops, GradientOptions options) override;
void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) override;
void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) override;
void Copy(PRectangle rc, Scintilla::Point from, Surface &surfaceSource) override;
std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) override;
void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore,
ColourDesired back) override;
void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore,
ColourDesired back) override;
void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore) override;
void MeasureWidths(Font &font_, std::string_view text, XYPOSITION *positions) override;
XYPOSITION WidthText(Font &font_, std::string_view text) override;
XYPOSITION Ascent(Font &font_) override;
XYPOSITION Descent(Font &font_) override;
XYPOSITION InternalLeading(Font &font_) override;
XYPOSITION Height(Font &font_) override;
XYPOSITION AverageCharWidth(Font &font_) override;
void SetClip(PRectangle rc);
void FlushCachedState();
void SetClip(PRectangle rc) override;
void FlushCachedState() override;
void SetUnicodeMode(bool unicodeMode_);
void SetDBCSMode(int codePage_);
void SetUnicodeMode(bool unicodeMode_) override;
void SetDBCSMode(int codePage_) override;
void SetBidiR2L(bool bidiR2L_) override;
}; // SurfaceImpl class
} // Scintilla namespace

File diff suppressed because it is too large Load Diff

View File

@ -16,59 +16,64 @@
#include "QuartzTextStyle.h"
class QuartzTextLayout
{
class QuartzTextLayout {
public:
/** Create a text layout for drawing on the specified context. */
explicit QuartzTextLayout( CGContextRef context )
{
mString = NULL;
mLine = NULL;
stringLength = 0;
setContext(context);
/** Create a text layout for drawing. */
QuartzTextLayout() : mString(NULL), mLine(NULL), stringLength(0) {
}
~QuartzTextLayout()
{
if ( mString != NULL )
{
~QuartzTextLayout() {
if (mString) {
CFRelease(mString);
mString = NULL;
}
if ( mLine != NULL )
{
if (mLine) {
CFRelease(mLine);
mLine = NULL;
}
}
inline void setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle& r )
{
CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false );
if (!str)
return;
CFStringEncoding setText(std::string_view sv, CFStringEncoding encoding, const QuartzTextStyle &r) {
// First clear current values in case of failure.
if (mString) {
CFRelease(mString);
mString = NULL;
}
if (mLine) {
CFRelease(mLine);
mLine = NULL;
}
const UInt8 *puiBuffer = reinterpret_cast<const UInt8 *>(sv.data());
CFStringRef str = CFStringCreateWithBytes(NULL, puiBuffer, sv.length(), encoding, false);
if (!str) {
// Failed to decode bytes into string with given encoding so try
// MacRoman which should accept any byte.
encoding = kCFStringEncodingMacRoman;
str = CFStringCreateWithBytes(NULL, puiBuffer, sv.length(), encoding, false);
}
if (!str) {
return encoding;
}
stringLength = CFStringGetLength(str);
CFMutableDictionaryRef stringAttribs = r.getCTStyle();
if (mString != NULL)
CFRelease(mString);
mString = ::CFAttributedStringCreate(NULL, str, stringAttribs);
if (mLine != NULL)
CFRelease(mLine);
mLine = ::CTLineCreateWithAttributedString(mString);
CFRelease( str );
CFRelease(str);
return encoding;
}
/** Draw the text layout into the current CGContext at the specified position.
/** Draw the text layout into a CGContext at the specified position.
* @param gc The CGContext in which to draw the text.
* @param x The x axis position to draw the baseline in the current CGContext.
* @param y The y axis position to draw the baseline in the current CGContext. */
void draw( float x, float y )
{
if (mLine == NULL)
void draw(CGContextRef gc, float x, float y) {
if (!mLine)
return;
::CGContextSetTextMatrix(gc, CGAffineTransformMakeScale(1.0, -1.0));
@ -80,8 +85,7 @@ public:
::CTLineDraw(mLine, gc);
}
float MeasureStringWidth()
{
float MeasureStringWidth() {
if (mLine == NULL)
return 0.0f;
@ -96,13 +100,7 @@ public:
return stringLength;
}
inline void setContext (CGContextRef context)
{
gc = context;
}
private:
CGContextRef gc;
CFAttributedStringRef mString;
CTLineRef mLine;
CFIndex stringLength;

View File

@ -10,11 +10,9 @@
#include "QuartzTextStyleAttribute.h"
class QuartzTextStyle
{
class QuartzTextStyle {
public:
QuartzTextStyle()
{
QuartzTextStyle() {
fontRef = NULL;
styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
&kCFTypeDictionaryKeyCallBacks,
@ -23,8 +21,7 @@ public:
characterSet = 0;
}
QuartzTextStyle(const QuartzTextStyle &other)
{
QuartzTextStyle(const QuartzTextStyle &other) {
// Does not copy font colour attribute
fontRef = static_cast<CTFontRef>(CFRetain(other.fontRef));
styleDict = CFDictionaryCreateMutable(kCFAllocatorDefault, 2,
@ -34,48 +31,39 @@ public:
characterSet = other.characterSet;
}
~QuartzTextStyle()
{
if (styleDict != NULL)
{
~QuartzTextStyle() {
if (styleDict != NULL) {
CFRelease(styleDict);
styleDict = NULL;
}
if (fontRef)
{
if (fontRef) {
CFRelease(fontRef);
fontRef = NULL;
}
}
CFMutableDictionaryRef getCTStyle() const
{
CFMutableDictionaryRef getCTStyle() const {
return styleDict;
}
void setCTStyleColor(CGColor *inColor)
{
void setCTStyleColor(CGColor *inColor) {
CFDictionarySetValue(styleDict, kCTForegroundColorAttributeName, inColor);
}
float getAscent() const
{
float getAscent() const {
return static_cast<float>(::CTFontGetAscent(fontRef));
}
float getDescent() const
{
float getDescent() const {
return static_cast<float>(::CTFontGetDescent(fontRef));
}
float getLeading() const
{
float getLeading() const {
return static_cast<float>(::CTFontGetLeading(fontRef));
}
void setFontRef(CTFontRef inRef, int characterSet_)
{
void setFontRef(CTFontRef inRef, int characterSet_) {
fontRef = inRef;
characterSet = characterSet_;
@ -89,13 +77,11 @@ public:
CFDictionaryAddValue(styleDict, kCTFontAttributeName, fontRef);
}
CTFontRef getFontRef()
{
CTFontRef getFontRef() {
return fontRef;
}
int getCharacterSet()
{
int getCharacterSet() {
return characterSet;
}

View File

@ -12,20 +12,17 @@
#ifndef _QUARTZ_TEXT_STYLE_ATTRIBUTE_H
#define _QUARTZ_TEXT_STYLE_ATTRIBUTE_H
class QuartzFont
{
class QuartzFont {
public:
/** Create a font style from a name. */
QuartzFont( const char* name, size_t length, float size, int weight, bool italic )
{
assert( name != NULL && length > 0 && name[length] == '\0' );
QuartzFont(const char *name, size_t length, float size, int weight, bool italic) {
assert(name != NULL && length > 0 && name[length] == '\0');
CFStringRef fontName = CFStringCreateWithCString(kCFAllocatorDefault, name, kCFStringEncodingMacRoman);
assert(fontName != NULL);
bool bold = weight > SC_WEIGHT_NORMAL;
if (bold || italic)
{
if (bold || italic) {
CTFontSymbolicTraits desiredTrait = 0;
CTFontSymbolicTraits traitMask = 0;
@ -44,24 +41,18 @@ public:
// create a font and then a copy of it with the sym traits
CTFontRef iFont = ::CTFontCreateWithName(fontName, size, NULL);
fontid = ::CTFontCreateCopyWithSymbolicTraits(iFont, size, NULL, desiredTrait, traitMask);
if (fontid)
{
if (fontid) {
CFRelease(iFont);
}
else
{
} else {
// Traits failed so use base font
fontid = iFont;
}
}
else
{
} else {
// create the font, no traits
fontid = ::CTFontCreateWithName(fontName, size, NULL);
}
if (!fontid)
{
if (!fontid) {
// Failed to create requested font so use font always present
fontid = ::CTFontCreateWithName((CFStringRef)@"Monaco", size, NULL);
}
@ -69,8 +60,7 @@ public:
CFRelease(fontName);
}
CTFontRef getFontID()
{
CTFontRef getFontID() {
return fontid;
}

View File

@ -13,16 +13,18 @@
* This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt).
*/
#include <stdlib.h>
#include <stdio.h>
#include <time.h>
#include <ctype.h>
#include <cstddef>
#include <cstdlib>
#include <cstdio>
#include <ctime>
#include <stdexcept>
#include <string>
#include <vector>
#include <map>
#include <memory>
#include "ILoader.h"
#include "ILexer.h"
#ifdef SCI_LEXER
@ -30,6 +32,8 @@
#include "PropSetSimple.h"
#endif
#include "Position.h"
#include "UniqueString.h"
#include "SplitVector.h"
#include "Partitioning.h"
#include "RunStyles.h"
@ -38,7 +42,6 @@
#include "CallTip.h"
#include "KeyMap.h"
#include "Indicator.h"
#include "XPM.h"
#include "LineMarker.h"
#include "Style.h"
#include "ViewStyle.h"
@ -47,6 +50,8 @@
#include "CaseFolder.h"
#include "Document.h"
#include "CaseConvert.h"
#include "UniConversion.h"
#include "DBCS.h"
#include "Selection.h"
#include "PositionCache.h"
#include "EditModel.h"
@ -57,7 +62,7 @@
#include "AutoComplete.h"
#include "ScintillaBase.h"
extern "C" NSString* ScintillaRecPboardType;
extern "C" NSString *ScintillaRecPboardType;
@class SCIContentView;
@class SCIMarginView;
@ -68,15 +73,14 @@ extern "C" NSString* ScintillaRecPboardType;
/**
* Helper class to be used as timer target (NSTimer).
*/
@interface TimerTarget : NSObject
{
void* mTarget;
NSNotificationQueue* notificationQueue;
@interface TimerTarget : NSObject {
void *mTarget;
NSNotificationQueue *notificationQueue;
}
- (id) init: (void*) target;
- (void) timerFired: (NSTimer*) timer;
- (void) idleTimerFired: (NSTimer*) timer;
- (void) idleTriggered: (NSNotification*) notification;
- (id) init: (void *) target;
- (void) timerFired: (NSTimer *) timer;
- (void) idleTimerFired: (NSTimer *) timer;
- (void) idleTriggered: (NSNotification *) notification;
@end
namespace Scintilla {
@ -84,11 +88,11 @@ namespace Scintilla {
/**
* Main scintilla class, implemented for OS X (Cocoa).
*/
class ScintillaCocoa : public ScintillaBase
{
class ScintillaCocoa : public ScintillaBase {
private:
TimerTarget* timerTarget;
NSEvent* lastMouseEvent;
ScintillaView *sciView;
TimerTarget *timerTarget;
NSEvent *lastMouseEvent;
id<ScintillaNotificationProtocol> delegate;
@ -99,125 +103,127 @@ private:
bool enteredSetScrollingSize;
// Private so ScintillaCocoa objects can not be copied
ScintillaCocoa(const ScintillaCocoa &) : ScintillaBase() {}
ScintillaCocoa &operator=(const ScintillaCocoa &) { return * this; }
bool GetPasteboardData(NSPasteboard* board, SelectionText* selectedText);
void SetPasteboardData(NSPasteboard* board, const SelectionText& selectedText);
int TargetAsUTF8(char *text);
int EncodedFromUTF8(char *utf8, char *encoded) const;
bool GetPasteboardData(NSPasteboard *board, SelectionText *selectedText);
void SetPasteboardData(NSPasteboard *board, const SelectionText &selectedText);
Sci::Position TargetAsUTF8(char *text) const;
Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const;
int scrollSpeed;
int scrollTicks;
NSTimer* tickTimer;
NSTimer* idleTimer;
CFRunLoopObserverRef observer;
FindHighlightLayer *layerFindIndicator;
protected:
Point GetVisibleOriginInMain() const;
PRectangle GetClientRectangle() const;
virtual PRectangle GetClientDrawingRectangle();
Point GetVisibleOriginInMain() const override;
PRectangle GetClientRectangle() const override;
PRectangle GetClientDrawingRectangle() override;
Point ConvertPoint(NSPoint point);
virtual void RedrawRect(PRectangle rc);
virtual void DiscardOverdraw();
virtual void Redraw();
void RedrawRect(PRectangle rc) override;
void DiscardOverdraw() override;
void Redraw() override;
virtual void Initialise();
virtual void Finalise();
virtual CaseFolder *CaseFolderForEncoding();
virtual std::string CaseMapString(const std::string &s, int caseMapping);
virtual void CancelModes();
void Init();
CaseFolder *CaseFolderForEncoding() override;
std::string CaseMapString(const std::string &s, int caseMapping) override;
void CancelModes() override;
public:
ScintillaCocoa(SCIContentView* view, SCIMarginView* viewMargin);
virtual ~ScintillaCocoa();
ScintillaCocoa(ScintillaView *sciView_, SCIContentView *viewContent, SCIMarginView *viewMargin);
// Deleted so ScintillaCocoa objects can not be copied.
ScintillaCocoa(const ScintillaCocoa &) = delete;
ScintillaCocoa &operator=(const ScintillaCocoa &) = delete;
~ScintillaCocoa() override;
void Finalise() override;
void SetDelegate(id<ScintillaNotificationProtocol> delegate_);
void RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback);
sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
NSScrollView* ScrollContainer() const;
SCIContentView* ContentView();
NSScrollView *ScrollContainer() const;
SCIContentView *ContentView();
bool SyncPaint(void* gc, PRectangle rc);
bool SyncPaint(void *gc, PRectangle rc);
bool Draw(NSRect rect, CGContextRef gc);
void PaintMargin(NSRect aRect);
virtual sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void TickFor(TickReason reason);
bool FineTickerAvailable();
bool FineTickerRunning(TickReason reason);
void FineTickerStart(TickReason reason, int millis, int tolerance);
void FineTickerCancel(TickReason reason);
bool SetIdle(bool on);
void SetMouseCapture(bool on);
bool HaveMouseCapture();
sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
void TickFor(TickReason reason) override;
bool FineTickerRunning(TickReason reason) override;
void FineTickerStart(TickReason reason, int millis, int tolerance) override;
void FineTickerCancel(TickReason reason) override;
bool SetIdle(bool on) override;
void SetMouseCapture(bool on) override;
bool HaveMouseCapture() override;
void WillDraw(NSRect rect);
void ScrollText(int linesToMove);
void SetVerticalScrollPos();
void SetHorizontalScrollPos();
bool ModifyScrollBars(int nMax, int nPage);
void ScrollText(Sci::Line linesToMove) override;
void SetVerticalScrollPos() override;
void SetHorizontalScrollPos() override;
bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) override;
bool SetScrollingSize(void);
void Resize();
void UpdateForScroll();
// Notifications for the owner.
void NotifyChange();
void NotifyFocus(bool focus);
void NotifyParent(SCNotification scn);
void NotifyChange() override;
void NotifyFocus(bool focus) override;
void NotifyParent(SCNotification scn) override;
void NotifyURIDropped(const char *uri);
bool HasSelection();
bool CanUndo();
bool CanRedo();
virtual void CopyToClipboard(const SelectionText &selectedText);
virtual void Copy();
virtual bool CanPaste();
virtual void Paste();
virtual void Paste(bool rectangular);
void CTPaint(void* gc, NSRect rc);
void CopyToClipboard(const SelectionText &selectedText) override;
void Copy() override;
bool CanPaste() override;
void Paste() override;
void Paste(bool rectangular);
void CTPaint(void *gc, NSRect rc);
void CallTipMouseDown(NSPoint pt);
virtual void CreateCallTipWindow(PRectangle rc);
virtual void AddToPopUp(const char *label, int cmd = 0, bool enabled = true);
virtual void ClaimSelection();
void CreateCallTipWindow(PRectangle rc) override;
void AddToPopUp(const char *label, int cmd = 0, bool enabled = true) override;
void ClaimSelection() override;
NSPoint GetCaretPosition();
static sptr_t DirectFunction(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
NSTimer *timers[tickPlatform+1];
void TimerFired(NSTimer* timer);
void TimerFired(NSTimer *timer);
void IdleTimerFired();
static void UpdateObserver(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *sci);
void ObserverAdd();
void ObserverRemove();
virtual void IdleWork();
virtual void QueueIdleWork(WorkNeeded::workItems items, int upTo);
int InsertText(NSString* input);
NSRange PositionsFromCharacters(NSRange range) const;
NSRange CharactersFromPositions(NSRange range) const;
void IdleWork() override;
void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) override;
ptrdiff_t InsertText(NSString *input);
NSRange PositionsFromCharacters(NSRange rangeCharacters) const;
NSRange CharactersFromPositions(NSRange rangePositions) const;
NSString *RangeTextAsString(NSRange rangePositions) const;
NSInteger VisibleLineForIndex(NSInteger index);
NSRange RangeForVisibleLine(NSInteger lineVisible);
NSRect FrameForRange(NSRange rangeCharacters);
NSRect GetBounds() const;
void SelectOnlyMainSelection();
void ConvertSelectionVirtualSpace();
bool ClearAllSelections();
void CompositionStart();
void CompositionCommit();
void CompositionUndo();
virtual void SetDocPointer(Document *document);
void SetDocPointer(Document *document) override;
bool KeyboardInput(NSEvent* event);
void MouseDown(NSEvent* event);
void MouseMove(NSEvent* event);
void MouseUp(NSEvent* event);
void MouseEntered(NSEvent* event);
void MouseExited(NSEvent* event);
void MouseWheel(NSEvent* event);
bool KeyboardInput(NSEvent *event);
void MouseDown(NSEvent *event);
void RightMouseDown(NSEvent *event);
void MouseMove(NSEvent *event);
void MouseUp(NSEvent *event);
void MouseEntered(NSEvent *event);
void MouseExited(NSEvent *event);
void MouseWheel(NSEvent *event);
// Drag and drop
void StartDrag();
bool GetDragData(id <NSDraggingInfo> info, NSPasteboard &pasteBoard, SelectionText* selectedText);
void StartDrag() override;
bool GetDragData(id <NSDraggingInfo> info, NSPasteboard &pasteBoard, SelectionText *selectedText);
NSDragOperation DraggingEntered(id <NSDraggingInfo> info);
NSDragOperation DraggingUpdated(id <NSDraggingInfo> info);
void DraggingExited(id <NSDraggingInfo> info);
@ -225,16 +231,19 @@ public:
void DragScroll();
// Promote some methods needed for NSResponder actions.
virtual void SelectAll();
void SelectAll() override;
void DeleteBackward();
virtual void Cut();
virtual void Undo();
virtual void Redo();
void Cut() override;
void Undo() override;
void Redo() override;
virtual NSMenu* CreateContextMenu(NSEvent* event);
bool ShouldDisplayPopupOnMargin();
bool ShouldDisplayPopupOnText();
NSMenu *CreateContextMenu(NSEvent *event);
void HandleCommand(NSInteger command);
virtual void ActiveStateChanged(bool isActive);
void ActiveStateChanged(bool isActive);
void WindowWillMove();
// Find indicator
void ShowFindIndicatorForRange(NSRange charRange, BOOL retaining);

File diff suppressed because it is too large Load Diff

View File

@ -9,17 +9,19 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.sun.${PRODUCT_NAME:identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>${PRODUCT_NAME}</string>
<key>CFBundlePackageType</key>
<string>FMWK</string>
<key>CFBundleShortVersionString</key>
<string>4.1.4</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1.0</string>
<string>4.1.4</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>

View File

@ -11,7 +11,6 @@
1100F1EC178E393200105727 /* CaseConvert.h in Headers */ = {isa = PBXBuildFile; fileRef = 1100F1E7178E393200105727 /* CaseConvert.h */; };
1100F1ED178E393200105727 /* CaseFolder.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1100F1E8178E393200105727 /* CaseFolder.cxx */; };
1100F1EE178E393200105727 /* CaseFolder.h in Headers */ = {isa = PBXBuildFile; fileRef = 1100F1E9178E393200105727 /* CaseFolder.h */; };
1100F1EF178E393200105727 /* UnicodeFromUTF8.h in Headers */ = {isa = PBXBuildFile; fileRef = 1100F1EA178E393200105727 /* UnicodeFromUTF8.h */; };
1102C31C169FB49300DC16AB /* LexLaTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1102C31B169FB49300DC16AB /* LexLaTeX.cxx */; };
11126B8214CD3A6200803C49 /* LexAVS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11126B8114CD3A6200803C49 /* LexAVS.cxx */; };
1114D6CB1602A951001DC345 /* LexPO.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1114D6CA1602A951001DC345 /* LexPO.cxx */; };
@ -63,7 +62,6 @@
114B6F3A11FA7526004FB6AB /* LexNimrod.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEB11FA7526004FB6AB /* LexNimrod.cxx */; };
114B6F3B11FA7526004FB6AB /* LexNsis.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEC11FA7526004FB6AB /* LexNsis.cxx */; };
114B6F3C11FA7526004FB6AB /* LexOpal.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EED11FA7526004FB6AB /* LexOpal.cxx */; };
114B6F3D11FA7526004FB6AB /* LexOthers.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEE11FA7526004FB6AB /* LexOthers.cxx */; };
114B6F3E11FA7526004FB6AB /* LexPascal.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EEF11FA7526004FB6AB /* LexPascal.cxx */; };
114B6F3F11FA7526004FB6AB /* LexPB.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF011FA7526004FB6AB /* LexPB.cxx */; };
114B6F4011FA7526004FB6AB /* LexPerl.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6EF111FA7526004FB6AB /* LexPerl.cxx */; };
@ -126,7 +124,7 @@
114B6F9D11FA75BE004FB6AB /* PropSetSimple.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9411FA75BE004FB6AB /* PropSetSimple.cxx */; };
114B6F9E11FA75BE004FB6AB /* StyleContext.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9511FA75BE004FB6AB /* StyleContext.cxx */; };
114B6F9F11FA75BE004FB6AB /* WordList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 114B6F9611FA75BE004FB6AB /* WordList.cxx */; };
114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA011FA75DB004FB6AB /* ILexer.h */; };
114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA011FA75DB004FB6AB /* ILexer.h */; settings = {ATTRIBUTES = (Public, ); }; };
114B6FBD11FA7623004FB6AB /* AutoComplete.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA211FA7623004FB6AB /* AutoComplete.h */; };
114B6FBE11FA7623004FB6AB /* CallTip.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA311FA7623004FB6AB /* CallTip.h */; };
114B6FBF11FA7623004FB6AB /* Catalogue.h in Headers */ = {isa = PBXBuildFile; fileRef = 114B6FA411FA7623004FB6AB /* Catalogue.h */; };
@ -200,6 +198,8 @@
280056FC188DDD2C00F200AE /* StringCopy.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056F9188DDD2C00F200AE /* StringCopy.h */; };
280056FD188DDD2C00F200AE /* SubStyles.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056FA188DDD2C00F200AE /* SubStyles.h */; };
28064A05190F12E100E6E47F /* LexDMIS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28064A04190F12E100E6E47F /* LexDMIS.cxx */; };
282D4A961F53FE270082E4D3 /* ILoader.h in Headers */ = {isa = PBXBuildFile; fileRef = 282D4A951F53FE270082E4D3 /* ILoader.h */; settings = {ATTRIBUTES = (Public, ); }; };
28804B2C1EEE232E00C0D154 /* DBCS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28804B2B1EEE232E00C0D154 /* DBCS.cxx */; };
28A067111A36B42600B4966A /* LexHex.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A067101A36B42600B4966A /* LexHex.cxx */; };
28A1DD51196BE0CA006EFCDD /* EditModel.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */; };
28A1DD52196BE0CA006EFCDD /* EditView.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD4F196BE0CA006EFCDD /* EditView.cxx */; };
@ -208,12 +208,29 @@
28A1DD58196BE0ED006EFCDD /* EditView.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD55196BE0ED006EFCDD /* EditView.h */; };
28A1DD59196BE0ED006EFCDD /* MarginView.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD56196BE0ED006EFCDD /* MarginView.h */; };
28A7D6051995E47D0062D204 /* LexRegistry.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A7D6041995E47D0062D204 /* LexRegistry.cxx */; };
28B6470C1B54C0720009DC49 /* LexBatch.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647061B54C0720009DC49 /* LexBatch.cxx */; };
28B6470D1B54C0720009DC49 /* LexDiff.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647071B54C0720009DC49 /* LexDiff.cxx */; };
28B6470E1B54C0720009DC49 /* LexErrorList.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647081B54C0720009DC49 /* LexErrorList.cxx */; };
28B6470F1B54C0720009DC49 /* LexMake.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B647091B54C0720009DC49 /* LexMake.cxx */; };
28B647101B54C0720009DC49 /* LexNull.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B6470A1B54C0720009DC49 /* LexNull.cxx */; };
28B647111B54C0720009DC49 /* LexProps.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28B6470B1B54C0720009DC49 /* LexProps.cxx */; };
28BC38EC1B74C6AD008BF9EB /* Sci_Position.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BC38EB1B74C6AD008BF9EB /* Sci_Position.h */; settings = {ATTRIBUTES = (Public, ); }; };
28BDA1221EFB8F7C00EBD3F3 /* DefaultLexer.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28BDA1211EFB8F7C00EBD3F3 /* DefaultLexer.cxx */; };
28BDA1241EFB8FB200EBD3F3 /* DefaultLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 28BDA1231EFB8FB200EBD3F3 /* DefaultLexer.h */; };
28C40CA81CB7321200B089F2 /* LexJSON.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28C40CA71CB7321200B089F2 /* LexJSON.cxx */; };
28D191A21DEA72C800159938 /* LexEDIFACT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28D191A11DEA72C800159938 /* LexEDIFACT.cxx */; };
28D516D81830FFCA0047C93D /* info_bar_bg@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */; };
28D516D91830FFCA0047C93D /* mac_cursor_busy@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */; };
28D516DA1830FFCA0047C93D /* mac_cursor_flipped@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */; };
28FDA42119B6967B00BE27D7 /* LexBibTeX.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */; };
3D994BD7A5EAC4FA5B3CFBDF /* LexMaxima.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 29B042978C1F93EF42F9E4AB /* LexMaxima.cxx */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
F437405F9F32C7DEFCA38C11 /* LexIndent.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */; };
FDC7442CAD70B9A67EF1639D /* LexSAS.cxx in Sources */ = {isa = PBXBuildFile; fileRef = A95147A1AB7CADB00DAFE724 /* LexSAS.cxx */; };
5F804AA6B60FE695863A39FE /* LexStata.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 7623427695416AB1270EE023 /* LexStata.cxx */; };
0ED84236A703D57578EBFD2F /* LexNim.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 47814937A6B72D2B0F065B61 /* LexNim.cxx */; };
00724A59981D34F11A3D162F /* LexCIL.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 577F46B88F633198B56D088D /* LexCIL.cxx */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@ -225,7 +242,6 @@
1100F1E7178E393200105727 /* CaseConvert.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CaseConvert.h; path = ../../src/CaseConvert.h; sourceTree = "<group>"; };
1100F1E8178E393200105727 /* CaseFolder.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CaseFolder.cxx; path = ../../src/CaseFolder.cxx; sourceTree = "<group>"; };
1100F1E9178E393200105727 /* CaseFolder.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CaseFolder.h; path = ../../src/CaseFolder.h; sourceTree = "<group>"; };
1100F1EA178E393200105727 /* UnicodeFromUTF8.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = UnicodeFromUTF8.h; path = ../../src/UnicodeFromUTF8.h; sourceTree = "<group>"; };
1102C31B169FB49300DC16AB /* LexLaTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexLaTeX.cxx; path = ../../lexers/LexLaTeX.cxx; sourceTree = "<group>"; };
11126B8114CD3A6200803C49 /* LexAVS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexAVS.cxx; path = ../../lexers/LexAVS.cxx; sourceTree = "<group>"; };
1114D6CA1602A951001DC345 /* LexPO.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPO.cxx; path = ../../lexers/LexPO.cxx; sourceTree = "<group>"; };
@ -277,7 +293,6 @@
114B6EEB11FA7526004FB6AB /* LexNimrod.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNimrod.cxx; path = ../../lexers/LexNimrod.cxx; sourceTree = SOURCE_ROOT; };
114B6EEC11FA7526004FB6AB /* LexNsis.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNsis.cxx; path = ../../lexers/LexNsis.cxx; sourceTree = SOURCE_ROOT; };
114B6EED11FA7526004FB6AB /* LexOpal.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOpal.cxx; path = ../../lexers/LexOpal.cxx; sourceTree = SOURCE_ROOT; };
114B6EEE11FA7526004FB6AB /* LexOthers.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOthers.cxx; path = ../../lexers/LexOthers.cxx; sourceTree = SOURCE_ROOT; };
114B6EEF11FA7526004FB6AB /* LexPascal.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPascal.cxx; path = ../../lexers/LexPascal.cxx; sourceTree = SOURCE_ROOT; };
114B6EF011FA7526004FB6AB /* LexPB.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPB.cxx; path = ../../lexers/LexPB.cxx; sourceTree = SOURCE_ROOT; };
114B6EF111FA7526004FB6AB /* LexPerl.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexPerl.cxx; path = ../../lexers/LexPerl.cxx; sourceTree = SOURCE_ROOT; };
@ -414,6 +429,9 @@
280056F9188DDD2C00F200AE /* StringCopy.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = StringCopy.h; path = ../../lexlib/StringCopy.h; sourceTree = "<group>"; };
280056FA188DDD2C00F200AE /* SubStyles.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SubStyles.h; path = ../../lexlib/SubStyles.h; sourceTree = "<group>"; };
28064A04190F12E100E6E47F /* LexDMIS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMIS.cxx; path = ../../lexers/LexDMIS.cxx; sourceTree = "<group>"; };
282D4A951F53FE270082E4D3 /* ILoader.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = ILoader.h; path = ../../include/ILoader.h; sourceTree = "<group>"; };
282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexIndent.cxx; path = ../../lexers/LexIndent.cxx; sourceTree = SOURCE_ROOT; };
28804B2B1EEE232E00C0D154 /* DBCS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DBCS.cxx; path = ../../src/DBCS.cxx; sourceTree = "<group>"; };
28A067101A36B42600B4966A /* LexHex.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexHex.cxx; path = ../../lexers/LexHex.cxx; sourceTree = "<group>"; };
28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditModel.cxx; path = ../../src/EditModel.cxx; sourceTree = "<group>"; };
28A1DD4F196BE0CA006EFCDD /* EditView.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = EditView.cxx; path = ../../src/EditView.cxx; sourceTree = "<group>"; };
@ -422,14 +440,31 @@
28A1DD55196BE0ED006EFCDD /* EditView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditView.h; path = ../../src/EditView.h; sourceTree = "<group>"; };
28A1DD56196BE0ED006EFCDD /* MarginView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = MarginView.h; path = ../../src/MarginView.h; sourceTree = "<group>"; };
28A7D6041995E47D0062D204 /* LexRegistry.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRegistry.cxx; path = ../../lexers/LexRegistry.cxx; sourceTree = "<group>"; };
28B647061B54C0720009DC49 /* LexBatch.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBatch.cxx; path = ../../lexers/LexBatch.cxx; sourceTree = "<group>"; };
28B647071B54C0720009DC49 /* LexDiff.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDiff.cxx; path = ../../lexers/LexDiff.cxx; sourceTree = "<group>"; };
28B647081B54C0720009DC49 /* LexErrorList.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexErrorList.cxx; path = ../../lexers/LexErrorList.cxx; sourceTree = "<group>"; };
28B647091B54C0720009DC49 /* LexMake.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMake.cxx; path = ../../lexers/LexMake.cxx; sourceTree = "<group>"; };
28B6470A1B54C0720009DC49 /* LexNull.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNull.cxx; path = ../../lexers/LexNull.cxx; sourceTree = "<group>"; };
28B6470B1B54C0720009DC49 /* LexProps.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexProps.cxx; path = ../../lexers/LexProps.cxx; sourceTree = "<group>"; };
28BC38EB1B74C6AD008BF9EB /* Sci_Position.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Sci_Position.h; path = ../../include/Sci_Position.h; sourceTree = "<group>"; };
28BDA1211EFB8F7C00EBD3F3 /* DefaultLexer.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = DefaultLexer.cxx; path = ../../lexlib/DefaultLexer.cxx; sourceTree = "<group>"; };
28BDA1231EFB8FB200EBD3F3 /* DefaultLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = DefaultLexer.h; path = ../../lexlib/DefaultLexer.h; sourceTree = "<group>"; };
28C40CA71CB7321200B089F2 /* LexJSON.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexJSON.cxx; path = ../../lexers/LexJSON.cxx; sourceTree = "<group>"; };
28D1919E1DE69FC100159938 /* module.modulemap */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = "sourcecode.module-map"; path = module.modulemap; sourceTree = "<group>"; };
28D191A11DEA72C800159938 /* LexEDIFACT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexEDIFACT.cxx; path = ../../lexers/LexEDIFACT.cxx; sourceTree = "<group>"; };
28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "info_bar_bg@2x.png"; sourceTree = "<group>"; };
28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mac_cursor_busy@2x.png"; sourceTree = "<group>"; };
28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "mac_cursor_flipped@2x.png"; sourceTree = "<group>"; };
28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexBibTeX.cxx; path = ../../lexers/LexBibTeX.cxx; sourceTree = "<group>"; };
29B042978C1F93EF42F9E4AB /* LexMaxima.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexMaxima.cxx; path = ../../lexers/LexMaxima.cxx; sourceTree = SOURCE_ROOT; };
32DBCF5E0370ADEE00C91783 /* Scintilla_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Scintilla_Prefix.pch; sourceTree = "<group>"; };
8DC2EF5A0486A6940098B216 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
8DC2EF5B0486A6940098B216 /* Scintilla.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = Scintilla.framework; sourceTree = BUILT_PRODUCTS_DIR; };
D2F7E79907B2D74100F64583 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
A95147A1AB7CADB00DAFE724 /* LexSAS.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSAS.cxx; path = ../../lexers/LexSAS.cxx; sourceTree = SOURCE_ROOT; };
7623427695416AB1270EE023 /* LexStata.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexStata.cxx; path = ../../lexers/LexStata.cxx; sourceTree = SOURCE_ROOT; };
47814937A6B72D2B0F065B61 /* LexNim.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexNim.cxx; path = ../../lexers/LexNim.cxx; sourceTree = SOURCE_ROOT; };
577F46B88F633198B56D088D /* LexCIL.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCIL.cxx; path = ../../lexers/LexCIL.cxx; sourceTree = SOURCE_ROOT; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
@ -489,6 +524,7 @@
08FB77AEFE84172EC02AAC07 /* Classes */ = {
isa = PBXGroup;
children = (
28D1919E1DE69FC100159938 /* module.modulemap */,
2744E4980FC167ED00E85C33 /* Source Files */,
2744E4970FC167E400E85C33 /* Header Files */,
);
@ -526,7 +562,6 @@
2744E47D0FC1674E00E85C33 /* Lexers */ = {
isa = PBXGroup;
children = (
11126B8114CD3A6200803C49 /* LexAVS.cxx */,
11F35FDA12AEFAF100F0236D /* LexA68k.cxx */,
114B6EBE11FA7526004FB6AB /* LexAbaqus.cxx */,
114B6EBF11FA7526004FB6AB /* LexAda.cxx */,
@ -536,12 +571,15 @@
114B6EC311FA7526004FB6AB /* LexASY.cxx */,
114B6EC411FA7526004FB6AB /* LexAU3.cxx */,
114B6EC511FA7526004FB6AB /* LexAVE.cxx */,
11126B8114CD3A6200803C49 /* LexAVS.cxx */,
114B6EC611FA7526004FB6AB /* LexBaan.cxx */,
114B6EC711FA7526004FB6AB /* LexBash.cxx */,
114B6EC811FA7526004FB6AB /* LexBasic.cxx */,
28B647061B54C0720009DC49 /* LexBatch.cxx */,
28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */,
114B6EC911FA7526004FB6AB /* LexBullant.cxx */,
114B6ECA11FA7526004FB6AB /* LexCaml.cxx */,
577F46B88F633198B56D088D /* LexCIL.cxx */,
114B6ECB11FA7526004FB6AB /* LexCLW.cxx */,
114B6ECC11FA7526004FB6AB /* LexCmake.cxx */,
114B6ECD11FA7526004FB6AB /* LexCOBOL.cxx */,
@ -552,11 +590,14 @@
114B6ED111FA7526004FB6AB /* LexCsound.cxx */,
114B6ED211FA7526004FB6AB /* LexCSS.cxx */,
114B6ED311FA7526004FB6AB /* LexD.cxx */,
28B647071B54C0720009DC49 /* LexDiff.cxx */,
11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */,
28064A04190F12E100E6E47F /* LexDMIS.cxx */,
11BEB6A114EF189600BDE92A /* LexECL.cxx */,
28D191A11DEA72C800159938 /* LexEDIFACT.cxx */,
114B6ED411FA7526004FB6AB /* LexEiffel.cxx */,
114B6ED511FA7526004FB6AB /* LexErlang.cxx */,
28B647081B54C0720009DC49 /* LexErrorList.cxx */,
114B6ED611FA7526004FB6AB /* LexEScript.cxx */,
114B6ED711FA7526004FB6AB /* LexFlagship.cxx */,
114B6ED811FA7526004FB6AB /* LexForth.cxx */,
@ -566,7 +607,9 @@
114B6EDC11FA7526004FB6AB /* LexHaskell.cxx */,
28A067101A36B42600B4966A /* LexHex.cxx */,
114B6EDD11FA7526004FB6AB /* LexHTML.cxx */,
282E41F3B9E2BFEDD6A05BE7 /* LexIndent.cxx */,
114B6EDE11FA7526004FB6AB /* LexInno.cxx */,
28C40CA71CB7321200B089F2 /* LexJSON.cxx */,
114B6EDF11FA7526004FB6AB /* LexKix.cxx */,
11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */,
1102C31B169FB49300DC16AB /* LexLaTeX.cxx */,
@ -574,19 +617,22 @@
114B6EE111FA7526004FB6AB /* LexLout.cxx */,
114B6EE211FA7526004FB6AB /* LexLua.cxx */,
114B6EE311FA7526004FB6AB /* LexMagik.cxx */,
28B647091B54C0720009DC49 /* LexMake.cxx */,
114B6EE411FA7526004FB6AB /* LexMarkdown.cxx */,
114B6EE511FA7526004FB6AB /* LexMatlab.cxx */,
29B042978C1F93EF42F9E4AB /* LexMaxima.cxx */,
114B6EE611FA7526004FB6AB /* LexMetapost.cxx */,
114B6EE711FA7526004FB6AB /* LexMMIXAL.cxx */,
11BB124C12FF9C1300F6BCF7 /* LexModula.cxx */,
114B6EE811FA7526004FB6AB /* LexMPT.cxx */,
114B6EE911FA7526004FB6AB /* LexMSSQL.cxx */,
114B6EEA11FA7526004FB6AB /* LexMySQL.cxx */,
47814937A6B72D2B0F065B61 /* LexNim.cxx */,
114B6EEB11FA7526004FB6AB /* LexNimrod.cxx */,
114B6EEC11FA7526004FB6AB /* LexNsis.cxx */,
28B6470A1B54C0720009DC49 /* LexNull.cxx */,
114B6EED11FA7526004FB6AB /* LexOpal.cxx */,
11594BE7155B91DF0099E1FA /* LexOScript.cxx */,
114B6EEE11FA7526004FB6AB /* LexOthers.cxx */,
114B6EEF11FA7526004FB6AB /* LexPascal.cxx */,
114B6EF011FA7526004FB6AB /* LexPB.cxx */,
114B6EF111FA7526004FB6AB /* LexPerl.cxx */,
@ -596,6 +642,7 @@
114B6EF411FA7526004FB6AB /* LexPowerPro.cxx */,
114B6EF511FA7526004FB6AB /* LexPowerShell.cxx */,
114B6EF611FA7526004FB6AB /* LexProgress.cxx */,
28B6470B1B54C0720009DC49 /* LexProps.cxx */,
114B6EF711FA7526004FB6AB /* LexPS.cxx */,
114B6EF811FA7526004FB6AB /* LexPython.cxx */,
114B6EF911FA7526004FB6AB /* LexR.cxx */,
@ -603,6 +650,7 @@
28A7D6041995E47D0062D204 /* LexRegistry.cxx */,
114B6EFB11FA7526004FB6AB /* LexRuby.cxx */,
1160E0371803651C00BCEBCB /* LexRust.cxx */,
A95147A1AB7CADB00DAFE724 /* LexSAS.cxx */,
114B6EFC11FA7526004FB6AB /* LexScriptol.cxx */,
114B6EFD11FA7526004FB6AB /* LexSmalltalk.cxx */,
114B6EFE11FA7526004FB6AB /* LexSML.cxx */,
@ -610,6 +658,7 @@
114B6F0011FA7526004FB6AB /* LexSpecman.cxx */,
114B6F0111FA7526004FB6AB /* LexSpice.cxx */,
114B6F0211FA7526004FB6AB /* LexSQL.cxx */,
7623427695416AB1270EE023 /* LexStata.cxx */,
11FDAEB6174E1A9700FA161B /* LexSTTXT.cxx */,
114B6F0311FA7526004FB6AB /* LexTACL.cxx */,
114B6F0411FA7526004FB6AB /* LexTADS3.cxx */,
@ -642,6 +691,7 @@
114B6FA611FA7623004FB6AB /* CharClassify.h */,
114B6FA711FA7623004FB6AB /* ContractionState.h */,
114B6FA811FA7623004FB6AB /* Decoration.h */,
28BDA1231EFB8FB200EBD3F3 /* DefaultLexer.h */,
114B6FA911FA7623004FB6AB /* Document.h */,
28A1DD54196BE0ED006EFCDD /* EditModel.h */,
114B6FAA11FA7623004FB6AB /* Editor.h */,
@ -649,6 +699,7 @@
114B6FAB11FA7623004FB6AB /* ExternalLexer.h */,
114B6FAC11FA7623004FB6AB /* FontQuality.h */,
114B6FA011FA75DB004FB6AB /* ILexer.h */,
282D4A951F53FE270082E4D3 /* ILoader.h */,
114B6FAD11FA7623004FB6AB /* Indicator.h */,
114B6FAE11FA7623004FB6AB /* KeyMap.h */,
114B6FDA11FA7645004FB6AB /* LexAccessor.h */,
@ -673,7 +724,6 @@
114B6FB811FA7623004FB6AB /* Style.h */,
114B6FE111FA7645004FB6AB /* StyleContext.h */,
280056FA188DDD2C00F200AE /* SubStyles.h */,
1100F1EA178E393200105727 /* UnicodeFromUTF8.h */,
114B6FBA11FA7623004FB6AB /* UniConversion.h */,
114B6FBB11FA7623004FB6AB /* ViewStyle.h */,
114B6FE211FA7645004FB6AB /* WordList.h */,
@ -696,7 +746,9 @@
114B6F8F11FA75BE004FB6AB /* CharacterSet.cxx */,
114B6F6411FA7597004FB6AB /* CharClassify.cxx */,
114B6F6511FA7597004FB6AB /* ContractionState.cxx */,
28804B2B1EEE232E00C0D154 /* DBCS.cxx */,
114B6F6611FA7597004FB6AB /* Decoration.cxx */,
28BDA1211EFB8F7C00EBD3F3 /* DefaultLexer.cxx */,
114B6F6711FA7597004FB6AB /* Document.cxx */,
28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */,
114B6F6811FA7597004FB6AB /* Editor.cxx */,
@ -737,6 +789,7 @@
2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */,
119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */,
2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */,
28BC38EB1B74C6AD008BF9EB /* Sci_Position.h */,
2744E4870FC1678600E85C33 /* SciLexer.h */,
2744E4880FC1678600E85C33 /* Scintilla.h */,
2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */,
@ -785,9 +838,12 @@
isa = PBXHeadersBuildPhase;
buildActionMask = 2147483647;
files = (
28BC38EC1B74C6AD008BF9EB /* Sci_Position.h in Headers */,
114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */,
2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */,
2744E5AC0FC168B200E85C33 /* InfoBarCommunicator.h in Headers */,
2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */,
28BDA1241EFB8FB200EBD3F3 /* DefaultLexer.h in Headers */,
280056FB188DDD2C00F200AE /* SparseState.h in Headers */,
2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */,
2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */,
@ -796,7 +852,6 @@
2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */,
2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */,
2791F3C90FC19F71009DBCF9 /* Scintilla.h in Headers */,
114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */,
114B6FBD11FA7623004FB6AB /* AutoComplete.h in Headers */,
114B6FBE11FA7623004FB6AB /* CallTip.h in Headers */,
114B6FBF11FA7623004FB6AB /* Catalogue.h in Headers */,
@ -804,6 +859,7 @@
114B6FC111FA7623004FB6AB /* CharClassify.h in Headers */,
114B6FC211FA7623004FB6AB /* ContractionState.h in Headers */,
114B6FC311FA7623004FB6AB /* Decoration.h in Headers */,
282D4A961F53FE270082E4D3 /* ILoader.h in Headers */,
114B6FC411FA7623004FB6AB /* Document.h in Headers */,
114B6FC511FA7623004FB6AB /* Editor.h in Headers */,
114B6FC611FA7623004FB6AB /* ExternalLexer.h in Headers */,
@ -843,7 +899,6 @@
11FBA39E17817DA00048C071 /* CharacterCategory.h in Headers */,
1100F1EC178E393200105727 /* CaseConvert.h in Headers */,
1100F1EE178E393200105727 /* CaseFolder.h in Headers */,
1100F1EF178E393200105727 /* UnicodeFromUTF8.h in Headers */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -875,7 +930,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0610;
LastUpgradeCheck = 0930;
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ScintillaFramework" */;
compatibilityVersion = "Xcode 3.2";
@ -923,8 +978,12 @@
2744E5B30FC168C500E85C33 /* PlatCocoa.mm in Sources */,
2744E5B50FC168C500E85C33 /* ScintillaCocoa.mm in Sources */,
2744E5B60FC168C500E85C33 /* ScintillaView.mm in Sources */,
28D191A21DEA72C800159938 /* LexEDIFACT.cxx in Sources */,
28BDA1221EFB8F7C00EBD3F3 /* DefaultLexer.cxx in Sources */,
114B6F0D11FA7526004FB6AB /* LexAbaqus.cxx in Sources */,
114B6F0E11FA7526004FB6AB /* LexAda.cxx in Sources */,
28B6470C1B54C0720009DC49 /* LexBatch.cxx in Sources */,
28B6470F1B54C0720009DC49 /* LexMake.cxx in Sources */,
114B6F0F11FA7526004FB6AB /* LexAPDL.cxx in Sources */,
114B6F1011FA7526004FB6AB /* LexAsm.cxx in Sources */,
114B6F1111FA7526004FB6AB /* LexAsn1.cxx in Sources */,
@ -938,10 +997,13 @@
114B6F1911FA7526004FB6AB /* LexCaml.cxx in Sources */,
114B6F1A11FA7526004FB6AB /* LexCLW.cxx in Sources */,
114B6F1B11FA7526004FB6AB /* LexCmake.cxx in Sources */,
28C40CA81CB7321200B089F2 /* LexJSON.cxx in Sources */,
114B6F1C11FA7526004FB6AB /* LexCOBOL.cxx in Sources */,
114B6F1D11FA7526004FB6AB /* LexConf.cxx in Sources */,
28B647101B54C0720009DC49 /* LexNull.cxx in Sources */,
114B6F1E11FA7526004FB6AB /* LexCPP.cxx in Sources */,
114B6F1F11FA7526004FB6AB /* LexCrontab.cxx in Sources */,
28B647111B54C0720009DC49 /* LexProps.cxx in Sources */,
114B6F2011FA7526004FB6AB /* LexCsound.cxx in Sources */,
114B6F2111FA7526004FB6AB /* LexCSS.cxx in Sources */,
114B6F2211FA7526004FB6AB /* LexD.cxx in Sources */,
@ -974,9 +1036,10 @@
114B6F3911FA7526004FB6AB /* LexMySQL.cxx in Sources */,
114B6F3A11FA7526004FB6AB /* LexNimrod.cxx in Sources */,
114B6F3B11FA7526004FB6AB /* LexNsis.cxx in Sources */,
28804B2C1EEE232E00C0D154 /* DBCS.cxx in Sources */,
114B6F3C11FA7526004FB6AB /* LexOpal.cxx in Sources */,
114B6F3D11FA7526004FB6AB /* LexOthers.cxx in Sources */,
114B6F3E11FA7526004FB6AB /* LexPascal.cxx in Sources */,
28B6470D1B54C0720009DC49 /* LexDiff.cxx in Sources */,
114B6F3F11FA7526004FB6AB /* LexPB.cxx in Sources */,
114B6F4011FA7526004FB6AB /* LexPerl.cxx in Sources */,
114B6F4111FA7526004FB6AB /* LexPLM.cxx in Sources */,
@ -1029,6 +1092,7 @@
114B6F8911FA7598004FB6AB /* Selection.cxx in Sources */,
114B6F8A11FA7598004FB6AB /* Style.cxx in Sources */,
28A7D6051995E47D0062D204 /* LexRegistry.cxx in Sources */,
28B6470E1B54C0720009DC49 /* LexErrorList.cxx in Sources */,
114B6F8B11FA7598004FB6AB /* UniConversion.cxx in Sources */,
114B6F8C11FA7598004FB6AB /* ViewStyle.cxx in Sources */,
114B6F8D11FA7598004FB6AB /* XPM.cxx in Sources */,
@ -1058,6 +1122,12 @@
11FDD0E017C480D4001541B9 /* LexKVIrc.cxx in Sources */,
1160E0381803651C00BCEBCB /* LexRust.cxx in Sources */,
11FF3FE21810EB3900E13F13 /* LexDMAP.cxx in Sources */,
F437405F9F32C7DEFCA38C11 /* LexIndent.cxx in Sources */,
3D994BD7A5EAC4FA5B3CFBDF /* LexMaxima.cxx in Sources */,
FDC7442CAD70B9A67EF1639D /* LexSAS.cxx in Sources */,
5F804AA6B60FE695863A39FE /* LexStata.cxx in Sources */,
0ED84236A703D57578EBFD2F /* LexNim.cxx in Sources */,
00724A59981D34F11A3D162F /* LexCIL.cxx in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1080,8 +1150,10 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
EXCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = ".bzr *.nib *.lproj *.framework *.gch (*) CVS .svn *.xcodeproj *.xcode *.pbproj *.pbxproj";
@ -1091,10 +1163,7 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Scintilla_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
SCI_NAMESPACE,
SCI_LEXER,
);
GCC_PREPROCESSOR_DEFINITIONS = SCI_LEXER;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
@ -1102,6 +1171,8 @@
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.7;
MODULEMAP_FILE = module.modulemap;
PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = Scintilla;
SKIP_INSTALL = YES;
WRAPPER_EXTENSION = framework;
@ -1113,18 +1184,17 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
CLANG_CXX_LIBRARY = "libc++";
CLANG_ENABLE_OBJC_ARC = YES;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DEFINES_MODULE = YES;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
FRAMEWORK_VERSION = A;
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = Scintilla_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
SCI_NAMESPACE,
SCI_LEXER,
);
GCC_PREPROCESSOR_DEFINITIONS = SCI_LEXER;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
@ -1132,6 +1202,8 @@
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.7;
MODULEMAP_FILE = module.modulemap;
PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = Scintilla;
SKIP_INSTALL = YES;
WRAPPER_EXTENSION = framework;
@ -1141,17 +1213,43 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
../../include,
../../src,
../../lexlib,
);
MACOSX_DEPLOYMENT_TARGET = 10.5;
MACOSX_DEPLOYMENT_TARGET = 10.7;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx;
};
@ -1160,16 +1258,41 @@
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_CXX_LANGUAGE_STANDARD = "c++17";
CLANG_ENABLE_OBJC_ARC = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNDECLARED_SELECTOR = YES;
GCC_WARN_UNINITIALIZED_AUTOS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
HEADER_SEARCH_PATHS = (
../../include,
../../src,
../../lexlib,
);
MACOSX_DEPLOYMENT_TARGET = 10.5;
MACOSX_DEPLOYMENT_TARGET = 10.7;
SDKROOT = macosx;
};
name = Release;

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:ScintillaFramework.xcodeproj">
</FileRef>
</Workspace>

View File

@ -0,0 +1,10 @@
framework module Scintilla {
umbrella header "ScintillaView.h"
module InfoBar {
header "InfoBar.h"
}
// ILexer.h is not included as Swift doesn't yet interoperate with C++
exclude header "ILexer.h"
export *
module * { export * }
}

View File

@ -15,10 +15,12 @@
@interface AppController : NSObject {
IBOutlet NSBox *mEditHost;
ScintillaView* mEditor;
ScintillaView* sciExtra; // For testing Scintilla tear-down
}
- (void) awakeFromNib;
- (void) setupEditor;
- (IBAction) searchText: (id) sender;
- (IBAction) addRemoveExtra: (id) sender;
@end

View File

@ -72,20 +72,30 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL.
[mEditor setAutoresizingMask: NSViewWidthSizable | NSViewHeightSizable];
// Let's load some text for the editor, as initial content.
NSString *sql = [self exampleText];
[mEditor setString: sql];
[self setupEditor];
sciExtra = nil;
}
- (NSString *) exampleText
{
NSError* error = nil;
NSString* path = [[NSBundle mainBundle] pathForResource: @"TestData"
ofType: @"sql" inDirectory: nil];
NSString* sql = [NSString stringWithContentsOfFile: path
NSString *sql = [NSString stringWithContentsOfFile: path
encoding: NSUTF8StringEncoding
error: &error];
if (error && [[error domain] isEqual: NSCocoaErrorDomain])
NSLog(@"%@", error);
[mEditor setString: sql];
[self setupEditor];
return sql;
}
//--------------------------------------------------------------------------------------------------
@ -99,9 +109,6 @@ const char user_keywords[] = // Definition of own keywords, not used by MySQL.
[mEditor setGeneralProperty: SCI_SETLEXER parameter: SCLEX_MYSQL value: 0];
// alternatively: [mEditor setEditorProperty: SCI_SETLEXERLANGUAGE parameter: nil value: (sptr_t) "mysql"];
// Number of styles we use with this lexer.
[mEditor setGeneralProperty: SCI_SETSTYLEBITS value: [mEditor getGeneralProperty: SCI_GETSTYLEBITSNEEDED]];
// Keywords to highlight. Indices are:
// 0 - Major keywords (reserved keywords)
// 1 - Normal keywords (everything not reserved but integral part of the language)
@ -234,7 +241,7 @@ static const char * box_xpm[] = {
- (void) showAutocompletion
{
const char *words = "Babylon-5?1 Battlestar-Galactica Millenium-Falcon?2 Moya?2 Serenity Voyager";
const char *words = "Babylon-5?1 Battlestar-Galactica Millennium-Falcon?2 Moya?2 Serenity Voyager";
[mEditor setGeneralProperty: SCI_AUTOCSETIGNORECASE parameter: 1 value:0];
[mEditor setGeneralProperty: SCI_REGISTERIMAGE parameter: 1 value:(sptr_t)box_xpm];
const int imSize = 12;
@ -271,6 +278,26 @@ static const char * box_xpm[] = {
[self showAutocompletion];
}
- (IBAction) addRemoveExtra: (id) sender
{
if (sciExtra) {
[sciExtra removeFromSuperview];
sciExtra = nil;
} else {
NSRect newFrame = mEditHost.frame;
newFrame.origin.x += newFrame.size.width + 5;
newFrame.origin.y += 46;
newFrame.size.width = 96;
newFrame.size.height -= 60;
sciExtra = [[[ScintillaView alloc] initWithFrame: newFrame] autorelease];
[[[mEditHost window]contentView] addSubview: sciExtra];
[sciExtra setGeneralProperty: SCI_SETWRAPMODE parameter: SC_WRAP_WORD value: 1];
NSString *sql = [self exampleText];
[sciExtra setString: sql];
}
}
-(IBAction) setFontQuality: (id) sender
{
[ScintillaView directCall:mEditor message:SCI_SETFONTQUALITY wParam:[sender tag] lParam:0];

File diff suppressed because it is too large Load Diff

View File

@ -9,7 +9,7 @@
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>com.sun.${PRODUCT_NAME:identifier}</string>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>

View File

@ -11,7 +11,7 @@
271FA52C0F850BE20033D021 /* AppController.mm in Sources */ = {isa = PBXBuildFile; fileRef = 271FA52B0F850BE20033D021 /* AppController.mm */; };
2791F4490FC1A8E9009DBCF9 /* TestData.sql in Resources */ = {isa = PBXBuildFile; fileRef = 2791F4480FC1A8E9009DBCF9 /* TestData.sql */; };
27AF7EC30FC2C351007160EF /* Scintilla.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 2744E5EA0FC16BE200E85C33 /* Scintilla.framework */; };
27AF7ECA0FC2C388007160EF /* Scintilla.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2744E5EA0FC16BE200E85C33 /* Scintilla.framework */; };
27AF7ECA0FC2C388007160EF /* Scintilla.framework in CopyFiles */ = {isa = PBXBuildFile; fileRef = 2744E5EA0FC16BE200E85C33 /* Scintilla.framework */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
@ -191,7 +191,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0510;
LastUpgradeCheck = 0930;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ScintillaTest" */;
compatibilityVersion = "Xcode 3.2";
@ -285,7 +285,7 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
@ -294,15 +294,13 @@
GCC_OPTIMIZATION_LEVEL = 0;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ScintillaTest_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
SCI_LEXER,
SCI_NAMESPACE,
);
GCC_PREPROCESSOR_DEFINITIONS = SCI_LEXER;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = ScintillaTest;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "";
@ -313,22 +311,20 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_ENABLE_OBJC_WEAK = YES;
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_MODEL_TUNING = G5;
GCC_PRECOMPILE_PREFIX_HEADER = YES;
GCC_PREFIX_HEADER = ScintillaTest_Prefix.pch;
GCC_PREPROCESSOR_DEFINITIONS = (
SCI_LEXER,
SCI_NAMESPACE,
);
GCC_PREPROCESSOR_DEFINITIONS = SCI_LEXER;
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "";
PRODUCT_BUNDLE_IDENTIFIER = "com.sun.${PRODUCT_NAME:identifier}";
PRODUCT_NAME = ScintillaTest;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "";
@ -338,14 +334,28 @@
C01FCF4F08A954540054247B /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
ENABLE_TESTABILITY = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
@ -363,14 +373,27 @@
C01FCF5008A954540054247B /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_COMMA = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INFINITE_RECURSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
CLANG_WARN_STRICT_PROTOTYPES = YES;
CLANG_WARN_SUSPICIOUS_MOVE = YES;
CLANG_WARN_UNREACHABLE_CODE = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
ENABLE_STRICT_OBJC_MSGSEND = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_NO_COMMON_BLOCKS = YES;
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
GCC_WARN_ABOUT_RETURN_TYPE = YES;

View File

@ -0,0 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Workspace
version = "1.0">
<FileRef
location = "self:ScintillaTest.xcodeproj">
</FileRef>
</Workspace>

View File

@ -23,7 +23,6 @@
#define WM_COMMAND 1001
#define WM_NOTIFY 1002
namespace Scintilla {
/**
* On the Mac, there is no WM_COMMAND or WM_NOTIFY message that can be sent
* back to the parent. Therefore, there must be a callback handler that acts
@ -35,34 +34,25 @@ namespace Scintilla {
* <br>
* WM_NOTIFY: wParam = control ID, lParam = ptr to SCNotification structure, with hwndFrom set to ScintillaCocoa*
*/
typedef void(*SciNotifyFunc) (intptr_t windowid, unsigned int iMessage, uintptr_t wParam, uintptr_t lParam);
class ScintillaCocoa;
}
@class ScintillaView;
typedef void(*SciNotifyFunc)(intptr_t windowid, unsigned int iMessage, uintptr_t wParam, uintptr_t lParam);
extern NSString *const SCIUpdateUINotification;
@protocol ScintillaNotificationProtocol
- (void)notification: (Scintilla::SCNotification*)notification;
- (void) notification: (SCNotification *) notification;
@end
/**
* SCIScrollView provides pre-macOS 10.14 tiling behavior.
*/
@interface SCIScrollView : NSScrollView;
@end
/**
* SCIMarginView draws line numbers and other margins next to the text view.
*/
@interface SCIMarginView : NSRulerView
{
@private
int marginWidth;
ScintillaView *owner;
NSMutableArray *currentCursors;
}
@property (assign) int marginWidth;
@property (assign) ScintillaView *owner;
- (id)initWithScrollView:(NSScrollView *)aScrollView;
@interface SCIMarginView : NSRulerView;
@end
@ -74,85 +64,59 @@ extern NSString *const SCIUpdateUINotification;
NSTextInputClient,
NSUserInterfaceValidations,
NSDraggingSource,
NSDraggingDestination>
{
@private
ScintillaView* mOwner;
NSCursor* mCurrentCursor;
NSTrackingArea *trackingArea;
NSDraggingDestination,
NSAccessibilityStaticText>;
// Set when we are in composition mode and partial input is displayed.
NSRange mMarkedTextRange;
}
@property (nonatomic, assign) ScintillaView* owner;
- (void) setCursor: (int) cursor;
- (BOOL) canUndo;
- (BOOL) canRedo;
- (void) setCursor: (int) cursor; // Needed by ScintillaCocoa
@end
@interface ScintillaView : NSView <InfoBarCommunicator, ScintillaNotificationProtocol>
{
@private
// The back end is kind of a controller and model in one.
// It uses the content view for display.
Scintilla::ScintillaCocoa* mBackend;
/**
* ScintillaView is the class instantiated by client code.
* It contains an NSScrollView which contains a SCIMarginView and a SCIContentView.
* It is responsible for providing an API and communicating to a delegate.
*/
@interface ScintillaView : NSView <InfoBarCommunicator, ScintillaNotificationProtocol>;
// This is the actual content to which the backend renders itself.
SCIContentView* mContent;
NSScrollView *scrollView;
SCIMarginView *marginView;
CGFloat zoomDelta;
// Area to display additional controls (e.g. zoom info, caret position, status info).
NSView <InfoBarCommunicator>* mInfoBar;
BOOL mInfoBarAtTop;
id<ScintillaNotificationProtocol> mDelegate;
}
@property (nonatomic, readonly) Scintilla::ScintillaCocoa* backend;
@property (nonatomic, assign) id<ScintillaNotificationProtocol> delegate;
@property (nonatomic, readonly) NSScrollView *scrollView;
@property(nonatomic, unsafe_unretained) id<ScintillaNotificationProtocol> delegate;
@property(nonatomic, readonly) NSScrollView *scrollView;
+ (Class) contentViewClass;
- (void) notify: (NotificationType) type message: (NSString*) message location: (NSPoint) location
- (void) notify: (NotificationType) type message: (NSString *) message location: (NSPoint) location
value: (float) value;
- (void) setCallback: (id <InfoBarCommunicator>) callback;
- (void) suspendDrawing: (BOOL) suspend;
- (void) notification: (Scintilla::SCNotification*) notification;
- (void) notification: (SCNotification *) notification;
- (void) updateIndicatorIME;
// Scroller handling
- (void) setMarginWidth: (int) width;
- (SCIContentView*) content;
- (SCIContentView *) content;
- (void) updateMarginCursors;
// NSTextView compatibility layer.
- (NSString*) string;
- (void) setString: (NSString*) aString;
- (NSString *) string;
- (void) setString: (NSString *) aString;
- (void) insertText: (id) aString;
- (void) setEditable: (BOOL) editable;
- (BOOL) isEditable;
- (NSRange) selectedRange;
- (NSRange) selectedRangePositions;
- (NSString*) selectedString;
- (NSString *) selectedString;
- (void) deleteRange: (NSRange) range;
- (void)setFontName: (NSString*) font
- (void) setFontName: (NSString *) font
size: (int) size
bold: (BOOL) bold
italic: (BOOL) italic;
// Native call through to the backend.
+ (sptr_t) directCall: (ScintillaView*) sender message: (unsigned int) message wParam: (uptr_t) wParam
+ (sptr_t) directCall: (ScintillaView *) sender message: (unsigned int) message wParam: (uptr_t) wParam
lParam: (sptr_t) lParam;
- (sptr_t) message: (unsigned int) message wParam: (uptr_t) wParam lParam: (sptr_t) lParam;
- (sptr_t) message: (unsigned int) message wParam: (uptr_t) wParam;
@ -165,38 +129,38 @@ extern NSString *const SCIUpdateUINotification;
- (long) getGeneralProperty: (int) property;
- (long) getGeneralProperty: (int) property parameter: (long) parameter;
- (long) getGeneralProperty: (int) property parameter: (long) parameter extra: (long) extra;
- (long) getGeneralProperty: (int) property ref: (const void*) ref;
- (void) setColorProperty: (int) property parameter: (long) parameter value: (NSColor*) value;
- (void) setColorProperty: (int) property parameter: (long) parameter fromHTML: (NSString*) fromHTML;
- (NSColor*) getColorProperty: (int) property parameter: (long) parameter;
- (void) setReferenceProperty: (int) property parameter: (long) parameter value: (const void*) value;
- (const void*) getReferenceProperty: (int) property parameter: (long) parameter;
- (void) setStringProperty: (int) property parameter: (long) parameter value: (NSString*) value;
- (NSString*) getStringProperty: (int) property parameter: (long) parameter;
- (void) setLexerProperty: (NSString*) name value: (NSString*) value;
- (NSString*) getLexerProperty: (NSString*) name;
- (long) getGeneralProperty: (int) property ref: (const void *) ref;
- (void) setColorProperty: (int) property parameter: (long) parameter value: (NSColor *) value;
- (void) setColorProperty: (int) property parameter: (long) parameter fromHTML: (NSString *) fromHTML;
- (NSColor *) getColorProperty: (int) property parameter: (long) parameter;
- (void) setReferenceProperty: (int) property parameter: (long) parameter value: (const void *) value;
- (const void *) getReferenceProperty: (int) property parameter: (long) parameter;
- (void) setStringProperty: (int) property parameter: (long) parameter value: (NSString *) value;
- (NSString *) getStringProperty: (int) property parameter: (long) parameter;
- (void) setLexerProperty: (NSString *) name value: (NSString *) value;
- (NSString *) getLexerProperty: (NSString *) name;
// The delegate property should be used instead of registerNotifyCallback which is deprecated.
- (void) registerNotifyCallback: (intptr_t) windowid value: (Scintilla::SciNotifyFunc) callback __attribute__((deprecated));
- (void) registerNotifyCallback: (intptr_t) windowid value: (SciNotifyFunc) callback __attribute__ ( (deprecated)) ;
- (void) setInfoBar: (NSView <InfoBarCommunicator>*) aView top: (BOOL) top;
- (void) setStatusText: (NSString*) text;
- (void) setInfoBar: (NSView <InfoBarCommunicator> *) aView top: (BOOL) top;
- (void) setStatusText: (NSString *) text;
- (BOOL) findAndHighlightText: (NSString*) searchText
- (BOOL) findAndHighlightText: (NSString *) searchText
matchCase: (BOOL) matchCase
wholeWord: (BOOL) wholeWord
scrollTo: (BOOL) scrollTo
wrap: (BOOL) wrap;
- (BOOL) findAndHighlightText: (NSString*) searchText
- (BOOL) findAndHighlightText: (NSString *) searchText
matchCase: (BOOL) matchCase
wholeWord: (BOOL) wholeWord
scrollTo: (BOOL) scrollTo
wrap: (BOOL) wrap
backwards: (BOOL) backwards;
- (int) findAndReplaceText: (NSString*) searchText
byText: (NSString*) newText
- (int) findAndReplaceText: (NSString *) searchText
byText: (NSString *) newText
matchCase: (BOOL) matchCase
wholeWord: (BOOL) wholeWord
doAll: (BOOL) doAll;

File diff suppressed because it is too large Load Diff

View File

@ -14,7 +14,7 @@ make test
cd ../../..
# ************************************************************
# Target 2: build framework and test app with Xcode targetting OS X 10.n with n from 9 to 5
# Target 2: build framework and test app with Xcode targeting OS X 10.n with n from 9 to 5
# Only SDK versions that are installed will be built
# Clean both then build both -- if perform clean in ScintillaTest, also cleans ScintillaFramework
# which can cause double build

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 1.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 1.3 KiB

View File

@ -1 +1 @@
del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog >NUL:
@del /S /Q *.a *.aps *.bsc *.dll *.dsw *.exe *.idb *.ilc *.ild *.ilf *.ilk *.ils *.lib *.map *.ncb *.obj *.o *.opt *.pdb *.plg *.res *.sbr *.tds *.exp *.tlog >NUL:

View File

@ -1 +0,0 @@
del /S /Q .cvsignore

View File

@ -6,6 +6,7 @@
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Scintilla and SciTE
</title>
@ -48,14 +49,14 @@
library and with limited use of templates.
</p>
<p>
The currently supported platforms, Windows, GTK+/Linux and wxWindows are fairly similar in
The currently supported platforms, Windows, GTK+/Linux, Cocoa and wxWidgets are fairly similar in
many ways.
Each has windows, menus and bitmaps. These features generally work in similar ways so each
has a way to move a window or draw a red line. Sometimes one platform requires a sequence of
calls rather than a single call. At other times, the differences are more profound. Reading
the Windows clipboard occurs synchronously but reading the GTK+ clipboard requires a request
call that will be asynchronously answered with a message containing the clipboard data.
The wxWindows platform is available from the <a href="http://wxwindows.org/">wxWindows site</a>
The wxWidgets platform is available from the <a href="http://wxwidgets.org/">wxWidgets site</a>
</p>
<br />
<h3>
@ -86,25 +87,21 @@
the name of a macro on Windows.
</p>
<h4>
Colour, ColourPair, Palette
ColourDesired
</h4>
<p>
Colour holds a platform specific colour identifier - COLORREF for Windows and GdkColor for
GTK+. The red, green and blue components that make up the colour are limited to the 8 bits of
precision available on Windows. ColourPairs are used because not all possible colours are
always available. Using an 8 bit colour mode, which is a common setting for both Windows and
GTK+, only 256 colours are possible on the display. Thus when an application asks for a dull
red, say #400000, it may only be allocated an already available colour such as #800000 or
#330000. With 16 or 2 colour modes even less choice is available and the application will
have to use the limited set of already available colours.
This is a simple class holding an expected colour. It is internally represented as a single
32 bit integer in BGR format with 8 bits per colour, but also provides a convenient API to fetch
each component separately.
As a platform might not be able to represent the exact desired colour if it doesn't have 24 bit
depth available, it might not actually represent the exact desired colour but select a best fit
that it can actually render.
</p>
A Palette object holds a set of colour pairs and can make the appropriate calls to ask to
allocate these colours and to see what the platform has decided will be allowed.
<h4>
Font
</h4>
<p>
Font holds a platform specific font identifier - HFONT for Windows, GdkFont* for GTK+. It
Font holds a platform specific font identifier - HFONT for Windows, PangoFontDescription* for GTK+. It
does not own the identifier and so will not delete the platform font object in its
destructor. Client code should call Destroy at appropriate times.
</p>
@ -115,8 +112,8 @@
Surface is an abstraction over each platform's concept of somewhere that graphical drawing
operations can be done. It may wrap an already created drawing place such as a window or be
used to create a bitmap that can be drawn into and later copied onto another surface. On
Windows it wraps a HDC and possibly a HBITMAP. On GTK+ it wraps a GdkDrawable* and possibly a
GdkPixmap*. Other platform specific objects are created (and correctly destroyed) whenever
Windows it wraps a HDC and possibly a HBITMAP. On GTK+ it wraps a cairo_surface_t*.
Other platform specific objects are created (and correctly destroyed) whenever
required to perform drawing actions.
</p>
<p>
@ -146,7 +143,7 @@
</h4>
<p>
Menu is a small helper class for constructing popup menus. It contains the platform specific
menu identifier - HMENU for Windows, GtkItemFactory* for GTK+. Most of the work in
menu identifier - HMENU for Windows, GtkMenu* for GTK+. Most of the work in
constructing menus requires access to platform events and so is done in the Platform Events
and API layer.
</p>

View File

@ -6,6 +6,7 @@
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Scintilla icons
</title>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.3 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 8.2 KiB

View File

@ -0,0 +1,70 @@
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Privacy Policy
</title>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<img src="SciTEIco.png" border="3" height="64" width="64" alt="Scintilla icon" />
</td>
<td>
<a href="index.html" style="color:white;text-decoration:none"><font size="5">Scintilla
and SciTE</font></a>
</td>
</tr>
</table>
<h2>
Privacy Policy for scintilla.org
</h2>
<h3>
Information Collected
</h3>
<p>
Logs are collected to allow analysis of which pages are viewed.
The advertisements collect viewing information through Google Analytics which is
used by Google and advertisers.
No personally identifiable information is collected by scintilla.org.
</p>
<h3>
External Links
</h3>
<p>
Other web sites are linked to from this site.
These web sites have their own privacy policies which may differ significantly to those of scintilla.org.
</p>
<h3>
Cookies
</h3>
<p>
A cookie is a text file placed on the hard drive of a computer by some web pages which is used to remember
when a particular user returns to that site.
The advertisements shown on the main pages may use cookies.
</p>
<h3>
Contact
</h3>
<p>
This web site is the responsibility of Neil Hodgson.
Most queries about the site contents should go to one of the mailing lists mentioned on the main pages.
Queries about the privacy policy may be sent to neilh @ scintilla.org.
</p>
<h3>
Changes to this Policy
</h3>
<p>
This policy may change. If it does then this page will be updated and the date at the bottom will change.
</p>
<p>
This policy was last updated 2 June 2015.
</p>
</body>
</html>

View File

@ -5,6 +5,7 @@
<head>
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Scintilla and SciTE Code Style Preferences
</title>
@ -123,6 +124,8 @@
compilers on diverse platforms with high performance and low resource usage.
Scintilla has stricter portability requirements to SciTE as it may be ported to
low capability platforms.
Scintilla code must build with C++17 which can be checked with "g++ --std=c++17".
SciTE can use C++17 features that are widely available from g++ 7.1, MSVC 2017.6 and Clang 5.0 compilers.
</p>
<p>
To achieve portability, only a subset of C++ features are used.
@ -130,22 +133,28 @@
C++, exceptions may not be thrown out of Scintilla and all exceptions should be caught
before returning from Scintilla.
Run-time type information adds to memory use so is turned off.
A 'Scintilla' name spaces is optionally used based on the SCI_NAMESPACE
definition. This helps with name clashes on OS X.
A 'Scintilla' name space is used. This helps with name clashes on OS X.
</p>
<p>
The goto statement is not used because of bad memories from my first job
maintaining FORTRAN programs. The union feature is not used as it can lead to
non-type-safe value access.
</p>
<p>
The SCI_METHOD preprocessor definition should be used when implementing
interfaces which include it like ILexer and only there.
</p>
<p>
Headers should always be included in the same order as given by the
scripts/HeaderOrder.txt file.
</p>
<h3>
Casting
</h3>
<p>
Do not use old C style casts like (char *)s. Instead use the most strict form of C++
cast possible like const_cast&lt;char *&gt;(s). Use static_cast and const_cast
where possible rather than reinterpret_cast. Because the code is compiled with
run-time type information turned off, dynamic_cast will not work.
where possible rather than reinterpret_cast.
</p>
<p>
The benefit to using the new style casts is that they explicitly detail what evil is
@ -255,5 +264,31 @@
<p>Ensure there are no warnings under the compiler you use. Warnings from other compilers
will be noted on the feature request.</p>
<p>sc.ch is an int: do not pass this around as a char.</p>
<p>The ctype functions like isalnum and isdigit only work on ASCII (0..127) and may cause
undefined behaviour including crashes if used on other values. Check with IsASCII before calling is*.</p>
<p>Functions, structs and classes in lexers should be in an unnamed namespace (see LexCPP)
or be marked "static" so they will not leak into other lexers.</p>
<p>If you copy from an existing lexer, remove any code that is not needed since it makes it
more difficult to maintain and review.</p>
<p>When modifying an existing lexer, try to maintain as much compatibility as possible.
Do not renumber lexical styles as current client code may be built against the earlier values.</p>
<h4>
Properties
</h4>
<p>
Properties provided by a new lexer should follow the naming conventions
and should include a comment suitable for showing to end users.
The convention is for properties that control styling to be named
lexer.&lt;lexername&gt;.* and those that control folding to be named
fold.&lt;lexername&gt;.*.
Examples are "lexer.python.literals.binary" and "fold.haskell.imports".
</p>
<p>
The properties "fold" and "fold.comment" are generic and can be used by
any lexer.
</p>
<p>
See LexPython for examples of properties in an object lexer and LexHTML for a functional lexer.
</p>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 9.9 KiB

After

Width:  |  Height:  |  Size: 9.5 KiB

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Download Scintilla
</title>
@ -25,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla356.zip?download">
<font size="4"> <a href="https://www.scintilla.org/scintilla414.zip">
Windows</a>&nbsp;&nbsp;
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla356.tgz?download">
<a href="https://www.scintilla.org/scintilla414.tgz">
GTK+/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -41,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 3.5.6
Release 4.1.4
</h3>
<h4>
Source Code
@ -49,8 +50,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/scintilla356.zip?download">zip format</a> (1450K) commonly used on Windows</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla356.tgz?download">tgz format</a> (1300K) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/scintilla414.zip">zip format</a> (1700K) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/scintilla414.tgz">tgz format</a> (1500K) 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>

File diff suppressed because it is too large Load Diff

View File

@ -6,6 +6,7 @@
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Scintilla and SciTE Related Sites
</title>
@ -37,7 +38,7 @@
is a port to MorphOS.
</p>
<p>
<a href="https://metacpan.org/module/Wx::Scintilla">Wx::Scintilla</a>
<a href="https://metacpan.org/pod/Wx::Scintilla">Wx::Scintilla</a>
is a Perl Binding for Scintilla on wxWidgets.
</p>
<p>
@ -49,7 +50,7 @@
these programs, using all the typical GObject conventions.
</p>
<p>
<a href="http://mewsoft.com/cgi-bin/forum/forum.cgi?action=ViewTopic&Topic=1494&Forum=1&Page=1&Period=0a&Lang=English">Editawy</a>
<a href="http://www.mewsoft.com/forums/source-code-editor-activex-control-released-scintilla-activex-wrapper-control&amp;action=ViewTopic&amp;Topic=1494&amp;Forum=1&amp;Page=1&amp;Period=0a&amp;Lang=English">Editawy</a>
is an ActiveX Control wrapper that support all Scintilla functions and additional high level functions.
</p>
<p>
@ -75,7 +76,7 @@
</a> is an encapsulation of Scintilla for use within the .NET framework.
</p>
<p>
<a href="http://www.riverbankcomputing.co.uk/software/qscintilla/intro">QScintilla
<a href="https://riverbankcomputing.com/software/qscintilla/intro">QScintilla
</a> is a port of Scintilla to the Qt platform. It has a similar license to Qt: GPL for use in
free software and commercial for use in close-source applications.
</p>
@ -127,7 +128,24 @@
Projects using Scintilla
</h3>
<p>
<a href="http://rhaberkorn.github.com/sciteco/">SciTECO</a>
<a href="https://github.com/martinrotter/textilosaurus">Textilosaurus</a>
is simple cross-platform UTF-8 text editor based on Qt and Scintilla.
</p>
<p>
<a href="http://stefanstools.sourceforge.net/BowPad.html">BowPad</a>
is a small and fast text editor with a modern ribbon user interface (Windows7 or later).
</p>
<p>
<a href="http://studio.zerobrane.com">ZeroBrane Studio Lua IDE</a>
is a lightweight Lua IDE with code completion, syntax highlighting, live
coding, remote debugger, and code analyzer (Windows, OSX, and Linux).
</p>
<p>
<a href="http://www.xml-buddy.com/">XML Validator Buddy</a>
is an XML/JSON editor and XML validator for Windows.
</p>
<p>
<a href="http://sciteco.sf.net/">SciTECO</a>
is an advanced TECO dialect and interactive screen editor based on Scintilla.
</p>
<p>
@ -153,7 +171,7 @@
is a cross-platform, visual database design, sql coding and administration tool.
</p>
<p>
<a href="http://liveditor.com/index.html">LIVEditor</a>
<a href="http://liveditor.com/index.php">LIVEditor</a>
is for web front end coders editing html/css/js code.
</p>
<p>
@ -161,8 +179,8 @@
is a wxWidgets-based Perl IDE.
</p>
<p>
<a href="http://manoscoder.gr/CoderStudio/CoderStudio.asp">CoderStudio</a>
is an IDE for Assembly programming similar to Visual Studio 6.0.
<a href="http://www.manoscoder.gr/wintools/viewtopic.php?f=20&t=84">CoderStudio</a>
is an IDE for plain C and Assembly programming similar to Visual Studio.
</p>
<p>
<a href="http://www.sparxsystems.com/products/ea/index.html">Enterprise Architect</a>
@ -170,14 +188,14 @@
</p>
<p>
<a href="https://launchpad.net/codeassistor">The CodeAssistor Editor</a>
is a small and simple MacOSX source code editor.
is a small and simple source code editor for MacOSX, Windows, and GTK/Linux.
</p>
<p>
<a href="http://www.topwizprogramming.com/freecode_pbeditor.html">PBEditor</a>
is a text editor for PowerBuilder.
</p>
<p>
<a href="http://www.cryptool.org/">CrypTool</a>
<a href="https://www.cryptool.org/en/">CrypTool</a>
is an application for applying and analyzing cryptographic algorithms.
</p>
<p>
@ -190,34 +208,22 @@
is a simple programming language with a Visual Basic like syntax.
</p>
<p>
<a href="http://www.daansystems.com/lispide">LispIDE</a>
<a href="http://www.daansystems.com/lispide/">LispIDE</a>
is a basic Lisp editor for Windows 2000, XP and Vista.
</p>
<p>
<a href="http://www.flexsoft.cc/download.htm">FlexEdit</a>
is Free Text/Hex Editor for Windows.
</p>
<p>
<a href="http://www.assembla.com/wiki/show/FileWorkbench">File Workbench:</a>
<a href="https://www.assembla.com/wiki/show/FileWorkbench">File Workbench:</a>
a file manager / text editor environment with Squirrel scripting.
</p>
<p>
<a href="http://kephra.sf.net">Kephra</a>
is a free, easy and comfortable cross-platform editor written in Perl.
</p>
<p>
<a href="http://top.gresham-computing.com">TOP</a>
is an interface to HP's NonStop servers which run a proprietary OS.
</p>
<p>
<a href="http://universalindent.sourceforge.net/">UniversalIndentGUI</a>
is a cross platform GUI for several code formatters, beautifiers and indenters
like GreatCode, AStyle (Artistic Styler), GNU Indent, BCPP and so on.
</p>
<p>
<a href="http://scitools.com/products/trackback/product.php">TrackBack</a>
watches and backs up every change made in your source code.
</p>
<p>
<a href="http://elementaryreports.com/">Elementary Reports</a>
is designed to reduce the time to compose detailed and professional primary school reports.
@ -233,12 +239,12 @@
class diagrams.
</p>
<p>
The <a href="http://www.adobe.com/devnet/bridge/">ExtendScript Toolkit</a>
The <a href="http://www.adobe.com/devnet/bridge.html">ExtendScript Toolkit</a>
is a development and debugging tool for JavaScript
scripts included with Adobe CS3 Suites.
</p>
<p>
<a href="http://tortoisesvn.net/">TortoiseSVN</a>
<a href="https://tortoisesvn.net/">TortoiseSVN</a>
is a Windows GUI client for the Subversion source control software.
</p>
<p>
@ -263,7 +269,7 @@
is a graphical user interface for changing SciTE properties files.
</p>
<p>
<a href="http://www.totalcmd.net/plugring/SciLister.html">Scintilla Lister</a>
<a href="http://totalcmd.net/plugring/SciLister.html">Scintilla Lister</a>
is a plugin for Total Commander allowing viewing all documents with syntax highlighting
inside Total Commander.
</p>
@ -279,7 +285,7 @@
Code::Blocks</a> is an open source, cross platform free C++ IDE.
</p>
<p>
<a href="http://notepad-plus.sourceforge.net/uk/site.htm">
<a href="https://notepad-plus-plus.org/">
Notepad++</a> is a free source code editor under Windows.
</p>
<p>
@ -291,7 +297,7 @@
LSW DotNet-Lab</a> is a development environment for the .NET platform.
</p>
<p>
<a href="http://glintercept.nutty.org/">
<a href="https://github.com/dtrebilco/glintercept">
GLIntercept</a> is an OpenGL function call interceptor that uses SciTE as a
run-time shader editor.
</p>
@ -308,7 +314,7 @@
PyCrash Viewer</a> can examine crash dumps of Python programs.
</p>
<p>
<a href="http://www.cabletest.com/mpt-wa-software-discovery.shtml">
<a href="http://www.cabletest.com/en/featured_products_MPT2.aspx">
MPT series Wire Analyzers</a> use Scintilla and SciTE.
</p>
<p>
@ -330,18 +336,14 @@
is a user-friendly source code editor easily extended using Python.
</p>
<p>
<a href="http://www.spaceblue.com/venis/">
<a href="http://www.spaceblue.com/products/venis/index.html">
Venis IX</a>,
the Visual Environment for NSIS (Nullsoft Scriptable Install System).
</p>
<p>
<a href="http://www.die-offenbachs.de/detlev/eric.html">Eric3</a>
<a href="http://eric-ide.python-projects.org/">Eric3</a>
is a Python IDE written using PyQt and QScintilla.
</p>
<p>
<a href="http://www.bomberstudios.com/sciteflash/">SciTE|Flash</a>
is a free Scintilla-based ActionScript editor for Windows.
</p>
<p>
<a href="http://www.computersciencelab.com/CppIde.htm">CPPIDE</a>
is part of some commercial high-school oriented programming course software.
@ -358,26 +360,18 @@
<a href="http://wxbasic.sourceforge.net/">wxBasic</a> is an open source
Basic interpreter that uses the wxWidgets toolkit. A small IDE is under construction.
</p>
<p>
<a href="http://freeride.rubyforge.org/wiki/wiki.pl">FreeRIDE</a> will be a
cross-platform IDE for the Ruby programming language.
</p>
<p>
<a href="http://visual-mingw.sourceforge.net/">Visual MinGW</a> is an
IDE for the MinGW compiler system.This runs on Windows with gcc.
</p>
<p>
The <a href="http://archaeopteryx.com/wingide">Wing IDE</a> is a
The <a href="http://archaeopteryx.com/">Wing IDE</a> is a
complete integrated development environment for the Python programming
language.
Available on Intel based Linux and Windows and on MacOS X through XDarwin.
</p>
<p>
<a href="http://www.gorlice.net.pl/~rybak/luaide/">LuaIDE</a>
is an IDE for Lua on Windows.
</p>
<p>
<a href="http://www.aegisknight.org/sphere/">Sphere</a>
<a href="http://www.spheredev.org/">Sphere</a>
is 2D RPG engine with a development environment.
</p>
<p>
@ -398,20 +392,10 @@
is a Python debugger that can run on one Windows machine debugging a Python program running
on either the same or another machine.
</p>
<p>
<a href="http://www.rexx.com/~dkuhlman/">pyeditor and wxEditor</a>
are scriptable editors implemented in Python. pyeditor is based on GTK+ and
the pyscintilla wrapper. wxEditor is based on wxWidgets, wxPython and
wxStyledTextControl.
</p>
<p>
<a href="http://sourceforge.net/projects/pycrust/">PyCrust</a> is an interactive
Python shell based on wxPython.
</p>
<p>
<a href="http://www.thekompany.com/products/blackadder/">Black Adder</a> is a
Qt based development environment for Python and Ruby.
</p>
<p>
<a href="http://www.activestate.com/Products/Komodo/">Komodo</a>
is a cross-platform multi-language development environment built
@ -424,16 +408,16 @@
will be of interest to others wanting to control SciTE.
</p>
<p>
<a href="http://anjuta.sourceforge.net/">Anjuta</a>
<a href="http://anjuta.org/">Anjuta</a>
is an open source C/C++ IDE for Linux/GNOME.
</p>
<p>
A <a href="http://www.burgaud.com">version of SciTE for Win32</a> enhanced
A <a href="https://www.burgaud.com">version of SciTE for Win32</a> enhanced
with a tab control to allow easy movement between buffers.
Go to the "Goodies" area on this site.
</p>
<p>
<a href="http://www.suneido.com">
<a href="http://suneido.com">
Suneido</a> is an integrated application platform currently available for Win32 that includes an
object-oriented language, client-server database, and user interface and reporting frameworks.
</p>
@ -448,18 +432,22 @@
wxStyledTextCtrl used as its editor.
</p>
<p>
<a href="http://www.python.org/download/windows/">PythonWin</a>, a Win32 IDE for Python, uses
<a href="https://www.python.org/download/windows/">PythonWin</a>, a Win32 IDE for Python, uses
Scintilla for both its editing and interactive windows.
</p>
<h3>
Editing Components
</h3>
<p>
<a href="https://codemirror.net/">CodeMirror</a>
is a versatile text editor implemented in JavaScript for the browser.
</p>
<p>
<a href="http://www.soft-gems.net/index.php/controls/unicodeeditor-formerly-unicode-syntax-editor">UniCodeEditor</a>
is a Unicode aware syntax editor control for Delphi and C++ Builder.
</p>
<p>
<a href="http://projects.gnome.org/gtksourceview/">GtkSourceView</a>
<a href="https://wiki.gnome.org/Projects/GtkSourceView">GtkSourceView</a>
is a text widget that extends the standard GTK+ 2.x text widget and improves it
by implementing syntax highlighting and other features typical of a source editor.
</p>
@ -468,7 +456,7 @@
is a free source code editing component implemented in Ruby.
</p>
<p>
<a href="http://www.actiprosoftware.com/Products/DotNet/SyntaxEditor/Default.aspx">SyntaxEditor</a>
<a href="http://www.actiprosoftware.com/products/controls/wpf/syntaxeditor">SyntaxEditor</a>
is a commercial native .Net source code editing component.
</p>
<p>
@ -478,7 +466,7 @@
<p>
<a href="http://www.gtk.org/">GTK+</a>, the GIMP Toolkit, contains a rich text editing
widget.<br />
<a href="http://gedit.sourceforge.net/">Gedit</a> is an editor for GTK+/GNOME.<br />
<a href="https://wiki.gnome.org/Apps/Gedit">Gedit</a> is an editor for GTK+/GNOME.<br />
<!--
<a href="http://www.daimi.au.dk/~mailund/gtk.html">GtkEditor</a> is a source code editing
widget based on the GTK+ text widget.<br />
@ -491,15 +479,12 @@
<a href="http://www.codeguru.com/">CodeGuru</a> has source code for several Win32 MFC based
editors.
</p>
<a href="http://synedit.sourceforge.net/">SynEdit</a> is a Win32 edit control written
<a href="http://sourceforge.net/projects/synedit/">SynEdit</a> is a Win32 edit control written
in Delphi.
<p>
<a href="http://www.tetradyne.com/srcvwax.htm">SourceView</a> is a commercial editing
component for Win32.
</p>
<p>
<a href="http://www.winmain.com/">CodeMax</a> is another commercial component for Win32.
</p>
<h3>
Documents
</h3>
@ -535,9 +520,9 @@
WinMerge over the files to work out how to merge.
</p>
<p>
<a href="http://www.python.org">Python</a> is my favourite programming language. Scintilla
<a href="https://www.python.org">Python</a> is my favourite programming language. Scintilla
was started after I tried to improve the editor built into <a
href="http://www.python.org/download/windows/">PythonWin</a>, but was frustrated by the limitations of
href="https://www.python.org/download/windows/">PythonWin</a>, but was frustrated by the limitations of
the Windows Richedit control which PythonWin used.
</p>
<p>
@ -545,7 +530,7 @@
implementation of regular expression pattern matching used in Scintilla.
</p>
<p>
Inspirational coding soundscapes by <a href="http://www.davidbridie.com.au">David Bridie</a>.
Inspirational coding soundscapes by <a href="http://www.davidbridie.com/">David Bridie</a>.
</p>
</body>
</html>

View File

@ -6,6 +6,7 @@
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Scintilla and SciTE To Do
</title>
@ -29,8 +30,8 @@
Feedback
</h3>
<p>
Issues can be reported on the <a href="http://sourceforge.net/p/scintilla/bugs/">Bug Tracker</a>
and features requested on the <a href="http://sourceforge.net/p/scintilla/feature-requests/">Feature Request Tracker</a>.
Issues can be reported on the <a href="https://sourceforge.net/p/scintilla/bugs/">Bug Tracker</a>
and features requested on the <a href="https://sourceforge.net/p/scintilla/feature-requests/">Feature Request Tracker</a>.
</p>
<h3>
Scintilla Bugs

View File

@ -6,6 +6,7 @@
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Scintilla Usage Notes
</title>

View File

@ -0,0 +1,204 @@
<?xml version="1.0"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta name="generator" content="HTML Tidy, see www.w3.org" />
<meta name="generator" content="SciTE" />
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<title>
Scintilla Style Metadata
</title>
<style type="text/css">
<!--
/*<![CDATA[*/
CODE { font-weight: bold; font-family: Menlo,Consolas,Bitstream Vera Sans Mono,Courier New,monospace; }
/*]]>*/
-->
</style>
</head>
<body bgcolor="#FFFFFF" text="#000000">
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td>
<img src="SciTEIco.png" border="3" height="64" width="64" alt="Scintilla icon" />
</td>
<td>
<a href="index.html" style="color:white;text-decoration:none"><font size="5">Scintilla</font></a>
</td>
</tr>
</table>
<h2>
Language Types
</h2>
<p>
Scintilla contains lexers for various types of languages:
<ul>
<li>Programming languages like C++, Java, and Python.</li>
<li>Assembler languages are low-level programming languages which may additionally include instructions and registers.</li>
<li>Markup languages like HTML, TeX, and Markdown.</li>
<li>Data languages like EDIFACT and YAML.</li>
</ul>
</p>
<p>
Some languages can be used in different ways. JavaScript is a programming language but also
the basis of JSON data files. Similarly,
<a href="https://en.wikipedia.org/wiki/S-expression">Lisp s expressions</a> can be used for both source code and data.
</p>
<p>
Each language type has common elements such as identifiers in programming languages.
These common elements should be identified so that languages can be displayed with common
styles for these elements.
Style tags are used for this purpose in Scintilla.
</p>
<h2>
Style Tags
</h2>
<p>
Every style has a list of tags where a tag is a lower-case word containing only the common ASCII letters 'a'-'z'
such as "comment" or "operator".
</p>
<p>
Tags are ordered from most important to least important.
</p>
<p>
While applications may assign visual attributes for tag lists in many different ways, one reasonable technique is to
apply tag-specific attributes in reverse order so that earlier and more important tags override less important tags.
For example, the tag list <code>"error comment documentation keyword"</code> with
a set of tag attributes <br />
<code>{ comment=fore:green,back:very-light-green,font:Serif documentation=fore:light-green error=strikethrough keyword=bold }</code><br />
could be rendered as <br />
<code>bold,fore:light-green,back:very-light-green,font:Serif,strikethrough</code>.
</p>
<p>
Alternative renderings could check for multi-tag combinations like
<code>{ comment.documentation=fore:light-green comment.line=dark-green comment=green }.</code>
</p>
<p>
Commonly, a tag list will contain an optional embedded language; optional statuses; a base type; and a set of type modifiers:<br />
<code>embedded-language? status* base-type modifiers*</code>
</p>
<h3>Embedded language</h3>
<p>
The embedded language may be a source <code>(client | server)</code> followed by a language name
<code>(javascript | php | python | basic)</code>.
This may be extended in the future with other programming languages and style-definition languages like CSS.
</p>
<h3>Status</h3>
<p>
The statuses may be <code>(error | unused | predefined | inactive)</code>.<br />
The <code>error</code> status is used for lexical statuses that indicate errors in the source code such as unterminated quoted strings.<br />
The <code>unused</code> status may indicate a gap in the lexical states, possibly because an old lexical class is no longer used or an upcoming lexical class may fill that position.<br />
The <code>predefined</code> status indicates a style in the range 32.39 that is used for non-lexical purposes in Scintilla.<br />
The <code>inactive</code> status is used for text that is not currently interpreted such as C++ code that is contained within a '#if 0' preprocessor block.
</p>
<h3>Basic Types</h3>
<p>
The basic types for programming languages are <code>(default | operator | keyword | identifier | literal | comment | preprocessor | label)</code>.<br />
The <code>default</code> type is commonly used for spaces and tabs between tokens although it may cover other characters in some languages.
</p>
<p>
Assembler languages add <code>(instruction | register)</code>. to the basic types from programming languages.<br />
</p>
<p>
The basic types for markup languages are <code>(default | tag | attribute | comment | preprocessor)</code>.<br />
</p>
<p>
The basic types for data languages are <code>(default | key | data | comment)</code>.<br />
</p>
<h3>Comments</h3>
<p>
Programming languages may differentiate between line and stream comments and treat documentation comments as distinct from other comments.
Documentation comments may be marked up with documentation keywords.<br />
The additional attributes commonly used are <code>(line | documentation | keyword | taskmarker)</code>.
</p>
<h3>Literals</h3>
<p>
Programming and assembler languages contain a rich set of literals including numbers like <code>7</code> and <code>3.89e23</code>; <code>"string\n"</code>; and <code>nullptr</code>
and differentiating between these is often wanted.<br />
The common literal types are <code>(numeric | boolean | string | regex | date | time | uuid | nil | compound)</code>.<br />
Numeric literal types are subdivided into <code>(integer | real)</code>.<br />
String literal types may add (perhaps multiple) further attributes from <code> (heredoc | character | escapesequence | interpolated | multiline | raw)</code>.<br />
</p>
<p>
An escape sequence within an interpolated heredoc may thus be <code>literal string heredoc escapesequence</code>.
</p>
<h3>
List of known tags
</h3>
<table>
<tr><td><code>attribute</code></td><td>Markup attribute</td></tr>
<tr><td><code>basic</code></td><td>Embedded Basic</td></tr>
<tr><td><code>boolean</code></td><td>True or false literal</td></tr>
<tr><td><code>character</code></td><td>Single character literal as opposed to a string literal</td></tr>
<tr><td><code>client</code></td><td>Script executed on client</td></tr>
<tr><td><code>comment</code></td><td>The standard comment type in a language: may be stream or line</td></tr>
<tr><td><code>compound</code></td><td>Literal containing multiple subliterals such as a tuple or complex number</td></tr>
<tr><td><code>data</code></td><td>A value in a data file</td></tr>
<tr><td><code>date</code></td><td>Literal representing a data such as '19/November/1975'</td></tr>
<tr><td><code>default</code></td><td>Starting state commonly also used for white space</td></tr>
<tr><td><code>documentation</code></td><td>Comment that can be extracted into documentation</td></tr>
<tr><td><code>error</code></td><td>State indicating an invalid or erroneous element</td></tr>
<tr><td><code>escapesequence</code></td><td>Parts of a string that are not literal such as '\t' for tab in C</td></tr>
<tr><td><code>heredoc</code></td><td>Lengthy text literal marked by a word at both ends</td></tr>
<tr><td><code>identifier</code></td><td>Name that identifies an object or class of object</td></tr>
<tr><td><code>inactive</code></td><td>Code that is not currently interpreted</td></tr>
<tr><td><code>instruction</code></td><td>Mnemonic in assembler languages like 'addc'</td></tr>
<tr><td><code>integer</code></td><td>Numeric literal with no fraction or exponent like '738'</td></tr>
<tr><td><code>interpolated</code></td><td>String that can contain expressions</td></tr>
<tr><td><code>javascript</code></td><td>Embedded Javascript</td></tr>
<tr><td><code>key</code></td><td>Element which allows finding associated data</td></tr>
<tr><td><code>keyword</code></td><td>Reserved word with special meaning like 'while'</td></tr>
<tr><td><code>label</code></td><td>Destination for jumps in programming and assembler languages</td></tr>
<tr><td><code>line</code></td><td>Differentiates between stream comments and line comments in languages that have both</td></tr>
<tr><td><code>literal</code></td><td>Fixed value in source code</td></tr>
<tr><td><code>multiline</code></td><td>Differentiates between single line and multiline elements, commonly strings</td></tr>
<tr><td><code>nil</code></td><td>Literal for the null pointer such as nullptr in C++ or NULL in C</td></tr>
<tr><td><code>numeric</code></td><td>Literal number like '16'</td></tr>
<tr><td><code>operator</code></td><td>Punctuation character such as '&amp;' or '['</td></tr>
<tr><td><code>php</code></td><td>Embedded PHP</td></tr>
<tr><td><code>predefined</code></td><td>Style in the range 32.39 that is used for non-lexical purposes</td></tr>
<tr><td><code>preprocessor</code></td><td>Element that is recognized in an early stage of translation</td></tr>
<tr><td><code>python</code></td><td>Embedded Python</td></tr>
<tr><td><code>raw</code></td><td>String type that avoids interpretation: may be used for regular expressions in languages without a specific regex type</td></tr>
<tr><td><code>real</code></td><td>Numeric literal which may have a fraction or exponent like '3.84e-15'</td></tr>
<tr><td><code>regex</code></td><td>Regular expression literal like '^[a-z]+'</td></tr>
<tr><td><code>register</code></td><td>CPU register in assembler languages</td></tr>
<tr><td><code>server</code></td><td>Script executed on server</td></tr>
<tr><td><code>string</code></td><td>Sequence of characters</td></tr>
<tr><td><code>tag</code></td><td>Markup tag like '&lt;br /&gt;'</td></tr>
<tr><td><code>taskmarker</code></td><td>Word in comment that marks future work like 'FIXME'</td></tr>
<tr><td><code>time</code></td><td>Literal representing a time such as '9:34:31'</td></tr>
<tr><td><code>unused</code></td><td>Style that is not currently used</td></tr>
<tr><td><code>uuid</code></td><td>Universally unique identifier often used in interface definition files which may look like '{098f2470-bae0-11cd-b579-08002b30bfeb}'</td></tr>
</table>
<h2>
Extension
</h2>
<p>
Each element in this scheme may be extended in the future. This may be done by revising this document to provide a common approach to new features.
Individual lexers may also choose to expose unique language features through new tags.
</p>
<h2>
Translation
</h2>
<p>
Tags could be exposed directly in user interfaces or configuration languages.
However, an application may also translate these to match its naming schema.
Capitalization and punctuation could be different (like <code>Here-Doc</code> instead of <code>heredoc</code>),
terminology changed ("constant" instead of "literal"),
or human language changed from English to Chinese or Spanish.
</p>
<p>
Starting from a common set of tags makes these modifications tractable.
</p>
<h2>
Open issues
</h2>
<p>
The C++ lexer (for example) has inactive states and dynamically allocated substyles.
These should be exposed through the metadata mechanism but are not currently.
</p>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 33 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -9,7 +9,8 @@
<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="20150526" />
<meta name="Date.Modified" content="20190307" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
#versionlist {
margin: 0;
@ -37,7 +38,7 @@
<script type="text/javascript">
function IsRemote() {
var loc = '' + window.location;
return loc.indexOf('http:') != -1;
return (loc.indexOf('http:')) != -1 || (loc.indexOf('https:') != -1);
}
</script>
<title>
@ -55,8 +56,8 @@
GTK+, and OS X</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 3.5.6<br />
Site last modified May 26 2015</font>
<font color="#FFCC99" size="3"> Release version 4.1.4<br />
Site last modified March 7 2019</font>
</td>
<td width="20%">
&nbsp;
@ -65,40 +66,39 @@
</table>
<table bgcolor="#000000" width="100%" cellspacing="0" cellpadding="0" border="0">
<tr>
<td width="100%" style="background: url(http://www.scintilla.org/SciBreak.jpg) no-repeat;height:150px;">
<td width="100%" style="background: url(https://www.scintilla.org/SciBreak.jpg) no-repeat;height:150px;">
&nbsp;
</td>
</tr>
</table>
<ul id="versionlist">
<li>Version 3.5.6 fixes a bug with undo on Cocoa that could lose data.</li>
<li>Version 3.5.5 improves IME on Qt and fixes minor bugs.</li>
<li>Version 3.5.4 improves indicators to be able to change appearance on mouse-over and to use a wide variety of colours together.</li>
<li>Version 3.5.3 removes support for Windows 95, 98, and ME.</li>
<li>Version 3.5.2 only supports 64-bit builds for OS X 10.7+ Cocoa. Provisional support of C++11 &lt;regex&gt;.</li>
<li>Version 3.5.1 fixes minor bugs and includes a lexer for BibTeX.</li>
<li>Version 3.5.0 can share space vertically so that extreme ascenders and descenders are not cut off.
Separate timers are used to minimize wake ups and thus power use.</li>
<li>Version 4.1.4 makes calltips work on Qt and adds a lexer for .NET's Common Intermediate Language CIL.</li>
<li>Version 4.1.3 is compatible with macOS 10.14, improves performance, and adds a new lexer for Nim which will replace the "nimrod" lexer.</li>
<li>Version 4.1.2 is a minor release.</li>
<li>Version 4.1.1 adds optional indexing of line starts in UTF-8 documents by UTF-32 code points and UTF-16 code units.</li>
<li>Version 4.1.0 adds experimental support for bidirectional text as used by Arabic and Hebrew on Win32 and Cocoa.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="http://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
<li id="remote2"><a href="http://www.scintilla.org/ScintillaDownload.html">Download</a></li>
<li><a href="http://www.scintilla.org/ScintillaDoc.html">Documentation</a></li>
<li><a href="http://www.scintilla.org/ScintillaToDo.html">Bugs</a></li>
<li id="remote3"><a href="http://www.scintilla.org/SciTE.html">SciTE</a></li>
<li><a href="http://www.scintilla.org/ScintillaHistory.html">History</a></li>
<li><a href="http://www.scintilla.org/ScintillaRelated.html">Related</a></li>
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
<li id="remote2"><a href="https://www.scintilla.org/ScintillaDownload.html">Download</a></li>
<li><a href="https://www.scintilla.org/ScintillaDoc.html">Documentation</a></li>
<li><a href="https://www.scintilla.org/ScintillaToDo.html">Bugs</a></li>
<li id="remote3"><a href="https://www.scintilla.org/SciTE.html">SciTE</a></li>
<li><a href="https://www.scintilla.org/ScintillaHistory.html">History</a></li>
<li><a href="https://www.scintilla.org/ScintillaRelated.html">Related</a></li>
<li id="remote4"><a href="https://www.scintilla.org/Privacy.html">Privacy</a></li>
</ul>
<script type="text/javascript" language="JavaScript"><!--
if (!IsRemote()) { //if NOT remote...
document.getElementById('remote1').style.display='none';
document.getElementById('remote2').style.display='none';
document.getElementById('remote3').style.display='none';
document.getElementById('remote4').style.display='none';
}
//--></script>
<p>
<a href="http://www.scintilla.org/ScintillaDoc.html">Scintilla</a> is a free source code editing component.
It comes with complete source code and a <a href="http://www.scintilla.org/License.txt">license</a> that
<a href="https://www.scintilla.org/ScintillaDoc.html">Scintilla</a> is a free source code editing component.
It comes with complete source code and a <a href="https://www.scintilla.org/License.txt">license</a> that
permits use in any free project or commercial product.
</p>
<p>
@ -111,7 +111,14 @@ if (!IsRemote()) { //if NOT remote...
colours and multiple fonts.
</p>
<p>
<a href="http://www.scintilla.org/SciTE.html">SciTE</a> is a SCIntilla based Text Editor. Originally built to
Current development occurs on the default branch as 4.* which requires a recent
C++ compiler that supports C++17.
</p>
<p>
For projects that need to work with older systems, a LongTerm3 branch is available which uses only features from C++11.
</p>
<p>
<a href="https://www.scintilla.org/SciTE.html">SciTE</a> is a SCIntilla based Text Editor. Originally built to
demonstrate Scintilla, it has grown to be a generally useful editor with facilities for
building and running programs. It is best used for jobs with simple configurations - I use it
for building test and demonstration programs as well as SciTE and Scintilla, themselves.
@ -126,32 +133,36 @@ if (!IsRemote()) { //if NOT remote...
</p>
<p>
Scintilla and SciTE are currently available for Intel Win32, OS X, and Linux compatible operating
systems with GTK+. They have been run on Windows XP, Windows 7, OS X 10.6+, and on Ubuntu 10.10
with GTK+ 2.20. <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, OS X 10.7+, and on Ubuntu 14.04
with GTK+ 2.24. <a href="https://www.scintilla.org/SciTEImage.html">Here is a screenshot of
SciTE.</a><br />
</p>
<p>
You can <a href="http://www.scintilla.org/ScintillaDownload.html">download Scintilla.</a>
You can <a href="https://www.scintilla.org/ScintillaDownload.html">download Scintilla.</a>
</p>
<p>
The source code can be downloaded via Mercurial at the Source Forge
<a href="http://sourceforge.net/projects/scintilla/">Scintilla project page</a>.
<a href="https://sourceforge.net/projects/scintilla/">Scintilla project page</a>.
</p>
<p>
<a href="http://www.scintilla.org/ScintillaRelated.html">Related sites.</a>
<a href="https://www.scintilla.org/ScintillaRelated.html">Related sites.</a>
</p>
<p>
<a href="http://www.scintilla.org/ScintillaToDo.html">Bugs and To Do list.</a>
<a href="https://www.scintilla.org/ScintillaToDo.html">Bugs and To Do list.</a>
</p>
<p>
<a href="http://www.scintilla.org/ScintillaHistory.html">History and contribution credits.</a>
<a href="https://www.scintilla.org/ScintillaHistory.html">History and contribution credits.</a>
</p>
<p>
<a href="http://www.scintilla.org/Icons.html">Icons that can be used with Scintilla.</a>
<a href="https://www.scintilla.org/Icons.html">Icons that can be used with Scintilla.</a>
</p>
<p>
The <a href="https://scintilla.sourceforge.io/LongTermDownload.html">LongTerm3</a>
branch of Scintilla avoids using features from C++14 or later in order to support older systems.
</p>
<p>
Questions and comments about Scintilla should be directed to the
<a href="http://groups.google.com/group/scintilla-interest">scintilla-interest</a>
<a href="https://groups.google.com/forum/#!forum/scintilla-interest">scintilla-interest</a>
mailing list,
which is for discussion of Scintilla and related projects, their bugs and future features.
This is a low traffic list, averaging less than 20 messages per week.
@ -163,21 +174,21 @@ if (!IsRemote()) { //if NOT remote...
may receive no response.
<br />
</p>
There is a <a href="http://sourceforge.net/projects/scintilla/">Scintilla project page</a>
There is a <a href="https://sourceforge.net/projects/scintilla/">Scintilla project page</a>
hosted on
<script type="text/javascript" language="JavaScript">
<!--
if (IsRemote()) {
document.write('<a href="http://sourceforge.net/projects/scintilla/">');
document.write('<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> ');
document.write('<a href="https://sourceforge.net/projects/scintilla/">');
document.write('<img src="https://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a> ');
} else {
document.write('<a href="http://sourceforge.net/projects/scintilla/">SourceForge<\/a>');
document.write('<a href="https://sourceforge.net/projects/scintilla/">SourceForge<\/a>');
}
//-->
</script>
<noscript>
<a href="http://sourceforge.net/projects/scintilla">
<img src="http://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a>
<a href="https://sourceforge.net/projects/scintilla/">
<img src="https://sflogo.sourceforge.net/sflogo.php?group_id=2439&amp;type=8" width="80" height="15" alt="Get Scintilla at SourceForge.net. Fast, secure and Free Open Source software downloads" /></a>
</noscript>
</body>
</html>

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@ -6,25 +6,15 @@
#ifndef CONVERTER_H
#define CONVERTER_H
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
typedef GIConv ConverterHandle;
const ConverterHandle iconvhBad = (ConverterHandle)(-1);
// Since various versions of iconv can not agree on whether the src argument
// is char ** or const char ** provide a templatised adaptor.
template<typename T>
size_t iconv_adaptor(size_t(*f_iconv)(ConverterHandle, T, size_t *, char **, size_t *),
ConverterHandle cd, char** src, size_t *srcleft,
char **dst, size_t *dstleft) {
return f_iconv(cd, (T)src, srcleft, dst, dstleft);
}
const GIConv iconvhBad = (GIConv)(-1);
const gsize sizeFailure = static_cast<gsize>(-1);
/**
* Encapsulate iconv safely and avoid iconv_adaptor complexity in client code.
* Encapsulate g_iconv safely.
*/
class Converter {
ConverterHandle iconvh;
GIConv iconvh;
void OpenHandle(const char *fullDestination, const char *charSetSource) {
iconvh = g_iconv_open(fullDestination, charSetSource);
}
@ -45,15 +35,14 @@ public:
operator bool() const {
return Succeeded();
}
void Open(const char *charSetDestination, const char *charSetSource, bool transliterations=true) {
void Open(const char *charSetDestination, const char *charSetSource, bool transliterations) {
Close();
if (*charSetSource) {
// Try allowing approximate transliterations
if (transliterations) {
char fullDest[200];
g_strlcpy(fullDest, charSetDestination, sizeof(fullDest));
g_strlcat(fullDest, "//TRANSLIT", sizeof(fullDest));
OpenHandle(fullDest, charSetSource);
std::string fullDest(charSetDestination);
fullDest.append("//TRANSLIT");
OpenHandle(fullDest.c_str(), charSetSource);
}
if (!Succeeded()) {
// Transliterations failed so try basic name
@ -67,17 +56,15 @@ public:
iconvh = iconvhBad;
}
}
size_t Convert(char** src, size_t *srcleft, char **dst, size_t *dstleft) const {
gsize Convert(char** src, gsize *srcleft, char **dst, gsize *dstleft) const {
if (!Succeeded()) {
return (size_t)(-1);
return sizeFailure;
} else {
return iconv_adaptor(g_iconv, iconvh, src, srcleft, dst, dstleft);
return g_iconv(iconvh, src, srcleft, dst, dstleft);
}
}
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,290 @@
// Scintilla source code edit control
// ScintillaGTK.h - GTK+ specific subclass of ScintillaBase
// Copyright 1998-2004 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SCINTILLAGTK_H
#define SCINTILLAGTK_H
namespace Scintilla {
class ScintillaGTKAccessible;
#define OBJECT_CLASS GObjectClass
class ScintillaGTK : public ScintillaBase {
friend class ScintillaGTKAccessible;
_ScintillaObject *sci;
Window wText;
Window scrollbarv;
Window scrollbarh;
GtkAdjustment *adjustmentv;
GtkAdjustment *adjustmenth;
Window wSelection;
int verticalScrollBarWidth;
int horizontalScrollBarHeight;
SelectionText primary;
GdkEvent *evbtn;
guint buttonMouse;
bool capturedMouse;
bool dragWasDropped;
int lastKey;
int rectangularSelectionModifier;
GtkWidgetClass *parentClass;
static GdkAtom atomClipboard;
static GdkAtom atomUTF8;
static GdkAtom atomString;
static GdkAtom atomUriList;
static GdkAtom atomDROPFILES_DND;
GdkAtom atomSought;
#if PLAT_GTK_WIN32
CLIPFORMAT cfColumnSelect;
#endif
Window wPreedit;
Window wPreeditDraw;
GtkIMContext *im_context;
PangoScript lastNonCommonScript;
// Wheel mouse support
unsigned int linesPerScroll;
GTimeVal lastWheelMouseTime;
gint lastWheelMouseDirection;
gint wheelMouseIntensity;
gdouble smoothScrollY;
gdouble smoothScrollX;
#if GTK_CHECK_VERSION(3,0,0)
cairo_rectangle_list_t *rgnUpdate;
#else
GdkRegion *rgnUpdate;
#endif
bool repaintFullWindow;
guint styleIdleID;
int accessibilityEnabled;
AtkObject *accessible;
public:
explicit ScintillaGTK(_ScintillaObject *sci_);
// Deleted so ScintillaGTK objects can not be copied.
ScintillaGTK(const ScintillaGTK &) = delete;
ScintillaGTK(ScintillaGTK &&) = delete;
ScintillaGTK &operator=(const ScintillaGTK &) = delete;
ScintillaGTK &operator=(ScintillaGTK &&) = delete;
virtual ~ScintillaGTK();
static ScintillaGTK *FromWidget(GtkWidget *widget);
static void ClassInit(OBJECT_CLASS* object_class, GtkWidgetClass *widget_class, GtkContainerClass *container_class);
private:
void Init();
void Finalise() override;
bool AbandonPaint() override;
void DisplayCursor(Window::Cursor c) override;
bool DragThreshold(Point ptStart, Point ptNow) override;
void StartDrag() override;
Sci::Position TargetAsUTF8(char *text) const;
Sci::Position EncodedFromUTF8(const char *utf8, char *encoded) const;
bool ValidCodePage(int codePage) const override;
public: // Public for scintilla_send_message
sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
private:
sptr_t DefWndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam) override;
struct TimeThunk {
TickReason reason;
ScintillaGTK *scintilla;
guint timer;
TimeThunk() : reason(tickCaret), scintilla(NULL), timer(0) {}
};
TimeThunk timers[tickDwell+1];
bool FineTickerRunning(TickReason reason) override;
void FineTickerStart(TickReason reason, int millis, int tolerance) override;
void FineTickerCancel(TickReason reason) override;
bool SetIdle(bool on) override;
void SetMouseCapture(bool on) override;
bool HaveMouseCapture() override;
bool PaintContains(PRectangle rc) override;
void FullPaint();
PRectangle GetClientRectangle() const override;
void ScrollText(Sci::Line linesToMove) override;
void SetVerticalScrollPos() override;
void SetHorizontalScrollPos() override;
bool ModifyScrollBars(Sci::Line nMax, Sci::Line nPage) override;
void ReconfigureScrollBars() override;
void NotifyChange() override;
void NotifyFocus(bool focus) override;
void NotifyParent(SCNotification scn) override;
void NotifyKey(int key, int modifiers);
void NotifyURIDropped(const char *list);
const char *CharacterSetID() const;
CaseFolder *CaseFolderForEncoding() override;
std::string CaseMapString(const std::string &s, int caseMapping) override;
int KeyDefault(int key, int modifiers) override;
void CopyToClipboard(const SelectionText &selectedText) override;
void Copy() override;
void Paste() override;
void CreateCallTipWindow(PRectangle rc) override;
void AddToPopUp(const char *label, int cmd = 0, bool enabled = true) override;
bool OwnPrimarySelection();
void ClaimSelection() override;
void GetGtkSelectionText(GtkSelectionData *selectionData, SelectionText &selText);
void ReceivedSelection(GtkSelectionData *selection_data);
void ReceivedDrop(GtkSelectionData *selection_data);
static void GetSelection(GtkSelectionData *selection_data, guint info, SelectionText *text);
void StoreOnClipboard(SelectionText *clipText);
static void ClipboardGetSelection(GtkClipboard* clip, GtkSelectionData *selection_data, guint info, void *data);
static void ClipboardClearSelection(GtkClipboard* clip, void *data);
void UnclaimSelection(GdkEventSelection *selection_event);
static void PrimarySelection(GtkWidget *widget, GtkSelectionData *selection_data, guint info, guint time_stamp, ScintillaGTK *sciThis);
static gboolean PrimaryClear(GtkWidget *widget, GdkEventSelection *event, ScintillaGTK *sciThis);
void Resize(int width, int height);
// Callback functions
void RealizeThis(GtkWidget *widget);
static void Realize(GtkWidget *widget);
void UnRealizeThis(GtkWidget *widget);
static void UnRealize(GtkWidget *widget);
void MapThis();
static void Map(GtkWidget *widget);
void UnMapThis();
static void UnMap(GtkWidget *widget);
gint FocusInThis(GtkWidget *widget);
static gint FocusIn(GtkWidget *widget, GdkEventFocus *event);
gint FocusOutThis(GtkWidget *widget);
static gint FocusOut(GtkWidget *widget, GdkEventFocus *event);
static void SizeRequest(GtkWidget *widget, GtkRequisition *requisition);
#if GTK_CHECK_VERSION(3,0,0)
static void GetPreferredWidth(GtkWidget *widget, gint *minimalWidth, gint *naturalWidth);
static void GetPreferredHeight(GtkWidget *widget, gint *minimalHeight, gint *naturalHeight);
#endif
static void SizeAllocate(GtkWidget *widget, GtkAllocation *allocation);
#if GTK_CHECK_VERSION(3,0,0)
gboolean DrawTextThis(cairo_t *cr);
static gboolean DrawText(GtkWidget *widget, cairo_t *cr, ScintillaGTK *sciThis);
gboolean DrawThis(cairo_t *cr);
static gboolean DrawMain(GtkWidget *widget, cairo_t *cr);
#else
gboolean ExposeTextThis(GtkWidget *widget, GdkEventExpose *ose);
static gboolean ExposeText(GtkWidget *widget, GdkEventExpose *ose, ScintillaGTK *sciThis);
gboolean Expose(GtkWidget *widget, GdkEventExpose *ose);
static gboolean ExposeMain(GtkWidget *widget, GdkEventExpose *ose);
#endif
void ForAll(GtkCallback callback, gpointer callback_data);
static void MainForAll(GtkContainer *container, gboolean include_internals, GtkCallback callback, gpointer callback_data);
static void ScrollSignal(GtkAdjustment *adj, ScintillaGTK *sciThis);
static void ScrollHSignal(GtkAdjustment *adj, ScintillaGTK *sciThis);
gint PressThis(GdkEventButton *event);
static gint Press(GtkWidget *widget, GdkEventButton *event);
static gint MouseRelease(GtkWidget *widget, GdkEventButton *event);
static gint ScrollEvent(GtkWidget *widget, GdkEventScroll *event);
static gint Motion(GtkWidget *widget, GdkEventMotion *event);
gboolean KeyThis(GdkEventKey *event);
static gboolean KeyPress(GtkWidget *widget, GdkEventKey *event);
static gboolean KeyRelease(GtkWidget *widget, GdkEventKey *event);
#if GTK_CHECK_VERSION(3,0,0)
gboolean DrawPreeditThis(GtkWidget *widget, cairo_t *cr);
static gboolean DrawPreedit(GtkWidget *widget, cairo_t *cr, ScintillaGTK *sciThis);
#else
gboolean ExposePreeditThis(GtkWidget *widget, GdkEventExpose *ose);
static gboolean ExposePreedit(GtkWidget *widget, GdkEventExpose *ose, ScintillaGTK *sciThis);
#endif
AtkObject* GetAccessibleThis(GtkWidget *widget);
static AtkObject* GetAccessible(GtkWidget *widget);
bool KoreanIME();
void CommitThis(char *commitStr);
static void Commit(GtkIMContext *context, char *str, ScintillaGTK *sciThis);
void PreeditChangedInlineThis();
void PreeditChangedWindowedThis();
static void PreeditChanged(GtkIMContext *context, ScintillaGTK *sciThis);
void MoveImeCarets(int pos);
void DrawImeIndicator(int indicator, int len);
void SetCandidateWindowPos();
static void StyleSetText(GtkWidget *widget, GtkStyle *previous, void*);
static void RealizeText(GtkWidget *widget, void*);
static void Dispose(GObject *object);
static void Destroy(GObject *object);
static void SelectionReceived(GtkWidget *widget, GtkSelectionData *selection_data,
guint time);
static void SelectionGet(GtkWidget *widget, GtkSelectionData *selection_data,
guint info, guint time);
static gint SelectionClear(GtkWidget *widget, GdkEventSelection *selection_event);
gboolean DragMotionThis(GdkDragContext *context, gint x, gint y, guint dragtime);
static gboolean DragMotion(GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint dragtime);
static void DragLeave(GtkWidget *widget, GdkDragContext *context,
guint time);
static void DragEnd(GtkWidget *widget, GdkDragContext *context);
static gboolean Drop(GtkWidget *widget, GdkDragContext *context,
gint x, gint y, guint time);
static void DragDataReceived(GtkWidget *widget, GdkDragContext *context,
gint x, gint y, GtkSelectionData *selection_data, guint info, guint time);
static void DragDataGet(GtkWidget *widget, GdkDragContext *context,
GtkSelectionData *selection_data, guint info, guint time);
static gboolean TimeOut(gpointer ptt);
static gboolean IdleCallback(gpointer pSci);
static gboolean StyleIdle(gpointer pSci);
void IdleWork() override;
void QueueIdleWork(WorkNeeded::workItems items, Sci::Position upTo) override;
void SetDocPointer(Document *document) override;
static void PopUpCB(GtkMenuItem *menuItem, ScintillaGTK *sciThis);
#if GTK_CHECK_VERSION(3,0,0)
static gboolean DrawCT(GtkWidget *widget, cairo_t *cr, CallTip *ctip);
#else
static gboolean ExposeCT(GtkWidget *widget, GdkEventExpose *ose, CallTip *ctip);
#endif
static gboolean PressCT(GtkWidget *widget, GdkEventButton *event, ScintillaGTK *sciThis);
static sptr_t DirectFunction(sptr_t ptr,
unsigned int iMessage, uptr_t wParam, sptr_t lParam);
};
// helper class to watch a GObject lifetime and get notified when it dies
class GObjectWatcher {
GObject *weakRef;
void WeakNotifyThis(GObject *obj G_GNUC_UNUSED) {
PLATFORM_ASSERT(obj == weakRef);
Destroyed();
weakRef = 0;
}
static void WeakNotify(gpointer data, GObject *obj) {
static_cast<GObjectWatcher*>(data)->WeakNotifyThis(obj);
}
public:
GObjectWatcher(GObject *obj) :
weakRef(obj) {
g_object_weak_ref(weakRef, WeakNotify, this);
}
virtual ~GObjectWatcher() {
if (weakRef) {
g_object_weak_unref(weakRef, WeakNotify, this);
}
}
virtual void Destroyed() {}
bool IsDestroyed() const {
return weakRef != 0;
}
};
std::string ConvertText(const char *s, size_t len, const char *charSetDest,
const char *charSetSource, bool transliterations, bool silent=false);
}
#endif

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,192 @@
/* Scintilla source code edit control */
/* ScintillaGTKAccessible.h - GTK+ accessibility for ScintillaGTK */
/* Copyright 2016 by Colomban Wendling <colomban@geany.org>
* The License.txt file describes the conditions under which this software may be distributed. */
#ifndef SCINTILLAGTKACCESSIBLE_H
#define SCINTILLAGTKACCESSIBLE_H
namespace Scintilla {
#ifndef ATK_CHECK_VERSION
# define ATK_CHECK_VERSION(x, y, z) 0
#endif
class ScintillaGTKAccessible {
private:
// weak references to related objects
GtkAccessible *accessible;
ScintillaGTK *sci;
// cache holding character offset for each line start, see CharacterOffsetFromByteOffset()
std::vector<Sci::Position> character_offsets;
// cached length of the deletion, in characters (see Notify())
int deletionLengthChar;
// local state for comparing
Sci::Position old_pos;
std::vector<SelectionRange> old_sels;
bool Enabled() const;
void UpdateCursor();
void Notify(GtkWidget *widget, gint code, SCNotification *nt);
static void SciNotify(GtkWidget *widget, gint code, SCNotification *nt, gpointer data) {
try {
static_cast<ScintillaGTKAccessible*>(data)->Notify(widget, code, nt);
} catch (...) {}
}
Sci::Position ByteOffsetFromCharacterOffset(Sci::Position startByte, int characterOffset) {
Sci::Position pos = sci->pdoc->GetRelativePosition(startByte, characterOffset);
if (pos == INVALID_POSITION) {
// clamp invalid positions inside the document
if (characterOffset > 0) {
return sci->pdoc->Length();
} else {
return 0;
}
}
return pos;
}
Sci::Position ByteOffsetFromCharacterOffset(Sci::Position characterOffset) {
return ByteOffsetFromCharacterOffset(0, characterOffset);
}
Sci::Position CharacterOffsetFromByteOffset(Sci::Position byteOffset) {
const Sci::Line line = sci->pdoc->LineFromPosition(byteOffset);
if (character_offsets.size() <= static_cast<size_t>(line)) {
if (character_offsets.empty())
character_offsets.push_back(0);
for (Sci::Position i = character_offsets.size(); i <= line; i++) {
const Sci::Position start = sci->pdoc->LineStart(i - 1);
const Sci::Position end = sci->pdoc->LineStart(i);
character_offsets.push_back(character_offsets[i - 1] + sci->pdoc->CountCharacters(start, end));
}
}
const Sci::Position lineStart = sci->pdoc->LineStart(line);
return character_offsets[line] + sci->pdoc->CountCharacters(lineStart, byteOffset);
}
void CharacterRangeFromByteRange(Sci::Position startByte, Sci::Position endByte, int *startChar, int *endChar) {
*startChar = CharacterOffsetFromByteOffset(startByte);
*endChar = *startChar + sci->pdoc->CountCharacters(startByte, endByte);
}
void ByteRangeFromCharacterRange(int startChar, int endChar, Sci::Position& startByte, Sci::Position& endByte) {
startByte = ByteOffsetFromCharacterOffset(startChar);
endByte = ByteOffsetFromCharacterOffset(startByte, endChar - startChar);
}
Sci::Position PositionBefore(Sci::Position pos) {
return sci->pdoc->MovePositionOutsideChar(pos - 1, -1, true);
}
Sci::Position PositionAfter(Sci::Position pos) {
return sci->pdoc->MovePositionOutsideChar(pos + 1, 1, true);
}
int StyleAt(Sci::Position position, bool ensureStyle = false) {
if (ensureStyle)
sci->pdoc->EnsureStyledTo(position);
return sci->pdoc->StyleAt(position);
}
// For AtkText
gchar *GetTextRangeUTF8(Sci::Position startByte, Sci::Position endByte);
gchar *GetText(int startChar, int endChar);
gchar *GetTextAfterOffset(int charOffset, AtkTextBoundary boundaryType, int *startChar, int *endChar);
gchar *GetTextBeforeOffset(int charOffset, AtkTextBoundary boundaryType, int *startChar, int *endChar);
gchar *GetTextAtOffset(int charOffset, AtkTextBoundary boundaryType, int *startChar, int *endChar);
#if ATK_CHECK_VERSION(2, 10, 0)
gchar *GetStringAtOffset(int charOffset, AtkTextGranularity granularity, int *startChar, int *endChar);
#endif
gunichar GetCharacterAtOffset(int charOffset);
gint GetCharacterCount();
gint GetCaretOffset();
gboolean SetCaretOffset(int charOffset);
gint GetOffsetAtPoint(gint x, gint y, AtkCoordType coords);
void GetCharacterExtents(int charOffset, gint *x, gint *y, gint *width, gint *height, AtkCoordType coords);
AtkAttributeSet *GetAttributesForStyle(unsigned int styleNum);
AtkAttributeSet *GetRunAttributes(int charOffset, int *startChar, int *endChar);
AtkAttributeSet *GetDefaultAttributes();
gint GetNSelections();
gchar *GetSelection(gint selection_num, int *startChar, int *endChar);
gboolean AddSelection(int startChar, int endChar);
gboolean RemoveSelection(int selection_num);
gboolean SetSelection(gint selection_num, int startChar, int endChar);
// for AtkEditableText
bool InsertStringUTF8(Sci::Position bytePos, const gchar *utf8, Sci::Position lengthBytes);
void SetTextContents(const gchar *contents);
void InsertText(const gchar *text, int lengthBytes, int *charPosition);
void CopyText(int startChar, int endChar);
void CutText(int startChar, int endChar);
void DeleteText(int startChar, int endChar);
void PasteText(int charPosition);
public:
ScintillaGTKAccessible(GtkAccessible *accessible_, GtkWidget *widget_);
~ScintillaGTKAccessible();
static ScintillaGTKAccessible *FromAccessible(GtkAccessible *accessible);
static ScintillaGTKAccessible *FromAccessible(AtkObject *accessible) {
return FromAccessible(GTK_ACCESSIBLE(accessible));
}
// So ScintillaGTK can notify us
void ChangeDocument(Document *oldDoc, Document *newDoc);
void NotifyReadOnly();
void SetAccessibility();
// Helper GtkWidget methods
static AtkObject *WidgetGetAccessibleImpl(GtkWidget *widget, AtkObject **cache, gpointer widget_parent_class);
// ATK methods
class AtkTextIface {
public:
static void init(::AtkTextIface *iface);
private:
AtkTextIface();
static gchar *GetText(AtkText *text, int start_offset, int end_offset);
static gchar *GetTextAfterOffset(AtkText *text, int offset, AtkTextBoundary boundary_type, int *start_offset, int *end_offset);
static gchar *GetTextBeforeOffset(AtkText *text, int offset, AtkTextBoundary boundary_type, int *start_offset, int *end_offset);
static gchar *GetTextAtOffset(AtkText *text, gint offset, AtkTextBoundary boundary_type, gint *start_offset, gint *end_offset);
#if ATK_CHECK_VERSION(2, 10, 0)
static gchar *GetStringAtOffset(AtkText *text, gint offset, AtkTextGranularity granularity, gint *start_offset, gint *end_offset);
#endif
static gunichar GetCharacterAtOffset(AtkText *text, gint offset);
static gint GetCharacterCount(AtkText *text);
static gint GetCaretOffset(AtkText *text);
static gboolean SetCaretOffset(AtkText *text, gint offset);
static gint GetOffsetAtPoint(AtkText *text, gint x, gint y, AtkCoordType coords);
static void GetCharacterExtents(AtkText *text, gint offset, gint *x, gint *y, gint *width, gint *height, AtkCoordType coords);
static AtkAttributeSet *GetRunAttributes(AtkText *text, gint offset, gint *start_offset, gint *end_offset);
static AtkAttributeSet *GetDefaultAttributes(AtkText *text);
static gint GetNSelections(AtkText *text);
static gchar *GetSelection(AtkText *text, gint selection_num, gint *start_pos, gint *end_pos);
static gboolean AddSelection(AtkText *text, gint start, gint end);
static gboolean RemoveSelection(AtkText *text, gint selection_num);
static gboolean SetSelection(AtkText *text, gint selection_num, gint start, gint end);
};
class AtkEditableTextIface {
public:
static void init(::AtkEditableTextIface *iface);
private:
AtkEditableTextIface();
static void SetTextContents(AtkEditableText *text, const gchar *contents);
static void InsertText(AtkEditableText *text, const gchar *contents, gint length, gint *position);
static void CopyText(AtkEditableText *text, gint start, gint end);
static void CutText(AtkEditableText *text, gint start, gint end);
static void DeleteText(AtkEditableText *text, gint start, gint end);
static void PasteText(AtkEditableText *text, gint position);
};
};
}
#endif /* SCINTILLAGTKACCESSIBLE_H */

File diff suppressed because it is too large Load Diff

View File

@ -6,15 +6,22 @@
# Builds for GTK+ 2 and no longer supports GTK+ 1.
# Also works with ming32-make on Windows.
.SUFFIXES: .cxx .c .o .h .a
.SUFFIXES: .cxx .c .o .h .a .list
srcdir ?= .
ifdef CLANG
CXX = clang++ -Wno-deprecated-register
CXX = clang++
CXXWARNFLAGS = -Wall -pedantic -Wno-deprecated-register -Wno-missing-braces
CC = clang
# Can choose aspect to sanitize: address and undefined can simply change SANITIZE but for
# thread also need to create Position Independent Executable -> search online documentation
SANITIZE = address
#SANITIZE = undefined
else
CXXWARNFLAGS = -Wall -pedantic
endif
ARFLAGS = rc
RANLIB = touch
ifdef GTK3
@ -31,22 +38,29 @@ RANLIB = ranlib
endif
endif
ifdef windir
DEL = del /q
COMPLIB=..\bin\scintilla.a
else
DEL = rm -f
COMPLIB=../bin/scintilla.a
# Enable Position Independent Code except on Windows where it is the default so the flag produces a warning
ifndef windir
PICFLAGS = -fPIC
endif
vpath %.h ../src ../include ../lexlib
vpath %.cxx ../src ../lexlib ../lexers
ifdef windir
CC = gcc
DEL = del /q
COMPLIB=$(srcdir)\..\bin\scintilla.a
else
DEL = rm -f
COMPLIB=$(srcdir)/../bin/scintilla.a
endif
INCLUDEDIRS=-I ../include -I ../src -I ../lexlib
vpath %.h $(srcdir) $(srcdir)/../src $(srcdir)/../include $(srcdir)/../lexlib
vpath %.c $(srcdir)
vpath %.cxx $(srcdir) $(srcdir)/../src $(srcdir)/../lexlib $(srcdir)/../lexers
INCLUDEDIRS=-I $(srcdir)/../include -I $(srcdir)/../src -I $(srcdir)/../lexlib
ifdef CHECK_DEPRECATED
DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DDISABLE_GDK_FONT
endif
CXXBASEFLAGS=-Wall -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED)
CXXBASEFLAGS=$(CXXWARNFLAGS) $(PICFLAGS) -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED)
ifdef NOTHREADS
THREADFLAGS=-DG_THREADS_IMPL_NONE
@ -54,8 +68,8 @@ else
THREADFLAGS=
endif
ifdef CXX11_REGEX
REFLAGS=-DCXX11_REGEX
ifdef NO_CXX11_REGEX
REFLAGS=-DNO_CXX11_REGEX
endif
ifdef DEBUG
@ -68,38 +82,49 @@ else
CTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
endif
CFLAGS:=$(CTFLAGS)
CXXTFLAGS:=--std=c++0x $(CTFLAGS) $(REFLAGS)
CXXTFLAGS:=--std=gnu++17 $(CTFLAGS) $(REFLAGS)
CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION))
MARSHALLER=scintilla-marshal.o
.cxx.o:
$(CXX) $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) -c $<
.c.o:
$(CC) $(CONFIGFLAGS) $(CFLAGS) -w -c $<
LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx))))
all: $(COMPLIB)
clean:
$(DEL) *.o $(COMPLIB) *.plist
.cxx.o:
$(CXX) $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) -c $<
.c.o:
$(CC) $(CONFIGFLAGS) $(CTFLAGS) $(CFLAGS) -w -c $<
GLIB_GENMARSHAL = glib-genmarshal
GLIB_GENMARSHAL_FLAGS = --prefix=scintilla_marshal
.list.h:
$(GLIB_GENMARSHAL) --header $(GLIB_GENMARSHAL_FLAGS) $< > $@
.list.c:
$(GLIB_GENMARSHAL) --body $(GLIB_GENMARSHAL_FLAGS) $< > $@
LEXOBJS:=$(addsuffix .o,$(basename $(sort $(notdir $(wildcard $(srcdir)/../lexers/Lex*.cxx)))))
analyze:
clang --analyze $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx
clang --analyze $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) $(srcdir)/*.cxx $(srcdir)/../src/*.cxx $(srcdir)/../lexlib/*.cxx $(srcdir)/../lexers/*.cxx
deps:
$(CXX) -MM $(CONFIGFLAGS) $(CXXTFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak
# To minimize deltas, including between Unix and Windows, the lexer file names are sorted case-insensitively
LEXSORTED=$(shell ls $(srcdir)/../lexers/Lex*.cxx | sort -f)
DEPSRCS=$(srcdir)/*.cxx $(srcdir)/../src/*.cxx $(srcdir)/../lexlib/*.cxx $(LEXSORTED)
deps: deps.mak
deps.mak:
$(CXX) -MM $(CONFIGFLAGS) $(CXXTFLAGS) $(DEPSRCS) | sed -e 's/\/usr.* //' | grep [a-zA-Z] > $@
$(COMPLIB): Accessor.o CharacterSet.o LexerBase.o LexerModule.o LexerSimple.o StyleContext.o WordList.o \
$(COMPLIB): Accessor.o CharacterSet.o DefaultLexer.o LexerBase.o LexerModule.o LexerSimple.o StyleContext.o WordList.o \
CharClassify.o Decoration.o Document.o PerLine.o Catalogue.o CallTip.o CaseConvert.o CaseFolder.o \
ScintillaBase.o ContractionState.o EditModel.o Editor.o EditView.o ExternalLexer.o MarginView.o \
PropSetSimple.o PlatGTK.o \
KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o CellBuffer.o CharacterCategory.o ViewStyle.o \
KeyMap.o LineMarker.o PositionCache.o ScintillaGTK.o ScintillaGTKAccessible.o CellBuffer.o CharacterCategory.o ViewStyle.o \
RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
$(MARSHALLER) $(LEXOBJS)
$(AR) rc $@ $^
$(AR) $(ARFLAGS) $@ $^
$(RANLIB) $@
# Automatically generate header dependencies with "make deps"

View File

@ -1,10 +1,8 @@
#include <glib-object.h>
#ifdef G_ENABLE_DEBUG
#define g_marshal_value_peek_boolean(v) g_value_get_boolean (v)
#define g_marshal_value_peek_char(v) g_value_get_char (v)
#define g_marshal_value_peek_char(v) g_value_get_schar (v)
#define g_marshal_value_peek_uchar(v) g_value_get_uchar (v)
#define g_marshal_value_peek_int(v) g_value_get_int (v)
#define g_marshal_value_peek_uint(v) g_value_get_uint (v)
@ -21,6 +19,7 @@
#define g_marshal_value_peek_boxed(v) g_value_get_boxed (v)
#define g_marshal_value_peek_pointer(v) g_value_get_pointer (v)
#define g_marshal_value_peek_object(v) g_value_get_object (v)
#define g_marshal_value_peek_variant(v) g_value_get_variant (v)
#else /* !G_ENABLE_DEBUG */
/* WARNING: This code accesses GValues directly, which is UNSUPPORTED API.
* Do not access GValues directly in your code. Instead, use the
@ -35,8 +34,8 @@
#define g_marshal_value_peek_ulong(v) (v)->data[0].v_ulong
#define g_marshal_value_peek_int64(v) (v)->data[0].v_int64
#define g_marshal_value_peek_uint64(v) (v)->data[0].v_uint64
#define g_marshal_value_peek_enum(v) (v)->data[0].v_int
#define g_marshal_value_peek_flags(v) (v)->data[0].v_uint
#define g_marshal_value_peek_enum(v) (v)->data[0].v_long
#define g_marshal_value_peek_flags(v) (v)->data[0].v_ulong
#define g_marshal_value_peek_float(v) (v)->data[0].v_float
#define g_marshal_value_peek_double(v) (v)->data[0].v_double
#define g_marshal_value_peek_string(v) (v)->data[0].v_pointer
@ -44,25 +43,25 @@
#define g_marshal_value_peek_boxed(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_pointer(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_object(v) (v)->data[0].v_pointer
#define g_marshal_value_peek_variant(v) (v)->data[0].v_pointer
#endif /* !G_ENABLE_DEBUG */
/* NONE:INT,POINTER (scintilla-marshal.list:1) */
/* VOID:INT,OBJECT (scintilla-marshal.list:1) */
void
scintilla_marshal_VOID__INT_POINTER (GClosure *closure,
GValue *return_value,
scintilla_marshal_VOID__INT_OBJECT (GClosure *closure,
GValue *return_value G_GNUC_UNUSED,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer invocation_hint G_GNUC_UNUSED,
gpointer marshal_data)
{
typedef void (*GMarshalFunc_VOID__INT_POINTER) (gpointer data1,
gint arg_1,
gpointer arg_2,
typedef void (*GMarshalFunc_VOID__INT_OBJECT) (gpointer data1,
gint arg1,
gpointer arg2,
gpointer data2);
register GMarshalFunc_VOID__INT_POINTER callback;
register GCClosure *cc = (GCClosure*) closure;
register gpointer data1, data2;
GCClosure *cc = (GCClosure *) closure;
gpointer data1, data2;
GMarshalFunc_VOID__INT_OBJECT callback;
g_return_if_fail (n_param_values == 3);
@ -76,11 +75,48 @@ scintilla_marshal_VOID__INT_POINTER (GClosure *closure,
data1 = g_value_peek_pointer (param_values + 0);
data2 = closure->data;
}
callback = (GMarshalFunc_VOID__INT_POINTER) (marshal_data ? marshal_data : cc->callback);
callback = (GMarshalFunc_VOID__INT_OBJECT) (marshal_data ? marshal_data : cc->callback);
callback (data1,
g_marshal_value_peek_int (param_values + 1),
g_marshal_value_peek_pointer (param_values + 2),
g_marshal_value_peek_object (param_values + 2),
data2);
}
/* VOID:INT,BOXED (scintilla-marshal.list:2) */
void
scintilla_marshal_VOID__INT_BOXED (GClosure *closure,
GValue *return_value G_GNUC_UNUSED,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint G_GNUC_UNUSED,
gpointer marshal_data)
{
typedef void (*GMarshalFunc_VOID__INT_BOXED) (gpointer data1,
gint arg1,
gpointer arg2,
gpointer data2);
GCClosure *cc = (GCClosure *) closure;
gpointer data1, data2;
GMarshalFunc_VOID__INT_BOXED callback;
g_return_if_fail (n_param_values == 3);
if (G_CCLOSURE_SWAP_DATA (closure))
{
data1 = closure->data;
data2 = g_value_peek_pointer (param_values + 0);
}
else
{
data1 = g_value_peek_pointer (param_values + 0);
data2 = closure->data;
}
callback = (GMarshalFunc_VOID__INT_BOXED) (marshal_data ? marshal_data : cc->callback);
callback (data1,
g_marshal_value_peek_int (param_values + 1),
g_marshal_value_peek_boxed (param_values + 2),
data2);
}

View File

@ -1,21 +1,30 @@
#ifndef __scintilla_marshal_MARSHAL_H__
#define __scintilla_marshal_MARSHAL_H__
/* This file is generated, all changes will be lost */
#ifndef __SCINTILLA_MARSHAL_MARSHAL_H__
#define __SCINTILLA_MARSHAL_MARSHAL_H__
#include <glib-object.h>
G_BEGIN_DECLS
/* NONE:INT,POINTER (scintilla-marshal.list:1) */
extern void scintilla_marshal_VOID__INT_POINTER (GClosure *closure,
/* VOID:INT,OBJECT (scintilla-marshal.list:1) */
extern
void scintilla_marshal_VOID__INT_OBJECT (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
#define scintilla_marshal_NONE__INT_POINTER scintilla_marshal_VOID__INT_POINTER
/* VOID:INT,BOXED (scintilla-marshal.list:2) */
extern
void scintilla_marshal_VOID__INT_BOXED (GClosure *closure,
GValue *return_value,
guint n_param_values,
const GValue *param_values,
gpointer invocation_hint,
gpointer marshal_data);
G_END_DECLS
#endif /* __scintilla_marshal_MARSHAL_H__ */
#endif /* __SCINTILLA_MARSHAL_MARSHAL_H__ */

View File

@ -1 +1,2 @@
NONE:INT,POINTER
VOID:INT,OBJECT
VOID:INT,BOXED

View File

@ -8,69 +8,55 @@
#ifndef ILEXER_H
#define ILEXER_H
#ifdef SCI_NAMESPACE
#include "Sci_Position.h"
namespace Scintilla {
#endif
#ifdef _WIN32
#define SCI_METHOD __stdcall
#else
#define SCI_METHOD
#endif
enum { dvOriginal=0, dvLineEnd=1 };
enum { dvRelease4=2 };
class IDocument {
public:
virtual int SCI_METHOD Version() const = 0;
virtual void SCI_METHOD SetErrorStatus(int status) = 0;
virtual int SCI_METHOD Length() const = 0;
virtual void SCI_METHOD GetCharRange(char *buffer, int position, int lengthRetrieve) const = 0;
virtual char SCI_METHOD StyleAt(int position) const = 0;
virtual int SCI_METHOD LineFromPosition(int position) const = 0;
virtual int SCI_METHOD LineStart(int line) const = 0;
virtual int SCI_METHOD GetLevel(int line) const = 0;
virtual int SCI_METHOD SetLevel(int line, int level) = 0;
virtual int SCI_METHOD GetLineState(int line) const = 0;
virtual int SCI_METHOD SetLineState(int line, int state) = 0;
virtual void SCI_METHOD StartStyling(int position, char mask) = 0;
virtual bool SCI_METHOD SetStyleFor(int length, char style) = 0;
virtual bool SCI_METHOD SetStyles(int length, const char *styles) = 0;
virtual Sci_Position SCI_METHOD Length() const = 0;
virtual void SCI_METHOD GetCharRange(char *buffer, Sci_Position position, Sci_Position lengthRetrieve) const = 0;
virtual char SCI_METHOD StyleAt(Sci_Position position) const = 0;
virtual Sci_Position SCI_METHOD LineFromPosition(Sci_Position position) const = 0;
virtual Sci_Position SCI_METHOD LineStart(Sci_Position line) const = 0;
virtual int SCI_METHOD GetLevel(Sci_Position line) const = 0;
virtual int SCI_METHOD SetLevel(Sci_Position line, int level) = 0;
virtual int SCI_METHOD GetLineState(Sci_Position line) const = 0;
virtual int SCI_METHOD SetLineState(Sci_Position line, int state) = 0;
virtual void SCI_METHOD StartStyling(Sci_Position position) = 0;
virtual bool SCI_METHOD SetStyleFor(Sci_Position length, char style) = 0;
virtual bool SCI_METHOD SetStyles(Sci_Position length, const char *styles) = 0;
virtual void SCI_METHOD DecorationSetCurrentIndicator(int indicator) = 0;
virtual void SCI_METHOD DecorationFillRange(int position, int value, int fillLength) = 0;
virtual void SCI_METHOD ChangeLexerState(int start, int end) = 0;
virtual void SCI_METHOD DecorationFillRange(Sci_Position position, int value, Sci_Position fillLength) = 0;
virtual void SCI_METHOD ChangeLexerState(Sci_Position start, Sci_Position end) = 0;
virtual int SCI_METHOD CodePage() const = 0;
virtual bool SCI_METHOD IsDBCSLeadByte(char ch) const = 0;
virtual const char * SCI_METHOD BufferPointer() = 0;
virtual int SCI_METHOD GetLineIndentation(int line) = 0;
virtual int SCI_METHOD GetLineIndentation(Sci_Position line) = 0;
virtual Sci_Position SCI_METHOD LineEnd(Sci_Position line) const = 0;
virtual Sci_Position SCI_METHOD GetRelativePosition(Sci_Position positionStart, Sci_Position characterOffset) const = 0;
virtual int SCI_METHOD GetCharacterAndWidth(Sci_Position position, Sci_Position *pWidth) const = 0;
};
class IDocumentWithLineEnd : public IDocument {
public:
virtual int SCI_METHOD LineEnd(int line) const = 0;
virtual int SCI_METHOD GetRelativePosition(int positionStart, int characterOffset) const = 0;
virtual int SCI_METHOD GetCharacterAndWidth(int position, int *pWidth) const = 0;
};
enum { lvRelease4=2 };
enum { lvOriginal=0, lvSubStyles=1 };
class ILexer {
class ILexer4 {
public:
virtual int SCI_METHOD Version() const = 0;
virtual void SCI_METHOD Release() = 0;
virtual const char * SCI_METHOD PropertyNames() = 0;
virtual int SCI_METHOD PropertyType(const char *name) = 0;
virtual const char * SCI_METHOD DescribeProperty(const char *name) = 0;
virtual int SCI_METHOD PropertySet(const char *key, const char *val) = 0;
virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) = 0;
virtual const char * SCI_METHOD DescribeWordListSets() = 0;
virtual int SCI_METHOD WordListSet(int n, const char *wl) = 0;
virtual void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
virtual void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess) = 0;
virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) = 0;
virtual void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
virtual void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position lengthDoc, int initStyle, IDocument *pAccess) = 0;
virtual void * SCI_METHOD PrivateCall(int operation, void *pointer) = 0;
};
class ILexerWithSubStyles : public ILexer {
public:
virtual int SCI_METHOD LineEndTypesSupported() = 0;
virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0;
virtual int SCI_METHOD SubStylesStart(int styleBase) = 0;
@ -81,18 +67,12 @@ public:
virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0;
virtual int SCI_METHOD DistanceToSecondaryStyles() = 0;
virtual const char * SCI_METHOD GetSubStyleBases() = 0;
virtual int SCI_METHOD NamedStyles() = 0;
virtual const char * SCI_METHOD NameOfStyle(int style) = 0;
virtual const char * SCI_METHOD TagsOfStyle(int style) = 0;
virtual const char * SCI_METHOD DescriptionOfStyle(int style) = 0;
};
class ILoader {
public:
virtual int SCI_METHOD Release() = 0;
// Returns a status code from SC_STATUS_*
virtual int SCI_METHOD AddData(char *data, int length) = 0;
virtual void * SCI_METHOD ConvertToDocument() = 0;
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -0,0 +1,21 @@
// Scintilla source code edit control
/** @file ILoader.h
** Interface for loading into a Scintilla document from a background thread.
**/
// Copyright 1998-2017 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef ILOADER_H
#define ILOADER_H
#include "Sci_Position.h"
class ILoader {
public:
virtual int SCI_METHOD Release() = 0;
// Returns a status code from SC_STATUS_*
virtual int SCI_METHOD AddData(const char *data, Sci_Position length) = 0;
virtual void * SCI_METHOD ConvertToDocument() = 0;
};
#endif

View File

@ -25,6 +25,7 @@
#define PLAT_FOX 0
#define PLAT_CURSES 0
#define PLAT_TK 0
#define PLAT_HAIKU 0
#if defined(FOX)
#undef PLAT_FOX
@ -38,6 +39,10 @@
#undef PLAT_CURSES
#define PLAT_CURSES 1
#elif defined(__HAIKU__)
#undef PLAT_HAIKU
#define PLAT_HAIKU 1
#elif defined(SCINTILLA_QT)
#undef PLAT_QT
#define PLAT_QT 1
@ -71,15 +76,10 @@
#endif
#ifdef SCI_NAMESPACE
namespace Scintilla {
#endif
typedef float XYPOSITION;
typedef double XYACCUMULATOR;
inline int RoundXYPosition(XYPOSITION xyPos) {
return int(xyPos + 0.5);
}
// Underlying the implementation of the platform classes are platform specific types.
// Sometimes these need to be passed around by client code so they are defined here
@ -101,21 +101,19 @@ public:
XYPOSITION x;
XYPOSITION y;
explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) {
constexpr explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) noexcept : x(x_), y(y_) {
}
static Point FromInts(int x_, int y_) {
static Point FromInts(int x_, int y_) noexcept {
return Point(static_cast<XYPOSITION>(x_), static_cast<XYPOSITION>(y_));
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
static Point FromLong(long lpoint);
};
/**
* A geometric rectangle class.
* PRectangle is similar to the Win32 RECT.
* PRectangle is similar to Win32 RECT.
* PRectangles contain their top and left sides, but not their right and bottom sides.
*/
class PRectangle {
@ -125,113 +123,147 @@ public:
XYPOSITION right;
XYPOSITION bottom;
explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) :
constexpr explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) noexcept :
left(left_), top(top_), right(right_), bottom(bottom_) {
}
static PRectangle FromInts(int left_, int top_, int right_, int bottom_) {
static PRectangle FromInts(int left_, int top_, int right_, int bottom_) noexcept {
return PRectangle(static_cast<XYPOSITION>(left_), static_cast<XYPOSITION>(top_),
static_cast<XYPOSITION>(right_), static_cast<XYPOSITION>(bottom_));
}
// Other automatically defined methods (assignment, copy constructor, destructor) are fine
bool operator==(PRectangle &rc) const {
bool operator==(const PRectangle &rc) const noexcept {
return (rc.left == left) && (rc.right == right) &&
(rc.top == top) && (rc.bottom == bottom);
}
bool Contains(Point pt) const {
bool Contains(Point pt) const noexcept {
return (pt.x >= left) && (pt.x <= right) &&
(pt.y >= top) && (pt.y <= bottom);
}
bool ContainsWholePixel(Point pt) const {
bool ContainsWholePixel(Point pt) const noexcept {
// Does the rectangle contain all of the pixel to left/below the point
return (pt.x >= left) && ((pt.x+1) <= right) &&
(pt.y >= top) && ((pt.y+1) <= bottom);
}
bool Contains(PRectangle rc) const {
bool Contains(PRectangle rc) const noexcept {
return (rc.left >= left) && (rc.right <= right) &&
(rc.top >= top) && (rc.bottom <= bottom);
}
bool Intersects(PRectangle other) const {
bool Intersects(PRectangle other) const noexcept {
return (right > other.left) && (left < other.right) &&
(bottom > other.top) && (top < other.bottom);
}
void Move(XYPOSITION xDelta, XYPOSITION yDelta) {
void Move(XYPOSITION xDelta, XYPOSITION yDelta) noexcept {
left += xDelta;
top += yDelta;
right += xDelta;
bottom += yDelta;
}
XYPOSITION Width() const { return right - left; }
XYPOSITION Height() const { return bottom - top; }
bool Empty() const {
XYPOSITION Width() const noexcept { return right - left; }
XYPOSITION Height() const noexcept { return bottom - top; }
bool Empty() const noexcept {
return (Height() <= 0) || (Width() <= 0);
}
};
/**
* Holds a desired RGB colour.
* Holds an RGB colour with 8 bits for each component.
*/
constexpr const float componentMaximum = 255.0f;
class ColourDesired {
long co;
int co;
public:
ColourDesired(long lcol=0) {
co = lcol;
explicit ColourDesired(int co_=0) noexcept : co(co_) {
}
ColourDesired(unsigned int red, unsigned int green, unsigned int blue) {
Set(red, green, blue);
ColourDesired(unsigned int red, unsigned int green, unsigned int blue) noexcept :
co(red | (green << 8) | (blue << 16)) {
}
bool operator==(const ColourDesired &other) const {
bool operator==(const ColourDesired &other) const noexcept {
return co == other.co;
}
void Set(long lcol) {
co = lcol;
}
void Set(unsigned int red, unsigned int green, unsigned int blue) {
co = red | (green << 8) | (blue << 16);
}
static inline unsigned int ValueOfHex(const char ch) {
if (ch >= '0' && ch <= '9')
return ch - '0';
else if (ch >= 'A' && ch <= 'F')
return ch - 'A' + 10;
else if (ch >= 'a' && ch <= 'f')
return ch - 'a' + 10;
else
return 0;
}
void Set(const char *val) {
if (*val == '#') {
val++;
}
unsigned int r = ValueOfHex(val[0]) * 16 + ValueOfHex(val[1]);
unsigned int g = ValueOfHex(val[2]) * 16 + ValueOfHex(val[3]);
unsigned int b = ValueOfHex(val[4]) * 16 + ValueOfHex(val[5]);
Set(r, g, b);
}
long AsLong() const {
int AsInteger() const noexcept {
return co;
}
unsigned int GetRed() const {
// Red, green and blue values as bytes 0..255
unsigned char GetRed() const noexcept {
return co & 0xff;
}
unsigned int GetGreen() const {
unsigned char GetGreen() const noexcept {
return (co >> 8) & 0xff;
}
unsigned int GetBlue() const {
unsigned char GetBlue() const noexcept {
return (co >> 16) & 0xff;
}
// Red, green and blue values as float 0..1.0
float GetRedComponent() const noexcept {
return GetRed() / componentMaximum;
}
float GetGreenComponent() const noexcept {
return GetGreen() / componentMaximum;
}
float GetBlueComponent() const noexcept {
return GetBlue() / componentMaximum;
}
};
/**
* Holds an RGBA colour.
*/
class ColourAlpha : public ColourDesired {
public:
explicit ColourAlpha(int co_ = 0) noexcept : ColourDesired(co_) {
}
ColourAlpha(unsigned int red, unsigned int green, unsigned int blue) noexcept :
ColourDesired(red | (green << 8) | (blue << 16)) {
}
ColourAlpha(unsigned int red, unsigned int green, unsigned int blue, unsigned int alpha) noexcept :
ColourDesired(red | (green << 8) | (blue << 16) | (alpha << 24)) {
}
ColourAlpha(ColourDesired cd, unsigned int alpha) noexcept :
ColourDesired(cd.AsInteger() | (alpha << 24)) {
}
ColourDesired GetColour() const noexcept {
return ColourDesired(AsInteger() & 0xffffff);
}
unsigned char GetAlpha() const noexcept {
return (AsInteger() >> 24) & 0xff;
}
float GetAlphaComponent() const noexcept {
return GetAlpha() / componentMaximum;
}
ColourAlpha MixedWith(ColourAlpha other) const noexcept {
const unsigned int red = (GetRed() + other.GetRed()) / 2;
const unsigned int green = (GetGreen() + other.GetGreen()) / 2;
const unsigned int blue = (GetBlue() + other.GetBlue()) / 2;
const unsigned int alpha = (GetAlpha() + other.GetAlpha()) / 2;
return ColourAlpha(red, green, blue, alpha);
}
};
/**
* Holds an element of a gradient with an RGBA colour and a relative position.
*/
class ColourStop {
public:
float position;
ColourAlpha colour;
ColourStop(float position_, ColourAlpha colour_) noexcept :
position(position_), colour(colour_) {
}
};
/**
@ -254,7 +286,7 @@ struct FontParameters {
bool italic_=false,
int extraFontFlag_=0,
int technology_=0,
int characterSet_=0) :
int characterSet_=0) noexcept :
faceName(faceName_),
size(size_),
@ -271,33 +303,62 @@ struct FontParameters {
class Font {
protected:
FontID fid;
// Private so Font objects can not be copied
Font(const Font &);
Font &operator=(const Font &);
public:
Font();
Font() noexcept;
// Deleted so Font objects can not be copied
Font(const Font &) = delete;
Font(Font &&) = delete;
Font &operator=(const Font &) = delete;
Font &operator=(Font &&) = delete;
virtual ~Font();
virtual void Create(const FontParameters &fp);
virtual void Release();
FontID GetID() { return fid; }
FontID GetID() const noexcept { return fid; }
// Alias another font - caller guarantees not to Release
void SetID(FontID fid_) { fid = fid_; }
void SetID(FontID fid_) noexcept { fid = fid_; }
friend class Surface;
friend class SurfaceImpl;
};
class IScreenLine {
public:
virtual std::string_view Text() const = 0;
virtual size_t Length() const = 0;
virtual size_t RepresentationCount() const = 0;
virtual XYPOSITION Width() const = 0;
virtual XYPOSITION Height() const = 0;
virtual XYPOSITION TabWidth() const = 0;
virtual XYPOSITION TabWidthMinimumPixels() const = 0;
virtual const Font *FontOfPosition(size_t position) const = 0;
virtual XYPOSITION RepresentationWidth(size_t position) const = 0;
virtual XYPOSITION TabPositionAfter(XYPOSITION xPosition) const = 0;
};
struct Interval {
XYPOSITION left;
XYPOSITION right;
};
class IScreenLineLayout {
public:
virtual ~IScreenLineLayout() = default;
virtual size_t PositionFromX(XYPOSITION xDistance, bool charPosition) = 0;
virtual XYPOSITION XFromPosition(size_t caretPosition) = 0;
virtual std::vector<Interval> FindRangeIntervals(size_t start, size_t end) = 0;
};
/**
* A surface abstracts a place to draw.
*/
class Surface {
private:
// Private so Surface objects can not be copied
Surface(const Surface &) {}
Surface &operator=(const Surface &) { return *this; }
public:
Surface() {}
Surface() noexcept = default;
Surface(const Surface &) = delete;
Surface(Surface &&) = delete;
Surface &operator=(const Surface &) = delete;
Surface &operator=(Surface &&) = delete;
virtual ~Surface() {}
static Surface *Allocate(int technology);
@ -312,27 +373,29 @@ public:
virtual int DeviceHeightFont(int points)=0;
virtual void MoveTo(int x_, int y_)=0;
virtual void LineTo(int x_, int y_)=0;
virtual void Polygon(Point *pts, int npts, ColourDesired fore, ColourDesired back)=0;
virtual void Polygon(Point *pts, size_t npts, ColourDesired fore, ColourDesired back)=0;
virtual void RectangleDraw(PRectangle rc, ColourDesired fore, ColourDesired back)=0;
virtual void FillRectangle(PRectangle rc, ColourDesired back)=0;
virtual void FillRectangle(PRectangle rc, Surface &surfacePattern)=0;
virtual void RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesired back)=0;
virtual void AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fill, int alphaFill,
ColourDesired outline, int alphaOutline, int flags)=0;
enum class GradientOptions { leftToRight, topToBottom };
virtual void GradientRectangle(PRectangle rc, const std::vector<ColourStop> &stops, GradientOptions options)=0;
virtual void DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) = 0;
virtual void Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back)=0;
virtual void Copy(PRectangle rc, Point from, Surface &surfaceSource)=0;
virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0;
virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore, ColourDesired back)=0;
virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len, ColourDesired fore)=0;
virtual void MeasureWidths(Font &font_, const char *s, int len, XYPOSITION *positions)=0;
virtual XYPOSITION WidthText(Font &font_, const char *s, int len)=0;
virtual XYPOSITION WidthChar(Font &font_, char ch)=0;
virtual std::unique_ptr<IScreenLineLayout> Layout(const IScreenLine *screenLine) = 0;
virtual void DrawTextNoClip(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) = 0;
virtual void DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore, ColourDesired back) = 0;
virtual void DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, std::string_view text, ColourDesired fore) = 0;
virtual void MeasureWidths(Font &font_, std::string_view text, XYPOSITION *positions) = 0;
virtual XYPOSITION WidthText(Font &font_, std::string_view text) = 0;
virtual XYPOSITION Ascent(Font &font_)=0;
virtual XYPOSITION Descent(Font &font_)=0;
virtual XYPOSITION InternalLeading(Font &font_)=0;
virtual XYPOSITION ExternalLeading(Font &font_)=0;
virtual XYPOSITION Height(Font &font_)=0;
virtual XYPOSITION AverageCharWidth(Font &font_)=0;
@ -341,13 +404,9 @@ public:
virtual void SetUnicodeMode(bool unicodeMode_)=0;
virtual void SetDBCSMode(int codePage)=0;
virtual void SetBidiR2L(bool bidiR2L_)=0;
};
/**
* A simple callback action passing one piece of untyped user data.
*/
typedef void (*CallBackAction)(void*);
/**
* Class to hide the details of window manipulation.
* Does not own the window which will normally have a longer life than this object.
@ -356,30 +415,31 @@ class Window {
protected:
WindowID wid;
public:
Window() : wid(0), cursorLast(cursorInvalid) {
Window() noexcept : wid(nullptr), cursorLast(cursorInvalid) {
}
Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) {
}
virtual ~Window();
Window &operator=(WindowID wid_) {
Window(const Window &source) = delete;
Window(Window &&) = delete;
Window &operator=(WindowID wid_) noexcept {
wid = wid_;
cursorLast = cursorInvalid;
return *this;
}
WindowID GetID() const { return wid; }
bool Created() const { return wid != 0; }
Window &operator=(const Window &) = delete;
Window &operator=(Window &&) = delete;
virtual ~Window();
WindowID GetID() const noexcept { return wid; }
bool Created() const noexcept { return wid != nullptr; }
void Destroy();
bool HasFocus();
PRectangle GetPosition();
PRectangle GetPosition() const;
void SetPosition(PRectangle rc);
void SetPositionRelative(PRectangle rc, Window relativeTo);
PRectangle GetClientPosition();
void SetPositionRelative(PRectangle rc, const Window *relativeTo);
PRectangle GetClientPosition() const;
void Show(bool show=true);
void InvalidateAll();
void InvalidateRectangle(PRectangle rc);
virtual void SetFont(Font &font);
enum Cursor { cursorInvalid, cursorText, cursorArrow, cursorUp, cursorWait, cursorHoriz, cursorVert, cursorReverseArrow, cursorHand };
void SetCursor(Cursor curs);
void SetTitle(const char *s);
PRectangle GetMonitorRect(Point pt);
private:
Cursor cursorLast;
@ -389,13 +449,26 @@ private:
* Listbox management.
*/
// ScintillaBase implements IListBoxDelegate to receive ListBoxEvents from a ListBox
struct ListBoxEvent {
enum class EventType { selectionChange, doubleClick } event;
ListBoxEvent(EventType event_) noexcept : event(event_) {
}
};
class IListBoxDelegate {
public:
virtual void ListNotify(ListBoxEvent *plbe)=0;
};
class ListBox : public Window {
public:
ListBox();
virtual ~ListBox();
ListBox() noexcept;
~ListBox() override;
static ListBox *Allocate();
virtual void SetFont(Font &font)=0;
void SetFont(Font &font) override =0;
virtual void Create(Window &parent, int ctrlID, Point location, int lineHeight_, bool unicodeMode_, int technology_)=0;
virtual void SetAverageCharWidth(int width)=0;
virtual void SetVisibleRows(int rows)=0;
@ -412,7 +485,7 @@ public:
virtual void RegisterImage(int type, const char *xpm_data)=0;
virtual void RegisterRGBAImage(int type, int width, int height, const unsigned char *pixelsImage) = 0;
virtual void ClearRegisteredImages()=0;
virtual void SetDoubleClickAction(CallBackAction, void *)=0;
virtual void SetDelegate(IListBoxDelegate *lbDelegate)=0;
virtual void SetList(const char* list, char separator, char typesep)=0;
};
@ -422,27 +495,19 @@ public:
class Menu {
MenuID mid;
public:
Menu();
MenuID GetID() { return mid; }
Menu() noexcept;
MenuID GetID() const noexcept { return mid; }
void CreatePopUp();
void Destroy();
void Show(Point pt, Window &w);
};
class ElapsedTime {
long bigBit;
long littleBit;
public:
ElapsedTime();
double Duration(bool reset=false);
};
/**
* Dynamic Library (DLL/SO/...) loading
*/
class DynamicLibrary {
public:
virtual ~DynamicLibrary() {}
virtual ~DynamicLibrary() = default;
/// @return Pointer to function "name", or NULL on failure.
virtual Function FindFunction(const char *name) = 0;
@ -469,65 +534,34 @@ public:
* and chrome colour. Not a creatable object, more of a module with several functions.
*/
class Platform {
// Private so Platform objects can not be copied
Platform(const Platform &) {}
Platform &operator=(const Platform &) { return *this; }
public:
// Should be private because no new Platforms are ever created
// but gcc warns about this
Platform() {}
~Platform() {}
Platform() = default;
Platform(const Platform &) = delete;
Platform(Platform &&) = delete;
Platform &operator=(const Platform &) = delete;
Platform &operator=(Platform &&) = delete;
~Platform() = default;
static ColourDesired Chrome();
static ColourDesired ChromeHighlight();
static const char *DefaultFont();
static int DefaultFontSize();
static unsigned int DoubleClickTime();
static bool MouseButtonBounce();
static void DebugDisplay(const char *s);
static bool IsKeyDown(int key);
static long SendScintilla(
WindowID w, unsigned int msg, unsigned long wParam=0, long lParam=0);
static long SendScintillaPointer(
WindowID w, unsigned int msg, unsigned long wParam=0, void *lParam=0);
static bool IsDBCSLeadByte(int codePage, char ch);
static int DBCSCharLength(int codePage, const char *s);
static int DBCSCharMaxLength();
// These are utility functions not really tied to a platform
static int Minimum(int a, int b);
static int Maximum(int a, int b);
// Next three assume 16 bit shorts and 32 bit longs
static long LongFromTwoShorts(short a,short b) {
static constexpr long LongFromTwoShorts(short a,short b) noexcept {
return (a) | ((b) << 16);
}
static short HighShortFromLong(long x) {
return static_cast<short>(x >> 16);
}
static short LowShortFromLong(long x) {
return static_cast<short>(x & 0xffff);
}
static void DebugPrintf(const char *format, ...);
static bool ShowAssertionPopUps(bool assertionPopUps_);
static void Assert(const char *c, const char *file, int line) CLANG_ANALYZER_NORETURN;
static int Clamp(int val, int minVal, int maxVal);
};
#ifdef NDEBUG
#define PLATFORM_ASSERT(c) ((void)0)
#else
#ifdef SCI_NAMESPACE
#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Scintilla::Platform::Assert(#c, __FILE__, __LINE__))
#else
#define PLATFORM_ASSERT(c) ((c) ? (void)(0) : Platform::Assert(#c, __FILE__, __LINE__))
#endif
#endif
#ifdef SCI_NAMESPACE
}
#endif
#if defined(__GNUC__) && defined(SCINTILLA_QT)
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#endif
#endif

View File

@ -132,10 +132,19 @@
#define SCLEX_SREC 117
#define SCLEX_IHEX 118
#define SCLEX_TEHEX 119
#define SCLEX_JSON 120
#define SCLEX_EDIFACT 121
#define SCLEX_INDENT 122
#define SCLEX_MAXIMA 123
#define SCLEX_STATA 124
#define SCLEX_SAS 125
#define SCLEX_NIM 126
#define SCLEX_CIL 127
#define SCLEX_SEARCHRESULT 150
#define SCLEX_OBJC 151
#define SCLEX_USER 152
#define SCLEX_AUTOMATIC 1000
//For All lexer
#define SCE_UNIVERSAL_FOUND_STYLE 31
#define SCE_UNIVERSAL_FOUND_STYLE_SMART 29
@ -147,82 +156,6 @@
#define SCE_UNIVERSAL_FOUND_STYLE_EXT3 23
#define SCE_UNIVERSAL_FOUND_STYLE_EXT4 22
#define SCE_UNIVERSAL_FOUND_STYLE_EXT5 21
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_P_NUMBER 2
#define SCE_P_STRING 3
#define SCE_P_CHARACTER 4
#define SCE_P_WORD 5
#define SCE_P_TRIPLE 6
#define SCE_P_TRIPLEDOUBLE 7
#define SCE_P_CLASSNAME 8
#define SCE_P_DEFNAME 9
#define SCE_P_OPERATOR 10
#define SCE_P_IDENTIFIER 11
#define SCE_P_COMMENTBLOCK 12
#define SCE_P_STRINGEOL 13
#define SCE_P_WORD2 14
#define SCE_P_DECORATOR 15
#define SCE_C_DEFAULT 0
#define SCE_C_COMMENT 1
#define SCE_C_COMMENTLINE 2
#define SCE_C_COMMENTDOC 3
#define SCE_C_NUMBER 4
#define SCE_C_WORD 5
#define SCE_C_STRING 6
#define SCE_C_CHARACTER 7
#define SCE_C_UUID 8
#define SCE_C_PREPROCESSOR 9
#define SCE_C_OPERATOR 10
#define SCE_C_IDENTIFIER 11
#define SCE_C_STRINGEOL 12
#define SCE_C_VERBATIM 13
#define SCE_C_REGEX 14
#define SCE_C_COMMENTLINEDOC 15
#define SCE_C_WORD2 16
#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_C_HASHQUOTEDSTRING 22
#define SCE_C_PREPROCESSORCOMMENT 23
#define SCE_C_PREPROCESSORCOMMENTDOC 24
#define SCE_C_USERLITERAL 25
#define SCE_C_TASKMARKER 26
#define SCE_C_ESCAPESEQUENCE 27
#define SCE_D_DEFAULT 0
#define SCE_D_COMMENT 1
#define SCE_D_COMMENTLINE 2
#define SCE_D_COMMENTDOC 3
#define SCE_D_COMMENTNESTED 4
#define SCE_D_NUMBER 5
#define SCE_D_WORD 6
#define SCE_D_WORD2 7
#define SCE_D_WORD3 8
#define SCE_D_TYPEDEF 9
#define SCE_D_STRING 10
#define SCE_D_STRINGEOL 11
#define SCE_D_CHARACTER 12
#define SCE_D_OPERATOR 13
#define SCE_D_IDENTIFIER 14
#define SCE_D_COMMENTLINEDOC 15
#define SCE_D_COMMENTDOCKEYWORD 16
#define SCE_D_COMMENTDOCKEYWORDERROR 17
#define SCE_D_STRINGB 18
#define SCE_D_STRINGR 19
#define SCE_D_WORD5 20
#define SCE_D_WORD6 21
#define SCE_D_WORD7 22
#define SCE_SEARCHRESULT_DEFAULT 0
#define SCE_SEARCHRESULT_SEARCH_HEADER 1
#define SCE_SEARCHRESULT_FILE_HEADER 2
#define SCE_SEARCHRESULT_LINE_NUMBER 3
#define SCE_SEARCHRESULT_WORD2SEARCH 4
#define SCE_SEARCHRESULT_HIGHLIGHT_LINE 5
#define SCE_SEARCHRESULT_CURRENT_LINE 6
#define SCE_OBJC_DIRECTIVE 20
#define SCE_OBJC_QUALIFIER 21
#define SCE_UDL_VERSION_MAJOR 2
#define SCE_UDL_VERSION_MINOR 1
@ -321,6 +254,88 @@
#define SCE_USER_MASK_NESTING_OPERATORS2 0x2000000
#define SCE_USER_MASK_NESTING_NUMBERS 0x4000000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
#define SCE_P_NUMBER 2
#define SCE_P_STRING 3
#define SCE_P_CHARACTER 4
#define SCE_P_WORD 5
#define SCE_P_TRIPLE 6
#define SCE_P_TRIPLEDOUBLE 7
#define SCE_P_CLASSNAME 8
#define SCE_P_DEFNAME 9
#define SCE_P_OPERATOR 10
#define SCE_P_IDENTIFIER 11
#define SCE_P_COMMENTBLOCK 12
#define SCE_P_STRINGEOL 13
#define SCE_P_WORD2 14
#define SCE_P_DECORATOR 15
#define SCE_P_FSTRING 16
#define SCE_P_FCHARACTER 17
#define SCE_P_FTRIPLE 18
#define SCE_P_FTRIPLEDOUBLE 19
#define SCE_C_DEFAULT 0
#define SCE_C_COMMENT 1
#define SCE_C_COMMENTLINE 2
#define SCE_C_COMMENTDOC 3
#define SCE_C_NUMBER 4
#define SCE_C_WORD 5
#define SCE_C_STRING 6
#define SCE_C_CHARACTER 7
#define SCE_C_UUID 8
#define SCE_C_PREPROCESSOR 9
#define SCE_C_OPERATOR 10
#define SCE_C_IDENTIFIER 11
#define SCE_C_STRINGEOL 12
#define SCE_C_VERBATIM 13
#define SCE_C_REGEX 14
#define SCE_C_COMMENTLINEDOC 15
#define SCE_C_WORD2 16
#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_C_HASHQUOTEDSTRING 22
#define SCE_C_PREPROCESSORCOMMENT 23
#define SCE_C_PREPROCESSORCOMMENTDOC 24
#define SCE_C_USERLITERAL 25
#define SCE_C_TASKMARKER 26
#define SCE_C_ESCAPESEQUENCE 27
#define SCE_D_DEFAULT 0
#define SCE_D_COMMENT 1
#define SCE_D_COMMENTLINE 2
#define SCE_D_COMMENTDOC 3
#define SCE_D_COMMENTNESTED 4
#define SCE_D_NUMBER 5
#define SCE_D_WORD 6
#define SCE_D_WORD2 7
#define SCE_D_WORD3 8
#define SCE_D_TYPEDEF 9
#define SCE_D_STRING 10
#define SCE_D_STRINGEOL 11
#define SCE_D_CHARACTER 12
#define SCE_D_OPERATOR 13
#define SCE_D_IDENTIFIER 14
#define SCE_D_COMMENTLINEDOC 15
#define SCE_D_COMMENTDOCKEYWORD 16
#define SCE_D_COMMENTDOCKEYWORDERROR 17
#define SCE_D_STRINGB 18
#define SCE_D_STRINGR 19
#define SCE_D_WORD5 20
#define SCE_D_WORD6 21
#define SCE_D_WORD7 22
#define SCE_SEARCHRESULT_DEFAULT 0
#define SCE_SEARCHRESULT_SEARCH_HEADER 1
#define SCE_SEARCHRESULT_FILE_HEADER 2
#define SCE_SEARCHRESULT_LINE_NUMBER 3
#define SCE_SEARCHRESULT_WORD2SEARCH 4
#define SCE_SEARCHRESULT_HIGHLIGHT_LINE 5
#define SCE_SEARCHRESULT_CURRENT_LINE 6
#define SCE_OBJC_DIRECTIVE 20
#define SCE_OBJC_QUALIFIER 21
#define SCE_TCL_DEFAULT 0
#define SCE_TCL_COMMENT 1
#define SCE_TCL_COMMENTLINE 2
@ -619,6 +634,24 @@
#define SCE_ERR_JAVA_STACK 20
#define SCE_ERR_VALUE 21
#define SCE_ERR_GCC_INCLUDED_FROM 22
#define SCE_ERR_ESCSEQ 23
#define SCE_ERR_ESCSEQ_UNKNOWN 24
#define SCE_ERR_ES_BLACK 40
#define SCE_ERR_ES_RED 41
#define SCE_ERR_ES_GREEN 42
#define SCE_ERR_ES_BROWN 43
#define SCE_ERR_ES_BLUE 44
#define SCE_ERR_ES_MAGENTA 45
#define SCE_ERR_ES_CYAN 46
#define SCE_ERR_ES_GRAY 47
#define SCE_ERR_ES_DARK_GRAY 48
#define SCE_ERR_ES_BRIGHT_RED 49
#define SCE_ERR_ES_BRIGHT_GREEN 50
#define SCE_ERR_ES_YELLOW 51
#define SCE_ERR_ES_BRIGHT_BLUE 52
#define SCE_ERR_ES_BRIGHT_MAGENTA 53
#define SCE_ERR_ES_BRIGHT_CYAN 54
#define SCE_ERR_ES_WHITE 55
#define SCE_BAT_DEFAULT 0
#define SCE_BAT_COMMENT 1
#define SCE_BAT_WORD 2
@ -653,6 +686,10 @@
#define SCE_DIFF_DELETED 5
#define SCE_DIFF_ADDED 6
#define SCE_DIFF_CHANGED 7
#define SCE_DIFF_PATCH_ADD 8
#define SCE_DIFF_PATCH_DELETE 9
#define SCE_DIFF_REMOVED_PATCH_ADD 10
#define SCE_DIFF_REMOVED_PATCH_DELETE 11
#define SCE_CONF_DEFAULT 0
#define SCE_CONF_COMMENT 1
#define SCE_CONF_NUMBER 2
@ -701,6 +738,20 @@
#define SCE_BAAN_IDENTIFIER 8
#define SCE_BAAN_STRINGEOL 9
#define SCE_BAAN_WORD2 10
#define SCE_BAAN_WORD3 11
#define SCE_BAAN_WORD4 12
#define SCE_BAAN_WORD5 13
#define SCE_BAAN_WORD6 14
#define SCE_BAAN_WORD7 15
#define SCE_BAAN_WORD8 16
#define SCE_BAAN_WORD9 17
#define SCE_BAAN_TABLEDEF 18
#define SCE_BAAN_TABLESQL 19
#define SCE_BAAN_FUNCTION 20
#define SCE_BAAN_DOMDEF 21
#define SCE_BAAN_FUNCDEF 22
#define SCE_BAAN_OBJECTDEF 23
#define SCE_BAAN_DEFINEDEF 24
#define SCE_LISP_DEFAULT 0
#define SCE_LISP_COMMENT 1
#define SCE_LISP_NUMBER 2
@ -754,6 +805,14 @@
#define SCE_MATLAB_OPERATOR 6
#define SCE_MATLAB_IDENTIFIER 7
#define SCE_MATLAB_DOUBLEQUOTESTRING 8
#define SCE_MAXIMA_OPERATOR 0
#define SCE_MAXIMA_COMMANDENDING 1
#define SCE_MAXIMA_COMMENT 2
#define SCE_MAXIMA_NUMBER 3
#define SCE_MAXIMA_STRING 4
#define SCE_MAXIMA_COMMAND 5
#define SCE_MAXIMA_VARIABLE 6
#define SCE_MAXIMA_UNKNOWN 7
#define SCE_SCRIPTOL_DEFAULT 0
#define SCE_SCRIPTOL_WHITE 1
#define SCE_SCRIPTOL_COMMENTLINE 2
@ -1379,38 +1438,19 @@
#define SCE_PLM_OPERATOR 5
#define SCE_PLM_CONTROL 6
#define SCE_PLM_KEYWORD 7
#define SCE_4GL_DEFAULT 0
#define SCE_4GL_NUMBER 1
#define SCE_4GL_WORD 2
#define SCE_4GL_STRING 3
#define SCE_4GL_CHARACTER 4
#define SCE_4GL_PREPROCESSOR 5
#define SCE_4GL_OPERATOR 6
#define SCE_4GL_IDENTIFIER 7
#define SCE_4GL_BLOCK 8
#define SCE_4GL_END 9
#define SCE_4GL_COMMENT1 10
#define SCE_4GL_COMMENT2 11
#define SCE_4GL_COMMENT3 12
#define SCE_4GL_COMMENT4 13
#define SCE_4GL_COMMENT5 14
#define SCE_4GL_COMMENT6 15
#define SCE_4GL_DEFAULT_ 16
#define SCE_4GL_NUMBER_ 17
#define SCE_4GL_WORD_ 18
#define SCE_4GL_STRING_ 19
#define SCE_4GL_CHARACTER_ 20
#define SCE_4GL_PREPROCESSOR_ 21
#define SCE_4GL_OPERATOR_ 22
#define SCE_4GL_IDENTIFIER_ 23
#define SCE_4GL_BLOCK_ 24
#define SCE_4GL_END_ 25
#define SCE_4GL_COMMENT1_ 26
#define SCE_4GL_COMMENT2_ 27
#define SCE_4GL_COMMENT3_ 28
#define SCE_4GL_COMMENT4_ 29
#define SCE_4GL_COMMENT5_ 30
#define SCE_4GL_COMMENT6_ 31
#define SCE_ABL_DEFAULT 0
#define SCE_ABL_NUMBER 1
#define SCE_ABL_WORD 2
#define SCE_ABL_STRING 3
#define SCE_ABL_CHARACTER 4
#define SCE_ABL_PREPROCESSOR 5
#define SCE_ABL_OPERATOR 6
#define SCE_ABL_IDENTIFIER 7
#define SCE_ABL_BLOCK 8
#define SCE_ABL_END 9
#define SCE_ABL_COMMENT 10
#define SCE_ABL_TASKMARKER 11
#define SCE_ABL_LINECOMMENT 12
#define SCE_ABAQUS_DEFAULT 0
#define SCE_ABAQUS_COMMENT 1
#define SCE_ABAQUS_COMMENTBLOCK 2
@ -1688,6 +1728,7 @@
#define SCE_COFFEESCRIPT_COMMENTBLOCK 22
#define SCE_COFFEESCRIPT_VERBOSE_REGEX 23
#define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24
#define SCE_COFFEESCRIPT_INSTANCEPROPERTY 25
#define SCE_AVS_DEFAULT 0
#define SCE_AVS_COMMENTBLOCK 1
#define SCE_AVS_COMMENTBLOCKN 2
@ -1889,6 +1930,85 @@
#define SCE_HEX_CHECKSUM 16
#define SCE_HEX_CHECKSUM_WRONG 17
#define SCE_HEX_GARBAGE 18
#define SCE_JSON_DEFAULT 0
#define SCE_JSON_NUMBER 1
#define SCE_JSON_STRING 2
#define SCE_JSON_STRINGEOL 3
#define SCE_JSON_PROPERTYNAME 4
#define SCE_JSON_ESCAPESEQUENCE 5
#define SCE_JSON_LINECOMMENT 6
#define SCE_JSON_BLOCKCOMMENT 7
#define SCE_JSON_OPERATOR 8
#define SCE_JSON_URI 9
#define SCE_JSON_COMPACTIRI 10
#define SCE_JSON_KEYWORD 11
#define SCE_JSON_LDKEYWORD 12
#define SCE_JSON_ERROR 13
#define SCE_EDI_DEFAULT 0
#define SCE_EDI_SEGMENTSTART 1
#define SCE_EDI_SEGMENTEND 2
#define SCE_EDI_SEP_ELEMENT 3
#define SCE_EDI_SEP_COMPOSITE 4
#define SCE_EDI_SEP_RELEASE 5
#define SCE_EDI_UNA 6
#define SCE_EDI_UNH 7
#define SCE_EDI_BADSEGMENT 8
#define SCE_STATA_DEFAULT 0
#define SCE_STATA_COMMENT 1
#define SCE_STATA_COMMENTLINE 2
#define SCE_STATA_COMMENTBLOCK 3
#define SCE_STATA_NUMBER 4
#define SCE_STATA_OPERATOR 5
#define SCE_STATA_IDENTIFIER 6
#define SCE_STATA_STRING 7
#define SCE_STATA_TYPE 8
#define SCE_STATA_WORD 9
#define SCE_STATA_GLOBAL_MACRO 10
#define SCE_STATA_MACRO 11
#define SCE_SAS_DEFAULT 0
#define SCE_SAS_COMMENT 1
#define SCE_SAS_COMMENTLINE 2
#define SCE_SAS_COMMENTBLOCK 3
#define SCE_SAS_NUMBER 4
#define SCE_SAS_OPERATOR 5
#define SCE_SAS_IDENTIFIER 6
#define SCE_SAS_STRING 7
#define SCE_SAS_TYPE 8
#define SCE_SAS_WORD 9
#define SCE_SAS_GLOBAL_MACRO 10
#define SCE_SAS_MACRO 11
#define SCE_SAS_MACRO_KEYWORD 12
#define SCE_SAS_BLOCK_KEYWORD 13
#define SCE_SAS_MACRO_FUNCTION 14
#define SCE_SAS_STATEMENT 15
#define SCE_NIM_DEFAULT 0
#define SCE_NIM_COMMENT 1
#define SCE_NIM_COMMENTDOC 2
#define SCE_NIM_COMMENTLINE 3
#define SCE_NIM_COMMENTLINEDOC 4
#define SCE_NIM_NUMBER 5
#define SCE_NIM_STRING 6
#define SCE_NIM_CHARACTER 7
#define SCE_NIM_WORD 8
#define SCE_NIM_TRIPLE 9
#define SCE_NIM_TRIPLEDOUBLE 10
#define SCE_NIM_BACKTICKS 11
#define SCE_NIM_FUNCNAME 12
#define SCE_NIM_STRINGEOL 13
#define SCE_NIM_NUMERROR 14
#define SCE_NIM_OPERATOR 15
#define SCE_NIM_IDENTIFIER 16
#define SCE_CIL_DEFAULT 0
#define SCE_CIL_COMMENT 1
#define SCE_CIL_COMMENTLINE 2
#define SCE_CIL_WORD 3
#define SCE_CIL_WORD2 4
#define SCE_CIL_WORD3 5
#define SCE_CIL_STRING 6
#define SCE_CIL_LABEL 7
#define SCE_CIL_OPERATOR 8
#define SCE_CIL_IDENTIFIER 9
#define SCE_CIL_STRINGEOL 10
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif

View File

@ -0,0 +1,29 @@
// Scintilla source code edit control
/** @file Sci_Position.h
** Define the Sci_Position type used in Scintilla's external interfaces.
** These need to be available to clients written in C so are not in a C++ namespace.
**/
// Copyright 2015 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#ifndef SCI_POSITION_H
#define SCI_POSITION_H
#include <stddef.h>
// Basic signed type used throughout interface
typedef ptrdiff_t Sci_Position;
// Unsigned variant used for ILexer::Lex and ILexer::Fold
typedef size_t Sci_PositionU;
// For Sci_CharacterRange which is defined as long to be compatible with Win32 CHARRANGE
typedef long Sci_PositionCR;
#ifdef _WIN32
#define SCI_METHOD __stdcall
#else
#define SCI_METHOD
#endif
#endif

View File

@ -26,19 +26,15 @@ int Scintilla_LinkLexers(void);
}
#endif
/* Here should be placed typedefs for uptr_t, an unsigned integer type large enough to
* hold a pointer and sptr_t, a signed integer large enough to hold a pointer.
* May need to be changed for 64 bit platforms. */
#if defined(_WIN32)
#include <basetsd.h>
#endif
#ifdef MAXULONG_PTR
typedef ULONG_PTR uptr_t;
typedef LONG_PTR sptr_t;
#else
typedef unsigned long uptr_t;
typedef long sptr_t;
#endif
// Include header that defines basic numeric types.
#include <stdint.h>
// Define uptr_t, an unsigned integer type large enough to hold a pointer.
typedef uintptr_t uptr_t;
// Define sptr_t, a signed integer large enough to hold a pointer.
typedef intptr_t sptr_t;
#include "Sci_Position.h"
typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
@ -71,8 +67,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCWS_INVISIBLE 0
#define SCWS_VISIBLEALWAYS 1
#define SCWS_VISIBLEAFTERINDENT 2
#define SCWS_VISIBLEONLYININDENT 3
#define SCI_GETVIEWWS 2020
#define SCI_SETVIEWWS 2021
#define SCTD_LONGARROW 0
#define SCTD_STRIKEOUT 1
#define SCI_GETTABDRAWMODE 2698
#define SCI_SETTABDRAWMODE 2699
#define SCI_POSITIONFROMPOINT 2022
#define SCI_POSITIONFROMPOINTCLOSE 2023
#define SCI_GOTOLINE 2024
@ -164,6 +165,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARGIN_FORE 3
#define SC_MARGIN_TEXT 4
#define SC_MARGIN_RTEXT 5
#define SC_MARGIN_COLOUR 6
#define SCI_SETMARGINTYPEN 2240
#define SCI_GETMARGINTYPEN 2241
#define SCI_SETMARGINWIDTHN 2242
@ -174,6 +176,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETMARGINSENSITIVEN 2247
#define SCI_SETMARGINCURSORN 2248
#define SCI_GETMARGINCURSORN 2249
#define SCI_SETMARGINBACKN 2250
#define SCI_GETMARGINBACKN 2251
#define SCI_SETMARGINS 2252
#define SCI_GETMARGINS 2253
#define STYLE_DEFAULT 32
#define STYLE_LINENUMBER 33
#define STYLE_BRACELIGHT 34
@ -181,6 +187,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define STYLE_CONTROLCHAR 36
#define STYLE_INDENTGUIDE 37
#define STYLE_CALLTIP 38
#define STYLE_FOLDDISPLAYTEXT 39
#define STYLE_LASTPREDEFINED 39
#define STYLE_MAX 255
#define SC_CHARSET_ANSI 0
@ -194,6 +201,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_CHARSET_MAC 77
#define SC_CHARSET_OEM 255
#define SC_CHARSET_RUSSIAN 204
#define SC_CHARSET_OEM866 866
#define SC_CHARSET_CYRILLIC 1251
#define SC_CHARSET_SHIFTJIS 128
#define SC_CHARSET_SYMBOL 2
@ -217,6 +225,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_CASE_MIXED 0
#define SC_CASE_UPPER 1
#define SC_CASE_LOWER 2
#define SC_CASE_CAMEL 3
#define SCI_STYLEGETFORE 2481
#define SCI_STYLEGETBACK 2482
#define SCI_STYLEGETBOLD 2483
@ -277,6 +286,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define INDIC_COMPOSITIONTHIN 15
#define INDIC_FULLBOX 16
#define INDIC_TEXTFORE 17
#define INDIC_POINT 18
#define INDIC_POINTCHARACTER 19
#define INDIC_GRADIENT 20
#define INDIC_GRADIENTCENTRE 21
#define INDIC_IME 32
#define INDIC_IME_MAX 35
#define INDIC_MAX 35
@ -304,8 +317,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETWHITESPACEBACK 2085
#define SCI_SETWHITESPACESIZE 2086
#define SCI_GETWHITESPACESIZE 2087
#define SCI_SETSTYLEBITS 2090
#define SCI_GETSTYLEBITS 2091
#define SCI_SETLINESTATE 2092
#define SCI_GETLINESTATE 2093
#define SCI_GETMAXLINESTATE 2094
@ -313,6 +324,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETCARETLINEVISIBLE 2096
#define SCI_GETCARETLINEBACK 2097
#define SCI_SETCARETLINEBACK 2098
#define SCI_GETCARETLINEFRAME 2704
#define SCI_SETCARETLINEFRAME 2705
#define SCI_STYLESETCHANGEABLE 2099
#define SCI_AUTOCSHOW 2100
#define SCI_AUTOCCANCEL 2101
@ -352,6 +365,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETLINEINDENTPOSITION 2128
#define SCI_GETCOLUMN 2129
#define SCI_COUNTCHARACTERS 2633
#define SCI_COUNTCODEUNITS 2715
#define SCI_SETHSCROLLBAR 2130
#define SCI_GETHSCROLLBAR 2131
#define SC_IV_NONE 0
@ -379,6 +393,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_PRINT_BLACKONWHITE 2
#define SC_PRINT_COLOURONWHITE 3
#define SC_PRINT_COLOURONWHITEDEFAULTBG 4
#define SC_PRINT_SCREENCOLOURS 5
#define SCI_SETPRINTCOLOURMODE 2148
#define SCI_GETPRINTCOLOURMODE 2149
#define SCFIND_WHOLEWORD 0x2
@ -434,6 +449,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETTARGETEND 2193
#define SCI_SETTARGETRANGE 2686
#define SCI_GETTARGETTEXT 2687
#define SCI_TARGETFROMSELECTION 2287
#define SCI_TARGETWHOLEDOCUMENT 2690
#define SCI_REPLACETARGET 2194
#define SCI_REPLACETARGETRE 2195
#define SCI_SEARCHINTARGET 2197
@ -468,6 +485,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETFOLDEXPANDED 2229
#define SCI_GETFOLDEXPANDED 2230
#define SCI_TOGGLEFOLD 2231
#define SCI_TOGGLEFOLDSHOWTEXT 2700
#define SC_FOLDDISPLAYTEXT_HIDDEN 0
#define SC_FOLDDISPLAYTEXT_STANDARD 1
#define SC_FOLDDISPLAYTEXT_BOXED 2
#define SCI_FOLDDISPLAYTEXTSETSTYLE 2701
#define SC_FOLDACTION_CONTRACT 0
#define SC_FOLDACTION_EXPAND 1
#define SC_FOLDACTION_TOGGLE 2
@ -498,6 +520,13 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETMOUSEDWELLTIME 2265
#define SCI_WORDSTARTPOSITION 2266
#define SCI_WORDENDPOSITION 2267
#define SCI_ISRANGEWORD 2691
#define SC_IDLESTYLING_NONE 0
#define SC_IDLESTYLING_TOVISIBLE 1
#define SC_IDLESTYLING_AFTERVISIBLE 2
#define SC_IDLESTYLING_ALL 3
#define SCI_SETIDLESTYLING 2692
#define SCI_GETIDLESTYLING 2693
#define SC_WRAP_NONE 0
#define SC_WRAP_WORD 1
#define SC_WRAP_CHAR 2
@ -520,6 +549,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_WRAPINDENT_FIXED 0
#define SC_WRAPINDENT_SAME 1
#define SC_WRAPINDENT_INDENT 2
#define SC_WRAPINDENT_DEEPINDENT 3
#define SCI_SETWRAPINDENTMODE 2472
#define SCI_GETWRAPINDENTMODE 2473
#define SC_CACHE_NONE 0
@ -539,8 +569,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETVSCROLLBAR 2280
#define SCI_GETVSCROLLBAR 2281
#define SCI_APPENDTEXT 2282
#define SCI_GETTWOPHASEDRAW 2283
#define SCI_SETTWOPHASEDRAW 2284
#define SC_PHASES_ONE 0
#define SC_PHASES_TWO 1
#define SC_PHASES_MULTIPLE 2
@ -559,11 +587,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETMULTIPASTE 2614
#define SCI_GETMULTIPASTE 2615
#define SCI_GETTAG 2616
#define SCI_TARGETFROMSELECTION 2287
#define SCI_LINESJOIN 2288
#define SCI_LINESSPLIT 2289
#define SCI_SETFOLDMARGINCOLOUR 2290
#define SCI_SETFOLDMARGINHICOLOUR 2291
#define SC_ACCESSIBILITY_DISABLED 0
#define SC_ACCESSIBILITY_ENABLED 1
#define SCI_SETACCESSIBILITY 2702
#define SCI_GETACCESSIBILITY 2703
#define SCI_LINEDOWN 2300
#define SCI_LINEDOWNEXTEND 2301
#define SCI_LINEUP 2302
@ -605,6 +636,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_LINECUT 2337
#define SCI_LINEDELETE 2338
#define SCI_LINETRANSPOSE 2339
#define SCI_LINEREVERSE 2354
#define SCI_LINEDUPLICATE 2404
#define SCI_LOWERCASE 2340
#define SCI_UPPERCASE 2341
@ -637,24 +669,36 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define EDGE_NONE 0
#define EDGE_LINE 1
#define EDGE_BACKGROUND 2
#define EDGE_MULTILINE 3
#define SCI_GETEDGECOLUMN 2360
#define SCI_SETEDGECOLUMN 2361
#define SCI_GETEDGEMODE 2362
#define SCI_SETEDGEMODE 2363
#define SCI_GETEDGECOLOUR 2364
#define SCI_SETEDGECOLOUR 2365
#define SCI_MULTIEDGEADDLINE 2694
#define SCI_MULTIEDGECLEARALL 2695
#define SCI_SEARCHANCHOR 2366
#define SCI_SEARCHNEXT 2367
#define SCI_SEARCHPREV 2368
#define SCI_LINESONSCREEN 2370
#define SC_POPUP_NEVER 0
#define SC_POPUP_ALL 1
#define SC_POPUP_TEXT 2
#define SCI_USEPOPUP 2371
#define SCI_SELECTIONISRECTANGLE 2372
#define SCI_SETZOOM 2373
#define SCI_GETZOOM 2374
#define SC_DOCUMENTOPTION_DEFAULT 0
#define SC_DOCUMENTOPTION_STYLES_NONE 0x1
#define SC_DOCUMENTOPTION_TEXT_LARGE 0x100
#define SCI_CREATEDOCUMENT 2375
#define SCI_ADDREFDOCUMENT 2376
#define SCI_RELEASEDOCUMENT 2377
#define SCI_GETDOCUMENTOPTIONS 2379
#define SCI_GETMODEVENTMASK 2378
#define SCI_SETCOMMANDEVENTS 2717
#define SCI_GETCOMMANDEVENTS 2718
#define SCI_SETFOCUS 2380
#define SCI_GETFOCUS 2381
#define SC_STATUS_OK 0
@ -666,6 +710,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETSTATUS 2383
#define SCI_SETMOUSEDOWNCAPTURES 2384
#define SCI_GETMOUSEDOWNCAPTURES 2385
#define SCI_SETMOUSEWHEELCAPTURES 2696
#define SCI_GETMOUSEWHEELCAPTURES 2697
#define SC_CURSORNORMAL -1
#define SC_CURSORARROW 2
#define SC_CURSORWAIT 4
@ -710,6 +756,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_POSITIONBEFORE 2417
#define SCI_POSITIONAFTER 2418
#define SCI_POSITIONRELATIVE 2670
#define SCI_POSITIONRELATIVECODEUNITS 2716
#define SCI_COPYRANGE 2419
#define SCI_COPYTEXT 2420
#define SC_SEL_STREAM 0
@ -718,6 +765,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_SEL_THIN 3
#define SCI_SETSELECTIONMODE 2422
#define SCI_GETSELECTIONMODE 2423
#define SCI_GETMOVEEXTENDSSELECTION 2706
#define SCI_GETLINESELSTARTPOSITION 2424
#define SCI_GETLINESELENDPOSITION 2425
#define SCI_LINEDOWNRECTEXTEND 2426
@ -779,6 +827,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define CARETSTYLE_INVISIBLE 0
#define CARETSTYLE_LINE 1
#define CARETSTYLE_BLOCK 2
#define CARETSTYLE_OVERSTRIKE_BAR 0
#define CARETSTYLE_OVERSTRIKE_BLOCK 16
#define SCI_SETCARETSTYLE 2512
#define SCI_GETCARETSTYLE 2513
#define SCI_SETINDICATORCURRENT 2500
@ -882,6 +932,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCVS_NONE 0
#define SCVS_RECTANGULARSELECTION 1
#define SCVS_USERACCESSIBLE 2
#define SCVS_NOWRAPLINESTART 4
#define SCI_SETVIRTUALSPACEOPTIONS 2596
#define SCI_GETVIRTUALSPACEOPTIONS 2597
#define SCI_SETRECTANGULARSELECTIONMODIFIER 2598
@ -894,6 +945,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETADDITIONALCARETFORE 2605
#define SCI_ROTATESELECTION 2606
#define SCI_SWAPMAINANCHORCARET 2607
#define SCI_MULTIPLESELECTADDNEXT 2688
#define SCI_MULTIPLESELECTADDEACH 2689
#define SCI_CHANGELEXERSTATE 2617
#define SCI_CONTRACTEDFOLDNEXT 2618
#define SCI_VERTICALCENTRECARET 2619
@ -944,7 +997,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETPROPERTY 4008
#define SCI_GETPROPERTYEXPANDED 4009
#define SCI_GETPROPERTYINT 4010
#define SCI_GETSTYLEBITSNEEDED 4011
#define SCI_GETLEXERLANGUAGE 4012
#define SCI_PRIVATELEXERCALL 4013
#define SCI_PROPERTYNAMES 4014
@ -964,6 +1016,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETIDENTIFIERS 4024
#define SCI_DISTANCETOSECONDARYSTYLES 4025
#define SCI_GETSUBSTYLEBASES 4026
#define SCI_GETNAMEDSTYLES 4029
#define SCI_NAMEOFSTYLE 4030
#define SCI_TAGSOFSTYLE 4031
#define SCI_DESCRIPTIONOFSTYLE 4032
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
@ -1021,6 +1077,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCMOD_ALT 4
#define SCMOD_SUPER 8
#define SCMOD_META 16
#define SC_AC_FILLUP 1
#define SC_AC_DOUBLECLICK 2
#define SC_AC_TAB 3
#define SC_AC_NEWLINE 4
#define SC_AC_COMMAND 5
#define SCN_STYLENEEDED 2000
#define SCN_CHARADDED 2001
#define SCN_SAVEPOINTREACHED 2002
@ -1050,21 +1111,37 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCN_HOTSPOTRELEASECLICK 2027
#define SCN_FOCUSIN 2028
#define SCN_FOCUSOUT 2029
#define SCN_AUTOCCOMPLETED 2030
#define SCN_MARGINRIGHTCLICK 2031
#define SCN_AUTOCSELECTIONCHANGE 2032
#ifndef SCI_DISABLE_PROVISIONAL
#define SC_BIDIRECTIONAL_DISABLED 0
#define SC_BIDIRECTIONAL_L2R 1
#define SC_BIDIRECTIONAL_R2L 2
#define SCI_GETBIDIRECTIONAL 2708
#define SCI_SETBIDIRECTIONAL 2709
#define SC_LINECHARACTERINDEX_NONE 0
#define SC_LINECHARACTERINDEX_UTF32 1
#define SC_LINECHARACTERINDEX_UTF16 2
#define SCI_GETLINECHARACTERINDEX 2710
#define SCI_ALLOCATELINECHARACTERINDEX 2711
#define SCI_RELEASELINECHARACTERINDEX 2712
#define SCI_LINEFROMINDEXPOSITION 2713
#define SCI_INDEXPOSITIONFROMLINE 2714
#endif
#define SCN_SCROLLED 2080
#define SCN_FOLDINGSTATECHANGED 2081
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
/* These structures are defined to be exactly the same shape as the Win32
* CHARRANGE, TEXTRANGE, FINDTEXTEX, FORMATRANGE, and NMHDR structs.
* So older code that treats Scintilla as a RichEdit will work. */
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
namespace Scintilla {
#endif
struct Sci_CharacterRange {
long cpMin;
long cpMax;
Sci_PositionCR cpMin;
Sci_PositionCR cpMax;
};
struct Sci_TextRange {
@ -1078,10 +1155,6 @@ struct Sci_TextToFind {
struct Sci_CharacterRange chrgText;
};
#define CharacterRange Sci_CharacterRange
#define TextRange Sci_TextRange
#define TextToFind Sci_TextToFind
typedef void *Sci_SurfaceID;
struct Sci_Rectangle {
@ -1102,7 +1175,12 @@ struct Sci_RangeToFormat {
struct Sci_CharacterRange chrg;
};
#define RangeToFormat Sci_RangeToFormat
#ifndef __cplusplus
/* For the GTK+ platform, g-ir-scanner needs to have these typedefs. This
* is not required in C++ code and actually seems to break ScintillaEditPy */
typedef struct Sci_NotifyHeader Sci_NotifyHeader;
typedef struct SCNotification SCNotification;
#endif
struct Sci_NotifyHeader {
/* Compatible with Windows NMHDR.
@ -1113,18 +1191,18 @@ struct Sci_NotifyHeader {
unsigned int code;
};
#define NotifyHeader Sci_NotifyHeader
struct SCNotification {
struct Sci_NotifyHeader nmhdr;
int position;
Sci_NotifyHeader nmhdr;
Sci_Position position;
/* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
/* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */
/* SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, SCN_HOTSPOTRELEASECLICK, */
/* SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
/* SCN_USERLISTSELECTION, SCN_AUTOCSELECTION */
int ch; /* SCN_CHARADDED, SCN_KEY */
int ch;
/* SCN_CHARADDED, SCN_KEY, SCN_AUTOCCOMPLETED, SCN_AUTOCSELECTION, */
/* SCN_USERLISTSELECTION */
int modifiers;
/* SCN_KEY, SCN_DOUBLECLICK, SCN_HOTSPOTCLICK, SCN_HOTSPOTDOUBLECLICK, */
/* SCN_HOTSPOTRELEASECLICK, SCN_INDICATORCLICK, SCN_INDICATORRELEASE, */
@ -1133,12 +1211,12 @@ struct SCNotification {
const char *text;
/* SCN_MODIFIED, SCN_USERLISTSELECTION, SCN_AUTOCSELECTION, SCN_URIDROPPED */
int length; /* SCN_MODIFIED */
int linesAdded; /* SCN_MODIFIED */
Sci_Position length; /* SCN_MODIFIED */
Sci_Position linesAdded; /* SCN_MODIFIED */
int message; /* SCN_MACRORECORD */
uptr_t wParam; /* SCN_MACRORECORD */
sptr_t lParam; /* SCN_MACRORECORD */
int line; /* SCN_MODIFIED */
Sci_Position line; /* SCN_MODIFIED */
int foldLevelNow; /* SCN_MODIFIED */
int foldLevelPrev; /* SCN_MODIFIED */
int margin; /* SCN_MARGINCLICK */
@ -1146,8 +1224,10 @@ struct SCNotification {
int x; /* SCN_DWELLSTART, SCN_DWELLEND */
int y; /* SCN_DWELLSTART, SCN_DWELLEND */
int token; /* SCN_MODIFIED with SC_MOD_CONTAINER */
int annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
Sci_Position annotationLinesAdded; /* SCN_MODIFIED with SC_MOD_CHANGEANNOTATION */
int updated; /* SCN_UPDATEUI */
int listCompletionMethod;
/* SCN_AUTOCSELECTION, SCN_AUTOCCOMPLETED, SCN_USERLISTSELECTION, */
};
struct SearchResultMarking {
@ -1160,18 +1240,24 @@ struct SearchResultMarkings {
SearchResultMarking *_markings;
};
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
}
#endif
#ifdef INCLUDE_DEPRECATED_FEATURES
#define SC_CP_DBCS 1
#define SCI_SETUSEPALETTE 2039
#define SCI_GETUSEPALETTE 2139
#define SCI_SETKEYSUNICODE 2521
#define SCI_GETKEYSUNICODE 2522
#define SCI_GETTWOPHASEDRAW 2283
#define SCI_SETTWOPHASEDRAW 2284
#define CharacterRange Sci_CharacterRange
#define TextRange Sci_TextRange
#define TextToFind Sci_TextToFind
#define RangeToFormat Sci_RangeToFormat
#define NotifyHeader Sci_NotifyHeader
#define SCI_SETSTYLEBITS 2090
#define SCI_GETSTYLEBITS 2091
#define SCI_GETSTYLEBITSNEEDED 4011
#endif
#endif

File diff suppressed because it is too large Load Diff

View File

@ -1,8 +1,9 @@
/* Scintilla source code edit control */
/** @file ScintillaWidget.h
** Definition of Scintilla widget for GTK+.
** Only needed by GTK+ code but is harmless on other platforms.
**/
/* @file ScintillaWidget.h
* Definition of Scintilla widget for GTK+.
* Only needed by GTK+ code but is harmless on other platforms.
* This comment is not a doc-comment as that causes warnings from g-ir-scanner.
*/
/* Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
* The License.txt file describes the conditions under which this software may be distributed. */
@ -19,8 +20,15 @@ extern "C" {
#define SCINTILLA_CLASS(klass) G_TYPE_CHECK_CLASS_CAST (klass, scintilla_get_type (), ScintillaClass)
#define IS_SCINTILLA(obj) G_TYPE_CHECK_INSTANCE_TYPE (obj, scintilla_get_type ())
#define SCINTILLA_TYPE_OBJECT (scintilla_object_get_type())
#define SCINTILLA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj), SCINTILLA_TYPE_OBJECT, ScintillaObject))
#define SCINTILLA_IS_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), SCINTILLA_TYPE_OBJECT))
#define SCINTILLA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass))
#define SCINTILLA_IS_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass), SCINTILLA_TYPE_OBJECT))
#define SCINTILLA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), SCINTILLA_TYPE_OBJECT, ScintillaObjectClass))
typedef struct _ScintillaObject ScintillaObject;
typedef struct _ScintillaClass ScintillaClass;
typedef struct _ScintillaClass ScintillaObjectClass;
struct _ScintillaObject {
GtkContainer cont;
@ -30,15 +38,28 @@ struct _ScintillaObject {
struct _ScintillaClass {
GtkContainerClass parent_class;
void (* command) (ScintillaObject *ttt);
void (* notify) (ScintillaObject *ttt);
void (* command) (ScintillaObject *sci, int cmd, GtkWidget *window);
void (* notify) (ScintillaObject *sci, int id, SCNotification *scn);
};
GType scintilla_object_get_type (void);
GtkWidget* scintilla_object_new (void);
gintptr scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam);
GType scnotification_get_type (void);
#define SCINTILLA_TYPE_NOTIFICATION (scnotification_get_type())
#ifndef G_IR_SCANNING
/* The legacy names confuse the g-ir-scanner program */
typedef struct _ScintillaClass ScintillaClass;
GType scintilla_get_type (void);
GtkWidget* scintilla_new (void);
void scintilla_set_id (ScintillaObject *sci, uptr_t id);
sptr_t scintilla_send_message (ScintillaObject *sci,unsigned int iMessage, uptr_t wParam, sptr_t lParam);
void scintilla_release_resources(void);
#endif
#define SCINTILLA_NOTIFY "sci-notify"

View File

@ -26,9 +26,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
// Return values for GetOperatorType
@ -115,7 +113,7 @@ static inline bool IsDoxygenChar (const int ch)
* Main function, which colourises a 68k source
*/
static void ColouriseA68kDoc (unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler)
static void ColouriseA68kDoc (Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler)
{
// Used to buffer a string, to be able to compare it using built-in functions
char Buffer[100];

View File

@ -24,9 +24,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || ch == '_'));
@ -43,7 +41,7 @@ static inline bool IsAnOperator(char ch) {
return false;
}
static void ColouriseAPDLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
static void ColouriseAPDLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
int stringStart = ' ';
@ -184,16 +182,16 @@ static int CheckAPDLFoldPoint(char const *token, int &level) {
return 0;
}
static void FoldAPDLDoc(unsigned int startPos, int length, int,
static void FoldAPDLDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler) {
int line = styler.GetLine(startPos);
Sci_Position line = styler.GetLine(startPos);
int level = styler.LevelAt(line);
int go = 0, done = 0;
int endPos = startPos + length;
Sci_Position endPos = startPos + length;
char word[256];
int wordlen = 0;
int i;
Sci_Position i;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// Scan for tokens at the start of the line (they may include
// whitespace, for tokens like "End Function"

View File

@ -19,11 +19,9 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static void ColouriseAsyDoc(unsigned int startPos, int length, int initStyle,
static void ColouriseAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
@ -152,7 +150,7 @@ static inline bool isASYidentifier(int ch) {
((ch >= 'a') && (ch <= 'z')) || ((ch >= 'A') && (ch <= 'Z')) ;
}
static int ParseASYWord(unsigned int pos, Accessor &styler, char *word)
static int ParseASYWord(Sci_PositionU pos, Accessor &styler, char *word)
{
int length=0;
char ch=styler.SafeGetCharAt(pos);
@ -167,11 +165,11 @@ static int ParseASYWord(unsigned int pos, Accessor &styler, char *word)
return length;
}
static bool IsASYDrawingLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
static bool IsASYDrawingLine(Sci_Position line, Accessor &styler) {
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
int startpos = pos;
Sci_Position startpos = pos;
char buffer[100]="";
while (startpos<eol_pos){
@ -186,14 +184,14 @@ static bool IsASYDrawingLine(int line, Accessor &styler) {
return false;
}
static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,
static void FoldAsyDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
unsigned int endPos = startPos + length;
Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@ -202,7 +200,7 @@ static void FoldAsyDoc(unsigned int startPos, int length, int initStyle,
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
for (unsigned int i = startPos; i < endPos; i++) {
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;

View File

@ -1,6 +1,6 @@
// Scintilla source code edit control
// @file LexAU3.cxx
// Lexer for AutoIt3 http://www.hiddensoft.com/autoit3
// Lexer for AutoIt3 https://www.autoitscript.com/site/
// by Jos van der Zande, jvdzande@yahoo.com
//
// Changes:
@ -68,9 +68,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsTypeCharacter(const int ch)
{
@ -170,10 +168,10 @@ static int GetSendKey(const char *szLine, char *szKey)
//
// Routine to check the last "none comment" character on a line to see if its a continuation
//
static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
static bool IsContinuationLine(Sci_PositionU szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
int nePos = styler.LineStart(szLine+1) - 2;
Sci_Position nsPos = styler.LineStart(szLine);
Sci_Position nePos = styler.LineStart(szLine+1) - 2;
//int stylech = styler.StyleAt(nsPos);
while (nsPos < nePos)
{
@ -195,8 +193,8 @@ static bool IsContinuationLine(unsigned int szLine, Accessor &styler)
//
// syntax highlighting logic
static void ColouriseAU3Doc(unsigned int startPos,
int length, int initStyle,
static void ColouriseAU3Doc(Sci_PositionU startPos,
Sci_Position length, int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@ -209,8 +207,8 @@ static void ColouriseAU3Doc(unsigned int startPos,
WordList &keywords7 = *keywordlists[6];
WordList &keywords8 = *keywordlists[7];
// find the first previous line without continuation character at the end
int lineCurrent = styler.GetLine(startPos);
int s_startPos = startPos;
Sci_Position lineCurrent = styler.GetLine(startPos);
Sci_Position s_startPos = startPos;
// When not inside a Block comment: find First line without _
if (!(initStyle==SCE_AU3_COMMENTBLOCK)) {
while ((lineCurrent > 0 && IsContinuationLine(lineCurrent,styler)) ||
@ -447,7 +445,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
{
si=0;
// at line end and not found a continuation char then reset to default
int lineCurrent = styler.GetLine(sc.currentPos);
Sci_Position lineCurrent = styler.GetLine(sc.currentPos);
if (!IsContinuationLine(lineCurrent,styler))
{
sc.SetState(SCE_AU3_DEFAULT);
@ -492,7 +490,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
else
{
// check if the start is a valid SendKey start
int nPos = 0;
Sci_Position nPos = 0;
int nState = 1;
char cTemp;
while (!(nState == 2) && ((cTemp = s[nPos]) != '\0'))
@ -659,10 +657,10 @@ static bool IsStreamCommentStyle(int style) {
//
// Routine to find first none space on the current line and return its Style
// needed for comment lines not starting on pos 1
static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)
static int GetStyleFirstWord(Sci_PositionU szLine, Accessor &styler)
{
int nsPos = styler.LineStart(szLine);
int nePos = styler.LineStart(szLine+1) - 1;
Sci_Position nsPos = styler.LineStart(szLine);
Sci_Position nePos = styler.LineStart(szLine+1) - 1;
while (isspacechar(styler.SafeGetCharAt(nsPos)) && nsPos < nePos)
{
nsPos++; // skip to next char
@ -674,16 +672,16 @@ static int GetStyleFirstWord(unsigned int szLine, Accessor &styler)
//
static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
static void FoldAU3Doc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
{
int endPos = startPos + length;
Sci_Position endPos = startPos + length;
// get settings from the config files for folding comments and preprocessor lines
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldInComment = styler.GetPropertyInt("fold.comment") == 2;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldpreprocessor = styler.GetPropertyInt("fold.preprocessor") != 0;
// Backtrack to previous line in case need to fix its fold status
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
if (startPos > 0) {
if (lineCurrent > 0) {
lineCurrent--;
@ -720,7 +718,7 @@ static void FoldAU3Doc(unsigned int startPos, int length, int, WordList *[], Acc
char chNext = styler.SafeGetCharAt(startPos);
char chPrev = ' ';
//
for (int i = startPos; i < endPos; i++) {
for (Sci_Position i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
if (IsAWordChar(ch)) {

View File

@ -25,9 +25,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
@ -59,8 +57,8 @@ inline bool isAveOperator(char ch) {
}
static void ColouriseAveDoc(
unsigned int startPos,
int length,
Sci_PositionU startPos,
Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@ -82,7 +80,7 @@ static void ColouriseAveDoc(
for (; sc.More(); sc.Forward()) {
if (sc.atLineEnd) {
// Update the line state, so it can be seen by next line
int currentLine = styler.GetLine(sc.currentPos);
Sci_Position currentLine = styler.GetLine(sc.currentPos);
styler.SetLineState(currentLine, 0);
}
if (sc.atLineStart && (sc.state == SCE_AVE_STRING)) {
@ -157,11 +155,11 @@ static void ColouriseAveDoc(
sc.Complete();
}
static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, WordList *[],
static void FoldAveDoc(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
unsigned int lengthDoc = startPos + length;
Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = static_cast<char>(tolower(styler[startPos]));
@ -169,7 +167,7 @@ static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, W
int styleNext = styler.StyleAt(startPos);
char s[10] = "";
for (unsigned int i = startPos; i < lengthDoc; i++) {
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = static_cast<char>(tolower(chNext));
chNext = static_cast<char>(tolower(styler.SafeGetCharAt(i + 1)));
int style = styleNext;

View File

@ -24,9 +24,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
@ -44,8 +42,8 @@ static inline bool IsANumberChar(int ch) {
}
static void ColouriseAvsDoc(
unsigned int startPos,
int length,
Sci_PositionU startPos,
Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@ -57,7 +55,7 @@ static void ColouriseAvsDoc(
WordList &clipProperties = *keywordlists[4];
WordList &userDefined = *keywordlists[5];
int currentLine = styler.GetLine(startPos);
Sci_Position currentLine = styler.GetLine(startPos);
// Initialize the block comment nesting level, if we are inside such a comment.
int blockCommentLevel = 0;
if (initStyle == SCE_AVS_COMMENTBLOCK || initStyle == SCE_AVS_COMMENTBLOCKN) {
@ -208,24 +206,24 @@ static void ColouriseAvsDoc(
}
static void FoldAvsDoc(
unsigned int startPos,
int length,
Sci_PositionU startPos,
Sci_Position length,
int initStyle,
WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
for (unsigned int i = startPos; i < endPos; i++) {
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;

View File

@ -26,9 +26,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAKeywordChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == ' ')));
@ -38,7 +36,7 @@ static inline bool IsASetChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-')));
}
static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */,
static void ColouriseABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList*[] /* *keywordlists[] */,
Accessor &styler) {
enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \
DAT_LINE_VAL, DAT_LINE_COMMA,\
@ -301,10 +299,10 @@ static int LowerCase(int c)
return c;
}
static int LineEnd(int line, Accessor &styler)
static Sci_Position LineEnd(Sci_Position line, Accessor &styler)
{
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
int eol_pos ;
const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
Sci_Position eol_pos ;
// if the line is the last line, the eol_pos is styler.Length()
// eol will contain a new line, or a virtual new line
if ( docLines == line )
@ -314,7 +312,7 @@ static int LineEnd(int line, Accessor &styler)
return eol_pos ;
}
static int LineStart(int line, Accessor &styler)
static Sci_Position LineStart(Sci_Position line, Accessor &styler)
{
return styler.LineStart(line) ;
}
@ -330,14 +328,14 @@ static int LineStart(int line, Accessor &styler)
// 6 : block close keyword line
// 7 : keyword line in error
// 8 : comment line
static int LineType(int line, Accessor &styler) {
int pos = LineStart(line, styler) ;
int eol_pos = LineEnd(line, styler) ;
static int LineType(Sci_Position line, Accessor &styler) {
Sci_Position pos = LineStart(line, styler) ;
Sci_Position eol_pos = LineEnd(line, styler) ;
int c ;
char ch = ' ';
int i = pos ;
Sci_Position i = pos ;
while ( i < eol_pos ) {
c = styler.SafeGetCharAt(i);
ch = static_cast<char>(LowerCase(c));
@ -418,7 +416,7 @@ static int LineType(int line, Accessor &styler) {
return 4 ;
}
static void SafeSetLevel(int line, int level, Accessor &styler)
static void SafeSetLevel(Sci_Position line, int level, Accessor &styler)
{
if ( line < 0 )
return ;
@ -432,20 +430,20 @@ static void SafeSetLevel(int line, int level, Accessor &styler)
styler.SetLevel(line, level) ;
}
static void FoldABAQUSDoc(unsigned int startPos, int length, int,
static void FoldABAQUSDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler) {
int startLine = styler.GetLine(startPos) ;
int endLine = styler.GetLine(startPos+length-1) ;
Sci_Position startLine = styler.GetLine(startPos) ;
Sci_Position endLine = styler.GetLine(startPos+length-1) ;
// bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
// We want to deal with all the cases
// To know the correct indentlevel, we need to look back to the
// previous command line indentation level
// order of formatting keyline datalines commentlines
int beginData = -1 ;
int beginComment = -1 ;
int prvKeyLine = startLine ;
int prvKeyLineTp = 0 ;
Sci_Position beginData = -1 ;
Sci_Position beginComment = -1 ;
Sci_Position prvKeyLine = startLine ;
Sci_Position prvKeyLineTp = 0 ;
// Scan until we find the previous keyword line
// this will give us the level reference that we need
@ -467,7 +465,7 @@ WordList *[], Accessor &styler) {
prvKeyLine = -1 ;
// Now start scanning over the lines.
for ( int line = startLine; line <= endLine; line++ ) {
for ( Sci_Position line = startLine; line <= endLine; line++ ) {
int lineType = LineType(line, styler) ;
// Check for comment line
@ -516,7 +514,7 @@ WordList *[], Accessor &styler) {
datLevel = level ;
}
for ( int ll = beginData; ll < beginComment; ll++ )
for ( Sci_Position ll = beginData; ll < beginComment; ll++ )
SafeSetLevel(ll, datLevel, styler) ;
// The keyword we just found is going to be written at another level
@ -532,7 +530,7 @@ WordList *[], Accessor &styler) {
}
}
for ( int lll = beginComment; lll < line; lll++ )
for ( Sci_Position lll = beginComment; lll < line; lll++ )
SafeSetLevel(lll, level, styler) ;
// wrap and reset
@ -549,10 +547,10 @@ WordList *[], Accessor &styler) {
} else {
// We need to find out whether this comment block is followed by
// a data line or a keyword line
const int docLines = styler.GetLine(styler.Length() - 1);
const Sci_Position docLines = styler.GetLine(styler.Length() - 1);
for ( int line = endLine + 1; line <= docLines; line++ ) {
int lineType = LineType(line, styler) ;
for ( Sci_Position line = endLine + 1; line <= docLines; line++ ) {
Sci_Position lineType = LineType(line, styler) ;
if ( lineType != 8 ) {
if ( !(lineType & 4) ) {
@ -578,7 +576,7 @@ WordList *[], Accessor &styler) {
datLevel = level ;
}
for ( int ll = beginData; ll < beginComment; ll++ )
for ( Sci_Position ll = beginData; ll < beginComment; ll++ )
SafeSetLevel(ll, datLevel, styler) ;
if ( prvKeyLineTp == 5 ) {
@ -588,7 +586,7 @@ WordList *[], Accessor &styler) {
if ( prvKeyLineTp == 6 ) {
level -= 1 ;
}
for ( int m = beginComment; m <= endLine; m++ )
for ( Sci_Position m = beginComment; m <= endLine; m++ )
SafeSetLevel(m, level, styler) ;
}

View File

@ -25,17 +25,15 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/*
* Interface
*/
static void ColouriseDocument(
unsigned int startPos,
int length,
Sci_PositionU startPos,
Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
@ -222,8 +220,8 @@ static void ColouriseWord(StyleContext& sc, WordList& keywords, bool& apostrophe
//
static void ColouriseDocument(
unsigned int startPos,
int length,
Sci_PositionU startPos,
Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler) {
@ -231,7 +229,7 @@ static void ColouriseDocument(
StyleContext sc(startPos, length, initStyle, styler);
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
bool apostropheStartsAttribute = (styler.GetLineState(lineCurrent) & 1) != 0;
while (sc.More()) {

View File

@ -30,10 +30,9 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "DefaultLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
@ -139,7 +138,7 @@ struct OptionSetAsm : public OptionSet<OptionsAsm> {
}
};
class LexerAsm : public ILexer {
class LexerAsm : public DefaultLexer {
WordList cpuInstruction;
WordList mathInstruction;
WordList registers;
@ -157,50 +156,50 @@ public:
}
virtual ~LexerAsm() {
}
void SCI_METHOD Release() {
void SCI_METHOD Release() override {
delete this;
}
int SCI_METHOD Version() const {
return lvOriginal;
int SCI_METHOD Version() const override {
return lvRelease4;
}
const char * SCI_METHOD PropertyNames() {
const char * SCI_METHOD PropertyNames() override {
return osAsm.PropertyNames();
}
int SCI_METHOD PropertyType(const char *name) {
int SCI_METHOD PropertyType(const char *name) override {
return osAsm.PropertyType(name);
}
const char * SCI_METHOD DescribeProperty(const char *name) {
const char * SCI_METHOD DescribeProperty(const char *name) override {
return osAsm.DescribeProperty(name);
}
int SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
const char * SCI_METHOD DescribeWordListSets() override {
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);
Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void * SCI_METHOD PrivateCall(int, void *) {
void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
static ILexer *LexerFactoryAsm() {
static ILexer4 *LexerFactoryAsm() {
return new LexerAsm(';');
}
static ILexer *LexerFactoryAs() {
static ILexer4 *LexerFactoryAs() {
return new LexerAsm('#');
}
};
int SCI_METHOD LexerAsm::PropertySet(const char *key, const char *val) {
Sci_Position 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) {
Sci_Position SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@ -228,7 +227,7 @@ int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
wordListN = &directives4foldend;
break;
}
int firstModification = -1;
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@ -240,7 +239,7 @@ int SCI_METHOD LexerAsm::WordListSet(int n, const char *wl) {
return firstModification;
}
void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
void SCI_METHOD LexerAsm::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
// Do not leak onto next line
@ -371,16 +370,16 @@ void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle,
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "else".
void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
void SCI_METHOD LexerAsm::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
unsigned int endPos = startPos + length;
Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@ -391,7 +390,7 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle,
char word[100];
int wordlen = 0;
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
for (unsigned int i = startPos; i < endPos; i++) {
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
@ -453,7 +452,7 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle,
}
lineCurrent++;
levelCurrent = levelNext;
if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
if (atEOL && (i == static_cast<Sci_PositionU>(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);
}

View File

@ -23,9 +23,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
// Some char test functions
static bool isAsn1Number(int ch)
@ -47,7 +45,7 @@ static bool isAsn1Char(int ch)
// Function determining the color of a given code portion
// Based on a "state"
//
static void ColouriseAsn1Doc(unsigned int startPos, int length, int initStyle, WordList *keywordLists[], Accessor &styler)
static void ColouriseAsn1Doc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordLists[], Accessor &styler)
{
// The keywords
WordList &Keywords = *keywordLists[0];
@ -168,7 +166,7 @@ asn1_default:
sc.Complete();
}
static void FoldAsn1Doc(unsigned int, int, int, WordList *[], Accessor &styler)
static void FoldAsn1Doc(Sci_PositionU, Sci_Position, int, WordList *[], Accessor &styler)
{
// No folding enabled, no reason to continue...
if( styler.GetPropertyInt("fold") == 0 )

File diff suppressed because it is too large Load Diff

View File

@ -12,20 +12,25 @@
#include <stdarg.h>
#include <assert.h>
#include <string>
#include <vector>
#include <map>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StringCopy.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "SubStyles.h"
#include "DefaultLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#define HERE_DELIM_MAX 256
@ -60,7 +65,9 @@ using namespace Scintilla;
#define BASH_DELIM_STACK_MAX 7
static inline int translateBashDigit(int ch) {
namespace {
inline int translateBashDigit(int ch) {
if (ch >= '0' && ch <= '9') {
return ch - '0';
} else if (ch >= 'a' && ch <= 'z') {
@ -75,7 +82,7 @@ static inline int translateBashDigit(int ch) {
return BASH_BASE_ERROR;
}
static inline int getBashNumberBase(char *s) {
inline int getBashNumberBase(char *s) {
int i = 0;
int base = 0;
while (*s) {
@ -88,7 +95,7 @@ static inline int getBashNumberBase(char *s) {
return base;
}
static int opposite(int ch) {
int opposite(int ch) {
if (ch == '(') return ')';
if (ch == '[') return ']';
if (ch == '{') return '}';
@ -96,10 +103,197 @@ static int opposite(int ch) {
return ch;
}
static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
int GlobScan(StyleContext &sc) {
// forward scan for zsh globs, disambiguate versus bash arrays
// complex expressions may still fail, e.g. unbalanced () '' "" etc
int c, sLen = 0;
int pCount = 0;
int hash = 0;
while ((c = sc.GetRelativeCharacter(++sLen)) != 0) {
if (IsASpace(c)) {
return 0;
} else if (c == '\'' || c == '\"') {
if (hash != 2) return 0;
} else if (c == '#' && hash == 0) {
hash = (sLen == 1) ? 2:1;
} else if (c == '(') {
pCount++;
} else if (c == ')') {
if (pCount == 0) {
if (hash) return sLen;
return 0;
}
pCount--;
}
}
return 0;
}
WordList &keywords = *keywordlists[0];
bool IsCommentLine(Sci_Position line, LexAccessor &styler) {
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
else if (ch != ' ' && ch != '\t')
return false;
}
return false;
}
struct OptionsBash {
bool fold;
bool foldComment;
bool foldCompact;
OptionsBash() {
fold = false;
foldComment = false;
foldCompact = true;
}
};
const char * const bashWordListDesc[] = {
"Keywords",
0
};
struct OptionSetBash : public OptionSet<OptionsBash> {
OptionSetBash() {
DefineProperty("fold", &OptionsBash::fold);
DefineProperty("fold.comment", &OptionsBash::foldComment);
DefineProperty("fold.compact", &OptionsBash::foldCompact);
DefineWordListSets(bashWordListDesc);
}
};
const char styleSubable[] = { SCE_SH_IDENTIFIER, SCE_SH_SCALAR, 0 };
LexicalClass lexicalClasses[] = {
// Lexer Bash SCLEX_BASH SCE_SH_:
0, "SCE_SH_DEFAULT", "default", "White space",
1, "SCE_SH_ERROR", "error", "Error",
2, "SCE_SH_COMMENTLINE", "comment line", "Line comment: #",
3, "SCE_SH_NUMBER", "literal numeric", "Number",
4, "SCE_SH_WORD", "keyword", "Keyword",
5, "SCE_SH_STRING", "literal string", "String",
6, "SCE_SH_CHARACTER", "literal string", "Single quoted string",
7, "SCE_SH_OPERATOR", "operator", "Operators",
8, "SCE_SH_IDENTIFIER", "identifier", "Identifiers",
9, "SCE_SH_SCALAR", "identifier", "Scalar variable",
10, "SCE_SH_PARAM", "identifier", "Parameter",
11, "SCE_SH_BACKTICKS", "literal string", "Backtick quoted command",
12, "SCE_SH_HERE_DELIM", "operator", "Heredoc delimiter",
13, "SCE_SH_HERE_Q", "literal string", "Heredoc quoted string",
};
}
class LexerBash : public DefaultLexer {
WordList keywords;
OptionsBash options;
OptionSetBash osBash;
enum { ssIdentifier, ssScalar };
SubStyles subStyles;
public:
LexerBash() :
DefaultLexer(lexicalClasses, ELEMENTS(lexicalClasses)),
subStyles(styleSubable, 0x80, 0x40, 0) {
}
virtual ~LexerBash() {
}
void SCI_METHOD Release() override {
delete this;
}
int SCI_METHOD Version() const override {
return lvRelease4;
}
const char * SCI_METHOD PropertyNames() override {
return osBash.PropertyNames();
}
int SCI_METHOD PropertyType(const char* name) override {
return osBash.PropertyType(name);
}
const char * SCI_METHOD DescribeProperty(const char *name) override {
return osBash.DescribeProperty(name);
}
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
const char * SCI_METHOD DescribeWordListSets() override {
return osBash.DescribeWordListSets();
}
Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override {
return subStyles.Allocate(styleBase, numberStyles);
}
int SCI_METHOD SubStylesStart(int styleBase) override {
return subStyles.Start(styleBase);
}
int SCI_METHOD SubStylesLength(int styleBase) override {
return subStyles.Length(styleBase);
}
int SCI_METHOD StyleFromSubStyle(int subStyle) override {
const int styleBase = subStyles.BaseStyle(subStyle);
return styleBase;
}
int SCI_METHOD PrimaryStyleFromStyle(int style) override {
return style;
}
void SCI_METHOD FreeSubStyles() override {
subStyles.Free();
}
void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override {
subStyles.SetIdentifiers(style, identifiers);
}
int SCI_METHOD DistanceToSecondaryStyles() override {
return 0;
}
const char *SCI_METHOD GetSubStyleBases() override {
return styleSubable;
}
static ILexer4 *LexerFactoryBash() {
return new LexerBash();
}
};
Sci_Position SCI_METHOD LexerBash::PropertySet(const char *key, const char *val) {
if (osBash.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
Sci_Position SCI_METHOD LexerBash::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
wordListN = &keywords;
break;
}
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
firstModification = 0;
}
}
return firstModification;
}
void SCI_METHOD LexerBash::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
WordList cmdDelimiter, bashStruct, bashStruct_in;
cmdDelimiter.Set("| || |& & && ; ;; ( ) { }");
bashStruct.Set("if elif fi while until else then do done esac eval");
@ -113,9 +307,9 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/<?!.~@");
CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMACahGLNn");
CharacterSet setParam(CharacterSet::setAlphaNum, "$_");
CharacterSet setHereDoc(CharacterSet::setAlpha, "_\\-+!");
CharacterSet setHereDoc2(CharacterSet::setAlphaNum, "_-+!");
CharacterSet setLeftShift(CharacterSet::setDigits, "=$");
CharacterSet setHereDoc(CharacterSet::setAlpha, "_\\-+!%*,./:?@[]^`{}~");
CharacterSet setHereDoc2(CharacterSet::setAlphaNum, "_-+!%*,./:=?@[]^`{}~");
CharacterSet setLeftShift(CharacterSet::setDigits, "$");
class HereDocCls { // Class to manage HERE document elements
public:
@ -126,14 +320,13 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
bool Quoted; // true if Quote in ('\'','"','`')
bool Indent; // indented delimiter (for <<-)
int DelimiterLength; // strlen(Delimiter)
char *Delimiter; // the Delimiter, 256: sizeof PL_tokenbuf
char Delimiter[HERE_DELIM_MAX]; // the Delimiter
HereDocCls() {
State = 0;
Quote = 0;
Quoted = false;
Indent = 0;
DelimiterLength = 0;
Delimiter = new char[HERE_DELIM_MAX];
Delimiter[0] = '\0';
}
void Append(int ch) {
@ -141,7 +334,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
Delimiter[DelimiterLength] = '\0';
}
~HereDocCls() {
delete []Delimiter;
}
};
HereDocCls HereDoc;
@ -173,18 +365,15 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
int Up, Down;
int Style;
int Depth; // levels pushed
int *CountStack;
int *UpStack;
int *StyleStack;
int CountStack[BASH_DELIM_STACK_MAX];
int UpStack [BASH_DELIM_STACK_MAX];
int StyleStack[BASH_DELIM_STACK_MAX];
QuoteStackCls() {
Count = 0;
Up = '\0';
Down = '\0';
Style = 0;
Depth = 0;
CountStack = new int[BASH_DELIM_STACK_MAX];
UpStack = new int[BASH_DELIM_STACK_MAX];
StyleStack = new int[BASH_DELIM_STACK_MAX];
}
void Start(int u, int s) {
Count = 1;
@ -214,23 +403,24 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
Down = opposite(Up);
}
~QuoteStackCls() {
delete []CountStack;
delete []UpStack;
delete []StyleStack;
}
};
QuoteStackCls QuoteStack;
const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_SH_IDENTIFIER);
const WordClassifier &classifierScalars = subStyles.Classifier(SCE_SH_SCALAR);
int numBase = 0;
int digit;
unsigned int endPos = startPos + length;
Sci_PositionU endPos = startPos + length;
int cmdState = BASH_CMD_START;
int testExprType = 0;
LexAccessor styler(pAccess);
// Always backtracks to the start of a line that is not a continuation
// of the previous line (i.e. start of a bash command segment)
int ln = styler.GetLine(startPos);
if (ln > 0 && startPos == static_cast<unsigned int>(styler.LineStart(ln)))
Sci_Position ln = styler.GetLine(startPos);
if (ln > 0 && startPos == static_cast<Sci_PositionU>(styler.LineStart(ln)))
ln--;
for (;;) {
startPos = styler.LineStart(ln);
@ -290,6 +480,11 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
char s[500];
char s2[10];
sc.GetCurrent(s, sizeof(s));
int identifierStyle = SCE_SH_IDENTIFIER;
int subStyle = classifierIdentifiers.ValueFor(s);
if (subStyle >= 0) {
identifierStyle = subStyle;
}
// allow keywords ending in a whitespace or command delimiter
s2[0] = static_cast<char>(sc.ch);
s2[1] = '\0';
@ -301,7 +496,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
else if (strcmp(s, "do") == 0 && keywordEnds)
cmdStateNew = BASH_CMD_START;
else
sc.ChangeState(SCE_SH_IDENTIFIER);
sc.ChangeState(identifierStyle);
sc.SetState(SCE_SH_DEFAULT);
break;
}
@ -311,41 +506,50 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
cmdStateNew = BASH_CMD_TEST;
testExprType = 0;
} else
sc.ChangeState(SCE_SH_IDENTIFIER);
sc.ChangeState(identifierStyle);
}
// detect bash construct keywords
else if (bashStruct.InList(s)) {
if (cmdState == BASH_CMD_START && keywordEnds)
cmdStateNew = BASH_CMD_START;
else
sc.ChangeState(SCE_SH_IDENTIFIER);
sc.ChangeState(identifierStyle);
}
// 'for'|'case'|'select' needs 'in'|'do' to be highlighted later
else if (bashStruct_in.InList(s)) {
if (cmdState == BASH_CMD_START && keywordEnds)
cmdStateNew = BASH_CMD_WORD;
else
sc.ChangeState(SCE_SH_IDENTIFIER);
sc.ChangeState(identifierStyle);
}
// disambiguate option items and file test operators
else if (s[0] == '-') {
if (cmdState != BASH_CMD_TEST)
sc.ChangeState(SCE_SH_IDENTIFIER);
sc.ChangeState(identifierStyle);
}
// disambiguate keywords and identifiers
else if (cmdState != BASH_CMD_START
|| !(keywords.InList(s) && keywordEnds)) {
sc.ChangeState(SCE_SH_IDENTIFIER);
sc.ChangeState(identifierStyle);
}
sc.SetState(SCE_SH_DEFAULT);
}
break;
case SCE_SH_IDENTIFIER:
if (sc.chPrev == '\\' || !setWord.Contains(sc.ch) ||
(cmdState == BASH_CMD_ARITH && !setWordStart.Contains(sc.ch))) {
char s[500];
sc.GetCurrent(s, sizeof(s));
int subStyle = classifierIdentifiers.ValueFor(s);
if (subStyle >= 0) {
sc.ChangeState(subStyle);
}
if (sc.chPrev == '\\') { // for escaped chars
sc.ForwardSetState(SCE_SH_DEFAULT);
} else if (!setWord.Contains(sc.ch)) {
} else {
sc.SetState(SCE_SH_DEFAULT);
}
}
break;
case SCE_SH_NUMBER:
digit = translateBashDigit(sc.ch);
@ -419,17 +623,18 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
sc.Forward();
HereDoc.Quoted = true;
HereDoc.State = 1;
} else if (setHereDoc.Contains(sc.chNext)) {
} else if (setHereDoc.Contains(sc.chNext) ||
(sc.chNext == '=' && cmdState != BASH_CMD_ARITH)) {
// an unquoted here-doc delimiter, no special handling
// TODO check what exactly bash considers part of the delim
HereDoc.State = 1;
} else if (sc.chNext == '<') { // HERE string <<<
sc.Forward();
sc.ForwardSetState(SCE_SH_DEFAULT);
} else if (IsASpace(sc.chNext)) {
// eat whitespace
} else if (setLeftShift.Contains(sc.chNext)) {
// left shift << or <<= operator cases
} else if (setLeftShift.Contains(sc.chNext) ||
(sc.chNext == '=' && cmdState == BASH_CMD_ARITH)) {
// left shift <<$var or <<= cases
sc.ChangeState(SCE_SH_OPERATOR);
sc.ForwardSetState(SCE_SH_DEFAULT);
} else {
@ -497,6 +702,12 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
break;
case SCE_SH_SCALAR: // variable names
if (!setParam.Contains(sc.ch)) {
char s[500];
sc.GetCurrent(s, sizeof(s));
int subStyle = classifierScalars.ValueFor(&s[1]); // skip the $
if (subStyle >= 0) {
sc.ChangeState(subStyle);
}
if (sc.LengthCurrent() == 1) {
// Special variable: $(, $_ etc.
sc.ForwardSetState(SCE_SH_DEFAULT);
@ -584,12 +795,14 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
HereDoc.State = 2;
if (HereDoc.Quoted) {
if (sc.state == SCE_SH_HERE_DELIM) {
// Missing quote at end of string! We are stricter than bash.
// Colour here-doc anyway while marking this bit as an error.
// Missing quote at end of string! Syntax error in bash 4.3
// Mark this bit as an error, do not colour any here-doc
sc.ChangeState(SCE_SH_ERROR);
}
sc.SetState(SCE_SH_DEFAULT);
} else {
// HereDoc.Quote always == '\''
sc.SetState(SCE_SH_HERE_Q);
}
} else if (HereDoc.DelimiterLength == 0) {
// no delimiter, illegal (but '' and "" are legal)
sc.ChangeState(SCE_SH_ERROR);
@ -634,6 +847,23 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
} else {
sc.SetState(SCE_SH_WORD);
}
// handle some zsh features within arithmetic expressions only
if (cmdState == BASH_CMD_ARITH) {
if (sc.chPrev == '[') { // [#8] [##8] output digit setting
sc.SetState(SCE_SH_WORD);
if (sc.chNext == '#') {
sc.Forward();
}
} else if (sc.Match("##^") && IsUpperCase(sc.GetRelative(3))) { // ##^A
sc.SetState(SCE_SH_IDENTIFIER);
sc.Forward(3);
} else if (sc.chNext == '#' && !IsASpace(sc.GetRelative(2))) { // ##a
sc.SetState(SCE_SH_IDENTIFIER);
sc.Forward(2);
} else if (setWordStart.Contains(sc.chNext)) { // #name
sc.SetState(SCE_SH_IDENTIFIER);
}
}
} else if (sc.ch == '\"') {
sc.SetState(SCE_SH_STRING);
QuoteStack.Start(sc.ch, BASH_DELIM_STRING);
@ -687,6 +917,15 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
char s[10];
bool isCmdDelim = false;
sc.SetState(SCE_SH_OPERATOR);
// globs have no whitespace, do not appear in arithmetic expressions
if (cmdState != BASH_CMD_ARITH && sc.ch == '(' && sc.chNext != '(') {
int i = GlobScan(sc);
if (i > 1) {
sc.SetState(SCE_SH_IDENTIFIER);
sc.Forward(i);
continue;
}
}
// handle opening delimiters for test/arithmetic expressions - ((,[[,[
if (cmdState == BASH_CMD_START
|| cmdState == BASH_CMD_BODY) {
@ -752,39 +991,30 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
sc.Complete();
}
static bool IsCommentLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
else if (ch != ' ' && ch != '\t')
return false;
}
return false;
}
void SCI_METHOD LexerBash::Fold(Sci_PositionU startPos, Sci_Position length, int, IDocument *pAccess) {
if(!options.fold)
return;
static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
LexAccessor styler(pAccess);
Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
int skipHereCh = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
for (unsigned int i = startPos; i < endPos; i++) {
char word[8] = { '\0' }; // we're not interested in long words anyway
unsigned int wordlen = 0;
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
// Comment folding
if (foldComment && atEOL && IsCommentLine(lineCurrent, styler))
if (options.foldComment && atEOL && IsCommentLine(lineCurrent, styler))
{
if (!IsCommentLine(lineCurrent - 1, styler)
&& IsCommentLine(lineCurrent + 1, styler))
@ -793,6 +1023,19 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
&& !IsCommentLine(lineCurrent + 1, styler))
levelCurrent--;
}
if (style == SCE_SH_WORD) {
if ((wordlen + 1) < sizeof(word))
word[wordlen++] = ch;
if (styleNext != style) {
word[wordlen] = '\0';
wordlen = 0;
if (strcmp(word, "if") == 0 || strcmp(word, "case") == 0 || strcmp(word, "do") == 0) {
levelCurrent++;
} else if (strcmp(word, "fi") == 0 || strcmp(word, "esac") == 0 || strcmp(word, "done") == 0) {
levelCurrent--;
}
}
}
if (style == SCE_SH_OPERATOR) {
if (ch == '{') {
levelCurrent++;
@ -818,7 +1061,7 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
if (visibleChars == 0 && options.foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
@ -837,9 +1080,4 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
static const char * const bashWordListDesc[] = {
"Keywords",
0
};
LexerModule lmBash(SCLEX_BASH, ColouriseBashDoc, "bash", FoldBashDoc, bashWordListDesc);
LexerModule lmBash(SCLEX_BASH, LexerBash::LexerFactoryBash, "bash", bashWordListDesc);

View File

@ -37,10 +37,9 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "DefaultLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/* Bits:
* 1 - whitespace
@ -226,7 +225,7 @@ struct OptionSetBasic : public OptionSet<OptionsBasic> {
}
};
class LexerBasic : public ILexer {
class LexerBasic : public DefaultLexer {
char comment_char;
int (*CheckFoldPoint)(char const *, int &);
WordList keywordlists[4];
@ -240,51 +239,51 @@ public:
}
virtual ~LexerBasic() {
}
void SCI_METHOD Release() {
void SCI_METHOD Release() override {
delete this;
}
int SCI_METHOD Version() const {
return lvOriginal;
int SCI_METHOD Version() const override {
return lvRelease4;
}
const char * SCI_METHOD PropertyNames() {
const char * SCI_METHOD PropertyNames() override {
return osBasic.PropertyNames();
}
int SCI_METHOD PropertyType(const char *name) {
int SCI_METHOD PropertyType(const char *name) override {
return osBasic.PropertyType(name);
}
const char * SCI_METHOD DescribeProperty(const char *name) {
const char * SCI_METHOD DescribeProperty(const char *name) override {
return osBasic.DescribeProperty(name);
}
int SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
const char * SCI_METHOD DescribeWordListSets() override {
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);
Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void * SCI_METHOD PrivateCall(int, void *) {
void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
static ILexer *LexerFactoryBlitzBasic() {
static ILexer4 *LexerFactoryBlitzBasic() {
return new LexerBasic(';', CheckBlitzFoldPoint, blitzbasicWordListDesc);
}
static ILexer *LexerFactoryPureBasic() {
static ILexer4 *LexerFactoryPureBasic() {
return new LexerBasic(';', CheckPureFoldPoint, purebasicWordListDesc);
}
static ILexer *LexerFactoryFreeBasic() {
static ILexer4 *LexerFactoryFreeBasic() {
return new LexerBasic('\'', CheckFreeFoldPoint, freebasicWordListDesc );
}
};
int SCI_METHOD LexerBasic::PropertySet(const char *key, const char *val) {
Sci_Position 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) {
Sci_Position SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@ -300,7 +299,7 @@ int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
wordListN = &keywordlists[3];
break;
}
int firstModification = -1;
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@ -312,7 +311,7 @@ int SCI_METHOD LexerBasic::WordListSet(int n, const char *wl) {
return firstModification;
}
void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
void SCI_METHOD LexerBasic::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
bool wasfirst = true, isfirst = true; // true if first token in a line
@ -471,17 +470,17 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle
}
void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initStyle */, IDocument *pAccess) {
void SCI_METHOD LexerBasic::Fold(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
int line = styler.GetLine(startPos);
Sci_Position line = styler.GetLine(startPos);
int level = styler.LevelAt(line);
int go = 0, done = 0;
int endPos = startPos + length;
Sci_Position endPos = startPos + length;
char word[256];
int wordlen = 0;
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
@ -489,7 +488,7 @@ void SCI_METHOD LexerBasic::Fold(unsigned int startPos, int length, int /* initS
// Scan for tokens at the start of the line (they may include
// whitespace, for tokens like "End Function"
for (int i = startPos; i < endPos; i++) {
for (Sci_Position i = startPos; i < endPos; i++) {
int c = cNext;
cNext = styler.SafeGetCharAt(i + 1);
bool atEOL = (c == '\r' && cNext != '\n') || (c == '\n');

View File

@ -0,0 +1,498 @@
// Scintilla source code edit control
/** @file LexBatch.cxx
** Lexer for batch files.
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <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"
using namespace Scintilla;
static bool Is0To9(char ch) {
return (ch >= '0') && (ch <= '9');
}
static bool IsAlphabetic(int ch) {
return IsASCII(ch) && isalpha(ch);
}
static inline bool AtEOL(Accessor &styler, Sci_PositionU i) {
return (styler[i] == '\n') ||
((styler[i] == '\r') && (styler.SafeGetCharAt(i + 1) != '\n'));
}
// Tests for BATCH Operators
static bool IsBOperator(char ch) {
return (ch == '=') || (ch == '+') || (ch == '>') || (ch == '<') ||
(ch == '|') || (ch == '?') || (ch == '*');
}
// Tests for BATCH Separators
static bool IsBSeparator(char ch) {
return (ch == '\\') || (ch == '.') || (ch == ';') ||
(ch == '\"') || (ch == '\'') || (ch == '/');
}
static void ColouriseBatchLine(
char *lineBuffer,
Sci_PositionU lengthLine,
Sci_PositionU startLine,
Sci_PositionU endPos,
WordList *keywordlists[],
Accessor &styler) {
Sci_PositionU offset = 0; // Line Buffer Offset
Sci_PositionU cmdLoc; // External Command / Program Location
char wordBuffer[81]; // Word Buffer - large to catch long paths
Sci_PositionU wbl; // Word Buffer Length
Sci_PositionU wbo; // Word Buffer Offset - also Special Keyword Buffer Length
WordList &keywords = *keywordlists[0]; // Internal Commands
WordList &keywords2 = *keywordlists[1]; // External Commands (optional)
// CHOICE, ECHO, GOTO, PROMPT and SET have Default Text that may contain Regular Keywords
// Toggling Regular Keyword Checking off improves readability
// Other Regular Keywords and External Commands / Programs might also benefit from toggling
// Need a more robust algorithm to properly toggle Regular Keyword Checking
bool continueProcessing = true; // Used to toggle Regular Keyword Checking
// Special Keywords are those that allow certain characters without whitespace after the command
// Examples are: cd. cd\ md. rd. dir| dir> echo: echo. path=
// Special Keyword Buffer used to determine if the first n characters is a Keyword
char sKeywordBuffer[10]; // Special Keyword Buffer
bool sKeywordFound; // Exit Special Keyword for-loop if found
// Skip initial spaces
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
offset++;
}
// Colorize Default Text
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
// Set External Command / Program Location
cmdLoc = offset;
// Check for Fake Label (Comment) or Real Label - return if found
if (lineBuffer[offset] == ':') {
if (lineBuffer[offset + 1] == ':') {
// Colorize Fake Label (Comment) - :: is similar to REM, see http://content.techweb.com/winmag/columns/explorer/2000/21.htm
styler.ColourTo(endPos, SCE_BAT_COMMENT);
} else {
// Colorize Real Label
styler.ColourTo(endPos, SCE_BAT_LABEL);
}
return;
// Check for Drive Change (Drive Change is internal command) - return if found
} else if ((IsAlphabetic(lineBuffer[offset])) &&
(lineBuffer[offset + 1] == ':') &&
((isspacechar(lineBuffer[offset + 2])) ||
(((lineBuffer[offset + 2] == '\\')) &&
(isspacechar(lineBuffer[offset + 3]))))) {
// Colorize Regular Keyword
styler.ColourTo(endPos, SCE_BAT_WORD);
return;
}
// Check for Hide Command (@ECHO OFF/ON)
if (lineBuffer[offset] == '@') {
styler.ColourTo(startLine + offset, SCE_BAT_HIDE);
offset++;
}
// Skip next spaces
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
offset++;
}
// Read remainder of line word-at-a-time or remainder-of-word-at-a-time
while (offset < lengthLine) {
if (offset > startLine) {
// Colorize Default Text
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
// Copy word from Line Buffer into Word Buffer
wbl = 0;
for (; offset < lengthLine && wbl < 80 &&
!isspacechar(lineBuffer[offset]); wbl++, offset++) {
wordBuffer[wbl] = static_cast<char>(tolower(lineBuffer[offset]));
}
wordBuffer[wbl] = '\0';
wbo = 0;
// Check for Comment - return if found
if (CompareCaseInsensitive(wordBuffer, "rem") == 0) {
styler.ColourTo(endPos, SCE_BAT_COMMENT);
return;
}
// Check for Separator
if (IsBSeparator(wordBuffer[0])) {
// Check for External Command / Program
if ((cmdLoc == offset - wbl) &&
((wordBuffer[0] == ':') ||
(wordBuffer[0] == '\\') ||
(wordBuffer[0] == '.'))) {
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Colorize External Command / Program
if (!keywords2) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else if (keywords2.InList(wordBuffer)) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else {
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
// Reset External Command / Program Location
cmdLoc = offset;
} else {
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Colorize Default Text
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
// Check for Regular Keyword in list
} else if ((keywords.InList(wordBuffer)) &&
(continueProcessing)) {
// ECHO, GOTO, PROMPT and SET require no further Regular Keyword Checking
if ((CompareCaseInsensitive(wordBuffer, "echo") == 0) ||
(CompareCaseInsensitive(wordBuffer, "goto") == 0) ||
(CompareCaseInsensitive(wordBuffer, "prompt") == 0) ||
(CompareCaseInsensitive(wordBuffer, "set") == 0)) {
continueProcessing = false;
}
// Identify External Command / Program Location for ERRORLEVEL, and EXIST
if ((CompareCaseInsensitive(wordBuffer, "errorlevel") == 0) ||
(CompareCaseInsensitive(wordBuffer, "exist") == 0)) {
// Reset External Command / Program Location
cmdLoc = offset;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Skip comparison
while ((cmdLoc < lengthLine) &&
(!isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Identify External Command / Program Location for CALL, DO, LOADHIGH and LH
} else if ((CompareCaseInsensitive(wordBuffer, "call") == 0) ||
(CompareCaseInsensitive(wordBuffer, "do") == 0) ||
(CompareCaseInsensitive(wordBuffer, "loadhigh") == 0) ||
(CompareCaseInsensitive(wordBuffer, "lh") == 0)) {
// Reset External Command / Program Location
cmdLoc = offset;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
}
// Colorize Regular keyword
styler.ColourTo(startLine + offset - 1, SCE_BAT_WORD);
// No need to Reset Offset
// Check for Special Keyword in list, External Command / Program, or Default Text
} else if ((wordBuffer[0] != '%') &&
(wordBuffer[0] != '!') &&
(!IsBOperator(wordBuffer[0])) &&
(continueProcessing)) {
// Check for Special Keyword
// Affected Commands are in Length range 2-6
// Good that ERRORLEVEL, EXIST, CALL, DO, LOADHIGH, and LH are unaffected
sKeywordFound = false;
for (Sci_PositionU keywordLength = 2; keywordLength < wbl && keywordLength < 7 && !sKeywordFound; keywordLength++) {
wbo = 0;
// Copy Keyword Length from Word Buffer into Special Keyword Buffer
for (; wbo < keywordLength; wbo++) {
sKeywordBuffer[wbo] = static_cast<char>(wordBuffer[wbo]);
}
sKeywordBuffer[wbo] = '\0';
// Check for Special Keyword in list
if ((keywords.InList(sKeywordBuffer)) &&
((IsBOperator(wordBuffer[wbo])) ||
(IsBSeparator(wordBuffer[wbo])))) {
sKeywordFound = true;
// ECHO requires no further Regular Keyword Checking
if (CompareCaseInsensitive(sKeywordBuffer, "echo") == 0) {
continueProcessing = false;
}
// Colorize Special Keyword as Regular Keyword
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_WORD);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
}
}
// Check for External Command / Program or Default Text
if (!sKeywordFound) {
wbo = 0;
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
// Read up to %, Operator or Separator
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
(wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
// Reset External Command / Program Location
cmdLoc = offset - (wbl - wbo);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
// CHOICE requires no further Regular Keyword Checking
if (CompareCaseInsensitive(wordBuffer, "choice") == 0) {
continueProcessing = false;
}
// Check for START (and its switches) - What follows is External Command \ Program
if (CompareCaseInsensitive(wordBuffer, "start") == 0) {
// Reset External Command / Program Location
cmdLoc = offset;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Reset External Command / Program Location if command switch detected
if (lineBuffer[cmdLoc] == '/') {
// Skip command switch
while ((cmdLoc < lengthLine) &&
(!isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
}
}
// Colorize External Command / Program
if (!keywords2) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else if (keywords2.InList(wordBuffer)) {
styler.ColourTo(startLine + offset - 1, SCE_BAT_COMMAND);
} else {
styler.ColourTo(startLine + offset - 1, SCE_BAT_DEFAULT);
}
// No need to Reset Offset
// Check for Default Text
} else {
// Read up to %, Operator or Separator
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
(wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
// Colorize Default Text
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
}
}
// Check for Argument (%n), Environment Variable (%x...%) or Local Variable (%%a)
} else if (wordBuffer[0] == '%') {
// Colorize Default Text
styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
wbo++;
// Search to end of word for second % (can be a long path)
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
// Check for Argument (%n) or (%*)
if (((Is0To9(wordBuffer[1])) || (wordBuffer[1] == '*')) &&
(wordBuffer[wbo] != '%')) {
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
cmdLoc = offset - (wbl - 2);
}
// Colorize Argument
styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_IDENTIFIER);
// Reset Offset to re-process remainder of word
offset -= (wbl - 2);
// Check for Expanded Argument (%~...) / Variable (%%~...)
} else if (((wbl > 1) && (wordBuffer[1] == '~')) ||
((wbl > 2) && (wordBuffer[1] == '%') && (wordBuffer[2] == '~'))) {
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
cmdLoc = offset - (wbl - wbo);
}
// Colorize Expanded Argument / Variable
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
// Check for Environment Variable (%x...%)
} else if ((wordBuffer[1] != '%') &&
(wordBuffer[wbo] == '%')) {
wbo++;
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
cmdLoc = offset - (wbl - wbo);
}
// Colorize Environment Variable
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
// Check for Local Variable (%%a)
} else if (
(wbl > 2) &&
(wordBuffer[1] == '%') &&
(wordBuffer[2] != '%') &&
(!IsBOperator(wordBuffer[2])) &&
(!IsBSeparator(wordBuffer[2]))) {
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
cmdLoc = offset - (wbl - 3);
}
// Colorize Local Variable
styler.ColourTo(startLine + offset - 1 - (wbl - 3), SCE_BAT_IDENTIFIER);
// Reset Offset to re-process remainder of word
offset -= (wbl - 3);
}
// Check for Environment Variable (!x...!)
} else if (wordBuffer[0] == '!') {
// Colorize Default Text
styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
wbo++;
// Search to end of word for second ! (can be a long path)
while ((wbo < wbl) &&
(wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
if (wordBuffer[wbo] == '!') {
wbo++;
// Check for External Command / Program
if (cmdLoc == offset - wbl) {
cmdLoc = offset - (wbl - wbo);
}
// Colorize Environment Variable
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_IDENTIFIER);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
}
// Check for Operator
} else if (IsBOperator(wordBuffer[0])) {
// Colorize Default Text
styler.ColourTo(startLine + offset - 1 - wbl, SCE_BAT_DEFAULT);
// Check for Comparison Operator
if ((wordBuffer[0] == '=') && (wordBuffer[1] == '=')) {
// Identify External Command / Program Location for IF
cmdLoc = offset;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Colorize Comparison Operator
styler.ColourTo(startLine + offset - 1 - (wbl - 2), SCE_BAT_OPERATOR);
// Reset Offset to re-process remainder of word
offset -= (wbl - 2);
// Check for Pipe Operator
} else if (wordBuffer[0] == '|') {
// Reset External Command / Program Location
cmdLoc = offset - wbl + 1;
// Skip next spaces
while ((cmdLoc < lengthLine) &&
(isspacechar(lineBuffer[cmdLoc]))) {
cmdLoc++;
}
// Colorize Pipe Operator
styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR);
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
// Check for Other Operator
} else {
// Check for > Operator
if (wordBuffer[0] == '>') {
// Turn Keyword and External Command / Program checking back on
continueProcessing = true;
}
// Colorize Other Operator
styler.ColourTo(startLine + offset - 1 - (wbl - 1), SCE_BAT_OPERATOR);
// Reset Offset to re-process remainder of word
offset -= (wbl - 1);
}
// Check for Default Text
} else {
// Read up to %, Operator or Separator
while ((wbo < wbl) &&
(wordBuffer[wbo] != '%') &&
(wordBuffer[wbo] != '!') &&
(!IsBOperator(wordBuffer[wbo])) &&
(!IsBSeparator(wordBuffer[wbo]))) {
wbo++;
}
// Colorize Default Text
styler.ColourTo(startLine + offset - 1 - (wbl - wbo), SCE_BAT_DEFAULT);
// Reset Offset to re-process remainder of word
offset -= (wbl - wbo);
}
// Skip next spaces - nothing happens if Offset was Reset
while ((offset < lengthLine) && (isspacechar(lineBuffer[offset]))) {
offset++;
}
}
// Colorize Default Text for remainder of line - currently not lexed
styler.ColourTo(endPos, SCE_BAT_DEFAULT);
}
static void ColouriseBatchDoc(
Sci_PositionU startPos,
Sci_Position length,
int /*initStyle*/,
WordList *keywordlists[],
Accessor &styler) {
char lineBuffer[1024];
styler.StartAt(startPos);
styler.StartSegment(startPos);
Sci_PositionU linePos = 0;
Sci_PositionU startLine = startPos;
for (Sci_PositionU i = startPos; i < startPos + length; i++) {
lineBuffer[linePos++] = styler[i];
if (AtEOL(styler, i) || (linePos >= sizeof(lineBuffer) - 1)) {
// End of line (or of line buffer) met, colourise it
lineBuffer[linePos] = '\0';
ColouriseBatchLine(lineBuffer, linePos, startLine, i, keywordlists, styler);
linePos = 0;
startLine = i + 1;
}
}
if (linePos > 0) { // Last line does not have ending characters
lineBuffer[linePos] = '\0';
ColouriseBatchLine(lineBuffer, linePos, startLine, startPos + length - 1,
keywordlists, styler);
}
}
static const char *const batchWordListDesc[] = {
"Internal Commands",
"External Commands",
0
};
LexerModule lmBatch(SCLEX_BATCH, ColouriseBatchDoc, "batch", 0, batchWordListDesc);

View File

@ -30,9 +30,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
namespace {
bool IsAlphabetic(unsigned int ch)
@ -76,7 +74,7 @@ namespace {
return IsEntryStart(sc.chPrev, sc.ch);
}
void ColorizeBibTeX(unsigned start_pos, int length, int /*init_style*/, WordList* keywordlists[], Accessor& styler)
void ColorizeBibTeX(Sci_PositionU start_pos, Sci_Position length, int /*init_style*/, WordList* keywordlists[], Accessor& styler)
{
WordList &EntryNames = *keywordlists[0];
bool fold_compact = styler.GetPropertyInt("fold.compact", 1) != 0;
@ -94,7 +92,7 @@ namespace {
styler.StartAt(start_pos);
styler.StartSegment(start_pos);
int current_line = styler.GetLine(start_pos);
Sci_Position current_line = styler.GetLine(start_pos);
int prev_level = styler.LevelAt(current_line) & SC_FOLDLEVELNUMBERMASK;
int current_level = prev_level;
int visible_chars = 0;
@ -153,7 +151,7 @@ namespace {
sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the =
sc.ForwardSetState(SCE_BIBTEX_VALUE); // Parameter value colorization
int start = sc.currentPos;
Sci_Position start = sc.currentPos;
// We need to handle multiple situations:
// 1. name"one two {three}"
@ -227,12 +225,12 @@ namespace {
state = SCE_BIBTEX_DEFAULT;
}
int end = sc.currentPos;
Sci_Position end = sc.currentPos;
current_line = styler.GetLine(end);
// We have possibly skipped some lines, so the folding levels
// have to be adjusted separately
for (int i = styler.GetLine(start); i <= styler.GetLine(end); ++i)
for (Sci_Position i = styler.GetLine(start); i <= styler.GetLine(end); ++i)
styler.SetLevel(i, prev_level);
sc.ForwardSetState(state);

View File

@ -19,14 +19,12 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static int classifyWordBullant(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
static int classifyWordBullant(Sci_PositionU start, Sci_PositionU end, WordList &keywords, Accessor &styler) {
char s[100];
s[0] = '\0';
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++) {
for (Sci_PositionU i = 0; i < end - start + 1 && i < 30; i++) {
s[i] = static_cast<char>(tolower(styler[start + i]));
s[i + 1] = '\0';
}
@ -58,14 +56,14 @@ static int classifyWordBullant(unsigned int start, unsigned int end, WordList &k
return lev;
}
static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
static void ColouriseBullantDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
styler.StartAt(startPos);
bool fold = styler.GetPropertyInt("fold") != 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
@ -74,11 +72,11 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
styler.StartSegment(startPos);
int endFoundThisLine = 0;
for (unsigned int i = startPos; i < lengthDoc; i++) {
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);

404
scintilla/lexers/LexCIL.cxx Normal file
View File

@ -0,0 +1,404 @@
// Scintilla source code edit control
/** @file LexCIL.cxx
** Lexer for Common Intermediate Language
** Written by Jad Altahan (github.com/xv)
** CIL manual: https://www.ecma-international.org/publications/standards/Ecma-335.htm
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <string>
#include <map>
#include <algorithm>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "StringCopy.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "CharacterCategory.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "DefaultLexer.h"
using namespace Scintilla;
namespace {
// Use an unnamed namespace to protect the functions and classes from name conflicts
bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
}
bool IsOperator(const int ch) {
if ((ch < 0x80) && (isalnum(ch)))
return false;
if (strchr("!%&*+-/<=>@^|~()[]{}", ch)) {
return true;
}
return false;
}
constexpr bool IsStreamCommentStyle(const int style) noexcept {
return style == SCE_CIL_COMMENT;
}
struct OptionsCIL {
bool fold;
bool foldComment;
bool foldCommentMultiline;
bool foldCompact;
OptionsCIL() {
fold = true;
foldComment = false;
foldCommentMultiline = true;
foldCompact = true;
}
};
static const char *const cilWordListDesc[] = {
"Primary CIL keywords",
"Metadata",
"Opcode instructions",
0
};
struct OptionSetCIL : public OptionSet<OptionsCIL> {
OptionSetCIL() {
DefineProperty("fold", &OptionsCIL::fold);
DefineProperty("fold.comment", &OptionsCIL::foldComment);
DefineProperty("fold.cil.comment.multiline", &OptionsCIL::foldCommentMultiline,
"Set this property to 0 to disable folding multi-line comments when fold.comment=1.");
DefineProperty("fold.compact", &OptionsCIL::foldCompact);
DefineWordListSets(cilWordListDesc);
}
};
LexicalClass lexicalClasses[] = {
// Lexer CIL SCLEX_CIL SCE_CIL_:
0, "SCE_CIL_DEFAULT", "default", "White space",
1, "SCE_CIL_COMMENT", "comment", "Multi-line comment",
2, "SCE_CIL_COMMENTLINE", "comment line", "Line comment",
3, "SCE_CIL_WORD", "keyword", "Keyword 1",
4, "SCE_CIL_WORD2", "keyword", "Keyword 2",
5, "SCE_CIL_WORD3", "keyword", "Keyword 3",
6, "SCE_CIL_STRING", "literal string", "Double quoted string",
7, "SCE_CIL_LABEL", "label", "Code label",
8, "SCE_CIL_OPERATOR", "operator", "Operators",
9, "SCE_CIL_STRINGEOL", "error literal string", "String is not closed",
10, "SCE_CIL_IDENTIFIER", "identifier", "Identifiers",
};
}
class LexerCIL : public DefaultLexer {
WordList keywords, keywords2, keywords3;
OptionsCIL options;
OptionSetCIL osCIL;
public:
LexerCIL() : DefaultLexer(lexicalClasses, ELEMENTS(lexicalClasses)) { }
virtual ~LexerCIL() { }
void SCI_METHOD Release() override {
delete this;
}
int SCI_METHOD Version() const override {
return lvRelease4;
}
const char * SCI_METHOD PropertyNames() override {
return osCIL.PropertyNames();
}
int SCI_METHOD PropertyType(const char *name) override {
return osCIL.PropertyType(name);
}
const char * SCI_METHOD DescribeProperty(const char *name) override {
return osCIL.DescribeProperty(name);
}
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
const char * SCI_METHOD DescribeWordListSets() override {
return osCIL.DescribeWordListSets();
}
Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
int SCI_METHOD LineEndTypesSupported() override {
return SC_LINE_END_TYPE_UNICODE;
}
int SCI_METHOD PrimaryStyleFromStyle(int style) override {
return style;
}
static ILexer4 *LexerFactoryCIL() {
return new LexerCIL();
}
};
Sci_Position SCI_METHOD LexerCIL::PropertySet(const char *key, const char *val) {
if (osCIL.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
Sci_Position SCI_METHOD LexerCIL::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;
}
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
firstModification = 0;
}
}
return firstModification;
}
void SCI_METHOD LexerCIL::Lex(Sci_PositionU startPos, Sci_Position length,
int initStyle, IDocument *pAccess) {
if (initStyle == SCE_CIL_STRINGEOL) {
initStyle = SCE_CIL_DEFAULT;
}
Accessor styler(pAccess, NULL);
StyleContext sc(startPos, length, initStyle, styler);
bool identAtLineStart = false, // Checks if an identifier is at line start (ignoring spaces)
canStyleLabels = false; // Checks if conditions are met to style SCE_CIL_LABEL
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) {
if (sc.state == SCE_CIL_STRING) {
sc.SetState(SCE_CIL_STRING);
}
identAtLineStart = true;
}
// Handle string line continuation
if (sc.ch == '\\' && (sc.chNext == '\n' || sc.chNext == '\r') &&
(sc.state == SCE_CIL_STRING)) {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
continue;
}
switch (sc.state) {
case SCE_CIL_OPERATOR:
sc.SetState(SCE_CIL_DEFAULT);
break;
case SCE_CIL_IDENTIFIER:
if (!IsAWordChar(sc.ch)) {
if (canStyleLabels && (sc.ch == ':' && sc.chNext != ':')) {
sc.ChangeState(SCE_CIL_LABEL);
sc.ForwardSetState(SCE_CIL_DEFAULT);
} else {
char kwSize[100];
sc.GetCurrent(kwSize, sizeof(kwSize));
int style = SCE_CIL_IDENTIFIER;
if (keywords.InList(kwSize)) {
style = SCE_CIL_WORD;
} else if (keywords2.InList(kwSize)) {
style = SCE_CIL_WORD2;
} else if (keywords3.InList(kwSize)) {
style = SCE_CIL_WORD3;
}
sc.ChangeState(style);
sc.SetState(SCE_CIL_DEFAULT);
}
}
break;
case SCE_CIL_COMMENT:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_CIL_DEFAULT);
}
break;
case SCE_CIL_COMMENTLINE:
if (sc.atLineStart) {
sc.SetState(SCE_CIL_DEFAULT);
}
break;
case SCE_CIL_STRING:
if (sc.ch == '\\') {
if (sc.chNext == '"' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '"') {
sc.ForwardSetState(SCE_CIL_DEFAULT);
} else if (sc.atLineEnd) {
sc.ChangeState(SCE_CIL_STRINGEOL);
sc.ForwardSetState(SCE_CIL_DEFAULT);
}
break;
}
if (sc.state == SCE_CIL_DEFAULT) {
// String
if (sc.ch == '"') {
sc.SetState(SCE_CIL_STRING);
}
// Keyword
else if (IsAWordChar(sc.ch)) {
// Allow setting SCE_CIL_LABEL style only if the label is the
// first token in the line and does not start with a dot or a digit
canStyleLabels = identAtLineStart && !(sc.ch == '.' || IsADigit(sc.ch));
sc.SetState(SCE_CIL_IDENTIFIER);
}
// Multi-line comment
else if (sc.Match('/', '*')) {
sc.SetState(SCE_CIL_COMMENT);
sc.Forward();
}
// Line comment
else if (sc.Match('/', '/')) {
sc.SetState(SCE_CIL_COMMENTLINE);
}
// Operators
else if (IsOperator(sc.ch)) {
sc.SetState(SCE_CIL_OPERATOR);
}
}
if (!IsASpace(sc.ch)) {
identAtLineStart = false;
}
}
sc.Complete();
}
void SCI_METHOD LexerCIL::Fold(Sci_PositionU startPos, Sci_Position length,
int initStyle, IDocument *pAccess) {
if (!options.fold) {
return;
}
LexAccessor styler(pAccess);
const Sci_PositionU endPos = startPos + length;
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
int style = initStyle;
int styleNext = styler.StyleAt(startPos);
int levelNext = levelCurrent;
int visibleChars = 0;
char chNext = styler[startPos];
for (Sci_PositionU i = startPos; i < endPos; i++) {
const char ch = chNext;
int stylePrev = style;
chNext = styler.SafeGetCharAt(i + 1);
style = styleNext;
styleNext = styler.StyleAt(i + 1);
const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (options.foldComment &&
options.foldCommentMultiline && IsStreamCommentStyle(style)) {
if (!IsStreamCommentStyle(stylePrev)) {
levelNext++;
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
levelNext--;
}
}
if (style == SCE_CIL_OPERATOR) {
if (ch == '{') {
levelNext++;
} else if (ch == '}') {
levelNext--;
}
}
if (!IsASpace(ch)) {
visibleChars++;
}
if (atEOL || (i == endPos - 1)) {
int lev = levelCurrent | levelNext << 16;
if (visibleChars == 0 && options.foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (levelCurrent < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelCurrent = levelNext;
if (options.foldCompact &&
i == static_cast<Sci_PositionU>(styler.Length() - 1)) {
styler.SetLevel(lineCurrent, lev | SC_FOLDLEVELWHITEFLAG);
}
visibleChars = 0;
}
}
}
LexerModule lmCIL(SCLEX_CIL, LexerCIL::LexerFactoryCIL, "cil", cilWordListDesc);

View File

@ -24,9 +24,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
// Is an end of line character
inline bool IsEOL(const int ch) {
@ -142,12 +140,12 @@ inline bool SetNumericConstantState(StyleContext &scDoc) {
}
// Get the next word in uppercase from the current position (keyword lookahead)
inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLength, char *cWord) {
inline bool GetNextWordUpper(Accessor &styler, Sci_PositionU uiStartPos, Sci_Position iLength, char *cWord) {
unsigned int iIndex = 0; // Buffer Index
Sci_PositionU iIndex = 0; // Buffer Index
// Loop through the remaining string from the current position
for (int iOffset = uiStartPos; iOffset < iLength; iOffset++) {
for (Sci_Position iOffset = uiStartPos; iOffset < iLength; iOffset++) {
// Get the character from the buffer using the offset
char cCharacter = styler[iOffset];
if (IsEOL(cCharacter)) {
@ -174,7 +172,7 @@ inline bool GetNextWordUpper(Accessor &styler, unsigned int uiStartPos, int iLen
}
// Clarion Language Colouring Procedure
static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
static void ColouriseClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler, bool bCaseSensitive) {
int iParenthesesLevel = 0; // Parenthese Level
int iColumn1Label = false; // Label starts in Column 1
@ -521,22 +519,22 @@ static void ColouriseClarionDoc(unsigned int uiStartPos, int iLength, int iInitS
}
// Clarion Language Case Sensitive Colouring Procedure
static void ColouriseClarionDocSensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
static void ColouriseClarionDocSensitive(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, true);
}
// Clarion Language Case Insensitive Colouring Procedure
static void ColouriseClarionDocInsensitive(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
static void ColouriseClarionDocInsensitive(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *wlKeywords[], Accessor &accStyler) {
ColouriseClarionDoc(uiStartPos, iLength, iInitStyle, wlKeywords, accStyler, false);
}
// Fill Buffer
static void FillBuffer(unsigned int uiStart, unsigned int uiEnd, Accessor &accStyler, char *szBuffer, unsigned int uiLength) {
static void FillBuffer(Sci_PositionU uiStart, Sci_PositionU uiEnd, Accessor &accStyler, char *szBuffer, Sci_PositionU uiLength) {
unsigned int uiPos = 0;
Sci_PositionU uiPos = 0;
while ((uiPos < uiEnd - uiStart + 1) && (uiPos < uiLength-1)) {
szBuffer[uiPos] = static_cast<char>(toupper(accStyler[uiStart + uiPos]));
@ -599,19 +597,19 @@ static int ClassifyClarionFoldPoint(int iLevel, const char* szString) {
}
// Clarion Language Folding Procedure
static void FoldClarionDoc(unsigned int uiStartPos, int iLength, int iInitStyle, WordList *[], Accessor &accStyler) {
static void FoldClarionDoc(Sci_PositionU uiStartPos, Sci_Position iLength, int iInitStyle, WordList *[], Accessor &accStyler) {
unsigned int uiEndPos = uiStartPos + iLength;
int iLineCurrent = accStyler.GetLine(uiStartPos);
Sci_PositionU uiEndPos = uiStartPos + iLength;
Sci_Position iLineCurrent = accStyler.GetLine(uiStartPos);
int iLevelPrev = accStyler.LevelAt(iLineCurrent) & SC_FOLDLEVELNUMBERMASK;
int iLevelCurrent = iLevelPrev;
char chNext = accStyler[uiStartPos];
int iStyle = iInitStyle;
int iStyleNext = accStyler.StyleAt(uiStartPos);
int iVisibleChars = 0;
int iLastStart = 0;
Sci_Position iLastStart = 0;
for (unsigned int uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) {
for (Sci_PositionU uiPos = uiStartPos; uiPos < uiEndPos; uiPos++) {
char chChar = chNext;
chNext = accStyler.SafeGetCharAt(uiPos + 1);

View File

@ -26,9 +26,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#define IN_DIVISION 0x01
#define IN_DECLARATIVES 0x02
@ -64,12 +62,12 @@ static int CountBits(int nBits)
return count;
}
static void getRange(unsigned int start,
unsigned int end,
static void getRange(Sci_PositionU start,
Sci_PositionU end,
Accessor &styler,
char *s,
unsigned int len) {
unsigned int i = 0;
Sci_PositionU len) {
Sci_PositionU i = 0;
while ((i < end - start + 1) && (i < len-1)) {
s[i] = static_cast<char>(tolower(styler[start + i]));
i++;
@ -77,12 +75,12 @@ static void getRange(unsigned int start,
s[i] = '\0';
}
static void ColourTo(Accessor &styler, unsigned int end, unsigned int attr) {
static void ColourTo(Accessor &styler, Sci_PositionU end, unsigned int attr) {
styler.ColourTo(end, attr);
}
static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
static int classifyWordCOBOL(Sci_PositionU start, Sci_PositionU end, /*WordList &keywords*/WordList *keywordlists[], Accessor &styler, int nContainment, bool *bAarea) {
int ret = 0;
WordList& a_keywords = *keywordlists[0];
@ -142,7 +140,7 @@ static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &k
return ret;
}
static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
static void ColouriseCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
styler.StartAt(startPos);
@ -152,11 +150,11 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
state = SCE_C_DEFAULT;
char chPrev = ' ';
char chNext = styler[startPos];
unsigned int lengthDoc = startPos + length;
Sci_PositionU lengthDoc = startPos + length;
int nContainment;
int currentLine = styler.GetLine(startPos);
Sci_Position currentLine = styler.GetLine(startPos);
if (currentLine > 0) {
styler.SetLineState(currentLine, styler.GetLineState(currentLine-1));
nContainment = styler.GetLineState(currentLine);
@ -170,7 +168,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
bool bNewLine = true;
bool bAarea = !isspacechar(chNext);
int column = 0;
for (unsigned int i = startPos; i < lengthDoc; i++) {
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@ -277,7 +275,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
if (ch == '\r' || ch == '\n') {
if (((i > styler.GetStartSegment() + 2) || (
(initStyle == SCE_C_COMMENTDOC) &&
(styler.GetStartSegment() == static_cast<unsigned int>(startPos))))) {
(styler.GetStartSegment() == static_cast<Sci_PositionU>(startPos))))) {
ColourTo(styler, i, state);
state = SCE_C_DEFAULT;
}
@ -309,12 +307,12 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
ColourTo(styler, lengthDoc - 1, state);
}
static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[],
static void FoldCOBOLDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = lineCurrent > 0 ? styler.LevelAt(lineCurrent - 1) & SC_FOLDLEVELNUMBERMASK : 0xFFF;
char chNext = styler[startPos];
@ -322,7 +320,7 @@ static void FoldCOBOLDoc(unsigned int startPos, int length, int, WordList *[],
bool bAarea = !isspacechar(chNext);
int column = 0;
bool bComment = false;
for (unsigned int i = startPos; i < endPos; i++) {
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
++column;

View File

@ -13,6 +13,7 @@
#include <assert.h>
#include <ctype.h>
#include <utility>
#include <string>
#include <vector>
#include <map>
@ -22,6 +23,7 @@
#include "Scintilla.h"
#include "SciLexer.h"
#include "StringCopy.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
@ -32,14 +34,12 @@
#include "SparseState.h"
#include "SubStyles.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
namespace {
// Use an unnamed namespace to protect the functions and classes from name conflicts
bool IsSpaceEquiv(int state) {
bool IsSpaceEquiv(int state) noexcept {
return (state <= SCE_C_COMMENTDOC) ||
// including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
(state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) ||
@ -53,10 +53,10 @@ bool IsSpaceEquiv(int state) {
// a = b+++/ptn/...
// Putting a space between the '++' post-inc operator and the '+' binary op
// fixes this, and is highly recommended for readability anyway.
bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
int pos = (int) sc.currentPos;
bool FollowsPostfixOperator(const StyleContext &sc, LexAccessor &styler) {
Sci_Position pos = sc.currentPos;
while (--pos > 0) {
char ch = styler[pos];
const char ch = styler[pos];
if (ch == '+' || ch == '-') {
return styler[pos - 1] == ch;
}
@ -64,13 +64,13 @@ bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
return false;
}
bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
bool followsReturnKeyword(const 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);
Sci_Position pos = sc.currentPos;
const Sci_Position currentLine = styler.GetLine(pos);
const Sci_Position lineStartPos = styler.LineStart(currentLine);
while (--pos > lineStartPos) {
char ch = styler.SafeGetCharAt(pos);
const char ch = styler.SafeGetCharAt(pos);
if (ch != ' ' && ch != '\t') {
break;
}
@ -86,13 +86,13 @@ bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
return !*s;
}
bool IsSpaceOrTab(int ch) {
bool IsSpaceOrTab(int ch) noexcept {
return ch == ' ' || ch == '\t';
}
bool OnlySpaceOrTab(const std::string &s) {
for (std::string::const_iterator it = s.begin(); it != s.end(); ++it) {
if (!IsSpaceOrTab(*it))
bool OnlySpaceOrTab(const std::string &s) noexcept {
for (const char ch : s) {
if (!IsSpaceOrTab(ch))
return false;
}
return true;
@ -100,11 +100,11 @@ bool OnlySpaceOrTab(const std::string &s) {
std::vector<std::string> StringSplit(const std::string &text, int separator) {
std::vector<std::string> vs(text.empty() ? 0 : 1);
for (std::string::const_iterator it = text.begin(); it != text.end(); ++it) {
if (*it == separator) {
vs.push_back(std::string());
for (const char ch : text) {
if (ch == separator) {
vs.emplace_back();
} else {
vs.back() += *it;
vs.back() += ch;
}
}
return vs;
@ -141,21 +141,21 @@ BracketPair FindBracketPair(std::vector<std::string> &tokens) {
}
void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
int activity, WordList &markerList, bool caseSensitive){
int activity, const WordList &markerList, bool caseSensitive){
if ((isoperator(sc.chPrev) || IsASpace(sc.chPrev)) && markerList.Length()) {
const int lengthMarker = 50;
char marker[lengthMarker+1];
int currPos = (int) sc.currentPos;
char marker[lengthMarker+1] = "";
const Sci_Position currPos = static_cast<Sci_Position>(sc.currentPos);
int i = 0;
while (i < lengthMarker) {
char ch = styler.SafeGetCharAt(currPos + i);
const char ch = styler.SafeGetCharAt(currPos + i);
if (IsASpace(ch) || isoperator(ch)) {
break;
}
if (caseSensitive)
marker[i] = ch;
else
marker[i] = static_cast<char>(tolower(ch));
marker[i] = MakeLowerCase(ch);
i++;
}
marker[i] = '\0';
@ -199,24 +199,34 @@ struct EscapeSequence {
}
};
std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
std::string GetRestOfLine(LexAccessor &styler, Sci_Position start, bool allowSpace) {
std::string restOfLine;
int i =0;
Sci_Position line = styler.GetLine(start);
Sci_Position pos = start;
Sci_Position endLine = styler.LineEnd(line);
char ch = styler.SafeGetCharAt(start, '\n');
int endLine = styler.LineEnd(styler.GetLine(start));
while (((start+i) < endLine) && (ch != '\r')) {
char chNext = styler.SafeGetCharAt(start + i + 1, '\n');
while (pos < endLine) {
if (ch == '\\' && ((pos + 1) == endLine)) {
// Continuation line
line++;
pos = styler.LineStart(line);
endLine = styler.LineEnd(line);
ch = styler.SafeGetCharAt(pos, '\n');
} else {
const char chNext = styler.SafeGetCharAt(pos + 1, '\n');
if (ch == '/' && (chNext == '/' || chNext == '*'))
break;
if (allowSpace || (ch != ' '))
if (allowSpace || (ch != ' ')) {
restOfLine += ch;
i++;
}
pos++;
ch = chNext;
}
}
return restOfLine;
}
bool IsStreamCommentStyle(int style) {
bool IsStreamCommentStyle(int style) noexcept {
return style == SCE_C_COMMENT ||
style == SCE_C_COMMENTDOC ||
style == SCE_C_COMMENTDOCKEYWORD ||
@ -224,12 +234,12 @@ bool IsStreamCommentStyle(int style) {
}
struct PPDefinition {
int line;
Sci_Position line;
std::string key;
std::string value;
bool isUndef;
std::string arguments;
PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :
PPDefinition(Sci_Position line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, const std::string &arguments_="") :
line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) {
}
};
@ -238,22 +248,26 @@ class LinePPState {
int state;
int ifTaken;
int level;
bool ValidLevel() const {
bool ValidLevel() const noexcept {
return level >= 0 && level < 32;
}
int maskLevel() const {
int maskLevel() const noexcept {
if (level >= 0) {
return 1 << level;
} else {
return 1;
}
}
public:
LinePPState() : state(0), ifTaken(0), level(-1) {
}
bool IsInactive() const {
bool IsInactive() const noexcept {
return state != 0;
}
bool CurrentIfTaken() const {
bool CurrentIfTaken() const noexcept {
return (ifTaken & maskLevel()) != 0;
}
void StartSection(bool on) {
void StartSection(bool on) noexcept {
level++;
if (ValidLevel()) {
if (on) {
@ -265,14 +279,14 @@ public:
}
}
}
void EndSection() {
void EndSection() noexcept {
if (ValidLevel()) {
state &= ~maskLevel();
ifTaken &= ~maskLevel();
}
level--;
}
void InvertCurrentLevel() {
void InvertCurrentLevel() noexcept {
if (ValidLevel()) {
state ^= maskLevel();
ifTaken |= maskLevel();
@ -285,14 +299,14 @@ public:
class PPStates {
std::vector<LinePPState> vlls;
public:
LinePPState ForLine(int line) const {
LinePPState ForLine(Sci_Position line) const {
if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) {
return vlls[line];
} else {
return LinePPState();
}
}
void Add(int line, LinePPState lls) {
void Add(Sci_Position line, LinePPState lls) {
vlls.resize(line+1);
vlls[line] = lls;
}
@ -320,6 +334,7 @@ struct OptionsCPP {
std::string foldExplicitEnd;
bool foldExplicitAnywhere;
bool foldPreprocessor;
bool foldPreprocessorAtElse;
bool foldCompact;
bool foldAtElse;
OptionsCPP() {
@ -341,6 +356,7 @@ struct OptionsCPP {
foldExplicitEnd = "";
foldExplicitAnywhere = false;
foldPreprocessor = false;
foldPreprocessorAtElse = false;
foldCompact = false;
foldAtElse = false;
}
@ -412,6 +428,9 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
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.cpp.preprocessor.at.else", &OptionsCPP::foldPreprocessorAtElse,
"This option enables folding on a preprocessor #else or #endif line of an #if statement.");
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.");
@ -427,13 +446,46 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0};
LexicalClass lexicalClasses[] = {
// Lexer Cpp SCLEX_CPP SCE_C_:
0, "SCE_C_DEFAULT", "default", "White space",
1, "SCE_C_COMMENT", "comment", "Comment: /* */.",
2, "SCE_C_COMMENTLINE", "comment line", "Line Comment: //.",
3, "SCE_C_COMMENTDOC", "comment documentation", "Doc comment: block comments beginning with /** or /*!",
4, "SCE_C_NUMBER", "literal numeric", "Number",
5, "SCE_C_WORD", "keyword", "Keyword",
6, "SCE_C_STRING", "literal string", "Double quoted string",
7, "SCE_C_CHARACTER", "literal string character", "Single quoted string",
8, "SCE_C_UUID", "literal uuid", "UUIDs (only in IDL)",
9, "SCE_C_PREPROCESSOR", "preprocessor", "Preprocessor",
10, "SCE_C_OPERATOR", "operator", "Operators",
11, "SCE_C_IDENTIFIER", "identifier", "Identifiers",
12, "SCE_C_STRINGEOL", "error literal string", "End of line where string is not closed",
13, "SCE_C_VERBATIM", "literal string multiline raw", "Verbatim strings for C#",
14, "SCE_C_REGEX", "literal regex", "Regular expressions for JavaScript",
15, "SCE_C_COMMENTLINEDOC", "comment documentation line", "Doc Comment Line: line comments beginning with /// or //!.",
16, "SCE_C_WORD2", "identifier", "Keywords2",
17, "SCE_C_COMMENTDOCKEYWORD", "comment documentation keyword", "Comment keyword",
18, "SCE_C_COMMENTDOCKEYWORDERROR", "error comment documentation keyword", "Comment keyword error",
19, "SCE_C_GLOBALCLASS", "identifier", "Global class",
20, "SCE_C_STRINGRAW", "literal string multiline raw", "Raw strings for C++0x",
21, "SCE_C_TRIPLEVERBATIM", "literal string multiline raw", "Triple-quoted strings for Vala",
22, "SCE_C_HASHQUOTEDSTRING", "literal string", "Hash-quoted strings for Pike",
23, "SCE_C_PREPROCESSORCOMMENT", "comment preprocessor", "Preprocessor stream comment",
24, "SCE_C_PREPROCESSORCOMMENTDOC", "comment preprocessor documentation", "Preprocessor stream doc comment",
25, "SCE_C_USERLITERAL", "literal", "User defined literals",
26, "SCE_C_TASKMARKER", "comment taskmarker", "Task Marker",
27, "SCE_C_ESCAPESEQUENCE", "literal string escapesequence", "Escape sequence",
};
}
class LexerCPP : public ILexerWithSubStyles {
class LexerCPP : public ILexer4 {
bool caseSensitive;
CharacterSet setWord;
CharacterSet setNegationOp;
CharacterSet setArithmethicOp;
CharacterSet setAddOp;
CharacterSet setMultOp;
CharacterSet setRelOp;
CharacterSet setLogicalOp;
CharacterSet setWordStart;
@ -455,7 +507,7 @@ class LexerCPP : public ILexerWithSubStyles {
arguments.clear();
return *this;
}
bool IsMacro() const {
bool IsMacro() const noexcept {
return !arguments.empty();
}
};
@ -468,86 +520,141 @@ class LexerCPP : public ILexerWithSubStyles {
enum { activeFlag = 0x40 };
enum { ssIdentifier, ssDocKeyword };
SubStyles subStyles;
std::string returnBuffer;
public:
explicit LexerCPP(bool caseSensitive_) :
caseSensitive(caseSensitive_),
setWord(CharacterSet::setAlphaNum, "._", 0x80, true),
setNegationOp(CharacterSet::setNone, "!"),
setArithmethicOp(CharacterSet::setNone, "+-/*%"),
setAddOp(CharacterSet::setNone, "+-"),
setMultOp(CharacterSet::setNone, "*/%"),
setRelOp(CharacterSet::setNone, "=!<>"),
setLogicalOp(CharacterSet::setNone, "|&"),
subStyles(styleSubable, 0x80, 0x40, activeFlag) {
}
virtual ~LexerCPP() {
}
void SCI_METHOD Release() {
void SCI_METHOD Release() override {
delete this;
}
int SCI_METHOD Version() const {
return lvSubStyles;
int SCI_METHOD Version() const override {
return lvRelease4;
}
const char * SCI_METHOD PropertyNames() {
const char * SCI_METHOD PropertyNames() override {
return osCPP.PropertyNames();
}
int SCI_METHOD PropertyType(const char *name) {
int SCI_METHOD PropertyType(const char *name) override {
return osCPP.PropertyType(name);
}
const char * SCI_METHOD DescribeProperty(const char *name) {
const char * SCI_METHOD DescribeProperty(const char *name) override {
return osCPP.DescribeProperty(name);
}
int SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
const char * SCI_METHOD DescribeWordListSets() override {
return osCPP.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);
Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void * SCI_METHOD PrivateCall(int, void *) {
void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
int SCI_METHOD LineEndTypesSupported() {
int SCI_METHOD LineEndTypesSupported() override {
return SC_LINE_END_TYPE_UNICODE;
}
int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) {
int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) override {
return subStyles.Allocate(styleBase, numberStyles);
}
int SCI_METHOD SubStylesStart(int styleBase) {
int SCI_METHOD SubStylesStart(int styleBase) override {
return subStyles.Start(styleBase);
}
int SCI_METHOD SubStylesLength(int styleBase) {
int SCI_METHOD SubStylesLength(int styleBase) override {
return subStyles.Length(styleBase);
}
int SCI_METHOD StyleFromSubStyle(int subStyle) {
int styleBase = subStyles.BaseStyle(MaskActive(subStyle));
int active = subStyle & activeFlag;
int SCI_METHOD StyleFromSubStyle(int subStyle) override {
const int styleBase = subStyles.BaseStyle(MaskActive(subStyle));
const int active = subStyle & activeFlag;
return styleBase | active;
}
int SCI_METHOD PrimaryStyleFromStyle(int style) {
int SCI_METHOD PrimaryStyleFromStyle(int style) override {
return MaskActive(style);
}
void SCI_METHOD FreeSubStyles() {
void SCI_METHOD FreeSubStyles() override {
subStyles.Free();
}
void SCI_METHOD SetIdentifiers(int style, const char *identifiers) {
void SCI_METHOD SetIdentifiers(int style, const char *identifiers) override {
subStyles.SetIdentifiers(style, identifiers);
}
int SCI_METHOD DistanceToSecondaryStyles() {
int SCI_METHOD DistanceToSecondaryStyles() override {
return activeFlag;
}
const char * SCI_METHOD GetSubStyleBases() {
const char * SCI_METHOD GetSubStyleBases() override {
return styleSubable;
}
int SCI_METHOD NamedStyles() override {
return std::max(subStyles.LastAllocated() + 1,
static_cast<int>(ELEMENTS(lexicalClasses))) +
activeFlag;
}
const char * SCI_METHOD NameOfStyle(int style) override {
if (style >= NamedStyles())
return "";
if (style < static_cast<int>(ELEMENTS(lexicalClasses)))
return lexicalClasses[style].name;
// TODO: inactive and substyles
return "";
}
const char * SCI_METHOD TagsOfStyle(int style) override {
if (style >= NamedStyles())
return "Excess";
returnBuffer.clear();
const int firstSubStyle = subStyles.FirstAllocated();
if (firstSubStyle >= 0) {
const int lastSubStyle = subStyles.LastAllocated();
if (((style >= firstSubStyle) && (style <= (lastSubStyle))) ||
((style >= firstSubStyle + activeFlag) && (style <= (lastSubStyle + activeFlag)))) {
int styleActive = style;
if (style > lastSubStyle) {
returnBuffer = "inactive ";
styleActive -= activeFlag;
}
const int styleMain = StyleFromSubStyle(styleActive);
returnBuffer += lexicalClasses[styleMain].tags;
return returnBuffer.c_str();
}
}
if (style < static_cast<int>(ELEMENTS(lexicalClasses)))
return lexicalClasses[style].tags;
if (style >= activeFlag) {
returnBuffer = "inactive ";
const int styleActive = style - activeFlag;
if (styleActive < static_cast<int>(ELEMENTS(lexicalClasses)))
returnBuffer += lexicalClasses[styleActive].tags;
else
returnBuffer = "";
return returnBuffer.c_str();
}
return "";
}
const char * SCI_METHOD DescriptionOfStyle(int style) override {
if (style >= NamedStyles())
return "";
if (style < static_cast<int>(ELEMENTS(lexicalClasses)))
return lexicalClasses[style].description;
// TODO: inactive and substyles
return "";
}
static ILexer *LexerFactoryCPP() {
static ILexer4 *LexerFactoryCPP() {
return new LexerCPP(true);
}
static ILexer *LexerFactoryCPPInsensitive() {
static ILexer4 *LexerFactoryCPPInsensitive() {
return new LexerCPP(false);
}
static int MaskActive(int style) {
static int MaskActive(int style) noexcept {
return style & ~activeFlag;
}
void EvaluateTokens(std::vector<std::string> &tokens, const SymbolTable &preprocessorDefinitions);
@ -555,7 +662,7 @@ public:
bool EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions);
};
int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
Sci_Position SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
if (osCPP.PropertySet(&options, key, val)) {
if (strcmp(key, "lexer.cpp.allow.dollars") == 0) {
setWord = CharacterSet(CharacterSet::setAlphaNum, "._", 0x80, true);
@ -568,7 +675,7 @@ int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
return -1;
}
int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@ -590,7 +697,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
wordListN = &markerList;
break;
}
int firstModification = -1;
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@ -606,8 +713,8 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
if (cpEquals) {
std::string name(cpDefinition, cpEquals - cpDefinition);
std::string val(cpEquals+1);
size_t bracket = name.find('(');
size_t bracketEnd = name.find(')');
const size_t bracket = name.find('(');
const size_t bracketEnd = name.find(')');
if ((bracket != std::string::npos) && (bracketEnd != std::string::npos)) {
// Macro
std::string args = name.substr(bracket + 1, bracketEnd - bracket - 1);
@ -628,16 +735,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
return firstModification;
}
// Functor used to truncate history
struct After {
int line;
explicit After(int line_) : line(line_) {}
bool operator()(PPDefinition &p) const {
return p.line > line;
}
};
void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
@ -664,13 +762,13 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
bool inRERange = false;
bool seenDocKeyBrace = false;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) ||
(MaskActive(initStyle) == SCE_C_COMMENTLINE) ||
(MaskActive(initStyle) == SCE_C_COMMENTLINEDOC)) {
// Set continuationLine if last character of previous line is '\'
if (lineCurrent > 0) {
int endLinePrevious = styler.LineEnd(lineCurrent - 1);
const Sci_Position endLinePrevious = styler.LineEnd(lineCurrent - 1);
if (endLinePrevious > 0) {
continuationLine = styler.SafeGetCharAt(endLinePrevious-1) == '\\';
}
@ -679,7 +777,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// look back to set chPrevNonWhite properly for better regex colouring
if (startPos > 0) {
int back = startPos;
Sci_Position back = startPos;
while (--back && IsSpaceEquiv(MaskActive(styler.StyleAt(back))))
;
if (MaskActive(styler.StyleAt(back)) == SCE_C_OPERATOR) {
@ -687,7 +785,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
}
}
StyleContext sc(startPos, length, initStyle, styler, static_cast<unsigned char>(0xff));
StyleContext sc(startPos, length, initStyle, styler);
LinePPState preproc = vlls.ForLine(lineCurrent);
bool definitionsChanged = false;
@ -697,18 +795,19 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
if (!options.updatePreprocessor)
ppDefineHistory.clear();
std::vector<PPDefinition>::iterator itInvalid = std::find_if(ppDefineHistory.begin(), ppDefineHistory.end(), After(lineCurrent-1));
std::vector<PPDefinition>::iterator itInvalid = std::find_if(ppDefineHistory.begin(), ppDefineHistory.end(),
[lineCurrent](const PPDefinition &p) { return p.line >= lineCurrent; });
if (itInvalid != ppDefineHistory.end()) {
ppDefineHistory.erase(itInvalid, ppDefineHistory.end());
definitionsChanged = true;
}
SymbolTable preprocessorDefinitions = preprocessorDefinitionsStart;
for (std::vector<PPDefinition>::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) {
if (itDef->isUndef)
preprocessorDefinitions.erase(itDef->key);
for (const PPDefinition &ppDef : ppDefineHistory) {
if (ppDef.isUndef)
preprocessorDefinitions.erase(ppDef.key);
else
preprocessorDefinitions[itDef->key] = SymbolValue(itDef->value, itDef->arguments);
preprocessorDefinitions[ppDef.key] = SymbolValue(ppDef.value, ppDef.arguments);
}
std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1);
@ -719,7 +818,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
const WordClassifier &classifierIdentifiers = subStyles.Classifier(SCE_C_IDENTIFIER);
const WordClassifier &classifierDocKeyWords = subStyles.Classifier(SCE_C_COMMENTDOCKEYWORD);
int lineEndNext = styler.LineEnd(lineCurrent);
Sci_Position lineEndNext = styler.LineEnd(lineCurrent);
for (; sc.More();) {
@ -757,10 +856,13 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// Handle line continuation generically.
if (sc.ch == '\\') {
if (static_cast<int>((sc.currentPos+1)) >= lineEndNext) {
if (static_cast<Sci_Position>((sc.currentPos+1)) >= lineEndNext) {
lineCurrent++;
lineEndNext = styler.LineEnd(lineCurrent);
vlls.Add(lineCurrent, preproc);
if (rawStringTerminator != "") {
rawSTNew.Set(lineCurrent-1, rawStringTerminator);
}
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
// Even in UTF-8, \r and \n are separate
@ -821,7 +923,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
const bool raw = literalString && sc.chPrev == 'R' && !setInvalidRawFirst.Contains(sc.chNext);
if (raw)
s[lenS--] = '\0';
bool valid =
const bool valid =
(lenS == 0) ||
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
@ -848,7 +950,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
break;
case SCE_C_PREPROCESSOR:
if (options.stylingWithinPreprocessor) {
if (IsASpace(sc.ch)) {
if (IsASpace(sc.ch) || (sc.ch == '(')) {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
} else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"') || sc.atLineEnd)) {
@ -1026,7 +1128,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
while ((sc.ch < 0x80) && islower(sc.ch))
sc.Forward(); // gobble regex flags
sc.SetState(SCE_C_DEFAULT|activitySet);
} else if (sc.ch == '\\' && (static_cast<int>(sc.currentPos+1) < lineEndNext)) {
} else if (sc.ch == '\\' && (static_cast<Sci_Position>(sc.currentPos+1) < lineEndNext)) {
// Gobble up the escaped character
sc.Forward();
} else if (sc.ch == '[') {
@ -1052,7 +1154,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
}
break;
case SCE_C_TRIPLEVERBATIM:
if (sc.Match("\"\"\"")) {
if (sc.Match(R"(""")")) {
while (sc.Match('"')) {
sc.Forward();
}
@ -1083,7 +1185,7 @@ 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 (options.triplequotedStrings && sc.Match("\"\"\"")) {
} else if (options.triplequotedStrings && sc.Match(R"(""")")) {
sc.SetState(SCE_C_TRIPLEVERBATIM|activitySet);
sc.Forward(2);
} else if (options.hashquotedStrings && sc.Match('#', '\"')) {
@ -1132,8 +1234,8 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
if (MaskActive(styler.StyleAt(sc.currentPos - 1)) == SCE_C_STRINGRAW) {
sc.SetState(SCE_C_STRINGRAW|activitySet);
rawStringTerminator = ")";
for (int termPos = sc.currentPos + 1;; termPos++) {
char chTerminator = styler.SafeGetCharAt(termPos, '(');
for (Sci_Position termPos = sc.currentPos + 1;; termPos++) {
const char chTerminator = styler.SafeGetCharAt(termPos, '(');
if (chTerminator == '(')
break;
rawStringTerminator += chTerminator;
@ -1164,14 +1266,14 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} else {
if (options.trackPreprocessor) {
if (sc.Match("ifdef") || sc.Match("ifndef")) {
bool isIfDef = sc.Match("ifdef");
int i = isIfDef ? 5 : 6;
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + i + 1, false);
const bool isIfDef = sc.Match("ifdef");
const int startRest = isIfDef ? 5 : 6;
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + startRest + 1, false);
bool foundDef = preprocessorDefinitions.find(restOfLine) != preprocessorDefinitions.end();
preproc.StartSection(isIfDef == foundDef);
} else if (sc.Match("if")) {
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true);
bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
const bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
preproc.StartSection(ifGood);
} else if (sc.Match("else")) {
if (!preproc.CurrentIfTaken()) {
@ -1189,8 +1291,8 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// Ensure only one chosen out of #if .. #elif .. #elif .. #else .. #endif
if (!preproc.CurrentIfTaken()) {
// Similar to #if
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 2, true);
bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 4, true);
const bool ifGood = EvaluateExpression(restOfLine, preprocessorDefinitions);
if (ifGood) {
preproc.InvertCurrentLevel();
activitySet = preproc.IsInactive() ? activeFlag : 0;
@ -1238,6 +1340,8 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
std::string value = restOfLine.substr(startValue);
if (OnlySpaceOrTab(value))
value = "1"; // No value defaults to 1
preprocessorDefinitions[key] = value;
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value));
definitionsChanged = true;
@ -1279,34 +1383,34 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
unsigned int endPos = startPos + length;
const Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
bool inLineComment = false;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
unsigned int lineStartNext = styler.LineStart(lineCurrent+1);
Sci_PositionU lineStartNext = styler.LineStart(lineCurrent+1);
int levelMinCurrent = levelCurrent;
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = MaskActive(styler.StyleAt(startPos));
int style = MaskActive(initStyle);
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
for (Sci_PositionU i = startPos; i < endPos; i++) {
const char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
const int stylePrev = style;
style = styleNext;
styleNext = MaskActive(styler.StyleAt(i + 1));
bool atEOL = i == (lineStartNext-1);
const bool atEOL = i == (lineStartNext-1);
if ((style == SCE_C_COMMENTLINE) || (style == SCE_C_COMMENTLINEDOC))
inLineComment = true;
if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) {
@ -1326,7 +1430,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
}
} else {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
const char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelNext++;
} else if (chNext2 == '}') {
@ -1337,7 +1441,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
}
if (options.foldPreprocessor && (style == SCE_C_PREPROCESSOR)) {
if (ch == '#') {
unsigned int j = i + 1;
Sci_PositionU j = i + 1;
while ((j < endPos) && IsASpaceOrTab(styler.SafeGetCharAt(j))) {
j++;
}
@ -1346,17 +1450,21 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
} else if (styler.Match(j, "end")) {
levelNext--;
}
if (options.foldPreprocessorAtElse && (styler.Match(j, "else") || styler.Match(j, "elif"))) {
levelMinCurrent--;
}
}
}
if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) {
if (ch == '{' || ch == '[') {
if (ch == '{' || ch == '[' || ch == '(') {
// Measure the minimum before a '{' to allow
// folding on "} else {"
if (levelMinCurrent > levelNext) {
if (options.foldAtElse && levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
} else if (ch == '}' || ch == ']') {
} else if (ch == '}' || ch == ']' || ch == ')') {
levelNext--;
}
}
@ -1364,7 +1472,9 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
visibleChars++;
if (atEOL || (i == endPos-1)) {
int levelUse = levelCurrent;
if (options.foldSyntaxBased && options.foldAtElse) {
if ((options.foldSyntaxBased && options.foldAtElse) ||
(options.foldPreprocessor && options.foldPreprocessorAtElse)
) {
levelUse = levelMinCurrent;
}
int lev = levelUse | levelNext << 16;
@ -1379,7 +1489,7 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
lineStartNext = styler.LineStart(lineCurrent+1);
levelCurrent = levelNext;
levelMinCurrent = levelCurrent;
if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
if (atEOL && (i == static_cast<Sci_PositionU>(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);
}
@ -1419,6 +1529,7 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTabl
if (it != preprocessorDefinitions.end()) {
val = "1";
}
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 2);
}
tokens[i] = val;
} else {
@ -1481,8 +1592,8 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTabl
tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end());
}
} else {
// Identifier not found
tokens.erase(tokens.begin() + i);
// Identifier not found and value defaults to zero
tokens[i] = "0";
}
} else {
i++;
@ -1519,18 +1630,20 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTabl
}
// Evaluate expressions in precedence order
enum precedence { precArithmetic, precRelative, precLogical };
for (int prec=precArithmetic; prec <= precLogical; prec++) {
enum precedence { precMult, precAdd, precRelative
, precLogical, /* end marker */ precLast };
for (int prec = precMult; prec < precLast; prec++) {
// Looking at 3 tokens at a time so end at 2 before end
for (size_t k=0; (k+2)<tokens.size();) {
char chOp = tokens[k+1][0];
const char chOp = tokens[k+1][0];
if (
((prec==precArithmetic) && setArithmethicOp.Contains(chOp)) ||
((prec==precMult) && setMultOp.Contains(chOp)) ||
((prec==precAdd) && setAddOp.Contains(chOp)) ||
((prec==precRelative) && setRelOp.Contains(chOp)) ||
((prec==precLogical) && setLogicalOp.Contains(chOp))
) {
int valA = atoi(tokens[k].c_str());
int valB = atoi(tokens[k+2].c_str());
const int valA = atoi(tokens[k].c_str());
const int valB = atoi(tokens[k+2].c_str());
int result = 0;
if (tokens[k+1] == "+")
result = valA + valB;
@ -1558,11 +1671,9 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTabl
result = valA || valB;
else if (tokens[k+1] == "&&")
result = valA && valB;
char sResult[30];
sprintf(sResult, "%d", result);
std::vector<std::string>::iterator itInsert =
tokens.erase(tokens.begin() + k, tokens.begin() + k + 3);
tokens.insert(itInsert, sResult);
tokens.insert(itInsert, std::to_string(result));
} else {
k++;
}
@ -1617,7 +1728,7 @@ bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &pr
EvaluateTokens(tokens, preprocessorDefinitions);
// "0" or "" -> false else true
bool isFalse = tokens.empty() ||
const bool isFalse = tokens.empty() ||
((tokens.size() == 1) && ((tokens[0] == "") || tokens[0] == "0"));
return !isFalse;
}

View File

@ -1,7 +1,8 @@
// Scintilla source code edit control
// Encoding: UTF-8
/** @file LexCSS.cxx
** Lexer for Cascading Style Sheets
** Written by Jakub Vrána
** Written by Jakub Vrána
** Improved by Philippe Lhoste (CSS2)
** Improved by Ross McKay (SCSS mode; see http://sass-lang.com/ )
**/
@ -31,9 +32,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const unsigned int ch) {
@ -58,11 +57,11 @@ inline bool IsCssOperator(const int ch) {
}
// look behind (from start of document to our start position) to determine current nesting level
inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) {
inline int NestingLevelLookBehind(Sci_PositionU startPos, Accessor &styler) {
int ch;
int nestingLevel = 0;
for (unsigned int i = 0; i < startPos; i++) {
for (Sci_PositionU i = 0; i < startPos; i++) {
ch = styler.SafeGetCharAt(i);
if (ch == '{')
nestingLevel++;
@ -73,7 +72,7 @@ inline int NestingLevelLookBehind(unsigned int startPos, Accessor &styler) {
return nestingLevel;
}
static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[], Accessor &styler) {
static void ColouriseCssDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[], Accessor &styler) {
WordList &css1Props = *keywordlists[0];
WordList &pseudoClasses = *keywordlists[1];
WordList &css2Props = *keywordlists[2];
@ -131,7 +130,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (lastStateC == -1) {
// backtrack to get last state:
// comments are like whitespace, so we must return to the previous state
unsigned int i = startPos;
Sci_PositionU i = startPos;
for (; i > 0; i--) {
if ((lastStateC = styler.StyleAt(i-1)) != SCE_CSS_COMMENT) {
if (lastStateC == SCE_CSS_OPERATOR) {
@ -165,7 +164,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.state == SCE_CSS_DOUBLESTRING || sc.state == SCE_CSS_SINGLESTRING) {
if (sc.ch != (sc.state == SCE_CSS_DOUBLESTRING ? '\"' : '\''))
continue;
unsigned int i = sc.currentPos;
Sci_PositionU i = sc.currentPos;
while (i && styler[i-1] == '\\')
i--;
if ((sc.currentPos - i) % 2 == 1)
@ -175,7 +174,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
if (sc.state == SCE_CSS_OPERATOR) {
if (op == ' ') {
unsigned int i = startPos;
Sci_PositionU i = startPos;
op = styler.SafeGetCharAt(i-1);
opPrev = styler.SafeGetCharAt(i-2);
while (--i) {
@ -347,6 +346,7 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
case SCE_CSS_DEFAULT:
if (isLessDocument) // give priority to pseudo elements
break;
// Falls through.
case SCE_CSS_VALUE:
lastStateVar = sc.state;
sc.SetState(SCE_CSS_VARIABLE);
@ -380,10 +380,10 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
// check for nested rule selector
if (sc.state == SCE_CSS_IDENTIFIER && (IsAWordChar(sc.ch) || sc.ch == ':' || sc.ch == '.' || sc.ch == '#')) {
// look ahead to see whether { comes before next ; and }
unsigned int endPos = startPos + length;
Sci_PositionU endPos = startPos + length;
int ch;
for (unsigned int i = sc.currentPos; i < endPos; i++) {
for (Sci_PositionU i = sc.currentPos; i < endPos; i++) {
ch = styler.SafeGetCharAt(i);
if (ch == ';' || ch == '}')
break;
@ -502,17 +502,17 @@ static void ColouriseCssDoc(unsigned int startPos, int length, int initStyle, Wo
sc.Complete();
}
static void FoldCSSDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler) {
static void FoldCSSDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
bool inComment = (styler.StyleAt(startPos-1) == SCE_CSS_COMMENT);
for (unsigned int i = startPos; i < endPos; i++) {
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styler.StyleAt(i);

View File

@ -37,6 +37,10 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#if defined(__clang__)
#pragma clang diagnostic ignored "-Wcomma"
#endif
// Since the Microsoft __iscsym[f] funcs are not ANSI...
inline int iscaml(int c) {return isalnum(c) || c == '_';}
inline int iscamlf(int c) {return isalpha(c) || c == '_';}
@ -46,9 +50,7 @@ static const int baseT[24] = {
0, 0, 8, 0, 0, 0, 0, 0, 0, 0, 0,16 /* M - X */
};
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
#ifdef BUILD_AS_EXTERNAL_LEXER
/*
@ -66,18 +68,18 @@ using namespace Scintilla;
#endif
static void ColouriseCamlDoc(
unsigned int startPos, int length,
Sci_PositionU startPos, Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
static void FoldCamlDoc(
unsigned int startPos, int length,
Sci_PositionU startPos, Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler);
static void InternalLexOrFold(int lexOrFold, unsigned int startPos, int length,
static void InternalLexOrFold(int lexOrFold, Sci_PositionU startPos, Sci_Position length,
int initStyle, char *words[], WindowID window, char *props);
static const char* LexerName = "caml";
@ -109,7 +111,7 @@ long Platform::SendScintillaPointer(WindowID w, unsigned int msg, unsigned long
reinterpret_cast<LPARAM>(lParam));
}
void EXT_LEXER_DECL Fold(unsigned int lexer, unsigned int startPos, int length,
void EXT_LEXER_DECL Fold(unsigned int lexer, Sci_PositionU startPos, Sci_Position length,
int initStyle, char *words[], WindowID window, char *props)
{
// below useless evaluation(s) to supress "not used" warnings
@ -138,7 +140,7 @@ void EXT_LEXER_DECL GetLexerName(unsigned int Index, char *name, int buflength)
}
}
void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length,
void EXT_LEXER_DECL Lex(unsigned int lexer, Sci_PositionU startPos, Sci_Position length,
int initStyle, char *words[], WindowID window, char *props)
{
// below useless evaluation(s) to supress "not used" warnings
@ -147,7 +149,7 @@ void EXT_LEXER_DECL Lex(unsigned int lexer, unsigned int startPos, int length,
InternalLexOrFold(0, startPos, length, initStyle, words, window, props);
}
static void InternalLexOrFold(int foldOrLex, unsigned int startPos, int length,
static void InternalLexOrFold(int foldOrLex, Sci_PositionU startPos, Sci_Position length,
int initStyle, char *words[], WindowID window, char *props)
{
// create and initialize a WindowAccessor (including contained PropSet)
@ -180,7 +182,7 @@ static
#endif /* BUILD_AS_EXTERNAL_LEXER */
void ColouriseCamlDoc(
unsigned int startPos, int length,
Sci_PositionU startPos, Sci_Position length,
int initStyle,
WordList *keywordlists[],
Accessor &styler)
@ -188,7 +190,8 @@ void ColouriseCamlDoc(
// initialize styler
StyleContext sc(startPos, length, initStyle, styler);
int chBase = 0, chToken = 0, chLit = 0;
Sci_PositionU chToken = 0;
int chBase = 0, chLit = 0;
WordList& keywords = *keywordlists[0];
WordList& keywords2 = *keywordlists[1];
WordList& keywords3 = *keywordlists[2];
@ -206,7 +209,7 @@ void ColouriseCamlDoc(
while (sc.More()) {
// set up [per-char] state info
int state2 = -1; // (ASSUME no state change)
int chColor = sc.currentPos - 1;// (ASSUME standard coloring range)
Sci_Position chColor = sc.currentPos - 1;// (ASSUME standard coloring range)
bool advance = true; // (ASSUME scanner "eats" 1 char)
// step state machine
@ -254,11 +257,11 @@ void ColouriseCamlDoc(
case SCE_CAML_IDENTIFIER:
// [try to] interpret as [additional] identifier char
if (!(iscaml(sc.ch) || sc.Match('\''))) {
const int n = sc.currentPos - chToken;
const Sci_Position n = sc.currentPos - chToken;
if (n < 24) {
// length is believable as keyword, [re-]construct token
char t[24];
for (int i = -n; i < 0; i++)
for (Sci_Position i = -n; i < 0; i++)
t[n + i] = static_cast<char>(sc.GetRelative(i));
t[n] = '\0';
// special-case "_" token as KEYWORD
@ -367,6 +370,7 @@ void ColouriseCamlDoc(
break;
}/* else
// fall through for SML char literal (handle like string) */
// Falls through.
case SCE_CAML_STRING:
// [try to] interpret as [additional] [SML char/] string literal char
@ -390,7 +394,7 @@ void ColouriseCamlDoc(
state2 = SCE_CAML_STRING, sc.ch = ' ' /* (...\") */, chColor++,
styler.ColourTo(chColor, SCE_CAML_WHITE), styler.Flush();
// ... then backtrack to determine original SML literal type
int p = chColor - 2;
Sci_Position p = chColor - 2;
for (; p >= 0 && styler.StyleAt(p) == SCE_CAML_WHITE; p--) ;
if (p >= 0)
state2 = static_cast<int>(styler.StyleAt(p));
@ -437,7 +441,7 @@ void ColouriseCamlDoc(
static
#endif /* BUILD_AS_EXTERNAL_LEXER */
void FoldCamlDoc(
unsigned int, int,
Sci_PositionU, Sci_Position,
int,
WordList *[],
Accessor &)

View File

@ -24,9 +24,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static bool isCmakeNumber(char ch)
{
@ -43,10 +41,10 @@ static bool isCmakeLetter(char ch)
return(ch >= 'A' && ch <= 'Z') || (ch >= 'a' && ch <= 'z');
}
static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor &styler)
static bool CmakeNextLineHasElse(Sci_PositionU start, Sci_PositionU end, Accessor &styler)
{
int nNextLine = -1;
for ( unsigned int i = start; i < end; i++ ) {
Sci_Position nNextLine = -1;
for ( Sci_PositionU i = start; i < end; i++ ) {
char cNext = styler.SafeGetCharAt( i );
if ( cNext == '\n' ) {
nNextLine = i+1;
@ -57,7 +55,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor
if ( nNextLine == -1 ) // We never foudn the next line...
return false;
for ( unsigned int firstChar = nNextLine; firstChar < end; firstChar++ ) {
for ( Sci_PositionU firstChar = nNextLine; firstChar < end; firstChar++ ) {
char cNext = styler.SafeGetCharAt( firstChar );
if ( cNext == ' ' )
continue;
@ -71,7 +69,7 @@ static bool CmakeNextLineHasElse(unsigned int start, unsigned int end, Accessor
return false;
}
static int calculateFoldCmake(unsigned int start, unsigned int end, int foldlevel, Accessor &styler, bool bElse)
static int calculateFoldCmake(Sci_PositionU start, Sci_PositionU end, int foldlevel, Accessor &styler, bool bElse)
{
// If the word is too long, it is not what we are looking for
if ( end - start > 20 )
@ -100,7 +98,7 @@ static int calculateFoldCmake(unsigned int start, unsigned int end, int foldleve
return newFoldlevel;
}
static int classifyWordCmake(unsigned int start, unsigned int end, WordList *keywordLists[], Accessor &styler )
static int classifyWordCmake(Sci_PositionU start, Sci_PositionU end, WordList *keywordLists[], Accessor &styler )
{
char word[100] = {0};
char lowercaseWord[100] = {0};
@ -109,7 +107,7 @@ static int classifyWordCmake(unsigned int start, unsigned int end, WordList *key
WordList &Parameters = *keywordLists[1];
WordList &UserDefined = *keywordLists[2];
for (unsigned int i = 0; i < end - start + 1 && i < 99; i++) {
for (Sci_PositionU i = 0; i < end - start + 1 && i < 99; i++) {
word[i] = static_cast<char>( styler[ start + i ] );
lowercaseWord[i] = static_cast<char>(tolower(word[i]));
}
@ -162,7 +160,7 @@ static int classifyWordCmake(unsigned int start, unsigned int end, WordList *key
return SCE_CMAKE_DEFAULT;
}
static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
static void ColouriseCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler)
{
int state = SCE_CMAKE_DEFAULT;
if ( startPos > 0 )
@ -171,14 +169,14 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
styler.StartAt( startPos );
styler.GetLine( startPos );
unsigned int nLengthDoc = startPos + length;
Sci_PositionU nLengthDoc = startPos + length;
styler.StartSegment( startPos );
char cCurrChar;
bool bVarInString = false;
bool bClassicVarInString = false;
unsigned int i;
Sci_PositionU i;
for ( i = startPos; i < nLengthDoc; i++ ) {
cCurrChar = styler.SafeGetCharAt( i );
char cNextChar = styler.SafeGetCharAt(i+1);
@ -263,8 +261,8 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
}
if ( cNextChar == '\r' || cNextChar == '\n' ) {
int nCurLine = styler.GetLine(i+1);
int nBack = i;
Sci_Position nCurLine = styler.GetLine(i+1);
Sci_Position nBack = i;
// We need to check if the previous line has a \ in it...
bool bNextLine = false;
@ -377,7 +375,7 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
styler.ColourTo(nLengthDoc-1,state);
}
static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], Accessor &styler)
static void FoldCmakeDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[], Accessor &styler)
{
// No folding enabled, no reason to continue...
if ( styler.GetPropertyInt("fold") == 0 )
@ -385,18 +383,18 @@ static void FoldCmakeDoc(unsigned int startPos, int length, int, WordList *[], A
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) == 1;
int lineCurrent = styler.GetLine(startPos);
unsigned int safeStartPos = styler.LineStart( lineCurrent );
Sci_Position lineCurrent = styler.GetLine(startPos);
Sci_PositionU safeStartPos = styler.LineStart( lineCurrent );
bool bArg1 = true;
int nWordStart = -1;
Sci_Position nWordStart = -1;
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
int levelNext = levelCurrent;
for (unsigned int i = safeStartPos; i < startPos + length; i++) {
for (Sci_PositionU i = safeStartPos; i < startPos + length; i++) {
char chCurr = styler.SafeGetCharAt(i);
if ( bArg1 ) {

View File

@ -14,7 +14,8 @@
#include <assert.h>
#include <ctype.h>
#include "Platform.h"
#include <algorithm>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
@ -26,9 +27,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static bool IsSpaceEquiv(int state) {
return (state == SCE_COFFEESCRIPT_DEFAULT
@ -40,6 +39,36 @@ static bool IsSpaceEquiv(int state) {
|| state == SCE_COFFEESCRIPT_REGEX);
}
// Store the current lexer state and brace count prior to starting a new
// `#{}` interpolation level.
// Based on LexRuby.cxx.
static void enterInnerExpression(int *p_inner_string_types,
int *p_inner_expn_brace_counts,
int& inner_string_count,
int state,
int& brace_counts
) {
p_inner_string_types[inner_string_count] = state;
p_inner_expn_brace_counts[inner_string_count] = brace_counts;
brace_counts = 0;
++inner_string_count;
}
// Restore the lexer state and brace count for the previous `#{}` interpolation
// level upon returning to it.
// Note the previous lexer state is the return value and needs to be restored
// manually by the StyleContext.
// Based on LexRuby.cxx.
static int exitInnerExpression(int *p_inner_string_types,
int *p_inner_expn_brace_counts,
int& inner_string_count,
int& brace_counts
) {
--inner_string_count;
brace_counts = p_inner_expn_brace_counts[inner_string_count];
return p_inner_string_types[inner_string_count];
}
// Preconditions: sc.currentPos points to a character after '+' or '-'.
// The test for pos reaching 0 should be redundant,
// and is in only for safety measures.
@ -48,7 +77,7 @@ static bool IsSpaceEquiv(int state) {
// Putting a space between the '++' post-inc operator and the '+' binary op
// fixes this, and is highly recommended for readability anyway.
static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) {
int pos = (int) sc.currentPos;
Sci_Position pos = (Sci_Position) sc.currentPos;
while (--pos > 0) {
char ch = styler[pos];
if (ch == '+' || ch == '-') {
@ -58,29 +87,21 @@ static bool FollowsPostfixOperator(StyleContext &sc, Accessor &styler) {
return false;
}
static bool followsReturnKeyword(StyleContext &sc, Accessor &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);
static bool followsKeyword(StyleContext &sc, Accessor &styler) {
Sci_Position pos = (Sci_Position) sc.currentPos;
Sci_Position currentLine = styler.GetLine(pos);
Sci_Position lineStartPos = styler.LineStart(currentLine);
while (--pos > lineStartPos) {
char 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;
styler.Flush();
return styler.StyleAt(pos) == SCE_COFFEESCRIPT_WORD;
}
static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
static void ColouriseCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
@ -96,10 +117,31 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
int chPrevNonWhite = ' ';
int visibleChars = 0;
// String/Regex interpolation variables, based on LexRuby.cxx.
// In most cases a value of 2 should be ample for the code the user is
// likely to enter. For example,
// "Filling the #{container} with #{liquid}..."
// from the CoffeeScript homepage nests to a level of 2
// If the user actually hits a 6th occurrence of '#{' in a double-quoted
// string (including regexes), it will stay as a string. The problem with
// this is that quotes might flip, a 7th '#{' will look like a comment,
// and code-folding might be wrong.
#define INNER_STRINGS_MAX_COUNT 5
// These vars track our instances of "...#{,,,'..#{,,,}...',,,}..."
int inner_string_types[INNER_STRINGS_MAX_COUNT];
// Track # braces when we push a new #{ thing
int inner_expn_brace_counts[INNER_STRINGS_MAX_COUNT];
int inner_string_count = 0;
int brace_counts = 0; // Number of #{ ... } things within an expression
for (int i = 0; i < INNER_STRINGS_MAX_COUNT; i++) {
inner_string_types[i] = 0;
inner_expn_brace_counts[i] = 0;
}
// look back to set chPrevNonWhite properly for better regex colouring
int endPos = startPos + length;
Sci_Position endPos = startPos + length;
if (startPos > 0 && IsSpaceEquiv(initStyle)) {
unsigned int back = startPos;
Sci_PositionU back = startPos;
styler.Flush();
while (back > 0 && IsSpaceEquiv(styler.StyleAt(--back)))
;
@ -117,7 +159,7 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
StyleContext sc(startPos, endPos - startPos, initStyle, styler);
for (; sc.More(); sc.Forward()) {
for (; sc.More();) {
if (sc.atLineStart) {
// Reset states to beginning of colourise so no surprises
@ -146,6 +188,8 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
sc.ChangeState(SCE_COFFEESCRIPT_WORD2);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_COFFEESCRIPT_GLOBALCLASS);
} else if (sc.LengthCurrent() > 0 && s[0] == '@') {
sc.ChangeState(SCE_COFFEESCRIPT_INSTANCEPROPERTY);
}
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
@ -153,6 +197,7 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
case SCE_COFFEESCRIPT_WORD:
case SCE_COFFEESCRIPT_WORD2:
case SCE_COFFEESCRIPT_GLOBALCLASS:
case SCE_COFFEESCRIPT_INSTANCEPROPERTY:
if (!setWord.Contains(sc.ch)) {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
@ -169,6 +214,15 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (sc.ch == '#' && sc.chNext == '{' && inner_string_count < INNER_STRINGS_MAX_COUNT) {
// process interpolated code #{ ... }
enterInnerExpression(inner_string_types,
inner_expn_brace_counts,
inner_string_count,
sc.state,
brace_counts);
sc.SetState(SCE_COFFEESCRIPT_OPERATOR);
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_COFFEESCRIPT_CHARACTER:
@ -239,7 +293,7 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
sc.Forward();
} else if (sc.ch == '/'
&& (setOKBeforeRE.Contains(chPrevNonWhite)
|| followsReturnKeyword(sc, styler))
|| followsKeyword(sc, styler))
&& (!setCouldBePostOp.Contains(chPrevNonWhite)
|| !FollowsPostfixOperator(sc, styler))) {
sc.SetState(SCE_COFFEESCRIPT_REGEX); // JavaScript's RegEx
@ -257,6 +311,19 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
}
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_COFFEESCRIPT_OPERATOR);
// Handle '..' and '...' operators correctly.
if (sc.ch == '.') {
for (int i = 0; i < 2 && sc.chNext == '.'; i++, sc.Forward()) ;
} else if (sc.ch == '{') {
++brace_counts;
} else if (sc.ch == '}' && --brace_counts <= 0 && inner_string_count > 0) {
// Return to previous state before #{ ... }
sc.ForwardSetState(exitInnerExpression(inner_string_types,
inner_expn_brace_counts,
inner_string_count,
brace_counts));
continue; // skip sc.Forward() at loop end
}
}
}
@ -264,14 +331,15 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
chPrevNonWhite = sc.ch;
visibleChars++;
}
sc.Forward();
}
sc.Complete();
}
static bool IsCommentLine(int line, Accessor &styler) {
int pos = styler.LineStart(line);
int eol_pos = styler.LineStart(line + 1) - 1;
for (int i = pos; i < eol_pos; i++) {
static bool IsCommentLine(Sci_Position line, Accessor &styler) {
Sci_Position pos = styler.LineStart(line);
Sci_Position eol_pos = styler.LineStart(line + 1) - 1;
for (Sci_Position i = pos; i < eol_pos; i++) {
char ch = styler[i];
if (ch == '#')
return true;
@ -281,12 +349,12 @@ static bool IsCommentLine(int line, Accessor &styler) {
return false;
}
static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
static void FoldCoffeeScriptDoc(Sci_PositionU startPos, Sci_Position length, int,
WordList *[], Accessor &styler) {
// A simplified version of FoldPyDoc
const int maxPos = startPos + length;
const int maxLines = styler.GetLine(maxPos - 1); // Requested last line
const int docLines = styler.GetLine(styler.Length() - 1); // Available last line
const Sci_Position maxPos = startPos + length;
const Sci_Position maxLines = styler.GetLine(maxPos - 1); // Requested last line
const Sci_Position docLines = styler.GetLine(styler.Length() - 1); // Available last line
// property fold.coffeescript.comment
const bool foldComment = styler.GetPropertyInt("fold.coffeescript.comment") != 0;
@ -298,7 +366,7 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
// and so we can fix any preceding fold level (which is why we go back
// at least one line in all cases)
int spaceFlags = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int indentCurrent = styler.IndentAmount(lineCurrent, &spaceFlags, NULL);
while (lineCurrent > 0) {
lineCurrent--;
@ -321,7 +389,7 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
// Gather info
int lev = indentCurrent;
int lineNext = lineCurrent + 1;
Sci_Position lineNext = lineCurrent + 1;
int indentNext = indentCurrent;
if (lineNext <= docLines) {
// Information about next line is only available if not at end of document
@ -358,14 +426,14 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
}
const int levelAfterComments = indentNext & SC_FOLDLEVELNUMBERMASK;
const int levelBeforeComments = Platform::Maximum(indentCurrentLevel,levelAfterComments);
const int levelBeforeComments = std::max(indentCurrentLevel,levelAfterComments);
// Now set all the indent levels on the lines we skipped
// Do this from end to start. Once we encounter one line
// which is indented more than the line after the end of
// the comment-block, use the level of the block before
int skipLine = lineNext;
Sci_Position skipLine = lineNext;
int skipLevel = levelAfterComments;
while (--skipLine > lineCurrent) {

View File

@ -27,18 +27,16 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *keywordLists[], Accessor &styler)
static void ColouriseConfDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *keywordLists[], Accessor &styler)
{
int state = SCE_CONF_DEFAULT;
char chNext = styler[startPos];
int lengthDoc = startPos + length;
Sci_Position lengthDoc = startPos + length;
// create a buffer large enough to take the largest chunk...
char *buffer = new char[length+1];
int bufferCount = 0;
Sci_Position bufferCount = 0;
// this assumes that we have 2 keyword list in conf.properties
WordList &directives = *keywordLists[0];
@ -48,7 +46,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
// using the hand-written state machine shown below
styler.StartAt(startPos);
styler.StartSegment(startPos);
for (int i = startPos; i < lengthDoc; i++) {
for (Sci_Position i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);

View File

@ -25,19 +25,17 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordList
static void ColouriseNncrontabDoc(Sci_PositionU startPos, Sci_Position length, int, WordList
*keywordLists[], Accessor &styler)
{
int state = SCE_NNCRONTAB_DEFAULT;
char chNext = styler[startPos];
int lengthDoc = startPos + length;
Sci_Position lengthDoc = startPos + length;
// create a buffer large enough to take the largest chunk...
char *buffer = new char[length+1];
int bufferCount = 0;
Sci_Position bufferCount = 0;
// used when highliting environment variables inside quoted string:
bool insideString = false;
@ -50,7 +48,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
// using the hand-written state machine shown below
styler.StartAt(startPos);
styler.StartSegment(startPos);
for (int i = startPos; i < lengthDoc; i++) {
for (Sci_Position i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);

View File

@ -24,9 +24,7 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
@ -51,7 +49,7 @@ static inline bool IsCsoundOperator(char ch) {
return false;
}
static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
static void ColouriseCsoundDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &opcode = *keywordlists[0];
@ -150,17 +148,17 @@ static void ColouriseCsoundDoc(unsigned int startPos, int length, int initStyle,
sc.Complete();
}
static void FoldCsoundInstruments(unsigned int startPos, int length, int /* initStyle */, WordList *[],
static void FoldCsoundInstruments(Sci_PositionU startPos, Sci_Position length, int /* initStyle */, WordList *[],
Accessor &styler) {
unsigned int lengthDoc = startPos + length;
Sci_PositionU lengthDoc = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int stylePrev = 0;
int styleNext = styler.StyleAt(startPos);
for (unsigned int i = startPos; i < lengthDoc; i++) {
for (Sci_PositionU i = startPos; i < lengthDoc; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;

View File

@ -27,10 +27,9 @@
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "DefaultLexer.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/* Nested comments require keeping the value of the nesting level for every
position in the document. But since scintilla always styles line by line,
@ -145,7 +144,7 @@ struct OptionSetD : public OptionSet<OptionsD> {
}
};
class LexerD : public ILexer {
class LexerD : public DefaultLexer {
bool caseSensitive;
WordList keywords;
WordList keywords2;
@ -162,49 +161,49 @@ public:
}
virtual ~LexerD() {
}
void SCI_METHOD Release() {
void SCI_METHOD Release() override {
delete this;
}
int SCI_METHOD Version() const {
return lvOriginal;
int SCI_METHOD Version() const override {
return lvRelease4;
}
const char * SCI_METHOD PropertyNames() {
const char * SCI_METHOD PropertyNames() override {
return osD.PropertyNames();
}
int SCI_METHOD PropertyType(const char *name) {
int SCI_METHOD PropertyType(const char *name) override {
return osD.PropertyType(name);
}
const char * SCI_METHOD DescribeProperty(const char *name) {
const char * SCI_METHOD DescribeProperty(const char *name) override {
return osD.DescribeProperty(name);
}
int SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) override;
const char * SCI_METHOD DescribeWordListSets() override {
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);
Sci_Position SCI_METHOD WordListSet(int n, const char *wl) override;
void SCI_METHOD Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void SCI_METHOD Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) override;
void * SCI_METHOD PrivateCall(int, void *) {
void * SCI_METHOD PrivateCall(int, void *) override {
return 0;
}
static ILexer *LexerFactoryD() {
static ILexer4 *LexerFactoryD() {
return new LexerD(true);
}
static ILexer *LexerFactoryDInsensitive() {
static ILexer4 *LexerFactoryDInsensitive() {
return new LexerD(false);
}
};
int SCI_METHOD LexerD::PropertySet(const char *key, const char *val) {
Sci_Position 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) {
Sci_Position SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
@ -229,7 +228,7 @@ int SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
wordListN = &keywords7;
break;
}
int firstModification = -1;
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
@ -241,14 +240,14 @@ int SCI_METHOD LexerD::WordListSet(int n, const char *wl) {
return firstModification;
}
void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
void SCI_METHOD LexerD::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
LexAccessor styler(pAccess);
int styleBeforeDCKeyword = SCE_D_DEFAULT;
StyleContext sc(startPos, length, initStyle, styler);
int curLine = styler.GetLine(startPos);
Sci_Position curLine = styler.GetLine(startPos);
int curNcLevel = curLine > 0? styler.GetLineState(curLine-1): 0;
bool numFloat = false; // Float literals have '+' and '-' signs
bool numHex = false;
@ -471,16 +470,16 @@ void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, ID
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
void SCI_METHOD LexerD::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
void SCI_METHOD LexerD::Fold(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
unsigned int endPos = startPos + length;
Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
@ -491,7 +490,7 @@ void SCI_METHOD LexerD::Fold(unsigned int startPos, int length, int initStyle, I
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++) {
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;

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