Skip to content

Commit

Permalink
Update to scintilla 5.5.1 & Lexilla 5.3.3
Browse files Browse the repository at this point in the history
Release 5.5.1 ( https://www.scintilla.org/scintilla551.zip )

    Released 22 July 2024.
    SCI_CUTALLOWLINE added which is similar to SCI_COPYALLOWLINE but also deletes the copied text. Feature notepad-plus-plus#1518.
    Can set font used for autocompletion lists with SCI_AUTOCSETSTYLE. Feature notepad-plus-plus#1523.
    Increase maximum zoom set interactively to +60 points. Feature notepad-plus-plus#1517.
    Fix flickering cursor after some mouse action sequences. Bug notepad-plus-plus#2443.

Release 5.3.3 ( https://www.scintilla.org/lexilla533.zip )

    Released 22 July 2024.
    ASP: Control whether ASP is enabled for XML and HTML with lexer.xml.allow.asp and lexer.html.allow.asp. Issue notepad-plus-plus#252.
    JavaScript: Recognize regular expressions at start or after '>' in JavaScript when lexer is cpp, hypertext, or xml. Issue notepad-plus-plus#250, Bug notepad-plus-plus#918.
    JavaScript: Recognize initial #! 'shebang' line as a comment in standalone files. Issue notepad-plus-plus#253.
    Lua: Fix non-ASCII identifiers joined with '.' or ':'. Issue notepad-plus-plus#242.
    Lua: Fix folding for multi-line SCE_LUA_LITERALSTRING and SCE_LUA_COMMENT when performed incrementally. Issue notepad-plus-plus#247.
    PHP: Control whether PHP is enabled for XML and HTML with lexer.xml.allow.php and lexer.html.allow.php. Issue notepad-plus-plus#252.

Close notepad-plus-plus#15466
  • Loading branch information
chcg authored and donho committed Jul 23, 2024
1 parent d805dcb commit d8c6350
Show file tree
Hide file tree
Showing 83 changed files with 1,010 additions and 461 deletions.
Binary file not shown.
Binary file not shown.
12 changes: 6 additions & 6 deletions lexilla/.github/workflows/build-check-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on: [push]
jobs:
build:

runs-on: macos-11
runs-on: macos-latest

strategy:
matrix:
Expand All @@ -18,16 +18,16 @@ jobs:
(cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip)
(cd .. && unzip scintilla500.zip)
- name: Unit Test
run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test)
run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) test)
- name: Build Lexilla
run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}})
run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN))
- uses: actions/upload-artifact@v4
with:
name: liblexilla.dylib
path: bin/liblexilla.dylib
- name: Test lexing and folding
run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test)
run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) test)
- name: CheckLexilla C Example
run: (cd examples/CheckLexilla && make DEBUG=1 check)
run: (cd examples/CheckLexilla && make DEBUG=1 --jobs=$(getconf _NPROCESSORS_ONLN) check)
- name: SimpleLexer Example
run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} check)
run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) check)
4 changes: 2 additions & 2 deletions lexilla/.github/workflows/build-check-win32.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,11 @@ jobs:
- name: CheckLexilla C Example
run: |
cd examples/CheckLexilla
cl CheckLexilla.c -I ../../include -Fe: CheckLexilla
cl -MP CheckLexilla.c -I ../../include -Fe: CheckLexilla
.\CheckLexilla.exe
cd ../..
- name: SimpleLexer Example
run: |
cd examples/SimpleLexer
cl -std:c++17 -EHsc -LD -I ../../../scintilla/include -I ../../include -I ../../lexlib SimpleLexer.cxx ../../lexlib/*.cxx
cl -MP -std:c++17 -EHsc -LD -I ../../../scintilla/include -I ../../include -I ../../lexlib SimpleLexer.cxx ../../lexlib/*.cxx
cd ../..
10 changes: 5 additions & 5 deletions lexilla/.github/workflows/build-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ jobs:
(cd .. && wget --no-verbose https://www.scintilla.org/scintilla500.zip)
(cd .. && unzip scintilla500.zip)
- name: Unit Test
run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test)
run: (cd test/unit && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) test)
- name: Build Lexilla
run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}})
run: (cd src && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN))
- uses: actions/upload-artifact@v4
with:
name: liblexilla-${{matrix.cpp_compiler}}.so
path: bin/liblexilla.so
overwrite: true
- name: Test lexing and folding
run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} test)
run: (cd test && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) test)
- name: CheckLexilla C Example
run: (cd examples/CheckLexilla && make DEBUG=1 check)
run: (cd examples/CheckLexilla && make DEBUG=1 --jobs=$(getconf _NPROCESSORS_ONLN) check)
- name: SimpleLexer Example
run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} check)
run: (cd examples/SimpleLexer && make DEBUG=1 CXX=${{matrix.cpp_compiler}} --jobs=$(getconf _NPROCESSORS_ONLN) check)
10 changes: 9 additions & 1 deletion lexilla/cppcheck.suppress
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ useInitializationList
// produces same result on empty collections
useStlAlgorithm

// Common for lexer object destructors
missingOverride

// Some non-explicit constructors are used for conversions or are private to lexers
noExplicitConstructor

Expand Down Expand Up @@ -153,7 +156,6 @@ constVariableReference:lexilla/lexers/LexTCL.cxx
invalidscanf:lexilla/lexers/LexTCMD.cxx
constParameterReference:lexilla/lexers/LexTeX.cxx
variableScope:lexilla/lexers/LexTeX.cxx
knownConditionTrueFalse:lexilla/lexers/LexTxt2tags.cxx
knownConditionTrueFalse:lexilla/lexers/LexVB.cxx
constParameterReference:lexilla/lexers/LexVerilog.cxx
variableScope:lexilla/lexers/LexVerilog.cxx
Expand Down Expand Up @@ -205,3 +207,9 @@ knownConditionTrueFalse:lexilla/test/unit/testCharacterSet.cxx

// cppcheck fails REQUIRE from Catch
comparisonOfFuncReturningBoolError:lexilla/test/unit/*.cxx

// cppcheck fails SECTION from Catch
syntaxError:lexilla/test/unit/*.cxx

// argv has a standardised type
constParameter:lexilla/examples/CheckLexilla/CheckLexilla.c
8 changes: 4 additions & 4 deletions lexilla/doc/Lexilla.html
Original file line number Diff line number Diff line change
Expand Up @@ -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="20240423" />
<meta name="Date.Modified" content="20240722" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<style type="text/css">
.logo {
Expand Down Expand Up @@ -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.3.2<br />
Site last modified April 23 2024</font>
<font color="#FFCC99" size="3">Release version 5.3.3<br />
Site last modified July 22 2024</font>
</td>
<td width="20%">
&nbsp;
Expand All @@ -77,11 +77,11 @@
</tr>
</table>
<ul id="versionlist">
<li>Version 5.3.3 improves HTML, JavaScript, Lua, PHP, and XML.</li>
<li>Version 5.3.2 improves COBOL, HTML, Lua, Ruby, and Rust.</li>
<li>Version 5.3.1 improves Assembler, Bash, Batch, JavaScript, Python, and Ruby.</li>
<li>Version 5.3.0 improves Bash, HTML, and Lua.</li>
<li>Version 5.2.9 fixes potential problems on macOS 12 and older when built with Xcode 15.0.</li>
<li>Version 5.2.8 improves Python and R.</li>
</ul>
<ul id="menu">
<li id="remote1"><a href="https://www.scintilla.org/SciTEImage.html">Screenshot</a></li>
Expand Down
10 changes: 5 additions & 5 deletions lexilla/doc/LexillaDownload.html
Original file line number Diff line number Diff line change
Expand Up @@ -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/lexilla532.zip">
<font size="4"> <a href="https://www.scintilla.org/lexilla533.zip">
Windows</a>&nbsp;&nbsp;
<a href="https://www.scintilla.org/lexilla532.tgz">
<a href="https://www.scintilla.org/lexilla533.tgz">
GTK/Linux</a>&nbsp;&nbsp;
</font>
</td>
Expand All @@ -42,16 +42,16 @@ <h2>
containing very few restrictions.
</p>
<h3>
Release 5.3.2
Release 5.3.3
</h3>
<h4>
Source Code
</h4>
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/lexilla532.zip">zip format</a> (1.3M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla532.tgz">tgz format</a> (0.9M) commonly used on Linux and compatible operating systems</li>
<li><a href="https://www.scintilla.org/lexilla533.zip">zip format</a> (1.3M) commonly used on Windows</li>
<li><a href="https://www.scintilla.org/lexilla533.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>
Expand Down
37 changes: 37 additions & 0 deletions lexilla/doc/LexillaHistory.html
Original file line number Diff line number Diff line change
Expand Up @@ -588,6 +588,43 @@ <h2>Contributors</h2>
</tr>
</table>
<h2>Releases</h2>
<h3>
<a href="https://www.scintilla.org/lexilla533.zip">Release 5.3.3</a>
</h3>
<ul>
<li>
Released 22 July 2024.
</li>
<li>
ASP: Control whether ASP is enabled for XML and HTML with
lexer.xml.allow.asp and lexer.html.allow.asp.
<a href="https://github.com/ScintillaOrg/lexilla/issues/252">Issue #252</a>.
</li>
<li>
JavaScript: Recognize regular expressions at start or after '&gt;' in JavaScript when lexer is cpp,
hypertext, or xml.
<a href="https://github.com/ScintillaOrg/lexilla/issues/250">Issue #250</a>,
<a href="https://sourceforge.net/p/scintilla/bugs/918/">Bug #918</a>.
</li>
<li>
JavaScript: Recognize initial #! 'shebang' line as a comment in standalone files.
<a href="https://github.com/ScintillaOrg/lexilla/issues/253">Issue #253</a>.
</li>
<li>
Lua: Fix non-ASCII identifiers joined with '.' or ':'.
<a href="https://github.com/ScintillaOrg/lexilla/issues/242">Issue #242</a>.
</li>
<li>
Lua: Fix folding for multi-line SCE_LUA_LITERALSTRING and SCE_LUA_COMMENT
when performed incrementally.
<a href="https://github.com/ScintillaOrg/lexilla/issues/247">Issue #247</a>.
</li>
<li>
PHP: Control whether PHP is enabled for XML and HTML with
lexer.xml.allow.php and lexer.html.allow.php.
<a href="https://github.com/ScintillaOrg/lexilla/issues/252">Issue #252</a>.
</li>
</ul>
<h3>
<a href="https://www.scintilla.org/lexilla532.zip">Release 5.3.2</a>
</h3>
Expand Down
18 changes: 13 additions & 5 deletions lexilla/examples/SimpleLexer/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,15 @@

INCLUDES = -I ../../../scintilla/include -I ../../include -I ../../lexlib

BASE_FLAGS += --std=c++17 -shared
BASE_FLAGS += --std=c++17

ifdef windir
SHAREDEXTENSION = dll
else
ifeq ($(shell uname),Darwin)
SHAREDEXTENSION = dylib
BASE_FLAGS += -dynamiclib -arch arm64 -arch x86_64
BASE_FLAGS += -arch arm64 -arch x86_64
LINK_FLAGS += -dynamiclib
else
BASE_FLAGS += -fPIC
SHAREDEXTENSION = so
Expand All @@ -23,7 +24,14 @@ ifdef windir
endif

LIBRARY = SimpleLexer.$(SHAREDEXTENSION)
LEXLIB = ../../lexlib/*.cxx

vpath %.cxx ../../lexlib

LEXLIB_SOURCES := $(sort $(notdir $(wildcard ../../lexlib/*.cxx)))
LEXLIB = $(LEXLIB_SOURCES:.cxx=.o)

%.o: %.cxx
$(CXX) $(INCLUDES) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) -c $< -o $@

all: $(LIBRARY)

Expand All @@ -34,5 +42,5 @@ check: $(LIBRARY)
clean:
$(RM) *.o *obj *.lib *.exp $(LIBRARY)

$(LIBRARY): *.cxx
$(CXX) $(INCLUDES) $(BASE_FLAGS) $(CPPFLAGS) $(CXXFLAGS) $^ $(LEXLIB) $(LIBS) $(LDLIBS) -o $@
$(LIBRARY): $(LEXLIB) *.cxx
$(CXX) $(INCLUDES) $(LINK_FLAGS) $(BASE_FLAGS) -shared $(CPPFLAGS) $(CXXFLAGS) $^ $(LIBS) $(LDLIBS) -o $@
8 changes: 7 additions & 1 deletion lexilla/lexers/LexCPP.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,7 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i
const StyleContext::Transform transform = caseSensitive ?
StyleContext::Transform::none : StyleContext::Transform::lower;

const CharacterSet setOKBeforeRE("([{=,:;!%^&*|?~+-");
const CharacterSet setOKBeforeRE("([{=,:;!%^&*|?~+-> ");
const CharacterSet setCouldBePostOp("+-");

const CharacterSet setDoxygen(CharacterSet::setAlpha, "$@\\&<>#{}[]");
Expand Down Expand Up @@ -890,6 +890,12 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i

Sci_PositionU lineEndNext = styler.LineEnd(lineCurrent);

if (sc.currentPos == 0 && sc.Match('#', '!')) {
// Shell Shebang at beginning of file
sc.SetState(SCE_C_COMMENTLINE);
sc.Forward();
}

for (; sc.More();) {

if (sc.atLineStart) {
Expand Down
4 changes: 3 additions & 1 deletion lexilla/lexers/LexDMAP.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,12 @@
#include "LexerModule.h"
/***************************************/

#if defined(__clang__) && !defined(__APPLE__)
#if defined(__clang__)
#if __has_warning("-Wunused-but-set-variable")
// Disable warning for numNonBlank
#pragma clang diagnostic ignored "-Wunused-but-set-variable"
#endif
#endif

using namespace Lexilla;

Expand Down
56 changes: 47 additions & 9 deletions lexilla/lexers/LexHTML.cxx
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,30 @@ constexpr bool isPHPStringState(int state) noexcept {
(state == SCE_HPHP_COMPLEX_VARIABLE);
}

enum class AllowPHP : int {
None, // No PHP
PHP, // <?php and <?=
Question, // <?
};

constexpr bool IsPHPEntryState(int state) noexcept {
return !(isPHPStringState(state) || IsScriptCommentState(state) || AnyOf(state, SCE_H_ASPAT, SCE_HPHP_COMMENT, SCE_HPHP_COMMENTLINE));
}

bool IsPHPStart(AllowPHP allowPHP, Accessor &styler, Sci_PositionU start) {
if (allowPHP == AllowPHP::None) {
return false;
}
if (allowPHP == AllowPHP::PHP) {
// Require <?php or <?=
constexpr std::string_view phpTag = "<?php";
constexpr std::string_view echoTag = "<?=";
const std::string tag = styler.GetRangeLowered(start, start + phpTag.length());
return (tag == phpTag) || (tag.substr(0, echoTag.length()) == echoTag);
}
return true;
}

Sci_Position FindPhpStringDelimiter(std::string &phpStringDelimiter, Sci_Position i, const Sci_Position lengthDoc, Accessor &styler, bool &isSimpleString) {
const Sci_Position beginning = i - 1;
bool isQuoted = false;
Expand Down Expand Up @@ -722,8 +746,12 @@ struct OptionsHTML {
int aspDefaultLanguage = eScriptJS;
bool caseSensitive = false;
bool allowScripts = true;
AllowPHP allowPHPinXML = AllowPHP::Question;
AllowPHP allowPHPinHTML = AllowPHP::Question;
bool isMako = false;
bool isDjango = false;
bool allowASPinXML = true;
bool allowASPinHTML = true;
bool fold = false;
bool foldHTML = false;
bool foldHTMLPreprocessor = true;
Expand Down Expand Up @@ -767,12 +795,26 @@ struct OptionSetHTML : public OptionSet<OptionsHTML> {
DefineProperty("lexer.xml.allow.scripts", &OptionsHTML::allowScripts,
"Set to 0 to disable scripts in XML.");

DefineProperty("lexer.xml.allow.php", &OptionsHTML::allowPHPinXML,
"Set to 0 to disable PHP in XML, 1 to accept <?php and <?=, 2 to also accept <?."
"The default is 2.");

DefineProperty("lexer.html.allow.php", &OptionsHTML::allowPHPinHTML,
"Set to 0 to disable PHP in HTML, 1 to accept <?php and <?=, 2 to also accept <?."
"The default is 2.");

DefineProperty("lexer.html.mako", &OptionsHTML::isMako,
"Set to 1 to enable the mako template language.");

DefineProperty("lexer.html.django", &OptionsHTML::isDjango,
"Set to 1 to enable the django template language.");

DefineProperty("lexer.xml.allow.asp", &OptionsHTML::allowASPinXML,
"Set to 0 to disable ASP in XML.");

DefineProperty("lexer.html.allow.asp", &OptionsHTML::allowASPinHTML,
"Set to 0 to disable ASP in HTML.");

DefineProperty("fold", &OptionsHTML::fold);

DefineProperty("fold.html", &OptionsHTML::foldHTML,
Expand Down Expand Up @@ -1219,13 +1261,15 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
const bool foldXmlAtTagOpen = isXml && fold && options.foldXmlAtTagOpen;
const bool caseSensitive = options.caseSensitive;
const bool allowScripts = options.allowScripts;
const AllowPHP allowPHP = isXml ? options.allowPHPinXML : options.allowPHPinHTML;
const bool isMako = options.isMako;
const bool isDjango = options.isDjango;
const bool allowASP = (isXml ? options.allowASPinXML : options.allowASPinHTML) && !isMako && !isDjango;
const CharacterSet setHTMLWord(CharacterSet::setAlphaNum, ".-_:!#", true);
const CharacterSet setTagContinue(CharacterSet::setAlphaNum, ".-_:!#[", true);
const CharacterSet setAttributeContinue(CharacterSet::setAlphaNum, ".-_:!#/", true);
// TODO: also handle + and - (except if they're part of ++ or --) and return keywords
const CharacterSet setOKBeforeJSRE(CharacterSet::setNone, "([{=,:;!%^&*|?~");
const CharacterSet setOKBeforeJSRE(CharacterSet::setNone, "([{=,:;!%^&*|?~> ");
// Only allow [A-Za-z0-9.#-_:] in entities
const CharacterSet setEntity(CharacterSet::setAlphaNum, ".#-_:");

Expand Down Expand Up @@ -1447,13 +1491,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int

/////////////////////////////////////
// handle the start of PHP pre-processor = Non-HTML
else if ((state != SCE_H_ASPAT) &&
!isPHPStringState(state) &&
(state != SCE_HPHP_COMMENT) &&
(state != SCE_HPHP_COMMENTLINE) &&
(ch == '<') &&
(chNext == '?') &&
!IsScriptCommentState(state)) {
else if ((ch == '<') && (chNext == '?') && IsPHPEntryState(state) && IsPHPStart(allowPHP, styler, i)) {
beforeLanguage = scriptLanguage;
scriptLanguage = segIsScriptingIndicator(styler, i + 2, i + 6, isXml ? eScriptXML : eScriptPHP);
if ((scriptLanguage != eScriptPHP) && (isStringState(state) || (state==SCE_H_COMMENT))) continue;
Expand Down Expand Up @@ -1579,7 +1617,7 @@ void SCI_METHOD LexerHTML::Lex(Sci_PositionU startPos, Sci_Position length, int
}

// handle the start of ASP pre-processor = Non-HTML
else if (!isMako && !isDjango && !isCommentASPState(state) && (ch == '<') && (chNext == '%') && !isPHPStringState(state)) {
else if ((ch == '<') && (chNext == '%') && allowASP && !isCommentASPState(state) && !isPHPStringState(state)) {
styler.ColourTo(i - 1, StateToPrint);
beforePreProc = state;
if (inScriptType == eNonHtmlScript)
Expand Down
Loading

0 comments on commit d8c6350

Please sign in to comment.