[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: [ktexteditor] src/syntax: syntax: add optional char in LineContinue
From: Michal Humpula <michal.humpula () seznam ! cz>
Date: 2014-02-18 18:56:51
Message-ID: E1WFpqd-0004oo-6r () scm ! kde ! org
[Download RAW message or body]
Git commit 807fda4f7d545d9bc490d809fb717b103bf46970 by Michal Humpula.
Committed on 18/02/2014 at 18:56.
Pushed by michalhumpula into branch 'master'.
syntax: add optional char in LineContinue
M +2 -0 src/syntax/data/language.dtd
M +1 -1 src/syntax/katehighlight.cpp
M +3 -2 src/syntax/katehighlighthelpers.cpp
M +3 -1 src/syntax/katehighlighthelpers.h
http://commits.kde.org/ktexteditor/807fda4f7d545d9bc490d809fb717b103bf46970
diff --git a/src/syntax/data/language.dtd b/src/syntax/data/language.dtd
index a86d51f..8a0b98d 100644
--- a/src/syntax/data/language.dtd
+++ b/src/syntax/data/language.dtd
@@ -432,10 +432,12 @@ TODO
<!-- Detect a line continuation
commonAttributes: Common attributes
+ char: The char marking the end of line [char, optional, \
default='\\']
-->
<!ELEMENT LineContinue EMPTY>
<!ATTLIST LineContinue
%commonAttributes;
+ char CDATA #IMPLIED
>
<!-- Detect a C-style escaped character
diff --git a/src/syntax/katehighlight.cpp b/src/syntax/katehighlight.cpp
index 05ea70a..3d631f4 100644
--- a/src/syntax/katehighlight.cpp
+++ b/src/syntax/katehighlight.cpp
@@ -1074,7 +1074,7 @@ KateHlItem \
*KateHighlighting::createKateHlItem(KateSyntaxContextData *data, } else if (dataname \
== QLatin1String("RangeDetect")) {
tmpItem = (new KateHlRangeDetect(attr, context, regionId, regionId2, chr, \
chr1)); } else if (dataname == QLatin1String("LineContinue")) {
- tmpItem = (new KateHlLineContinue(attr, context, regionId, regionId2));
+ tmpItem = (new KateHlLineContinue(attr, context, regionId, regionId2, chr));
} else if (dataname == QLatin1String("StringDetect")) {
tmpItem = (new KateHlStringDetect(attr, context, regionId, regionId2, \
stringdata, insensitive)); } else if (dataname == QLatin1String("WordDetect")) {
diff --git a/src/syntax/katehighlighthelpers.cpp \
b/src/syntax/katehighlighthelpers.cpp index bf3ed5e..8394d11 100644
--- a/src/syntax/katehighlighthelpers.cpp
+++ b/src/syntax/katehighlighthelpers.cpp
@@ -677,14 +677,15 @@ KateHlItem *KateHlRegExpr::clone(const QStringList *args)
// //END
//BEGIN KateHlLineContinue
-KateHlLineContinue::KateHlLineContinue(int attribute, KateHlContextModification \
context, signed char regionId, signed char regionId2) \
+KateHlLineContinue::KateHlLineContinue(int attribute, KateHlContextModification \
context, signed char regionId, signed char regionId2, QChar c) : \
KateHlItem(attribute, context, regionId, regionId2) + , m_trailer(c.isNull() ? \
QLatin1Char('\\') : c) {
}
int KateHlLineContinue::checkHgl(const QString &text, int offset, int len)
{
- if ((len == 1) && (text[offset] == QLatin1Char('\\'))) {
+ if ((len == 1) && (text[offset] == m_trailer)) {
return ++offset;
}
diff --git a/src/syntax/katehighlighthelpers.h b/src/syntax/katehighlighthelpers.h
index 9e39212..633af4e 100644
--- a/src/syntax/katehighlighthelpers.h
+++ b/src/syntax/katehighlighthelpers.h
@@ -250,7 +250,7 @@ public:
class KateHlLineContinue : public KateHlItem
{
public:
- KateHlLineContinue(int attribute, KateHlContextModification context, signed char \
regionId, signed char regionId2); + KateHlLineContinue(int attribute, \
KateHlContextModification context, signed char regionId, signed char regionId2, QChar \
c);
virtual bool endEnable(QChar c)
{
@@ -261,6 +261,8 @@ public:
{
return true;
}
+private:
+ QChar m_trailer;
};
class KateHlCStringChar : public KateHlItem
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic