From 6a9e8073585400f4dbed2b057448b1b26e810224 Mon Sep 17 00:00:00 2001 From: Thomas Linder Puls Date: Sat, 9 Jan 2016 14:30:17 +1100 Subject: Recognize numbers more accurately and allow non-ASCII verbatim quoting characters. --- doc/ScintillaHistory.html | 5 +++++ lexers/LexVisualProlog.cxx | 15 ++++++++++----- 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/doc/ScintillaHistory.html b/doc/ScintillaHistory.html index fa910eef3..f673ddfe8 100644 --- a/doc/ScintillaHistory.html +++ b/doc/ScintillaHistory.html @@ -544,6 +544,11 @@ Bug #1800.
  • + Visual Prolog lexer recognizes numbers more accurately and allows non-ASCII verbatim + quoting characters. + Feature #1130. +
  • +
  • Send SCN_UPDATEUI with SC_UPDATE_SELECTION when the application changes multiple selection.
  • diff --git a/lexers/LexVisualProlog.cxx b/lexers/LexVisualProlog.cxx index d05413d7b..79b5f5d07 100644 --- a/lexers/LexVisualProlog.cxx +++ b/lexers/LexVisualProlog.cxx @@ -162,6 +162,11 @@ static bool isAlphaNum(int ch){ return (ccLu == cc || ccLl == cc || ccLt == cc || ccLm == cc || ccLo == cc || ccNd == cc || ccNl == cc || ccNo == cc); } +static bool isStringVerbatimOpenClose(int ch){ + CharacterCategory cc = CategoriseCharacter(ch); + return (ccPc <= cc && cc <= ccSo); +} + static bool isIdChar(int ch){ return ('_') == ch || isAlphaNum(ch); } @@ -198,11 +203,11 @@ static bool isOpenStringVerbatim(int next, int &closingQuote){ case L';': return false; default: - if (isAlphaNum(next)) { - return false; - } else { + if (isStringVerbatimOpenClose(next)) { closingQuote = next; return true; + } else { + return false; } } } @@ -247,7 +252,7 @@ static void forwardEscapeLiteral(StyleContext &sc, int EscapeState) { void SCI_METHOD LexerVisualProlog::Lex(Sci_PositionU startPos, Sci_Position length, int initStyle, IDocument *pAccess) { LexAccessor styler(pAccess); CharacterSet setDoxygen(CharacterSet::setAlpha, ""); - CharacterSet setNumber(CharacterSet::setNone, "+-.0123456789abcdefABCDEFxoXO"); + CharacterSet setNumber(CharacterSet::setNone, "0123456789abcdefABCDEFxoXO"); StyleContext sc(startPos, length, initStyle, styler, 0x7f); @@ -273,7 +278,7 @@ void SCI_METHOD LexerVisualProlog::Lex(Sci_PositionU startPos, Sci_Position leng break; case SCE_VISUALPROLOG_NUMBER: // We accept almost anything because of hex. and number suffixes - if (!(setNumber.Contains(sc.ch))) { + if (!(setNumber.Contains(sc.ch)) || (sc.Match('.') && IsADigit(sc.chNext))) { sc.SetState(SCE_VISUALPROLOG_DEFAULT); } break; -- cgit v1.2.3