aboutsummaryrefslogtreecommitdiffhomepage
diff options
context:
space:
mode:
authorThomas Linder Puls <devnull@localhost>2016-01-09 14:30:17 +1100
committerThomas Linder Puls <devnull@localhost>2016-01-09 14:30:17 +1100
commit6a9e8073585400f4dbed2b057448b1b26e810224 (patch)
treedce64eb0deea4532da8f04c4bcb428b05b81ead0
parent460a98ec04e3125c67503437bd1cdbade79f44c8 (diff)
downloadscintilla-mirror-6a9e8073585400f4dbed2b057448b1b26e810224.tar.gz
Recognize numbers more accurately and allow non-ASCII verbatim quoting
characters.
-rw-r--r--doc/ScintillaHistory.html5
-rw-r--r--lexers/LexVisualProlog.cxx15
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 @@
<a href="http://sourceforge.net/p/scintilla/bugs/1800/">Bug #1800</a>.
</li>
<li>
+ Visual Prolog lexer recognizes numbers more accurately and allows non-ASCII verbatim
+ quoting characters.
+ <a href="http://sourceforge.net/p/scintilla/feature-requests/1130/">Feature #1130.</a>
+ </li>
+ <li>
Send SCN_UPDATEUI with SC_UPDATE_SELECTION when the application changes multiple
selection.
</li>
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;