From 6a036ac8001e1a740fd28323ea22d6acfbd29877 Mon Sep 17 00:00:00 2001 From: Neil Date: Mon, 13 Apr 2020 07:41:08 +1000 Subject: Backport: Replace islower function and add tests for JavaScript regular expressions. Backport of changeset 8143:a5eb440dc1e2. --- cppcheck.suppress | 3 +++ lexers/LexCPP.cxx | 5 ++--- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/cppcheck.suppress b/cppcheck.suppress index 1d351d90b..ac9aad1ac 100644 --- a/cppcheck.suppress +++ b/cppcheck.suppress @@ -197,6 +197,9 @@ constVariable:scintilla/lexers/LexVHDL.cxx // bp.itBracket not actually redundant as needed by return statements redundantAssignment:scintilla/lexers/LexCPP.cxx +// Suppress everything in test example files +*:scintilla/lexilla/test/examples/* + // Suppress everything in catch.hpp as won't be changing *:scintilla/test/unit/catch.hpp // For now, suppress all test source files as, since Catch 2, cppcheck shows many warnings showing diff --git a/lexers/LexCPP.cxx b/lexers/LexCPP.cxx index 2fbbf7151..10e38c661 100644 --- a/lexers/LexCPP.cxx +++ b/lexers/LexCPP.cxx @@ -9,7 +9,6 @@ #include #include #include -#include #include #include @@ -1160,9 +1159,9 @@ void SCI_METHOD LexerCPP::Lex(Sci_PositionU startPos, Sci_Position length, int i case SCE_C_REGEX: if (sc.atLineStart) { sc.SetState(SCE_C_DEFAULT|activitySet); - } else if (! inRERange && sc.ch == '/') { + } else if (!inRERange && sc.ch == '/') { sc.Forward(); - while ((sc.ch < 0x80) && islower(sc.ch)) + while (IsLowerCase(sc.ch)) sc.Forward(); // gobble regex flags sc.SetState(SCE_C_DEFAULT|activitySet); } else if (sc.ch == '\\' && ((sc.currentPos+1) < lineEndNext)) { -- cgit v1.2.3