Merge pull request #4220 from RaiKoHoff/Dev_Master

Update Lexilla Lib v5.2.0
This commit is contained in:
Rainer Kottenhoff 2022-10-15 01:57:56 +02:00 committed by GitHub
commit 85daea2de6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
20 changed files with 302 additions and 101 deletions

View File

@ -1281,6 +1281,7 @@
#define IDS_LEX_2ND_CH_MODIFIED 63394
#define IDS_LEX_2ND_CH_REV_TO_ORG 63395
#define IDS_LEX_2ND_CH_REV_TO_MOD 63396
#define IDS_LEX_STR_63397 63397
#define IDS_LEX_CSV_COL_0 63490

View File

@ -495,6 +495,7 @@ BEGIN
IDS_LEX_STR_63386 "Symbol Identifier"
IDS_LEX_STR_63387 "Symbol Operator"
IDS_LEX_STR_63388 "String EOL"
IDS_LEX_STR_63397 "Backticks"
END
STRINGTABLE

View File

@ -495,6 +495,7 @@ BEGIN
IDS_LEX_STR_63386 "Symbol Identifier"
IDS_LEX_STR_63387 "Symbol Operator"
IDS_LEX_STR_63388 "String EOL"
IDS_LEX_STR_63397 "Backticks"
END
STRINGTABLE

View File

@ -17,10 +17,12 @@ noExplicitConstructor
// code legibility.
passedByValue
// This could be fixed but it should be rewritten to use string_view which doesn't have resize
uselessCallsSubstr:lexilla/lexers/LexCPP.cxx
// Suppress most lexer warnings since the lexers are maintained by others
redundantCondition:lexilla/lexers/LexA68k.cxx
constParameter:lexilla/lexers/LexAbaqus.cxx
unusedStructMember:lexilla/lexers/LexAsciidoc.cxx
constParameterCallback:lexilla/lexers/LexAsn1.cxx
knownConditionTrueFalse:lexilla/lexers/LexAU3.cxx
shadowVariable:lexilla/lexers/LexAU3.cxx
@ -43,6 +45,7 @@ knownConditionTrueFalse:lexilla/lexers/LexEiffel.cxx
variableScope:lexilla/lexers/LexErlang.cxx
knownConditionTrueFalse:lexilla/lexers/LexEScript.cxx
constParameter:lexilla/lexers/LexFortran.cxx
redundantContinue:lexilla/lexers/LexFortran.cxx
redundantCondition:lexilla/lexers/LexFSharp.cxx
knownConditionTrueFalse:lexilla/lexers/LexFSharp.cxx
constParameter:lexilla/lexers/LexGDScript.cxx
@ -102,12 +105,16 @@ knownConditionTrueFalse:lexilla/lexers/LexTxt2tags.cxx
knownConditionTrueFalse:lexilla/lexers/LexVB.cxx
constParameter:lexilla/lexers/LexVerilog.cxx
variableScope:lexilla/lexers/LexVerilog.cxx
badBitmaskCheck:lexilla/lexers/LexVerilog.cxx
uselessCallsSubstr:lexilla/lexers/LexVerilog.cxx
constParameter:lexilla/lexers/LexVHDL.cxx
shadowVariable:lexilla/lexers/LexVHDL.cxx
unreadVariable:lexilla/lexers/LexVHDL.cxx
variableScope:lexilla/lexers/LexVHDL.cxx
unreadVariable:lexilla/lexers/LexVisualProlog.cxx
unreadVariable:lexilla/lexers/LexX12.cxx
constVariable:lexilla/lexers/LexX12.cxx
uselessCallsSubstr:lexilla/lexers/LexX12.cxx
constParameter:lexilla/lexers/LexYAML.cxx
knownConditionTrueFalse:lexilla/lexers/LexYAML.cxx
@ -136,7 +143,6 @@ constVariable:lexilla/lexers/LexModula.cxx
constVariable:lexilla/lexers/LexOpal.cxx
constVariable:lexilla/lexers/LexPS.cxx
constVariable:lexilla/lexers/LexPascal.cxx
constVariable:lexilla/lexers/LexR.cxx
constVariable:lexilla/lexers/LexRebol.cxx
constVariable:lexilla/lexers/LexRuby.cxx
constVariable:lexilla/lexers/LexSorcus.cxx

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="20220827" />
<meta name="Date.Modified" content="20221012" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
@ -61,8 +61,8 @@
<font color="#FFCC99" size="4"> A library of language lexers for use with Scintilla</font>
</td>
<td width="40%" align="right">
<font color="#FFCC99" size="3">Release version 5.1.9<br />
Site last modified August 27 2022</font>
<font color="#FFCC99" size="3">Release version 5.2.0<br />
Site last modified October 12 2022</font>
</td>
<td width="20%">
&nbsp;
@ -77,12 +77,12 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.2.0 improves PowerShell and R.</li>
<li>Version 5.1.9 improves Julia and Properties.</li>
<li>Version 5.1.8 improves F#, MS SQL, PowerShell, and Visual Prolog.</li>
<li>Version 5.1.7 improves CMake, HTML, Matlab, Raku, Ruby, and VHDL.</li>
<li>Version 5.1.6 improves Markdown and Ruby.</li>
<li>Version 5.1.5 improves Bash, Batch, F#, HTML, Inno Setup, and Python.</li>
<li>Version 5.1.4 adds lexers for AsciiDoc and GDScript.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>

View File

@ -26,9 +26,9 @@
<table bgcolor="#CCCCCC" width="100%" cellspacing="0" cellpadding="8" border="0">
<tr>
<td>
<font size="4"> <a href="https://www.scintilla.org/lexilla519.zip">
<font size="4"> <a href="https://www.scintilla.org/lexilla520.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla519.tgz">
<a href="https://www.scintilla.org/lexilla520.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
@ -42,7 +42,7 @@
containing very few restrictions.
</p>
<h3>
Release 5.1.9
Release 5.2.0
</h3>
<h4>
Source Code
@ -50,8 +50,8 @@
The source code package contains all of the source code for Lexilla but no binary
executable code and is available in
<ul>
<li><a href="https://www.scintilla.org/lexilla519.zip">zip format</a> (1.2M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla519.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/lexilla520.zip">zip format</a> (1.2M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla520.tgz">tgz format</a> (0.9M) 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>

View File

@ -585,6 +585,43 @@
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla520.zip">Release 5.2.0</a>
</h3>
<ul>
<li>
Released 12 October 2022.
</li>
<li>
PowerShell: End comment before \r carriage return so \r and \n in same
SCE_POWERSHELL_DEFAULT style.
<a href="https://github.com/ScintillaOrg/lexilla/pull/99">Pull request #99</a>.
</li>
<li>
PowerShell: Fix character truncation bug that lead to 'ġ' styled as an operator since its low 8 bits
are equal to '!'.
</li>
<li>
R: Support hexadecimal, float exponent and number suffix.
<a href="https://github.com/ScintillaOrg/lexilla/issues/101">Issue #101</a>.
</li>
<li>
R: Highlight backticks.
<a href="https://github.com/ScintillaOrg/lexilla/pull/102">Pull request #102</a>.
</li>
<li>
R: Highlight raw strings.
<a href="https://github.com/ScintillaOrg/lexilla/issues/100">Issue #100</a>.
</li>
<li>
R: Optionally highlight escape sequences in strings.
<a href="https://github.com/ScintillaOrg/lexilla/issues/100">Issue #100</a>.
</li>
<li>
Fix early truncation from LexAccessor::GetRange and LexAccessor::GetRangeLowered.
<a href="https://github.com/ScintillaOrg/lexilla/issues/17">Issue #17</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla519.zip">Release 5.1.9</a>
</h3>

View File

@ -1569,6 +1569,10 @@ val SCE_R_OPERATOR=8
val SCE_R_IDENTIFIER=9
val SCE_R_INFIX=10
val SCE_R_INFIXEOL=11
val SCE_R_BACKTICKS=12
val SCE_R_RAWSTRING=13
val SCE_R_RAWSTRING2=14
val SCE_R_ESCAPESEQUENCE=15
# Lexical state for SCLEX_MAGIK
lex MagikSF=SCLEX_MAGIK SCE_MAGIK_
val SCE_MAGIK_DEFAULT=0

View File

@ -1396,6 +1396,10 @@
#define SCE_R_IDENTIFIER 9
#define SCE_R_INFIX 10
#define SCE_R_INFIXEOL 11
#define SCE_R_BACKTICKS 12
#define SCE_R_RAWSTRING 13
#define SCE_R_RAWSTRING2 14
#define SCE_R_ESCAPESEQUENCE 15
#define SCE_MAGIK_DEFAULT 0
#define SCE_MAGIK_COMMENT 1
#define SCE_MAGIK_HYPER_COMMENT 16

View File

@ -169,7 +169,7 @@ class EscapeSequence {
int digitsLeft = 0;
public:
EscapeSequence() = default;
void resetEscapeState(int nextChar) {
void resetEscapeState(int nextChar) noexcept {
digitsLeft = 0;
escapeSetValid = &setNoneNumeric;
if (nextChar == 'U') {
@ -186,7 +186,7 @@ public:
escapeSetValid = &setOctDigits;
}
}
bool atEscapeEnd(int currChar) const {
bool atEscapeEnd(int currChar) const noexcept {
return (digitsLeft <= 0) || !escapeSetValid->Contains(currChar);
}
void consumeDigit() noexcept {
@ -314,9 +314,8 @@ public:
LinePPState ForLine(Sci_Position line) const noexcept {
if ((line > 0) && (vlls.size() > static_cast<size_t>(line))) {
return vlls[line];
} else {
return LinePPState();
}
return {};
}
void Add(Sci_Position line, LinePPState lls) {
vlls.resize(line+1);
@ -727,6 +726,8 @@ Sci_Position SCI_METHOD LexerCPP::WordListSet(int n, const char *wl) {
case 5:
wordListN = &markerList;
break;
default:
break;
}
Sci_Position firstModification = -1;
if (wordListN) {
@ -1426,7 +1427,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
if (options.updatePreprocessor && preproc.IsActive()) {
const std::string restOfLine = GetRestOfLine(styler, sc.currentPos + 5, false);
Tokens tokens = Tokenize(restOfLine);
if (tokens.size() >= 1) {
if (!tokens.empty()) {
const std::string key = tokens[0];
preprocessorDefinitions.erase(key);
ppDefineHistory.emplace_back(lineCurrent, key, "", true);
@ -1812,7 +1813,7 @@ bool LexerCPP::EvaluateExpression(const std::string &expr, const SymbolTable &pr
// "0" or "" -> false else true
const bool isFalse = tokens.empty() ||
((tokens.size() == 1) && (((tokens[0]).empty()) || tokens[0] == "0"));
((tokens.size() == 1) && (tokens[0].empty() || tokens[0] == "0"));
return !isFalse;
}

View File

@ -29,19 +29,19 @@
using namespace Lexilla;
// Extended to accept accented characters
static inline bool IsAWordChar(int ch) {
return ch >= 0x80 || isalnum(ch & 0xFF) || ch == '-' || ch == '_';
static inline bool IsAWordChar(int ch) noexcept {
return ch >= 0x80 || isalnum(ch) || ch == '-' || ch == '_';
}
static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *keywordlists[], Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
WordList &keywords4 = *keywordlists[3];
WordList &keywords5 = *keywordlists[4];
WordList &keywords6 = *keywordlists[5];
const WordList &keywords = *keywordlists[0];
const WordList &keywords2 = *keywordlists[1];
const WordList &keywords3 = *keywordlists[2];
const WordList &keywords4 = *keywordlists[3];
const WordList &keywords5 = *keywordlists[4];
const WordList &keywords6 = *keywordlists[5];
styler.StartAt(startPos);
@ -50,7 +50,7 @@ static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length,
for (; sc.More(); sc.Forward()) {
if (sc.state == SCE_POWERSHELL_COMMENT) {
if (sc.atLineEnd) {
if (sc.MatchLineEnd()) {
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_COMMENTSTREAM) {
@ -107,7 +107,7 @@ static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length,
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_OPERATOR) {
if (!isoperator(static_cast<char>(sc.ch))) {
if (!isoperator(sc.ch)) {
sc.SetState(SCE_POWERSHELL_DEFAULT);
}
} else if (sc.state == SCE_POWERSHELL_IDENTIFIER) {
@ -148,7 +148,7 @@ static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length,
sc.SetState(SCE_POWERSHELL_VARIABLE);
} else if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_POWERSHELL_NUMBER);
} else if (isoperator(static_cast<char>(sc.ch))) {
} else if (isoperator(sc.ch)) {
sc.SetState(SCE_POWERSHELL_OPERATOR);
} else if (IsAWordChar(sc.ch)) {
sc.SetState(SCE_POWERSHELL_IDENTIFIER);
@ -165,10 +165,10 @@ static void ColourisePowerShellDoc(Sci_PositionU startPos, Sci_Position length,
// and to make it possible to fiddle the current level for "} else {".
static void FoldPowerShellDoc(Sci_PositionU startPos, Sci_Position length, int initStyle,
WordList *[], Accessor &styler) {
bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
Sci_PositionU endPos = startPos + length;
const bool foldComment = styler.GetPropertyInt("fold.comment") != 0;
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
const bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
const Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
@ -180,12 +180,12 @@ static void FoldPowerShellDoc(Sci_PositionU startPos, Sci_Position length, int i
int styleNext = styler.StyleAt(startPos);
int style = initStyle;
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
const char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int stylePrev = style;
const int stylePrev = style;
style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_POWERSHELL_OPERATOR) {
if (ch == '{') {
// Measure the minimum before a '{' to allow

View File

@ -6,12 +6,8 @@
// Copyright 1998-2002 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 <cassert>
#include <cctype>
#include <string>
#include <string_view>
@ -29,17 +25,17 @@
using namespace Lexilla;
static inline bool IsAWordChar(const int ch) {
return IsASCII(ch) && (isalnum(ch) || ch == '.' || ch == '_');
namespace {
inline bool IsAWordChar(int ch) noexcept {
return (ch < 0x80) && (isalnum(ch) || ch == '.' || ch == '_');
}
static inline bool IsAWordStart(const int ch) {
return IsASCII(ch) && (isalnum(ch) || ch == '_');
inline bool IsAWordStart(int ch) noexcept {
return (ch < 0x80) && (isalnum(ch) || ch == '_');
}
static inline bool IsAnOperator(const int ch) {
if (IsASCII(ch) && isalnum(ch))
return false;
constexpr bool IsAnOperator(int ch) noexcept {
// '.' left out as it is used to make up numbers
if (ch == '-' || ch == '+' || ch == '!' || ch == '~' ||
ch == '?' || ch == ':' || ch == '*' || ch == '/' ||
@ -51,36 +47,103 @@ static inline bool IsAnOperator(const int ch) {
return false;
}
static void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
constexpr bool IsOctalOrHex(int ch, bool hex) noexcept {
return IsAnOctalDigit(ch) || (hex && IsAHeXDigit(ch));
}
// https://search.r-project.org/R/refmans/base/html/Quotes.html
struct EscapeSequence {
int outerState = SCE_R_DEFAULT;
int digitsLeft = 0;
bool hex = false;
bool brace = false;
// highlight any character as escape sequence, unrecognized escape sequence is syntax error.
void resetEscapeState(int state, int chNext) noexcept {
outerState = state;
digitsLeft = 1;
hex = true;
brace = false;
if (chNext == 'x') {
digitsLeft = 3;
} else if (chNext == 'u') {
digitsLeft = 5;
} else if (chNext == 'U') {
digitsLeft = 9;
} else if (IsAnOctalDigit(chNext)) {
digitsLeft = 3;
hex = false;
}
}
bool atEscapeEnd(int ch) noexcept {
--digitsLeft;
return digitsLeft <= 0 || !IsOctalOrHex(ch, hex);
}
};
int CheckRawString(LexAccessor &styler, Sci_Position pos, int &dashCount) {
dashCount = 0;
while (true) {
const char ch = styler.SafeGetCharAt(pos++);
switch (ch) {
case '-':
++dashCount;
break;
case '(':
return ')';
case '[':
return ']';
case '{':
return '}';
default:
dashCount = 0;
return 0;
}
}
}
void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initStyle, WordList *keywordlists[],
Accessor &styler) {
WordList &keywords = *keywordlists[0];
WordList &keywords2 = *keywordlists[1];
WordList &keywords3 = *keywordlists[2];
// Do not leak onto next line
if (initStyle == SCE_R_INFIXEOL)
initStyle = SCE_R_DEFAULT;
const WordList &keywords = *keywordlists[0];
const WordList &keywords2 = *keywordlists[1];
const WordList &keywords3 = *keywordlists[2];
// state for raw string
int matchingDelimiter = 0;
int dashCount = 0;
// property lexer.r.escape.sequence
// Set to 1 to enable highlighting of escape sequences in strings.
const bool escapeSequence = styler.GetPropertyInt("lexer.r.escape.sequence", 0) != 0;
EscapeSequence escapeSeq;
StyleContext sc(startPos, length, initStyle, styler);
for (; sc.More(); sc.Forward()) {
if (sc.atLineStart && (sc.state == SCE_R_STRING)) {
// Prevent SCE_R_STRINGEOL from leaking back to previous line
sc.SetState(SCE_R_STRING);
if (sc.currentLine > 0) {
const int lineState = styler.GetLineState(sc.currentLine - 1);
matchingDelimiter = lineState & 0xff;
dashCount = lineState >> 8;
}
for (; sc.More(); sc.Forward()) {
// Determine if the current state should terminate.
if (sc.state == SCE_R_OPERATOR) {
switch (sc.state) {
case SCE_R_OPERATOR:
sc.SetState(SCE_R_DEFAULT);
} else if (sc.state == SCE_R_NUMBER) {
if (!IsADigit(sc.ch) && !(sc.ch == '.' && IsADigit(sc.chNext))) {
break;
case SCE_R_NUMBER:
// https://cran.r-project.org/doc/manuals/r-release/R-lang.html#Literal-constants
if (AnyOf(sc.ch, 'e', 'E', 'p', 'P') && (IsADigit(sc.chNext) || sc.chNext == '+' || sc.chNext == '-')) {
sc.Forward(); // exponent part
} else if (!(IsAHeXDigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext)))) {
if (AnyOf(sc.ch, 'L', 'i')) {
sc.Forward(); // integer and complex qualifier
}
sc.SetState(SCE_R_DEFAULT);
}
} else if (sc.state == SCE_R_IDENTIFIER) {
break;
case SCE_R_IDENTIFIER:
if (!IsAWordChar(sc.ch)) {
char s[100];
sc.GetCurrent(s, sizeof(s));
@ -93,39 +156,101 @@ static void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initS
}
sc.SetState(SCE_R_DEFAULT);
}
} else if (sc.state == SCE_R_COMMENT) {
if (sc.ch == '\r' || sc.ch == '\n') {
break;
case SCE_R_COMMENT:
if (sc.MatchLineEnd()) {
sc.SetState(SCE_R_DEFAULT);
}
} else if (sc.state == SCE_R_STRING) {
break;
case SCE_R_STRING:
case SCE_R_STRING2:
case SCE_R_BACKTICKS:
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
if (escapeSequence) {
escapeSeq.resetEscapeState(sc.state, sc.chNext);
sc.SetState(SCE_R_ESCAPESEQUENCE);
sc.Forward();
if (sc.chNext == '{' && AnyOf(sc.ch, 'u', 'U')) {
escapeSeq.brace = true;
sc.Forward();
} else if (sc.MatchLineEnd()) {
// don't highlight line ending as escape sequence:
// escapeSeq.outerState is lost when editing on next line.
sc.SetState(escapeSeq.outerState);
}
} else {
sc.Forward(); // Skip all characters after the backslash
}
} else if ((sc.state == SCE_R_STRING && sc.ch == '\"')
|| (sc.state == SCE_R_STRING2 && sc.ch == '\'')
|| (sc.state == SCE_R_BACKTICKS && sc.ch == '`')) {
sc.ForwardSetState(SCE_R_DEFAULT);
}
break;
case SCE_R_ESCAPESEQUENCE:
if (escapeSeq.atEscapeEnd(sc.ch)) {
if (escapeSeq.brace && sc.ch == '}') {
sc.Forward();
}
} else if (sc.ch == '\"') {
sc.ForwardSetState(SCE_R_DEFAULT);
sc.SetState(escapeSeq.outerState);
continue;
}
} else if (sc.state == SCE_R_INFIX) {
break;
case SCE_R_RAWSTRING:
case SCE_R_RAWSTRING2:
while (sc.ch == matchingDelimiter) {
sc.Forward();
int count = dashCount;
while (count != 0 && sc.ch == '-') {
--count;
sc.Forward();
}
if (count == 0 && sc.ch == ((sc.state == SCE_R_RAWSTRING) ? '\"' : '\'')) {
matchingDelimiter = 0;
dashCount = 0;
sc.ForwardSetState(SCE_R_DEFAULT);
break;
}
}
break;
case SCE_R_INFIX:
if (sc.ch == '%') {
sc.ForwardSetState(SCE_R_DEFAULT);
} else if (sc.atLineEnd) {
sc.ChangeState(SCE_R_INFIXEOL);
sc.ForwardSetState(SCE_R_DEFAULT);
}
}else if (sc.state == SCE_R_STRING2) {
if (sc.ch == '\\') {
if (sc.chNext == '\"' || sc.chNext == '\'' || sc.chNext == '\\') {
sc.Forward();
}
} else if (sc.ch == '\'') {
sc.ForwardSetState(SCE_R_DEFAULT);
break;
case SCE_R_INFIXEOL:
if (sc.atLineStart) {
sc.SetState(SCE_R_DEFAULT);
}
break;
}
// Determine if a new state should be entered.
if (sc.state == SCE_R_DEFAULT) {
if (IsADigit(sc.ch) || (sc.ch == '.' && IsADigit(sc.chNext))) {
sc.SetState(SCE_R_NUMBER);
if (sc.ch == '0' && AnyOf(sc.chNext, 'x', 'X')) {
sc.Forward();
}
} else if (AnyOf(sc.ch, 'r', 'R') && AnyOf(sc.chNext, '\"', '\'')) {
const int chNext = sc.chNext;
matchingDelimiter = CheckRawString(styler, sc.currentPos + 2, dashCount);
if (matchingDelimiter) {
sc.SetState((chNext == '\"') ? SCE_R_RAWSTRING : SCE_R_RAWSTRING2);
sc.Forward(dashCount + 2);
} else {
// syntax error
sc.SetState(SCE_R_IDENTIFIER);
sc.ForwardSetState((chNext == '\"') ? SCE_R_STRING : SCE_R_STRING2);
}
} else if (IsAWordStart(sc.ch) ) {
sc.SetState(SCE_R_IDENTIFIER);
} else if (sc.Match('#')) {
@ -136,10 +261,17 @@ static void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initS
sc.SetState(SCE_R_INFIX);
} else if (sc.ch == '\'') {
sc.SetState(SCE_R_STRING2);
} else if (sc.ch == '`') {
sc.SetState(SCE_R_BACKTICKS);
} else if (IsAnOperator(sc.ch)) {
sc.SetState(SCE_R_OPERATOR);
}
}
if (sc.atLineEnd) {
const int lineState = matchingDelimiter | (dashCount << 8);
styler.SetLineState(sc.currentLine, lineState);
}
}
sc.Complete();
}
@ -147,11 +279,11 @@ static void ColouriseRDoc(Sci_PositionU startPos, Sci_Position length, int initS
// Store both the current line's fold level and the next lines in the
// level store to make it easy to pick up with each increment
// and to make it possible to fiddle the current level for "} else {".
static void FoldRDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
void FoldRDoc(Sci_PositionU startPos, Sci_Position length, int, WordList *[],
Accessor &styler) {
bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
Sci_PositionU endPos = startPos + length;
const bool foldCompact = styler.GetPropertyInt("fold.compact", 1) != 0;
const bool foldAtElse = styler.GetPropertyInt("fold.at.else", 0) != 0;
const Sci_PositionU endPos = startPos + length;
int visibleChars = 0;
Sci_Position lineCurrent = styler.GetLine(startPos);
int levelCurrent = SC_FOLDLEVELBASE;
@ -162,11 +294,11 @@ static void FoldRDoc(Sci_PositionU startPos, Sci_Position length, int, WordList
char chNext = styler[startPos];
int styleNext = styler.StyleAt(startPos);
for (Sci_PositionU i = startPos; i < endPos; i++) {
char ch = chNext;
const char ch = chNext;
chNext = styler.SafeGetCharAt(i + 1);
int style = styleNext;
const int style = styleNext;
styleNext = styler.StyleAt(i + 1);
bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
const bool atEOL = (ch == '\r' && chNext != '\n') || (ch == '\n');
if (style == SCE_R_OPERATOR) {
if (ch == '{') {
// Measure the minimum before a '{' to allow
@ -203,15 +335,15 @@ static void FoldRDoc(Sci_PositionU startPos, Sci_Position length, int, WordList
}
static const char * const RWordLists[] = {
const char * const RWordLists[] = {
"Language Keywords",
"Base / Default package function",
"Other Package Functions",
"Unused",
"Unused",
0,
nullptr,
};
}
LexerModule lmR(SCLEX_R, ColouriseRDoc, "r", FoldRDoc, RWordLists);

View File

@ -93,6 +93,16 @@ constexpr bool IsADigit(int ch) noexcept {
return (ch >= '0') && (ch <= '9');
}
constexpr bool IsAHeXDigit(int ch) noexcept {
return (ch >= '0' && ch <= '9')
|| (ch >= 'A' && ch <= 'F')
|| (ch >= 'a' && ch <= 'f');
}
constexpr bool IsAnOctalDigit(int ch) noexcept {
return ch >= '0' && ch <= '7';
}
constexpr bool IsADigit(int ch, int base) noexcept {
if (base <= 10) {
return (ch >= '0') && (ch < '0' + base);

View File

@ -58,7 +58,7 @@ std::string LexAccessor::GetRange(Sci_PositionU startPos_, Sci_PositionU endPos_
assert(startPos_ < endPos_);
const Sci_PositionU len = endPos_ - startPos_;
std::string s(len, '\0');
GetRange(startPos_, endPos_, s.data(), len);
GetRange(startPos_, endPos_, s.data(), len + 1);
return s;
}
@ -66,7 +66,7 @@ std::string LexAccessor::GetRangeLowered(Sci_PositionU startPos_, Sci_PositionU
assert(startPos_ < endPos_);
const Sci_PositionU len = endPos_ - startPos_;
std::string s(len, '\0');
GetRangeLowered(startPos_, endPos_, s.data(), len);
GetRangeLowered(startPos_, endPos_, s.data(), len + 1);
return s;
}

View File

@ -15,7 +15,7 @@
<key>CFBundlePackageType</key>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>5.1.9</string>
<string>5.2.0</string>
<key>CFBundleVersion</key>
<string>$(CURRENT_PROJECT_VERSION)</string>
<key>NSHumanReadableCopyright</key>

View File

@ -875,7 +875,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.1.9;
CURRENT_PROJECT_VERSION = 5.2.0;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;
@ -901,7 +901,7 @@
buildSettings = {
CLANG_CXX_LANGUAGE_STANDARD = "gnu++17";
CODE_SIGN_STYLE = Automatic;
CURRENT_PROJECT_VERSION = 5.1.9;
CURRENT_PROJECT_VERSION = 5.2.0;
DEVELOPMENT_TEAM = 4F446KW87E;
DYLIB_COMPATIBILITY_VERSION = 1;
DYLIB_CURRENT_VERSION = 1;

View File

@ -4,8 +4,8 @@
#include <windows.h>
#define VERSION_LEXILLA "5.1.9"
#define VERSION_WORDS 5, 1, 9, 0
#define VERSION_LEXILLA "5.2.0"
#define VERSION_WORDS 5, 2, 0, 0
VS_VERSION_INFO VERSIONINFO
FILEVERSION VERSION_WORDS

View File

@ -1 +1 @@
519
520

View File

@ -60,7 +60,7 @@ EDITLEXER lexPS =
&KeyWords_PS, {
{ {STYLE_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
//{ {SCE_POWERSHELL_DEFAULT}, IDS_LEX_STR_63126, L"Default", L"", L"" },
{ {MULTI_STYLE(SCE_POWERSHELL_COMMENT,SCE_POWERSHELL_COMMENTSTREAM,0,0)}, IDS_LEX_STR_63127, L"Comment", L"fore:#646464", L"" },
{ {MULTI_STYLE(SCE_POWERSHELL_COMMENT,SCE_POWERSHELL_COMMENTSTREAM,SCE_POWERSHELL_COMMENTDOCKEYWORD,0)}, IDS_LEX_STR_63127, L"Comment", L"fore:#646464", L"" },
{ {SCE_POWERSHELL_KEYWORD}, IDS_LEX_STR_63128, L"Keyword", L"bold; fore:#804000", L"" },
{ {SCE_POWERSHELL_IDENTIFIER}, IDS_LEX_STR_63129, L"Identifier", L"", L"" },
{ {MULTI_STYLE(SCE_POWERSHELL_STRING,SCE_POWERSHELL_CHARACTER,0,0)}, IDS_LEX_STR_63131, L"String", L"fore:#008000", L"" },
@ -69,6 +69,7 @@ EDITLEXER lexPS =
{ {SCE_POWERSHELL_VARIABLE}, IDS_LEX_STR_63249, L"Variable", L"fore:#0A246A", L"" },
{ {MULTI_STYLE(SCE_POWERSHELL_CMDLET,SCE_POWERSHELL_FUNCTION,0,0)}, IDS_LEX_STR_63250, L"Cmdlet", L"fore:#804000; back:#FFF1A8", L"" },
{ {SCE_POWERSHELL_ALIAS}, IDS_LEX_STR_63251, L"Alias", L"bold; fore:#0A246A", L"" },
//{ {MULTI_STYLE(SCE_POWERSHELL_HERE_STRING,SCE_POWERSHELL_HERE_CHARACTER,0,0)}, IDS_LEX_STR_63131, L"Here String", L"fore:#008000", L"" },
EDITLEXER_SENTINEL
}
};

View File

@ -87,6 +87,9 @@ EDITLEXER lexR =
{ {SCE_R_IDENTIFIER}, IDS_LEX_STR_63129, L"Identifier", L"", L"" },
{ {SCE_R_INFIX}, IDS_LEX_STR_63269, L"Infix", L"fore:#660066", L"" },
{ {SCE_R_INFIXEOL}, IDS_LEX_STR_63270, L"Infix EOL", L"fore:#FF4000; back:#E0C0E0; eolfilled", L"" },
{ {SCE_R_BACKTICKS}, IDS_LEX_STR_63397, L"Backticks", L"fore:#3C6CDD", L"" },
{ {MULTI_STYLE(SCE_R_RAWSTRING,SCE_R_RAWSTRING2,0,0)}, IDS_LEX_STR_63301, L"Literal String", L"italic; fore:#3C6CDD", L"" },
{ {SCE_R_ESCAPESEQUENCE}, IDS_LEX_STR_63366, L"ESC Sequence", L"fore:#0080C0", L"" },
EDITLEXER_SENTINEL
}
};