summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authortagezi <lera.goncharuk@gmail.com>2017-05-26 17:39:35 +0300
committerMike Kaganski <mike.kaganski@collabora.com>2017-05-27 20:00:29 +0200
commit2121ed8c14763c465ed913982b36328c21c313f4 (patch)
tree73f9507eb262e5b6e170de380eda694eb24e1ee5
parent49efc2d00a674e4fa16aa10c19cafbb10e1573ef (diff)
tdf#36541 Wrong syntax highlighting in BASIC IDE
-- and // are not comments in Basic Change-Id: I6cd16f2d19eec280ead7d59a6162cd03ac267474 Reviewed-on: https://gerrit.libreoffice.org/38074 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com> (cherry picked from commit 6dbf9543c6f83d7b1fe7ad27232f65152456619a) Reviewed-on: https://gerrit.libreoffice.org/38089
-rw-r--r--comphelper/source/misc/syntaxhighlight.cxx36
1 files changed, 18 insertions, 18 deletions
diff --git a/comphelper/source/misc/syntaxhighlight.cxx b/comphelper/source/misc/syntaxhighlight.cxx
index bcfdb3f15fa0..f27a993a1c3f 100644
--- a/comphelper/source/misc/syntaxhighlight.cxx
+++ b/comphelper/source/misc/syntaxhighlight.cxx
@@ -395,7 +395,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/
else if ( testCharFlags( c, CharFlags::Operator ) || ( (c == '\'') && (aLanguage==HighlighterLanguage::Basic)) )
{
// parameters for SQL view
- if ( (c==':') || (c=='?'))
+ if (((c==':') || (c=='?')) && (aLanguage == HighlighterLanguage::SQL))
{
if (c!='?')
{
@@ -412,7 +412,7 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/
}
reType = TokenType::Parameter;
}
- else if (c=='-')
+ else if ((c=='-') && (aLanguage == HighlighterLanguage::SQL))
{
sal_Unicode cPeekNext = *pos;
if (cPeekNext=='-')
@@ -426,24 +426,24 @@ bool SyntaxHighlighter::Tokenizer::getNextToken(const sal_Unicode*& pos, /*out*/
reType = TokenType::Comment;
}
}
- else if (c=='/')
- {
- sal_Unicode cPeekNext = *pos;
- if (cPeekNext=='/')
- {
- // Remove all characters until end of line or EOF
- while( cPeekNext != 0 && !testCharFlags( cPeekNext, CharFlags::EOL ) )
- {
- ++pos;
- cPeekNext = *pos;
- }
- reType = TokenType::Comment;
- }
- }
+ else if ((c=='/') && (aLanguage == HighlighterLanguage::SQL))
+ {
+ sal_Unicode cPeekNext = *pos;
+ if (cPeekNext=='/')
+ {
+ // Remove all characters until end of line or EOF
+ while( cPeekNext != 0 && !testCharFlags( cPeekNext, CharFlags::EOL ) )
+ {
+ ++pos;
+ cPeekNext = *pos;
+ }
+ reType = TokenType::Comment;
+ }
+ }
else
{
- // Comment?
- if ( c == '\'' )
+ // Apostrophe is Basic comment
+ if (( c == '\'') && (aLanguage == HighlighterLanguage::Basic))
{
// Skip all characters until end of input or end of line:
for (;;) {