[UPGRADE] Upgrade Scintilla from v3.34 to v3.56.

This commit is contained in:
Don Ho 2015-06-07 23:19:26 +02:00
parent aa944fdfe3
commit 4ac665d0ce
231 changed files with 32093 additions and 10354 deletions

View File

@ -40,8 +40,8 @@ The current make file only supports static linking between SciTE and Scintilla.
*** Windows version ***
A C++ compiler is required. Visual Studio .NET 2010 is the development system
used for most development although TDM Mingw32 4.4.1 is also supported.
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.
To build Scintilla, make in the scintilla/win32 directory
cd scintilla\win32
@ -54,10 +54,7 @@ To build SciTE, use the makefiles located in the scite/win32 directory
GCC: mingw32-make
VS .NET: nmake -f scite.mak
An executable SciTE will now be in scite\bin.
The Visual C++ 6.0 project (.dsp) and make files are no longer supported but are left
in the download for people that are prepared to update them.
An executable SciTE will now be in scite/bin.
*** GTK+/Windows version ***

View File

@ -1,71 +0,0 @@
### start defines ###
include common.mk
INST_NAME=-install_name \
@executable_path/../Frameworks/Sci.framework/Versions/A/Sci
LD=gcc $(ARCH) -dynamiclib -framework Cocoa $(INST_NAME)
LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx))))
SCI_LEXERS=$(LEXOBJS) \
LexerBase.o LexerModule.o LexerSimple.o Accessor.o
SCI_OBJ=AutoComplete.o CallTip.o CellBuffer.o CharClassify.o \
ContractionState.o Decoration.o Document.o Editor.o \
ExternalLexer.o Indicator.o KeyMap.o LineMarker.o PerLine.o \
PositionCache.o PropSetSimple.o RESearch.o RunStyles.o ScintillaBase.o Style.o \
StyleContext.o UniConversion.o ViewStyle.o XPM.o WordList.o \
Selection.o CharacterSet.o Catalogue.o $(SCI_LEXERS)
WAH_OBJ=DocumentAccessor.o KeyWords.o WindowAccessor.o
COC_OBJ=PlatCocoa.o ScintillaCocoa.o ScintillaView.o InfoBar.o
OBJ=$(SCI_OBJ) $(UNUSED_OBJ) $(COC_OBJ)
OBJS=$(addprefix $(FRM_BLD)/,$(OBJ))
TARG=$(APP)/Versions/A/Sci
APP=$(FRM_BLD)/Sci.framework
### end defines ###
### start targets ###
all: $(FRM_BLD) $(TARG)
cleanfrm:
-rm -rf $(FRM_BLD)
$(APP): $(FRM_BLD)
-rm -rf $(APP)
-mkdir $(APP)
-mkdir $(APP)/Versions
-mkdir $(APP)/Versions/A
-mkdir $(APP)/Versions/A/Headers
-mkdir $(APP)/Versions/A/Resources
-ln -sf `pwd`/$(APP)/Versions/A `pwd`/$(APP)/Versions/Current
-ln -sf `pwd`/$(APP)/Versions/A/Headers `pwd`/$(APP)/Headers
-ln -sf `pwd`/$(APP)/Versions/A/Resources `pwd`/$(APP)/Resources
-cp *.h $(APP)/Headers/
-cp ../src/*.h $(APP)/Headers/
-cp ../include/*.h $(APP)/Headers/
-cp -R ScintillaFramework/English.lproj $(APP)/Resources
-cp res/*.png $(APP)/Resources
-cp ScintillaFramework/Info.plist $(APP)/Resources
$(TARG) : $(OBJS) $(APP)
$(LD) $(OBJS) $(gDEFs) -o $(TARG) -lstdc++
-ln `pwd`/$(TARG) `pwd`/$(APP)/Sci
$(FRM_BLD):
-mkdir $(BLD)
-mkdir $(FRM_BLD)
### get around to filling out the real dependencies later ###
#$(FRM_BLD)/AutoComplete.o : ../src/AutoComplete.cxx ../src/AutoComplete.h \
# ../include/Platform.h
#$(FRM_BLD)/CallTip.o : ../src/CallTip.cxx ../src/CallTip.h \
# ../include/Platform.h
### end targets ###

View File

@ -28,15 +28,15 @@
@private
NSImage* mBackground;
IBDisplay mDisplayMask;
float mScaleFactor;
NSPopUpButton* mZoomPopup;
int mCurrentCaretX;
int mCurrentCaretY;
NSTextField* mCaretPositionLabel;
NSTextField* mStatusTextLabel;
id <InfoBarCommunicator> mCallback;
}

View File

@ -22,7 +22,7 @@
{
// 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.
@ -30,26 +30,26 @@
{
// Get our ideal size for current text
NSSize textSize = [self cellSizeForBounds: theRect];
// Center that in the proposed rect
float heightDelta = newRect.size.height - textSize.height;
CGFloat heightDelta = newRect.size.height - textSize.height;
if (heightDelta > 0)
{
newRect.size.height -= heightDelta;
newRect.origin.y += ceil(heightDelta / 2);
}
}
return newRect;
}
//--------------------------------------------------------------------------------------------------
- (void) selectWithFrame: (NSRect) aRect inView: (NSView*) controlView editor: (NSText*) textObj
- (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;
mIsEditingOrSelecting = YES;
[super selectWithFrame: aRect
inView: controlView
editor: textObj
@ -63,7 +63,7 @@
- (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
@ -86,8 +86,8 @@
if (self)
{
NSBundle* bundle = [NSBundle bundleForClass: [InfoBar class]];
NSString* path = [bundle pathForResource: @"info_bar_bg" ofType: @"png" inDirectory: nil];
NSString* path = [bundle pathForResource: @"info_bar_bg" ofType: @"tiff" inDirectory: nil];
mBackground = [[NSImage alloc] initWithContentsOfFile: path];
if (![mBackground isValid])
NSLog(@"Background image for info bar is invalid.");
@ -103,12 +103,12 @@
//--------------------------------------------------------------------------------------------------
/**
* Called by a connected compontent (usually the info bar) if something changed there.
* Called by a connected component (usually the info bar) if something changed there.
*
* @param type The type of the notification.
* @param message Carries the new status message if the type is a status message change.
* @param location Carries the new location (e.g. caret) if the type is a caret change or similar type.
* @param location Carries the new zoom value if the type is a zoom change.
* @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
@ -143,7 +143,7 @@ static NSString *DefaultScaleMenuLabels[] = {
@"20%", @"30%", @"50%", @"75%", @"100%", @"130%", @"160%", @"200%", @"250%", @"300%"
};
static float DefaultScaleMenuFactors[] = {
0.2, 0.3, 0.5, 0.75, 1.0, 1.3, 1.6, 2.0, 2.5, 3.0
0.2f, 0.3f, 0.5f, 0.75f, 1.0f, 1.3f, 1.6f, 2.0f, 2.5f, 3.0f
};
static unsigned DefaultScaleMenuSelectedItemIndex = 4;
static float BarFontSize = 10.0;
@ -152,14 +152,14 @@ static float BarFontSize = 10.0;
{
// 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];
// No border or background please.
[[mZoomPopup cell] setBordered: NO];
[[mZoomPopup cell] setArrowPosition: NSPopUpArrowAtBottom];
// Fill it.
for (unsigned count = 0; count < numberOfDefaultItems; count++)
{
@ -169,28 +169,28 @@ static float BarFontSize = 10.0;
[currentItem setRepresentedObject: [NSNumber numberWithFloat: DefaultScaleMenuFactors[count]]];
}
[mZoomPopup selectItemAtIndex: DefaultScaleMenuSelectedItemIndex];
// Hook it up.
[mZoomPopup setTarget: self];
[mZoomPopup setAction: @selector(zoomItemAction:)];
// Set a suitable font.
[mZoomPopup setFont: [NSFont menuBarFontOfSize: BarFontSize]];
// Make sure the popup is big enough to fit the cells.
[mZoomPopup sizeToFit];
// Don't let it become first responder
[mZoomPopup setRefusesFirstResponder: YES];
// put it in the scrollview.
[self addSubview: mZoomPopup];
[mZoomPopup release];
// 2) The caret position label.
Class oldCellClass = [NSTextField cellClass];
[NSTextField setCellClass: [VerticallyCenteredTextFieldCell class]];
mCaretPositionLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 50.0, 1.0)];
[mCaretPositionLabel setBezeled: NO];
[mCaretPositionLabel setBordered: NO];
@ -205,7 +205,7 @@ static float BarFontSize = 10.0;
[self addSubview: mCaretPositionLabel];
[mCaretPositionLabel release];
// 3) The status text.
mStatusTextLabel = [[NSTextField alloc] initWithFrame: NSMakeRect(0.0, 0.0, 1.0, 1.0)];
[mStatusTextLabel setBezeled: NO];
@ -220,7 +220,7 @@ static float BarFontSize = 10.0;
[self addSubview: mStatusTextLabel];
[mStatusTextLabel release];
// Restore original cell class so that everything else doesn't get broken
[NSTextField setCellClass: oldCellClass];
}
@ -248,12 +248,12 @@ static float BarFontSize = 10.0;
[mBackground drawAtPoint: target fromRect: NSZeroRect operation: NSCompositeCopy fraction: 1];
target.x += mBackground.size.width;
}
// Draw separator lines between items.
NSRect verticalLineRect;
float component = 190.0 / 255.0;
CGFloat component = 190.0 / 255.0;
NSColor* lineColor = [NSColor colorWithDeviceRed: component green: component blue: component alpha: 1];
if (mDisplayMask & IBShowZoom)
{
verticalLineRect = [mZoomPopup frame];
@ -265,7 +265,7 @@ static float BarFontSize = 10.0;
NSRectFill(verticalLineRect);
}
}
if (mDisplayMask & IBShowCaretPosition)
{
verticalLineRect = [mCaretPositionLabel frame];
@ -301,7 +301,7 @@ static float BarFontSize = 10.0;
- (void) positionSubViews
{
NSRect currentBounds = {0, 0, 0, [self frame].size.height};
NSRect currentBounds = {{0, 0}, {0, [self frame].size.height}};
if (mDisplayMask & IBShowZoom)
{
[mZoomPopup setHidden: NO];
@ -347,7 +347,7 @@ static float BarFontSize = 10.0;
mDisplayMask = display;
[self positionSubViews];
[self needsDisplay];
}
}
}
//--------------------------------------------------------------------------------------------------
@ -358,7 +358,7 @@ static float BarFontSize = 10.0;
- (void) zoomItemAction: (id) sender
{
NSNumber* selectedFactorObject = [[sender selectedCell] representedObject];
if (selectedFactorObject == nil)
{
NSLog(@"Scale popup action: setting arbitrary zoom factors is not yet supported.");
@ -369,9 +369,9 @@ static float BarFontSize = 10.0;
[self setScaleFactor: [selectedFactorObject floatValue] adjustPopup: NO];
}
}
//--------------------------------------------------------------------------------------------------
- (void) setScaleFactor: (float) newScaleFactor adjustPopup: (BOOL) flag
{
if (mScaleFactor != newScaleFactor)
@ -381,7 +381,7 @@ static float BarFontSize = 10.0;
{
unsigned count = 0;
unsigned numberOfDefaultItems = sizeof(DefaultScaleMenuFactors) / sizeof(float);
// We only work with some preset zoom values. If the given value does not correspond
// to one then show no selection.
while (count < numberOfDefaultItems && (fabs(newScaleFactor - DefaultScaleMenuFactors[count]) > 0.07))
@ -391,7 +391,7 @@ static float BarFontSize = 10.0;
else
{
[mZoomPopup selectItemAtIndex: count];
// Set scale factor to found preset value if it comes close.
mScaleFactor = DefaultScaleMenuFactors[count];
}
@ -400,7 +400,7 @@ static float BarFontSize = 10.0;
{
// Internally set. Notify owner.
[mCallback notify: IBNZoomChanged message: nil location: NSZeroPoint value: newScaleFactor];
}
}
}
}
@ -414,12 +414,12 @@ static float BarFontSize = 10.0;
// Make the position one-based.
int newX = (int) position.x + 1;
int newY = (int) position.y + 1;
if (mCurrentCaretX != newX || mCurrentCaretY != newY)
{
mCurrentCaretX = newX;
mCurrentCaretY = newY;
[mCaretPositionLabel setStringValue: [NSString stringWithFormat: @"%d:%d", newX, newY]];
}
}
@ -427,7 +427,7 @@ static float BarFontSize = 10.0;
//--------------------------------------------------------------------------------------------------
/**
* Makes the bar resize to the smallest width that can accomodate the currently enabled items.
* Makes the bar resize to the smallest width that can accommodate the currently enabled items.
*/
- (void) sizeToFit
{
@ -435,13 +435,13 @@ static float BarFontSize = 10.0;
frame.size.width = 0;
if (mDisplayMask & IBShowZoom)
frame.size.width += [mZoomPopup frame].size.width;
if (mDisplayMask & IBShowCaretPosition)
frame.size.width += [mCaretPositionLabel frame].size.width;
if (mDisplayMask & IBShowStatusText)
frame.size.width += [mStatusTextLabel frame].size.width;
[self setFrame: frame];
}

View File

@ -8,7 +8,7 @@
* This file is dual licensed under LGPL v2.1 and the Scintilla license (http://www.scintilla.org/License.txt).
*/
enum IBDisplay {
typedef NS_OPTIONS(NSUInteger, IBDisplay) {
IBShowZoom = 0x01,
IBShowCaretPosition = 0x02,
IBShowStatusText = 0x04,
@ -21,7 +21,7 @@ enum IBDisplay {
* ScintillaView implementation. The protocol is used two-way.
*/
enum NotificationType {
typedef NS_ENUM(NSInteger, NotificationType) {
IBNZoomChanged, // The user selected another zoom value.
IBNCaretChanged, // The caret in the editor changed.
IBNStatusChanged, // The application set a new status message.

View File

@ -7,14 +7,14 @@
#ifndef PLATCOCOA_H
#define PLATCOCOA_H
#include <cstring>
#include <cstdio>
#include <cstdlib>
#include <assert.h>
#include <sys/time.h>
#include <cstdlib>
#include <cstring>
#include <cstdio>
#include <Cocoa/Cocoa.h>
#include "QuartzTextLayout.h"
@ -50,7 +50,7 @@ private:
QuartzTextLayout* textLayout;
int codePage;
int verticalDeviceResolution;
/** If the surface is a bitmap context, contains a reference to the bitmap data. */
uint8_t* bitmapData;
/** If the surface is a bitmap context, stores the dimensions of the bitmap. */
@ -98,7 +98,7 @@ public:
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,
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);
@ -117,7 +117,7 @@ public:
void SetUnicodeMode(bool unicodeMode_);
void SetDBCSMode(int codePage_);
}; // SurfaceImpl class
} // Scintilla namespace
#endif

File diff suppressed because it is too large Load Diff

View File

@ -20,7 +20,7 @@ class QuartzTextLayout
{
public:
/** Create a text layout for drawing on the specified context. */
QuartzTextLayout( CGContextRef context )
explicit QuartzTextLayout( CGContextRef context )
{
mString = NULL;
mLine = NULL;
@ -39,7 +39,7 @@ public:
{
CFRelease(mLine);
mLine = NULL;
}
}
}
inline void setText( const UInt8* buffer, size_t byteLength, CFStringEncoding encoding, const QuartzTextStyle& r )
@ -47,19 +47,19 @@ public:
CFStringRef str = CFStringCreateWithBytes( NULL, buffer, byteLength, encoding, false );
if (!str)
return;
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 );
}
@ -70,28 +70,28 @@ public:
{
if (mLine == NULL)
return;
::CGContextSetTextMatrix(gc, CGAffineTransformMakeScale(1.0, -1.0));
// Set the text drawing position.
::CGContextSetTextPosition(gc, x, y);
// And finally, draw!
::CTLineDraw(mLine, gc);
}
float MeasureStringWidth()
{
{
if (mLine == NULL)
return 0.0f;
return ::CTLineGetTypographicBounds(mLine, NULL, NULL, NULL);
return static_cast<float>(::CTLineGetTypographicBounds(mLine, NULL, NULL, NULL));
}
CTLineRef getCTLine() {
return mLine;
}
CFIndex getStringLength() {
return stringLength;
}

View File

@ -61,17 +61,17 @@ public:
float getAscent() const
{
return ::CTFontGetAscent(fontRef);
return static_cast<float>(::CTFontGetAscent(fontRef));
}
float getDescent() const
{
return ::CTFontGetDescent(fontRef);
return static_cast<float>(::CTFontGetDescent(fontRef));
}
float getLeading() const
{
return ::CTFontGetLeading(fontRef);
return static_cast<float>(::CTFontGetLeading(fontRef));
}
void setFontRef(CTFontRef inRef, int characterSet_)

View File

@ -1,36 +0,0 @@
### start defines ###
include common.mk
NAME=Demo
LD=gcc $(ARCH) -framework Cocoa
TARG=$(APP)/Contents/MacOS/$(NAME)
APP=$(APP_BLD)/$(NAME).app
all: $(APP_BLD) $(TARG)
$(APP):
-rm -rf $(APP)
-mkdir $(APP)
-mkdir $(APP)/Contents/
-mkdir $(APP)/Contents/Frameworks/
-mkdir $(APP)/Contents/MacOS/
-mkdir $(APP)/Contents/Resources/
-cp ScintillaTest/Info.plist $(APP)/Contents/Info.plist.bak
-sed "s/\$${EXECUTABLE_NAME}/$(NAME)/g" < $(APP)/Contents/Info.plist.bak > $(APP)/Contents/Info.plist.bak2
-sed "s/\$${PRODUCT_NAME}/$(NAME)/g" < $(APP)/Contents/Info.plist.bak2 > $(APP)/Contents/Info.plist
-rm $(APP)/Contents/Info.plist.bak $(APP)/Contents/Info.plist.bak2
-cp -r ScintillaTest/English.lproj $(APP)/Contents/Resources/
/Developer/usr/bin/ibtool --errors --warnings --notices --output-format human-readable-text \
--compile $(APP)/Contents/Resources/English.lproj/MainMenu.nib ScintillaTest/English.lproj/MainMenu.xib
-cp ScintillaTest/TestData.sql $(APP)/Contents/Resources/
-make -f Framework.mk all
$(TARG) : $(APP_BLD)/main.o $(APP_BLD)/AppController.o $(APP)
-cp -R $(FRM_BLD)/Sci.framework $(APP)/Contents/Frameworks/
$(LD) $(APP_BLD)/main.o $(APP_BLD)/AppController.o $(APP)/Contents/Frameworks/Sci.framework/Sci -o $(TARG) -lstdc++
$(APP_BLD) :
-mkdir $(BLD)
-mkdir $(APP_BLD)

View File

@ -14,11 +14,12 @@
*/
#include <stdlib.h>
#include <string>
#include <stdio.h>
#include <ctype.h>
#include <time.h>
#include <ctype.h>
#include <stdexcept>
#include <string>
#include <vector>
#include <map>
@ -40,23 +41,26 @@
#include "XPM.h"
#include "LineMarker.h"
#include "Style.h"
#include "AutoComplete.h"
#include "ViewStyle.h"
#include "CharClassify.h"
#include "Decoration.h"
#include "CaseFolder.h"
#include "Document.h"
#include "CaseConvert.h"
#include "Selection.h"
#include "PositionCache.h"
#include "EditModel.h"
#include "MarginView.h"
#include "EditView.h"
#include "Editor.h"
#include "AutoComplete.h"
#include "ScintillaBase.h"
#include "CaseConvert.h"
extern "C" NSString* ScintillaRecPboardType;
@class InnerView;
@class MarginView;
@class SCIContentView;
@class SCIMarginView;
@class ScintillaView;
@class FindHighlightLayer;
@ -77,26 +81,6 @@ extern "C" NSString* ScintillaRecPboardType;
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
* like a Windows WndProc, where Scintilla can send notifications to. Use
* ScintillaCocoa::RegisterNotifyHandler() to register such a handler.
* Message format is:
* <br>
* WM_COMMAND: HIWORD (wParam) = notification code, LOWORD (wParam) = 0 (no control ID), lParam = ScintillaCocoa*
* <br>
* WM_NOTIFY: wParam = 0 (no 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);
/**
* Scintilla sends these two messages to the nofity handler. Please refer
* to the Windows API doc for details about the message format.
*/
#define WM_COMMAND 1001
#define WM_NOTIFY 1002
/**
* Main scintilla class, implemented for OS X (Cocoa).
*/
@ -105,7 +89,9 @@ class ScintillaCocoa : public ScintillaBase
private:
TimerTarget* timerTarget;
NSEvent* lastMouseEvent;
id<ScintillaNotificationProtocol> delegate;
SciNotifyFunc notifyProc;
intptr_t notifyObj;
@ -119,20 +105,26 @@ private:
bool GetPasteboardData(NSPasteboard* board, SelectionText* selectedText);
void SetPasteboardData(NSPasteboard* board, const SelectionText& selectedText);
int TargetAsUTF8(char *text);
int EncodedFromUTF8(char *utf8, char *encoded) const;
int scrollSpeed;
int scrollTicks;
NSTimer* tickTimer;
NSTimer* idleTimer;
CFRunLoopObserverRef observer;
FindHighlightLayer *layerFindIndicator;
protected:
Point GetVisibleOriginInMain();
PRectangle GetClientRectangle();
Point GetVisibleOriginInMain() const;
PRectangle GetClientRectangle() const;
virtual PRectangle GetClientDrawingRectangle();
Point ConvertPoint(NSPoint point);
virtual void RedrawRect(PRectangle rc);
virtual void DiscardOverdraw();
virtual void Redraw();
virtual void Initialise();
virtual void Finalise();
virtual CaseFolder *CaseFolderForEncoding();
@ -140,25 +132,30 @@ protected:
virtual void CancelModes();
public:
ScintillaCocoa(InnerView* view, MarginView* viewMargin);
ScintillaCocoa(SCIContentView* view, SCIMarginView* viewMargin);
virtual ~ScintillaCocoa();
void SetDelegate(id<ScintillaNotificationProtocol> delegate_);
void RegisterNotifyCallback(intptr_t windowid, SciNotifyFunc callback);
sptr_t WndProc(unsigned int iMessage, uptr_t wParam, sptr_t lParam);
ScintillaView* TopContainer();
NSScrollView* ScrollContainer();
InnerView* ContentView();
NSScrollView* ScrollContainer() const;
SCIContentView* ContentView();
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 SetTicking(bool on);
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();
void WillDraw(NSRect rect);
void ScrollText(int linesToMove);
void SetVerticalScrollPos();
void SetHorizontalScrollPos();
@ -188,9 +185,10 @@ public:
virtual void ClaimSelection();
NSPoint GetCaretPosition();
static sptr_t DirectFunction(ScintillaCocoa *sciThis, unsigned int iMessage, uptr_t wParam, sptr_t lParam);
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 IdleTimerFired();
static void UpdateObserver(CFRunLoopObserverRef observer, CFRunLoopActivity activity, void *sci);
@ -199,7 +197,14 @@ public:
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 SelectOnlyMainSelection();
void ConvertSelectionVirtualSpace();
bool ClearAllSelections();
void CompositionStart();
void CompositionCommit();
void CompositionUndo();
virtual void SetDocPointer(Document *document);
bool KeyboardInput(NSEvent* event);
@ -218,14 +223,14 @@ public:
void DraggingExited(id <NSDraggingInfo> info);
bool PerformDragOperation(id <NSDraggingInfo> info);
void DragScroll();
// Promote some methods needed for NSResponder actions.
virtual void SelectAll();
void DeleteBackward();
virtual void Cut();
virtual void Undo();
virtual void Redo();
virtual NSMenu* CreateContextMenu(NSEvent* event);
void HandleCommand(NSInteger command);

File diff suppressed because it is too large Load Diff

View File

@ -167,6 +167,7 @@
1152A77315313E58000D4E1A /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1152A77215313E58000D4E1A /* QuartzCore.framework */; };
11594BE9155B91DF0099E1FA /* LexOScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11594BE7155B91DF0099E1FA /* LexOScript.cxx */; };
11594BEA155B91DF0099E1FA /* LexVisualProlog.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11594BE8155B91DF0099E1FA /* LexVisualProlog.cxx */; };
1160E0381803651C00BCEBCB /* LexRust.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 1160E0371803651C00BCEBCB /* LexRust.cxx */; };
117ACE9114A29A1E002876F9 /* LexTCMD.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 117ACE9014A29A1E002876F9 /* LexTCMD.cxx */; };
119FF1BF13C9D1820007CE42 /* QuartzTextStyle.h in Headers */ = {isa = PBXBuildFile; fileRef = 119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */; };
11A0A8A1148602DF0018D143 /* LexCoffeeScript.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */; };
@ -176,6 +177,8 @@
11FBA39D17817DA00048C071 /* CharacterCategory.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FBA39B17817DA00048C071 /* CharacterCategory.cxx */; };
11FBA39E17817DA00048C071 /* CharacterCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = 11FBA39C17817DA00048C071 /* CharacterCategory.h */; };
11FDAEB7174E1A9800FA161B /* LexSTTXT.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FDAEB6174E1A9700FA161B /* LexSTTXT.cxx */; };
11FDD0E017C480D4001541B9 /* LexKVIrc.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */; };
11FF3FE21810EB3900E13F13 /* LexDMAP.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */; };
2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59D0FC168A100E85C33 /* InfoBar.h */; settings = {ATTRIBUTES = (Public, ); }; };
2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A30FC168A100E85C33 /* ScintillaView.h */; settings = {ATTRIBUTES = (Public, ); }; };
2744E5AC0FC168B200E85C33 /* InfoBarCommunicator.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5AB0FC168B200E85C33 /* InfoBarCommunicator.h */; settings = {ATTRIBUTES = (Public, ); }; };
@ -183,16 +186,32 @@
2744E5B30FC168C500E85C33 /* PlatCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5AE0FC168C500E85C33 /* PlatCocoa.mm */; };
2744E5B50FC168C500E85C33 /* ScintillaCocoa.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5B00FC168C500E85C33 /* ScintillaCocoa.mm */; };
2744E5B60FC168C500E85C33 /* ScintillaView.mm in Sources */ = {isa = PBXBuildFile; fileRef = 2744E5B10FC168C500E85C33 /* ScintillaView.mm */; };
2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59E0FC168A100E85C33 /* PlatCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; };
2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4850FC1678600E85C33 /* Platform.h */; settings = {ATTRIBUTES = (Public, ); }; };
2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59E0FC168A100E85C33 /* PlatCocoa.h */; };
2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4850FC1678600E85C33 /* Platform.h */; };
2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4870FC1678600E85C33 /* SciLexer.h */; settings = {ATTRIBUTES = (Public, ); }; };
2791F3C90FC19F71009DBCF9 /* Scintilla.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E4880FC1678600E85C33 /* Scintilla.h */; settings = {ATTRIBUTES = (Public, ); }; };
2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */; settings = {ATTRIBUTES = (Public, ); }; };
2791F3E30FC1A3AE009DBCF9 /* QuartzTextLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */; settings = {ATTRIBUTES = (Public, ); }; };
2791F3E40FC1A3AE009DBCF9 /* QuartzTextStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */; settings = {ATTRIBUTES = (Public, ); }; };
2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A20FC168A100E85C33 /* ScintillaCocoa.h */; };
2791F3E30FC1A3AE009DBCF9 /* QuartzTextLayout.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E59F0FC168A100E85C33 /* QuartzTextLayout.h */; };
2791F3E40FC1A3AE009DBCF9 /* QuartzTextStyleAttribute.h in Headers */ = {isa = PBXBuildFile; fileRef = 2744E5A00FC168A100E85C33 /* QuartzTextStyleAttribute.h */; };
27FEF4540FC1B413005E115A /* info_bar_bg.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4510FC1B413005E115A /* info_bar_bg.png */; };
27FEF4550FC1B413005E115A /* mac_cursor_busy.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4520FC1B413005E115A /* mac_cursor_busy.png */; };
27FEF4560FC1B413005E115A /* mac_cursor_flipped.png in Resources */ = {isa = PBXBuildFile; fileRef = 27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */; };
280056FB188DDD2C00F200AE /* SparseState.h in Headers */ = {isa = PBXBuildFile; fileRef = 280056F8188DDD2C00F200AE /* SparseState.h */; };
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 */; };
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 */; };
28A1DD53196BE0CA006EFCDD /* MarginView.cxx in Sources */ = {isa = PBXBuildFile; fileRef = 28A1DD50196BE0CA006EFCDD /* MarginView.cxx */; };
28A1DD57196BE0ED006EFCDD /* EditModel.h in Headers */ = {isa = PBXBuildFile; fileRef = 28A1DD54196BE0ED006EFCDD /* EditModel.h */; };
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 */; };
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 */; };
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C1666FE841158C02AAC07 /* InfoPlist.strings */; };
8DC2EF570486A6940098B216 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7B1FEA5585E11CA2CBB /* Cocoa.framework */; };
/* End PBXBuildFile section */
@ -362,6 +381,7 @@
1152A77215313E58000D4E1A /* QuartzCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = QuartzCore.framework; path = ../../../../../../../../System/Library/Frameworks/QuartzCore.framework; sourceTree = "<group>"; };
11594BE7155B91DF0099E1FA /* LexOScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexOScript.cxx; path = ../../lexers/LexOScript.cxx; sourceTree = "<group>"; };
11594BE8155B91DF0099E1FA /* LexVisualProlog.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexVisualProlog.cxx; path = ../../lexers/LexVisualProlog.cxx; sourceTree = "<group>"; };
1160E0371803651C00BCEBCB /* LexRust.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexRust.cxx; path = ../../lexers/LexRust.cxx; sourceTree = "<group>"; };
117ACE9014A29A1E002876F9 /* LexTCMD.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexTCMD.cxx; path = ../../lexers/LexTCMD.cxx; sourceTree = "<group>"; };
119FF1BE13C9D1820007CE42 /* QuartzTextStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = QuartzTextStyle.h; path = ../QuartzTextStyle.h; sourceTree = "<group>"; };
11A0A8A0148602DF0018D143 /* LexCoffeeScript.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexCoffeeScript.cxx; path = ../../lexers/LexCoffeeScript.cxx; sourceTree = "<group>"; };
@ -371,6 +391,8 @@
11FBA39B17817DA00048C071 /* CharacterCategory.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = CharacterCategory.cxx; path = ../../lexlib/CharacterCategory.cxx; sourceTree = "<group>"; };
11FBA39C17817DA00048C071 /* CharacterCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = CharacterCategory.h; path = ../../lexlib/CharacterCategory.h; sourceTree = "<group>"; };
11FDAEB6174E1A9700FA161B /* LexSTTXT.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexSTTXT.cxx; path = ../../lexers/LexSTTXT.cxx; sourceTree = "<group>"; };
11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexKVIrc.cxx; path = ../../lexers/LexKVIrc.cxx; sourceTree = "<group>"; };
11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = LexDMAP.cxx; path = ../../lexers/LexDMAP.cxx; sourceTree = "<group>"; };
2744E4850FC1678600E85C33 /* Platform.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Platform.h; path = ../../include/Platform.h; sourceTree = SOURCE_ROOT; };
2744E4870FC1678600E85C33 /* SciLexer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SciLexer.h; path = ../../include/SciLexer.h; sourceTree = SOURCE_ROOT; };
2744E4880FC1678600E85C33 /* Scintilla.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = Scintilla.h; path = ../../include/Scintilla.h; sourceTree = SOURCE_ROOT; };
@ -388,6 +410,22 @@
27FEF4510FC1B413005E115A /* info_bar_bg.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = info_bar_bg.png; sourceTree = "<group>"; };
27FEF4520FC1B413005E115A /* mac_cursor_busy.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mac_cursor_busy.png; sourceTree = "<group>"; };
27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = mac_cursor_flipped.png; sourceTree = "<group>"; };
280056F8188DDD2C00F200AE /* SparseState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = SparseState.h; path = ../../lexlib/SparseState.h; sourceTree = "<group>"; };
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>"; };
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>"; };
28A1DD50196BE0CA006EFCDD /* MarginView.cxx */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = MarginView.cxx; path = ../../src/MarginView.cxx; sourceTree = "<group>"; };
28A1DD54196BE0ED006EFCDD /* EditModel.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = EditModel.h; path = ../../src/EditModel.h; sourceTree = "<group>"; };
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>"; };
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>"; };
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; };
@ -501,6 +539,7 @@
114B6EC611FA7526004FB6AB /* LexBaan.cxx */,
114B6EC711FA7526004FB6AB /* LexBash.cxx */,
114B6EC811FA7526004FB6AB /* LexBasic.cxx */,
28FDA42019B6967B00BE27D7 /* LexBibTeX.cxx */,
114B6EC911FA7526004FB6AB /* LexBullant.cxx */,
114B6ECA11FA7526004FB6AB /* LexCaml.cxx */,
114B6ECB11FA7526004FB6AB /* LexCLW.cxx */,
@ -513,6 +552,8 @@
114B6ED111FA7526004FB6AB /* LexCsound.cxx */,
114B6ED211FA7526004FB6AB /* LexCSS.cxx */,
114B6ED311FA7526004FB6AB /* LexD.cxx */,
11FF3FE11810EB3900E13F13 /* LexDMAP.cxx */,
28064A04190F12E100E6E47F /* LexDMIS.cxx */,
11BEB6A114EF189600BDE92A /* LexECL.cxx */,
114B6ED411FA7526004FB6AB /* LexEiffel.cxx */,
114B6ED511FA7526004FB6AB /* LexErlang.cxx */,
@ -523,9 +564,11 @@
114B6EDA11FA7526004FB6AB /* LexGAP.cxx */,
114B6EDB11FA7526004FB6AB /* LexGui4Cli.cxx */,
114B6EDC11FA7526004FB6AB /* LexHaskell.cxx */,
28A067101A36B42600B4966A /* LexHex.cxx */,
114B6EDD11FA7526004FB6AB /* LexHTML.cxx */,
114B6EDE11FA7526004FB6AB /* LexInno.cxx */,
114B6EDF11FA7526004FB6AB /* LexKix.cxx */,
11FDD0DF17C480D4001541B9 /* LexKVIrc.cxx */,
1102C31B169FB49300DC16AB /* LexLaTeX.cxx */,
114B6EE011FA7526004FB6AB /* LexLisp.cxx */,
114B6EE111FA7526004FB6AB /* LexLout.cxx */,
@ -557,7 +600,9 @@
114B6EF811FA7526004FB6AB /* LexPython.cxx */,
114B6EF911FA7526004FB6AB /* LexR.cxx */,
114B6EFA11FA7526004FB6AB /* LexRebol.cxx */,
28A7D6041995E47D0062D204 /* LexRegistry.cxx */,
114B6EFB11FA7526004FB6AB /* LexRuby.cxx */,
1160E0371803651C00BCEBCB /* LexRust.cxx */,
114B6EFC11FA7526004FB6AB /* LexScriptol.cxx */,
114B6EFD11FA7526004FB6AB /* LexSmalltalk.cxx */,
114B6EFE11FA7526004FB6AB /* LexSML.cxx */,
@ -598,7 +643,9 @@
114B6FA711FA7623004FB6AB /* ContractionState.h */,
114B6FA811FA7623004FB6AB /* Decoration.h */,
114B6FA911FA7623004FB6AB /* Document.h */,
28A1DD54196BE0ED006EFCDD /* EditModel.h */,
114B6FAA11FA7623004FB6AB /* Editor.h */,
28A1DD55196BE0ED006EFCDD /* EditView.h */,
114B6FAB11FA7623004FB6AB /* ExternalLexer.h */,
114B6FAC11FA7623004FB6AB /* FontQuality.h */,
114B6FA011FA75DB004FB6AB /* ILexer.h */,
@ -610,6 +657,7 @@
114B6FDD11FA7645004FB6AB /* LexerNoExceptions.h */,
114B6FDE11FA7645004FB6AB /* LexerSimple.h */,
114B6FAF11FA7623004FB6AB /* LineMarker.h */,
28A1DD56196BE0ED006EFCDD /* MarginView.h */,
114B6FDF11FA7645004FB6AB /* OptionSet.h */,
114B6FB011FA7623004FB6AB /* Partitioning.h */,
114B6FB111FA7623004FB6AB /* PerLine.h */,
@ -619,9 +667,12 @@
114B6FB411FA7623004FB6AB /* RunStyles.h */,
114B6FB511FA7623004FB6AB /* ScintillaBase.h */,
114B6FB611FA7623004FB6AB /* Selection.h */,
280056F8188DDD2C00F200AE /* SparseState.h */,
114B6FB711FA7623004FB6AB /* SplitVector.h */,
280056F9188DDD2C00F200AE /* StringCopy.h */,
114B6FB811FA7623004FB6AB /* Style.h */,
114B6FE111FA7645004FB6AB /* StyleContext.h */,
280056FA188DDD2C00F200AE /* SubStyles.h */,
1100F1EA178E393200105727 /* UnicodeFromUTF8.h */,
114B6FBA11FA7623004FB6AB /* UniConversion.h */,
114B6FBB11FA7623004FB6AB /* ViewStyle.h */,
@ -647,7 +698,9 @@
114B6F6511FA7597004FB6AB /* ContractionState.cxx */,
114B6F6611FA7597004FB6AB /* Decoration.cxx */,
114B6F6711FA7597004FB6AB /* Document.cxx */,
28A1DD4E196BE0CA006EFCDD /* EditModel.cxx */,
114B6F6811FA7597004FB6AB /* Editor.cxx */,
28A1DD4F196BE0CA006EFCDD /* EditView.cxx */,
114B6F6911FA7598004FB6AB /* ExternalLexer.cxx */,
114B6F6A11FA7598004FB6AB /* Indicator.cxx */,
114B6F6B11FA7598004FB6AB /* KeyMap.cxx */,
@ -656,6 +709,7 @@
114B6F9211FA75BE004FB6AB /* LexerNoExceptions.cxx */,
114B6F9311FA75BE004FB6AB /* LexerSimple.cxx */,
114B6F6C11FA7598004FB6AB /* LineMarker.cxx */,
28A1DD50196BE0CA006EFCDD /* MarginView.cxx */,
114B6F6D11FA7598004FB6AB /* PerLine.cxx */,
114B6F6E11FA7598004FB6AB /* PositionCache.cxx */,
114B6F9411FA75BE004FB6AB /* PropSetSimple.cxx */,
@ -705,6 +759,9 @@
27FEF4500FC1B413005E115A /* res */ = {
isa = PBXGroup;
children = (
28D516D51830FFCA0047C93D /* info_bar_bg@2x.png */,
28D516D61830FFCA0047C93D /* mac_cursor_busy@2x.png */,
28D516D71830FFCA0047C93D /* mac_cursor_flipped@2x.png */,
27FEF4510FC1B413005E115A /* info_bar_bg.png */,
27FEF4520FC1B413005E115A /* mac_cursor_busy.png */,
27FEF4530FC1B413005E115A /* mac_cursor_flipped.png */,
@ -730,13 +787,14 @@
files = (
2744E5A40FC168A100E85C33 /* InfoBar.h in Headers */,
2744E5AC0FC168B200E85C33 /* InfoBarCommunicator.h in Headers */,
2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */,
280056FB188DDD2C00F200AE /* SparseState.h in Headers */,
2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */,
2791F3C60FC19F71009DBCF9 /* PlatCocoa.h in Headers */,
2791F3E30FC1A3AE009DBCF9 /* QuartzTextLayout.h in Headers */,
2791F3E40FC1A3AE009DBCF9 /* QuartzTextStyleAttribute.h in Headers */,
2791F3E00FC1A390009DBCF9 /* ScintillaCocoa.h in Headers */,
2744E5AA0FC168A100E85C33 /* ScintillaView.h in Headers */,
2791F3C70FC19F71009DBCF9 /* Platform.h in Headers */,
2791F3C80FC19F71009DBCF9 /* SciLexer.h in Headers */,
2791F3C90FC19F71009DBCF9 /* Scintilla.h in Headers */,
114B6FA111FA75DB004FB6AB /* ILexer.h in Headers */,
114B6FBD11FA7623004FB6AB /* AutoComplete.h in Headers */,
@ -750,6 +808,7 @@
114B6FC511FA7623004FB6AB /* Editor.h in Headers */,
114B6FC611FA7623004FB6AB /* ExternalLexer.h in Headers */,
114B6FC711FA7623004FB6AB /* FontQuality.h in Headers */,
28A1DD57196BE0ED006EFCDD /* EditModel.h in Headers */,
114B6FC811FA7623004FB6AB /* Indicator.h in Headers */,
114B6FC911FA7623004FB6AB /* KeyMap.h in Headers */,
114B6FCA11FA7623004FB6AB /* LineMarker.h in Headers */,
@ -757,11 +816,14 @@
114B6FCC11FA7623004FB6AB /* PerLine.h in Headers */,
114B6FCD11FA7623004FB6AB /* PositionCache.h in Headers */,
114B6FCE11FA7623004FB6AB /* RESearch.h in Headers */,
28A1DD58196BE0ED006EFCDD /* EditView.h in Headers */,
114B6FCF11FA7623004FB6AB /* RunStyles.h in Headers */,
280056FD188DDD2C00F200AE /* SubStyles.h in Headers */,
114B6FD011FA7623004FB6AB /* ScintillaBase.h in Headers */,
114B6FD111FA7623004FB6AB /* Selection.h in Headers */,
114B6FD211FA7623004FB6AB /* SplitVector.h in Headers */,
114B6FD311FA7623004FB6AB /* Style.h in Headers */,
280056FC188DDD2C00F200AE /* StringCopy.h in Headers */,
114B6FD511FA7623004FB6AB /* UniConversion.h in Headers */,
114B6FD611FA7623004FB6AB /* ViewStyle.h in Headers */,
114B6FD711FA7623004FB6AB /* XPM.h in Headers */,
@ -773,6 +835,7 @@
114B6FE811FA7645004FB6AB /* LexerNoExceptions.h in Headers */,
114B6FE911FA7645004FB6AB /* LexerSimple.h in Headers */,
114B6FEA11FA7645004FB6AB /* OptionSet.h in Headers */,
28A1DD59196BE0ED006EFCDD /* MarginView.h in Headers */,
114B6FEB11FA7645004FB6AB /* PropSetSimple.h in Headers */,
114B6FEC11FA7645004FB6AB /* StyleContext.h in Headers */,
114B6FED11FA7645004FB6AB /* WordList.h in Headers */,
@ -812,7 +875,7 @@
0867D690FE84028FC02AAC07 /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0460;
LastUpgradeCheck = 0610;
};
buildConfigurationList = 1DEB91B108733DA50010E9CD /* Build configuration list for PBXProject "ScintillaFramework" */;
compatibilityVersion = "Xcode 3.2";
@ -841,8 +904,11 @@
files = (
8DC2EF530486A6940098B216 /* InfoPlist.strings in Resources */,
27FEF4540FC1B413005E115A /* info_bar_bg.png in Resources */,
28D516D81830FFCA0047C93D /* info_bar_bg@2x.png in Resources */,
28D516D91830FFCA0047C93D /* mac_cursor_busy@2x.png in Resources */,
27FEF4550FC1B413005E115A /* mac_cursor_busy.png in Resources */,
27FEF4560FC1B413005E115A /* mac_cursor_flipped.png in Resources */,
28D516DA1830FFCA0047C93D /* mac_cursor_flipped@2x.png in Resources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -883,19 +949,23 @@
114B6F2411FA7526004FB6AB /* LexErlang.cxx in Sources */,
114B6F2511FA7526004FB6AB /* LexEScript.cxx in Sources */,
114B6F2611FA7526004FB6AB /* LexFlagship.cxx in Sources */,
28064A05190F12E100E6E47F /* LexDMIS.cxx in Sources */,
114B6F2711FA7526004FB6AB /* LexForth.cxx in Sources */,
114B6F2811FA7526004FB6AB /* LexFortran.cxx in Sources */,
28FDA42119B6967B00BE27D7 /* LexBibTeX.cxx in Sources */,
114B6F2911FA7526004FB6AB /* LexGAP.cxx in Sources */,
114B6F2A11FA7526004FB6AB /* LexGui4Cli.cxx in Sources */,
114B6F2B11FA7526004FB6AB /* LexHaskell.cxx in Sources */,
114B6F2C11FA7526004FB6AB /* LexHTML.cxx in Sources */,
114B6F2D11FA7526004FB6AB /* LexInno.cxx in Sources */,
114B6F2E11FA7526004FB6AB /* LexKix.cxx in Sources */,
28A067111A36B42600B4966A /* LexHex.cxx in Sources */,
114B6F2F11FA7526004FB6AB /* LexLisp.cxx in Sources */,
114B6F3011FA7526004FB6AB /* LexLout.cxx in Sources */,
114B6F3111FA7526004FB6AB /* LexLua.cxx in Sources */,
114B6F3211FA7526004FB6AB /* LexMagik.cxx in Sources */,
114B6F3311FA7526004FB6AB /* LexMarkdown.cxx in Sources */,
28A1DD52196BE0CA006EFCDD /* EditView.cxx in Sources */,
114B6F3411FA7526004FB6AB /* LexMatlab.cxx in Sources */,
114B6F3511FA7526004FB6AB /* LexMetapost.cxx in Sources */,
114B6F3611FA7526004FB6AB /* LexMMIXAL.cxx in Sources */,
@ -931,6 +1001,7 @@
114B6F5411FA7526004FB6AB /* LexTAL.cxx in Sources */,
114B6F5511FA7526004FB6AB /* LexTCL.cxx in Sources */,
114B6F5611FA7526004FB6AB /* LexTeX.cxx in Sources */,
28A1DD53196BE0CA006EFCDD /* MarginView.cxx in Sources */,
114B6F5711FA7526004FB6AB /* LexTxt2tags.cxx in Sources */,
114B6F5811FA7526004FB6AB /* LexVB.cxx in Sources */,
114B6F5911FA7526004FB6AB /* LexVerilog.cxx in Sources */,
@ -941,6 +1012,7 @@
114B6F7911FA7598004FB6AB /* Catalogue.cxx in Sources */,
114B6F7A11FA7598004FB6AB /* CellBuffer.cxx in Sources */,
114B6F7B11FA7598004FB6AB /* CharClassify.cxx in Sources */,
28A1DD51196BE0CA006EFCDD /* EditModel.cxx in Sources */,
114B6F7C11FA7598004FB6AB /* ContractionState.cxx in Sources */,
114B6F7D11FA7598004FB6AB /* Decoration.cxx in Sources */,
114B6F7E11FA7598004FB6AB /* Document.cxx in Sources */,
@ -956,6 +1028,7 @@
114B6F8811FA7598004FB6AB /* ScintillaBase.cxx in Sources */,
114B6F8911FA7598004FB6AB /* Selection.cxx in Sources */,
114B6F8A11FA7598004FB6AB /* Style.cxx in Sources */,
28A7D6051995E47D0062D204 /* LexRegistry.cxx in Sources */,
114B6F8B11FA7598004FB6AB /* UniConversion.cxx in Sources */,
114B6F8C11FA7598004FB6AB /* ViewStyle.cxx in Sources */,
114B6F8D11FA7598004FB6AB /* XPM.cxx in Sources */,
@ -982,6 +1055,9 @@
11FBA39D17817DA00048C071 /* CharacterCategory.cxx in Sources */,
1100F1EB178E393200105727 /* CaseConvert.cxx in Sources */,
1100F1ED178E393200105727 /* CaseFolder.cxx in Sources */,
11FDD0E017C480D4001541B9 /* LexKVIrc.cxx in Sources */,
1160E0381803651C00BCEBCB /* LexRust.cxx in Sources */,
11FF3FE21810EB3900E13F13 /* LexDMAP.cxx in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@ -1003,7 +1079,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -1018,15 +1095,15 @@
SCI_NAMESPACE,
SCI_LEXER,
);
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = Scintilla;
SDKROOT = macosx10.7;
SKIP_INSTALL = YES;
WRAPPER_EXTENSION = framework;
};
name = Debug;
@ -1035,7 +1112,8 @@
isa = XCBuildConfiguration;
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
CLANG_CXX_LIBRARY = "libc++";
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -1047,15 +1125,15 @@
SCI_NAMESPACE,
SCI_LEXER,
);
GCC_VERSION = com.apple.compilers.llvm.clang.1_0;
GCC_WARN_UNINITIALIZED_AUTOS = NO;
GCC_WARN_UNKNOWN_PRAGMAS = YES;
GCC_WARN_UNUSED_FUNCTION = YES;
GCC_WARN_UNUSED_LABEL = YES;
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "@executable_path/../Frameworks";
MACOSX_DEPLOYMENT_TARGET = 10.7;
PRODUCT_NAME = Scintilla;
SDKROOT = macosx10.7;
SKIP_INSTALL = YES;
WRAPPER_EXTENSION = framework;
};
name = Release;
@ -1063,7 +1141,7 @@
1DEB91B208733DA50010E9CD /* Debug */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
@ -1073,15 +1151,16 @@
../../src,
../../lexlib,
);
MACOSX_DEPLOYMENT_TARGET = 10.5;
ONLY_ACTIVE_ARCH = YES;
SDKROOT = macosx10.7;
SDKROOT = macosx;
};
name = Debug;
};
1DEB91B308733DA50010E9CD /* Release */ = {
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_CXX_LANGUAGE_STANDARD = "c++0x";
GCC_C_LANGUAGE_STANDARD = c99;
GCC_WARN_ABOUT_RETURN_TYPE = YES;
GCC_WARN_UNUSED_VARIABLE = YES;
@ -1090,7 +1169,8 @@
../../src,
../../lexlib,
);
SDKROOT = macosx10.7;
MACOSX_DEPLOYMENT_TARGET = 10.5;
SDKROOT = macosx;
};
name = Release;
};

View File

@ -9,8 +9,8 @@
#import <Cocoa/Cocoa.h>
#import "ScintillaView.h"
#import "InfoBar.h"
#import "Scintilla/ScintillaView.h"
#import "Scintilla/InfoBar.h"
@interface AppController : NSObject {
IBOutlet NSBox *mEditHost;

View File

@ -191,7 +191,7 @@
29B97313FDCFA39411CA2CEA /* Project object */ = {
isa = PBXProject;
attributes = {
LastUpgradeCheck = 0450;
LastUpgradeCheck = 0510;
};
buildConfigurationList = C01FCF4E08A954540054247B /* Build configuration list for PBXProject "ScintillaTest" */;
compatibilityVersion = "Xcode 3.2";
@ -286,6 +286,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COMBINE_HIDPI_IMAGES = YES;
COPY_PHASE_STRIP = NO;
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_DYNAMIC_NO_PIC = NO;
@ -297,13 +298,13 @@
SCI_LEXER,
SCI_NAMESPACE,
);
HEADER_SEARCH_PATHS = "../..//**";
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "";
PRODUCT_NAME = ScintillaTest;
SDKROOT = macosx10.7;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "";
};
name = Debug;
@ -313,6 +314,7 @@
buildSettings = {
ALWAYS_SEARCH_USER_PATHS = NO;
ARCHS = "$(ARCHS_STANDARD_32_64_BIT)";
COMBINE_HIDPI_IMAGES = YES;
DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
FRAMEWORK_SEARCH_PATHS = "$(inherited)";
GCC_MODEL_TUNING = G5;
@ -322,13 +324,13 @@
SCI_LEXER,
SCI_NAMESPACE,
);
HEADER_SEARCH_PATHS = "../..//**";
HEADER_SEARCH_PATHS = "";
INFOPLIST_FILE = Info.plist;
INSTALL_PATH = "$(HOME)/Applications";
LIBRARY_SEARCH_PATHS = "$(inherited)";
OTHER_LDFLAGS = "";
PRODUCT_NAME = ScintillaTest;
SDKROOT = macosx10.7;
SDKROOT = macosx;
USER_HEADER_SEARCH_PATHS = "";
};
name = Release;
@ -337,14 +339,24 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_OPTIMIZATION_LEVEL = 0;
GCC_VERSION = com.apple.compilers.llvm.clang.1_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;
ONLY_ACTIVE_ARCH = YES;
OTHER_LDFLAGS = "";
SDKROOT = macosx10.7;
SDKROOT = macosx;
};
name = Debug;
};
@ -352,12 +364,22 @@
isa = XCBuildConfiguration;
buildSettings = {
ARCHS = "$(ARCHS_STANDARD_32_BIT)";
CLANG_WARN_BOOL_CONVERSION = YES;
CLANG_WARN_CONSTANT_CONVERSION = YES;
CLANG_WARN_EMPTY_BODY = YES;
CLANG_WARN_ENUM_CONVERSION = YES;
CLANG_WARN_INT_CONVERSION = YES;
CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
GCC_C_LANGUAGE_STANDARD = c99;
GCC_VERSION = com.apple.compilers.llvm.clang.1_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;
OTHER_LDFLAGS = "";
SDKROOT = macosx10.7;
SDKROOT = macosx;
};
name = Release;
};

View File

@ -11,25 +11,47 @@
#import <Cocoa/Cocoa.h>
#import "Platform.h"
#import "Scintilla.h"
#import "SciLexer.h"
#import "InfoBarCommunicator.h"
#import "ScintillaCocoa.h"
/**
* Scintilla sends these two messages to the notify handler. Please refer
* to the Windows API doc for details about the message format.
*/
#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
* like a Windows WndProc, where Scintilla can send notifications to. Use
* ScintillaView registerNotifyCallback() to register such a handler.
* Message format is:
* <br>
* WM_COMMAND: HIWORD (wParam) = notification code, LOWORD (wParam) = control ID, lParam = ScintillaCocoa*
* <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;
extern NSString *SCIUpdateUINotification;
extern NSString *const SCIUpdateUINotification;
@protocol ScintillaNotificationProtocol
- (void)notification: (Scintilla::SCNotification*)notification;
@end
/**
* MarginView draws line numbers and other margins next to the text view.
* SCIMarginView draws line numbers and other margins next to the text view.
*/
@interface MarginView : NSRulerView
@interface SCIMarginView : NSRulerView
{
@private
int marginWidth;
@ -45,51 +67,51 @@ extern NSString *SCIUpdateUINotification;
@end
/**
* InnerView is the Cocoa interface to the Scintilla backend. It handles text input and
* SCIContentView is the Cocoa interface to the Scintilla backend. It handles text input and
* provides a canvas for painting the output.
*/
@interface InnerView : NSView <NSTextInputClient, NSUserInterfaceValidations>
@interface SCIContentView : NSView <
NSTextInputClient,
NSUserInterfaceValidations,
NSDraggingSource,
NSDraggingDestination>
{
@private
ScintillaView* mOwner;
NSCursor* mCurrentCursor;
NSTrackingRectTag mCurrentTrackingRect;
NSTrackingArea *trackingArea;
// Set when we are in composition mode and partial input is displayed.
NSRange mMarkedTextRange;
BOOL undoCollectionWasActive;
}
@property (nonatomic, assign) ScintillaView* owner;
- (void) dealloc;
- (void) removeMarkedText;
- (void) setCursor: (Scintilla::Window::Cursor) cursor;
- (void) setCursor: (int) cursor;
- (BOOL) canUndo;
- (BOOL) canRedo;
@end
@interface ScintillaView : NSView <InfoBarCommunicator>
@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;
// This is the actual content to which the backend renders itself.
InnerView* mContent;
SCIContentView* mContent;
NSScrollView *scrollView;
MarginView *marginView;
SCIMarginView *marginView;
CGFloat zoomDelta;
// Area to display additional controls (e.g. zoom info, caret position, status info).
NSView <InfoBarCommunicator>* mInfoBar;
BOOL mInfoBarAtTop;
int mInitialInfoBarWidth;
id<ScintillaNotificationProtocol> mDelegate;
}
@ -98,31 +120,32 @@ extern NSString *SCIUpdateUINotification;
@property (nonatomic, assign) id<ScintillaNotificationProtocol> delegate;
@property (nonatomic, readonly) NSScrollView *scrollView;
- (void) dealloc;
- (void) positionSubViews;
+ (Class) contentViewClass;
- (void) sendNotification: (NSString*) notificationName;
- (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;
// Scroller handling
- (void) setMarginWidth: (int) width;
- (void) scrollerAction: (id) sender;
- (InnerView*) content;
- (SCIContentView*) content;
- (void) updateMarginCursors;
// NSTextView compatibility layer.
- (NSString*) string;
- (void) setString: (NSString*) aString;
- (void) insertText: (NSString*) aString;
- (void) insertText: (id) aString;
- (void) setEditable: (BOOL) editable;
- (BOOL) isEditable;
- (NSRange) selectedRange;
- (NSString*) selectedString;
- (void) deleteRange: (NSRange) range;
- (void)setFontName: (NSString*) font
size: (int) size
bold: (BOOL) bold
@ -153,7 +176,8 @@ extern NSString *SCIUpdateUINotification;
- (void) setLexerProperty: (NSString*) name value: (NSString*) value;
- (NSString*) getLexerProperty: (NSString*) name;
- (void) registerNotifyCallback: (intptr_t) windowid value: (Scintilla::SciNotifyFunc) callback;
// The delegate property should be used instead of registerNotifyCallback which is deprecated.
- (void) registerNotifyCallback: (intptr_t) windowid value: (Scintilla::SciNotifyFunc) callback __attribute__((deprecated));
- (void) setInfoBar: (NSView <InfoBarCommunicator>*) aView top: (BOOL) top;
- (void) setStatusText: (NSString*) text;

File diff suppressed because it is too large Load Diff

View File

@ -4,56 +4,58 @@
cd ../..
# ************************************************************
# Target 1: build framework and test app with Xcode targetting OS X 10.7
# Target 1: Unit tests
echo Unit tests
cd scintilla/test/unit
make clean
make test
cd ../../..
# ************************************************************
# Target 2: build framework and test app with Xcode targetting 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
cd scintilla/cocoa/ScintillaFramework
xcodebuild clean
cd ../ScintillaTest
xcodebuild clean
cd ../ScintillaFramework
xcodebuild -sdk macosx10.7
cd ../ScintillaTest
xcodebuild -sdk macosx10.7
cd ../../..
echo Building Cocoa-native ScintillaFramework and ScintillaTest
for sdk in macosx10.9 macosx10.8 macosx10.7 macosx10.6 macosx10.5
do
xcodebuild -showsdks | grep $sdk
if [ "$(xcodebuild -showsdks | grep $sdk)" != "" ]
then
echo Building with $sdk
cd scintilla/cocoa/ScintillaFramework
xcodebuild clean
cd ../ScintillaTest
xcodebuild clean
cd ../ScintillaFramework
xcodebuild -sdk $sdk
cd ../ScintillaTest
xcodebuild -sdk $sdk
cd ../../..
else
echo Warning $sdk not available
fi
done
# ************************************************************
# Target 2: build framework and test app with Xcode targetting OS X 10.6
cd scintilla/cocoa/ScintillaFramework
xcodebuild clean
cd ../ScintillaTest
xcodebuild clean
cd ../ScintillaFramework
xcodebuild -sdk macosx10.6
cd ../ScintillaTest
xcodebuild -sdk macosx10.6
cd ../../..
# ************************************************************
# Target 3: build framework and test app with Xcode targetting OS X 10.5
cd scintilla/cocoa/ScintillaFramework
xcodebuild clean
cd ../ScintillaTest
xcodebuild clean
cd ../ScintillaFramework
xcodebuild -sdk macosx10.5
cd ../ScintillaTest
xcodebuild -sdk macosx10.5
cd ../../..
# ************************************************************
# Target 4: Qt builds
# Target 3: Qt builds
# Requires Qt development libraries and qmake to be installed
echo Building Qt and PySide
cd scintilla/qt
cd ScintillaEditBase
qmake
qmake -spec macx-xcode
xcodebuild clean
xcodebuild
cd ..
cd ScintillaEdit
python WidgetGen.py
qmake
qmake -spec macx-xcode
xcodebuild clean
xcodebuild
cd ..
@ -62,14 +64,3 @@ cd ScintillaEditPy
python sepbuild.py
cd ..
cd ../..
# ************************************************************
# Target 5: build framework and test app with make
cd scintilla/cocoa
make -f Framework.mk clean
make -f Framework.mk all
make -f SciTest.mk all
cd ../..

View File

@ -1,57 +0,0 @@
### shared variables and targets between Framework.mk and SciTest.mk ###
# build directories
BLD=build
APP_BLD=$(BLD)/Application
FRM_BLD=$(BLD)/Framework
ifdef DBG
CFLAGS=-g -O0
else
CFLAGS=-Os
endif
# compiler and compiler options
ARCH=-arch i386 $(CFLAGS)
CC=gcc -x c++ $(ARCH)
CO=gcc -x objective-c++ $(ARCH)
CCX=$(CC) $(gDEFs) $(INCS)
CCO=$(CO) $(gDEFs) $(INCS)
# include directories and global #define
gDEFs=-DSCI_NAMESPACE -DSCI_LEXER
# source directories
SRC_DIRS=../src ./ScintillaFramework ./ScintillaTest ./ \
../lexers ../lexlib
INC_DIRS=$(SRC_DIRS) ../include
INCS=$(addprefix -I,$(INC_DIRS))
vpath %.m $(SRC_DIRS)
vpath %.mm $(SRC_DIRS)
vpath %.cpp $(SRC_DIRS)
vpath %.cxx $(SRC_DIRS)
vpath %.c $(SRC_DIRS)
vpath %.h $(INC_DIRS)
# clean everything
clean:
-rm -rf $(BLD)
# build application objective-c++ files
$(APP_BLD)/%.o : %.mm
$(CCO) -c $< -o $@
# build application objective-c files
$(APP_BLD)/%.o : %.m
$(CCO) -c $< -o $@
# build framework c++ files
$(FRM_BLD)/%.o : %.cxx
$(CCX) -c $< -o $@
# build framework objective-c++ files
$(FRM_BLD)/%.o : %.mm
$(CCO) -c $< -o $@

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.9 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.2 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.7 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 446 B

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 8.3 KiB

View File

@ -34,7 +34,7 @@ newline terminates the initStyle state the lexer should enter its
default state (or whatever state should follow initStyle).
The keywordlists parameter specifies the keywords that the lexer must
recognize. A WordList class object contains methods that make simplify
recognize. A WordList class object contains methods that simplify
the recognition of keywords. Present lexers use a helper function
called classifyWordLLL to recognize keywords. These functions show how
to use the keywordlists parameter to recognize keywords. This

BIN
scintilla/doc/Markers.png Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

File diff suppressed because it is too large Load Diff

View File

@ -25,9 +25,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla334.zip?download">
<font size="4"> <a href="http://prdownloads.sourceforge.net/scintilla/scintilla356.zip?download">
Windows</a>&nbsp;&nbsp;
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla334.tgz?download">
<a href="http://prdownloads.sourceforge.net/scintilla/scintilla356.tgz?download">
GTK+/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -41,7 +41,7 @@
containing very few restrictions.
</p>
<h3>
Release 3.3.4
Release 3.5.6
</h3>
<h4>
Source Code
@ -49,8 +49,8 @@
The source code package contains all of the source code for Scintilla but no binary
executable code and is available in
<ul>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla334.zip?download">zip format</a> (1250K) commonly used on Windows</li>
<li><a href="http://prdownloads.sourceforge.net/scintilla/scintilla334.tgz?download">tgz format</a> (1100K) commonly used on Linux and compatible operating systems</li>
<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>
</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

@ -9,7 +9,7 @@
<meta name="keywords" content="Scintilla, SciTE, Editing Component, Text Editor" />
<meta name="Description"
content="www.scintilla.org is the home of the Scintilla editing component and SciTE text editor application." />
<meta name="Date.Modified" content="20130719" />
<meta name="Date.Modified" content="20150526" />
<style type="text/css">
#versionlist {
margin: 0;
@ -55,8 +55,8 @@
GTK+, and OS X</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3"> Release version 3.3.4<br />
Site last modified July 19 2013</font>
<font color="#FFCC99" size="3"> Release version 3.5.6<br />
Site last modified May 26 2015</font>
</td>
<td width="20%">
&nbsp;
@ -71,14 +71,14 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 3.3.4 better supports Unicode use in lexers.</li>
<li>Version 3.3.3 fixes bugs on GTK+.</li>
<li>Version 3.3.2 simplifies implementing folding.</li>
<li>Version 3.3.1 fixes bugs on Cocoa.</li>
<li>Version 3.3.0 should not be used on Cocoa since it contains bugs fixed in 3.3.1.
It implements overlay scrollers and kinetic scrolling on Cocoa.
Performance improved on GTK+ and Cocoa by performing more work in
high-priority idle tasks.</li>
<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>
</ul>
<ul id="menu">
<li id="remote1"><a href="http://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
@ -135,7 +135,7 @@ if (!IsRemote()) { //if NOT remote...
</p>
<p>
The source code can be downloaded via Mercurial at the Source Forge
<a href="https://sourceforge.net/project/?group_id=2439">Scintilla project page</a>.
<a href="http://sourceforge.net/projects/scintilla/">Scintilla project page</a>.
</p>
<p>
<a href="http://www.scintilla.org/ScintillaRelated.html">Related sites.</a>
@ -154,7 +154,7 @@ if (!IsRemote()) { //if NOT remote...
<a href="http://groups.google.com/group/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 50 messages per week.
This is a low traffic list, averaging less than 20 messages per week.
To avoid spam, only list members can write to the list.
New versions of Scintilla are announced on scintilla-interest and may also be received by SourceForge
members by clicking on the Monitor column icon for "scintilla" on
@ -163,15 +163,15 @@ if (!IsRemote()) { //if NOT remote...
may receive no response.
<br />
</p>
There is a <a href="https://sourceforge.net/project/?group_id=2439">Scintilla project page</a>
There is a <a href="http://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('<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> ');
} else {
document.write('<a href="http://sourceforge.net/projects/scintilla">SourceForge<\/a>');
document.write('<a href="http://sourceforge.net/projects/scintilla/">SourceForge<\/a>');
}
//-->
</script>

View File

@ -3,6 +3,13 @@
// Copyright 2004 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#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
@ -44,8 +51,8 @@ public:
// Try allowing approximate transliterations
if (transliterations) {
char fullDest[200];
strcpy(fullDest, charSetDestination);
strcat(fullDest, "//TRANSLIT");
g_strlcpy(fullDest, charSetDestination, sizeof(fullDest));
g_strlcat(fullDest, "//TRANSLIT", sizeof(fullDest));
OpenHandle(fullDest, charSetSource);
}
if (!Succeeded()) {
@ -68,3 +75,9 @@ public:
}
}
};
#ifdef SCI_NAMESPACE
}
#endif
#endif

View File

@ -3,9 +3,9 @@
// Copyright 1998-2004 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 <stdlib.h>
#include <stddef.h>
#include <math.h>
@ -23,8 +23,9 @@
#include "Scintilla.h"
#include "ScintillaWidget.h"
#include "UniConversion.h"
#include "StringCopy.h"
#include "XPM.h"
#include "UniConversion.h"
#if defined(__clang__)
// Clang 3.0 incorrectly displays sentinel warnings. Fixed by clang 3.1.
@ -46,7 +47,9 @@
#define IS_WIDGET_FOCUSSED(w) (GTK_WIDGET_HAS_FOCUS(w))
#endif
// The Pango version guard for pango_units_from_double and pango_units_to_double
static const double kPi = 3.14159265358979323846;
// The Pango version guard for pango_units_from_double and pango_units_to_double
// is more complex than simply implementing these here.
static int pangoUnitsFromDouble(double d) {
@ -224,12 +227,12 @@ Point Point::FromLong(long lpoint) {
}
static void SetLogFont(LOGFONT &lf, const char *faceName, int characterSet, float size, int weight, bool italic) {
memset(&lf, 0, sizeof(lf));
lf = LOGFONT();
lf.size = size;
lf.weight = weight;
lf.italic = italic;
lf.characterSet = characterSet;
strncpy(lf.faceName, faceName, sizeof(lf.faceName) - 1);
StringCopy(lf.faceName, faceName);
}
/**
@ -251,7 +254,7 @@ class FontCached : Font {
int usage;
LOGFONT lf;
int hash;
FontCached(const FontParameters &fp);
explicit FontCached(const FontParameters &fp);
~FontCached() {}
bool SameAs(const FontParameters &fp);
virtual void Release();
@ -337,7 +340,7 @@ void FontCached::ReleaseAll() {
FontID FontCached::CreateNewFont(const FontParameters &fp) {
PangoFontDescription *pfd = pango_font_description_new();
if (pfd) {
pango_font_description_set_family(pfd,
pango_font_description_set_family(pfd,
(fp.faceName[0] == '!') ? fp.faceName+1 : fp.faceName);
pango_font_description_set_size(pfd, pangoUnitsFromDouble(fp.size));
pango_font_description_set_weight(pfd, static_cast<PangoWeight>(fp.weight));
@ -524,27 +527,34 @@ void SurfaceImpl::Release() {
}
bool SurfaceImpl::Initialised() {
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 8, 0)
if (inited && context) {
if (cairo_status(context) == CAIRO_STATUS_SUCCESS) {
// Even when status is success, the target surface may have been
// finished whch may cause an assertion to fail crashing the application.
// The cairo_surface_has_show_text_glyphs call checks the finished flag
// and when set, sets the status to CAIRO_STATUS_SURFACE_FINISHED
// which leads to warning messages instead of crashes.
// Performing the check in this method as it is called rarely and has no
// other side effects.
cairo_surface_t *psurfContext = cairo_get_target(context);
if (psurfContext) {
cairo_surface_has_show_text_glyphs(psurfContext);
}
}
return cairo_status(context) == CAIRO_STATUS_SUCCESS;
}
#endif
return inited;
}
void SurfaceImpl::Init(WindowID wid) {
Release();
PLATFORM_ASSERT(wid);
#if GTK_CHECK_VERSION(3,0,0)
GdkWindow *drawable_ = gtk_widget_get_window(PWidget(wid));
#else
GdkDrawable *drawable_ = GDK_DRAWABLE(PWidget(wid)->window);
#endif
if (drawable_) {
context = gdk_cairo_create(drawable_);
PLATFORM_ASSERT(context);
} else {
// Shouldn't happen with valid window but may when calls made before
// window completely allocated and mapped.
psurf = cairo_image_surface_create(CAIRO_FORMAT_RGB24, 1, 1);
context = cairo_create(psurf);
}
createdGC = true;
// if we are only created from a window ID, we can't perform drawing
psurf = 0;
context = 0;
createdGC = false;
pcontext = gtk_widget_create_pango_context(PWidget(wid));
PLATFORM_ASSERT(pcontext);
layout = pango_layout_new(pcontext);
@ -592,6 +602,7 @@ void SurfaceImpl::InitPixMap(int width, int height, Surface *surface_, WindowID
cairo_set_line_width(context, 1);
createdGC = true;
inited = true;
et = surfImpl->et;
}
void SurfaceImpl::PenColour(ColourDesired fore) {
@ -662,9 +673,10 @@ void SurfaceImpl::LineTo(int x_, int y_) {
void SurfaceImpl::Polygon(Point *pts, int npts, ColourDesired fore,
ColourDesired back) {
PLATFORM_ASSERT(context);
PenColour(back);
cairo_move_to(context, pts[0].x + 0.5, pts[0].y + 0.5);
for (int i = 1;i < npts;i++) {
for (int i = 1; i < npts; i++) {
cairo_line_to(context, pts[i].x + 0.5, pts[i].y + 0.5);
}
cairo_close_path(context);
@ -697,8 +709,9 @@ void SurfaceImpl::FillRectangle(PRectangle rc, ColourDesired back) {
void SurfaceImpl::FillRectangle(PRectangle rc, Surface &surfacePattern) {
SurfaceImpl &surfi = static_cast<SurfaceImpl &>(surfacePattern);
bool canDraw = surfi.psurf;
bool canDraw = surfi.psurf != NULL;
if (canDraw) {
PLATFORM_ASSERT(context);
// Tile pattern over rectangle
// Currently assumes 8x8 pattern
int widthPat = 8;
@ -732,14 +745,14 @@ void SurfaceImpl::RoundedRectangle(PRectangle rc, ColourDesired fore, ColourDesi
Point(rc.left, rc.bottom - 2),
Point(rc.left, rc.top + 2),
};
Polygon(pts, sizeof(pts) / sizeof(pts[0]), fore, back);
Polygon(pts, ELEMENTS(pts), fore, back);
} else {
RectangleDraw(rc, fore, back);
}
}
static void PathRoundRectangle(cairo_t *context, double left, double top, double width, double height, int radius) {
double degrees = M_PI / 180.0;
double degrees = kPi / 180.0;
#if CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 2, 0)
cairo_new_sub_path(context);
@ -784,6 +797,7 @@ void SurfaceImpl::AlphaRectangle(PRectangle rc, int cornerSize, ColourDesired fi
}
void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsigned char *pixelsImage) {
PLATFORM_ASSERT(context);
if (rc.Width() > width)
rc.left += (rc.Width() - width) / 2;
rc.right = rc.left + width;
@ -798,9 +812,9 @@ void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsi
#endif
int ucs = stride * height;
std::vector<unsigned char> image(ucs);
for (int y=0; y<height; y++) {
for (int x=0; x<width; x++) {
unsigned char *pixel = &image[0] + y*stride + x * 4;
for (int iy=0; iy<height; iy++) {
for (int ix=0; ix<width; ix++) {
unsigned char *pixel = &image[0] + iy*stride + ix * 4;
unsigned char alpha = pixelsImage[3];
pixel[2] = (*pixelsImage++) * alpha / 255;
pixel[1] = (*pixelsImage++) * alpha / 255;
@ -809,18 +823,19 @@ void SurfaceImpl::DrawRGBAImage(PRectangle rc, int width, int height, const unsi
}
}
cairo_surface_t *psurf = cairo_image_surface_create_for_data(&image[0], CAIRO_FORMAT_ARGB32, width, height, stride);
cairo_set_source_surface(context, psurf, rc.left, rc.top);
cairo_surface_t *psurfImage = cairo_image_surface_create_for_data(&image[0], CAIRO_FORMAT_ARGB32, width, height, stride);
cairo_set_source_surface(context, psurfImage, rc.left, rc.top);
cairo_rectangle(context, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);
cairo_fill(context);
cairo_surface_destroy(psurf);
cairo_surface_destroy(psurfImage);
}
void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back) {
PLATFORM_ASSERT(context);
PenColour(back);
cairo_arc(context, (rc.left + rc.right) / 2 + 0.5, (rc.top + rc.bottom) / 2 + 0.5,
Platform::Minimum(rc.Width(), rc.Height()) / 2, 0, 2*M_PI);
cairo_arc(context, (rc.left + rc.right) / 2, (rc.top + rc.bottom) / 2,
Platform::Minimum(rc.Width(), rc.Height()) / 2, 0, 2*kPi);
cairo_fill_preserve(context);
PenColour(fore);
cairo_stroke(context);
@ -828,8 +843,9 @@ void SurfaceImpl::Ellipse(PRectangle rc, ColourDesired fore, ColourDesired back)
void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) {
SurfaceImpl &surfi = static_cast<SurfaceImpl &>(surfaceSource);
bool canDraw = surfi.psurf;
bool canDraw = surfi.psurf != NULL;
if (canDraw) {
PLATFORM_ASSERT(context);
cairo_set_source_surface(context, surfi.psurf,
rc.left - from.x, rc.top - from.y);
cairo_rectangle(context, rc.left, rc.top, rc.right-rc.left, rc.bottom-rc.top);
@ -840,7 +856,7 @@ void SurfaceImpl::Copy(PRectangle rc, Point from, Surface &surfaceSource) {
std::string UTF8FromLatin1(const char *s, int len) {
std::string utfForm(len*2 + 1, '\0');
size_t lenU = 0;
for (int i=0;i<len;i++) {
for (int i=0; i<len; i++) {
unsigned int uch = static_cast<unsigned char>(s[i]);
if (uch < 0x80) {
utfForm[lenU++] = uch;
@ -888,18 +904,6 @@ static size_t MultiByteLenFromIconv(const Converter &conv, const char *s, size_t
return 1;
}
static size_t UTF8CharLength(const char *s) {
const unsigned char *us = reinterpret_cast<const unsigned char *>(s);
unsigned char ch = *us;
if (ch < 0x80) {
return 1;
} else if (ch < 0x80 + 0x40 + 0x20) {
return 2;
} else {
return 3;
}
}
void SurfaceImpl::DrawTextBase(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len,
ColourDesired fore) {
PenColour(fore);
@ -946,7 +950,7 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font_, XYPOSITION ybase,
void SurfaceImpl::DrawTextTransparent(PRectangle rc, Font &font_, XYPOSITION ybase, const char *s, int len,
ColourDesired fore) {
// Avoid drawing spaces in transparent mode
for (int i=0;i<len;i++) {
for (int i=0; i<len; i++) {
if (s[i] != ' ') {
DrawTextBase(rc, font_, ybase, s, len, fore);
return;
@ -1043,7 +1047,7 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION
positions[i++] = iti.position - (places - place) * iti.distance / places;
positionsCalculated++;
}
clusterStart += UTF8CharLength(utfForm.c_str()+clusterStart);
clusterStart += UTF8CharLength(static_cast<unsigned char>(utfForm.c_str()[clusterStart]));
place++;
}
}
@ -1051,8 +1055,10 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION
}
}
if (positionsCalculated < 1 ) {
// Either Latin1 or DBCS conversion failed so treat as Latin1.
// Either 8-bit or DBCS conversion failed so treat as 8-bit.
SetConverter(PFont(font_)->characterSet);
const bool rtlCheck = PFont(font_)->characterSet == SC_CHARSET_HEBREW ||
PFont(font_)->characterSet == SC_CHARSET_ARABIC;
std::string utfForm = UTF8FromIconv(conv, s, len);
if (utfForm.empty()) {
utfForm = UTF8FromLatin1(s, len);
@ -1060,19 +1066,33 @@ void SurfaceImpl::MeasureWidths(Font &font_, const char *s, int len, XYPOSITION
pango_layout_set_text(layout, utfForm.c_str(), utfForm.length());
int i = 0;
int clusterStart = 0;
// Each Latin1 input character may take 1 or 2 bytes in UTF-8
// Each 8-bit input character may take 1 or 2 bytes in UTF-8
// and groups of up to 3 may be represented as ligatures.
ClusterIterator iti(layout, utfForm.length());
while (!iti.finished) {
iti.Next();
int clusterEnd = iti.curIndex;
int ligatureLength = g_utf8_strlen(utfForm.c_str() + clusterStart, clusterEnd - clusterStart);
if (rtlCheck && ((clusterEnd <= clusterStart) || (ligatureLength == 0) || (ligatureLength > 3))) {
// Something has gone wrong: exit quickly but pretend all the characters are equally spaced:
int widthLayout = 0;
pango_layout_get_size(layout, &widthLayout, NULL);
XYPOSITION widthTotal = doubleFromPangoUnits(widthLayout);
for (int bytePos=0; bytePos<lenPositions; bytePos++) {
positions[bytePos] = widthTotal / lenPositions * (bytePos + 1);
}
return;
}
PLATFORM_ASSERT(ligatureLength > 0 && ligatureLength <= 3);
for (int charInLig=0; charInLig<ligatureLength; charInLig++) {
positions[i++] = iti.position - (ligatureLength - 1 - charInLig) * iti.distance / ligatureLength;
}
clusterStart = clusterEnd;
}
while (i < lenPositions) {
// If something failed, fill in rest of the positions
positions[i++] = clusterStart;
}
PLATFORM_ASSERT(i == lenPositions);
}
}
@ -1182,6 +1202,7 @@ XYPOSITION SurfaceImpl::AverageCharWidth(Font &font_) {
}
void SurfaceImpl::SetClip(PRectangle rc) {
PLATFORM_ASSERT(context);
cairo_rectangle(context, rc.left, rc.top, rc.right, rc.bottom);
cairo_clip(context);
}
@ -1205,9 +1226,20 @@ Surface *Surface::Allocate(int) {
Window::~Window() {}
void Window::Destroy() {
if (wid)
gtk_widget_destroy(GTK_WIDGET(wid));
wid = 0;
if (wid) {
ListBox *listbox = dynamic_cast<ListBox*>(this);
if (listbox) {
gtk_widget_hide(GTK_WIDGET(wid));
// clear up window content
listbox->Clear();
// resize the window to the smallest possible size for it to adapt
// to future content
gtk_window_resize(GTK_WINDOW(wid), 1, 1);
} else {
gtk_widget_destroy(GTK_WIDGET(wid));
}
wid = 0;
}
}
bool Window::HasFocus() {
@ -1268,7 +1300,7 @@ void Window::SetPositionRelative(PRectangle rc, Window relativeTo) {
gtk_window_move(GTK_WINDOW(PWidget(wid)), ox, oy);
gtk_widget_set_size_request(PWidget(wid), sizex, sizey);
gtk_window_resize(GTK_WINDOW(wid), sizex, sizey);
}
PRectangle Window::GetClientPosition() {
@ -1391,6 +1423,8 @@ enum {
};
class ListBoxX : public ListBox {
WindowID widCached;
WindowID frame;
WindowID list;
WindowID scroller;
void *pixhash;
@ -1403,7 +1437,7 @@ public:
CallBackAction doubleClickAction;
void *doubleClickActionData;
ListBoxX() : list(0), scroller(0), pixhash(NULL), pixbuf_renderer(0),
ListBoxX() : widCached(0), frame(0), list(0), scroller(0), pixhash(NULL), pixbuf_renderer(0),
desiredVisibleRows(5), maxItemCharacters(0),
aveCharWidth(1), doubleClickAction(NULL), doubleClickActionData(NULL) {
}
@ -1412,12 +1446,17 @@ public:
g_hash_table_foreach((GHashTable *) pixhash, list_image_free, NULL);
g_hash_table_destroy((GHashTable *) pixhash);
}
if (widCached) {
gtk_widget_destroy(GTK_WIDGET(widCached));
wid = widCached = 0;
}
}
virtual void SetFont(Font &font);
virtual void Create(Window &parent, int ctrlID, Point location_, int lineHeight_, bool unicodeMode_, int technology_);
virtual void SetAverageCharWidth(int width);
virtual void SetVisibleRows(int rows);
virtual int GetVisibleRows() const;
int GetRowHeight();
virtual PRectangle GetDesiredRect();
virtual int CaretFromEdge();
virtual void Clear();
@ -1443,6 +1482,50 @@ ListBox *ListBox::Allocate() {
return lb;
}
// SmallScroller, a GtkScrolledWindow that can shrink very small, as
// gtk_widget_set_size_request() cannot shrink widgets on GTK3
typedef struct {
GtkScrolledWindow parent;
/* Workaround ABI issue with Windows GTK2 bundle and GCC > 3.
See http://lists.geany.org/pipermail/devel/2015-April/thread.html#9379
GtkScrolledWindow contains a bitfield, and GCC 3.4 and 4.8 don't agree
on the size of the structure (regardless of -mms-bitfields):
- GCC 3.4 has sizeof(GtkScrolledWindow)=88
- GCC 4.8 has sizeof(GtkScrolledWindow)=84
As Windows GTK2 bundle is built with GCC 3, it requires types derived
from GtkScrolledWindow to be at least 88 bytes, which means we need to
add some fake padding to fill in the extra 4 bytes.
There is however no other issue with the layout difference as we never
access any GtkScrolledWindow fields ourselves. */
int padding;
} SmallScroller;
typedef GtkScrolledWindowClass SmallScrollerClass;
G_DEFINE_TYPE(SmallScroller, small_scroller, GTK_TYPE_SCROLLED_WINDOW)
#if GTK_CHECK_VERSION(3,0,0)
static void small_scroller_get_preferred_height(GtkWidget *widget, gint *min, gint *nat) {
GTK_WIDGET_CLASS(small_scroller_parent_class)->get_preferred_height(widget, min, nat);
*min = 1;
}
#else
static void small_scroller_size_request(GtkWidget *widget, GtkRequisition *req) {
GTK_WIDGET_CLASS(small_scroller_parent_class)->size_request(widget, req);
req->height = 1;
}
#endif
static void small_scroller_class_init(SmallScrollerClass *klass) {
#if GTK_CHECK_VERSION(3,0,0)
GTK_WIDGET_CLASS(klass)->get_preferred_height = small_scroller_get_preferred_height;
#else
GTK_WIDGET_CLASS(klass)->size_request = small_scroller_size_request;
#endif
}
static void small_scroller_init(SmallScroller *){}
static gboolean ButtonPress(GtkWidget *, GdkEventButton* ev, gpointer p) {
try {
ListBoxX* lb = reinterpret_cast<ListBoxX*>(p);
@ -1504,15 +1587,20 @@ static void StyleSet(GtkWidget *w, GtkStyle*, void*) {
}
void ListBoxX::Create(Window &, int, Point, int, bool, int) {
wid = gtk_window_new(GTK_WINDOW_POPUP);
if (widCached != 0) {
wid = widCached;
return;
}
GtkWidget *frame = gtk_frame_new(NULL);
gtk_widget_show(frame);
gtk_container_add(GTK_CONTAINER(GetID()), frame);
wid = widCached = gtk_window_new(GTK_WINDOW_POPUP);
frame = gtk_frame_new(NULL);
gtk_widget_show(PWidget(frame));
gtk_container_add(GTK_CONTAINER(GetID()), PWidget(frame));
gtk_frame_set_shadow_type(GTK_FRAME(frame), GTK_SHADOW_OUT);
gtk_container_set_border_width(GTK_CONTAINER(frame), 0);
scroller = gtk_scrolled_window_new(NULL, NULL);
scroller = g_object_new(small_scroller_get_type(), NULL);
gtk_container_set_border_width(GTK_CONTAINER(scroller), 0);
gtk_scrolled_window_set_policy(GTK_SCROLLED_WINDOW(scroller),
GTK_POLICY_NEVER, GTK_POLICY_AUTOMATIC);
@ -1553,12 +1641,11 @@ void ListBoxX::Create(Window &, int, Point, int, bool, int) {
if (g_object_class_find_property(G_OBJECT_GET_CLASS(list), "fixed-height-mode"))
g_object_set(G_OBJECT(list), "fixed-height-mode", TRUE, NULL);
GtkWidget *wid = PWidget(list); // No code inside the G_OBJECT macro
gtk_container_add(GTK_CONTAINER(PWidget(scroller)), wid);
gtk_widget_show(wid);
g_signal_connect(G_OBJECT(wid), "button_press_event",
GtkWidget *widget = PWidget(list); // No code inside the G_OBJECT macro
gtk_container_add(GTK_CONTAINER(PWidget(scroller)), widget);
gtk_widget_show(widget);
g_signal_connect(G_OBJECT(widget), "button_press_event",
G_CALLBACK(ButtonPress), this);
gtk_widget_realize(PWidget(wid));
}
void ListBoxX::SetFont(Font &scint_font) {
@ -1585,6 +1672,30 @@ int ListBoxX::GetVisibleRows() const {
return desiredVisibleRows;
}
int ListBoxX::GetRowHeight()
{
#if GTK_CHECK_VERSION(3,0,0)
// This version sometimes reports erroneous results on GTK2, but the GTK2
// version is inaccurate for GTK 3.14.
GdkRectangle rect;
GtkTreePath *path = gtk_tree_path_new_first();
gtk_tree_view_get_background_area(GTK_TREE_VIEW(list), path, NULL, &rect);
return rect.height;
#else
int row_height=0;
int vertical_separator=0;
int expander_size=0;
GtkTreeViewColumn *column = gtk_tree_view_get_column(GTK_TREE_VIEW(list), 0);
gtk_tree_view_column_cell_get_size(column, NULL, NULL, NULL, NULL, &row_height);
gtk_widget_style_get(PWidget(list),
"vertical-separator", &vertical_separator,
"expander-size", &expander_size, NULL);
row_height += vertical_separator;
row_height = Platform::Maximum(row_height, expander_size);
return row_height;
#endif
}
PRectangle ListBoxX::GetDesiredRect() {
// Before any size allocated pretend its 100 wide so not scrolled
PRectangle rc(0, 0, 100, 100);
@ -1594,53 +1705,63 @@ PRectangle ListBoxX::GetDesiredRect() {
rows = desiredVisibleRows;
GtkRequisition req;
#if GTK_CHECK_VERSION(3,0,0)
// This, apparently unnecessary call, ensures gtk_tree_view_column_cell_get_size
// returns reasonable values.
gtk_widget_get_preferred_size(GTK_WIDGET(scroller), NULL, &req);
// returns reasonable values.
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(GTK_WIDGET(frame), NULL, &req);
#else
gtk_widget_size_request(GTK_WIDGET(frame), &req);
#endif
int height;
// First calculate height of the clist for our desired visible
// row count otherwise it tries to expand to the total # of rows
// Get cell height
int row_width=0;
int row_height=0;
GtkTreeViewColumn * column =
gtk_tree_view_get_column(GTK_TREE_VIEW(list), 0);
gtk_tree_view_column_cell_get_size(column, NULL,
NULL, NULL, &row_width, &row_height);
int row_height = GetRowHeight();
#if GTK_CHECK_VERSION(3,0,0)
GtkStyleContext *styleContextList = gtk_widget_get_style_context(PWidget(list));
GtkBorder padding;
gtk_style_context_get_padding(styleContextList, GTK_STATE_FLAG_NORMAL, &padding);
GtkStyleContext *styleContextFrame = gtk_widget_get_style_context(PWidget(frame));
GtkBorder padding, border;
gtk_style_context_get_padding(styleContextFrame, GTK_STATE_FLAG_NORMAL, &padding);
gtk_style_context_get_border(styleContextFrame, GTK_STATE_FLAG_NORMAL, &border);
height = (rows * row_height
+ padding.top + padding.bottom
+ 2 * (gtk_container_get_border_width(GTK_CONTAINER(PWidget(list))) + 1));
+ border.top + border.bottom
+ 2 * gtk_container_get_border_width(GTK_CONTAINER(PWidget(list))));
#else
int ythickness = PWidget(list)->style->ythickness;
height = (rows * row_height
+ 2 * (ythickness
+ GTK_CONTAINER(PWidget(list))->border_width + 1));
+ 2 * (PWidget(frame)->style->ythickness
+ GTK_CONTAINER(PWidget(list))->border_width));
#endif
gtk_widget_set_size_request(GTK_WIDGET(PWidget(list)), -1, height);
rc.bottom = height;
// Get the size of the scroller because we set usize on the window
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(GTK_WIDGET(scroller), NULL, &req);
#else
gtk_widget_size_request(GTK_WIDGET(scroller), &req);
#endif
rc.right = req.width;
rc.bottom = Platform::Maximum(height, req.height);
gtk_widget_set_size_request(GTK_WIDGET(list), -1, -1);
int width = maxItemCharacters;
if (width < 12)
width = 12;
rc.right = width * (aveCharWidth + aveCharWidth / 3);
if (Length() > rows)
rc.right = rc.right + 16;
// Add horizontal padding and borders
int horizontal_separator=0;
gtk_widget_style_get(PWidget(list),
"horizontal-separator", &horizontal_separator, NULL);
rc.right += horizontal_separator;
#if GTK_CHECK_VERSION(3,0,0)
rc.right += (padding.left + padding.right
+ border.left + border.right
+ 2 * gtk_container_get_border_width(GTK_CONTAINER(PWidget(list))));
#else
rc.right += 2 * (PWidget(frame)->style->xthickness
+ GTK_CONTAINER(PWidget(list))->border_width);
#endif
if (Length() > rows) {
// Add the width of the scrollbar
GtkWidget *vscrollbar =
gtk_scrolled_window_get_vscrollbar(GTK_SCROLLED_WINDOW(scroller));
#if GTK_CHECK_VERSION(3,0,0)
gtk_widget_get_preferred_size(vscrollbar, NULL, &req);
#else
gtk_widget_size_request(vscrollbar, &req);
#endif
rc.right += req.width;
}
}
return rc;
}
@ -1752,12 +1873,7 @@ void ListBoxX::Select(int n) {
+ adj->lower - adj->page_size / 2;
#endif
// Get cell height
int row_width;
int row_height;
GtkTreeViewColumn * column =
gtk_tree_view_get_column(GTK_TREE_VIEW(list), 0);
gtk_tree_view_column_cell_get_size(column, NULL, NULL,
NULL, &row_width, &row_height);
int row_height = GetRowHeight();
int rows = Length();
if ((rows == 0) || (rows > desiredVisibleRows))
@ -1785,6 +1901,7 @@ void ListBoxX::Select(int n) {
}
int ListBoxX::GetSelection() {
int index = -1;
GtkTreeIter iter;
GtkTreeModel *model;
GtkTreeSelection *selection;
@ -1794,9 +1911,10 @@ int ListBoxX::GetSelection() {
int *indices = gtk_tree_path_get_indices(path);
// Don't free indices.
if (indices)
return indices[0];
index = indices[0];
gtk_tree_path_free(path);
}
return -1;
return index;
}
int ListBoxX::Find(const char *prefix) {
@ -1828,8 +1946,7 @@ void ListBoxX::GetValue(int n, char *value, int len) {
gtk_tree_model_get(model, &iter, TEXT_COLUMN, &text, -1);
}
if (text && len > 0) {
strncpy(value, text, len);
value[len - 1] = '\0';
g_strlcpy(value, text, len);
} else {
value[0] = '\0';
}
@ -1961,7 +2078,7 @@ class DynamicLibraryImpl : public DynamicLibrary {
protected:
GModule* m;
public:
DynamicLibraryImpl(const char *modulePath) {
explicit DynamicLibraryImpl(const char *modulePath) {
m = g_module_open(modulePath, G_MODULE_BIND_LAZY);
}
@ -1979,8 +2096,9 @@ public:
return static_cast<Function>(fn_address);
else
return NULL;
} else
} else {
return NULL;
}
}
virtual bool IsValid() {
@ -2139,8 +2257,7 @@ bool Platform::ShowAssertionPopUps(bool assertionPopUps_) {
void Platform::Assert(const char *c, const char *file, int line) {
char buffer[2000];
sprintf(buffer, "Assertion [%s] failed at %s %d", c, file, line);
strcat(buffer, "\r\n");
g_snprintf(buffer, sizeof(buffer), "Assertion [%s] failed at %s %d\r\n", c, file, line);
Platform::DebugDisplay(buffer);
abort();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,25 +1,27 @@
PlatGTK.o: PlatGTK.cxx \
../include/Scintilla.h ../include/ScintillaWidget.h \
../src/UniConversion.h ../src/XPM.h Converter.h
../lexlib/StringCopy.h ../src/XPM.h ../src/UniConversion.h Converter.h
ScintillaGTK.o: ScintillaGTK.cxx \
../include/ILexer.h ../include/Scintilla.h ../include/ScintillaWidget.h \
../include/SciLexer.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/ContractionState.h ../src/CellBuffer.h \
../src/CallTip.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/AutoComplete.h \
../src/ViewStyle.h ../src/Decoration.h ../src/CharClassify.h \
../src/CaseFolder.h ../src/Document.h ../src/Selection.h \
../src/PositionCache.h ../src/Editor.h ../src/ScintillaBase.h \
../src/UniConversion.h ../src/CaseConvert.h scintilla-marshal.h \
../lexlib/LexerModule.h ../src/ExternalLexer.h Converter.h
../include/SciLexer.h ../lexlib/StringCopy.h ../lexlib/LexerModule.h \
../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \
../src/ContractionState.h ../src/CellBuffer.h ../src/CallTip.h \
../src/KeyMap.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Decoration.h ../src/CaseFolder.h ../src/Document.h \
../src/CaseConvert.h ../src/UniConversion.h ../src/Selection.h \
../src/PositionCache.h ../src/EditModel.h ../src/MarginView.h \
../src/EditView.h ../src/Editor.h ../src/AutoComplete.h \
../src/ScintillaBase.h ../src/ExternalLexer.h scintilla-marshal.h \
Converter.h
AutoComplete.o: ../src/AutoComplete.cxx ../include/Platform.h \
../lexlib/CharacterSet.h ../src/AutoComplete.h ../include/Scintilla.h
../include/Scintilla.h ../lexlib/CharacterSet.h ../src/AutoComplete.h
CallTip.o: ../src/CallTip.cxx ../include/Platform.h \
../include/Scintilla.h ../src/CallTip.h
CaseConvert.o: ../src/CaseConvert.cxx ../src/CaseConvert.h \
../src/UniConversion.h ../src/UnicodeFromUTF8.h
CaseFolder.o: ../src/CaseFolder.cxx ../src/CaseConvert.h \
../src/UniConversion.h ../src/CaseFolder.h
../include/Scintilla.h ../lexlib/StringCopy.h ../src/CallTip.h
CaseConvert.o: ../src/CaseConvert.cxx ../lexlib/StringCopy.h \
../src/CaseConvert.h ../src/UniConversion.h ../src/UnicodeFromUTF8.h
CaseFolder.o: ../src/CaseFolder.cxx ../src/CaseFolder.h \
../src/CaseConvert.h ../src/UniConversion.h
Catalogue.o: ../src/Catalogue.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/LexerModule.h \
../src/Catalogue.h
@ -34,52 +36,82 @@ Decoration.o: ../src/Decoration.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/Decoration.h
Document.o: ../src/Document.cxx ../include/Platform.h ../include/ILexer.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/CellBuffer.h ../src/PerLine.h \
../src/CharClassify.h ../lexlib/CharacterSet.h ../src/Decoration.h \
../include/Scintilla.h ../lexlib/CharacterSet.h ../src/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/CellBuffer.h \
../src/PerLine.h ../src/CharClassify.h ../src/Decoration.h \
../src/CaseFolder.h ../src/Document.h ../src/RESearch.h \
../src/UniConversion.h
EditModel.o: ../src/EditModel.cxx ../include/Platform.h \
../include/ILexer.h ../include/Scintilla.h ../lexlib/StringCopy.h \
../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \
../src/ContractionState.h ../src/CellBuffer.h ../src/KeyMap.h \
../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \
../src/ViewStyle.h ../src/CharClassify.h ../src/Decoration.h \
../src/CaseFolder.h ../src/Document.h ../src/UniConversion.h \
../src/Selection.h ../src/PositionCache.h ../src/EditModel.h
EditView.o: ../src/EditView.cxx ../include/Platform.h ../include/ILexer.h \
../include/Scintilla.h ../lexlib/StringCopy.h ../src/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/ContractionState.h \
../src/CellBuffer.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \
../src/CharClassify.h ../src/Decoration.h ../src/CaseFolder.h \
../src/Document.h ../src/UniConversion.h ../src/Selection.h \
../src/PositionCache.h ../src/EditModel.h ../src/MarginView.h \
../src/EditView.h
Editor.o: ../src/Editor.cxx ../include/Platform.h ../include/ILexer.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/ContractionState.h ../src/CellBuffer.h \
../src/KeyMap.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Decoration.h ../src/CaseFolder.h ../src/Document.h \
../src/UniConversion.h ../src/Selection.h ../src/PositionCache.h \
../src/Editor.h
../include/Scintilla.h ../lexlib/StringCopy.h ../src/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/ContractionState.h \
../src/CellBuffer.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \
../src/CharClassify.h ../src/Decoration.h ../src/CaseFolder.h \
../src/Document.h ../src/UniConversion.h ../src/Selection.h \
../src/PositionCache.h ../src/EditModel.h ../src/MarginView.h \
../src/EditView.h ../src/Editor.h
ExternalLexer.o: ../src/ExternalLexer.cxx ../include/Platform.h \
../include/ILexer.h ../include/Scintilla.h ../include/SciLexer.h \
../lexlib/LexerModule.h ../src/Catalogue.h ../src/ExternalLexer.h
Indicator.o: ../src/Indicator.cxx ../include/Platform.h \
../include/Scintilla.h ../src/XPM.h ../src/Indicator.h
../include/Scintilla.h ../src/Indicator.h ../src/XPM.h
KeyMap.o: ../src/KeyMap.cxx ../include/Platform.h ../include/Scintilla.h \
../src/KeyMap.h
LineMarker.o: ../src/LineMarker.cxx ../include/Platform.h \
../include/Scintilla.h ../src/XPM.h ../src/LineMarker.h
../include/Scintilla.h ../lexlib/StringCopy.h ../src/XPM.h \
../src/LineMarker.h
MarginView.o: ../src/MarginView.cxx ../include/Platform.h \
../include/ILexer.h ../include/Scintilla.h ../lexlib/StringCopy.h \
../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \
../src/ContractionState.h ../src/CellBuffer.h ../src/KeyMap.h \
../src/Indicator.h ../src/XPM.h ../src/LineMarker.h ../src/Style.h \
../src/ViewStyle.h ../src/CharClassify.h ../src/Decoration.h \
../src/CaseFolder.h ../src/Document.h ../src/UniConversion.h \
../src/Selection.h ../src/PositionCache.h ../src/EditModel.h \
../src/MarginView.h ../src/EditView.h
PerLine.o: ../src/PerLine.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/CellBuffer.h ../src/PerLine.h
PositionCache.o: ../src/PositionCache.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h ../src/ContractionState.h ../src/CellBuffer.h \
../src/KeyMap.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Decoration.h ../include/ILexer.h ../src/CaseFolder.h \
../src/Document.h ../src/Selection.h ../src/PositionCache.h
../include/ILexer.h ../include/Scintilla.h ../src/SplitVector.h \
../src/Partitioning.h ../src/RunStyles.h ../src/ContractionState.h \
../src/CellBuffer.h ../src/KeyMap.h ../src/Indicator.h ../src/XPM.h \
../src/LineMarker.h ../src/Style.h ../src/ViewStyle.h \
../src/CharClassify.h ../src/Decoration.h ../src/CaseFolder.h \
../src/Document.h ../src/UniConversion.h ../src/Selection.h \
../src/PositionCache.h
RESearch.o: ../src/RESearch.cxx ../src/CharClassify.h ../src/RESearch.h
RunStyles.o: ../src/RunStyles.cxx ../include/Platform.h \
../include/Scintilla.h ../src/SplitVector.h ../src/Partitioning.h \
../src/RunStyles.h
ScintillaBase.o: ../src/ScintillaBase.cxx ../include/Platform.h \
../include/ILexer.h ../include/Scintilla.h ../lexlib/PropSetSimple.h \
../include/SciLexer.h ../lexlib/LexerModule.h ../src/Catalogue.h \
../include/ILexer.h ../include/Scintilla.h ../include/SciLexer.h \
../lexlib/PropSetSimple.h ../lexlib/LexerModule.h ../src/Catalogue.h \
../src/SplitVector.h ../src/Partitioning.h ../src/RunStyles.h \
../src/ContractionState.h ../src/CellBuffer.h ../src/CallTip.h \
../src/KeyMap.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h ../src/AutoComplete.h \
../src/CharClassify.h ../src/Decoration.h ../src/CaseFolder.h \
../src/Document.h ../src/Selection.h ../src/PositionCache.h \
../src/Editor.h ../src/ScintillaBase.h
../src/Style.h ../src/ViewStyle.h ../src/CharClassify.h \
../src/Decoration.h ../src/CaseFolder.h ../src/Document.h \
../src/Selection.h ../src/PositionCache.h ../src/EditModel.h \
../src/MarginView.h ../src/EditView.h ../src/Editor.h \
../src/AutoComplete.h ../src/ScintillaBase.h
Selection.o: ../src/Selection.cxx ../include/Platform.h \
../include/Scintilla.h ../src/Selection.h
Style.o: ../src/Style.cxx ../include/Platform.h ../include/Scintilla.h \
@ -90,3 +122,417 @@ ViewStyle.o: ../src/ViewStyle.cxx ../include/Platform.h \
../src/RunStyles.h ../src/Indicator.h ../src/XPM.h ../src/LineMarker.h \
../src/Style.h ../src/ViewStyle.h
XPM.o: ../src/XPM.cxx ../include/Platform.h ../src/XPM.h
Accessor.o: ../lexlib/Accessor.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h
CharacterCategory.o: ../lexlib/CharacterCategory.cxx \
../lexlib/StringCopy.h ../lexlib/CharacterCategory.h
CharacterSet.o: ../lexlib/CharacterSet.cxx ../lexlib/CharacterSet.h
LexerBase.o: ../lexlib/LexerBase.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/LexerModule.h ../lexlib/LexerBase.h
LexerModule.o: ../lexlib/LexerModule.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/LexerModule.h ../lexlib/LexerBase.h ../lexlib/LexerSimple.h
LexerNoExceptions.o: ../lexlib/LexerNoExceptions.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/LexerModule.h ../lexlib/LexerBase.h \
../lexlib/LexerNoExceptions.h
LexerSimple.o: ../lexlib/LexerSimple.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/LexerModule.h ../lexlib/LexerBase.h ../lexlib/LexerSimple.h
PropSetSimple.o: ../lexlib/PropSetSimple.cxx ../lexlib/PropSetSimple.h
StyleContext.o: ../lexlib/StyleContext.cxx ../include/ILexer.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h
WordList.o: ../lexlib/WordList.cxx ../lexlib/StringCopy.h \
../lexlib/WordList.h
LexA68k.o: ../lexers/LexA68k.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexAPDL.o: ../lexers/LexAPDL.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexASY.o: ../lexers/LexASY.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexAU3.o: ../lexers/LexAU3.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexAVE.o: ../lexers/LexAVE.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexAVS.o: ../lexers/LexAVS.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexAbaqus.o: ../lexers/LexAbaqus.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexAda.o: ../lexers/LexAda.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexAsm.o: ../lexers/LexAsm.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h ../lexlib/OptionSet.h
LexAsn1.o: ../lexers/LexAsn1.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexBaan.o: ../lexers/LexBaan.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexBash.o: ../lexers/LexBash.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexBasic.o: ../lexers/LexBasic.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h ../lexlib/OptionSet.h
LexBullant.o: ../lexers/LexBullant.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexCLW.o: ../lexers/LexCLW.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexCOBOL.o: ../lexers/LexCOBOL.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexCPP.o: ../lexers/LexCPP.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h ../lexlib/OptionSet.h ../lexlib/SparseState.h \
../lexlib/SubStyles.h
LexCSS.o: ../lexers/LexCSS.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexCaml.o: ../lexers/LexCaml.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexCmake.o: ../lexers/LexCmake.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexCoffeeScript.o: ../lexers/LexCoffeeScript.cxx ../include/Platform.h \
../include/ILexer.h ../include/Scintilla.h ../include/SciLexer.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexConf.o: ../lexers/LexConf.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexCrontab.o: ../lexers/LexCrontab.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexCsound.o: ../lexers/LexCsound.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexD.o: ../lexers/LexD.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h ../lexlib/OptionSet.h
LexDMAP.o: ../lexers/LexDMAP.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexDMIS.o: ../lexers/LexDMIS.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexECL.o: ../lexers/LexECL.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/PropSetSimple.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h ../lexlib/OptionSet.h
LexEScript.o: ../lexers/LexEScript.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexEiffel.o: ../lexers/LexEiffel.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexErlang.o: ../lexers/LexErlang.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexFlagship.o: ../lexers/LexFlagship.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexForth.o: ../lexers/LexForth.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexFortran.o: ../lexers/LexFortran.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexGAP.o: ../lexers/LexGAP.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexGui4Cli.o: ../lexers/LexGui4Cli.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexHTML.o: ../lexers/LexHTML.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/StringCopy.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexHaskell.o: ../lexers/LexHaskell.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/CharacterCategory.h ../lexlib/LexerModule.h \
../lexlib/OptionSet.h
LexInno.o: ../lexers/LexInno.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexKVIrc.o: ../lexers/LexKVIrc.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexKix.o: ../lexers/LexKix.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexLaTeX.o: ../lexers/LexLaTeX.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h ../lexlib/LexerBase.h
LexLisp.o: ../lexers/LexLisp.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexLout.o: ../lexers/LexLout.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexLua.o: ../lexers/LexLua.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexMMIXAL.o: ../lexers/LexMMIXAL.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexMPT.o: ../lexers/LexMPT.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexMSSQL.o: ../lexers/LexMSSQL.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexMagik.o: ../lexers/LexMagik.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexMarkdown.o: ../lexers/LexMarkdown.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexMatlab.o: ../lexers/LexMatlab.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexMetapost.o: ../lexers/LexMetapost.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexModula.o: ../lexers/LexModula.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexMySQL.o: ../lexers/LexMySQL.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexNimrod.o: ../lexers/LexNimrod.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexNsis.o: ../lexers/LexNsis.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexOScript.o: ../lexers/LexOScript.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexOpal.o: ../lexers/LexOpal.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexOthers.o: ../lexers/LexOthers.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexPB.o: ../lexers/LexPB.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexPLM.o: ../lexers/LexPLM.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexPO.o: ../lexers/LexPO.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexPOV.o: ../lexers/LexPOV.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexPS.o: ../lexers/LexPS.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexPascal.o: ../lexers/LexPascal.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexPerl.o: ../lexers/LexPerl.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h ../lexlib/OptionSet.h
LexPowerPro.o: ../lexers/LexPowerPro.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexPowerShell.o: ../lexers/LexPowerShell.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexProgress.o: ../lexers/LexProgress.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexPython.o: ../lexers/LexPython.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexR.o: ../lexers/LexR.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexRebol.o: ../lexers/LexRebol.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexRuby.o: ../lexers/LexRuby.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexRust.o: ../lexers/LexRust.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/PropSetSimple.h \
../lexlib/WordList.h ../lexlib/LexAccessor.h ../lexlib/Accessor.h \
../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h ../lexlib/OptionSet.h
LexSML.o: ../lexers/LexSML.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexSQL.o: ../lexers/LexSQL.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h ../lexlib/OptionSet.h ../lexlib/SparseState.h
LexSTTXT.o: ../lexers/LexSTTXT.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexScriptol.o: ../lexers/LexScriptol.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexSmalltalk.o: ../lexers/LexSmalltalk.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexSorcus.o: ../lexers/LexSorcus.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexSpecman.o: ../lexers/LexSpecman.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexSpice.o: ../lexers/LexSpice.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexTACL.o: ../lexers/LexTACL.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexTADS3.o: ../lexers/LexTADS3.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexTAL.o: ../lexers/LexTAL.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexTCL.o: ../lexers/LexTCL.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexTCMD.o: ../lexers/LexTCMD.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexTeX.o: ../lexers/LexTeX.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexTxt2tags.o: ../lexers/LexTxt2tags.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexVB.o: ../lexers/LexVB.cxx ../include/ILexer.h ../include/Scintilla.h \
../include/SciLexer.h ../lexlib/WordList.h ../lexlib/LexAccessor.h \
../lexlib/Accessor.h ../lexlib/StyleContext.h ../lexlib/CharacterSet.h \
../lexlib/LexerModule.h
LexVHDL.o: ../lexers/LexVHDL.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexVerilog.o: ../lexers/LexVerilog.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h
LexVisualProlog.o: ../lexers/LexVisualProlog.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/CharacterCategory.h \
../lexlib/LexerModule.h ../lexlib/OptionSet.h
LexYAML.o: ../lexers/LexYAML.cxx ../include/ILexer.h \
../include/Scintilla.h ../include/SciLexer.h ../lexlib/WordList.h \
../lexlib/LexAccessor.h ../lexlib/Accessor.h ../lexlib/StyleContext.h \
../lexlib/CharacterSet.h ../lexlib/LexerModule.h

View File

@ -8,13 +8,13 @@
.SUFFIXES: .cxx .c .o .h .a
ifdef CLANG
CC = clang --std=c++0x
CCOMP = clang
else
CC = g++
CCOMP = gcc
CXX = clang++ -Wno-deprecated-register
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
endif
AR = ar
RANLIB = touch
ifdef GTK3
@ -46,7 +46,7 @@ INCLUDEDIRS=-I ../include -I ../src -I ../lexlib
ifdef CHECK_DEPRECATED
DEPRECATED=-DGDK_PIXBUF_DISABLE_DEPRECATED -DGDK_DISABLE_DEPRECATED -DGTK_DISABLE_DEPRECATED -DDISABLE_GDK_FONT
endif
CXXBASEFLAGS=-Wall -Wno-missing-braces -Wno-char-subscripts -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED)
CXXBASEFLAGS=-Wall -pedantic -DGTK -DSCI_LEXER $(INCLUDEDIRS) $(DEPRECATED)
ifdef NOTHREADS
THREADFLAGS=-DG_THREADS_IMPL_NONE
@ -54,25 +54,30 @@ else
THREADFLAGS=
endif
ifdef DEBUG
ifdef CLANG
CXXTFLAGS=-DDEBUG -g -fsanitize=address $(CXXBASEFLAGS) $(THREADFLAGS)
else
CXXTFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS)
endif
else
CXXTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
ifdef CXX11_REGEX
REFLAGS=-DCXX11_REGEX
endif
CFLAGS:=$(CXXTFLAGS)
ifdef DEBUG
ifdef CLANG
CTFLAGS=-DDEBUG -g -fsanitize=$(SANITIZE) $(CXXBASEFLAGS) $(THREADFLAGS)
else
CTFLAGS=-DDEBUG -g $(CXXBASEFLAGS) $(THREADFLAGS)
endif
else
CTFLAGS=-DNDEBUG -Os $(CXXBASEFLAGS) $(THREADFLAGS)
endif
CFLAGS:=$(CTFLAGS)
CXXTFLAGS:=--std=c++0x $(CTFLAGS) $(REFLAGS)
CONFIGFLAGS:=$(shell pkg-config --cflags $(GTKVERSION))
MARSHALLER=scintilla-marshal.o
.cxx.o:
$(CC) $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) -c $<
$(CXX) $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) -c $<
.c.o:
$(CCOMP) $(CONFIGFLAGS) $(CFLAGS) -w -c $<
$(CC) $(CONFIGFLAGS) $(CFLAGS) -w -c $<
LEXOBJS:=$(addsuffix .o,$(basename $(notdir $(wildcard ../lexers/Lex*.cxx))))
@ -85,11 +90,12 @@ analyze:
clang --analyze $(CONFIGFLAGS) $(CXXTFLAGS) $(CXXFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx
deps:
$(CC) -MM $(CONFIGFLAGS) $(CXXTFLAGS) *.cxx ../src/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak
$(CXX) -MM $(CONFIGFLAGS) $(CXXTFLAGS) *.cxx ../src/*.cxx ../lexlib/*.cxx ../lexers/*.cxx | sed -e 's/\/usr.* //' | grep [a-zA-Z] >deps.mak
$(COMPLIB): Accessor.o CharacterSet.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 Editor.o ExternalLexer.o PropSetSimple.o PlatGTK.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 \
RESearch.o RunStyles.o Selection.o Style.o Indicator.o AutoComplete.o UniConversion.o XPM.o \
$(MARSHALLER) $(LEXOBJS)

View File

@ -75,6 +75,8 @@ public:
virtual int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) = 0;
virtual int SCI_METHOD SubStylesStart(int styleBase) = 0;
virtual int SCI_METHOD SubStylesLength(int styleBase) = 0;
virtual int SCI_METHOD StyleFromSubStyle(int subStyle) = 0;
virtual int SCI_METHOD PrimaryStyleFromStyle(int style) = 0;
virtual void SCI_METHOD FreeSubStyles() = 0;
virtual void SCI_METHOD SetIdentifiers(int style, const char *identifiers) = 0;
virtual int SCI_METHOD DistanceToSecondaryStyles() = 0;

View File

@ -77,7 +77,9 @@ namespace Scintilla {
typedef float XYPOSITION;
typedef double XYACCUMULATOR;
//#define XYPOSITION int
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
@ -92,7 +94,7 @@ typedef void *IdlerID;
/**
* A geometric point class.
* Point is exactly the same as the Win32 POINT and GTK+ GdkPoint so can be used interchangeably.
* Point is similar to the Win32 POINT and GTK+ GdkPoint types.
*/
class Point {
public:
@ -102,6 +104,10 @@ public:
explicit Point(XYPOSITION x_=0, XYPOSITION y_=0) : x(x_), y(y_) {
}
static Point FromInts(int x_, int y_) {
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);
@ -109,7 +115,7 @@ public:
/**
* A geometric rectangle class.
* PRectangle is exactly the same as the Win32 RECT so can be used interchangeably.
* PRectangle is similar to the Win32 RECT.
* PRectangles contain their top and left sides, but not their right and bottom sides.
*/
class PRectangle {
@ -119,10 +125,15 @@ public:
XYPOSITION right;
XYPOSITION bottom;
PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) :
explicit PRectangle(XYPOSITION left_=0, XYPOSITION top_=0, XYPOSITION right_=0, XYPOSITION bottom_ = 0) :
left(left_), top(top_), right(right_), bottom(bottom_) {
}
static PRectangle FromInts(int left_, int top_, int right_, int bottom_) {
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 {
@ -133,6 +144,11 @@ public:
return (pt.x >= left) && (pt.x <= right) &&
(pt.y >= top) && (pt.y <= bottom);
}
bool ContainsWholePixel(Point pt) const {
// 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 {
return (rc.left >= left) && (rc.right <= right) &&
(rc.top >= top) && (rc.bottom <= bottom);
@ -255,9 +271,6 @@ struct FontParameters {
class Font {
protected:
FontID fid;
#if PLAT_WX
int ascent;
#endif
// Private so Font objects can not be copied
Font(const Font &);
Font &operator=(const Font &);
@ -271,9 +284,6 @@ public:
FontID GetID() { return fid; }
// Alias another font - caller guarantees not to Release
void SetID(FontID fid_) { fid = fid_; }
#if PLAT_WX
void SetAscent(int ascent_) { ascent = ascent_; }
#endif
friend class Surface;
friend class SurfaceImpl;
};
@ -345,22 +355,10 @@ typedef void (*CallBackAction)(void*);
class Window {
protected:
WindowID wid;
#if PLAT_MACOSX
void *windowRef;
void *control;
#endif
public:
Window() : wid(0), cursorLast(cursorInvalid) {
#if PLAT_MACOSX
windowRef = 0;
control = 0;
#endif
}
Window(const Window &source) : wid(source.wid), cursorLast(cursorInvalid) {
#if PLAT_MACOSX
windowRef = 0;
control = 0;
#endif
}
virtual ~Window();
Window &operator=(WindowID wid_) {
@ -383,10 +381,6 @@ public:
void SetCursor(Cursor curs);
void SetTitle(const char *s);
PRectangle GetMonitorRect(Point pt);
#if PLAT_MACOSX
void SetWindow(void *ref) { windowRef = ref; }
void SetControl(void *_control) { control = _control; }
#endif
private:
Cursor cursorLast;
};
@ -460,6 +454,16 @@ public:
static DynamicLibrary *Load(const char *modulePath);
};
#if defined(__clang__)
# if __has_feature(attribute_analyzer_noreturn)
# define CLANG_ANALYZER_NORETURN __attribute__((analyzer_noreturn))
# else
# define CLANG_ANALYZER_NORETURN
# endif
#else
# define CLANG_ANALYZER_NORETURN
#endif
/**
* Platform class used to retrieve system wide parameters such as double click speed
* and chrome colour. Not a creatable object, more of a module with several functions.
@ -504,7 +508,7 @@ public:
}
static void DebugPrintf(const char *format, ...);
static bool ShowAssertionPopUps(bool assertionPopUps_);
static void Assert(const char *c, const char *file, int line);
static void Assert(const char *c, const char *file, int line) CLANG_ANALYZER_NORETURN;
static int Clamp(int val, int minVal, int maxVal);
};
@ -522,15 +526,8 @@ public:
}
#endif
// Shut up annoying Visual C++ warnings:
#ifdef _MSC_VER
#pragma warning(disable: 4244 4309 4514 4710)
#endif
#if defined(__GNUC__) && defined(SCINTILLA_QT)
#pragma GCC diagnostic ignored "-Wmissing-braces"
#pragma GCC diagnostic ignored "-Wmissing-field-initializers"
#pragma GCC diagnostic ignored "-Wchar-subscripts"
#endif
#endif

View File

@ -122,6 +122,16 @@
#define SCLEX_VISUALPROLOG 107
#define SCLEX_LITERATEHASKELL 108
#define SCLEX_STTXT 109
#define SCLEX_KVIRC 110
#define SCLEX_RUST 111
#define SCLEX_DMAP 112
#define SCLEX_AS 113
#define SCLEX_DMIS 114
#define SCLEX_REGISTRY 115
#define SCLEX_BIBTEX 116
#define SCLEX_SREC 117
#define SCLEX_IHEX 118
#define SCLEX_TEHEX 119
#define SCLEX_SEARCHRESULT 150
#define SCLEX_OBJC 151
#define SCLEX_USER 152
@ -178,6 +188,9 @@
#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
@ -539,6 +552,10 @@
#define SCE_B_ERROR 16
#define SCE_B_HEXNUMBER 17
#define SCE_B_BINNUMBER 18
#define SCE_B_COMMENTBLOCK 19
#define SCE_B_DOCLINE 20
#define SCE_B_DOCBLOCK 21
#define SCE_B_DOCKEYWORD 22
#define SCE_PROPS_DEFAULT 0
#define SCE_PROPS_COMMENT 1
#define SCE_PROPS_SECTION 2
@ -1005,6 +1022,11 @@
#define SCE_V_IDENTIFIER 11
#define SCE_V_STRINGEOL 12
#define SCE_V_USER 19
#define SCE_V_COMMENT_WORD 20
#define SCE_V_INPUT 21
#define SCE_V_OUTPUT 22
#define SCE_V_INOUT 23
#define SCE_V_PORT_CONNECT 24
#define SCE_KIX_DEFAULT 0
#define SCE_KIX_COMMENT 1
#define SCE_KIX_STRING1 2
@ -1015,6 +1037,7 @@
#define SCE_KIX_KEYWORD 7
#define SCE_KIX_FUNCTIONS 8
#define SCE_KIX_OPERATOR 9
#define SCE_KIX_COMMENTSTREAM 10
#define SCE_KIX_IDENTIFIER 31
#define SCE_GC_DEFAULT 0
#define SCE_GC_COMMENTLINE 1
@ -1111,6 +1134,7 @@
#define SCE_VHDL_STDPACKAGE 12
#define SCE_VHDL_STDTYPE 13
#define SCE_VHDL_USERWORD 14
#define SCE_VHDL_BLOCK_COMMENT 15
#define SCE_CAML_DEFAULT 0
#define SCE_CAML_IDENTIFIER 1
#define SCE_CAML_TAGNAME 2
@ -1222,6 +1246,7 @@
#define SCE_SQL_USER3 21
#define SCE_SQL_USER4 22
#define SCE_SQL_QUOTEDIDENTIFIER 23
#define SCE_SQL_QOPERATOR 24
#define SCE_ST_DEFAULT 0
#define SCE_ST_STRING 1
#define SCE_ST_NUMBER 2
@ -1660,7 +1685,6 @@
#define SCE_COFFEESCRIPT_GLOBALCLASS 19
#define SCE_COFFEESCRIPT_STRINGRAW 20
#define SCE_COFFEESCRIPT_TRIPLEVERBATIM 21
#define SCE_COFFEESCRIPT_HASHQUOTEDSTRING 22
#define SCE_COFFEESCRIPT_COMMENTBLOCK 22
#define SCE_COFFEESCRIPT_VERBOSE_REGEX 23
#define SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT 24
@ -1768,6 +1792,103 @@
#define SCE_STTXT_DATETIME 16
#define SCE_STTXT_VARS 17
#define SCE_STTXT_PRAGMAS 18
#define SCE_KVIRC_DEFAULT 0
#define SCE_KVIRC_COMMENT 1
#define SCE_KVIRC_COMMENTBLOCK 2
#define SCE_KVIRC_STRING 3
#define SCE_KVIRC_WORD 4
#define SCE_KVIRC_KEYWORD 5
#define SCE_KVIRC_FUNCTION_KEYWORD 6
#define SCE_KVIRC_FUNCTION 7
#define SCE_KVIRC_VARIABLE 8
#define SCE_KVIRC_NUMBER 9
#define SCE_KVIRC_OPERATOR 10
#define SCE_KVIRC_STRING_FUNCTION 11
#define SCE_KVIRC_STRING_VARIABLE 12
#define SCE_RUST_DEFAULT 0
#define SCE_RUST_COMMENTBLOCK 1
#define SCE_RUST_COMMENTLINE 2
#define SCE_RUST_COMMENTBLOCKDOC 3
#define SCE_RUST_COMMENTLINEDOC 4
#define SCE_RUST_NUMBER 5
#define SCE_RUST_WORD 6
#define SCE_RUST_WORD2 7
#define SCE_RUST_WORD3 8
#define SCE_RUST_WORD4 9
#define SCE_RUST_WORD5 10
#define SCE_RUST_WORD6 11
#define SCE_RUST_WORD7 12
#define SCE_RUST_STRING 13
#define SCE_RUST_STRINGR 14
#define SCE_RUST_CHARACTER 15
#define SCE_RUST_OPERATOR 16
#define SCE_RUST_IDENTIFIER 17
#define SCE_RUST_LIFETIME 18
#define SCE_RUST_MACRO 19
#define SCE_RUST_LEXERROR 20
#define SCE_RUST_BYTESTRING 21
#define SCE_RUST_BYTESTRINGR 22
#define SCE_RUST_BYTECHARACTER 23
#define SCE_DMAP_DEFAULT 0
#define SCE_DMAP_COMMENT 1
#define SCE_DMAP_NUMBER 2
#define SCE_DMAP_STRING1 3
#define SCE_DMAP_STRING2 4
#define SCE_DMAP_STRINGEOL 5
#define SCE_DMAP_OPERATOR 6
#define SCE_DMAP_IDENTIFIER 7
#define SCE_DMAP_WORD 8
#define SCE_DMAP_WORD2 9
#define SCE_DMAP_WORD3 10
#define SCE_DMIS_DEFAULT 0
#define SCE_DMIS_COMMENT 1
#define SCE_DMIS_STRING 2
#define SCE_DMIS_NUMBER 3
#define SCE_DMIS_KEYWORD 4
#define SCE_DMIS_MAJORWORD 5
#define SCE_DMIS_MINORWORD 6
#define SCE_DMIS_UNSUPPORTED_MAJOR 7
#define SCE_DMIS_UNSUPPORTED_MINOR 8
#define SCE_DMIS_LABEL 9
#define SCE_REG_DEFAULT 0
#define SCE_REG_COMMENT 1
#define SCE_REG_VALUENAME 2
#define SCE_REG_STRING 3
#define SCE_REG_HEXDIGIT 4
#define SCE_REG_VALUETYPE 5
#define SCE_REG_ADDEDKEY 6
#define SCE_REG_DELETEDKEY 7
#define SCE_REG_ESCAPED 8
#define SCE_REG_KEYPATH_GUID 9
#define SCE_REG_STRING_GUID 10
#define SCE_REG_PARAMETER 11
#define SCE_REG_OPERATOR 12
#define SCE_BIBTEX_DEFAULT 0
#define SCE_BIBTEX_ENTRY 1
#define SCE_BIBTEX_UNKNOWN_ENTRY 2
#define SCE_BIBTEX_KEY 3
#define SCE_BIBTEX_PARAMETER 4
#define SCE_BIBTEX_VALUE 5
#define SCE_BIBTEX_COMMENT 6
#define SCE_HEX_DEFAULT 0
#define SCE_HEX_RECSTART 1
#define SCE_HEX_RECTYPE 2
#define SCE_HEX_RECTYPE_UNKNOWN 3
#define SCE_HEX_BYTECOUNT 4
#define SCE_HEX_BYTECOUNT_WRONG 5
#define SCE_HEX_NOADDRESS 6
#define SCE_HEX_DATAADDRESS 7
#define SCE_HEX_RECCOUNT 8
#define SCE_HEX_STARTADDRESS 9
#define SCE_HEX_ADDRESSFIELD_UNKNOWN 10
#define SCE_HEX_EXTENDEDADDRESS 11
#define SCE_HEX_DATA_ODD 12
#define SCE_HEX_DATA_EVEN 13
#define SCE_HEX_DATA_UNKNOWN 14
#define SCE_HEX_DATA_EMPTY 15
#define SCE_HEX_CHECKSUM 16
#define SCE_HEX_CHECKSUM_WRONG 17
#define SCE_HEX_GARBAGE 18
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif

View File

@ -18,9 +18,9 @@ extern "C" {
#if defined(_WIN32)
/* Return false on failure: */
int Scintilla_RegisterClasses(void *hInstance);
int Scintilla_ReleaseResources();
int Scintilla_ReleaseResources(void);
#endif
int Scintilla_LinkLexers();
int Scintilla_LinkLexers(void);
#ifdef __cplusplus
}
@ -50,6 +50,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_ADDTEXT 2001
#define SCI_ADDSTYLEDTEXT 2002
#define SCI_INSERTTEXT 2003
#define SCI_CHANGEINSERTION 2672
#define SCI_CLEARALL 2004
#define SCI_DELETERANGE 2645
#define SCI_CLEARDOCUMENTSTYLE 2005
@ -91,8 +92,15 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SETBUFFEREDDRAW 2035
#define SCI_SETTABWIDTH 2036
#define SCI_GETTABWIDTH 2121
#define SCI_CLEARTABSTOPS 2675
#define SCI_ADDTABSTOP 2676
#define SCI_GETNEXTTABSTOP 2677
#define SC_CP_UTF8 65001
#define SCI_SETCODEPAGE 2037
#define SC_IME_WINDOWED 0
#define SC_IME_INLINE 1
#define SCI_GETIMEINTERACTION 2678
#define SCI_SETIMEINTERACTION 2679
#define MARKER_MAX 31
#define SC_MARK_CIRCLE 0
#define SC_MARK_ROUNDRECT 1
@ -125,6 +133,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MARK_AVAILABLE 28
#define SC_MARK_UNDERLINE 29
#define SC_MARK_RGBAIMAGE 30
#define SC_MARK_BOOKMARK 31
#define SC_MARK_CHARACTER 10000
#define SC_MARKNUM_FOLDEREND 25
#define SC_MARKNUM_FOLDEROPENMID 26
@ -265,7 +274,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define INDIC_DOTBOX 12
#define INDIC_SQUIGGLEPIXMAP 13
#define INDIC_COMPOSITIONTHICK 14
#define INDIC_MAX 31
#define INDIC_COMPOSITIONTHIN 15
#define INDIC_FULLBOX 16
#define INDIC_TEXTFORE 17
#define INDIC_IME 32
#define INDIC_IME_MAX 35
#define INDIC_MAX 35
#define INDIC_CONTAINER 8
#define INDIC0_MASK 0x20
#define INDIC1_MASK 0x40
@ -277,6 +291,15 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_INDICGETFORE 2083
#define SCI_INDICSETUNDER 2510
#define SCI_INDICGETUNDER 2511
#define SCI_INDICSETHOVERSTYLE 2680
#define SCI_INDICGETHOVERSTYLE 2681
#define SCI_INDICSETHOVERFORE 2682
#define SCI_INDICGETHOVERFORE 2683
#define SC_INDICVALUEBIT 0x1000000
#define SC_INDICVALUEMASK 0xFFFFFF
#define SC_INDICFLAG_VALUEFORE 1
#define SCI_INDICSETFLAGS 2684
#define SCI_INDICGETFLAGS 2685
#define SCI_SETWHITESPACEFORE 2084
#define SCI_SETWHITESPACEBACK 2085
#define SCI_SETWHITESPACESIZE 2086
@ -358,11 +381,12 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_PRINT_COLOURONWHITEDEFAULTBG 4
#define SCI_SETPRINTCOLOURMODE 2148
#define SCI_GETPRINTCOLOURMODE 2149
#define SCFIND_WHOLEWORD 2
#define SCFIND_MATCHCASE 4
#define SCFIND_WHOLEWORD 0x2
#define SCFIND_MATCHCASE 0x4
#define SCFIND_WORDSTART 0x00100000
#define SCFIND_REGEXP 0x00200000
#define SCFIND_POSIX 0x00400000
#define SCFIND_CXX11REGEX 0x00800000
#define SCI_FINDTEXT 2150
#define SCI_FORMATRANGE 2151
#define SCI_GETFIRSTVISIBLELINE 2152
@ -408,6 +432,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETTARGETSTART 2191
#define SCI_SETTARGETEND 2192
#define SCI_GETTARGETEND 2193
#define SCI_SETTARGETRANGE 2686
#define SCI_GETTARGETTEXT 2687
#define SCI_REPLACETARGET 2194
#define SCI_REPLACETARGETRE 2195
#define SCI_SEARCHINTARGET 2197
@ -417,6 +443,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_CALLTIPCANCEL 2201
#define SCI_CALLTIPACTIVE 2202
#define SCI_CALLTIPPOSSTART 2203
#define SCI_CALLTIPSETPOSSTART 2214
#define SCI_CALLTIPSETHLT 2204
#define SCI_CALLTIPSETBACK 2205
#define SCI_CALLTIPSETFORE 2206
@ -459,6 +486,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_FOLDFLAG_LINEAFTER_EXPANDED 0x0008
#define SC_FOLDFLAG_LINEAFTER_CONTRACTED 0x0010
#define SC_FOLDFLAG_LEVELNUMBERS 0x0040
#define SC_FOLDFLAG_LINESTATE 0x0080
#define SCI_SETFOLDFLAGS 2233
#define SCI_ENSUREVISIBLEENFORCEPOLICY 2234
#define SCI_SETTABINDENTS 2260
@ -473,6 +501,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_WRAP_NONE 0
#define SC_WRAP_WORD 1
#define SC_WRAP_CHAR 2
#define SC_WRAP_WHITESPACE 3
#define SCI_SETWRAPMODE 2268
#define SCI_GETWRAPMODE 2269
#define SC_WRAPVISUALFLAG_NONE 0x0000
@ -512,6 +541,11 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#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
#define SCI_GETPHASESDRAW 2673
#define SCI_SETPHASESDRAW 2674
#define SC_EFF_QUALITY_MASK 0xF
#define SC_EFF_QUALITY_DEFAULT 0
#define SC_EFF_QUALITY_NON_ANTIALIASED 1
@ -626,6 +660,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_STATUS_OK 0
#define SC_STATUS_FAILURE 1
#define SC_STATUS_BADALLOC 2
#define SC_STATUS_WARN_START 1000
#define SC_STATUS_WARN_REGEX 1001
#define SCI_SETSTATUS 2382
#define SCI_GETSTATUS 2383
#define SCI_SETMOUSEDOWNCAPTURES 2384
@ -673,6 +709,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_PARAUPEXTEND 2416
#define SCI_POSITIONBEFORE 2417
#define SCI_POSITIONAFTER 2418
#define SCI_POSITIONRELATIVE 2670
#define SCI_COPYRANGE 2419
#define SCI_COPYTEXT 2420
#define SC_SEL_STREAM 0
@ -711,6 +748,10 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_CASEINSENSITIVEBEHAVIOUR_IGNORECASE 1
#define SCI_AUTOCSETCASEINSENSITIVEBEHAVIOUR 2634
#define SCI_AUTOCGETCASEINSENSITIVEBEHAVIOUR 2635
#define SC_MULTIAUTOC_ONCE 0
#define SC_MULTIAUTOC_EACH 1
#define SCI_AUTOCSETMULTI 2636
#define SCI_AUTOCGETMULTI 2637
#define SC_ORDER_PRESORTED 0
#define SC_ORDER_PERFORMSORT 1
#define SC_ORDER_CUSTOM 2
@ -756,8 +797,6 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_GETCHARACTERPOINTER 2520
#define SCI_GETRANGEPOINTER 2643
#define SCI_GETGAPPOSITION 2644
#define SCI_SETKEYSUNICODE 2521
#define SCI_GETKEYSUNICODE 2522
#define SCI_INDICSETALPHA 2523
#define SCI_INDICGETALPHA 2524
#define SCI_INDICSETOUTLINEALPHA 2558
@ -791,6 +830,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define ANNOTATION_HIDDEN 0
#define ANNOTATION_STANDARD 1
#define ANNOTATION_BOXED 2
#define ANNOTATION_INDENTED 3
#define SCI_ANNOTATIONSETVISIBLE 2548
#define SCI_ANNOTATIONGETVISIBLE 2549
#define SCI_ANNOTATIONSETSTYLEOFFSET 2550
@ -801,6 +841,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_ADDUNDOACTION 2560
#define SCI_CHARPOSITIONFROMPOINT 2561
#define SCI_CHARPOSITIONFROMPOINTCLOSE 2562
#define SCI_SETMOUSESELECTIONRECTANGULARSWITCH 2668
#define SCI_GETMOUSESELECTIONRECTANGULARSWITCH 2669
#define SCI_SETMULTIPLESELECTION 2563
#define SCI_GETMULTIPLESELECTION 2564
#define SCI_SETADDITIONALSELECTIONTYPING 2565
@ -814,6 +856,7 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_CLEARSELECTIONS 2571
#define SCI_SETSELECTION 2572
#define SCI_ADDSELECTION 2573
#define SCI_DROPSELECTIONN 2671
#define SCI_SETMAINSELECTION 2574
#define SCI_GETMAINSELECTION 2575
#define SCI_SETSELECTIONNCARET 2576
@ -867,6 +910,8 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_SCROLLTOEND 2629
#define SC_TECHNOLOGY_DEFAULT 0
#define SC_TECHNOLOGY_DIRECTWRITE 1
#define SC_TECHNOLOGY_DIRECTWRITERETAIN 2
#define SC_TECHNOLOGY_DIRECTWRITEDC 3
#define SCI_SETTECHNOLOGY 2630
#define SCI_GETTECHNOLOGY 2631
#define SCI_CREATELOADER 2632
@ -877,6 +922,14 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_VCHOMEDISPLAYEXTEND 2653
#define SCI_GETCARETLINEVISIBLEALWAYS 2654
#define SCI_SETCARETLINEVISIBLEALWAYS 2655
#define SC_LINE_END_TYPE_DEFAULT 0
#define SC_LINE_END_TYPE_UNICODE 1
#define SCI_SETLINEENDTYPESALLOWED 2656
#define SCI_GETLINEENDTYPESALLOWED 2657
#define SCI_GETLINEENDTYPESACTIVE 2658
#define SCI_SETREPRESENTATION 2665
#define SCI_GETREPRESENTATION 2666
#define SCI_CLEARREPRESENTATION 2667
#define SCI_STARTRECORD 3001
#define SCI_STOPRECORD 3002
#define SCI_SETLEXER 4001
@ -901,6 +954,16 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCI_PROPERTYTYPE 4015
#define SCI_DESCRIBEPROPERTY 4016
#define SCI_DESCRIBEKEYWORDSETS 4017
#define SCI_GETLINEENDTYPESSUPPORTED 4018
#define SCI_ALLOCATESUBSTYLES 4020
#define SCI_GETSUBSTYLESSTART 4021
#define SCI_GETSUBSTYLESLENGTH 4022
#define SCI_GETSTYLEFROMSUBSTYLE 4027
#define SCI_GETPRIMARYSTYLEFROMSTYLE 4028
#define SCI_FREESUBSTYLES 4023
#define SCI_SETIDENTIFIERS 4024
#define SCI_DISTANCETOSECONDARYSTYLES 4025
#define SCI_GETSUBSTYLEBASES 4026
#define SC_MOD_INSERTTEXT 0x1
#define SC_MOD_DELETETEXT 0x2
#define SC_MOD_CHANGESTYLE 0x4
@ -921,7 +984,9 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SC_MOD_CHANGEANNOTATION 0x20000
#define SC_MOD_CONTAINER 0x40000
#define SC_MOD_LEXERSTATE 0x80000
#define SC_MODEVENTMASKALL 0xFFFFF
#define SC_MOD_INSERTCHECK 0x100000
#define SC_MOD_CHANGETABSTOPS 0x200000
#define SC_MODEVENTMASKALL 0x3FFFFF
#define SC_SEARCHRESULT_LINEBUFFERMAXLENGTH 1024
#define SC_UPDATE_CONTENT 0x1
#define SC_UPDATE_SELECTION 0x2
@ -983,30 +1048,17 @@ typedef sptr_t (*SciFnDirect)(sptr_t ptr, unsigned int iMessage, uptr_t wParam,
#define SCN_AUTOCCANCELLED 2025
#define SCN_AUTOCCHARDELETED 2026
#define SCN_HOTSPOTRELEASECLICK 2027
#ifndef SCI_DISABLE_PROVISIONAL
#define SC_LINE_END_TYPE_DEFAULT 0
#define SC_LINE_END_TYPE_UNICODE 1
#define SCI_SETLINEENDTYPESALLOWED 2656
#define SCI_GETLINEENDTYPESALLOWED 2657
#define SCI_GETLINEENDTYPESACTIVE 2658
#define SCI_GETLINEENDTYPESSUPPORTED 4018
#define SCI_ALLOCATESUBSTYLES 4020
#define SCI_GETSUBSTYLESSTART 4021
#define SCI_GETSUBSTYLESLENGTH 4022
#define SCI_FREESUBSTYLES 4023
#define SCI_SETIDENTIFIERS 4024
#define SCI_DISTANCETOSECONDARYSTYLES 4025
#define SCI_GETSUBSTYLEBASES 4026
#define SCN_FOCUSIN 2028
#define SCN_FOCUSOUT 2029
#define SCN_SCROLLED 2080
#define SCN_FOLDINGSTATECHANGED 2081
#endif
/* --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. */
#ifdef SCI_NAMESPACE
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
namespace Scintilla {
#endif
@ -1022,7 +1074,7 @@ struct Sci_TextRange {
struct Sci_TextToFind {
struct Sci_CharacterRange chrg;
char *lpstrText;
const char *lpstrText;
struct Sci_CharacterRange chrgText;
};
@ -1108,7 +1160,7 @@ struct SearchResultMarkings {
SearchResultMarking *_markings;
};
#ifdef SCI_NAMESPACE
#if defined(__cplusplus) && defined(SCI_NAMESPACE)
}
#endif
@ -1117,6 +1169,8 @@ struct SearchResultMarkings {
#define SC_CP_DBCS 1
#define SCI_SETUSEPALETTE 2039
#define SCI_GETUSEPALETTE 2139
#define SCI_SETKEYSUNICODE 2521
#define SCI_GETKEYSUNICODE 2522
#endif

View File

@ -72,11 +72,11 @@
## Line numbers and positions start at 0.
## String arguments may contain NUL ('\0') characters where the calls provide a length
## argument and retrieve NUL characters. All retrieved strings except for those retrieved
## by GetLine also have a NUL appended but client code should calculate the size that
## will be returned rather than relying upon the NUL whenever possible. Allow for the
## extra NUL character when allocating buffers. The size to allocate for a stringresult
## can be determined by calling with a NULL (0) pointer.
## argument and retrieve NUL characters. APIs marked as NUL-terminated also have a
## NUL appended but client code should calculate the size that will be returned rather
## than relying upon the NUL whenever possible. Allow for the extra NUL character when
## allocating buffers. The size to allocate for a stringresult (not including NUL) can be
## determined by calling with a NULL (0) pointer.
cat Basics
@ -98,6 +98,9 @@ fun void AddStyledText=2002(int length, cells c)
# Insert string at a position.
fun void InsertText=2003(position pos, string text)
# Change the text that is being inserted in response to SC_MOD_INSERTCHECK
fun void ChangeInsertion=2672(int length, string text)
# Delete all text in the document.
fun void ClearAll=2004(,)
@ -183,6 +186,7 @@ set void SetAnchor=2026(position posAnchor,)
# Retrieve the text of the line containing the caret.
# Returns the index of the caret on the line.
# Result is NUL-terminated.
fun int GetCurLine=2027(int length, stringresult text)
# Retrieve the position of the last correctly styled character.
@ -223,6 +227,15 @@ set void SetTabWidth=2036(int tabWidth,)
# Retrieve the visible size of a tab.
get int GetTabWidth=2121(,)
# Clear explicit tabstops on a line.
fun void ClearTabStops=2675(int line,)
# Add an explicit tab stop for a line.
fun void AddTabStop=2676(int line, int x)
# Find the next explicit tab stop position on a line after a position.
fun int GetNextTabStop=2677(int line, int x)
# The SC_CP_UTF8 value can be used to enter Unicode mode.
# This is the same value as CP_UTF8 in Windows
val SC_CP_UTF8=65001
@ -231,6 +244,16 @@ val SC_CP_UTF8=65001
# The SC_CP_UTF8 value can be used to enter Unicode mode.
set void SetCodePage=2037(int codePage,)
enu IMEInteraction=SC_IME_
val SC_IME_WINDOWED=0
val SC_IME_INLINE=1
# Is the IME displayed in a winow or inline?
get int GetIMEInteraction=2678(,)
# Choose to display the the IME in a winow or inline.
set void SetIMEInteraction=2679(int imeInteraction,)
enu MarkerSymbol=SC_MARK_
val MARKER_MAX=31
val SC_MARK_CIRCLE=0
@ -268,6 +291,7 @@ val SC_MARK_LEFTRECT=27
val SC_MARK_AVAILABLE=28
val SC_MARK_UNDERLINE=29
val SC_MARK_RGBAIMAGE=30
val SC_MARK_BOOKMARK=31
val SC_MARK_CHARACTER=10000
@ -456,6 +480,7 @@ get int StyleGetSize=2485(int style,)
# Get the font of a style.
# Returns the length of the fontName
# Result is NUL-terminated.
get int StyleGetFont=2486(int style, stringresult fontName)
# Get is a style to have its end of line filled or not.
@ -555,7 +580,7 @@ set void SetCaretPeriod=2076(int periodMilliseconds,)
set void SetWordChars=2077(, string characters)
# Get the set of characters making up words for when moving or selecting by word.
# Retuns the number of characters
# Returns the number of characters
get int GetWordChars=2646(, stringresult characters)
# Start a sequence of actions that is undone and redone as a unit.
@ -582,7 +607,12 @@ val INDIC_SQUIGGLELOW=11
val INDIC_DOTBOX=12
val INDIC_SQUIGGLEPIXMAP=13
val INDIC_COMPOSITIONTHICK=14
val INDIC_MAX=31
val INDIC_COMPOSITIONTHIN=15
val INDIC_FULLBOX=16
val INDIC_TEXTFORE=17
val INDIC_IME=32
val INDIC_IME_MAX=35
val INDIC_MAX=35
val INDIC_CONTAINER=8
val INDIC0_MASK=0x20
val INDIC1_MASK=0x40
@ -607,6 +637,30 @@ set void IndicSetUnder=2510(int indic, bool under)
# Retrieve whether indicator drawn under or over text.
get bool IndicGetUnder=2511(int indic,)
# Set a hover indicator to plain, squiggle or TT.
set void IndicSetHoverStyle=2680(int indic, int style)
# Retrieve the hover style of an indicator.
get int IndicGetHoverStyle=2681(int indic,)
# Set the foreground hover colour of an indicator.
set void IndicSetHoverFore=2682(int indic, colour fore)
# Retrieve the foreground hover colour of an indicator.
get colour IndicGetHoverFore=2683(int indic,)
val SC_INDICVALUEBIT=0x1000000
val SC_INDICVALUEMASK=0xFFFFFF
enu IndicFlag=SC_INDICFLAG_
val SC_INDICFLAG_VALUEFORE=1
# Set the attributes of an indicator.
set void IndicSetFlags=2684(int indic, int flags)
# Retrieve the attributes of an indicator.
get int IndicGetFlags=2685(int indic,)
# Set the foreground colour of all whitespace and whether to use this setting.
fun void SetWhitespaceFore=2084(bool useSetting, colour fore)
@ -856,18 +910,12 @@ set void SetPrintColourMode=2148(int mode,)
get int GetPrintColourMode=2149(,)
enu FindOption=SCFIND_
val SCFIND_WHOLEWORD=2
val SCFIND_MATCHCASE=4
val SCFIND_WHOLEWORD=0x2
val SCFIND_MATCHCASE=0x4
val SCFIND_WORDSTART=0x00100000
val SCFIND_REGEXP=0x00200000
val SCFIND_POSIX=0x00400000
val SCFIND_REGEXP_DOTMATCHESNL=0x10000000
val SCFIND_REGEXP_EMPTYMATCH_MASK=0xE0000000
val SCFIND_REGEXP_EMPTYMATCH_NONE=0x00000000
val SCFIND_REGEXP_EMPTYMATCH_NOTAFTERMATCH=0x20000000
val SCFIND_REGEXP_EMPTYMATCH_ALL=0x40000000
val SCFIND_REGEXP_EMPTYMATCH_ALLOWATSTART=0x80000000
val SCFIND_REGEXP_SKIPCRLFASONE=0x08000000
val SCFIND_POSIX=0x00400000
val SCFIND_CXX11REGEX=0x00800000
# Find some text in the document.
fun position FindText=2150(int flags, findtext ft)
@ -905,6 +953,7 @@ fun void SetSel=2160(position start, position end)
# Retrieve the selected text.
# Return the length of the text.
# Result is NUL-terminated.
fun int GetSelText=2161(, stringresult text)
# Retrieve a range of text.
@ -975,6 +1024,7 @@ fun void SetText=2181(, string text)
# Retrieve all the text in the document.
# Returns number of characters retrieved.
# Result is NUL-terminated.
fun int GetText=2182(int length, stringresult text)
# Retrieve the number of characters in the document.
@ -1013,6 +1063,12 @@ set void SetTargetEnd=2192(position pos,)
# Get the position that ends the target.
get position GetTargetEnd=2193(,)
# Sets both the start and end of the target in one call.
fun void SetTargetRange=2686(position start, position end)
# Retrieve the text in the target.
get int GetTargetText=2687(, stringresult characters)
# Replace the target text with the argument text.
# Text is counted so it can contain NULs.
# Returns the length of the replacement text.
@ -1049,6 +1105,9 @@ fun bool CallTipActive=2202(,)
# Retrieve the position where the caret was before displaying the call tip.
fun position CallTipPosStart=2203(,)
# Set the start position in order to change when backspacing removes the calltip.
set void CallTipSetPosStart=2214(int posStart,)
# Highlight a segment of the definition.
fun void CallTipSetHlt=2204(int start, int end)
@ -1154,6 +1213,7 @@ val SC_FOLDFLAG_LINEBEFORE_CONTRACTED=0x0004
val SC_FOLDFLAG_LINEAFTER_EXPANDED=0x0008
val SC_FOLDFLAG_LINEAFTER_CONTRACTED=0x0010
val SC_FOLDFLAG_LEVELNUMBERS=0x0040
val SC_FOLDFLAG_LINESTATE=0x0080
# Set some style options for folding.
set void SetFoldFlags=2233(int flags,)
@ -1192,6 +1252,7 @@ enu Wrap=SC_WRAP_
val SC_WRAP_NONE=0
val SC_WRAP_WORD=1
val SC_WRAP_CHAR=2
val SC_WRAP_WHITESPACE=3
# Sets whether text is word wrapped.
set void SetWrapMode=2268(int mode,)
@ -1289,13 +1350,27 @@ get bool GetVScrollBar=2281(,)
# Append a string to the end of the document without changing the selection.
fun void AppendText=2282(int length, string text)
# Is drawing done in two phases with backgrounds drawn before faoregrounds?
# Is drawing done in two phases with backgrounds drawn before foregrounds?
get bool GetTwoPhaseDraw=2283(,)
# In twoPhaseDraw mode, drawing is performed in two phases, first the background
# and then the foreground. This avoids chopping off characters that overlap the next run.
set void SetTwoPhaseDraw=2284(bool twoPhase,)
enu FontQuality=SC_PHASES_
val SC_PHASES_ONE=0
val SC_PHASES_TWO=1
val SC_PHASES_MULTIPLE=2
# How many phases is drawing done in?
get int GetPhasesDraw=2673(,)
# In one phase draw, text is drawn in a series of rectangular blocks with no overlap.
# In two phase draw, text is drawn in a series of lines allowing runs to overlap horizontally.
# In multiple phase draw, each element is drawn over the whole drawing area, allowing text
# to overlap from one line to the next.
set void SetPhasesDraw=2674(int phases,)
# Control font anti-aliasing.
enu FontQuality=SC_EFF_
@ -1325,6 +1400,7 @@ set void SetMultiPaste=2614(int multiPaste,)
get int GetMultiPaste=2615(,)
# Retrieve the value of a tag from a regular expression search.
# Result is NUL-terminated.
get int GetTag=2616(int tagNumber, stringresult tagValue)
# Make the target range start and end be the same as the selection range start and end.
@ -1626,6 +1702,8 @@ enu Status=SC_STATUS_
val SC_STATUS_OK=0
val SC_STATUS_FAILURE=1
val SC_STATUS_BADALLOC=2
val SC_STATUS_WARN_START=1000
val SC_STATUS_WARN_REGEX=1001
# Change error status - 0 = OK.
set void SetStatus=2382(int statusCode,)
@ -1763,6 +1841,10 @@ fun position PositionBefore=2417(position pos,)
# page into account. Maximum value returned is the last position in the document.
fun position PositionAfter=2418(position pos,)
# Given a valid document position, return a position that differs in a number
# of characters. Returned value is always between 0 and last position in document.
fun position PositionRelative=2670(position pos, int relative)
# Copy a range of text to the clipboard. Positions are clipped into the document.
fun void CopyRange=2419(position start, position end)
@ -1866,6 +1948,7 @@ get int AutoCGetCurrent=2445(,)
# Get currently selected item text in the auto-completion list
# Returns the length of the item text
# Result is NUL-terminated.
get int AutoCGetCurrentText=2610(, stringresult s)
enu CaseInsensitiveBehaviour=SC_CASEINSENSITIVEBEHAVIOUR_
@ -1878,6 +1961,16 @@ set void AutoCSetCaseInsensitiveBehaviour=2634(int behaviour,)
# Get auto-completion case insensitive behaviour.
get int AutoCGetCaseInsensitiveBehaviour=2635(,)
enu MultiAutoComplete=SC_MULTIAUTOC_
val SC_MULTIAUTOC_ONCE=0
val SC_MULTIAUTOC_EACH=1
# Change the effect of autocompleting when there are multiple selections.
set void AutoCSetMulti=2636(int multi,)
# Retrieve the effect of autocompleting when there are multiple selections..
get int AutoCGetMulti=2637(,)
enu Ordering=SC_ORDER_
val SC_ORDER_PRESORTED=0
val SC_ORDER_PERFORMSORT=1
@ -2005,12 +2098,6 @@ get int GetRangePointer=2643(int position, int rangeLength)
# the range of a call to GetRangePointer.
get position GetGapPosition=2644(,)
# Always interpret keyboard input as Unicode
set void SetKeysUnicode=2521(bool keysUnicode,)
# Are keys always interpreted as Unicode?
get bool GetKeysUnicode=2522(,)
# Set the alpha fill colour of the given indicator.
set void IndicSetAlpha=2523(int indicator, int alpha)
@ -2103,6 +2190,7 @@ enu AnnotationVisible=ANNOTATION_
val ANNOTATION_HIDDEN=0
val ANNOTATION_STANDARD=1
val ANNOTATION_BOXED=2
val ANNOTATION_INDENTED=3
# Set the visibility for the annotations for a view
set void AnnotationSetVisible=2548(int visible,)
@ -2134,6 +2222,12 @@ fun position CharPositionFromPoint=2561(int x, int y)
# Return INVALID_POSITION if not close to text.
fun position CharPositionFromPointClose=2562(int x, int y)
# Set whether switching to rectangular mode while selecting with the mouse is allowed.
set void SetMouseSelectionRectangularSwitch=2668(bool mouseSelectionRectangularSwitch,)
# Whether switching to rectangular mode while selecting with the mouse is allowed.
get bool GetMouseSelectionRectangularSwitch=2669(,)
# Set whether multiple selections can be made
set void SetMultipleSelection=2563(bool multipleSelection,)
@ -2173,6 +2267,9 @@ fun int SetSelection=2572(int caret, int anchor)
# Add a selection
fun int AddSelection=2573(int caret, int anchor)
# Drop one selection
fun void DropSelectionN=2671(int selection,)
# Set the main selection
set void SetMainSelection=2574(int selection,)
@ -2301,6 +2398,8 @@ fun void ScrollToEnd=2629(,)
val SC_TECHNOLOGY_DEFAULT=0
val SC_TECHNOLOGY_DIRECTWRITE=1
val SC_TECHNOLOGY_DIRECTWRITERETAIN=2
val SC_TECHNOLOGY_DIRECTWRITEDC=3
# Set the technology used.
set void SetTechnology=2630(int technology,)
@ -2333,6 +2432,32 @@ get bool GetCaretLineVisibleAlways=2654(,)
# Sets the caret line to always visible.
set void SetCaretLineVisibleAlways=2655(bool alwaysVisible,)
# Line end types which may be used in addition to LF, CR, and CRLF
# SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator,
# U+2029 Paragraph Separator, and U+0085 Next Line
enu LineEndType=SC_LINE_END_TYPE_
val SC_LINE_END_TYPE_DEFAULT=0
val SC_LINE_END_TYPE_UNICODE=1
# Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding.
set void SetLineEndTypesAllowed=2656(int lineEndBitSet,)
# Get the line end types currently allowed.
get int GetLineEndTypesAllowed=2657(,)
# Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation.
get int GetLineEndTypesActive=2658(,)
# Set the way a character is drawn.
set void SetRepresentation=2665(string encodedCharacter, string representation)
# Set the way a character is drawn.
# Result is NUL-terminated.
get int GetRepresentation=2666(string encodedCharacter, stringresult representation)
# Remove a character representation.
fun void ClearRepresentation=2667(string encodedCharacter,)
# Start notifying the container of all key presses and commands.
fun void StartRecord=3001(,)
@ -2364,10 +2489,12 @@ set void SetLexerLanguage=4006(, string language)
fun void LoadLexerLibrary=4007(, string path)
# Retrieve a "property" value previously set with SetProperty.
# Result is NUL-terminated.
get int GetProperty=4008(string key, stringresult buf)
# Retrieve a "property" value previously set with SetProperty,
# with "$()" variable replacement on returned buffer.
# Result is NUL-terminated.
get int GetPropertyExpanded=4009(string key, stringresult buf)
# Retrieve a "property" value previously set with SetProperty,
@ -2379,12 +2506,14 @@ get int GetStyleBitsNeeded=4011(,)
# Retrieve the name of the lexer.
# Return the length of the text.
# Result is NUL-terminated.
get int GetLexerLanguage=4012(, stringresult text)
# For private communication between an application and a known lexer.
fun int PrivateLexerCall=4013(int operation, int pointer)
# Retrieve a '\n' separated list of properties understood by the current lexer.
# Result is NUL-terminated.
fun int PropertyNames=4014(, stringresult names)
enu TypeProperty=SC_TYPE_
@ -2396,11 +2525,46 @@ val SC_TYPE_STRING=2
fun int PropertyType=4015(string name,)
# Describe a property.
# Result is NUL-terminated.
fun int DescribeProperty=4016(string name, stringresult description)
# Retrieve a '\n' separated list of descriptions of the keyword sets understood by the current lexer.
# Result is NUL-terminated.
fun int DescribeKeyWordSets=4017(, stringresult descriptions)
# Bit set of LineEndType enumertion for which line ends beyond the standard
# LF, CR, and CRLF are supported by the lexer.
get int GetLineEndTypesSupported=4018(,)
# Allocate a set of sub styles for a particular base style, returning start of range
fun int AllocateSubStyles=4020(int styleBase, int numberStyles)
# The starting style number for the sub styles associated with a base style
get int GetSubStylesStart=4021(int styleBase,)
# The number of sub styles associated with a base style
get int GetSubStylesLength=4022(int styleBase,)
# For a sub style, return the base style, else return the argument.
get int GetStyleFromSubStyle=4027(int subStyle,)
# For a secondary style, return the primary style, else return the argument.
get int GetPrimaryStyleFromStyle=4028(int style,)
# Free allocated sub styles
fun void FreeSubStyles=4023(,)
# Set the identifiers that are shown in a particular style
set void SetIdentifiers=4024(int style, string identifiers)
# Where styles are duplicated by a feature such as active/inactive code
# return the distance between the two types.
get int DistanceToSecondaryStyles=4025(,)
# Get the set of base styles that can be extended with sub styles
# Result is NUL-terminated.
get int GetSubStyleBases=4026(, stringresult styles)
# Notifications
# Type of modification and the action which caused the modification.
# These are defined as a bit mask to make it easy to specify which notifications are wanted.
@ -2426,7 +2590,9 @@ val SC_MOD_CHANGEMARGIN=0x10000
val SC_MOD_CHANGEANNOTATION=0x20000
val SC_MOD_CONTAINER=0x40000
val SC_MOD_LEXERSTATE=0x80000
val SC_MODEVENTMASKALL=0xFFFFF
val SC_MOD_INSERTCHECK=0x100000
val SC_MOD_CHANGETABSTOPS=0x200000
val SC_MODEVENTMASKALL=0x3FFFFF
enu Update=SC_UPDATE_
val SC_UPDATE_CONTENT=0x1
@ -2587,6 +2753,16 @@ val SCLEX_OSCRIPT=106
val SCLEX_VISUALPROLOG=107
val SCLEX_LITERATEHASKELL=108
val SCLEX_STTXT=109
val SCLEX_KVIRC=110
val SCLEX_RUST=111
val SCLEX_DMAP=112
val SCLEX_AS=113
val SCLEX_DMIS=114
val SCLEX_REGISTRY=115
val SCLEX_BIBTEX=116
val SCLEX_SREC=117
val SCLEX_IHEX=118
val SCLEX_TEHEX=119
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -2638,6 +2814,9 @@ val SCE_C_TRIPLEVERBATIM=21
val SCE_C_HASHQUOTEDSTRING=22
val SCE_C_PREPROCESSORCOMMENT=23
val SCE_C_PREPROCESSORCOMMENTDOC=24
val SCE_C_USERLITERAL=25
val SCE_C_TASKMARKER=26
val SCE_C_ESCAPESEQUENCE=27
# Lexical states for SCLEX_D
lex D=SCLEX_D SCE_D_
val SCE_D_DEFAULT=0
@ -2690,8 +2869,6 @@ val SCE_TCL_BLOCK_COMMENT=21
# Lexical states for SCLEX_HTML, SCLEX_XML
lex HTML=SCLEX_HTML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
lex XML=SCLEX_XML SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
lex ASP=SCLEX_ASP SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
lex PHP=SCLEX_PHP SCE_H_ SCE_HJ_ SCE_HJA_ SCE_HB_ SCE_HBA_ SCE_HP_ SCE_HPHP_ SCE_HPA_
val SCE_H_DEFAULT=0
val SCE_H_TAG=1
val SCE_H_TAGUNKNOWN=2
@ -2921,6 +3098,10 @@ val SCE_B_LABEL=15
val SCE_B_ERROR=16
val SCE_B_HEXNUMBER=17
val SCE_B_BINNUMBER=18
val SCE_B_COMMENTBLOCK=19
val SCE_B_DOCLINE=20
val SCE_B_DOCBLOCK=21
val SCE_B_DOCKEYWORD=22
# Lexical states for SCLEX_PROPERTIES
lex Properties=SCLEX_PROPERTIES SCE_PROPS_
val SCE_PROPS_DEFAULT=0
@ -3173,8 +3354,9 @@ val SCE_SCRIPTOL_IDENTIFIER=12
val SCE_SCRIPTOL_TRIPLE=13
val SCE_SCRIPTOL_CLASSNAME=14
val SCE_SCRIPTOL_PREPROCESSOR=15
# Lexical states for SCLEX_ASM
# Lexical states for SCLEX_ASM, SCLEX_AS
lex Asm=SCLEX_ASM SCE_ASM_
lex As=SCLEX_AS SCE_ASM_
val SCE_ASM_DEFAULT=0
val SCE_ASM_COMMENT=1
val SCE_ASM_NUMBER=2
@ -3461,6 +3643,11 @@ val SCE_V_OPERATOR=10
val SCE_V_IDENTIFIER=11
val SCE_V_STRINGEOL=12
val SCE_V_USER=19
val SCE_V_COMMENT_WORD=20
val SCE_V_INPUT=21
val SCE_V_OUTPUT=22
val SCE_V_INOUT=23
val SCE_V_PORT_CONNECT=24
# Lexical states for SCLEX_KIX
lex Kix=SCLEX_KIX SCE_KIX_
val SCE_KIX_DEFAULT=0
@ -3473,6 +3660,7 @@ val SCE_KIX_MACRO=6
val SCE_KIX_KEYWORD=7
val SCE_KIX_FUNCTIONS=8
val SCE_KIX_OPERATOR=9
val SCE_KIX_COMMENTSTREAM=10
val SCE_KIX_IDENTIFIER=31
# Lexical states for SCLEX_GUI4CLI
lex Gui4Cli=SCLEX_GUI4CLI SCE_GC_
@ -3583,6 +3771,7 @@ val SCE_VHDL_STDFUNCTION=11
val SCE_VHDL_STDPACKAGE=12
val SCE_VHDL_STDTYPE=13
val SCE_VHDL_USERWORD=14
val SCE_VHDL_BLOCK_COMMENT=15
# Lexical states for SCLEX_CAML
lex Caml=SCLEX_CAML SCE_CAML_
val SCE_CAML_DEFAULT=0
@ -3704,6 +3893,7 @@ val SCE_SQL_USER2=20
val SCE_SQL_USER3=21
val SCE_SQL_USER4=22
val SCE_SQL_QUOTEDIDENTIFIER=23
val SCE_SQL_QOPERATOR=24
# Lexical states for SCLEX_SMALLTALK
lex Smalltalk=SCLEX_SMALLTALK SCE_ST_
val SCE_ST_DEFAULT=0
@ -3931,8 +4121,8 @@ val SCE_R_OPERATOR=8
val SCE_R_IDENTIFIER=9
val SCE_R_INFIX=10
val SCE_R_INFIXEOL=11
# Lexical state for SCLEX_MAGIKSF
lex MagikSF=SCLEX_MAGIKSF SCE_MAGIK_
# Lexical state for SCLEX_MAGIK
lex MagikSF=SCLEX_MAGIK SCE_MAGIK_
val SCE_MAGIK_DEFAULT=0
val SCE_MAGIK_COMMENT=1
val SCE_MAGIK_HYPER_COMMENT=16
@ -4194,7 +4384,6 @@ val SCE_COFFEESCRIPT_COMMENTDOCKEYWORDERROR=18
val SCE_COFFEESCRIPT_GLOBALCLASS=19
val SCE_COFFEESCRIPT_STRINGRAW=20
val SCE_COFFEESCRIPT_TRIPLEVERBATIM=21
val SCE_COFFEESCRIPT_HASHQUOTEDSTRING=22
val SCE_COFFEESCRIPT_COMMENTBLOCK=22
val SCE_COFFEESCRIPT_VERBOSE_REGEX=23
val SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT=24
@ -4312,6 +4501,121 @@ val SCE_STTXT_IDENTIFIER=15
val SCE_STTXT_DATETIME=16
val SCE_STTXT_VARS=17
val SCE_STTXT_PRAGMAS=18
# Lexical states for SCLEX_KVIRC
lex KVIrc=SCLEX_KVIRC SCE_KVIRC_
val SCE_KVIRC_DEFAULT=0
val SCE_KVIRC_COMMENT=1
val SCE_KVIRC_COMMENTBLOCK=2
val SCE_KVIRC_STRING=3
val SCE_KVIRC_WORD=4
val SCE_KVIRC_KEYWORD=5
val SCE_KVIRC_FUNCTION_KEYWORD=6
val SCE_KVIRC_FUNCTION=7
val SCE_KVIRC_VARIABLE=8
val SCE_KVIRC_NUMBER=9
val SCE_KVIRC_OPERATOR=10
val SCE_KVIRC_STRING_FUNCTION=11
val SCE_KVIRC_STRING_VARIABLE=12
# Lexical states for SCLEX_RUST
lex Rust=SCLEX_RUST SCE_RUST_
val SCE_RUST_DEFAULT=0
val SCE_RUST_COMMENTBLOCK=1
val SCE_RUST_COMMENTLINE=2
val SCE_RUST_COMMENTBLOCKDOC=3
val SCE_RUST_COMMENTLINEDOC=4
val SCE_RUST_NUMBER=5
val SCE_RUST_WORD=6
val SCE_RUST_WORD2=7
val SCE_RUST_WORD3=8
val SCE_RUST_WORD4=9
val SCE_RUST_WORD5=10
val SCE_RUST_WORD6=11
val SCE_RUST_WORD7=12
val SCE_RUST_STRING=13
val SCE_RUST_STRINGR=14
val SCE_RUST_CHARACTER=15
val SCE_RUST_OPERATOR=16
val SCE_RUST_IDENTIFIER=17
val SCE_RUST_LIFETIME=18
val SCE_RUST_MACRO=19
val SCE_RUST_LEXERROR=20
val SCE_RUST_BYTESTRING=21
val SCE_RUST_BYTESTRINGR=22
val SCE_RUST_BYTECHARACTER=23
# Lexical states for SCLEX_DMAP
lex DMAP=SCLEX_DMAP SCE_DMAP_
val SCE_DMAP_DEFAULT=0
val SCE_DMAP_COMMENT=1
val SCE_DMAP_NUMBER=2
val SCE_DMAP_STRING1=3
val SCE_DMAP_STRING2=4
val SCE_DMAP_STRINGEOL=5
val SCE_DMAP_OPERATOR=6
val SCE_DMAP_IDENTIFIER=7
val SCE_DMAP_WORD=8
val SCE_DMAP_WORD2=9
val SCE_DMAP_WORD3=10
# Lexical states for SCLEX_DMIS
lex DMIS=SCLEX_DMIS SCE_DMIS_
val SCE_DMIS_DEFAULT=0
val SCE_DMIS_COMMENT=1
val SCE_DMIS_STRING=2
val SCE_DMIS_NUMBER=3
val SCE_DMIS_KEYWORD=4
val SCE_DMIS_MAJORWORD=5
val SCE_DMIS_MINORWORD=6
val SCE_DMIS_UNSUPPORTED_MAJOR=7
val SCE_DMIS_UNSUPPORTED_MINOR=8
val SCE_DMIS_LABEL=9
# Lexical states for SCLEX_REGISTRY
lex REG=SCLEX_REGISTRY SCE_REG_
val SCE_REG_DEFAULT=0
val SCE_REG_COMMENT=1
val SCE_REG_VALUENAME=2
val SCE_REG_STRING=3
val SCE_REG_HEXDIGIT=4
val SCE_REG_VALUETYPE=5
val SCE_REG_ADDEDKEY=6
val SCE_REG_DELETEDKEY=7
val SCE_REG_ESCAPED=8
val SCE_REG_KEYPATH_GUID=9
val SCE_REG_STRING_GUID=10
val SCE_REG_PARAMETER=11
val SCE_REG_OPERATOR=12
# Lexical state for SCLEX_BIBTEX
lex BibTeX=SCLEX_BIBTEX SCE_BIBTEX_
val SCE_BIBTEX_DEFAULT=0
val SCE_BIBTEX_ENTRY=1
val SCE_BIBTEX_UNKNOWN_ENTRY=2
val SCE_BIBTEX_KEY=3
val SCE_BIBTEX_PARAMETER=4
val SCE_BIBTEX_VALUE=5
val SCE_BIBTEX_COMMENT=6
# Lexical state for SCLEX_SREC
lex Srec=SCLEX_SREC SCE_HEX_
val SCE_HEX_DEFAULT=0
val SCE_HEX_RECSTART=1
val SCE_HEX_RECTYPE=2
val SCE_HEX_RECTYPE_UNKNOWN=3
val SCE_HEX_BYTECOUNT=4
val SCE_HEX_BYTECOUNT_WRONG=5
val SCE_HEX_NOADDRESS=6
val SCE_HEX_DATAADDRESS=7
val SCE_HEX_RECCOUNT=8
val SCE_HEX_STARTADDRESS=9
val SCE_HEX_ADDRESSFIELD_UNKNOWN=10
val SCE_HEX_EXTENDEDADDRESS=11
val SCE_HEX_DATA_ODD=12
val SCE_HEX_DATA_EVEN=13
val SCE_HEX_DATA_UNKNOWN=14
val SCE_HEX_DATA_EMPTY=15
val SCE_HEX_CHECKSUM=16
val SCE_HEX_CHECKSUM_WRONG=17
val SCE_HEX_GARBAGE=18
# Lexical state for SCLEX_IHEX (shared with Srec)
lex IHex=SCLEX_IHEX SCE_HEX_
# Lexical state for SCLEX_TEHEX (shared with Srec)
lex TEHex=SCLEX_TEHEX SCE_HEX_
# Events
@ -4343,51 +4647,13 @@ evt void IndicatorRelease=2024(int modifiers, int position)
evt void AutoCCancelled=2025(void)
evt void AutoCCharDeleted=2026(void)
evt void HotSpotReleaseClick=2027(int modifiers, int position)
evt void FocusIn=2028(void)
evt void FocusOut=2029(void)
# There are no provisional features currently
cat Provisional
# Line end types which may be used in addition to LF, CR, and CRLF
# SC_LINE_END_TYPE_UNICODE includes U+2028 Line Separator,
# U+2029 Paragraph Separator, and U+0085 Next Line
enu LineEndType=SC_LINE_END_TYPE_
val SC_LINE_END_TYPE_DEFAULT=0
val SC_LINE_END_TYPE_UNICODE=1
# Set the line end types that the application wants to use. May not be used if incompatible with lexer or encoding.
set void SetLineEndTypesAllowed=2656(int lineEndBitSet,)
# Get the line end types currently allowed.
get int GetLineEndTypesAllowed=2657(,)
# Get the line end types currently recognised. May be a subset of the allowed types due to lexer limitation.
get int GetLineEndTypesActive=2658(,)
# Bit set of LineEndType enumertion for which line ends beyond the standard
# LF, CR, and CRLF are supported by the lexer.
get int GetLineEndTypesSupported=4018(,)
# Allocate a set of sub styles for a particular base style, returning start of range
fun int AllocateSubStyles=4020(int styleBase, int numberStyles)
# The starting style number for the sub styles associated with a base style
get int GetSubStylesStart=4021(int styleBase,)
# The number of sub styles associated with a base style
get int GetSubStylesLength=4022(int styleBase,)
# Free allocated sub styles
fun void FreeSubStyles=4023(,)
# Set the identifiers that are shown in a particular style
set void SetIdentifiers=4024(int style, string identifiers)
# Where styles are duplicated by a feature such as active/inactive code
# return the distance between the two types.
get int DistanceToSecondaryStyles=4025(,)
# Get the set of base styles that can be extended with sub styles
get int GetSubStyleBases=4026(, stringresult styles)
cat Deprecated
# Deprecated in 2.21
@ -4402,3 +4668,11 @@ get bool GetUsePalette=2139(,)
# In palette mode, Scintilla uses the environment's palette calls to display
# more colours. This may lead to ugly displays.
set void SetUsePalette=2039(bool usePalette,)
# Deprecated in 3.5.5
# Always interpret keyboard input as Unicode
set void SetKeysUnicode=2521(bool keysUnicode,)
# Are keys always interpreted as Unicode?
get bool GetKeysUnicode=2522(,)

View File

@ -87,7 +87,7 @@ static inline bool IsAWordStart(const int ch)
}
static inline bool IsAOperator(char ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
if (ch == '+' || ch == '-' || ch == '*' || ch == '/' ||
ch == '&' || ch == '^' || ch == '=' || ch == '<' || ch == '>' ||
@ -228,7 +228,7 @@ static void ColouriseAU3Doc(unsigned int startPos,
char si; // string indicator "=1 '=2
char ni; // Numeric indicator error=9 normal=0 normal+dec=1 hex=2 Enot=3
char ci; // comment indicator 0=not linecomment(;)
char s_save[100];
char s_save[100] = "";
si=0;
ni=0;
ci=0;

View File

@ -45,7 +45,7 @@ inline bool IsAWordStart(const int ch) {
}
inline bool isAveOperator(char ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
@ -167,7 +167,7 @@ static void FoldAveDoc(unsigned int startPos, int length, int /* initStyle */, W
char chNext = static_cast<char>(tolower(styler[startPos]));
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
int styleNext = styler.StyleAt(startPos);
char s[10];
char s[10] = "";
for (unsigned int i = startPos; i < lengthDoc; i++) {
char ch = static_cast<char>(tolower(chNext));

View File

@ -30,10 +30,6 @@
using namespace Scintilla;
#endif
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || (ch == '_')));
}
static inline bool IsAKeywordChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == ' ')));
}
@ -42,17 +38,6 @@ static inline bool IsASetChar(const int ch) {
return (ch < 0x80 && (isalnum(ch) || (ch == '_') || (ch == '.') || (ch == '-')));
}
static inline bool IsAnOperator(char ch) {
// '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||
ch == '(' || ch == ')' || ch == '=' || ch == '^' ||
ch == '[' || ch == ']' || ch == '<' || ch == '&' ||
ch == '>' || ch == ',' || ch == '|' || ch == '~' ||
ch == '$' || ch == ':' || ch == '%')
return true;
return false;
}
static void ColouriseABAQUSDoc(unsigned int startPos, int length, int initStyle, WordList*[] /* *keywordlists[] */,
Accessor &styler) {
enum localState { KW_LINE_KW, KW_LINE_COMMA, KW_LINE_PAR, KW_LINE_EQ, KW_LINE_VAL, \

View File

@ -511,5 +511,5 @@ static inline bool IsWordCharacter(int ch) {
}
static inline bool IsWordStartCharacter(int ch) {
return (isascii(ch) && isalpha(ch)) || ch == '_';
return (IsASCII(ch) && isalpha(ch)) || ch == '_';
}

View File

@ -150,8 +150,10 @@ class LexerAsm : public ILexer {
WordList directives4foldend;
OptionsAsm options;
OptionSetAsm osAsm;
int commentChar;
public:
LexerAsm() {
LexerAsm(int commentChar_) {
commentChar = commentChar_;
}
virtual ~LexerAsm() {
}
@ -183,7 +185,11 @@ public:
}
static ILexer *LexerFactoryAsm() {
return new LexerAsm();
return new LexerAsm(';');
}
static ILexer *LexerFactoryAs() {
return new LexerAsm('#');
}
};
@ -342,9 +348,9 @@ void SCI_METHOD LexerAsm::Lex(unsigned int startPos, int length, int initStyle,
// Determine if a new state should be entered.
if (sc.state == SCE_ASM_DEFAULT) {
if (sc.ch == ';'){
if (sc.ch == commentChar){
sc.SetState(SCE_ASM_COMMENT);
} else if (isascii(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && isascii(sc.chNext) && isdigit(sc.chNext)))) {
} else if (IsASCII(sc.ch) && (isdigit(sc.ch) || (sc.ch == '.' && IsASCII(sc.chNext) && isdigit(sc.chNext)))) {
sc.SetState(SCE_ASM_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_ASM_IDENTIFIER);
@ -457,4 +463,5 @@ void SCI_METHOD LexerAsm::Fold(unsigned int startPos, int length, int initStyle,
}
LexerModule lmAsm(SCLEX_ASM, LexerAsm::LexerFactoryAsm, "asm", asmWordListDesc);
LexerModule lmAs(SCLEX_AS, LexerAsm::LexerFactoryAs, "as", asmWordListDesc);

View File

@ -108,6 +108,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
CharacterSet setWordStart(CharacterSet::setAlpha, "_");
// note that [+-] are often parts of identifiers in shell scripts
CharacterSet setWord(CharacterSet::setAlphaNum, "._+-");
CharacterSet setMetaCharacter(CharacterSet::setNone, "|&;()<> \t\r\n");
setMetaCharacter.Add(0);
CharacterSet setBashOperator(CharacterSet::setNone, "^&%()-+=|{}[]:;>,*/<?!.~@");
CharacterSet setSingleCharOp(CharacterSet::setNone, "rwxoRWXOezsfdlpSbctugkTBMACahGLNn");
CharacterSet setParam(CharacterSet::setAlphaNum, "$_");
@ -417,8 +419,6 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
sc.Forward();
HereDoc.Quoted = true;
HereDoc.State = 1;
} else if (!HereDoc.Indent && sc.chNext == '-') { // <<- indent case
HereDoc.Indent = true;
} else if (setHereDoc.Contains(sc.chNext)) {
// an unquoted here-doc delimiter, no special handling
// TODO check what exactly bash considers part of the delim
@ -437,12 +437,22 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
HereDoc.State = 1;
}
} else if (HereDoc.State == 1) { // collect the delimiter
if (setHereDoc2.Contains(sc.ch) || sc.chPrev == '\\') {
// * if single quoted, there's no escape
// * if double quoted, there are \\ and \" escapes
if ((HereDoc.Quote == '\'' && sc.ch != HereDoc.Quote) ||
(HereDoc.Quoted && sc.ch != HereDoc.Quote && sc.ch != '\\') ||
(HereDoc.Quote != '\'' && sc.chPrev == '\\') ||
(setHereDoc2.Contains(sc.ch))) {
HereDoc.Append(sc.ch);
} else if (HereDoc.Quoted && sc.ch == HereDoc.Quote) { // closing quote => end of delimiter
sc.ForwardSetState(SCE_SH_DEFAULT);
} else if (sc.ch == '\\') {
// skip escape prefix
if (HereDoc.Quoted && sc.chNext != HereDoc.Quote && sc.chNext != '\\') {
// in quoted prefixes only \ and the quote eat the escape
HereDoc.Append(sc.ch);
} else {
// skip escape prefix
}
} else if (!HereDoc.Quoted) {
sc.SetState(SCE_SH_DEFAULT);
}
@ -457,7 +467,7 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
if (sc.atLineStart) {
sc.SetState(SCE_SH_HERE_Q);
int prefixws = 0;
while (IsASpace(sc.ch) && !sc.atLineEnd) { // whitespace prefix
while (sc.ch == '\t' && !sc.atLineEnd) { // tabulation prefix
sc.Forward();
prefixws++;
}
@ -469,7 +479,8 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
char s[HERE_DELIM_MAX];
sc.GetCurrent(s, sizeof(s));
if (sc.LengthCurrent() == 0) { // '' or "" delimiters
if (prefixws == 0 && HereDoc.Quoted && HereDoc.DelimiterLength == 0)
if ((prefixws == 0 || HereDoc.Indent) &&
HereDoc.Quoted && HereDoc.DelimiterLength == 0)
sc.SetState(SCE_SH_DEFAULT);
break;
}
@ -617,7 +628,12 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
} else if (setWordStart.Contains(sc.ch)) {
sc.SetState(SCE_SH_WORD);
} else if (sc.ch == '#') {
sc.SetState(SCE_SH_COMMENTLINE);
if (stylePrev != SCE_SH_WORD && stylePrev != SCE_SH_IDENTIFIER &&
(sc.currentPos == 0 || setMetaCharacter.Contains(sc.chPrev))) {
sc.SetState(SCE_SH_COMMENTLINE);
} else {
sc.SetState(SCE_SH_WORD);
}
} else if (sc.ch == '\"') {
sc.SetState(SCE_SH_STRING);
QuoteStack.Start(sc.ch, BASH_DELIM_STRING);
@ -655,7 +671,12 @@ static void ColouriseBashDoc(unsigned int startPos, int length, int initStyle,
} else if (sc.Match('<', '<')) {
sc.SetState(SCE_SH_HERE_DELIM);
HereDoc.State = 0;
HereDoc.Indent = false;
if (sc.GetRelative(2) == '-') { // <<- indent case
HereDoc.Indent = true;
sc.Forward();
} else {
HereDoc.Indent = false;
}
} else if (sc.ch == '-' && // one-char file test operators
setSingleCharOp.Contains(sc.chNext) &&
!setWord.Contains(sc.GetRelative(2)) &&
@ -750,6 +771,7 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int skipHereCh = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
@ -781,7 +803,15 @@ static void FoldBashDoc(unsigned int startPos, int length, int, WordList *[],
// Here Document folding
if (style == SCE_SH_HERE_DELIM) {
if (ch == '<' && chNext == '<') {
levelCurrent++;
if (styler.SafeGetCharAt(i + 2) == '<') {
skipHereCh = 1;
} else {
if (skipHereCh == 0) {
levelCurrent++;
} else {
skipHereCh = 0;
}
}
}
} else if (style == SCE_SH_HERE_Q && styler.StyleAt(i+1) == SCE_SH_DEFAULT) {
levelCurrent--;

View File

@ -49,17 +49,18 @@ using namespace Scintilla;
* 8 - decimal digit
* 16 - hex digit
* 32 - bin digit
* 64 - letter
*/
static int character_classification[128] =
{
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 2,
60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2,
2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 4,
2, 20, 20, 20, 20, 20, 20, 4, 4, 4, 4, 4, 4, 4, 4, 4,
4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 2, 2, 2, 2, 0
0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1, 2, 0, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 10, 2,
60, 60, 28, 28, 28, 28, 28, 28, 28, 28, 2, 2, 2, 2, 2, 2,
2, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 2, 2, 2, 2, 68,
2, 84, 84, 84, 84, 84, 84, 68, 68, 68, 68, 68, 68, 68, 68, 68,
68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 68, 2, 2, 2, 2, 0
};
static bool IsSpace(int c) {
@ -86,6 +87,10 @@ static bool IsBinDigit(int c) {
return c < 128 && (character_classification[c] & 32);
}
static bool IsLetter(int c) {
return c < 128 && (character_classification[c] & 64);
}
static int LowerCase(int c)
{
if (c >= 'A' && c <= 'Z')
@ -126,13 +131,23 @@ static int CheckPureFoldPoint(char const *token, int &level) {
static int CheckFreeFoldPoint(char const *token, int &level) {
if (!strcmp(token, "function") ||
!strcmp(token, "sub") ||
!strcmp(token, "type")) {
!strcmp(token, "enum") ||
!strcmp(token, "type") ||
!strcmp(token, "union") ||
!strcmp(token, "property") ||
!strcmp(token, "destructor") ||
!strcmp(token, "constructor")) {
level |= SC_FOLDLEVELHEADERFLAG;
return 1;
}
if (!strcmp(token, "end function") ||
!strcmp(token, "end sub") ||
!strcmp(token, "end type")) {
!strcmp(token, "end enum") ||
!strcmp(token, "end type") ||
!strcmp(token, "end union") ||
!strcmp(token, "end property") ||
!strcmp(token, "end destructor") ||
!strcmp(token, "end constructor")) {
return -1;
}
return 0;
@ -219,9 +234,9 @@ class LexerBasic : public ILexer {
OptionSetBasic osBasic;
public:
LexerBasic(char comment_char_, int (*CheckFoldPoint_)(char const *, int &), const char * const wordListDescriptions[]) :
comment_char(comment_char_),
CheckFoldPoint(CheckFoldPoint_),
osBasic(wordListDescriptions) {
comment_char(comment_char_),
CheckFoldPoint(CheckFoldPoint_),
osBasic(wordListDescriptions) {
}
virtual ~LexerBasic() {
}
@ -302,6 +317,7 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle
bool wasfirst = true, isfirst = true; // true if first token in a line
styler.StartAt(startPos);
int styleBeforeKeyword = SCE_B_DEFAULT;
StyleContext sc(startPos, length, initStyle, styler);
@ -367,14 +383,44 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle
if (sc.atLineEnd) {
sc.SetState(SCE_B_DEFAULT);
}
} else if (sc.state == SCE_B_DOCLINE) {
if (sc.atLineEnd) {
sc.SetState(SCE_B_DEFAULT);
} else if (sc.ch == '\\' || sc.ch == '@') {
if (IsLetter(sc.chNext) && sc.chPrev != '\\') {
styleBeforeKeyword = sc.state;
sc.SetState(SCE_B_DOCKEYWORD);
};
}
} else if (sc.state == SCE_B_DOCKEYWORD) {
if (IsSpace(sc.ch)) {
sc.SetState(styleBeforeKeyword);
} else if (sc.atLineEnd && styleBeforeKeyword == SCE_B_DOCLINE) {
sc.SetState(SCE_B_DEFAULT);
}
} else if (sc.state == SCE_B_COMMENTBLOCK) {
if (sc.Match("\'/")) {
sc.Forward();
sc.ForwardSetState(SCE_B_DEFAULT);
}
} else if (sc.state == SCE_B_DOCBLOCK) {
if (sc.Match("\'/")) {
sc.Forward();
sc.ForwardSetState(SCE_B_DEFAULT);
} else if (sc.ch == '\\' || sc.ch == '@') {
if (IsLetter(sc.chNext) && sc.chPrev != '\\') {
styleBeforeKeyword = sc.state;
sc.SetState(SCE_B_DOCKEYWORD);
};
}
}
if (sc.atLineStart)
isfirst = true;
if (sc.state == SCE_B_DEFAULT || sc.state == SCE_B_ERROR) {
if (isfirst && sc.Match('.')) {
sc.SetState(SCE_B_LABEL);
if (isfirst && sc.Match('.') && comment_char != '\'') {
sc.SetState(SCE_B_LABEL);
} else if (isfirst && sc.Match('#')) {
wasfirst = isfirst;
sc.SetState(SCE_B_IDENTIFIER);
@ -383,15 +429,25 @@ void SCI_METHOD LexerBasic::Lex(unsigned int startPos, int length, int initStyle
// up in freebasic with SCE_B_PREPROCESSOR.
if (comment_char == '\'' && sc.Match(comment_char, '$'))
sc.SetState(SCE_B_PREPROCESSOR);
else
else if (sc.Match("\'*") || sc.Match("\'!")) {
sc.SetState(SCE_B_DOCLINE);
} else {
sc.SetState(SCE_B_COMMENT);
}
} else if (sc.Match("/\'")) {
if (sc.Match("/\'*") || sc.Match("/\'!")) { // Support of gtk-doc/Doxygen doc. style
sc.SetState(SCE_B_DOCBLOCK);
} else {
sc.SetState(SCE_B_COMMENTBLOCK);
}
sc.Forward(); // Eat the ' so it isn't used for the end of the comment
} else if (sc.Match('"')) {
sc.SetState(SCE_B_STRING);
} else if (IsDigit(sc.ch)) {
sc.SetState(SCE_B_NUMBER);
} else if (sc.Match('$')) {
} else if (sc.Match('$') || sc.Match("&h") || sc.Match("&H") || sc.Match("&o") || sc.Match("&O")) {
sc.SetState(SCE_B_HEXNUMBER);
} else if (sc.Match('%')) {
} else if (sc.Match('%') || sc.Match("&b") || sc.Match("&B")) {
sc.SetState(SCE_B_BINNUMBER);
} else if (sc.Match('#')) {
sc.SetState(SCE_B_CONSTANT);

View File

@ -0,0 +1,310 @@
// Copyright 2008-2010 Sergiu Dotenco. The License.txt file describes the
// conditions under which this software may be distributed.
/**
* @file LexBibTeX.cxx
* @brief General BibTeX coloring scheme.
* @author Sergiu Dotenco
* @date April 18, 2009
*/
#include <stdlib.h>
#include <string.h>
#include <cassert>
#include <cctype>
#include <string>
#include <algorithm>
#include <functional>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "PropSetSimple.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
namespace {
bool IsAlphabetic(unsigned int ch)
{
return IsASCII(ch) && std::isalpha(ch) != 0;
}
bool IsAlphaNumeric(char ch)
{
return IsASCII(ch) && std::isalnum(ch);
}
bool EqualCaseInsensitive(const char* a, const char* b)
{
return CompareCaseInsensitive(a, b) == 0;
}
bool EntryWithoutKey(const char* name)
{
return EqualCaseInsensitive(name,"string");
}
char GetClosingBrace(char openbrace)
{
char result = openbrace;
switch (openbrace) {
case '(': result = ')'; break;
case '{': result = '}'; break;
}
return result;
}
bool IsEntryStart(char prev, char ch)
{
return prev != '\\' && ch == '@';
}
bool IsEntryStart(const StyleContext& sc)
{
return IsEntryStart(sc.chPrev, sc.ch);
}
void ColorizeBibTeX(unsigned start_pos, int length, int /*init_style*/, WordList* keywordlists[], Accessor& styler)
{
WordList &EntryNames = *keywordlists[0];
bool fold_compact = styler.GetPropertyInt("fold.compact", 1) != 0;
std::string buffer;
buffer.reserve(25);
// We always colorize a section from the beginning, so let's
// search for the @ character which isn't escaped, i.e. \@
while (start_pos > 0 && !IsEntryStart(styler.SafeGetCharAt(start_pos - 1),
styler.SafeGetCharAt(start_pos))) {
--start_pos; ++length;
}
styler.StartAt(start_pos);
styler.StartSegment(start_pos);
int current_line = styler.GetLine(start_pos);
int prev_level = styler.LevelAt(current_line) & SC_FOLDLEVELNUMBERMASK;
int current_level = prev_level;
int visible_chars = 0;
bool in_comment = false ;
StyleContext sc(start_pos, length, SCE_BIBTEX_DEFAULT, styler);
bool going = sc.More(); // needed because of a fuzzy end of file state
char closing_brace = 0;
bool collect_entry_name = false;
for (; going; sc.Forward()) {
if (!sc.More())
going = false; // we need to go one behind the end of text
if (in_comment) {
if (sc.atLineEnd) {
sc.SetState(SCE_BIBTEX_DEFAULT);
in_comment = false;
}
}
else {
// Found @entry
if (IsEntryStart(sc)) {
sc.SetState(SCE_BIBTEX_UNKNOWN_ENTRY);
sc.Forward();
++current_level;
buffer.clear();
collect_entry_name = true;
}
else if ((sc.state == SCE_BIBTEX_ENTRY || sc.state == SCE_BIBTEX_UNKNOWN_ENTRY)
&& (sc.ch == '{' || sc.ch == '(')) {
// Entry name colorization done
// Found either a { or a ( after entry's name, e.g. @entry(...) @entry{...}
// Closing counterpart needs to be stored.
closing_brace = GetClosingBrace(sc.ch);
sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize { (
// @string doesn't have any key
if (EntryWithoutKey(buffer.c_str()))
sc.ForwardSetState(SCE_BIBTEX_PARAMETER);
else
sc.ForwardSetState(SCE_BIBTEX_KEY); // Key/label colorization
}
// Need to handle the case where entry's key is empty
// e.g. @book{,...}
if (sc.state == SCE_BIBTEX_KEY && sc.ch == ',') {
// Key/label colorization done
sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the ,
sc.ForwardSetState(SCE_BIBTEX_PARAMETER); // Parameter colorization
}
else if (sc.state == SCE_BIBTEX_PARAMETER && sc.ch == '=') {
sc.SetState(SCE_BIBTEX_DEFAULT); // Don't colorize the =
sc.ForwardSetState(SCE_BIBTEX_VALUE); // Parameter value colorization
int start = sc.currentPos;
// We need to handle multiple situations:
// 1. name"one two {three}"
// 2. name={one {one two {two}} three}
// 3. year=2005
// Skip ", { until we encounter the first alphanumerical character
while (sc.More() && !(IsAlphaNumeric(sc.ch) || sc.ch == '"' || sc.ch == '{'))
sc.Forward();
if (sc.More()) {
// Store " or {
char ch = sc.ch;
// Not interested in alphanumerical characters
if (IsAlphaNumeric(ch))
ch = 0;
int skipped = 0;
if (ch) {
// Skip preceding " or { such as in name={{test}}.
// Remember how many characters have been skipped
// Make sure that empty values, i.e. "" are also handled correctly
while (sc.More() && (sc.ch == ch && (ch != '"' || skipped < 1))) {
sc.Forward();
++skipped;
}
}
// Closing counterpart for " is the same character
if (ch == '{')
ch = '}';
// We have reached the parameter value
// In case the open character was a alnum char, skip until , is found
// otherwise until skipped == 0
while (sc.More() && (skipped > 0 || (!ch && !(sc.ch == ',' || sc.ch == closing_brace)))) {
// Make sure the character isn't escaped
if (sc.chPrev != '\\') {
// Parameter value contains a { which is the 2nd case described above
if (sc.ch == '{')
++skipped; // Remember it
else if (sc.ch == '}')
--skipped;
else if (skipped == 1 && sc.ch == ch && ch == '"') // Don't ignore cases like {"o}
skipped = 0;
}
sc.Forward();
}
}
// Don't colorize the ,
sc.SetState(SCE_BIBTEX_DEFAULT);
// Skip until the , or entry's closing closing_brace is found
// since this parameter might be the last one
while (sc.More() && !(sc.ch == ',' || sc.ch == closing_brace))
sc.Forward();
int state = SCE_BIBTEX_PARAMETER; // The might be more parameters
// We've reached the closing closing_brace for the bib entry
// in case no " or {} has been used to enclose the value,
// as in 3rd case described above
if (sc.ch == closing_brace) {
--current_level;
// Make sure the text between entries is not colored
// using parameter's style
state = SCE_BIBTEX_DEFAULT;
}
int 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)
styler.SetLevel(i, prev_level);
sc.ForwardSetState(state);
}
if (sc.state == SCE_BIBTEX_PARAMETER && sc.ch == closing_brace) {
sc.SetState(SCE_BIBTEX_DEFAULT);
--current_level;
}
// Non escaped % found which represents a comment until the end of the line
if (sc.chPrev != '\\' && sc.ch == '%') {
in_comment = true;
sc.SetState(SCE_BIBTEX_COMMENT);
}
}
if (sc.state == SCE_BIBTEX_UNKNOWN_ENTRY || sc.state == SCE_BIBTEX_ENTRY) {
if (!IsAlphabetic(sc.ch) && collect_entry_name)
collect_entry_name = false;
if (collect_entry_name) {
buffer += static_cast<char>(tolower(sc.ch));
if (EntryNames.InList(buffer.c_str()))
sc.ChangeState(SCE_BIBTEX_ENTRY);
else
sc.ChangeState(SCE_BIBTEX_UNKNOWN_ENTRY);
}
}
if (sc.atLineEnd) {
int level = prev_level;
if (visible_chars == 0 && fold_compact)
level |= SC_FOLDLEVELWHITEFLAG;
if ((current_level > prev_level))
level |= SC_FOLDLEVELHEADERFLAG;
// else if (current_level < prev_level)
// level |= SC_FOLDLEVELBOXFOOTERFLAG; // Deprecated
if (level != styler.LevelAt(current_line)) {
styler.SetLevel(current_line, level);
}
++current_line;
prev_level = current_level;
visible_chars = 0;
}
if (!isspacechar(sc.ch))
++visible_chars;
}
sc.Complete();
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(current_line) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(current_line, prev_level | flagsNext);
}
}
static const char * const BibTeXWordLists[] = {
"Entry Names",
0,
};
LexerModule lmBibTeX(SCLEX_BIBTEX, ColorizeBibTeX, "bib", 0, BibTeXWordLists);
// Entry Names
// article, book, booklet, conference, inbook,
// incollection, inproceedings, manual, mastersthesis,
// misc, phdthesis, proceedings, techreport, unpublished,
// string, url

View File

@ -116,7 +116,7 @@ static void ColouriseBullantDoc(unsigned int startPos, int length, int initStyle
}
blockChange=0;
*/ }
if (!(isascii(ch) && isspace(ch)))
if (!(IsASCII(ch) && isspace(ch)))
visibleChars++;
if (styler.IsLeadByte(ch)) {

View File

@ -44,13 +44,13 @@ inline bool isCOBOLoperator(char ch)
inline bool isCOBOLwordchar(char ch)
{
return isascii(ch) && (isalnum(ch) || ch == '-');
return IsASCII(ch) && (isalnum(ch) || ch == '-');
}
inline bool isCOBOLwordstart(char ch)
{
return isascii(ch) && isalnum(ch);
return IsASCII(ch) && isalnum(ch);
}
static int CountBits(int nBits)
@ -90,6 +90,8 @@ static int classifyWordCOBOL(unsigned int start, unsigned int end, /*WordList &k
WordList& c_keywords = *keywordlists[2];
char s[100];
s[0] = '\0';
s[1] = '\0';
getRange(start, end, styler, s, sizeof(s));
char chAttr = SCE_C_IDENTIFIER;
@ -205,7 +207,7 @@ static void ColouriseCOBOLDoc(unsigned int startPos, int length, int initStyle,
}
if (state == SCE_C_DEFAULT) {
if (isCOBOLwordstart(ch) || (ch == '$' && isascii(chNext) && isalpha(chNext))) {
if (isCOBOLwordstart(ch) || (ch == '$' && IsASCII(chNext) && isalpha(chNext))) {
ColourTo(styler, i-1, state);
state = SCE_C_IDENTIFIER;
} else if (column == 6 && ch == '*') {

View File

@ -8,10 +8,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <string>
#include <vector>
@ -36,7 +36,10 @@
using namespace Scintilla;
#endif
static bool IsSpaceEquiv(int state) {
namespace {
// Use an unnamed namespace to protect the functions and classes from name conflicts
bool IsSpaceEquiv(int state) {
return (state <= SCE_C_COMMENTDOC) ||
// including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
(state == SCE_C_COMMENTLINEDOC) || (state == SCE_C_COMMENTDOCKEYWORD) ||
@ -50,7 +53,7 @@ static 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.
static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
int pos = (int) sc.currentPos;
while (--pos > 0) {
char ch = styler[pos];
@ -61,7 +64,7 @@ static bool FollowsPostfixOperator(StyleContext &sc, LexAccessor &styler) {
return false;
}
static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
// Don't look at styles, so no need to flush.
int pos = (int) sc.currentPos;
int currentLine = styler.GetLine(pos);
@ -83,7 +86,120 @@ static bool followsReturnKeyword(StyleContext &sc, LexAccessor &styler) {
return !*s;
}
static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
bool IsSpaceOrTab(int ch) {
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))
return false;
}
return true;
}
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());
} else {
vs.back() += *it;
}
}
return vs;
}
struct BracketPair {
std::vector<std::string>::iterator itBracket;
std::vector<std::string>::iterator itEndBracket;
};
BracketPair FindBracketPair(std::vector<std::string> &tokens) {
BracketPair bp;
std::vector<std::string>::iterator itTok = std::find(tokens.begin(), tokens.end(), "(");
bp.itBracket = tokens.end();
bp.itEndBracket = tokens.end();
if (itTok != tokens.end()) {
bp.itBracket = itTok;
size_t nest = 0;
while (itTok != tokens.end()) {
if (*itTok == "(") {
nest++;
} else if (*itTok == ")") {
nest--;
if (nest == 0) {
bp.itEndBracket = itTok;
return bp;
}
}
++itTok;
}
}
bp.itBracket = tokens.end();
return bp;
}
void highlightTaskMarker(StyleContext &sc, LexAccessor &styler,
int activity, 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;
int i = 0;
while (i < lengthMarker) {
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));
i++;
}
marker[i] = '\0';
if (markerList.InList(marker)) {
sc.SetState(SCE_C_TASKMARKER|activity);
}
}
}
struct EscapeSequence {
int digitsLeft;
CharacterSet setHexDigits;
CharacterSet setOctDigits;
CharacterSet setNoneNumeric;
CharacterSet *escapeSetValid;
EscapeSequence() {
digitsLeft = 0;
escapeSetValid = 0;
setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef");
setOctDigits = CharacterSet(CharacterSet::setNone, "01234567");
}
void resetEscapeState(int nextChar) {
digitsLeft = 0;
escapeSetValid = &setNoneNumeric;
if (nextChar == 'U') {
digitsLeft = 9;
escapeSetValid = &setHexDigits;
} else if (nextChar == 'u') {
digitsLeft = 5;
escapeSetValid = &setHexDigits;
} else if (nextChar == 'x') {
digitsLeft = 5;
escapeSetValid = &setHexDigits;
} else if (setOctDigits.Contains(nextChar)) {
digitsLeft = 3;
escapeSetValid = &setOctDigits;
}
}
bool atEscapeEnd(int currChar) const {
return (digitsLeft <= 0) || !escapeSetValid->Contains(currChar);
}
};
std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace) {
std::string restOfLine;
int i =0;
char ch = styler.SafeGetCharAt(start, '\n');
@ -100,40 +216,21 @@ static std::string GetRestOfLine(LexAccessor &styler, int start, bool allowSpace
return restOfLine;
}
static bool IsStreamCommentStyle(int style) {
bool IsStreamCommentStyle(int style) {
return style == SCE_C_COMMENT ||
style == SCE_C_COMMENTDOC ||
style == SCE_C_COMMENTDOCKEYWORD ||
style == SCE_C_COMMENTDOCKEYWORDERROR;
}
static std::vector<std::string> Tokenize(const std::string &s) {
// Break into space separated tokens
std::string word;
std::vector<std::string> tokens;
for (const char *cp = s.c_str(); *cp; cp++) {
if ((*cp == ' ') || (*cp == '\t')) {
if (!word.empty()) {
tokens.push_back(word);
word = "";
}
} else {
word += *cp;
}
}
if (!word.empty()) {
tokens.push_back(word);
}
return tokens;
}
struct PPDefinition {
int line;
std::string key;
std::string value;
bool isUndef;
PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false) :
line(line_), key(key_), value(value_), isUndef(isUndef_) {
std::string arguments;
PPDefinition(int line_, const std::string &key_, const std::string &value_, bool isUndef_ = false, std::string arguments_="") :
line(line_), key(key_), value(value_), isUndef(isUndef_), arguments(arguments_) {
}
};
@ -209,8 +306,11 @@ struct OptionsCPP {
bool identifiersAllowDollars;
bool trackPreprocessor;
bool updatePreprocessor;
bool verbatimStringsAllowEscapes;
bool triplequotedStrings;
bool hashquotedStrings;
bool backQuotedStrings;
bool escapeSequence;
bool fold;
bool foldSyntaxBased;
bool foldComment;
@ -227,8 +327,11 @@ struct OptionsCPP {
identifiersAllowDollars = true;
trackPreprocessor = true;
updatePreprocessor = true;
verbatimStringsAllowEscapes = false;
triplequotedStrings = false;
hashquotedStrings = false;
backQuotedStrings = false;
escapeSequence = false;
fold = false;
foldSyntaxBased = true;
foldComment = false;
@ -243,12 +346,13 @@ struct OptionsCPP {
}
};
static const char *const cppWordLists[] = {
const char *const cppWordLists[] = {
"Primary keywords and identifiers",
"Secondary keywords and identifiers",
"Documentation comment keywords",
"Global classes and typedefs",
"Preprocessor definitions",
"Task marker and error marker keywords",
0,
};
@ -268,12 +372,21 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
DefineProperty("lexer.cpp.update.preprocessor", &OptionsCPP::updatePreprocessor,
"Set to 1 to update preprocessor definitions when #define found.");
DefineProperty("lexer.cpp.verbatim.strings.allow.escapes", &OptionsCPP::verbatimStringsAllowEscapes,
"Set to 1 to allow verbatim strings to contain escape sequences.");
DefineProperty("lexer.cpp.triplequoted.strings", &OptionsCPP::triplequotedStrings,
"Set to 1 to enable highlighting of triple-quoted strings.");
DefineProperty("lexer.cpp.hashquoted.strings", &OptionsCPP::hashquotedStrings,
"Set to 1 to enable highlighting of hash-quoted strings.");
DefineProperty("lexer.cpp.backquoted.strings", &OptionsCPP::backQuotedStrings,
"Set to 1 to enable highlighting of back-quoted raw strings .");
DefineProperty("lexer.cpp.escape.sequence", &OptionsCPP::escapeSequence,
"Set to 1 to enable highlighting of escape sequences in strings");
DefineProperty("fold", &OptionsCPP::fold);
DefineProperty("fold.cpp.syntax.based", &OptionsCPP::foldSyntaxBased,
@ -312,7 +425,9 @@ struct OptionSetCPP : public OptionSet<OptionsCPP> {
}
};
static const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0};
const char styleSubable[] = {SCE_C_IDENTIFIER, SCE_C_COMMENTDOCKEYWORD, 0};
}
class LexerCPP : public ILexerWithSubStyles {
bool caseSensitive;
@ -321,6 +436,7 @@ class LexerCPP : public ILexerWithSubStyles {
CharacterSet setArithmethicOp;
CharacterSet setRelOp;
CharacterSet setLogicalOp;
CharacterSet setWordStart;
PPStates vlls;
std::vector<PPDefinition> ppDefineHistory;
WordList keywords;
@ -328,15 +444,32 @@ class LexerCPP : public ILexerWithSubStyles {
WordList keywords3;
WordList keywords4;
WordList ppDefinitions;
std::map<std::string, std::string> preprocessorDefinitionsStart;
WordList markerList;
struct SymbolValue {
std::string value;
std::string arguments;
SymbolValue(const std::string &value_="", const std::string &arguments_="") : value(value_), arguments(arguments_) {
}
SymbolValue &operator = (const std::string &value_) {
value = value_;
arguments.clear();
return *this;
}
bool IsMacro() const {
return !arguments.empty();
}
};
typedef std::map<std::string, SymbolValue> SymbolTable;
SymbolTable preprocessorDefinitionsStart;
OptionsCPP options;
OptionSetCPP osCPP;
EscapeSequence escapeSeq;
SparseState<std::string> rawStringTerminators;
enum { activeFlag = 0x40 };
enum { ssIdentifier, ssDocKeyword };
SubStyles subStyles;
public:
LexerCPP(bool caseSensitive_) :
explicit LexerCPP(bool caseSensitive_) :
caseSensitive(caseSensitive_),
setWord(CharacterSet::setAlphaNum, "._", 0x80, true),
setNegationOp(CharacterSet::setNone, "!"),
@ -376,7 +509,7 @@ public:
int SCI_METHOD LineEndTypesSupported() {
return SC_LINE_END_TYPE_UNICODE;
};
}
int SCI_METHOD AllocateSubStyles(int styleBase, int numberStyles) {
return subStyles.Allocate(styleBase, numberStyles);
@ -387,6 +520,14 @@ public:
int SCI_METHOD SubStylesLength(int styleBase) {
return subStyles.Length(styleBase);
}
int SCI_METHOD StyleFromSubStyle(int subStyle) {
int styleBase = subStyles.BaseStyle(MaskActive(subStyle));
int active = subStyle & activeFlag;
return styleBase | active;
}
int SCI_METHOD PrimaryStyleFromStyle(int style) {
return MaskActive(style);
}
void SCI_METHOD FreeSubStyles() {
subStyles.Free();
}
@ -409,8 +550,9 @@ public:
static int MaskActive(int style) {
return style & ~activeFlag;
}
void EvaluateTokens(std::vector<std::string> &tokens);
bool EvaluateExpression(const std::string &expr, const std::map<std::string, std::string> &preprocessorDefinitions);
void EvaluateTokens(std::vector<std::string> &tokens, const SymbolTable &preprocessorDefinitions);
std::vector<std::string> Tokenize(const std::string &expr) const;
bool EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions);
};
int SCI_METHOD LexerCPP::PropertySet(const char *key, const char *val) {
@ -444,6 +586,9 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
case 4:
wordListN = &ppDefinitions;
break;
case 5:
wordListN = &markerList;
break;
}
int firstModification = -1;
if (wordListN) {
@ -461,7 +606,16 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
if (cpEquals) {
std::string name(cpDefinition, cpEquals - cpDefinition);
std::string val(cpEquals+1);
preprocessorDefinitionsStart[name] = val;
size_t bracket = name.find('(');
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);
name = name.substr(0, bracket);
preprocessorDefinitionsStart[name] = SymbolValue(val, args);
} else {
preprocessorDefinitionsStart[name] = val;
}
} else {
std::string name(cpDefinition);
std::string val("1");
@ -477,7 +631,7 @@ int SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
// Functor used to truncate history
struct After {
int line;
After(int line_) : line(line_) {}
explicit After(int line_) : line(line_) {}
bool operator()(PPDefinition &p) const {
return p.line > line;
}
@ -491,7 +645,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
setWordStart = CharacterSet(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setInvalidRawFirst(CharacterSet::setNone, " )\\\t\v\f\n");
@ -503,10 +657,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
int visibleChars = 0;
bool lastWordWasUUID = false;
int styleBeforeDCKeyword = SCE_C_DEFAULT;
int styleBeforeTaskMarker = SCE_C_DEFAULT;
bool continuationLine = false;
bool isIncludePreprocessor = false;
bool isStringInPreprocessor = false;
bool inRERange = false;
bool seenDocKeyBrace = false;
int lineCurrent = styler.GetLine(startPos);
if ((MaskActive(initStyle) == SCE_C_PREPROCESSOR) ||
@ -531,7 +687,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
}
}
StyleContext sc(startPos, length, initStyle, styler, static_cast<char>(0xff));
StyleContext sc(startPos, length, initStyle, styler, static_cast<unsigned char>(0xff));
LinePPState preproc = vlls.ForLine(lineCurrent);
bool definitionsChanged = false;
@ -547,12 +703,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
definitionsChanged = true;
}
std::map<std::string, std::string> preprocessorDefinitions = preprocessorDefinitionsStart;
SymbolTable preprocessorDefinitions = preprocessorDefinitionsStart;
for (std::vector<PPDefinition>::iterator itDef = ppDefineHistory.begin(); itDef != ppDefineHistory.end(); ++itDef) {
if (itDef->isUndef)
preprocessorDefinitions.erase(itDef->key);
else
preprocessorDefinitions[itDef->key] = itDef->value;
preprocessorDefinitions[itDef->key] = SymbolValue(itDef->value, itDef->arguments);
}
std::string rawStringTerminator = rawStringTerminators.ValueAt(lineCurrent-1);
@ -572,13 +728,13 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
// Inside inactive preprocessor declaration, state will be reset anyway at the end of this block.
if ((sc.state == SCE_C_STRING) || (sc.state == SCE_C_CHARACTER)) {
// Prevent SCE_C_STRINGEOL from leaking back to previous line which
// ends with a line continuation by locking in the state upto this position.
// ends with a line continuation by locking in the state up to this position.
sc.SetState(sc.state);
}
if ((MaskActive(sc.state) == SCE_C_PREPROCESSOR) && (!continuationLine)) {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
// Reset states to begining of colourise so no surprises
// Reset states to beginning of colourise so no surprises
// if different sets of lines lexed.
visibleChars = 0;
lastWordWasUUID = false;
@ -625,12 +781,19 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
break;
case SCE_C_NUMBER:
// We accept almost anything because of hex. and number suffixes
if (!(setWord.Contains(sc.ch)
if (sc.ch == '_') {
sc.ChangeState(SCE_C_USERLITERAL|activitySet);
} else if (!(setWord.Contains(sc.ch)
|| (sc.ch == '\'')
|| ((sc.ch == '+' || sc.ch == '-') && (sc.chPrev == 'e' || sc.chPrev == 'E' ||
sc.chPrev == 'p' || sc.chPrev == 'P')))) {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
break;
case SCE_C_USERLITERAL:
if (!(setWord.Contains(sc.ch)))
sc.SetState(SCE_C_DEFAULT|activitySet);
break;
case SCE_C_IDENTIFIER:
if (sc.atLineStart || sc.atLineEnd || !setWord.Contains(sc.ch) || (sc.ch == '.')) {
char s[1000];
@ -663,13 +826,24 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
((lenS == 1) && ((s[0] == 'L') || (s[0] == 'u') || (s[0] == 'U'))) ||
((lenS == 2) && literalString && (s[0] == 'u') && (s[1] == '8'));
if (valid) {
if (literalString)
sc.ChangeState((raw ? SCE_C_STRINGRAW : SCE_C_STRING)|activitySet);
else
if (literalString) {
if (raw) {
// Set the style of the string prefix to SCE_C_STRINGRAW but then change to
// SCE_C_DEFAULT as that allows the raw string start code to run.
sc.ChangeState(SCE_C_STRINGRAW|activitySet);
sc.SetState(SCE_C_DEFAULT|activitySet);
} else {
sc.ChangeState(SCE_C_STRING|activitySet);
}
} else {
sc.ChangeState(SCE_C_CHARACTER|activitySet);
}
} else {
sc.SetState(SCE_C_DEFAULT | activitySet);
}
} else {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
sc.SetState(SCE_C_DEFAULT|activitySet);
}
break;
case SCE_C_PREPROCESSOR:
@ -677,7 +851,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
if (IsASpace(sc.ch)) {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
} else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"'))) {
} else if (isStringInPreprocessor && (sc.Match('>') || sc.Match('\"') || sc.atLineEnd)) {
isStringInPreprocessor = false;
} else if (!isStringInPreprocessor) {
if ((isIncludePreprocessor && sc.Match('<')) || sc.Match('\"')) {
@ -706,6 +880,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
} else {
styleBeforeTaskMarker = SCE_C_COMMENT;
highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive);
}
break;
case SCE_C_COMMENTDOC:
@ -723,6 +900,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
case SCE_C_COMMENTLINE:
if (sc.atLineStart && !continuationLine) {
sc.SetState(SCE_C_DEFAULT|activitySet);
} else {
styleBeforeTaskMarker = SCE_C_COMMENTLINE;
highlightTaskMarker(sc, styler, activitySet, markerList, caseSensitive);
}
break;
case SCE_C_COMMENTLINEDOC:
@ -741,14 +921,18 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
} else if (!setDoxygen.Contains(sc.ch)) {
seenDocKeyBrace = false;
} else if (sc.ch == '[' || sc.ch == '{') {
seenDocKeyBrace = true;
} else if (!setDoxygen.Contains(sc.ch)
&& !(seenDocKeyBrace && (sc.ch == ',' || sc.ch == '.'))) {
char s[100];
if (caseSensitive) {
sc.GetCurrent(s, sizeof(s));
} else {
sc.GetCurrentLowered(s, sizeof(s));
}
if (!IsASpace(sc.ch)) {
if (!(IsASpace(sc.ch) || (sc.ch == 0))) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR|activitySet);
} else if (!keywords3.InList(s + 1)) {
int subStyleCDKW = classifierDocKeyWords.ValueFor(s+1);
@ -759,6 +943,7 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
}
}
sc.SetState(styleBeforeDCKeyword|activitySet);
seenDocKeyBrace = false;
}
break;
case SCE_C_STRING:
@ -770,11 +955,35 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
isIncludePreprocessor = false;
}
} else if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
if (options.escapeSequence) {
sc.SetState(SCE_C_ESCAPESEQUENCE|activitySet);
escapeSeq.resetEscapeState(sc.chNext);
}
sc.Forward(); // Skip all characters after the backslash
} else if (sc.ch == '\"') {
if (sc.chNext == '_') {
sc.ChangeState(SCE_C_USERLITERAL|activitySet);
} else {
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
}
}
break;
case SCE_C_ESCAPESEQUENCE:
escapeSeq.digitsLeft--;
if (!escapeSeq.atEscapeEnd(sc.ch)) {
break;
}
if (sc.ch == '"') {
sc.SetState(SCE_C_STRING|activitySet);
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
} else if (sc.ch == '\\') {
escapeSeq.resetEscapeState(sc.chNext);
sc.Forward();
} else {
sc.SetState(SCE_C_STRING|activitySet);
if (sc.atLineEnd) {
sc.ChangeState(SCE_C_STRINGEOL|activitySet);
}
}
break;
case SCE_C_HASHQUOTEDSTRING:
@ -802,7 +1011,11 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
sc.Forward();
}
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
if (sc.chNext == '_') {
sc.ChangeState(SCE_C_USERLITERAL|activitySet);
} else {
sc.ForwardSetState(SCE_C_DEFAULT|activitySet);
}
}
break;
case SCE_C_REGEX:
@ -828,7 +1041,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
}
break;
case SCE_C_VERBATIM:
if (sc.ch == '\"') {
if (options.verbatimStringsAllowEscapes && (sc.ch == '\\')) {
sc.Forward(); // Skip all characters after the backslash
} else if (sc.ch == '\"') {
if (sc.chNext == '\"') {
sc.Forward();
} else {
@ -848,6 +1063,12 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
if (sc.atLineEnd || sc.ch == ')') {
sc.SetState(SCE_C_DEFAULT|activitySet);
}
break;
case SCE_C_TASKMARKER:
if (isoperator(sc.ch) || IsASpace(sc.ch)) {
sc.SetState(styleBeforeTaskMarker|activitySet);
styleBeforeTaskMarker = SCE_C_DEFAULT;
}
}
if (sc.atLineEnd && !atLineEndBeforeSwitch) {
@ -868,6 +1089,9 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} else if (options.hashquotedStrings && sc.Match('#', '\"')) {
sc.SetState(SCE_C_HASHQUOTEDSTRING|activitySet);
sc.Forward();
} else if (options.backQuotedStrings && sc.Match('`')) {
sc.SetState(SCE_C_STRINGRAW|activitySet);
rawStringTerminator = "`";
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
if (lastWordWasUUID) {
sc.SetState(SCE_C_UUID|activitySet);
@ -986,28 +1210,45 @@ void SCI_METHOD LexerCPP::Lex(unsigned int startPos, int length, int initStyle,
} else if (sc.Match("define")) {
if (options.updatePreprocessor && !preproc.IsInactive()) {
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 6, true);
if (restOfLine.find(")") == std::string::npos) { // Don't handle macros with arguments
std::vector<std::string> tokens = Tokenize(restOfLine);
std::string key;
std::string value("1");
if (tokens.size() >= 1) {
key = tokens[0];
if (tokens.size() >= 2) {
value = tokens[1];
}
preprocessorDefinitions[key] = value;
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value));
definitionsChanged = true;
}
size_t startName = 0;
while ((startName < restOfLine.length()) && IsSpaceOrTab(restOfLine[startName]))
startName++;
size_t endName = startName;
while ((endName < restOfLine.length()) && setWord.Contains(static_cast<unsigned char>(restOfLine[endName])))
endName++;
std::string key = restOfLine.substr(startName, endName-startName);
if ((endName < restOfLine.length()) && (restOfLine.at(endName) == '(')) {
// Macro
size_t endArgs = endName;
while ((endArgs < restOfLine.length()) && (restOfLine[endArgs] != ')'))
endArgs++;
std::string args = restOfLine.substr(endName + 1, endArgs - endName - 1);
size_t startValue = endArgs+1;
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
std::string value;
if (startValue < restOfLine.length())
value = restOfLine.substr(startValue);
preprocessorDefinitions[key] = SymbolValue(value, args);
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value, false, args));
definitionsChanged = true;
} else {
// Value
size_t startValue = endName;
while ((startValue < restOfLine.length()) && IsSpaceOrTab(restOfLine[startValue]))
startValue++;
std::string value = restOfLine.substr(startValue);
preprocessorDefinitions[key] = value;
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, value));
definitionsChanged = true;
}
}
} else if (sc.Match("undef")) {
if (options.updatePreprocessor && !preproc.IsInactive()) {
std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, true);
const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, false);
std::vector<std::string> tokens = Tokenize(restOfLine);
std::string key;
if (tokens.size() >= 1) {
key = tokens[0];
const std::string key = tokens[0];
preprocessorDefinitions.erase(key);
ppDefineHistory.push_back(PPDefinition(lineCurrent, key, "", true));
definitionsChanged = true;
@ -1108,14 +1349,14 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
}
}
if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) {
if (ch == '{') {
if (ch == '{' || ch == '[') {
// Measure the minimum before a '{' to allow
// folding on "} else {"
if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
} else if (ch == '}') {
} else if (ch == '}' || ch == ']') {
levelNext--;
}
}
@ -1148,19 +1389,36 @@ void SCI_METHOD LexerCPP::Fold(unsigned int startPos, int length, int initStyle,
}
}
void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens, const SymbolTable &preprocessorDefinitions) {
// Evaluate defined() statements to either 0 or 1
for (size_t i=0; (i+2)<tokens.size();) {
if ((tokens[i] == "defined") && (tokens[i+1] == "(")) {
// Remove whitespace tokens
tokens.erase(std::remove_if(tokens.begin(), tokens.end(), OnlySpaceOrTab), tokens.end());
// Evaluate defined statements to either 0 or 1
for (size_t i=0; (i+1)<tokens.size();) {
if (tokens[i] == "defined") {
const char *val = "0";
if (tokens[i+2] == ")") {
// defined()
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3);
} else if (((i+3)<tokens.size()) && (tokens[i+3] == ")")) {
// defined(<int>)
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4);
val = "1";
if (tokens[i+1] == "(") {
if (((i + 2)<tokens.size()) && (tokens[i + 2] == ")")) {
// defined()
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 3);
} else if (((i+3)<tokens.size()) && (tokens[i+3] == ")")) {
// defined(<identifier>)
SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+2]);
if (it != preprocessorDefinitions.end()) {
val = "1";
}
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 4);
} else {
// Spurious '(' so erase as more likely to result in false
tokens.erase(tokens.begin() + i + 1, tokens.begin() + i + 2);
}
} else {
// defined <identifier>
SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i+1]);
if (it != preprocessorDefinitions.end()) {
val = "1";
}
}
tokens[i] = val;
} else {
@ -1168,21 +1426,82 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
}
}
// Evaluate identifiers
const size_t maxIterations = 100;
size_t iterations = 0; // Limit number of iterations in case there is a recursive macro.
for (size_t i = 0; (i<tokens.size()) && (iterations < maxIterations);) {
iterations++;
if (setWordStart.Contains(static_cast<unsigned char>(tokens[i][0]))) {
SymbolTable::const_iterator it = preprocessorDefinitions.find(tokens[i]);
if (it != preprocessorDefinitions.end()) {
// Tokenize value
std::vector<std::string> macroTokens = Tokenize(it->second.value);
if (it->second.IsMacro()) {
if ((i + 1 < tokens.size()) && (tokens.at(i + 1) == "(")) {
// Create map of argument name to value
std::vector<std::string> argumentNames = StringSplit(it->second.arguments, ',');
std::map<std::string, std::string> arguments;
size_t arg = 0;
size_t tok = i+2;
while ((tok < tokens.size()) && (arg < argumentNames.size()) && (tokens.at(tok) != ")")) {
if (tokens.at(tok) != ",") {
arguments[argumentNames.at(arg)] = tokens.at(tok);
arg++;
}
tok++;
}
// Remove invocation
tokens.erase(tokens.begin() + i, tokens.begin() + tok + 1);
// Substitute values into macro
macroTokens.erase(std::remove_if(macroTokens.begin(), macroTokens.end(), OnlySpaceOrTab), macroTokens.end());
for (size_t iMacro = 0; iMacro < macroTokens.size();) {
if (setWordStart.Contains(static_cast<unsigned char>(macroTokens[iMacro][0]))) {
std::map<std::string, std::string>::const_iterator itFind = arguments.find(macroTokens[iMacro]);
if (itFind != arguments.end()) {
// TODO: Possible that value will be expression so should insert tokenized form
macroTokens[iMacro] = itFind->second;
}
}
iMacro++;
}
// Insert results back into tokens
tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end());
} else {
i++;
}
} else {
// Remove invocation
tokens.erase(tokens.begin() + i);
// Insert results back into tokens
tokens.insert(tokens.begin() + i, macroTokens.begin(), macroTokens.end());
}
} else {
// Identifier not found
tokens.erase(tokens.begin() + i);
}
} else {
i++;
}
}
// Find bracketed subexpressions and recurse on them
std::vector<std::string>::iterator itBracket = std::find(tokens.begin(), tokens.end(), "(");
std::vector<std::string>::iterator itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
while ((itBracket != tokens.end()) && (itEndBracket != tokens.end()) && (itEndBracket > itBracket)) {
std::vector<std::string> inBracket(itBracket + 1, itEndBracket);
EvaluateTokens(inBracket);
BracketPair bracketPair = FindBracketPair(tokens);
while (bracketPair.itBracket != tokens.end()) {
std::vector<std::string> inBracket(bracketPair.itBracket + 1, bracketPair.itEndBracket);
EvaluateTokens(inBracket, preprocessorDefinitions);
// The insertion is done before the removal because there were failures with the opposite approach
tokens.insert(itBracket, inBracket.begin(), inBracket.end());
itBracket = std::find(tokens.begin(), tokens.end(), "(");
itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
tokens.erase(itBracket, itEndBracket + 1);
tokens.insert(bracketPair.itBracket, inBracket.begin(), inBracket.end());
itBracket = std::find(tokens.begin(), tokens.end(), "(");
itEndBracket = std::find(tokens.begin(), tokens.end(), ")");
bracketPair = FindBracketPair(tokens);
tokens.erase(bracketPair.itBracket, bracketPair.itEndBracket + 1);
bracketPair = FindBracketPair(tokens);
}
// Evaluate logical negations
@ -1251,45 +1570,51 @@ void LexerCPP::EvaluateTokens(std::vector<std::string> &tokens) {
}
}
bool LexerCPP::EvaluateExpression(const std::string &expr, const std::map<std::string, std::string> &preprocessorDefinitions) {
// Break into tokens, replacing with definitions
std::string word;
std::vector<std::string> LexerCPP::Tokenize(const std::string &expr) const {
// Break into tokens
std::vector<std::string> tokens;
const char *cp = expr.c_str();
for (;;) {
while (*cp) {
std::string word;
if (setWord.Contains(static_cast<unsigned char>(*cp))) {
// Identifiers and numbers
while (setWord.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
cp++;
}
} else if (IsSpaceOrTab(*cp)) {
while (IsSpaceOrTab(*cp)) {
word += *cp;
cp++;
}
} else if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
cp++;
if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
cp++;
}
} else if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
cp++;
if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
word += *cp;
cp++;
}
} else {
std::map<std::string, std::string>::const_iterator it = preprocessorDefinitions.find(word);
if (it != preprocessorDefinitions.end()) {
tokens.push_back(it->second);
} else if (!word.empty() && ((word[0] >= '0' && word[0] <= '9') || (word == "defined"))) {
tokens.push_back(word);
}
word = "";
if (!*cp) {
break;
}
if ((*cp != ' ') && (*cp != '\t')) {
std::string op(cp, 1);
if (setRelOp.Contains(static_cast<unsigned char>(*cp))) {
if (setRelOp.Contains(static_cast<unsigned char>(cp[1]))) {
op += cp[1];
cp++;
}
} else if (setLogicalOp.Contains(static_cast<unsigned char>(*cp))) {
if (setLogicalOp.Contains(static_cast<unsigned char>(cp[1]))) {
op += cp[1];
cp++;
}
}
tokens.push_back(op);
}
// Should handle strings, characters, and comments here
word += *cp;
cp++;
}
cp++;
tokens.push_back(word);
}
return tokens;
}
EvaluateTokens(tokens);
bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &preprocessorDefinitions) {
std::vector<std::string> tokens = Tokenize(expr);
EvaluateTokens(tokens, preprocessorDefinitions);
// "0" or "" -> false else true
bool isFalse = tokens.empty() ||

View File

@ -226,14 +226,13 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
break;
case SCE_CMAKE_COMMENT:
if ( cNextChar == '\n' || cNextChar == '\r' ) {
// Special case:
if ( cCurrChar == '\\' ) {
if ( cCurrChar == '\n' || cCurrChar == '\r' ) {
if ( styler.SafeGetCharAt(i-1) == '\\' ) {
styler.ColourTo(i-2,state);
styler.ColourTo(i,SCE_CMAKE_DEFAULT);
styler.ColourTo(i-1,SCE_CMAKE_DEFAULT);
}
else {
styler.ColourTo(i,state);
styler.ColourTo(i-1,state);
state = SCE_CMAKE_DEFAULT;
}
}
@ -335,10 +334,7 @@ static void ColouriseCmakeDoc(unsigned int startPos, int length, int, WordList *
break;
}
if ( state == SCE_CMAKE_COMMENT) {
styler.ColourTo(i,state);
}
else if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) {
if ( state == SCE_CMAKE_STRINGDQ || state == SCE_CMAKE_STRINGLQ || state == SCE_CMAKE_STRINGRQ ) {
bool bIngoreNextDollarSign = false;
if ( bVarInString && cCurrChar == '$' ) {

View File

@ -31,16 +31,13 @@ using namespace Scintilla;
#endif
static bool IsSpaceEquiv(int state) {
return (state <= SCE_C_COMMENTDOC
// including SCE_C_DEFAULT, SCE_C_COMMENT, SCE_C_COMMENTLINE
|| state == SCE_C_COMMENTLINEDOC
|| state == SCE_C_COMMENTDOCKEYWORD
|| state == SCE_C_COMMENTDOCKEYWORDERROR
return (state == SCE_COFFEESCRIPT_DEFAULT
|| state == SCE_COFFEESCRIPT_COMMENTLINE
|| state == SCE_COFFEESCRIPT_COMMENTBLOCK
|| state == SCE_COFFEESCRIPT_VERBOSE_REGEX
|| state == SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT
|| state == SCE_C_WORD
|| state == SCE_C_REGEX);
|| state == SCE_COFFEESCRIPT_WORD
|| state == SCE_COFFEESCRIPT_REGEX);
}
// Preconditions: sc.currentPos points to a character after '+' or '-'.
@ -66,9 +63,8 @@ static bool followsReturnKeyword(StyleContext &sc, Accessor &styler) {
int pos = (int) sc.currentPos;
int currentLine = styler.GetLine(pos);
int lineStartPos = styler.LineStart(currentLine);
char ch;
while (--pos > lineStartPos) {
ch = styler.SafeGetCharAt(pos);
char ch = styler.SafeGetCharAt(pos);
if (ch != ' ' && ch != '\t') {
break;
}
@ -89,51 +85,16 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
// property styling.within.preprocessor
// For C++ code, determines whether all preprocessor code is styled in the preprocessor style (0, the default)
// or only from the initial # to the end of the command word(1).
bool stylingWithinPreprocessor = styler.GetPropertyInt("styling.within.preprocessor") != 0;
CharacterSet setOKBeforeRE(CharacterSet::setNone, "([{=,:;!%^&*|?~+-");
CharacterSet setCouldBePostOp(CharacterSet::setNone, "+-");
CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
CharacterSet setWordStart(CharacterSet::setAlpha, "_", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._", 0x80, true);
// property lexer.cpp.allow.dollars
// Set to 0 to disallow the '$' character in identifiers with the cpp lexer.
if (styler.GetPropertyInt("lexer.cpp.allow.dollars", 1) != 0) {
setWordStart.Add('$');
setWord.Add('$');
}
CharacterSet setWordStart(CharacterSet::setAlpha, "_$@", 0x80, true);
CharacterSet setWord(CharacterSet::setAlphaNum, "._$", 0x80, true);
int chPrevNonWhite = ' ';
int visibleChars = 0;
bool lastWordWasUUID = false;
int styleBeforeDCKeyword = SCE_C_DEFAULT;
bool continuationLine = false;
bool isIncludePreprocessor = false;
if (initStyle == SCE_C_PREPROCESSOR) {
// Set continuationLine if last character of previous line is '\'
int lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0) {
int chBack = styler.SafeGetCharAt(startPos-1, 0);
int chBack2 = styler.SafeGetCharAt(startPos-2, 0);
int lineEndChar = '!';
if (chBack2 == '\r' && chBack == '\n') {
lineEndChar = styler.SafeGetCharAt(startPos-3, 0);
} else if (chBack == '\n' || chBack == '\r') {
lineEndChar = chBack2;
}
continuationLine = lineEndChar == '\\';
}
}
// look back to set chPrevNonWhite properly for better regex colouring
int endPos = startPos + length;
@ -142,13 +103,13 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
styler.Flush();
while (back > 0 && IsSpaceEquiv(styler.StyleAt(--back)))
;
if (styler.StyleAt(back) == SCE_C_OPERATOR) {
if (styler.StyleAt(back) == SCE_COFFEESCRIPT_OPERATOR) {
chPrevNonWhite = styler.SafeGetCharAt(back);
}
if (startPos != back) {
initStyle = styler.StyleAt(back);
if (IsSpaceEquiv(initStyle)) {
initStyle = SCE_C_DEFAULT;
initStyle = SCE_COFFEESCRIPT_DEFAULT;
}
}
startPos = back;
@ -159,143 +120,74 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart) {
// Reset states to begining of colourise so no surprises
// Reset states to beginning of colourise so no surprises
// if different sets of lines lexed.
visibleChars = 0;
lastWordWasUUID = false;
isIncludePreprocessor = false;
}
// Handle line continuation generically.
if (sc.ch == '\\') {
if (sc.chNext == '\n' || sc.chNext == '\r') {
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
sc.Forward();
}
continuationLine = true;
continue;
}
}
// Determine if the current state should terminate.
switch (sc.state) {
case SCE_C_OPERATOR:
sc.SetState(SCE_C_DEFAULT);
case SCE_COFFEESCRIPT_OPERATOR:
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
break;
case SCE_C_NUMBER:
case SCE_COFFEESCRIPT_NUMBER:
// We accept almost anything because of hex. and number suffixes
if (!setWord.Contains(sc.ch)) {
sc.SetState(SCE_C_DEFAULT);
if (!setWord.Contains(sc.ch) || sc.Match('.', '.')) {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_C_IDENTIFIER:
case SCE_COFFEESCRIPT_IDENTIFIER:
if (!setWord.Contains(sc.ch) || (sc.ch == '.') || (sc.ch == '$')) {
char s[1000];
sc.GetCurrent(s, sizeof(s));
if (keywords.InList(s)) {
lastWordWasUUID = strcmp(s, "uuid") == 0;
sc.ChangeState(SCE_C_WORD);
sc.ChangeState(SCE_COFFEESCRIPT_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_C_WORD2);
sc.ChangeState(SCE_COFFEESCRIPT_WORD2);
} else if (keywords4.InList(s)) {
sc.ChangeState(SCE_C_GLOBALCLASS);
sc.ChangeState(SCE_COFFEESCRIPT_GLOBALCLASS);
}
sc.SetState(SCE_C_DEFAULT);
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_C_PREPROCESSOR:
if (sc.atLineStart && !continuationLine) {
sc.SetState(SCE_C_DEFAULT);
} else if (stylingWithinPreprocessor) {
if (IsASpace(sc.ch)) {
sc.SetState(SCE_C_DEFAULT);
}
} else {
if (sc.Match('/', '*') || sc.Match('/', '/')) {
sc.SetState(SCE_C_DEFAULT);
}
case SCE_COFFEESCRIPT_WORD:
case SCE_COFFEESCRIPT_WORD2:
case SCE_COFFEESCRIPT_GLOBALCLASS:
if (!setWord.Contains(sc.ch)) {
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_C_COMMENT:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
}
break;
case SCE_C_COMMENTDOC:
if (sc.Match('*', '/')) {
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
} else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
// Verify that we have the conditions to mark a comment-doc-keyword
if ((IsASpace(sc.chPrev) || sc.chPrev == '*') && (!IsASpace(sc.chNext))) {
styleBeforeDCKeyword = SCE_C_COMMENTDOC;
sc.SetState(SCE_C_COMMENTDOCKEYWORD);
}
}
break;
case SCE_C_COMMENTLINE:
case SCE_COFFEESCRIPT_COMMENTLINE:
if (sc.atLineStart) {
sc.SetState(SCE_C_DEFAULT);
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_C_COMMENTLINEDOC:
if (sc.atLineStart) {
sc.SetState(SCE_C_DEFAULT);
} else if (sc.ch == '@' || sc.ch == '\\') { // JavaDoc and Doxygen support
// Verify that we have the conditions to mark a comment-doc-keyword
if ((IsASpace(sc.chPrev) || sc.chPrev == '/' || sc.chPrev == '!') && (!IsASpace(sc.chNext))) {
styleBeforeDCKeyword = SCE_C_COMMENTLINEDOC;
sc.SetState(SCE_C_COMMENTDOCKEYWORD);
}
}
break;
case SCE_C_COMMENTDOCKEYWORD:
if ((styleBeforeDCKeyword == SCE_C_COMMENTDOC) && sc.Match('*', '/')) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
} else if (!setDoxygen.Contains(sc.ch)) {
char s[100];
sc.GetCurrent(s, sizeof(s));
if (!IsASpace(sc.ch) || !keywords3.InList(s + 1)) {
sc.ChangeState(SCE_C_COMMENTDOCKEYWORDERROR);
}
sc.SetState(styleBeforeDCKeyword);
}
break;
case SCE_C_STRING:
if (isIncludePreprocessor) {
if (sc.ch == '>') {
sc.ForwardSetState(SCE_C_DEFAULT);
isIncludePreprocessor = false;
}
} else if (sc.ch == '\\') {
case SCE_COFFEESCRIPT_STRING:
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_C_DEFAULT);
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_C_CHARACTER:
case SCE_COFFEESCRIPT_CHARACTER:
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_C_DEFAULT);
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_C_REGEX:
case SCE_COFFEESCRIPT_REGEX:
if (sc.atLineStart) {
sc.SetState(SCE_C_DEFAULT);
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (sc.ch == '/') {
sc.Forward();
while ((sc.ch < 0x80) && islower(sc.ch))
sc.Forward(); // gobble regex flags
sc.SetState(SCE_C_DEFAULT);
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (sc.ch == '\\') {
// Gobble up the quoted character
if (sc.chNext == '\\' || sc.chNext == '/') {
@ -303,30 +195,16 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
}
}
break;
case SCE_C_STRINGEOL:
case SCE_COFFEESCRIPT_STRINGEOL:
if (sc.atLineStart) {
sc.SetState(SCE_C_DEFAULT);
}
break;
case SCE_C_VERBATIM:
if (sc.ch == '\"') {
if (sc.chNext == '\"') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_C_DEFAULT);
}
}
break;
case SCE_C_UUID:
if (sc.ch == '\r' || sc.ch == '\n' || sc.ch == ')') {
sc.SetState(SCE_C_DEFAULT);
sc.SetState(SCE_COFFEESCRIPT_DEFAULT);
}
break;
case SCE_COFFEESCRIPT_COMMENTBLOCK:
if (sc.Match("###")) {
sc.Forward();
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (sc.ch == '\\') {
sc.Forward();
}
@ -335,7 +213,7 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
if (sc.Match("///")) {
sc.Forward();
sc.Forward();
sc.ForwardSetState(SCE_C_DEFAULT);
sc.ForwardSetState(SCE_COFFEESCRIPT_DEFAULT);
} else if (sc.Match('#')) {
sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX_COMMENT);
} else if (sc.ch == '\\') {
@ -350,31 +228,11 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
}
// Determine if a new state should be entered.
if (sc.state == SCE_C_DEFAULT) {
if (sc.Match('@', '\"')) {
sc.SetState(SCE_C_VERBATIM);
sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
if (lastWordWasUUID) {
sc.SetState(SCE_C_UUID);
lastWordWasUUID = false;
} else {
sc.SetState(SCE_C_NUMBER);
}
} else if (setWordStart.Contains(sc.ch) || (sc.ch == '@') || (sc.ch == '$')) {
if (lastWordWasUUID) {
sc.SetState(SCE_C_UUID);
lastWordWasUUID = false;
} else {
sc.SetState(SCE_C_IDENTIFIER);
}
} else if (sc.Match('/', '*')) {
if (sc.Match("/**") || sc.Match("/*!")) { // Support of Qt/Doxygen doc. style
sc.SetState(SCE_C_COMMENTDOC);
} else {
sc.SetState(SCE_C_COMMENT);
}
sc.Forward(); // Eat the * so it isn't used for the end of the comment
if (sc.state == SCE_COFFEESCRIPT_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_COFFEESCRIPT_NUMBER);
} else if (setWordStart.Contains(sc.ch)) {
sc.SetState(SCE_COFFEESCRIPT_IDENTIFIER);
} else if (sc.Match("///")) {
sc.SetState(SCE_COFFEESCRIPT_VERBOSE_REGEX);
sc.Forward();
@ -384,25 +242,21 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
|| followsReturnKeyword(sc, styler))
&& (!setCouldBePostOp.Contains(chPrevNonWhite)
|| !FollowsPostfixOperator(sc, styler))) {
sc.SetState(SCE_C_REGEX); // JavaScript's RegEx
sc.SetState(SCE_COFFEESCRIPT_REGEX); // JavaScript's RegEx
} else if (sc.ch == '\"') {
sc.SetState(SCE_C_STRING);
isIncludePreprocessor = false; // ensure that '>' won't end the string
} else if (isIncludePreprocessor && sc.ch == '<') {
sc.SetState(SCE_C_STRING);
sc.SetState(SCE_COFFEESCRIPT_STRING);
} else if (sc.ch == '\'') {
sc.SetState(SCE_C_CHARACTER);
sc.SetState(SCE_COFFEESCRIPT_CHARACTER);
} else if (sc.ch == '#') {
if (sc.Match("###")) {
sc.SetState(SCE_COFFEESCRIPT_COMMENTBLOCK);
sc.Forward();
sc.Forward();
} else {
sc.SetState(SCE_C_COMMENTLINE);
sc.SetState(SCE_COFFEESCRIPT_COMMENTLINE);
}
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_C_OPERATOR);
sc.SetState(SCE_COFFEESCRIPT_OPERATOR);
}
}
@ -410,7 +264,6 @@ static void ColouriseCoffeeScriptDoc(unsigned int startPos, int length, int init
chPrevNonWhite = sc.ch;
visibleChars++;
}
continuationLine = false;
}
sc.Complete();
}
@ -422,10 +275,6 @@ static bool IsCommentLine(int line, Accessor &styler) {
char ch = styler[i];
if (ch == '#')
return true;
else if (ch == '/'
&& i < eol_pos - 1
&& styler[i + 1] == '*')
return true;
else if (ch != ' ' && ch != '\t')
return false;
}
@ -557,6 +406,9 @@ static void FoldCoffeeScriptDoc(unsigned int startPos, int length, int,
static const char *const csWordLists[] = {
"Keywords",
"Secondary keywords",
"Unused",
"Global classes",
0,
};

View File

@ -37,7 +37,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
char chNext = styler[startPos];
int lengthDoc = startPos + length;
// create a buffer large enough to take the largest chunk...
char *buffer = new char[length];
char *buffer = new char[length+1];
int bufferCount = 0;
// this assumes that we have 2 keyword list in conf.properties
@ -74,17 +74,17 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
} else if( ch == '"') {
state = SCE_CONF_STRING;
styler.ColourTo(i,SCE_CONF_STRING);
} else if( isascii(ch) && ispunct(ch) ) {
} else if( IsASCII(ch) && ispunct(ch) ) {
// signals an operator...
// no state jump necessary for this
// simple case...
styler.ColourTo(i,SCE_CONF_OPERATOR);
} else if( isascii(ch) && isalpha(ch) ) {
} else if( IsASCII(ch) && isalpha(ch) ) {
// signals the start of an identifier
bufferCount = 0;
buffer[bufferCount++] = static_cast<char>(tolower(ch));
state = SCE_CONF_IDENTIFIER;
} else if( isascii(ch) && isdigit(ch) ) {
} else if( IsASCII(ch) && isdigit(ch) ) {
// signals the start of a number
bufferCount = 0;
buffer[bufferCount++] = ch;
@ -111,7 +111,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
// if we find a non-alphanumeric char,
// we simply go to default state
// else we're still dealing with an extension...
if( (isascii(ch) && isalnum(ch)) || (ch == '_') ||
if( (IsASCII(ch) && isalnum(ch)) || (ch == '_') ||
(ch == '-') || (ch == '$') ||
(ch == '/') || (ch == '.') || (ch == '*') )
{
@ -133,7 +133,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
case SCE_CONF_IDENTIFIER:
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric
if( (isascii(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) {
if( (IsASCII(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') || (ch == '$') || (ch == '.') || (ch == '*')) {
buffer[bufferCount++] = static_cast<char>(tolower(ch));
} else {
state = SCE_CONF_DEFAULT;
@ -158,7 +158,7 @@ static void ColouriseConfDoc(unsigned int startPos, int length, int, WordList *k
case SCE_CONF_NUMBER:
// stay in CONF_NUMBER state until we find a non-numeric
if( (isascii(ch) && isdigit(ch)) || ch == '.') {
if( (IsASCII(ch) && isdigit(ch)) || ch == '.') {
buffer[bufferCount++] = ch;
} else {
state = SCE_CONF_DEFAULT;

View File

@ -36,7 +36,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
char chNext = styler[startPos];
int lengthDoc = startPos + length;
// create a buffer large enough to take the largest chunk...
char *buffer = new char[length];
char *buffer = new char[length+1];
int bufferCount = 0;
// used when highliting environment variables inside quoted string:
bool insideString = false;
@ -98,12 +98,12 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
// signals an asterisk
// no state jump necessary for this simple case...
styler.ColourTo(i,SCE_NNCRONTAB_ASTERISK);
} else if( (isascii(ch) && isalpha(ch)) || ch == '<' ) {
} else if( (IsASCII(ch) && isalpha(ch)) || ch == '<' ) {
// signals the start of an identifier
bufferCount = 0;
buffer[bufferCount++] = ch;
state = SCE_NNCRONTAB_IDENTIFIER;
} else if( isascii(ch) && isdigit(ch) ) {
} else if( IsASCII(ch) && isdigit(ch) ) {
// signals the start of a number
bufferCount = 0;
buffer[bufferCount++] = ch;
@ -171,7 +171,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
case SCE_NNCRONTAB_IDENTIFIER:
// stay in CONF_IDENTIFIER state until we find a non-alphanumeric
if( (isascii(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') ||
if( (IsASCII(ch) && isalnum(ch)) || (ch == '_') || (ch == '-') || (ch == '/') ||
(ch == '$') || (ch == '.') || (ch == '<') || (ch == '>') ||
(ch == '@') ) {
buffer[bufferCount++] = ch;
@ -200,7 +200,7 @@ static void ColouriseNncrontabDoc(unsigned int startPos, int length, int, WordLi
case SCE_NNCRONTAB_NUMBER:
// stay in CONF_NUMBER state until we find a non-numeric
if( isascii(ch) && isdigit(ch) /* || ch == '.' */ ) {
if( IsASCII(ch) && isdigit(ch) /* || ch == '.' */ ) {
buffer[bufferCount++] = ch;
} else {
state = SCE_NNCRONTAB_DEFAULT;

View File

@ -39,7 +39,7 @@ static inline bool IsAWordStart(const int ch) {
}
static inline bool IsCsoundOperator(char ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '*' || ch == '/' || ch == '-' || ch == '+' ||

View File

@ -41,15 +41,15 @@ using namespace Scintilla;
// Underscore, letter, digit and universal alphas from C99 Appendix D.
static bool IsWordStart(int ch) {
return (isascii(ch) && (isalpha(ch) || ch == '_')) || !isascii(ch);
return (IsASCII(ch) && (isalpha(ch) || ch == '_')) || !IsASCII(ch);
}
static bool IsWord(int ch) {
return (isascii(ch) && (isalnum(ch) || ch == '_')) || !isascii(ch);
return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch);
}
static bool IsDoxygen(int ch) {
if (isascii(ch) && islower(ch))
if (IsASCII(ch) && islower(ch))
return true;
if (ch == '$' || ch == '@' || ch == '\\' ||
ch == '&' || ch == '#' || ch == '<' || ch == '>' ||
@ -267,7 +267,7 @@ void SCI_METHOD LexerD::Lex(unsigned int startPos, int length, int initStyle, ID
break;
case SCE_D_NUMBER:
// We accept almost anything because of hex. and number suffixes
if (isascii(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) {
if (IsASCII(sc.ch) && (isalnum(sc.ch) || sc.ch == '_')) {
continue;
} else if (sc.ch == '.' && sc.chNext != '.' && !numFloat) {
// Don't parse 0..2 as number.

View File

@ -0,0 +1,228 @@
// Scintilla source code edit control
/** @file LexDMAP.cxx
** Lexer for MSC Nastran DMAP.
** Written by Mark Robinson, based on the Fortran lexer by Chuan-jian Shen, Last changed Aug. 2013
**/
// 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"
/***************************************/
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/***********************************************/
static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '%');
}
/**********************************************/
static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch));
}
/***************************************/
static void ColouriseDMAPDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
/***************************************/
int posLineStart = 0, numNonBlank = 0;
int endPos = startPos + length;
/***************************************/
// backtrack to the nearest keyword
while ((startPos > 1) && (styler.StyleAt(startPos) != SCE_DMAP_WORD)) {
startPos--;
}
startPos = styler.LineStart(styler.GetLine(startPos));
initStyle = styler.StyleAt(startPos - 1);
StyleContext sc(startPos, endPos-startPos, initStyle, styler);
/***************************************/
for (; sc.More(); sc.Forward()) {
// remember the start position of the line
if (sc.atLineStart) {
posLineStart = sc.currentPos;
numNonBlank = 0;
sc.SetState(SCE_DMAP_DEFAULT);
}
if (!IsASpaceOrTab(sc.ch)) numNonBlank ++;
/***********************************************/
// Handle data appearing after column 72; it is ignored
int toLineStart = sc.currentPos - posLineStart;
if (toLineStart >= 72 || sc.ch == '$') {
sc.SetState(SCE_DMAP_COMMENT);
while (!sc.atLineEnd && sc.More()) sc.Forward(); // Until line end
continue;
}
/***************************************/
// Determine if the current state should terminate.
if (sc.state == SCE_DMAP_OPERATOR) {
sc.SetState(SCE_DMAP_DEFAULT);
} else if (sc.state == SCE_DMAP_NUMBER) {
if (!(IsAWordChar(sc.ch) || sc.ch=='\'' || sc.ch=='\"' || sc.ch=='.')) {
sc.SetState(SCE_DMAP_DEFAULT);
}
} else if (sc.state == SCE_DMAP_IDENTIFIER) {
if (!IsAWordChar(sc.ch) || (sc.ch == '%')) {
char s[100];
sc.GetCurrentLowered(s, sizeof(s));
if (keywords.InList(s)) {
sc.ChangeState(SCE_DMAP_WORD);
} else if (keywords2.InList(s)) {
sc.ChangeState(SCE_DMAP_WORD2);
} else if (keywords3.InList(s)) {
sc.ChangeState(SCE_DMAP_WORD3);
}
sc.SetState(SCE_DMAP_DEFAULT);
}
} else if (sc.state == SCE_DMAP_COMMENT) {
if (sc.ch == '\r' || sc.ch == '\n') {
sc.SetState(SCE_DMAP_DEFAULT);
}
} else if (sc.state == SCE_DMAP_STRING1) {
if (sc.ch == '\'') {
if (sc.chNext == '\'') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_DMAP_DEFAULT);
}
} else if (sc.atLineEnd) {
sc.ChangeState(SCE_DMAP_STRINGEOL);
sc.ForwardSetState(SCE_DMAP_DEFAULT);
}
} else if (sc.state == SCE_DMAP_STRING2) {
if (sc.atLineEnd) {
sc.ChangeState(SCE_DMAP_STRINGEOL);
sc.ForwardSetState(SCE_DMAP_DEFAULT);
} else if (sc.ch == '\"') {
if (sc.chNext == '\"') {
sc.Forward();
} else {
sc.ForwardSetState(SCE_DMAP_DEFAULT);
}
}
}
/***************************************/
// Determine if a new state should be entered.
if (sc.state == SCE_DMAP_DEFAULT) {
if (sc.ch == '$') {
sc.SetState(SCE_DMAP_COMMENT);
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) || (sc.ch == '-' && IsADigit(sc.chNext))) {
sc.SetState(SCE_F_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_DMAP_IDENTIFIER);
} else if (sc.ch == '\"') {
sc.SetState(SCE_DMAP_STRING2);
} else if (sc.ch == '\'') {
sc.SetState(SCE_DMAP_STRING1);
} else if (isoperator(static_cast<char>(sc.ch))) {
sc.SetState(SCE_DMAP_OPERATOR);
}
}
}
sc.Complete();
}
/***************************************/
// To determine the folding level depending on keywords
static int classifyFoldPointDMAP(const char* s, const char* prevWord) {
int lev = 0;
if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "enddo") == 0 || strcmp(s, "endif") == 0) {
lev = -1;
} else if ((strcmp(prevWord, "do") == 0 && strcmp(s, "while") == 0) || strcmp(s, "then") == 0) {
lev = 1;
}
return lev;
}
// Folding the code
static void FoldDMAPDoc(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
//
// bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
// Do not know how to fold the comment at the moment.
//
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
/***************************************/
int lastStart = 0;
char prevWord[32] = "";
/***************************************/
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
//
if ((stylePrev == SCE_DMAP_DEFAULT || stylePrev == SCE_DMAP_OPERATOR || stylePrev == SCE_DMAP_COMMENT) && (style == SCE_DMAP_WORD)) {
// Store last word and label start point.
lastStart = i;
}
/***************************************/
if (style == SCE_DMAP_WORD) {
if(iswordchar(ch) && !iswordchar(chNext)) {
char s[32];
unsigned int k;
for(k=0; (k<31 ) && (k<i-lastStart+1 ); k++) {
s[k] = static_cast<char>(tolower(styler[lastStart+k]));
}
s[k] = '\0';
levelCurrent += classifyFoldPointDMAP(s, prevWord);
strcpy(prevWord, s);
}
}
if (atEOL) {
int lev = levelPrev;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
visibleChars = 0;
strcpy(prevWord, "");
}
/***************************************/
if (!isspacechar(ch)) visibleChars++;
}
/***************************************/
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
/***************************************/
static const char * const DMAPWordLists[] = {
"Primary keywords and identifiers",
"Intrinsic functions",
"Extended and user defined functions",
0,
};
/***************************************/
LexerModule lmDMAP(SCLEX_DMAP, ColouriseDMAPDoc, "DMAP", FoldDMAPDoc, DMAPWordLists);

View File

@ -0,0 +1,355 @@
// Scintilla source code edit control
/** @file LexDMIS.cxx
** Lexer for DMIS.
**/
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// Copyright 2013-2014 by Andreas Tscharner <andy@vis.ethz.ch>
// The License.txt file describes the conditions under which this software may be distributed.
#include <cstdlib>
#include <cassert>
#include <cstring>
#include <cctype>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static const char *const DMISWordListDesc[] = {
"DMIS Major Words",
"DMIS Minor Words",
"Unsupported DMIS Major Words",
"Unsupported DMIS Minor Words",
"Keywords for code folding start",
"Corresponding keywords for code folding end",
0
};
class LexerDMIS : public ILexer
{
private:
char *m_wordListSets;
WordList m_majorWords;
WordList m_minorWords;
WordList m_unsupportedMajor;
WordList m_unsupportedMinor;
WordList m_codeFoldingStart;
WordList m_codeFoldingEnd;
char * SCI_METHOD UpperCase(char *item);
void SCI_METHOD InitWordListSets(void);
public:
LexerDMIS(void);
virtual ~LexerDMIS(void);
int SCI_METHOD Version() const {
return lvOriginal;
}
void SCI_METHOD Release() {
delete this;
}
const char * SCI_METHOD PropertyNames() {
return NULL;
}
int SCI_METHOD PropertyType(const char *) {
return -1;
}
const char * SCI_METHOD DescribeProperty(const char *) {
return NULL;
}
int SCI_METHOD PropertySet(const char *, const char *) {
return -1;
}
int SCI_METHOD WordListSet(int n, const char *wl);
void * SCI_METHOD PrivateCall(int, void *) {
return NULL;
}
static ILexer *LexerFactoryDMIS() {
return new LexerDMIS;
}
const char * SCI_METHOD DescribeWordListSets();
void SCI_METHOD Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
void SCI_METHOD Fold(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess);
};
char * SCI_METHOD LexerDMIS::UpperCase(char *item)
{
char *itemStart;
itemStart = item;
while (item && *item) {
*item = toupper(*item);
item++;
};
return itemStart;
}
void SCI_METHOD LexerDMIS::InitWordListSets(void)
{
size_t totalLen = 0;
for (int i=0; DMISWordListDesc[i]; i++) {
totalLen += strlen(DMISWordListDesc[i]);
totalLen++;
};
totalLen++;
this->m_wordListSets = new char[totalLen];
memset(this->m_wordListSets, 0, totalLen);
for (int i=0; DMISWordListDesc[i]; i++) {
strcat(this->m_wordListSets, DMISWordListDesc[i]);
strcat(this->m_wordListSets, "\n");
};
}
LexerDMIS::LexerDMIS(void) {
this->InitWordListSets();
this->m_majorWords.Clear();
this->m_minorWords.Clear();
this->m_unsupportedMajor.Clear();
this->m_unsupportedMinor.Clear();
this->m_codeFoldingStart.Clear();
this->m_codeFoldingEnd.Clear();
}
LexerDMIS::~LexerDMIS(void) {
delete[] this->m_wordListSets;
}
int SCI_METHOD LexerDMIS::WordListSet(int n, const char *wl)
{
switch (n) {
case 0:
this->m_majorWords.Clear();
this->m_majorWords.Set(wl);
break;
case 1:
this->m_minorWords.Clear();
this->m_minorWords.Set(wl);
break;
case 2:
this->m_unsupportedMajor.Clear();
this->m_unsupportedMajor.Set(wl);
break;
case 3:
this->m_unsupportedMinor.Clear();
this->m_unsupportedMinor.Set(wl);
break;
case 4:
this->m_codeFoldingStart.Clear();
this->m_codeFoldingStart.Set(wl);
break;
case 5:
this->m_codeFoldingEnd.Clear();
this->m_codeFoldingEnd.Set(wl);
break;
default:
return -1;
break;
}
return 0;
}
const char * SCI_METHOD LexerDMIS::DescribeWordListSets()
{
return this->m_wordListSets;
}
void SCI_METHOD LexerDMIS::Lex(unsigned int startPos, int lengthDoc, int initStyle, IDocument *pAccess)
{
const unsigned int MAX_STR_LEN = 100;
LexAccessor styler(pAccess);
StyleContext scCTX(startPos, lengthDoc, initStyle, styler);
CharacterSet setDMISNumber(CharacterSet::setDigits, ".-+eE");
CharacterSet setDMISWordStart(CharacterSet::setAlpha, "-234", 0x80, true);
CharacterSet setDMISWord(CharacterSet::setAlpha);
bool isIFLine = false;
for (; scCTX.More(); scCTX.Forward()) {
if (scCTX.atLineEnd) {
isIFLine = false;
};
switch (scCTX.state) {
case SCE_DMIS_DEFAULT:
if (scCTX.Match('$', '$')) {
scCTX.SetState(SCE_DMIS_COMMENT);
scCTX.Forward();
};
if (scCTX.Match('\'')) {
scCTX.SetState(SCE_DMIS_STRING);
};
if (IsADigit(scCTX.ch) || ((scCTX.Match('-') || scCTX.Match('+')) && IsADigit(scCTX.chNext))) {
scCTX.SetState(SCE_DMIS_NUMBER);
break;
};
if (setDMISWordStart.Contains(scCTX.ch)) {
scCTX.SetState(SCE_DMIS_KEYWORD);
};
if (scCTX.Match('(') && (!isIFLine)) {
scCTX.SetState(SCE_DMIS_LABEL);
};
break;
case SCE_DMIS_COMMENT:
if (scCTX.atLineEnd) {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
break;
case SCE_DMIS_STRING:
if (scCTX.Match('\'')) {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
break;
case SCE_DMIS_NUMBER:
if (!setDMISNumber.Contains(scCTX.ch)) {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
break;
case SCE_DMIS_KEYWORD:
if (!setDMISWord.Contains(scCTX.ch)) {
char tmpStr[MAX_STR_LEN];
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
scCTX.GetCurrent(tmpStr, (MAX_STR_LEN-1));
strncpy(tmpStr, this->UpperCase(tmpStr), (MAX_STR_LEN-1));
if (this->m_minorWords.InList(tmpStr)) {
scCTX.ChangeState(SCE_DMIS_MINORWORD);
};
if (this->m_majorWords.InList(tmpStr)) {
isIFLine = (strcmp(tmpStr, "IF") == 0);
scCTX.ChangeState(SCE_DMIS_MAJORWORD);
};
if (this->m_unsupportedMajor.InList(tmpStr)) {
scCTX.ChangeState(SCE_DMIS_UNSUPPORTED_MAJOR);
};
if (this->m_unsupportedMinor.InList(tmpStr)) {
scCTX.ChangeState(SCE_DMIS_UNSUPPORTED_MINOR);
};
if (scCTX.Match('(') && (!isIFLine)) {
scCTX.SetState(SCE_DMIS_LABEL);
} else {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
};
break;
case SCE_DMIS_LABEL:
if (scCTX.Match(')')) {
scCTX.SetState(SCE_DMIS_DEFAULT);
};
break;
};
};
scCTX.Complete();
}
void SCI_METHOD LexerDMIS::Fold(unsigned int startPos, int lengthDoc, int, IDocument *pAccess)
{
const int MAX_STR_LEN = 100;
LexAccessor styler(pAccess);
unsigned int endPos = startPos + lengthDoc;
char chNext = styler[startPos];
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int strPos = 0;
bool foldWordPossible = false;
CharacterSet setDMISFoldWord(CharacterSet::setAlpha);
char *tmpStr;
tmpStr = new char[MAX_STR_LEN];
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
for (unsigned int i=startPos; i<endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i+1);
bool atEOL = ((ch == '\r' && chNext != '\n') || (ch == '\n'));
if (strPos >= (MAX_STR_LEN-1)) {
strPos = MAX_STR_LEN-1;
};
int style = styler.StyleAt(i);
bool noFoldPos = ((style == SCE_DMIS_COMMENT) || (style == SCE_DMIS_STRING));
if (foldWordPossible) {
if (setDMISFoldWord.Contains(ch)) {
tmpStr[strPos++] = ch;
} else {
tmpStr = this->UpperCase(tmpStr);
if (this->m_codeFoldingStart.InList(tmpStr) && (!noFoldPos)) {
levelCurrent++;
};
if (this->m_codeFoldingEnd.InList(tmpStr) && (!noFoldPos)) {
levelCurrent--;
};
memset(tmpStr, 0, MAX_STR_LEN*sizeof(char));
strPos = 0;
foldWordPossible = false;
};
} else {
if (setDMISFoldWord.Contains(ch)) {
tmpStr[strPos++] = ch;
foldWordPossible = true;
};
};
if (atEOL || (i == (endPos-1))) {
int lev = levelPrev;
if (levelCurrent > levelPrev) {
lev |= SC_FOLDLEVELHEADERFLAG;
};
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
};
lineCurrent++;
levelPrev = levelCurrent;
};
};
delete[] tmpStr;
}
LexerModule lmDMIS(SCLEX_DMIS, LexerDMIS::LexerFactoryDMIS, "DMIS", DMISWordListDesc);

View File

@ -7,10 +7,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#ifdef _MSC_VER
#pragma warning(disable: 4786)

View File

@ -6,10 +6,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"

View File

@ -27,15 +27,6 @@
using namespace Scintilla;
#endif
static inline bool IsAWordChar(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' ||
ch == '_' || ch == '?' || ch == '"' || ch == '@' ||
ch == '!' || ch == '[' || ch == ']' || ch == '/' ||
ch == '+' || ch == '-' || ch == '*' || ch == '<' ||
ch == '>' || ch == '=' || ch == ';' || ch == '(' ||
ch == ')' );
}
static inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
}
@ -123,29 +114,29 @@ static void ColouriseForthDoc(unsigned int startPos, int length, int initStyle,
(sc.atLineStart || IsASpaceChar(sc.chPrev)) &&
(sc.atLineEnd || IsASpaceChar(sc.chNext))) {
sc.SetState(SCE_FORTH_COMMENT_ML);
} else if ( (sc.ch == '$' && (isascii(sc.chNext) && isxdigit(sc.chNext))) ) {
} else if ( (sc.ch == '$' && (IsASCII(sc.chNext) && isxdigit(sc.chNext))) ) {
// number starting with $ is a hex number
sc.SetState(SCE_FORTH_NUMBER);
while(sc.More() && isascii(sc.chNext) && isxdigit(sc.chNext))
while(sc.More() && IsASCII(sc.chNext) && isxdigit(sc.chNext))
sc.Forward();
} else if ( (sc.ch == '%' && (isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))) ) {
} else if ( (sc.ch == '%' && (IsASCII(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))) ) {
// number starting with % is binary
sc.SetState(SCE_FORTH_NUMBER);
while(sc.More() && isascii(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))
while(sc.More() && IsASCII(sc.chNext) && (sc.chNext == '0' || sc.chNext == '1'))
sc.Forward();
} else if ( isascii(sc.ch) &&
(isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && isascii(sc.chNext) && isxdigit(sc.chNext)) )
} else if ( IsASCII(sc.ch) &&
(isxdigit(sc.ch) || ((sc.ch == '.' || sc.ch == '-') && IsASCII(sc.chNext) && isxdigit(sc.chNext)) )
){
sc.SetState(SCE_FORTH_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_FORTH_IDENTIFIER);
} else if (sc.ch == '{') {
sc.SetState(SCE_FORTH_LOCALE);
} else if (sc.ch == ':' && isascii(sc.chNext) && isspace(sc.chNext)) {
} else if (sc.ch == ':' && IsASCII(sc.chNext) && isspace(sc.chNext)) {
// highlight word definitions e.g. : GCD ( n n -- n ) ..... ;
// ^ ^^^
sc.SetState(SCE_FORTH_DEFWORD);
while(sc.More() && isascii(sc.chNext) && isspace(sc.chNext))
while(sc.More() && IsASCII(sc.chNext) && isspace(sc.chNext))
sc.Forward();
} else if (sc.ch == ';' &&
(sc.atLineStart || IsASpaceChar(sc.chPrev)) &&

View File

@ -1,7 +1,7 @@
// Scintilla source code edit control
/** @file LexFortran.cxx
** Lexer for Fortran.
** Writen by Chuan-jian Shen, Last changed Sep. 2003
** Written by Chuan-jian Shen, Last changed Sep. 2003
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@ -38,15 +38,15 @@ static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch));
}
/***************************************/
inline bool IsABlank(unsigned int ch) {
return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ;
static inline bool IsABlank(unsigned int ch) {
return (ch == ' ') || (ch == 0x09) || (ch == 0x0b) ;
}
/***************************************/
inline bool IsALineEnd(char ch) {
return ((ch == '\n') || (ch == '\r')) ;
static inline bool IsALineEnd(char ch) {
return ((ch == '\n') || (ch == '\r')) ;
}
/***************************************/
unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
static unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
while (!IsALineEnd(styler.SafeGetCharAt(pos++))) continue;
if (styler.SafeGetCharAt(pos) == '\n') pos++;
while (IsABlank(styler.SafeGetCharAt(pos++))) continue;
@ -60,7 +60,7 @@ unsigned int GetContinuedPos(unsigned int pos, Accessor &styler) {
}
/***************************************/
static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler, bool isFixFormat) {
WordList *keywordlists[], Accessor &styler, bool isFixFormat) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
@ -89,11 +89,11 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
int toLineStart = sc.currentPos - posLineStart;
if (isFixFormat && (toLineStart < 6 || toLineStart >= 72)) {
if ((toLineStart == 0 && (tolower(sc.ch) == 'c' || sc.ch == '*')) || sc.ch == '!') {
if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") ||
sc.chNext == '$') {
sc.SetState(SCE_F_PREPROCESSOR);
if (sc.MatchIgnoreCase("cdec$") || sc.MatchIgnoreCase("*dec$") || sc.MatchIgnoreCase("!dec$") ||
sc.MatchIgnoreCase("cdir$") || sc.MatchIgnoreCase("*dir$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("cms$") || sc.MatchIgnoreCase("*ms$") || sc.MatchIgnoreCase("!ms$") ||
sc.chNext == '$') {
sc.SetState(SCE_F_PREPROCESSOR);
} else {
sc.SetState(SCE_F_COMMENT);
}
@ -111,8 +111,8 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
//if (!IsASpace(sc.ch) && sc.ch != '0') {
if (sc.ch != '\r' && sc.ch != '\n') {
sc.SetState(SCE_F_CONTINUATION);
if (!IsASpace(sc.ch) && sc.ch != '0')
sc.ForwardSetState(prevState);
if (!IsASpace(sc.ch) && sc.ch != '0')
sc.ForwardSetState(prevState);
} else
sc.SetState(SCE_F_DEFAULT);
}
@ -122,9 +122,9 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
// Hanndle preprocessor directives
if (sc.ch == '#' && numNonBlank == 1)
{
sc.SetState(SCE_F_PREPROCESSOR);
while (!sc.atLineEnd && sc.More())
sc.Forward(); // Until line end
sc.SetState(SCE_F_PREPROCESSOR);
while (!sc.atLineEnd && sc.More())
sc.Forward(); // Until line end
}
/***************************************/
// Handle line continuation generically.
@ -221,8 +221,8 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
// Determine if a new state should be entered.
if (sc.state == SCE_F_DEFAULT) {
if (sc.ch == '!') {
if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
if (sc.MatchIgnoreCase("!dec$") || sc.MatchIgnoreCase("!dir$") ||
sc.MatchIgnoreCase("!ms$") || sc.chNext == '$') {
sc.SetState(SCE_F_PREPROCESSOR);
} else {
sc.SetState(SCE_F_COMMENT);
@ -232,7 +232,7 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_F_NUMBER);
} else if ((tolower(sc.ch) == 'b' || tolower(sc.ch) == 'o' ||
tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) {
tolower(sc.ch) == 'z') && (sc.chNext == '\"' || sc.chNext == '\'')) {
sc.SetState(SCE_F_NUMBER);
sc.Forward();
} else if (sc.ch == '.' && isalpha(sc.chNext)) {
@ -254,41 +254,49 @@ static void ColouriseFortranDoc(unsigned int startPos, int length, int initStyle
// To determine the folding level depending on keywords
static int classifyFoldPointFortran(const char* s, const char* prevWord, const char chNextNonBlank) {
int lev = 0;
if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0)
return -1;
if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0
|| strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0
|| strcmp(s, "do") == 0 || strcmp(s, "enum") ==0
|| strcmp(s, "function") == 0 || strcmp(s, "interface") == 0
|| strcmp(s, "module") == 0 || strcmp(s, "program") == 0
|| strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0
|| (strcmp(s, "type") == 0 && chNextNonBlank != '(')
|| strcmp(s, "critical") == 0){
if (strcmp(prevWord, "end") == 0)
lev = 0;
else
lev = 1;
} else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=')
|| strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
|| strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
|| strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0
|| strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0
|| strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0
|| strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0
|| strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0
|| strcmp(s, "endwhere") == 0 || strcmp(s, "endcritical") == 0
|| (strcmp(s, "procedure") == 0 && strcmp(prevWord, "module") == 0) ) { // Take care of the "module procedure" statement
lev = -1;
} else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if
if ((strcmp(prevWord, "module") == 0 && strcmp(s, "subroutine") == 0)
|| (strcmp(prevWord, "module") == 0 && strcmp(s, "function") == 0)) {
lev = 0;
} else if (strcmp(s, "associate") == 0 || strcmp(s, "block") == 0
|| strcmp(s, "blockdata") == 0 || strcmp(s, "select") == 0
|| strcmp(s, "selecttype") == 0 || strcmp(s, "selectcase") == 0
|| strcmp(s, "do") == 0 || strcmp(s, "enum") ==0
|| strcmp(s, "function") == 0 || strcmp(s, "interface") == 0
|| strcmp(s, "module") == 0 || strcmp(s, "program") == 0
|| strcmp(s, "subroutine") == 0 || strcmp(s, "then") == 0
|| (strcmp(s, "type") == 0 && chNextNonBlank != '(')
|| strcmp(s, "critical") == 0 || strcmp(s, "submodule") == 0){
if (strcmp(prevWord, "end") == 0)
lev = 0;
else
lev = 1;
} else if ((strcmp(s, "end") == 0 && chNextNonBlank != '=')
|| strcmp(s, "endassociate") == 0 || strcmp(s, "endblock") == 0
|| strcmp(s, "endblockdata") == 0 || strcmp(s, "endselect") == 0
|| strcmp(s, "enddo") == 0 || strcmp(s, "endenum") ==0
|| strcmp(s, "endif") == 0 || strcmp(s, "endforall") == 0
|| strcmp(s, "endfunction") == 0 || strcmp(s, "endinterface") == 0
|| strcmp(s, "endmodule") == 0 || strcmp(s, "endprogram") == 0
|| strcmp(s, "endsubroutine") == 0 || strcmp(s, "endtype") == 0
|| strcmp(s, "endwhere") == 0 || strcmp(s, "endcritical") == 0
|| (strcmp(prevWord, "module") == 0 && strcmp(s, "procedure") == 0) // Take care of the "module procedure" statement
|| strcmp(s, "endsubmodule") == 0) {
lev = -1;
} else if (strcmp(prevWord, "end") == 0 && strcmp(s, "if") == 0){ // end if
lev = 0;
} else if (strcmp(prevWord, "type") == 0 && strcmp(s, "is") == 0){ // type is
lev = -1;
}
lev = -1;
} else if ((strcmp(prevWord, "end") == 0 && strcmp(s, "procedure") == 0)
|| strcmp(s, "endprocedure") == 0) {
lev = 1; // level back to 0, because no folding support for "module procedure" in submodule
}
return lev;
}
/***************************************/
// Folding the code
static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
Accessor &styler, bool isFixFormat) {
Accessor &styler, bool isFixFormat) {
//
// bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
// Do not know how to fold the comment at the moment.
@ -297,35 +305,51 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
unsigned int endPos = startPos + length;
int visibleChars = 0;
int lineCurrent = styler.GetLine(startPos);
int levelPrev = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
int levelCurrent = levelPrev;
int levelCurrent;
bool isPrevLine;
if (lineCurrent > 0) {
lineCurrent--;
startPos = styler.LineStart(lineCurrent);
levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
isPrevLine = true;
} else {
levelCurrent = styler.LevelAt(lineCurrent) & SC_FOLDLEVELNUMBERMASK;
isPrevLine = false;
}
char chNext = styler[startPos];
char chNextNonBlank;
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
int levelDeltaNext = 0;
/***************************************/
int lastStart = 0;
char prevWord[32] = "";
char Label[6] = "";
// Variables for do label folding.
static int doLabels[100];
static int posLabel=-1;
/***************************************/
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
chNextNonBlank = chNext;
char chNextNonBlank = chNext;
bool nextEOL = false;
if (IsALineEnd(chNextNonBlank)) {
nextEOL = true;
}
unsigned int j=i+1;
while(IsABlank(chNextNonBlank) && j<endPos) {
j ++ ;
chNextNonBlank = styler.SafeGetCharAt(j);
if (IsALineEnd(chNextNonBlank)) {
nextEOL = true;
}
}
if (!nextEOL && j == endPos) {
nextEOL = true;
}
int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
//
if (((isFixFormat && stylePrev == SCE_F_CONTINUATION) || stylePrev == SCE_F_DEFAULT || stylePrev == SCE_F_OPERATOR) && (style == SCE_F_WORD || style == SCE_F_LABEL)) {
if (((isFixFormat && stylePrev == SCE_F_CONTINUATION) || stylePrev == SCE_F_DEFAULT
|| stylePrev == SCE_F_OPERATOR) && (style == SCE_F_WORD || style == SCE_F_LABEL)) {
// Store last word and label start point.
lastStart = i;
}
@ -339,7 +363,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
}
s[k] = '\0';
// Handle the forall and where statement and structure.
if (strcmp(s, "forall") == 0 || strcmp(s, "where") == 0) {
if (strcmp(s, "forall") == 0 || (strcmp(s, "where") == 0 && strcmp(prevWord, "else") != 0)) {
if (strcmp(prevWord, "end") != 0) {
j = i + 1;
char chBrace = '(', chSeek = ')', ch1 = styler.SafeGetCharAt(j);
@ -362,22 +386,25 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
if (depth == 0) break;
}
}
int tmpLineCurrent = lineCurrent;
while (j<endPos) {
j++;
chAtPos = styler.SafeGetCharAt(j);
styAtPos = styler.StyleAt(j);
if (styAtPos == SCE_F_COMMENT || IsABlank(chAtPos)) continue;
if (!IsALineEnd(chAtPos) && (styAtPos == SCE_F_COMMENT || IsABlank(chAtPos))) continue;
if (isFixFormat) {
if (!IsALineEnd(chAtPos)) {
break;
} else {
if (lineCurrent < styler.GetLine(styler.Length()-1)) {
j = styler.LineStart(lineCurrent+1);
if (styler.StyleAt(j+5) == SCE_F_CONTINUATION) {
if (tmpLineCurrent < styler.GetLine(styler.Length()-1)) {
tmpLineCurrent++;
j = styler.LineStart(tmpLineCurrent);
if (styler.StyleAt(j+5) == SCE_F_CONTINUATION
&& !IsABlank(styler.SafeGetCharAt(j+5)) && styler.SafeGetCharAt(j+5) != '0') {
j += 5;
continue;
} else {
levelCurrent++;
levelDeltaNext++;
break;
}
}
@ -387,7 +414,7 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
j = GetContinuedPos(j+1, styler);
continue;
} else if (IsALineEnd(chAtPos)) {
levelCurrent ++;
levelDeltaNext++;
break;
} else {
break;
@ -396,61 +423,64 @@ static void FoldFortranDoc(unsigned int startPos, int length, int initStyle,
}
}
} else {
levelCurrent += classifyFoldPointFortran(s, prevWord, chNextNonBlank);
// Store the do Labels into array
if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) {
unsigned int k = 0;
for (i=j; (i<j+5 && i<endPos); i++) {
ch = styler.SafeGetCharAt(i);
if (IsADigit(ch))
Label[k++] = ch;
else
break;
int wordLevelDelta = classifyFoldPointFortran(s, prevWord, chNextNonBlank);
levelDeltaNext += wordLevelDelta;
if (((strcmp(s, "else") == 0) && (nextEOL || chNextNonBlank == '!')) ||
(strcmp(prevWord, "else") == 0 && strcmp(s, "where") == 0) || strcmp(s, "elsewhere") == 0) {
if (!isPrevLine) {
levelCurrent--;
}
Label[k] = '\0';
posLabel ++;
doLabels[posLabel] = atoi(Label);
levelDeltaNext++;
} else if ((strcmp(prevWord, "else") == 0 && strcmp(s, "if") == 0) || strcmp(s, "elseif") == 0) {
if (!isPrevLine) {
levelCurrent--;
}
} else if ((strcmp(prevWord, "select") == 0 && strcmp(s, "case") == 0) || strcmp(s, "selectcase") == 0 ||
(strcmp(prevWord, "select") == 0 && strcmp(s, "type") == 0) || strcmp(s, "selecttype") == 0) {
levelDeltaNext += 2;
} else if ((strcmp(s, "case") == 0 && chNextNonBlank == '(') || (strcmp(prevWord, "case") == 0 && strcmp(s, "default") == 0) ||
(strcmp(prevWord, "type") == 0 && strcmp(s, "is") == 0) ||
(strcmp(prevWord, "class") == 0 && strcmp(s, "is") == 0) ||
(strcmp(prevWord, "class") == 0 && strcmp(s, "default") == 0) ) {
if (!isPrevLine) {
levelCurrent--;
}
levelDeltaNext++;
} else if ((strcmp(prevWord, "end") == 0 && strcmp(s, "select") == 0) || strcmp(s, "endselect") == 0) {
levelDeltaNext -= 2;
}
// There are multiple forms of "do" loop. The older form with a label "do 100 i=1,10" would require matching
// labels to ensure the folding level does not decrease too far when labels are used for other purposes.
// Since this is difficult, do-label constructs are not folded.
if (strcmp(s, "do") == 0 && IsADigit(chNextNonBlank)) {
// Remove delta for do-label
levelDeltaNext -= wordLevelDelta;
}
}
strcpy(prevWord, s);
}
} else if (style == SCE_F_LABEL) {
if(IsADigit(ch) && !IsADigit(chNext)) {
for(j = 0; ( j < 5 ) && ( j < i-lastStart+1 ); j++) {
ch = styler.SafeGetCharAt(lastStart + j);
if (IsADigit(ch) && styler.StyleAt(lastStart+j) == SCE_F_LABEL)
Label[j] = ch;
else
break;
}
Label[j] = '\0';
while (doLabels[posLabel] == atoi(Label) && posLabel > -1) {
levelCurrent--;
posLabel--;
}
}
}
if (atEOL) {
int lev = levelPrev;
int lev = levelCurrent;
if (visibleChars == 0 && foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if ((levelCurrent > levelPrev) && (visibleChars > 0))
if ((levelDeltaNext > 0) && (visibleChars > 0))
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
if (lev != styler.LevelAt(lineCurrent))
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
levelPrev = levelCurrent;
levelCurrent += levelDeltaNext;
levelDeltaNext = 0;
visibleChars = 0;
strcpy(prevWord, "");
isPrevLine = false;
}
/***************************************/
if (!isspacechar(ch)) visibleChars++;
}
/***************************************/
// Fill in the real level of the next line, keeping the current flags as they will be filled in later
int flagsNext = styler.LevelAt(lineCurrent) & ~SC_FOLDLEVELNUMBERMASK;
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
/***************************************/
static const char * const FortranWordLists[] = {
@ -461,22 +491,22 @@ static const char * const FortranWordLists[] = {
};
/***************************************/
static void ColouriseFortranDocFreeFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
Accessor &styler) {
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, false);
}
/***************************************/
static void ColouriseFortranDocFixFormat(unsigned int startPos, int length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
Accessor &styler) {
ColouriseFortranDoc(startPos, length, initStyle, keywordlists, styler, true);
}
/***************************************/
static void FoldFortranDocFreeFormat(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
WordList *[], Accessor &styler) {
FoldFortranDoc(startPos, length, initStyle,styler, false);
}
/***************************************/
static void FoldFortranDocFixFormat(unsigned int startPos, int length, int initStyle,
WordList *[], Accessor &styler) {
WordList *[], Accessor &styler) {
FoldFortranDoc(startPos, length, initStyle,styler, true);
}
/***************************************/

View File

@ -29,7 +29,7 @@ using namespace Scintilla;
#endif
static inline bool IsGAPOperator(char ch) {
if (isascii(ch) && isalnum(ch)) return false;
if (IsASCII(ch) && isalnum(ch)) return false;
if (ch == '+' || ch == '-' || ch == '*' || ch == '/' ||
ch == '^' || ch == ',' || ch == '!' || ch == '.' ||
ch == '=' || ch == '<' || ch == '>' || ch == '(' ||

View File

@ -6,8 +6,8 @@ This is the Lexer for Gui4Cli, included in SciLexer.dll
To add to SciLexer.dll:
1. Add the values below to INCLUDE\Scintilla.iface
2. Run the include/HFacer.py script
3. Run the src/lexGen.py script
2. Run the scripts/HFacer.py script
3. Run the scripts/LexGen.py script
val SCE_GC_DEFAULT=0
val SCE_GC_COMMENTLINE=1
@ -49,10 +49,6 @@ static inline bool IsAWordChar(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_' || ch =='\\');
}
static inline bool IsAWordStart(const int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.');
}
inline bool isGCOperator(int ch)
{ if (isalnum(ch))
return false;

View File

@ -16,6 +16,7 @@
#include "Scintilla.h"
#include "SciLexer.h"
#include "StringCopy.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
@ -43,7 +44,7 @@ static inline bool IsAWordStart(const int ch) {
}
inline bool IsOperator(int ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
@ -339,9 +340,9 @@ static void classifyWordHTJS(unsigned int start, unsigned int end,
static int classifyWordHTVB(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, script_mode inScriptType) {
char chAttr = SCE_HB_IDENTIFIER;
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.');
if (wordIsNumber)
if (wordIsNumber) {
chAttr = SCE_HB_NUMBER;
else {
} else {
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
if (keywords.InList(s)) {
@ -385,9 +386,9 @@ static void classifyWordHTPy(unsigned int start, unsigned int end, WordList &key
static void classifyWordHTPHP(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler) {
char chAttr = SCE_HPHP_DEFAULT;
bool wordIsNumber = IsADigit(styler[start]) || (styler[start] == '.' && start+1 <= end && IsADigit(styler[start+1]));
if (wordIsNumber)
if (wordIsNumber) {
chAttr = SCE_HPHP_NUMBER;
else {
} else {
char s[100];
GetTextSegment(styler, start, end, s, sizeof(s));
if (keywords.InList(s))
@ -422,7 +423,6 @@ static int StateForScript(script_type scriptLanguage) {
switch (scriptLanguage) {
case eScriptJS:
Result = SCE_HJ_START;
break;
case eScriptPython:
Result = SCE_HP_START;
break;
@ -446,12 +446,12 @@ static int StateForScript(script_type scriptLanguage) {
}
static inline bool issgmlwordchar(int ch) {
return !isascii(ch) ||
return !IsASCII(ch) ||
(isalnum(ch) || ch == '.' || ch == '_' || ch == ':' || ch == '!' || ch == '#' || ch == '[');
}
static inline bool IsPhpWordStart(int ch) {
return (isascii(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f);
return (IsASCII(ch) && (isalpha(ch) || (ch == '_'))) || (ch >= 0x7f);
}
static inline bool IsPhpWordChar(int ch) {
@ -575,8 +575,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5]; // SGML (DTD) keywords
// Lexer for HTML requires more lexical states (8 bits worth) than most lexers
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
styler.StartAt(startPos);
char prevWord[200];
prevWord[0] = '\0';
char phpStringDelimiter[200]; // PHP is not limited in length, we are
@ -608,7 +607,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (startPos == 0)
state = SCE_H_DEFAULT;
}
styler.StartAt(startPos, static_cast<char>(STYLE_MAX));
styler.StartAt(startPos);
int lineCurrent = styler.GetLine(startPos);
int lineState;
@ -810,8 +809,8 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
styler.SetLineState(lineCurrent,
((inScriptType & 0x03) << 0) |
((tagOpened & 0x01) << 2) |
((tagClosing & 0x01) << 3) |
((tagOpened ? 1 : 0) << 2) |
((tagClosing ? 1 : 0) << 3) |
((aspScript & 0x0F) << 4) |
((clientScript & 0x0F) << 8) |
((beforePreProc & 0xFF) << 12));
@ -822,19 +821,27 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
// handle start of Mako comment line
if (isMako && ch == '#' && chNext == '#') {
makoComment = 1;
state = SCE_HP_COMMENTLINE;
}
// handle end of Mako comment line
else if (isMako && makoComment && (ch == '\r' || ch == '\n')) {
makoComment = 0;
styler.ColourTo(i, SCE_HP_COMMENTLINE);
state = SCE_HP_DEFAULT;
styler.ColourTo(i, StateToPrint);
if (scriptLanguage == eScriptPython) {
state = SCE_HP_DEFAULT;
} else {
state = SCE_H_DEFAULT;
}
}
// Allow falling through to mako handling code if newline is going to end a block
if (((ch == '\r' && chNext != '\n') || (ch == '\n')) &&
(!isMako || (0 != strcmp(makoBlockType, "%")))) {
}
// Ignore everything in mako comment until the line ends
else if (isMako && makoComment) {
}
// generic end of script processing
else if ((inScriptType == eNonHtmlScript) && (ch == '<') && (chNext == '/')) {
@ -929,9 +936,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
(ch == '$' && chNext == '{') ||
(ch == '<' && chNext == '/' && chNext2 == '%'))) {
if (ch == '%' || ch == '/')
strcpy(makoBlockType, "%");
StringCopy(makoBlockType, "%");
else if (ch == '$')
strcpy(makoBlockType, "{");
StringCopy(makoBlockType, "{");
else if (chNext == '/')
GetNextWord(styler, i+3, makoBlockType, sizeof(makoBlockType));
else
@ -1000,9 +1007,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
// handle the start Django template code
else if (isDjango && scriptLanguage != eScriptPython && (ch == '{' && (chNext == '%' || chNext == '{'))) {
if (chNext == '%')
strcpy(djangoBlockType, "%");
StringCopy(djangoBlockType, "%");
else
strcpy(djangoBlockType, "{");
StringCopy(djangoBlockType, "{");
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
if (inScriptType == eNonHtmlScript)
@ -1233,7 +1240,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i - 2, StateToPrint);
}
state = SCE_H_SGML_COMMENT;
} else if (isascii(ch) && isalpha(ch) && (chPrev == '%')) {
} else if (IsASCII(ch) && isalpha(ch) && (chPrev == '%')) {
styler.ColourTo(i - 2, StateToPrint);
state = SCE_H_SGML_ENTITY;
} else if (ch == '#') {
@ -1312,6 +1319,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i - 2, StateToPrint);
state = SCE_H_SGML_COMMENT;
}
break;
case SCE_H_SGML_DOUBLESTRING:
if (ch == '\"') {
styler.ColourTo(i, StateToPrint);
@ -1351,7 +1359,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
break;
case SCE_H_SGML_SPECIAL:
if (!(isascii(ch) && isupper(ch))) {
if (!(IsASCII(ch) && isupper(ch))) {
styler.ColourTo(i - 1, StateToPrint);
if (isalnum(ch)) {
state = SCE_H_SGML_ERROR;
@ -1364,7 +1372,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
if (ch == ';') {
styler.ColourTo(i, StateToPrint);
state = SCE_H_SGML_DEFAULT;
} else if (!(isascii(ch) && isalnum(ch)) && ch != '-' && ch != '.') {
} else if (!(IsASCII(ch) && isalnum(ch)) && ch != '-' && ch != '.') {
styler.ColourTo(i, SCE_H_SGML_ERROR);
state = SCE_H_SGML_DEFAULT;
}
@ -1374,9 +1382,9 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
styler.ColourTo(i, StateToPrint);
state = SCE_H_DEFAULT;
}
if (ch != '#' && !(isascii(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway...
if (ch != '#' && !(IsASCII(ch) && isalnum(ch)) // Should check that '#' follows '&', but it is unlikely anyway...
&& ch != '.' && ch != '-' && ch != '_' && ch != ':') { // valid in XML
if (!isascii(ch)) // Possibly start of a multibyte character so don't allow this byte to be in entity style
if (!IsASCII(ch)) // Possibly start of a multibyte character so don't allow this byte to be in entity style
styler.ColourTo(i-1, SCE_H_TAGUNKNOWN);
else
styler.ColourTo(i, SCE_H_TAGUNKNOWN);
@ -1702,7 +1710,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
case SCE_HJ_REGEX:
if (ch == '\r' || ch == '\n' || ch == '/') {
if (ch == '/') {
while (isascii(chNext) && islower(chNext)) { // gobble regex flags
while (IsASCII(chNext) && islower(chNext)) { // gobble regex flags
i++;
ch = chNext;
chNext = static_cast<unsigned char>(styler.SafeGetCharAt(i + 1));
@ -1916,7 +1924,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HPHP_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_HPHP_HSTRING;
strcpy(phpStringDelimiter, "\"");
StringCopy(phpStringDelimiter, "\"");
} else if (styler.Match(i, "<<<")) {
bool isSimpleString = false;
i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString);
@ -1926,7 +1934,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
} else if (ch == '\'') {
state = SCE_HPHP_SIMPLESTRING;
strcpy(phpStringDelimiter, "\'");
StringCopy(phpStringDelimiter, "\'");
} else if (ch == '$' && IsPhpWordStart(chNext)) {
state = SCE_HPHP_VARIABLE;
} else if (IsOperator(ch)) {
@ -2046,7 +2054,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
state = SCE_HPHP_COMMENTLINE;
} else if (ch == '\"') {
state = SCE_HPHP_HSTRING;
strcpy(phpStringDelimiter, "\"");
StringCopy(phpStringDelimiter, "\"");
} else if (styler.Match(i, "<<<")) {
bool isSimpleString = false;
i = FindPhpStringDelimiter(phpStringDelimiter, sizeof(phpStringDelimiter), i + 3, lengthDoc, styler, isSimpleString);
@ -2056,7 +2064,7 @@ static void ColouriseHyperTextDoc(unsigned int startPos, int length, int initSty
}
} else if (ch == '\'') {
state = SCE_HPHP_SIMPLESTRING;
strcpy(phpStringDelimiter, "\'");
StringCopy(phpStringDelimiter, "\'");
} else if (ch == '$' && IsPhpWordStart(chNext)) {
state = SCE_HPHP_VARIABLE;
} else if (IsOperator(ch)) {
@ -2178,6 +2186,6 @@ static const char * const phpscriptWordListDesc[] = {
0,
};
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc, 8);
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc, 8);
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc, 8);
LexerModule lmHTML(SCLEX_HTML, ColouriseHTMLDoc, "hypertext", 0, htmlWordListDesc);
LexerModule lmXML(SCLEX_XML, ColouriseXMLDoc, "xml", 0, htmlWordListDesc);
LexerModule lmPHPSCRIPT(SCLEX_PHPSCRIPT, ColourisePHPScriptDoc, "phpscript", 0, phpscriptWordListDesc);

View File

@ -38,9 +38,9 @@
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "CharacterCategory.h"
#include "LexerModule.h"
#include "OptionSet.h"
#include "CharacterCategory.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;

1045
scintilla/lexers/LexHex.cxx Normal file

File diff suppressed because it is too large Load Diff

View File

@ -104,7 +104,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
} else if (ch == '\'') {
// Start of a single-quote string
state = SCE_INNO_STRING_SINGLE;
} else if (isascii(ch) && (isalpha(ch) || (ch == '_'))) {
} else if (IsASCII(ch) && (isalpha(ch) || (ch == '_'))) {
// Start of an identifier
bufferCount = 0;
buffer[bufferCount++] = static_cast<char>(tolower(ch));
@ -123,7 +123,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
break;
case SCE_INNO_IDENTIFIER:
if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
if (IsASCII(ch) && (isalnum(ch) || (ch == '_'))) {
buffer[bufferCount++] = static_cast<char>(tolower(ch));
} else {
state = SCE_INNO_DEFAULT;
@ -160,7 +160,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
} else {
styler.ColourTo(i,SCE_INNO_DEFAULT);
}
} else if (isascii(ch) && (isalnum(ch) || (ch == '_'))) {
} else if (IsASCII(ch) && (isalnum(ch) || (ch == '_'))) {
buffer[bufferCount++] = static_cast<char>(tolower(ch));
} else {
state = SCE_INNO_DEFAULT;
@ -170,7 +170,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
case SCE_INNO_PREPROC:
if (isWS || isEOL) {
if (isascii(chPrev) && isalpha(chPrev)) {
if (IsASCII(chPrev) && isalpha(chPrev)) {
state = SCE_INNO_DEFAULT;
buffer[bufferCount] = '\0';
@ -185,7 +185,7 @@ static void ColouriseInnoDoc(unsigned int startPos, int length, int, WordList *k
chNext = styler[i--];
ch = chPrev;
}
} else if (isascii(ch) && isalpha(ch)) {
} else if (IsASCII(ch) && isalpha(ch)) {
if (chPrev == '#' || chPrev == ' ' || chPrev == '\t')
bufferCount = 0;
buffer[bufferCount++] = static_cast<char>(tolower(ch));

View File

@ -0,0 +1,473 @@
// Scintilla source code edit control
/** @file LexKVIrc.cxx
** Lexer for KVIrc script.
**/
// Copyright 2013 by OmegaPhil <OmegaPhil+scintilla@gmail.com>, based in
// part from LexPython Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// and LexCmake Copyright 2007 by Cristian Adam <cristian [dot] adam [at] gmx [dot] net>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
/* KVIrc Script syntactic rules: http://www.kvirc.net/doc/doc_syntactic_rules.html */
/* Utility functions */
static inline bool IsAWordChar(int ch) {
/* Keyword list includes modules, i.e. words including '.', and
* alias namespaces include ':' */
return (ch < 0x80) && (isalnum(ch) || ch == '_' || ch == '.'
|| ch == ':');
}
static inline bool IsAWordStart(int ch) {
/* Functions (start with '$') are treated separately to keywords */
return (ch < 0x80) && (isalnum(ch) || ch == '_' );
}
/* Interface function called by Scintilla to request some text to be
syntax highlighted */
static void ColouriseKVIrcDoc(unsigned int startPos, int length,
int initStyle, WordList *keywordlists[],
Accessor &styler)
{
/* Fetching style context */
StyleContext sc(startPos, length, initStyle, styler);
/* Accessing keywords and function-marking keywords */
WordList &keywords = *keywordlists[0];
WordList &functionKeywords = *keywordlists[1];
/* Looping for all characters - only automatically moving forward
* when asked for (transitions leaving strings and keywords do this
* already) */
bool next = true;
for( ; sc.More(); next ? sc.Forward() : (void)0 )
{
/* Resetting next */
next = true;
/* Dealing with different states */
switch (sc.state)
{
case SCE_KVIRC_DEFAULT:
/* Detecting single-line comments
* Unfortunately KVIrc script allows raw '#<channel
* name>' to be used, and appending # to an array returns
* its length...
* Going for a compromise where single line comments not
* starting on a newline are allowed in all cases except
* when they are preceeded with an opening bracket or comma
* (this will probably be the most common style a valid
* string-less channel name will be used with), with the
* array length case included
*/
if (
(sc.ch == '#' && sc.atLineStart) ||
(sc.ch == '#' && (
sc.chPrev != '(' && sc.chPrev != ',' &&
sc.chPrev != ']')
)
)
{
sc.SetState(SCE_KVIRC_COMMENT);
break;
}
/* Detecting multi-line comments */
if (sc.Match('/', '*'))
{
sc.SetState(SCE_KVIRC_COMMENTBLOCK);
break;
}
/* Detecting strings */
if (sc.ch == '"')
{
sc.SetState(SCE_KVIRC_STRING);
break;
}
/* Detecting functions */
if (sc.ch == '$')
{
sc.SetState(SCE_KVIRC_FUNCTION);
break;
}
/* Detecting variables */
if (sc.ch == '%')
{
sc.SetState(SCE_KVIRC_VARIABLE);
break;
}
/* Detecting numbers - isdigit is unsafe as it does not
* validate, use CharacterSet.h functions */
if (IsADigit(sc.ch))
{
sc.SetState(SCE_KVIRC_NUMBER);
break;
}
/* Detecting words */
if (IsAWordStart(sc.ch) && IsAWordChar(sc.chNext))
{
sc.SetState(SCE_KVIRC_WORD);
sc.Forward();
break;
}
/* Detecting operators */
if (isoperator(sc.ch))
{
sc.SetState(SCE_KVIRC_OPERATOR);
break;
}
break;
case SCE_KVIRC_COMMENT:
/* Breaking out of single line comment when a newline
* is introduced */
if (sc.ch == '\r' || sc.ch == '\n')
{
sc.SetState(SCE_KVIRC_DEFAULT);
break;
}
break;
case SCE_KVIRC_COMMENTBLOCK:
/* Detecting end of multi-line comment */
if (sc.Match('*', '/'))
{
// Moving the current position forward two characters
// so that '*/' is included in the comment
sc.Forward(2);
sc.SetState(SCE_KVIRC_DEFAULT);
/* Comment has been exited and the current position
* moved forward, yet the new current character
* has yet to be defined - loop without moving
* forward again */
next = false;
break;
}
break;
case SCE_KVIRC_STRING:
/* Detecting end of string - closing speechmarks */
if (sc.ch == '"')
{
/* Allowing escaped speechmarks to pass */
if (sc.chPrev == '\\')
break;
/* Moving the current position forward to capture the
* terminating speechmarks, and ending string */
sc.ForwardSetState(SCE_KVIRC_DEFAULT);
/* String has been exited and the current position
* moved forward, yet the new current character
* has yet to be defined - loop without moving
* forward again */
next = false;
break;
}
/* Functions and variables are now highlighted in strings
* Detecting functions */
if (sc.ch == '$')
{
/* Allowing escaped functions to pass */
if (sc.chPrev == '\\')
break;
sc.SetState(SCE_KVIRC_STRING_FUNCTION);
break;
}
/* Detecting variables */
if (sc.ch == '%')
{
/* Allowing escaped variables to pass */
if (sc.chPrev == '\\')
break;
sc.SetState(SCE_KVIRC_STRING_VARIABLE);
break;
}
/* Breaking out of a string when a newline is introduced */
if (sc.ch == '\r' || sc.ch == '\n')
{
/* Allowing escaped newlines */
if (sc.chPrev == '\\')
break;
sc.SetState(SCE_KVIRC_DEFAULT);
break;
}
break;
case SCE_KVIRC_FUNCTION:
case SCE_KVIRC_VARIABLE:
/* Detecting the end of a function/variable (word) */
if (!IsAWordChar(sc.ch))
{
sc.SetState(SCE_KVIRC_DEFAULT);
/* Word has been exited yet the current character
* has yet to be defined - loop without moving
* forward again */
next = false;
break;
}
break;
case SCE_KVIRC_STRING_FUNCTION:
case SCE_KVIRC_STRING_VARIABLE:
/* A function or variable in a string
* Detecting the end of a function/variable (word) */
if (!IsAWordChar(sc.ch))
{
sc.SetState(SCE_KVIRC_STRING);
/* Word has been exited yet the current character
* has yet to be defined - loop without moving
* forward again */
next = false;
break;
}
break;
case SCE_KVIRC_NUMBER:
/* Detecting the end of a number */
if (!IsADigit(sc.ch))
{
sc.SetState(SCE_KVIRC_DEFAULT);
/* Number has been exited yet the current character
* has yet to be defined - loop without moving
* forward */
next = false;
break;
}
break;
case SCE_KVIRC_OPERATOR:
/* Because '%' is an operator but is also the marker for
* a variable, I need to always treat operators as single
* character strings and therefore redo their detection
* after every character */
sc.SetState(SCE_KVIRC_DEFAULT);
/* Operator has been exited yet the current character
* has yet to be defined - loop without moving
* forward */
next = false;
break;
case SCE_KVIRC_WORD:
/* Detecting the end of a word */
if (!IsAWordChar(sc.ch))
{
/* Checking if the word was actually a keyword -
* fetching the current word, NULL-terminated like
* the keyword list */
char s[100];
int wordLen = sc.currentPos - styler.GetStartSegment();
if (wordLen > 99)
wordLen = 99; /* Include '\0' in buffer */
int i;
for( i = 0; i < wordLen; ++i )
{
s[i] = styler.SafeGetCharAt( styler.GetStartSegment() + i );
}
s[wordLen] = '\0';
/* Actually detecting keywords and fixing the state */
if (keywords.InList(s))
{
/* The SetState call actually commits the
* previous keyword state */
sc.ChangeState(SCE_KVIRC_KEYWORD);
}
else if (functionKeywords.InList(s))
{
// Detecting function keywords and fixing the state
sc.ChangeState(SCE_KVIRC_FUNCTION_KEYWORD);
}
/* Transitioning to default and committing the previous
* word state */
sc.SetState(SCE_KVIRC_DEFAULT);
/* Word has been exited yet the current character
* has yet to be defined - loop without moving
* forward again */
next = false;
break;
}
break;
}
}
/* Indicating processing is complete */
sc.Complete();
}
static void FoldKVIrcDoc(unsigned int startPos, int length, int /*initStyle - unused*/,
WordList *[], Accessor &styler)
{
/* Based on CMake's folder */
/* Exiting if folding isnt enabled */
if ( styler.GetPropertyInt("fold") == 0 )
return;
/* Obtaining current line number*/
int currentLine = styler.GetLine(startPos);
/* Obtaining starting character - indentation is done on a line basis,
* not character */
unsigned int safeStartPos = styler.LineStart( currentLine );
/* Initialising current level - this is defined as indentation level
* in the low 12 bits, with flag bits in the upper four bits.
* It looks like two indentation states are maintained in the returned
* 32bit value - 'nextLevel' in the most-significant bits, 'currentLevel'
* in the least-significant bits. Since the next level is the most
* up to date, this must refer to the current state of indentation.
* So the code bitshifts the old current level out of existence to
* get at the actual current state of indentation
* Based on the LexerCPP.cxx line 958 comment */
int currentLevel = SC_FOLDLEVELBASE;
if (currentLine > 0)
currentLevel = styler.LevelAt(currentLine - 1) >> 16;
int nextLevel = currentLevel;
// Looping for characters in range
for (unsigned int i = safeStartPos; i < startPos + length; ++i)
{
/* Folding occurs after syntax highlighting, meaning Scintilla
* already knows where the comments are
* Fetching the current state */
int state = styler.StyleAt(i) & 31;
switch( styler.SafeGetCharAt(i) )
{
case '{':
/* Indenting only when the braces are not contained in
* a comment */
if (state != SCE_KVIRC_COMMENT &&
state != SCE_KVIRC_COMMENTBLOCK)
++nextLevel;
break;
case '}':
/* Outdenting only when the braces are not contained in
* a comment */
if (state != SCE_KVIRC_COMMENT &&
state != SCE_KVIRC_COMMENTBLOCK)
--nextLevel;
break;
case '\n':
case '\r':
/* Preparing indentation information to return - combining
* current and next level data */
int lev = currentLevel | nextLevel << 16;
/* If the next level increases the indent level, mark the
* current line as a fold point - current level data is
* in the least significant bits */
if (nextLevel > currentLevel )
lev |= SC_FOLDLEVELHEADERFLAG;
/* Updating indentation level if needed */
if (lev != styler.LevelAt(currentLine))
styler.SetLevel(currentLine, lev);
/* Updating variables */
++currentLine;
currentLevel = nextLevel;
/* Dealing with problematic Windows newlines -
* incrementing to avoid the extra newline breaking the
* fold point */
if (styler.SafeGetCharAt(i) == '\r' &&
styler.SafeGetCharAt(i + 1) == '\n')
++i;
break;
}
}
/* At this point the data has ended, so presumably the end of the line?
* Preparing indentation information to return - combining current
* and next level data */
int lev = currentLevel | nextLevel << 16;
/* If the next level increases the indent level, mark the current
* line as a fold point - current level data is in the least
* significant bits */
if (nextLevel > currentLevel )
lev |= SC_FOLDLEVELHEADERFLAG;
/* Updating indentation level if needed */
if (lev != styler.LevelAt(currentLine))
styler.SetLevel(currentLine, lev);
}
/* Registering wordlists */
static const char *const kvircWordListDesc[] = {
"primary",
"function_keywords",
0
};
/* Registering functions and wordlists */
LexerModule lmKVIrc(SCLEX_KVIRC, ColouriseKVIrcDoc, "kvirc", FoldKVIrcDoc,
kvircWordListDesc);

View File

@ -4,6 +4,7 @@
**/
// Copyright 2004 by Manfred Becker <manfred@becker-trdf.de>
// The License.txt file describes the conditions under which this software may be distributed.
// Edited by Lee Wilmott (24-Jun-2014) added support for block comments
#include <stdlib.h>
#include <string.h>
@ -54,6 +55,10 @@ static void ColouriseKixDoc(unsigned int startPos, int length, int initStyle,
if (sc.atLineEnd) {
sc.SetState(SCE_KIX_DEFAULT);
}
} else if (sc.state == SCE_KIX_COMMENTSTREAM) {
if (sc.ch == '/' && sc.chPrev == '*') {
sc.ForwardSetState(SCE_KIX_DEFAULT);
}
} else if (sc.state == SCE_KIX_STRING1) {
// This is a doubles quotes string
if (sc.ch == '\"') {
@ -104,6 +109,8 @@ static void ColouriseKixDoc(unsigned int startPos, int length, int initStyle,
if (sc.state == SCE_KIX_DEFAULT) {
if (sc.ch == ';') {
sc.SetState(SCE_KIX_COMMENT);
} else if (sc.ch == '/' && sc.chNext == '*') {
sc.SetState(SCE_KIX_COMMENTSTREAM);
} else if (sc.ch == '\"') {
sc.SetState(SCE_KIX_STRING1);
} else if (sc.ch == '\'') {

View File

@ -99,7 +99,7 @@ static bool latexIsBlankAndNL(int ch) {
}
static bool latexIsLetter(int ch) {
return isascii(ch) && isalpha(ch);
return IsASCII(ch) && isalpha(ch);
}
static bool latexIsTagValid(int &i, int l, Accessor &styler) {
@ -224,7 +224,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
chNext = styler.SafeGetCharAt(i + 1);
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i, SCE_L_ERROR);
} else if (isascii(chNext)) {
} else if (IsASCII(chNext)) {
styler.ColourTo(i + 1, SCE_L_SHORTCMD);
if (chNext == '(') {
mode = 1;
@ -340,7 +340,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
chNext = styler.SafeGetCharAt(i + 1);
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i, SCE_L_ERROR);
} else if (isascii(chNext)) {
} else if (IsASCII(chNext)) {
if (chNext == ')') {
mode = 0;
state = SCE_L_DEFAULT;
@ -382,7 +382,7 @@ void SCI_METHOD LexerLaTeX::Lex(unsigned int startPos, int length, int initStyle
chNext = styler.SafeGetCharAt(i + 1);
} else if (chNext == '\r' || chNext == '\n') {
styler.ColourTo(i, SCE_L_ERROR);
} else if (isascii(chNext)) {
} else if (IsASCII(chNext)) {
if (chNext == ']') {
mode = 0;
state = SCE_L_DEFAULT;

View File

@ -33,7 +33,7 @@ using namespace Scintilla;
#define SCE_LISP_MACRO_DISPATCH 31
static inline bool isLispoperator(char ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
if (ch == '\'' || ch == '`' || ch == '(' || ch == ')' || ch == '[' || ch == ']' || ch == '{' || ch == '}')
return true;
@ -41,7 +41,7 @@ static inline bool isLispoperator(char ch) {
}
static inline bool isLispwordstart(char ch) {
return isascii(ch) && ch != ';' && !isspacechar(ch) && !isLispoperator(ch) &&
return IsASCII(ch) && ch != ';' && !isspacechar(ch) && !isLispoperator(ch) &&
ch != '\n' && ch != '\r' && ch != '\"';
}
@ -142,7 +142,7 @@ static void ColouriseLispDoc(unsigned int startPos, int length, int initStyle, W
}
}
} else if (state == SCE_LISP_MACRO_DISPATCH) {
if (!(isascii(ch) && isdigit(ch))) {
if (!(IsASCII(ch) && isdigit(ch))) {
if (ch != 'r' && ch != 'R' && (i - styler.GetStartSegment()) > 1) {
state = SCE_LISP_DEFAULT;
} else {

View File

@ -151,7 +151,7 @@ static void FoldLoutDoc(unsigned int startPos, int length, int, WordList *[],
char chNext = styler[startPos];
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
int styleNext = styler.StyleAt(startPos);
char s[10];
char s[10] = "";
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;

View File

@ -141,7 +141,7 @@ static void ColouriseLuaDoc(
char s[100];
while (setWord.Contains(c = sc.GetRelative(ln))) { // get potential label
if (i < 90)
s[i++] = c;
s[i++] = static_cast<char>(c);
ln++;
}
s[i] = '\0'; int lbl = ln;

View File

@ -35,7 +35,7 @@ static inline bool IsAWordChar(const int ch) {
}
inline bool isMMIXALOperator(char ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
if (ch == '+' || ch == '-' || ch == '|' || ch == '^' ||
ch == '*' || ch == '/' ||

View File

@ -37,7 +37,7 @@ static int GetLotLineState(std::string &line) {
// Now finds the first non-blank character
unsigned i; // Declares counter here to make it persistent after the for loop
for (i = 0; i < line.length(); ++i) {
if (!(isascii(line[i]) && isspace(line[i])))
if (!(IsASCII(line[i]) && isspace(line[i])))
break;
}

View File

@ -35,19 +35,6 @@ using namespace Scintilla;
#define KW_MSSQL_STORED_PROCEDURES 5
#define KW_MSSQL_OPERATORS 6
static bool isMSSQLOperator(char ch) {
if (isascii(ch) && isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '%' || ch == '^' || ch == '&' || ch == '*' ||
ch == '-' || ch == '+' || ch == '=' || ch == '|' ||
ch == '<' || ch == '>' || ch == '/' ||
ch == '!' || ch == '~' || ch == '(' || ch == ')' ||
ch == ',')
return true;
return false;
}
static char classifyWordSQL(unsigned int start,
unsigned int end,
WordList *keywordlists[],
@ -220,7 +207,7 @@ static void ColouriseMSSQLDoc(unsigned int startPos, int length,
styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT);
prevState = state;
state = SCE_MSSQL_COLUMN_NAME_2;
} else if (isMSSQLOperator(ch)) {
} else if (isoperator(ch)) {
styler.ColourTo(i - 1, SCE_MSSQL_DEFAULT);
styler.ColourTo(i, SCE_MSSQL_OPERATOR);
//~ style = SCE_MSSQL_DEFAULT;
@ -300,7 +287,7 @@ static void FoldMSSQLDoc(unsigned int startPos, int length, int, WordList *[], A
int levelCurrent = levelPrev;
char chNext = styler[startPos];
bool inComment = (styler.StyleAt(startPos-1) == SCE_MSSQL_COMMENT);
char s[10];
char s[10] = "";
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);

View File

@ -118,10 +118,11 @@ static bool AtTermStart(StyleContext &sc) {
}
static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
int c, count = 1;
int count = 1;
unsigned int i = 0;
while (++i) {
c = sc.GetRelative(i);
for (;;) {
++i;
int c = sc.GetRelative(i);
if (c == sc.ch)
++count;
// hit a terminating character
@ -140,7 +141,6 @@ static bool IsValidHrule(const unsigned int endPos, StyleContext &sc) {
}
}
}
return false;
}
static void ColorizeMarkdownDoc(unsigned int startPos, int length, int initStyle,

View File

@ -12,6 +12,9 @@
** - added ... displayed as a comment
** - removed unused IsAWord functions
** - added some comments
**
** Changes by John Donoghue 2014/08/01
** - fix allowed transpose ' after {} operator
**/
// Copyright 1998-2001 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@ -57,7 +60,8 @@ static bool IsOctaveComment(Accessor &styler, int pos, int len) {
static void ColouriseMatlabOctaveDoc(
unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler,
bool (*IsCommentChar)(int)) {
bool (*IsCommentChar)(int),
bool ismatlab) {
WordList &keywords = *keywordlists[0];
@ -199,7 +203,11 @@ static void ColouriseMatlabOctaveDoc(
styler.SetLineState(curLine, commentDepth);
sc.SetState(SCE_MATLAB_COMMENT);
} else if (sc.ch == '!' && sc.chNext != '=' ) {
sc.SetState(SCE_MATLAB_COMMAND);
if(ismatlab) {
sc.SetState(SCE_MATLAB_COMMAND);
} else {
sc.SetState(SCE_MATLAB_OPERATOR);
}
} else if (sc.ch == '\'') {
if (transpose) {
sc.SetState(SCE_MATLAB_OPERATOR);
@ -213,7 +221,7 @@ static void ColouriseMatlabOctaveDoc(
} else if (isalpha(sc.ch)) {
sc.SetState(SCE_MATLAB_KEYWORD);
} else if (isoperator(static_cast<char>(sc.ch)) || sc.ch == '@' || sc.ch == '\\') {
if (sc.ch == ')' || sc.ch == ']') {
if (sc.ch == ')' || sc.ch == ']' || sc.ch == '}') {
transpose = true;
} else {
transpose = false;
@ -229,12 +237,12 @@ static void ColouriseMatlabOctaveDoc(
static void ColouriseMatlabDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar);
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsMatlabCommentChar, true);
}
static void ColouriseOctaveDoc(unsigned int startPos, int length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar);
ColouriseMatlabOctaveDoc(startPos, length, initStyle, keywordlists, styler, IsOctaveCommentChar, false);
}
static void FoldMatlabOctaveDoc(unsigned int startPos, int length, int,

View File

@ -34,7 +34,7 @@ using namespace Scintilla;
#ifdef DEBUG_LEX_MODULA
#define DEBUG_STATE( p, c )\
fprintf( stderr, "Unknown state: currentPos = %d, char = '%c'\n", p, c );
fprintf( stderr, "Unknown state: currentPos = %ud, char = '%c'\n", p, c );
#else
#define DEBUG_STATE( p, c )
#endif

View File

@ -40,13 +40,6 @@ static inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalpha(ch) || ch == '_');
}
static inline bool IsADoxygenChar(int ch) {
return (islower(ch) || ch == '$' || ch == '@' ||
ch == '\\' || ch == '&' || ch == '<' ||
ch == '>' || ch == '#' || ch == '{' ||
ch == '}' || ch == '[' || ch == ']');
}
static inline bool IsANumberChar(int ch) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
@ -577,4 +570,4 @@ static const char * const mysqlWordListDesc[] = {
0
};
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc, 7);
LexerModule lmMySQL(SCLEX_MYSQL, ColouriseMySQLDoc, "mysql", FoldMySQLDoc, mysqlWordListDesc);

View File

@ -180,6 +180,8 @@ static int classifyWordNsis(unsigned int start, unsigned int end, WordList *keyw
bUserVars = true;
char s[100];
s[0] = '\0';
s[1] = '\0';
WordList &Functions = *keywordLists[0];
WordList &Variables = *keywordLists[1];

View File

@ -295,7 +295,7 @@ inline bool HandleInteger( unsigned int & cur, unsigned int one_too_much, Access
}
ch = styler.SafeGetCharAt( cur );
if( !( isascii( ch ) && isdigit( ch ) ) )
if( !( IsASCII( ch ) && isdigit( ch ) ) )
{
styler.ColourTo( cur - 1, SCE_OPAL_INTEGER );
styler.StartSegment( cur );
@ -314,7 +314,7 @@ inline bool HandleWord( unsigned int & cur, unsigned int one_too_much, Accessor
{
ch = styler.SafeGetCharAt( cur );
if( ( ch != '_' ) && ( ch != '-' ) &&
!( isascii( ch ) && ( islower( ch ) || isupper( ch ) || isdigit( ch ) ) ) ) break;
!( IsASCII( ch ) && ( islower( ch ) || isupper( ch ) || isdigit( ch ) ) ) ) break;
cur++;
if( cur >= one_too_much )
@ -490,13 +490,13 @@ static void ColouriseOpalDoc( unsigned int startPos, int length, int initStyle,
default:
{
// Integer
if( isascii( ch ) && isdigit( ch ) )
if( IsASCII( ch ) && isdigit( ch ) )
{
if( !HandleInteger( cur, one_too_much, styler ) ) return;
}
// Keyword
else if( isascii( ch ) && ( islower( ch ) || isupper( ch ) ) )
else if( IsASCII( ch ) && ( islower( ch ) || isupper( ch ) ) )
{
if( !HandleWord( cur, one_too_much, styler, keywordlists ) ) return;

View File

@ -40,7 +40,7 @@ static bool Is1To9(char ch) {
}
static bool IsAlphabetic(int ch) {
return isascii(ch) && isalpha(ch);
return IsASCII(ch) && isalpha(ch);
}
static inline bool AtEOL(Accessor &styler, unsigned int i) {
@ -954,15 +954,16 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
// Common: <filename>(<line>): warning|error|note|remark|catastrophic|fatal
// Common: <filename>(<line>) warning|error|note|remark|catastrophic|fatal
// Microsoft: <filename>(<line>,<column>)<message>
// CTags: \t<message>
// CTags: <identifier>\t<filename>\t<message>
// Lua 5 traceback: \t<filename>:<line>:<message>
// Lua 5.1: <exe>: <filename>:<line>:<message>
bool initialTab = (lineBuffer[0] == '\t');
bool initialColonPart = false;
bool canBeCtags = !initialTab; // For ctags must have an identifier with no spaces then a tab
enum { stInitial,
stGccStart, stGccDigit, stGccColumn, stGcc,
stMsStart, stMsDigit, stMsBracket, stMsVc, stMsDigitComma, stMsDotNet,
stCtagsStart, stCtagsStartString, stCtagsStringDollar, stCtags,
stCtagsStart, stCtagsFile, stCtagsStartString, stCtagsStringDollar, stCtags,
stUnrecognized
} state = stInitial;
for (unsigned int i = 0; i < lengthLine; i++) {
@ -984,9 +985,11 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
// May be Microsoft
// Check against '0' often removes phone numbers
state = stMsStart;
} else if ((ch == '\t') && (!initialTab)) {
} else if ((ch == '\t') && canBeCtags) {
// May be CTags
state = stCtagsStart;
} else if (ch == ' ') {
canBeCtags = false;
}
} else if (state == stGccStart) { // <filename>:
state = Is1To9(ch) ? stGccDigit : stUnrecognized;
@ -1034,8 +1037,9 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
!CompareCaseInsensitive(word, "fatal") || !CompareCaseInsensitive(word, "catastrophic") ||
!CompareCaseInsensitive(word, "note") || !CompareCaseInsensitive(word, "remark")) {
state = stMsVc;
} else
} else {
state = stUnrecognized;
}
} else {
state = stUnrecognized;
}
@ -1047,6 +1051,10 @@ static int RecogniseErrorListLine(const char *lineBuffer, unsigned int lengthLin
state = stUnrecognized;
}
} else if (state == stCtagsStart) {
if (ch == '\t') {
state = stCtagsFile;
}
} else if (state == stCtagsFile) {
if ((lineBuffer[i - 1] == '\t') &&
((ch == '/' && chNext == '^') || Is0To9(ch))) {
state = stCtags;

View File

@ -6,6 +6,12 @@
** The License.txt file describes the conditions under which this software may be distributed.
**/
// Previous releases of this lexer included support for marking token starts with
// a style byte indicator. This was used by the wxGhostscript IDE/debugger.
// Style byte indicators were removed in version 3.4.3.
// Anyone wanting to restore this functionality for wxGhostscript using 'modern'
// indicators can examine the earlier source in the Mercurial repository.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
@ -72,7 +78,6 @@ static void ColourisePSDoc(
StyleContext sc(startPos, length, initStyle, styler);
bool tokenizing = styler.GetPropertyInt("ps.tokenize") != 0;
int pslevel = styler.GetPropertyInt("ps.level", 3);
int lineCurrent = styler.GetLine(startPos);
int nestTextCurrent = 0;
@ -83,15 +88,6 @@ static void ColourisePSDoc(
bool numHasExponent = false;
bool numHasSign = false;
// Clear out existing tokenization
if (tokenizing && length > 0) {
styler.StartAt(startPos, static_cast<char>(INDIC2_MASK));
styler.ColourTo(startPos + length-1, 0);
styler.Flush();
styler.StartAt(startPos);
styler.StartSegment(startPos);
}
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart)
lineCurrent = styler.GetLine(sc.currentPos);
@ -196,7 +192,6 @@ static void ColourisePSDoc(
// Determine if a new state should be entered.
if (sc.state == SCE_C_DEFAULT) {
unsigned int tokenpos = sc.currentPos;
if (sc.ch == '[' || sc.ch == ']') {
sc.SetState(SCE_PS_PAREN_ARRAY);
@ -262,17 +257,6 @@ static void ColourisePSDoc(
} else if (!IsAWhitespaceChar(sc.ch)) {
sc.SetState(SCE_PS_NAME);
}
// Mark the start of tokens
if (tokenizing && sc.state != SCE_C_DEFAULT && sc.state != SCE_PS_COMMENT &&
sc.state != SCE_PS_DSC_COMMENT && sc.state != SCE_PS_DSC_VALUE) {
styler.Flush();
styler.StartAt(tokenpos, static_cast<char>(INDIC2_MASK));
styler.ColourTo(tokenpos, INDIC2_MASK);
styler.Flush();
styler.StartAt(tokenpos);
styler.StartSegment(tokenpos);
}
}
if (sc.atLineEnd)
@ -296,11 +280,10 @@ static void FoldPSDoc(unsigned int startPos, int length, int, WordList *[],
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style;
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
style = styleNext;
int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n'); //mac??
if ((style & 31) == SCE_PS_PAREN_PROC) {

View File

@ -12,7 +12,7 @@
A few words about features of the new completely rewritten LexPascal...
Generally speaking LexPascal tries to support all available Delphi features (up
to Delphi 2009 at this time), including .NET specific features.
to Delphi XE4 at this time).
~ HIGHLIGHTING:
@ -89,17 +89,18 @@ would be folded.
~ KEYWORDS:
The list of keywords that can be used in pascal.properties file (up to Delphi
2009):
XE4):
- Keywords: absolute abstract and array as asm assembler automated begin case
cdecl class const constructor deprecated destructor dispid dispinterface div do
downto dynamic else end except export exports external far file final
finalization finally for forward function goto if implementation in inherited
initialization inline interface is label library message mod near nil not object
of on or out overload override packed pascal platform private procedure program
property protected public published raise record register reintroduce repeat
resourcestring safecall sealed set shl shr static stdcall strict string then
threadvar to try type unit unsafe until uses var varargs virtual while with xor
cdecl class const constructor delayed deprecated destructor dispid dispinterface
div do downto dynamic else end except experimental export exports external far
file final finalization finally for forward function goto helper if
implementation in inherited initialization inline interface is label library
message mod near nil not object of on operator or out overload override packed
pascal platform private procedure program property protected public published
raise record reference register reintroduce repeat resourcestring safecall
sealed set shl shr static stdcall strict string then threadvar to try type unit
unsafe until uses var varargs virtual while winapi with xor
- Keywords related to the "smart highlithing" feature: add default implements
index name nodefault read readonly remove stored write writeonly

View File

@ -191,9 +191,9 @@ static int styleCheckIdentifier(LexAccessor &styler, unsigned int bk) {
static int podLineScan(LexAccessor &styler, unsigned int &pos, unsigned int endPos) {
// forward scan the current line to classify line for POD style
int state = -1;
while (pos <= endPos) {
while (pos < endPos) {
int ch = static_cast<unsigned char>(styler.SafeGetCharAt(pos));
if (ch == '\n' || ch == '\r' || pos >= endPos) {
if (ch == '\n' || ch == '\r') {
if (ch == '\r' && styler.SafeGetCharAt(pos + 1) == '\n') pos++;
break;
}
@ -662,7 +662,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
} else if (initStyle == SCE_PL_POD
|| initStyle == SCE_PL_POD_VERB
) {
// POD backtracking finds preceeding blank lines and goes back past them
// POD backtracking finds preceding blank lines and goes back past them
int ln = styler.GetLine(startPos);
if (ln > 0) {
initStyle = styler.StyleAt(styler.LineStart(--ln));
@ -861,10 +861,14 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
sc.Forward();
}
if (sc.ch != '\r') { // skip CR if CRLF
HereDoc.Append(sc.ch);
int i = 0; // else append char, possibly an extended char
while (i < sc.width) {
HereDoc.Append(static_cast<unsigned char>(styler.SafeGetCharAt(sc.currentPos + i)));
i++;
}
}
}
} else { // an unquoted here-doc delimiter
} else { // an unquoted here-doc delimiter, no extended charsets
if (setHereDocDelim.Contains(sc.ch)) {
HereDoc.Append(sc.ch);
} else {
@ -885,7 +889,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
if (HereDoc.DelimiterLength == 0 || sc.Match(HereDoc.Delimiter)) {
int c = sc.GetRelative(HereDoc.DelimiterLength);
if (c == '\r' || c == '\n') { // peek first, do not consume match
sc.Forward(HereDoc.DelimiterLength);
sc.ForwardBytes(HereDoc.DelimiterLength);
sc.SetState(SCE_PL_DEFAULT);
backFlag = BACK_NONE;
HereDoc.State = 0;
@ -939,7 +943,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
if (pod == SCE_PL_DEFAULT) {
if (sc.state == SCE_PL_POD_VERB) {
unsigned int fw2 = fw;
while (fw2 <= endPos && pod == SCE_PL_DEFAULT) {
while (fw2 < (endPos - 1) && pod == SCE_PL_DEFAULT) {
fw = fw2++; // penultimate line (last blank line)
pod = podLineScan(styler, fw2, endPos);
styler.SetLineState(styler.GetLine(fw2), pod);
@ -961,7 +965,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
}
sc.SetState(pod);
}
sc.Forward(fw - sc.currentPos); // commit style
sc.ForwardBytes(fw - sc.currentPos); // commit style
}
break;
case SCE_PL_REGEX:
@ -1021,7 +1025,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
// For '#', if no whitespace in between, it's a delimiter.
if (IsASpace(c)) {
// Keep going
} else if (c == '#' && IsASpaceOrTab(sc.GetRelative(sLen - 1))) {
} else if (c == '#' && IsASpaceOrTab(sc.GetRelativeCharacter(sLen - 1))) {
endType = 3;
} else
Quote.Open(c);
@ -1109,7 +1113,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
while (setSubPrototype.Contains(sc.GetRelative(i)))
i++;
if (sc.GetRelative(i) == ')') { // valid sub prototype
sc.Forward(i);
sc.ForwardBytes(i);
sc.ForwardSetState(SCE_PL_DEFAULT);
} else {
// abandon prototype, restart from '('
@ -1155,12 +1159,12 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
sc.ForwardSetState(SCE_PL_DEFAULT);
HereDoc.State = 3;
} else {
// invalid indentifier; inexact fallback, but hey
// invalid identifier; inexact fallback, but hey
sc.ChangeState(SCE_PL_IDENTIFIER);
sc.SetState(SCE_PL_DEFAULT);
}
} else {
sc.ChangeState(SCE_PL_DEFAULT); // invalid indentifier
sc.ChangeState(SCE_PL_DEFAULT); // invalid identifier
}
backFlag = BACK_NONE;
break;
@ -1181,7 +1185,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
}
switch (HereDoc.Quote) {
case '\'':
st_new = SCE_PL_HERE_Q ;
st_new = SCE_PL_HERE_Q;
break;
case '"' :
st_new = SCE_PL_HERE_QQ;
@ -1322,7 +1326,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
if (setArray.Contains(sc.chNext)) {
// no special treatment
} else if (sc.chNext == ':' && sc.GetRelative(2) == ':') {
sc.Forward(2);
sc.ForwardBytes(2);
} else if (sc.chNext == '{' || sc.chNext == '[') {
sc.ForwardSetState(SCE_PL_OPERATOR);
} else {
@ -1445,7 +1449,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
if (preferRE) {
sc.SetState(SCE_PL_SYMBOLTABLE);
if (sc.chNext == ':' && sc.GetRelative(2) == ':') {
sc.Forward(2);
sc.ForwardBytes(2);
} else if (sc.chNext == '{') {
sc.ForwardSetState(SCE_PL_OPERATOR);
} else {
@ -1462,7 +1466,7 @@ void SCI_METHOD LexerPerl::Lex(unsigned int startPos, int length, int initStyle,
if (setHash.Contains(sc.chNext)) {
sc.Forward();
} else if (sc.chNext == ':' && sc.GetRelative(2) == ':') {
sc.Forward(2);
sc.ForwardBytes(2);
} else if (sc.chNext == '{') {
sc.ForwardSetState(SCE_PL_OPERATOR);
} else {
@ -1626,7 +1630,7 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt
else if (styler.Match(i, "=head"))
podHeading = PodHeadingLevel(i, styler);
} else if (style == SCE_PL_DATASECTION) {
if (ch == '=' && isascii(chNext) && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE)
if (ch == '=' && IsASCII(chNext) && isalpha(chNext) && levelCurrent == SC_FOLDLEVELBASE)
levelCurrent++;
else if (styler.Match(i, "=cut") && levelCurrent > SC_FOLDLEVELBASE)
levelCurrent = (levelCurrent & ~PERL_HEADFOLD_MASK) - 1;
@ -1722,4 +1726,4 @@ void SCI_METHOD LexerPerl::Fold(unsigned int startPos, int length, int /* initSt
styler.SetLevel(lineCurrent, levelPrev | flagsNext);
}
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc, 8);
LexerModule lmPerl(SCLEX_PERL, LexerPerl::LexerFactoryPerl, "perl", perlWordListDesc);

View File

@ -385,7 +385,7 @@ static void ColourisePyDoc(unsigned int startPos, int length, int initStyle,
base_n_number = false;
sc.SetState(SCE_P_NUMBER);
}
} else if ((isascii(sc.ch) && isoperator(static_cast<char>(sc.ch))) || sc.ch == '`') {
} else if ((IsASCII(sc.ch) && isoperator(static_cast<char>(sc.ch))) || sc.ch == '`') {
sc.SetState(SCE_P_OPERATOR);
} else if (sc.ch == '#') {
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);

View File

@ -37,7 +37,7 @@ static inline bool IsAWordStart(const int ch) {
}
static inline bool IsAnOperator(const int ch) {
if (isascii(ch) && isalnum(ch))
if (IsASCII(ch) && isalnum(ch))
return false;
// '.' left out as it is used to make up numbers
if (ch == '-' || ch == '+' || ch == '!' || ch == '~' ||

View File

@ -0,0 +1,416 @@
// Scintilla source code edit control
/**
* @file LexRegistry.cxx
* @date July 26 2014
* @brief Lexer for Windows registration files(.reg)
* @author nkmathew
*
* The License.txt file describes the conditions under which this software may be
* distributed.
*
*/
#include <cstdlib>
#include <cassert>
#include <cctype>
#include <cstdio>
#include <string>
#include <vector>
#include <map>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static const char *const RegistryWordListDesc[] = {
0
};
struct OptionsRegistry {
bool foldCompact;
bool fold;
OptionsRegistry() {
foldCompact = false;
fold = false;
}
};
struct OptionSetRegistry : public OptionSet<OptionsRegistry> {
OptionSetRegistry() {
DefineProperty("fold.compact", &OptionsRegistry::foldCompact);
DefineProperty("fold", &OptionsRegistry::fold);
DefineWordListSets(RegistryWordListDesc);
}
};
class LexerRegistry : public ILexer {
OptionsRegistry options;
OptionSetRegistry optSetRegistry;
static bool IsStringState(int state) {
return (state == SCE_REG_VALUENAME || state == SCE_REG_STRING);
}
static bool IsKeyPathState(int state) {
return (state == SCE_REG_ADDEDKEY || state == SCE_REG_DELETEDKEY);
}
static bool AtValueType(LexAccessor &styler, int start) {
int i = 0;
while (i < 10) {
i++;
char curr = styler.SafeGetCharAt(start+i, '\0');
if (curr == ':') {
return true;
} else if (!curr) {
return false;
}
}
return false;
}
static bool IsNextNonWhitespace(LexAccessor &styler, int start, char ch) {
int i = 0;
while (i < 100) {
i++;
char curr = styler.SafeGetCharAt(start+i, '\0');
char next = styler.SafeGetCharAt(start+i+1, '\0');
bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n');
if (curr == ch) {
return true;
} else if (!isspacechar(curr) || atEOL) {
return false;
}
}
return false;
}
// Looks for the equal sign at the end of the string
static bool AtValueName(LexAccessor &styler, int start) {
bool atEOL = false;
int i = 0;
bool escaped = false;
while (!atEOL) {
i++;
char curr = styler.SafeGetCharAt(start+i, '\0');
char next = styler.SafeGetCharAt(start+i+1, '\0');
atEOL = (curr == '\r' && next != '\n') || (curr == '\n');
if (escaped) {
escaped = false;
continue;
}
escaped = curr == '\\';
if (curr == '"') {
return IsNextNonWhitespace(styler, start+i, '=');
} else if (!curr) {
return false;
}
}
return false;
}
static bool AtKeyPathEnd(LexAccessor &styler, int start) {
bool atEOL = false;
int i = 0;
while (!atEOL) {
i++;
char curr = styler.SafeGetCharAt(start+i, '\0');
char next = styler.SafeGetCharAt(start+i+1, '\0');
atEOL = (curr == '\r' && next != '\n') || (curr == '\n');
if (curr == ']' || !curr) {
// There's still at least one or more square brackets ahead
return false;
}
}
return true;
}
static bool AtGUID(LexAccessor &styler, int start) {
int count = 8;
int portion = 0;
int offset = 1;
char digit = '\0';
while (portion < 5) {
int i = 0;
while (i < count) {
digit = styler.SafeGetCharAt(start+offset);
if (!(isxdigit(digit) || digit == '-')) {
return false;
}
offset++;
i++;
}
portion++;
count = (portion == 4) ? 13 : 5;
}
digit = styler.SafeGetCharAt(start+offset);
if (digit == '}') {
return true;
} else {
return false;
}
}
public:
LexerRegistry() {}
virtual ~LexerRegistry() {}
virtual int SCI_METHOD Version() const {
return lvOriginal;
}
virtual void SCI_METHOD Release() {
delete this;
}
virtual const char *SCI_METHOD PropertyNames() {
return optSetRegistry.PropertyNames();
}
virtual int SCI_METHOD PropertyType(const char *name) {
return optSetRegistry.PropertyType(name);
}
virtual const char *SCI_METHOD DescribeProperty(const char *name) {
return optSetRegistry.DescribeProperty(name);
}
virtual int SCI_METHOD PropertySet(const char *key, const char *val) {
if (optSetRegistry.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
virtual int SCI_METHOD WordListSet(int, const char *) {
return -1;
}
virtual void *SCI_METHOD PrivateCall(int, void *) {
return 0;
}
static ILexer *LexerFactoryRegistry() {
return new LexerRegistry;
}
virtual const char *SCI_METHOD DescribeWordListSets() {
return optSetRegistry.DescribeWordListSets();
}
virtual void SCI_METHOD Lex(unsigned startPos,
int length,
int initStyle,
IDocument *pAccess);
virtual void SCI_METHOD Fold(unsigned startPos,
int length,
int initStyle,
IDocument *pAccess);
};
void SCI_METHOD LexerRegistry::Lex(unsigned startPos,
int length,
int initStyle,
IDocument *pAccess) {
int beforeGUID = SCE_REG_DEFAULT;
int beforeEscape = SCE_REG_DEFAULT;
CharacterSet setOperators = CharacterSet(CharacterSet::setNone, "-,.=:\\@()");
LexAccessor styler(pAccess);
StyleContext context(startPos, length, initStyle, styler);
bool highlight = true;
bool afterEqualSign = false;
while (context.More()) {
if (context.atLineStart) {
int currPos = static_cast<int>(context.currentPos);
bool continued = styler[currPos-3] == '\\';
highlight = continued ? true : false;
}
switch (context.state) {
case SCE_REG_COMMENT:
if (context.atLineEnd) {
context.SetState(SCE_REG_DEFAULT);
}
break;
case SCE_REG_VALUENAME:
case SCE_REG_STRING: {
int currPos = static_cast<int>(context.currentPos);
if (context.ch == '"') {
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == '\\') {
beforeEscape = context.state;
context.SetState(SCE_REG_ESCAPED);
context.Forward();
} else if (context.ch == '{') {
if (AtGUID(styler, currPos)) {
beforeGUID = context.state;
context.SetState(SCE_REG_STRING_GUID);
}
}
if (context.state == SCE_REG_STRING &&
context.ch == '%' &&
(isdigit(context.chNext) || context.chNext == '*')) {
context.SetState(SCE_REG_PARAMETER);
}
}
break;
case SCE_REG_PARAMETER:
context.ForwardSetState(SCE_REG_STRING);
if (context.ch == '"') {
context.ForwardSetState(SCE_REG_DEFAULT);
}
break;
case SCE_REG_VALUETYPE:
if (context.ch == ':') {
context.SetState(SCE_REG_DEFAULT);
afterEqualSign = false;
}
break;
case SCE_REG_HEXDIGIT:
case SCE_REG_OPERATOR:
context.SetState(SCE_REG_DEFAULT);
break;
case SCE_REG_DELETEDKEY:
case SCE_REG_ADDEDKEY: {
int currPos = static_cast<int>(context.currentPos);
if (context.ch == ']' && AtKeyPathEnd(styler, currPos)) {
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == '{') {
if (AtGUID(styler, currPos)) {
beforeGUID = context.state;
context.SetState(SCE_REG_KEYPATH_GUID);
}
}
}
break;
case SCE_REG_ESCAPED:
if (context.ch == '"') {
context.SetState(beforeEscape);
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == '\\') {
context.Forward();
} else {
context.SetState(beforeEscape);
beforeEscape = SCE_REG_DEFAULT;
}
break;
case SCE_REG_STRING_GUID:
case SCE_REG_KEYPATH_GUID: {
if (context.ch == '}') {
context.ForwardSetState(beforeGUID);
beforeGUID = SCE_REG_DEFAULT;
}
int currPos = static_cast<int>(context.currentPos);
if (context.ch == '"' && IsStringState(context.state)) {
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == ']' &&
AtKeyPathEnd(styler, currPos) &&
IsKeyPathState(context.state)) {
context.ForwardSetState(SCE_REG_DEFAULT);
} else if (context.ch == '\\' && IsStringState(context.state)) {
beforeEscape = context.state;
context.SetState(SCE_REG_ESCAPED);
context.Forward();
}
}
break;
}
// Determine if a new state should be entered.
if (context.state == SCE_REG_DEFAULT) {
int currPos = static_cast<int>(context.currentPos);
if (context.ch == ';') {
context.SetState(SCE_REG_COMMENT);
} else if (context.ch == '"') {
if (AtValueName(styler, currPos)) {
context.SetState(SCE_REG_VALUENAME);
} else {
context.SetState(SCE_REG_STRING);
}
} else if (context.ch == '[') {
if (IsNextNonWhitespace(styler, currPos, '-')) {
context.SetState(SCE_REG_DELETEDKEY);
} else {
context.SetState(SCE_REG_ADDEDKEY);
}
} else if (context.ch == '=') {
afterEqualSign = true;
highlight = true;
} else if (afterEqualSign) {
bool wordStart = isalpha(context.ch) && !isalpha(context.chPrev);
if (wordStart && AtValueType(styler, currPos)) {
context.SetState(SCE_REG_VALUETYPE);
}
} else if (isxdigit(context.ch) && highlight) {
context.SetState(SCE_REG_HEXDIGIT);
}
highlight = (context.ch == '@') ? true : highlight;
if (setOperators.Contains(context.ch) && highlight) {
context.SetState(SCE_REG_OPERATOR);
}
}
context.Forward();
}
context.Complete();
}
// Folding similar to that of FoldPropsDoc in LexOthers
void SCI_METHOD LexerRegistry::Fold(unsigned startPos,
int length,
int,
IDocument *pAccess) {
if (!options.fold) {
return;
}
LexAccessor styler(pAccess);
int currLine = styler.GetLine(startPos);
int visibleChars = 0;
unsigned endPos = startPos + length;
bool atKeyPath = false;
for (unsigned i = startPos; i < endPos; i++) {
atKeyPath = IsKeyPathState(styler.StyleAt(i)) ? true : atKeyPath;
char curr = styler.SafeGetCharAt(i);
char next = styler.SafeGetCharAt(i+1);
bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n');
if (atEOL || i == (endPos-1)) {
int level = SC_FOLDLEVELBASE;
if (currLine > 0) {
int prevLevel = styler.LevelAt(currLine-1);
if (prevLevel & SC_FOLDLEVELHEADERFLAG) {
level += 1;
} else {
level = prevLevel;
}
}
if (!visibleChars && options.foldCompact) {
level |= SC_FOLDLEVELWHITEFLAG;
} else if (atKeyPath) {
level = SC_FOLDLEVELBASE | SC_FOLDLEVELHEADERFLAG;
}
if (level != styler.LevelAt(currLine)) {
styler.SetLevel(currLine, level);
}
currLine++;
visibleChars = 0;
atKeyPath = false;
}
if (!isspacechar(curr)) {
visibleChars++;
}
}
// Make the folding reach the last line in the file
int level = SC_FOLDLEVELBASE;
if (currLine > 0) {
int prevLevel = styler.LevelAt(currLine-1);
if (prevLevel & SC_FOLDLEVELHEADERFLAG) {
level += 1;
} else {
level = prevLevel;
}
}
styler.SetLevel(currLine, level);
}
LexerModule lmRegistry(SCLEX_REGISTRY,
LexerRegistry::LexerFactoryRegistry,
"registry",
RegistryWordListDesc);

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,816 @@
/** @file LexRust.cxx
** Lexer for Rust.
**
** Copyright (c) 2013 by SiegeLord <slabode@aim.com>
** Converted to lexer object and added further folding features/properties by "Udo Lechner" <dlchnr(at)gmx(dot)net>
**/
// Copyright 1998-2005 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include <string>
#include <map>
#include "ILexer.h"
#include "Scintilla.h"
#include "SciLexer.h"
#include "PropSetSimple.h"
#include "WordList.h"
#include "LexAccessor.h"
#include "Accessor.h"
#include "StyleContext.h"
#include "CharacterSet.h"
#include "LexerModule.h"
#include "OptionSet.h"
#ifdef SCI_NAMESPACE
using namespace Scintilla;
#endif
static const int NUM_RUST_KEYWORD_LISTS = 7;
static const int MAX_RUST_IDENT_CHARS = 1023;
static bool IsStreamCommentStyle(int style) {
return style == SCE_RUST_COMMENTBLOCK ||
style == SCE_RUST_COMMENTBLOCKDOC;
}
// Options used for LexerRust
struct OptionsRust {
bool fold;
bool foldSyntaxBased;
bool foldComment;
bool foldCommentMultiline;
bool foldCommentExplicit;
std::string foldExplicitStart;
std::string foldExplicitEnd;
bool foldExplicitAnywhere;
bool foldCompact;
int foldAtElseInt;
bool foldAtElse;
OptionsRust() {
fold = false;
foldSyntaxBased = true;
foldComment = false;
foldCommentMultiline = true;
foldCommentExplicit = true;
foldExplicitStart = "";
foldExplicitEnd = "";
foldExplicitAnywhere = false;
foldCompact = true;
foldAtElseInt = -1;
foldAtElse = false;
}
};
static const char * const rustWordLists[NUM_RUST_KEYWORD_LISTS + 1] = {
"Primary keywords and identifiers",
"Built in types",
"Other keywords",
"Keywords 4",
"Keywords 5",
"Keywords 6",
"Keywords 7",
0,
};
struct OptionSetRust : public OptionSet<OptionsRust> {
OptionSetRust() {
DefineProperty("fold", &OptionsRust::fold);
DefineProperty("fold.comment", &OptionsRust::foldComment);
DefineProperty("fold.compact", &OptionsRust::foldCompact);
DefineProperty("fold.at.else", &OptionsRust::foldAtElse);
DefineProperty("fold.rust.syntax.based", &OptionsRust::foldSyntaxBased,
"Set this property to 0 to disable syntax based folding.");
DefineProperty("fold.rust.comment.multiline", &OptionsRust::foldCommentMultiline,
"Set this property to 0 to disable folding multi-line comments when fold.comment=1.");
DefineProperty("fold.rust.comment.explicit", &OptionsRust::foldCommentExplicit,
"Set this property to 0 to disable folding explicit fold points when fold.comment=1.");
DefineProperty("fold.rust.explicit.start", &OptionsRust::foldExplicitStart,
"The string to use for explicit fold start points, replacing the standard //{.");
DefineProperty("fold.rust.explicit.end", &OptionsRust::foldExplicitEnd,
"The string to use for explicit fold end points, replacing the standard //}.");
DefineProperty("fold.rust.explicit.anywhere", &OptionsRust::foldExplicitAnywhere,
"Set this property to 1 to enable explicit fold points anywhere, not just in line comments.");
DefineProperty("lexer.rust.fold.at.else", &OptionsRust::foldAtElseInt,
"This option enables Rust folding on a \"} else {\" line of an if statement.");
DefineWordListSets(rustWordLists);
}
};
class LexerRust : public ILexer {
WordList keywords[NUM_RUST_KEYWORD_LISTS];
OptionsRust options;
OptionSetRust osRust;
public:
virtual ~LexerRust() {
}
void SCI_METHOD Release() {
delete this;
}
int SCI_METHOD Version() const {
return lvOriginal;
}
const char * SCI_METHOD PropertyNames() {
return osRust.PropertyNames();
}
int SCI_METHOD PropertyType(const char *name) {
return osRust.PropertyType(name);
}
const char * SCI_METHOD DescribeProperty(const char *name) {
return osRust.DescribeProperty(name);
}
int SCI_METHOD PropertySet(const char *key, const char *val);
const char * SCI_METHOD DescribeWordListSets() {
return osRust.DescribeWordListSets();
}
int SCI_METHOD WordListSet(int n, const char *wl);
void SCI_METHOD Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
void SCI_METHOD Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess);
void * SCI_METHOD PrivateCall(int, void *) {
return 0;
}
static ILexer *LexerFactoryRust() {
return new LexerRust();
}
};
int SCI_METHOD LexerRust::PropertySet(const char *key, const char *val) {
if (osRust.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
int SCI_METHOD LexerRust::WordListSet(int n, const char *wl) {
int firstModification = -1;
if (n < NUM_RUST_KEYWORD_LISTS) {
WordList *wordListN = &keywords[n];
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
firstModification = 0;
}
}
return firstModification;
}
static bool IsWhitespace(int c) {
return c == ' ' || c == '\t' || c == '\r' || c == '\n';
}
/* This isn't quite right for Unicode identifiers */
static bool IsIdentifierStart(int ch) {
return (IsASCII(ch) && (isalpha(ch) || ch == '_')) || !IsASCII(ch);
}
/* This isn't quite right for Unicode identifiers */
static bool IsIdentifierContinue(int ch) {
return (IsASCII(ch) && (isalnum(ch) || ch == '_')) || !IsASCII(ch);
}
static void ScanWhitespace(Accessor& styler, int& pos, int max) {
while (IsWhitespace(styler.SafeGetCharAt(pos, '\0')) && pos < max) {
if (pos == styler.LineEnd(styler.GetLine(pos)))
styler.SetLineState(styler.GetLine(pos), 0);
pos++;
}
styler.ColourTo(pos-1, SCE_RUST_DEFAULT);
}
static void GrabString(char* s, Accessor& styler, int start, int len) {
for (int ii = 0; ii < len; ii++)
s[ii] = styler[ii + start];
s[len] = '\0';
}
static void ScanIdentifier(Accessor& styler, int& pos, WordList *keywords) {
int start = pos;
while (IsIdentifierContinue(styler.SafeGetCharAt(pos, '\0')))
pos++;
if (styler.SafeGetCharAt(pos, '\0') == '!') {
pos++;
styler.ColourTo(pos - 1, SCE_RUST_MACRO);
} else {
char s[MAX_RUST_IDENT_CHARS + 1];
int len = pos - start;
len = len > MAX_RUST_IDENT_CHARS ? MAX_RUST_IDENT_CHARS : len;
GrabString(s, styler, start, len);
bool keyword = false;
for (int ii = 0; ii < NUM_RUST_KEYWORD_LISTS; ii++) {
if (keywords[ii].InList(s)) {
styler.ColourTo(pos - 1, SCE_RUST_WORD + ii);
keyword = true;
break;
}
}
if (!keyword) {
styler.ColourTo(pos - 1, SCE_RUST_IDENTIFIER);
}
}
}
/* Scans a sequence of digits, returning true if it found any. */
static bool ScanDigits(Accessor& styler, int& pos, int base) {
int old_pos = pos;
for (;;) {
int c = styler.SafeGetCharAt(pos, '\0');
if (IsADigit(c, base) || c == '_')
pos++;
else
break;
}
return old_pos != pos;
}
/* Scans an integer and floating point literals. */
static void ScanNumber(Accessor& styler, int& pos) {
int base = 10;
int c = styler.SafeGetCharAt(pos, '\0');
int n = styler.SafeGetCharAt(pos + 1, '\0');
bool error = false;
/* Scan the prefix, thus determining the base.
* 10 is default if there's no prefix. */
if (c == '0' && n == 'x') {
pos += 2;
base = 16;
} else if (c == '0' && n == 'b') {
pos += 2;
base = 2;
} else if (c == '0' && n == 'o') {
pos += 2;
base = 8;
}
/* Scan initial digits. The literal is malformed if there are none. */
error |= !ScanDigits(styler, pos, base);
/* See if there's an integer suffix. We mimic the Rust's lexer
* and munch it even if there was an error above. */
c = styler.SafeGetCharAt(pos, '\0');
if (c == 'u' || c == 'i') {
pos++;
c = styler.SafeGetCharAt(pos, '\0');
n = styler.SafeGetCharAt(pos + 1, '\0');
if (c == '8' || c == 's') {
pos++;
} else if (c == '1' && n == '6') {
pos += 2;
} else if (c == '3' && n == '2') {
pos += 2;
} else if (c == '6' && n == '4') {
pos += 2;
} else {
error = true;
}
/* See if it's a floating point literal. These literals have to be base 10.
*/
} else if (!error) {
/* If there's a period, it's a floating point literal unless it's
* followed by an identifier (meaning this is a method call, e.g.
* `1.foo()`) or another period, in which case it's a range (e.g. 1..2)
*/
n = styler.SafeGetCharAt(pos + 1, '\0');
if (c == '.' && !(IsIdentifierStart(n) || n == '.')) {
error |= base != 10;
pos++;
/* It's ok to have no digits after the period. */
ScanDigits(styler, pos, 10);
}
/* Look for the exponentiation. */
c = styler.SafeGetCharAt(pos, '\0');
if (c == 'e' || c == 'E') {
error |= base != 10;
pos++;
c = styler.SafeGetCharAt(pos, '\0');
if (c == '-' || c == '+')
pos++;
/* It is invalid to have no digits in the exponent. */
error |= !ScanDigits(styler, pos, 10);
}
/* Scan the floating point suffix. */
c = styler.SafeGetCharAt(pos, '\0');
if (c == 'f') {
error |= base != 10;
pos++;
c = styler.SafeGetCharAt(pos, '\0');
n = styler.SafeGetCharAt(pos + 1, '\0');
if (c == '3' && n == '2') {
pos += 2;
} else if (c == '6' && n == '4') {
pos += 2;
} else {
error = true;
}
}
}
if (error)
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
else
styler.ColourTo(pos - 1, SCE_RUST_NUMBER);
}
static bool IsOneCharOperator(int c) {
return c == ';' || c == ',' || c == '(' || c == ')'
|| c == '{' || c == '}' || c == '[' || c == ']'
|| c == '@' || c == '#' || c == '~' || c == '+'
|| c == '*' || c == '/' || c == '^' || c == '%'
|| c == '.' || c == ':' || c == '!' || c == '<'
|| c == '>' || c == '=' || c == '-' || c == '&'
|| c == '|' || c == '$';
}
static bool IsTwoCharOperator(int c, int n) {
return (c == '.' && n == '.') || (c == ':' && n == ':')
|| (c == '!' && n == '=') || (c == '<' && n == '<')
|| (c == '<' && n == '=') || (c == '>' && n == '>')
|| (c == '>' && n == '=') || (c == '=' && n == '=')
|| (c == '=' && n == '>') || (c == '-' && n == '>')
|| (c == '&' && n == '&') || (c == '|' && n == '|')
|| (c == '-' && n == '=') || (c == '&' && n == '=')
|| (c == '|' && n == '=') || (c == '+' && n == '=')
|| (c == '*' && n == '=') || (c == '/' && n == '=')
|| (c == '^' && n == '=') || (c == '%' && n == '=');
}
static bool IsThreeCharOperator(int c, int n, int n2) {
return (c == '<' && n == '<' && n2 == '=')
|| (c == '>' && n == '>' && n2 == '=');
}
static bool IsValidCharacterEscape(int c) {
return c == 'n' || c == 'r' || c == 't' || c == '\\'
|| c == '\'' || c == '"' || c == '0';
}
static bool IsValidStringEscape(int c) {
return IsValidCharacterEscape(c) || c == '\n' || c == '\r';
}
static bool ScanNumericEscape(Accessor &styler, int& pos, int num_digits, bool stop_asap) {
for (;;) {
int c = styler.SafeGetCharAt(pos, '\0');
if (!IsADigit(c, 16))
break;
num_digits--;
pos++;
if (num_digits == 0 && stop_asap)
return true;
}
if (num_digits == 0) {
return true;
} else {
return false;
}
}
/* This is overly permissive for character literals in order to accept UTF-8 encoded
* character literals. */
static void ScanCharacterLiteralOrLifetime(Accessor &styler, int& pos, bool ascii_only) {
pos++;
int c = styler.SafeGetCharAt(pos, '\0');
int n = styler.SafeGetCharAt(pos + 1, '\0');
bool done = false;
bool valid_lifetime = !ascii_only && IsIdentifierStart(c);
bool valid_char = true;
bool first = true;
while (!done) {
switch (c) {
case '\\':
done = true;
if (IsValidCharacterEscape(n)) {
pos += 2;
} else if (n == 'x') {
pos += 2;
valid_char = ScanNumericEscape(styler, pos, 2, false);
} else if (n == 'u' && !ascii_only) {
pos += 2;
valid_char = ScanNumericEscape(styler, pos, 4, false);
} else if (n == 'U' && !ascii_only) {
pos += 2;
valid_char = ScanNumericEscape(styler, pos, 8, false);
} else {
valid_char = false;
}
break;
case '\'':
valid_char = !first;
done = true;
break;
case '\t':
case '\n':
case '\r':
case '\0':
valid_char = false;
done = true;
break;
default:
if (ascii_only && !IsASCII((char)c)) {
done = true;
valid_char = false;
} else if (!IsIdentifierContinue(c) && !first) {
done = true;
} else {
pos++;
}
break;
}
c = styler.SafeGetCharAt(pos, '\0');
n = styler.SafeGetCharAt(pos + 1, '\0');
first = false;
}
if (styler.SafeGetCharAt(pos, '\0') == '\'') {
valid_lifetime = false;
} else {
valid_char = false;
}
if (valid_lifetime) {
styler.ColourTo(pos - 1, SCE_RUST_LIFETIME);
} else if (valid_char) {
pos++;
styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTECHARACTER : SCE_RUST_CHARACTER);
} else {
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
}
}
enum CommentState {
UnknownComment,
DocComment,
NotDocComment
};
/*
* The rule for block-doc comments is as follows: /xxN and /x! (where x is an asterisk, N is a non-asterisk) start doc comments.
* Otherwise it's a regular comment.
*/
static void ResumeBlockComment(Accessor &styler, int& pos, int max, CommentState state, int level) {
int c = styler.SafeGetCharAt(pos, '\0');
bool maybe_doc_comment = false;
if (c == '*') {
int n = styler.SafeGetCharAt(pos + 1, '\0');
if (n != '*' && n != '/') {
maybe_doc_comment = true;
}
} else if (c == '!') {
maybe_doc_comment = true;
}
for (;;) {
int n = styler.SafeGetCharAt(pos + 1, '\0');
if (pos == styler.LineEnd(styler.GetLine(pos)))
styler.SetLineState(styler.GetLine(pos), level);
if (c == '*') {
pos++;
if (n == '/') {
pos++;
level--;
if (level == 0) {
styler.SetLineState(styler.GetLine(pos), 0);
if (state == DocComment || (state == UnknownComment && maybe_doc_comment))
styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCKDOC);
else
styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCK);
break;
}
}
} else if (c == '/') {
pos++;
if (n == '*') {
pos++;
level++;
}
}
else {
pos++;
}
if (pos >= max) {
if (state == DocComment || (state == UnknownComment && maybe_doc_comment))
styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCKDOC);
else
styler.ColourTo(pos - 1, SCE_RUST_COMMENTBLOCK);
break;
}
c = styler.SafeGetCharAt(pos, '\0');
}
}
/*
* The rule for line-doc comments is as follows... ///N and //! (where N is a non slash) start doc comments.
* Otherwise it's a normal line comment.
*/
static void ResumeLineComment(Accessor &styler, int& pos, int max, CommentState state) {
bool maybe_doc_comment = false;
int c = styler.SafeGetCharAt(pos, '\0');
if (c == '/') {
if (pos < max) {
pos++;
c = styler.SafeGetCharAt(pos, '\0');
if (c != '/') {
maybe_doc_comment = true;
}
}
} else if (c == '!') {
maybe_doc_comment = true;
}
while (pos < max && c != '\n') {
if (pos == styler.LineEnd(styler.GetLine(pos)))
styler.SetLineState(styler.GetLine(pos), 0);
pos++;
c = styler.SafeGetCharAt(pos, '\0');
}
if (state == DocComment || (state == UnknownComment && maybe_doc_comment))
styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINEDOC);
else
styler.ColourTo(pos - 1, SCE_RUST_COMMENTLINE);
}
static void ScanComments(Accessor &styler, int& pos, int max) {
pos++;
int c = styler.SafeGetCharAt(pos, '\0');
pos++;
if (c == '/')
ResumeLineComment(styler, pos, max, UnknownComment);
else if (c == '*')
ResumeBlockComment(styler, pos, max, UnknownComment, 1);
}
static void ResumeString(Accessor &styler, int& pos, int max, bool ascii_only) {
int c = styler.SafeGetCharAt(pos, '\0');
bool error = false;
while (c != '"' && !error) {
if (pos >= max) {
error = true;
break;
}
if (pos == styler.LineEnd(styler.GetLine(pos)))
styler.SetLineState(styler.GetLine(pos), 0);
if (c == '\\') {
int n = styler.SafeGetCharAt(pos + 1, '\0');
if (IsValidStringEscape(n)) {
pos += 2;
} else if (n == 'x') {
pos += 2;
error = !ScanNumericEscape(styler, pos, 2, true);
} else if (n == 'u' && !ascii_only) {
pos += 2;
error = !ScanNumericEscape(styler, pos, 4, true);
} else if (n == 'U' && !ascii_only) {
pos += 2;
error = !ScanNumericEscape(styler, pos, 8, true);
} else {
pos += 1;
error = true;
}
} else {
if (ascii_only && !IsASCII((char)c))
error = true;
else
pos++;
}
c = styler.SafeGetCharAt(pos, '\0');
}
if (!error)
pos++;
styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRING : SCE_RUST_STRING);
}
static void ResumeRawString(Accessor &styler, int& pos, int max, int num_hashes, bool ascii_only) {
for (;;) {
if (pos == styler.LineEnd(styler.GetLine(pos)))
styler.SetLineState(styler.GetLine(pos), num_hashes);
int c = styler.SafeGetCharAt(pos, '\0');
if (c == '"') {
pos++;
int trailing_num_hashes = 0;
while (styler.SafeGetCharAt(pos, '\0') == '#' && trailing_num_hashes < num_hashes) {
trailing_num_hashes++;
pos++;
}
if (trailing_num_hashes == num_hashes) {
styler.SetLineState(styler.GetLine(pos), 0);
break;
}
} else if (pos >= max) {
break;
} else {
if (ascii_only && !IsASCII((char)c))
break;
pos++;
}
}
styler.ColourTo(pos - 1, ascii_only ? SCE_RUST_BYTESTRINGR : SCE_RUST_STRINGR);
}
static void ScanRawString(Accessor &styler, int& pos, int max, bool ascii_only) {
pos++;
int num_hashes = 0;
while (styler.SafeGetCharAt(pos, '\0') == '#') {
num_hashes++;
pos++;
}
if (styler.SafeGetCharAt(pos, '\0') != '"') {
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
} else {
pos++;
ResumeRawString(styler, pos, max, num_hashes, ascii_only);
}
}
void SCI_METHOD LexerRust::Lex(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
PropSetSimple props;
Accessor styler(pAccess, &props);
int pos = startPos;
int max = pos + length;
styler.StartAt(pos);
styler.StartSegment(pos);
if (initStyle == SCE_RUST_COMMENTBLOCK || initStyle == SCE_RUST_COMMENTBLOCKDOC) {
ResumeBlockComment(styler, pos, max, initStyle == SCE_RUST_COMMENTBLOCKDOC ? DocComment : NotDocComment, styler.GetLineState(styler.GetLine(pos) - 1));
} else if (initStyle == SCE_RUST_COMMENTLINE || initStyle == SCE_RUST_COMMENTLINEDOC) {
ResumeLineComment(styler, pos, max, initStyle == SCE_RUST_COMMENTLINEDOC ? DocComment : NotDocComment);
} else if (initStyle == SCE_RUST_STRING) {
ResumeString(styler, pos, max, false);
} else if (initStyle == SCE_RUST_BYTESTRING) {
ResumeString(styler, pos, max, true);
} else if (initStyle == SCE_RUST_STRINGR) {
ResumeRawString(styler, pos, max, styler.GetLineState(styler.GetLine(pos) - 1), false);
} else if (initStyle == SCE_RUST_BYTESTRINGR) {
ResumeRawString(styler, pos, max, styler.GetLineState(styler.GetLine(pos) - 1), true);
}
while (pos < max) {
int c = styler.SafeGetCharAt(pos, '\0');
int n = styler.SafeGetCharAt(pos + 1, '\0');
int n2 = styler.SafeGetCharAt(pos + 2, '\0');
if (pos == 0 && c == '#' && n == '!' && n2 != '[') {
pos += 2;
ResumeLineComment(styler, pos, max, NotDocComment);
} else if (IsWhitespace(c)) {
ScanWhitespace(styler, pos, max);
} else if (c == '/' && (n == '/' || n == '*')) {
ScanComments(styler, pos, max);
} else if (c == 'r' && (n == '#' || n == '"')) {
ScanRawString(styler, pos, max, false);
} else if (c == 'b' && n == 'r' && (n2 == '#' || n2 == '"')) {
pos++;
ScanRawString(styler, pos, max, true);
} else if (c == 'b' && n == '"') {
pos += 2;
ResumeString(styler, pos, max, true);
} else if (c == 'b' && n == '\'') {
pos++;
ScanCharacterLiteralOrLifetime(styler, pos, true);
} else if (IsIdentifierStart(c)) {
ScanIdentifier(styler, pos, keywords);
} else if (IsADigit(c)) {
ScanNumber(styler, pos);
} else if (IsThreeCharOperator(c, n, n2)) {
pos += 3;
styler.ColourTo(pos - 1, SCE_RUST_OPERATOR);
} else if (IsTwoCharOperator(c, n)) {
pos += 2;
styler.ColourTo(pos - 1, SCE_RUST_OPERATOR);
} else if (IsOneCharOperator(c)) {
pos++;
styler.ColourTo(pos - 1, SCE_RUST_OPERATOR);
} else if (c == '\'') {
ScanCharacterLiteralOrLifetime(styler, pos, false);
} else if (c == '"') {
pos++;
ResumeString(styler, pos, max, false);
} else {
pos++;
styler.ColourTo(pos - 1, SCE_RUST_LEXERROR);
}
}
styler.ColourTo(pos - 1, SCE_RUST_DEFAULT);
styler.Flush();
}
void SCI_METHOD LexerRust::Fold(unsigned int startPos, int length, int initStyle, IDocument *pAccess) {
if (!options.fold)
return;
LexAccessor styler(pAccess);
unsigned int endPos = startPos + length;
int visibleChars = 0;
bool inLineComment = false;
int lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent-1) >> 16;
unsigned int lineStartNext = styler.LineStart(lineCurrent+1);
int levelMinCurrent = levelCurrent;
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
const bool userDefinedFoldMarkers = !options.foldExplicitStart.empty() && !options.foldExplicitEnd.empty();
for (unsigned int i = startPos; i < endPos; i++) {
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = i == (lineStartNext-1);
if ((style == SCE_RUST_COMMENTLINE) || (style == SCE_RUST_COMMENTLINEDOC))
inLineComment = true;
if (options.foldComment && options.foldCommentMultiline && IsStreamCommentStyle(style) && !inLineComment) {
if (!IsStreamCommentStyle(stylePrev)) {
levelNext++;
} else if (!IsStreamCommentStyle(styleNext) && !atEOL) {
// Comments don't end at end of line and the next character may be unstyled.
levelNext--;
}
}
if (options.foldComment && options.foldCommentExplicit && ((style == SCE_RUST_COMMENTLINE) || options.foldExplicitAnywhere)) {
if (userDefinedFoldMarkers) {
if (styler.Match(i, options.foldExplicitStart.c_str())) {
levelNext++;
} else if (styler.Match(i, options.foldExplicitEnd.c_str())) {
levelNext--;
}
} else {
if ((ch == '/') && (chNext == '/')) {
char chNext2 = styler.SafeGetCharAt(i + 2);
if (chNext2 == '{') {
levelNext++;
} else if (chNext2 == '}') {
levelNext--;
}
}
}
}
if (options.foldSyntaxBased && (style == SCE_RUST_OPERATOR)) {
if (ch == '{') {
// Measure the minimum before a '{' to allow
// folding on "} else {"
if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
} else if (ch == '}') {
levelNext--;
}
}
if (!IsASpace(ch))
visibleChars++;
if (atEOL || (i == endPos-1)) {
int levelUse = levelCurrent;
if (options.foldSyntaxBased && options.foldAtElse) {
levelUse = levelMinCurrent;
}
int lev = levelUse | levelNext << 16;
if (visibleChars == 0 && options.foldCompact)
lev |= SC_FOLDLEVELWHITEFLAG;
if (levelUse < levelNext)
lev |= SC_FOLDLEVELHEADERFLAG;
if (lev != styler.LevelAt(lineCurrent)) {
styler.SetLevel(lineCurrent, lev);
}
lineCurrent++;
lineStartNext = styler.LineStart(lineCurrent+1);
levelCurrent = levelNext;
levelMinCurrent = levelCurrent;
if (atEOL && (i == static_cast<unsigned int>(styler.Length()-1))) {
// There is an empty line at end of file so give it same level and empty
styler.SetLevel(lineCurrent, (levelCurrent | levelCurrent << 16) | SC_FOLDLEVELWHITEFLAG);
}
visibleChars = 0;
inLineComment = false;
}
}
}
LexerModule lmRust(SCLEX_RUST, LexerRust::LexerFactoryRust, "rust", rustWordLists);

View File

@ -54,14 +54,15 @@ static inline bool IsADoxygenChar(int ch) {
ch == '}' || ch == '[' || ch == ']');
}
static inline bool IsANumberChar(int ch) {
static inline bool IsANumberChar(int ch, int chPrev) {
// Not exactly following number definition (several dots are seen as OK, etc.)
// but probably enough in most cases.
return (ch < 0x80) &&
(isdigit(ch) || toupper(ch) == 'E' ||
ch == '.' || ch == '-' || ch == '+');
ch == '.' || ((ch == '-' || ch == '+') && chPrev < 0x80 && toupper(chPrev) == 'E'));
}
typedef unsigned int sql_state_t;
class SQLStates {
public :
@ -69,7 +70,7 @@ public :
sqlStatement.Set(lineNumber, sqlStatesLine);
}
unsigned short int IgnoreWhen (unsigned short int sqlStatesLine, bool enable) {
sql_state_t IgnoreWhen (sql_state_t sqlStatesLine, bool enable) {
if (enable)
sqlStatesLine |= MASK_IGNORE_WHEN;
else
@ -78,7 +79,7 @@ public :
return sqlStatesLine;
}
unsigned short int IntoCondition (unsigned short int sqlStatesLine, bool enable) {
sql_state_t IntoCondition (sql_state_t sqlStatesLine, bool enable) {
if (enable)
sqlStatesLine |= MASK_INTO_CONDITION;
else
@ -87,7 +88,7 @@ public :
return sqlStatesLine;
}
unsigned short int IntoExceptionBlock (unsigned short int sqlStatesLine, bool enable) {
sql_state_t IntoExceptionBlock (sql_state_t sqlStatesLine, bool enable) {
if (enable)
sqlStatesLine |= MASK_INTO_EXCEPTION;
else
@ -96,7 +97,7 @@ public :
return sqlStatesLine;
}
unsigned short int IntoDeclareBlock (unsigned short int sqlStatesLine, bool enable) {
sql_state_t IntoDeclareBlock (sql_state_t sqlStatesLine, bool enable) {
if (enable)
sqlStatesLine |= MASK_INTO_DECLARE;
else
@ -105,7 +106,7 @@ public :
return sqlStatesLine;
}
unsigned short int IntoMergeStatement (unsigned short int sqlStatesLine, bool enable) {
sql_state_t IntoMergeStatement (sql_state_t sqlStatesLine, bool enable) {
if (enable)
sqlStatesLine |= MASK_MERGE_STATEMENT;
else
@ -114,7 +115,7 @@ public :
return sqlStatesLine;
}
unsigned short int CaseMergeWithoutWhenFound (unsigned short int sqlStatesLine, bool found) {
sql_state_t CaseMergeWithoutWhenFound (sql_state_t sqlStatesLine, bool found) {
if (found)
sqlStatesLine |= MASK_CASE_MERGE_WITHOUT_WHEN_FOUND;
else
@ -122,7 +123,7 @@ public :
return sqlStatesLine;
}
unsigned short int IntoSelectStatementOrAssignment (unsigned short int sqlStatesLine, bool found) {
sql_state_t IntoSelectStatementOrAssignment (sql_state_t sqlStatesLine, bool found) {
if (found)
sqlStatesLine |= MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT;
else
@ -130,67 +131,109 @@ public :
return sqlStatesLine;
}
unsigned short int BeginCaseBlock (unsigned short int sqlStatesLine) {
sql_state_t BeginCaseBlock (sql_state_t sqlStatesLine) {
if ((sqlStatesLine & MASK_NESTED_CASES) < MASK_NESTED_CASES) {
sqlStatesLine++;
}
return sqlStatesLine;
}
unsigned short int EndCaseBlock (unsigned short int sqlStatesLine) {
sql_state_t EndCaseBlock (sql_state_t sqlStatesLine) {
if ((sqlStatesLine & MASK_NESTED_CASES) > 0) {
sqlStatesLine--;
}
return sqlStatesLine;
}
bool IsIgnoreWhen (unsigned short int sqlStatesLine) {
sql_state_t IntoCreateStatement (sql_state_t sqlStatesLine, bool enable) {
if (enable)
sqlStatesLine |= MASK_INTO_CREATE;
else
sqlStatesLine &= ~MASK_INTO_CREATE;
return sqlStatesLine;
}
sql_state_t IntoCreateViewStatement (sql_state_t sqlStatesLine, bool enable) {
if (enable)
sqlStatesLine |= MASK_INTO_CREATE_VIEW;
else
sqlStatesLine &= ~MASK_INTO_CREATE_VIEW;
return sqlStatesLine;
}
sql_state_t IntoCreateViewAsStatement (sql_state_t sqlStatesLine, bool enable) {
if (enable)
sqlStatesLine |= MASK_INTO_CREATE_VIEW_AS_STATEMENT;
else
sqlStatesLine &= ~MASK_INTO_CREATE_VIEW_AS_STATEMENT;
return sqlStatesLine;
}
bool IsIgnoreWhen (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_IGNORE_WHEN) != 0;
}
bool IsIntoCondition (unsigned short int sqlStatesLine) {
bool IsIntoCondition (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_INTO_CONDITION) != 0;
}
bool IsIntoCaseBlock (unsigned short int sqlStatesLine) {
bool IsIntoCaseBlock (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_NESTED_CASES) != 0;
}
bool IsIntoExceptionBlock (unsigned short int sqlStatesLine) {
bool IsIntoExceptionBlock (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_INTO_EXCEPTION) != 0;
}
bool IsIntoSelectStatementOrAssignment (unsigned short int sqlStatesLine) {
bool IsIntoSelectStatementOrAssignment (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT) != 0;
}
bool IsCaseMergeWithoutWhenFound (unsigned short int sqlStatesLine) {
bool IsCaseMergeWithoutWhenFound (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_CASE_MERGE_WITHOUT_WHEN_FOUND) != 0;
}
bool IsIntoDeclareBlock (unsigned short int sqlStatesLine) {
bool IsIntoDeclareBlock (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_INTO_DECLARE) != 0;
}
bool IsIntoMergeStatement (unsigned short int sqlStatesLine) {
bool IsIntoMergeStatement (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_MERGE_STATEMENT) != 0;
}
unsigned short int ForLine(int lineNumber) {
bool IsIntoCreateStatement (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_INTO_CREATE) != 0;
}
bool IsIntoCreateViewStatement (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_INTO_CREATE_VIEW) != 0;
}
bool IsIntoCreateViewAsStatement (sql_state_t sqlStatesLine) {
return (sqlStatesLine & MASK_INTO_CREATE_VIEW_AS_STATEMENT) != 0;
}
sql_state_t ForLine(int lineNumber) {
return sqlStatement.ValueAt(lineNumber);
}
SQLStates() {}
private :
SparseState <unsigned short int> sqlStatement;
SparseState <sql_state_t> sqlStatement;
enum {
MASK_NESTED_CASES = 0x01FF,
MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT = 0x0200,
MASK_CASE_MERGE_WITHOUT_WHEN_FOUND = 0x0400,
MASK_MERGE_STATEMENT = 0x0800,
MASK_INTO_DECLARE = 0x1000,
MASK_INTO_EXCEPTION = 0x2000,
MASK_INTO_CONDITION = 0x4000,
MASK_IGNORE_WHEN = 0x8000
MASK_NESTED_CASES = 0x0001FF,
MASK_INTO_SELECT_STATEMENT_OR_ASSIGNEMENT = 0x000200,
MASK_CASE_MERGE_WITHOUT_WHEN_FOUND = 0x000400,
MASK_MERGE_STATEMENT = 0x000800,
MASK_INTO_DECLARE = 0x001000,
MASK_INTO_EXCEPTION = 0x002000,
MASK_INTO_CONDITION = 0x004000,
MASK_IGNORE_WHEN = 0x008000,
MASK_INTO_CREATE = 0x010000,
MASK_INTO_CREATE_VIEW = 0x020000,
MASK_INTO_CREATE_VIEW_AS_STATEMENT = 0x040000
};
};
@ -401,6 +444,7 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
StyleContext sc(startPos, length, initStyle, styler);
int styleBeforeDCKeyword = SCE_SQL_DEFAULT;
int offset = 0;
for (; sc.More(); sc.Forward(), offset++) {
// Determine if the current state should terminate.
switch (sc.state) {
@ -409,7 +453,7 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
break;
case SCE_SQL_NUMBER:
// We stop the number definition on non-numerical non-dot non-eE non-sign char
if (!IsANumberChar(sc.ch)) {
if (!IsANumberChar(sc.ch, sc.chPrev)) {
sc.SetState(SCE_SQL_DEFAULT);
}
break;
@ -513,11 +557,45 @@ void SCI_METHOD LexerSQL::Lex(unsigned int startPos, int length, int initStyle,
}
}
break;
case SCE_SQL_QOPERATOR:
// Locate the unique Q operator character
sc.Complete();
char qOperator = 0x00;
for (int styleStartPos = sc.currentPos; styleStartPos > 0; --styleStartPos) {
if (styler.StyleAt(styleStartPos - 1) != SCE_SQL_QOPERATOR) {
qOperator = styler.SafeGetCharAt(styleStartPos + 2);
break;
}
}
char qComplement = 0x00;
if (qOperator == '<') {
qComplement = '>';
} else if (qOperator == '(') {
qComplement = ')';
} else if (qOperator == '{') {
qComplement = '}';
} else if (qOperator == '[') {
qComplement = ']';
} else {
qComplement = qOperator;
}
if (sc.Match(qComplement, '\'')) {
sc.Forward();
sc.ForwardSetState(SCE_SQL_DEFAULT);
}
break;
}
// Determine if a new state should be entered.
if (sc.state == SCE_SQL_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
if (sc.Match('q', '\'') || sc.Match('Q', '\'')) {
sc.SetState(SCE_SQL_QOPERATOR);
sc.Forward();
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)) ||
((sc.ch == '-' || sc.ch == '+') && IsADigit(sc.chNext) && !IsADigit(sc.chPrev))) {
sc.SetState(SCE_SQL_NUMBER);
} else if (IsAWordStart(sc.ch)) {
sc.SetState(SCE_SQL_IDENTIFIER);
@ -561,12 +639,46 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
if (lineCurrent > 0) {
// Backtrack to previous line in case need to fix its fold status for folding block of single-line comments (i.e. '--').
lineCurrent -= 1;
startPos = styler.LineStart(lineCurrent);
int lastNLPos = -1;
// And keep going back until we find an operator ';' followed
// by white-space and/or comments. This will improve folding.
while (--startPos > 0) {
char ch = styler[startPos];
if (ch == '\n' || (ch == '\r' && styler[startPos + 1] != '\n')) {
lastNLPos = startPos;
} else if (ch == ';' &&
styler.StyleAt(startPos) == SCE_SQL_OPERATOR) {
bool isAllClear = true;
for (int tempPos = startPos + 1;
tempPos < lastNLPos;
++tempPos) {
int tempStyle = styler.StyleAt(tempPos);
if (!IsCommentStyle(tempStyle)
&& tempStyle != SCE_SQL_DEFAULT) {
isAllClear = false;
break;
}
}
if (isAllClear) {
startPos = lastNLPos + 1;
break;
}
}
}
lineCurrent = styler.GetLine(startPos);
if (lineCurrent > 0)
levelCurrent = styler.LevelAt(lineCurrent - 1) >> 16;
}
// And because folding ends at ';', keep going until we find one
// Otherwise if create ... view ... as is split over multiple
// lines the folding won't always update immediately.
unsigned int docLength = styler.Length();
for (; endPos < docLength; ++endPos) {
if (styler.SafeGetCharAt(endPos) == ';') {
break;
}
}
int levelNext = levelCurrent;
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
@ -576,7 +688,7 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
// this statementFound flag avoids to fold when the statement is on only one line by ignoring ELSE or ELSIF
// eg. "IF condition1 THEN ... ELSIF condition2 THEN ... ELSE ... END IF;"
bool statementFound = false;
unsigned short int sqlStatesCurrentLine = 0;
sql_state_t sqlStatesCurrentLine = 0;
if (!options.foldOnlyBegin) {
sqlStatesCurrentLine = sqlStates.ForLine(lineCurrent);
}
@ -606,6 +718,16 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
}
if (sqlStates.IsIntoSelectStatementOrAssignment(sqlStatesCurrentLine))
sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, false);
if (sqlStates.IsIntoCreateStatement(sqlStatesCurrentLine)) {
if (sqlStates.IsIntoCreateViewStatement(sqlStatesCurrentLine)) {
if (sqlStates.IsIntoCreateViewAsStatement(sqlStatesCurrentLine)) {
levelNext--;
sqlStatesCurrentLine = sqlStates.IntoCreateViewAsStatement(sqlStatesCurrentLine, false);
}
sqlStatesCurrentLine = sqlStates.IntoCreateViewStatement(sqlStatesCurrentLine, false);
}
sqlStatesCurrentLine = sqlStates.IntoCreateStatement(sqlStatesCurrentLine, false);
}
}
if (ch == ':' && chNext == '=' && !IsCommentStyle(style))
sqlStatesCurrentLine = sqlStates.IntoSelectStatementOrAssignment(sqlStatesCurrentLine, true);
@ -805,6 +927,19 @@ void SCI_METHOD LexerSQL::Fold(unsigned int startPos, int length, int initStyle,
sqlStatesCurrentLine = sqlStates.CaseMergeWithoutWhenFound(sqlStatesCurrentLine, true);
levelNext++;
statementFound = true;
} else if ((!options.foldOnlyBegin) &&
strcmp(s, "create") == 0) {
sqlStatesCurrentLine = sqlStates.IntoCreateStatement(sqlStatesCurrentLine, true);
} else if ((!options.foldOnlyBegin) &&
strcmp(s, "view") == 0 &&
sqlStates.IsIntoCreateStatement(sqlStatesCurrentLine)) {
sqlStatesCurrentLine = sqlStates.IntoCreateViewStatement(sqlStatesCurrentLine, true);
} else if ((!options.foldOnlyBegin) &&
strcmp(s, "as") == 0 &&
sqlStates.IsIntoCreateViewStatement(sqlStatesCurrentLine) &&
! sqlStates.IsIntoCreateViewAsStatement(sqlStatesCurrentLine)) {
sqlStatesCurrentLine = sqlStates.IntoCreateViewAsStatement(sqlStatesCurrentLine, true);
levelNext++;
}
}
if (atEOL) {

View File

@ -85,17 +85,22 @@ static void ColouriseSTTXTDoc (unsigned int startPos, int length, int initStyle,
break;
}
case SCE_STTXT_HEXNUMBER: {
if(setHexNumber.Contains(sc.ch))
if (setHexNumber.Contains(sc.ch))
continue;
else if(setDataTime.Contains(sc.ch))
sc.SetState(SCE_STTXT_DATETIME);
sc.ChangeState(SCE_STTXT_DATETIME);
else if(setWord.Contains(sc.ch))
sc.ChangeState(SCE_STTXT_DEFAULT);
else
sc.SetState(SCE_STTXT_DEFAULT);
break;
}
case SCE_STTXT_DATETIME: {
if(!setDataTime.Contains(sc.ch))
if (setDataTime.Contains(sc.ch))
continue;
else if(setWord.Contains(sc.ch))
sc.ChangeState(SCE_STTXT_DEFAULT);
else
sc.SetState(SCE_STTXT_DEFAULT);
break;
}

View File

@ -27,7 +27,7 @@ using namespace Scintilla;
static void ClassifyWordSol(unsigned int start, unsigned int end, WordList &keywords, Accessor &styler, char *prevWord)
{
char s[100];
char s[100] = "";
bool wordIsNumber = isdigit(styler[start]) != 0;
for (unsigned int i = 0; i < end - start + 1 && i < 30; i++)
{
@ -127,11 +127,10 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
}
}
styler.StartAt(startPos, 127);
styler.StartAt(startPos);
WordList &keywords = *keywordlists[0];
int whingeLevel = styler.GetPropertyInt("tab.timmy.whinge.level");
char prevWord[200];
prevWord[0] = '\0';
if (length == 0) return;
@ -143,37 +142,9 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
char chPrev2 = ' ';
char chNext = styler[startPos];
styler.StartSegment(startPos);
bool atStartLine = true;
int spaceFlags = 0;
for (int i = startPos; i < lengthDoc; i++)
{
if (atStartLine)
{
char chBad = static_cast<char>(64);
char chGood = static_cast<char>(0);
char chFlags = chGood;
if (whingeLevel == 1)
{
chFlags = (spaceFlags & wsInconsistent) ? chBad : chGood;
}
else if (whingeLevel == 2)
{
chFlags = (spaceFlags & wsSpaceTab) ? chBad : chGood;
}
else if (whingeLevel == 3)
{
chFlags = (spaceFlags & wsSpace) ? chBad : chGood;
}
else if (whingeLevel == 4)
{
chFlags = (spaceFlags & wsTab) ? chBad : chGood;
}
styler.SetFlags(chFlags, static_cast<char>(state));
atStartLine = false;
}
char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
@ -185,7 +156,6 @@ static void ColouriseSolDoc(unsigned int startPos, int length, int initStyle,
{
styler.ColourTo(i, state);
}
atStartLine = true;
}
if (styler.IsLeadByte(ch))

View File

@ -8,10 +8,10 @@
#include <stdlib.h>
#include <string.h>
#include <ctype.h>
#include <stdio.h>
#include <stdarg.h>
#include <assert.h>
#include <ctype.h>
#include "ILexer.h"
#include "Scintilla.h"

View File

@ -60,11 +60,7 @@ static void ColouriseWhiteSpace(StyleContext& sc, bool& apostropheStartsAttribut
static void ColouriseWord(StyleContext& sc, WordList& keywords, WordList& keywords2, WordList& keywords3, bool& apostropheStartsAttribute);
static inline bool IsDelimiterCharacter(int ch);
static inline bool IsNumberStartCharacter(int ch);
static inline bool IsNumberCharacter(int ch);
static inline bool IsSeparatorOrDelimiterCharacter(int ch);
static inline bool IsWordStartCharacter(int ch);
static inline bool IsWordCharacter(int ch);
static void ColouriseComment(StyleContext& sc, bool&) {
sc.SetState(SCE_SPICE_COMMENTLINE);
@ -205,27 +201,6 @@ static inline bool IsDelimiterCharacter(int ch) {
}
}
static inline bool IsNumberCharacter(int ch) {
return IsNumberStartCharacter(ch) ||
ch == '_' ||
ch == '.' ||
ch == '#' ||
(ch >= 'a' && ch <= 'f') ||
(ch >= 'A' && ch <= 'F');
}
static inline bool IsNumberStartCharacter(int ch) {
return IsADigit(ch);
}
static inline bool IsSeparatorOrDelimiterCharacter(int ch) {
return IsASpace(ch) || IsDelimiterCharacter(ch);
}
static inline bool IsWordCharacter(int ch) {
return IsWordStartCharacter(ch) || IsADigit(ch);
}
static inline bool IsWordStartCharacter(int ch) {
return (isascii(ch) && isalpha(ch)) || ch == '_';
}

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