Upgrade Scintilla component to 3.6.6.

This commit is contained in:
Paul Kulchenko 2016-05-23 21:17:00 -07:00
parent d81fb0be63
commit c03ce59b86
34 changed files with 835 additions and 549 deletions

View File

@ -267,6 +267,7 @@ WXSCINTILLA_OBJECTS = \
wxscintilla_LexHex.o \
wxscintilla_LexHTML.o \
wxscintilla_LexInno.o \
wxscintilla_LexJSON.o \
wxscintilla_LexKix.o \
wxscintilla_LexKVIrc.o \
wxscintilla_LexLaTeX.o \
@ -15279,6 +15280,9 @@ wxscintilla_LexHTML.o: $(srcdir)/src/stc/scintilla/lexers/LexHTML.cxx
wxscintilla_LexInno.o: $(srcdir)/src/stc/scintilla/lexers/LexInno.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexInno.cxx
wxscintilla_LexJSON.o: $(srcdir)/src/stc/scintilla/lexers/LexJSON.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexJSON.cxx
wxscintilla_LexKix.o: $(srcdir)/src/stc/scintilla/lexers/LexKix.cxx
$(CXXC) -c -o $@ $(WXSCINTILLA_CXXFLAGS) $(srcdir)/src/stc/scintilla/lexers/LexKix.cxx

View File

@ -100,6 +100,7 @@
src/stc/scintilla/lexers/LexHex.cxx
src/stc/scintilla/lexers/LexHTML.cxx
src/stc/scintilla/lexers/LexInno.cxx
src/stc/scintilla/lexers/LexJSON.cxx
src/stc/scintilla/lexers/LexKix.cxx
src/stc/scintilla/lexers/LexKVIrc.cxx
src/stc/scintilla/lexers/LexLaTeX.cxx

View File

@ -560,6 +560,7 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_LEX_SREC 117
#define wxSTC_LEX_IHEX 118
#define wxSTC_LEX_TEHEX 119
#define wxSTC_LEX_JSON 120
/// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
/// value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -2432,6 +2433,24 @@ class WXDLLIMPEXP_FWD_CORE wxScrollBar;
#define wxSTC_HEX_CHECKSUM_WRONG 17
#define wxSTC_HEX_GARBAGE 18
/// Lexical state for SCLEX_IHEX (shared with Srec)
/// Lexical state for SCLEX_TEHEX (shared with Srec)
/// Lexical states for SCLEX_JSON
#define wxSTC_JSON_DEFAULT 0
#define wxSTC_JSON_NUMBER 1
#define wxSTC_JSON_STRING 2
#define wxSTC_JSON_STRINGEOL 3
#define wxSTC_JSON_PROPERTYNAME 4
#define wxSTC_JSON_ESCAPESEQUENCE 5
#define wxSTC_JSON_LINECOMMENT 6
#define wxSTC_JSON_BLOCKCOMMENT 7
#define wxSTC_JSON_OPERATOR 8
#define wxSTC_JSON_URI 9
#define wxSTC_JSON_COMPACTIRI 10
#define wxSTC_JSON_KEYWORD 11
#define wxSTC_JSON_LDKEYWORD 12
#define wxSTC_JSON_ERROR 13
//}}}
//----------------------------------------------------------------------

View File

@ -516,6 +516,7 @@
#define wxSTC_LEX_SREC 117
#define wxSTC_LEX_IHEX 118
#define wxSTC_LEX_TEHEX 119
#define wxSTC_LEX_JSON 120
/// When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
/// value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -2388,6 +2389,24 @@
#define wxSTC_HEX_CHECKSUM_WRONG 17
#define wxSTC_HEX_GARBAGE 18
/// Lexical state for SCLEX_IHEX (shared with Srec)
/// Lexical state for SCLEX_TEHEX (shared with Srec)
/// Lexical states for SCLEX_JSON
#define wxSTC_JSON_DEFAULT 0
#define wxSTC_JSON_NUMBER 1
#define wxSTC_JSON_STRING 2
#define wxSTC_JSON_STRINGEOL 3
#define wxSTC_JSON_PROPERTYNAME 4
#define wxSTC_JSON_ESCAPESEQUENCE 5
#define wxSTC_JSON_LINECOMMENT 6
#define wxSTC_JSON_BLOCKCOMMENT 7
#define wxSTC_JSON_OPERATOR 8
#define wxSTC_JSON_URI 9
#define wxSTC_JSON_COMPACTIRI 10
#define wxSTC_JSON_KEYWORD 11
#define wxSTC_JSON_LDKEYWORD 12
#define wxSTC_JSON_ERROR 13
//}}}
// Commands that can be bound to keystrokes {{{

View File

@ -1085,7 +1085,6 @@ def processIface(iface, h_tmplt, cpp_tmplt, ih_tmplt, h_dest, cpp_dest, docstr_d
else:
print('***** Unknown line type: %s' % line)
# process templates
data = {}
data['VALUES'] = processVals(values)

View File

@ -3,7 +3,7 @@ directories from the Scintilla source distribution. All other code
needed to implement Scintilla on top of wxWidgets is located in the
directory above this one.
The current version of the Scintilla code is 3.6.3
The current version of the Scintilla code is 3.6.6
These are the basic steps needed to update the version of Scintilla used by wxSTC.
@ -56,6 +56,17 @@ interface/wx/stc/stc.h, also check any documentation-only changes from
Scintilla.iface and see if the existing docs for those items should be
updated too.
10. Build and test.
10. Apply the fix for scintilla/src/UniConversion.h based on commit by
Vadim Zeitlin <vadim@wxwidgets.org> from March 5th, 2016.
11. Submit patch to wxTrac.
This is required to avoid gcc warnings (and possibly errors with other
compilers) about ambiguous comparison operators due to our (wchar_t,
wxUniChar) overloads defined in wx/unichar.h.
-inline unsigned int UTF16CharLength(wchar_t uch) {
+inline unsigned int UTF16CharLength(wchar_t wch) {
+ const int uch = wch;
11. Build and test.
12. Submit patch to wxTrac.

View File

@ -132,6 +132,7 @@
#define SCLEX_SREC 117
#define SCLEX_IHEX 118
#define SCLEX_TEHEX 119
#define SCLEX_JSON 120
#define SCLEX_AUTOMATIC 1000
#define SCE_P_DEFAULT 0
#define SCE_P_COMMENTLINE 1
@ -1787,6 +1788,20 @@
#define SCE_HEX_CHECKSUM 16
#define SCE_HEX_CHECKSUM_WRONG 17
#define SCE_HEX_GARBAGE 18
#define SCE_JSON_DEFAULT 0
#define SCE_JSON_NUMBER 1
#define SCE_JSON_STRING 2
#define SCE_JSON_STRINGEOL 3
#define SCE_JSON_PROPERTYNAME 4
#define SCE_JSON_ESCAPESEQUENCE 5
#define SCE_JSON_LINECOMMENT 6
#define SCE_JSON_BLOCKCOMMENT 7
#define SCE_JSON_OPERATOR 8
#define SCE_JSON_URI 9
#define SCE_JSON_COMPACTIRI 10
#define SCE_JSON_KEYWORD 11
#define SCE_JSON_LDKEYWORD 12
#define SCE_JSON_ERROR 13
/* --Autogenerated -- end of section automatically generated from Scintilla.iface */
#endif

View File

@ -1121,6 +1121,13 @@ struct Sci_RangeToFormat {
#define RangeToFormat Sci_RangeToFormat
#ifndef __cplusplus
/* For the GTK+ platform, g-ir-scanner needs to have these typedefs. This
* is not required in C++ code and actually seems to break ScintillaEditPy */
typedef struct Sci_NotifyHeader Sci_NotifyHeader;
typedef struct SCNotification SCNotification;
#endif
struct Sci_NotifyHeader {
/* Compatible with Windows NMHDR.
* hwndFrom is really an environment specific window handle or pointer
@ -1133,7 +1140,7 @@ struct Sci_NotifyHeader {
#define NotifyHeader Sci_NotifyHeader
struct SCNotification {
struct Sci_NotifyHeader nmhdr;
Sci_NotifyHeader nmhdr;
Sci_Position position;
/* SCN_STYLENEEDED, SCN_DOUBLECLICK, SCN_MODIFIED, SCN_MARGINCLICK, */
/* SCN_NEEDSHOWN, SCN_DWELLSTART, SCN_DWELLEND, SCN_CALLTIPCLICK, */

View File

@ -2799,6 +2799,7 @@ val SCLEX_BIBTEX=116
val SCLEX_SREC=117
val SCLEX_IHEX=118
val SCLEX_TEHEX=119
val SCLEX_JSON=120
# When a lexer specifies its language as SCLEX_AUTOMATIC it receives a
# value assigned in sequence from SCLEX_AUTOMATIC+1.
@ -4677,6 +4678,22 @@ val SCE_HEX_GARBAGE=18
lex IHex=SCLEX_IHEX SCE_HEX_
# Lexical state for SCLEX_TEHEX (shared with Srec)
lex TEHex=SCLEX_TEHEX SCE_HEX_
# Lexical states for SCLEX_JSON
lex JSON=SCLEX_JSON SCE_JSON_
val SCE_JSON_DEFAULT=0
val SCE_JSON_NUMBER=1
val SCE_JSON_STRING=2
val SCE_JSON_STRINGEOL=3
val SCE_JSON_PROPERTYNAME=4
val SCE_JSON_ESCAPESEQUENCE=5
val SCE_JSON_LINECOMMENT=6
val SCE_JSON_BLOCKCOMMENT=7
val SCE_JSON_OPERATOR=8
val SCE_JSON_URI=9
val SCE_JSON_COMPACTIRI=10
val SCE_JSON_KEYWORD=11
val SCE_JSON_LDKEYWORD=12
val SCE_JSON_ERROR=13
# Events
@ -4712,7 +4729,7 @@ evt void FocusIn=2028(void)
evt void FocusOut=2029(void)
evt void AutoCCompleted=2030(string text, int position, int ch, CompletionMethods listCompletionMethod)
# There are no provisional features currently
# There are no provisional APIs currently, but some arguments to SCI_SETTECHNOLOGY are provisional.
cat Provisional

View File

@ -38,13 +38,17 @@ struct _ScintillaObject {
struct _ScintillaClass {
GtkContainerClass parent_class;
void (* command) (ScintillaObject *ttt);
void (* notify) (ScintillaObject *ttt);
void (* command) (ScintillaObject *sci, int cmd, GtkWidget *window);
void (* notify) (ScintillaObject *sci, int id, SCNotification *scn);
};
GType scintilla_object_get_type (void);
GtkWidget* scintilla_object_new (void);
long scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam);
gintptr scintilla_object_send_message (ScintillaObject *sci, unsigned int iMessage, guintptr wParam, gintptr lParam);
GType scnotification_get_type (void);
#define SCINTILLA_TYPE_NOTIFICATION (scnotification_get_type())
#ifndef G_IR_SCANNING
/* The legacy names confuse the g-ir-scanner program */

View File

@ -761,6 +761,9 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
lineCurrent++;
lineEndNext = styler.LineEnd(lineCurrent);
vlls.Add(lineCurrent, preproc);
if (rawStringTerminator != "") {
rawSTNew.Set(lineCurrent-1, rawStringTerminator);
}
sc.Forward();
if (sc.ch == '\r' && sc.chNext == '\n') {
// Even in UTF-8, \r and \n are separate
@ -1349,14 +1352,14 @@ void SCI_METHOD LexerCPP::Fold(Sci_PositionU startPos, Sci_Position length, int
}
}
if (options.foldSyntaxBased && (style == SCE_C_OPERATOR)) {
if (ch == '{' || ch == '[') {
if (ch == '{' || ch == '[' || ch == '(') {
// Measure the minimum before a '{' to allow
// folding on "} else {"
if (levelMinCurrent > levelNext) {
levelMinCurrent = levelNext;
}
levelNext++;
} else if (ch == '}' || ch == ']') {
} else if (ch == '}' || ch == ']' || ch == ')') {
levelNext--;
}
}

View File

@ -828,7 +828,7 @@ static void ColouriseHyperTextDoc(Sci_PositionU startPos, Sci_Position length, i
// handle end of Mako comment line
else if (isMako && makoComment && (ch == '\r' || ch == '\n')) {
makoComment = 0;
styler.ColourTo(i, StateToPrint);
styler.ColourTo(i - 1, StateToPrint);
if (scriptLanguage == eScriptPython) {
state = SCE_HP_DEFAULT;
} else {

View File

@ -0,0 +1,497 @@
// Scintilla source code edit control
/**
* @file LexJSON.cxx
* @date February 19, 2016
* @brief Lexer for JSON and JSON-LD formats
* @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 JSONWordListDesc[] = {
"JSON Keywords",
"JSON-LD Keywords",
0
};
/**
* Used to detect compact IRI/URLs in JSON-LD without first looking ahead for the
* colon separating the prefix and suffix
*
* https://www.w3.org/TR/json-ld/#dfn-compact-iri
*/
struct CompactIRI {
int colonCount;
bool foundInvalidChar;
CharacterSet setCompactIRI;
CompactIRI() {
colonCount = 0;
foundInvalidChar = false;
setCompactIRI = CharacterSet(CharacterSet::setAlpha, "$_-");
}
void resetState() {
colonCount = 0;
foundInvalidChar = false;
}
void checkChar(int ch) {
if (ch == ':') {
colonCount++;
} else {
foundInvalidChar |= !setCompactIRI.Contains(ch);
}
}
bool shouldHighlight() const {
return !foundInvalidChar && colonCount == 1;
}
};
/**
* Keeps track of escaped characters in strings as per:
*
* https://tools.ietf.org/html/rfc7159#section-7
*/
struct EscapeSequence {
int digitsLeft;
CharacterSet setHexDigits;
CharacterSet setEscapeChars;
EscapeSequence() {
digitsLeft = 0;
setHexDigits = CharacterSet(CharacterSet::setDigits, "ABCDEFabcdef");
setEscapeChars = CharacterSet(CharacterSet::setNone, "\\\"tnbfru/");
}
// Returns true if the following character is a valid escaped character
bool newSequence(int nextChar) {
digitsLeft = 0;
if (nextChar == 'u') {
digitsLeft = 5;
} else if (!setEscapeChars.Contains(nextChar)) {
return false;
}
return true;
}
bool atEscapeEnd() const {
return digitsLeft <= 0;
}
bool isInvalidChar(int currChar) const {
return !setHexDigits.Contains(currChar);
}
};
struct OptionsJSON {
bool foldCompact;
bool fold;
bool allowComments;
bool escapeSequence;
OptionsJSON() {
foldCompact = false;
fold = false;
allowComments = false;
escapeSequence = false;
}
};
struct OptionSetJSON : public OptionSet<OptionsJSON> {
OptionSetJSON() {
DefineProperty("lexer.json.escape.sequence", &OptionsJSON::escapeSequence,
"Set to 1 to enable highlighting of escape sequences in strings");
DefineProperty("lexer.json.allow.comments", &OptionsJSON::allowComments,
"Set to 1 to enable highlighting of line/block comments in JSON");
DefineProperty("fold.compact", &OptionsJSON::foldCompact);
DefineProperty("fold", &OptionsJSON::fold);
DefineWordListSets(JSONWordListDesc);
}
};
class LexerJSON : public ILexer {
OptionsJSON options;
OptionSetJSON optSetJSON;
EscapeSequence escapeSeq;
WordList keywordsJSON;
WordList keywordsJSONLD;
CharacterSet setOperators;
CharacterSet setURL;
CharacterSet setKeywordJSONLD;
CharacterSet setKeywordJSON;
CompactIRI compactIRI;
static bool IsNextNonWhitespace(LexAccessor &styler, Sci_Position start, char ch) {
Sci_Position i = 0;
while (i < 50) {
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 colon following the end quote
*
* Assumes property names of lengths no longer than a 100 characters.
* The colon is also expected to be less than 50 spaces after the end
* quote for the string to be considered a property name
*/
static bool AtPropertyName(LexAccessor &styler, Sci_Position start) {
Sci_Position i = 0;
bool escaped = false;
while (i < 100) {
i++;
char curr = styler.SafeGetCharAt(start+i, '\0');
if (escaped) {
escaped = false;
continue;
}
escaped = curr == '\\';
if (curr == '"') {
return IsNextNonWhitespace(styler, start+i, ':');
} else if (!curr) {
return false;
}
}
return false;
}
static bool IsNextWordInList(WordList &keywordList, CharacterSet wordSet,
StyleContext &context, LexAccessor &styler) {
char word[51];
Sci_Position currPos = (Sci_Position) context.currentPos;
int i = 0;
while (i < 50) {
char ch = styler.SafeGetCharAt(currPos + i);
if (!wordSet.Contains(ch)) {
break;
}
word[i] = ch;
i++;
}
word[i] = '\0';
return keywordList.InList(word);
}
public:
LexerJSON() :
setOperators(CharacterSet::setNone, "[{}]:,"),
setURL(CharacterSet::setAlphaNum, "-._~:/?#[]@!$&'()*+,),="),
setKeywordJSONLD(CharacterSet::setAlpha, ":@"),
setKeywordJSON(CharacterSet::setAlpha, "$_") {
}
virtual ~LexerJSON() {}
virtual int SCI_METHOD Version() const {
return lvOriginal;
}
virtual void SCI_METHOD Release() {
delete this;
}
virtual const char *SCI_METHOD PropertyNames() {
return optSetJSON.PropertyNames();
}
virtual int SCI_METHOD PropertyType(const char *name) {
return optSetJSON.PropertyType(name);
}
virtual const char *SCI_METHOD DescribeProperty(const char *name) {
return optSetJSON.DescribeProperty(name);
}
virtual Sci_Position SCI_METHOD PropertySet(const char *key, const char *val) {
if (optSetJSON.PropertySet(&options, key, val)) {
return 0;
}
return -1;
}
virtual Sci_Position SCI_METHOD WordListSet(int n, const char *wl) {
WordList *wordListN = 0;
switch (n) {
case 0:
wordListN = &keywordsJSON;
break;
case 1:
wordListN = &keywordsJSONLD;
break;
}
Sci_Position firstModification = -1;
if (wordListN) {
WordList wlNew;
wlNew.Set(wl);
if (*wordListN != wlNew) {
wordListN->Set(wl);
firstModification = 0;
}
}
return firstModification;
}
virtual void *SCI_METHOD PrivateCall(int, void *) {
return 0;
}
static ILexer *LexerFactoryJSON() {
return new LexerJSON;
}
virtual const char *SCI_METHOD DescribeWordListSets() {
return optSetJSON.DescribeWordListSets();
}
virtual void SCI_METHOD Lex(Sci_PositionU startPos,
Sci_Position length,
int initStyle,
IDocument *pAccess);
virtual void SCI_METHOD Fold(Sci_PositionU startPos,
Sci_Position length,
int initStyle,
IDocument *pAccess);
};
void SCI_METHOD LexerJSON::Lex(Sci_PositionU startPos,
Sci_Position length,
int initStyle,
IDocument *pAccess) {
LexAccessor styler(pAccess);
StyleContext context(startPos, length, initStyle, styler);
int stringStyleBefore = SCE_JSON_STRING;
while (context.More()) {
switch (context.state) {
case SCE_JSON_BLOCKCOMMENT:
if (context.Match("*/")) {
context.Forward();
context.ForwardSetState(SCE_JSON_DEFAULT);
}
break;
case SCE_JSON_LINECOMMENT:
if (context.atLineEnd) {
context.SetState(SCE_JSON_DEFAULT);
}
break;
case SCE_JSON_STRINGEOL:
if (context.atLineStart) {
context.SetState(SCE_JSON_DEFAULT);
}
break;
case SCE_JSON_ESCAPESEQUENCE:
escapeSeq.digitsLeft--;
if (!escapeSeq.atEscapeEnd()) {
if (escapeSeq.isInvalidChar(context.ch)) {
context.SetState(SCE_JSON_ERROR);
}
break;
}
if (context.ch == '"') {
context.SetState(stringStyleBefore);
context.ForwardSetState(SCE_C_DEFAULT);
} else if (context.ch == '\\') {
if (!escapeSeq.newSequence(context.chNext)) {
context.SetState(SCE_JSON_ERROR);
}
context.Forward();
} else {
context.SetState(stringStyleBefore);
if (context.atLineEnd) {
context.ChangeState(SCE_JSON_STRINGEOL);
}
}
break;
case SCE_JSON_PROPERTYNAME:
case SCE_JSON_STRING:
if (context.ch == '"') {
if (compactIRI.shouldHighlight()) {
context.ChangeState(SCE_JSON_COMPACTIRI);
context.ForwardSetState(SCE_JSON_DEFAULT);
compactIRI.resetState();
} else {
context.ForwardSetState(SCE_JSON_DEFAULT);
}
} else if (context.atLineEnd) {
context.ChangeState(SCE_JSON_STRINGEOL);
} else if (context.ch == '\\') {
stringStyleBefore = context.state;
if (options.escapeSequence) {
context.SetState(SCE_JSON_ESCAPESEQUENCE);
if (!escapeSeq.newSequence(context.chNext)) {
context.SetState(SCE_JSON_ERROR);
}
}
context.Forward();
} else if (context.Match("https://") ||
context.Match("http://") ||
context.Match("ssh://") ||
context.Match("git://") ||
context.Match("svn://") ||
context.Match("ftp://") ||
context.Match("mailto:")) {
// Handle most common URI schemes only
stringStyleBefore = context.state;
context.SetState(SCE_JSON_URI);
} else if (context.ch == '@') {
// https://www.w3.org/TR/json-ld/#dfn-keyword
if (IsNextWordInList(keywordsJSONLD, setKeywordJSONLD, context, styler)) {
stringStyleBefore = context.state;
context.SetState(SCE_JSON_LDKEYWORD);
}
} else {
compactIRI.checkChar(context.ch);
}
break;
case SCE_JSON_LDKEYWORD:
case SCE_JSON_URI:
if ((!setKeywordJSONLD.Contains(context.ch) &&
(context.state == SCE_JSON_LDKEYWORD)) ||
(!setURL.Contains(context.ch))) {
context.SetState(stringStyleBefore);
}
if (context.ch == '"') {
context.ForwardSetState(SCE_JSON_DEFAULT);
} else if (context.atLineEnd) {
context.ChangeState(SCE_JSON_STRINGEOL);
}
break;
case SCE_JSON_OPERATOR:
case SCE_JSON_NUMBER:
context.SetState(SCE_JSON_DEFAULT);
break;
case SCE_JSON_ERROR:
if (context.atLineEnd) {
context.SetState(SCE_JSON_DEFAULT);
}
break;
case SCE_JSON_KEYWORD:
if (!setKeywordJSON.Contains(context.ch)) {
context.SetState(SCE_JSON_DEFAULT);
}
break;
}
if (context.state == SCE_JSON_DEFAULT) {
if (context.ch == '"') {
compactIRI.resetState();
context.SetState(SCE_JSON_STRING);
Sci_Position currPos = static_cast<Sci_Position>(context.currentPos);
if (AtPropertyName(styler, currPos)) {
context.SetState(SCE_JSON_PROPERTYNAME);
}
} else if (setOperators.Contains(context.ch)) {
context.SetState(SCE_JSON_OPERATOR);
} else if (options.allowComments && context.Match("/*")) {
context.SetState(SCE_JSON_BLOCKCOMMENT);
context.Forward();
} else if (options.allowComments && context.Match("//")) {
context.SetState(SCE_JSON_LINECOMMENT);
} else if (setKeywordJSON.Contains(context.ch)) {
if (IsNextWordInList(keywordsJSON, setKeywordJSON, context, styler)) {
context.SetState(SCE_JSON_KEYWORD);
}
}
bool numberStart =
IsADigit(context.ch) && (context.chPrev == '+'||
context.chPrev == '-' ||
context.atLineStart ||
IsASpace(context.chPrev) ||
setOperators.Contains(context.chPrev));
bool exponentPart =
tolower(context.ch) == 'e' &&
IsADigit(context.chPrev) &&
(IsADigit(context.chNext) ||
context.chNext == '+' ||
context.chNext == '-');
bool signPart =
(context.ch == '-' || context.ch == '+') &&
((tolower(context.chPrev) == 'e' && IsADigit(context.chNext)) ||
((IsASpace(context.chPrev) || setOperators.Contains(context.chPrev))
&& IsADigit(context.chNext)));
bool adjacentDigit =
IsADigit(context.ch) && IsADigit(context.chPrev);
bool afterExponent = IsADigit(context.ch) && tolower(context.chPrev) == 'e';
bool dotPart = context.ch == '.' &&
IsADigit(context.chPrev) &&
IsADigit(context.chNext);
bool afterDot = IsADigit(context.ch) && context.chPrev == '.';
if (numberStart ||
exponentPart ||
signPart ||
adjacentDigit ||
dotPart ||
afterExponent ||
afterDot) {
context.SetState(SCE_JSON_NUMBER);
} else if (context.state == SCE_JSON_DEFAULT && !IsASpace(context.ch)) {
context.SetState(SCE_JSON_ERROR);
}
}
context.Forward();
}
context.Complete();
}
void SCI_METHOD LexerJSON::Fold(Sci_PositionU startPos,
Sci_Position length,
int,
IDocument *pAccess) {
if (!options.fold) {
return;
}
LexAccessor styler(pAccess);
Sci_PositionU currLine = styler.GetLine(startPos);
Sci_PositionU endPos = startPos + length;
int currLevel = styler.LevelAt(currLine) & SC_FOLDLEVELNUMBERMASK;
int nextLevel = currLevel;
int visibleChars = 0;
for (Sci_PositionU i = startPos; i < endPos; i++) {
char curr = styler.SafeGetCharAt(i);
char next = styler.SafeGetCharAt(i+1);
bool atEOL = (curr == '\r' && next != '\n') || (curr == '\n');
if (styler.StyleAt(i) == SCE_JSON_OPERATOR) {
if (curr == '{' || curr == '[') {
nextLevel++;
} else if (curr == '}' || curr == ']') {
nextLevel--;
}
}
if (atEOL || i == (endPos-1)) {
int level = currLevel;
if (!visibleChars && options.foldCompact) {
level |= SC_FOLDLEVELWHITEFLAG;
} else if (nextLevel > currLevel) {
level |= SC_FOLDLEVELHEADERFLAG;
}
if (level != styler.LevelAt(currLine)) {
styler.SetLevel(currLine, level);
}
currLine++;
currLevel = nextLevel;
visibleChars = 0;
}
if (!isspacechar(curr)) {
visibleChars++;
}
}
}
LexerModule lmJSON(SCLEX_JSON,
LexerJSON::LexerFactoryJSON,
"json",
JSONWordListDesc);

View File

@ -9,7 +9,6 @@
/** TODO:
WebSpeed support in html lexer
Support "end triggers" expression of the triggers phrase
Support more than 6 comments levels
**/
#include <stdlib.h>
#include <string.h>
@ -44,13 +43,26 @@ static inline bool IsAWordStart(int ch) {
enum SentenceStart { SetSentenceStart = 0xf, ResetSentenceStart = 0x10}; // true -> bit = 0
static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
Accessor &styler) {
WordList &keywords1 = *keywordlists[0]; // regular keywords
WordList &keywords2 = *keywordlists[1]; // block opening keywords, only when SentenceStart
WordList &keywords3 = *keywordlists[2]; // block opening keywords
//WordList &keywords4 = *keywordlists[3]; // preprocessor keywords. Not implemented
WordList &keywords1 = *keywordlists[0]; // regular keywords
WordList &keywords2 = *keywordlists[1]; // block opening keywords, only when SentenceStart
WordList &keywords3 = *keywordlists[2]; // block opening keywords
//WordList &keywords4 = *keywordlists[3]; // preprocessor keywords. Not implemented
Sci_Position currentLine = styler.GetLine(startPos);
// Initialize the block comment /* */ nesting level, if we are inside such a comment.
int blockCommentLevel = 0;
if (initStyle == SCE_4GL_COMMENT1 ||
initStyle == SCE_4GL_COMMENT1_) {
blockCommentLevel = styler.GetLineState(currentLine - 1);
}
// Do not leak single-line comments onto next line
if (initStyle == SCE_4GL_COMMENT2 ||
initStyle == SCE_4GL_COMMENT2_) {
initStyle = SCE_4GL_DEFAULT;
}
int visibleChars = 0;
int mask;
@ -65,6 +77,19 @@ static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int ini
visibleChars = 0;
}
if (sc.atLineEnd) {
// Update the line state, so it can be seen by next line
currentLine = styler.GetLine(sc.currentPos);
if (sc.state == SCE_4GL_COMMENT1 ||
sc.state == SCE_4GL_COMMENT1_) {
// Inside a block comment, we set the line state
styler.SetLineState(currentLine, blockCommentLevel);
} else {
// Reset the line state
styler.SetLineState(currentLine, 0);
}
}
// Handle line continuation generically.
if ((sc.state & 0xf) < SCE_4GL_COMMENT1) {
if (sc.ch == '~') {
@ -96,7 +121,9 @@ static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int ini
sc.SetState(SCE_4GL_DEFAULT | mask);
break;
case SCE_4GL_NUMBER:
if (!(IsADigit(sc.ch))) {
// Hex numbers (0xnnnn) are supported so accept any
// alphanumeric character if it follows a leading digit.
if (!(IsAlphaNumeric(sc.ch))) {
sc.SetState(SCE_4GL_DEFAULT | mask);
}
break;
@ -104,10 +131,10 @@ static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int ini
if (!IsAWordChar(sc.ch) && sc.ch != '-') {
char s[1000];
sc.GetCurrentLowered(s, sizeof(s));
if ((((sc.state & 0x10) == 0) && keywords2.InList(s)) || keywords3.InList(s)) {
if ((((sc.state & 0x10) == 0) && keywords2.InListAbbreviated(s, '(')) || keywords3.InListAbbreviated(s, '(')) {
sc.ChangeState(SCE_4GL_BLOCK | ResetSentenceStart);
}
else if (keywords1.InList(s)) {
else if (keywords1.InListAbbreviated(s, '(')) {
if ((s[0] == 'e' && s[1] =='n' && s[2] == 'd' && !isalnum(s[3]) && s[3] != '-') ||
(s[0] == 'f' && s[1] =='o' && s[2] == 'r' && s[3] == 'w' && s[4] =='a' && s[5] == 'r' && s[6] == 'd'&& !isalnum(s[7]))) {
sc.ChangeState(SCE_4GL_END | ResetSentenceStart);
@ -141,20 +168,23 @@ static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int ini
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
}
break;
default:
if ((sc.state & 0xf) >= SCE_4GL_COMMENT1) {
if (sc.ch == '*' && sc.chNext == '/') {
sc.Forward();
if ((sc.state & 0xf) == SCE_4GL_COMMENT1) {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
}
else
sc.SetState((sc.state & 0x1f) - 1);
} else if (sc.ch == '/' && sc.chNext == '*') {
sc.Forward();
sc.SetState((sc.state & 0x1f) + 1);
case SCE_4GL_COMMENT1:
if (sc.Match('/', '*')) {
blockCommentLevel++;
sc.Forward();
} else if (sc.Match('*', '/') && blockCommentLevel > 0) {
blockCommentLevel--;
sc.Forward();
if (blockCommentLevel == 0) {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
}
}
break;
case SCE_4GL_COMMENT2:
if (sc.atLineEnd) {
sc.ForwardSetState(SCE_4GL_DEFAULT | mask);
}
break;
}
// Determine if a new state should be entered.
@ -164,9 +194,13 @@ static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int ini
sc.SetState(SCE_4GL_NUMBER | ResetSentenceStart);
} else if (IsAWordStart(sc.ch) || (sc.ch == '@')) {
sc.SetState(SCE_4GL_IDENTIFIER | mask);
} else if (sc.ch == '/' && sc.chNext == '*') {
} else if (sc.Match('/', '*')) {
blockCommentLevel = 1;
sc.SetState(SCE_4GL_COMMENT1 | mask);
sc.Forward();
} else if (sc.Match('/', '/') &&
(sc.atLineStart || sc.chPrev == ' ' || sc.chPrev == '\t')) {
sc.SetState(SCE_4GL_COMMENT2 | mask);
} else if (sc.ch == '\"') {
sc.SetState(SCE_4GL_STRING | ResetSentenceStart);
} else if (sc.ch == '\'') {
@ -199,7 +233,7 @@ static void Colourise4glDoc(Sci_PositionU startPos, Sci_Position length, int ini
}
static bool IsStreamCommentStyle(int style) {
return (style & 0xf) >= SCE_4GL_COMMENT1 ;
return (style & 0xf) == SCE_4GL_COMMENT1 ;
}
// Store both the current line's fold level and the next lines in the

View File

@ -117,6 +117,17 @@ inline bool IsAWordStart(int ch) {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
static bool IsFirstNonWhitespace(Sci_Position pos, Accessor &styler) {
Sci_Position line = styler.GetLine(pos);
Sci_Position start_pos = styler.LineStart(line);
for (Sci_Position i = start_pos; i < pos; i++) {
char ch = styler[i];
if (!(ch == ' ' || ch == '\t'))
return false;
}
return true;
}
// Options used for LexerPython
struct OptionsPython {
int whingeLevel;
@ -560,7 +571,10 @@ void SCI_METHOD LexerPython::Lex(Sci_PositionU startPos, Sci_Position length, in
} else if (sc.ch == '#') {
sc.SetState(sc.chNext == '#' ? SCE_P_COMMENTBLOCK : SCE_P_COMMENTLINE);
} else if (sc.ch == '@') {
sc.SetState(SCE_P_DECORATOR);
if (IsFirstNonWhitespace(sc.currentPos, styler))
sc.SetState(SCE_P_DECORATOR);
else
sc.SetState(SCE_P_OPERATOR);
} else if (IsPyStringStart(sc.ch, sc.chNext, sc.GetRelative(2), allowedLiterals)) {
Sci_PositionU nextIndex = 0;
sc.SetState(GetPyStringState(styler, sc.currentPos, &nextIndex, allowedLiterals));

View File

@ -433,6 +433,32 @@ static bool haveTargetMatch(Sci_Position currPos,
return true;
}
// Finds the start position of the expression containing @p pos
// @p min_pos should be a known expression start, e.g. the start of the line
static Sci_Position findExpressionStart(Sci_Position pos,
Sci_Position min_pos,
Accessor &styler) {
int depth = 0;
for (; pos > min_pos; pos -= 1) {
int style = styler.StyleAt(pos - 1);
if (style == SCE_RB_OPERATOR) {
int ch = styler[pos - 1];
if (ch == '}' || ch == ')' || ch == ']') {
depth += 1;
} else if (ch == '{' || ch == '(' || ch == '[') {
if (depth == 0) {
break;
} else {
depth -= 1;
}
} else if (ch == ';' && depth == 0) {
break;
}
}
}
return pos;
}
// We need a check because the form
// [identifier] <<[target]
// is ambiguous. The Ruby lexer/parser resolves it by
@ -458,14 +484,18 @@ static bool sureThisIsNotHeredoc(Sci_Position lt2StartPos,
const bool definitely_not_a_here_doc = true;
const bool looks_like_a_here_doc = false;
// find the expression start rather than the line start
Sci_Position exprStartPosn = findExpressionStart(lt2StartPos, lineStartPosn, styler);
// Find the first word after some whitespace
Sci_Position firstWordPosn = skipWhitespace(lineStartPosn, lt2StartPos, styler);
Sci_Position firstWordPosn = skipWhitespace(exprStartPosn, lt2StartPos, styler);
if (firstWordPosn >= lt2StartPos) {
return definitely_not_a_here_doc;
}
prevStyle = styler.StyleAt(firstWordPosn);
// If we have '<<' following a keyword, it's not a heredoc
if (prevStyle != SCE_RB_IDENTIFIER
&& prevStyle != SCE_RB_SYMBOL
&& prevStyle != SCE_RB_INSTANCE_VAR
&& prevStyle != SCE_RB_CLASS_VAR) {
return definitely_not_a_here_doc;
@ -503,6 +533,16 @@ static bool sureThisIsNotHeredoc(Sci_Position lt2StartPos,
}
// Skip next batch of white-space
firstWordPosn = skipWhitespace(firstWordPosn, lt2StartPos, styler);
// possible symbol for an implicit hash argument
if (firstWordPosn < lt2StartPos && styler.StyleAt(firstWordPosn) == SCE_RB_SYMBOL) {
for (; firstWordPosn <= lt2StartPos; firstWordPosn += 1) {
if (styler.StyleAt(firstWordPosn) != SCE_RB_SYMBOL) {
break;
}
}
// Skip next batch of white-space
firstWordPosn = skipWhitespace(firstWordPosn, lt2StartPos, styler);
}
if (firstWordPosn != lt2StartPos) {
// Have [[^ws[identifier]ws[*something_else*]ws<<
return definitely_not_a_here_doc;
@ -1088,6 +1128,10 @@ static void ColouriseRbDoc(Sci_PositionU startPos, Sci_Position length, int init
// <name>= is a name only when being def'd -- Get it the next time
// This means that <name>=<name> is always lexed as
// <name>, (op, =), <name>
} else if (ch == ':'
&& isSafeWordcharOrHigh(chPrev)
&& strchr(" \t\n\r", chNext) != NULL) {
state = SCE_RB_SYMBOL;
} else if ((ch == '?' || ch == '!')
&& isSafeWordcharOrHigh(chPrev)
&& !isSafeWordcharOrHigh(chNext)) {

View File

@ -339,7 +339,7 @@ static bool IsOneCharOperator(int 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) {
@ -407,7 +407,18 @@ static void ScanCharacterLiteralOrLifetime(Accessor &styler, Sci_Position& pos,
valid_char = ScanNumericEscape(styler, pos, 2, false);
} else if (n == 'u' && !ascii_only) {
pos += 2;
valid_char = ScanNumericEscape(styler, pos, 4, false);
if (styler.SafeGetCharAt(pos, '\0') != '{') {
// old-style
valid_char = ScanNumericEscape(styler, pos, 4, false);
} else {
int n_digits = 0;
while (IsADigit(styler.SafeGetCharAt(++pos, '\0'), 16) && n_digits++ < 6) {
}
if (n_digits > 0 && styler.SafeGetCharAt(pos, '\0') == '}')
pos++;
else
valid_char = false;
}
} else if (n == 'U' && !ascii_only) {
pos += 2;
valid_char = ScanNumericEscape(styler, pos, 8, false);
@ -579,7 +590,18 @@ static void ResumeString(Accessor &styler, Sci_Position& pos, Sci_Position max,
error = !ScanNumericEscape(styler, pos, 2, true);
} else if (n == 'u' && !ascii_only) {
pos += 2;
error = !ScanNumericEscape(styler, pos, 4, true);
if (styler.SafeGetCharAt(pos, '\0') != '{') {
// old-style
error = !ScanNumericEscape(styler, pos, 4, true);
} else {
int n_digits = 0;
while (IsADigit(styler.SafeGetCharAt(++pos, '\0'), 16) && n_digits++ < 6) {
}
if (n_digits > 0 && styler.SafeGetCharAt(pos, '\0') == '}')
pos++;
else
error = true;
}
} else if (n == 'U' && !ascii_only) {
pos += 2;
error = !ScanNumericEscape(styler, pos, 8, true);

View File

@ -1,239 +0,0 @@
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
# Date : 31 March 2016 *
# *
#*****************************************************************************
.first
define wx [----.include.wx]
.suffixes : .cpp
.ifdef __WXMOTIF__
CXX_DEFINE = /define=(__WX__=1,__WXMOTIF__=1,__USE_STD_IOSTREAM=1)/name=(as_is,short)\
/assume=(nostdnew,noglobal_array_new)\
/include=([],[-.src],[-.include],[-.lexlib])\
/warn=disable=(INTSIGNCHANGE)
CC_DEFINE = /define=(__WX__=1,__WXMOTIF__=1)/name=(as_is,short)\
/include=([],[-.src],[-.include],[-.lexlib])
.else
.ifdef __WXGTK__
CXX_DEFINE = /define=(__WX__=1,__WXGTK__=1,__USE_STD_IOSTREAM=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)\
/include=([],[-.src],[-.include],[-.lexlib])\
/warn=disable=(INTSIGNCHANGE)
CC_DEFINE = /define=(__WX__=1,__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/include=([],[-.src],[-.include],[-.lexlib])
.else
.ifdef __WXGTK2__
CXX_DEFINE = /define=(__WX__=1,__WXGTK__=1,VMS_GTK2=1,__USE_STD_IOSTREAM=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)\
/include=([],[-.src],[-.include],[-.lexlib])\
/warn=disable=(INTSIGNCHANGE)
CC_DEFINE = /define=(__WX__=1,__WXGTK__=1,VMS_GTK2=1)/float=ieee/name=(as_is,short)\
/ieee=denorm/include=([],[-.src],[-.include],[-.lexlib])
.else
.ifdef __WXX11__
CXX_DEFINE = /define=(__WX__=1,__WXX11__=1,__WXUNIVERSAL__==1,__USE_STD_IOSTREAM=1)/float=ieee\
/name=(as_is,short)/assume=(nostdnew,noglobal_array_new)\
/include=([],[-.src],[-.include],[-.lexlib])\
/warn=disable=(INTSIGNCHANGE)
CC_DEFINE = /define=(__WX__=1,__WXX11__=1,__WXUNIVERSAL__==1)/float=ieee\
/name=(as_is,short)/include=([],[-.src],[-.include],[-.lexlib])
.else
CXX_DEFINE =
CC_DEFINE =
.endif
.endif
.endif
.endif
.cxx.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cxx
.cpp.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
.c.obj :
cc $(CFLAGS)$(CC_DEFINE) $(MMS$TARGET_NAME).c
OBJECTS=LexA68k.obj,LexAbaqus.obj,LexAda.obj,LexAPDL.obj,LexAsm.obj,\
LexAsn1.obj,LexASY.obj,LexAU3.obj,LexAVE.obj,LexAVS.obj,LexBaan.obj,\
LexBash.obj,LexBasic.obj,LexBullant.obj,LexCaml.obj,LexCLW.obj,\
LexCmake.obj,LexCOBOL.obj,LexCoffeeScript.obj,LexConf.obj,\
LexCPP.obj,LexCrontab.obj,LexCsound.obj,LexCSS.obj,LexD.obj,\
LexECL.obj,LexEiffel.obj,LexErlang.obj,LexEScript.obj,LexFlagship.obj,\
LexForth.obj,LexFortran.obj,LexGAP.obj,LexGui4Cli.obj,LexHaskell.obj,\
LexHTML.obj,LexInno.obj,LexKix.obj,LexKVIrc.obj,LexLaTeX.obj,LexLisp.obj,\
LexLout.obj,LexLua.obj,LexMagik.obj,LexMarkdown.obj,LexMatlab.obj,\
LexMetapost.obj
OBJECTS1=LexMMIXAL.obj,LexModula.obj,LexMPT.obj,LexMSSQL.obj,LexMySQL.obj,\
LexNimrod.obj,LexNsis.obj,LexOpal.obj,LexOScript.obj,\
LexPascal.obj,LexPB.obj,LexPerl.obj,LexPLM.obj,LexPO.obj,LexPOV.obj,\
LexPowerPro.obj,LexPowerShell.obj,LexProgress.obj,LexPS.obj,\
LexPython.obj,LexR.obj,LexRebol.obj,LexRuby.obj,LexRust.obj,\
LexScriptol.obj,LexSmalltalk.obj,LexSML.obj,LexSorcus.obj,LexSpecman.obj,\
LexSpice.obj,LexSQL.obj,LexSTTXT.obj,LexTACL.obj,LexTADS3.obj,LexTAL.obj,\
LexTCL.obj,LexTCMD.obj,LexTeX.obj,LexTxt2tags.obj,LexVB.obj,\
LexVerilog.obj,LexVHDL.obj,LexVisualProlog.obj,LexYAML.obj,\
LexDMAP.obj,LexHex.obj,LexBibTeX.obj,LexDMIS.obj,LexRegistry.obj,\
LexBatch.obj,LexDiff.obj,LexErrorList.obj,LexMake.obj,LexNull.obj,\
LexProps.obj
SOURCES=LexA68k.cxx,LexAbaqus.cxx,LexAda.cxx,LexAPDL.cxx,LexAsm.cxx,\
LexAsn1.cxx,LexASY.cxx,LexAU3.cxx,LexAVE.cxx,LexAVS.cxx,LexBaan.cxx,\
LexBash.cxx,LexBasic.cxx,LexBullant.cxx,LexCaml.cxx,LexCLW.cxx,\
LexCmake.cxx,LexCOBOL.cxx,LexCoffeeScript.cxx,LexConf.cxx,\
LexCPP.cxx,LexCrontab.cxx,LexCsound.cxx,LexCSS.cxx,LexD.cxx,LexDMAP.cxx,\
LexECL.cxx,LexEiffel.cxx,LexErlang.cxx,LexEScript.cxx,LexFlagship.cxx,\
LexForth.cxx,LexFortran.cxx,LexGAP.cxx,LexGui4Cli.cxx,LexHaskell.cxx,\
LexHTML.cxx,LexInno.cxx,LexKix.cxx,LexKVIrc.cxx,LexLaTeX.cxx,LexLisp.cxx,\
LexLout.cxx,LexLua.cxx,LexMagik.cxx,LexMarkdown.cxx,LexMatlab.cxx,\
LexMetapost.cxx,\
LexMMIXAL.cxx,LexModula.cxx,LexMPT.cxx,LexMSSQL.cxx,LexMySQL.cxx,\
LexNimrod.cxx,LexNsis.cxx,LexOpal.cxx,LexOScript.cxx,\
LexPascal.cxx,LexPB.cxx,LexPerl.cxx,LexPLM.cxx,LexPO.cxx,LexPOV.cxx,\
LexPowerPro.cxx,LexPowerShell.cxx,LexProgress.cxx,LexPS.cxx,\
LexPython.cxx,LexR.cxx,LexRebol.cxx,LexRuby.cxx,LexRust.cxx,\
LexScriptol.cxx,LexSmalltalk.cxx,LexSML.cxx,LexSorcus.cxx,LexSpecman.cxx,\
LexSpice.cxx,LexSQL.cxx,LexSTTXT.cxx,LexTACL.cxx,LexTADS3.cxx,LexTAL.cxx,\
LexTCL.cxx,LexTCMD.cxx,LexTeX.cxx,LexTxt2tags.cxx,LexVB.cxx,\
LexVerilog.cxx,LexVHDL.cxx,LexVisualProlog.cxx,LexYAML.cxx,\
LexDMAP.cxx LexHex.cxx LexBibTeX.cxx LexDMIS.cxx LexRegistry.cxx \
LexBatch.cxx LexDiff.cxx LexErrorList.cxx LexMake.cxx LexNull.cxx \
LexProps.cxx
all : $(SOURCES)
$(MMS)$(MMSQUALIFIERS) $(OBJECTS)
$(MMS)$(MMSQUALIFIERS) $(OBJECTS1)
.ifdef __WXMOTIF__
library [----.lib]libwx_motif.olb $(OBJECTS)
library [----.lib]libwx_motif.olb $(OBJECTS1)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_motif.olb [.CXX_REPOSITORY]*.obj
.else
.ifdef __WXGTK__
library [----.lib]libwx_gtk.olb $(OBJECTS)
library [----.lib]libwx_gtk.olb $(OBJECTS1)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_gtk.olb [.CXX_REPOSITORY]*.obj
.else
.ifdef __WXGTK2__
library [----.lib]libwx_gtk2.olb $(OBJECTS)
library [----.lib]libwx_gtk2.olb $(OBJECTS1)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_gtk2.olb [.CXX_REPOSITORY]*.obj
.else
.ifdef __WXX11__
library [----.lib]libwx_x11_univ.olb $(OBJECTS)
library [----.lib]libwx_x11_univ.olb $(OBJECTS1)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_x11_univ.olb [.CXX_REPOSITORY]*.obj
.endif
.endif
.endif
.endif
$(OBJECTS) : [----.include.wx]setup.h
$(OBJECTS1) : [----.include.wx]setup.h
LexA68k.obj : LexA68k.cxx
LexAbaqus.obj : LexAbaqus.cxx
LexAda.obj : LexAda.cxx
LexAPDL.obj : LexAPDL.cxx
LexAsm.obj : LexAsm.cxx
LexAsn1.obj : LexAsn1.cxx
LexASY.obj : LexASY.cxx
LexAU3.obj : LexAU3.cxx
LexAVE.obj : LexAVE.cxx
LexAVS.obj : LexAVS.cxx
LexBaan.obj : LexBaan.cxx
LexBash.obj : LexBash.cxx
LexBasic.obj : LexBasic.cxx
LexBullant.obj : LexBullant.cxx
LexCaml.obj : LexCaml.cxx
LexCLW.obj : LexCLW.cxx
LexCmake.obj : LexCmake.cxx
LexCOBOL.obj : LexCOBOL.cxx
LexCoffeeScript.obj : LexCoffeeScript.cxx
LexConf.obj : LexConf.cxx
LexCPP.obj : LexCPP.cxx
LexCrontab.obj : LexCrontab.cxx
LexCsound.obj : LexCsound.cxx
LexCSS.obj : LexCSS.cxx
LexD.obj : LexD.cxx
LexDMAP.obj : LexDMAP.cxx
LexECL.obj : LexECL.cxx
LexEiffel.obj : LexEiffel.cxx
LexErlang.obj : LexErlang.cxx
LexEScript.obj : LexEScript.cxx
LexFlagship.obj : LexFlagship.cxx
LexForth.obj : LexForth.cxx
LexFortran.obj : LexFortran.cxx
LexGAP.obj : LexGAP.cxx
LexGui4Cli.obj : LexGui4Cli.cxx
LexHaskell.obj : LexHaskell.cxx
LexHTML.obj : LexHTML.cxx
LexInno.obj : LexInno.cxx
LexKix.obj : LexKix.cxx
LexKVIrc.obj : LexKVIrc.cxx
LexLaTeX.obj : LexLaTeX.cxx
LexLisp.obj : LexLisp.cxx
LexLout.obj : LexLout.cxx
LexLua.obj : LexLua.cxx
LexMagik.obj : LexMagik.cxx
LexMarkdown.obj : LexMarkdown.cxx
LexMatlab.obj : LexMatlab.cxx
LexMetapost.obj : LexMetapost.cxx
LexMMIXAL.obj : LexMMIXAL.cxx
LexModula.obj : LexModula.cxx
LexMPT.obj : LexMPT.cxx
LexMSSQL.obj : LexMSSQL.cxx
LexMySQL.obj : LexMySQL.cxx
LexNimrod.obj : LexNimrod.cxx
LexNsis.obj : LexNsis.cxx
LexOpal.obj : LexOpal.cxx
LexOScript.obj : LexOScript.cxx
LexPascal.obj : LexPascal.cxx
LexPB.obj : LexPB.cxx
LexPerl.obj : LexPerl.cxx
LexPLM.obj : LexPLM.cxx
LexPO.obj : LexPO.cxx
LexPOV.obj : LexPOV.cxx
LexPowerPro.obj : LexPowerPro.cxx
LexPowerShell.obj : LexPowerShell.cxx
LexProgress.obj : LexProgress.cxx
LexPS.obj : LexPS.cxx
LexPython.obj : LexPython.cxx
LexR.obj : LexR.cxx
LexRebol.obj : LexRebol.cxx
LexRuby.obj : LexRuby.cxx
LexRust.obj : LexRust.cxx
LexScriptol.obj : LexScriptol.cxx
LexSmalltalk.obj : LexSmalltalk.cxx
LexSML.obj : LexSML.cxx
LexSorcus.obj : LexSorcus.cxx
LexSpecman.obj : LexSpecman.cxx
LexSpice.obj : LexSpice.cxx
LexSQL.obj : LexSQL.cxx
LexSTTXT.obj : LexSTTXT.cxx
LexTACL.obj : LexTACL.cxx
LexTADS3.obj : LexTADS3.cxx
LexTAL.obj : LexTAL.cxx
LexTCL.obj : LexTCL.cxx
LexTCMD.obj : LexTCMD.cxx
LexTeX.obj : LexTeX.cxx
LexTxt2tags.obj : LexTxt2tags.cxx
LexVB.obj : LexVB.cxx
LexVerilog.obj : LexVerilog.cxx
LexVHDL.obj : LexVHDL.cxx
LexVisualProlog.obj : LexVisualProlog.cxx
LexYAML.obj : LexYAML.cxx
LexDMAP.obj : LexDMAP.cxx
LexHex.obj : LexHex.cxx
LexBibTeX.obj : LexBibTeX.cxx
LexDMIS.obj : LexDMIS.cxx
LexRegistry.obj : LexRegistry.cxx
LexBatch.obj : LexBatch.cxx
LexDiff.obj : LexDiff.cxx
LexErrorList.obj : LexErrorList.cxx
LexMake.obj : LexMake.cxx
LexNull.obj : LexNull.cxx
LexProps.obj : LexProps.cxx

View File

@ -1,6 +1,6 @@
// Scintilla source code edit control
/** @file KeyWords.cxx
** Colourise for particular languages.
/** @file Accessor.cxx
** Interfaces between Scintilla and lexers.
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

View File

@ -1,6 +1,6 @@
// Scintilla source code edit control
/** @file KeyWords.cxx
** Colourise for particular languages.
/** @file WordList.cxx
** Hold a list of words.
**/
// Copyright 1998-2002 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.

View File

@ -1,94 +0,0 @@
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
# Date : 24 August 2012 *
# *
#*****************************************************************************
.first
define wx [----.include.wx]
.suffixes : .cpp
.ifdef __WXMOTIF__
CXX_DEFINE = /define=(__WX__=1,__WXMOTIF__=1,__USE_STD_IOSTREAM=1)/name=(as_is,short)\
/assume=(nostdnew,noglobal_array_new)/include=([],[-.src],[-.include])
CC_DEFINE = /define=(__WX__=1,__WXMOTIF__=1)/name=(as_is,short)\
/include=([],[-.src],[-.include])
.else
.ifdef __WXGTK__
CXX_DEFINE = /define=(__WX__=1,__WXGTK__=1,__USE_STD_IOSTREAM=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)/include=([],[-.src],[-.include])
CC_DEFINE = /define=(__WX__=1,__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/include=([],[-.src],[-.include])
.else
.ifdef __WXGTK2__
CXX_DEFINE = /define=(__WX__=1,__WXGTK__=1,VMS_GTK2=1,__USE_STD_IOSTREAM=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)/include=([],[-.src],[-.include])
CC_DEFINE = /define=(__WX__=1,__WXGTK__=1,VMS_GTK2=1)/float=ieee/name=(as_is,short)\
/ieee=denorm/include=([],[-.src],[-.include])
.else
.ifdef __WXX11__
CXX_DEFINE = /define=(__WX__=1,__WXX11__=1,__WXUNIVERSAL__==1,__USE_STD_IOSTREAM=1)/float=ieee\
/name=(as_is,short)/assume=(nostdnew,noglobal_array_new)\
/include=([],[-.src],[-.include])
CC_DEFINE = /define=(__WX__=1,__WXX11__=1,__WXUNIVERSAL__==1)/float=ieee\
/name=(as_is,short)/include=([],[-.src],[-.include])
.else
CXX_DEFINE =
CC_DEFINE =
.endif
.endif
.endif
.endif
.cxx.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cxx
.cpp.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
.c.obj :
cc $(CFLAGS)$(CC_DEFINE) $(MMS$TARGET_NAME).c
OBJECTS=Accessor.obj,CharacterCategory.obj,CharacterSet.obj,LexerBase.obj,\
LexerModule.obj,LexerNoExceptions.obj,LexerSimple.obj,PropSetSimple.obj,\
StyleContext.obj,WordList.obj
SOURCES=Accessor.cxx,CharacterCategory.cxx,CharacterSet.cxx,LexerBase.cxx,\
LexerModule.cxx,LexerNoExceptions.cxx,LexerSimple.cxx,PropSetSimple.cxx,\
StyleContext.cxx,WordList.cxx
all : $(SOURCES)
$(MMS)$(MMSQUALIFIERS) $(OBJECTS)
.ifdef __WXMOTIF__
library [----.lib]libwx_motif.olb $(OBJECTS)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_motif.olb [.CXX_REPOSITORY]*.obj
.else
.ifdef __WXGTK__
library [----.lib]libwx_gtk.olb $(OBJECTS)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_gtk.olb [.CXX_REPOSITORY]*.obj
.else
.ifdef __WXGTK2__
library [----.lib]libwx_gtk2.olb $(OBJECTS)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_gtk2.olb [.CXX_REPOSITORY]*.obj
.else
.ifdef __WXX11__
library [----.lib]libwx_x11_univ.olb $(OBJECTS)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_x11_univ.olb [.CXX_REPOSITORY]*.obj
.endif
.endif
.endif
.endif
$(OBJECTS) : [----.include.wx]setup.h
Accessor.obj : Accessor.cxx
CharacterCategory.obj : CharacterCategory.cxx
CharacterSet.obj : CharacterSet.cxx
LexerBase.obj : LexerBase.cxx
LexerModule.obj : LexerModule.cxx
LexerNoExceptions.obj : LexerNoExceptions.cxx
LexerSimple.obj : LexerSimple.cxx
PropSetSimple.obj : PropSetSimple.cxx
StyleContext.obj : StyleContext.cxx
WordList.obj : WordList.cxx

View File

@ -126,6 +126,7 @@ int Scintilla_LinkLexers() {
LINK_LEXER(lmHTML);
LINK_LEXER(lmIHex);
LINK_LEXER(lmInno);
LINK_LEXER(lmJSON);
LINK_LEXER(lmKix);
LINK_LEXER(lmKVIrc);
LINK_LEXER(lmLatex);

View File

@ -16,7 +16,7 @@
#include <vector>
#include <algorithm>
#ifdef CXX11_REGEX
#ifndef NO_CXX11_REGEX
#include <regex>
#endif
@ -436,12 +436,12 @@ static bool IsSubordinate(int levelStart, int levelTry) {
if (levelTry & SC_FOLDLEVELWHITEFLAG)
return true;
else
return (levelStart & SC_FOLDLEVELNUMBERMASK) < (levelTry & SC_FOLDLEVELNUMBERMASK);
return LevelNumber(levelStart) < LevelNumber(levelTry);
}
int Document::GetLastChild(int lineParent, int level, int lastLine) {
if (level == -1)
level = GetLevel(lineParent) & SC_FOLDLEVELNUMBERMASK;
level = LevelNumber(GetLevel(lineParent));
int maxLine = LinesTotal();
int lookLastLine = (lastLine != -1) ? Platform::Minimum(LinesTotal() - 1, lastLine) : -1;
int lineMaxSubord = lineParent;
@ -454,7 +454,7 @@ int Document::GetLastChild(int lineParent, int level, int lastLine) {
lineMaxSubord++;
}
if (lineMaxSubord > lineParent) {
if (level > (GetLevel(lineMaxSubord + 1) & SC_FOLDLEVELNUMBERMASK)) {
if (level > LevelNumber(GetLevel(lineMaxSubord + 1))) {
// Have chewed up some whitespace that belongs to a parent so seek back
if (GetLevel(lineMaxSubord) & SC_FOLDLEVELWHITEFLAG) {
lineMaxSubord--;
@ -465,16 +465,16 @@ int Document::GetLastChild(int lineParent, int level, int lastLine) {
}
int Document::GetFoldParent(int line) const {
int level = GetLevel(line) & SC_FOLDLEVELNUMBERMASK;
int level = LevelNumber(GetLevel(line));
int lineLook = line - 1;
while ((lineLook > 0) && (
(!(GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG)) ||
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) >= level))
(LevelNumber(GetLevel(lineLook)) >= level))
) {
lineLook--;
}
if ((GetLevel(lineLook) & SC_FOLDLEVELHEADERFLAG) &&
((GetLevel(lineLook) & SC_FOLDLEVELNUMBERMASK) < level)) {
(LevelNumber(GetLevel(lineLook)) < level)) {
return lineLook;
} else {
return -1;
@ -487,11 +487,11 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, in
int lookLine = line;
int lookLineLevel = level;
int lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
int lookLineLevelNum = LevelNumber(lookLineLevel);
while ((lookLine > 0) && ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) ||
((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum >= (GetLevel(lookLine + 1) & SC_FOLDLEVELNUMBERMASK))))) {
((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum >= LevelNumber(GetLevel(lookLine + 1)))))) {
lookLineLevel = GetLevel(--lookLine);
lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
lookLineLevelNum = LevelNumber(lookLineLevel);
}
int beginFoldBlock = (lookLineLevel & SC_FOLDLEVELHEADERFLAG) ? lookLine : GetFoldParent(lookLine);
@ -505,7 +505,7 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, in
if (endFoldBlock < line) {
lookLine = beginFoldBlock - 1;
lookLineLevel = GetLevel(lookLine);
lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
lookLineLevelNum = LevelNumber(lookLineLevel);
while ((lookLine >= 0) && (lookLineLevelNum >= SC_FOLDLEVELBASE)) {
if (lookLineLevel & SC_FOLDLEVELHEADERFLAG) {
if (GetLastChild(lookLine, -1, lookLastLine) == line) {
@ -514,17 +514,17 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, in
firstChangeableLineBefore = line - 1;
}
}
if ((lookLine > 0) && (lookLineLevelNum == SC_FOLDLEVELBASE) && ((GetLevel(lookLine - 1) & SC_FOLDLEVELNUMBERMASK) > lookLineLevelNum))
if ((lookLine > 0) && (lookLineLevelNum == SC_FOLDLEVELBASE) && (LevelNumber(GetLevel(lookLine - 1)) > lookLineLevelNum))
break;
lookLineLevel = GetLevel(--lookLine);
lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
lookLineLevelNum = LevelNumber(lookLineLevel);
}
}
if (firstChangeableLineBefore == -1) {
for (lookLine = line - 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
for (lookLine = line - 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = LevelNumber(lookLineLevel);
lookLine >= beginFoldBlock;
lookLineLevel = GetLevel(--lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK) {
if ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || (lookLineLevelNum > (level & SC_FOLDLEVELNUMBERMASK))) {
lookLineLevel = GetLevel(--lookLine), lookLineLevelNum = LevelNumber(lookLineLevel)) {
if ((lookLineLevel & SC_FOLDLEVELWHITEFLAG) || (lookLineLevelNum > LevelNumber(level))) {
firstChangeableLineBefore = lookLine;
break;
}
@ -534,10 +534,10 @@ void Document::GetHighlightDelimiters(HighlightDelimiter &highlightDelimiter, in
firstChangeableLineBefore = beginFoldBlock - 1;
int firstChangeableLineAfter = -1;
for (lookLine = line + 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK;
for (lookLine = line + 1, lookLineLevel = GetLevel(lookLine), lookLineLevelNum = LevelNumber(lookLineLevel);
lookLine <= endFoldBlock;
lookLineLevel = GetLevel(++lookLine), lookLineLevelNum = lookLineLevel & SC_FOLDLEVELNUMBERMASK) {
if ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum < (GetLevel(lookLine + 1) & SC_FOLDLEVELNUMBERMASK))) {
lookLineLevel = GetLevel(++lookLine), lookLineLevelNum = LevelNumber(lookLineLevel)) {
if ((lookLineLevel & SC_FOLDLEVELHEADERFLAG) && (lookLineLevelNum < LevelNumber(GetLevel(lookLine + 1)))) {
firstChangeableLineAfter = lookLine;
break;
}
@ -2336,7 +2336,7 @@ public:
}
};
#ifdef CXX11_REGEX
#ifndef NO_CXX11_REGEX
class ByteIterator : public std::iterator<std::bidirectional_iterator_tag, char> {
public:
@ -2617,9 +2617,9 @@ bool MatchOnLines(const Document *doc, const Regex &regexp, const RESearchRange
for (size_t co = 0; co < match.size(); co++) {
search.bopat[co] = match[co].first.Pos();
search.eopat[co] = match[co].second.PosRoundUp();
size_t lenMatch = search.eopat[co] - search.bopat[co];
Sci::Position lenMatch = search.eopat[co] - search.bopat[co];
search.pat[co].resize(lenMatch);
for (size_t iPos = 0; iPos < lenMatch; iPos++) {
for (Sci::Position iPos = 0; iPos < lenMatch; iPos++) {
search.pat[co][iPos] = doc->CharAt(iPos + search.bopat[co]);
}
}
@ -2696,7 +2696,7 @@ long BuiltinRegex::FindText(Document *doc, int minPos, int maxPos, const char *s
bool caseSensitive, bool, bool, int flags,
int *length) {
#ifdef CXX11_REGEX
#ifndef NO_CXX11_REGEX
if (flags & SCFIND_CXX11REGEX) {
return Cxx11RegexFindText(doc, minPos, maxPos, s,
caseSensitive, length, search);

View File

@ -171,6 +171,10 @@ public:
class Document;
inline int LevelNumber(int level) {
return level & SC_FOLDLEVELNUMBERMASK;
}
class LexInterface {
protected:
Document *pdoc;
@ -207,9 +211,6 @@ public:
bool operator==(const WatcherWithUserData &other) const {
return (watcher == other.watcher) && (userData == other.userData);
}
bool operator!=(const WatcherWithUserData &other) const {
return !((watcher == other.watcher) && (userData == other.userData));
}
};
private:

View File

@ -1,5 +1,5 @@
// Scintilla source code edit control
/** @file Editor.cxx
/** @file EditView.cxx
** Defines the appearance of the main text area of the editor window.
**/
// Copyright 1998-2014 by Neil Hodgson <neilh@scintilla.org>
@ -1744,7 +1744,7 @@ static void DrawFoldLines(Surface *surface, const EditModel &model, const ViewSt
const int level = model.pdoc->GetLevel(line);
const int levelNext = model.pdoc->GetLevel(line + 1);
if ((level & SC_FOLDLEVELHEADERFLAG) &&
((level & SC_FOLDLEVELNUMBERMASK) < (levelNext & SC_FOLDLEVELNUMBERMASK))) {
(LevelNumber(level) < LevelNumber(levelNext))) {
// Paint the line above the fold
if ((expanded && (model.foldFlags & SC_FOLDFLAG_LINEBEFORE_EXPANDED))
||

View File

@ -303,7 +303,7 @@ int Editor::TopLineOfMain() const {
}
PRectangle Editor::GetClientRectangle() const {
Window &win = const_cast<Window &>(wMain);
Window win = wMain;
return win.GetClientPosition();
}
@ -828,6 +828,7 @@ void Editor::MovedCaret(SelectionPosition newPos, SelectionPosition previousPos,
}
ShowCaretAtCurrentPosition();
NotifyCaretMove();
ClaimSelection();
SetHoverIndicatorPosition(sel.MainCaret());
@ -1437,6 +1438,9 @@ void Editor::InvalidateCaret() {
UpdateSystemCaret();
}
void Editor::NotifyCaretMove() {
}
void Editor::UpdateSystemCaret() {
}
@ -2265,12 +2269,13 @@ void Editor::DelCharBack(bool allowLineStartDeletion) {
ShowCaretAtCurrentPosition();
}
int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta) {
int Editor::ModifierFlags(bool shift, bool ctrl, bool alt, bool meta, bool super) {
return
(shift ? SCI_SHIFT : 0) |
(ctrl ? SCI_CTRL : 0) |
(alt ? SCI_ALT : 0) |
(meta ? SCI_META : 0);
(meta ? SCI_META : 0) |
(super ? SCI_SUPER : 0);
}
void Editor::NotifyFocus(bool focus) {
@ -5292,7 +5297,7 @@ void Editor::FoldExpand(int line, int action, int level) {
if (expanding && (cs.HiddenLines() == 0))
// Nothing to do
return;
int lineMaxSubord = pdoc->GetLastChild(line, level & SC_FOLDLEVELNUMBERMASK);
int lineMaxSubord = pdoc->GetLastChild(line, LevelNumber(level));
line++;
cs.SetVisible(line, lineMaxSubord, expanding);
while (line <= lineMaxSubord) {
@ -5399,7 +5404,7 @@ void Editor::FoldAll(int action) {
for (int line = 0; line < maxLine; line++) {
int level = pdoc->GetLevel(line);
if ((level & SC_FOLDLEVELHEADERFLAG) &&
(SC_FOLDLEVELBASE == (level & SC_FOLDLEVELNUMBERMASK))) {
(SC_FOLDLEVELBASE == LevelNumber(level))) {
SetFoldExpanded(line, false);
int lineMaxSubord = pdoc->GetLastChild(line, -1);
if (lineMaxSubord > line) {
@ -5422,17 +5427,25 @@ void Editor::FoldChanged(int line, int levelNow, int levelPrev) {
FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev);
}
} else if (levelPrev & SC_FOLDLEVELHEADERFLAG) {
const int prevLine = line - 1;
const int prevLineLevel = pdoc->GetLevel(prevLine);
// Combining two blocks where the first block is collapsed (e.g. by deleting the line(s) which separate(s) the two blocks)
if ((LevelNumber(prevLineLevel) == LevelNumber(levelNow)) && !cs.GetVisible(prevLine))
FoldLine(pdoc->GetFoldParent(prevLine), SC_FOLDACTION_EXPAND);
if (!cs.GetExpanded(line)) {
// Removing the fold from one that has been contracted so should expand
// otherwise lines are left invisible with no way to make them visible
if (cs.SetExpanded(line, true)) {
RedrawSelMargin();
}
// Combining two blocks where the second one is collapsed (e.g. by adding characters in the line which separates the two blocks)
FoldExpand(line, SC_FOLDACTION_EXPAND, levelPrev);
}
}
if (!(levelNow & SC_FOLDLEVELWHITEFLAG) &&
((levelPrev & SC_FOLDLEVELNUMBERMASK) > (levelNow & SC_FOLDLEVELNUMBERMASK))) {
(LevelNumber(levelPrev) > LevelNumber(levelNow))) {
if (cs.HiddenLines()) {
// See if should still be hidden
int parentLine = pdoc->GetFoldParent(line);
@ -5443,6 +5456,15 @@ void Editor::FoldChanged(int line, int levelNow, int levelPrev) {
}
}
}
// Combining two blocks where the first one is collapsed (e.g. by adding characters in the line which separates the two blocks)
if (!(levelNow & SC_FOLDLEVELWHITEFLAG) && (LevelNumber(levelPrev) < LevelNumber(levelNow))) {
if (cs.HiddenLines()) {
const int parentLine = pdoc->GetFoldParent(line);
if (!cs.GetExpanded(parentLine) && cs.GetExpanded(line))
FoldLine(parentLine, SC_FOLDACTION_EXPAND);
}
}
}
void Editor::NeedShown(int pos, int len) {

View File

@ -46,13 +46,11 @@ public:
workStyle=1,
workUpdateUI=2
};
bool active;
enum workItems items;
Position upTo;
WorkNeeded() : active(false), items(workNone), upTo(0) {}
WorkNeeded() : items(workNone), upTo(0) {}
void Reset() {
active = false;
items = workNone;
upTo = 0;
}
@ -367,6 +365,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void DropCaret();
void CaretSetPeriod(int period);
void InvalidateCaret();
virtual void NotifyCaretMove();
virtual void UpdateSystemCaret();
bool Wrapping() const;
@ -414,7 +413,7 @@ protected: // ScintillaBase subclass needs access to much of Editor
void DelCharBack(bool allowLineStartDeletion);
virtual void ClaimSelection() = 0;
static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false);
static int ModifierFlags(bool shift, bool ctrl, bool alt, bool meta=false, bool super=false);
virtual void NotifyChange() = 0;
virtual void NotifyFocus(bool focus);
virtual void SetCtrlID(int identifier);

View File

@ -17,6 +17,7 @@ namespace Scintilla {
#define SCI_CTRL SCMOD_CTRL
#define SCI_ALT SCMOD_ALT
#define SCI_META SCMOD_META
#define SCI_SUPER SCMOD_SUPER
#define SCI_CSHIFT (SCI_CTRL | SCI_SHIFT)
#define SCI_ASHIFT (SCI_ALT | SCI_SHIFT)

View File

@ -243,7 +243,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect
levelPrev = model.pdoc->GetLevel(lineBack);
}
if (!(levelPrev & SC_FOLDLEVELHEADERFLAG)) {
if ((level & SC_FOLDLEVELNUMBERMASK) < (levelPrev & SC_FOLDLEVELNUMBERMASK))
if (LevelNumber(level) < LevelNumber(levelPrev))
needWhiteClosure = true;
}
}
@ -279,8 +279,8 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect
// Decide which fold indicator should be displayed
const int level = model.pdoc->GetLevel(lineDoc);
const int levelNext = model.pdoc->GetLevel(lineDoc + 1);
const int levelNum = level & SC_FOLDLEVELNUMBERMASK;
const int levelNextNum = levelNext & SC_FOLDLEVELNUMBERMASK;
const int levelNum = LevelNumber(level);
const int levelNextNum = LevelNumber(levelNext);
if (level & SC_FOLDLEVELHEADERFLAG) {
if (firstSubLine) {
if (levelNum < levelNextNum) {
@ -312,7 +312,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect
needWhiteClosure = false;
const int firstFollowupLine = model.cs.DocFromDisplay(model.cs.DisplayFromDoc(lineDoc + 1));
const int firstFollowupLineLevel = model.pdoc->GetLevel(firstFollowupLine);
const int secondFollowupLineLevelNum = model.pdoc->GetLevel(firstFollowupLine + 1) & SC_FOLDLEVELNUMBERMASK;
const int secondFollowupLineLevelNum = LevelNumber(model.pdoc->GetLevel(firstFollowupLine + 1));
if (!model.cs.GetExpanded(lineDoc)) {
if ((firstFollowupLineLevel & SC_FOLDLEVELWHITEFLAG) &&
(levelNum > secondFollowupLineLevelNum))
@ -380,7 +380,7 @@ void MarginView::PaintMargin(Surface *surface, int topLine, PRectangle rc, PRect
sprintf(number, "%c%c %03X %03X",
(lev & SC_FOLDLEVELHEADERFLAG) ? 'H' : '_',
(lev & SC_FOLDLEVELWHITEFLAG) ? 'W' : '_',
lev & SC_FOLDLEVELNUMBERMASK,
LevelNumber(lev),
lev >> 16
);
} else {

View File

@ -1,6 +1,6 @@
// Scintilla source code edit control
/** @file Position.h
** Will define global type name Position in the Sci internal namespace.
** Defines global type name Position in the Sci internal namespace.
**/
// Copyright 2015 by Neil Hodgson <neilh@scintilla.org>
// The License.txt file describes the conditions under which this software may be distributed.
@ -8,14 +8,21 @@
#ifndef POSITION_H
#define POSITION_H
/**
* A Position is a position within a document between two characters or at the beginning or end.
* Sometimes used as a character index where it identifies the character after the position.
*/
namespace Sci {
// After 3.6.0:
// typedef int Position;
typedef int Position;
// A later version (4.x) of this file may:
//#if defined(SCI_LARGE_FILE_SUPPORT)
//typedef ptrdiff_t Position;
//typedef std::ptrdiff_t Position;
// or may allow runtime choice between different position sizes.
const Position invalidPosition = -1;
}

View File

@ -39,7 +39,7 @@ public:
int Execute(CharacterIndexer &ci, int lp, int endp);
enum { MAXTAG=10 };
enum { MAXNFA=2048 };
enum { MAXNFA=4096 };
enum { NOTFOUND=-1 };
int bopat[MAXTAG];

View File

@ -1,122 +0,0 @@
#*****************************************************************************
# *
# Make file for VMS *
# Author : J.Jansen (joukj@hrem.nano.tudelft.nl) *
# Date : 13 July 2015 *
# *
#*****************************************************************************
.first
define wx [----.include.wx]
.suffixes : .cpp
.ifdef __WXMOTIF__
CXX_DEFINE = /define=(__WX__=1,__WXMOTIF__=1,__USE_STD_IOSTREAM=1)/name=(as_is,short)\
/assume=(nostdnew,noglobal_array_new)\
/include=([],[-.src],[-.include],[-.lexlib])
CC_DEFINE = /define=(__WX__=1,__WXMOTIF__=1)/name=(as_is,short)\
/include=([],[-.src],[-.include],[-.lexlib])
.else
.ifdef __WXGTK__
CXX_DEFINE = /define=(__WX__=1,__WXGTK__=1,__USE_STD_IOSTREAM=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)\
/include=([],[-.src],[-.include],[-.lexlib])
CC_DEFINE = /define=(__WX__=1,__WXGTK__=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/include=([],[-.src],[-.include],[-.lexlib])
.else
.ifdef __WXGTK2__
CXX_DEFINE = /define=(__WX__=1,__WXGTK__=1,VMS_GTK2=1,__USE_STD_IOSTREAM=1)/float=ieee/name=(as_is,short)/ieee=denorm\
/assume=(nostdnew,noglobal_array_new)\
/include=([],[-.src],[-.include],[-.lexlib])
CC_DEFINE = /define=(__WX__=1,__WXGTK__=1,VMS_GTK2=1)/float=ieee/name=(as_is,short)\
/ieee=denorm/include=([],[-.src],[-.include],[-.lexlib])
.else
.ifdef __WXX11__
CXX_DEFINE = /define=(__WX__=1,__WXX11__=1,__WXUNIVERSAL__==1,__USE_STD_IOSTREAM=1)/float=ieee\
/name=(as_is,short)/assume=(nostdnew,noglobal_array_new)\
/include=([],[-.src],[-.include],[-.lexlib])
CC_DEFINE = /define=(__WX__=1,__WXX11__=1,__WXUNIVERSAL__==1)/float=ieee\
/name=(as_is,short)/include=([],[-.src],[-.include],[-.lexlib])
.else
CXX_DEFINE =
CC_DEFINE =
.endif
.endif
.endif
.endif
.cxx.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cxx
.cpp.obj :
cxx $(CXXFLAGS)$(CXX_DEFINE) $(MMS$TARGET_NAME).cpp
.c.obj :
cc $(CFLAGS)$(CC_DEFINE) $(MMS$TARGET_NAME).c
OBJECTS=AutoComplete.obj,CallTip.obj,CaseConvert.obj,CaseFolder.obj,\
Catalogue.obj,CellBuffer.obj,CharClassify.obj,ContractionState.obj,\
Decoration.obj,Document.obj,Editor.obj,ExternalLexer.obj,Indicator.obj,\
KeyMap.obj,LineMarker.obj,PerLine.obj,PositionCache.obj,RESearch.obj,\
RunStyles.obj,ScintillaBase.obj,Selection.obj,Style.obj,UniConversion.obj,\
ViewStyle.obj,XPM.obj,EditModel.obj,EditView.obj,MarginView.obj
SOURCES=AutoComplete.cxx,CallTip.cxx,CaseConvert.cxx,CaseFolder.cxx,\
Catalogue.cxx,CellBuffer.cxx,CharClassify.cxx,ContractionState.cxx,\
Decoration.cxx,Document.cxx,Editor.cxx,ExternalLexer.cxx,Indicator.cxx,\
KeyMap.cxx,LineMarker.cxx,PerLine.cxx,PositionCache.cxx,RESearch.cxx,\
RunStyles.cxx,ScintillaBase.cxx,Selection.cxx,Style.cxx,UniConversion.cxx,\
ViewStyle.cxx,XPM.cxx,EditModel.cxx,EditView.cxx,MarginView.cxx
all : $(SOURCES)
$(MMS)$(MMSQUALIFIERS) $(OBJECTS)
.ifdef __WXMOTIF__
library [----.lib]libwx_motif.olb $(OBJECTS)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_motif.olb [.CXX_REPOSITORY]*.obj
.else
.ifdef __WXGTK__
library [----.lib]libwx_gtk.olb $(OBJECTS)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_gtk.olb [.CXX_REPOSITORY]*.obj
.else
.ifdef __WXGTK2__
library [----.lib]libwx_gtk2.olb $(OBJECTS)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_gtk2.olb [.CXX_REPOSITORY]*.obj
.else
.ifdef __WXX11__
library [----.lib]libwx_x11_univ.olb $(OBJECTS)
If f$getsyi("HW_MODEL") .le. 2048 then library [----.lib]libwx_x11_univ.olb [.CXX_REPOSITORY]*.obj
.endif
.endif
.endif
.endif
$(OBJECTS) : [----.include.wx]setup.h
AutoComplete.obj : AutoComplete.cxx
CallTip.obj : CallTip.cxx
CaseConvert.obj : CaseConvert.cxx
CaseFolder.obj : CaseFolder.cxx
Catalogue.obj : Catalogue.cxx
CellBuffer.obj : CellBuffer.cxx
CharClassify.obj : CharClassify.cxx
ContractionState.obj : ContractionState.cxx
Decoration.obj : Decoration.cxx
Document.obj : Document.cxx
Editor.obj : Editor.cxx
cxx $(CXXFLAGS)$(CXX_DEFINE)/nowarn Editor.cxx
ExternalLexer.obj : ExternalLexer.cxx
Indicator.obj : Indicator.cxx
KeyMap.obj : KeyMap.cxx
LineMarker.obj : LineMarker.cxx
PerLine.obj : PerLine.cxx
PositionCache.obj : PositionCache.cxx
RESearch.obj : RESearch.cxx
RunStyles.obj : RunStyles.cxx
ScintillaBase.obj : ScintillaBase.cxx
Selection.obj : Selection.cxx
Style.obj : Style.cxx
UniConversion.obj : UniConversion.cxx
ViewStyle.obj : ViewStyle.cxx
XPM.obj : XPM.cxx
EditModel.obj : EditModel.cxx
EditView.obj : EditView.cxx
MarginView.obj : MarginView.cxx

View File

@ -5502,7 +5502,7 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
{
return wxVersionInfo("Scintilla", 3, 6, 3, "Scintilla 3.6.3");
return wxVersionInfo("Scintilla", 3, 6, 6, "Scintilla 3.6.6");
}
#endif // wxUSE_STC

View File

@ -1208,7 +1208,7 @@ wxStyledTextEvent::wxStyledTextEvent(const wxStyledTextEvent& event):
/*static*/ wxVersionInfo wxStyledTextCtrl::GetLibraryVersionInfo()
{
return wxVersionInfo("Scintilla", 3, 6, 3, "Scintilla 3.6.3");
return wxVersionInfo("Scintilla", 3, 6, 6, "Scintilla 3.6.6");
}
#endif // wxUSE_STC